Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1998 Intel Corporation
  3. Module Name:
  4. Abstract:
  5. Revision History
  6. --*/
  7. /*
  8. * The variable store protocol interface is specific to the reference
  9. * implementation. The initialization code adds variable store devices
  10. * to the system, and the FW connects to the devices to provide the
  11. * variable store interfaces through these devices.
  12. */
  13. /*
  14. * Variable Store Device protocol
  15. */
  16. #define VARIABLE_STORE_PROTOCOL \
  17. { 0xf088cd91, 0xa046, 0x11d2, 0x8e, 0x42, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  18. INTERFACE_DECL(_EFI_VARIABLE_STORE);
  19. typedef
  20. EFI_STATUS
  21. (EFIAPI *EFI_STORE_CLEAR) (
  22. IN struct _EFI_VARIABLE_STORE *This,
  23. IN UINTN BankNo,
  24. IN OUT VOID *Scratch
  25. );
  26. typedef
  27. EFI_STATUS
  28. (EFIAPI *EFI_STORE_READ) (
  29. IN struct _EFI_VARIABLE_STORE *This,
  30. IN UINTN BankNo,
  31. IN UINTN Offset,
  32. IN UINTN BufferSize,
  33. OUT VOID *Buffer
  34. );
  35. typedef
  36. EFI_STATUS
  37. (EFIAPI *EFI_STORE_UPDATE) (
  38. IN struct _EFI_VARIABLE_STORE *This,
  39. IN UINTN BankNo,
  40. IN UINTN Offset,
  41. IN UINTN BufferSize,
  42. IN VOID *Buffer
  43. );
  44. typedef
  45. EFI_STATUS
  46. (EFIAPI *EFI_STORE_SIZE) (
  47. IN struct _EFI_VARIABLE_STORE *This,
  48. IN UINTN NoBanks
  49. );
  50. typedef
  51. EFI_STATUS
  52. (EFIAPI *EFI_TRANSACTION_UPDATE) (
  53. IN struct _EFI_VARIABLE_STORE *This,
  54. IN UINTN BankNo,
  55. IN VOID *NewContents
  56. );
  57. typedef struct _EFI_VARIABLE_STORE {
  58. /*
  59. * Number of banks and bank size
  60. */
  61. UINT32 Attributes;
  62. UINT32 BankSize;
  63. UINT32 NoBanks;
  64. /*
  65. * Functions to access the storage banks
  66. */
  67. EFI_STORE_CLEAR ClearStore;
  68. EFI_STORE_READ ReadStore;
  69. EFI_STORE_UPDATE UpdateStore;
  70. EFI_STORE_SIZE SizeStore OPTIONAL;
  71. EFI_TRANSACTION_UPDATE TransactionUpdate OPTIONAL;
  72. } EFI_VARIABLE_STORE;
  73. /*
  74. *
  75. * ClearStore() - A function to clear the requested storage bank. A cleared
  76. * bank contains all "on" bits.
  77. *
  78. * ReadStore() - Read data from the requested store.
  79. *
  80. * UpdateStore() - Updates data on the requested store. The FW will only
  81. * ever issue updates to clear bits in the store. Updates must be
  82. * performed in LSb to MSb order of the update buffer.
  83. *
  84. * SizeStore() - An optional function for non-runtime stores that can be
  85. * dynamically sized. The FW will only ever increase or decrease the store
  86. * by 1 banksize at a time, and it is always adding or removing a bank from
  87. * the end of the store.
  88. *
  89. * By default the FW will update variables and storage banks in an
  90. * "atomic" manner by keeping 1 old copy of the data during an update,
  91. * and recovering appropiately if the power is lost during the middle
  92. * of an operation. To do this the FW needs to have multiple banks
  93. * of storage dedicated to its use. If that's not possible, the driver
  94. * can implement an atomic bank update function and the FW will allow
  95. * 1 bank in this case. (It will allow any number of banks,
  96. * but it won't require an "extra" bank to provide its bank transaction
  97. * function).
  98. *
  99. * TransactionUpdate() - An optional function that can clear & update an
  100. * entire bank in an "atomic" fashion. If the operation fails in the
  101. * middle the driver is responsible for having either the previous copy
  102. * of the bank's data or the new copy. A copy that's partially written
  103. * is not valid as internal data settings may get lost. Supply this
  104. * function only when needed.
  105. */