diff mbox series

[edk2,v2,2/2] ArmVirtPkg: switch to new PL011UartLib implementation

Message ID 20171116174708.24964-3-ard.biesheuvel@linaro.org
State Accepted
Commit 1195b8578764909858fe7d8458ab67f098fff182
Headers show
Series ArmplatformPkg: clean up PL011 support library | expand

Commit Message

Ard Biesheuvel Nov. 16, 2017, 5:47 p.m. UTC
Switch to the new, cleaned up PL011UartLib implementation so we will
be able to remove the old one.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmVirtPkg/ArmVirt.dsc.inc                                            | 2 +-
 ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c | 5 ++---
 ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c      | 5 ++---
 3 files changed, 5 insertions(+), 7 deletions(-)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek Nov. 16, 2017, 10:17 p.m. UTC | #1
On 11/16/17 18:47, Ard Biesheuvel wrote:
> Switch to the new, cleaned up PL011UartLib implementation so we will

> be able to remove the old one.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmVirtPkg/ArmVirt.dsc.inc                                            | 2 +-

>  ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c | 5 ++---

>  ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c      | 5 ++---

>  3 files changed, 5 insertions(+), 7 deletions(-)

> 

> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc

> index c92a69281ae4..50eb8675d1c0 100644

> --- a/ArmVirtPkg/ArmVirt.dsc.inc

> +++ b/ArmVirtPkg/ArmVirt.dsc.inc

> @@ -106,7 +106,7 @@ [LibraryClasses.common]

>    RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf

>    TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf

>    # ARM PL011 UART Driver

> -  PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf

> +  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf

>    SerialPortLib|ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf

>  

>    #

> diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

> index e28750f3b4c4..d9fd0ef98359 100644

> --- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

> +++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

> @@ -16,14 +16,13 @@

>  

>  **/

>  

> -#include <Base.h>

> +#include <Uefi.h>

>  

>  #include <Library/PcdLib.h>

> +#include <Library/PL011UartLib.h>

>  #include <Library/SerialPortLib.h>

>  #include <libfdt.h>

>  

> -#include <Drivers/PL011Uart.h>

> -

>  RETURN_STATUS

>  EFIAPI

>  SerialPortInitialize (

> diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

> index 05d3547fda91..c161dd6349d3 100644

> --- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

> +++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

> @@ -17,9 +17,10 @@

>  

>  **/

>  

> -#include <Base.h>

> +#include <Uefi.h>

>  

>  #include <Library/PcdLib.h>

> +#include <Library/PL011UartLib.h>

>  #include <Library/SerialPortLib.h>

>  #include <Pi/PiBootMode.h>

>  #include <Uefi/UefiBaseType.h>

> @@ -28,8 +29,6 @@

>  #include <Library/HobLib.h>

>  #include <Guid/EarlyPL011BaseAddress.h>

>  

> -#include <Drivers/PL011Uart.h>

> -

>  STATIC UINTN mSerialBaseAddress;

>  

>  RETURN_STATUS

> 


Awesome idea!

One comment: can you please check whether, if you replace

#include <Uefi.h>

with

#include <Uefi/UefiBaseType.h>

then stuff will still build?

Both SerialPortLib instances are BASE, so we should not include <Uefi.h>
(in particular <Uefi/UefiSpec.h> included by it).

If it works, then:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


If it doesn't work, then I think we should figure out why not; it could
be a sign of some layering violation, which would be nice to document at
least in the commit message.

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Nov. 17, 2017, 10:01 a.m. UTC | #2
On 16 November 2017 at 22:17, Laszlo Ersek <lersek@redhat.com> wrote:
> On 11/16/17 18:47, Ard Biesheuvel wrote:

>> Switch to the new, cleaned up PL011UartLib implementation so we will

>> be able to remove the old one.

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> ---

>>  ArmVirtPkg/ArmVirt.dsc.inc                                            | 2 +-

>>  ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c | 5 ++---

>>  ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c      | 5 ++---

>>  3 files changed, 5 insertions(+), 7 deletions(-)

>>

>> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc

>> index c92a69281ae4..50eb8675d1c0 100644

>> --- a/ArmVirtPkg/ArmVirt.dsc.inc

>> +++ b/ArmVirtPkg/ArmVirt.dsc.inc

>> @@ -106,7 +106,7 @@ [LibraryClasses.common]

>>    RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf

>>    TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf

>>    # ARM PL011 UART Driver

>> -  PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf

>> +  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf

>>    SerialPortLib|ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf

>>

>>    #

>> diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

>> index e28750f3b4c4..d9fd0ef98359 100644

>> --- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

>> +++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

>> @@ -16,14 +16,13 @@

>>

>>  **/

>>

>> -#include <Base.h>

>> +#include <Uefi.h>

>>

>>  #include <Library/PcdLib.h>

>> +#include <Library/PL011UartLib.h>

>>  #include <Library/SerialPortLib.h>

>>  #include <libfdt.h>

>>

>> -#include <Drivers/PL011Uart.h>

>> -

>>  RETURN_STATUS

>>  EFIAPI

>>  SerialPortInitialize (

>> diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

>> index 05d3547fda91..c161dd6349d3 100644

>> --- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

>> +++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c

>> @@ -17,9 +17,10 @@

>>

>>  **/

>>

>> -#include <Base.h>

>> +#include <Uefi.h>

>>

>>  #include <Library/PcdLib.h>

>> +#include <Library/PL011UartLib.h>

>>  #include <Library/SerialPortLib.h>

>>  #include <Pi/PiBootMode.h>

>>  #include <Uefi/UefiBaseType.h>

>> @@ -28,8 +29,6 @@

>>  #include <Library/HobLib.h>

>>  #include <Guid/EarlyPL011BaseAddress.h>

>>

>> -#include <Drivers/PL011Uart.h>

>> -

>>  STATIC UINTN mSerialBaseAddress;

>>

>>  RETURN_STATUS

>>

>

> Awesome idea!

>

> One comment: can you please check whether, if you replace

>

> #include <Uefi.h>

>

> with

>

> #include <Uefi/UefiBaseType.h>

>

> then stuff will still build?

>

> Both SerialPortLib instances are BASE, so we should not include <Uefi.h>

> (in particular <Uefi/UefiSpec.h> included by it).

>

> If it works, then:

>

> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

>

> If it doesn't work, then I think we should figure out why not; it could

> be a sign of some layering violation, which would be nice to document at

> least in the commit message.

>


Yes, that works. I added #include <Uefi/UefiBaseType.h> to
Library/PL011UartLib.h, which includes Protocol/SerialIo.h and
therefore needs the UEFI types. With that, I can drop the change from
the SerialPortLib implementations, in both patches.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index c92a69281ae4..50eb8675d1c0 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -106,7 +106,7 @@  [LibraryClasses.common]
   RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
   TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
   # ARM PL011 UART Driver
-  PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
+  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
   SerialPortLib|ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
 
   #
diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
index e28750f3b4c4..d9fd0ef98359 100644
--- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
+++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
@@ -16,14 +16,13 @@ 
 
 **/
 
-#include <Base.h>
+#include <Uefi.h>
 
 #include <Library/PcdLib.h>
+#include <Library/PL011UartLib.h>
 #include <Library/SerialPortLib.h>
 #include <libfdt.h>
 
-#include <Drivers/PL011Uart.h>
-
 RETURN_STATUS
 EFIAPI
 SerialPortInitialize (
diff --git a/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c b/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c
index 05d3547fda91..c161dd6349d3 100644
--- a/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c
+++ b/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c
@@ -17,9 +17,10 @@ 
 
 **/
 
-#include <Base.h>
+#include <Uefi.h>
 
 #include <Library/PcdLib.h>
+#include <Library/PL011UartLib.h>
 #include <Library/SerialPortLib.h>
 #include <Pi/PiBootMode.h>
 #include <Uefi/UefiBaseType.h>
@@ -28,8 +29,6 @@ 
 #include <Library/HobLib.h>
 #include <Guid/EarlyPL011BaseAddress.h>
 
-#include <Drivers/PL011Uart.h>
-
 STATIC UINTN mSerialBaseAddress;
 
 RETURN_STATUS