Skip to content

Commit

Permalink
OpenLegacyBoot: Fix prefix on debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldfish64 committed Aug 14, 2023
1 parent 667d9c3 commit d5de545
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Platform/OpenLegacyBoot/BiosDisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ BiosDiskReset (
CarryFlag = OcLegacyThunkBiosInt86 (ThunkContext, Legacy8259, 0x13, &Regs);

if (CarryFlag != 0) {
DEBUG ((DEBUG_WARN, "LEG: Failed to reset BIOS disk %u, error 0x%X\n", DriveNumber, Regs.H.AL));
DEBUG ((DEBUG_WARN, "OLB: Failed to reset BIOS disk %u, error 0x%X\n", DriveNumber, Regs.H.AL));
if (Regs.H.AL == BIOS_RESET_FAILED) {
Regs.H.AH = 0x00;
Regs.H.DL = DriveNumber;
CarryFlag = OcLegacyThunkBiosInt86 (ThunkContext, Legacy8259, 0x13, &Regs);
if (CarryFlag != 0) {
DEBUG ((DEBUG_WARN, "LEG: Failed to reset BIOS disk %u, error 0x%X\n", DriveNumber, Regs.H.AH));
DEBUG ((DEBUG_WARN, "OLB: Failed to reset BIOS disk %u, error 0x%X\n", DriveNumber, Regs.H.AH));
return EFI_DEVICE_ERROR;
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ InternalGetBiosDiskNumber (
&DeviceAddressPacketAddress
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Failure allocating low memory packet for BIOS disk read - %r\n", Status));
DEBUG ((DEBUG_WARN, "OLB: Failure allocating low memory packet for BIOS disk read - %r\n", Status));
return Status;
}

Expand Down
27 changes: 14 additions & 13 deletions Platform/OpenLegacyBoot/LegacyBootSupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ InternalLoadAppleLegacyInterface (
return EFI_INVALID_PARAMETER;
}

DebugPrintDevicePath (DEBUG_INFO, "OCB: Legacy disk device path", WholeDiskPath);
DebugPrintDevicePath (DEBUG_INFO, "OLB: Legacy disk device path", WholeDiskPath);

// TODO: Mark target partition as active on pure MBR and hybrid GPT disks.
// Macs only boot the active partition.
Expand Down Expand Up @@ -227,7 +227,7 @@ InternalLoadAppleLegacyInterface (
UnicodeDevicePath = ConvertDevicePathToText (LegacyDevicePaths[Index], FALSE, FALSE);
DEBUG ((
DEBUG_INFO,
"OCB: Loaded Apple legacy interface at dp %s - %r\n",
"OLB: Loaded Apple legacy interface at dp %s - %r\n",
UnicodeDevicePath != NULL ? UnicodeDevicePath : L"<null>",
Status
));
Expand Down Expand Up @@ -271,7 +271,7 @@ InternalGetPartitionLegacyOsType (
return OcLegacyOsTypeNone;
}

DebugPrintDevicePath (DEBUG_INFO, "OCB: Reading MBR for disk", DevicePath);
DebugPrintDevicePath (DEBUG_INFO, "OLB: Reading MBR for disk", DevicePath);

DiskHandle = OcPartitionGetDiskHandle (DevicePath);
if (DiskHandle == NULL) {
Expand All @@ -280,7 +280,7 @@ InternalGetPartitionLegacyOsType (

Mbr = OcGetDiskMbrTable (DiskHandle, TRUE);
if (Mbr == NULL) {
DEBUG ((DEBUG_INFO, "OCB: Disk does not contain a valid MBR partition table\n"));
DEBUG ((DEBUG_INFO, "OLB: Disk does not contain a valid MBR partition table\n"));
return OcLegacyOsTypeNone;
}

Expand All @@ -293,7 +293,7 @@ InternalGetPartitionLegacyOsType (
//
// Retrieve the first sector of the partition.
//
DebugPrintDevicePath (DEBUG_INFO, "OCB: Reading PBR for partition", DevicePath);
DebugPrintDevicePath (DEBUG_INFO, "OLB: Reading PBR for partition", DevicePath);
Status = OcDiskInitializeContext (
&DiskContext,
PartitionHandle,
Expand All @@ -306,7 +306,7 @@ InternalGetPartitionLegacyOsType (
MbrSize = ALIGN_VALUE (sizeof (*Mbr), DiskContext.BlockSize);
Mbr = (MASTER_BOOT_RECORD *)AllocatePool (MbrSize);
if (Mbr == NULL) {
DEBUG ((DEBUG_INFO, "OCB: Buffer allocation error\n"));
DEBUG ((DEBUG_INFO, "OLB: Buffer allocation error\n"));
return OcLegacyOsTypeNone;
}

Expand All @@ -322,7 +322,7 @@ InternalGetPartitionLegacyOsType (
}
}

DebugPrintHexDump (DEBUG_INFO, "OCB: MbrHEX", Mbr->BootStrapCode, sizeof (Mbr->BootStrapCode));
DebugPrintHexDump (DEBUG_INFO, "OLB: MbrHEX", Mbr->BootStrapCode, sizeof (Mbr->BootStrapCode));

//
// Validate signature in MBR.
Expand All @@ -346,7 +346,7 @@ InternalGetPartitionLegacyOsType (
LegacyOsType = OcLegacyOsTypeIsoLinux;
} else {
LegacyOsType = OcLegacyOsTypeNone;
DEBUG ((DEBUG_INFO, "OCB: Unknown legacy bootsector signature\n"));
DEBUG ((DEBUG_INFO, "OLB: Unknown legacy bootsector signature\n"));
}

FreePool (Mbr);
Expand Down Expand Up @@ -381,7 +381,7 @@ InternalLoadLegacyPbr (
(VOID **)&Legacy8259
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "LEG: Could not locate Legacy8259 protocol\n"));
DEBUG ((DEBUG_INFO, "OLB: Could not locate Legacy8259 protocol\n"));
return Status;
}

Expand All @@ -400,7 +400,7 @@ InternalLoadLegacyPbr (
PbrSize = ALIGN_VALUE (sizeof (*Pbr), DiskContext.BlockSize);
Pbr = (MASTER_BOOT_RECORD *)AllocatePool (PbrSize);
if (Pbr == NULL) {
DEBUG ((DEBUG_INFO, "LEG: Buffer allocation error\n"));
DEBUG ((DEBUG_INFO, "OLB: Buffer allocation error\n"));
return EFI_OUT_OF_RESOURCES;
}

Expand All @@ -415,7 +415,7 @@ InternalLoadLegacyPbr (
return Status;
}

DebugPrintHexDump (DEBUG_INFO, "LEG: PbrHEX", (UINT8 *)Pbr, sizeof (*Pbr));
DebugPrintHexDump (DEBUG_INFO, "OLB: PbrHEX", (UINT8 *)Pbr, sizeof (*Pbr));

//
// Retrieve MBR from disk.
Expand All @@ -428,7 +428,7 @@ InternalLoadLegacyPbr (

Mbr = OcGetDiskMbrTable (DiskHandle, TRUE);
if (Mbr == NULL) {
DEBUG ((DEBUG_INFO, "LEG: Disk does not contain a valid MBR partition table\n"));
DEBUG ((DEBUG_INFO, "OLB: Disk does not contain a valid MBR partition table\n"));
FreePool (Pbr);
return EFI_INVALID_PARAMETER;
}
Expand Down Expand Up @@ -461,9 +461,10 @@ InternalLoadLegacyPbr (
CopyMem (PbrPtr, Pbr, sizeof (*Pbr));
CopyMem (MbrPtr, Mbr, sizeof (*Mbr));

DebugPrintHexDump (DEBUG_INFO, "LEG: PbrPtr", (UINT8 *)PbrPtr, sizeof (*PbrPtr));
DebugPrintHexDump (DEBUG_INFO, "OLB: PbrPtr", (UINT8 *)PbrPtr, sizeof (*PbrPtr));

OcLegacyThunkDisconnectEfiGraphics ();
ReleaseUsbOwnership ();

//
// Thunk to real mode and invoke legacy boot sector.
Expand Down
18 changes: 9 additions & 9 deletions Platform/OpenLegacyBoot/OpenLegacyBoot.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ ExternalSystemActionDoLegacyBoot (
// On Macs, use the Apple legacy interface.
// On other systems, use the Legacy8259 protocol.
//
DebugPrintDevicePath (DEBUG_INFO, "LEG: Legacy device path", DevicePath);
DebugPrintDevicePath (DEBUG_INFO, "OLB: Legacy device path", DevicePath);
if (mIsAppleInterfaceSupported) {
Status = InternalLoadAppleLegacyInterface (
mImageHandle,
DevicePath,
&LoadedImageHandle
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Failure while loading Apple legacy interface - %r\n", Status));
DEBUG ((DEBUG_WARN, "OLB: Failure while loading Apple legacy interface - %r\n", Status));
return Status;
}

Expand All @@ -75,7 +75,7 @@ ExternalSystemActionDoLegacyBoot (
(VOID **)&LoadedImage
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Failure while loading Apple legacy interface - %r\n", Status));
DEBUG ((DEBUG_WARN, "OLB: Failure while loading Apple legacy interface - %r\n", Status));
return Status;
}

Expand All @@ -94,7 +94,7 @@ ExternalSystemActionDoLegacyBoot (
));
Status = gBS->StartImage (LoadedImageHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Failure while starting Apple legacy interface - %r\n", Status));
DEBUG ((DEBUG_WARN, "OLB: Failure while starting Apple legacy interface - %r\n", Status));
return Status;
}
} else {
Expand Down Expand Up @@ -139,7 +139,7 @@ OcGetLegacyBootEntries (
(VOID **)&FileSystem
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Missing filesystem - %r\n", Status));
DEBUG ((DEBUG_WARN, "OLB: Missing filesystem - %r\n", Status));
return Status;
}
Expand All @@ -151,7 +151,7 @@ OcGetLegacyBootEntries (
&RootDirectory
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Invalid root volume - %r\n", Status));
DEBUG ((DEBUG_WARN, "OLB: Invalid root volume - %r\n", Status));
return Status;
}
Expand All @@ -161,7 +161,7 @@ OcGetLegacyBootEntries (
// Disallow all but NTFS filesystems.
//
// if ((FileSystemPolicy & OC_SCAN_ALLOW_FS_NTFS) != 0) {
// DEBUG ((DEBUG_INFO, "LEG: Not scanning non-NTFS filesystem\n"));
// DEBUG ((DEBUG_INFO, "OLB: Not scanning non-NTFS filesystem\n"));
// Status = EFI_NOT_FOUND;
// }

Expand Down Expand Up @@ -242,11 +242,11 @@ UefiMain (

Status = InternalIsLegacyInterfaceSupported (&mIsAppleInterfaceSupported);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "LEG: Legacy boot interface is supported on this system\n"));
DEBUG ((DEBUG_WARN, "OLB: Legacy boot interface is supported on this system\n"));
return Status;
}

DEBUG ((DEBUG_INFO, "LEG: Apple legacy interface: %d\n", mIsAppleInterfaceSupported));
DEBUG ((DEBUG_INFO, "OLB: Apple legacy interface: %d\n", mIsAppleInterfaceSupported));

Status = gBS->InstallMultipleProtocolInterfaces (
&ImageHandle,
Expand Down

0 comments on commit d5de545

Please sign in to comment.