summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/background.h2
-rw-r--r--src/include/console.h2
-rw-r--r--src/include/dev.h6
-rw-r--r--src/include/gpxe/arp.h3
-rw-r--r--src/include/gpxe/command.h2
-rw-r--r--src/include/gpxe/device.h6
-rw-r--r--src/include/gpxe/errortab.h2
-rw-r--r--src/include/gpxe/init.h2
-rw-r--r--src/include/gpxe/netdevice.h7
-rw-r--r--src/include/gpxe/pci.h6
-rw-r--r--src/include/gpxe/settings.h5
-rw-r--r--src/include/gpxe/tables.h24
-rw-r--r--src/include/gpxe/tcpip.h6
-rw-r--r--src/include/image.h8
-rw-r--r--src/include/isa.h2
-rw-r--r--src/include/proto.h10
-rw-r--r--src/include/resolv.h2
17 files changed, 51 insertions, 44 deletions
diff --git a/src/include/background.h b/src/include/background.h
index 40706cd7..6f39d394 100644
--- a/src/include/background.h
+++ b/src/include/background.h
@@ -40,7 +40,7 @@ struct background {
};
/** A member of the background protocols table */
-#define __background __table ( background, 01 )
+#define __background __table ( struct background, background, 01 )
/* Functions in background.c */
diff --git a/src/include/console.h b/src/include/console.h
index 78bbf5d0..f38d4ecf 100644
--- a/src/include/console.h
+++ b/src/include/console.h
@@ -93,7 +93,7 @@ struct console_driver {
* @endcode
*
*/
-#define __console_driver __table ( console, 01 )
+#define __console_driver __table ( struct console_driver, console, 01 )
/* Function prototypes */
diff --git a/src/include/dev.h b/src/include/dev.h
index 6edfc63f..77452ad7 100644
--- a/src/include/dev.h
+++ b/src/include/dev.h
@@ -155,7 +155,7 @@ struct bus_driver {
const char * ( *name_device ) ( struct bus_dev *bus_dev );
};
-#define __bus_driver __table ( bus_driver, 01 )
+#define __bus_driver __table ( struct bus_driver, bus_driver, 01 )
/*
* A structure fully describing the bus-independent parts of a
@@ -181,7 +181,7 @@ struct type_driver {
int ( * load ) ( struct type_dev *type_dev, struct buffer *buffer );
};
-#define __type_driver __table ( type_driver, 01 )
+#define __type_driver __table ( struct type_driver, type_driver, 01 )
/*
* A driver for a device.
@@ -198,7 +198,7 @@ struct device_driver {
struct bus_dev *bus_dev );
};
-#define __device_driver __table ( device_driver, 01 )
+#define __device_driver __table ( struct device_driver, device_driver, 01 )
#if 0
#define DRIVER(_name,_type_driver,_bus_driver,_bus_info, \
diff --git a/src/include/gpxe/arp.h b/src/include/gpxe/arp.h
index 8ff1cff0..1c702b00 100644
--- a/src/include/gpxe/arp.h
+++ b/src/include/gpxe/arp.h
@@ -27,7 +27,8 @@ struct arp_net_protocol {
};
/** Declare an ARP protocol */
-#define __arp_net_protocol __table ( arp_net_protocols, 01 )
+#define __arp_net_protocol \
+ __table ( struct arp_net_protocol, arp_net_protocols, 01 )
extern int arp_resolve ( struct net_device *netdev,
struct net_protocol *net_protocol,
diff --git a/src/include/gpxe/command.h b/src/include/gpxe/command.h
index 95f6c5ed..5d8057ab 100644
--- a/src/include/gpxe/command.h
+++ b/src/include/gpxe/command.h
@@ -17,6 +17,6 @@ struct command {
int ( * exec ) ( int argc, char **argv );
};
-#define __command __table ( commands, 01 )
+#define __command __table ( struct command, commands, 01 )
#endif /* _GPXE_COMMAND_H */
diff --git a/src/include/gpxe/device.h b/src/include/gpxe/device.h
index 43bbf604..9f670cfd 100644
--- a/src/include/gpxe/device.h
+++ b/src/include/gpxe/device.h
@@ -13,6 +13,8 @@
/** A hardware device */
struct device {
+ /** Name */
+ char name[16];
/** Devices on the same bus */
struct list_head siblings;
/** Devices attached to this device */
@@ -28,8 +30,6 @@ struct device {
*
*/
struct root_device {
- /** Name */
- const char *name;
/** Device chain
*
* A root device has a NULL parent field.
@@ -62,7 +62,7 @@ struct root_driver {
};
/** Declare a root device */
-#define __root_device __table ( root_devices, 01 )
+#define __root_device __table ( struct root_device, root_devices, 01 )
extern int probe_devices ( void );
extern void remove_devices ( void );
diff --git a/src/include/gpxe/errortab.h b/src/include/gpxe/errortab.h
index 1ca7fe55..470f7e79 100644
--- a/src/include/gpxe/errortab.h
+++ b/src/include/gpxe/errortab.h
@@ -15,6 +15,6 @@ struct errortab {
const char *text;
};
-#define __errortab __table ( errortab, 01 )
+#define __errortab __table ( struct errortab, errortab, 01 )
#endif /* _GPXE_ERRORTAB_H */
diff --git a/src/include/gpxe/init.h b/src/include/gpxe/init.h
index 3881da45..0a2eb0bf 100644
--- a/src/include/gpxe/init.h
+++ b/src/include/gpxe/init.h
@@ -46,7 +46,7 @@ struct init_fn {
/* Macro for creating an initialisation function table entry */
#define INIT_FN( init_order, init_func, reset_func, exit_func ) \
struct init_fn PREFIX_OBJECT(init_fn__) \
- __table ( init_fn, init_order ) = { \
+ __table ( struct init_fn, init_fn, init_order ) = { \
.init = init_func, \
.reset = reset_func, \
.exit = exit_func, \
diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h
index e1dddd63..b029d16a 100644
--- a/src/include/gpxe/netdevice.h
+++ b/src/include/gpxe/netdevice.h
@@ -16,6 +16,7 @@ struct pk_buff;
struct net_device;
struct net_protocol;
struct ll_protocol;
+struct device;
/** Maximum length of a link-layer address */
#define MAX_LL_ADDR_LEN 6
@@ -140,6 +141,8 @@ struct net_device {
struct list_head list;
/** Name of this network device */
char name[8];
+ /** Underlying hardware device */
+ struct device *dev;
/** List of persistent reference holders */
struct list_head references;
@@ -219,10 +222,10 @@ struct net_device {
#define NETDEV_OPEN 0x0001
/** Declare a link-layer protocol */
-#define __ll_protocol __table ( ll_protocols, 01 )
+#define __ll_protocol __table ( struct ll_protocol, ll_protocols, 01 )
/** Declare a network-layer protocol */
-#define __net_protocol __table ( net_protocols, 01 )
+#define __net_protocol __table ( struct net_protocol, net_protocols, 01 )
extern struct list_head net_devices;
diff --git a/src/include/gpxe/pci.h b/src/include/gpxe/pci.h
index a27d6f1f..8269dfaa 100644
--- a/src/include/gpxe/pci.h
+++ b/src/include/gpxe/pci.h
@@ -277,8 +277,8 @@ struct pci_device {
* field.
*/
void *priv;
- /** Device name */
- const char *name;
+ /** Driver name */
+ const char *driver_name;
};
/** A PCI driver */
@@ -305,7 +305,7 @@ struct pci_driver {
};
/** Declare a PCI driver */
-#define __pci_driver __table ( pci_drivers, 01 )
+#define __pci_driver __table ( struct pci_driver, pci_drivers, 01 )
#define PCI_DEVFN( slot, func ) ( ( (slot) << 3 ) | (func) )
#define PCI_SLOT( devfn ) ( ( (devfn) >> 3 ) & 0x1f )
diff --git a/src/include/gpxe/settings.h b/src/include/gpxe/settings.h
index d5be524d..f30bbfbc 100644
--- a/src/include/gpxe/settings.h
+++ b/src/include/gpxe/settings.h
@@ -66,7 +66,8 @@ struct config_setting_type {
};
/** Declare a configuration setting type */
-#define __config_setting_type __table ( config_setting_types, 01 )
+#define __config_setting_type \
+ __table ( struct config_setting_type, config_setting_types, 01 )
/**
* A configuration setting
@@ -98,7 +99,7 @@ struct config_setting {
};
/** Declare a configuration setting */
-#define __config_setting __table ( config_settings, 01 )
+#define __config_setting __table ( struct config_setting, config_settings, 01 )
/**
* Show value of setting
diff --git a/src/include/gpxe/tables.h b/src/include/gpxe/tables.h
index 385bb525..b2c56ab6 100644
--- a/src/include/gpxe/tables.h
+++ b/src/include/gpxe/tables.h
@@ -165,16 +165,17 @@
*/
#ifdef DOXYGEN
-#define __attribute__(x)
+#define __attribute__( x )
#endif
-#define __table_str(x) #x
-#define __table_section(table,idx) \
- __section__ ( ".tbl." __table_str(table) "." __table_str(idx) )
+#define __table_str( x ) #x
+#define __table_section( table, idx ) \
+ __section__ ( ".tbl." __table_str ( table ) "." __table_str ( idx ) )
-#define __table_section_start(table) __table_section(table,00)
-#define __table_section_end(table) __table_section(table,99)
+#define __table_section_start( table ) __table_section ( table, 00 )
+#define __table_section_end( table ) __table_section ( table, 99 )
+#define __natural_alignment( type ) __aligned__ ( __alignof__ ( type ) )
/**
* Linker table entry.
@@ -191,8 +192,9 @@
* @endcode
*
*/
-#define __table(table,idx) \
- __attribute__ (( __table_section(table,idx) ))
+#define __table( type, table, idx ) \
+ __attribute__ (( __table_section ( table, idx ), \
+ __natural_alignment ( type ) ))
/**
* Linker table start marker.
@@ -207,8 +209,7 @@
* @endcode
*
*/
-#define __table_start(table) \
- __attribute__ (( __table_section_start(table) ))
+#define __table_start( type, table ) __table ( type, table, 00 )
/**
* Linker table end marker.
@@ -223,7 +224,6 @@
* @endcode
*
*/
-#define __table_end(table) \
- __attribute__ (( __table_section_end(table) ))
+#define __table_end( type, table ) __table ( type, table, 99 )
#endif /* _GPXE_TABLES_H */
diff --git a/src/include/gpxe/tcpip.h b/src/include/gpxe/tcpip.h
index 1fdb8b71..2508d5f5 100644
--- a/src/include/gpxe/tcpip.h
+++ b/src/include/gpxe/tcpip.h
@@ -99,10 +99,12 @@ struct tcpip_net_protocol {
};
/** Declare a TCP/IP transport-layer protocol */
-#define __tcpip_protocol __table ( tcpip_protocols, 01 )
+#define __tcpip_protocol \
+ __table ( struct tcpip_protocol, tcpip_protocols, 01 )
/** Declare a TCP/IP network-layer protocol */
-#define __tcpip_net_protocol __table ( tcpip_net_protocols, 01 )
+#define __tcpip_net_protocol \
+ __table ( struct tcpip_net_protocol, tcpip_net_protocols, 01 )
extern int tcpip_rx ( struct pk_buff *pkb, uint8_t tcpip_proto,
struct sockaddr_tcpip *st_src,
diff --git a/src/include/image.h b/src/include/image.h
index 3483fe09..b86f324c 100644
--- a/src/include/image.h
+++ b/src/include/image.h
@@ -13,10 +13,10 @@ struct image {
int ( * boot ) ( void *context );
};
-#define __image_start __table_start(image)
-#define __image __table(image,01)
-#define __default_image __table(image,02)
-#define __image_end __table_end(image)
+#define __image_start __table_start ( struct image, image )
+#define __image __table ( struct image, image, 01 )
+#define __default_image __table ( struct image, image, 02 )
+#define __image_end __table_end ( struct image, image )
/* Functions in image.c */
diff --git a/src/include/isa.h b/src/include/isa.h
index eacbb8ef..37265617 100644
--- a/src/include/isa.h
+++ b/src/include/isa.h
@@ -54,7 +54,7 @@ struct isa_driver {
*
*/
#define ISA_DRIVER( _name, _probe_addrs, _probe_addr, _mfg_id, _prod_id ) \
-struct isa_driver _name __table(isa_driver,01 ) = { \
+struct isa_driver _name __table ( struct isa_driver, isa_driver, 01 ) = { \
.probe_addrs = _probe_addrs, \
.addr_count = sizeof ( _probe_addrs ) / sizeof ( _probe_addrs[0] ), \
.probe_addr = _probe_addr, \
diff --git a/src/include/proto.h b/src/include/proto.h
index 7bceef9d..c16229ef 100644
--- a/src/include/proto.h
+++ b/src/include/proto.h
@@ -18,11 +18,11 @@ struct protocol {
* should use __protocol.
*
*/
-#define __protocol_start __table_start(protocol)
-#define __protocol __table(protocol,01)
-#define __default_protocol_start __table(protocol,02)
-#define __default_protocol __table(protocol,03)
-#define __protocol_end __table_end(protocol)
+#define __protocol_start __table_start ( struct protocol, protocol )
+#define __protocol __table ( struct protocol, protocol, 01 )
+#define __default_protocol_start __table ( struct protocol, protocol, 02 )
+#define __default_protocol __table ( struct protocol, protocol, 03 )
+#define __protocol_end __table_end ( struct protocol, protocol )
/*
* Functions in proto.c
diff --git a/src/include/resolv.h b/src/include/resolv.h
index e97fd1e5..714d39ef 100644
--- a/src/include/resolv.h
+++ b/src/include/resolv.h
@@ -9,7 +9,7 @@ struct resolver {
int ( * resolv ) ( struct in_addr *address, const char *name );
};
-#define __resolver __table(resolver,01)
+#define __resolver __table ( struct resolver, resolver, 01 )
extern int resolv ( struct in_addr *address, const char *name );