+/**\r
+ This function validates the Device Handle Type field in the Generic Initiator\r
+ Affinity Structure.\r
+\r
+ @param [in] Ptr Pointer to the start of the field data.\r
+ @param [in] Context Pointer to context specific information e.g. this\r
+ could be a pointer to the ACPI table header.\r
+**/\r
+STATIC\r
+VOID\r
+EFIAPI\r
+ValidateSratDeviceHandleType (\r
+ IN UINT8* Ptr,\r
+ IN VOID* Context\r
+ )\r
+{\r
+ UINT8 DeviceHandleType;\r
+\r
+ DeviceHandleType = *Ptr;\r
+\r
+ if (DeviceHandleType > EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {\r
+ IncrementErrorCount ();\r
+ Print (\r
+ L"\nERROR: Invalid Device Handle Type: %d. Must be between 0 and %d.",\r
+ DeviceHandleType,\r
+ EFI_ACPI_6_3_PCI_DEVICE_HANDLE\r
+ );\r
+ }\r
+}\r
+\r
+/**\r
+ This function traces the PCI BDF Number field inside Device Handle - PCI\r
+\r
+ @param [in] Format Format string for tracing the data.\r
+ @param [in] Ptr Pointer to the start of the buffer.\r
+**/\r
+STATIC\r
+VOID\r
+EFIAPI\r
+DumpSratPciBdfNumber (\r
+ IN CONST CHAR16* Format,\r
+ IN UINT8* Ptr\r
+ )\r
+{\r
+ CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];\r
+\r
+ Print (L"\n");\r
+\r
+ /*\r
+ The PCI BDF Number subfields are printed in the order specified in the ACPI\r
+ specification. The format of the 16-bit PCI BDF Number field is as follows:\r
+\r
+ +-----+------+------+\r
+ |DEV | FUNC | BUS |\r
+ +-----+------+------+\r
+ |15:11| 10:8 | 7:0 |\r
+ +-----+------+------+\r
+ */\r
+\r
+ // Print PCI Bus Number (Bits 7:0 of Byte 2)\r
+ UnicodeSPrint (\r
+ Buffer,\r
+ sizeof (Buffer),\r
+ L"PCI Bus Number"\r
+ );\r
+ PrintFieldName (4, Buffer);\r
+ Print (\r
+ L"0x%x\n",\r
+ *Ptr\r
+ );\r
+\r
+ Ptr++;\r
+\r
+ // Print PCI Device Number (Bits 7:3 of Byte 3)\r
+ UnicodeSPrint (\r
+ Buffer,\r
+ sizeof (Buffer),\r
+ L"PCI Device Number"\r
+ );\r
+ PrintFieldName (4, Buffer);\r
+ Print (\r
+ L"0x%x\n",\r
+ (*Ptr & (BIT7 | BIT6 | BIT5 | BIT4 | BIT3)) >> 3\r
+ );\r
+\r
+ // PCI Function Number (Bits 2:0 of Byte 3)\r
+ UnicodeSPrint (\r
+ Buffer,\r
+ sizeof (Buffer),\r
+ L"PCI Function Number"\r
+ );\r
+ PrintFieldName (4, Buffer);\r
+ Print (\r
+ L"0x%x\n",\r
+ *Ptr & (BIT2 | BIT1 | BIT0)\r
+ );\r
+}\r
+\r
+/**\r
+ An ACPI_PARSER array describing the Device Handle - ACPI\r
+**/\r
+STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {\r
+ {L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},\r
+ {L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},\r
+ {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}\r
+};\r
+\r
+/**\r
+ An ACPI_PARSER array describing the Device Handle - PCI\r
+**/\r
+STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {\r
+ {L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},\r
+ {L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL},\r
+ {L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,\r
+ NULL, NULL, NULL}\r
+};\r
+\r
+/**\r
+ This function traces the Device Handle field inside Generic Initiator\r
+ Affinity Structure.\r
+\r
+ @param [in] Format Format string for tracing the data.\r
+ @param [in] Ptr Pointer to the start of the buffer.\r
+**/\r
+STATIC\r
+VOID\r
+EFIAPI\r
+DumpSratDeviceHandle (\r
+ IN CONST CHAR16* Format,\r
+ IN UINT8* Ptr\r
+ )\r
+{\r
+ if (SratDeviceHandleType == NULL) {\r
+ IncrementErrorCount ();\r
+ Print (L"\nERROR: Device Handle Type read incorrectly.\n");\r
+ return;\r
+ }\r
+\r
+ Print (L"\n");\r
+\r
+ if (*SratDeviceHandleType == EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) {\r
+ ParseAcpi (\r
+ TRUE,\r
+ 2,\r
+ NULL,\r
+ Ptr,\r
+ sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_ACPI),\r
+ PARSER_PARAMS (SratDeviceHandleAcpiParser)\r
+ );\r
+ } else if (*SratDeviceHandleType == EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {\r
+ ParseAcpi (\r
+ TRUE,\r
+ 2,\r
+ NULL,\r
+ Ptr,\r
+ sizeof (EFI_ACPI_6_3_DEVICE_HANDLE_PCI),\r
+ PARSER_PARAMS (SratDeviceHandlePciParser)\r
+ );\r
+ }\r
+}\r
+\r