aboutsummaryrefslogtreecommitdiff
path: root/src/pci.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-10-12 10:09:15 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-10-12 10:09:15 -0400
commit59f02834f38c63be537f63a702c69b68af913bfa (patch)
tree86b5c59b50021ae851a8dffb60d3118d76269b94 /src/pci.c
parent91031edcb2a6adf2510478bc81a4df68c5e3daf2 (diff)
downloadseabios-hppa-59f02834f38c63be537f63a702c69b68af913bfa.zip
seabios-hppa-59f02834f38c63be537f63a702c69b68af913bfa.tar.gz
seabios-hppa-59f02834f38c63be537f63a702c69b68af913bfa.tar.bz2
Add stubs for USB OHCI support.
Enable USB wrapper functions to call either ohci or ehci helpers. Implement pci_config_maskw in place of pci_set_bus_master. Introduce 'struct usb_pipe' in place of 'void *' for pipes.
Diffstat (limited to 'src/pci.c')
-rw-r--r--src/pci.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/pci.c b/src/pci.c
index e6b74d5..143acf6 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -48,6 +48,15 @@ u8 pci_config_readb(u16 bdf, u32 addr)
return inb(PORT_PCI_DATA + (addr & 3));
}
+void
+pci_config_maskw(u16 bdf, u32 addr, u16 off, u16 on)
+{
+ u16 val = pci_config_readw(bdf, addr);
+ val = (val & ~off) | on;
+ pci_config_writew(bdf, addr, val);
+}
+
+// Helper function for foreachpci() macro - return next device
int
pci_next(int bdf, int *pmax)
{
@@ -156,10 +165,8 @@ pci_find_device(u16 vendid, u16 devid)
int bdf, max;
foreachpci(bdf, max) {
u32 v = pci_config_readl(bdf, PCI_VENDOR_ID);
- if (v != id)
- continue;
- // Found it.
- return bdf;
+ if (v == id)
+ return bdf;
}
return -1;
}
@@ -171,18 +178,8 @@ pci_find_class(u16 classid)
int bdf, max;
foreachpci(bdf, max) {
u16 v = pci_config_readw(bdf, PCI_CLASS_DEVICE);
- if (v != classid)
- continue;
- // Found it.
- return bdf;
+ if (v == classid)
+ return bdf;
}
return -1;
}
-
-void
-pci_set_bus_master(u16 bdf)
-{
- u16 val = pci_config_readw(bdf, PCI_COMMAND);
- val |= PCI_COMMAND_MASTER;
- pci_config_writew(bdf, PCI_COMMAND, val);
-}