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

IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c

Go to the documentation of this file.
00001 
00015 #include "Ps2Mouse.h"
00016 
00017 //
00018 // EFI Component Name Protocol
00019 //
00020 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gPs2MouseComponentName = {
00021   Ps2MouseComponentNameGetDriverName,
00022   Ps2MouseComponentNameGetControllerName,
00023   "eng"
00024 };
00025 
00026 //
00027 // EFI Component Name 2 Protocol
00028 //
00029 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2 = {
00030   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2MouseComponentNameGetDriverName,
00031   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2MouseComponentNameGetControllerName,
00032   "en"
00033 };
00034 
00035 
00036 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {
00037   {
00038     "eng;en",
00039     L"PS/2 Mouse Driver"
00040   },
00041   {
00042     NULL,
00043     NULL
00044   }
00045 };
00046 
00086 EFI_STATUS
00087 EFIAPI
00088 Ps2MouseComponentNameGetDriverName (
00089   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
00090   IN  CHAR8                        *Language,
00091   OUT CHAR16                       **DriverName
00092   )
00093 {
00094   return LookupUnicodeString2 (
00095            Language,
00096            This->SupportedLanguages,
00097            mPs2MouseDriverNameTable,
00098            DriverName,
00099            (BOOLEAN)(This == &gPs2MouseComponentName)
00100            );
00101 }
00102 
00171 EFI_STATUS
00172 EFIAPI
00173 Ps2MouseComponentNameGetControllerName (
00174   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
00175   IN  EFI_HANDLE                                      ControllerHandle,
00176   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
00177   IN  CHAR8                                           *Language,
00178   OUT CHAR16                                          **ControllerName
00179   )
00180 {
00181   EFI_STATUS                                  Status;
00182   EFI_SIMPLE_POINTER_PROTOCOL                 *SimplePointerProtocol;
00183   PS2_MOUSE_DEV                               *MouseDev;
00184   EFI_ISA_IO_PROTOCOL                         *IsaIoProtocol;
00185 
00186   //
00187   // This is a device driver, so ChildHandle must be NULL.
00188   //
00189   if (ChildHandle != NULL) {
00190     return EFI_UNSUPPORTED;
00191   }
00192   //
00193   // Check Controller's handle
00194   //
00195   Status = gBS->OpenProtocol (
00196                   ControllerHandle,
00197                   &gEfiIsaIoProtocolGuid,
00198                   (VOID **) &IsaIoProtocol,
00199                   gPS2MouseDriver.DriverBindingHandle,
00200                   ControllerHandle,
00201                   EFI_OPEN_PROTOCOL_BY_DRIVER
00202                   );
00203   if (!EFI_ERROR (Status)) {
00204     gBS->CloseProtocol (
00205            ControllerHandle,
00206            &gEfiIsaIoProtocolGuid,
00207            gPS2MouseDriver.DriverBindingHandle,
00208            ControllerHandle
00209            );
00210 
00211     return EFI_UNSUPPORTED;
00212   }
00213 
00214   if (Status != EFI_ALREADY_STARTED) {
00215     return EFI_UNSUPPORTED;
00216   }
00217   //
00218   // Get the device context
00219   //
00220   Status = gBS->OpenProtocol (
00221                   ControllerHandle,
00222                   &gEfiSimplePointerProtocolGuid,
00223                   (VOID **) &SimplePointerProtocol,
00224                   gPS2MouseDriver.DriverBindingHandle,
00225                   ControllerHandle,
00226                   EFI_OPEN_PROTOCOL_GET_PROTOCOL
00227                   );
00228   if (EFI_ERROR (Status)) {
00229     return Status;
00230   }
00231 
00232   MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);
00233 
00234   return LookupUnicodeString2 (
00235            Language,
00236            This->SupportedLanguages,
00237            MouseDev->ControllerNameTable,
00238            ControllerName,
00239            (BOOLEAN)(This == &gPs2MouseComponentName)
00240            );
00241 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines