ALL CODE IN THE SERIALIO STACK MUST BE RE-ENTRANT AND CALLABLE FROM\r
INTERRUPT CONTEXT\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
(EFI_DEVICE_PATH_PROTOCOL *) NULL,\r
{\r
DebugPortReset,\r
- DebugPortRead, \r
- DebugPortWrite, \r
- DebugPortPoll \r
+ DebugPortRead,\r
+ DebugPortWrite,\r
+ DebugPortPoll\r
},\r
(EFI_HANDLE) 0,\r
(EFI_SERIAL_IO_PROTOCOL *) NULL,\r
}\r
\r
/**\r
- Debug Port Driver entry point. \r
+ Debug Port Driver entry point.\r
\r
Reads DebugPort variable to determine what device and settings to use as the\r
debug port. Binds exclusively to SerialIo. Reverts to defaults if no variable\r
is found.\r
\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
@param[in] SystemTable A pointer to the EFI System Table.\r
- \r
+\r
@retval EFI_SUCCESS The entry point is executed successfully.\r
@retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.\r
@retval other Some error occurs when executing this entry point.\r
}\r
\r
/**\r
- Checks to see if there's not already a DebugPort interface somewhere. \r
+ Checks to see if there's not already a DebugPort interface somewhere.\r
\r
If there's a DEBUGPORT variable, the device path must match exactly. If there's\r
no DEBUGPORT variable, then device path is not checked and does not matter.\r
EFI_HANDLE TempHandle;\r
\r
//\r
- // Check to see that there's not a debugport protocol already published\r
- // Question: Why do we prevent debugport protocol published on more one device?\r
+ // Check to see that there's not a debugport protocol already published,\r
+ // since only one standard UART serial port could be supported by this driver.\r
//\r
if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **) &DebugPortInterface) != EFI_NOT_FOUND) {\r
return EFI_UNSUPPORTED;\r
Status = EFI_UNSUPPORTED;\r
}\r
\r
- if (Status == EFI_SUCCESS && \r
+ if (Status == EFI_SUCCESS &&\r
(Dp2->Type != MESSAGING_DEVICE_PATH ||\r
- Dp2->SubType != MSG_VENDOR_DP || \r
+ Dp2->SubType != MSG_VENDOR_DP ||\r
*((UINT16 *) Dp2->Length) != sizeof (DEBUGPORT_DEVICE_PATH))) {\r
\r
Status = EFI_UNSUPPORTED;\r
}\r
\r
- if (Status == EFI_SUCCESS && CompareMem (&gEfiDebugPortDevicePathGuid, Dp2 + 1, sizeof (EFI_GUID))) {\r
+ if (Status == EFI_SUCCESS && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *) (Dp2 + 1))) {\r
Status = EFI_UNSUPPORTED;\r
}\r
\r
\r
@retval EFI_SUCCESS This driver is added to ControllerHandle.\r
@retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.\r
- @retval others Some error occurs. \r
+ @retval others Some error occurs.\r
\r
**/\r
EFI_STATUS\r
DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH;\r
DebugPortDP.Header.SubType = MSG_VENDOR_DP;\r
SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP));\r
- CopyMem (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid, sizeof (EFI_GUID));\r
+ CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid);\r
\r
Dp1 = DevicePathFromHandle (ControllerHandle);\r
if (Dp1 == NULL) {\r
);\r
\r
if (EFI_ERROR (Status)) {\r
- DEBUG_CODE_BEGIN ();\r
- UINTN BufferSize;\r
-\r
- BufferSize = 48;\r
- DebugPortWrite (\r
- &mDebugPortDevice.DebugPortInterface,\r
- 0,\r
- &BufferSize,\r
- "DebugPort driver failed to open child controller\n\n"\r
- );\r
- DEBUG_CODE_END ();\r
-\r
gBS->CloseProtocol (\r
ControllerHandle,\r
&gEfiSerialIoProtocolGuid,\r
return Status;\r
}\r
\r
- DEBUG_CODE_BEGIN ();\r
- UINTN BufferSize;\r
-\r
- BufferSize = 38;\r
- DebugPortWrite (\r
- &mDebugPortDevice.DebugPortInterface,\r
- 0,\r
- &BufferSize,\r
- "Hello World from the DebugPort driver\n\n"\r
- );\r
-\r
- DEBUG_CODE_END ();\r
-\r
return EFI_SUCCESS;\r
}\r
\r
\r
The port itself should be fine since it was set up during initialization.\r
\r
- @param This Protocol instance pointer. \r
+ @param This Protocol instance pointer.\r
\r
@return EFI_SUCCESS Always.\r
\r
-**/ \r
+**/\r
EFI_STATUS\r
EFIAPI\r
DebugPortReset (\r
On output, the amount of data actually written.\r
@param Buffer Pointer to buffer to read.\r
\r
- @retval EFI_SUCCESS \r
- @retval others \r
+ @retval EFI_SUCCESS\r
+ @retval others\r
\r
**/\r
EFI_STATUS\r
DebugPort interface\r
@retval EFI_DEVICE_ERROR A hardware failure occured... (from SerialIo)\r
\r
-**/ \r
+**/\r
EFI_STATUS\r
EFIAPI\r
DebugPortPoll (\r