VirtualBox

Ignore:
Timestamp:
Mar 12, 2019 12:40:12 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129295
Message:

EFI: First step in UDK2018 merge. Does not build yet.

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c

    r58466 r77662  
    33
    44  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
     6
    57  This program and the accompanying materials are licensed and made available
    68  under the terms and conditions of the BSD License which accompanies this
     
    5153
    5254  Reads the I/O port specified by Port with registers width specified by Width.
    53   The read value is returned. If such operations are not supported, then ASSERT().
     55  The read value is returned.
     56
    5457  This function must guarantee that all I/O read and write operations are serialized.
     58  If such operations are not supported, then ASSERT().
    5559
    5660  @param  Port          The base address of the I/O operation.
     
    6872  )
    6973{
    70   EFI_STATUS                        Status;
    71   UINT64                            Data;
     74  EFI_STATUS  Status;
     75  UINT64      Data;
    7276
    7377  Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data);
     
    8185
    8286  Writes the I/O port specified by Port with registers width and value specified by Width
    83   and Data respectively.  Data is returned. If such operations are not supported, then ASSERT().
     87  and Data respectively. Data is returned.
     88
    8489  This function must guarantee that all I/O read and write operations are serialized.
     90  If such operations are not supported, then ASSERT().
    8591
    8692  @param  Port          The base address of the I/O operation.
     
    8995  @param  Data          The value to write to the I/O port.
    9096
    91   @return The paramter of Data.
     97  @return The parameter of Data.
    9298
    9399**/
     
    109115
    110116/**
     117  Reads registers in the EFI CPU I/O space.
     118
     119  Reads the I/O port specified by Port with registers width specified by Width.
     120  The port is read Count times, and the read data is stored in the provided Buffer.
     121
     122  This function must guarantee that all I/O read and write operations are serialized.
     123  If such operations are not supported, then ASSERT().
     124
     125  @param  Port          The base address of the I/O operation.
     126                        The caller is responsible for aligning the Address if required.
     127  @param  Width         The width of the I/O operation.
     128  @param  Count         The number of times to read I/O port.
     129  @param  Buffer        The buffer to store the read data into.
     130
     131**/
     132VOID
     133EFIAPI
     134IoReadFifoWorker (
     135  IN      UINTN                      Port,
     136  IN      EFI_CPU_IO_PROTOCOL_WIDTH  Width,
     137  IN      UINTN                      Count,
     138  IN      VOID                       *Buffer
     139  )
     140{
     141  EFI_STATUS  Status;
     142
     143  Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer);
     144  ASSERT_EFI_ERROR (Status);
     145}
     146
     147/**
     148  Writes registers in the EFI CPU I/O space.
     149
     150  Writes the I/O port specified by Port with registers width specified by Width.
     151  The port is written Count times, and the write data is retrieved from the provided Buffer.
     152
     153  This function must guarantee that all I/O read and write operations are serialized.
     154  If such operations are not supported, then ASSERT().
     155
     156  @param  Port          The base address of the I/O operation.
     157                        The caller is responsible for aligning the Address if required.
     158  @param  Width         The width of the I/O operation.
     159  @param  Count         The number of times to write I/O port.
     160  @param  Buffer        The buffer to store the read data into.
     161
     162**/
     163VOID
     164EFIAPI
     165IoWriteFifoWorker (
     166  IN      UINTN                      Port,
     167  IN      EFI_CPU_IO_PROTOCOL_WIDTH  Width,
     168  IN      UINTN                      Count,
     169  IN      VOID                       *Buffer
     170  )
     171{
     172  EFI_STATUS  Status;
     173
     174  Status = mCpuIo->Io.Write (mCpuIo, Width, Port, Count, Buffer);
     175  ASSERT_EFI_ERROR (Status);
     176}
     177
     178/**
    111179  Reads memory-mapped registers in the EFI system memory space.
    112180
     
    398466
    399467/**
     468  Reads an 8-bit I/O port fifo into a block of memory.
     469
     470  Reads the 8-bit I/O fifo port specified by Port.
     471  The port is read Count times, and the read data is
     472  stored in the provided Buffer.
     473
     474  This function must guarantee that all I/O read and write operations are
     475  serialized.
     476
     477  If 8-bit I/O port operations are not supported, then ASSERT().
     478
     479  @param  Port    The I/O port to read.
     480  @param  Count   The number of times to read I/O port.
     481  @param  Buffer  The buffer to store the read data into.
     482
     483**/
     484VOID
     485EFIAPI
     486IoReadFifo8 (
     487  IN      UINTN                     Port,
     488  IN      UINTN                     Count,
     489  OUT     VOID                      *Buffer
     490  )
     491{
     492  IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
     493}
     494
     495/**
     496  Writes a block of memory into an 8-bit I/O port fifo.
     497
     498  Writes the 8-bit I/O fifo port specified by Port.
     499  The port is written Count times, and the write data is
     500  retrieved from the provided Buffer.
     501
     502  This function must guarantee that all I/O write and write operations are
     503  serialized.
     504
     505  If 8-bit I/O port operations are not supported, then ASSERT().
     506
     507  @param  Port    The I/O port to write.
     508  @param  Count   The number of times to write I/O port.
     509  @param  Buffer  The buffer to retrieve the write data from.
     510
     511**/
     512VOID
     513EFIAPI
     514IoWriteFifo8 (
     515  IN      UINTN                     Port,
     516  IN      UINTN                     Count,
     517  IN      VOID                      *Buffer
     518  )
     519{
     520  IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
     521}
     522
     523/**
     524  Reads a 16-bit I/O port fifo into a block of memory.
     525
     526  Reads the 16-bit I/O fifo port specified by Port.
     527  The port is read Count times, and the read data is
     528  stored in the provided Buffer.
     529
     530  This function must guarantee that all I/O read and write operations are
     531  serialized.
     532
     533  If 16-bit I/O port operations are not supported, then ASSERT().
     534
     535  @param  Port    The I/O port to read.
     536  @param  Count   The number of times to read I/O port.
     537  @param  Buffer  The buffer to store the read data into.
     538
     539**/
     540VOID
     541EFIAPI
     542IoReadFifo16 (
     543  IN      UINTN                     Port,
     544  IN      UINTN                     Count,
     545  OUT     VOID                      *Buffer
     546  )
     547{
     548  //
     549  // Make sure Port is aligned on a 16-bit boundary.
     550  //
     551  ASSERT ((Port & 1) == 0);
     552  IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer);
     553}
     554
     555/**
     556  Writes a block of memory into a 16-bit I/O port fifo.
     557
     558  Writes the 16-bit I/O fifo port specified by Port.
     559  The port is written Count times, and the write data is
     560  retrieved from the provided Buffer.
     561
     562  This function must guarantee that all I/O write and write operations are
     563  serialized.
     564
     565  If 16-bit I/O port operations are not supported, then ASSERT().
     566
     567  @param  Port    The I/O port to write.
     568  @param  Count   The number of times to write I/O port.
     569  @param  Buffer  The buffer to retrieve the write data from.
     570
     571**/
     572VOID
     573EFIAPI
     574IoWriteFifo16 (
     575  IN      UINTN                     Port,
     576  IN      UINTN                     Count,
     577  IN      VOID                      *Buffer
     578  )
     579{
     580  //
     581  // Make sure Port is aligned on a 16-bit boundary.
     582  //
     583  ASSERT ((Port & 1) == 0);
     584  IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer);
     585}
     586
     587/**
     588  Reads a 32-bit I/O port fifo into a block of memory.
     589
     590  Reads the 32-bit I/O fifo port specified by Port.
     591  The port is read Count times, and the read data is
     592  stored in the provided Buffer.
     593
     594  This function must guarantee that all I/O read and write operations are
     595  serialized.
     596
     597  If 32-bit I/O port operations are not supported, then ASSERT().
     598
     599  @param  Port    The I/O port to read.
     600  @param  Count   The number of times to read I/O port.
     601  @param  Buffer  The buffer to store the read data into.
     602
     603**/
     604VOID
     605EFIAPI
     606IoReadFifo32 (
     607  IN      UINTN                     Port,
     608  IN      UINTN                     Count,
     609  OUT     VOID                      *Buffer
     610  )
     611{
     612  //
     613  // Make sure Port is aligned on a 32-bit boundary.
     614  //
     615  ASSERT ((Port & 3) == 0);
     616  IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer);
     617}
     618
     619/**
     620  Writes a block of memory into a 32-bit I/O port fifo.
     621
     622  Writes the 32-bit I/O fifo port specified by Port.
     623  The port is written Count times, and the write data is
     624  retrieved from the provided Buffer.
     625
     626  This function must guarantee that all I/O write and write operations are
     627  serialized.
     628
     629  If 32-bit I/O port operations are not supported, then ASSERT().
     630
     631  @param  Port    The I/O port to write.
     632  @param  Count   The number of times to write I/O port.
     633  @param  Buffer  The buffer to retrieve the write data from.
     634
     635**/
     636VOID
     637EFIAPI
     638IoWriteFifo32 (
     639  IN      UINTN                     Port,
     640  IN      UINTN                     Count,
     641  IN      VOID                      *Buffer
     642  )
     643{
     644  //
     645  // Make sure Port is aligned on a 32-bit boundary.
     646  //
     647  ASSERT ((Port & 3) == 0);
     648  IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer);
     649}
     650
     651/**
    400652  Reads an 8-bit MMIO register.
    401653
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette