VirtualBox

Ignore:
Timestamp:
Nov 6, 2014 11:10:15 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96810
Message:

EFI: use rep ins/outs where appropriate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c

    r48674 r53251  
    197197}
    198198
     199
     200#ifdef VBOX
     201
     202/**
     203  Reads an 8-bit I/O FIFO port.
     204
     205  @param  Port   The I/O port to read.
     206  @param  Buffer The buffer to write the data to.
     207  @param  Count  The number of bytes to read.
     208
     209**/
     210__inline__
     211VOID
     212EFIAPI
     213IoReadBuffer8 (
     214  IN      UINTN                     Port,
     215  OUT     VOID                      *Buffer,
     216  IN      UINTN                     Count
     217  )
     218{
     219  __asm__ __volatile__ ("rep; insb" : "+D" (Buffer), "+c" (Count) : "d" ((UINT16)Port));
     220}
     221
     222
     223/**
     224  Reads a 16-bit I/O FIFO port.
     225
     226  @param  Port   The I/O port to read.
     227  @param  Buffer The buffer to write the data to.
     228  @param  Count  The number of words to read.
     229
     230**/
     231__inline__
     232VOID
     233EFIAPI
     234IoReadBuffer16 (
     235  IN      UINTN                     Port,
     236  OUT     VOID                      *Buffer,
     237  IN      UINTN                     Count
     238  )
     239{
     240  __asm__ __volatile__ ("rep; insw" : "+D" (Buffer), "+c" (Count) : "d" ((UINT16)Port));
     241}
     242
     243/**
     244  Reads a 32-bit I/O FIFO port.
     245
     246  @param  Port   The I/O port to read.
     247  @param  Buffer The buffer to write the data to.
     248  @param  Count  The number of dwords to read.
     249
     250**/
     251__inline__
     252VOID
     253EFIAPI
     254IoReadBuffer32 (
     255  IN      UINTN                     Port,
     256  OUT     VOID                      *Buffer,
     257  IN      UINTN                     Count
     258  )
     259{
     260  __asm__ __volatile__ ("rep; insl" : "+D" (Buffer), "+c" (Count) : "d" ((UINT16)Port));
     261}
     262
     263
     264/**
     265  Writes to an 8-bit I/O FIFO port.
     266
     267  @param  Port   The I/O port to read.
     268  @param  Buffer The buffer to write the data to.
     269  @param  Count  The number of bytes to write.
     270
     271**/
     272__inline__
     273VOID
     274EFIAPI
     275IoWriteBuffer8 (
     276  IN      UINTN                     Port,
     277  IN CONST VOID                     *Buffer,
     278  IN      UINTN                     Count
     279  )
     280{
     281  __asm__ __volatile__ ("rep; outsb" : "+S" (Buffer), "+c" (Count) : "d" ((UINT16)Port));
     282}
     283
     284
     285/**
     286  Writes to a 16-bit I/O FIFO port.
     287
     288  @param  Port   The I/O port to read.
     289  @param  Buffer The buffer to write the data to.
     290  @param  Count  The number of words to write.
     291
     292**/
     293__inline__
     294VOID
     295EFIAPI
     296IoWriteBuffer16 (
     297  IN      UINTN                     Port,
     298  IN CONST VOID                     *Buffer,
     299  IN      UINTN                     Count
     300  )
     301{
     302  __asm__ __volatile__ ("rep; outsw" : "+S" (Buffer), "+c" (Count) : "d" ((UINT16)Port));
     303}
     304
     305/**
     306  Writes to a 32-bit I/O FIFO port.
     307
     308  @param  Port   The I/O port to read.
     309  @param  Buffer The buffer to write the data to.
     310  @param  Count  The number of dwords to write.
     311
     312**/
     313__inline__
     314VOID
     315EFIAPI
     316IoWriteBuffer32 (
     317  IN      UINTN                     Port,
     318  IN CONST VOID                     *Buffer,
     319  IN      UINTN                     Count
     320  )
     321{
     322  __asm__ __volatile__ ("rep; outsl" : "+S" (Buffer), "+c" (Count) : "d" ((UINT16)Port));
     323}
     324
     325#endif /* VBOX */
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