iPXE
|
EFI SNP HII protocol. More...
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <errno.h>
#include <ipxe/settings.h>
#include <ipxe/nvo.h>
#include <ipxe/device.h>
#include <ipxe/netdevice.h>
#include <ipxe/version.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_hii.h>
#include <ipxe/efi/efi_snp.h>
#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_path.h>
#include <ipxe/efi/efi_utils.h>
#include <ipxe/efi/efi_null.h>
#include <config/branding.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
EFI_REQUEST_PROTOCOL (EFI_HII_DATABASE_PROTOCOL, &efihii) | |
static struct settings * | efi_snp_hii_settings (struct efi_snp_device *snpdev) |
Identify settings to be exposed via HII. More... | |
static int | efi_snp_hii_setting_applies (struct efi_snp_device *snpdev, struct setting *setting) |
Check whether or not setting is applicable. More... | |
static void | efi_snp_hii_random_guid (EFI_GUID *guid) |
Generate a random GUID. More... | |
static void | efi_snp_hii_questions (struct efi_snp_device *snpdev, struct efi_ifr_builder *ifr, unsigned int varstore_id) |
Generate EFI SNP questions. More... | |
static EFI_HII_PACKAGE_LIST_HEADER * | efi_snp_hii_package_list (struct efi_snp_device *snpdev) |
Build HII package list for SNP device. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
static EFI_STATUS EFIAPI | efi_snp_hii_route_config (const EFI_HII_CONFIG_ACCESS_PROTOCOL *hii, EFI_STRING config, EFI_STRING *progress) |
Store configuration. More... | |
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. More... | |
int | efi_snp_hii_install (struct efi_snp_device *snpdev) |
Install HII protocol and packages for SNP device. More... | |
int | efi_snp_hii_uninstall (struct efi_snp_device *snpdev) |
Uninstall HII protocol and package for SNP device. More... | |
Variables | |
static EFI_GUID | efi_hii_platform_setup_formset_guid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID |
EFI platform setup formset GUID. More... | |
static EFI_GUID | efi_hii_ibm_ucm_compliant_formset_guid = EFI_HII_IBM_UCM_COMPLIANT_FORMSET_GUID |
EFI IBM UCM compliant formset GUID. More... | |
static EFI_HII_DATABASE_PROTOCOL * | efihii |
EFI HII database protocol. More... | |
static EFI_HII_CONFIG_ACCESS_PROTOCOL | efi_snp_device_hii |
HII configuration access protocol. More... | |
EFI SNP HII protocol.
The HII protocols are some of the less-well designed parts of the entire EFI specification. This is a significant accomplishment.
The face-slappingly ludicrous query string syntax seems to be motivated by the desire to allow a caller to query multiple drivers simultaneously via the single-instance HII_CONFIG_ROUTING_PROTOCOL, which is supposed to pass relevant subsets of the query string to the relevant drivers.
Nobody uses the HII_CONFIG_ROUTING_PROTOCOL. Not even the EFI setup browser uses the HII_CONFIG_ROUTING_PROTOCOL. To the best of my knowledge, there has only ever been one implementation of the HII_CONFIG_ROUTING_PROTOCOL (as part of EDK2), and it just doesn't work. It's so badly broken that I can't even figure out what the code is trying to do.
Fundamentally, the problem seems to be that Javascript programmers should not be allowed to design APIs for C code.
Definition in file efi_snp_hii.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
EFI_REQUEST_PROTOCOL | ( | EFI_HII_DATABASE_PROTOCOL | , |
& | efihii | ||
) |
|
static |
Identify settings to be exposed via HII.
snpdev | SNP device |
settings | Settings, or NULL |
Definition at line 89 of file efi_snp_hii.c.
References find_child_settings(), efi_snp_device::netdev, netdev_settings(), and NVO_SETTINGS_NAME.
Referenced by efi_snp_hii_fetch(), efi_snp_hii_setting_applies(), and efi_snp_hii_store().
|
static |
Check whether or not setting is applicable.
snpdev | SNP device |
setting | Setting |
applies | Setting applies |
Definition at line 102 of file efi_snp_hii.c.
References efi_snp_hii_settings(), and nvo_applies().
Referenced by efi_snp_hii_extract_config(), and efi_snp_hii_questions().
|
static |
Generate a random GUID.
guid | GUID to fill in |
Definition at line 113 of file efi_snp_hii.c.
References guid, and random().
Referenced by efi_snp_hii_install(), and efi_snp_hii_package_list().
|
static |
Generate EFI SNP questions.
snpdev | SNP device |
ifr | IFR builder |
varstore_id | Variable store identifier |
Definition at line 128 of file efi_snp_hii.c.
References setting::description, efi_ifr_string(), efi_ifr_string_op(), efi_snp_hii_setting_applies(), for_each_table_entry, setting::name, NULL, PRODUCT_SETTING_URI, setting_cmp(), SETTINGS, and setting::tag.
Referenced by efi_snp_hii_package_list().
|
static |
Build HII package list for SNP device.
snpdev | SNP device |
package | Package list, or NULL on error |
Definition at line 163 of file efi_snp_hii.c.
References DBGC, net_device::dev, device::driver_name, efi_hii_ibm_ucm_compliant_formset_guid, efi_hii_platform_setup_formset_guid, efi_ifr_end_op(), efi_ifr_form_op(), efi_ifr_form_set_op(), efi_ifr_free(), efi_ifr_guid_class_op(), efi_ifr_guid_subclass_op(), efi_ifr_init(), efi_ifr_string(), efi_ifr_text_op(), efi_ifr_varstore_name_value_op(), EFI_NETWORK_DEVICE_CLASS, efi_snp_hii_questions(), efi_snp_hii_random_guid(), device::name, name, efi_snp_device::netdev, netdev, netdev_addr(), NULL, product_name, product_short_name, product_version, and efi_ifr_builder::varstore_id.
Referenced by efi_snp_hii_install().
|
static |
Append response to result string.
snpdev | SNP device |
key | Key |
value | Value |
results | Result string |
rc | Return status code |
The result string is allocated dynamically using BootServices::AllocatePool(), and the caller is responsible for eventually calling BootServices::FreePool().
Definition at line 248 of file efi_snp_hii.c.
References EFI_BOOT_SERVICES::AllocatePool, EFI_SYSTEM_TABLE::BootServices, EEFI, efi_snprintf(), efi_systab, EfiBootServicesData, EFI_BOOT_SERVICES::FreePool, key, len, strlen(), value, and wcslen().
Referenced by efi_snp_hii_fetch().
|
static |
Fetch HII setting.
snpdev | SNP device |
key | Key |
value | Value |
results | Result string |
have_setting | Flag indicating detection of a setting |
rc | Return status code |
Definition at line 283 of file efi_snp_hii.c.
References DBGC, efi_snp_hii_append(), efi_snp_hii_settings(), ENODEV, ENOMEM, ENOTSUP, fetchf_setting(), find_setting(), free, key, len, setting::name, NULL, origin, rc, setting_exists(), sprintf, strcasecmp(), strerror(), value, and zalloc().
Referenced by efi_snp_hii_extract_config().
|
static |
Fetch HII setting.
snpdev | SNP device |
key | Key |
value | Value |
results | Result string (unused) |
have_setting | Flag indicating detection of a setting (unused) |
rc | Return status code |
Definition at line 384 of file efi_snp_hii.c.
References DBGC, efi_snp_hii_settings(), EINVAL, ENODEV, ENOMEM, ENOTSUP, find_setting(), free, key, len, memcpy(), setting::name, rc, storef_setting(), strcasecmp(), strerror(), strlen(), strtoul(), tmp, value, and zalloc().
Referenced by efi_snp_hii_route_config().
|
static |
Process portion of HII configuration string.
snpdev | SNP device |
string | HII configuration string |
progress | Progress through HII configuration string |
results | Results string |
have_setting | Flag indicating detection of a setting (unused) |
process | Function used to process key=value pairs |
rc | Return status code |
Definition at line 471 of file efi_snp_hii.c.
References ENOMEM, free, key, NULL, rc, string, value, and zalloc().
Referenced by efi_snp_hii_extract_config(), and efi_snp_hii_route_config().
|
static |
Fetch configuration.
hii | HII configuration access protocol |
request | Configuration to fetch |
progress | Progress made through configuration to fetch |
results | Query results |
efirc | EFI status code |
Definition at line 538 of file efi_snp_hii.c.
References container_of, DBGC, EFI_INVALID_PARAMETER, efi_snp_hii_fetch(), efi_snp_hii_process(), efi_snp_hii_setting_applies(), EFIRC, for_each_table_entry, efi_snp_device::hii, setting::name, NULL, rc, request, and SETTINGS.
|
static |
Store configuration.
hii | HII configuration access protocol |
config | Configuration to store |
progress | Progress made through configuration to store |
efirc | EFI status code |
Definition at line 599 of file efi_snp_hii.c.
References container_of, DBGC, efi_snp_hii_process(), efi_snp_hii_store(), EFIRC, efi_snp_device::hii, NULL, and rc.
|
static |
Handle form actions.
hii | HII configuration access protocol |
action | Form browser action |
question_id | Question ID |
type | Type of value |
value | Value |
action_request | Action requested by driver |
efirc | EFI status code |
Definition at line 633 of file efi_snp_hii.c.
References container_of, DBGC, EFI_UNSUPPORTED, and efi_snp_device::hii.
int efi_snp_hii_install | ( | struct efi_snp_device * | snpdev | ) |
Install HII protocol and packages for SNP device.
snpdev | SNP device |
rc | Return status code |
Definition at line 658 of file efi_snp_hii.c.
References EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI, efi_child_add(), efi_child_del(), efi_device_path_protocol_guid, efi_hii_config_access_protocol_guid, efi_nullify_hii(), efi_path_len(), efi_path_terminate(), efi_snp_device_hii, efi_snp_hii_package_list(), efi_snp_hii_random_guid(), efi_systab, efihii, ENOMEM, ENOTSUP, free, VENDOR_DEVICE_PATH::Guid, efi_snp_device::handle, HARDWARE_DEVICE_PATH, VENDOR_DEVICE_PATH::Header, efi_snp_device::hii, efi_snp_device::hii_child_handle, efi_snp_device::hii_child_path, efi_snp_device::hii_handle, HW_VENDOR_DP, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, EFI_DEVICE_PATH_PROTOCOL::Length, memcpy(), _EFI_HII_DATABASE_PROTOCOL::NewPackageList, NULL, efi_snp_device::package_list, efi_snp_device::path, rc, _EFI_HII_DATABASE_PROTOCOL::RemovePackageList, strerror(), EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, and zalloc().
Referenced by efi_snp_probe().
int efi_snp_hii_uninstall | ( | struct efi_snp_device * | snpdev | ) |
Uninstall HII protocol and package for SNP device.
snpdev | SNP device |
leak | Uninstallation failed: leak memory |
Definition at line 796 of file efi_snp_hii.c.
References EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI, efi_child_del(), efi_device_path_protocol_guid, efi_hii_config_access_protocol_guid, efi_nullify_hii(), efi_shutdown_in_progress, efi_systab, efihii, free, efi_snp_device::handle, efi_snp_device::hii, efi_snp_device::hii_child_handle, efi_snp_device::hii_child_path, efi_snp_device::hii_handle, NULL, efi_snp_device::package_list, _EFI_HII_DATABASE_PROTOCOL::RemovePackageList, strerror(), and EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces.
Referenced by efi_snp_probe(), and efi_snp_remove().
|
static |
EFI platform setup formset GUID.
Definition at line 73 of file efi_snp_hii.c.
Referenced by efi_snp_hii_package_list().
|
static |
EFI IBM UCM compliant formset GUID.
Definition at line 77 of file efi_snp_hii.c.
Referenced by efi_snp_hii_package_list().
|
static |
EFI HII database protocol.
Definition at line 80 of file efi_snp_hii.c.
Referenced by efi_snp_hii_install(), and efi_snp_hii_uninstall().
|
static |
HII configuration access protocol.
Definition at line 646 of file efi_snp_hii.c.
Referenced by efi_snp_hii_install().