summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Bus
diff options
context:
space:
mode:
authorxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-26 08:35:57 +0000
committerxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-26 08:35:57 +0000
commitc7916981cc01e37d189e1802463fa68d10a17bf2 (patch)
treefb7f0fd15763f7cfeebd373adeda5ec033019467 /EdkModulePkg/Bus
parentb4667b1105d09e64cbad2e9d0343a89a3cc0cb3e (diff)
downloadedk2-platforms-c7916981cc01e37d189e1802463fa68d10a17bf2.tar.xz
To fix,
cd ...... works unnormally in shell USB CBI1 driver has no component name protocol git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2328 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Bus')
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c204
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa6
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c12
3 files changed, 219 insertions, 3 deletions
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c
new file mode 100644
index 0000000000..f8485dd734
--- /dev/null
+++ b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c
@@ -0,0 +1,204 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ ComponentName.c
+
+Abstract:
+
+--*/
+
+#include "cbi.h"
+
+extern EFI_DRIVER_BINDING_PROTOCOL gUsbCbi1DriverBinding;
+
+//
+// EFI Component Name Functions
+//
+EFI_STATUS
+EFIAPI
+UsbCbi1ComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+EFI_STATUS
+EFIAPI
+UsbCbi1ComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+//
+// EFI Component Name Protocol
+//
+EFI_COMPONENT_NAME_PROTOCOL gUsbCbi1ComponentName = {
+ UsbCbi1ComponentNameGetDriverName,
+ UsbCbi1ComponentNameGetControllerName,
+ "eng"
+};
+
+STATIC EFI_UNICODE_STRING_TABLE mUsbCbi1DriverNameTable[] = {
+ { "eng", (CHAR16 *) L"Usb Cbi1 Mass Storage Driver" },
+ { NULL , NULL }
+};
+
+
+EFI_STATUS
+EFIAPI
+UsbCbi1ComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+/*++
+
+ Routine Description:
+ Retrieves a Unicode string that is the user readable name of the EFI Driver.
+
+ Arguments:
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ Language - A pointer to a three character ISO 639-2 language identifier.
+ This is the language of the driver name that that the caller
+ is requesting, and it must match one of the languages specified
+ in SupportedLanguages. The number of languages supported by a
+ driver is up to the driver writer.
+ DriverName - A pointer to the Unicode string to return. This Unicode string
+ is the name of the driver specified by This in the language
+ specified by Language.
+
+ Returns:
+ EFI_SUCCESS - The Unicode string for the Driver specified by This
+ and the language specified by Language was returned
+ in DriverName.
+ EFI_INVALID_PARAMETER - Language is NULL.
+ EFI_INVALID_PARAMETER - DriverName is NULL.
+ EFI_UNSUPPORTED - The driver specified by This does not support the
+ language specified by Language.
+
+--*/
+{
+ return LookupUnicodeString (
+ Language,
+ gUsbCbi1ComponentName.SupportedLanguages,
+ mUsbCbi1DriverNameTable,
+ DriverName
+ );
+}
+
+EFI_STATUS
+EFIAPI
+UsbCbi1ComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+/*++
+
+ Routine Description:
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by an EFI Driver.
+
+ Arguments:
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ ControllerHandle - The handle of a controller that the driver specified by
+ This is managing. This handle specifies the controller
+ whose name is to be returned.
+ ChildHandle - The handle of the child controller to retrieve the name
+ of. This is an optional parameter that may be NULL. It
+ will be NULL for device drivers. It will also be NULL
+ for a bus drivers that wish to retrieve the name of the
+ bus controller. It will not be NULL for a bus driver
+ that wishes to retrieve the name of a child controller.
+ Language - A pointer to a three character ISO 639-2 language
+ identifier. This is the language of the controller name
+ that that the caller is requesting, and it must match one
+ of the languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up to the
+ driver writer.
+ ControllerName - A pointer to the Unicode string to return. This Unicode
+ string is the name of the controller specified by
+ ControllerHandle and ChildHandle in the language specified
+ by Language from the point of view of the driver specified
+ by This.
+
+ Returns:
+ EFI_SUCCESS - The Unicode string for the user readable name in the
+ language specified by Language for the driver
+ specified by This was returned in DriverName.
+ EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
+ EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
+ EFI_INVALID_PARAMETER - Language is NULL.
+ EFI_INVALID_PARAMETER - ControllerName is NULL.
+ EFI_UNSUPPORTED - The driver specified by This is not currently managing
+ the controller specified by ControllerHandle and
+ ChildHandle.
+ EFI_UNSUPPORTED - The driver specified by This does not support the
+ language specified by Language.
+
+--*/
+{
+ EFI_STATUS Status;
+ USB_CBI_DEVICE *UsbCbiDev;
+ EFI_USB_ATAPI_PROTOCOL *UsbAtapi;
+
+ //
+ // This is a device driver, so ChildHandle must be NULL.
+ //
+ if (ChildHandle != NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Make sure this driver is currently managing ControllerHandle
+ //
+ Status = EfiTestManagedDevice (
+ ControllerHandle,
+ gUsbCbi1DriverBinding.DriverBindingHandle,
+ &gEfiUsbIoProtocolGuid
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Get the device context
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiUsbAtapiProtocolGuid,
+ (VOID **) &UsbAtapi,
+ gUsbCbi1DriverBinding.DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (UsbAtapi);
+
+ return LookupUnicodeString (
+ Language,
+ gUsbCbi1ComponentName.SupportedLanguages,
+ UsbCbiDev->ControllerNameTable,
+ ControllerName
+ );
+
+}
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa
index d21cb776a4..2a0a86b8ae 100644
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa
+++ b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
<MsaHeader>
<ModuleName>UsbCbi1</ModuleName>
@@ -56,6 +56,7 @@
<SourceFiles>
<Filename>cbi.h</Filename>
<Filename>cbi1.c</Filename>
+ <Filename>ComponentName.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
@@ -76,7 +77,8 @@
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>
- <DriverBinding>gCBI1DriverBinding</DriverBinding>
+ <DriverBinding>gUsbCbi1DriverBinding</DriverBinding>
+ <ComponentName>gUsbCbi1ComponentName</ComponentName>
</Extern>
</Externs>
</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
index 008627b9dd..d8ef374c9f 100644
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
+++ b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
@@ -20,6 +20,8 @@ Abstract:
#include "cbi.h"
+extern EFI_COMPONENT_NAME_PROTOCOL gUsbCbi1ComponentName;
+
EFI_STATUS
EFIAPI
UsbCBI1DriverEntryPoint (
@@ -113,7 +115,7 @@ Cbi1ReportStatusCode (
);
-EFI_DRIVER_BINDING_PROTOCOL gCBI1DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gUsbCbi1DriverBinding = {
CBI1DriverBindingSupported,
CBI1DriverBindingStart,
CBI1DriverBindingStop,
@@ -352,6 +354,14 @@ CBI1DriverBindingStart (
goto ErrorExit;
}
+ UsbCbiDev->ControllerNameTable = NULL;
+ AddUnicodeString (
+ "eng",
+ gUsbCbi1ComponentName.SupportedLanguages,
+ &UsbCbiDev->ControllerNameTable,
+ (CHAR16 *) L"Usb Cbi1 Mass Storage"
+ );
+
return EFI_SUCCESS;
ErrorExit: