summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/hci/shell_banner.c11
-rw-r--r--src/include/gpxe/dhcp.h5
-rw-r--r--src/include/gpxe/features.h63
-rw-r--r--src/net/aoe.c3
-rw-r--r--src/net/tcp/iscsi.c3
-rw-r--r--src/net/udp/dhcp.c15
6 files changed, 99 insertions, 1 deletions
diff --git a/src/hci/shell_banner.c b/src/hci/shell_banner.c
index 1413fe16..bb8166db 100644
--- a/src/hci/shell_banner.c
+++ b/src/hci/shell_banner.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <console.h>
#include <latch.h>
+#include <gpxe/features.h>
#include <gpxe/shell_banner.h>
/** @file
@@ -33,6 +34,9 @@
#define BOLD "\033[1m"
#define CYAN "\033[36m"
+static char * features[0] __table_start ( char *, features );
+static char * features_end[0] __table_end ( char *, features );
+
/**
* Print shell banner and prompt for shell entry
*
@@ -40,6 +44,7 @@
*/
int shell_banner ( void ) {
unsigned long timeout = ( currticks() + BANNER_TIMEOUT );
+ char **feature;
int key;
int enter_shell = 0;
@@ -47,7 +52,11 @@ int shell_banner ( void ) {
printf ( NORMAL "\n\n\n" BOLD "gPXE " VERSION
NORMAL " -- Open Source Boot Firmware -- "
CYAN "http://etherboot.org" NORMAL "\n"
- "Press Ctrl-B for the gPXE command line..." );
+ "Features:" );
+ for ( feature = features ; feature < features_end ; feature++ ) {
+ printf ( " %s", *feature );
+ }
+ printf ( "\nPress Ctrl-B for the gPXE command line..." );
/* Wait for key */
while ( currticks() < timeout ) {
diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h
index 86322786..bbd345c8 100644
--- a/src/include/gpxe/dhcp.h
+++ b/src/include/gpxe/dhcp.h
@@ -168,6 +168,11 @@ struct job_interface;
*/
#define DHCP_EB_SIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 3 )
+/*
+ * Tags in the range 0x10-0x7f are reserved for feature markers
+ *
+ */
+
/** Network device descriptor
*
* Byte 0 is the bus type ID; remaining bytes depend on the bus type.
diff --git a/src/include/gpxe/features.h b/src/include/gpxe/features.h
new file mode 100644
index 00000000..20cce316
--- /dev/null
+++ b/src/include/gpxe/features.h
@@ -0,0 +1,63 @@
+#ifndef _GPXE_FEATURES_H
+#define _GPXE_FEATURES_H
+
+#include <stdint.h>
+#include <gpxe/tables.h>
+#include <gpxe/dhcp.h>
+
+/** @file
+ *
+ * Feature list
+ *
+ */
+
+/**
+ * @defgroup dhcpfeatures DHCP feature option tags
+ *
+ * DHCP feature option tags are Etherboot encapsulated options in the
+ * range 0x10-0x7f.
+ *
+ * @{
+ */
+
+/** PXE API extensions */
+#define DHCP_EB_FEATURE_PXE_EXT 0x10
+
+/** iSCSI */
+#define DHCP_EB_FEATURE_ISCSI 0x11
+
+/** AoE */
+#define DHCP_EB_FEATURE_AOE 0x12
+
+/** @} */
+
+/** Declare a feature code for DHCP */
+#define __dhcp_feature __table ( uint8_t, dhcp_features, 01 )
+
+/** Construct a DHCP feature table entry */
+#define DHCP_FEATURE( feature_opt ) \
+ _DHCP_FEATURE ( OBJECT, feature_opt )
+#define _DHCP_FEATURE( _name, feature_opt ) \
+ __DHCP_FEATURE ( _name, feature_opt )
+#define __DHCP_FEATURE( _name, feature_opt ) \
+ uint8_t __dhcp_feature_ ## _name [] __dhcp_feature = { \
+ feature_opt, DHCP_BYTE ( 1 ) \
+ };
+
+/** Declare a named feature */
+#define __feature_name __table ( char *, features, 01 )
+
+/** Construct a named feature */
+#define FEATURE_NAME( text ) \
+ _FEATURE_NAME ( OBJECT, text )
+#define _FEATURE_NAME( _name, text ) \
+ __FEATURE_NAME ( _name, text )
+#define __FEATURE_NAME( _name, text ) \
+ char * __feature_ ## _name __feature_name = text;
+
+/** Declare a feature */
+#define FEATURE( text, feature_opt ) \
+ FEATURE_NAME ( text ); \
+ DHCP_FEATURE ( feature_opt );
+
+#endif /* _GPXE_FEATURES_H */
diff --git a/src/net/aoe.c b/src/net/aoe.c
index fd82665d..5536ae8d 100644
--- a/src/net/aoe.c
+++ b/src/net/aoe.c
@@ -31,6 +31,7 @@
#include <gpxe/ata.h>
#include <gpxe/netdevice.h>
#include <gpxe/process.h>
+#include <gpxe/features.h>
#include <gpxe/aoe.h>
/** @file
@@ -39,6 +40,8 @@
*
*/
+FEATURE ( "AoE", DHCP_EB_FEATURE_AOE );
+
struct net_protocol aoe_protocol;
/** List of all AoE sessions */
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index e6459171..5d8639e7 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -32,6 +32,7 @@
#include <gpxe/uaccess.h>
#include <gpxe/tcpip.h>
#include <gpxe/dhcp.h>
+#include <gpxe/features.h>
#include <gpxe/iscsi.h>
/** @file
@@ -40,6 +41,8 @@
*
*/
+FEATURE ( "iSCSI", DHCP_EB_FEATURE_ISCSI );
+
/** iSCSI initiator name (explicitly specified) */
static char *iscsi_explicit_initiator_iqn;
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index f8f59e2e..ed455632 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -70,6 +70,10 @@ static uint8_t dhcp_request_options_data[] = {
DHCP_END
};
+/** DHCP feature codes */
+static uint8_t dhcp_features[0] __table_start ( uint8_t, dhcp_features );
+static uint8_t dhcp_features_end[0] __table_end ( uint8_t, dhcp_features );
+
/**
* Name a DHCP packet type
*
@@ -508,6 +512,7 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
struct dhcp_packet *dhcppkt ) {
struct device_description *desc = &netdev->dev->desc;
struct dhcp_netdev_desc dhcp_desc;
+ size_t dhcp_features_len;
int rc;
/* Create DHCP packet */
@@ -544,6 +549,16 @@ int create_dhcp_request ( struct net_device *netdev, int msgtype,
}
}
+ /* Add options to identify the feature list */
+ dhcp_features_len = ( dhcp_features_end - dhcp_features );
+ if ( ( rc = set_dhcp_packet_option ( dhcppkt, DHCP_EB_ENCAP,
+ dhcp_features,
+ dhcp_features_len ) ) != 0 ) {
+ DBG ( "DHCP could not set features list option: %s\n",
+ strerror ( rc ) );
+ return rc;
+ }
+
/* Add options to identify the network device */
dhcp_desc.type = desc->bus_type;
dhcp_desc.vendor = htons ( desc->vendor );