~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxIdeControllerDxe/ComponentName.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id$ */
 
2
/** @file
 
3
 * ComponentName.c
 
4
 */
 
5
 
 
6
/*
 
7
 * Copyright (C) 2009-2010 Oracle Corporation
 
8
 *
 
9
 * This file is part of VirtualBox Open Source Edition (OSE), as
 
10
 * available from http://www.virtualbox.org. This file is free software;
 
11
 * you can redistribute it and/or modify it under the terms of the GNU
 
12
 * General Public License (GPL) as published by the Free Software
 
13
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 
14
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 
15
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 
16
 */
 
17
 
 
18
/** @file
 
19
  This portion is to register the IDE Controller Driver name:
 
20
  "IDE Controller Init Driver"
 
21
 
 
22
  Copyright (c) 2008 Intel Corporation. <BR>
 
23
  All rights reserved. This program and the accompanying materials                          
 
24
  are licensed and made available under the terms and conditions of the BSD License         
 
25
  which accompanies this distribution.  The full text of the license may be found at        
 
26
  http://opensource.org/licenses/bsd-license.php                                            
 
27
 
 
28
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
 
29
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
 
30
 
 
31
**/
 
32
 
 
33
#include "IdeController.h"
 
34
 
 
35
//
 
36
// EFI Component Name Protocol
 
37
//
 
38
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gIdeControllerComponentName = {
 
39
  IdeControllerComponentNameGetDriverName,
 
40
  IdeControllerComponentNameGetControllerName,
 
41
  "eng"
 
42
};
 
43
 
 
44
//
 
45
// EFI Component Name 2 Protocol
 
46
//
 
47
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2 = {
 
48
  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IdeControllerComponentNameGetDriverName,
 
49
  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IdeControllerComponentNameGetControllerName,
 
50
  "en"
 
51
};
 
52
 
 
53
//
 
54
// Driver Name Strings
 
55
//
 
56
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerDriverNameTable[] = {
 
57
  {
 
58
    "eng;en",
 
59
    (CHAR16 *)L"IDE Controller Init Driver"
 
60
  },
 
61
  {
 
62
    NULL,
 
63
    NULL
 
64
  }
 
65
};
 
66
 
 
67
//
 
68
// Controller Name Strings
 
69
//
 
70
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerControllerNameTable[] = {
 
71
  {
 
72
    "eng;en",
 
73
    (CHAR16 *)L"PCAT IDE Controller"
 
74
  },
 
75
  {
 
76
    NULL,
 
77
    NULL
 
78
  }
 
79
};
 
80
 
 
81
EFI_STATUS
 
82
EFIAPI
 
83
IdeControllerComponentNameGetDriverName (
 
84
  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
 
85
  IN  CHAR8                        *Language,
 
86
  OUT CHAR16                       **DriverName
 
87
  )
 
88
/*++
 
89
 
 
90
  Routine Description:
 
91
    Retrieves a Unicode string that is the user readable name of the EFI Driver.
 
92
 
 
93
  Arguments:
 
94
    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
 
95
    Language   - A pointer to a three character ISO 639-2 language identifier.
 
96
                 This is the language of the driver name that that the caller 
 
97
                 is requesting, and it must match one of the languages specified
 
98
                 in SupportedLanguages.  The number of languages supported by a 
 
99
                 driver is up to the driver writer.
 
100
    DriverName - A pointer to the Unicode string to return.  This Unicode string
 
101
                 is the name of the driver specified by This in the language 
 
102
                 specified by Language.
 
103
 
 
104
  Returns:
 
105
    EFI_SUCCESS           - The Unicode string for the Driver specified by This
 
106
                            and the language specified by Language was returned 
 
107
                            in DriverName.
 
108
    EFI_INVALID_PARAMETER - Language is NULL.
 
109
    EFI_INVALID_PARAMETER - DriverName is NULL.
 
110
    EFI_UNSUPPORTED       - The driver specified by This does not support the 
 
111
                            language specified by Language.
 
112
 
 
113
--*/
 
114
{
 
115
  return LookupUnicodeString2 (
 
116
           Language,
 
117
           This->SupportedLanguages,
 
118
           mIdeControllerDriverNameTable,
 
119
           DriverName,
 
120
           (BOOLEAN)(This == &gIdeControllerComponentName)
 
121
           );
 
122
}
 
123
 
 
124
EFI_STATUS
 
125
EFIAPI
 
126
IdeControllerComponentNameGetControllerName (
 
127
  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
 
128
  IN  EFI_HANDLE                                      ControllerHandle,
 
129
  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
 
130
  IN  CHAR8                                           *Language,
 
131
  OUT CHAR16                                          **ControllerName
 
132
  )
 
133
/*++
 
134
 
 
135
  Routine Description:
 
136
    Retrieves a Unicode string that is the user readable name of the controller
 
137
    that is being managed by an EFI Driver.
 
138
 
 
139
  Arguments:
 
140
    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
 
141
    ControllerHandle - The handle of a controller that the driver specified by 
 
142
                       This is managing.  This handle specifies the controller 
 
143
                       whose name is to be returned.
 
144
    ChildHandle      - The handle of the child controller to retrieve the name 
 
145
                       of.  This is an optional parameter that may be NULL.  It 
 
146
                       will be NULL for device drivers.  It will also be NULL 
 
147
                       for a bus drivers that wish to retrieve the name of the 
 
148
                       bus controller.  It will not be NULL for a bus driver 
 
149
                       that wishes to retrieve the name of a child controller.
 
150
    Language         - A pointer to a three character ISO 639-2 language 
 
151
                       identifier.  This is the language of the controller name 
 
152
                       that that the caller is requesting, and it must match one
 
153
                       of the languages specified in SupportedLanguages.  The 
 
154
                       number of languages supported by a driver is up to the 
 
155
                       driver writer.
 
156
    ControllerName   - A pointer to the Unicode string to return.  This Unicode
 
157
                       string is the name of the controller specified by 
 
158
                       ControllerHandle and ChildHandle in the language 
 
159
                       specified by Language from the point of view of the 
 
160
                       driver specified by This. 
 
161
 
 
162
  Returns:
 
163
    EFI_SUCCESS           - The Unicode string for the user readable name in the 
 
164
                            language specified by Language for the driver 
 
165
                            specified by This was returned in DriverName.
 
166
    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
 
167
    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid 
 
168
                            EFI_HANDLE.
 
169
    EFI_INVALID_PARAMETER - Language is NULL.
 
170
    EFI_INVALID_PARAMETER - ControllerName is NULL.
 
171
    EFI_UNSUPPORTED       - The driver specified by This is not currently 
 
172
                            managing the controller specified by 
 
173
                            ControllerHandle and ChildHandle.
 
174
    EFI_UNSUPPORTED       - The driver specified by This does not support the 
 
175
                            language specified by Language.
 
176
 
 
177
--*/
 
178
{
 
179
  EFI_STATUS            Status;
 
180
 
 
181
  //
 
182
  // Make sure this driver is currently managing ControllHandle
 
183
  //
 
184
  Status = EfiTestManagedDevice (
 
185
             ControllerHandle,
 
186
             gIdeControllerDriverBinding.DriverBindingHandle,
 
187
             &gEfiPciIoProtocolGuid
 
188
             );
 
189
  if (EFI_ERROR (Status)) {
 
190
    return Status;
 
191
  }
 
192
 
 
193
  if (ChildHandle != NULL) {
 
194
    return EFI_UNSUPPORTED;
 
195
  }
 
196
 
 
197
  return LookupUnicodeString2 (
 
198
          Language,
 
199
          This->SupportedLanguages,
 
200
          mIdeControllerControllerNameTable,
 
201
          ControllerName,
 
202
          (BOOLEAN)(This == &gIdeControllerComponentName)
 
203
          );
 
204
}