summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/pnic.c
diff options
context:
space:
mode:
authorMichael Brown2006-05-16 17:12:06 +0200
committerMichael Brown2006-05-16 17:12:06 +0200
commit15ee09ed10d71969abeea9f578f061e096ef43d0 (patch)
treefe9465a87de8f62287474b1c2dc85516b868fbf5 /src/drivers/net/pnic.c
parentMissed a reference to heap.h. (diff)
downloadipxe-15ee09ed10d71969abeea9f578f061e096ef43d0.tar.gz
ipxe-15ee09ed10d71969abeea9f578f061e096ef43d0.tar.xz
ipxe-15ee09ed10d71969abeea9f578f061e096ef43d0.zip
Restructured PCI subsystem to fit the new device model.
Generic PCI code now handles 64-bit BARs correctly when setting "membase"; drivers should need to call pci_bar_start() only if they want to use BARs other than the first memory or I/O BAR. Split rarely-used PCI functions out into pciextra.c. Core PCI code is now 662 bytes (down from 1308 bytes in Etherboot 5.4). 284 bytes of this saving comes from the pci/pciextra split. Cosmetic changes to lots of drivers (e.g. vendor_id->vendor in order to match the names used in Linux).
Diffstat (limited to 'src/drivers/net/pnic.c')
-rw-r--r--src/drivers/net/pnic.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/drivers/net/pnic.c b/src/drivers/net/pnic.c
index d4b19778..18f7b93b 100644
--- a/src/drivers/net/pnic.c
+++ b/src/drivers/net/pnic.c
@@ -199,13 +199,17 @@ static void pnic_remove ( struct pci_device *pci ) {
/**************************************************************************
PROBE - Look for an adapter, this routine's visible to the outside
***************************************************************************/
-static int pnic_probe ( struct pci_device *pci ) {
+static int pnic_probe ( struct pci_device *pci,
+ const struct pci_device_id *id __unused ) {
struct net_device *netdev;
struct pnic *pnic;
uint16_t api_version;
uint16_t status;
int rc;
+ /* Fix up PCI device */
+ adjust_pci_device ( pci );
+
/* Allocate net device */
netdev = alloc_etherdev ( sizeof ( *pnic ) );
if ( ! netdev ) {
@@ -248,32 +252,14 @@ static int pnic_probe ( struct pci_device *pci ) {
return rc;
}
-static struct pci_id pnic_nics[] = {
+static struct pci_device_id pnic_nics[] = {
/* genrules.pl doesn't let us use macros for PCI IDs...*/
PCI_ROM ( 0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor" ),
};
-static struct pci_driver pnic_driver = {
+struct pci_driver pnic_driver __pci_driver = {
.ids = pnic_nics,
.id_count = ( sizeof ( pnic_nics ) / sizeof ( pnic_nics[0] ) ),
- .class = PCI_NO_CLASS,
- // .probe = pnic_probe,
- // .remove = pnic_remove,
+ .probe = pnic_probe,
+ .remove = pnic_remove,
};
-
-// PCI_DRIVER ( pnic_driver );
-
-
-static int pnic_hack_probe ( void *dummy, struct pci_device *pci ) {
- return ( pnic_probe ( pci ) == 0 );
-}
-
-static void pnic_hack_disable ( void *dummy, struct pci_device *pci ) {
- pnic_remove ( pci );
-}
-
-#include "dev.h"
-extern struct type_driver test_driver;
-
-DRIVER ( "PNIC", test_driver, pci_driver, pnic_driver,
- pnic_hack_probe, pnic_hack_disable );