Ticket #2005: hp6715b_pci_fixup.diff

File hp6715b_pci_fixup.diff, 2.4 KB (added by euan, 17 years ago)
  • src/add-ons/kernel/bus_managers/pci/pci_fixup.cpp

     
    122122    dprintf("intel_fixup_ahci: 0x90: 0x%02lx\n", pci->ReadPciConfig(domain, bus, device, function, 0x90, 1));
    123123}
    124124
     125/* The HP6715b bios assigns the SB600 audio and sata overlapping pci memory regions.  Thus preventing
     126   correct operation of both devices.  For now we disable audio and zero it's BARs.  Long term solution
     127   will require the device to be remapped
     128*/
     129static void
     130ati_fixup_sb600(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function, uint16 deviceId)
     131{
     132    static uint32 sataBar = 0;
     133    static uint32 audioBar = 0;
    125134
     135    switch (deviceId)
     136    {
     137        case 0x4383: //could add subsystem Id check if really paranoid [103c:30c2]
     138            // Read BAR[0]
     139            audioBar = pci->ReadPciConfig(domain, bus, device, function, PCI_base_registers, 4);
     140            audioBar &= PCI_address_memory_32_mask;
     141            dprintf("Found SB600 HD Audio (Azalia) 0x%08lx\n", audioBar);
     142            break;
     143        case 0x4380:
     144            // Read BAR[5]
     145            sataBar = pci->ReadPciConfig(domain, bus, device, function, PCI_base_registers + (5*4), 4);
     146            sataBar &= PCI_address_memory_32_mask;
     147            dprintf("Found SB600 Sata 0x%08lx\n", sataBar);
     148            break;
     149        default:
     150            return;
     151    }
     152
     153    if (audioBar == 0xD0608000 && sataBar == 0xD0609000)
     154    {   
     155        dprintf("Disabling SB600 audio bar due to overlapping resources (seen on HP6715b laptop)\n");
     156        // turn everything off
     157        pci->WritePciConfig(domain, bus, device, function, PCI_command, 2, 0);
     158        pci->WritePciConfig(domain, bus, device, function, PCI_base_registers + 0, 4, 0); 
     159        pci->WritePciConfig(domain, bus, device, function, PCI_base_registers + 4, 4, 0);
     160        pci->WritePciConfig(domain, bus, device, function, PCI_base_registers + 8, 4, 0);
     161        pci->WritePciConfig(domain, bus, device, function, PCI_base_registers + 12, 4, 0);
     162        pci->WritePciConfig(domain, bus, device, function, PCI_base_registers + 16, 4, 0);
     163    }
     164}
     165
    126166void
    127167pci_fixup_device(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function)
    128168{
     
    139179        case 0x8086:
    140180            intel_fixup_ahci(pci, domain, bus, device, function, deviceId);
    141181            break;
     182
     183        case 0x1002:
     184            ati_fixup_sb600(pci, domain, bus, device, function, deviceId);
     185            break;
     186
     187        default:
     188            break;
    142189    }
    143190}
    144191