summaryrefslogtreecommitdiffstats
path: root/src/include/nic.h
diff options
context:
space:
mode:
authorMichael Brown2005-04-21 20:18:29 +0200
committerMichael Brown2005-04-21 20:18:29 +0200
commit98ff29345ec0819498f131496db0d96262e3c05f (patch)
tree4b31c4d59e3293d7fc0b35587145a30d1b074f2e /src/include/nic.h
parentForce a standard format upon debug messages. (diff)
downloadipxe-98ff29345ec0819498f131496db0d96262e3c05f.tar.gz
ipxe-98ff29345ec0819498f131496db0d96262e3c05f.tar.xz
ipxe-98ff29345ec0819498f131496db0d96262e3c05f.zip
Created a bus/device API that allows for the ROM prefix to specify an
initial device, and will also allow for e.g. a device menu to be presented to the user.
Diffstat (limited to 'src/include/nic.h')
-rw-r--r--src/include/nic.h52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/include/nic.h b/src/include/nic.h
index 02fcafc1..7b12c5be 100644
--- a/src/include/nic.h
+++ b/src/include/nic.h
@@ -8,6 +8,10 @@
#ifndef NIC_H
#define NIC_H
+#include "dev.h"
+#include "byteswap.h"
+#include "dhcp.h"
+
typedef enum {
DISABLE = 0,
ENABLE,
@@ -24,16 +28,17 @@ typedef enum duplex {
* functions.
*/
struct nic {
- struct nic_operations *nic_op;
- int flags; /* driver specific flags */
- unsigned char *node_addr;
- unsigned char *packet;
- unsigned int packetlen;
- unsigned int ioaddr;
- unsigned char irqno;
- unsigned int mbps;
- duplex_t duplex;
- void *priv_data; /* driver can hang private data here */
+ struct nic_operations *nic_op;
+ int flags; /* driver specific flags */
+ unsigned char *node_addr;
+ unsigned char *packet;
+ unsigned int packetlen;
+ unsigned int ioaddr;
+ unsigned char irqno;
+ unsigned int mbps;
+ duplex_t duplex;
+ struct dhcp_dev_id dhcp_dev_id;
+ void *priv_data; /* driver private data */
};
struct nic_operations {
@@ -42,52 +47,43 @@ struct nic_operations {
void ( *transmit ) ( struct nic *, const char *,
unsigned int, unsigned int, const char * );
void ( *irq ) ( struct nic *, irq_action_t );
- void ( *disable ) ( struct nic * );
};
+extern struct type_driver nic_driver;
+
/*
* Function prototypes
*
*/
-struct dev;
-extern struct nic * nic_device ( struct dev * dev );
extern int dummy_connect ( struct nic *nic );
extern void dummy_irq ( struct nic *nic, irq_action_t irq_action );
+extern void nic_disable ( struct nic *nic );
/*
* Functions that implicitly operate on the current boot device
*
- * "nic" always points to &dev.nic
*/
-extern struct nic *nic;
+extern struct nic nic;
static inline int eth_connect ( void ) {
- return nic->nic_op->connect ( nic );
+ return nic.nic_op->connect ( &nic );
}
static inline int eth_poll ( int retrieve ) {
- return nic->nic_op->poll ( nic, retrieve );
+ return nic.nic_op->poll ( &nic, retrieve );
}
static inline void eth_transmit ( const char *dest, unsigned int type,
unsigned int size, const void *packet ) {
- nic->nic_op->transmit ( nic, dest, type, size, packet );
+ nic.nic_op->transmit ( &nic, dest, type, size, packet );
}
static inline void eth_irq ( irq_action_t action ) {
- nic->nic_op->irq ( nic, action );
+ nic.nic_op->irq ( &nic, action );
}
/* Should be using disable() rather than eth_disable() */
-static inline void eth_disable ( void ) __attribute__ (( deprecated ));
-static inline void eth_disable ( void ) {
- nic->nic_op->disable ( nic );
-}
-
-/* dev.h needs declarations from nic.h */
-#include "dev.h"
-/* to get global "dev" */
-#include "main.h"
+extern void eth_disable ( void ) __attribute__ (( deprecated ));
#endif /* NIC_H */