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
This commit is contained in:
klu2 2007-01-12 05:47:58 +00:00
parent d02ea95873
commit 3727980651
4 changed files with 15 additions and 16 deletions

View File

@ -223,8 +223,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding = {
NULL NULL
}; };
UINT32 mUsbCapabilityLen;
UINT32 mDeviceSpeed[16];
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -1283,9 +1281,9 @@ EhciGetRootHubPortStatus (
// Not Low Speed Device Attached // Not Low Speed Device Attached
// //
if ((PORTSC_CCS & PortStatusControlReg) && (PORTSC_CSC & PortStatusControlReg)) { 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 // Fill Port Status Change bits
@ -1410,7 +1408,7 @@ EhciSetRootHubPortFeature (
} }
Status = WaitForEhcNotHalt (HcDev, EHCI_GENERIC_TIMEOUT); Status = WaitForEhcNotHalt (HcDev, EHCI_GENERIC_TIMEOUT);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((gEHCDebugLevel, "WaitForEhcNotHalt TimeOut\n")); DEBUG ((gEHCDebugLevel, "EHCI: WaitForEhcNotHalt TimeOut\n"));
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
goto exit; goto exit;
} }

View File

@ -100,7 +100,6 @@ extern UINTN gEHCErrorLevel;
// //
// Enhanced Host Controller Registers definitions // Enhanced Host Controller Registers definitions
// //
extern UINT32 mUsbCapabilityLen;
extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding; extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName;
@ -393,6 +392,8 @@ typedef struct _USB2_HC_DEV {
MEMORY_MANAGE_HEADER *MemoryHeader; MEMORY_MANAGE_HEADER *MemoryHeader;
UINT8 Is64BitCapable; UINT8 Is64BitCapable;
UINT32 High32BitAddr; UINT32 High32BitAddr;
UINT32 UsbCapabilityLen;
UINT16 DeviceSpeed[16];
} USB2_HC_DEV; } USB2_HC_DEV;

View File

@ -151,12 +151,12 @@ Returns:
--*/ --*/
{ {
ASSERT (mUsbCapabilityLen); ASSERT (HcDev->UsbCapabilityLen);
return HcDev->PciIo->Mem.Read ( return HcDev->PciIo->Mem.Read (
HcDev->PciIo, HcDev->PciIo,
EfiPciIoWidthUint32, EfiPciIoWidthUint32,
USB_BAR_INDEX, USB_BAR_INDEX,
(UINT64) (OperationalRegAddr + mUsbCapabilityLen), (UINT64) (OperationalRegAddr + HcDev->UsbCapabilityLen),
1, 1,
Data Data
); );
@ -187,12 +187,12 @@ Returns:
--*/ --*/
{ {
ASSERT (mUsbCapabilityLen); ASSERT (HcDev->UsbCapabilityLen);
return HcDev->PciIo->Mem.Write ( return HcDev->PciIo->Mem.Write (
HcDev->PciIo, HcDev->PciIo,
EfiPciIoWidthUint32, EfiPciIoWidthUint32,
USB_BAR_INDEX, USB_BAR_INDEX,
(UINT64) (OperationalRegAddr + mUsbCapabilityLen), (UINT64) (OperationalRegAddr + HcDev->UsbCapabilityLen),
1, 1,
&Data &Data
); );
@ -347,9 +347,9 @@ Returns:
Status = ReadEhcCapabiltiyReg ( Status = ReadEhcCapabiltiyReg (
HcDev, HcDev,
CapabilityLenAddr, CapabilityLenAddr,
&mUsbCapabilityLen &(HcDev->UsbCapabilityLen)
); );
mUsbCapabilityLen = (UINT8) mUsbCapabilityLen; HcDev->UsbCapabilityLen = (UINT8) HcDev->UsbCapabilityLen;
return Status; return Status;
} }
@ -1004,7 +1004,7 @@ Returns:
HcCapParamsAddr = HCCPARAMS; HcCapParamsAddr = HCCPARAMS;
ReadEhcOperationalReg ( ReadEhcCapabiltiyReg(
HcDev, HcDev,
HcCapParamsAddr, HcCapParamsAddr,
&HcCapParamsReg &HcCapParamsReg

View File

@ -79,7 +79,7 @@ Returns:
0 0
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((gEHCErrorLevel, "PciIo->AllocateBuffer Failed\n")); DEBUG ((gEHCErrorLevel, "EHCI: PciIo->AllocateBuffer Failed\n"));
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto exit; goto exit;
} }
@ -93,7 +93,7 @@ Returns:
&Map &Map
); );
if (EFI_ERROR (Status) || (BufferSizeInBytes != EFI_PAGE_SIZE)) { 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; Status = EFI_OUT_OF_RESOURCES;
goto free_buffer; goto free_buffer;
} }
@ -107,7 +107,7 @@ Returns:
Status = SetCtrlDataStructSeg (HcDev); Status = SetCtrlDataStructSeg (HcDev);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((gEHCErrorLevel, "SetCtrlDataStructSeg Failed\n")); DEBUG ((gEHCErrorLevel, "EHCI: SetCtrlDataStructSeg Failed\n"));
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
goto unmap_buffer; goto unmap_buffer;
} }