ComponentName.c revision e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4c
1e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff /*++ 2e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 3e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffCopyright (c) 2004 - 2007, Intel Corporation 4e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffAll rights reserved. This program and the accompanying materials 5e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffare licensed and made available under the terms and conditions of the BSD License 6e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffwhich accompanies this distribution. The full text of the license may be found at 7e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffhttp://opensource.org/licenses/bsd-license.php 8e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 9e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 12e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffModule Name: 13e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 14e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ComponentName.c 15e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 16e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffAbstract: 17e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 18e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff--*/ 19e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 20e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 21e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// The package level header files this module uses 22e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 23e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff#include <PiDxe.h> 24e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 25e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 26e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// The Library classes this module consumes 27e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 28e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff#include <Library/UefiLib.h> 29e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 30e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 31e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// EFI Component Name Functions 32e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 33e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFI_STATUS 34e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFIAPI 35e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffUsbMassStorageGetDriverName ( 36e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 37e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN CHAR8 *Language, 38e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff OUT CHAR16 **DriverName 39e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ); 40e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 41e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFI_STATUS 42e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFIAPI 43e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffUsbMassStorageGetControllerName ( 44e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 45e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_HANDLE ControllerHandle, 46e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_HANDLE ChildHandle OPTIONAL, 47e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN CHAR8 *Language, 48e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff OUT CHAR16 **ControllerName 49e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ); 50e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 51e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 52e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// EFI Component Name Protocol 53e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff// 54e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName = { 55e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff UsbMassStorageGetDriverName, 56e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff UsbMassStorageGetControllerName, 57e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff "eng" 58e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff}; 59e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 60e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffSTATIC EFI_UNICODE_STRING_TABLE 61e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffmUsbMassStorageDriverNameTable[] = { 62e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff {"eng", L"Usb Mass Storage Driver"}, 63e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff {NULL, NULL} 64e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff}; 65e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 66e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFI_STATUS 67e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFIAPI 68e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffUsbMassStorageGetDriverName ( 69e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 70e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN CHAR8 *Language, 71e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff OUT CHAR16 **DriverName 72e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ) 73e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff/*++ 74e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 75e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Routine Description: 76e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Retrieves a Unicode string that is the user readable name of the EFI Driver. 77e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 78e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Arguments: 79e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. 80e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Language - A pointer to a three character ISO 639-2 language identifier. 81e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff This is the language of the driver name that that the caller 82e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff is requesting, and it must match one of the languages specified 83e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff in SupportedLanguages. The number of languages supported by a 84e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff driver is up to the driver writer. 85e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff DriverName - A pointer to the Unicode string to return. This Unicode string 86e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff is the name of the driver specified by This in the language 87e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff specified by Language. 88e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 89e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Returns: 90e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff EFI_SUCCESS - The Unicode string for the Driver specified by This 91e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff and the language specified by Language was returned 92e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff in DriverName. 93e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff EFI_INVALID_PARAMETER - Language is NULL. 94e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff EFI_INVALID_PARAMETER - DriverName is NULL. 95e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff EFI_UNSUPPORTED - The driver specified by This does not support the 96e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff language specified by Language. 97e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 98e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff--*/ 99e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff{ 100e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff return LookupUnicodeString ( 101e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Language, 102e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff gUsbMassStorageComponentName.SupportedLanguages, 103e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff mUsbMassStorageDriverNameTable, 104e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff DriverName 105e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ); 106e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff} 107e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 108e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFI_STATUS 109e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffEFIAPI 110e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeffUsbMassStorageGetControllerName ( 111e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 112e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_HANDLE ControllerHandle, 113e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN EFI_HANDLE ChildHandle OPTIONAL, 114e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff IN CHAR8 *Language, 115e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff OUT CHAR16 **ControllerName 116e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ) 117e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff/*++ 118e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 119e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Routine Description: 120e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Retrieves a Unicode string that is the user readable name of the controller 121e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff that is being managed by an EFI Driver. 122e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 123e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Arguments: 124e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. 125e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ControllerHandle - The handle of a controller that the driver specified by 126e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff This is managing. This handle specifies the controller 127e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff whose name is to be returned. 128e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ChildHandle - The handle of the child controller to retrieve the name 129e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff of. This is an optional parameter that may be NULL. It 130e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff will be NULL for device drivers. It will also be NULL 131e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff for a bus drivers that wish to retrieve the name of the 132e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff bus controller. It will not be NULL for a bus driver 133e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff that wishes to retrieve the name of a child controller. 134e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Language - A pointer to a three character ISO 639-2 language 135e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff identifier. This is the language of the controller name 136e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff that that the caller is requesting, and it must match one 137e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff of the languages specified in SupportedLanguages. The 138e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff number of languages supported by a driver is up to the 139e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff driver writer. 140e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ControllerName - A pointer to the Unicode string to return. This Unicode 141e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff string is the name of the controller specified by 142e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff ControllerHandle and ChildHandle in the language specified 143e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff by Language from the point of view of the driver specified 144e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff by This. 145e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 146e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff Returns: 147e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff EFI_UNSUPPORTED - The driver specified by This does not support the 148e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff language specified by Language. 149e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff 150e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff--*/ 151e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff{ 152e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff return EFI_UNSUPPORTED; 153e237e7ae9fc23f32a25040d49cc9a16f2a7f3b4cvanjeff} 154