]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg
authorStar Zeng <star.zeng@intel.com>
Thu, 26 Nov 2015 08:52:12 +0000 (08:52 +0000)
committerlzeng14 <lzeng14@Edk2>
Thu, 26 Nov 2015 08:52:12 +0000 (08:52 +0000)
Beyond just changing the directly related lines in the FDF and DSC files,
we have to adapt the EarlyFdtPL011SerialPortLib and FdtPL011SerialPortLib
instances as well, in the same patch. This is because the EmbeddedPkg
driver expects the SerialPortSetAttributes(),
SerialPortSetControl() and SerialPortGetControl() functions from
SerialPortExtLib, while the MdeModulePkg driver expects them from
SerialPortLib itself.

We cannot implement these functions in ArmVirtPkg's SerialPortLib
instances *before* flipping the driver, because it would cause double
function definitions in the EmbeddedPkg driver. We also can't implement
the functions *after* flipping the driver, because it would cause
unresolved function references in the MdeModulePkg driver. Therefore
we have to implement the functions simultaneously with the driver
replacement.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18973 6f19259b-4bc3-4df7-8a09-765794883524

ArmVirtPkg/ArmVirt.dsc.inc
ArmVirtPkg/ArmVirtQemu.dsc
ArmVirtPkg/ArmVirtQemu.fdf
ArmVirtPkg/ArmVirtXen.dsc
ArmVirtPkg/ArmVirtXen.fdf
ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

index 8626919f3a2c35426ee541eee28b18ef27004290..b5821a8d5ca1524c71f784c1948e3a693ac6281b 100644 (file)
   # ARM PL011 UART Driver\r
   PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf\r
   SerialPortLib|ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf\r
-  SerialPortExtLib|EmbeddedPkg/Library/SerialPortExtLibNull/SerialPortExtLibNull.inf\r
 \r
   #\r
   # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window\r
index 3e4dd229edb04e369f888bd4d3bd68fb1a467be3..e7bc56ef744911f6187bf60fc2771f72017aed82 100644 (file)
   MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf\r
   MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf\r
   MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf\r
-  EmbeddedPkg/SerialDxe/SerialDxe.inf\r
+  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf\r
 \r
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf\r
 \r
index 89a4015e595b0308e51f6d41318d6d4ea8cfbd45..738e3db57045697e8362ae0d2ef887da19b6b458 100644 (file)
@@ -134,7 +134,7 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf\r
   INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf\r
   INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf\r
-  INF EmbeddedPkg/SerialDxe/SerialDxe.inf\r
+  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf\r
 \r
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf\r
   INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf\r
index ac37cd2a43453544dd750340e88d6840ef5420db..32e0afc0cedc56dd3b17943179871a4263c24b91 100644 (file)
@@ -1,6 +1,7 @@
 #\r
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+#  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 \r
   MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf\r
   MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf\r
-  EmbeddedPkg/SerialDxe/SerialDxe.inf\r
+  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf\r
 \r
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf\r
 \r
index 97cab4b058f24d5bbf529f6e28010829331e49aa..729014753fa13c60b4182fefa38df709a311d1a4 100644 (file)
@@ -1,6 +1,7 @@
 #\r
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+#  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -134,7 +135,7 @@ READ_LOCK_STATUS   = TRUE
   #\r
   INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf\r
   INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf\r
-  INF EmbeddedPkg/SerialDxe/SerialDxe.inf\r
+  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf\r
 \r
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf\r
   INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf\r
index ba6d277d4571fc035db77ee6fad260b4f98bd489..c8bfb2972eb9fc5c1607f66fd05fbea7a4c23bf5 100644 (file)
@@ -4,6 +4,7 @@
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
   Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.<BR>\r
   Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,7 +20,6 @@
 \r
 #include <Library/PcdLib.h>\r
 #include <Library/SerialPortLib.h>\r
-#include <Library/SerialPortExtLib.h>\r
 #include <libfdt.h>\r
 \r
 #include <Drivers/PL011Uart.h>\r
@@ -183,3 +183,89 @@ SerialPortPoll (
 {\r
   return FALSE;\r
 }\r
+\r
+/**\r
+  Sets the control bits on a serial device.\r
+\r
+  @param[in] Control            Sets the bits of Control that are settable.\r
+\r
+  @retval RETURN_SUCCESS        The new control bits were set on the serial device.\r
+  @retval RETURN_UNSUPPORTED    The serial device does not support this operation.\r
+  @retval RETURN_DEVICE_ERROR   The serial device is not functioning correctly.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SerialPortSetControl (\r
+  IN UINT32 Control\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Retrieve the status of the control bits on a serial device.\r
+\r
+  @param[out] Control           A pointer to return the current control signals from the serial device.\r
+\r
+  @retval RETURN_SUCCESS        The control bits were read from the serial device.\r
+  @retval RETURN_UNSUPPORTED    The serial device does not support this operation.\r
+  @retval RETURN_DEVICE_ERROR   The serial device is not functioning correctly.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SerialPortGetControl (\r
+  OUT UINT32 *Control\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,\r
+  data bits, and stop bits on a serial device.\r
+\r
+  @param BaudRate           The requested baud rate. A BaudRate value of 0 will use the\r
+                            device's default interface speed.\r
+                            On output, the value actually set.\r
+  @param ReveiveFifoDepth   The requested depth of the FIFO on the receive side of the\r
+                            serial interface. A ReceiveFifoDepth value of 0 will use\r
+                            the device's default FIFO depth.\r
+                            On output, the value actually set.\r
+  @param Timeout            The requested time out for a single character in microseconds.\r
+                            This timeout applies to both the transmit and receive side of the\r
+                            interface. A Timeout value of 0 will use the device's default time\r
+                            out value.\r
+                            On output, the value actually set.\r
+  @param Parity             The type of parity to use on this serial device. A Parity value of\r
+                            DefaultParity will use the device's default parity value.\r
+                            On output, the value actually set.\r
+  @param DataBits           The number of data bits to use on the serial device. A DataBits\r
+                            vaule of 0 will use the device's default data bit setting.\r
+                            On output, the value actually set.\r
+  @param StopBits           The number of stop bits to use on this serial device. A StopBits\r
+                            value of DefaultStopBits will use the device's default number of\r
+                            stop bits.\r
+                            On output, the value actually set.\r
+\r
+  @retval RETURN_SUCCESS            The new attributes were set on the serial device.\r
+  @retval RETURN_UNSUPPORTED        The serial device does not support this operation.\r
+  @retval RETURN_INVALID_PARAMETER  One or more of the attributes has an unsupported value.\r
+  @retval RETURN_DEVICE_ERROR       The serial device is not functioning correctly.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SerialPortSetAttributes (\r
+  IN OUT UINT64             *BaudRate,\r
+  IN OUT UINT32             *ReceiveFifoDepth,\r
+  IN OUT UINT32             *Timeout,\r
+  IN OUT EFI_PARITY_TYPE    *Parity,\r
+  IN OUT UINT8              *DataBits,\r
+  IN OUT EFI_STOP_BITS_TYPE *StopBits\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r
index aced6666a913ba5482063402cc9fce82650e9cc6..b73ab8f48a9df7f0924cd9a5f7bc6e0f16f3151f 100644 (file)
@@ -5,6 +5,7 @@
   Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.<BR>\r
   Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>\r
   Copyright (c) 2014, Red Hat, Inc.<BR>\r
+  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -148,3 +149,89 @@ SerialPortPoll (
   }\r
   return FALSE;\r
 }\r
+\r
+/**\r
+  Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,\r
+  data bits, and stop bits on a serial device.\r
+\r
+  @param BaudRate           The requested baud rate. A BaudRate value of 0 will use the\r
+                            device's default interface speed.\r
+                            On output, the value actually set.\r
+  @param ReveiveFifoDepth   The requested depth of the FIFO on the receive side of the\r
+                            serial interface. A ReceiveFifoDepth value of 0 will use\r
+                            the device's default FIFO depth.\r
+                            On output, the value actually set.\r
+  @param Timeout            The requested time out for a single character in microseconds.\r
+                            This timeout applies to both the transmit and receive side of the\r
+                            interface. A Timeout value of 0 will use the device's default time\r
+                            out value.\r
+                            On output, the value actually set.\r
+  @param Parity             The type of parity to use on this serial device. A Parity value of\r
+                            DefaultParity will use the device's default parity value.\r
+                            On output, the value actually set.\r
+  @param DataBits           The number of data bits to use on the serial device. A DataBits\r
+                            vaule of 0 will use the device's default data bit setting.\r
+                            On output, the value actually set.\r
+  @param StopBits           The number of stop bits to use on this serial device. A StopBits\r
+                            value of DefaultStopBits will use the device's default number of\r
+                            stop bits.\r
+                            On output, the value actually set.\r
+\r
+  @retval RETURN_SUCCESS            The new attributes were set on the serial device.\r
+  @retval RETURN_UNSUPPORTED        The serial device does not support this operation.\r
+  @retval RETURN_INVALID_PARAMETER  One or more of the attributes has an unsupported value.\r
+  @retval RETURN_DEVICE_ERROR       The serial device is not functioning correctly.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SerialPortSetAttributes (\r
+  IN OUT UINT64             *BaudRate,\r
+  IN OUT UINT32             *ReceiveFifoDepth,\r
+  IN OUT UINT32             *Timeout,\r
+  IN OUT EFI_PARITY_TYPE    *Parity,\r
+  IN OUT UINT8              *DataBits,\r
+  IN OUT EFI_STOP_BITS_TYPE *StopBits\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Sets the control bits on a serial device.\r
+\r
+  @param Control                Sets the bits of Control that are settable.\r
+\r
+  @retval RETURN_SUCCESS        The new control bits were set on the serial device.\r
+  @retval RETURN_UNSUPPORTED    The serial device does not support this operation.\r
+  @retval RETURN_DEVICE_ERROR   The serial device is not functioning correctly.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SerialPortSetControl (\r
+  IN UINT32 Control\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Retrieve the status of the control bits on a serial device.\r
+\r
+  @param Control                A pointer to return the current control signals from the serial device.\r
+\r
+  @retval RETURN_SUCCESS        The control bits were read from the serial device.\r
+  @retval RETURN_UNSUPPORTED    The serial device does not support this operation.\r
+  @retval RETURN_DEVICE_ERROR   The serial device is not functioning correctly.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SerialPortGetControl (\r
+  OUT UINT32 *Control\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r