mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 13:00:39 +03:00
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).
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user