From cfcbb8bc5428cf3d86107913be4e33ee323d13c9 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Tue, 30 Dec 2008 07:10:46 +0000 Subject: [PATCH] 1. Use Mde library for Debug Port Module 2. Minimum changed for Debug Support Module. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7153 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/DebugPortDxe/DebugPort.c | 34 +++++++++---------- .../DebugSupportDxe/Ia32/PlDebugSupportIa32.c | 8 +++-- .../DebugSupportDxe/X64/PlDebugSupportX64.c | 11 ++++-- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c index 5881668d7f..a63ef84a30 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c @@ -37,9 +37,9 @@ DEBUGPORT_DEVICE mDebugPortDevice = { (EFI_DEVICE_PATH_PROTOCOL *) NULL, { DebugPortReset, - DebugPortRead, - DebugPortWrite, - DebugPortPoll + DebugPortRead, + DebugPortWrite, + DebugPortPoll }, (EFI_HANDLE) 0, (EFI_SERIAL_IO_PROTOCOL *) NULL, @@ -127,15 +127,15 @@ GetDebugPortVariable ( } /** - Debug Port Driver entry point. + Debug Port Driver entry point. Reads DebugPort variable to determine what device and settings to use as the debug port. Binds exclusively to SerialIo. Reverts to defaults if no variable is found. - @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. - + @retval EFI_SUCCESS The entry point is executed successfully. @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. @retval other Some error occurs when executing this entry point. @@ -167,7 +167,7 @@ InitializeDebugPortDriver ( } /** - Checks to see if there's not already a DebugPort interface somewhere. + Checks to see if there's not already a DebugPort interface somewhere. If there's a DEBUGPORT variable, the device path must match exactly. If there's no DEBUGPORT variable, then device path is not checked and does not matter. @@ -238,15 +238,15 @@ DebugPortSupported ( Status = EFI_UNSUPPORTED; } - if (Status == EFI_SUCCESS && + if (Status == EFI_SUCCESS && (Dp2->Type != MESSAGING_DEVICE_PATH || - Dp2->SubType != MSG_VENDOR_DP || + Dp2->SubType != MSG_VENDOR_DP || *((UINT16 *) Dp2->Length) != sizeof (DEBUGPORT_DEVICE_PATH))) { Status = EFI_UNSUPPORTED; } - if (Status == EFI_SUCCESS && CompareMem (&gEfiDebugPortDevicePathGuid, Dp2 + 1, sizeof (EFI_GUID))) { + if (Status == EFI_SUCCESS && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *) (Dp2 + 1))) { Status = EFI_UNSUPPORTED; } @@ -289,7 +289,7 @@ DebugPortSupported ( @retval EFI_SUCCESS This driver is added to ControllerHandle. @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. - @retval others Some error occurs. + @retval others Some error occurs. **/ EFI_STATUS @@ -365,7 +365,7 @@ DebugPortStart ( DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH; DebugPortDP.Header.SubType = MSG_VENDOR_DP; SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP)); - CopyMem (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid, sizeof (EFI_GUID)); + CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid); Dp1 = DevicePathFromHandle (ControllerHandle); if (Dp1 == NULL) { @@ -547,11 +547,11 @@ DebugPortStop ( The port itself should be fine since it was set up during initialization. - @param This Protocol instance pointer. + @param This Protocol instance pointer. @return EFI_SUCCESS Always. -**/ +**/ EFI_STATUS EFIAPI DebugPortReset ( @@ -579,8 +579,8 @@ DebugPortReset ( On output, the amount of data actually written. @param Buffer Pointer to buffer to read. - @retval EFI_SUCCESS - @retval others + @retval EFI_SUCCESS + @retval others **/ EFI_STATUS @@ -692,7 +692,7 @@ DebugPortWrite ( DebugPort interface @retval EFI_DEVICE_ERROR A hardware failure occured... (from SerialIo) -**/ +**/ EFI_STATUS EFIAPI DebugPortPoll ( diff --git a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupportIa32.c b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupportIa32.c index d2073f65fd..290fea69d5 100644 --- a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupportIa32.c +++ b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/PlDebugSupportIa32.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include "DebugSupport.h" +#include "PlDebugSupport.h" IA32_IDT_GATE_DESCRIPTOR NullDesc = {{0}}; @@ -30,7 +30,11 @@ GetInterruptHandleFromIdt ( ) { UINTN InterruptHandle; - + + // + // InterruptHandle 0-15 : OffsetLow + // InterruptHandle 16-31 : OffsetHigh + // ((UINT16 *) &InterruptHandle)[0] = (UINT16) IdtGateDescriptor->Bits.OffsetLow; ((UINT16 *) &InterruptHandle)[1] = (UINT16) IdtGateDescriptor->Bits.OffsetHigh; diff --git a/MdeModulePkg/Universal/DebugSupportDxe/X64/PlDebugSupportX64.c b/MdeModulePkg/Universal/DebugSupportDxe/X64/PlDebugSupportX64.c index 3143bafee7..1a0aeb1901 100644 --- a/MdeModulePkg/Universal/DebugSupportDxe/X64/PlDebugSupportX64.c +++ b/MdeModulePkg/Universal/DebugSupportDxe/X64/PlDebugSupportX64.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include "DebugSupport.h" +#include "PlDebugSupport.h" IA32_IDT_GATE_DESCRIPTOR NullDesc = {{0,0}}; @@ -30,7 +30,12 @@ GetInterruptHandleFromIdt ( ) { UINTN InterruptHandle; - + + // + // InterruptHandle 0-15 : OffsetLow + // InterruptHandle 16-31 : OffsetHigh + // InterruptHandle 32-63 : OffsetUpper + // ((UINT16 *) &InterruptHandle)[0] = (UINT16) IdtGateDecriptor->Bits.OffsetLow; ((UINT16 *) &InterruptHandle)[1] = (UINT16) IdtGateDecriptor->Bits.OffsetHigh; ((UINT32 *) &InterruptHandle)[1] = (UINT32) IdtGateDecriptor->Bits.OffsetUpper; @@ -136,6 +141,6 @@ ManageIdtEntryTable ( HookEntry (ExceptionType, NewCallback); } } - + return Status; } -- 2.39.2