From 0acb0168408c9e8e8fd843221bb57d1c3a39fb3d Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 2 Aug 2007 04:24:39 +0100 Subject: Add FEATURE() macro, plus code to display features at startup time, and generate DHCP options to indicate features to DHCP server (and to PXE NBPs). --- src/include/gpxe/dhcp.h | 5 ++++ src/include/gpxe/features.h | 63 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 src/include/gpxe/features.h (limited to 'src/include') diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h index 863227867..bbd345c8b 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 000000000..20cce316d --- /dev/null +++ b/src/include/gpxe/features.h @@ -0,0 +1,63 @@ +#ifndef _GPXE_FEATURES_H +#define _GPXE_FEATURES_H + +#include +#include +#include + +/** @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 */ -- cgit v1.2.3-55-g7522