forked from xt-sys/exectos
Unify variable types across project; use common type for storing numer of pages
This commit is contained in:
@@ -95,7 +95,7 @@ BlEnableConsoleCursor()
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
BlConsolePrint(IN PUINT16 Format,
|
||||
BlConsolePrint(IN PUSHORT Format,
|
||||
IN ...)
|
||||
{
|
||||
VA_LIST Arguments;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
BlDebugPrint(IN PUINT16 Format,
|
||||
BlDebugPrint(IN PUSHORT Format,
|
||||
IN ...)
|
||||
{
|
||||
VA_LIST Arguments;
|
||||
|
@@ -27,7 +27,7 @@ BlpActivateSerialIOController()
|
||||
PEFI_HANDLE PciHandle = NULL;
|
||||
PCI_COMMON_HEADER PciHeader;
|
||||
EFI_STATUS Status;
|
||||
UINT64 Address;
|
||||
ULONGLONG Address;
|
||||
|
||||
/* Allocate memory for single EFI_HANDLE, what should be enough in most cases */
|
||||
PciHandleSize = sizeof(EFI_HANDLE);
|
||||
@@ -83,9 +83,9 @@ BlpActivateSerialIOController()
|
||||
for(Function = 0; Function < PCI_MAX_FUNCTION; Function++)
|
||||
{
|
||||
/* Read configuration space */
|
||||
Address = ((UINT64)((((UINT_PTR) Bus) << 24) + (((UINT_PTR) Device) << 16) +
|
||||
(((UINT_PTR) Function) << 8) + ((UINT_PTR) 0)));
|
||||
PciDev->Pci.Read(PciDev, 2, Address, sizeof (PciHeader) / sizeof (UINT32), &PciHeader);
|
||||
Address = ((ULONGLONG)((((UINT_PTR) Bus) << 24) + (((UINT_PTR) Device) << 16) +
|
||||
(((UINT_PTR) Function) << 8) + ((UINT_PTR) 0)));
|
||||
PciDev->Pci.Read(PciDev, 2, Address, sizeof (PciHeader) / sizeof (UINT), &PciHeader);
|
||||
|
||||
/* Check if device exists */
|
||||
if(PciHeader.VendorId == PCI_INVALID_VENDORID)
|
||||
|
@@ -21,7 +21,7 @@ typedef VOID (BLPRINTCHAR)(IN USHORT Character);
|
||||
/* XTLDR routines forward references */
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlAllocateMemoryPages(IN UINT64 Pages,
|
||||
BlAllocateMemoryPages(IN ULONGLONG Pages,
|
||||
OUT PEFI_PHYSICAL_ADDRESS Memory);
|
||||
|
||||
XTCDECL
|
||||
@@ -52,7 +52,7 @@ BlCloseVolume(IN PEFI_HANDLE VolumeHandle);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlConsolePrint(IN PUINT16 Format,
|
||||
BlConsolePrint(IN PUSHORT Format,
|
||||
IN ...);
|
||||
|
||||
XTCDECL
|
||||
@@ -61,7 +61,7 @@ BlConsoleWrite(IN PUSHORT String);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlDebugPrint(IN PUINT16 Format,
|
||||
BlDebugPrint(IN PUSHORT Format,
|
||||
IN ...);
|
||||
|
||||
XTCDECL
|
||||
@@ -119,7 +119,7 @@ BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlFreeMemoryPages(IN UINT64 Pages,
|
||||
BlFreeMemoryPages(IN ULONGLONG Pages,
|
||||
IN EFI_PHYSICAL_ADDRESS Memory);
|
||||
|
||||
XTCDECL
|
||||
@@ -226,7 +226,7 @@ EFI_STATUS
|
||||
BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
IN PVOID VirtualAddress,
|
||||
IN PVOID PhysicalAddress,
|
||||
IN UINT NumberOfPages,
|
||||
IN ULONGLONG NumberOfPages,
|
||||
IN LOADER_MEMORY_TYPE MemoryType);
|
||||
|
||||
XTCDECL
|
||||
@@ -469,13 +469,13 @@ BlpReadConfigFile(IN CONST PWCHAR ConfigDirectory,
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpStringFormat(IN BLPRINTCHAR PrintCharRoutine,
|
||||
IN PUINT16 Format,
|
||||
IN PUSHORT Format,
|
||||
IN ...);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
IN PUINT16 Format,
|
||||
IN PUSHORT Format,
|
||||
IN VA_LIST Arguments);
|
||||
|
||||
XTCDECL
|
||||
@@ -505,8 +505,8 @@ BlpStringPrintUnsigned64(IN BLPRINTCHAR PrintCharRoutine,
|
||||
IN UINT_PTR Padding);
|
||||
|
||||
XTCDECL
|
||||
UINT64
|
||||
BlpStringReadPadding(IN PUINT16 *Format);
|
||||
ULONGLONG
|
||||
BlpStringReadPadding(IN PUSHORT *Format);
|
||||
|
||||
XTCDECL
|
||||
VOID
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlAllocateMemoryPages(IN UINT64 Pages,
|
||||
BlAllocateMemoryPages(IN ULONGLONG Pages,
|
||||
OUT PEFI_PHYSICAL_ADDRESS Memory)
|
||||
{
|
||||
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, Pages, Memory);
|
||||
@@ -67,7 +67,7 @@ BlAllocateMemoryPool(IN UINT_PTR Size,
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlFreeMemoryPages(IN UINT64 Pages,
|
||||
BlFreeMemoryPages(IN ULONGLONG Pages,
|
||||
IN EFI_PHYSICAL_ADDRESS Memory)
|
||||
{
|
||||
return EfiSystemTable->BootServices->FreePages(Memory, Pages);
|
||||
@@ -328,7 +328,7 @@ EFI_STATUS
|
||||
BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
IN PVOID VirtualAddress,
|
||||
IN PVOID PhysicalAddress,
|
||||
IN UINT NumberOfPages,
|
||||
IN ULONGLONG NumberOfPages,
|
||||
IN LOADER_MEMORY_TYPE MemoryType)
|
||||
{
|
||||
PLOADER_MEMORY_MAPPING Mapping1, Mapping2, Mapping3;
|
||||
@@ -352,7 +352,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
Mapping1->MemoryType = MemoryType;
|
||||
|
||||
/* Calculate the end of the physical address */
|
||||
PhysicalAddressEnd = (PUINT8)PhysicalAddress + (NumberOfPages * EFI_PAGE_SIZE) - 1;
|
||||
PhysicalAddressEnd = (PUCHAR)PhysicalAddress + (NumberOfPages * EFI_PAGE_SIZE) - 1;
|
||||
|
||||
/* Iterate through all the mappings already set to insert new mapping at the correct place */
|
||||
ListEntry = PageMap->MemoryMap.Flink;
|
||||
@@ -360,7 +360,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
{
|
||||
/* Take a mapping from the list and calculate its end of physical address */
|
||||
Mapping2 = CONTAIN_RECORD(ListEntry, LOADER_MEMORY_MAPPING, ListEntry);
|
||||
PhysicalAddress2End = (PUINT8)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1 ;
|
||||
PhysicalAddress2End = (PUCHAR)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1 ;
|
||||
|
||||
/* Check if new mapping is a subset of an existing mapping */
|
||||
if(Mapping1->PhysicalAddress >= Mapping2->PhysicalAddress && PhysicalAddressEnd <= PhysicalAddress2End)
|
||||
@@ -384,7 +384,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
}
|
||||
|
||||
/* Calculate number of pages for this mapping */
|
||||
NumberOfMappedPages = ((PUINT8)PhysicalAddress2End - (PUINT8)PhysicalAddressEnd) / EFI_PAGE_SIZE;
|
||||
NumberOfMappedPages = ((PUCHAR)PhysicalAddress2End - (PUCHAR)PhysicalAddressEnd) / EFI_PAGE_SIZE;
|
||||
if(NumberOfMappedPages > 0)
|
||||
{
|
||||
/* Pages associated to the mapping, allocate memory for it */
|
||||
@@ -396,7 +396,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
}
|
||||
|
||||
/* Set mapping fields and insert it on the top */
|
||||
Mapping3->PhysicalAddress = (PUINT8)PhysicalAddressEnd + 1;
|
||||
Mapping3->PhysicalAddress = (PUCHAR)PhysicalAddressEnd + 1;
|
||||
Mapping3->VirtualAddress = NULL;
|
||||
Mapping3->NumberOfPages = NumberOfMappedPages;
|
||||
Mapping3->MemoryType = Mapping2->MemoryType;
|
||||
@@ -404,9 +404,9 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
}
|
||||
|
||||
/* Calculate number of pages and the end of the physical address */
|
||||
Mapping2->NumberOfPages = ((PUINT8)PhysicalAddressEnd + 1 -
|
||||
(PUINT8)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE;
|
||||
PhysicalAddress2End = (PUINT8)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1;
|
||||
Mapping2->NumberOfPages = ((PUCHAR)PhysicalAddressEnd + 1 -
|
||||
(PUCHAR)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE;
|
||||
PhysicalAddress2End = (PUCHAR)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1;
|
||||
}
|
||||
|
||||
/* Check if they overlap */
|
||||
@@ -420,7 +420,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
}
|
||||
|
||||
/* Calculate number of pages for this mapping */
|
||||
NumberOfMappedPages = ((PUINT8)PhysicalAddress2End + 1 - (PUINT8)Mapping1->PhysicalAddress) / EFI_PAGE_SIZE;
|
||||
NumberOfMappedPages = ((PUCHAR)PhysicalAddress2End + 1 - (PUCHAR)Mapping1->PhysicalAddress) / EFI_PAGE_SIZE;
|
||||
if(NumberOfMappedPages > 0)
|
||||
{
|
||||
/* Pages associated to the mapping, allocate memory for it */
|
||||
@@ -440,9 +440,9 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
}
|
||||
|
||||
/* Calculate number of pages and the end of the physical address */
|
||||
Mapping2->NumberOfPages = ((PUINT8)Mapping1->PhysicalAddress -
|
||||
(PUINT8)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE;
|
||||
PhysicalAddress2End = (PUINT8)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1;
|
||||
Mapping2->NumberOfPages = ((PUCHAR)Mapping1->PhysicalAddress -
|
||||
(PUCHAR)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE;
|
||||
PhysicalAddress2End = (PUCHAR)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1;
|
||||
}
|
||||
|
||||
/* Check if mapping is really needed */
|
||||
|
@@ -28,7 +28,7 @@
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
IN PUINT16 Format,
|
||||
IN PUSHORT Format,
|
||||
IN VA_LIST Arguments)
|
||||
{
|
||||
PEFI_GUID Guid;
|
||||
@@ -46,7 +46,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
{
|
||||
case L'b':
|
||||
/* Boolean */
|
||||
BlpStringFormat(PrintCharRoutine, L"%s", VA_ARG(Arguments, INT32) ? "TRUE" : "FALSE");
|
||||
BlpStringFormat(PrintCharRoutine, L"%s", VA_ARG(Arguments, INT) ? "TRUE" : "FALSE");
|
||||
break;
|
||||
case L'c':
|
||||
/* Character */
|
||||
@@ -54,7 +54,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
break;
|
||||
case L'd':
|
||||
/* Signed 32-bit integer */
|
||||
BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT32), 10);
|
||||
BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT), 10);
|
||||
break;
|
||||
case L'g':
|
||||
/* EFI GUID */
|
||||
@@ -106,11 +106,11 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
break;
|
||||
case L'u':
|
||||
/* Unsigned 32-bit integer */
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, 0);
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 10, 0);
|
||||
break;
|
||||
case L'x':
|
||||
/* Unsigned 32-bit hexadecimal integer */
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, 0);
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 16, 0);
|
||||
break;
|
||||
case L'0':
|
||||
/* Zero padded numbers */
|
||||
@@ -120,7 +120,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
{
|
||||
case L'd':
|
||||
/* Zero-padded, signed 32-bit integer */
|
||||
BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT32), 10);
|
||||
BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT), 10);
|
||||
break;
|
||||
case L'l':
|
||||
/* 64-bit numbers */
|
||||
@@ -146,11 +146,11 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
break;
|
||||
case L'u':
|
||||
/* Zero-padded, unsigned 32-bit integer */
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, PaddingCount);
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 10, PaddingCount);
|
||||
break;
|
||||
case L'x':
|
||||
/* Zero-padded, unsigned 32-bit hexadecimal integer */
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, PaddingCount);
|
||||
BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 16, PaddingCount);
|
||||
break;
|
||||
default:
|
||||
/* Unknown by default */
|
||||
@@ -203,7 +203,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine,
|
||||
XTCDECL
|
||||
VOID
|
||||
BlpStringFormat(IN BLPRINTCHAR PrintCharRoutine,
|
||||
IN PUINT16 Format,
|
||||
IN PUSHORT Format,
|
||||
IN ...)
|
||||
{
|
||||
VA_LIST Arguments;
|
||||
@@ -371,9 +371,9 @@ BlpStringPrintUnsigned64(IN BLPRINTCHAR PrintCharRoutine,
|
||||
IN UINT_PTR Base,
|
||||
IN UINT_PTR Padding)
|
||||
{
|
||||
UINT16 Buffer[20];
|
||||
USHORT Buffer[20];
|
||||
UINT_PTR NumberLength;
|
||||
PUINT16 Pointer;
|
||||
PUSHORT Pointer;
|
||||
|
||||
/* Set pointer to the end of buffer */
|
||||
Pointer = Buffer + ARRAY_SIZE(Buffer);
|
||||
@@ -417,11 +417,11 @@ BlpStringPrintUnsigned64(IN BLPRINTCHAR PrintCharRoutine,
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
UINT64
|
||||
BlpStringReadPadding(IN PUINT16 *Format)
|
||||
ULONGLONG
|
||||
BlpStringReadPadding(IN PUSHORT *Format)
|
||||
{
|
||||
ULONG Count = 0;
|
||||
PUINT16 Fmt = *Format;
|
||||
PUSHORT Fmt = *Format;
|
||||
|
||||
/* Read the padding */
|
||||
for(;; ++Fmt)
|
||||
|
@@ -922,12 +922,12 @@ BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath)
|
||||
/* Get the device path length */
|
||||
while(TRUE)
|
||||
{
|
||||
Length += *(PUINT16)DevicePath->Length;
|
||||
Length += *(PUSHORT)DevicePath->Length;
|
||||
if(DevicePathNode->Type == EFI_END_DEVICE_PATH)
|
||||
{
|
||||
break;
|
||||
}
|
||||
DevicePathNode = (PEFI_DEVICE_PATH_PROTOCOL)((PUCHAR)DevicePathNode + *(PUINT16)DevicePath->Length);
|
||||
DevicePathNode = (PEFI_DEVICE_PATH_PROTOCOL)((PUCHAR)DevicePathNode + *(PUSHORT)DevicePath->Length);
|
||||
}
|
||||
|
||||
/* Check length */
|
||||
@@ -1044,8 +1044,8 @@ BlpFindParentBlockDevice(IN PLIST_ENTRY BlockDevices,
|
||||
}
|
||||
|
||||
/* Get child and parent node lengths */
|
||||
ChildLength = *(PUINT16)ChildDevicePath->Length;
|
||||
ParentLength = *(PUINT16)ParentDevicePath->Length;
|
||||
ChildLength = *(PUSHORT)ChildDevicePath->Length;
|
||||
ParentLength = *(PUSHORT)ParentDevicePath->Length;
|
||||
|
||||
/* Check if lengths match */
|
||||
if(ChildLength != ParentLength)
|
||||
|
Reference in New Issue
Block a user