diff options
-rw-r--r-- | drivers/pci/probe.c | 15 | ||||
-rw-r--r-- | include/uapi/linux/pci_regs.h | 15 |
2 files changed, 23 insertions, 7 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ec909afa90b6..81d06676ce34 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -579,14 +579,16 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
579 | if (pos) { | 579 | if (pos) { |
580 | u16 status; | 580 | u16 status; |
581 | enum pci_bus_speed max; | 581 | enum pci_bus_speed max; |
582 | pci_read_config_word(bridge, pos + 2, &status); | ||
583 | 582 | ||
584 | if (status & 0x8000) { | 583 | pci_read_config_word(bridge, pos + PCI_X_BRIDGE_SSTATUS, |
584 | &status); | ||
585 | |||
586 | if (status & PCI_X_SSTATUS_533MHZ) { | ||
585 | max = PCI_SPEED_133MHz_PCIX_533; | 587 | max = PCI_SPEED_133MHz_PCIX_533; |
586 | } else if (status & 0x4000) { | 588 | } else if (status & PCI_X_SSTATUS_266MHZ) { |
587 | max = PCI_SPEED_133MHz_PCIX_266; | 589 | max = PCI_SPEED_133MHz_PCIX_266; |
588 | } else if (status & 0x0002) { | 590 | } else if (status & PCI_X_SSTATUS_133MHZ) { |
589 | if (((status >> 12) & 0x3) == 2) { | 591 | if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) { |
590 | max = PCI_SPEED_133MHz_PCIX_ECC; | 592 | max = PCI_SPEED_133MHz_PCIX_ECC; |
591 | } else { | 593 | } else { |
592 | max = PCI_SPEED_133MHz_PCIX; | 594 | max = PCI_SPEED_133MHz_PCIX; |
@@ -596,7 +598,8 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
596 | } | 598 | } |
597 | 599 | ||
598 | bus->max_bus_speed = max; | 600 | bus->max_bus_speed = max; |
599 | bus->cur_bus_speed = pcix_bus_speed[(status >> 6) & 0xf]; | 601 | bus->cur_bus_speed = pcix_bus_speed[ |
602 | (status & PCI_X_SSTATUS_FREQ) >> 6]; | ||
600 | 603 | ||
601 | return; | 604 | return; |
602 | } | 605 | } |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 20ae747ddf34..4cca834f9abd 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
@@ -349,7 +349,7 @@ | |||
349 | #define PCI_AF_STATUS_TP 0x01 | 349 | #define PCI_AF_STATUS_TP 0x01 |
350 | #define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ | 350 | #define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ |
351 | 351 | ||
352 | /* PCI-X registers */ | 352 | /* PCI-X registers (Type 0 (non-bridge) devices) */ |
353 | 353 | ||
354 | #define PCI_X_CMD 2 /* Modes & Features */ | 354 | #define PCI_X_CMD 2 /* Modes & Features */ |
355 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ | 355 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ |
@@ -389,6 +389,19 @@ | |||
389 | #define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ | 389 | #define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ |
390 | #define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ | 390 | #define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ |
391 | 391 | ||
392 | /* PCI-X registers (Type 1 (bridge) devices) */ | ||
393 | |||
394 | #define PCI_X_BRIDGE_SSTATUS 2 /* Secondary Status */ | ||
395 | #define PCI_X_SSTATUS_64BIT 0x0001 /* Secondary AD interface is 64 bits */ | ||
396 | #define PCI_X_SSTATUS_133MHZ 0x0002 /* 133 MHz capable */ | ||
397 | #define PCI_X_SSTATUS_FREQ 0x03c0 /* Secondary Bus Mode and Frequency */ | ||
398 | #define PCI_X_SSTATUS_VERS 0x3000 /* PCI-X Capability Version */ | ||
399 | #define PCI_X_SSTATUS_V1 0x1000 /* Mode 2, not Mode 1 */ | ||
400 | #define PCI_X_SSTATUS_V2 0x2000 /* Mode 1 or Modes 1 and 2 */ | ||
401 | #define PCI_X_SSTATUS_266MHZ 0x4000 /* 266 MHz capable */ | ||
402 | #define PCI_X_SSTATUS_533MHZ 0x8000 /* 533 MHz capable */ | ||
403 | #define PCI_X_BRIDGE_STATUS 4 /* Bridge Status */ | ||
404 | |||
392 | /* PCI Bridge Subsystem ID registers */ | 405 | /* PCI Bridge Subsystem ID registers */ |
393 | 406 | ||
394 | #define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ | 407 | #define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ |