}
/* Bind interrupt */
- if (!assigned_device->dev.config[0x3d])
+ if (!assigned_device->dev.config[PCI_INTERRUPT_PIN])
goto out;
if ( PT_MACHINE_IRQ_AUTO == machine_irq )
pci_config_set_vendor_id(s->dev.config, vid);
pci_config_set_device_id(s->dev.config, did);
- s->dev.config[0x04] = 0x06; // command = bus master, pci mem
- s->dev.config[0x05] = 0x00;
- s->dev.config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error
- s->dev.config[0x07] = 0x00; // status = fast devsel
- s->dev.config[0x08] = rid; // revision
- s->dev.config[0x09] = 0x00; // programming i/f
+ s->dev.config[PCI_COMMAND] = 0x06; // command = bus master, pci mem
+ s->dev.config[PCI_COMMAND + 1] = 0x00;
+ s->dev.config[PCI_STATUS] = 0xa0; // status = fast back-to-back, 66MHz, no error
+ s->dev.config[PCI_STATUS + 1] = 0x00; // status = fast devsel
+ s->dev.config[PCI_REVISION] = rid;
+ s->dev.config[PCI_CLASS_PROG] = 0x00; // programming i/f
pci_config_set_class(s->dev.config, PCI_CLASS_BRIDGE_PCI);
- s->dev.config[0x0D] = 0x10; // latency_timer
- s->dev.config[0x0E] = 0x81; // header_type
- s->dev.config[0x1E] = 0xa0; // secondary status
+ s->dev.config[PCI_LATENCY_TIMER] = 0x10;
+ s->dev.config[PCI_HEADER_TYPE] = 0x81;
+ s->dev.config[PCI_SEC_STATUS] = 0xa0;
s->bus = pci_register_secondary_bus(&s->dev, map_irq);
return s->bus;
#define PCI_COMMAND 0x04 /* 16 bits */
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
-#define PCI_REVISION 0x08
-#define PCI_CLASS_DEVICE 0x0a /* Device class */
+#define PCI_STATUS 0x06 /* 16 bits */
+#define PCI_REVISION 0x08 /* 8 bits */
+#define PCI_CLASS_PROG 0x09
+#define PCI_CLASS_DEVICE 0x0a /* Device class */
+#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */
+#define PCI_LATENCY_TIMER 0x0d /* 8 bits */
+#define PCI_HEADER_TYPE 0x0e /* 8 bits */
#define PCI_SUBVENDOR_ID 0x2c /* 16 bits */
#define PCI_SUBDEVICE_ID 0x2e /* 16 bits */
#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */
#define PCI_MIN_GNT 0x3e /* 8 bits */
#define PCI_MAX_LAT 0x3f /* 8 bits */
+/* Header type 1 (PCI-to-PCI bridges) */
+#define PCI_SEC_STATUS 0x1e /* Secondary status register */
+
/* Bits in the PCI Status Register (PCI 2.3 spec) */
#define PCI_STATUS_RESERVED1 0x007
#define PCI_STATUS_INT_STATUS 0x008
pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);
pci_config_set_device_id(ohci->pci_dev.config, 0x003f); // device_id
- ohci->pci_dev.config[0x09] = 0x10; /* OHCI */
+ ohci->pci_dev.config[PCI_CLASS_PROG] = 0x10; /* OHCI */
pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
- ohci->pci_dev.config[0x3d] = 0x01; /* interrupt pin 1 */
+ ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
usb_ohci_init(&ohci->state, num_ports, devfn, ohci->pci_dev.irq[0],
OHCI_TYPE_PCI, ohci->pci_dev.name);