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).
This commit is contained in:
Michael Brown
2007-08-02 04:24:39 +01:00
parent 857c5db4dd
commit 0acb016840
6 changed files with 99 additions and 1 deletions

View File

@@ -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.

View File

@@ -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 */