Path: blob/main/sys/contrib/edk2/Include/Protocol/HiiConfigRouting.h
96339 views
/** @file1The file provides services to manage the movement of2configuration data from drivers to configuration applications.3It then serves as the single point to receive configuration4information from configuration applications, routing the5results to the appropriate drivers.67Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>8SPDX-License-Identifier: BSD-2-Clause-Patent910@par Revision Reference:11This Protocol was introduced in UEFI Specification 2.1.121314**/1516#ifndef __HII_CONFIG_ROUTING_H__17#define __HII_CONFIG_ROUTING_H__1819#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \20{ 0x587e72d7, 0xcc50, 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } }2122typedef struct _EFI_HII_CONFIG_ROUTING_PROTOCOL EFI_HII_CONFIG_ROUTING_PROTOCOL;2324/**2526This function allows the caller to request the current27configuration for one or more named elements from one or more28drivers. The resulting string is in the standard HII29configuration string format. If Successful, Results contains an30equivalent string with "=" and the values associated with all31names added in. The expected implementation is for each32<ConfigRequest> substring in the Request to call the HII33Configuration Routing Protocol ExtractProtocol function for the34driver corresponding to the <ConfigHdr> at the start of the35<ConfigRequest> substring. The request fails if no driver36matches the <ConfigRequest> substring. Note: Alternative37configuration strings may also be appended to the end of the38current configuration string. If they are, they must appear39after the current configuration. They must contain the same40routing (GUID, NAME, PATH) as the current configuration string.41They must have an additional description indicating the type of42alternative configuration the string represents,43"ALTCFG=<StringToken>". That <StringToken> (when converted from44hexadecimal (encoded as text) to binary) is a reference to a string in the45associated string pack. As an example, assume that the Request46string is:47GUID=...&NAME=00480050&PATH=...&Fred&George&Ron&Neville A result48might be:49GUID=...&NAME=00480050&PATH=...&Fred=16&George=16&Ron=12&Neville=11&50GUID=...&NAME=00480050&PATH=...&ALTCFG=0037&Fred=12&Neville=75152@param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL53instance.5455@param Request A null-terminated string in <MultiConfigRequest> format.5657@param Progress On return, points to a character in the58Request string. Points to the string's null59terminator if the request was successful. Points60to the most recent '&' before the first61failing name / value pair (or the beginning62of the string if the failure is in the first63name / value pair) if the request was not64successful6566@param Results A null-terminated string in <MultiConfigAltResp> format67which has all values filled in for the names in the68Request string.6970@retval EFI_SUCCESS The Results string is filled with the71values corresponding to all requested72names.7374@retval EFI_OUT_OF_RESOURCES Not enough memory to store the75parts of the results that must be76stored awaiting possible future77protocols.7879@retval EFI_INVALID_PARAMETER For example, passing in a NULL80for the Request parameter81would result in this type of82error. The Progress parameter83is set to NULL.8485@retval EFI_NOT_FOUND Routing data doesn't match any86known driver. Progress set to87the "G" in "GUID" of the88routing header that doesn't89match. Note: There is no90requirement that all routing91data be validated before any92configuration extraction.9394@retval EFI_INVALID_PARAMETER Illegal syntax. Progress set95to the most recent & before the96error, or the beginning of the97string.98@retval EFI_INVALID_PARAMETER The ExtractConfig function of the99underlying HII Configuration100Access Protocol returned101EFI_INVALID_PARAMETER. Progress102set to most recent & before the103error or the beginning of the104string.105106**/107typedef108EFI_STATUS109(EFIAPI *EFI_HII_EXTRACT_CONFIG)(110IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,111IN CONST EFI_STRING Request,112OUT EFI_STRING *Progress,113OUT EFI_STRING *Results114);115116/**117This function allows the caller to request the current configuration118for the entirety of the current HII database and returns the data in119a null-terminated string.120121This function allows the caller to request the current122configuration for all of the current HII database. The results123include both the current and alternate configurations as124described in ExtractConfig() above.125126@param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.127128@param Results Null-terminated Unicode string in129<MultiConfigAltResp> format which has all values130filled in for the entirety of the current HII131database. String to be allocated by the called132function. De-allocation is up to the caller.133134@retval EFI_SUCCESS The Results string is filled with the135values corresponding to all requested136names.137138@retval EFI_OUT_OF_RESOURCES Not enough memory to store the139parts of the results that must be140stored awaiting possible future141protocols.142143@retval EFI_INVALID_PARAMETERS For example, passing in a NULL144for the Results parameter145would result in this type of146error.147148**/149typedef150EFI_STATUS151(EFIAPI *EFI_HII_EXPORT_CONFIG)(152IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,153OUT EFI_STRING *Results154);155156/**157158This function routes the results of processing forms to the159appropriate targets. It scans for <ConfigHdr> within the string160and passes the header and subsequent body to the driver whose161location is described in the <ConfigHdr>. Many <ConfigHdr>s may162appear as a single request. The expected implementation is to163hand off the various <ConfigResp> substrings to the164Configuration Access Protocol RouteConfig routine corresponding165to the driver whose routing information is defined by the166<ConfigHdr> in turn.167168@param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.169170@param Configuration A null-terminated string in <MulltiConfigResp> format.171172@param Progress A pointer to a string filled in with the173offset of the most recent '&' before the174first failing name / value pair (or the175beginning of the string if the failure is in176the first name / value pair), or the177terminating NULL if all was successful.178179@retval EFI_SUCCESS The results have been distributed or are180awaiting distribution.181182@retval EFI_OUT_OF_RESOURCES Not enough memory to store the183parts of the results that must be184stored awaiting possible future185protocols.186187@retval EFI_INVALID_PARAMETERS Passing in a NULL for the188Results parameter would result189in this type of error.190191@retval EFI_NOT_FOUND The target for the specified routing data192was not found.193194**/195typedef196EFI_STATUS197(EFIAPI *EFI_HII_ROUTE_CONFIG)(198IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,199IN CONST EFI_STRING Configuration,200OUT EFI_STRING *Progress201);202203/**204205This function extracts the current configuration from a block of206bytes. To do so, it requires that the ConfigRequest string207consists of a list of <BlockName> formatted names. It uses the208offset in the name to determine the index into the Block to209start the extraction and the width of each name to determine the210number of bytes to extract. These are mapped to a string211using the equivalent of the C "%x" format (with optional leading212spaces). The call fails if, for any (offset, width) pair in213ConfigRequest, offset+value >= BlockSize.214215@param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.216217@param ConfigRequest A null-terminated string in <ConfigRequest> format.218219@param Block An array of bytes defining the block's220configuration.221222@param BlockSize The length in bytes of Block.223224@param Config The filled-in configuration string. String225allocated by the function. Returned only if226call is successful. The null-terminated string227will be <ConfigResp> format.228229@param Progress A pointer to a string filled in with the230offset of the most recent '&' before the231first failing name / value pair (or the232beginning of the string if the failure is in233the first name / value pair), or the234terminating NULL if all was successful.235236@retval EFI_SUCCESS The request succeeded. Progress points237to the null terminator at the end of the238ConfigRequest string.239240@retval EFI_OUT_OF_RESOURCES Not enough memory to allocate241Config. Progress points to the242first character of ConfigRequest.243244@retval EFI_INVALID_PARAMETERS Passing in a NULL for the245ConfigRequest or Block246parameter would result in this247type of error. Progress points248to the first character of249ConfigRequest.250251@retval EFI_NOT_FOUND The target for the specified routing data252was not found. Progress points to the253'G' in "GUID" of the errant routing254data.255@retval EFI_DEVICE_ERROR The block is not large enough. Progress undefined.256257@retval EFI_INVALID_PARAMETER Encountered non <BlockName>258formatted string. Block is259left updated and Progress260points at the '&' preceding261the first non-<BlockName>.262263**/264typedef265EFI_STATUS266(EFIAPI *EFI_HII_BLOCK_TO_CONFIG)(267IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,268IN CONST EFI_STRING ConfigRequest,269IN CONST UINT8 *Block,270IN CONST UINTN BlockSize,271OUT EFI_STRING *Config,272OUT EFI_STRING *Progress273);274275/**276This function maps a configuration containing a series of277<BlockConfig> formatted name value pairs in ConfigResp into a278Block so it may be stored in a linear mapped storage such as a279UEFI Variable. If present, the function skips GUID, NAME, and280PATH in <ConfigResp>. It stops when it finds a non-<BlockConfig>281name / value pair (after skipping the routing header) or when it282reaches the end of the string.283Example Assume an existing block containing: 00 01 02 03 04 05284And the ConfigResp string is:285OFFSET=4&WIDTH=1&VALUE=7&OFFSET=0&WIDTH=2&VALUE=AA55286The results are28755 AA 02 07 04 05288289@param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.290291@param ConfigResp A null-terminated string in <ConfigResp> format.292293@param Block A possibly null array of bytes294representing the current block. Only295bytes referenced in the ConfigResp296string in the block are modified. If297this parameter is null or if the298BlockLength parameter is (on input)299shorter than required by the300Configuration string, only the BlockSize301parameter is updated, and an appropriate302status (see below) is returned.303304@param BlockSize The length of the Block in units of UINT8.305On input, this is the size of the Block. On306output, if successful, contains the largest307index of the modified byte in the Block, or308the required buffer size if the Block is not309large enough.310311@param Progress On return, points to an element of the312ConfigResp string filled in with the offset313of the most recent "&" before the first314failing name / value pair (or the beginning315of the string if the failure is in the first316name / value pair), or the terminating NULL317if all was successful.318319@retval EFI_SUCCESS The request succeeded. Progress points to the null320terminator at the end of the ConfigResp string.321@retval EFI_OUT_OF_RESOURCES Not enough memory to allocate Config. Progress322points to the first character of ConfigResp.323@retval EFI_INVALID_PARAMETER Passing in a NULL for the ConfigResp or324Block parameter would result in this type of325error. Progress points to the first character of326ConfigResp.327@retval EFI_INVALID_PARAMETER Encountered non <BlockName> formatted name /328value pair. Block is left updated and329Progress points at the '&' preceding the first330non-<BlockName>.331@retval EFI_DEVICE_ERROR Block not large enough. Progress undefined.332@retval EFI_NOT_FOUND Target for the specified routing data was not found.333Progress points to the "G" in "GUID" of the errant334routing data.335@retval EFI_BUFFER_TOO_SMALL Block not large enough. Progress undefined.336BlockSize is updated with the required buffer size.337338**/339typedef340EFI_STATUS341(EFIAPI *EFI_HII_CONFIG_TO_BLOCK)(342IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,343IN CONST EFI_STRING ConfigResp,344IN OUT UINT8 *Block,345IN OUT UINTN *BlockSize,346OUT EFI_STRING *Progress347);348349/**350This helper function is to be called by drivers to extract portions of351a larger configuration string.352353@param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.354@param ConfigResp A null-terminated string in <ConfigAltResp> format.355@param Guid A pointer to the GUID value to search for in the356routing portion of the ConfigResp string when retrieving357the requested data. If Guid is NULL, then all GUID358values will be searched for.359@param Name A pointer to the NAME value to search for in the360routing portion of the ConfigResp string when retrieving361the requested data. If Name is NULL, then all Name362values will be searched for.363@param DevicePath A pointer to the PATH value to search for in the364routing portion of the ConfigResp string when retrieving365the requested data. If DevicePath is NULL, then all366DevicePath values will be searched for.367@param AltCfgId A pointer to the ALTCFG value to search for in the368routing portion of the ConfigResp string when retrieving369the requested data. If this parameter is NULL,370then the current setting will be retrieved.371@param AltCfgResp A pointer to a buffer which will be allocated by the372function which contains the retrieved string as requested.373This buffer is only allocated if the call was successful.374The null-terminated string will be <ConfigResp> format.375376@retval EFI_SUCCESS The request succeeded. The requested data was extracted377and placed in the newly allocated AltCfgResp buffer.378@retval EFI_OUT_OF_RESOURCES Not enough memory to allocate AltCfgResp.379@retval EFI_INVALID_PARAMETER Any parameter is invalid.380@retval EFI_NOT_FOUND The target for the specified routing data was not found.381**/382typedef383EFI_STATUS384(EFIAPI *EFI_HII_GET_ALT_CFG)(385IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,386IN CONST EFI_STRING ConfigResp,387IN CONST EFI_GUID *Guid,388IN CONST EFI_STRING Name,389IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,390IN CONST UINT16 *AltCfgId,391OUT EFI_STRING *AltCfgResp392);393394///395/// This protocol defines the configuration routing interfaces396/// between external applications and the HII. There may only be one397/// instance of this protocol in the system.398///399struct _EFI_HII_CONFIG_ROUTING_PROTOCOL {400EFI_HII_EXTRACT_CONFIG ExtractConfig;401EFI_HII_EXPORT_CONFIG ExportConfig;402EFI_HII_ROUTE_CONFIG RouteConfig;403EFI_HII_BLOCK_TO_CONFIG BlockToConfig;404EFI_HII_CONFIG_TO_BLOCK ConfigToBlock;405EFI_HII_GET_ALT_CFG GetAltConfig;406};407408extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid;409410#endif411412413