117 for ( i = 0 ; i <
sizeof ( *guid ) ; i++ )
130 unsigned int varstore_id ) {
133 unsigned int name_id;
134 unsigned int prompt_id;
135 unsigned int help_id;
136 unsigned int question_id;
151 question_id, varstore_id, name_id,
172 unsigned int title_id;
221 package = efi_ifr_package ( &ifr, &package_guid, "en-us",
222 efi_ifr_string ( &ifr, "English" ) );
224 DBGC ( snpdev,
"SNPDEV %p could not build IFR package\n",
250 wchar_t **results ) {
257 len = ( ( *results ? (
wcslen ( *results ) + 1 ) : 0 ) +
260 (
len * sizeof (
wchar_t ) ),
262 return -
EEFI ( efirc );
266 ( *results ? L
"&" : L
"" ),
key,
value );
285 wchar_t **results,
int *have_setting ) {
308 goto err_no_settings;
314 DBGC ( snpdev,
"SNPDEV %p no such setting \"%s\"\n",
317 goto err_find_setting;
328 DBGC ( snpdev,
"SNPDEV %p could not fetch %s: %s\n",
339 encoded = ( buf +
len + 1 );
344 for ( i = 0 ; i <
len ; i++ ) {
345 sprintf ( ( encoded + ( 4 * i ) ),
"%04x",
408 goto err_no_settings;
414 DBGC ( snpdev,
"SNPDEV %p no such setting \"%s\"\n",
417 goto err_find_setting;
430 for ( i = 0 ; i <
len ; i++ ) {
433 if ( endp != &
tmp[4] ) {
434 DBGC ( snpdev,
"SNPDEV %p invalid character %s\n",
443 DBGC ( snpdev,
"SNPDEV %p could not store \"%s\" into %s: %s\n",
472 wchar_t *
string,
wchar_t **progress,
473 wchar_t **results,
int *have_setting,
478 int *have_setting ) ) {
481 wchar_t *wvalue =
NULL;
493 if ( *(wend++) == L
'=' )
498 key_len = ( ( wvalue ? ( wvalue - 1 ) : wend ) - wkey );
499 value_len = ( wvalue ? ( wend - wvalue ) : 0 );
500 temp =
zalloc ( key_len + 1 + value_len + 1 );
504 value = ( temp + key_len + 1 );
508 key[key_len] = wkey[key_len];
509 while ( value_len-- )
510 value[value_len] = wvalue[value_len];
514 have_setting ) ) != 0 ) {
543 int have_setting = 0;
547 DBGC ( snpdev,
"SNPDEV %p ExtractConfig request \"%ls\"\n",
555 DBGC ( snpdev,
"SNPDEV %p ExtractConfig ignoring malformed " 556 "request\n", snpdev );
561 for ( pos = *progress =
request ; *progress && **progress ;
562 pos = *progress + 1 ) {
564 results, &have_setting,
571 if ( ! have_setting ) {
585 DBGC ( snpdev,
"SNPDEV %p ExtractConfig results \"%ls\"\n",
606 DBGC ( snpdev,
"SNPDEV %p RouteConfig \"%ls\"\n", snpdev, config );
609 for ( pos = *progress = config ; *progress && **progress ;
610 pos = *progress + 1 ) {
641 DBGC ( snpdev,
"SNPDEV %p Callback\n", snpdev );
662 size_t path_prefix_len;
679 DBGC ( snpdev,
"SNPDEV %p could not create HII package list\n",
682 goto err_build_package_list;
688 sizeof ( *vendor_path ) +
689 sizeof ( *path_end ) );
692 "SNPDEV %p could not allocate HII child device path\n",
695 goto err_alloc_child_path;
704 vendor_path->
Header.
Length[0] =
sizeof ( *vendor_path );
706 path_end = ( (
void * ) ( vendor_path + 1 ) );
715 DBGC ( snpdev,
"SNPDEV %p could not create HII child handle: " 717 goto err_hii_child_handle;
725 DBGC ( snpdev,
"SNPDEV %p could not add HII packages: %s\n",
727 goto err_new_package_list;
736 DBGC ( snpdev,
"SNPDEV %p could not install HII protocol: %s\n",
738 goto err_install_protocol;
745 "SNPDEV %p could not adopt HII child handle: %s\n",
747 goto err_efi_child_add;
758 DBGC ( snpdev,
"SNPDEV %p could not uninstall HII protocol: " 763 err_install_protocol:
766 err_new_package_list:
771 DBGC ( snpdev,
"SNPDEV %p could not uninstall HII path: %s\n",
775 err_hii_child_handle:
780 err_alloc_child_path:
785 err_build_package_list:
812 DBGC ( snpdev,
"SNPDEV %p could not uninstall HII protocol: " 824 DBGC ( snpdev,
"SNPDEV %p could not uninstall HII path: %s\n",
837 DBGC ( snpdev,
"SNPDEV %p HII nullified and leaked\n", snpdev );
const char product_short_name[]
Product short name string.
EFI human interface infrastructure.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
#define EINVAL
Invalid argument.
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
struct arbelprm_rc_send_wqe rc
void efi_ifr_form_set_op(struct efi_ifr_builder *ifr, const EFI_GUID *guid, unsigned int title_id, unsigned int help_id,...)
Add formset opcode to IFR builder.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static void efi_ifr_init(struct efi_ifr_builder *ifr)
Initialise IFR builder.
int fetchf_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char *buf, size_t len)
Fetch formatted value of setting.
int nvo_applies(struct settings *settings __unused, const struct setting *setting)
Check applicability of NVO setting.
void efi_ifr_end_op(struct efi_ifr_builder *ifr)
Add end opcode to IFR builder.
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
static void efi_snp_hii_random_guid(EFI_GUID *guid)
Generate a random GUID.
unsigned int efi_ifr_varstore_name_value_op(struct efi_ifr_builder *ifr, const EFI_GUID *guid)
Add name/value store opcode to IFR builder.
static EFI_GUID efi_hii_ibm_ucm_compliant_formset_guid
EFI IBM UCM compliant formset GUID.
static struct settings * efi_snp_hii_settings(struct efi_snp_device *snpdev)
Identify settings to be exposed via HII.
128 bit buffer containing a unique identifier value.
EFI_HII_DATABASE_REMOVE_PACK RemovePackageList
#define HARDWARE_DEVICE_PATH
Hardware Device Paths.
uint32_t type
Operating system type.
#define sprintf(buf, fmt,...)
Write a formatted string to a buffer.
static int efi_snp_hii_append(struct efi_snp_device *snpdev __unused, const char *key, const char *value, wchar_t **results)
Append response to result string.
EFI_HII_ACCESS_EXTRACT_CONFIG ExtractConfig
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
int strcasecmp(const char *first, const char *second)
Compare case-insensitive strings.
size_t efi_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
This protocol can be used on any device handle to obtain generic path/location information concerning...
const char * description
Description.
int efi_child_add(EFI_HANDLE parent, EFI_HANDLE child)
Add EFI device as child of another EFI device.
EFI_HANDLE hii_child_handle
EFI child handle for HII association.
static const char * netdev_addr(struct net_device *netdev)
Get printable network device link-layer address.
EFI_HII_CONFIG_ACCESS_PROTOCOL hii
HII configuration access protocol.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
EFI_HANDLE handle
EFI device handle.
size_t wcslen(const wchar_t *string)
Calculate length of wide-character string.
EFI_GUID efi_hii_config_access_protocol_guid
HII configuration access protocol GUID.
#define ENOTSUP
Operation not supported.
static void efi_path_terminate(EFI_DEVICE_PATH_PROTOCOL *end)
Terminate device path.
This protocol provides a callable interface between the HII and drivers.
#define SETTINGS
Configuration setting table.
struct net_device * netdev
The underlying iPXE network device.
void efi_ifr_string_op(struct efi_ifr_builder *ifr, unsigned int prompt_id, unsigned int help_id, unsigned int question_id, unsigned int varstore_id, unsigned int varstore_info, unsigned int vflags, unsigned int min_size, unsigned int max_size, unsigned int flags)
Add string opcode to IFR builder.
uint64_t tag
Setting tag, if applicable.
void efi_child_del(EFI_HANDLE parent, EFI_HANDLE child)
Remove EFI device as child of another EFI device.
EFI_HII_HANDLE hii_handle
HII handle.
EFI_GUID Guid
Vendor-assigned GUID that defines the data that follows.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
int efi_snp_hii_uninstall(struct efi_snp_device *snpdev)
Uninstall HII protocol and package for SNP device.
Database manager for HII-related data structures.
static void efi_snp_hii_questions(struct efi_snp_device *snpdev, struct efi_ifr_builder *ifr, unsigned int varstore_id)
Generate EFI SNP questions.
int efi_snp_hii_install(struct efi_snp_device *snpdev)
Install HII protocol and packages for SNP device.
EFI_DEVICE_PATH_PROTOCOL Header
EFI_HII_PACKAGE_LIST_HEADER * package_list
HII package list.
static int efi_snp_hii_process(struct efi_snp_device *snpdev, wchar_t *string, wchar_t **progress, wchar_t **results, int *have_setting, int(*process)(struct efi_snp_device *, const char *key, const char *value, wchar_t **results, int *have_setting))
Process portion of HII configuration string.
#define PRODUCT_SETTING_URI
#define container_of(ptr, type, field)
Get containing structure.
static int efi_snp_hii_fetch(struct efi_snp_device *snpdev, const char *key, const char *value, wchar_t **results, int *have_setting)
Fetch HII setting.
static EFI_STATUS EFIAPI efi_snp_hii_route_config(const EFI_HII_CONFIG_ACCESS_PROTOCOL *hii, EFI_STRING config, EFI_STRING *progress)
Store configuration.
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
void efi_ifr_guid_subclass_op(struct efi_ifr_builder *ifr, unsigned int subclass)
Add GUID subclass opcode to IFR builder.
static int efi_snp_hii_store(struct efi_snp_device *snpdev, const char *key, const char *value, wchar_t **results __unused, int *have_setting __unused)
Fetch HII setting.
#define HW_VENDOR_DP
Hardware Vendor Device Path SubType.
The Vendor Device Path allows the creation of vendor-defined Device Paths.
static struct net_device * netdev
int efi_snprintf(wchar_t *wbuf, size_t wsize, const char *fmt,...)
Write a formatted string to a buffer.
static int efi_snp_hii_setting_applies(struct efi_snp_device *snpdev, struct setting *setting)
Check whether or not setting is applicable.
void efi_ifr_text_op(struct efi_ifr_builder *ifr, unsigned int prompt_id, unsigned int help_id, unsigned int text_id)
Add text opcode to IFR builder.
unsigned int efi_ifr_form_op(struct efi_ifr_builder *ifr, unsigned int title_id)
Add form opcode to IFR builder.
const char * driver_name
Driver name.
static EFI_GUID efi_hii_platform_setup_formset_guid
EFI platform setup formset GUID.
unsigned int varstore_id
Current variable store identifier.
int storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
Non-volatile stored options.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
void efi_nullify_hii(EFI_HII_CONFIG_ACCESS_PROTOCOL *hii)
Nullify HII configuration access protocol.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
#define ENODEV
No such device.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t strlen(const char *src)
Get length of string.
const char product_version[]
Product version string.
static EFI_HII_PACKAGE_LIST_HEADER * efi_snp_hii_package_list(struct efi_snp_device *snpdev)
Build HII package list for SNP device.
EFI_DEVICE_PATH_PROTOCOL * hii_child_path
Device path of HII child handle.
#define EFI_INVALID_PARAMETER
Enumeration of EFI_STATUS.
static EFI_HII_CONFIG_ACCESS_PROTOCOL efi_snp_device_hii
HII configuration access protocol.
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
void efi_ifr_free(struct efi_ifr_builder *ifr)
Free memory used by IFR builder.
static EFI_STATUS EFIAPI efi_snp_hii_extract_config(const EFI_HII_CONFIG_ACCESS_PROTOCOL *hii, EFI_STRING request, EFI_STRING *progress, EFI_STRING *results)
Fetch configuration.
void efi_ifr_guid_class_op(struct efi_ifr_builder *ifr, unsigned int class)
Add GUID class opcode to IFR builder.
#define EFI_HII_IBM_UCM_COMPLIANT_FORMSET_GUID
GUID indicating formset compliance for IBM Unified Configuration Manager.
struct device * dev
Underlying hardware device.
Network device management.
static int setting_exists(struct settings *settings, const struct setting *setting)
Check existence of predefined setting.
UINT8 Length[2]
Specific Device Path data.
unsigned int efi_ifr_string(struct efi_ifr_builder *ifr, const char *fmt,...)
Add string to IFR builder.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
UINT8 SubType
Varies by Type 0xFF End Entire Device Path, or 0x01 End This Instance of a Device Path and start a ne...
static EFI_STATUS EFIAPI efi_snp_hii_callback(const EFI_HII_CONFIG_ACCESS_PROTOCOL *hii, EFI_BROWSER_ACTION action __unused, EFI_QUESTION_ID question_id __unused, UINT8 type __unused, EFI_IFR_TYPE_VALUE *value __unused, EFI_BROWSER_ACTION_REQUEST *action_request __unused)
Handle form actions.
u8 request[0]
List of IEs requested.
EFI_HII_DATABASE_NEW_PACK NewPackageList
UINT8 Type
0x01 Hardware Device Path.
#define NVO_SETTINGS_NAME
Name of non-volatile options settings block.
#define EFI_NETWORK_DEVICE_CLASS
EFI_SYSTEM_TABLE * efi_systab
const char product_name[]
Product name string.
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
struct setting * find_setting(const char *name)
Find predefined setting.
struct settings * find_child_settings(struct settings *parent, const char *name)
Find child settings block.
EFI_DEVICE_PATH_PROTOCOL * path
The device path.
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
#define NULL
NULL pointer (VOID *)
EFI_REQUEST_PROTOCOL(EFI_HII_DATABASE_PROTOCOL, &efihii)
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
EFI_ALLOCATE_POOL AllocatePool
int efi_shutdown_in_progress
EFI shutdown is in progress.
static EFI_HII_DATABASE_PROTOCOL * efihii
EFI HII database protocol.