Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

643 lines
20 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Copyright (c) 1998 Intel Corporation
  4. Module Name:
  5. sumain.c
  6. Abstract:
  7. SuMain() sets up NT specific data structures for OsLoader.c. This
  8. is necessary since we don't have the ARC firmware to do the work
  9. for us. SuMain() is call by SuSetup() which is an assembly level
  10. routine that does IA64 specific setup.
  11. Author:
  12. Allen Kay (akay) 19-May-95
  13. --*/
  14. #include "bldr.h"
  15. #include "sudata.h"
  16. #include "sal.h"
  17. #include "efi.h"
  18. #include "efip.h"
  19. #include "bootia64.h"
  20. #include "smbios.h"
  21. extern EFI_SYSTEM_TABLE *EfiST;
  22. //
  23. // External functions
  24. //
  25. extern VOID NtProcessStartup();
  26. extern VOID SuFillExportTable();
  27. extern VOID CpuSpecificWork();
  28. extern EFI_STATUS
  29. GetSystemConfigurationTable(
  30. IN EFI_GUID *TableGuid,
  31. IN OUT VOID **Table
  32. );
  33. //
  34. // Define export entry table.
  35. //
  36. PVOID ExportEntryTable[ExMaximumRoutine];
  37. // M E M O R Y D E S C R I P T O R
  38. //
  39. // Memory Descriptor - each contiguous block of physical memory is
  40. // described by a Memory Descriptor. The descriptors are a table, with
  41. // the last entry having a BlockBase and BlockSize of zero. A pointer
  42. // to the beginning of this table is passed as part of the BootContext
  43. // Record to the OS Loader.
  44. //
  45. BOOT_CONTEXT BootContext;
  46. //
  47. // Global EFI data
  48. //
  49. #define EFI_ARRAY_SIZE 100
  50. #define EFI_PAGE_SIZE 4096
  51. #define EFI_PAGE_SHIFT 12
  52. #define MEM_4K 0x1000
  53. #define MEM_8K 0x2000
  54. #define MEM_16K 0x4000
  55. #define MEM_64K 0x10000
  56. #define MEM_256K 0x40000
  57. #define MEM_1M 0x100000
  58. #define MEM_4M 0x400000
  59. #define MEM_16M 0x1000000
  60. #define MEM_64M 0x4000000
  61. #define MEM_256M 0x10000000
  62. EFI_HANDLE EfiImageHandle;
  63. EFI_SYSTEM_TABLE *EfiST;
  64. EFI_BOOT_SERVICES *EfiBS;
  65. EFI_RUNTIME_SERVICES *EfiRS;
  66. PSST_HEADER SalSystemTable;
  67. PVOID AcpiTable;
  68. PVOID SMBiosTable;
  69. //
  70. // EFI GUID defines
  71. //
  72. EFI_GUID EfiLoadedImageProtocol = LOADED_IMAGE_PROTOCOL;
  73. EFI_GUID EfiDevicePathProtocol = DEVICE_PATH_PROTOCOL;
  74. EFI_GUID EfiDeviceIoProtocol = DEVICE_IO_PROTOCOL;
  75. EFI_GUID EfiBlockIoProtocol = BLOCK_IO_PROTOCOL;
  76. EFI_GUID EfiDiskIoProtocol = DISK_IO_PROTOCOL;
  77. EFI_GUID EfiFilesystemProtocol = SIMPLE_FILE_SYSTEM_PROTOCOL;
  78. EFI_GUID AcpiTable_Guid = ACPI_TABLE_GUID;
  79. EFI_GUID SmbiosTableGuid = SMBIOS_TABLE_GUID;
  80. EFI_GUID SalSystemTableGuid = SAL_SYSTEM_TABLE_GUID;
  81. //
  82. // PAL, SAL, and IO port space data
  83. //
  84. TR_INFO Pal,Sal,SalGP;
  85. ULONGLONG PalProcPhysical;
  86. ULONGLONG PalPhysicalBase = 0;
  87. ULONGLONG PalTrPs;
  88. ULONGLONG IoPortPhysicalBase;
  89. ULONGLONG IoPortTrPs;
  90. ULONG WakeupVector;
  91. //
  92. // Function Prototypes
  93. //
  94. VOID
  95. GetPalProcEntryPoint(
  96. IN PSST_HEADER SalSystemTable
  97. );
  98. ULONG
  99. GetDevPathSize(
  100. IN EFI_DEVICE_PATH *DevPath
  101. );
  102. #if DBG
  103. #define DBG_TRACE(_X) EfiPrint(_X)
  104. #else
  105. #define DBG_TRACE(_X)
  106. #endif
  107. #ifdef FORCE_CD_BOOT
  108. EFI_HANDLE
  109. GetCd(
  110. );
  111. EFI_HANDLE
  112. GetCdTest(
  113. VOID
  114. );
  115. #endif // for FORCE_CD_BOOT
  116. VOID
  117. SuMain(
  118. IN EFI_HANDLE ImageHandle,
  119. IN EFI_SYSTEM_TABLE *SystemTable
  120. )
  121. /*++
  122. Routine Description:
  123. Main entrypoint of the SU module. Control is passed from the boot
  124. sector to startup.asm which does some run-time fixups on the stack
  125. and data segments and then passes control here.
  126. Arguments:
  127. None
  128. Returns:
  129. Does not return. Passes control to the OS loader
  130. --*/
  131. {
  132. PIMAGE_DOS_HEADER DosHeader;
  133. PIMAGE_NT_HEADERS NtHeader;
  134. PIMAGE_FILE_HEADER FileHeader;
  135. PIMAGE_OPTIONAL_HEADER OptionalHeader;
  136. PIMAGE_SECTION_HEADER SectionHeader;
  137. ULONG NumberOfSections;
  138. BOOLEAN ResourceFound = FALSE;
  139. ULONGLONG Destination;
  140. ULONGLONG VirtualSize;
  141. ULONGLONG SizeOfRawData;
  142. USHORT Section;
  143. EFI_GUID EfiLoadedImageProtocol = LOADED_IMAGE_PROTOCOL;
  144. EFI_LOADED_IMAGE *EfiImageInfo;
  145. EFI_STATUS Status;
  146. EFI_DEVICE_PATH *DevicePath, *TestPath;
  147. EFI_DEVICE_PATH_ALIGNED TestPathAligned;
  148. PCI_DEVICE_PATH *PciDevicePath;
  149. HARDDRIVE_DEVICE_PATH *HdDevicePath;
  150. ACPI_HID_DEVICE_PATH *AcpiDevicePath;
  151. ATAPI_DEVICE_PATH *AtapiDevicePath;
  152. SCSI_DEVICE_PATH *ScsiDevicePath;
  153. IPv4_DEVICE_PATH *IpV4DevicePath;
  154. IPv6_DEVICE_PATH *IpV6DevicePath;
  155. UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownDevicePath;
  156. ULONG i;
  157. PBOOT_DEVICE_ATAPI BootDeviceAtapi;
  158. PBOOT_DEVICE_SCSI BootDeviceScsi;
  159. PBOOT_DEVICE_FLOPPY BootDeviceFloppy;
  160. PBOOT_DEVICE_IPv4 BootDeviceIpV4;
  161. PBOOT_DEVICE_IPv6 BootDeviceIpV6;
  162. PBOOT_DEVICE_UNKNOWN BootDeviceUnknown;
  163. PSMBIOS_EPS_HEADER SMBiosEPSHeader;
  164. PUCHAR SMBiosEPSPtr;
  165. UCHAR CheckSum;
  166. UINT8 Channel = 0; // for SCSI boot devices - default to 0
  167. //
  168. // EFI global variables
  169. //
  170. EfiImageHandle = ImageHandle;
  171. EfiST = SystemTable;
  172. EfiBS = SystemTable->BootServices;
  173. EfiRS = SystemTable->RuntimeServices;
  174. DBG_TRACE(L"SuMain: entry\r\n");
  175. //
  176. // Get the SAL System Table
  177. //
  178. Status = GetSystemConfigurationTable(&SalSystemTableGuid, &SalSystemTable);
  179. if (EFI_ERROR(Status)) {
  180. EfiPrint(L"SuMain: HandleProtocol failed\n");
  181. EfiBS->Exit(EfiImageHandle, Status, 0, 0);
  182. }
  183. #if 0
  184. //
  185. // Get the MPS Table
  186. //
  187. Status = GetSystemConfigurationTable(&MpsTableGuid, &MpsTable);
  188. if (EFI_ERROR(Status)) {
  189. EfiPrint(L"SuMain: HandleProtocol failed\n");
  190. EfiBS->Exit(EfiImageHandle, Status, 0, 0);
  191. }
  192. #endif
  193. //
  194. // Get the ACPI Tables
  195. //
  196. //
  197. // Get the ACPI 2.0 Table, if present
  198. //
  199. //DbgPrint("Looking for ACPi 2.0\n");
  200. Status = GetSystemConfigurationTable(&AcpiTable_Guid, &AcpiTable);
  201. if (EFI_ERROR(Status)) {
  202. //DbgPrint("returned error\n");
  203. AcpiTable = NULL;
  204. }
  205. //DbgPrint("AcpiTable: %p\n", AcpiTable);
  206. if (!AcpiTable) {
  207. EfiPrint(L"SuMain: HandleProtocol failed\n");
  208. EfiBS->Exit(EfiImageHandle, Status, 0, 0);
  209. }
  210. //
  211. // Get the SMBIOS Table
  212. //
  213. Status = GetSystemConfigurationTable(&SmbiosTableGuid, &SMBiosTable);
  214. if (EFI_ERROR(Status)) {
  215. //DbgPrint("returned error\n");
  216. SMBiosTable = NULL;
  217. } else {
  218. //
  219. // Validate SMBIOS EPS Header
  220. //
  221. SMBiosEPSHeader = (PSMBIOS_EPS_HEADER)SMBiosTable;
  222. SMBiosEPSPtr = (PUCHAR)SMBiosTable;
  223. if ((*((PULONG)SMBiosEPSHeader->Signature) == SMBIOS_EPS_SIGNATURE) &&
  224. (SMBiosEPSHeader->Length >= sizeof(SMBIOS_EPS_HEADER)) &&
  225. (*((PULONG)SMBiosEPSHeader->Signature2) == DMI_EPS_SIGNATURE) &&
  226. (SMBiosEPSHeader->Signature2[4] == '_' ))
  227. {
  228. CheckSum = 0;
  229. for (i = 0; i < SMBiosEPSHeader->Length ; i++)
  230. {
  231. CheckSum = CheckSum + SMBiosEPSPtr[i];
  232. }
  233. if (CheckSum != 0)
  234. {
  235. DBG_TRACE(L"SMBios Table has bad checksum.....\r\n");
  236. SMBiosTable = NULL;
  237. } else {
  238. DBG_TRACE(L"SMBios Table has been validated.....\r\n");
  239. }
  240. } else {
  241. DBG_TRACE(L"SMBios Table is incorrectly formed.....\r\n");
  242. SMBiosTable = NULL;
  243. }
  244. }
  245. //
  246. // Get the image info for NTLDR
  247. //
  248. Status = EfiBS->HandleProtocol (
  249. ImageHandle,
  250. &EfiLoadedImageProtocol,
  251. &EfiImageInfo
  252. );
  253. if (EFI_ERROR(Status)) {
  254. EfiPrint(L"SuMain: HandleProtocol failed\n");
  255. EfiBS->Exit(EfiImageHandle, Status, 0, 0);
  256. }
  257. //
  258. // Get device path of the DeviceHandle associated with this image handle.
  259. //
  260. Status = EfiBS->HandleProtocol (
  261. EfiImageInfo->DeviceHandle,
  262. &EfiDevicePathProtocol,
  263. &DevicePath
  264. );
  265. if (EFI_ERROR(Status)) {
  266. EfiPrint(L"SuMain: HandleProtocol failed\r\n");
  267. EfiBS->Exit(EfiImageHandle, Status, 0, 0);
  268. }
  269. //
  270. // Get the MediaType and Partition information and save them in the
  271. // BootContext.
  272. //
  273. EfiAlignDp( &TestPathAligned,
  274. DevicePath,
  275. DevicePathNodeLength(DevicePath) );
  276. TestPath = (EFI_DEVICE_PATH *) &TestPathAligned;
  277. while (TestPath->Type != END_DEVICE_PATH_TYPE) {
  278. //
  279. // save the channel in case its needed later. We may
  280. // need this information to help further distinguish
  281. // between devices that share the same SCSI ID/LUN, but
  282. // may be sitting on different controllers.
  283. //
  284. if (TestPath->Type == HW_PCI_DP) {
  285. PciDevicePath = (PCI_DEVICE_PATH *)TestPath;
  286. Channel = PciDevicePath->Function;
  287. }
  288. if (TestPath->Type == MESSAGING_DEVICE_PATH) {
  289. if (TestPath->SubType == MSG_ATAPI_DP) {
  290. AtapiDevicePath = (ATAPI_DEVICE_PATH *) TestPath;
  291. BootContext.BusType = BootBusAtapi;
  292. BootDeviceAtapi = (PBOOT_DEVICE_ATAPI) &(BootContext.BootDevice);
  293. BootDeviceAtapi->PrimarySecondary = AtapiDevicePath->PrimarySecondary;
  294. BootDeviceAtapi->SlaveMaster = AtapiDevicePath->SlaveMaster;
  295. BootDeviceAtapi->Lun = AtapiDevicePath->Lun;
  296. } else if (TestPath->SubType == MSG_SCSI_DP) {
  297. ScsiDevicePath = (SCSI_DEVICE_PATH *) TestPath;
  298. BootContext.BusType = BootBusScsi;
  299. BootDeviceScsi = (PBOOT_DEVICE_SCSI) &(BootContext.BootDevice);
  300. // Remember his specifics
  301. BootDeviceScsi->Channel = Channel;
  302. BootDeviceScsi->Pun = ScsiDevicePath->Pun;
  303. BootDeviceScsi->Lun = ScsiDevicePath->Lun;
  304. } else if (TestPath->SubType == MSG_MAC_ADDR_DP) {
  305. BootContext.MediaType = BootMediaTcpip;
  306. } else if (TestPath->SubType == MSG_IPv4_DP) {
  307. IpV4DevicePath = (IPv4_DEVICE_PATH *) TestPath;
  308. BootContext.MediaType = BootMediaTcpip;
  309. BootDeviceIpV4 = (PBOOT_DEVICE_IPv4) &(BootContext.BootDevice);
  310. BootDeviceIpV4->RemotePort = IpV4DevicePath->RemotePort;
  311. BootDeviceIpV4->LocalPort = IpV4DevicePath->LocalPort;
  312. RtlCopyMemory(&BootDeviceIpV4->Ip, &IpV4DevicePath->LocalIpAddress, sizeof(EFI_IPv4_ADDRESS));
  313. } else if (TestPath->SubType == MSG_IPv6_DP) {
  314. IpV6DevicePath = (IPv6_DEVICE_PATH *) TestPath;
  315. BootContext.MediaType = BootMediaTcpip;
  316. BootDeviceIpV6 = (PBOOT_DEVICE_IPv6) &(BootContext.BootDevice);
  317. BootDeviceIpV6->RemotePort = IpV6DevicePath->RemotePort;
  318. BootDeviceIpV6->LocalPort = IpV6DevicePath->LocalPort;
  319. #if 0
  320. BootDeviceIpV6->Ip = IpV6DevicePath->Ip;
  321. #endif
  322. }
  323. } else if (TestPath->Type == ACPI_DEVICE_PATH) {
  324. AcpiDevicePath = (ACPI_HID_DEVICE_PATH *) TestPath;
  325. if (AcpiDevicePath->HID == EISA_ID(PNP_EISA_ID_CONST, 0x0303)) {
  326. BootDeviceFloppy = (PBOOT_DEVICE_FLOPPY) &(BootContext.BootDevice);
  327. BootDeviceFloppy->DriveNumber = AcpiDevicePath->UID;
  328. }
  329. } else if (TestPath->Type == HARDWARE_DEVICE_PATH) {
  330. if (TestPath->SubType == HW_VENDOR_DP) {
  331. UnknownDevicePath = (UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *) TestPath;
  332. BootDeviceUnknown = (PBOOT_DEVICE_UNKNOWN) &(BootContext.BootDevice);
  333. RtlCopyMemory( &(BootDeviceUnknown->Guid),
  334. &(UnknownDevicePath->DevicePath.Guid),
  335. sizeof(EFI_GUID));
  336. BootContext.BusType = BootBusVendor;
  337. BootDeviceUnknown->LegacyDriveLetter = UnknownDevicePath->LegacyDriveLetter;
  338. }
  339. } else if (TestPath->Type == MEDIA_DEVICE_PATH) {
  340. BootContext.MediaType = TestPath->SubType;
  341. if (TestPath->SubType == MEDIA_HARDDRIVE_DP) {
  342. HdDevicePath = (HARDDRIVE_DEVICE_PATH *) TestPath;
  343. BootContext.MediaType = BootMediaHardDisk;
  344. BootContext.PartitionNumber = (UCHAR) HdDevicePath->PartitionNumber;
  345. } else if (TestPath->SubType == MEDIA_CDROM_DP) {
  346. BootContext.MediaType = BootMediaCdrom;
  347. }
  348. }
  349. DevicePath = NextDevicePathNode(DevicePath);
  350. EfiAlignDp( &TestPathAligned,
  351. DevicePath,
  352. DevicePathNodeLength(DevicePath) );
  353. TestPath = (EFI_DEVICE_PATH *) &TestPathAligned;
  354. }
  355. #ifdef FORCE_CD_BOOT
  356. BootContext.MediaType = BootMediaCdrom;
  357. #endif
  358. //
  359. // Fill out the rest of BootContext fields
  360. //
  361. DosHeader = EfiImageInfo->ImageBase;
  362. NtHeader = (PIMAGE_NT_HEADERS) ((PUCHAR) DosHeader + DosHeader->e_lfanew);
  363. FileHeader = &(NtHeader->FileHeader);
  364. OptionalHeader = (PIMAGE_OPTIONAL_HEADER)
  365. ((PUCHAR)FileHeader + sizeof(IMAGE_FILE_HEADER));
  366. SectionHeader = (PIMAGE_SECTION_HEADER) ((PUCHAR)OptionalHeader +
  367. FileHeader->SizeOfOptionalHeader);
  368. BootContext.ExternalServicesTable = (PEXTERNAL_SERVICES_TABLE)
  369. &ExportEntryTable;
  370. BootContext.MachineType = MACHINE_TYPE_ISA;
  371. BootContext.OsLoaderBase = (ULONG_PTR)EfiImageInfo->ImageBase;
  372. BootContext.OsLoaderExports = (ULONG_PTR)EfiImageInfo->ImageBase +
  373. OptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
  374. BootContext.BootFlags = 0;
  375. //
  376. // Calculate the start address and the end address of OS loader.
  377. //
  378. BootContext.OsLoaderStart = (ULONG_PTR)EfiImageInfo->ImageBase +
  379. SectionHeader->VirtualAddress;
  380. BootContext.OsLoaderEnd = (ULONG_PTR)EfiImageInfo->ImageBase +
  381. SectionHeader->SizeOfRawData;
  382. for (Section=FileHeader->NumberOfSections ; Section-- ; SectionHeader++) {
  383. Destination = (ULONG_PTR)EfiImageInfo->ImageBase + SectionHeader->VirtualAddress;
  384. VirtualSize = SectionHeader->Misc.VirtualSize;
  385. SizeOfRawData = SectionHeader->SizeOfRawData;
  386. if (VirtualSize == 0) {
  387. VirtualSize = SizeOfRawData;
  388. }
  389. if (Destination < BootContext.OsLoaderStart) {
  390. BootContext.OsLoaderStart = Destination;
  391. }
  392. if (Destination+VirtualSize > BootContext.OsLoaderEnd) {
  393. BootContext.OsLoaderEnd = Destination+VirtualSize;
  394. }
  395. }
  396. //
  397. // Find .rsrc section
  398. //
  399. SectionHeader = (PIMAGE_SECTION_HEADER) ((PUCHAR)OptionalHeader +
  400. FileHeader->SizeOfOptionalHeader);
  401. NumberOfSections = FileHeader->NumberOfSections;
  402. while (NumberOfSections) {
  403. if (_stricmp((PCHAR)SectionHeader->Name, ".rsrc")==0) {
  404. BootContext.ResourceDirectory =
  405. (ULONGLONG) ((ULONG_PTR)EfiImageInfo->ImageBase + SectionHeader->VirtualAddress);
  406. BootContext.ResourceOffset = (ULONGLONG)((LONG)SectionHeader->VirtualAddress);
  407. ResourceFound = TRUE;
  408. }
  409. ++SectionHeader;
  410. --NumberOfSections;
  411. }
  412. if (ResourceFound == FALSE) {
  413. EfiPrint(L"SuMain: Resource section not found\n");
  414. EfiBS->Exit(EfiImageHandle, Status, 0, 0);
  415. }
  416. DBG_TRACE( L"SuMain: About to call NtProcessStartup\r\n");
  417. //
  418. // See if someone called us w/ a TFTP restart block.
  419. //
  420. if( EfiImageInfo->LoadOptionsSize == (sizeof(TFTP_RESTART_BLOCK)) ) {
  421. //
  422. // Likely. Make sure it's really a TFTP restart block and if so, go retrieve all
  423. // its contents.
  424. //
  425. if( EfiImageInfo->LoadOptions != NULL ) {
  426. extern TFTP_RESTART_BLOCK gTFTPRestartBlock;
  427. PTFTP_RESTART_BLOCK restartBlock = NULL;
  428. restartBlock = (PTFTP_RESTART_BLOCK)(EfiImageInfo->LoadOptions);
  429. RtlCopyMemory( &gTFTPRestartBlock,
  430. restartBlock,
  431. sizeof(TFTP_RESTART_BLOCK) );
  432. DBG_TRACE( L"SuMain: copied TFTP_RESTART_BLOCK into gTFTPRestartBlock\r\n");
  433. }
  434. }
  435. GetPalProcEntryPoint( SalSystemTable );
  436. //
  437. // construct arc memory descriptors for the first 128 mb of memory.
  438. // the loader will not use anything over 128 mb and efi may still
  439. // change the memory descriptors in it's memory map. let the loader's
  440. // memory map be for as small a memory region as possible, so that
  441. // the chance for the loader's/efi's memory map to get out of sync
  442. // is minimal
  443. //
  444. ConstructArcMemoryDescriptorsWithAllocation(0, BL_DRIVER_RANGE_HIGH << PAGE_SHIFT);
  445. //
  446. // Applies CPU specific workarounds
  447. //
  448. CpuSpecificWork();
  449. SuFillExportTable( );
  450. NtProcessStartup( &BootContext );
  451. }
  452. VOID
  453. GetPalProcEntryPoint(
  454. IN PSST_HEADER SalSystemTable
  455. )
  456. {
  457. PVOID NextEntry;
  458. PPAL_SAL_ENTRY_POINT PalSalEntryPoint;
  459. PAP_WAKEUP_DESCRIPTOR ApWakeupDescriptor;
  460. ULONG i;
  461. DBG_TRACE(L"GetPalProcEntryPoint: entry\n");
  462. //
  463. // Get PalProc entry point from SAL System Table
  464. //
  465. NextEntry = (PUCHAR) SalSystemTable + sizeof(SST_HEADER);
  466. for (i = 0; i < SalSystemTable->EntryCount; i++) {
  467. switch ( *(PUCHAR)NextEntry ) {
  468. case PAL_SAL_EP_TYPE:
  469. PalSalEntryPoint = (PPAL_SAL_ENTRY_POINT) NextEntry;
  470. PalProcPhysical = Pal.PhysicalAddress = PalSalEntryPoint->PalEntryPoint;
  471. Sal.PhysicalAddress = PalSalEntryPoint->SalEntryPoint;
  472. SalGP.PhysicalAddress = PalSalEntryPoint->GlobalPointer;
  473. NextEntry = (PPAL_SAL_ENTRY_POINT)NextEntry + 1;
  474. break;
  475. case SAL_MEMORY_TYPE:
  476. NextEntry = (PSAL_MEMORY_DESCRIPTOR)NextEntry + 1;
  477. break;
  478. case PLATFORM_FEATURES_TYPE:
  479. NextEntry = (PPLATFORM_FEATURES)NextEntry + 1;
  480. break;
  481. case TRANSLATION_REGISTER_TYPE:
  482. NextEntry = (PTRANSLATION_REGISTER)NextEntry + 1;
  483. break;
  484. case PTC_COHERENCE_TYPE:
  485. NextEntry = (PPTC_COHERENCE_DOMAIN)NextEntry + 1;
  486. break;
  487. case AP_WAKEUP_TYPE:
  488. ApWakeupDescriptor = (PAP_WAKEUP_DESCRIPTOR)NextEntry;
  489. WakeupVector = (ULONG) ApWakeupDescriptor->WakeupVector;
  490. NextEntry = (PAP_WAKEUP_DESCRIPTOR)NextEntry + 1;
  491. break;
  492. default:
  493. EfiPrint(L"SST: Invalid SST entry\n");
  494. EfiBS->Exit(EfiImageHandle, 0, 0, 0);
  495. }
  496. }
  497. DBG_TRACE(L"GetPalProcEntryPoint: exit\n");
  498. }
  499. ULONG
  500. GetDevPathSize(
  501. IN EFI_DEVICE_PATH *DevPath
  502. )
  503. {
  504. EFI_DEVICE_PATH *Start;
  505. //
  506. // Search for the end of the device path structure
  507. //
  508. Start = DevPath;
  509. while (DevPath->Type != END_DEVICE_PATH_TYPE) {
  510. DevPath = NextDevicePathNode(DevPath);
  511. }
  512. //
  513. // Compute the size
  514. //
  515. return (ULONG)((ULONGLONG)DevPath - (ULONGLONG)Start);
  516. }