mirror of https://github.com/ipxe/ipxe.git
Tweaked API to minimise changes to existing drivers even further.
parent
a713813596
commit
cfe3a663af
|
@ -143,24 +143,24 @@ static int pci_fill_device ( struct bus_dev *bus_dev,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int pci_check_driver ( struct bus_dev *bus_dev,
|
static int pci_check_driver ( struct bus_dev *bus_dev,
|
||||||
struct device_driver *device_driver ) {
|
struct device_driver *device_driver ) {
|
||||||
struct pci_device *pci = ( struct pci_device * ) bus_dev;
|
struct pci_device *pci = ( struct pci_device * ) bus_dev;
|
||||||
struct pci_driver_info *pci_driver_info
|
struct pci_driver *pci_driver
|
||||||
= ( struct pci_driver_info * ) device_driver->bus_driver_info;
|
= ( struct pci_driver * ) device_driver->bus_driver_info;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* If driver has a class, and class matches, use it */
|
/* If driver has a class, and class matches, use it */
|
||||||
if ( pci_driver_info->class &&
|
if ( pci_driver->class &&
|
||||||
( pci_driver_info->class == pci->class ) ) {
|
( pci_driver->class == pci->class ) ) {
|
||||||
DBG ( "driver %s matches class %hx\n",
|
DBG ( "driver %s matches class %hx\n",
|
||||||
device_driver->name, pci_driver_info->class );
|
device_driver->name, pci_driver->class );
|
||||||
pci->name = device_driver->name;
|
pci->name = device_driver->name;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If any of driver's IDs match, use it */
|
/* If any of driver's IDs match, use it */
|
||||||
for ( i = 0 ; i < pci_driver_info->id_count; i++ ) {
|
for ( i = 0 ; i < pci_driver->id_count; i++ ) {
|
||||||
struct pci_id *id = &pci_driver_info->ids[i];
|
struct pci_id *id = &pci_driver->ids[i];
|
||||||
|
|
||||||
if ( ( pci->vendor_id == id->vendor_id ) &&
|
if ( ( pci->vendor_id == id->vendor_id ) &&
|
||||||
( pci->device_id == id->device_id ) ) {
|
( pci->device_id == id->device_id ) ) {
|
||||||
|
@ -193,7 +193,7 @@ static char * pci_describe ( struct bus_dev *bus_dev ) {
|
||||||
* Name a PCI device
|
* Name a PCI device
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static char * pci_name ( struct bus_dev *bus_dev ) {
|
static const char * pci_name ( struct bus_dev *bus_dev ) {
|
||||||
struct pci_device *pci = ( struct pci_device * ) bus_dev;
|
struct pci_device *pci = ( struct pci_device * ) bus_dev;
|
||||||
|
|
||||||
return pci->name;
|
return pci->name;
|
||||||
|
|
|
@ -246,7 +246,7 @@ static struct pci_id pnic_nics[] = {
|
||||||
PCI_ROM ( 0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor" ),
|
PCI_ROM ( 0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor" ),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pci_driver_info pnic_driver =
|
static struct pci_driver pnic_driver =
|
||||||
PCI_DRIVER ( pnic_nics, PCI_NO_CLASS );
|
PCI_DRIVER ( pnic_nics, PCI_NO_CLASS );
|
||||||
|
|
||||||
DRIVER ( "PNIC", nic_driver, pci_driver, pnic_driver,
|
DRIVER ( "PNIC", nic_driver, pci_driver, pnic_driver,
|
||||||
|
|
|
@ -154,7 +154,7 @@ struct bus_driver {
|
||||||
int ( *check_driver ) ( struct bus_dev *bus_dev,
|
int ( *check_driver ) ( struct bus_dev *bus_dev,
|
||||||
struct device_driver *device_driver );
|
struct device_driver *device_driver );
|
||||||
char * ( *describe ) ( struct bus_dev *bus_dev );
|
char * ( *describe ) ( struct bus_dev *bus_dev );
|
||||||
char * ( *name ) ( struct bus_dev *bus_dev );
|
const char * ( *name ) ( struct bus_dev *bus_dev );
|
||||||
};
|
};
|
||||||
|
|
||||||
#define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))
|
#define __bus_driver __attribute__ (( used, __section__ ( ".drivers.bus" ) ))
|
||||||
|
|
|
@ -296,7 +296,7 @@ struct pci_id {
|
||||||
* can handle an entire class of devices.
|
* can handle an entire class of devices.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct pci_driver_info {
|
struct pci_driver {
|
||||||
struct pci_id *ids;
|
struct pci_id *ids;
|
||||||
unsigned int id_count;
|
unsigned int id_count;
|
||||||
uint16_t class;
|
uint16_t class;
|
||||||
|
|
Loading…
Reference in New Issue