AcpiParser.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. /** @file
  2. Header file for ACPI parser
  3. Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
  4. Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
  5. Copyright (c) 2022, AMD Incorporated. All rights reserved.
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #ifndef ACPIPARSER_H_
  9. #define ACPIPARSER_H_
  10. #define OUTPUT_FIELD_COLUMN_WIDTH 36
  11. /// The RSDP table signature is "RSD PTR " (8 bytes)
  12. /// However The signature for ACPI tables is 4 bytes.
  13. /// To work around this oddity define a signature type
  14. /// that allows us to process the log options.
  15. #define RSDP_TABLE_INFO SIGNATURE_32('R', 'S', 'D', 'P')
  16. /**
  17. This function increments the ACPI table error counter.
  18. **/
  19. VOID
  20. EFIAPI
  21. IncrementErrorCount (
  22. VOID
  23. );
  24. /**
  25. This function increments the ACPI table warning counter.
  26. **/
  27. VOID
  28. EFIAPI
  29. IncrementWarningCount (
  30. VOID
  31. );
  32. /**
  33. This function verifies the ACPI table checksum.
  34. This function verifies the checksum for the ACPI table and optionally
  35. prints the status.
  36. @param [in] Log If TRUE log the status of the checksum.
  37. @param [in] Ptr Pointer to the start of the table buffer.
  38. @param [in] Length The length of the buffer.
  39. @retval TRUE The checksum is OK.
  40. @retval FALSE The checksum failed.
  41. **/
  42. BOOLEAN
  43. EFIAPI
  44. VerifyChecksum (
  45. IN BOOLEAN Log,
  46. IN UINT8 *Ptr,
  47. IN UINT32 Length
  48. );
  49. /**
  50. This function performs a raw data dump of the ACPI table.
  51. @param [in] Ptr Pointer to the start of the table buffer.
  52. @param [in] Length The length of the buffer.
  53. **/
  54. VOID
  55. EFIAPI
  56. DumpRaw (
  57. IN UINT8 *Ptr,
  58. IN UINT32 Length
  59. );
  60. /**
  61. This function traces 1 byte of datum as specified in the format string.
  62. @param [in] Format The format string for tracing the data.
  63. @param [in] Ptr Pointer to the start of the buffer.
  64. **/
  65. VOID
  66. EFIAPI
  67. DumpUint8 (
  68. IN CONST CHAR16 *Format,
  69. IN UINT8 *Ptr
  70. );
  71. /**
  72. This function traces 2 bytes of data as specified in the format string.
  73. @param [in] Format The format string for tracing the data.
  74. @param [in] Ptr Pointer to the start of the buffer.
  75. **/
  76. VOID
  77. EFIAPI
  78. DumpUint16 (
  79. IN CONST CHAR16 *Format,
  80. IN UINT8 *Ptr
  81. );
  82. /**
  83. This function traces 4 bytes of data as specified in the format string.
  84. @param [in] Format The format string for tracing the data.
  85. @param [in] Ptr Pointer to the start of the buffer.
  86. **/
  87. VOID
  88. EFIAPI
  89. DumpUint32 (
  90. IN CONST CHAR16 *Format,
  91. IN UINT8 *Ptr
  92. );
  93. /**
  94. This function traces 8 bytes of data as specified by the format string.
  95. @param [in] Format The format string for tracing the data.
  96. @param [in] Ptr Pointer to the start of the buffer.
  97. **/
  98. VOID
  99. EFIAPI
  100. DumpUint64 (
  101. IN CONST CHAR16 *Format,
  102. IN UINT8 *Ptr
  103. );
  104. /**
  105. This function traces 3 characters which can be optionally
  106. formated using the format string if specified.
  107. If no format string is specified the Format must be NULL.
  108. @param [in] Format Optional format string for tracing the data.
  109. @param [in] Ptr Pointer to the start of the buffer.
  110. **/
  111. VOID
  112. EFIAPI
  113. Dump3Chars (
  114. IN CONST CHAR16 *Format OPTIONAL,
  115. IN UINT8 *Ptr
  116. );
  117. /**
  118. This function traces 4 characters which can be optionally
  119. formated using the format string if specified.
  120. If no format string is specified the Format must be NULL.
  121. @param [in] Format Optional format string for tracing the data.
  122. @param [in] Ptr Pointer to the start of the buffer.
  123. **/
  124. VOID
  125. EFIAPI
  126. Dump4Chars (
  127. IN CONST CHAR16 *Format OPTIONAL,
  128. IN UINT8 *Ptr
  129. );
  130. /**
  131. This function traces 6 characters which can be optionally
  132. formated using the format string if specified.
  133. If no format string is specified the Format must be NULL.
  134. @param [in] Format Optional format string for tracing the data.
  135. @param [in] Ptr Pointer to the start of the buffer.
  136. **/
  137. VOID
  138. EFIAPI
  139. Dump6Chars (
  140. IN CONST CHAR16 *Format OPTIONAL,
  141. IN UINT8 *Ptr
  142. );
  143. /**
  144. This function traces 8 characters which can be optionally
  145. formated using the format string if specified.
  146. If no format string is specified the Format must be NULL.
  147. @param [in] Format Optional format string for tracing the data.
  148. @param [in] Ptr Pointer to the start of the buffer.
  149. **/
  150. VOID
  151. EFIAPI
  152. Dump8Chars (
  153. IN CONST CHAR16 *Format OPTIONAL,
  154. IN UINT8 *Ptr
  155. );
  156. /**
  157. This function traces 12 characters which can be optionally
  158. formated using the format string if specified.
  159. If no format string is specified the Format must be NULL.
  160. @param [in] Format Optional format string for tracing the data.
  161. @param [in] Ptr Pointer to the start of the buffer.
  162. **/
  163. VOID
  164. EFIAPI
  165. Dump12Chars (
  166. IN CONST CHAR16 *Format OPTIONAL,
  167. IN UINT8 *Ptr
  168. );
  169. /**
  170. This function indents and prints the ACPI table Field Name.
  171. @param [in] Indent Number of spaces to add to the global table
  172. indent. The global table indent is 0 by default;
  173. however this value is updated on entry to the
  174. ParseAcpi() by adding the indent value provided to
  175. ParseAcpi() and restored back on exit. Therefore
  176. the total indent in the output is dependent on from
  177. where this function is called.
  178. @param [in] FieldName Pointer to the Field Name.
  179. **/
  180. VOID
  181. EFIAPI
  182. PrintFieldName (
  183. IN UINT32 Indent,
  184. IN CONST CHAR16 *FieldName
  185. );
  186. /**
  187. This function pointer is the template for customizing the trace output
  188. @param [in] Format Format string for tracing the data as specified by
  189. the 'Format' member of ACPI_PARSER.
  190. @param [in] Ptr Pointer to the start of the buffer.
  191. **/
  192. typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr);
  193. /**
  194. This function pointer is the template for validating an ACPI table field.
  195. @param [in] Ptr Pointer to the start of the field data.
  196. @param [in] Context Pointer to context specific information as specified by
  197. the 'Context' member of the ACPI_PARSER.
  198. e.g. this could be a pointer to the ACPI table header.
  199. **/
  200. typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context);
  201. /**
  202. The ACPI_PARSER structure describes the fields of an ACPI table and
  203. provides means for the parser to interpret and trace appropriately.
  204. The first three members are populated based on information present in
  205. in the ACPI table specifications. The remaining members describe how
  206. the parser should report the field information, validate the field data
  207. and/or update an external pointer to the field (ItemPtr).
  208. ParseAcpi() uses the format string specified by 'Format' for tracing
  209. the field data. If the field is more complex and requires additional
  210. processing for formatting and representation a print formatter function
  211. can be specified in 'PrintFormatter'.
  212. ParseAcpiBitFields() uses AcpiParser structure to parse the bit fields.
  213. It considers Length as a number of bits that need to be parsed.
  214. Also, the Offset field will be considered as starting offset of the bitfield.
  215. The PrintFormatter function may choose to use the format string
  216. specified by 'Format' or use its own internal format string.
  217. The 'Format' and 'PrintFormatter' members allow flexibility for
  218. representing the field data.
  219. **/
  220. typedef struct AcpiParser {
  221. /// String describing the ACPI table field
  222. /// (Field column from ACPI table spec)
  223. CONST CHAR16 *NameStr;
  224. /// The length of the field.
  225. /// (Byte Length column from ACPI table spec)
  226. /// Length(in bits) of the bitfield if used with ParseAcpiBitFields().
  227. UINT32 Length;
  228. /// The offset of the field from the start of the table.
  229. /// (Byte Offset column from ACPI table spec)
  230. /// The Bit offset of the field if used with ParseAcpiBitFields().
  231. UINT32 Offset;
  232. /// Optional Print() style format string for tracing the data. If not
  233. /// used this must be set to NULL.
  234. CONST CHAR16 *Format;
  235. /// Optional pointer to a print formatter function which
  236. /// is typically used to trace complex field information.
  237. /// If not used this must be set to NULL.
  238. /// The Format string is passed to the PrintFormatter function
  239. /// but may be ignored by the implementation code.
  240. FNPTR_PRINT_FORMATTER PrintFormatter;
  241. /// Optional pointer which may be set to request the parser to update
  242. /// a pointer to the field data. This value is set after the FieldValidator
  243. /// has been called and therefore should not be used by the FieldValidator.
  244. /// If unused this must be set to NULL.
  245. /// ItemPtr is not supported with ParseAcpiBitFields().
  246. VOID **ItemPtr;
  247. /// Optional pointer to a field validator function.
  248. /// The function should directly report any appropriate error or warning
  249. /// and invoke the appropriate counter update function.
  250. /// If not used this parameter must be set to NULL.
  251. FNPTR_FIELD_VALIDATOR FieldValidator;
  252. /// Optional pointer to context specific information,
  253. /// which the Field Validator function can use to determine
  254. /// additional information about the ACPI table and make
  255. /// decisions about the field being validated.
  256. /// e.g. this could be a pointer to the ACPI table header
  257. VOID *Context;
  258. } ACPI_PARSER;
  259. /**
  260. A structure used to store the pointers to the members of the
  261. ACPI description header structure that was parsed.
  262. **/
  263. typedef struct AcpiDescriptionHeaderInfo {
  264. /// ACPI table signature
  265. UINT32 *Signature;
  266. /// Length of the ACPI table
  267. UINT32 *Length;
  268. /// Revision
  269. UINT8 *Revision;
  270. /// Checksum
  271. UINT8 *Checksum;
  272. /// OEM Id - length is 6 bytes
  273. UINT8 *OemId;
  274. /// OEM table Id
  275. UINT64 *OemTableId;
  276. /// OEM revision Id
  277. UINT32 *OemRevision;
  278. /// Creator Id
  279. UINT32 *CreatorId;
  280. /// Creator revision
  281. UINT32 *CreatorRevision;
  282. } ACPI_DESCRIPTION_HEADER_INFO;
  283. /**
  284. This function is used to parse an ACPI table buffer.
  285. The ACPI table buffer is parsed using the ACPI table parser information
  286. specified by a pointer to an array of ACPI_PARSER elements. This parser
  287. function iterates through each item on the ACPI_PARSER array and logs the
  288. ACPI table fields.
  289. This function can optionally be used to parse ACPI tables and fetch specific
  290. field values. The ItemPtr member of the ACPI_PARSER structure (where used)
  291. is updated by this parser function to point to the selected field data
  292. (e.g. useful for variable length nested fields).
  293. @param [in] Trace Trace the ACPI fields TRUE else only parse the
  294. table.
  295. @param [in] Indent Number of spaces to indent the output.
  296. @param [in] AsciiName Optional pointer to an ASCII string that describes
  297. the table being parsed.
  298. @param [in] Ptr Pointer to the start of the buffer.
  299. @param [in] Length Length of the buffer pointed by Ptr.
  300. @param [in] Parser Pointer to an array of ACPI_PARSER structure that
  301. describes the table being parsed.
  302. @param [in] ParserItems Number of items in the ACPI_PARSER array.
  303. @retval Number of bytes parsed.
  304. **/
  305. UINT32
  306. EFIAPI
  307. ParseAcpi (
  308. IN BOOLEAN Trace,
  309. IN UINT32 Indent,
  310. IN CONST CHAR8 *AsciiName OPTIONAL,
  311. IN UINT8 *Ptr,
  312. IN UINT32 Length,
  313. IN CONST ACPI_PARSER *Parser,
  314. IN UINT32 ParserItems
  315. );
  316. /**
  317. This function is used to parse an ACPI table bitfield buffer.
  318. The ACPI table buffer is parsed using the ACPI table parser information
  319. specified by a pointer to an array of ACPI_PARSER elements. This parser
  320. function iterates through each item on the ACPI_PARSER array and logs the ACPI table bitfields.
  321. This function can optionally be used to parse ACPI tables and fetch specific
  322. field values. The ItemPtr member of the ACPI_PARSER structure (where used)
  323. is updated by this parser function to point to the selected field data
  324. (e.g. useful for variable length nested fields).
  325. ItemPtr member of ACPI_PARSER is not supported with this function.
  326. @param [in] Trace Trace the ACPI fields TRUE else only parse the
  327. table.
  328. @param [in] Indent Number of spaces to indent the output.
  329. @param [in] AsciiName Optional pointer to an ASCII string that describes
  330. the table being parsed.
  331. @param [in] Ptr Pointer to the start of the buffer.
  332. @param [in] Length Length of the buffer pointed by Ptr.
  333. @param [in] Parser Pointer to an array of ACPI_PARSER structure that
  334. describes the table being parsed.
  335. @param [in] ParserItems Number of items in the ACPI_PARSER array.
  336. @retval Number of bits parsed.
  337. **/
  338. UINT32
  339. EFIAPI
  340. ParseAcpiBitFields (
  341. IN BOOLEAN Trace,
  342. IN UINT32 Indent,
  343. IN CONST CHAR8 *AsciiName OPTIONAL,
  344. IN UINT8 *Ptr,
  345. IN UINT32 Length,
  346. IN CONST ACPI_PARSER *Parser,
  347. IN UINT32 ParserItems
  348. );
  349. /**
  350. This is a helper macro to pass parameters to the Parser functions.
  351. @param [in] Parser The name of the ACPI_PARSER array describing the
  352. ACPI table fields.
  353. **/
  354. #define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0])
  355. /**
  356. This is a helper macro for describing the ACPI header fields.
  357. @param [out] Info Pointer to retrieve the ACPI table header information.
  358. **/
  359. #define PARSE_ACPI_HEADER(Info) \
  360. { L"Signature", 4, 0, NULL, Dump4Chars, \
  361. (VOID**)&(Info)->Signature , NULL, NULL }, \
  362. { L"Length", 4, 4, L"%d", NULL, \
  363. (VOID**)&(Info)->Length, NULL, NULL }, \
  364. { L"Revision", 1, 8, L"%d", NULL, \
  365. (VOID**)&(Info)->Revision, NULL, NULL }, \
  366. { L"Checksum", 1, 9, L"0x%X", NULL, \
  367. (VOID**)&(Info)->Checksum, NULL, NULL }, \
  368. { L"Oem ID", 6, 10, NULL, Dump6Chars, \
  369. (VOID**)&(Info)->OemId, NULL, NULL }, \
  370. { L"Oem Table ID", 8, 16, NULL, Dump8Chars, \
  371. (VOID**)&(Info)->OemTableId, NULL, NULL }, \
  372. { L"Oem Revision", 4, 24, L"0x%X", NULL, \
  373. (VOID**)&(Info)->OemRevision, NULL, NULL }, \
  374. { L"Creator ID", 4, 28, NULL, Dump4Chars, \
  375. (VOID**)&(Info)->CreatorId, NULL, NULL }, \
  376. { L"Creator Revision", 4, 32, L"0x%X", NULL, \
  377. (VOID**)&(Info)->CreatorRevision, NULL, NULL }
  378. /**
  379. This function indents and traces the GAS structure as described by the GasParser.
  380. @param [in] Ptr Pointer to the start of the buffer.
  381. @param [in] Indent Number of spaces to indent the output.
  382. @param [in] Length Length of the GAS structure buffer.
  383. @retval Number of bytes parsed.
  384. **/
  385. UINT32
  386. EFIAPI
  387. DumpGasStruct (
  388. IN UINT8 *Ptr,
  389. IN UINT32 Indent,
  390. IN UINT32 Length
  391. );
  392. /**
  393. This function traces the GAS structure as described by the GasParser.
  394. @param [in] Format Optional format string for tracing the data.
  395. @param [in] Ptr Pointer to the start of the buffer.
  396. **/
  397. VOID
  398. EFIAPI
  399. DumpGas (
  400. IN CONST CHAR16 *Format OPTIONAL,
  401. IN UINT8 *Ptr
  402. );
  403. /**
  404. This function traces the ACPI header as described by the AcpiHeaderParser.
  405. @param [in] Ptr Pointer to the start of the buffer.
  406. @retval Number of bytes parsed.
  407. **/
  408. UINT32
  409. EFIAPI
  410. DumpAcpiHeader (
  411. IN UINT8 *Ptr
  412. );
  413. /**
  414. This function parses the ACPI header as described by the AcpiHeaderParser.
  415. This function optionally returns the Signature, Length and revision of the
  416. ACPI table.
  417. @param [in] Ptr Pointer to the start of the buffer.
  418. @param [out] Signature Gets location of the ACPI table signature.
  419. @param [out] Length Gets location of the length of the ACPI table.
  420. @param [out] Revision Gets location of the revision of the ACPI table.
  421. @retval Number of bytes parsed.
  422. **/
  423. UINT32
  424. EFIAPI
  425. ParseAcpiHeader (
  426. IN UINT8 *Ptr,
  427. OUT CONST UINT32 **Signature,
  428. OUT CONST UINT32 **Length,
  429. OUT CONST UINT8 **Revision
  430. );
  431. /**
  432. This function parses the ACPI AEST table.
  433. When trace is enabled this function parses the AEST table and
  434. traces the ACPI table fields.
  435. This function also performs validation of the ACPI table fields.
  436. @param [in] Trace If TRUE, trace the ACPI fields.
  437. @param [in] Ptr Pointer to the start of the buffer.
  438. @param [in] AcpiTableLength Length of the ACPI table.
  439. @param [in] AcpiTableRevision Revision of the ACPI table.
  440. **/
  441. VOID
  442. EFIAPI
  443. ParseAcpiAest (
  444. IN BOOLEAN Trace,
  445. IN UINT8 *Ptr,
  446. IN UINT32 AcpiTableLength,
  447. IN UINT8 AcpiTableRevision
  448. );
  449. /**
  450. This function parses the ACPI APMT table.
  451. When trace is enabled this function parses the APMT table and
  452. traces the ACPI table fields.
  453. This function also performs validation of the ACPI table fields.
  454. @param [in] Trace If TRUE, trace the ACPI fields.
  455. @param [in] Ptr Pointer to the start of the buffer.
  456. @param [in] AcpiTableLength Length of the ACPI table.
  457. @param [in] AcpiTableRevision Revision of the ACPI table.
  458. **/
  459. VOID
  460. EFIAPI
  461. ParseAcpiApmt (
  462. IN BOOLEAN Trace,
  463. IN UINT8 *Ptr,
  464. IN UINT32 AcpiTableLength,
  465. IN UINT8 AcpiTableRevision
  466. );
  467. /**
  468. This function parses the ACPI BGRT table.
  469. When trace is enabled this function parses the BGRT table and
  470. traces the ACPI table fields.
  471. This function also performs validation of the ACPI table fields.
  472. @param [in] Trace If TRUE, trace the ACPI fields.
  473. @param [in] Ptr Pointer to the start of the buffer.
  474. @param [in] AcpiTableLength Length of the ACPI table.
  475. @param [in] AcpiTableRevision Revision of the ACPI table.
  476. **/
  477. VOID
  478. EFIAPI
  479. ParseAcpiBgrt (
  480. IN BOOLEAN Trace,
  481. IN UINT8 *Ptr,
  482. IN UINT32 AcpiTableLength,
  483. IN UINT8 AcpiTableRevision
  484. );
  485. /**
  486. This function parses the ACPI DBG2 table.
  487. When trace is enabled this function parses the DBG2 table and
  488. traces the ACPI table fields.
  489. This function also performs validation of the ACPI table fields.
  490. @param [in] Trace If TRUE, trace the ACPI fields.
  491. @param [in] Ptr Pointer to the start of the buffer.
  492. @param [in] AcpiTableLength Length of the ACPI table.
  493. @param [in] AcpiTableRevision Revision of the ACPI table.
  494. **/
  495. VOID
  496. EFIAPI
  497. ParseAcpiDbg2 (
  498. IN BOOLEAN Trace,
  499. IN UINT8 *Ptr,
  500. IN UINT32 AcpiTableLength,
  501. IN UINT8 AcpiTableRevision
  502. );
  503. /**
  504. This function parses the ACPI DSDT table.
  505. When trace is enabled this function parses the DSDT table and
  506. traces the ACPI table fields.
  507. For the DSDT table only the ACPI header fields are parsed and
  508. traced.
  509. @param [in] Trace If TRUE, trace the ACPI fields.
  510. @param [in] Ptr Pointer to the start of the buffer.
  511. @param [in] AcpiTableLength Length of the ACPI table.
  512. @param [in] AcpiTableRevision Revision of the ACPI table.
  513. **/
  514. VOID
  515. EFIAPI
  516. ParseAcpiDsdt (
  517. IN BOOLEAN Trace,
  518. IN UINT8 *Ptr,
  519. IN UINT32 AcpiTableLength,
  520. IN UINT8 AcpiTableRevision
  521. );
  522. /**
  523. This function parses the ACPI ERST table.
  524. When trace is enabled this function parses the ERST table and
  525. traces the ACPI table fields.
  526. This function also performs validation of the ACPI table fields.
  527. @param [in] Trace If TRUE, trace the ACPI fields.
  528. @param [in] Ptr Pointer to the start of the buffer.
  529. @param [in] AcpiTableLength Length of the ACPI table.
  530. @param [in] AcpiTableRevision Revision of the ACPI table.
  531. **/
  532. VOID
  533. EFIAPI
  534. ParseAcpiErst (
  535. IN BOOLEAN Trace,
  536. IN UINT8 *Ptr,
  537. IN UINT32 AcpiTableLength,
  538. IN UINT8 AcpiTableRevision
  539. );
  540. /**
  541. This function parses the ACPI FACS table.
  542. When trace is enabled this function parses the FACS table and
  543. traces the ACPI table fields.
  544. This function also performs validation of the ACPI table fields.
  545. @param [in] Trace If TRUE, trace the ACPI fields.
  546. @param [in] Ptr Pointer to the start of the buffer.
  547. @param [in] AcpiTableLength Length of the ACPI table.
  548. @param [in] AcpiTableRevision Revision of the ACPI table.
  549. **/
  550. VOID
  551. EFIAPI
  552. ParseAcpiFacs (
  553. IN BOOLEAN Trace,
  554. IN UINT8 *Ptr,
  555. IN UINT32 AcpiTableLength,
  556. IN UINT8 AcpiTableRevision
  557. );
  558. /**
  559. This function parses the ACPI FADT table.
  560. This function parses the FADT table and optionally traces the ACPI
  561. table fields.
  562. This function also performs validation of the ACPI table fields.
  563. @param [in] Trace If TRUE, trace the ACPI fields.
  564. @param [in] Ptr Pointer to the start of the buffer.
  565. @param [in] AcpiTableLength Length of the ACPI table.
  566. @param [in] AcpiTableRevision Revision of the ACPI table.
  567. **/
  568. VOID
  569. EFIAPI
  570. ParseAcpiFadt (
  571. IN BOOLEAN Trace,
  572. IN UINT8 *Ptr,
  573. IN UINT32 AcpiTableLength,
  574. IN UINT8 AcpiTableRevision
  575. );
  576. /**
  577. This function parses the ACPI GTDT table.
  578. When trace is enabled this function parses the GTDT table and
  579. traces the ACPI table fields.
  580. This function also parses the following platform timer structures:
  581. - GT Block timer
  582. - Watchdog timer
  583. This function also performs validation of the ACPI table fields.
  584. @param [in] Trace If TRUE, trace the ACPI fields.
  585. @param [in] Ptr Pointer to the start of the buffer.
  586. @param [in] AcpiTableLength Length of the ACPI table.
  587. @param [in] AcpiTableRevision Revision of the ACPI table.
  588. **/
  589. VOID
  590. EFIAPI
  591. ParseAcpiGtdt (
  592. IN BOOLEAN Trace,
  593. IN UINT8 *Ptr,
  594. IN UINT32 AcpiTableLength,
  595. IN UINT8 AcpiTableRevision
  596. );
  597. /**
  598. This function parses the ACPI HMAT table.
  599. When trace is enabled this function parses the HMAT table and
  600. traces the ACPI table fields.
  601. This function parses the following HMAT structures:
  602. - Memory Proximity Domain Attributes Structure (Type 0)
  603. - System Locality Latency and Bandwidth Info Structure (Type 1)
  604. - Memory Side Cache Info structure (Type 2)
  605. This function also performs validation of the ACPI table fields.
  606. @param [in] Trace If TRUE, trace the ACPI fields.
  607. @param [in] Ptr Pointer to the start of the buffer.
  608. @param [in] AcpiTableLength Length of the ACPI table.
  609. @param [in] AcpiTableRevision Revision of the ACPI table.
  610. **/
  611. VOID
  612. EFIAPI
  613. ParseAcpiHmat (
  614. IN BOOLEAN Trace,
  615. IN UINT8 *Ptr,
  616. IN UINT32 AcpiTableLength,
  617. IN UINT8 AcpiTableRevision
  618. );
  619. /**
  620. This function parses the ACPI IORT table.
  621. When trace is enabled this function parses the IORT table and
  622. traces the ACPI fields.
  623. This function also parses the following nodes:
  624. - ITS Group
  625. - Named Component
  626. - Root Complex
  627. - SMMUv1/2
  628. - SMMUv3
  629. - PMCG
  630. This function also performs validation of the ACPI table fields.
  631. @param [in] Trace If TRUE, trace the ACPI fields.
  632. @param [in] Ptr Pointer to the start of the buffer.
  633. @param [in] AcpiTableLength Length of the ACPI table.
  634. @param [in] AcpiTableRevision Revision of the ACPI table.
  635. **/
  636. VOID
  637. EFIAPI
  638. ParseAcpiIort (
  639. IN BOOLEAN Trace,
  640. IN UINT8 *Ptr,
  641. IN UINT32 AcpiTableLength,
  642. IN UINT8 AcpiTableRevision
  643. );
  644. /**
  645. This function parses the ACPI MADT table.
  646. When trace is enabled this function parses the MADT table and
  647. traces the ACPI table fields.
  648. This function currently parses the following Interrupt Controller
  649. Structures:
  650. - GICC
  651. - GICD
  652. - GIC MSI Frame
  653. - GICR
  654. - GIC ITS
  655. This function also performs validation of the ACPI table fields.
  656. @param [in] Trace If TRUE, trace the ACPI fields.
  657. @param [in] Ptr Pointer to the start of the buffer.
  658. @param [in] AcpiTableLength Length of the ACPI table.
  659. @param [in] AcpiTableRevision Revision of the ACPI table.
  660. **/
  661. VOID
  662. EFIAPI
  663. ParseAcpiMadt (
  664. IN BOOLEAN Trace,
  665. IN UINT8 *Ptr,
  666. IN UINT32 AcpiTableLength,
  667. IN UINT8 AcpiTableRevision
  668. );
  669. /**
  670. This function parses the ACPI MCFG table.
  671. When trace is enabled this function parses the MCFG table and
  672. traces the ACPI table fields.
  673. This function also performs validation of the ACPI table fields.
  674. @param [in] Trace If TRUE, trace the ACPI fields.
  675. @param [in] Ptr Pointer to the start of the buffer.
  676. @param [in] AcpiTableLength Length of the ACPI table.
  677. @param [in] AcpiTableRevision Revision of the ACPI table.
  678. **/
  679. VOID
  680. EFIAPI
  681. ParseAcpiMcfg (
  682. IN BOOLEAN Trace,
  683. IN UINT8 *Ptr,
  684. IN UINT32 AcpiTableLength,
  685. IN UINT8 AcpiTableRevision
  686. );
  687. /**
  688. This function parses the ACPI PCCT table including its sub-structures
  689. of type 0 through 4.
  690. When trace is enabled this function parses the PCCT table and
  691. traces the ACPI table fields.
  692. This function also performs validation of the ACPI table fields.
  693. @param [in] Trace If TRUE, trace the ACPI fields.
  694. @param [in] Ptr Pointer to the start of the buffer.
  695. @param [in] AcpiTableLength Length of the ACPI table.
  696. @param [in] AcpiTableRevision Revision of the ACPI table.
  697. **/
  698. VOID
  699. EFIAPI
  700. ParseAcpiPcct (
  701. IN BOOLEAN Trace,
  702. IN UINT8 *Ptr,
  703. IN UINT32 AcpiTableLength,
  704. IN UINT8 AcpiTableRevision
  705. );
  706. /**
  707. This function parses the ACPI PPTT table.
  708. When trace is enabled this function parses the PPTT table and
  709. traces the ACPI table fields.
  710. This function also performs validation of the ACPI table fields.
  711. @param [in] Trace If TRUE, trace the ACPI fields.
  712. @param [in] Ptr Pointer to the start of the buffer.
  713. @param [in] AcpiTableLength Length of the ACPI table.
  714. @param [in] AcpiTableRevision Revision of the ACPI table.
  715. **/
  716. VOID
  717. EFIAPI
  718. ParseAcpiPptt (
  719. IN BOOLEAN Trace,
  720. IN UINT8 *Ptr,
  721. IN UINT32 AcpiTableLength,
  722. IN UINT8 AcpiTableRevision
  723. );
  724. /**
  725. This function parses the ACPI RSDP table.
  726. This function invokes the parser for the XSDT table.
  727. * Note - This function does not support parsing of RSDT table.
  728. This function also performs a RAW dump of the ACPI table and
  729. validates the checksum.
  730. @param [in] Trace If TRUE, trace the ACPI fields.
  731. @param [in] Ptr Pointer to the start of the buffer.
  732. @param [in] AcpiTableLength Length of the ACPI table.
  733. @param [in] AcpiTableRevision Revision of the ACPI table.
  734. **/
  735. VOID
  736. EFIAPI
  737. ParseAcpiRsdp (
  738. IN BOOLEAN Trace,
  739. IN UINT8 *Ptr,
  740. IN UINT32 AcpiTableLength,
  741. IN UINT8 AcpiTableRevision
  742. );
  743. /**
  744. This function parses the ACPI SLIT table.
  745. When trace is enabled this function parses the SLIT table and
  746. traces the ACPI table fields.
  747. This function also validates System Localities for the following:
  748. - Diagonal elements have a normalized value of 10
  749. - Relative distance from System Locality at i*N+j is same as
  750. j*N+i
  751. @param [in] Trace If TRUE, trace the ACPI fields.
  752. @param [in] Ptr Pointer to the start of the buffer.
  753. @param [in] AcpiTableLength Length of the ACPI table.
  754. @param [in] AcpiTableRevision Revision of the ACPI table.
  755. **/
  756. VOID
  757. EFIAPI
  758. ParseAcpiSlit (
  759. IN BOOLEAN Trace,
  760. IN UINT8 *Ptr,
  761. IN UINT32 AcpiTableLength,
  762. IN UINT8 AcpiTableRevision
  763. );
  764. /**
  765. This function parses the ACPI SPCR table.
  766. When trace is enabled this function parses the SPCR table and
  767. traces the ACPI table fields.
  768. This function also performs validations of the ACPI table fields.
  769. @param [in] Trace If TRUE, trace the ACPI fields.
  770. @param [in] Ptr Pointer to the start of the buffer.
  771. @param [in] AcpiTableLength Length of the ACPI table.
  772. @param [in] AcpiTableRevision Revision of the ACPI table.
  773. **/
  774. VOID
  775. EFIAPI
  776. ParseAcpiSpcr (
  777. IN BOOLEAN Trace,
  778. IN UINT8 *Ptr,
  779. IN UINT32 AcpiTableLength,
  780. IN UINT8 AcpiTableRevision
  781. );
  782. /**
  783. This function parses the ACPI SRAT table.
  784. When trace is enabled this function parses the SRAT table and
  785. traces the ACPI table fields.
  786. This function parses the following Resource Allocation Structures:
  787. - Processor Local APIC/SAPIC Affinity Structure
  788. - Memory Affinity Structure
  789. - Processor Local x2APIC Affinity Structure
  790. - GICC Affinity Structure
  791. This function also performs validation of the ACPI table fields.
  792. @param [in] Trace If TRUE, trace the ACPI fields.
  793. @param [in] Ptr Pointer to the start of the buffer.
  794. @param [in] AcpiTableLength Length of the ACPI table.
  795. @param [in] AcpiTableRevision Revision of the ACPI table.
  796. **/
  797. VOID
  798. EFIAPI
  799. ParseAcpiSrat (
  800. IN BOOLEAN Trace,
  801. IN UINT8 *Ptr,
  802. IN UINT32 AcpiTableLength,
  803. IN UINT8 AcpiTableRevision
  804. );
  805. /**
  806. This function parses the ACPI SSDT table.
  807. When trace is enabled this function parses the SSDT table and
  808. traces the ACPI table fields.
  809. For the SSDT table only the ACPI header fields are
  810. parsed and traced.
  811. @param [in] Trace If TRUE, trace the ACPI fields.
  812. @param [in] Ptr Pointer to the start of the buffer.
  813. @param [in] AcpiTableLength Length of the ACPI table.
  814. @param [in] AcpiTableRevision Revision of the ACPI table.
  815. **/
  816. VOID
  817. EFIAPI
  818. ParseAcpiSsdt (
  819. IN BOOLEAN Trace,
  820. IN UINT8 *Ptr,
  821. IN UINT32 AcpiTableLength,
  822. IN UINT8 AcpiTableRevision
  823. );
  824. /**
  825. This function parses the ACPI XSDT table
  826. and optionally traces the ACPI table fields.
  827. This function also performs validation of the XSDT table.
  828. @param [in] Trace If TRUE, trace the ACPI fields.
  829. @param [in] Ptr Pointer to the start of the buffer.
  830. @param [in] AcpiTableLength Length of the ACPI table.
  831. @param [in] AcpiTableRevision Revision of the ACPI table.
  832. **/
  833. VOID
  834. EFIAPI
  835. ParseAcpiXsdt (
  836. IN BOOLEAN Trace,
  837. IN UINT8 *Ptr,
  838. IN UINT32 AcpiTableLength,
  839. IN UINT8 AcpiTableRevision
  840. );
  841. #endif // ACPIPARSER_H_