EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

EmulatorPkg/EmuBusDriverDxe/ComponentName.c

Go to the documentation of this file.
00001 
00011 #include "EmuBusDriverDxe.h"
00012 
00013 //
00014 // EFI Component Name Functions
00015 //
00016 EFI_STATUS
00017 EFIAPI
00018 EmuBusDriverComponentNameGetDriverName (
00019   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
00020   IN  CHAR8                        *Language,
00021   OUT CHAR16                       **DriverName
00022   );
00023 
00024 EFI_STATUS
00025 EFIAPI
00026 EmuBusDriverComponentNameGetControllerName (
00027   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
00028   IN  EFI_HANDLE                                      ControllerHandle,
00029   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
00030   IN  CHAR8                                           *Language,
00031   OUT CHAR16                                          **ControllerName
00032   );
00033 
00034 //
00035 // EFI Component Name Protocol
00036 //
00037 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL     gEmuBusDriverComponentName = {
00038   EmuBusDriverComponentNameGetDriverName,
00039   EmuBusDriverComponentNameGetControllerName,
00040   "eng"
00041 };
00042 
00043 //
00044 // EFI Component Name 2 Protocol
00045 //
00046 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2 = {
00047   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuBusDriverComponentNameGetDriverName,
00048   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuBusDriverComponentNameGetControllerName,
00049   "en"
00050 };
00051 
00052 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuBusDriverNameTable[] = {
00053   { "eng", L"Emu Bus Driver" },
00054   { NULL , NULL }
00055 };
00056 
00096 EFI_STATUS
00097 EFIAPI
00098 EmuBusDriverComponentNameGetDriverName (
00099   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
00100   IN  CHAR8                        *Language,
00101   OUT CHAR16                       **DriverName
00102   )
00103 {
00104   return LookupUnicodeString2 (
00105           Language,
00106           This->SupportedLanguages,
00107           mEmuBusDriverNameTable,
00108           DriverName,
00109           (BOOLEAN)(This == &gEmuBusDriverComponentName)
00110           );
00111 }
00112 
00181 EFI_STATUS
00182 EFIAPI
00183 EmuBusDriverComponentNameGetControllerName (
00184   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
00185   IN  EFI_HANDLE                                      ControllerHandle,
00186   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
00187   IN  CHAR8                                           *Language,
00188   OUT CHAR16                                          **ControllerName
00189   )
00190 {
00191   EFI_STATUS              Status;
00192   EMU_IO_THUNK_PROTOCOL   *EmuIo;
00193   EMU_IO_DEVICE           *Private;
00194 
00195   //
00196   // Make sure this driver is currently managing ControllHandle
00197   //
00198   Status = EfiTestManagedDevice (
00199              ControllerHandle,
00200              gEmuBusDriverBinding.DriverBindingHandle,
00201              &gEmuThunkProtocolGuid
00202              );
00203   if (EFI_ERROR (Status)) {
00204     return Status;
00205   }
00206 
00207   //
00208   // This is a bus driver, so ChildHandle can not be NULL.
00209   //
00210   if (ChildHandle == NULL) {
00211     return EFI_UNSUPPORTED;
00212   }
00213 
00214   Status = EfiTestChildHandle (
00215              ControllerHandle,
00216              ChildHandle,
00217              &gEmuThunkProtocolGuid
00218              );
00219   if (EFI_ERROR (Status)) {
00220     return Status;
00221   }
00222 
00223   //
00224   // Get our context back
00225   //
00226   Status = gBS->OpenProtocol (
00227                   ChildHandle,
00228                   &gEmuIoThunkProtocolGuid,
00229                   (VOID**)&EmuIo,
00230                   gEmuBusDriverBinding.DriverBindingHandle,
00231                   ChildHandle,
00232                   EFI_OPEN_PROTOCOL_GET_PROTOCOL
00233                   );
00234   if (EFI_ERROR (Status)) {
00235     return EFI_UNSUPPORTED;
00236   }
00237 
00238   Private = EMU_IO_DEVICE_FROM_THIS (EmuIo);
00239 
00240   return LookupUnicodeString2 (
00241            Language,
00242            This->SupportedLanguages,
00243            Private->ControllerNameTable,
00244            ControllerName,
00245            (BOOLEAN)(This == &gEmuBusDriverComponentName)
00246           );
00247 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines