PlatformBm.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /** @file
  2. Head file for BDS Platform specific code
  3. Copyright (c) 2022 Loongson Technology Corporation Limited. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef PLATFORM_BM_H_
  7. #define PLATFORM_BM_H_
  8. #include <Library/DevicePathLib.h>
  9. #define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }
  10. #define SERIAL_DXE_FILE_GUID { \
  11. 0xD3987D4B, 0x971A, 0x435F, \
  12. { 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72, 0x41 } \
  13. }
  14. #define ALIGN_UP(addr, align) \
  15. ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
  16. #pragma pack (1)
  17. typedef struct {
  18. VENDOR_DEVICE_PATH SerialDxe;
  19. UART_DEVICE_PATH Uart;
  20. VENDOR_DEFINED_DEVICE_PATH TermType;
  21. EFI_DEVICE_PATH_PROTOCOL End;
  22. } PLATFORM_SERIAL_CONSOLE;
  23. #pragma pack ()
  24. #pragma pack (1)
  25. typedef struct {
  26. USB_CLASS_DEVICE_PATH Keyboard;
  27. EFI_DEVICE_PATH_PROTOCOL End;
  28. } PLATFORM_USB_KEYBOARD;
  29. #pragma pack ()
  30. /**
  31. Check if the handle satisfies a particular condition.
  32. @param[in] Handle The handle to check.
  33. @param[in] ReportText A caller-allocated string passed in for reporting
  34. purposes. It must never be NULL.
  35. @retval TRUE The condition is satisfied.
  36. @retval FALSE Otherwise. This includes the case when the condition could not
  37. be fully evaluated due to an error.
  38. **/
  39. typedef
  40. BOOLEAN
  41. (EFIAPI *FILTER_FUNCTION) (
  42. IN EFI_HANDLE Handle,
  43. IN CONST CHAR16 *ReportText
  44. );
  45. /**
  46. Process a handle.
  47. @param[in] Handle The handle to process.
  48. @param[in] ReportText A caller-allocated string passed in for reporting
  49. purposes. It must never be NULL.
  50. **/
  51. typedef
  52. VOID
  53. (EFIAPI *CALLBACK_FUNCTION) (
  54. IN EFI_HANDLE Handle,
  55. IN CONST CHAR16 *ReportText
  56. );
  57. /**
  58. * execute from kernel entry point.
  59. *
  60. * @param[in] Argc The count of args.
  61. * @param[in] Argv The pointer to args array.
  62. * @param[in] Bpi The pointer to bootparaminterface struct.
  63. * @param[in] Vec The fourth args for kernel.
  64. ***/
  65. typedef
  66. VOID
  67. (EFIAPI *EFI_KERNEL_ENTRY_POINT) (
  68. IN UINTN Argc,
  69. IN VOID *Argv,
  70. IN VOID *Bpi,
  71. IN VOID *Vec
  72. );
  73. /**
  74. Download the kernel, the initial ramdisk, and the kernel command line from
  75. QEMU's fw_cfg. Construct a minimal SimpleFileSystem that contains the two
  76. image files, and load and start the kernel from it.
  77. The kernel will be instructed via its command line to load the initrd from
  78. the same Simple FileSystem.
  79. @retval EFI_NOT_FOUND Kernel image was not found.
  80. @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
  81. @retval EFI_PROTOCOL_ERROR Unterminated kernel command line.
  82. @return Error codes from any of the underlying
  83. functions. On success, the function doesn't
  84. return.
  85. **/
  86. EFI_STATUS
  87. EFIAPI
  88. TryRunningQemuKernel (
  89. VOID
  90. );
  91. #endif // PLATFORM_BM_H_