This is based on a patch that was committed to bochs bios.
// This code is hardcoded for PIIX4 Power Management device.
PCIDevice d;
- int ret = pci_find_device(0x8086, 0x7113, 0, &d);
+ int ret = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3
+ , 0, &d);
if (ret)
// Device not found
return;
#define PCI_MIN_GNT 0x3e /* 8 bits */
#define PCI_MAX_LAT 0x3f /* 8 bits */
+#define PCI_VENDOR_ID_INTEL 0x8086
+#define PCI_VENDOR_ID_IBM 0x1014
+#define PCI_VENDOR_ID_APPLE 0x106b
+
+#define PCI_DEVICE_ID_INTEL_82441 0x1237
+#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
+#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
+#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
+
/****************************************************************
* PIR table
#define PCI_ROM_SLOT 6
#define PCI_NUM_REGIONS 7
-#define PCI_DEVICES_MAX 64
-
static u32 pci_bios_io_addr;
static u32 pci_bios_mem_addr;
static u32 pci_bios_bigmem_addr;
vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
device_id = pci_config_readw(d, PCI_DEVICE_ID);
- if (vendor_id == 0x8086 && device_id == 0x7000) {
+ if (vendor_id == PCI_VENDOR_ID_INTEL
+ && device_id == PCI_DEVICE_ID_INTEL_82371SB_0) {
int i, irq;
u8 elcr[2];
d.bus, d.devfn, vendor_id, device_id);
switch(class) {
case 0x0101:
- if (vendor_id == 0x8086 && device_id == 0x7010) {
+ if (vendor_id == PCI_VENDOR_ID_INTEL
+ && device_id == PCI_DEVICE_ID_INTEL_82371SB_1) {
/* PIIX3 IDE */
pci_config_writew(d, 0x40, 0x8000); // enable IDE0
pci_config_writew(d, 0x42, 0x8000); // enable IDE1
break;
case 0x0800:
/* PIC */
- if (vendor_id == 0x1014) {
+ if (vendor_id == PCI_VENDOR_ID_IBM) {
/* IBM */
if (device_id == 0x0046 || device_id == 0xFFFF) {
/* MPIC & MPIC2 */
}
break;
case 0xff00:
- if (vendor_id == 0x0106b &&
+ if (vendor_id == PCI_VENDOR_ID_APPLE &&
(device_id == 0x0017 || device_id == 0x0022)) {
/* macio bridge */
pci_set_io_region_addr(d, 0, 0x80800000);
pci_config_writeb(d, PCI_INTERRUPT_LINE, pic_irq);
}
- if (vendor_id == 0x8086 && device_id == 0x7113) {
+ if (vendor_id == PCI_VENDOR_ID_INTEL
+ && device_id == PCI_DEVICE_ID_INTEL_82371AB_3) {
/* PIIX4 Power Management device (for ACPI) */
u32 pm_io_base = BUILD_PM_IO_BASE;
pci_config_writel(d, 0x40, pm_io_base | 1);
// Locate chip controlling ram shadowing.
PCIDevice d;
- int ret = pci_find_device(0x8086, 0x1237, 0, &d);
+ int ret = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441
+ , 0, &d);
if (ret) {
dprintf(1, "Unable to unlock ram - bridge not found\n");
return;
dprintf(3, "locking shadow ram\n");
PCIDevice d;
- int ret = pci_find_device(0x8086, 0x1237, 0, &d);
+ int ret = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441
+ , 0, &d);
if (ret) {
dprintf(1, "Unable to lock ram - bridge not found\n");
return;
// This code is hardcoded for PIIX4 Power Management device.
PCIDevice i440_pcidev, d;
- int ret = pci_find_device(0x8086, 0x7113, 0, &d);
+ int ret = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3
+ , 0, &d);
if (ret)
// Device not found
return;
- ret = pci_find_device(0x8086, 0x1237, 0, &i440_pcidev);
+ ret = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441
+ , 0, &i440_pcidev);
if (ret)
return;