+\r
+ //\r
+ // Initialize the EntryPointStructure with initial values.\r
+ // Allocate memory (below 4GB).\r
+ //\r
+ PhysicalAddress = 0xffffffff;\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ EfiReservedMemoryType,\r
+ EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),\r
+ &PhysicalAddress\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_ERROR, "SmbiosDriverEntryPoint() could not allocate EntryPointStructure < 4GB\n"));\r
+ Status = gBS->AllocatePages (\r
+ AllocateAnyPages,\r
+ EfiReservedMemoryType,\r
+ EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),\r
+ &PhysicalAddress\r
+ );\r
+ if (EFI_ERROR (Status)) { \r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ }\r
+\r
+ EntryPointStructure = (SMBIOS_TABLE_ENTRY_POINT *) (UINTN) PhysicalAddress;\r
+ \r
+ CopyMem (\r
+ EntryPointStructure,\r
+ &EntryPointStructureData,\r
+ sizeof (SMBIOS_TABLE_ENTRY_POINT)\r
+ );\r
+\r
+ //\r
+ // Pre-allocate 1 page for SMBIOS table below 4GB.\r
+ // SMBIOS table will be updated when new SMBIOS type is added or \r
+ // existing SMBIOS type is updated. If the total size of SMBIOS table exceeds 1 page,\r
+ // we will re-allocate new memory when creating whole SMBIOS table.\r
+ //\r
+ PhysicalAddress = 0xffffffff;\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ EfiReservedMemoryType,\r
+ 1,\r
+ &PhysicalAddress\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_ERROR, "SmbiosDriverEntryPoint() could not allocate SMBIOS table < 4GB\n"));\r
+ EntryPointStructure->TableAddress = 0;\r
+ } else {\r
+ EntryPointStructure->TableAddress = (UINT32) PhysicalAddress;\r
+ mPreAllocatedPages = 1;\r
+ }\r
+\r
+ //\r
+ // Init TableLength to the length of End-Of-Table structure for SmbiosAdd() called at the first time\r
+ // to check the TableLength limitation.\r
+ //\r
+ EntryPointStructure->TableLength = sizeof (EFI_SMBIOS_TABLE_END_STRUCTURE);\r