Updated ISAPnP, EISA, MCA and ISA buses to current device model.

ISA 3c509 is currently non-functional, although the EISA (3c509-eisa) and
MCA (3c529) variants should build OK.

None of this code is yet tested.
This commit is contained in:
Michael Brown
2007-03-10 18:08:33 +00:00
parent f079865606
commit 520d9c36af
36 changed files with 1445 additions and 1675 deletions

View File

@@ -4,8 +4,8 @@
*
*/
#include "eisa.h"
#include "isa.h"
#include <gpxe/eisa.h>
#include <gpxe/isa.h>
#include "console.h"
#include "3c509.h"
@@ -27,7 +27,7 @@ static void el3_eisa_disable ( struct nic *nic, struct eisa_device *eisa ) {
disable_eisa_device ( eisa );
}
static struct eisa_id el3_eisa_adapters[] = {
static struct eisa_device_id el3_eisa_adapters[] = {
{ "3Com 3c509 EtherLink III (EISA)", MFG_ID, PROD_ID },
};

View File

@@ -4,7 +4,9 @@
*
*/
#include "isa.h"
#if 0
#include <gpxe/isa.h>
#include "io.h"
#include "timer.h"
#include "string.h"
@@ -399,3 +401,5 @@ DRIVER ( "3c509", nic_driver, t509_driver, el3_t509_driver,
el3_t509_probe, el3_t509_disable );
ISA_ROM ( "3c509", "3c509" );
#endif

View File

@@ -31,6 +31,8 @@
*/
#include "nic.h"
/*
* Ethernet software status per interface.
*/

View File

@@ -48,8 +48,8 @@
#include "etherboot.h"
/* to get the interface to the body of the program */
#include "nic.h"
#include "isapnp.h"
#include "isa.h" /* for ISA_ROM */
#include <gpxe/isapnp.h>
#include <gpxe/isa.h> /* for ISA_ROM */
#include "timer.h"
#include <gpxe/ethernet.h>
@@ -753,7 +753,7 @@ corkscrew_probe1(int ioaddr, int irq, int product_index __unused,
return 0;
}
static struct isapnp_id t515_adapters[] = {
static struct isapnp_device_id t515_adapters[] = {
{ "3c515 (ISAPnP)", ISAPNP_VENDOR('T','C','M'), 0x5051 },
};

View File

@@ -4,8 +4,8 @@
*/
#include "etherboot.h"
#include "mca.h"
#include "isa.h" /* for ISA_ROM */
#include <gpxe/mca.h>
#include <gpxe/isa.h> /* for ISA_ROM */
#include "nic.h"
#include "3c509.h"
@@ -37,7 +37,7 @@ static void t529_disable ( struct nic *nic, struct mca_device *mca __unused ) {
t5x9_disable ( nic );
}
static struct mca_id el3_mca_adapters[] = {
static struct mca_device_id el3_mca_adapters[] = {
{ "3Com 3c529 EtherLink III (10base2)", 0x627c },
{ "3Com 3c529 EtherLink III (10baseT)", 0x627d },
{ "3Com 3c529 EtherLink III (test mode)", 0x62db },

View File

@@ -27,7 +27,7 @@ $Id$
#include <gpxe/ethernet.h>
#include "etherboot.h"
#include "nic.h"
#include "isa.h"
#include <gpxe/isa.h>
#include "timer.h"
#include "3c509.h"

View File

@@ -69,7 +69,7 @@
#include <gpxe/ethernet.h>
#include "etherboot.h"
#include "nic.h"
#include "isa.h"
#include <gpxe/isa.h>
#include "console.h"
#include "cs89x0.h"

View File

@@ -236,7 +236,7 @@
#include "etherboot.h"
#include "nic.h"
#include "isa.h"
#include <gpxe/isa.h>
#include "console.h"
#include <gpxe/ethernet.h>

View File

@@ -33,7 +33,7 @@ has 34 pins, the top row of 2 are not used.
#include "etherboot.h"
#include "nic.h"
#include "isa.h"
#include <gpxe/isa.h>
#include "timer.h"
#include <gpxe/ethernet.h>
@@ -557,6 +557,7 @@ static int eepro_probe ( struct nic *nic, struct isa_device *isa ) {
unsigned char caddr[ETH_ALEN];
unsigned short saddr[ETH_ALEN/2];
} station_addr;
const char *name;
nic->irqno = 0;
isa_fill_nic ( nic, isa );
@@ -576,16 +577,16 @@ static int eepro_probe ( struct nic *nic, struct isa_device *isa ) {
station_addr.saddr[1] = read_eeprom(nic->ioaddr,3);
station_addr.saddr[0] = read_eeprom(nic->ioaddr,4);
if (l_eepro)
isa->name = "Intel EtherExpress 10 ISA";
name = "Intel EtherExpress 10 ISA";
else if (read_eeprom(nic->ioaddr,7) == ee_FX_INT2IRQ) {
isa->name = "Intel EtherExpress Pro/10+ ISA";
name = "Intel EtherExpress Pro/10+ ISA";
l_eepro = 2;
} else if (station_addr.saddr[0] == SA_ADDR1) {
isa->name = "Intel EtherExpress Pro/10 ISA";
name = "Intel EtherExpress Pro/10 ISA";
l_eepro = 1;
} else {
l_eepro = 0;
isa->name = "Intel 82595-based LAN card";
name = "Intel 82595-based LAN card";
}
station_addr.saddr[0] = swap16(station_addr.saddr[0]);
station_addr.saddr[1] = swap16(station_addr.saddr[1]);
@@ -594,7 +595,7 @@ static int eepro_probe ( struct nic *nic, struct isa_device *isa ) {
nic->node_addr[i] = station_addr.caddr[i];
}
DBG ( "%s ioaddr %#hX, addr %s", isa->name, nic->ioaddr, eth_ntoa ( nic->node_addr ) );
DBG ( "%s ioaddr %#hX, addr %s", name, nic->ioaddr, eth_ntoa ( nic->node_addr ) );
mem_start = RCV_LOWER_LIMIT << 8;
if ((mem_end & 0x3F) < 3 || (mem_end & 0x3F) > 29)

View File

@@ -64,11 +64,11 @@ static void legacy_close ( struct net_device *netdev __unused ) {
/* Nothing to do */
}
int legacy_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused,
int ( * probe ) ( struct nic *nic,
struct pci_device *pci ),
void ( * disable ) ( struct nic *nic ) ) {
int legacy_probe ( void *hwdev,
void ( * set_drvdata ) ( void *hwdev, void *priv ),
struct device *dev,
int ( * probe ) ( struct nic *nic, void *hwdev ),
void ( * disable ) ( struct nic *nic, void *hwdev ) ) {
struct net_device *netdev;
int rc;
@@ -80,8 +80,8 @@ int legacy_probe ( struct pci_device *pci,
return -ENOMEM;
netdev->priv = &nic;
memset ( &nic, 0, sizeof ( nic ) );
pci_set_drvdata ( pci, netdev );
netdev->dev = &pci->dev;
set_drvdata ( hwdev, netdev );
netdev->dev = dev;
netdev->open = legacy_open;
netdev->close = legacy_close;
@@ -89,13 +89,13 @@ int legacy_probe ( struct pci_device *pci,
netdev->poll = legacy_poll;
nic.node_addr = netdev->ll_addr;
if ( ! probe ( &nic, pci ) ) {
if ( ! probe ( &nic, hwdev ) ) {
free_netdev ( netdev );
return -ENODEV;
}
if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
disable ( &nic );
disable ( &nic, hwdev );
free_netdev ( netdev );
return rc;
}
@@ -108,22 +108,18 @@ int legacy_probe ( struct pci_device *pci,
return 0;
}
void legacy_remove ( struct pci_device *pci,
void ( * disable ) ( struct nic *nic ) ) {
struct net_device *netdev = pci_get_drvdata ( pci );
void legacy_remove ( void *hwdev,
void * ( * get_drvdata ) ( void *hwdev ),
void ( * disable ) ( struct nic *nic, void *hwdev ) ) {
struct net_device *netdev = get_drvdata ( hwdev );
struct nic *nic = netdev->priv;
unregister_netdev ( netdev );
disable ( nic );
disable ( nic, hwdev );
free_netdev ( netdev );
legacy_registered = 0;
}
void pci_fill_nic ( struct nic *nic, struct pci_device *pci ) {
nic->ioaddr = pci->ioaddr;
nic->irqno = pci->irq;
}
int dummy_connect ( struct nic *nic __unused ) {
return 1;
}
@@ -131,5 +127,3 @@ int dummy_connect ( struct nic *nic __unused ) {
void dummy_irq ( struct nic *nic __unused, irq_action_t irq_action __unused ) {
return;
}
REQUIRE_OBJECT ( pci );

View File

@@ -17,7 +17,7 @@ Skeleton NIC driver for Etherboot
/* to get the PCI support functions, if this is a PCI NIC */
#include <gpxe/pci.h>
/* to get the ISA support functions, if this is an ISA NIC */
#include "isa.h"
#include <gpxe/isa.h>
#include "mt_version.c"
#include "mt23108_imp.c"

View File

@@ -17,7 +17,7 @@ Skeleton NIC driver for Etherboot
/* to get the PCI support functions, if this is a PCI NIC */
#include <gpxe/pci.h>
/* to get the ISA support functions, if this is an ISA NIC */
#include "isa.h"
#include <gpxe/isa.h>
#include "mt_version.c"
#include "mt25218_imp.c"

View File

@@ -36,7 +36,7 @@ SMC8416 PIO support added by Andrew Bettison (andrewb@zip.com.au) on 4/3/02
#ifdef INCLUDE_NS8390
#include <gpxe/pci.h>
#else
#include "isa.h"
#include <gpxe/isa.h>
#endif
static unsigned char eth_vendor, eth_flags;

View File

@@ -1,419 +0,0 @@
/**************************************************************************
Etherboot - BOOTP/TFTP Bootstrap Program
Skeleton NIC driver for Etherboot
***************************************************************************/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*/
#include "etherboot.h"
#include "nic.h"
#include <gpxe/pci.h>
#include <gpxe/ethernet.h>
#include "isa.h"
#include "eisa.h"
#include "isapnp.h"
#include "mca.h"
/*
* NIC specific static variables go here. Try to avoid using static
* variables wherever possible. In particular, the I/O address can
* always be accessed via nic->ioaddr.
*/
/*
* If you have large static variables (e.g. transmit and receive
* buffers), you should place them together in a single structure and
* mark the structure as "shared". This enables this space to be
* shared between drivers in multi-driver images, which can easily
* reduce the runtime size by 50%.
*
*/
#define SKEL_RX_BUFS 1
#define SKEL_TX_BUFS 1
#define SKEL_RX_BUFSIZE 0
#define SKEL_TX_BUFSIZE 0
struct skel_rx_desc {};
struct skel_tx_desc {};
struct {
struct skel_rx_desc rxd[SKEL_RX_BUFS];
unsigned char rxb[SKEL_RX_BUFS][SKEL_RX_BUFSIZE];
struct skel_tx_desc txd[SKEL_TX_BUFS];
unsigned char txb[SKEL_TX_BUFS][SKEL_TX_BUFSIZE];
} skel_bufs __shared;
/*
* Don't forget to remove "__unused" from all the function parameters!
*
*/
/**************************************************************************
* CONNECT - Connect to the network
**************************************************************************
*/
static int skel_connect ( struct nic *nic __unused ) {
/*
* Connect to the network. For most NICs, this will probably
* be a no-op. For wireless NICs, this should be the point at
* which you attempt to join to an access point.
*
* Return 0 if the connection failed (e.g. no cable plugged
* in), 1 for success.
*
*/
return 1;
}
/**************************************************************************
* TRANSMIT - Transmit a frame
**************************************************************************
*/
static void skel_transmit ( struct nic *nic __unused,
const char *dest __unused,
unsigned int type __unused,
unsigned int size __unused,
const char *packet __unused ) {
/* Transmit packet to dest MAC address. You will need to
* construct the link-layer header (dest MAC, source MAC,
* type).
*/
/*
unsigned int nstype = htons ( type );
memcpy ( <tx_buffer>, dest, ETH_ALEN );
memcpy ( <tx_buffer> + ETH_ALEN, nic->node_addr, ETH_ALEN );
memcpy ( <tx_buffer> + 2 * ETH_ALEN, &nstype, 2 );
memcpy ( <tx_buffer> + ETH_HLEN, data, size );
<transmit_data> ( <tx_buffer>, size + ETH_HLEN );
*/
}
/**************************************************************************
* POLL - Wait for a frame
**************************************************************************
*/
static int skel_poll ( struct nic *nic __unused, int retrieve __unused ) {
/* Work out whether or not there's an ethernet packet ready to
* read. Return 0 if not.
*/
/*
if ( ! <packet_ready> ) return 0;
*/
/* retrieve==0 indicates that we are just checking for the
* presence of a packet but don't want to read it just yet.
*/
/*
if ( ! retrieve ) return 1;
*/
/* Copy data to nic->packet. Data should include the
* link-layer header (dest MAC, source MAC, type).
* Store length of data in nic->packetlen.
* Return true to indicate a packet has been read.
*/
/*
nic->packetlen = <packet_length>;
memcpy ( nic->packet, <packet_data>, <packet_length> );
return 1;
*/
return 0; /* Remove this line once this method is implemented */
}
/**************************************************************************
* IRQ - handle interrupts
**************************************************************************
*/
static void skel_irq ( struct nic *nic __unused, irq_action_t action ) {
/* This routine is somewhat optional. Etherboot itself
* doesn't use interrupts, but they are required under some
* circumstances when we're acting as a PXE stack.
*
* If you don't implement this routine, the only effect will
* be that your driver cannot be used via Etherboot's UNDI
* API. This won't affect programs that use only the UDP
* portion of the PXE API, such as pxelinux.
*/
switch ( action ) {
case DISABLE :
case ENABLE :
/* Set receive interrupt enabled/disabled state */
/*
outb ( action == ENABLE ? IntrMaskEnabled : IntrMaskDisabled,
nic->ioaddr + IntrMaskRegister );
*/
break;
case FORCE :
/* Force NIC to generate a receive interrupt */
/*
outb ( ForceInterrupt, nic->ioaddr + IntrForceRegister );
*/
break;
}
}
/**************************************************************************
* OPERATIONS TABLE - Pointers to all the above methods
**************************************************************************
*/
static struct nic_operations skel_operations = {
.connect = skel_connect,
.transmit = skel_transmit,
.poll = skel_poll,
.irq = skel_irq,
};
/**************************************************************************
* PROBE - Look for an adapter
*
* You need to define a probe routine and a disable routine for each
* bus type that your driver supports, together with tables that
* 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
* example, most PCI devices will only need the PCI probing section;
* ISAPnP, EISA, etc. can all be deleted.
*
* Some devices will need custom bus logic. The ISA 3c509 is a good
* example of this; it has a contention-resolution mechanism that is
* similar to ISAPnP, but not close enough to use the generic ISAPnP
* code. Look at 3c509.c to see how it works.
*
**************************************************************************
*/
/**************************************************************************
* PCI PROBE and DISABLE
**************************************************************************
*/
static int skel_pci_probe ( struct nic *nic, struct pci_device *pci ) {
pci_fill_nic ( nic, pci );
/* Test for physical presence of NIC */
/*
if ( ! my_tests ) {
DBG ( "Could not find NIC: my explanation\n" );
return 0;
}
*/
/* point to NIC specific routines */
nic->nic_op = &skel_operations;
return 1;
}
static void skel_pci_disable ( struct nic *nic __unused ) {
/* Reset the card to its initial state, disable DMA and
* interrupts
*/
}
static struct pci_device_id skel_pci_nics[] = {
PCI_ROM ( 0x0000, 0x0000, "skel-pci", "Skeleton PCI Adapter" ),
};
PCI_DRIVER ( skel_pci_driver, skel_pci_nics, PCI_NO_CLASS );
DRIVER ( "SKEL/PCI", nic_driver, pci_driver, skel_pci_driver,
skel_pci_probe, skel_pci_disable );
/**************************************************************************
* EISA PROBE and DISABLE
**************************************************************************
*/
static int skel_eisa_probe ( struct nic *nic, struct eisa_device *eisa ) {
eisa_fill_nic ( nic, eisa );
enable_eisa_device ( eisa );
nic->irqno = 0; /* No standard way to get irq from EISA cards */
/* Test for physical presence of NIC */
/*
if ( ! my_tests ) {
DBG ( "Could not find NIC: my explanation\n" );
return 0;
}
*/
/* point to NIC specific routines */
nic->nic_op = &skel_operations;
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[] = {
{ "Skeleton EISA Adapter", EISA_VENDOR('S','K','L'), 0x0000 },
};
EISA_DRIVER ( skel_eisa_driver, skel_eisa_nics );
DRIVER ( "SKEL/EISA", nic_driver, eisa_driver, skel_eisa_driver,
skel_eisa_probe, skel_eisa_disable );
ISA_ROM ( "skel-eisa", "Skeleton EISA Adapter" );
/**************************************************************************
* ISAPnP PROBE and DISABLE
**************************************************************************
*/
static int skel_isapnp_probe ( struct nic *nic,
struct isapnp_device *isapnp ) {
isapnp_fill_nic ( nic, isapnp );
activate_isapnp_device ( isapnp );
/* Test for physical presence of NIC */
/*
if ( ! my_tests ) {
DBG ( "Could not find NIC: my explanation\n" );
return 0;
}
*/
/* point to NIC specific routines */
nic->nic_op = &skel_operations;
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[] = {
{ "Skeleton ISAPnP Adapter", ISAPNP_VENDOR('S','K','L'), 0x0000 },
};
ISAPNP_DRIVER ( skel_isapnp_driver, skel_isapnp_nics );
DRIVER ( "SKEL/ISAPnP", nic_driver, isapnp_driver, skel_isapnp_driver,
skel_isapnp_probe, skel_isapnp_disable );
ISA_ROM ( "skel-isapnp", "Skeleton ISAPnP Adapter" );
/**************************************************************************
* MCA PROBE and DISABLE
**************************************************************************
*/
static int skel_mca_probe ( struct nic *nic,
struct mca_device *mca ) {
mca_fill_nic ( nic, mca );
/* MCA parameters are available in the mca->pos[] array */
/*
nic->ioaddr = ( mca->pos[xxx] << 8 ) + mca->pos[yyy];
nic->irqno = mca->pos[zzz] & 0x0f;
*/
/* Test for physical presence of NIC */
/*
if ( ! my_tests ) {
DBG ( "Could not find NIC: my explanation\n" );
return 0;
}
*/
/* point to NIC specific routines */
nic->nic_op = &skel_operations;
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[] = {
{ "Skeleton MCA Adapter", 0x0000 },
};
MCA_DRIVER ( skel_mca_driver, skel_mca_nics );
DRIVER ( "SKEL/MCA", nic_driver, mca_driver, skel_mca_driver,
skel_mca_probe, skel_mca_disable );
ISA_ROM ( "skel-mca", "Skeleton MCA Adapter" );
/**************************************************************************
* ISA PROBE and DISABLE
*
* 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
* using that I/O address to fill in the information in the nic
* structure.
*
* The list of probe addresses defined in skel_isa_probe_addrs[] will
* be passed to skel_isa_probe_addr(). If skel_isa_probe_addr()
* returns true, a struct isa_device will be created with isa->ioaddr
* set to the working I/O address, and skel_isa_probe() will be
* called.
*
* There is a standard mechanism for overriding the probe address list
* using ISA_PROBE_ADDRS. Do not implement any custom code to
* override the probe address list.
*
**************************************************************************
*/
static int skel_isa_probe_addr ( isa_probe_addr_t ioaddr __unused ) {
return 0;
}
static int skel_isa_probe ( struct nic *nic, struct isa_device *isa ) {
isa_fill_nic ( nic, isa );
nic->irqno = 0; /* No standard way to get IRQ for ISA */
/* Test for physical presence of NIC */
/*
if ( ! my_tests ) {
DBG ( "Could not find NIC: my explanation\n" );
return 0;
}
*/
/* point to NIC specific routines */
nic->nic_op = &skel_operations;
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[] = {
/*
0x200, 0x240,
*/
};
ISA_DRIVER ( skel_isa_driver, skel_isa_probe_addrs, skel_isa_probe_addr,
ISA_VENDOR('S','K','L'), 0x0000 );
DRIVER ( "SKEL/ISA", nic_driver, isa_driver, skel_isa_driver,
skel_isa_probe, skel_isa_disable );
ISA_ROM ( "skel-isa", "Skeleton ISA Adapter" );

View File

@@ -38,7 +38,7 @@
#include <gpxe/ethernet.h>
#include "etherboot.h"
#include "nic.h"
#include "isa.h"
#include <gpxe/isa.h>
#include "timer.h"
#include "smc9000.h"

View File

@@ -28,13 +28,6 @@
static struct tg3 tg3;
/* Dummy defines for error handling */
#define EBUSY 1
#define ENODEV 2
#define EINVAL 3
#define ENOMEM 4
/* These numbers seem to be hard coded in the NIC firmware somehow.
* You can't change the ring sizes, but you can change where you place
* them in the NIC onboard memory.

View File

@@ -1768,11 +1768,11 @@ struct velocity_opt {
#define RX_DESC_MIN 4
#define RX_DESC_MAX 255
#define RX_DESC_DEF 64
#define RX_DESC_DEF RX_DESC_MIN
#define TX_DESC_MIN 1
#define TX_DESC_MAX 256
#define TX_DESC_DEF 4
#define TX_DESC_DEF TX_DESC_MIN
struct velocity_info {
// struct list_head list;