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

VBoxPkg/VBoxVgaDxe/ComponentName.c

Go to the documentation of this file.
00001 /* $Id: ComponentName.c 29081 2010-05-05 13:32:04Z vboxsync $ */
00006 /*
00007  * Copyright (C) 2009-2010 Oracle Corporation
00008  *
00009  * This file is part of VirtualBox Open Source Edition (OSE), as
00010  * available from http://www.virtualbox.org. This file is free software;
00011  * you can redistribute it and/or modify it under the terms of the GNU
00012  * General Public License (GPL) as published by the Free Software
00013  * Foundation, in version 2 as it comes in the "COPYING" file of the
00014  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
00015  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
00016  */
00017 
00018 /*
00019   This code is based on:
00020 
00021   Copyright (c) 2006, Intel Corporation
00022   All rights reserved. This program and the accompanying materials
00023   are licensed and made available under the terms and conditions of the BSD License
00024   which accompanies this distribution.  The full text of the license may be found at
00025   http://opensource.org/licenses/bsd-license.php
00026 
00027   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00028   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00029 
00030 */
00031 
00032 #include "VBoxVga.h"
00033 
00034 //
00035 // EFI Component Name Protocol
00036 //
00037 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gVBoxVgaComponentName = {
00038   VBoxVgaComponentNameGetDriverName,
00039   VBoxVgaComponentNameGetControllerName,
00040   "eng"
00041 };
00042 
00043 //
00044 // EFI Component Name 2 Protocol
00045 //
00046 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gVBoxVgaComponentName2 = {
00047   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) VBoxVgaComponentNameGetDriverName,
00048   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) VBoxVgaComponentNameGetControllerName,
00049   "en"
00050 };
00051 
00052 
00053 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVBoxVgaDriverNameTable[] = {
00054   { "eng;en", L"Cirrus Logic 5430 Driver" },
00055   { NULL , NULL }
00056 };
00057 
00058 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVBoxVgaControllerNameTable[] = {
00059   { "eng;en", L"Cirrus Logic 5430 PCI Adapter" },
00060   { NULL , NULL }
00061 };
00062 
00102 EFI_STATUS
00103 EFIAPI
00104 VBoxVgaComponentNameGetDriverName (
00105   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
00106   IN  CHAR8                        *Language,
00107   OUT CHAR16                       **DriverName
00108   )
00109 {
00110   return LookupUnicodeString2 (
00111            Language,
00112            This->SupportedLanguages,
00113            mVBoxVgaDriverNameTable,
00114            DriverName,
00115            (BOOLEAN)(This == &gVBoxVgaComponentName)
00116            );
00117 }
00118 
00187 EFI_STATUS
00188 EFIAPI
00189 VBoxVgaComponentNameGetControllerName (
00190   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
00191   IN  EFI_HANDLE                                      ControllerHandle,
00192   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
00193   IN  CHAR8                                           *Language,
00194   OUT CHAR16                                          **ControllerName
00195   )
00196 {
00197   EFI_STATUS                      Status;
00198 
00199   //
00200   // This is a device driver, so ChildHandle must be NULL.
00201   //
00202   if (ChildHandle != NULL) {
00203     return EFI_UNSUPPORTED;
00204   }
00205 
00206   //
00207   // Make sure this driver is currently managing ControllHandle
00208   //
00209   Status = EfiTestManagedDevice (
00210              ControllerHandle,
00211              gVBoxVgaDriverBinding.DriverBindingHandle,
00212              &gEfiPciIoProtocolGuid
00213              );
00214   if (EFI_ERROR (Status)) {
00215     return Status;
00216   }
00217 
00218   //
00219   // Get the Cirrus Logic 5430's Device structure
00220   //
00221   return LookupUnicodeString2 (
00222            Language,
00223            This->SupportedLanguages,
00224            mVBoxVgaControllerNameTable,
00225            ControllerName,
00226            (BOOLEAN)(This == &gVBoxVgaComponentName)
00227            );
00228 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines