IN CONST CHAR8 * Hid\r
);\r
\r
+/** Convert a EisaId string to its compressed UINT32 equivalent.\r
+\r
+ Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"\r
+\r
+ @param [in] EisaIdStr Input EisaId string.\r
+ @param [out] EisaIdInt Output EisaId UINT32 (compressed).\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AmlGetEisaIdFromString (\r
+ IN CONST CHAR8 * EisaIdStr,\r
+ OUT UINT32 * EisaIdInt\r
+ );\r
+\r
#endif // ACPI_HELPER_LIB_H_\r
\r
return TRUE;\r
}\r
+\r
+/** Convert a EisaId string to its compressed UINT32 equivalent.\r
+\r
+ Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"\r
+\r
+ @param [in] EisaIdStr Input EisaId string.\r
+ @param [out] EisaIdInt Output EisaId UINT32 (compressed).\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AmlGetEisaIdFromString (\r
+ IN CONST CHAR8 * EisaIdStr,\r
+ OUT UINT32 * EisaIdInt\r
+ )\r
+{\r
+ if ((EisaIdStr == NULL) ||\r
+ (!IsValidPnpId (EisaIdStr)) ||\r
+ (EisaIdInt == NULL)) {\r
+ ASSERT (0);\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ /* Cf. ACPI 6.4 specification, s19.3.4 "ASL Macros": "Eisaid"\r
+\r
+ Converts and compresses the 7-character text argument into its corresponding\r
+ 4-byte numeric EISA ID encoding (Integer). This can be used when declaring\r
+ IDs for devices that are EISA IDs.\r
+\r
+ The algorithm used to convert the TextID is as shown in the following\r
+ example:\r
+ Starting with a seven character input string "PNP0303", we want to create\r
+ a DWordConst. This string contains a three character manufacturer code\r
+ "PNP", a three character hex product identifier "030", and a one character\r
+ revision identifier "3".\r
+ The compressed manufacturer code is created as follows:\r
+ 1) Find hex ASCII value for each letter\r
+ 2) Subtract 40h from each ASCII value\r
+ 3) Retain 5 least significant bits for each letter and discard remaining\r
+ 0's:\r
+\r
+ Byte 0:\r
+ Bit 7: reserved (0)\r
+ Bit 6-2: 1st character of compressed mfg code "P"\r
+ Bit 1-0: Upper 2 bits of 2nd character of mfg code "N"\r
+ Byte 1:\r
+ Bit 7-5: Lower 3 bits of 2nd character of mfg code "N"\r
+ Bit 4-0: 3rd character of mfg code "P"\r
+ Byte 2:\r
+ Bit 7-4: 1st hex digit of product number "0"\r
+ Bit 3-0: 2nd hex digit of product number "3"\r
+ Byte 3:\r
+ Bit 7-4: 3rd hex digit of product number "0"\r
+ Bit 3-0: 4th hex digit of product number "3"\r
+ */\r
+ *EisaIdInt = SwapBytes32 (\r
+ ((EisaIdStr[0] - 0x40) << 26) |\r
+ ((EisaIdStr[1] - 0x40) << 21) |\r
+ ((EisaIdStr[2] - 0x40) << 16) |\r
+ (HexFromAscii (EisaIdStr[3]) << 12) |\r
+ (HexFromAscii (EisaIdStr[4]) << 8) |\r
+ (HexFromAscii (EisaIdStr[5]) << 4) |\r
+ (HexFromAscii (EisaIdStr[6]))\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r