summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2002-10-08 18:25:10 +0000
committersos <sos@FreeBSD.org>2002-10-08 18:25:10 +0000
commitbc46f827dc2c6f3fb8fefa8e9d8a1defc36d0fc8 (patch)
treedfa0ca70297149a649c169cc7f10fcbef7db0202 /sys
parent4c2a550344dc273f873c0dddb5e14a7968fd1f66 (diff)
downloadFreeBSD-src-bc46f827dc2c6f3fb8fefa8e9d8a1defc36d0fc8.zip
FreeBSD-src-bc46f827dc2c6f3fb8fefa8e9d8a1defc36d0fc8.tar.gz
Fix for the panic when using a Promise TX2.
The problem is that the code does a check for the granparent of the Promise chip, if this is a bridge of the right type, we have a TX4 on our hands, and need to handle that ones "issues". Now the grandparent check cause subtle bugs in the newbus system, mainly that pci_get_devid doesn't return an error value. This patch works around the issue by using BUS_READ_IVAR() instead.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-pci.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index c57d391..0d1a037 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -256,23 +256,30 @@ ata_pci_match(device_t dev)
return "Promise ATA100 controller";
case 0x4d68105a:
- case 0x6268105a:
- if (pci_get_devid(GRANDPARENT(dev)) == 0x00221011 &&
- pci_get_class(GRANDPARENT(dev)) == PCIC_BRIDGE) {
- static long start = 0, end = 0;
-
- /* we belive we are on a TX4, now do our (simple) magic */
- if (pci_get_slot(dev) == 1) {
- bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &end);
- return "Promise TX4 ATA100 controller (channel 0+1)";
- }
- else if (pci_get_slot(dev) == 2 && start && end) {
- bus_set_resource(dev, SYS_RES_IRQ, 0, start, end);
- start = end = 0;
- return "Promise TX4 ATA100 controller (channel 2+3)";
+ case 0x6268105a:
+ {
+ uintptr_t devid = 0;
+
+ /* test if we are behind the right type of bridge */
+ if (!BUS_READ_IVAR(device_get_parent(GRANDPARENT(dev)),
+ GRANDPARENT(dev), PCI_IVAR_DEVID, &devid) &&
+ devid == 0x00221011 &&
+ pci_get_class(GRANDPARENT(dev)) == PCIC_BRIDGE) {
+ static long start = 0, end = 0;
+
+ /* we belive we are on a TX4, now do our (simple) magic */
+ if (pci_get_slot(dev) == 1) {
+ bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &end);
+ return "Promise TX4 ATA100 controller (channel 0+1)";
+ }
+ else if (pci_get_slot(dev) == 2 && start && end) {
+ bus_set_resource(dev, SYS_RES_IRQ, 0, start, end);
+ start = end = 0;
+ return "Promise TX4 ATA100 controller (channel 2+3)";
+ }
+ else
+ start = end = 0;
}
- else
- start = end = 0;
}
return "Promise TX2 ATA100 controller";
OpenPOWER on IntegriCloud