#include <stdint.h>#include <string.h>#include <stdio.h>#include <byteswap.h>#include <gpxe/pci.h>#include <gpxe/isapnp.h>#include <gpxe/isa.h>#include <gpxe/eisa.h>#include <gpxe/mca.h>#include <gpxe/io.h>Go to the source code of this file.
Data Structures | |
| struct | nic |
| struct | nic_operations |
Defines | |
| #define | PCI_DRIVER(_name, _ids, _class) |
| #define | ISAPNP_DRIVER(_name, _ids) |
| #define | EISA_DRIVER(_name, _ids) |
| #define | MCA_DRIVER(_name, _ids) |
| #define | ISA_DRIVER(_name, _probe_addrs, _probe_addr, _vendor_id, _prod_id) |
| #define | DRIVER(_name_text, _unused2, _unused3, _name, _probe, _disable) |
Typedefs | |
| typedef enum duplex | duplex_t |
Enumerations | |
| enum | irq_action_t { DISABLE = 0, ENABLE, FORCE } |
| enum | duplex { HALF_DUPLEX = 1, FULL_DUPLEX } |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | eth_poll (int retrieve) |
| static void | eth_transmit (const char *dest, unsigned int type, unsigned int size, const void *packet) |
| int | dummy_connect (struct nic *nic) |
| void | dummy_irq (struct nic *nic, irq_action_t irq_action) |
| 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)) |
| void | legacy_remove (void *hwdev, void *(*get_drvdata)(void *hwdev), void(*disable)(struct nic *nic, void *hwdev)) |
| static void | legacy_pci_set_drvdata (void *hwdev, void *priv) |
| static void * | legacy_pci_get_drvdata (void *hwdev) |
| static void | legacy_isapnp_set_drvdata (void *hwdev, void *priv) |
| static void * | legacy_isapnp_get_drvdata (void *hwdev) |
| static void | legacy_eisa_set_drvdata (void *hwdev, void *priv) |
| static void * | legacy_eisa_get_drvdata (void *hwdev) |
| static void | legacy_mca_set_drvdata (void *hwdev, void *priv) |
| static void * | legacy_mca_get_drvdata (void *hwdev) |
| static void | legacy_isa_set_drvdata (void *hwdev, void *priv) |
| static void * | legacy_isa_get_drvdata (void *hwdev) |
Variables | |
| struct nic | nic |
| #define PCI_DRIVER | ( | _name, | |||
| _ids, | |||||
| _class | ) |
Value:
static inline int \ _name ## _pci_legacy_probe ( struct pci_device *pci, \ const struct pci_device_id *id ); \ static inline void \ _name ## _pci_legacy_remove ( struct pci_device *pci ); \ struct pci_driver _name __pci_driver = { \ .ids = _ids, \ .id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \ .probe = _name ## _pci_legacy_probe, \ .remove = _name ## _pci_legacy_remove, \ }; \ REQUIRE_OBJECT ( pci );
| #define ISAPNP_DRIVER | ( | _name, | |||
| _ids | ) |
Value:
static inline int \ _name ## _isapnp_legacy_probe ( struct isapnp_device *isapnp, \ const struct isapnp_device_id *id ); \ static inline void \ _name ## _isapnp_legacy_remove ( struct isapnp_device *isapnp ); \ struct isapnp_driver _name __isapnp_driver = { \ .ids = _ids, \ .id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \ .probe = _name ## _isapnp_legacy_probe, \ .remove = _name ## _isapnp_legacy_remove, \ }; \ REQUIRE_OBJECT ( isapnp );
| #define EISA_DRIVER | ( | _name, | |||
| _ids | ) |
Value:
static inline int \ _name ## _eisa_legacy_probe ( struct eisa_device *eisa, \ const struct eisa_device_id *id ); \ static inline void \ _name ## _eisa_legacy_remove ( struct eisa_device *eisa ); \ struct eisa_driver _name __eisa_driver = { \ .ids = _ids, \ .id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \ .probe = _name ## _eisa_legacy_probe, \ .remove = _name ## _eisa_legacy_remove, \ }; \ REQUIRE_OBJECT ( eisa );
| #define MCA_DRIVER | ( | _name, | |||
| _ids | ) |
Value:
static inline int \ _name ## _mca_legacy_probe ( struct mca_device *mca, \ const struct mca_device_id *id ); \ static inline void \ _name ## _mca_legacy_remove ( struct mca_device *mca ); \ struct mca_driver _name __mca_driver = { \ .ids = _ids, \ .id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \ .probe = _name ## _mca_legacy_probe, \ .remove = _name ## _mca_legacy_remove, \ }; \ REQUIRE_OBJECT ( mca );
| #define ISA_DRIVER | ( | _name, | |||
| _probe_addrs, | |||||
| _probe_addr, | |||||
| _vendor_id, | |||||
| _prod_id | ) |
Value:
static inline int \ _name ## _isa_legacy_probe ( struct isa_device *isa ); \ static inline int \ _name ## _isa_legacy_probe_at_addr ( struct isa_device *isa ) { \ if ( ! _probe_addr ( isa->ioaddr ) ) \ return -ENODEV; \ return _name ## _isa_legacy_probe ( isa ); \ } \ static inline void \ _name ## _isa_legacy_remove ( struct isa_device *isa ); \ static const char _name ## _text[]; \ struct isa_driver _name __isa_driver = { \ .name = _name ## _text, \ .probe_addrs = _probe_addrs, \ .addr_count = ( sizeof ( _probe_addrs ) / \ sizeof ( _probe_addrs[0] ) ), \ .vendor_id = _vendor_id, \ .prod_id = _prod_id, \ .probe = _name ## _isa_legacy_probe_at_addr, \ .remove = _name ## _isa_legacy_remove, \ }; \ REQUIRE_OBJECT ( isa );
| #define DRIVER | ( | _name_text, | |||
| _unused2, | |||||
| _unused3, | |||||
| _name, | |||||
| _probe, | |||||
| _disable | ) |
| enum irq_action_t |
| enum duplex |
Definition at line 30 of file nic.h.
00030 { 00031 HALF_DUPLEX = 1, 00032 FULL_DUPLEX 00033 } duplex_t;
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static int eth_poll | ( | int | retrieve | ) | [inline, static] |
| static void eth_transmit | ( | const char * | dest, | |
| unsigned int | type, | |||
| unsigned int | size, | |||
| const void * | packet | |||
| ) | [inline, static] |
| int dummy_connect | ( | struct nic * | nic | ) |
| void dummy_irq | ( | struct nic * | nic, | |
| irq_action_t | irq_action | |||
| ) |
| int legacy_probe | ( | void * | hwdev, | |
| void(*)(void *hwdev, void *priv) | set_drvdata, | |||
| struct device * | dev, | |||
| int(*)(struct nic *nic, void *hwdev) | probe, | |||
| void(*)(struct nic *nic, void *hwdev) | disable | |||
| ) |
Definition at line 82 of file legacy.c.
References alloc_etherdev(), device::desc, net_device::dev, EBUSY, ENODEV, ENOMEM, net_device::hw_addr, device_description::irq, nic::irqno, legacy_registered, net_device::ll_protocol, memset(), netdev, netdev_init(), netdev_link_up(), netdev_nullify(), netdev_put(), nic::node_addr, ll_protocol::ntoa, printf(), net_device::priv, and register_netdev().
Referenced by t509_probe().
00086 { 00087 struct net_device *netdev; 00088 int rc; 00089 00090 if ( legacy_registered ) 00091 return -EBUSY; 00092 00093 netdev = alloc_etherdev ( 0 ); 00094 if ( ! netdev ) 00095 return -ENOMEM; 00096 netdev_init ( netdev, &legacy_operations ); 00097 netdev->priv = &nic; 00098 memset ( &nic, 0, sizeof ( nic ) ); 00099 set_drvdata ( hwdev, netdev ); 00100 netdev->dev = dev; 00101 00102 nic.node_addr = netdev->hw_addr; 00103 nic.irqno = dev->desc.irq; 00104 00105 if ( ! probe ( &nic, hwdev ) ) { 00106 rc = -ENODEV; 00107 goto err_probe; 00108 } 00109 00110 /* Overwrite the IRQ number. Some legacy devices set 00111 * nic->irqno to 0 in the probe routine to indicate that they 00112 * don't support interrupts; doing this allows the timer 00113 * interrupt to be used instead. 00114 */ 00115 dev->desc.irq = nic.irqno; 00116 00117 /* Mark as link up; legacy devices don't handle link state */ 00118 netdev_link_up ( netdev ); 00119 00120 if ( ( rc = register_netdev ( netdev ) ) != 0 ) 00121 goto err_register; 00122 00123 /* Do not remove this message */ 00124 printf ( "WARNING: Using legacy NIC wrapper on %s\n", 00125 netdev->ll_protocol->ntoa ( nic.node_addr ) ); 00126 00127 legacy_registered = 1; 00128 return 0; 00129 00130 err_register: 00131 disable ( &nic, hwdev ); 00132 err_probe: 00133 netdev_nullify ( netdev ); 00134 netdev_put ( netdev ); 00135 return rc; 00136 }
| void legacy_remove | ( | void * | hwdev, | |
| void *(*)(void *hwdev) | get_drvdata, | |||
| void(*)(struct nic *nic, void *hwdev) | disable | |||
| ) |
Definition at line 138 of file legacy.c.
References legacy_registered, netdev, netdev_nullify(), netdev_put(), net_device::priv, and unregister_netdev().
Referenced by t509_remove().
00140 { 00141 struct net_device *netdev = get_drvdata ( hwdev ); 00142 struct nic *nic = netdev->priv; 00143 00144 unregister_netdev ( netdev ); 00145 disable ( nic, hwdev ); 00146 netdev_nullify ( netdev ); 00147 netdev_put ( netdev ); 00148 legacy_registered = 0; 00149 }
| static void legacy_pci_set_drvdata | ( | void * | hwdev, | |
| void * | priv | |||
| ) | [inline, static] |
Definition at line 100 of file nic.h.
References pci_set_drvdata().
00100 { 00101 pci_set_drvdata ( hwdev, priv ); 00102 }
| static void* legacy_pci_get_drvdata | ( | void * | hwdev | ) | [inline, static] |
Definition at line 103 of file nic.h.
References pci_get_drvdata().
00103 { 00104 return pci_get_drvdata ( hwdev ); 00105 }
| static void legacy_isapnp_set_drvdata | ( | void * | hwdev, | |
| void * | priv | |||
| ) | [inline, static] |
Definition at line 121 of file nic.h.
References isapnp_set_drvdata().
00121 { 00122 isapnp_set_drvdata ( hwdev, priv ); 00123 }
| static void* legacy_isapnp_get_drvdata | ( | void * | hwdev | ) | [inline, static] |
Definition at line 124 of file nic.h.
References isapnp_get_drvdata().
00124 { 00125 return isapnp_get_drvdata ( hwdev ); 00126 }
| static void legacy_eisa_set_drvdata | ( | void * | hwdev, | |
| void * | priv | |||
| ) | [inline, static] |
Definition at line 142 of file nic.h.
References eisa_set_drvdata().
00142 { 00143 eisa_set_drvdata ( hwdev, priv ); 00144 }
| static void* legacy_eisa_get_drvdata | ( | void * | hwdev | ) | [inline, static] |
Definition at line 145 of file nic.h.
References eisa_get_drvdata().
00145 { 00146 return eisa_get_drvdata ( hwdev ); 00147 }
| static void legacy_mca_set_drvdata | ( | void * | hwdev, | |
| void * | priv | |||
| ) | [inline, static] |
Definition at line 163 of file nic.h.
References mca_set_drvdata().
00163 { 00164 mca_set_drvdata ( hwdev, priv ); 00165 }
| static void* legacy_mca_get_drvdata | ( | void * | hwdev | ) | [inline, static] |
Definition at line 166 of file nic.h.
References mca_get_drvdata().
00166 { 00167 return mca_get_drvdata ( hwdev ); 00168 }
| static void legacy_isa_set_drvdata | ( | void * | hwdev, | |
| void * | priv | |||
| ) | [inline, static] |
Definition at line 194 of file nic.h.
References isa_set_drvdata().
00194 { 00195 isa_set_drvdata ( hwdev, priv ); 00196 }
| static void* legacy_isa_get_drvdata | ( | void * | hwdev | ) | [inline, static] |
Definition at line 197 of file nic.h.
References isa_get_drvdata().
00197 { 00198 return isa_get_drvdata ( hwdev ); 00199 }
1.5.7.1