- Timestamp:
- 12/24/11 01:00:32 (5 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
-
ich_descriptors.c (modified) (4 diffs)
-
ich_descriptors.h (modified) (3 diffs)
-
programmer.h (modified) (2 diffs)
-
util/ich_descriptors_tool (added)
-
util/ich_descriptors_tool/Makefile (added)
-
util/ich_descriptors_tool/TODO (added)
-
util/ich_descriptors_tool/ich_descriptors_tool.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ich_descriptors.c
r1452 r1480 23 23 24 24 #include "ich_descriptors.h" 25 26 #ifdef ICH_DESCRIPTORS_FROM_DUMP 27 28 #include <stdio.h> 29 #define print(t, ...) printf(__VA_ARGS__) 30 #define DESCRIPTOR_MODE_SIGNATURE 0x0ff0a55a 31 /* The upper map is located in the word before the 256B-long OEM section at the 32 * end of the 4kB-long flash descriptor. 33 */ 34 #define UPPER_MAP_OFFSET (4096 - 256 - 4) 35 #define getVTBA(flumap) (((flumap)->FLUMAP1 << 4) & 0x00000ff0) 36 37 #else /* ICH_DESCRIPTORS_FROM_DUMP */ 38 25 39 #include "flash.h" /* for msg_* */ 26 40 #include "programmer.h" 41 42 #endif /* ICH_DESCRIPTORS_FROM_DUMP */ 43 44 #ifndef min 45 #define min(a, b) (a < b) ? a : b 46 #endif 27 47 28 48 void prettyprint_ich_reg_vscc(uint32_t reg_val, int verbosity) … … 48 68 prettyprint_ich_descriptor_region(desc); 49 69 prettyprint_ich_descriptor_master(&desc->master); 70 #ifdef ICH_DESCRIPTORS_FROM_DUMP 71 if (cs >= CHIPSET_ICH8) { 72 prettyprint_ich_descriptor_upper_map(&desc->upper); 73 prettyprint_ich_descriptor_straps(cs, desc); 74 } 75 #endif /* ICH_DESCRIPTORS_FROM_DUMP */ 50 76 } 51 77 … … 214 240 } 215 241 242 #ifdef ICH_DESCRIPTORS_FROM_DUMP 243 244 void prettyprint_ich_descriptor_straps_ich8(const struct ich_descriptors *desc) 245 { 246 static const char * const str_GPIO12[4] = { 247 "GPIO12", 248 "LAN PHY Power Control Function (Native Output)", 249 "GLAN_DOCK# (Native Input)", 250 "invalid configuration", 251 }; 252 253 msg_pdbg2("--- MCH details ---\n"); 254 msg_pdbg2("ME B is %sabled.\n", desc->north.ich8.MDB ? "dis" : "en"); 255 msg_pdbg2("\n"); 256 257 msg_pdbg2("--- ICH details ---\n"); 258 msg_pdbg2("ME SMBus Address 1: 0x%02x\n", desc->south.ich8.ASD); 259 msg_pdbg2("ME SMBus Address 2: 0x%02x\n", desc->south.ich8.ASD2); 260 msg_pdbg2("ME SMBus Controller is connected to the %s.\n", 261 desc->south.ich8.MESM2SEL ? "SMLink pins" : "SMBus pins"); 262 msg_pdbg2("SPI CS1 is used for %s.\n", 263 desc->south.ich8.SPICS1_LANPHYPC_SEL ? 264 "LAN PHY Power Control Function" : 265 "SPI Chip Select"); 266 msg_pdbg2("GPIO12 is used as %s.\n", 267 str_GPIO12[desc->south.ich8.GPIO12_SEL]); 268 msg_pdbg2("PCIe Port 6 is used for %s.\n", 269 desc->south.ich8.GLAN_PCIE_SEL ? "integrated LAN" : "PCI Express"); 270 msg_pdbg2("%sn BMC Mode: " 271 "Intel AMT SMBus Controller 1 is connected to %s.\n", 272 desc->south.ich8.BMCMODE ? "I" : "Not i", 273 desc->south.ich8.BMCMODE ? "SMLink" : "SMBus"); 274 msg_pdbg2("TCO is in %s Mode.\n", 275 desc->south.ich8.TCOMODE ? "Advanced TCO" : "Legacy/Compatible"); 276 msg_pdbg2("ME A is %sabled.\n", 277 desc->south.ich8.ME_DISABLE ? "dis" : "en"); 278 msg_pdbg2("\n"); 279 } 280 281 static void prettyprint_ich_descriptor_straps_56_pciecs(uint8_t conf, uint8_t off) 282 { 283 msg_pdbg2("PCI Express Port Configuration Strap %d: ", off+1); 284 285 off *= 4; 286 switch(conf){ 287 case 0: 288 msg_pdbg2("4x1 Ports %d-%d (x1)", 1+off, 4+off); 289 break; 290 case 1: 291 msg_pdbg2("1x2, 2x1 Port %d (x2), Port %d (disabled), " 292 "Ports %d, %d (x1)", 1+off, 2+off, 3+off, 4+off); 293 break; 294 case 2: 295 msg_pdbg2("2x2 Port %d (x2), Port %d (x2), Ports " 296 "%d, %d (disabled)", 1+off, 3+off, 2+off, 4+off); 297 break; 298 case 3: 299 msg_pdbg2("1x4 Port %d (x4), Ports %d-%d (disabled)", 300 1+off, 2+off, 4+off); 301 break; 302 } 303 msg_pdbg2("\n"); 304 } 305 306 void prettyprint_ich_descriptor_pchstraps45678_56(const struct ich_desc_south_strap *s) 307 { 308 /* PCHSTRP4 */ 309 msg_pdbg2("Intel PHY is %s.\n", 310 (s->ibex.PHYCON == 2) ? "connected" : 311 (s->ibex.PHYCON == 0) ? "disconnected" : "reserved"); 312 msg_pdbg2("GbE MAC SMBus address is %sabled.\n", 313 s->ibex.GBEMAC_SMBUS_ADDR_EN ? "en" : "dis"); 314 msg_pdbg2("GbE MAC SMBus address: 0x%02x\n", 315 s->ibex.GBEMAC_SMBUS_ADDR); 316 msg_pdbg2("GbE PHY SMBus address: 0x%02x\n", 317 s->ibex.GBEPHY_SMBUS_ADDR); 318 319 /* PCHSTRP5 */ 320 /* PCHSTRP6 */ 321 /* PCHSTRP7 */ 322 msg_pdbg2("Intel ME SMBus Subsystem Vendor ID: 0x%04x\n", 323 s->ibex.MESMA2UDID_VENDOR); 324 msg_pdbg2("Intel ME SMBus Subsystem Device ID: 0x%04x\n", 325 s->ibex.MESMA2UDID_VENDOR); 326 327 /* PCHSTRP8 */ 328 } 329 330 void prettyprint_ich_descriptor_pchstraps111213_56(const struct ich_desc_south_strap *s) 331 { 332 /* PCHSTRP11 */ 333 msg_pdbg2("SMLink1 GP Address is %sabled.\n", 334 s->ibex.SML1GPAEN ? "en" : "dis"); 335 msg_pdbg2("SMLink1 controller General Purpose Target address: 0x%02x\n", 336 s->ibex.SML1GPA); 337 msg_pdbg2("SMLink1 I2C Target address is %sabled.\n", 338 s->ibex.SML1I2CAEN ? "en" : "dis"); 339 msg_pdbg2("SMLink1 I2C Target address: 0x%02x\n", 340 s->ibex.SML1I2CA); 341 342 /* PCHSTRP12 */ 343 /* PCHSTRP13 */ 344 } 345 346 void prettyprint_ich_descriptor_straps_ibex(const struct ich_desc_south_strap *s) 347 { 348 static const uint8_t const dec_t209min[4] = { 349 100, 350 50, 351 5, 352 1 353 }; 354 355 msg_pdbg2("--- PCH ---\n"); 356 357 /* PCHSTRP0 */ 358 msg_pdbg2("Chipset configuration Softstrap 2: %d\n", s->ibex.cs_ss2); 359 msg_pdbg2("Intel ME SMBus Select is %sabled.\n", 360 s->ibex.SMB_EN ? "en" : "dis"); 361 msg_pdbg2("SMLink0 segment is %sabled.\n", 362 s->ibex.SML0_EN ? "en" : "dis"); 363 msg_pdbg2("SMLink1 segment is %sabled.\n", 364 s->ibex.SML1_EN ? "en" : "dis"); 365 msg_pdbg2("SMLink1 Frequency: %s\n", 366 (s->ibex.SML1FRQ == 1) ? "100 kHz" : "reserved"); 367 msg_pdbg2("Intel ME SMBus Frequency: %s\n", 368 (s->ibex.SMB0FRQ == 1) ? "100 kHz" : "reserved"); 369 msg_pdbg2("SMLink0 Frequency: %s\n", 370 (s->ibex.SML0FRQ == 1) ? "100 kHz" : "reserved"); 371 msg_pdbg2("GPIO12 is used as %s.\n", s->ibex.LANPHYPC_GP12_SEL ? 372 "LAN_PHY_PWR_CTRL" : "general purpose output"); 373 msg_pdbg2("Chipset configuration Softstrap 1: %d\n", s->ibex.cs_ss1); 374 msg_pdbg2("DMI RequesterID Checks are %sabled.\n", 375 s->ibex.DMI_REQID_DIS ? "en" : "dis"); 376 msg_pdbg2("BIOS Boot-Block size (BBBS): %d kB.\n", 377 1 << (6 + s->ibex.BBBS)); 378 379 /* PCHSTRP1 */ 380 msg_pdbg2("Chipset configuration Softstrap 3: 0x%x\n", s->ibex.cs_ss3); 381 382 /* PCHSTRP2 */ 383 msg_pdbg2("ME SMBus ASD address is %sabled.\n", 384 s->ibex.MESMASDEN ? "en" : "dis"); 385 msg_pdbg2("ME SMBus Controller ASD Target address: 0x%02x\n", 386 s->ibex.MESMASDA); 387 msg_pdbg2("ME SMBus I2C address is %sabled.\n", 388 s->ibex.MESMI2CEN ? "en" : "dis"); 389 msg_pdbg2("ME SMBus I2C target address: 0x%02x\n", 390 s->ibex.MESMI2CA); 391 392 /* PCHSTRP3 */ 393 prettyprint_ich_descriptor_pchstraps45678_56(s); 394 /* PCHSTRP9 */ 395 prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 0); 396 prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 1); 397 msg_pdbg2("PCIe Lane Reversal 1: PCIe Lanes 0-3 are %sreserved.\n", 398 s->ibex.PCIELR1 ? "" : "not "); 399 msg_pdbg2("PCIe Lane Reversal 2: PCIe Lanes 4-7 are %sreserved.\n", 400 s->ibex.PCIELR2 ? "" : "not "); 401 msg_pdbg2("DMI Lane Reversal: DMI Lanes 0-3 are %sreserved.\n", 402 s->ibex.DMILR ? "" : "not "); 403 msg_pdbg2("Default PHY PCIe Port is %d.\n", s->ibex.PHY_PCIEPORTSEL+1); 404 msg_pdbg2("Integrated MAC/PHY communication over PCIe is %sabled.\n", 405 s->ibex.PHY_PCIE_EN ? "en" : "dis"); 406 407 /* PCHSTRP10 */ 408 msg_pdbg2("Management Engine will boot from %sflash.\n", 409 s->ibex.ME_BOOT_FLASH ? "" : "ROM, then "); 410 msg_pdbg2("Chipset configuration Softstrap 5: %d\n", s->ibex.cs_ss5); 411 msg_pdbg2("Virtualization Engine Enable 1 is %sabled.\n", 412 s->ibex.VE_EN ? "en" : "dis"); 413 msg_pdbg2("ME Memory-attached Debug Display Device is %sabled.\n", 414 s->ibex.MMDDE ? "en" : "dis"); 415 msg_pdbg2("ME Memory-attached Debug Display Device address: 0x%02x\n", 416 s->ibex.MMADDR); 417 msg_pdbg2("Chipset configuration Softstrap 7: %d\n", s->ibex.cs_ss7); 418 msg_pdbg2("Integrated Clocking Configuration is %d.\n", 419 (s->ibex.ICC_SEL == 7) ? 0 : s->ibex.ICC_SEL); 420 msg_pdbg2("PCH Signal CL_RST1# does %sassert when Intel ME performs a " 421 "reset.\n", s->ibex.MER_CL1 ? "" : "not "); 422 423 prettyprint_ich_descriptor_pchstraps111213_56(s); 424 425 /* PCHSTRP14 */ 426 msg_pdbg2("Virtualization Engine Enable 2 is %sabled.\n", 427 s->ibex.VE_EN2 ? "en" : "dis"); 428 msg_pdbg2("Virtualization Engine will boot from %sflash.\n", 429 s->ibex.VE_BOOT_FLASH ? "" : "ROM, then "); 430 msg_pdbg2("Braidwood SSD functionality is %sabled.\n", 431 s->ibex.BW_SSD ? "en" : "dis"); 432 msg_pdbg2("Braidwood NVMHCI functionality is %sabled.\n", 433 s->ibex.NVMHCI_EN ? "en" : "dis"); 434 435 /* PCHSTRP15 */ 436 msg_pdbg2("Chipset configuration Softstrap 6: %d\n", s->ibex.cs_ss6); 437 msg_pdbg2("Integrated wired LAN Solution is %sabled.\n", 438 s->ibex.IWL_EN ? "en" : "dis"); 439 msg_pdbg2("t209 min Timing: %d ms\n", 440 dec_t209min[s->ibex.t209min]); 441 msg_pdbg2("\n"); 442 } 443 444 void prettyprint_ich_descriptor_straps_cougar(const struct ich_desc_south_strap *s) 445 { 446 msg_pdbg2("--- PCH ---\n"); 447 448 /* PCHSTRP0 */ 449 msg_pdbg2("Chipset configuration Softstrap 1: %d\n", s->cougar.cs_ss1); 450 msg_pdbg2("Intel ME SMBus Select is %sabled.\n", 451 s->ibex.SMB_EN ? "en" : "dis"); 452 msg_pdbg2("SMLink0 segment is %sabled.\n", 453 s->ibex.SML0_EN ? "en" : "dis"); 454 msg_pdbg2("SMLink1 segment is %sabled.\n", 455 s->ibex.SML1_EN ? "en" : "dis"); 456 msg_pdbg2("SMLink1 Frequency: %s\n", 457 (s->ibex.SML1FRQ == 1) ? "100 kHz" : "reserved"); 458 msg_pdbg2("Intel ME SMBus Frequency: %s\n", 459 (s->ibex.SMB0FRQ == 1) ? "100 kHz" : "reserved"); 460 msg_pdbg2("SMLink0 Frequency: %s\n", 461 (s->ibex.SML0FRQ == 1) ? "100 kHz" : "reserved"); 462 msg_pdbg2("GPIO12 is used as %s.\n", s->ibex.LANPHYPC_GP12_SEL ? 463 "LAN_PHY_PWR_CTRL" : "general purpose output"); 464 msg_pdbg2("LinkSec is %sabled.\n", 465 s->cougar.LINKSEC_DIS ? "en" : "dis"); 466 msg_pdbg2("DMI RequesterID Checks are %sabled.\n", 467 s->ibex.DMI_REQID_DIS ? "en" : "dis"); 468 msg_pdbg2("BIOS Boot-Block size (BBBS): %d kB.\n", 469 1 << (6 + s->ibex.BBBS)); 470 471 /* PCHSTRP1 */ 472 msg_pdbg2("Chipset configuration Softstrap 3: 0x%x\n", s->ibex.cs_ss3); 473 msg_pdbg2("Chipset configuration Softstrap 2: 0x%x\n", s->ibex.cs_ss2); 474 475 /* PCHSTRP2 */ 476 msg_pdbg2("ME SMBus ASD address is %sabled.\n", 477 s->ibex.MESMASDEN ? "en" : "dis"); 478 msg_pdbg2("ME SMBus Controller ASD Target address: 0x%02x\n", 479 s->ibex.MESMASDA); 480 msg_pdbg2("ME SMBus MCTP Address is %sabled.\n", 481 s->cougar.MESMMCTPAEN ? "en" : "dis"); 482 msg_pdbg2("ME SMBus MCTP target address: 0x%02x\n", 483 s->cougar.MESMMCTPA); 484 msg_pdbg2("ME SMBus I2C address is %sabled.\n", 485 s->ibex.MESMI2CEN ? "en" : "dis"); 486 msg_pdbg2("ME SMBus I2C target address: 0x%02x\n", 487 s->ibex.MESMI2CA); 488 489 /* PCHSTRP3 */ 490 prettyprint_ich_descriptor_pchstraps45678_56(s); 491 /* PCHSTRP9 */ 492 prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 0); 493 prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 1); 494 msg_pdbg2("PCIe Lane Reversal 1: PCIe Lanes 0-3 are %sreserved.\n", 495 s->ibex.PCIELR1 ? "" : "not "); 496 msg_pdbg2("PCIe Lane Reversal 2: PCIe Lanes 4-7 are %sreserved.\n", 497 s->ibex.PCIELR2 ? "" : "not "); 498 msg_pdbg2("DMI Lane Reversal: DMI Lanes 0-3 are %sreserved.\n", 499 s->ibex.DMILR ? "" : "not "); 500 msg_pdbg2("ME Debug status writes over SMBUS are %sabled.\n", 501 s->cougar.MDSMBE_EN ? "en" : "dis"); 502 msg_pdbg2("ME Debug SMBus Emergency Mode address: 0x%02x (raw)\n", 503 s->cougar.MDSMBE_ADD); 504 msg_pdbg2("Default PHY PCIe Port is %d.\n", s->ibex.PHY_PCIEPORTSEL+1); 505 msg_pdbg2("Integrated MAC/PHY communication over PCIe is %sabled.\n", 506 s->ibex.PHY_PCIE_EN ? "en" : "dis"); 507 msg_pdbg2("PCIe ports Subtractive Decode Agent is %sabled.\n", 508 s->cougar.SUB_DECODE_EN ? "en" : "dis"); 509 msg_pdbg2("GPIO74 is used as %s.\n", s->cougar.PCHHOT_SML1ALERT_SEL ? 510 "PCHHOT#" : "SML1ALERT#"); 511 512 /* PCHSTRP10 */ 513 msg_pdbg2("Management Engine will boot from %sflash.\n", 514 s->ibex.ME_BOOT_FLASH ? "" : "ROM, then "); 515 516 msg_pdbg2("ME Debug SMBus Emergency Mode is %sabled.\n", 517 s->cougar.MDSMBE_EN ? "en" : "dis"); 518 msg_pdbg2("ME Debug SMBus Emergency Mode Address: 0x%02x\n", 519 s->cougar.MDSMBE_ADD); 520 521 msg_pdbg2("Integrated Clocking Configuration used: %d\n", 522 s->cougar.ICC_SEL); 523 msg_pdbg2("PCH Signal CL_RST1# does %sassert when Intel ME performs a " 524 "reset.\n", s->ibex.MER_CL1 ? "" : "not "); 525 msg_pdbg2("ICC Profile is selected by %s.\n", 526 s->cougar.ICC_PRO_SEL ? "Softstraps" : "BIOS"); 527 msg_pdbg2("Deep SX is %ssupported on the platform.\n", 528 s->cougar.Deep_SX_EN ? "not " : ""); 529 msg_pdbg2("ME Debug LAN Emergency Mode is %sabled.\n", 530 s->cougar.ME_DBG_LAN ? "en" : "dis"); 531 532 prettyprint_ich_descriptor_pchstraps111213_56(s); 533 534 /* PCHSTRP14 */ 535 /* PCHSTRP15 */ 536 msg_pdbg2("Chipset configuration Softstrap 6: %d\n", s->cougar.cs_ss6); 537 msg_pdbg2("Integrated wired LAN is %sabled.\n", 538 s->cougar.IWL_EN ? "en" : "dis"); 539 msg_pdbg2("Chipset configuration Softstrap 5: %d\n", s->cougar.cs_ss5); 540 msg_pdbg2("SMLink1 provides temperature from %s.\n", 541 s->cougar.SMLINK1_THERM_SEL ? 542 "PCH only" : "the CPU, PCH and DIMMs"); 543 msg_pdbg2("GPIO29 is used as %s.\n", s->cougar.SLP_LAN_GP29_SEL ? 544 "general purpose output" : "SLP_LAN#"); 545 546 /* PCHSTRP16 */ 547 /* PCHSTRP17 */ 548 msg_pdbg2("Integrated Clock: %s Clock Mode\n", 549 s->cougar.ICML ? "Buffered Through" : "Full Integrated"); 550 msg_pdbg2("\n"); 551 } 552 553 void prettyprint_ich_descriptor_straps(enum ich_chipset cs, const struct ich_descriptors *desc) 554 { 555 unsigned int i, max; 556 msg_pdbg2("=== Softstraps ===\n"); 557 558 if (sizeof(desc->north.STRPs) / 4 + 1 < desc->content.MSL) { 559 max = sizeof(desc->north.STRPs) / 4 + 1; 560 msg_pdbg2("MSL (%u) is greater than the current maximum of %u " 561 "entries.\n", desc->content.MSL, max + 1); 562 msg_pdbg2("Only the first %u entries will be printed.\n", max); 563 } else 564 max = desc->content.MSL; 565 566 msg_pdbg2("--- North/MCH/PROC (%d entries) ---\n", max); 567 for (i = 0; i < max; i++) 568 msg_pdbg2("STRP%-2d = 0x%08x\n", i, desc->north.STRPs[i]); 569 msg_pdbg2("\n"); 570 571 if (sizeof(desc->south.STRPs) / 4 < desc->content.ISL) { 572 max = sizeof(desc->south.STRPs) / 4; 573 msg_pdbg2("ISL (%u) is greater than the current maximum of %u " 574 "entries.\n", desc->content.ISL, max); 575 msg_pdbg2("Only the first %u entries will be printed.\n", max); 576 } else 577 max = desc->content.ISL; 578 579 msg_pdbg2("--- South/ICH/PCH (%d entries) ---\n", max); 580 for (i = 0; i < max; i++) 581 msg_pdbg2("STRP%-2d = 0x%08x\n", i, desc->south.STRPs[i]); 582 msg_pdbg2("\n"); 583 584 switch (cs) { 585 case CHIPSET_ICH8: 586 if (sizeof(desc->north.ich8) / 4 != desc->content.MSL) 587 msg_pdbg2("Detailed North/MCH/PROC information is " 588 "probably not reliable, printing anyway.\n"); 589 if (sizeof(desc->south.ich8) / 4 != desc->content.ISL) 590 msg_pdbg2("Detailed South/ICH/PCH information is " 591 "probably not reliable, printing anyway.\n"); 592 prettyprint_ich_descriptor_straps_ich8(desc); 593 break; 594 case CHIPSET_5_SERIES_IBEX_PEAK: 595 /* PCH straps only. PROCSTRPs are unknown. */ 596 if (sizeof(desc->south.ibex) / 4 != desc->content.ISL) 597 msg_pdbg2("Detailed South/ICH/PCH information is " 598 "probably not reliable, printing anyway.\n"); 599 prettyprint_ich_descriptor_straps_ibex(&desc->south); 600 break; 601 case CHIPSET_6_SERIES_COUGAR_POINT: 602 /* PCH straps only. PROCSTRP0 is "reserved". */ 603 if (sizeof(desc->south.cougar) / 4 != desc->content.ISL) 604 msg_pdbg2("Detailed South/ICH/PCH information is " 605 "probably not reliable, printing anyway.\n"); 606 prettyprint_ich_descriptor_straps_cougar(&desc->south); 607 break; 608 case CHIPSET_ICH_UNKNOWN: 609 break; 610 default: 611 msg_pdbg2("The meaning of the descriptor straps are unknown " 612 "yet.\n\n"); 613 break; 614 } 615 } 616 617 void prettyprint_rdid(uint32_t reg_val) 618 { 619 uint8_t mid = reg_val & 0xFF; 620 uint16_t did = ((reg_val >> 16) & 0xFF) | (reg_val & 0xFF00); 621 msg_pdbg2("Manufacturer ID 0x%02x, Device ID 0x%04x\n", mid, did); 622 } 623 624 void prettyprint_ich_descriptor_upper_map(const struct ich_desc_upper_map *umap) 625 { 626 int i; 627 msg_pdbg2("=== Upper Map Section ===\n"); 628 msg_pdbg2("FLUMAP1 0x%08x\n", umap->FLUMAP1); 629 msg_pdbg2("\n"); 630 631 msg_pdbg2("--- Details ---\n"); 632 msg_pdbg2("VTL (length in DWORDS) = %d\n", umap->VTL); 633 msg_pdbg2("VTBA (base address) = 0x%6.6x\n", getVTBA(umap)); 634 msg_pdbg2("\n"); 635 636 msg_pdbg2("VSCC Table: %d entries\n", umap->VTL/2); 637 for (i = 0; i < umap->VTL/2; i++) 638 { 639 uint32_t jid = umap->vscc_table[i].JID; 640 uint32_t vscc = umap->vscc_table[i].VSCC; 641 msg_pdbg2(" JID%d = 0x%08x\n", i, jid); 642 msg_pdbg2(" VSCC%d = 0x%08x\n", i, vscc); 643 msg_pdbg2(" "); /* indention */ 644 prettyprint_rdid(jid); 645 msg_pdbg2(" "); /* indention */ 646 prettyprint_ich_reg_vscc(vscc, 0); 647 } 648 msg_pdbg2("\n"); 649 } 650 651 /* len is the length of dump in bytes */ 652 int read_ich_descriptors_from_dump(const uint32_t *dump, unsigned int len, struct ich_descriptors *desc) 653 { 654 unsigned int i, max; 655 uint8_t pch_bug_offset = 0; 656 657 if (dump == NULL || desc == NULL) 658 return ICH_RET_PARAM; 659 660 if (dump[0] != DESCRIPTOR_MODE_SIGNATURE) { 661 if (dump[4] == DESCRIPTOR_MODE_SIGNATURE) 662 pch_bug_offset = 4; 663 else 664 return ICH_RET_ERR; 665 } 666 667 /* map */ 668 if (len < (4 + pch_bug_offset) * 4 - 1) 669 return ICH_RET_OOB; 670 desc->content.FLVALSIG = dump[0 + pch_bug_offset]; 671 desc->content.FLMAP0 = dump[1 + pch_bug_offset]; 672 desc->content.FLMAP1 = dump[2 + pch_bug_offset]; 673 desc->content.FLMAP2 = dump[3 + pch_bug_offset]; 674 675 /* component */ 676 if (len < (getFCBA(&desc->content) + 3 * 4 - 1)) 677 return ICH_RET_OOB; 678 desc->component.FLCOMP = dump[(getFCBA(&desc->content) >> 2) + 0]; 679 desc->component.FLILL = dump[(getFCBA(&desc->content) >> 2) + 1]; 680 desc->component.FLPB = dump[(getFCBA(&desc->content) >> 2) + 2]; 681 682 /* region */ 683 if (len < (getFRBA(&desc->content) + 5 * 4 - 1)) 684 return ICH_RET_OOB; 685 desc->region.FLREGs[0] = dump[(getFRBA(&desc->content) >> 2) + 0]; 686 desc->region.FLREGs[1] = dump[(getFRBA(&desc->content) >> 2) + 1]; 687 desc->region.FLREGs[2] = dump[(getFRBA(&desc->content) >> 2) + 2]; 688 desc->region.FLREGs[3] = dump[(getFRBA(&desc->content) >> 2) + 3]; 689 desc->region.FLREGs[4] = dump[(getFRBA(&desc->content) >> 2) + 4]; 690 691 /* master */ 692 if (len < (getFMBA(&desc->content) + 3 * 4 - 1)) 693 return ICH_RET_OOB; 694 desc->master.FLMSTR1 = dump[(getFMBA(&desc->content) >> 2) + 0]; 695 desc->master.FLMSTR2 = dump[(getFMBA(&desc->content) >> 2) + 1]; 696 desc->master.FLMSTR3 = dump[(getFMBA(&desc->content) >> 2) + 2]; 697 698 /* upper map */ 699 desc->upper.FLUMAP1 = dump[(UPPER_MAP_OFFSET >> 2) + 0]; 700 701 /* VTL is 8 bits long. Quote from the Ibex Peak SPI programming guide: 702 * "Identifies the 1s based number of DWORDS contained in the VSCC 703 * Table. Each SPI component entry in the table is 2 DWORDS long." So 704 * the maximum of 255 gives us 127.5 SPI components(!?) 8 bytes each. A 705 * check ensures that the maximum offset actually accessed is available. 706 */ 707 if (len < (getVTBA(&desc->upper) + (desc->upper.VTL / 2 * 8) - 1)) 708 return ICH_RET_OOB; 709 710 for (i = 0; i < desc->upper.VTL/2; i++) { 711 desc->upper.vscc_table[i].JID = 712 dump[(getVTBA(&desc->upper) >> 2) + i * 2 + 0]; 713 desc->upper.vscc_table[i].VSCC = 714 dump[(getVTBA(&desc->upper) >> 2) + i * 2 + 1]; 715 } 716 717 /* MCH/PROC (aka. North) straps */ 718 if (len < getFMSBA(&desc->content) + desc->content.MSL * 4) 719 return ICH_RET_OOB; 720 721 /* limit the range to be written */ 722 max = min(sizeof(desc->north.STRPs) / 4, desc->content.MSL); 723 for (i = 0; i < max; i++) 724 desc->north.STRPs[i] = 725 dump[(getFMSBA(&desc->content) >> 2) + i]; 726 727 /* ICH/PCH (aka. South) straps */ 728 if (len < getFISBA(&desc->content) + desc->content.ISL * 4) 729 return ICH_RET_OOB; 730 731 /* limit the range to be written */ 732 max = min(sizeof(desc->south.STRPs) / 4, desc->content.ISL); 733 for (i = 0; i < max; i++) 734 desc->south.STRPs[i] = 735 dump[(getFISBA(&desc->content) >> 2) + i]; 736 737 return ICH_RET_OK; 738 } 739 740 #else /* ICH_DESCRIPTORS_FROM_DUMP */ 741 216 742 /** Returns the integer representation of the component density with index 217 743 idx in bytes or 0 if a correct size can not be determined. */ … … 314 840 return ICH_RET_OK; 315 841 } 842 #endif /* ICH_DESCRIPTORS_FROM_DUMP */ 316 843 #endif /* defined(__i386__) || defined(__x86_64__) */ -
trunk/ich_descriptors.h
r1460 r1480 228 228 }; 229 229 230 #ifdef ICH_DESCRIPTORS_FROM_DUMP 231 struct ich_desc_north_strap { 232 union { 233 uint32_t STRPs[1]; /* current maximum: ich8 */ 234 struct { /* ich8 */ 235 struct { /* STRP2 (in the datasheet) */ 236 uint32_t MDB :1, 237 :31; 238 }; 239 } ich8; 240 }; 241 }; 242 243 struct ich_desc_south_strap { 244 union { 245 uint32_t STRPs[16]; /* current maximum: ibex peak */ 246 struct { /* ich8 */ 247 struct { /* STRP1 */ 248 uint32_t ME_DISABLE :1, 249 :6, 250 TCOMODE :1, 251 ASD :7, 252 BMCMODE :1, 253 :3, 254 GLAN_PCIE_SEL :1, 255 GPIO12_SEL :2, 256 SPICS1_LANPHYPC_SEL :1, 257 MESM2SEL :1, 258 :1, 259 ASD2 :7; 260 }; 261 } ich8; 262 struct { /* ibex peak */ 263 struct { /* STRP0 */ 264 uint32_t :1, 265 cs_ss2 :1, 266 :5, 267 SMB_EN :1, 268 SML0_EN :1, 269 SML1_EN :1, 270 SML1FRQ :2, 271 SMB0FRQ :2, 272 SML0FRQ :2, 273 :4, 274 LANPHYPC_GP12_SEL :1, 275 cs_ss1 :1, 276 :2, 277 DMI_REQID_DIS :1, 278 :4, 279 BBBS :2, 280 :1; 281 }; 282 struct { /* STRP1 */ 283 uint32_t cs_ss3 :4, 284 :28; 285 }; 286 struct { /* STRP2 */ 287 uint32_t :8, 288 MESMASDEN :1, 289 MESMASDA :7, 290 :8, 291 MESMI2CEN :1, 292 MESMI2CA :7; 293 }; 294 struct { /* STRP3 */ 295 uint32_t :32; 296 }; 297 struct { /* STRP4 */ 298 uint32_t PHYCON :2, 299 :6, 300 GBEMAC_SMBUS_ADDR_EN :1, 301 GBEMAC_SMBUS_ADDR :7, 302 :1, 303 GBEPHY_SMBUS_ADDR :7, 304 :8; 305 }; 306 struct { /* STRP5 */ 307 uint32_t :32; 308 }; 309 struct { /* STRP6 */ 310 uint32_t :32; 311 }; 312 struct { /* STRP7 */ 313 uint32_t MESMA2UDID_VENDOR :16, 314 MESMA2UDID_DEVICE :16; 315 }; 316 struct { /* STRP8 */ 317 uint32_t :32; 318 }; 319 struct { /* STRP9 */ 320 uint32_t PCIEPCS1 :2, 321 PCIEPCS2 :2, 322 PCIELR1 :1, 323 PCIELR2 :1, 324 DMILR :1, 325 :1, 326 PHY_PCIEPORTSEL :3, 327 PHY_PCIE_EN :1, 328 :20; 329 }; 330 struct { /* STRP10 */ 331 uint32_t :1, 332 ME_BOOT_FLASH :1, 333 cs_ss5 :1, 334 VE_EN :1, 335 :4, 336 MMDDE :1, 337 MMADDR :7, 338 cs_ss7 :1, 339 :1, 340 ICC_SEL :3, 341 MER_CL1 :1, 342 :10; 343 }; 344 struct { /* STRP11 */ 345 uint32_t SML1GPAEN :1, 346 SML1GPA :7, 347 :16, 348 SML1I2CAEN :1, 349 SML1I2CA :7; 350 }; 351 struct { /* STRP12 */ 352 uint32_t :32; 353 }; 354 struct { /* STRP13 */ 355 uint32_t :32; 356 }; 357 struct { /* STRP14 */ 358 uint32_t :8, 359 VE_EN2 :1, 360 :5, 361 VE_BOOT_FLASH :1, 362 :1, 363 BW_SSD :1, 364 NVMHCI_EN :1, 365 :14; 366 }; 367 struct { /* STRP15 */ 368 uint32_t :3, 369 cs_ss6 :2, 370 :1, 371 IWL_EN :1, 372 :1, 373 t209min :2, 374 :22; 375 }; 376 } ibex; 377 struct { /* cougar point */ 378 struct { /* STRP0 */ 379 uint32_t :1, 380 cs_ss1 :1, 381 :5, 382 SMB_EN :1, 383 SML0_EN :1, 384 SML1_EN :1, 385 SML1FRQ :2, 386 SMB0FRQ :2, 387 SML0FRQ :2, 388 :4, 389 LANPHYPC_GP12_SEL :1, 390 LINKSEC_DIS :1, 391 :2, 392 DMI_REQID_DIS :1, 393 :4, 394 BBBS :2, 395 :1; 396 }; 397 struct { /* STRP1 */ 398 uint32_t cs_ss3 :4, 399 :4, 400 cs_ss2 :1, 401 :28; 402 }; 403 struct { /* STRP2 */ 404 uint32_t :8, 405 MESMASDEN :1, 406 MESMASDA :7, 407 MESMMCTPAEN :1, 408 MESMMCTPA :7, 409 MESMI2CEN :1, 410 MESMI2CA :7; 411 }; 412 struct { /* STRP3 */ 413 uint32_t :32; 414 }; 415 struct { /* STRP4 */ 416 uint32_t PHYCON :2, 417 :6, 418 GBEMAC_SMBUS_ADDR_EN :1, 419 GBEMAC_SMBUS_ADDR :7, 420 :1, 421 GBEPHY_SMBUS_ADDR :7, 422 :8; 423 }; 424 struct { /* STRP5 */ 425 uint32_t :32; 426 }; 427 struct { /* STRP6 */ 428 uint32_t :32; 429 }; 430 struct { /* STRP7 */ 431 uint32_t MESMA2UDID_VENDOR :16, 432 MESMA2UDID_DEVICE :16; 433 }; 434 struct { /* STRP8 */ 435 uint32_t :32; 436 }; 437 struct { /* STRP9 */ 438 uint32_t PCIEPCS1 :2, 439 PCIEPCS2 :2, 440 PCIELR1 :1, 441 PCIELR2 :1, 442 DMILR :1, 443 cs_ss4 :1, 444 PHY_PCIEPORTSEL :3, 445 PHY_PCIE_EN :1, 446 :2, 447 SUB_DECODE_EN :1, 448 :7, 449 PCHHOT_SML1ALERT_SEL :1, 450 :9; 451 }; 452 struct { /* STRP10 */ 453 uint32_t :1, 454 ME_BOOT_FLASH :1, 455 :6, 456 MDSMBE_EN :1, 457 MDSMBE_ADD :7, 458 :2, 459 ICC_SEL :3, 460 MER_CL1 :1, 461 ICC_PRO_SEL :1, 462 Deep_SX_EN :1, 463 ME_DBG_LAN :1, 464 :7; 465 }; 466 struct { /* STRP11 */ 467 uint32_t SML1GPAEN :1, 468 SML1GPA :7, 469 :16, 470 SML1I2CAEN :1, 471 SML1I2CA :7; 472 }; 473 struct { /* STRP12 */ 474 uint32_t :32; 475 }; 476 struct { /* STRP13 */ 477 uint32_t :32; 478 }; 479 struct { /* STRP14 */ 480 uint32_t :32; 481 }; 482 struct { /* STRP15 */ 483 uint32_t cs_ss6 :6, 484 IWL_EN :1, 485 cs_ss5 :2, 486 :4, 487 SMLINK1_THERM_SEL :1, 488 SLP_LAN_GP29_SEL :1, 489 :16; 490 }; 491 struct { /* STRP16 */ 492 uint32_t :32; 493 }; 494 struct { /* STRP17 */ 495 uint32_t ICML :1, 496 cs_ss7 :1, 497 :30; 498 }; 499 } cougar; 500 }; 501 }; 502 503 struct ich_desc_upper_map { 504 union { 505 uint32_t FLUMAP1; /* Flash Upper Map 1 */ 506 struct { 507 uint32_t VTBA :8, /* ME VSCC Table Base Address */ 508 VTL :8, /* ME VSCC Table Length */ 509 :16; 510 }; 511 }; 512 struct { 513 union { /* JEDEC-ID Register */ 514 uint32_t JID; 515 struct { 516 uint32_t vid :8, /* Vendor ID */ 517 cid0 :8, /* Component ID 0 */ 518 cid1 :8, /* Component ID 1 */ 519 :8; 520 }; 521 }; 522 union { /* Vendor Specific Component Capabilities */ 523 uint32_t VSCC; 524 struct { 525 uint32_t ubes :2, /* Upper Block/Sector Erase Size */ 526 uwg :1, /* Upper Write Granularity */ 527 uwsr :1, /* Upper Write Status Required */ 528 uwews :1, /* Upper Write Enable on Write Status */ 529 :3, 530 ueo :8, /* Upper Erase Opcode */ 531 lbes :2, /* Lower Block/Sector Erase Size */ 532 lwg :1, /* Lower Write Granularity */ 533 lwsr :1, /* Lower Write Status Required */ 534 lwews :1, /* Lower Write Enable on Write Status */ 535 :3, 536 leo :16; /* Lower Erase Opcode */ 537 }; 538 }; 539 } vscc_table[128]; 540 }; 541 #endif /* ICH_DESCRIPTORS_FROM_DUMP */ 542 230 543 struct ich_descriptors { 231 544 struct ich_desc_content content; … … 233 546 struct ich_desc_region region; 234 547 struct ich_desc_master master; 235 }; 236 237 void prettyprint_ich_descriptors(enum ich_chipset, const struct ich_descriptors *desc); 548 #ifdef ICH_DESCRIPTORS_FROM_DUMP 549 struct ich_desc_north_strap north; 550 struct ich_desc_south_strap south; 551 struct ich_desc_upper_map upper; 552 #endif /* ICH_DESCRIPTORS_FROM_DUMP */ 553 }; 554 555 void prettyprint_ich_descriptors(enum ich_chipset cs, const struct ich_descriptors *desc); 238 556 239 557 void prettyprint_ich_descriptor_content(const struct ich_desc_content *content); … … 242 560 void prettyprint_ich_descriptor_master(const struct ich_desc_master *master); 243 561 562 #ifdef ICH_DESCRIPTORS_FROM_DUMP 563 564 void prettyprint_ich_descriptor_upper_map(const struct ich_desc_upper_map *umap); 565 void prettyprint_ich_descriptor_straps(enum ich_chipset cs, const struct ich_descriptors *desc); 566 int read_ich_descriptors_from_dump(const uint32_t *dump, unsigned int len, struct ich_descriptors *desc); 567 568 #else /* ICH_DESCRIPTORS_FROM_DUMP */ 569 244 570 int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc); 245 571 int getFCBA_component_density(const struct ich_descriptors *desc, uint8_t idx); 246 572 573 #endif /* ICH_DESCRIPTORS_FROM_DUMP */ 247 574 #endif /* __ICH_DESCRIPTORS_H__ */ 248 575 #endif /* defined(__i386__) || defined(__x86_64__) */ -
trunk/programmer.h
r1475 r1480 528 528 529 529 /* ichspi.c */ 530 #if CONFIG_INTERNAL == 1531 530 enum ich_chipset { 532 531 CHIPSET_ICH_UNKNOWN, … … 540 539 }; 541 540 541 #if CONFIG_INTERNAL == 1 542 542 extern uint32_t ichspi_bbar; 543 543 int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
Note: See TracChangeset
for help on using the changeset viewer.
