From 3727980651ea6d34f0567af9af9c04107428535d Mon Sep 17 00:00:00 2001 From: klu2 Date: Fri, 12 Jan 2007 05:47:58 +0000 Subject: [PATCH] Remove two global variable: mUsbCapabilityLen and mDeviceSpeed and integrate them into USB2_HC_DEV. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2235 6f19259b-4bc3-4df7-8a09-765794883524 --- EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c | 8 +++----- EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h | 3 ++- EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c | 14 +++++++------- EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c | 6 +++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c index d573532f7e..8f32abf0dc 100644 --- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c +++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c @@ -223,8 +223,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding = { NULL }; -UINT32 mUsbCapabilityLen; -UINT32 mDeviceSpeed[16]; EFI_STATUS EFIAPI @@ -1283,9 +1281,9 @@ EhciGetRootHubPortStatus ( // Not Low Speed Device Attached // if ((PORTSC_CCS & PortStatusControlReg) && (PORTSC_CSC & PortStatusControlReg)) { - mDeviceSpeed[PortNumber] = IsHighSpeedDevice (This, PortNumber) ? USB_PORT_STAT_HIGH_SPEED : 0; + HcDev->DeviceSpeed[PortNumber] = IsHighSpeedDevice (This, PortNumber) ? USB_PORT_STAT_HIGH_SPEED : 0; } - PortStatus->PortStatus |= mDeviceSpeed[PortNumber]; + PortStatus->PortStatus |= HcDev->DeviceSpeed[PortNumber]; } // // Fill Port Status Change bits @@ -1410,7 +1408,7 @@ EhciSetRootHubPortFeature ( } Status = WaitForEhcNotHalt (HcDev, EHCI_GENERIC_TIMEOUT); if (EFI_ERROR (Status)) { - DEBUG ((gEHCDebugLevel, "WaitForEhcNotHalt TimeOut\n")); + DEBUG ((gEHCDebugLevel, "EHCI: WaitForEhcNotHalt TimeOut\n")); Status = EFI_DEVICE_ERROR; goto exit; } diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h index eb0508fce4..747e1ee124 100644 --- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h +++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h @@ -100,7 +100,6 @@ extern UINTN gEHCErrorLevel; // // Enhanced Host Controller Registers definitions // -extern UINT32 mUsbCapabilityLen; extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName; @@ -393,6 +392,8 @@ typedef struct _USB2_HC_DEV { MEMORY_MANAGE_HEADER *MemoryHeader; UINT8 Is64BitCapable; UINT32 High32BitAddr; + UINT32 UsbCapabilityLen; + UINT16 DeviceSpeed[16]; } USB2_HC_DEV; diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c index 70d1d5cf38..5767bbc024 100644 --- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c +++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c @@ -151,12 +151,12 @@ Returns: --*/ { - ASSERT (mUsbCapabilityLen); + ASSERT (HcDev->UsbCapabilityLen); return HcDev->PciIo->Mem.Read ( HcDev->PciIo, EfiPciIoWidthUint32, USB_BAR_INDEX, - (UINT64) (OperationalRegAddr + mUsbCapabilityLen), + (UINT64) (OperationalRegAddr + HcDev->UsbCapabilityLen), 1, Data ); @@ -187,12 +187,12 @@ Returns: --*/ { - ASSERT (mUsbCapabilityLen); + ASSERT (HcDev->UsbCapabilityLen); return HcDev->PciIo->Mem.Write ( HcDev->PciIo, EfiPciIoWidthUint32, USB_BAR_INDEX, - (UINT64) (OperationalRegAddr + mUsbCapabilityLen), + (UINT64) (OperationalRegAddr + HcDev->UsbCapabilityLen), 1, &Data ); @@ -347,9 +347,9 @@ Returns: Status = ReadEhcCapabiltiyReg ( HcDev, CapabilityLenAddr, - &mUsbCapabilityLen + &(HcDev->UsbCapabilityLen) ); - mUsbCapabilityLen = (UINT8) mUsbCapabilityLen; + HcDev->UsbCapabilityLen = (UINT8) HcDev->UsbCapabilityLen; return Status; } @@ -1004,7 +1004,7 @@ Returns: HcCapParamsAddr = HCCPARAMS; - ReadEhcOperationalReg ( + ReadEhcCapabiltiyReg( HcDev, HcCapParamsAddr, &HcCapParamsReg diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c index 1a947058be..9f1a15d093 100644 --- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c +++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c @@ -79,7 +79,7 @@ Returns: 0 ); if (EFI_ERROR (Status)) { - DEBUG ((gEHCErrorLevel, "PciIo->AllocateBuffer Failed\n")); + DEBUG ((gEHCErrorLevel, "EHCI: PciIo->AllocateBuffer Failed\n")); Status = EFI_OUT_OF_RESOURCES; goto exit; } @@ -93,7 +93,7 @@ Returns: &Map ); if (EFI_ERROR (Status) || (BufferSizeInBytes != EFI_PAGE_SIZE)) { - DEBUG ((gEHCErrorLevel, "PciIo->MapBuffer Failed\n")); + DEBUG ((gEHCErrorLevel, "EHCI: PciIo->MapBuffer Failed\n")); Status = EFI_OUT_OF_RESOURCES; goto free_buffer; } @@ -107,7 +107,7 @@ Returns: Status = SetCtrlDataStructSeg (HcDev); if (EFI_ERROR (Status)) { - DEBUG ((gEHCErrorLevel, "SetCtrlDataStructSeg Failed\n")); + DEBUG ((gEHCErrorLevel, "EHCI: SetCtrlDataStructSeg Failed\n")); Status = EFI_DEVICE_ERROR; goto unmap_buffer; }