summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/features.h
diff options
context:
space:
mode:
authorMichael Brown2007-08-02 05:24:39 +0200
committerMichael Brown2007-08-02 05:24:39 +0200
commit0acb0168408c9e8e8fd843221bb57d1c3a39fb3d (patch)
tree901a5c2eefcba15c742d7b1cc1f3291e12feff6b /src/include/gpxe/features.h
parentfix gcc 4.2.1 warning: discards qualifiers from pointer target type (diff)
downloadipxe-0acb0168408c9e8e8fd843221bb57d1c3a39fb3d.tar.gz
ipxe-0acb0168408c9e8e8fd843221bb57d1c3a39fb3d.tar.xz
ipxe-0acb0168408c9e8e8fd843221bb57d1c3a39fb3d.zip
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).
Diffstat (limited to 'src/include/gpxe/features.h')
-rw-r--r--src/include/gpxe/features.h63
1 files changed, 63 insertions, 0 deletions
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 <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 */