19UINTN mPreAllocatedPages = 0;
20UINTN mPre64BitAllocatedPages = 0;
184 if ((Size ==
NULL) || (NumberOfStrings ==
NULL)) {
185 return EFI_INVALID_PARAMETER;
188 FullSize = Head->Length;
189 CharInStr = (INT8 *)Head + Head->Length;
191 *NumberOfStrings = 0;
196 while (*CharInStr != 0 || *(CharInStr+1) != 0) {
197 if (*CharInStr == 0) {
202 if ((This->MajorVersion < 2) || ((This->MajorVersion == 2) && (This->MinorVersion < 7))) {
204 }
else if (This->MajorVersion < 3) {
211 MaxLen = SMBIOS_TABLE_MAX_LENGTH;
217 MaxLen = SMBIOS_3_0_TABLE_MAX_LENGTH;
221 if (*(CharInStr+
StrLen) == 0) {
227 return EFI_INVALID_PARAMETER;
235 *NumberOfStrings += 1;
260 IN EFI_SMBIOS_HANDLE Handle
266 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
267 HandleEntry = SMBIOS_HANDLE_ENTRY_FROM_LINK (Link);
268 if (HandleEntry->SmbiosHandle == Handle) {
288 IN OUT EFI_SMBIOS_HANDLE *MaxHandle
291 if ((This->MajorVersion == 2) && (This->MinorVersion == 0)) {
313 IN OUT EFI_SMBIOS_HANDLE *Handle
318 EFI_SMBIOS_HANDLE MaxSmbiosHandle;
319 EFI_SMBIOS_HANDLE AvailableHandle;
323 Private = SMBIOS_INSTANCE_FROM_THIS (This);
324 Head = &Private->AllocatedHandleListHead;
325 for (AvailableHandle = 0; AvailableHandle < MaxSmbiosHandle; AvailableHandle++) {
327 *Handle = AvailableHandle;
332 return EFI_OUT_OF_RESOURCES;
359 IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
367 UINTN NumberOfStrings;
372 EFI_SMBIOS_HANDLE MaxSmbiosHandle;
375 BOOLEAN Smbios32BitTable;
376 BOOLEAN Smbios64BitTable;
378 if (SmbiosHandle ==
NULL) {
379 return EFI_INVALID_PARAMETER;
382 Private = SMBIOS_INSTANCE_FROM_THIS (This);
386 Head = &Private->AllocatedHandleListHead;
388 return EFI_ALREADY_STARTED;
396 if (EFI_ERROR (Status)) {
404 if (*SmbiosHandle > MaxSmbiosHandle) {
405 return EFI_INVALID_PARAMETER;
413 if (EFI_ERROR (Status)) {
417 Smbios32BitTable =
FALSE;
418 Smbios64BitTable =
FALSE;
419 if ((This->MajorVersion < 0x3) ||
420 ((This->MajorVersion >= 0x3) && ((
PcdGet32 (PcdSmbiosEntryPointProvideMethod) & BIT0) == BIT0)))
427 if ((EntryPointStructure !=
NULL) &&
428 (EntryPointStructure->TableLength + StructureSize > SMBIOS_TABLE_MAX_LENGTH))
430 DEBUG ((DEBUG_INFO,
"SmbiosAdd: Total length exceeds max 32-bit table length with type = %d size = 0x%x\n", Record->Type, StructureSize));
432 Smbios32BitTable =
TRUE;
433 DEBUG ((DEBUG_INFO,
"SmbiosAdd: Smbios type %d with size 0x%x is added to 32-bit table\n", Record->Type, StructureSize));
440 if ((This->MajorVersion >= 0x3) && ((
PcdGet32 (PcdSmbiosEntryPointProvideMethod) & BIT1) == BIT1)) {
445 if ((Smbios30EntryPointStructure !=
NULL) &&
446 (Smbios30EntryPointStructure->TableMaximumSize + StructureSize > SMBIOS_3_0_TABLE_MAX_LENGTH))
448 DEBUG ((DEBUG_INFO,
"SmbiosAdd: Total length exceeds max 64-bit table length with type = %d size = 0x%x\n", Record->Type, StructureSize));
450 DEBUG ((DEBUG_INFO,
"SmbiosAdd: Smbios type %d with size 0x%x is added to 64-bit table\n", Record->Type, StructureSize));
451 Smbios64BitTable =
TRUE;
455 if ((!Smbios32BitTable) && (!Smbios64BitTable)) {
459 return EFI_OUT_OF_RESOURCES;
466 if (EFI_ERROR (Status)) {
477 if (SmbiosEntry ==
NULL) {
479 return EFI_OUT_OF_RESOURCES;
483 if (HandleEntry ==
NULL) {
485 return EFI_OUT_OF_RESOURCES;
491 HandleEntry->Signature = SMBIOS_HANDLE_ENTRY_SIGNATURE;
492 HandleEntry->SmbiosHandle = *SmbiosHandle;
493 InsertTailList (&Private->AllocatedHandleListHead, &HandleEntry->Link);
496 Raw = (VOID *)(InternalRecord + 1);
501 InternalRecord->Version = EFI_SMBIOS_RECORD_HEADER_VERSION;
503 InternalRecord->RecordSize = RecordSize;
504 InternalRecord->ProducerHandle = ProducerHandle;
505 InternalRecord->NumberOfStrings = NumberOfStrings;
509 SmbiosEntry->Signature = EFI_SMBIOS_ENTRY_SIGNATURE;
510 SmbiosEntry->RecordHeader = InternalRecord;
511 SmbiosEntry->RecordSize = TotalSize;
512 SmbiosEntry->Smbios32BitTable = Smbios32BitTable;
513 SmbiosEntry->Smbios64BitTable = Smbios64BitTable;
516 CopyMem (Raw, Record, StructureSize);
552 IN EFI_SMBIOS_HANDLE *SmbiosHandle,
560 UINTN TargetStrOffset;
570 EFI_SMBIOS_HANDLE MaxSmbiosHandle;
579 if (*SmbiosHandle > MaxSmbiosHandle) {
580 return EFI_INVALID_PARAMETER;
583 if (String ==
NULL) {
587 if (*StringNumber == 0) {
588 return EFI_NOT_FOUND;
593 if ((This->MajorVersion < 2) || ((This->MajorVersion == 2) && (This->MinorVersion < 7))) {
595 return EFI_UNSUPPORTED;
597 }
else if (This->MajorVersion < 3) {
604 if (InputStrLen > SMBIOS_TABLE_MAX_LENGTH) {
605 return EFI_UNSUPPORTED;
608 if (InputStrLen > SMBIOS_3_0_TABLE_MAX_LENGTH) {
613 return EFI_UNSUPPORTED;
617 Private = SMBIOS_INSTANCE_FROM_THIS (This);
622 if (EFI_ERROR (Status)) {
626 Head = &Private->DataListHead;
627 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
628 SmbiosEntry = SMBIOS_ENTRY_FROM_LINK (Link);
631 if (Record->Handle == *SmbiosHandle) {
635 if (*StringNumber > SmbiosEntry->RecordHeader->NumberOfStrings) {
637 return EFI_NOT_FOUND;
643 StrStart = (CHAR8 *)Record + Record->Length;
645 for (StrIndex = 1, TargetStrOffset = 0; StrIndex < *StringNumber; StrStart++, TargetStrOffset++) {
649 if (*StrStart == 0) {
656 if ((*StrStart == 0) && (*(StrStart + 1) == 0)) {
658 return EFI_NOT_FOUND;
662 if (*StrStart == 0) {
671 if (InputStrLen == TargetStrLen) {
684 SmbiosEntry->Smbios32BitTable =
FALSE;
685 SmbiosEntry->Smbios64BitTable =
FALSE;
686 if ((This->MajorVersion < 0x3) ||
687 ((This->MajorVersion >= 0x3) && ((
PcdGet32 (PcdSmbiosEntryPointProvideMethod) & BIT0) == BIT0)))
692 if ((EntryPointStructure !=
NULL) &&
693 (EntryPointStructure->TableLength + InputStrLen - TargetStrLen > SMBIOS_TABLE_MAX_LENGTH))
700 DEBUG ((DEBUG_INFO,
"SmbiosUpdateString: Total length exceeds max 32-bit table length\n"));
702 DEBUG ((DEBUG_INFO,
"SmbiosUpdateString: New smbios record add to 32-bit table\n"));
703 SmbiosEntry->Smbios32BitTable =
TRUE;
707 if ((This->MajorVersion >= 0x3) && ((
PcdGet32 (PcdSmbiosEntryPointProvideMethod) & BIT1) == BIT1)) {
711 if ((Smbios30EntryPointStructure !=
NULL) &&
712 (Smbios30EntryPointStructure->TableMaximumSize + InputStrLen - TargetStrLen > SMBIOS_3_0_TABLE_MAX_LENGTH))
714 DEBUG ((DEBUG_INFO,
"SmbiosUpdateString: Total length exceeds max 64-bit table length\n"));
716 DEBUG ((DEBUG_INFO,
"SmbiosUpdateString: New smbios record add to 64-bit table\n"));
717 SmbiosEntry->Smbios64BitTable =
TRUE;
721 if ((!SmbiosEntry->Smbios32BitTable) && (!SmbiosEntry->Smbios64BitTable)) {
723 return EFI_UNSUPPORTED;
730 NewEntrySize = SmbiosEntry->RecordSize + InputStrLen - TargetStrLen;
733 if (ResizedSmbiosEntry ==
NULL) {
735 return EFI_OUT_OF_RESOURCES;
739 Raw = (VOID *)(InternalRecord + 1);
744 InternalRecord->Version = EFI_SMBIOS_RECORD_HEADER_VERSION;
746 InternalRecord->RecordSize = SmbiosEntry->RecordHeader->RecordSize + InputStrLen - TargetStrLen;
747 InternalRecord->ProducerHandle = SmbiosEntry->RecordHeader->ProducerHandle;
748 InternalRecord->NumberOfStrings = SmbiosEntry->RecordHeader->NumberOfStrings;
753 CopyMem (Raw, SmbiosEntry->RecordHeader + 1, Record->Length + TargetStrOffset);
754 CopyMem ((VOID *)((
UINTN)Raw + Record->Length + TargetStrOffset), String, InputStrLen + 1);
756 (CHAR8 *)((
UINTN)Raw + Record->Length + TargetStrOffset + InputStrLen + 1),
757 (CHAR8 *)Record + Record->Length + TargetStrOffset + TargetStrLen + 1,
758 SmbiosEntry->RecordHeader->RecordSize - sizeof (
EFI_SMBIOS_RECORD_HEADER) - Record->Length - TargetStrOffset - TargetStrLen - 1
764 ResizedSmbiosEntry->Signature = EFI_SMBIOS_ENTRY_SIGNATURE;
765 ResizedSmbiosEntry->RecordHeader = InternalRecord;
766 ResizedSmbiosEntry->RecordSize = NewEntrySize;
767 ResizedSmbiosEntry->Smbios32BitTable = SmbiosEntry->Smbios32BitTable;
768 ResizedSmbiosEntry->Smbios64BitTable = SmbiosEntry->Smbios64BitTable;
789 return EFI_INVALID_PARAMETER;
806 IN EFI_SMBIOS_HANDLE SmbiosHandle
812 EFI_SMBIOS_HANDLE MaxSmbiosHandle;
823 if (SmbiosHandle > MaxSmbiosHandle) {
824 return EFI_INVALID_PARAMETER;
827 Private = SMBIOS_INSTANCE_FROM_THIS (This);
832 if (EFI_ERROR (Status)) {
836 Head = &Private->DataListHead;
837 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
838 SmbiosEntry = SMBIOS_ENTRY_FROM_LINK (Link);
840 if (Record->Handle == SmbiosHandle) {
848 Head = &Private->AllocatedHandleListHead;
849 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
850 HandleEntry = SMBIOS_HANDLE_ENTRY_FROM_LINK (Link);
851 if (HandleEntry->SmbiosHandle == SmbiosHandle) {
864 if (SmbiosEntry->Smbios32BitTable) {
865 DEBUG ((DEBUG_INFO,
"SmbiosRemove: remove from 32-bit table\n"));
868 if (SmbiosEntry->Smbios64BitTable) {
869 DEBUG ((DEBUG_INFO,
"SmbiosRemove: remove from 64-bit table\n"));
886 return EFI_INVALID_PARAMETER;
911 IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
912 IN EFI_SMBIOS_TYPE *Type OPTIONAL,
917 BOOLEAN StartPointFound;
924 if (SmbiosHandle ==
NULL) {
925 return EFI_INVALID_PARAMETER;
928 StartPointFound =
FALSE;
929 Private = SMBIOS_INSTANCE_FROM_THIS (This);
930 Head = &Private->DataListHead;
931 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
932 SmbiosEntry = SMBIOS_ENTRY_FROM_LINK (Link);
939 if ((Type !=
NULL) && (*Type != SmbiosTableHeader->Type)) {
943 *SmbiosHandle = SmbiosTableHeader->Handle;
944 *Record = SmbiosTableHeader;
945 if (ProducerHandle !=
NULL) {
946 *ProducerHandle = SmbiosEntry->RecordHeader->ProducerHandle;
955 if (!StartPointFound && (*SmbiosHandle == SmbiosTableHeader->Handle)) {
956 StartPointFound =
TRUE;
960 if (StartPointFound) {
961 if ((Type !=
NULL) && (*Type != SmbiosTableHeader->Type)) {
965 *SmbiosHandle = SmbiosTableHeader->Handle;
966 *Record = SmbiosTableHeader;
967 if (ProducerHandle !=
NULL) {
968 *ProducerHandle = SmbiosEntry->RecordHeader->ProducerHandle;
976 return EFI_NOT_FOUND;
1007 Private = SMBIOS_INSTANCE_FROM_THIS (This);
1008 if (*CurrentSmbiosEntry ==
NULL) {
1012 Head = &Private->DataListHead;
1017 Head = &(*CurrentSmbiosEntry)->Link;
1020 Link = Head->ForwardLink;
1022 if (Link == &Private->DataListHead) {
1026 return EFI_NOT_FOUND;
1029 SmbiosEntry = SMBIOS_ENTRY_FROM_LINK (Link);
1031 *Record = SmbiosTableHeader;
1032 *CurrentSmbiosEntry = SmbiosEntry;
1049 OUT VOID **TableEntryPointStructure
1052 UINT8 *BufferPointer;
1056 EFI_SMBIOS_HANDLE SmbiosHandle;
1064 BufferPointer =
NULL;
1066 if (EntryPointStructure ==
NULL) {
1072 DEBUG ((DEBUG_INFO,
"SmbiosCreateTable: Initialize 32-bit entry point structure\n"));
1073 EntryPointStructureData.MajorVersion = mPrivateData.Smbios.MajorVersion;
1074 EntryPointStructureData.MinorVersion = mPrivateData.Smbios.MinorVersion;
1075 EntryPointStructureData.SmbiosBcdRevision = 0;
1076 if ((mPrivateData.Smbios.MajorVersion <= 9) && (mPrivateData.Smbios.MinorVersion <= 9)) {
1077 EntryPointStructureData.SmbiosBcdRevision = ((mPrivateData.Smbios.MajorVersion & 0x0f) << 4) | (mPrivateData.Smbios.MinorVersion & 0x0f);
1080 PhysicalAddress = 0xffffffff;
1081 Status =
gBS->AllocatePages (
1087 if (EFI_ERROR (Status)) {
1088 DEBUG ((DEBUG_ERROR,
"SmbiosCreateTable () could not allocate EntryPointStructure < 4GB\n"));
1089 Status =
gBS->AllocatePages (
1095 if (EFI_ERROR (Status)) {
1096 return EFI_OUT_OF_RESOURCES;
1103 EntryPointStructure,
1104 &EntryPointStructureData,
1112 SmbiosProtocol = &mPrivateData.Smbios;
1117 EntryPointStructure->NumberOfSmbiosStructures = 0;
1118 EntryPointStructure->TableLength = 0;
1119 EntryPointStructure->MaxStructureSize = 0;
1124 CurrentSmbiosEntry =
NULL;
1128 if ((Status ==
EFI_SUCCESS) && (CurrentSmbiosEntry->Smbios32BitTable)) {
1133 EntryPointStructure->NumberOfSmbiosStructures++;
1134 EntryPointStructure->TableLength = (UINT16)(EntryPointStructure->TableLength + RecordSize);
1135 if (RecordSize > EntryPointStructure->MaxStructureSize) {
1136 EntryPointStructure->MaxStructureSize = (UINT16)RecordSize;
1139 }
while (!EFI_ERROR (Status));
1147 EndStructure.Header.Handle = SmbiosHandle;
1148 EndStructure.Tailing[0] = 0;
1149 EndStructure.Tailing[1] = 0;
1150 EntryPointStructure->NumberOfSmbiosStructures++;
1151 EntryPointStructure->TableLength = (UINT16)(EntryPointStructure->TableLength + sizeof (EndStructure));
1152 if (
sizeof (EndStructure) > EntryPointStructure->MaxStructureSize) {
1153 EntryPointStructure->MaxStructureSize = (UINT16)
sizeof (EndStructure);
1156 if (
EFI_SIZE_TO_PAGES ((UINT32)EntryPointStructure->TableLength) > mPreAllocatedPages) {
1163 "%a() re-allocate SMBIOS 32-bit table\n",
1166 if (EntryPointStructure->TableAddress != 0) {
1171 (VOID *)(
UINTN)EntryPointStructure->TableAddress,
1174 EntryPointStructure->TableAddress = 0;
1175 mPreAllocatedPages = 0;
1178 PhysicalAddress = 0xffffffff;
1179 Status =
gBS->AllocatePages (
1185 if (EFI_ERROR (Status)) {
1186 DEBUG ((DEBUG_ERROR,
"SmbiosCreateTable() could not allocate SMBIOS table < 4GB\n"));
1187 EntryPointStructure->TableAddress = 0;
1188 return EFI_OUT_OF_RESOURCES;
1190 EntryPointStructure->TableAddress = (UINT32)PhysicalAddress;
1198 ASSERT (EntryPointStructure->TableAddress != 0);
1199 BufferPointer = (UINT8 *)(
UINTN)EntryPointStructure->TableAddress;
1200 CurrentSmbiosEntry =
NULL;
1204 if ((Status ==
EFI_SUCCESS) && (CurrentSmbiosEntry->Smbios32BitTable)) {
1206 CopyMem (BufferPointer, SmbiosRecord, RecordSize);
1207 BufferPointer = BufferPointer + RecordSize;
1209 }
while (!EFI_ERROR (Status));
1214 CopyMem (BufferPointer, &EndStructure,
sizeof (EndStructure));
1219 EntryPointStructure->IntermediateChecksum = 0;
1220 EntryPointStructure->EntryPointStructureChecksum = 0;
1222 EntryPointStructure->IntermediateChecksum =
1223 CalculateCheckSum8 ((UINT8 *)EntryPointStructure + 0x10, EntryPointStructure->EntryPointLength - 0x10);
1224 EntryPointStructure->EntryPointStructureChecksum =
1225 CalculateCheckSum8 ((UINT8 *)EntryPointStructure, EntryPointStructure->EntryPointLength);
1230 *TableEntryPointStructure = EntryPointStructure;
1248 OUT VOID **TableEntryPointStructure
1251 UINT8 *BufferPointer;
1255 EFI_SMBIOS_HANDLE SmbiosHandle;
1263 BufferPointer =
NULL;
1265 if (Smbios30EntryPointStructure ==
NULL) {
1271 DEBUG ((DEBUG_INFO,
"SmbiosCreateTable: Initialize 64-bit entry point structure\n"));
1272 Smbios30EntryPointStructureData.MajorVersion = mPrivateData.Smbios.MajorVersion;
1273 Smbios30EntryPointStructureData.MinorVersion = mPrivateData.Smbios.MinorVersion;
1274 Smbios30EntryPointStructureData.DocRev =
PcdGet8 (PcdSmbiosDocRev);
1275 Status =
gBS->AllocatePages (
1281 if (EFI_ERROR (Status)) {
1282 DEBUG ((DEBUG_ERROR,
"SmbiosCreate64BitTable() could not allocate Smbios30EntryPointStructure\n"));
1283 return EFI_OUT_OF_RESOURCES;
1289 Smbios30EntryPointStructure,
1290 &Smbios30EntryPointStructureData,
1298 SmbiosProtocol = &mPrivateData.Smbios;
1299 Smbios30EntryPointStructure->TableMaximumSize = 0;
1304 CurrentSmbiosEntry =
NULL;
1308 if ((Status ==
EFI_SUCCESS) && (CurrentSmbiosEntry->Smbios64BitTable)) {
1313 Smbios30EntryPointStructure->TableMaximumSize = (UINT32)(Smbios30EntryPointStructure->TableMaximumSize + RecordSize);
1315 }
while (!EFI_ERROR (Status));
1323 EndStructure.Header.Handle = SmbiosHandle;
1324 EndStructure.Tailing[0] = 0;
1325 EndStructure.Tailing[1] = 0;
1326 Smbios30EntryPointStructure->TableMaximumSize = (UINT32)(Smbios30EntryPointStructure->TableMaximumSize + sizeof (EndStructure));
1328 if (
EFI_SIZE_TO_PAGES (Smbios30EntryPointStructure->TableMaximumSize) > mPre64BitAllocatedPages) {
1335 "%a() re-allocate SMBIOS 64-bit table\n",
1338 if (Smbios30EntryPointStructure->TableAddress != 0) {
1343 (VOID *)(
UINTN)Smbios30EntryPointStructure->TableAddress,
1344 mPre64BitAllocatedPages
1346 Smbios30EntryPointStructure->TableAddress = 0;
1347 mPre64BitAllocatedPages = 0;
1350 Status =
gBS->AllocatePages (
1356 if (EFI_ERROR (Status)) {
1357 DEBUG ((DEBUG_ERROR,
"SmbiosCreateTable() could not allocate SMBIOS 64-bit table\n"));
1358 Smbios30EntryPointStructure->TableAddress = 0;
1359 return EFI_OUT_OF_RESOURCES;
1361 Smbios30EntryPointStructure->TableAddress = PhysicalAddress;
1362 mPre64BitAllocatedPages =
EFI_SIZE_TO_PAGES (Smbios30EntryPointStructure->TableMaximumSize);
1369 ASSERT (Smbios30EntryPointStructure->TableAddress != 0);
1370 BufferPointer = (UINT8 *)(
UINTN)Smbios30EntryPointStructure->TableAddress;
1371 CurrentSmbiosEntry =
NULL;
1375 if ((Status ==
EFI_SUCCESS) && (CurrentSmbiosEntry->Smbios64BitTable)) {
1380 CopyMem (BufferPointer, SmbiosRecord, RecordSize);
1381 BufferPointer = BufferPointer + RecordSize;
1383 }
while (!EFI_ERROR (Status));
1388 CopyMem (BufferPointer, &EndStructure,
sizeof (EndStructure));
1393 Smbios30EntryPointStructure->EntryPointStructureChecksum = 0;
1394 Smbios30EntryPointStructure->EntryPointStructureChecksum =
1395 CalculateCheckSum8 ((UINT8 *)Smbios30EntryPointStructure, Smbios30EntryPointStructure->EntryPointLength);
1400 *TableEntryPointStructure = Smbios30EntryPointStructure;
1415 BOOLEAN Smbios32BitTable,
1416 BOOLEAN Smbios64BitTable
1423 if (Smbios32BitTable) {
1425 if (!EFI_ERROR (Status)) {
1426 gBS->InstallConfigurationTable (&gEfiSmbiosTableGuid, Eps);
1430 if (Smbios64BitTable) {
1432 if (!EFI_ERROR (Status)) {
1433 gBS->InstallConfigurationTable (&gEfiSmbios3TableGuid, Eps64Bit);
1452 IN VOID *TableEntry,
1453 OUT VOID **TableAddress,
1455 OUT UINT8 *MajorVersion,
1456 OUT UINT8 *MinorVersion
1464 if (
CompareMem (SmbiosTable->AnchorString,
"_SM_", 4) != 0) {
1468 if (
CompareMem (SmbiosTable->IntermediateAnchorString,
"_DMI_", 5) != 0) {
1477 if ((SmbiosTable->EntryPointLength != 0x1E) && (SmbiosTable->EntryPointLength !=
sizeof (
SMBIOS_TABLE_ENTRY_POINT))) {
1484 if (SmbiosTable->MajorVersion < 2) {
1488 *MajorVersion = SmbiosTable->MajorVersion;
1489 *MinorVersion = SmbiosTable->MinorVersion;
1495 (UINT8 *)SmbiosTable,
1496 SmbiosTable->EntryPointLength
1498 if (Checksum != 0) {
1509 if (Checksum != 0) {
1513 *TableAddress = (VOID *)(
UINTN)SmbiosTable->TableAddress;
1514 *TableMaximumSize = SmbiosTable->TableLength;
1532 IN VOID *TableEntry,
1533 OUT VOID **TableAddress,
1535 OUT UINT8 *MajorVersion,
1536 OUT UINT8 *MinorVersion
1544 if (
CompareMem (SmbiosTable->AnchorString,
"_SM3_", 5) != 0) {
1552 if (SmbiosTable->MajorVersion < 3) {
1556 *MajorVersion = SmbiosTable->MajorVersion;
1557 *MinorVersion = SmbiosTable->MinorVersion;
1563 (UINT8 *)SmbiosTable,
1564 SmbiosTable->EntryPointLength
1566 if (Checksum != 0) {
1570 *TableAddress = (VOID *)(
UINTN)SmbiosTable->TableAddress;
1571 *TableMaximumSize = SmbiosTable->TableMaximumSize;
1593 IN UINT8 MajorVersion,
1594 IN UINT8 MinorVersion
1599 EFI_SMBIOS_HANDLE SmbiosHandle;
1602 mPrivateData.Smbios.MajorVersion = MajorVersion;
1603 mPrivateData.Smbios.MinorVersion = MinorVersion;
1605 SmbiosEnd.Raw = Smbios.Raw + Length;
1607 if ((Smbios.Raw >= SmbiosEnd.Raw) || (Smbios.Raw ==
NULL)) {
1608 return EFI_INVALID_PARAMETER;
1616 return EFI_INVALID_PARAMETER;
1630 if ((
UINTN)(SmbiosEnd.Raw - Smbios.Raw) < (Smbios.Hdr->Length + 2U)) {
1631 return EFI_INVALID_PARAMETER;
1637 SmbiosHandle = Smbios.Hdr->Handle;
1639 &mPrivateData.Smbios,
1646 if (EFI_ERROR (Status)) {
1659 String = (CHAR8 *)(Smbios.Raw + Smbios.Hdr->Length);
1669 for ( ; *String != 0; String++) {
1670 if ((
UINTN)String >= (
UINTN)SmbiosEnd.Raw - sizeof (UINT8)) {
1671 return EFI_INVALID_PARAMETER;
1675 if (*(UINT8 *)++String == 0) {
1679 Smbios.Raw = (UINT8 *)++String;
1683 }
while (Smbios.Raw < SmbiosEnd.Raw);
1709 UINTN TableMaximumSize;
1713 Status = EFI_NOT_FOUND;
1718 for (Index = 0; Index <
ARRAY_SIZE (mIsSmbiosTableValid); Index++) {
1720 if (GuidHob ==
NULL) {
1726 if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION) {
1732 if (mIsSmbiosTableValid[Index].IsValid ((VOID *)(
UINTN)SmBiosTableAdress->SmBiosEntryPoint, &TableAddress, &TableMaximumSize, &MajorVersion, &MinorVersion)) {
1733 Smbios.Raw = TableAddress;
1735 if (EFI_ERROR (Status)) {
1736 DEBUG ((DEBUG_ERROR,
"RetrieveSmbiosFromHob: Failed to parse preinstalled tables from Guid Hob\n"));
1737 Status = EFI_UNSUPPORTED;
1770 mPrivateData.Signature = SMBIOS_INSTANCE_SIGNATURE;
1775 mPrivateData.Smbios.MajorVersion = (UINT8)(
PcdGet16 (PcdSmbiosVersion) >> 8);
1776 mPrivateData.Smbios.MinorVersion = (UINT8)(
PcdGet16 (PcdSmbiosVersion) & 0x00ff);
1785 mPrivateData.Handle =
NULL;
1786 Status =
gBS->InstallProtocolInterface (
1787 &mPrivateData.Handle,
1788 &gEfiSmbiosProtocolGuid,
1790 &mPrivateData.Smbios
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
UINT8 EFIAPI CalculateSum8(IN CONST UINT8 *Buffer, IN UINTN Length)
UINT8 EFIAPI CalculateCheckSum8(IN CONST UINT8 *Buffer, IN UINTN Length)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI AsciiStrCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define SMBIOS_TYPE_END_OF_TABLE
#define SMBIOS_STRING_MAX_LENGTH
#define SMBIOS_HANDLE_PI_RESERVED
#define ARRAY_SIZE(Array)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGet16(TokenName)
#define PcdGet8(TokenName)
#define PcdGet32(TokenName)
EFI_STATUS EFIAPI GetNextSmbiosRecord(IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_ENTRY **CurrentSmbiosEntry, OUT EFI_SMBIOS_TABLE_HEADER **Record)
STATIC BOOLEAN IsValidSmbios30Table(IN VOID *TableEntry, OUT VOID **TableAddress, OUT UINTN *TableMaximumSize, OUT UINT8 *MajorVersion, OUT UINT8 *MinorVersion)
EFI_STATUS EFIAPI GetSmbiosStructureSize(IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_SMBIOS_TABLE_HEADER *Head, OUT UINTN *Size, OUT UINTN *NumberOfStrings)
STATIC BOOLEAN IsValidSmbios20Table(IN VOID *TableEntry, OUT VOID **TableAddress, OUT UINTN *TableMaximumSize, OUT UINT8 *MajorVersion, OUT UINT8 *MinorVersion)
EFI_STATUS EFIAPI SmbiosRemove(IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_SMBIOS_HANDLE SmbiosHandle)
EFI_STATUS EFIAPI SmbiosDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI SmbiosGetNext(IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle, IN EFI_SMBIOS_TYPE *Type OPTIONAL, OUT EFI_SMBIOS_TABLE_HEADER **Record, OUT EFI_HANDLE *ProducerHandle OPTIONAL)
EFI_STATUS EFIAPI SmbiosCreate64BitTable(OUT VOID **TableEntryPointStructure)
STATIC EFI_STATUS ParseAndAddExistingSmbiosTable(IN EFI_HANDLE ImageHandle, IN SMBIOS_STRUCTURE_POINTER Smbios, IN UINTN Length, IN UINT8 MajorVersion, IN UINT8 MinorVersion)
EFI_STATUS RetrieveSmbiosFromHob(IN EFI_HANDLE ImageHandle)
EFI_STATUS EFIAPI SmbiosUpdateString(IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_SMBIOS_HANDLE *SmbiosHandle, IN UINTN *StringNumber, IN CHAR8 *String)
EFI_STATUS EFIAPI GetAvailableSmbiosHandle(IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_HANDLE *Handle)
EFI_STATUS EFIAPI SmbiosAdd(IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_HANDLE ProducerHandle OPTIONAL, IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle, IN EFI_SMBIOS_TABLE_HEADER *Record)
BOOLEAN EFIAPI CheckSmbiosHandleExistance(IN LIST_ENTRY *Head, IN EFI_SMBIOS_HANDLE Handle)
VOID EFIAPI SmbiosTableConstruction(BOOLEAN Smbios32BitTable, BOOLEAN Smbios64BitTable)
VOID EFIAPI GetMaxSmbiosHandle(IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_HANDLE *MaxHandle)
EFI_STATUS EFIAPI SmbiosCreateTable(OUT VOID **TableEntryPointStructure)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
VOID EFIAPI EfiReleaseLock(IN EFI_LOCK *Lock)
EFI_STATUS EFIAPI EfiAcquireLockOrFail(IN EFI_LOCK *Lock)
EFI_LOCK *EFIAPI EfiInitializeLock(IN OUT EFI_LOCK *Lock, IN EFI_TPL Priority)
#define UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD(TYPE, Field)