Home | History | Annotate | Download | only in Dxe
      1 /** @file
      2 Provides the definition of Usb Hc Protocol and OHCI controller
      3 private data structure.
      4 
      5 Copyright (c) 2013-2016 Intel Corporation.
      6 
      7 This program and the accompanying materials
      8 are licensed and made available under the terms and conditions of the BSD License
      9 which accompanies this distribution.  The full text of the license may be found at
     10 http://opensource.org/licenses/bsd-license.php
     11 
     12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     14 
     15 **/
     16 
     17 
     18 
     19 #ifndef _OHCI_H
     20 #define _OHCI_H
     21 
     22 
     23 #include <Uefi.h>
     24 
     25 #include <Protocol/UsbHostController.h>
     26 #include <Protocol/PciIo.h>
     27 
     28 #include <Guid/EventGroup.h>
     29 
     30 #include <Library/DebugLib.h>
     31 #include <Library/BaseMemoryLib.h>
     32 #include <Library/UefiBootServicesTableLib.h>
     33 #include <Library/UefiLib.h>
     34 #include <Library/BaseLib.h>
     35 #include <Library/MemoryAllocationLib.h>
     36 
     37 #include <IndustryStandard/Pci.h>
     38 
     39 
     40 typedef struct _USB_OHCI_HC_DEV USB_OHCI_HC_DEV;
     41 
     42 #include "UsbHcMem.h"
     43 #include "OhciReg.h"
     44 #include "OhciSched.h"
     45 #include "OhciUrb.h"
     46 #include "Descriptor.h"
     47 #include "ComponentName.h"
     48 #include "OhciDebug.h"
     49 
     50 extern EFI_DRIVER_BINDING_PROTOCOL   gOhciDriverBinding;
     51 extern EFI_COMPONENT_NAME_PROTOCOL   gOhciComponentName;
     52 extern EFI_COMPONENT_NAME2_PROTOCOL  gOhciComponentName2;
     53 
     54 #define USB_OHCI_HC_DEV_SIGNATURE     SIGNATURE_32('o','h','c','i')
     55 
     56 typedef struct _HCCA_MEMORY_BLOCK{
     57   UINT32                    HccaInterruptTable[32];    // 32-bit Physical Address to ED_DESCRIPTOR
     58   UINT16                    HccaFrameNumber;
     59   UINT16                    HccaPad;
     60   UINT32                    HccaDoneHead;              // 32-bit Physical Address to TD_DESCRIPTOR
     61   UINT8                     Reserved[116];
     62 } HCCA_MEMORY_BLOCK;
     63 
     64 
     65 struct _USB_OHCI_HC_DEV {
     66   UINTN                     Signature;
     67   EFI_USB_HC_PROTOCOL       UsbHc;
     68   EFI_USB2_HC_PROTOCOL      Usb2Hc;
     69   EFI_PCI_IO_PROTOCOL       *PciIo;
     70   UINT64                    OriginalPciAttributes;
     71 
     72   HCCA_MEMORY_BLOCK         *HccaMemoryBlock;
     73   VOID                      *HccaMemoryBuf;
     74   VOID                      *HccaMemoryMapping;
     75   UINTN                     HccaMemoryPages;
     76 
     77   ED_DESCRIPTOR             *IntervalList[6][32];
     78   INTERRUPT_CONTEXT_ENTRY   *InterruptContextList;
     79   VOID                      *MemPool;
     80 
     81   UINT32                    ToggleFlag;
     82 
     83   EFI_EVENT                 HouseKeeperTimer;
     84   //
     85   // ExitBootServicesEvent is used to stop the OHC DMA operation
     86   // after exit boot service.
     87   //
     88   EFI_EVENT                  ExitBootServiceEvent;
     89 
     90   EFI_UNICODE_STRING_TABLE  *ControllerNameTable;
     91 };
     92 
     93 #define USB_OHCI_HC_DEV_FROM_THIS(a)    CR(a, USB_OHCI_HC_DEV, UsbHc, USB_OHCI_HC_DEV_SIGNATURE)
     94 #define USB2_OHCI_HC_DEV_FROM_THIS(a)    CR(a, USB_OHCI_HC_DEV, Usb2Hc, USB_OHCI_HC_DEV_SIGNATURE)
     95 
     96 //
     97 // Func List
     98 //
     99 
    100 /**
    101   Provides software reset for the USB host controller.
    102 
    103   @param  This                  This EFI_USB_HC_PROTOCOL instance.
    104   @param  Attributes            A bit mask of the reset operation to perform.
    105 
    106   @retval EFI_SUCCESS           The reset operation succeeded.
    107   @retval EFI_INVALID_PARAMETER Attributes is not valid.
    108   @retval EFI_UNSUPPOURTED      The type of reset specified by Attributes is
    109                                 not currently supported by the host controller.
    110   @retval EFI_DEVICE_ERROR      Host controller isn't halted to reset.
    111 
    112 **/
    113 EFI_STATUS
    114 EFIAPI
    115 OhciReset (
    116   IN EFI_USB_HC_PROTOCOL  *This,
    117   IN UINT16               Attributes
    118   );
    119 /**
    120   Retrieve the current state of the USB host controller.
    121 
    122   @param  This                  This EFI_USB_HC_PROTOCOL instance.
    123   @param  State                 Variable to return the current host controller
    124                                 state.
    125 
    126   @retval EFI_SUCCESS           Host controller state was returned in State.
    127   @retval EFI_INVALID_PARAMETER State is NULL.
    128   @retval EFI_DEVICE_ERROR      An error was encountered while attempting to
    129                                 retrieve the host controller's current state.
    130 
    131 **/
    132 
    133 EFI_STATUS
    134 EFIAPI
    135 OhciGetState (
    136   IN  EFI_USB_HC_PROTOCOL  *This,
    137   OUT EFI_USB_HC_STATE     *State
    138   );
    139 /**
    140   Sets the USB host controller to a specific state.
    141 
    142   @param  This                  This EFI_USB_HC_PROTOCOL instance.
    143   @param  State                 The state of the host controller that will be set.
    144 
    145   @retval EFI_SUCCESS           The USB host controller was successfully placed
    146                                 in the state specified by State.
    147   @retval EFI_INVALID_PARAMETER State is invalid.
    148   @retval EFI_DEVICE_ERROR      Failed to set the state due to device error.
    149 
    150 **/
    151 
    152 EFI_STATUS
    153 EFIAPI
    154 OhciSetState(
    155   IN EFI_USB_HC_PROTOCOL  *This,
    156   IN EFI_USB_HC_STATE     State
    157   );
    158 /**
    159 
    160   Submits control transfer to a target USB device.
    161 
    162   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    163   @param  DeviceAddress         Represents the address of the target device on the USB,
    164                                 which is assigned during USB enumeration.
    165   @param  IsSlowDevice          Indicates whether the target device is slow device
    166                                 or full-speed device.
    167   @param  MaxPaketLength        Indicates the maximum packet size that the
    168                                 default control transfer endpoint is capable of
    169                                 sending or receiving.
    170   @param  Request               A pointer to the USB device request that will be sent
    171                                 to the USB device.
    172   @param  TransferDirection     Specifies the data direction for the transfer.
    173                                 There are three values available, DataIn, DataOut
    174                                 and NoData.
    175   @param  Data                  A pointer to the buffer of data that will be transmitted
    176                                 to USB device or received from USB device.
    177   @param  DataLength            Indicates the size, in bytes, of the data buffer
    178                                 specified by Data.
    179   @param  TimeOut               Indicates the maximum time, in microseconds,
    180                                 which the transfer is allowed to complete.
    181   @param  TransferResult        A pointer to the detailed result information generated
    182                                 by this control transfer.
    183 
    184   @retval EFI_SUCCESS           The control transfer was completed successfully.
    185   @retval EFI_OUT_OF_RESOURCES  The control transfer could not be completed due to a lack of resources.
    186   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
    187   @retval EFI_TIMEOUT           The control transfer failed due to timeout.
    188   @retval EFI_DEVICE_ERROR      The control transfer failed due to host controller or device error.
    189                                 Caller should check TranferResult for detailed error information.
    190 
    191 --*/
    192 
    193 
    194 EFI_STATUS
    195 EFIAPI
    196 OhciControlTransfer (
    197   IN     EFI_USB_HC_PROTOCOL     *This,
    198   IN     UINT8                   DeviceAddress,
    199   IN     BOOLEAN                 IsSlowDevice,
    200   IN     UINT8                   MaxPacketLength,
    201   IN     EFI_USB_DEVICE_REQUEST  *Request,
    202   IN     EFI_USB_DATA_DIRECTION  TransferDirection,
    203   IN OUT VOID                    *Data                 OPTIONAL,
    204   IN OUT UINTN                   *DataLength           OPTIONAL,
    205   IN     UINTN                   TimeOut,
    206   OUT    UINT32                  *TransferResult
    207   );
    208 /**
    209 
    210   Submits bulk transfer to a bulk endpoint of a USB device.
    211 
    212   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    213   @param  DeviceAddress         Represents the address of the target device on the USB,
    214                                 which is assigned during USB enumeration.
    215   @param  EndPointAddress       The combination of an endpoint number and an
    216                                 endpoint direction of the target USB device.
    217                                 Each endpoint address supports data transfer in
    218                                 one direction except the control endpoint
    219                                 (whose default endpoint address is 0).
    220                                 It is the caller's responsibility to make sure that
    221                                 the EndPointAddress represents a bulk endpoint.
    222   @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint
    223                                 is capable of sending or receiving.
    224   @param  Data                  A pointer to the buffer of data that will be transmitted
    225                                 to USB device or received from USB device.
    226   @param  DataLength            When input, indicates the size, in bytes, of the data buffer
    227                                 specified by Data. When output, indicates the actually
    228                                 transferred data size.
    229   @param  DataToggle            A pointer to the data toggle value. On input, it indicates
    230                                 the initial data toggle value the bulk transfer should adopt;
    231                                 on output, it is updated to indicate the data toggle value
    232                                 of the subsequent bulk transfer.
    233   @param  TimeOut               Indicates the maximum time, in microseconds, which the
    234                                 transfer is allowed to complete.
    235   TransferResult                A pointer to the detailed result information of the
    236                                 bulk transfer.
    237 
    238   @retval EFI_SUCCESS           The bulk transfer was completed successfully.
    239   @retval EFI_OUT_OF_RESOURCES  The bulk transfer could not be submitted due to lack of resource.
    240   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
    241   @retval EFI_TIMEOUT           The bulk transfer failed due to timeout.
    242   @retval EFI_DEVICE_ERROR      The bulk transfer failed due to host controller or device error.
    243                                 Caller should check TranferResult for detailed error information.
    244 
    245 **/
    246 
    247 
    248 EFI_STATUS
    249 EFIAPI
    250 OhciBulkTransfer(
    251   IN     EFI_USB_HC_PROTOCOL  *This,
    252   IN     UINT8                DeviceAddress,
    253   IN     UINT8                EndPointAddress,
    254   IN     UINT8                MaxPacketLength,
    255   IN OUT VOID                 *Data,
    256   IN OUT UINTN                *DataLength,
    257   IN OUT UINT8                *DataToggle,
    258   IN     UINTN                TimeOut,
    259   OUT    UINT32               *TransferResult
    260   );
    261 /**
    262 
    263   Submits an interrupt transfer to an interrupt endpoint of a USB device.
    264 
    265   @param  Ohc                   Device private data
    266   @param  DeviceAddress         Represents the address of the target device on the USB,
    267                                 which is assigned during USB enumeration.
    268   @param  EndPointAddress       The combination of an endpoint number and an endpoint
    269                                 direction of the target USB device. Each endpoint address
    270                                 supports data transfer in one direction except the
    271                                 control endpoint (whose default endpoint address is 0).
    272                                 It is the caller's responsibility to make sure that
    273                                 the EndPointAddress represents an interrupt endpoint.
    274   @param  IsSlowDevice          Indicates whether the target device is slow device
    275                                 or full-speed device.
    276   @param  MaxPacketLength       Indicates the maximum packet size the target endpoint
    277                                 is capable of sending or receiving.
    278   @param  IsNewTransfer         If TRUE, an asynchronous interrupt pipe is built between
    279                                 the host and the target interrupt endpoint.
    280                                 If FALSE, the specified asynchronous interrupt pipe
    281                                 is canceled.
    282   @param  DataToggle            A pointer to the data toggle value.  On input, it is valid
    283                                 when IsNewTransfer is TRUE, and it indicates the initial
    284                                 data toggle value the asynchronous interrupt transfer
    285                                 should adopt.
    286                                 On output, it is valid when IsNewTransfer is FALSE,
    287                                 and it is updated to indicate the data toggle value of
    288                                 the subsequent asynchronous interrupt transfer.
    289   @param  PollingInterval       Indicates the interval, in milliseconds, that the
    290                                 asynchronous interrupt transfer is polled.
    291                                 This parameter is required when IsNewTransfer is TRUE.
    292   @param  UCBuffer              Uncacheable buffer
    293   @param  DataLength            Indicates the length of data to be received at the
    294                                 rate specified by PollingInterval from the target
    295                                 asynchronous interrupt endpoint.  This parameter
    296                                 is only required when IsNewTransfer is TRUE.
    297   @param  CallBackFunction      The Callback function.This function is called at the
    298                                 rate specified by PollingInterval.This parameter is
    299                                 only required when IsNewTransfer is TRUE.
    300   @param  Context               The context that is passed to the CallBackFunction.
    301                                 This is an optional parameter and may be NULL.
    302   @param  IsPeriodic            Periodic interrupt or not
    303   @param  OutputED              The correspoding ED carried out
    304   @param  OutputTD              The correspoding TD carried out
    305 
    306 
    307   @retval EFI_SUCCESS           The asynchronous interrupt transfer request has been successfully
    308                                 submitted or canceled.
    309   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
    310   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
    311 
    312 **/
    313 
    314 EFI_STATUS
    315 OhciInterruptTransfer (
    316   IN     USB_OHCI_HC_DEV                  *Ohc,
    317   IN     UINT8                            DeviceAddress,
    318   IN     UINT8                            EndPointAddress,
    319   IN     BOOLEAN                          IsSlowDevice,
    320   IN     UINT8                            MaxPacketLength,
    321   IN     BOOLEAN                          IsNewTransfer,
    322   IN OUT UINT8                            *DataToggle        OPTIONAL,
    323   IN     UINTN                            PollingInterval    OPTIONAL,
    324   IN     VOID                             *UCBuffer          OPTIONAL,
    325   IN     UINTN                            DataLength         OPTIONAL,
    326   IN     EFI_ASYNC_USB_TRANSFER_CALLBACK  CallBackFunction   OPTIONAL,
    327   IN     VOID                             *Context           OPTIONAL,
    328   IN     BOOLEAN                          IsPeriodic         OPTIONAL,
    329   OUT    ED_DESCRIPTOR                    **OutputED         OPTIONAL,
    330   OUT    TD_DESCRIPTOR                    **OutputTD         OPTIONAL
    331   );
    332 /**
    333 
    334   Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
    335 
    336   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    337   @param  DeviceAddress         Represents the address of the target device on the USB,
    338                                 which is assigned during USB enumeration.
    339   @param  EndPointAddress       The combination of an endpoint number and an endpoint
    340                                 direction of the target USB device. Each endpoint address
    341                                 supports data transfer in one direction except the
    342                                 control endpoint (whose default endpoint address is 0).
    343                                 It is the caller's responsibility to make sure that
    344                                 the EndPointAddress represents an interrupt endpoint.
    345   @param  IsSlowDevice          Indicates whether the target device is slow device
    346                                 or full-speed device.
    347   @param  MaxiumPacketLength    Indicates the maximum packet size the target endpoint
    348                                 is capable of sending or receiving.
    349   @param  IsNewTransfer         If TRUE, an asynchronous interrupt pipe is built between
    350                                 the host and the target interrupt endpoint.
    351                                 If FALSE, the specified asynchronous interrupt pipe
    352                                 is canceled.
    353   @param  DataToggle            A pointer to the data toggle value.  On input, it is valid
    354                                 when IsNewTransfer is TRUE, and it indicates the initial
    355                                 data toggle value the asynchronous interrupt transfer
    356                                 should adopt.
    357                                 On output, it is valid when IsNewTransfer is FALSE,
    358                                 and it is updated to indicate the data toggle value of
    359                                 the subsequent asynchronous interrupt transfer.
    360   @param  PollingInterval       Indicates the interval, in milliseconds, that the
    361                                 asynchronous interrupt transfer is polled.
    362                                 This parameter is required when IsNewTransfer is TRUE.
    363   @param  DataLength            Indicates the length of data to be received at the
    364                                 rate specified by PollingInterval from the target
    365                                 asynchronous interrupt endpoint.  This parameter
    366                                 is only required when IsNewTransfer is TRUE.
    367   @param  CallBackFunction      The Callback function.This function is called at the
    368                                 rate specified by PollingInterval.This parameter is
    369                                 only required when IsNewTransfer is TRUE.
    370   @param  Context               The context that is passed to the CallBackFunction.
    371                                 This is an optional parameter and may be NULL.
    372 
    373   @retval EFI_SUCCESS           The asynchronous interrupt transfer request has been successfully
    374                                 submitted or canceled.
    375   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
    376   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
    377 
    378 **/
    379 
    380 
    381 EFI_STATUS
    382 EFIAPI
    383 OhciAsyncInterruptTransfer (
    384   IN     EFI_USB_HC_PROTOCOL              *This,
    385   IN     UINT8                            DeviceAddress,
    386   IN     UINT8                            EndPointAddress,
    387   IN     BOOLEAN                          IsSlowDevice,
    388   IN     UINT8                            MaxPacketLength,
    389   IN     BOOLEAN                          IsNewTransfer,
    390   IN OUT UINT8                            *DataToggle        OPTIONAL,
    391   IN     UINTN                            PollingInterval    OPTIONAL,
    392   IN     UINTN                            DataLength         OPTIONAL,
    393   IN     EFI_ASYNC_USB_TRANSFER_CALLBACK  CallBackFunction   OPTIONAL,
    394   IN     VOID                             *Context           OPTIONAL
    395   );
    396 /**
    397 
    398   Submits synchronous interrupt transfer to an interrupt endpoint
    399   of a USB device.
    400 
    401   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    402   @param  DeviceAddress         Represents the address of the target device on the USB,
    403                                 which is assigned during USB enumeration.
    404   @param  EndPointAddress       The combination of an endpoint number and an endpoint
    405                                 direction of the target USB device. Each endpoint
    406                                 address supports data transfer in one direction
    407                                 except the control endpoint (whose default
    408                                 endpoint address is 0). It is the caller's responsibility
    409                                 to make sure that the EndPointAddress represents
    410                                 an interrupt endpoint.
    411   @param  IsSlowDevice          Indicates whether the target device is slow device
    412                                 or full-speed device.
    413   @param  MaxPacketLength       Indicates the maximum packet size the target endpoint
    414                                 is capable of sending or receiving.
    415   @param  Data                  A pointer to the buffer of data that will be transmitted
    416                                 to USB device or received from USB device.
    417   @param  DataLength            On input, the size, in bytes, of the data buffer specified
    418                                 by Data. On output, the number of bytes transferred.
    419   @param  DataToggle            A pointer to the data toggle value. On input, it indicates
    420                                 the initial data toggle value the synchronous interrupt
    421                                 transfer should adopt;
    422                                 on output, it is updated to indicate the data toggle value
    423                                 of the subsequent synchronous interrupt transfer.
    424   @param  TimeOut               Indicates the maximum time, in microseconds, which the
    425                                 transfer is allowed to complete.
    426   @param  TransferResult        A pointer to the detailed result information from
    427                                 the synchronous interrupt transfer.
    428 
    429   @retval EFI_UNSUPPORTED       This interface not available.
    430   @retval EFI_INVALID_PARAMETER Parameters not follow spec
    431 
    432 **/
    433 
    434 
    435 EFI_STATUS
    436 EFIAPI
    437 OhciSyncInterruptTransfer (
    438   IN     EFI_USB_HC_PROTOCOL  *This,
    439   IN     UINT8                DeviceAddress,
    440   IN     UINT8                EndPointAddress,
    441   IN     BOOLEAN              IsSlowDevice,
    442   IN     UINT8                MaxPacketLength,
    443   IN OUT VOID                 *Data,
    444   IN OUT UINTN                *DataLength,
    445   IN OUT UINT8                *DataToggle,
    446   IN     UINTN                TimeOut,
    447   OUT    UINT32               *TransferResult
    448   );
    449 /**
    450 
    451   Submits isochronous transfer to a target USB device.
    452 
    453   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    454   @param  DeviceAddress         Represents the address of the target device on the USB,
    455                                 which is assigned during USB enumeration.
    456   @param  EndPointAddress       End point address
    457   @param  MaximumPacketLength   Indicates the maximum packet size that the
    458                                 default control transfer endpoint is capable of
    459                                 sending or receiving.
    460   @param  Data                  A pointer to the buffer of data that will be transmitted
    461                                 to USB device or received from USB device.
    462   @param  DataLength            Indicates the size, in bytes, of the data buffer
    463                                 specified by Data.
    464   @param  TransferResult        A pointer to the detailed result information generated
    465                                 by this control transfer.
    466 
    467   @retval EFI_UNSUPPORTED       This interface not available
    468   @retval EFI_INVALID_PARAMETER Data is NULL or DataLength is 0 or TransferResult is NULL
    469 
    470 **/
    471 
    472 
    473 EFI_STATUS
    474 EFIAPI
    475 OhciIsochronousTransfer (
    476   IN     EFI_USB_HC_PROTOCOL  *This,
    477   IN     UINT8                DeviceAddress,
    478   IN     UINT8                EndPointAddress,
    479   IN     UINT8                MaximumPacketLength,
    480   IN OUT VOID                 *Data,
    481   IN OUT UINTN                DataLength,
    482   OUT    UINT32               *TransferResult
    483   );
    484 /**
    485 
    486   Submits Async isochronous transfer to a target USB device.
    487 
    488   @param  his                   A pointer to the EFI_USB_HC_PROTOCOL instance.
    489   @param  DeviceAddress         Represents the address of the target device on the USB,
    490                                 which is assigned during USB enumeration.
    491   @param  EndPointAddress       End point address
    492   @param  MaximumPacketLength   Indicates the maximum packet size that the
    493                                 default control transfer endpoint is capable of
    494                                 sending or receiving.
    495   @param  Data                  A pointer to the buffer of data that will be transmitted
    496                                 to USB device or received from USB device.
    497   @param  IsochronousCallBack   When the transfer complete, the call back function will be called
    498   @param  Context               Pass to the call back function as parameter
    499 
    500   @retval EFI_UNSUPPORTED       This interface not available
    501   @retval EFI_INVALID_PARAMETER Data is NULL or Datalength is 0
    502 
    503 **/
    504 
    505 EFI_STATUS
    506 EFIAPI
    507 OhciAsyncIsochronousTransfer (
    508   IN     EFI_USB_HC_PROTOCOL                *This,
    509   IN     UINT8                              DeviceAddress,
    510   IN     UINT8                              EndPointAddress,
    511   IN     UINT8                              MaximumPacketLength,
    512   IN OUT VOID                               *Data,
    513   IN OUT UINTN                              DataLength,
    514   IN     EFI_ASYNC_USB_TRANSFER_CALLBACK    IsochronousCallBack,
    515   IN     VOID                               *Context OPTIONAL
    516   );
    517 
    518 /**
    519 
    520   Retrieves the number of root hub ports.
    521 
    522   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    523   @param  NumOfPorts            A pointer to the number of the root hub ports.
    524 
    525   @retval EFI_SUCCESS           The port number was retrieved successfully.
    526 **/
    527 EFI_STATUS
    528 EFIAPI
    529 OhciGetRootHubNumOfPorts (
    530   IN  EFI_USB_HC_PROTOCOL  *This,
    531   OUT UINT8                *NumOfPorts
    532   );
    533 /**
    534 
    535   Retrieves the current status of a USB root hub port.
    536 
    537   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL.
    538   @param  PortNumber            Specifies the root hub port from which the status
    539                                 is to be retrieved.  This value is zero-based. For example,
    540                                 if a root hub has two ports, then the first port is numbered 0,
    541                                 and the second port is numbered 1.
    542   @param  PortStatus            A pointer to the current port status bits and
    543                                 port status change bits.
    544 
    545   @retval EFI_SUCCESS           The status of the USB root hub port specified by PortNumber
    546                                 was returned in PortStatus.
    547   @retval EFI_INVALID_PARAMETER Port number not valid
    548 **/
    549 
    550 
    551 EFI_STATUS
    552 EFIAPI
    553 OhciGetRootHubPortStatus (
    554   IN  EFI_USB_HC_PROTOCOL  *This,
    555   IN  UINT8                PortNumber,
    556   OUT EFI_USB_PORT_STATUS  *PortStatus
    557   );
    558 
    559 /**
    560 
    561   Sets a feature for the specified root hub port.
    562 
    563   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL.
    564   @param  PortNumber            Specifies the root hub port whose feature
    565                                 is requested to be set.
    566   @param  PortFeature           Indicates the feature selector associated
    567                                 with the feature set request.
    568 
    569   @retval EFI_SUCCESS           The feature specified by PortFeature was set for the
    570                                 USB root hub port specified by PortNumber.
    571   @retval EFI_DEVICE_ERROR      Set feature failed because of hardware issue
    572   @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
    573 **/
    574 EFI_STATUS
    575 EFIAPI
    576 OhciSetRootHubPortFeature (
    577   IN EFI_USB_HC_PROTOCOL   *This,
    578   IN UINT8                 PortNumber,
    579   IN EFI_USB_PORT_FEATURE  PortFeature
    580   );
    581 /**
    582 
    583   Clears a feature for the specified root hub port.
    584 
    585   @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.
    586   @param  PortNumber            Specifies the root hub port whose feature
    587                                 is requested to be cleared.
    588   @param  PortFeature           Indicates the feature selector associated with the
    589                                 feature clear request.
    590 
    591   @retval EFI_SUCCESS           The feature specified by PortFeature was cleared for the
    592                                 USB root hub port specified by PortNumber.
    593   @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
    594   @retval EFI_DEVICE_ERROR      Some error happened when clearing feature
    595 **/
    596 EFI_STATUS
    597 EFIAPI
    598 OhciClearRootHubPortFeature (
    599   IN EFI_USB_HC_PROTOCOL   *This,
    600   IN UINT8                 PortNumber,
    601   IN EFI_USB_PORT_FEATURE  PortFeature
    602   );
    603 
    604 
    605 /**
    606   Test to see if this driver supports ControllerHandle. Any
    607   ControllerHandle that has UsbHcProtocol installed will be supported.
    608 
    609   @param  This                 Protocol instance pointer.
    610   @param  Controller           Handle of device to test.
    611   @param  RemainingDevicePath  Not used.
    612 
    613   @return EFI_SUCCESS          This driver supports this device.
    614   @return EFI_UNSUPPORTED      This driver does not support this device.
    615 
    616 **/
    617 EFI_STATUS
    618 EFIAPI
    619 
    620 OHCIDriverBindingSupported (
    621   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
    622   IN EFI_HANDLE                   Controller,
    623   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
    624   );
    625 
    626 /**
    627   Starting the Usb OHCI Driver.
    628 
    629   @param  This                  Protocol instance pointer.
    630   @param  Controller            Handle of device to test.
    631   @param  RemainingDevicePath   Not used.
    632 
    633   @retval EFI_SUCCESS           This driver supports this device.
    634   @retval EFI_UNSUPPORTED       This driver does not support this device.
    635   @retval EFI_DEVICE_ERROR      This driver cannot be started due to device Error.
    636                                 EFI_OUT_OF_RESOURCES- Failed due to resource shortage.
    637 
    638 **/
    639 EFI_STATUS
    640 EFIAPI
    641 OHCIDriverBindingStart (
    642   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
    643   IN EFI_HANDLE                   Controller,
    644   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
    645   );
    646 
    647 /**
    648   Stop this driver on ControllerHandle. Support stopping any child handles
    649   created by this driver.
    650 
    651   @param  This                  Protocol instance pointer.
    652   @param  Controller            Handle of device to stop driver on.
    653   @param  NumberOfChildren      Number of Children in the ChildHandleBuffer.
    654   @param  ChildHandleBuffer     List of handles for the children we need to stop.
    655 
    656   @return EFI_SUCCESS
    657   @return others
    658 
    659 **/
    660 EFI_STATUS
    661 EFIAPI
    662 OHCIDriverBindingStop (
    663   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
    664   IN EFI_HANDLE                   Controller,
    665   IN UINTN                        NumberOfChildren,
    666   IN EFI_HANDLE                   *ChildHandleBuffer
    667   );
    668 
    669 #endif
    670