--- ata-chipset.c 2008-07-23 21:10:54.700145967 -0500 +++ ata-chipset.c.k2 2008-07-23 21:10:49.431251177 -0500 @@ -50,6 +50,12 @@ #include #include +#ifdef __powerpc__ +#include +#include +#include +#endif + /* local prototypes */ /* ata-chipset.c */ static int ata_generic_chipinit(device_t dev); @@ -4687,6 +4693,29 @@ { struct ata_pci_controller *ctlr = device_get_softc(dev); +#ifdef __powerpc__ + /* + * The K2 controller in Apple G5s does not have its interrupt property + * set, and does not accept writes to PCI config space like most other + * devices. Solve with sledgehammer. + */ + + int status; + u_long startp, countp; + + status = bus_get_resource(dev, SYS_RES_IRQ, 0, &startp, &countp); + if (status == ENOENT) { + int irq; + phandle_t node; + + node = ofw_pci_find_node(dev); + OF_getprop(node, "interrupts", &irq, sizeof(irq)); + + bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); + } +#endif + + if (ata_setup_interrupt(dev)) return ENXIO;