mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 10:02:42 +03:00
Add device description fields to struct device.
This commit is contained in:
@@ -64,7 +64,7 @@ static int undipci_probe ( struct pci_device *pci,
|
||||
const struct pci_device_id *id __unused ) {
|
||||
struct undi_device *undi;
|
||||
struct undi_rom *undirom;
|
||||
unsigned int busdevfn = ( ( pci->bus << 8 ) | pci->devfn );
|
||||
unsigned int busdevfn = PCI_BUSDEVFN ( pci->bus, pci->devfn );
|
||||
int rc;
|
||||
|
||||
/* Ignore non-network devices */
|
||||
@@ -99,6 +99,7 @@ static int undipci_probe ( struct pci_device *pci,
|
||||
/* Add to device hierarchy */
|
||||
snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
|
||||
"UNDI-%s", pci->dev.name );
|
||||
memcpy ( &undi->dev.desc, &pci->dev.desc, sizeof ( undi->dev.desc ) );
|
||||
undi->dev.parent = &pci->dev;
|
||||
INIT_LIST_HEAD ( &undi->dev.children );
|
||||
list_add ( &undi->dev.siblings, &pci->dev.children );
|
||||
|
||||
@@ -76,13 +76,13 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
|
||||
/* Debug info */
|
||||
DBGC ( undi, "UNDI %p loading UNDI ROM %p to CS %04x DS %04x for ",
|
||||
undi, undirom, undi_loader.UNDI_CS, undi_loader.UNDI_DS );
|
||||
if ( undi->pci_busdevfn != 0xffff ) {
|
||||
if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
|
||||
unsigned int bus = ( undi->pci_busdevfn >> 8 );
|
||||
unsigned int devfn = ( undi->pci_busdevfn & 0xff );
|
||||
DBGC ( undi, "PCI %02x:%02x.%x\n",
|
||||
bus, PCI_SLOT ( devfn ), PCI_FUNC ( devfn ) );
|
||||
}
|
||||
if ( undi->isapnp_csn != 0xffff ) {
|
||||
if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
|
||||
DBGC ( undi, "ISAPnP(%04x) CSN %04x\n",
|
||||
undi->isapnp_read_port, undi->isapnp_csn );
|
||||
}
|
||||
|
||||
@@ -49,29 +49,41 @@
|
||||
* find.
|
||||
*/
|
||||
static int undibus_probe ( struct root_device *rootdev ) {
|
||||
struct undi_device *undi = &preloaded_undi;
|
||||
int rc;
|
||||
|
||||
/* Check for a valie preloaded UNDI device */
|
||||
if ( ! preloaded_undi.entry.segment ) {
|
||||
if ( ! undi->entry.segment ) {
|
||||
DBG ( "No preloaded UNDI device found!\n" );
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Add to device hierarchy */
|
||||
strncpy ( preloaded_undi.dev.name, "UNDI",
|
||||
( sizeof ( preloaded_undi.dev.name ) - 1 ) );
|
||||
preloaded_undi.dev.parent = &rootdev->dev;
|
||||
list_add ( &preloaded_undi.dev.siblings, &rootdev->dev.children);
|
||||
INIT_LIST_HEAD ( &preloaded_undi.dev.children );
|
||||
strncpy ( undi->dev.name, "UNDI",
|
||||
( sizeof ( undi->dev.name ) - 1 ) );
|
||||
if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
|
||||
struct pci_device_description *pcidesc = &undi->dev.desc.pci;
|
||||
pcidesc->bus_type = BUS_TYPE_PCI;
|
||||
pcidesc->busdevfn = undi->pci_busdevfn;
|
||||
pcidesc->vendor = undi->pci_vendor;
|
||||
pcidesc->device = undi->pci_device;
|
||||
} else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
|
||||
struct isapnp_device_description *isapnpdesc
|
||||
= &undi->dev.desc.isapnp;
|
||||
isapnpdesc->bus_type = BUS_TYPE_ISAPNP;
|
||||
}
|
||||
undi->dev.parent = &rootdev->dev;
|
||||
list_add ( &undi->dev.siblings, &rootdev->dev.children);
|
||||
INIT_LIST_HEAD ( &undi->dev.children );
|
||||
|
||||
/* Create network device */
|
||||
if ( ( rc = undinet_probe ( &preloaded_undi ) ) != 0 )
|
||||
if ( ( rc = undinet_probe ( undi ) ) != 0 )
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
list_del ( &preloaded_undi.dev.siblings );
|
||||
list_del ( &undi->dev.siblings );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -81,8 +93,10 @@ static int undibus_probe ( struct root_device *rootdev ) {
|
||||
* @v rootdev UNDI bus root device
|
||||
*/
|
||||
static void undibus_remove ( struct root_device *rootdev __unused ) {
|
||||
undinet_remove ( &preloaded_undi );
|
||||
list_del ( &preloaded_undi.dev.siblings );
|
||||
struct undi_device *undi = &preloaded_undi;
|
||||
|
||||
undinet_remove ( undi );
|
||||
list_del ( &undi->dev.siblings );
|
||||
}
|
||||
|
||||
/** UNDI bus root device driver */
|
||||
|
||||
Reference in New Issue
Block a user