VirtualBox

Ignore:
Timestamp:
Aug 14, 2024 1:16:30 PM (4 months ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

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/Include/Library/BaseLib.h

    r101291 r105670  
    193193
    194194VOID
     195RiscVSetSupervisorTimeCompareRegister (
     196  IN UINT64
     197  );
     198
     199VOID
    195200RiscVEnableTimerInterrupt (
    196201  VOID
     
    205210RiscVClearPendingTimerInterrupt (
    206211  VOID
     212  );
     213
     214/**
     215  RISC-V invalidate instruction cache.
     216
     217**/
     218VOID
     219EFIAPI
     220RiscVInvalidateInstCacheFenceAsm (
     221  VOID
     222  );
     223
     224/**
     225  RISC-V invalidate data cache.
     226
     227**/
     228VOID
     229EFIAPI
     230RiscVInvalidateDataCacheFenceAsm (
     231  VOID
     232  );
     233
     234/**
     235  RISC-V flush cache block. Atomically perform a clean operation
     236  followed by an invalidate operation
     237
     238**/
     239VOID
     240EFIAPI
     241RiscVCpuCacheFlushCmoAsm (
     242  IN UINTN
     243  );
     244
     245/**
     246Perform a write transfer to another cache or to memory if the
     247data in the copy of the cache block have been modified by a store
     248operation
     249
     250**/
     251VOID
     252EFIAPI
     253RiscVCpuCacheCleanCmoAsm (
     254  IN UINTN
     255  );
     256
     257/**
     258Deallocate the copy of the cache block
     259
     260**/
     261VOID
     262EFIAPI
     263RiscVCpuCacheInvalCmoAsm (
     264  IN UINTN
    207265  );
    208266
     
    230288#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT  8
    231289
     290/*
     291 * Set the exception base address for LoongArch.
     292 *
     293 * @param  ExceptionBaseAddress   The exception base address, must be aligned greater than or qeual to 4K .
     294 */
     295VOID
     296SetExceptionBaseAddress (
     297  IN UINT64
     298  );
     299
     300/*
     301 * Set the TlbRebase address for LoongArch.
     302 *
     303 * @param  TlbRebaseAddress   The TlbRebase address, must be aligned greater than or qeual to 4K .
     304 */
     305VOID
     306SetTlbRebaseAddress (
     307  IN UINT64
     308  );
     309
     310/**
     311  Enables local CPU interrupts.
     312
     313  @param  Needs to enable local interrupt bit.
     314**/
     315VOID
     316EnableLocalInterrupts (
     317  IN UINT16
     318  );
     319
     320/**
     321  Disables local CPU interrupts.
     322
     323  @param  Needs to disable local interrupt bit.
     324**/
     325VOID
     326DisableLocalInterrupts (
     327  IN UINT16
     328  );
     329
     330/**
     331  Read CPUCFG register.
     332
     333  @param  Index  Specifies the register number of the CPUCFG to read the data.
     334  @param  Data   A pointer to the variable used to store the CPUCFG register value.
     335**/
     336VOID
     337AsmCpucfg (
     338  IN  UINT32  Index,
     339  OUT UINT32  *Data
     340  );
     341
     342/**
     343  Gets the timer count value.
     344
     345  @param[] VOID
     346  @retval  timer count value.
     347
     348**/
     349UINTN
     350AsmReadStableCounter (
     351  VOID
     352  );
     353
     354/**
     355  CSR read operation.
     356
     357  @param[in]  Select   CSR read instruction select values.
     358
     359  @return     The return value of csrrd instruction, return -1 means no CSR instruction
     360              is found.
     361**/
     362UINTN
     363CsrRead (
     364  IN UINT16  Select
     365  );
     366
     367/**
     368  CSR write operation.
     369
     370  @param[in]  Select   CSR write instruction select values.
     371  @param[in]  Value    The csrwr will write the value.
     372
     373  @return     The return value of csrwr instruction, that is, store the old value of
     374              the register, return -1 means no CSR instruction is found.
     375**/
     376UINTN
     377CsrWrite (
     378  IN UINT16  Select,
     379  IN UINTN   Value
     380  );
     381
     382/**
     383  CSR exchange operation.
     384
     385  @param[in]  Select   CSR exchange instruction select values.
     386  @param[in]  Value    The csrxchg will write the value.
     387  @param[in]  Mask     The csrxchg mask value.
     388
     389  @return     The return value of csrxchg instruction, that is, store the old value of
     390              the register, return -1 means no CSR instruction is found.
     391**/
     392UINTN
     393CsrXChg (
     394  IN UINT16  Select,
     395  IN UINTN   Value,
     396  IN UINTN   Mask
     397  );
     398
     399/**
     400  IO CSR read byte operation.
     401
     402  @param[in]  Select   IO CSR read instruction select values.
     403
     404  @return     The return value of iocsrrd.b instruction.
     405
     406**/
     407UINT8
     408IoCsrRead8 (
     409  IN UINTN  Select
     410  );
     411
     412/**
     413  IO CSR read half word operation.
     414
     415  @param[in]  Select   IO CSR read instruction select values.
     416
     417  @return     The return value of iocsrrd.h instruction.
     418
     419**/
     420UINT16
     421IoCsrRead16 (
     422  IN UINTN  Select
     423  );
     424
     425/**
     426  IO CSR read word operation.
     427
     428  @param[in]  Select   IO CSR read instruction select values.
     429
     430  @return     The return value of iocsrrd.w instruction.
     431
     432**/
     433UINT32
     434IoCsrRead32 (
     435  IN UINTN  Select
     436  );
     437
     438/**
     439  IO CSR read double word operation. Only for LoongArch64.
     440
     441  @param[in]  Select   IO CSR read instruction select values.
     442
     443  @return     The return value of iocsrrd.d instruction.
     444
     445**/
     446UINT64
     447IoCsrRead64 (
     448  IN UINTN  Select
     449  );
     450
     451/**
     452  IO CSR write byte operation.
     453
     454  @param[in]  Select   IO CSR write instruction select values.
     455  @param[in]  Value    The iocsrwr.b will write the value.
     456
     457  @return     VOID.
     458
     459**/
     460VOID
     461IoCsrWrite8 (
     462  IN UINTN  Select,
     463  IN UINT8  Value
     464  );
     465
     466/**
     467  IO CSR write half word operation.
     468
     469  @param[in]  Select   IO CSR write instruction select values.
     470  @param[in]  Value    The iocsrwr.h will write the value.
     471
     472  @return     VOID.
     473
     474**/
     475VOID
     476IoCsrWrite16 (
     477  IN UINTN   Select,
     478  IN UINT16  Value
     479  );
     480
     481/**
     482  IO CSR write word operation.
     483
     484  @param[in]  Select   IO CSR write instruction select values.
     485  @param[in]  Value    The iocsrwr.w will write the value.
     486
     487  @return     VOID.
     488
     489**/
     490VOID
     491IoCsrWrite32 (
     492  IN UINTN   Select,
     493  IN UINT32  Value
     494  );
     495
     496/**
     497  IO CSR write double word operation. Only for LoongArch64.
     498
     499  @param[in]  Select   IO CSR write instruction select values.
     500  @param[in]  Value    The iocsrwr.d will write the value.
     501
     502  @return     VOID.
     503
     504**/
     505VOID
     506IoCsrWrite64 (
     507  IN UINTN   Select,
     508  IN UINT64  Value
     509  );
     510
    232511#endif // defined (MDE_CPU_LOONGARCH64)
    233512
     
    45994878  IN  UINT16      InitialValue
    46004879  );
     4880
     4881//
     4882// Initial value for the CRC16-ANSI algorithm, when no prior checksum has been calculated.
     4883//
     4884#define CRC16ANSI_INIT  0xffff
    46014885
    46024886/**
     
    75937877  );
    75947878
     7879///
     7880/// The structure used to supply and return data to and from the SVSM.
     7881///
     7882typedef struct {
     7883  VOID      *Caa;
     7884  UINT64    RaxIn;
     7885  UINT64    RcxIn;
     7886  UINT64    RdxIn;
     7887  UINT64    R8In;
     7888  UINT64    R9In;
     7889  UINT64    RaxOut;
     7890  UINT64    RcxOut;
     7891  UINT64    RdxOut;
     7892  UINT64    R8Out;
     7893  UINT64    R9Out;
     7894  UINT8     *CallPending;
     7895} SVSM_CALL_DATA;
     7896
     7897/**
     7898  Executes a VMGEXIT instruction (VMMCALL with a REP prefix) with arguments
     7899  and return code
     7900
     7901  Executes a VMGEXIT instruction placing the specified arguments in the
     7902  corresponding registers before invocation. Upon return an XCHG is done to
     7903  atomically clear and retrieve the SVSM call pending value. The returned RAX
     7904  register value becomes the function return code. This function is intended
     7905  for use with an SVSM. This function is only available on IA-32 and x64.
     7906
     7907  @param[in,out]  SvsmCallPending  Pointer to the location of the SVSM call data
     7908
     7909  @return                          Value of the RAX register on return
     7910
     7911**/
     7912UINT32
     7913EFIAPI
     7914AsmVmgExitSvsm (
     7915  IN OUT SVSM_CALL_DATA  *SvsmCallData
     7916  );
     7917
    75957918/**
    75967919  Patch the immediate operand of an IA32 or X64 instruction such that the byte,
Note: See TracChangeset for help on using the changeset viewer.

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