david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Updated to new API.

This commit is contained in:
Michael Brown 2005-04-22 11:56:49 +00:00
parent 1e156f537b
commit 329ccfdc21
1 changed files with 68 additions and 56 deletions

View File

@ -104,23 +104,6 @@ static void skel_transmit ( struct nic *nic __unused,
*/ */
} }
/**************************************************************************
* DISABLE - Turn off ethernet interface
**************************************************************************
*/
static void skel_disable ( struct nic *nic __unused ) {
/* put the card in its initial state */
/* This function serves 3 purposes.
* This disables DMA and interrupts so we don't receive
* unexpected packets or interrupts from the card after
* etherboot has finished.
* This frees resources so etherboot may use
* this driver on another interface
* This allows etherboot to reinitialize the interface
* if something is something goes wrong.
*/
}
/************************************************************************** /**************************************************************************
* IRQ - handle interrupts * IRQ - handle interrupts
************************************************************************** **************************************************************************
@ -163,15 +146,15 @@ static struct nic_operations skel_operations = {
.poll = skel_poll, .poll = skel_poll,
.transmit = skel_transmit, .transmit = skel_transmit,
.irq = skel_irq, .irq = skel_irq,
}; };
/************************************************************************** /**************************************************************************
* PROBE - Look for an adapter * PROBE - Look for an adapter
* *
* You need to define a probe routine for each bus type that your * You need to define a probe routine and a disable routine for each
* driver supports, together with tables that enable Etherboot to * bus type that your driver supports, together with tables that
* identify that your driver should be used for a particular device. * enable Etherboot to identify that your driver should be used for a
* particular device.
* *
* Delete whichever of the following sections you don't need. For * Delete whichever of the following sections you don't need. For
* example, most PCI devices will only need the PCI probing section; * example, most PCI devices will only need the PCI probing section;
@ -186,18 +169,13 @@ static struct nic_operations skel_operations = {
*/ */
/************************************************************************** /**************************************************************************
* PCI PROBE - Look for an adapter * PCI PROBE and DISABLE
************************************************************************** **************************************************************************
*/ */
static int skel_pci_probe ( struct nic *nic, struct pci_device *pci ) { static int skel_pci_probe ( struct nic *nic, struct pci_device *pci ) {
pci_fill_nic ( nic, pci ); pci_fill_nic ( nic, pci );
nic->ioaddr = pci->ioaddr;
nic->irqno = pci->irq;
/* Test for physical presence of NIC */ /* Test for physical presence of NIC */
/* /*
if ( ! my_tests ) { if ( ! my_tests ) {
@ -211,6 +189,13 @@ static int skel_pci_probe ( struct nic *nic, struct pci_device *pci ) {
return 1; return 1;
} }
static void skel_pci_disable ( struct nic *nic __unused,
struct pci_device *pci __unused ) {
/* Reset the card to its initial state, disable DMA and
* interrupts
*/
}
static struct pci_id skel_pci_nics[] = { static struct pci_id skel_pci_nics[] = {
PCI_ROM ( 0x0000, 0x0000, "skel-pci", "Skeleton PCI Adapter" ), PCI_ROM ( 0x0000, 0x0000, "skel-pci", "Skeleton PCI Adapter" ),
}; };
@ -219,18 +204,17 @@ static struct pci_driver skel_pci_driver =
PCI_DRIVER ( skel_pci_nics, PCI_NO_CLASS ); PCI_DRIVER ( skel_pci_nics, PCI_NO_CLASS );
DRIVER ( "SKEL/PCI", nic_driver, pci_driver, skel_pci_driver, DRIVER ( "SKEL/PCI", nic_driver, pci_driver, skel_pci_driver,
skel_pci_probe, skel_disable ); skel_pci_probe, skel_pci_disable );
/************************************************************************** /**************************************************************************
* EISA PROBE - Look for an adapter * EISA PROBE and DISABLE
************************************************************************** **************************************************************************
*/ */
static int skel_eisa_probe ( struct nic *nic, struct eisa_device *eisa ) { static int skel_eisa_probe ( struct nic *nic, struct eisa_device *eisa ) {
struct nic *nic = nic_device ( dev );
eisa_fill_nic ( nic, eisa );
enable_eisa_device ( eisa ); enable_eisa_device ( eisa );
nic->ioaddr = eisa->ioaddr; nic->irqno = 0; /* No standard way to get irq from EISA cards */
nic->irqno = 0;
/* Test for physical presence of NIC */ /* Test for physical presence of NIC */
/* /*
@ -245,29 +229,35 @@ static int skel_eisa_probe ( struct nic *nic, struct eisa_device *eisa ) {
return 1; return 1;
} }
static void skel_eisa_disable ( struct nic *nic __unused,
struct eisa_device *eisa ) {
/* Reset the card to its initial state, disable DMA and
* interrupts
*/
disable_eisa_device ( eisa );
}
static struct eisa_id skel_eisa_nics[] = { static struct eisa_id skel_eisa_nics[] = {
{ "Skeleton EISA Adapter", EISA_VENDOR('S','K','L'), 0x0000 }, { "Skeleton EISA Adapter", EISA_VENDOR('S','K','L'), 0x0000 },
}; };
static struct eisa_driver skel_eisa_driver = static struct eisa_driver skel_eisa_driver =
EISA_DRIVER ( "SKEL/EISA", skel_eisa_nics ); EISA_DRIVER ( skel_eisa_nics );
BOOT_DRIVER ( "SKEL/EISA", find_eisa_boot_device, DRIVER ( "SKEL/EISA", nic_driver, eisa_driver, skel_eisa_driver,
skel_eisa_driver, skel_eisa_probe ); skel_eisa_probe, skel_eisa_disable );
ISA_ROM ( "skel-eisa", "Skeleton EISA Adapter" ); ISA_ROM ( "skel-eisa", "Skeleton EISA Adapter" );
/************************************************************************** /**************************************************************************
* ISAPnP PROBE - Look for an adapter * ISAPnP PROBE and DISABLE
************************************************************************** **************************************************************************
*/ */
static int skel_isapnp_probe ( struct nic *nic, static int skel_isapnp_probe ( struct nic *nic,
struct isapnp_device *isapnp ) { struct isapnp_device *isapnp ) {
struct nic *nic = nic_device ( dev );
nic->ioaddr = isapnp->ioaddr; isapnp_fill_nic ( nic, isapnp );
nic->irqno = isapnp->irqno; activate_isapnp_device ( isapnp );
activate_isapnp_device ( isapnp, 1 );
/* Test for physical presence of NIC */ /* Test for physical presence of NIC */
/* /*
@ -282,25 +272,34 @@ static int skel_isapnp_probe ( struct nic *nic,
return 1; return 1;
} }
static void skel_isapnp_disable ( struct nic *nic __unused,
struct isapnp_device *isapnp ) {
/* Reset the card to its initial state, disable DMA and
* interrupts
*/
deactivate_isapnp_device ( isapnp );
}
static struct isapnp_id skel_isapnp_nics[] = { static struct isapnp_id skel_isapnp_nics[] = {
{ "Skeleton ISAPnP Adapter", ISAPNP_VENDOR('S','K','L'), 0x0000 }, { "Skeleton ISAPnP Adapter", ISAPNP_VENDOR('S','K','L'), 0x0000 },
}; };
static struct isapnp_driver skel_isapnp_driver = static struct isapnp_driver skel_isapnp_driver =
ISAPNP_DRIVER ( "SKEL/ISAPnP", skel_isapnp_nics ); ISAPNP_DRIVER ( skel_isapnp_nics );
BOOT_DRIVER ( "SKEL/ISAPnP", find_isapnp_boot_device, DRIVER ( "SKEL/ISAPnP", nic_driver, isapnp_driver, skel_isapnp_driver,
skel_isapnp_driver, skel_isapnp_probe ); skel_isapnp_probe, skel_isapnp_disable );
ISA_ROM ( "skel-isapnp", "Skeleton ISAPnP Adapter" ); ISA_ROM ( "skel-isapnp", "Skeleton ISAPnP Adapter" );
/************************************************************************** /**************************************************************************
* MCA PROBE - Look for an adapter * MCA PROBE and DISABLE
************************************************************************** **************************************************************************
*/ */
static int skel_mca_probe ( struct nic *nic, static int skel_mca_probe ( struct nic *nic,
struct mca_device *mca __unused ) { struct mca_device *mca ) {
struct nic *nic = nic_device ( dev );
mca_fill_nic ( nic, mca );
/* MCA parameters are available in the mca->pos[] array */ /* MCA parameters are available in the mca->pos[] array */
/* /*
@ -321,20 +320,27 @@ static int skel_mca_probe ( struct nic *nic,
return 1; return 1;
} }
static void skel_mca_disable ( struct nic *nic __unused,
struct mca_device *mca __unused ) {
/* Reset the card to its initial state, disable DMA and
* interrupts
*/
}
static struct mca_id skel_mca_nics[] = { static struct mca_id skel_mca_nics[] = {
{ "Skeleton MCA Adapter", 0x0000 }, { "Skeleton MCA Adapter", 0x0000 },
}; };
static struct mca_driver skel_mca_driver = static struct mca_driver skel_mca_driver =
MCA_DRIVER ( "SKEL/MCA", skel_mca_nics ); MCA_DRIVER ( skel_mca_nics );
BOOT_DRIVER ( "SKEL/MCA", find_mca_boot_device, DRIVER ( "SKEL/MCA", nic_driver, mca_driver, skel_mca_driver,
skel_mca_driver, skel_mca_probe ); skel_mca_probe, skel_mca_disable );
ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" ); ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" );
/************************************************************************** /**************************************************************************
* ISA PROBE - Look for an adapter * ISA PROBE and DISABLE
* *
* The "classical" ISA probe is split into two stages: trying a list * The "classical" ISA probe is split into two stages: trying a list
* of I/O addresses to see if there's anything listening, and then * of I/O addresses to see if there's anything listening, and then
@ -358,10 +364,9 @@ static int skel_isa_probe_addr ( isa_probe_addr_t ioaddr __unused ) {
} }
static int skel_isa_probe ( struct nic *nic, struct isa_device *isa ) { static int skel_isa_probe ( struct nic *nic, struct isa_device *isa ) {
struct nic *nic = nic_device ( dev );
nic->ioaddr = isa->ioaddr; isa_fill_nic ( nic, isa );
nic->irqno = 0; nic->irqno = 0; /* No standard way to get IRQ for ISA */
/* Test for physical presence of NIC */ /* Test for physical presence of NIC */
/* /*
@ -376,6 +381,13 @@ static int skel_isa_probe ( struct nic *nic, struct isa_device *isa ) {
return 1; return 1;
} }
static void skel_isa_disable ( struct nic *nic __unused,
struct isa_device *isa __unused ) {
/* Reset the card to its initial state, disable DMA and
* interrupts
*/
}
static isa_probe_addr_t skel_isa_probe_addrs[] = { static isa_probe_addr_t skel_isa_probe_addrs[] = {
/* /*
0x200, 0x240, 0x200, 0x240,
@ -383,11 +395,11 @@ static isa_probe_addr_t skel_isa_probe_addrs[] = {
}; };
static struct isa_driver skel_isa_driver = static struct isa_driver skel_isa_driver =
ISA_DRIVER ( "SKEL/ISA", skel_isa_probe_addrs, skel_isa_probe_addr, ISA_DRIVER ( skel_isa_probe_addrs, skel_isa_probe_addr,
ISA_VENDOR('S','K','L'), 0x0000 ); ISA_VENDOR('S','K','L'), 0x0000 );
BOOT_DRIVER ( "SKEL/ISA", find_isa_boot_device, DRIVER ( "SKEL/ISA", nic_driver, isa_driver, skel_isa_driver,
skel_isa_driver, skel_isa_probe ); skel_isa_probe, skel_isa_disable );
ISA_ROM ( "skel-isa", "Skeleton ISA Adapter" ); ISA_ROM ( "skel-isa", "Skeleton ISA Adapter" );