61 UINT8 WorkBuffer[MAX_SMBUS_BLOCK_LEN];
64 case EfiSmbusQuickRead:
65 DEBUG ((DEBUG_INFO,
"EfiSmbusQuickRead - 0x%08x\n", SmbusAddress));
68 case EfiSmbusQuickWrite:
69 DEBUG ((DEBUG_INFO,
"EfiSmbusQuickWrite - 0x%08x\n", SmbusAddress));
72 case EfiSmbusReceiveByte:
73 DEBUG ((DEBUG_INFO,
"EfiSmbusReceiveByte - 0x%08x\n", SmbusAddress));
76 case EfiSmbusSendByte:
77 DEBUG ((DEBUG_INFO,
"EfiSmbusSendByte - 0x%08x (0x%02x)\n", SmbusAddress, (
UINTN)*(UINT8 *)Buffer));
80 case EfiSmbusReadByte:
81 DEBUG ((DEBUG_INFO,
"EfiSmbusReadByte - 0x%08x\n", SmbusAddress));
84 case EfiSmbusWriteByte:
85 DEBUG ((DEBUG_INFO,
"EfiSmbusWriteByte - 0x%08x (0x%02x)\n", SmbusAddress, (
UINTN)*(UINT8 *)Buffer));
88 case EfiSmbusReadWord:
89 DEBUG ((DEBUG_INFO,
"EfiSmbusReadWord - 0x%08x\n", SmbusAddress));
92 case EfiSmbusWriteWord:
93 DEBUG ((DEBUG_INFO,
"EfiSmbusWriteWord - 0x%08x (0x%04x)\n", SmbusAddress, (
UINTN)*(UINT16 *)Buffer));
96 case EfiSmbusProcessCall:
97 DEBUG ((DEBUG_INFO,
"EfiSmbusProcessCall - 0x%08x (0x%04x)\n", SmbusAddress, (
UINTN)*(UINT16 *)Buffer));
100 case EfiSmbusReadBlock:
101 DEBUG ((DEBUG_INFO,
"EfiSmbusReadBlock - 0x%08x\n", SmbusAddress));
104 case EfiSmbusWriteBlock:
105 DEBUG ((DEBUG_INFO,
"EfiSmbusWriteBlock - 0x%08x\n", SmbusAddress));
108 case EfiSmbusBWBRProcessCall:
109 DEBUG ((DEBUG_INFO,
"EfiSmbusBWBRProcessCall - 0x%08x\n", SmbusAddress));
113 return EFI_INVALID_PARAMETER;
141 if (Width >= S3BootScriptWidthMaximum) {
142 return EFI_INVALID_PARAMETER;
145 *AddressStride = (UINT32)(1 << (Width & 0x03));
146 *BufferStride = *AddressStride;
148 AlignMask = *AddressStride - 1;
149 if ((Address & AlignMask) != 0) {
150 return EFI_INVALID_PARAMETER;
192 Out.Buf = (UINT8 *)Buffer;
194 if (Address > MAX_IO_ADDRESS) {
195 return EFI_INVALID_PARAMETER;
198 Status =
BuildLoopData (Width, Address, &AddressStride, &BufferStride);
199 if (EFI_ERROR (Status)) {
206 for ( ; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {
209 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint8 - 0x%08x\n", (
UINTN)Address));
213 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint8 - 0x%08x\n", (
UINTN)Address));
217 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint8 - 0x%08x\n", (
UINTN)Address));
222 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint16 - 0x%08x\n", (
UINTN)Address));
226 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint16 - 0x%08x\n", (
UINTN)Address));
230 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint16 - 0x%08x\n", (
UINTN)Address));
235 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint32 - 0x%08x\n", (
UINTN)Address));
239 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint32 - 0x%08x\n", (
UINTN)Address));
243 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint32 - 0x%08x\n", (
UINTN)Address));
248 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint64 - 0x%08x\n", (
UINTN)Address));
252 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint64 - 0x%08x\n", (
UINTN)Address));
256 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint64 - 0x%08x\n", (
UINTN)Address));
261 return EFI_INVALID_PARAMETER;
294 UINT64 OriginalAddress;
298 In.Buf = (UINT8 *)Buffer;
300 if (Address > MAX_IO_ADDRESS) {
301 return EFI_INVALID_PARAMETER;
304 Status =
BuildLoopData (Width, Address, &AddressStride, &BufferStride);
305 if (EFI_ERROR (Status)) {
312 OriginalAddress = Address;
313 OriginalIn.Buf = In.Buf;
314 for ( ; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {
317 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (
UINTN)Address, (
UINTN)*In.Uint8));
321 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (
UINTN)OriginalAddress, (
UINTN)*In.Uint8));
325 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (
UINTN)Address, (
UINTN)*OriginalIn.Uint8));
329 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (
UINTN)Address, (
UINTN)*In.Uint16));
333 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (
UINTN)OriginalAddress, (
UINTN)*In.Uint16));
337 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (
UINTN)Address, (
UINTN)*OriginalIn.Uint16));
341 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (
UINTN)Address, (
UINTN)*In.Uint32));
345 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (
UINTN)OriginalAddress, (
UINTN)*In.Uint32));
349 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (
UINTN)Address, (
UINTN)*OriginalIn.Uint32));
353 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (
UINTN)Address, *In.Uint64));
357 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (
UINTN)OriginalAddress, *In.Uint64));
361 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (
UINTN)Address, *OriginalIn.Uint64));
365 return EFI_INVALID_PARAMETER;
397 Address = IoWrite.Address;
398 Count = IoWrite.Count;
401 DEBUG ((DEBUG_INFO,
"BootScriptExecuteIoWrite - 0x%08x, 0x%08x, 0x%08x\n", (
UINTN)Address, Count, (
UINTN)Width));
436 Status =
BuildLoopData (Width, Address, &AddressStride, &BufferStride);
437 if (EFI_ERROR (Status)) {
444 for ( ; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {
447 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint8 - 0x%08x\n", (
UINTN)Address));
451 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint8 - 0x%08x\n", (
UINTN)Address));
455 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint8 - 0x%08x\n", (
UINTN)Address));
460 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint16 - 0x%08x\n", (
UINTN)Address));
464 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint16 - 0x%08x\n", (
UINTN)Address));
468 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint16 - 0x%08x\n", (
UINTN)Address));
473 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint32 - 0x%08x\n", (
UINTN)Address));
477 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint32 - 0x%08x\n", (
UINTN)Address));
481 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint32 - 0x%08x\n", (
UINTN)Address));
486 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint64 - 0x%08x\n", (
UINTN)Address));
490 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint64 - 0x%08x\n", (
UINTN)Address));
494 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint64 - 0x%08x\n", (
UINTN)Address));
499 return EFI_UNSUPPORTED;
532 UINT64 OriginalAddress;
539 Status =
BuildLoopData (Width, Address, &AddressStride, &BufferStride);
540 if (EFI_ERROR (Status)) {
547 OriginalAddress = Address;
548 OriginalIn.Buf = In.Buf;
549 for ( ; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {
552 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (
UINTN)Address, (
UINTN)*In.Uint8));
556 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (
UINTN)OriginalAddress, (
UINTN)*In.Uint8));
560 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (
UINTN)Address, (
UINTN)*OriginalIn.Uint8));
564 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (
UINTN)Address, (
UINTN)*In.Uint16));
568 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (
UINTN)OriginalAddress, (
UINTN)*In.Uint16));
572 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (
UINTN)Address, (
UINTN)*OriginalIn.Uint16));
576 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (
UINTN)Address, (
UINTN)*In.Uint32));
580 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (
UINTN)OriginalAddress, (
UINTN)*In.Uint32));
584 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (
UINTN)Address, (
UINTN)*OriginalIn.Uint32));
588 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (
UINTN)Address, *In.Uint64));
592 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (
UINTN)OriginalAddress, *In.Uint64));
596 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (
UINTN)Address, *OriginalIn.Uint64));
600 return EFI_UNSUPPORTED;
633 Address = MemWrite.Address;
634 Count = MemWrite.Count;
637 DEBUG ((DEBUG_INFO,
"BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (
UINTN)Address, Count, (
UINTN)Width));
670 Out.Buf = (UINT8 *)Buffer;
672 PciAddress = PCI_ADDRESS_ENCODE (Segment, Address);
674 Status =
BuildLoopData (Width, PciAddress, &AddressStride, &BufferStride);
675 if (EFI_ERROR (Status)) {
682 for ( ; Count > 0; Count--, PciAddress += AddressStride, Out.Buf += BufferStride) {
685 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint8 - 0x%016lx\n", PciAddress));
689 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint8 - 0x%016lx\n", PciAddress));
693 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint8 - 0x%016lx\n", PciAddress));
698 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint16 - 0x%016lx\n", PciAddress));
702 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint16 - 0x%016lx\n", PciAddress));
706 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint16 - 0x%016lx\n", PciAddress));
711 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint32 - 0x%016lx\n", PciAddress));
715 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint32 - 0x%016lx\n", PciAddress));
719 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint32 - 0x%016lx\n", PciAddress));
724 return EFI_INVALID_PARAMETER;
757 UINT64 OriginalPciAddress;
762 In.Buf = (UINT8 *)Buffer;
764 PciAddress = PCI_ADDRESS_ENCODE (Segment, Address);
766 Status =
BuildLoopData (Width, PciAddress, &AddressStride, &BufferStride);
767 if (EFI_ERROR (Status)) {
774 OriginalPciAddress = PciAddress;
775 OriginalIn.Buf = In.Buf;
776 for ( ; Count > 0; Count--, PciAddress += AddressStride, In.Buf += BufferStride) {
779 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint8 - 0x%016lx (0x%02x)\n", PciAddress, (
UINTN)*In.Uint8));
783 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint8 - 0x%016lx (0x%02x)\n", OriginalPciAddress, (
UINTN)*In.Uint8));
787 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint8 - 0x%016lx (0x%02x)\n", PciAddress, (
UINTN)*OriginalIn.Uint8));
791 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint16 - 0x%016lx (0x%04x)\n", PciAddress, (
UINTN)*In.Uint16));
795 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint16 - 0x%016lx (0x%04x)\n", OriginalPciAddress, (
UINTN)*In.Uint16));
799 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint16 - 0x%016lx (0x%04x)\n", PciAddress, (
UINTN)*OriginalIn.Uint16));
803 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthUint32 - 0x%016lx (0x%08x)\n", PciAddress, (
UINTN)*In.Uint32));
807 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFifoUint32 - 0x%016lx (0x%08x)\n", OriginalPciAddress, (
UINTN)*In.Uint32));
811 DEBUG ((DEBUG_INFO,
"S3BootScriptWidthFillUint32 - 0x%016lx (0x%08x)\n", (
UINTN)PciAddress, (
UINTN)*OriginalIn.Uint32));
815 return EFI_INVALID_PARAMETER;
896 Address = PciCfgWrite.Address;
897 Count = PciCfgWrite.Count;
900 DEBUG ((DEBUG_INFO,
"BootScriptExecutePciCfgWrite - 0x%016lx, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (0, Address), Count, (
UINTN)Width));
929 DEBUG ((DEBUG_INFO,
"BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (
UINTN)IoReadWrite.Address, AndMask, OrMask));
937 if (!EFI_ERROR (Status)) {
938 Data = (Data & AndMask) | OrMask;
975 DEBUG ((DEBUG_INFO,
"BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (
UINTN)MemReadWrite.Address, AndMask, OrMask));
979 MemReadWrite.Address,
983 if (!EFI_ERROR (Status)) {
984 Data = (Data & AndMask) | OrMask;
987 MemReadWrite.Address,
1021 DEBUG ((DEBUG_INFO,
"BootScriptExecutePciCfgReadWrite - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (0, PciCfgReadWrite.Address), AndMask, OrMask));
1025 PciCfgReadWrite.Address,
1029 if (EFI_ERROR (Status)) {
1033 Data = (Data & AndMask) | OrMask;
1037 PciCfgReadWrite.Address,
1065 DEBUG ((DEBUG_INFO,
"BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (
UINTN)SmbusExecuteEntry.SmBusAddress, (
UINTN)SmbusExecuteEntry.Operation));
1067 SmBusAddress = (
UINTN)SmbusExecuteEntry.SmBusAddress;
1068 DataSize = (
UINTN)SmbusExecuteEntry.DataSize;
1093 DEBUG ((DEBUG_INFO,
"BootScriptExecuteStall - 0x%08x\n", (
UINTN)Stall.Duration));
1111 DISPATCH_ENTRYPOINT_FUNC EntryFunc;
1115 EntryFunc = (DISPATCH_ENTRYPOINT_FUNC)(
UINTN)(ScriptDispatch.EntryPoint);
1117 DEBUG ((DEBUG_INFO,
"BootScriptExecuteDispatch - 0x%08x\n", (
UINTN)ScriptDispatch.EntryPoint));
1136 DISPATCH_ENTRYPOINT_FUNC EntryFunc;
1141 DEBUG ((DEBUG_INFO,
"BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (
UINTN)ScriptDispatch2.EntryPoint, (
UINTN)ScriptDispatch2.Context));
1143 EntryFunc = (DISPATCH_ENTRYPOINT_FUNC)(
UINTN)(ScriptDispatch2.EntryPoint);
1145 Status = EntryFunc (
NULL, (VOID *)(
UINTN)ScriptDispatch2.Context);
1175 DEBUG ((DEBUG_INFO,
"BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (
UINTN)MemPoll.Address, AndMask, OrMask));
1184 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1188 for (LoopTimes = 0; LoopTimes < MemPoll.LoopTimes; LoopTimes++) {
1198 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1203 if (LoopTimes < MemPoll.LoopTimes) {
1206 return EFI_DEVICE_ERROR;
1225 UINT8 *InformationData;
1230 DEBUG ((DEBUG_INFO,
"BootScriptExecuteInformation - 0x%08x\n", (
UINTN)InformationData));
1232 DEBUG ((DEBUG_INFO,
"BootScriptInformation: "));
1233 for (Index = 0; Index < Information.InformationLength; Index++) {
1234 DEBUG ((DEBUG_INFO,
"%02x ", InformationData[Index]));
1237 DEBUG ((DEBUG_INFO,
"\n"));
1254 UINT8 *InformationData;
1259 DEBUG ((DEBUG_INFO,
"BootScriptExecuteLabel - 0x%08x\n", (
UINTN)InformationData));
1261 DEBUG ((DEBUG_INFO,
"BootScriptLabel: "));
1262 for (Index = 0; Index < Information.InformationLength; Index++) {
1263 DEBUG ((DEBUG_INFO,
"%02x ", InformationData[Index]));
1266 DEBUG ((DEBUG_INFO,
"\n"));
1280 OUT UINT64 *AndMask,
1288 switch (ScriptHeader->OpCode) {
1289 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
1293 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
1297 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
1300 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
1304 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
1308 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
1312 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
1316 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
1324 DataPtr = Script + Size;
1326 switch (ScriptHeader->Width) {
1328 *AndMask = (UINT64)(*(UINT8 *)(DataPtr + 1));
1329 *OrMask = (UINT64)(*DataPtr);
1333 *AndMask = (UINT64)(*(UINT16 *)(DataPtr + 2));
1334 *OrMask = (UINT64)(*(UINT16 *)DataPtr);
1338 *AndMask = (UINT64)(*(UINT32 *)(DataPtr + 4));
1339 *OrMask = (UINT64)(*(UINT32 *)DataPtr);
1343 *AndMask = (UINT64)(*(UINT64 *)(DataPtr + 8));
1344 *OrMask = (UINT64)(*(UINT64 *)DataPtr);
1379 DEBUG ((DEBUG_INFO,
"BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (
UINTN)IoPoll.Address, AndMask, OrMask));
1388 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1392 for (LoopTimes = 0; LoopTimes < IoPoll.Delay; LoopTimes++) {
1401 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1406 if (LoopTimes < IoPoll.Delay) {
1409 return EFI_DEVICE_ERROR;
1441 DEBUG ((DEBUG_INFO,
"BootScriptExecutePciCfg2Write - 0x%016lx, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (Segment, Address), Count, (
UINTN)Width));
1470 DEBUG ((DEBUG_INFO,
"BootScriptExecutePciCfg2ReadWrite - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfg2ReadWrite.Segment, PciCfg2ReadWrite.Address), AndMask, OrMask));
1474 PciCfg2ReadWrite.Segment,
1475 PciCfg2ReadWrite.Address,
1479 if (EFI_ERROR (Status)) {
1483 Data = (Data & AndMask) | OrMask;
1486 PciCfg2ReadWrite.Segment,
1487 PciCfg2ReadWrite.Address,
1519 DEBUG ((DEBUG_INFO,
"BootScriptPciCfgPoll - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (0, PciCfgPoll.Address), AndMask, OrMask));
1528 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1532 for (LoopTimes = 0; LoopTimes < PciCfgPoll.Delay; LoopTimes++) {
1541 if ((!EFI_ERROR (Status)) &&
1542 ((Data & AndMask) == OrMask))
1548 if (LoopTimes < PciCfgPoll.Delay) {
1551 return EFI_DEVICE_ERROR;
1582 DEBUG ((DEBUG_INFO,
"BootScriptPciCfg2Poll - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfg2Poll.Segment, PciCfg2Poll.Address), AndMask, OrMask));
1586 PciCfg2Poll.Segment,
1587 PciCfg2Poll.Address,
1591 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1595 for (LoopTimes = 0; LoopTimes < PciCfg2Poll.Delay; LoopTimes++) {
1601 PciCfg2Poll.Segment,
1602 PciCfg2Poll.Address,
1606 if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {
1611 if (LoopTimes < PciCfg2Poll.Delay) {
1614 return EFI_DEVICE_ERROR;
1644 return EFI_INVALID_PARAMETER;
1647 DEBUG ((DEBUG_INFO,
"S3BootScriptExecute:\n"));
1649 return EFI_UNSUPPORTED;
1652 DEBUG ((DEBUG_INFO,
"TableHeader - 0x%08x\n", Script));
1654 StartAddress = (
UINTN)Script;
1655 TableLength = TableHeader.TableLength;
1656 Script = Script + TableHeader.Length;
1661 DEBUG ((DEBUG_INFO,
"TableHeader.Version - 0x%04x\n", (
UINTN)TableHeader.Version));
1662 DEBUG ((DEBUG_INFO,
"TableHeader.TableLength - 0x%08x\n", (
UINTN)TableLength));
1664 while ((
UINTN)Script < (
UINTN)(StartAddress + TableLength)) {
1665 DEBUG ((DEBUG_INFO,
"ExecuteBootScript - %08x\n", (
UINTN)Script));
1668 switch (ScriptHeader.OpCode) {
1669 case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
1670 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\n"));
1674 case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
1675 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\n"));
1684 case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
1685 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\n"));
1689 case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
1690 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\n"));
1694 case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
1695 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\n"));
1703 case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
1704 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\n"));
1708 case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
1709 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\n"));
1717 case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
1718 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_DISPATCH_OPCODE\n"));
1722 case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
1723 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE\n"));
1727 case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
1728 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));
1733 DEBUG ((DEBUG_INFO,
"S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));
1737 case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
1738 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\n"));
1747 case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
1748 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\n"));
1752 case EFI_BOOT_SCRIPT_STALL_OPCODE:
1753 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_STALL_OPCODE\n"));
1757 case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
1758 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));
1764 case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
1765 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));
1770 case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
1771 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));
1776 case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
1777 DEBUG ((DEBUG_INFO,
"EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));
1782 case S3_BOOT_SCRIPT_LIB_LABEL_OPCODE:
1786 DEBUG ((DEBUG_INFO,
"S3_BOOT_SCRIPT_LIB_LABEL_OPCODE\n"));
1790 DEBUG ((DEBUG_INFO,
"S3BootScriptDone - %r\n", EFI_UNSUPPORTED));
1791 return EFI_UNSUPPORTED;
1794 if (EFI_ERROR (Status)) {
1795 DEBUG ((DEBUG_INFO,
"S3BootScriptDone - %r\n", Status));
1799 Script = Script + ScriptHeader.Length;
1802 DEBUG ((DEBUG_INFO,
"S3BootScriptDone - %r\n", Status));
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS BootScriptExecutePciCfg2Write(IN UINT8 *Script)
VOID BootScriptExecuteLabel(IN UINT8 *Script)
EFI_STATUS BootScriptExecuteIoPoll(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS BootScriptExecutePciCfgReadWrite(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS BuildLoopData(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, OUT UINTN *AddressStride, OUT UINTN *BufferStride)
RETURN_STATUS EFIAPI S3BootScriptExecute(VOID)
EFI_STATUS ScriptIoWrite(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
EFI_STATUS BootScriptExecuteDispatch2(IN UINT8 *Script)
EFI_STATUS BootScriptExecuteDispatch(IN UINT8 *Script)
EFI_STATUS BootScriptExecuteIoWrite(IN UINT8 *Script)
EFI_STATUS BootScriptPciCfgPoll(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS BootScriptExecuteStall(IN UINT8 *Script)
EFI_STATUS BootScriptExecuteMemPoll(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS BootScriptExecuteSmbusExecute(IN UINT8 *Script)
EFI_STATUS BootScriptExecuteIoReadWrite(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS InternalSmbusExecute(IN UINTN SmbusAddress, IN EFI_SMBUS_OPERATION Operation, IN OUT UINTN *Length, IN OUT VOID *Buffer)
EFI_STATUS BootScriptPciCfg2Poll(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS ScriptPciCfg2Write(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
EFI_STATUS BootScriptExecutePciCfg2ReadWrite(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
EFI_STATUS EFIAPI ScriptPciCfgWrite(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
EFI_STATUS ScriptPciCfg2Read(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
EFI_STATUS ScriptMemoryRead(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
EFI_STATUS ScriptPciCfgRead(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
EFI_STATUS BootScriptExecuteMemoryWrite(IN UINT8 *Script)
VOID BootScriptExecuteInformation(IN UINT8 *Script)
EFI_STATUS BootScriptExecuteMemoryReadWrite(IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
VOID CheckAndOrMask(IN EFI_BOOT_SCRIPT_COMMON_HEADER *ScriptHeader, OUT UINT64 *AndMask, OUT UINT64 *OrMask, IN UINT8 *Script)
EFI_STATUS ScriptMemoryWrite(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
EFI_STATUS ScriptIoRead(IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
EFI_STATUS BootScriptExecutePciCfgWrite(IN UINT8 *Script)
SCRIPT_TABLE_PRIVATE_DATA * mS3BootScriptTablePtr
UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
UINT16 EFIAPI PciSegmentWrite16(IN UINT64 Address, IN UINT16 Value)
UINT32 EFIAPI PciSegmentWrite32(IN UINT64 Address, IN UINT32 Value)
UINT16 EFIAPI PciSegmentRead16(IN UINT64 Address)
UINT32 EFIAPI PciSegmentRead32(IN UINT64 Address)
UINT8 EFIAPI PciSegmentWrite8(IN UINT64 Address, IN UINT8 Value)
#define S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE
#define S3_BOOT_SCRIPT_LIB_TABLE_OPCODE
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
UINT64 EFIAPI IoRead64(IN UINTN Port)
UINT64 EFIAPI IoWrite64(IN UINTN Port, IN UINT64 Value)
UINT64 EFIAPI MmioRead64(IN UINTN Address)
UINT16 EFIAPI MmioRead16(IN UINTN Address)
UINT8 EFIAPI MmioRead8(IN UINTN Address)
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
UINT8 EFIAPI IoRead8(IN UINTN Port)
UINT32 EFIAPI MmioRead32(IN UINTN Address)
UINT16 EFIAPI IoRead16(IN UINTN Port)
UINT16 EFIAPI MmioWrite16(IN UINTN Address, IN UINT16 Value)
UINT32 EFIAPI IoRead32(IN UINTN Port)
UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
UINT16 EFIAPI IoWrite16(IN UINTN Port, IN UINT16 Value)
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
#define DEBUG(Expression)
@ S3BootScriptWidthFillUint16
16-bit Fill operation.
@ S3BootScriptWidthFifoUint64
64-bit FIFO operation.
@ S3BootScriptWidthUint16
16-bit operation.
@ S3BootScriptWidthFillUint32
32-bit Fill operation.
@ S3BootScriptWidthFillUint8
8-bit Fill operation.
@ S3BootScriptWidthFifoUint8
8-bit FIFO operation.
@ S3BootScriptWidthUint64
64-bit operation.
@ S3BootScriptWidthFifoUint16
16-bit FIFO operation.
@ S3BootScriptWidthFifoUint32
32-bit FIFO operation.
@ S3BootScriptWidthFillUint64
64-bit Fill operation.
@ S3BootScriptWidthUint32
32-bit operation.
@ S3BootScriptWidthUint8
8-bit operation.
enum _EFI_SMBUS_OPERATION EFI_SMBUS_OPERATION
UINT16 EFIAPI SmBusReadDataWord(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusWriteDataByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
#define SMBUS_LIB_ADDRESS(SlaveAddress, Command, Length, Pec)
UINTN EFIAPI SmBusWriteBlock(IN UINTN SmBusAddress, OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
UINT16 EFIAPI SmBusProcessCall(IN UINTN SmBusAddress, IN UINT16 Value, OUT RETURN_STATUS *Status OPTIONAL)
VOID EFIAPI SmBusQuickWrite(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
UINTN EFIAPI SmBusReadBlock(IN UINTN SmBusAddress, OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusReceiveByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
VOID EFIAPI SmBusQuickRead(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
UINT16 EFIAPI SmBusWriteDataWord(IN UINTN SmBusAddress, IN UINT16 Value, OUT RETURN_STATUS *Status OPTIONAL)
UINTN EFIAPI SmBusBlockProcessCall(IN UINTN SmBusAddress, IN VOID *WriteBuffer, OUT VOID *ReadBuffer, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusSendByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
UINT8 EFIAPI SmBusReadDataByte(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL)
EFI_STATUS EFIAPI PciCfg2Write(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, IN UINT64 Address, IN OUT VOID *Buffer)