Re: [edk2] [PATCH v3] ArmPkg/ArmScmiDxe: Add clock enable function
Apart from some minor indentation errors in function parameter declarations in ArmScmiClock2Protocol.h , this looks fine. -Original Message- From: Ard Biesheuvel Sent: 21 December 2018 14:55 To: Jeff Brasen ; Girish Pathak Cc: edk2-devel@lists.01.org; Leif Lindholm Subject: Re: [PATCH v3] ArmPkg/ArmScmiDxe: Add clock enable function On Fri, 14 Dec 2018 at 00:48, Jeff Brasen wrote: > > Add function to allow enabling and disabling of the clock using the > SCMI interface. Add gArmScmiClock2ProtocolGuid to distinguish > platforms that support new API from those that just have the older protocol. > > SCMI_CLOCK2_PROTOCOL also adds a version parameter to allow for future > changes. It is placed after the functions that are present in the > existing protocol to allow SCMI_CLOCK2_PROTOCOL to be cast to > SCMI_CLOCK_PROTOCOL so that only a single implementation of those > function are needed. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jeff Brasen > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Cc: Grish Pathak I'd like to hear from Girish as well, since he contributed this code originally. > --- > ArmPkg/ArmPkg.dec | 1 + > .../ArmScmiDxe/ArmScmiClockProtocolPrivate.h | 7 + > ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf | 1 + > ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c | 62 +++ > ArmPkg/Include/Protocol/ArmScmiClock2Protocol.h| 198 > + > 5 files changed, 269 insertions(+) > create mode 100644 ArmPkg/Include/Protocol/ArmScmiClock2Protocol.h > > diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index > d99eb67..2f5e5b3 100644 > --- a/ArmPkg/ArmPkg.dec > +++ b/ArmPkg/ArmPkg.dec > @@ -59,6 +59,7 @@ >## Arm System Control and Management Interface(SCMI) Clock management > protocol >## ArmPkg/Include/Protocol/ArmScmiClockProtocol.h >gArmScmiClockProtocolGuid = { 0x91ce67a8, 0xe0aa, 0x4012, { 0xb9, > 0x9f, 0xb6, 0xfc, 0xf3, 0x4, 0x8e, 0xaa } } > + gArmScmiClock2ProtocolGuid = { 0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, > + 0x34, 0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf } } > >## Arm System Control and Management Interface(SCMI) Clock management > protocol >## ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h > diff --git a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > index 0d1ec6f..c135bac 100644 > --- a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > +++ b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > @@ -59,6 +59,13 @@ typedef struct { >CLOCK_RATE_DWORD Rate; > } CLOCK_RATE_SET_ATTRIBUTES; > > + > +// Message parameters for CLOCK_CONFIG_SET command. > +typedef struct { > + UINT32 ClockId; > + UINT32 Attributes; > +} CLOCK_CONFIG_SET_ATTRIBUTES; > + > // if ClockAttr Bit[0] is set then clock device is enabled. > #define CLOCK_ENABLE_MASK 0x1 > #define CLOCK_ENABLED(ClockAttr) ((ClockAttr & CLOCK_ENABLE_MASK) == > 1) diff --git a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf > b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf > index 05ce9c0..9b29b9f 100644 > --- a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf > +++ b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf > @@ -46,6 +46,7 @@ > [Protocols] >gArmScmiBaseProtocolGuid >gArmScmiClockProtocolGuid > + gArmScmiClock2ProtocolGuid >gArmScmiPerformanceProtocolGuid > > [Depex] > diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > index 64d2afa..c7f27a3 100644 > --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > > #include "ArmScmiClockProtocolPrivate.h" > #include "ScmiPrivate.h" > @@ -388,6 +389,53 @@ ClockRateSet ( >return Status; > } > > +/** Enable/Disable specified clock. > + > + @param[in] ThisA Pointer to SCMI_CLOCK_PROTOCOL Instance. > + @param[in] ClockId Identifier for the clock device. > + @param[in] Enable TRUE to enable, FALSE to disable. > + > + @retval EFI_SUCCESS Clock enable/disable successful. > + @retval EFI_DEVICE_ERROR SCP returns an SCMI error. > + @retval !(EFI_SUCCESS) Other errors. > +**/ > +STATIC > +EFI_STATUS > +ClockEnable ( > + IN SCMI_CLOCK2_PROTOCOL *This, > + IN UINT32 ClockId, > + IN BOOLEAN Enable > + ) > +{ > + EFI_STATUS Status; > + CLOCK_CONFIG_SET_ATTRIBUTES *ClockConfigSetAttributes; > + SCMI_COMMANDCmd;
[edk2] [PATCH v2 1/2] ArmPkg/ArmScmiDxe: Fix ASSERT error in SCMI DXE
This change fixes a bug in the SCMI DXE which is observed with the upcoming release of the SCP firmware. The PROTOCOL_ID_MASK (0xF) which is used to generate an index in the ProtocolInitFxns is wrong because protocol ids can be anywhere in 0x10 - 15 or 0x80 - FF range. This mask generates the same index for two different protocols e.g. for protocol ids 0x10 and 0x90, which causes duplicate initialization of a protocol resulting in a failure. This change removes the use of PROTOCOL_ID_MASK and instead uses a list of protocol ids and their initialization functions to identify a supported protocol and initialize it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Tested-by: Sudeep Holla --- Notes: v2: - We don't permit initialized automatic variables. [Ard] Fixed. [Girish] - Just use Protocols[0].Id.[Ard] Done.[Girish] - Call ScmiBaseProtocolInit() here.[Ard] Done.[Girish] - Please use a for () loop instead of while[Ard] Fixed. [Girish] - Replace ASSERT (FALSE) with ASSERT_EFI_ERROR () [Ard] Fixed. [Girish] - Rename InitFxn to InitFn [Ard] Fixed. [Girish] ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 36 ++-- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 8 +++-- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c index 2920c6f6f33c5bb8ac00c903a0b199ba5f06f4de..a56c7b21d5f09d41a110826b7b9db14ac34451de 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c @@ -29,13 +29,10 @@ #include "ScmiDxe.h" #include "ScmiPrivate.h" -STATIC CONST SCMI_PROTOCOL_INIT_TABLE ProtocolInitFxns[MAX_PROTOCOLS] = { - { ScmiBaseProtocolInit }, - { NULL }, - { NULL }, - { ScmiPerformanceProtocolInit }, - { ScmiClockProtocolInit }, - { NULL } +STATIC CONST SCMI_PROTOCOL_ENTRY Protocols[] = { + { SCMI_PROTOCOL_ID_BASE, ScmiBaseProtocolInit }, + { SCMI_PROTOCOL_ID_PERFORMANCE, ScmiPerformanceProtocolInit }, + { SCMI_PROTOCOL_ID_CLOCK, ScmiClockProtocolInit } }; /** ARM SCMI driver entry point function. @@ -65,14 +62,14 @@ ArmScmiDxeEntryPoint ( UINT32 Version; UINT32 Index; UINT32 NumProtocols; - UINT32 ProtocolNo; + UINT32 ProtocolIndex; UINT8 SupportedList[MAX_PROTOCOLS]; UINT32 SupportedListSize = sizeof (SupportedList); - ProtocolNo = SCMI_PROTOCOL_ID_BASE & PROTOCOL_ID_MASK; - // Every SCMI implementation must implement the base protocol. - Status = ProtocolInitFxns[ProtocolNo].Init (); + ASSERT (Protocols[0].Id == SCMI_PROTOCOL_ID_BASE); + + Status = ScmiBaseProtocolInit (); if (EFI_ERROR (Status)) { ASSERT (FALSE); return Status; @@ -123,13 +120,16 @@ ArmScmiDxeEntryPoint ( } // Install supported protocol on ImageHandle. - for (Index = 0; Index < NumProtocols; Index++) { -ProtocolNo = SupportedList[Index] & PROTOCOL_ID_MASK; -if (ProtocolInitFxns[ProtocolNo].Init != NULL) { - Status = ProtocolInitFxns[ProtocolNo].Init (); - if (EFI_ERROR (Status)) { -ASSERT (FALSE); -return Status; + for (ProtocolIndex = 1; ProtocolIndex < ARRAY_SIZE (Protocols); + ProtocolIndex++) { +for (Index = 0; Index < NumProtocols; Index++) { + if (Protocols[ProtocolIndex].Id == SupportedList[Index]) { +Status = Protocols[ProtocolIndex].InitFn (); +if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; +} +break; } } } diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h index 29cdde173659c701116b021a3c437a92b473e4e5..222e54f4dca558d9b1fedddf3f96fd977898c7b2 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h @@ -17,8 +17,9 @@ #ifndef SCMI_DXE_H_ #define SCMI_DXE_H_ +#include "ScmiPrivate.h" + #define MAX_PROTOCOLS6 -#define PROTOCOL_ID_MASK 0xF #define MAX_VENDOR_LEN SCMI_MAX_STR_LEN /** Pointer to protocol initialization function. @@ -35,7 +36,8 @@ EFI_STATUS ); typedef struct { - SCMI_PROTOCOL_INIT_FXN Init; -} SCMI_PROTOCOL_INIT_TABLE; + SCMI_PROTOCOL_ID Id;// Protocol Id. + SCMI_PROTOCOL_INIT_FXN InitFn; // Protocol init function. +} SCMI_PROTOCOL_ENTRY; #endif /* SCMI_DXE_H_ */ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v2 2/2] ArmPkg/ArmScmiDxe: Dynamically allocate buffer for protocol ids
Dynamically allocate the buffer to receive the SCMI protocol list. This makes MAX_PROTOCOLS redundant, so it is removed. It also fixes one minor code alignment issue and removes an unused macro PROTOCOL_MASK. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Tested-by: Sudeep Holla --- Notes: v2: - Remove change-id [Ard] Done [Girish] ArmPkg/Drivers/ArmScmiDxe/Scmi.c| 5 ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 27 +++- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 1 - 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/Scmi.c b/ArmPkg/Drivers/ArmScmiDxe/Scmi.c index 1e279f69cf615428dbb6477b8ac7de3258628df3..d247d3a932fe9f197460a95e9afa88681742e4b4 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/Scmi.c +++ b/ArmPkg/Drivers/ArmScmiDxe/Scmi.c @@ -22,11 +22,6 @@ #include "ScmiPrivate.h" -// SCMI Specification 1.0 -#define MAX_PROTOCOLS 6 - -#define PROTOCOL_MASK 0xF - // Arbitrary timeout value 20ms. #define RESPONSE_TIMEOUT 2 diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c index a56c7b21d5f09d41a110826b7b9db14ac34451de..0400799b5c521dcfa2ce866b0ffd48530e8cf0d1 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c @@ -63,8 +63,8 @@ ArmScmiDxeEntryPoint ( UINT32 Index; UINT32 NumProtocols; UINT32 ProtocolIndex; - UINT8 SupportedList[MAX_PROTOCOLS]; - UINT32 SupportedListSize = sizeof (SupportedList); + UINT8 *SupportedList; + UINT32 SupportedListSize; // Every SCMI implementation must implement the base protocol. ASSERT (Protocols[0].Id == SCMI_PROTOCOL_ID_BASE); @@ -108,13 +108,26 @@ ArmScmiDxeEntryPoint ( ASSERT (NumProtocols != 0); + SupportedListSize = (NumProtocols * sizeof (*SupportedList)); + + Status = gBS->AllocatePool ( + EfiBootServicesData, + SupportedListSize, + (VOID**) + ); + if (EFI_ERROR (Status)) { +ASSERT (FALSE); +return Status; + } + // Get the list of protocols supported by SCP firmware on the platform. Status = BaseProtocol->DiscoverListProtocols ( - BaseProtocol, - , - SupportedList - ); + BaseProtocol, + , + SupportedList + ); if (EFI_ERROR (Status)) { +gBS->FreePool (SupportedList); ASSERT (FALSE); return Status; } @@ -134,5 +147,7 @@ ArmScmiDxeEntryPoint ( } } + gBS->FreePool (SupportedList); + return EFI_SUCCESS; } diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h index 222e54f4dca558d9b1fedddf3f96fd977898c7b2..c9a9072579e32c06cc231d388fb3f2fe8d37eb21 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h @@ -19,7 +19,6 @@ #include "ScmiPrivate.h" -#define MAX_PROTOCOLS6 #define MAX_VENDOR_LEN SCMI_MAX_STR_LEN /** Pointer to protocol initialization function. -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v2 0/2] ArmPkg/ArmScmiDxe: Fix a bug uncovered with the new SCP firmware
This patch series addresses comments on the original https://github.com/girishpathak/edk2/tree/281_scmi_fix_v1 This series fixes a bug in the ArmScmiDxe which was revealed while testing with the new SCP firmware. The changes can be seen at https://github.com/girishpathak/edk2/tree/281_scmi_fix_v2 Girish Pathak (2): ArmPkg/ArmScmiDxe: Fix ASSERT error in SCMI DXE ArmPkg/ArmScmiDxe: Dynamically allocate buffer for protocol ids ArmPkg/Drivers/ArmScmiDxe/Scmi.c| 5 -- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 63 ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 9 +-- 3 files changed, 44 insertions(+), 33 deletions(-) -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v1 0/2] ArmPkg/ArmScmiDxe: Fix a bug uncovered with the new SCP firmware
This series fixes a bug in the ArmScmiDxe which was revealed while testing with the new SCP firmware. The changes can be seen at https://github.com/girishpathak/edk2/tree/281_scmi_fix_v1 Girish Pathak (2): ArmPkg/ArmScmiDxe: Fix ASSERT error in SCMI DXE ArmPkg/ArmScmiDxe: Dynamically allocate buffer for protocol ids ArmPkg/Drivers/ArmScmiDxe/Scmi.c| 5 -- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 62 ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 9 +-- 3 files changed, 43 insertions(+), 33 deletions(-) -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v1 1/2] ArmPkg/ArmScmiDxe: Fix ASSERT error in SCMI DXE
This change fixes a bug in the SCMI DXE which is observed with the upcoming release of the SCP firmware. The PROTOCOL_ID_MASK (0xF) which is used to generate an index in the ProtocolInitFxns is wrong because protocol ids can be anywhere in 0x10 - 15 or 0x80 - FF range. This mask generates the same index for two different protocols e.g. for protocol ids 0x10 and 0x90, which causes duplicate initialization of a protocol resulting in a failure. This change removes the use of PROTOCOL_ID_MASK and instead uses a list of protocol ids and their initialization functions to identify a supported protocol and initialize it. Change-Id: Ib004294d2bec853045ed6e811d123832fba555cd Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak --- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 35 ++-- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 8 +++-- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c index 2920c6f6f33c5bb8ac00c903a0b199ba5f06f4de..cc68cbc922fcc06bff8f7e0aa8b6bf64a9932874 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c @@ -29,13 +29,10 @@ #include "ScmiDxe.h" #include "ScmiPrivate.h" -STATIC CONST SCMI_PROTOCOL_INIT_TABLE ProtocolInitFxns[MAX_PROTOCOLS] = { - { ScmiBaseProtocolInit }, - { NULL }, - { NULL }, - { ScmiPerformanceProtocolInit }, - { ScmiClockProtocolInit }, - { NULL } +STATIC CONST SCMI_PROTOCOL_ENTRY Protocols[] = { + { SCMI_PROTOCOL_ID_BASE, ScmiBaseProtocolInit }, + { SCMI_PROTOCOL_ID_PERFORMANCE, ScmiPerformanceProtocolInit }, + { SCMI_PROTOCOL_ID_CLOCK, ScmiClockProtocolInit } }; /** ARM SCMI driver entry point function. @@ -65,14 +62,14 @@ ArmScmiDxeEntryPoint ( UINT32 Version; UINT32 Index; UINT32 NumProtocols; - UINT32 ProtocolNo; + UINT32 ProtocolIndex = 0; UINT8 SupportedList[MAX_PROTOCOLS]; UINT32 SupportedListSize = sizeof (SupportedList); - ProtocolNo = SCMI_PROTOCOL_ID_BASE & PROTOCOL_ID_MASK; - // Every SCMI implementation must implement the base protocol. - Status = ProtocolInitFxns[ProtocolNo].Init (); + ASSERT (Protocols[ProtocolIndex].Id == SCMI_PROTOCOL_ID_BASE); + + Status = Protocols[ProtocolIndex].InitFxn (); if (EFI_ERROR (Status)) { ASSERT (FALSE); return Status; @@ -123,13 +120,15 @@ ArmScmiDxeEntryPoint ( } // Install supported protocol on ImageHandle. - for (Index = 0; Index < NumProtocols; Index++) { -ProtocolNo = SupportedList[Index] & PROTOCOL_ID_MASK; -if (ProtocolInitFxns[ProtocolNo].Init != NULL) { - Status = ProtocolInitFxns[ProtocolNo].Init (); - if (EFI_ERROR (Status)) { -ASSERT (FALSE); -return Status; + while (++ProtocolIndex < ARRAY_SIZE (Protocols)) { +for (Index = 0; Index < NumProtocols; Index++) { + if (Protocols[ProtocolIndex].Id == SupportedList[Index]) { +Status = Protocols[ProtocolIndex].InitFxn (); +if (EFI_ERROR (Status)) { + ASSERT (FALSE); + return Status; +} +break; } } } diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h index 29cdde173659c701116b021a3c437a92b473e4e5..5815e1e78074067760b6f618e248526ee25e59c8 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h @@ -17,8 +17,9 @@ #ifndef SCMI_DXE_H_ #define SCMI_DXE_H_ +#include "ScmiPrivate.h" + #define MAX_PROTOCOLS6 -#define PROTOCOL_ID_MASK 0xF #define MAX_VENDOR_LEN SCMI_MAX_STR_LEN /** Pointer to protocol initialization function. @@ -35,7 +36,8 @@ EFI_STATUS ); typedef struct { - SCMI_PROTOCOL_INIT_FXN Init; -} SCMI_PROTOCOL_INIT_TABLE; + SCMI_PROTOCOL_ID Id;// Protocol Id. + SCMI_PROTOCOL_INIT_FXN InitFxn; // Protocol init function. +} SCMI_PROTOCOL_ENTRY; #endif /* SCMI_DXE_H_ */ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v1 2/2] ArmPkg/ArmScmiDxe: Dynamically allocate buffer for protocol ids
Dynamically allocate the buffer to receive the SCMI protocol list. This makes MAX_PROTOCOLS redundant, so it is removed. It also fixes one minor code alignment issue and removes an unused macro PROTOCOL_MASK. Change-Id: Idc5880d4fb7b5c674f5fb7dce1198a7cad0303a7 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak --- ArmPkg/Drivers/ArmScmiDxe/Scmi.c| 5 ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 27 +++- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 1 - 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/Scmi.c b/ArmPkg/Drivers/ArmScmiDxe/Scmi.c index 1e279f69cf615428dbb6477b8ac7de3258628df3..d247d3a932fe9f197460a95e9afa88681742e4b4 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/Scmi.c +++ b/ArmPkg/Drivers/ArmScmiDxe/Scmi.c @@ -22,11 +22,6 @@ #include "ScmiPrivate.h" -// SCMI Specification 1.0 -#define MAX_PROTOCOLS 6 - -#define PROTOCOL_MASK 0xF - // Arbitrary timeout value 20ms. #define RESPONSE_TIMEOUT 2 diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c index cc68cbc922fcc06bff8f7e0aa8b6bf64a9932874..e7b9feca5e1b565fc031385bfe2f2dc0ca53aab0 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c @@ -63,8 +63,8 @@ ArmScmiDxeEntryPoint ( UINT32 Index; UINT32 NumProtocols; UINT32 ProtocolIndex = 0; - UINT8 SupportedList[MAX_PROTOCOLS]; - UINT32 SupportedListSize = sizeof (SupportedList); + UINT8 *SupportedList; + UINT32 SupportedListSize; // Every SCMI implementation must implement the base protocol. ASSERT (Protocols[ProtocolIndex].Id == SCMI_PROTOCOL_ID_BASE); @@ -108,13 +108,26 @@ ArmScmiDxeEntryPoint ( ASSERT (NumProtocols != 0); + SupportedListSize = (NumProtocols * sizeof (*SupportedList)); + + Status = gBS->AllocatePool ( + EfiBootServicesData, + SupportedListSize, + (VOID**) + ); + if (EFI_ERROR (Status)) { +ASSERT (FALSE); +return Status; + } + // Get the list of protocols supported by SCP firmware on the platform. Status = BaseProtocol->DiscoverListProtocols ( - BaseProtocol, - , - SupportedList - ); + BaseProtocol, + , + SupportedList + ); if (EFI_ERROR (Status)) { +gBS->FreePool (SupportedList); ASSERT (FALSE); return Status; } @@ -133,5 +146,7 @@ ArmScmiDxeEntryPoint ( } } + gBS->FreePool (SupportedList); + return EFI_SUCCESS; } diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h index 5815e1e78074067760b6f618e248526ee25e59c8..b50a52a01d47efbbccec8c97bf44041c47ff8b38 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h @@ -19,7 +19,6 @@ #include "ScmiPrivate.h" -#define MAX_PROTOCOLS6 #define MAX_VENDOR_LEN SCMI_MAX_STR_LEN /** Pointer to protocol initialization function. -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH edk2-platforms v4 04/17] ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf
Hi Leif, > -Original Message- > From: Leif Lindholm <leif.lindh...@linaro.org> > Sent: 23 April 2018 18:03 > To: Girish Pathak <girish.pat...@arm.com> > Cc: edk2-devel@lists.01.org; ard.biesheu...@linaro.org; Matteo Carlini > <matteo.carl...@arm.com>; Stephanie Hughes-Fitt f...@arm.com>; nd <n...@arm.com>; Arvind Chauhan > <arvind.chau...@arm.com>; Daniil Egranov <daniil.egra...@arm.com>; > Thomas Abraham <thomas.abra...@arm.com> > Subject: Re: [PATCH edk2-platforms v4 04/17] ARM/VExpressPkg: Remove > unused PcdPL111LcdMaxMode from HDLCD inf > > On Thu, Apr 05, 2018 at 07:07:50PM +0100, Girish Pathak wrote: > > PCD PcdPL111LcdMaxMode is not used in HDLCD platform library. > > Presence of this PCD in HDLCD is probably due to copy/paste code from > > PL111 Lcd platform library. This change removes it from the > > HdLcdArmVExpressLib.inf file. > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Urgh - push failed on the above. > Can you confirm it should be version 1.1? Oops.. Sorry my fault. It should be 1.1 Thanks, Girish > / > Leif > > > Signed-off-by: Girish Pathak <girish.pat...@arm.com> > > Signed-off-by: Evan Lloyd <evan.ll...@arm.com> > > Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> > > --- > > > > > Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpr > essL > > ib.inf | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git > > > a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > sLib.inf > > > b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > sLib.inf index > > > bedbaea3a296bea5184564c582659381733d08a9..34db24d4ee6162b0e963d50 > 0a8ed > > 1097bd8a5ceb 100644 > > --- > > > a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > sLib.inf > > +++ > b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > > +++ pressLib.inf > > @@ -40,5 +40,4 @@ [Protocols] > >gEfiEdidActiveProtocolGuid# Produced > > > > [Pcd] > > - gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode > >gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId > > -- > > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' > > > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol
Hi Leif, > -Original Message- > From: Leif Lindholm <leif.lindh...@linaro.org> > Sent: 23 April 2018 17:22 > To: Girish Pathak <girish.pat...@arm.com> > Cc: edk2-devel@lists.01.org; ard.biesheu...@linaro.org; Matteo Carlini > <matteo.carl...@arm.com>; Stephanie Hughes-Fitt f...@arm.com>; nd <n...@arm.com> > Subject: Re: [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol > > On Mon, Apr 23, 2018 at 04:06:43PM +, Girish Pathak wrote: > > > From: Leif Lindholm <leif.lindh...@linaro.org> > > > Sent: 23 April 2018 12:32 > > > To: Girish Pathak <girish.pat...@arm.com> > > > Cc: edk2-devel@lists.01.org; ard.biesheu...@linaro.org; Matteo > > > Carlini <matteo.carl...@arm.com>; Stephanie Hughes-Fitt > > > ; nd <n...@arm.com> > > > Subject: Re: [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol > > > > > > Hmm, I did find a few minor things below that I need to hear back on > > > before pushing. > > > > Thanks for your comments, We can incorporate all the changes > > suggested, shall I tidy this up and resubmit the patch series ? > > Oh God, please don't. > > If you're happy with all of my comments on previous patches, can you just > say if you're OK with me folding in the below patch into 16/16 before > pushing?: Thanks for this, it's ok to fold it. Regards, Girish > > From 50294f90db0c3e7b5b19bc2022b5c1d866d0b8e1 Mon Sep 17 00:00:00 > 2001 > From: Leif Lindholm <leif.lindh...@linaro.org> > Date: Mon, 23 Apr 2018 12:36:06 +0100 > Subject: [PATCH] fixup scmi > > --- > ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h | 2 +- > ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c | 4 ++-- > ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c | 8 > 3 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > index 71245c1647..0d1ec6f5ad 100644 > --- a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > +++ b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h > @@ -30,7 +30,7 @@ typedef struct { > #define RATE_FORMAT_SHIFT 12 > #define RATE_FORMAT_MASK0x0001 > #define RATE_FORMAT(RatesFlags) ((RatesFlags >> RATE_FORMAT_SHIFT) > \ > - & RATE_FORMAT_MASK) > + & RATE_FORMAT_MASK) > > // Number of remaining rates after a call to the SCP, RatesFlag Bits[31:16] > #define NUM_REMAIN_RATES_SHIFT16 > diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > index fe7edd2a8c..64d2afab72 100644 > --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c > @@ -83,7 +83,7 @@ ClockGetTotalClocks ( > >Status = ScmiGetProtocolAttributes (SCMI_PROTOCOL_ID_CLOCK, > ); >if (EFI_ERROR (Status)) { > - return Status; > +return Status; >} > >*TotalClocks = SCMI_CLOCK_PROTOCOL_TOTAL_CLKS (ReturnValues[0]); > @@ -334,7 +334,7 @@ ClockRateGet ( > return Status; >} > > - *Rate = ((UINT64)ClockRate->High << 32) | ClockRate->Low; > + *Rate = ConvertTo64Bit (ClockRate->Low, ClockRate->High); > >return EFI_SUCCESS; > } > diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c > b/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c > index ac32442ad8..e012424a9b 100644 > --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c > +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c > @@ -15,9 +15,9 @@ > DEN0056A_System_Control_and_Management_Interface.pdf > **/ > > +#include > #include > #include > -#include > > #include "ArmScmiPerformanceProtocolPrivate.h" > #include "ScmiPrivate.h" > @@ -72,7 +72,7 @@ PerformanceGetAttributes ( > return Status; >} > > - memcpy ( > + CopyMem ( > Attributes, > ReturnValues, > sizeof (SCMI_PERFORMANCE_PROTOCOL_ATTRIBUTES) > @@ -127,7 +127,7 @@ PerformanceDomainAttributes ( > return Status; >} > > - memcpy ( > + CopyMem ( > DomainAttributes, > ReturnValues, > sizeof (SCMI_PERFORMANCE_DOMAIN_ATTRIBUTES) > @@ -219,7 +219,7 @@ PerformanceDescribeLevels ( > } > > for (LevelNo = 0; LevelNo < ReturnNumLevels; LevelNo++) { > - memcpy ( > + CopyMem ( > [LevelIndex++], > >PerfLevel[LevelNo], > sizeof (SCMI_PERFORMANCE_LEVEL) > -- > 2.11.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol
Hi Leif, > -Original Message- > From: Leif Lindholm <leif.lindh...@linaro.org> > Sent: 23 April 2018 12:32 > To: Girish Pathak <girish.pat...@arm.com> > Cc: edk2-devel@lists.01.org; ard.biesheu...@linaro.org; Matteo Carlini > <matteo.carl...@arm.com>; Stephanie Hughes-Fitt f...@arm.com>; nd <n...@arm.com> > Subject: Re: [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol > > Hmm, I did find a few minor things below that I need to hear back on > before pushing. Thanks for your comments, We can incorporate all the changes suggested, shall I tidy this up and resubmit the patch series ? Regards, Girish > > On Tue, Mar 20, 2018 at 04:12:12PM +, Girish Pathak wrote: > > This change introduces a new SCMI protocol driver for > > Arm systems. The driver currently supports only clock > > and performance management protocols. Other protocols > > will be added as and when needed. > > > > Clock management protocol is used to configure various clocks > > available on the platform e.g. HDLCD clock on the Juno platforms. > > > > Whereas performance management protocol allows adjustment > > of various performance domains. Currently this is used to evaluate > > performance of the Juno platform. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Girish Pathak <girish.pat...@arm.com> > > Signed-off-by: Evan Lloyd <evan.ll...@arm.com> > > --- > > > > Notes: > > v3: > > - Please rename ArmMtl.h to ArmMtlLibi.h, and > > declare it as a library class in the package file. [Ard] > > > > Done, however ArmMtlLib.h is now part of earlier commit [Girish] > > > > - Move ArmScmiDxe to ArmPkg from ArmPlatformPkg [Ard] > > > > Done[Girish] > > > > - Declare gArmScmiBaseProtocolGuid and similar > > protocols Guids in ArmPkg.dec [Ard] > > > > Done[Girish] > > > > - Replace flexible array member [] with [1] [Ard] > > > > Done[Girish] > > > > - Move protocol init function which are not part of > > of protocol like ScmiBaseProtocolInit elsewhere[Ard] > > > > Done[Girish] > > > > - Please don't put stuff in Include/Drivers. [Ard] > > > > Moved headers to Include/Protocol. [Girish] > > > > ArmPkg/ArmPkg.dec | 13 + > > ArmPkg/ArmPkg.dsc | 6 +- > > ArmPkg/Drivers/ArmScmiDxe/ArmScmiBaseProtocolPrivate.h| 46 ++ > > ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h | 84 > > > ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf | 53 +++ > > ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h | > 55 +++ > > ArmPkg/Drivers/ArmScmiDxe/Scmi.c | 262 > > +++ > > ArmPkg/Drivers/ArmScmiDxe/ScmiBaseProtocol.c | 318 > ++ > > ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c | 418 > ++ > > ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 138 ++ > > ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 41 ++ > > ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c | 457 > > > ArmPkg/Drivers/ArmScmiDxe/ScmiPrivate.h | 174 > > > > ArmPkg/Include/Protocol/ArmScmi.h | 27 ++ > > ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h | 174 > > > ArmPkg/Include/Protocol/ArmScmiClockProtocol.h| 218 > ++ > > ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h | 265 > > > 17 files changed, 2748 insertions(+), 1 deletion(-) > > > > diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec > > index > 881751d81c6384a3eb0b4c180c76d01a58266a74..16f7e40046429142b44b52604 > 3b61a3d5e089d2c 100644 > > --- a/ArmPkg/ArmPkg.dec > > +++ b/ArmPkg/ArmPkg.dec > > @@ -51,6 +51,19 @@ [Guids.common] > > > >gArmGicDxeFileGuid = { 0xde371f7c, 0xdec4, 0x4d21, { 0xad, 0xf1, 0x59, > 0x3a, 0xbc, 0xc1, 0x58, 0x82 } } > > > > +[Protoco
[edk2] [PATCH edk2-platforms v4 10/17] ARM/VExpressPkg: Redefine LcdPlatformGetTimings function
From: EvanLloyd The LcdPlatformGetTimings interface function takes similar sets of multiple parameters for horizontal and vertical timings which can be aggregated in a common data type. This change defines a structure SCAN_TIMINGS for this which can be used to describe both horizontal and vertical scan timings, and accordingly redefines the LcdPlatformGetTiming interface, greatly reducing the amount of data passed about. Similarly the mode definition tables are also changed to use this data type and thus enable pass through access. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 106 +--- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 168 2 files changed, 109 insertions(+), 165 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 97cbe77ee79f53d3430b0fdb057a3bf262834849..0c3a4efd6d8d1617965394f461c3f3e7bf70994d 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -30,57 +30,51 @@ typedef struct { UINT32 Mode; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; UINT32 OscFreq; // These are used by HDLCD - UINT32 HSync; - UINT32 HBackPorch; - UINT32 HFrontPorch; - UINT32 VSync; - UINT32 VBackPorch; - UINT32 VFrontPorch; -} LCD_RESOLUTION; + SCAN_TIMINGS Horizontal; + SCAN_TIMINGS Vertical; +} DISPLAY_MODE; /** The display modes supported by the platform. **/ -LCD_RESOLUTION mResolutions[] = { +STATIC DISPLAY_MODE mDisplayModes[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp -VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, +VGA, VGA_OSC_FREQUENCY, -VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, -VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH +{VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, +{VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp -SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, +SVGA, SVGA_OSC_FREQUENCY, -SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, -SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH +{SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH}, +{SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp -XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, +XGA, XGA_OSC_FREQUENCY, -XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, -XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH +{XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, +{XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp -SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, +SXGA, (SXGA_OSC_FREQUENCY/2), -SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, -SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH +{SXGA_H_RES_PIXELS, SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH}, +{SXGA_V_RES_PIXELS, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH} }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp -UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, +UXGA, (UXGA_OSC_FREQUENCY/2), -UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, -UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH +{UXGA_H_RES_PIXELS, UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH}, +{UXGA_V_RES_PIXELS, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH} }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp -HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, +HD, (HD_OSC_FREQUENCY/2), -HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, -HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH +{HD_H_RES_PIXELS, HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH}, +{HD_V_RES_PIXELS, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH} } }; @@ -205,7 +199,7 @@ LcdPlatformGetMaxMode (VOID) { // The following line will report correctly the total number of graphics modes // that could be supported by the graphics driver - return (sizeof (mResolutions) / sizeof (LCD_RESOLUTION)); + return (sizeof (mDisplayModes) / sizeof (DISPLAY_MODE)); } /** Set the requested display mode. @@ -232,7 +226,7 @@ LcdPlatformSetMode ( Status = ArmPlatform
[edk2] [PATCH edk2-platforms v4 12/17] ARM/VExpressPkg: Allocate framebuffer using EfiReservedMemoryType
As per the UEFI specification(2.7) section 12.9, the GOP framebuffer memory can be accessed in the pre-boot and the post boot phase (by OS) Therefore the memory type EfiBootServicesData which may no longer exist after ExitBootServices is incorrect for the framebuffer memory allocation. Change EfiBootServicesData with EfiReservedMemoryType so that allocated memory can be accessed in the post boot phase. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v4: - Use EfiReservedMemory [Ard] - Done [Girish] Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 2 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index f7cae39c9cc9954ba4cad1bd597ebfc8baf10f11..f1c497f4b3474e32626bcfce0398432319eae72f 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -176,7 +176,7 @@ LcdPlatformGetVram ( } Status = gBS->AllocatePages ( AllocationType, - EfiBootServicesData, + EfiReservedMemoryType, EFI_SIZE_TO_PAGES (((UINTN)LCD_VRAM_SIZE)), VramBaseAddress ); diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 2f4814a2adbf01517ba14d75ce579ff35c362379..50a53d3fff5065b0fcec5a5332dcc63e344328c3 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -232,7 +232,7 @@ LcdPlatformGetVram ( // Allocate the VRAM from the DRAM so that nobody else uses it. Status = gBS->AllocatePages ( AllocateAddress, -EfiBootServicesData, +EfiReservedMemoryType, EFI_SIZE_TO_PAGES (((UINTN)LCD_VRAM_SIZE)), VramBaseAddress ); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v4 13/17] ARM/VExpressPkg: Reserving framebuffer at build
From: Girish Pathak This change uses two PCDs, PcdArmLcdFrameBufferBase and PcdArmLcdFrameBufferSize introduced in correspondiong EDK2 patch to reserve framebuffer in DRAM if these values are defined in platform specific DSC file, avoiding the need to allocate dynamically. This allows the framebuffer to appear as "I/O memory" outside of the normal RAM map, which is similar to the "VRAM" case. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Move PcdArmLcdDdrFrameBufferBase and PcdArmLcdDdrFrameBufferSize to VExpressPkg. [Ard] These PCDs are also used for the Juno platform hence these PCDs are defined for the ArmPlatformPkg so that both platform can use it.[Girish] - Could you please add an ASSERT() so that System Memory and PcdArmLcdDdrFrameBufferBase do not overlap [Ard] Done[Girish] Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 4 +- Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 41 ++-- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf index 8c6291c42f8a599591d00d7afcb2ff3399417034..b025abd98b5e654323b7821ac353ad920e2e6421 100644 --- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf @@ -1,5 +1,5 @@ #/* @file -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -54,6 +54,8 @@ [FixedPcd] gArmTokenSpaceGuid.PcdArmPrimaryCore gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferSize [Ppis] gArmMpCoreInfoPpiGuid diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c index 9fb0803d31ad0dbab59875bae99fd8a381d484b7..1d5fefc21726ba1b05d90e0e47677575d7fa2034 100644 --- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c +++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011-2016, ARM Limited. All rights reserved. +* Copyright (c) 2011-2018, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -128,17 +128,34 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length = 2 * ARM_VE_SMB_PERIPH_SZ; VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - // VRAM - VirtualMemoryTable[++Index].PhysicalBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; - VirtualMemoryTable[Index].VirtualBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; - VirtualMemoryTable[Index].Length = PL111_CLCD_VRAM_MOTHERBOARD_SIZE; - // - // Map the VRAM region as Normal Non-Cacheable memory and not device memory, - // so that we can use the accelerated string routines that may use unaligned - // accesses or DC ZVA instructions. The enum identifier is slightly awkward - // here, but it maps to a memory type that allows buffering and reordering. - // - VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + // Map region for the framebuffer in the system RAM if no VRAM present + if (FixedPcdGet32 (PcdArmLcdDdrFrameBufferBase) == 0) { +// VRAM +VirtualMemoryTable[++Index].PhysicalBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; +VirtualMemoryTable[Index].VirtualBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; +VirtualMemoryTable[Index].Length = PL111_CLCD_VRAM_MOTHERBOARD_SIZE; +// +// Map the VRAM region as Normal Non-Cacheable memory and not device memory, +// so that we can use the accelerated string routines that may use unaligned +// accesses or DC ZVA instructions. The enum identifier is slightly awkward +// here, but it maps to a memory type that allows buffering and reordering. +// +VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + } else { +ASSERT ((ARM_VE_DRAM_BASE + ARM_VE_DRAM_SZ - 1) < +FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase)); +VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase); +VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdArmLcdDdrFrameB
[edk2] [PATCH edk2-platforms v4 17/17] ARM/JunoPkg: Add HDLCD platform library
This change adds the HDLCD platform lib for the Juno plaform. This library will be instantiated as a LcdPlatformLib to link with LcdGraphicsOutputDxe for the Juno platform. HDLCD platform library depends on the Arm SCMI DXE driver for communication with the SCP for clock setting. Therefore this change also enables building of Arm SCMI DXE driver for the Juno platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Wouldn't it make more sense to add a macro ENABLE_HDLCD, rather than inverting the logic?[Ard] We used this to correspond with the ACPI (FADT) terminology, where HEADLESS implies more than just no display. Refer below email [Evan] https://lists.01.org/pipermail/edk2-devel/ 2018-January/019925.html - SRAM mapping: Couldn't you map it as non-cacheable memory instead [Ard] Done [Girish] - Please fix weird indentation [Ard] Done [Girish] - Please don't use CPP conditionals for control flow [Ard] Done [Girish] Platform/ARM/JunoPkg/ArmJuno.dec | 8 + Platform/ARM/JunoPkg/ArmJuno.dsc | 26 + Platform/ARM/JunoPkg/ArmJuno.fdf | 12 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoLib.inf | 5 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c | 21 +- Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJuno.c | 555 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf | 41 ++ 7 files changed, 665 insertions(+), 3 deletions(-) diff --git a/Platform/ARM/JunoPkg/ArmJuno.dec b/Platform/ARM/JunoPkg/ArmJuno.dec index fdb56fccb2b259301fd787016a9c4de7ab3c356d..edbbb827ad45cf9e33adede006628432aa41c77b 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dec +++ b/Platform/ARM/JunoPkg/ArmJuno.dec @@ -53,3 +53,11 @@ [PcdsFixedAtBuild.common] gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxBase|0x2E00|UINT64|0x0025 gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxSize|0x80|UINT32|0x0026 + # MaxMode must be one number higher than the actual max mode, + # i.e. for actual maximum mode 2, set the value to 3. + # + # Default value zero allows platform to enumerate maximum supported mode. + # + # For a list of mode numbers look in HdLcdArmJuno.c + gArmJunoTokenSpaceGuid.PcdArmHdLcdMaxMode|0|UINT32|0x0017 + diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc index 851dc0f04ad693e4a88cee070b205f0234687d81..d5e87f1edfd5d60a543e51cb42dfbcc4489d3f7d 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dsc +++ b/Platform/ARM/JunoPkg/ArmJuno.dsc @@ -50,6 +50,11 @@ [LibraryClasses.common] # SCMI Mailbox Transport Layer ArmMtlLib|Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf +!ifndef HEADLESS_PLATFORM + LcdPlatformLib|Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf + LcdHwLib|ArmPlatformPkg/Library/HdLcd/HdLcd.inf +!endif + [LibraryClasses.common.SEC] PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf @@ -100,7 +105,15 @@ [PcdsFixedAtBuild.common] # System Memory (2GB - 16MB of Trusted DRAM at the top of the 32bit address space) gArmTokenSpaceGuid.PcdSystemMemoryBase|0x8000 + +!ifdef HEADLESS_PLATFORM gArmTokenSpaceGuid.PcdSystemMemorySize|0x7F00 +!else + # Default framebuffer size is 0x7E9000, reduce system memory size for framebuffer. + gArmTokenSpaceGuid.PcdSystemMemorySize|0x7E817000 + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase|0xFE817000 + gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect|TRUE +!endif # Juno Dual-Cluster profile gArmPlatformTokenSpaceGuid.PcdCoreCount|6 @@ -142,6 +155,11 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C01 gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C02F000 +!ifndef HEADLESS_PLATFORM + # ARM Juno HDLCD Base + gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x7FF6 +!endif + # # PLDA PCI Root Complex # @@ -315,6 +333,11 @@ [Components.common] MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf +!ifndef HEADLESS_PLATFORM + # Graphic Output Protocol + ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf +!endif + # # Juno platform driver # @@ -348,6 +371,9 @@ [Components.common] BdsLib|Platform
[edk2] [PATCH edk2-platforms v4 14/17] ARM/VExpressPkg: Set EFI_MEMORY_XP flag on GOP framebuffer
The framebuffer memory is set with flag EFI_MEMORY_WC (uncached, unbuffered) which causes framebuffer memory with eXecute bit set. Framebuffer memory having executable bit set is a security hazard. This fix adds EFI_MEMORY_XP flag to avoid this. Unfortunately function gDS->SetMemorySpaceAttributes() causes assertion due to unsupported EFI_MEMORY_XP type. Therefore this fix replaces gDS->SetMemorySpaceAttributes() with Cpu->SetMemoryAttributes(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 24 ++-- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 1 - Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 24 ++-- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 1 - 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index f1c497f4b3474e32626bcfce0398432319eae72f..711f036d74b6544e54ec073a354e9fc6f36db5e2 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -17,11 +17,11 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -159,6 +159,7 @@ LcdPlatformGetVram ( { EFI_STATUS Status; EFI_ALLOCATE_TYPE AllocationType; + EFI_CPU_ARCH_PROTOCOL *Cpu; ASSERT (VramBaseAddress != NULL); ASSERT (VramSize != NULL); @@ -185,13 +186,22 @@ LcdPlatformGetVram ( return Status; } - // Mark the VRAM as write-combining. - // The VRAM is inside the DRAM, which is cacheable. - Status = gDS->SetMemorySpaceAttributes ( - *VramBaseAddress, - *VramSize, - EFI_MEMORY_WC + // Ensure the Cpu architectural protocol is already installed + Status = gBS->LocateProtocol ( + , + NULL, + (VOID **) ); + if (!EFI_ERROR (Status)) { +// The VRAM is inside the DRAM, which is cacheable. +// Mark the VRAM as write-combining (uncached) and non-executable. +Status = Cpu->SetMemoryAttributes ( +Cpu, +*VramBaseAddress, +*VramSize, +EFI_MEMORY_WC | EFI_MEMORY_XP +); + } if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index 9b0d358846bf367d7f9ff6f5d3fdffc204864528..c7b1b7fae77cbbf82b3a0768e7654a96719f5e7a 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -33,7 +33,6 @@ [Packages] [LibraryClasses] ArmPlatformSysConfigLib BaseLib - DxeServicesTableLib [Protocols] gEfiEdidDiscoveredProtocolGuid# Produced diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 50a53d3fff5065b0fcec5a5332dcc63e344328c3..bcf4f6593c071b652695ec463687ac2fe84ffa73 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -17,10 +17,10 @@ #include #include #include -#include #include #include +#include #include #include @@ -212,6 +212,7 @@ LcdPlatformGetVram ( ) { EFI_STATUS Status; + EFI_CPU_ARCH_PROTOCOL *Cpu; ASSERT (VramBaseAddress != NULL); ASSERT (VramSize != NULL); @@ -241,13 +242,22 @@ LcdPlatformGetVram ( return Status; } -// Mark the VRAM as write-combining. -// The VRAM is inside the DRAM, which is cacheable. -Status = gDS->SetMemorySpaceAttributes ( -*VramBaseAddress, -*VramSize, -EFI_MEMORY_WC +// Ensure the Cpu architectural protocol is already installed +Status = gBS->LocateProtocol ( +, +NULL, +(VOID **) ); +if (!EFI_ERROR (Status)) { + // The VRAM is inside the DRAM, which is cacheable. + // Mark the VRAM as write-combining (uncached) and non-executable. + Status = Cpu->SetMem
[edk2] [PATCH edk2-platforms v4 15/17] ARM/VExpressPkg: New DP500/DP550/DP650 platform library
From: Girish Pathak This change adds LcdPlatformLib implementation for Arm Mali DP500/DP500/DP650 display processors for models (with DP550 support). NOTE: Versions for actual hardware are liable to require extra handling for clock input changes, etc. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Please fix the funky indentation [Ard] Done [Girish] - Add EFI_MEMORY_XP [Ard] Done [Girish] Platform/ARM/VExpressPkg/ArmVExpressPkg.dec| 3 +- Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c | 387 Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf | 43 +++ Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 3 + Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 12 +- 5 files changed, 446 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec b/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec index 695553a94f7f7e963b5db995c5e54f1ae1559daf..ac77540362d0775bed45f517306b98ea16bfb170 100644 --- a/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec +++ b/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec @@ -1,7 +1,7 @@ #/** @file # Arm Versatile Express package. # -# Copyright (c) 2012-2015, ARM Limited. All rights reserved. +# Copyright (c) 2012-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -51,6 +51,7 @@ [PcdsFixedAtBuild.common] gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId|1|UINT32|0x0003 gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId|0|UINT32|0x0005 + gArmVExpressTokenSpaceGuid.PcdArmMaliDpMaxMode|0|UINT32|0x0008 # # Device path of block device on which Fastboot will flash partitions diff --git a/Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c b/Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c new file mode 100644 index ..04ad341d14650b10b92a38a6ff68108871feef9e --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c @@ -0,0 +1,387 @@ +/** @file + + The file contains Arm Mali DP platform specific implementation. + + Copyright (c) 2017-2018, Arm Limited. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** Check an address is within 40 bits. + + The ARM Mali DP framebuffer address size can not be wider than 40 bits +**/ +#define DP_VALID_BASE_ADDR(Address) ((Address >> 40) == 0) + +typedef struct { + UINT32 OscFreq; + SCAN_TIMINGSHorizontal; + SCAN_TIMINGSVertical; +} DISPLAY_MODE; + +/** The display modes implemented by this driver. + + On Models, the OSC frequencies (listed for each mode below) are not used. + However these frequencies are useful on hardware plaforms where related + clock (or PLL) settings are based on these pixel clocks. + + Since the clock settings are defined externally, the driver must + communicate pixel clock frequencies to relevant modules + responsible for setting clocks. e.g. SCP. +**/ +STATIC DISPLAY_MODE mDisplayModes[] = { + { +// Mode 0 : VGA : 640 x 480 x 24 bpp. +VGA_OSC_FREQUENCY, +{VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, +{VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} + }, + { +// Mode 1 : WVGA : 800 x 480 x 24 bpp. +WVGA_OSC_FREQUENCY, +{WVGA_H_RES_PIXELS, WVGA_H_SYNC, WVGA_H_BACK_PORCH, WVGA_H_FRONT_PORCH}, +{WVGA_V_RES_PIXELS, WVGA_V_SYNC, WVGA_V_BACK_PORCH, WVGA_V_FRONT_PORCH} + }, + { +// Mode 2 : SVGA : 800 x 600 x 24 bpp. +SVGA_OSC_FREQUENCY, +{SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH}, +{SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} + }, + { +// Mode 3 : QHD : 960 x 540 x 24 bpp. +QHD_OSC_FREQUENCY, +{QHD_H_RES_PIXELS, QHD_H_SYNC, QHD_H_BACK_PORCH, QHD_H_FRONT_PORCH}, +{QHD_V_RES_PIXELS, QHD_V_SYNC, QHD_V_BACK_PORCH, QHD_V_FRONT_PORCH} + }, + { +// Mode 4 : WSVGA : 1024 x 600 x 24 b
[edk2] [PATCH edk2-platforms v4 16/17] ARM/JunoPkg: Adding SCMI MTL library
This change adds a new Mailbox Transport Layer library for the Juno platform. This library is required for ArmScmiDxe driver communication with the SCP. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> --- Notes: v3: - Please rename this library *instance* to something Juno-specific, e.g., ArmJunoMtlLib[Ard] Renamed to ArmJunoMtlLib [Girish] Platform/ARM/JunoPkg/ArmJuno.dec | 9 +- Platform/ARM/JunoPkg/ArmJuno.dsc | 5 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c | 8 +- Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c| 198 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf | 39 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlPrivateLib.h | 94 ++ 6 files changed, 349 insertions(+), 4 deletions(-) diff --git a/Platform/ARM/JunoPkg/ArmJuno.dec b/Platform/ARM/JunoPkg/ArmJuno.dec index 60cef6d23a2d904103b9806d871fd2b89fff51c3..fdb56fccb2b259301fd787016a9c4de7ab3c356d 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dec +++ b/Platform/ARM/JunoPkg/ArmJuno.dec @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2015, ARM Limited. All rights reserved. +# Copyright (c) 2013-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -46,3 +46,10 @@ [PcdsFixedAtBuild.common] # Juno Device Trees are loaded from NOR Flash gArmJunoTokenSpaceGuid.PcdJunoFdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/board.dtb"|VOID*|0x0008 + # MHU Register base used by SCMI Mailbox transport + gArmJunoTokenSpaceGuid.PcdArmMtlDoorBell|0x2B1F|UINT64|0x0024 + + # ARM_JUNO_NON_SECURE_SRAM_BASE used by SCMI Mailbox transport + gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxBase|0x2E00|UINT64|0x0025 + gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxSize|0x80|UINT32|0x0026 + diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc index 9d7317683ef39ab47429234b98d94c04953b41cb..851dc0f04ad693e4a88cee070b205f0234687d81 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dsc +++ b/Platform/ARM/JunoPkg/ArmJuno.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2017, ARM Limited. All rights reserved. +# Copyright (c) 2013-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -47,6 +47,9 @@ [LibraryClasses.common] # USB Requirements UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + # SCMI Mailbox Transport Layer + ArmMtlLib|Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf + [LibraryClasses.common.SEC] PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf diff --git a/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c b/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c index 2d9c2c95a80d9c34ba4a1a526950537a97ec5d10..2cac815e96104e74c9ceae2c4140bcab535432a8 100644 --- a/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c +++ b/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2013-2015, ARM Limited. All rights reserved. +* Copyright (c) 2013-2018, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -107,7 +107,11 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_NON_SECURE_SRAM_BASE; VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_NON_SECURE_SRAM_BASE; VirtualMemoryTable[Index].Length = ARM_JUNO_NON_SECURE_SRAM_SZ; - VirtualMemoryTable[Index].Attributes = CacheAttributes; + // This memory is shared between the application processor + // and the SCP. To avoid coherency problems, map it as uncached memory. + // NOTE: The attribute value is misleading, it indicates memory map type as + // an un-cached, un-buffered but allows buffering and reordering. + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; // PCI Root Complex VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPcieControlBaseAddress); diff --git a/Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c b/Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c new file mode 100644 index ..ee1efe1574c124c7f7cf1fb345b46806bc3a4466 --- /dev/null +++ b/Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c @@ -0,0 +1,198 @@ +/** @file + + Copyright (c) 2017-2018, Arm Limited. All rights reserved. +
[edk2] [PATCH edk2-platforms v4 03/17] ARM/VExpressPkg: Tidy HdLcd/PL111Lcd code: Updated comments
From: Girish Pathak There is no functional modification in this change. In this change some comments in HDLCD and PL111LCD platform library code are modified and a few new comments are added. This is to prevent mixing formatting changes with functional changes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 74 Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 73 +++ Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 2 +- 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 36ea484bbceac51566bfeaf029b1aa0ede93dee1..80603f04df3793b8b62196990c846de9ba8f130d 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -44,6 +44,8 @@ typedef struct { UINT32 VFrontPorch; } LCD_RESOLUTION; +/** The display modes supported by the platform. +**/ LCD_RESOLUTION mResolutions[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, @@ -93,6 +95,13 @@ EFI_EDID_ACTIVE_PROTOCOL mEdidActive = { NULL }; +/** HDLCD platform specific initialization function. + + @param[in] Handle Handle to the LCD device instance. + + @retval EFI_SUCCESSPlaform library initialized successfully. + @retval !(EFI_SUCCESS) Other errors. +**/ EFI_STATUS LcdPlatformInitializeDisplay ( IN EFI_HANDLE Handle @@ -123,6 +132,18 @@ LcdPlatformInitializeDisplay ( return Status; } +/** Allocate VRAM memory in DRAM for the framebuffer + (unless it is reserved already). + + The allocated address can be used to set the framebuffer. + + @param[out] VramBaseAddress A pointer to the framebuffer address. + @param[out] VramSizeA pointer to the size of the framebuffer + in bytes + + @retval EFI_SUCCESS Framebuffer memory allocated successfully. + @retval !(EFI_SUCCESS) Other errors. +**/ EFI_STATUS LcdPlatformGetVram ( OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress, @@ -169,6 +190,13 @@ LcdPlatformGetVram ( return EFI_SUCCESS; } +/** Return total number of modes supported. + + Note: Valid mode numbers are 0 to MaxMode - 1 + See Section 12.9 of the UEFI Specification 2.7 + + @retval UINT32 Mode Number. +**/ UINT32 LcdPlatformGetMaxMode (VOID) { @@ -177,6 +205,14 @@ LcdPlatformGetMaxMode (VOID) return (sizeof (mResolutions) / sizeof (LCD_RESOLUTION)); } +/** Set the requested display mode. + + @param[in] ModeNumber Mode Number. + + @retval EFI_SUCCESS Mode set successfully. + @retval EFI_INVALID_PARAMETER Requested mode not found. + @retval !(EFI_SUCCESS)Other errors. +**/ EFI_STATUS LcdPlatformSetMode ( IN UINT32 ModeNumber @@ -226,6 +262,17 @@ LcdPlatformSetMode ( return Status; } +/** Return information for the requested mode number. + + @param[in] ModeNumber Mode Number. + + @param[out] InfoPointer for returned mode information + (on success). + + @retval EFI_SUCCESS Mode information for the requested mode + returned successfully. + @retval EFI_INVALID_PARAMETER Requested mode not found. +**/ EFI_STATUS LcdPlatformQueryMode ( IN UINT32ModeNumber, @@ -266,6 +313,23 @@ LcdPlatformQueryMode ( return EFI_SUCCESS; } +/** Return display timing information for the requested mode number. + + @param[in] ModeNumber Mode Number. + + @param[out] HResPointer to horizontal resolution. + @param[out] HSync Pointer to horizontal sync width. + @param[out] HBackPorch Pointer to horizontal back porch. + @param[out] HFrontPorch Pointer to horizontal front porch. + @param[out] VResPointer to vertical resolution. + @param[out] VSync Pointer to vertical sync width. + @param[out] VBackPorch Pointer to vertical back porch. + @param[out] VFrontPorch Pointer to vertical front porch. + + @retval EFI_SUCCESS Display timing information for the requested + mode returned successfully. + @retval EFI_INVALID_PARAMETER Requested mode not found. +**/ EFI_STATUS LcdPlatformGetTimin
[edk2] [PATCH edk2-platforms v4 02/17] ARM/VExpressPkg: Tidy HDLCD and PL11LCD platform Lib: Coding standard
From: Girish Pathak There is no functional modification in this change As preparation for further work, the formatting is corrected to meet the EDKII coding standard. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 136 ++- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 5 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 238 +++- 3 files changed, 218 insertions(+), 161 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index b1106ee19b98cebac01820924514eac79b97d0d5..36ea484bbceac51566bfeaf029b1aa0ede93dee1 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -1,6 +1,6 @@ -/** +/** @file - Copyright (c) 2012, ARM Ltd. All rights reserved. + Copyright (c) 2012-2018, ARM Ltd. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -44,35 +44,40 @@ typedef struct { UINT32 VFrontPorch; } LCD_RESOLUTION; - LCD_RESOLUTION mResolutions[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp -VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, VGA_OSC_FREQUENCY, +VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +VGA_OSC_FREQUENCY, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp -SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, SVGA_OSC_FREQUENCY, +SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +SVGA_OSC_FREQUENCY, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp -XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, XGA_OSC_FREQUENCY, +XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +XGA_OSC_FREQUENCY, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp -SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (SXGA_OSC_FREQUENCY/2), +SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +(SXGA_OSC_FREQUENCY/2), SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp -UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (UXGA_OSC_FREQUENCY/2), +UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +(UXGA_OSC_FREQUENCY/2), UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp -HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (HD_OSC_FREQUENCY/2), +HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +(HD_OSC_FREQUENCY/2), HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH } @@ -95,19 +100,25 @@ LcdPlatformInitializeDisplay ( { EFI_STATUS Status; - // Set the FPGA multiplexer to select the video output from the motherboard or the daughterboard - Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, ARM_VE_DAUGHTERBOARD_1_SITE); - if (EFI_ERROR(Status)) { + // Set the FPGA multiplexer to select the video output from the + // motherboard or the daughterboard + Status = ArmPlatformSysConfigSet ( + SYS_CFG_MUXFPGA, + ARM_VE_DAUGHTERBOARD_1_SITE + ); + if (EFI_ERROR (Status)) { return Status; } // Install the EDID Protocols Status = gBS->InstallMultipleProtocolInterfaces ( -, -, , -, , -NULL - ); + , + , + , + , + , + NULL + ); return Status; } @@ -132,16 +143,25 @@ LcdPlatformGetVram ( } else { AllocationType = AllocateAddress; } - Status = gBS->AllocatePages (AllocationType, EfiBootServicesData, EFI_SIZE_TO_PAGES(((UINTN)LCD_VRAM_SIZE)), VramBaseAddress); - if (EFI_ERROR(Status)) { + Status = gBS->AllocatePages ( + AllocationType, + EfiBootServicesData, + EFI_SIZE_TO_P
[edk2] [PATCH edk2-platforms v4 11/17] ARM/VExpressPkg: PL111 and HDLCD: Add PCD to select pixel format
From: Girish Pathak Current HDLCD and PL111 platform libraries do not support display modes with PixelBlueGreenRedReserved8BitPerColor format, i.e. because of historical confusion, they do not support the UEFI default PixelBlueGreenRedReserved8BitPerColor LcdPlatformLib for PL111, LcdPlatformQueryMode function returns the pixel format as PixelRedGreenBlueReserved8BitPerColor which is wrong, because that does not match the display controller's pixel format which is set to BGR in PL111Lcd GOP driver. Also it is not possible to configure pixel format as RGB/BGR for the display modes for a platform at build time. This change adds PcdGopPixelFormat to configure pixel format as PixelRedGreenBlueReserved8BitPerColoror PixelBlueGreenRedReserved8BitPerColoror PixelBitMask. With this change, pixel format can be selected in the platform specific .dsc file for all supported display modes. Support for PixelBitMask is not implemented in PL111 or HDLCD GOP driver, hence HDLCD and PL111 platform libraries will return error EFI_UNSUPPORTED if PcdGopPixelFormat is set to PixelBitMask. Indeed, it is not clear what selecting PixelBitMask might mean, but the option is allowed as it might suit a custom platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Notes: v3: - Fix minor indentation [Ard] - Done [Girish] Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 23 Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 1 + Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 38 +--- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 1 + 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 0c3a4efd6d8d1617965394f461c3f3e7bf70994d..f7cae39c9cc9954ba4cad1bd597ebfc8baf10f11 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -93,6 +92,10 @@ EFI_EDID_ACTIVE_PROTOCOL mEdidActive = { @param[in] Handle Handle to the LCD device instance. @retval EFI_SUCCESSPlaform library initialized successfully. + @retval EFI_UNSUPPORTEDPcdGopPixelFormat must be + PixelRedGreenBlueReserved8BitPerColor OR + PixelBlueGreenRedReserved8BitPerColor + any other format is not supported. @retval !(EFI_SUCCESS) Other errors. **/ EFI_STATUS @@ -101,6 +104,17 @@ LcdPlatformInitializeDisplay ( ) { EFI_STATUS Status; + EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; + + // PixelBitMask and PixelBltOnly pixel formats are not supported + PixelFormat = FixedPcdGet32 (PcdGopPixelFormat); + if (PixelFormat != PixelRedGreenBlueReserved8BitPerColor && + PixelFormat != PixelBlueGreenRedReserved8BitPerColor) { + +ASSERT (PixelFormat == PixelRedGreenBlueReserved8BitPerColor || + PixelFormat == PixelBlueGreenRedReserved8BitPerColor); +return EFI_UNSUPPORTED; + } // Set the FPGA multiplexer to select the video output from the // motherboard or the daughterboard @@ -282,12 +296,7 @@ LcdPlatformQueryMode ( Info->VerticalResolution = mDisplayModes[ModeNumber].Vertical.Resolution; Info->PixelsPerScanLine = mDisplayModes[ModeNumber].Horizontal.Resolution; - /* Bits per Pixel is always LCD_BITS_PER_PIXEL_24 */ - Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; - Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK; - Info->PixelInformation.GreenMask= LCD_24BPP_GREEN_MASK; - Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK; - Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK; + Info->PixelFormat = FixedPcdGet32 (PcdGopPixelFormat); return EFI_SUCCESS; } diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index eb2a3c94b80129a16bf9ae26b7c2a5403556dc71..9b0d358846bf367d7f9ff6f5d3fdffc204864528 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -41,3 +41,4 @@ [Protocols] [FixedPcd] gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOsc
[edk2] [PATCH edk2-platforms v4 01/17] ARM/VExpressPkg: Fix MODULE_TYPE of HDLCD/PL111 platform libraries
From: Ard Biesheuvel <ard.biesheu...@linaro.org> This change fixes incorrect MODULE_TYPE of HDLCD and PL111 LcdPlatformLibs. Currently set MODUL_TYPE DXE_DRIVER is incorrect for these platform libraries. Hence set this to type BASE. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 4 ++-- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index fc51c781b45122eaf4f2269af61b44c8630cdfb8..5bbfb7eabb5d475a8c6ef21d0a3f75490be47467 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -2,7 +2,7 @@ # # Component description file for HdLcdArmLib module # -# Copyright (c) 2011-2012, ARM Ltd. All rights reserved. +# Copyright (c) 2011-2018, ARM Ltd. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -18,7 +18,7 @@ [Defines] INF_VERSION= 0x00010005 BASE_NAME = HdLcdArmVExpress FILE_GUID = 535a720e-06c0-4bb9-b563-452216abbed4 - MODULE_TYPE= DXE_DRIVER + MODULE_TYPE= BASE VERSION_STRING = 1.0 LIBRARY_CLASS = LcdPlatformLib diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf index fd83d2412d4fd2dfa59204f21626c62e377e3c55..7ffd217a7d1eefb06b99042c2b2a9ed0079f2bd3 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf @@ -2,7 +2,7 @@ # # Component description file for ArmVeGraphicsDxe module # -# Copyright (c) 2011-2012, ARM Ltd. All rights reserved. +# Copyright (c) 2011-2018, ARM Ltd. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -18,7 +18,7 @@ [Defines] INF_VERSION= 0x00010005 BASE_NAME = PL111LcdArmVExpressLib FILE_GUID = b7f06f20-496f-11e0-a8e8-0002a5d5c51b - MODULE_TYPE= DXE_DRIVER + MODULE_TYPE= BASE VERSION_STRING = 1.0 LIBRARY_CLASS = LcdPlatformLib -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v4 08/17] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove status check EFI_TIMEOUT
From: Girish Pathak None of the ArmPlatformSys* functions returns EFI_TIMEOUT. Hence checking this in the do {} while loop in LcdPlatformSetMode is wrong. Therefore remove this comparision and as a result remove the do {} while loop. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 22 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index d6d63295688f9aa5a6b24cee142760609439941d..cd62cd61883dcd78c72aa614466c6f714cc73fc4 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -230,25 +230,21 @@ LcdPlatformSetMode ( } // Set the video mode oscillator - do { -Status = ArmPlatformSysConfigSetDevice ( - SYS_CFG_OSC_SITE1, - FixedPcdGet32 (PcdHdLcdVideoModeOscId), - mResolutions[ModeNumber].OscFreq - ); - } while (Status == EFI_TIMEOUT); + Status = ArmPlatformSysConfigSetDevice ( + SYS_CFG_OSC_SITE1, + FixedPcdGet32 (PcdHdLcdVideoModeOscId), + mResolutions[ModeNumber].OscFreq + ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; } // Set the DVI into the new mode - do { -Status = ArmPlatformSysConfigSet ( - SYS_CFG_DVIMODE, - mResolutions[ModeNumber].Mode - ); - } while (Status == EFI_TIMEOUT); + Status = ArmPlatformSysConfigSet ( + SYS_CFG_DVIMODE, + mResolutions[ModeNumber].Mode + ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v4 06/17] ARM/VExpressPkg: PL111Lcd/HdLcd plaform libs: Minor code cleanup
From: Girish Pathak This minor change removes some unecessary initializations and variables in PL111LcdArmVExpress.c and redudant return status checks in HdLcdArmVExpress.c Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 5 + Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 16 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 5247b8e038ac45ba800d0f6c79f8718c99b951da..6fe7360d55c85ab9137b245b2fa7abf661de270e 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -259,10 +259,7 @@ LcdPlatformSetMode ( SYS_CFG_MUXFPGA, ARM_VE_DAUGHTERBOARD_1_SITE ); - if (EFI_ERROR (Status)) { -ASSERT_EFI_ERROR (Status); -return Status; - } + ASSERT_EFI_ERROR (Status); return Status; } diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 3d2ec7b1bf658a5fd644cd82fd1341245ba0f5d3..c229530ce8e7156d0b834abbe461a4d3213afc79 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -203,8 +203,6 @@ LcdPlatformGetVram ( { EFI_STATUS Status; - Status = EFI_SUCCESS; - ASSERT (VramBaseAddress != NULL); ASSERT (VramSize != NULL); @@ -214,6 +212,7 @@ LcdPlatformGetVram ( case ARM_VE_MOTHERBOARD_SITE: *VramBaseAddress = (EFI_PHYSICAL_ADDRESS)PL111_CLCD_VRAM_MOTHERBOARD_BASE; *VramSize = LCD_VRAM_SIZE; +Status = EFI_SUCCESS; break; case ARM_VE_DAUGHTERBOARD_1_SITE: @@ -242,7 +241,6 @@ LcdPlatformGetVram ( if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); - return Status; } break; @@ -292,7 +290,6 @@ LcdPlatformSetMode ( ) { EFI_STATUSStatus; - UINT32LcdSite; UINT32OscillatorId; SYS_CONFIG_FUNCTION Function; UINT32SysId; @@ -302,9 +299,7 @@ LcdPlatformSetMode ( return EFI_INVALID_PARAMETER; } - LcdSite = PL111_CLCD_SITE; - - switch (LcdSite) { + switch (PL111_CLCD_SITE) { case ARM_VE_MOTHERBOARD_SITE: Function = SYS_CFG_OSC; OscillatorId = PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID; @@ -349,11 +344,8 @@ LcdPlatformSetMode ( } // Set the multiplexer - Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, LcdSite); - if (EFI_ERROR (Status)) { -ASSERT_EFI_ERROR (Status); -return Status; - } + Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, PL111_CLCD_SITE); + ASSERT_EFI_ERROR (Status); return Status; } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v4 09/17] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove redundant Bpp
From: EvanLloyd Because of copy/paste effects, HdLcdArmVExpress.c contained a table entry "LCD_BPP Bpp;" specifying the Bits per Pixel for each mode. However, all modes are LCD_BITS_PER_PIXEL_24. This change removes the table entry and related use of the field. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 42 ++-- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index cd62cd61883dcd78c72aa614466c6f714cc73fc4..97cbe77ee79f53d3430b0fdb057a3bf262834849 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -32,7 +32,6 @@ typedef struct { UINT32 Mode; UINT32 HorizontalResolution; UINT32 VerticalResolution; - LCD_BPPBpp; UINT32 OscFreq; // These are used by HDLCD @@ -48,37 +47,37 @@ typedef struct { **/ LCD_RESOLUTION mResolutions[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp -VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, VGA_OSC_FREQUENCY, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp -SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, SVGA_OSC_FREQUENCY, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp -XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, XGA_OSC_FREQUENCY, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp -SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, (SXGA_OSC_FREQUENCY/2), SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp -UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, (UXGA_OSC_FREQUENCY/2), UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp -HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, (HD_OSC_FREQUENCY/2), HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH @@ -289,27 +288,12 @@ LcdPlatformQueryMode ( Info->VerticalResolution = mResolutions[ModeNumber].VerticalResolution; Info->PixelsPerScanLine = mResolutions[ModeNumber].HorizontalResolution; - switch (mResolutions[ModeNumber].Bpp) { - case LCD_BITS_PER_PIXEL_24: -Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; -Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK; -Info->PixelInformation.GreenMask= LCD_24BPP_GREEN_MASK; -Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK; -Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK; -break; - - case LCD_BITS_PER_PIXEL_16_555: - case LCD_BITS_PER_PIXEL_16_565: - case LCD_BITS_PER_PIXEL_12_444: - case LCD_BITS_PER_PIXEL_8: - case LCD_BITS_PER_PIXEL_4: - case LCD_BITS_PER_PIXEL_2: - case LCD_BITS_PER_PIXEL_1: - default: -// These are not supported -ASSERT (FALSE); -break; - } + /* Bits per Pixel is always LCD_BITS_PER_PIXEL_24 */ + Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; + Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK; + Info->PixelInformation.GreenMask= LCD_24BPP_GREEN_MASK; + Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK; + Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK; return EFI_SUCCESS; } @@ -392,7 +376,7 @@ LcdPlatformGetBpp ( return EFI_INVALID_PARAMETER; } - *Bpp = mResolutions[ModeNumber].Bpp; + *Bpp = LCD_BITS_PER_PIXEL_24; return EFI_SUCCESS; } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v4 04/17] ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf
PCD PcdPL111LcdMaxMode is not used in HDLCD platform library. Presence of this PCD in HDLCD is probably due to copy/paste code from PL111 Lcd platform library. This change removes it from the HdLcdArmVExpressLib.inf file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 1 - 1 file changed, 1 deletion(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index bedbaea3a296bea5184564c582659381733d08a9..34db24d4ee6162b0e963d500a8ed1097bd8a5ceb 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -40,5 +40,4 @@ [Protocols] gEfiEdidActiveProtocolGuid# Produced [Pcd] - gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v4 00/17] Update GOP
This patch series addresses comments on the patch v3 (https://lists.01.org/pipermail/edk2-devel/2018-March/023015.html) reworking of the Graphics Output Protocol code in ArmPlatformPkg. It also contains updates for the new SCMI protocol (MTL Library). Code is available for examination at: https://github.com/girishpathak/edk2-platforms/tree/201_gop_v4 Ard Biesheuvel (1): ARM/VExpressPkg: Fix MODULE_TYPE of HDLCD/PL111 platform libraries EvanLloyd (2): ARM/VExpressPkg: HdLcdArmVExpressLib: Remove redundant Bpp ARM/VExpressPkg: Redefine LcdPlatformGetTimings function Girish Pathak (14): ARM/VExpressPkg: Tidy HDLCD and PL11LCD platform Lib: Coding standard ARM/VExpressPkg: Tidy HdLcd/PL111Lcd code: Updated comments ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf ARM/VExpressPkg: Add and update debug ASSERTS ARM/VExpressPkg: PL111Lcd/HdLcd plaform libs: Minor code cleanup ARM/VExpressPkg: PL111 and HDLCD: Use FixedPcdGet32 ARM/VExpressPkg: HdLcdArmVExpressLib: Remove status check EFI_TIMEOUT ARM/VExpressPkg: PL111 and HDLCD: Add PCD to select pixel format ARM/VExpressPkg: Allocate framebuffer using EfiReservedMemoryType ARM/VExpressPkg: Reserving framebuffer at build ARM/VExpressPkg: Set EFI_MEMORY_XP flag on GOP framebuffer ARM/VExpressPkg: New DP500/DP550/DP650 platform library ARM/JunoPkg: Adding SCMI MTL library ARM/JunoPkg: Add HDLCD platform library Platform/ARM/JunoPkg/ArmJuno.dec | 17 +- Platform/ARM/JunoPkg/ArmJuno.dsc | 31 +- Platform/ARM/JunoPkg/ArmJuno.fdf | 12 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoLib.inf | 5 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c | 29 +- Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c | 198 +++ Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf | 39 ++ Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlPrivateLib.h | 94 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJuno.c | 555 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf | 41 ++ Platform/ARM/VExpressPkg/ArmVExpressPkg.dec | 3 +- Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c | 387 ++ Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf | 43 ++ Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 7 +- Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 53 +- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 310 +++ Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 14 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 389 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 10 +- 19 files changed, 1945 insertions(+), 292 deletions(-) create mode 100644 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c create mode 100644 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf create mode 100644 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlPrivateLib.h create mode 100644 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJuno.c create mode 100644 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf create mode 100644 Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c create mode 100644 Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH edk2-platforms v3 12/17] ARM/VExpressPkg: Allocate framebuffer using EfiRuntimeServicesData
> -Original Message- > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] > Sent: 21 March 2018 03:38 > To: Girish Pathak <girish.pat...@arm.com> > Cc: edk2-devel@lists.01.org; Leif Lindholm <leif.lindh...@linaro.org>; > Matteo Carlini <matteo.carl...@arm.com>; Stephanie Hughes-Fitt > <stephanie.hughes-f...@arm.com>; nd <n...@arm.com>; Arvind Chauhan > <arvind.chau...@arm.com>; Daniil Egranov <daniil.egra...@arm.com>; > Thomas Abraham <thomas.abra...@arm.com> > Subject: Re: [PATCH edk2-platforms v3 12/17] ARM/VExpressPkg: Allocate > framebuffer using EfiRuntimeServicesData > > On 21 March 2018 at 00:18, Girish Pathak <girish.pat...@arm.com> wrote: > > As per the UEFI specification(2.7) section 12.9, the GOP framebuffer > > memory can be accessed in the pre-boot and the post boot phase (by OS) > > Therefore the memory type EfiBootServicesData is incorrect for the > > framebuffer memory allocation. Change EfiBootServicesData with > > EfiRuntimeServicesData flag so that allocated memory can be access by > > the OS in the post boot phase. > > > > EfiRuntimeServicesData is intended for allocations that the EFI runtime > services need to access themselves at runtime, and will hence be virtually > remapped by SetVirtualAddressMap(). > > This does not apply to the framebuffer. Even if it may be used at OS runtime, > the firmware itself will never access it, so EfiRuntimeServicesData is not > appropriate > > Please use EfiReservedMemory instead. Specification (UEFI Spec 2_7_A Sept 6.pdf) describes EfiReservedMemoryType as Not usable before and after ExitBootServices, See Table 28 & 29 Hence EfiReservedMemoryType is not suitable in this case. Agree? > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Girish Pathak <girish.pat...@arm.com> > > Signed-off-by: Evan Lloyd <evan.ll...@arm.com> > > --- > > > Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpr > ess.c | 2 +- > > > > > Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArm > VEx > > press.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git > > > a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > s.c > > > b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > s.c index > > > f7cae39c9cc9954ba4cad1bd597ebfc8baf10f11..c0a25a18d3fcfe91a76ee985ee > 58 > > 145b97900fa0 100644 > > --- > > > a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > s.c > > +++ > b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > > +++ press.c > > @@ -176,7 +176,7 @@ LcdPlatformGetVram ( > >} > >Status = gBS->AllocatePages ( > >AllocationType, > > - EfiBootServicesData, > > + EfiRuntimeServicesData, > >EFI_SIZE_TO_PAGES (((UINTN)LCD_VRAM_SIZE)), > >VramBaseAddress > >); > > diff --git > > > a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdAr > mV > > Express.c > > > b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdAr > mV > > Express.c index > > > 2f4814a2adbf01517ba14d75ce579ff35c362379..61ddf77e903e6c33a26b2aa8b7 > 61 > > 21e807195a9a 100644 > > --- > > > a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdAr > mV > > Express.c > > +++ > b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111Lcd > > +++ ArmVExpress.c > > @@ -232,7 +232,7 @@ LcdPlatformGetVram ( > > // Allocate the VRAM from the DRAM so that nobody else uses it. > > Status = gBS->AllocatePages ( > > AllocateAddress, > > -EfiBootServicesData, > > +EfiRuntimeServicesData, > > EFI_SIZE_TO_PAGES (((UINTN)LCD_VRAM_SIZE)), > > VramBaseAddress > > ); > > -- > > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' > > > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 15/17] ARM/VExpressPkg: New DP500/DP550/DP650 platform library
From: Girish Pathak This change adds LcdPlatformLib implementation for Arm Mali DP500/DP500/DP650 display processors for models (with DP550 support). NOTE: Versions for actual hardware are liable to require extra handling for clock input changes, etc. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Please fix the funky indentation [Ard] Done [Girish] - Add EFI_MEMORY_XP [Ard] Done [Girish] Platform/ARM/VExpressPkg/ArmVExpressPkg.dec| 3 +- Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c | 387 Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf | 43 +++ Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 3 + Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 12 +- 5 files changed, 446 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec b/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec index 695553a94f7f7e963b5db995c5e54f1ae1559daf..ac77540362d0775bed45f517306b98ea16bfb170 100644 --- a/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec +++ b/Platform/ARM/VExpressPkg/ArmVExpressPkg.dec @@ -1,7 +1,7 @@ #/** @file # Arm Versatile Express package. # -# Copyright (c) 2012-2015, ARM Limited. All rights reserved. +# Copyright (c) 2012-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -51,6 +51,7 @@ [PcdsFixedAtBuild.common] gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId|1|UINT32|0x0003 gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId|0|UINT32|0x0005 + gArmVExpressTokenSpaceGuid.PcdArmMaliDpMaxMode|0|UINT32|0x0008 # # Device path of block device on which Fastboot will flash partitions diff --git a/Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c b/Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c new file mode 100644 index ..cc38e865d2246e12929ae65d1155a4e2ec6ac06f --- /dev/null +++ b/Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c @@ -0,0 +1,387 @@ +/** @file + + The file contains Arm Mali DP platform specific implementation. + + Copyright (c) 2017-2018, Arm Limited. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** Check an address is within 40 bits. + + The ARM Mali DP framebuffer address size can not be wider than 40 bits +**/ +#define DP_VALID_BASE_ADDR(Address) ((Address >> 40) == 0) + +typedef struct { + UINT32 OscFreq; + SCAN_TIMINGSHorizontal; + SCAN_TIMINGSVertical; +} DISPLAY_MODE; + +/** The display modes implemented by this driver. + + On Models, the OSC frequencies (listed for each mode below) are not used. + However these frequencies are useful on hardware plaforms where related + clock (or PLL) settings are based on these pixel clocks. + + Since the clock settings are defined externally, the driver must + communicate pixel clock frequencies to relevant modules + responsible for setting clocks. e.g. SCP. +**/ +STATIC DISPLAY_MODE mDisplayModes[] = { + { +// Mode 0 : VGA : 640 x 480 x 24 bpp. +VGA_OSC_FREQUENCY, +{VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, +{VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} + }, + { +// Mode 1 : WVGA : 800 x 480 x 24 bpp. +WVGA_OSC_FREQUENCY, +{WVGA_H_RES_PIXELS, WVGA_H_SYNC, WVGA_H_BACK_PORCH, WVGA_H_FRONT_PORCH}, +{WVGA_V_RES_PIXELS, WVGA_V_SYNC, WVGA_V_BACK_PORCH, WVGA_V_FRONT_PORCH} + }, + { +// Mode 2 : SVGA : 800 x 600 x 24 bpp. +SVGA_OSC_FREQUENCY, +{SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH}, +{SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} + }, + { +// Mode 3 : QHD : 960 x 540 x 24 bpp. +QHD_OSC_FREQUENCY, +{QHD_H_RES_PIXELS, QHD_H_SYNC, QHD_H_BACK_PORCH, QHD_H_FRONT_PORCH}, +{QHD_V_RES_PIXELS, QHD_V_SYNC, QHD_V_BACK_PORCH, QHD_V_FRONT_PORCH} + }, + { +// Mode 4 : WSVGA : 1024 x 600 x 24 b
[edk2] [PATCH edk2-platforms v3 14/17] ARM/VExpressPkg: Set EFI_MEMORY_XP flag on GOP framebuffer
The framebuffer memory is set with flag EFI_MEMORY_WC (uncached, unbuffered) which causes framebuffer memory with eXecute bit set. Framebuffer memory having executable bit set is a security hazard. This fix adds EFI_MEMORY_XP flag to avoid this. Unfortunately function gDS->SetMemorySpaceAttributes() causes assertion due to unsupported EFI_MEMORY_XP type. Therefore this fix replaces gDS->SetMemorySpaceAttributes() with Cpu->SetMemoryAttributes(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 24 ++-- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 1 - Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 24 ++-- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 1 - 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index c0a25a18d3fcfe91a76ee985ee58145b97900fa0..4c114de4062ece7cee1221148afb42e66d04f07e 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -17,11 +17,11 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -159,6 +159,7 @@ LcdPlatformGetVram ( { EFI_STATUS Status; EFI_ALLOCATE_TYPE AllocationType; + EFI_CPU_ARCH_PROTOCOL *Cpu; ASSERT (VramBaseAddress != NULL); ASSERT (VramSize != NULL); @@ -185,13 +186,22 @@ LcdPlatformGetVram ( return Status; } - // Mark the VRAM as write-combining. - // The VRAM is inside the DRAM, which is cacheable. - Status = gDS->SetMemorySpaceAttributes ( - *VramBaseAddress, - *VramSize, - EFI_MEMORY_WC + // Ensure the Cpu architectural protocol is already installed + Status = gBS->LocateProtocol ( + , + NULL, + (VOID **) ); + if (!EFI_ERROR (Status)) { +// The VRAM is inside the DRAM, which is cacheable. +// Mark the VRAM as write-combining (uncached) and non-executable. +Status = Cpu->SetMemoryAttributes ( +Cpu, +*VramBaseAddress, +*VramSize, +EFI_MEMORY_WC | EFI_MEMORY_XP +); + } if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index 9b0d358846bf367d7f9ff6f5d3fdffc204864528..c7b1b7fae77cbbf82b3a0768e7654a96719f5e7a 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -33,7 +33,6 @@ [Packages] [LibraryClasses] ArmPlatformSysConfigLib BaseLib - DxeServicesTableLib [Protocols] gEfiEdidDiscoveredProtocolGuid# Produced diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 61ddf77e903e6c33a26b2aa8b76121e807195a9a..cae5f3a658efa4cc2be135259b63c860c26c6874 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -17,10 +17,10 @@ #include #include #include -#include #include #include +#include #include #include @@ -212,6 +212,7 @@ LcdPlatformGetVram ( ) { EFI_STATUS Status; + EFI_CPU_ARCH_PROTOCOL *Cpu; ASSERT (VramBaseAddress != NULL); ASSERT (VramSize != NULL); @@ -241,13 +242,22 @@ LcdPlatformGetVram ( return Status; } -// Mark the VRAM as write-combining. -// The VRAM is inside the DRAM, which is cacheable. -Status = gDS->SetMemorySpaceAttributes ( -*VramBaseAddress, -*VramSize, -EFI_MEMORY_WC +// Ensure the Cpu architectural protocol is already installed +Status = gBS->LocateProtocol ( +, +NULL, +(VOID **) ); +if (!EFI_ERROR (Status)) { + // The VRAM is inside the DRAM, which is cacheable. + // Mark the VRAM as write-combining (uncached) and non-executable. + Status = Cpu->SetMem
[edk2] [PATCH edk2-platforms v3 16/17] ARM/JunoPkg: Adding SCMI MTL library
This change adds a new Mailbox Transport Layer library for the Juno platform. This library is required for ArmScmiDxe driver communication with the SCP. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> --- Notes: v3: - Please rename this library *instance* to something Juno-specific, e.g., ArmJunoMtlLib[Ard] Renamed to ArmJunoMtlLib [Girish] Platform/ARM/JunoPkg/ArmJuno.dec | 9 +- Platform/ARM/JunoPkg/ArmJuno.dsc | 5 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c | 8 +- Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c| 198 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf | 39 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlPrivateLib.h | 94 ++ 6 files changed, 349 insertions(+), 4 deletions(-) diff --git a/Platform/ARM/JunoPkg/ArmJuno.dec b/Platform/ARM/JunoPkg/ArmJuno.dec index 60cef6d23a2d904103b9806d871fd2b89fff51c3..fdb56fccb2b259301fd787016a9c4de7ab3c356d 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dec +++ b/Platform/ARM/JunoPkg/ArmJuno.dec @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2015, ARM Limited. All rights reserved. +# Copyright (c) 2013-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -46,3 +46,10 @@ [PcdsFixedAtBuild.common] # Juno Device Trees are loaded from NOR Flash gArmJunoTokenSpaceGuid.PcdJunoFdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/board.dtb"|VOID*|0x0008 + # MHU Register base used by SCMI Mailbox transport + gArmJunoTokenSpaceGuid.PcdArmMtlDoorBell|0x2B1F|UINT64|0x0024 + + # ARM_JUNO_NON_SECURE_SRAM_BASE used by SCMI Mailbox transport + gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxBase|0x2E00|UINT64|0x0025 + gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxSize|0x80|UINT32|0x0026 + diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc index 9d7317683ef39ab47429234b98d94c04953b41cb..851dc0f04ad693e4a88cee070b205f0234687d81 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dsc +++ b/Platform/ARM/JunoPkg/ArmJuno.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2017, ARM Limited. All rights reserved. +# Copyright (c) 2013-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -47,6 +47,9 @@ [LibraryClasses.common] # USB Requirements UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + # SCMI Mailbox Transport Layer + ArmMtlLib|Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf + [LibraryClasses.common.SEC] PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf diff --git a/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c b/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c index 2d9c2c95a80d9c34ba4a1a526950537a97ec5d10..2cac815e96104e74c9ceae2c4140bcab535432a8 100644 --- a/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c +++ b/Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2013-2015, ARM Limited. All rights reserved. +* Copyright (c) 2013-2018, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -107,7 +107,11 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[++Index].PhysicalBase = ARM_JUNO_NON_SECURE_SRAM_BASE; VirtualMemoryTable[Index].VirtualBase = ARM_JUNO_NON_SECURE_SRAM_BASE; VirtualMemoryTable[Index].Length = ARM_JUNO_NON_SECURE_SRAM_SZ; - VirtualMemoryTable[Index].Attributes = CacheAttributes; + // This memory is shared between the application processor + // and the SCP. To avoid coherency problems, map it as uncached memory. + // NOTE: The attribute value is misleading, it indicates memory map type as + // an un-cached, un-buffered but allows buffering and reordering. + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; // PCI Root Complex VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPcieControlBaseAddress); diff --git a/Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c b/Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c new file mode 100644 index ..ee1efe1574c124c7f7cf1fb345b46806bc3a4466 --- /dev/null +++ b/Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c @@ -0,0 +1,198 @@ +/** @file + + Copyright (c) 2017-2018, Arm Limited. All rights reserved. +
[edk2] [PATCH edk2-platforms v3 09/17] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove redundant Bpp
From: EvanLloyd Because of copy/paste effects, HdLcdArmVExpress.c contained a table entry "LCD_BPP Bpp;" specifying the Bits per Pixel for each mode. However, all modes are LCD_BITS_PER_PIXEL_24. This change removes the table entry and related use of the field. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 42 ++-- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index cd62cd61883dcd78c72aa614466c6f714cc73fc4..97cbe77ee79f53d3430b0fdb057a3bf262834849 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -32,7 +32,6 @@ typedef struct { UINT32 Mode; UINT32 HorizontalResolution; UINT32 VerticalResolution; - LCD_BPPBpp; UINT32 OscFreq; // These are used by HDLCD @@ -48,37 +47,37 @@ typedef struct { **/ LCD_RESOLUTION mResolutions[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp -VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, VGA_OSC_FREQUENCY, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp -SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, SVGA_OSC_FREQUENCY, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp -XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, XGA_OSC_FREQUENCY, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp -SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, (SXGA_OSC_FREQUENCY/2), SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp -UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, (UXGA_OSC_FREQUENCY/2), UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp -HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, (HD_OSC_FREQUENCY/2), HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH @@ -289,27 +288,12 @@ LcdPlatformQueryMode ( Info->VerticalResolution = mResolutions[ModeNumber].VerticalResolution; Info->PixelsPerScanLine = mResolutions[ModeNumber].HorizontalResolution; - switch (mResolutions[ModeNumber].Bpp) { - case LCD_BITS_PER_PIXEL_24: -Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; -Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK; -Info->PixelInformation.GreenMask= LCD_24BPP_GREEN_MASK; -Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK; -Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK; -break; - - case LCD_BITS_PER_PIXEL_16_555: - case LCD_BITS_PER_PIXEL_16_565: - case LCD_BITS_PER_PIXEL_12_444: - case LCD_BITS_PER_PIXEL_8: - case LCD_BITS_PER_PIXEL_4: - case LCD_BITS_PER_PIXEL_2: - case LCD_BITS_PER_PIXEL_1: - default: -// These are not supported -ASSERT (FALSE); -break; - } + /* Bits per Pixel is always LCD_BITS_PER_PIXEL_24 */ + Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; + Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK; + Info->PixelInformation.GreenMask= LCD_24BPP_GREEN_MASK; + Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK; + Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK; return EFI_SUCCESS; } @@ -392,7 +376,7 @@ LcdPlatformGetBpp ( return EFI_INVALID_PARAMETER; } - *Bpp = mResolutions[ModeNumber].Bpp; + *Bpp = LCD_BITS_PER_PIXEL_24; return EFI_SUCCESS; } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 13/17] ARM/VExpressPkg: Reserving framebuffer at build
From: Girish Pathak This change uses two PCDs, PcdArmLcdFrameBufferBase and PcdArmLcdFrameBufferSize introduced in correspondiong EDK2 patch to reserve framebuffer in DRAM if these values are defined in platform specific DSC file, avoiding the need to allocate dynamically. This allows the framebuffer to appear as "I/O memory" outside of the normal RAM map, which is similar to the "VRAM" case. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Move PcdArmLcdDdrFrameBufferBase and PcdArmLcdDdrFrameBufferSize to VExpressPkg. [Ard] These PCDs are also used for the Juno platform hence these PCDs are defined for the ArmPlatformPkg so that both platform can use it.[Girish] - Could you please add an ASSERT() so that System Memory and PcdArmLcdDdrFrameBufferBase do not overlap [Ard] Done[Girish] Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 4 +- Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 41 ++-- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf index 8c6291c42f8a599591d00d7afcb2ff3399417034..b025abd98b5e654323b7821ac353ad920e2e6421 100644 --- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf @@ -1,5 +1,5 @@ #/* @file -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2018, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -54,6 +54,8 @@ [FixedPcd] gArmTokenSpaceGuid.PcdArmPrimaryCore gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferSize [Ppis] gArmMpCoreInfoPpiGuid diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c index 9fb0803d31ad0dbab59875bae99fd8a381d484b7..1d5fefc21726ba1b05d90e0e47677575d7fa2034 100644 --- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c +++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011-2016, ARM Limited. All rights reserved. +* Copyright (c) 2011-2018, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -128,17 +128,34 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length = 2 * ARM_VE_SMB_PERIPH_SZ; VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - // VRAM - VirtualMemoryTable[++Index].PhysicalBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; - VirtualMemoryTable[Index].VirtualBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; - VirtualMemoryTable[Index].Length = PL111_CLCD_VRAM_MOTHERBOARD_SIZE; - // - // Map the VRAM region as Normal Non-Cacheable memory and not device memory, - // so that we can use the accelerated string routines that may use unaligned - // accesses or DC ZVA instructions. The enum identifier is slightly awkward - // here, but it maps to a memory type that allows buffering and reordering. - // - VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + // Map region for the framebuffer in the system RAM if no VRAM present + if (FixedPcdGet32 (PcdArmLcdDdrFrameBufferBase) == 0) { +// VRAM +VirtualMemoryTable[++Index].PhysicalBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; +VirtualMemoryTable[Index].VirtualBase = PL111_CLCD_VRAM_MOTHERBOARD_BASE; +VirtualMemoryTable[Index].Length = PL111_CLCD_VRAM_MOTHERBOARD_SIZE; +// +// Map the VRAM region as Normal Non-Cacheable memory and not device memory, +// so that we can use the accelerated string routines that may use unaligned +// accesses or DC ZVA instructions. The enum identifier is slightly awkward +// here, but it maps to a memory type that allows buffering and reordering. +// +VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + } else { +ASSERT ((ARM_VE_DRAM_BASE + ARM_VE_DRAM_SZ - 1) < +FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase)); +VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase); +VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdArmLcdDdrFrameB
[edk2] [PATCH edk2-platforms v3 17/17] ARM/JunoPkg: Add HDLCD platform library
This change adds the HDLCD platform lib for the Juno plaform. This library will be instantiated as a LcdPlatformLib to link with LcdGraphicsOutputDxe for the Juno platform. HDLCD platform library depends on the Arm SCMI DXE driver for communication with the SCP for clock setting. Therefore this change also enables building of Arm SCMI DXE driver for the Juno platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Wouldn't it make more sense to add a macro ENABLE_HDLCD, rather than inverting the logic?[Ard] We used this to correspond with the ACPI (FADT) terminology, where HEADLESS implies more than just no display. Refer below email [Evan] https://lists.01.org/pipermail/edk2-devel/ 2018-January/019925.html - SRAM mapping: Couldn't you map it as non-cacheable memory instead [Ard] Done [Girish] - Please fix weird indentation [Ard] Done [Girish] - Please don't use CPP conditionals for control flow [Ard] Done [Girish] Platform/ARM/JunoPkg/ArmJuno.dec | 8 + Platform/ARM/JunoPkg/ArmJuno.dsc | 26 + Platform/ARM/JunoPkg/ArmJuno.fdf | 12 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoLib.inf | 5 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c | 21 +- Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJuno.c | 555 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf | 41 ++ 7 files changed, 665 insertions(+), 3 deletions(-) diff --git a/Platform/ARM/JunoPkg/ArmJuno.dec b/Platform/ARM/JunoPkg/ArmJuno.dec index fdb56fccb2b259301fd787016a9c4de7ab3c356d..edbbb827ad45cf9e33adede006628432aa41c77b 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dec +++ b/Platform/ARM/JunoPkg/ArmJuno.dec @@ -53,3 +53,11 @@ [PcdsFixedAtBuild.common] gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxBase|0x2E00|UINT64|0x0025 gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxSize|0x80|UINT32|0x0026 + # MaxMode must be one number higher than the actual max mode, + # i.e. for actual maximum mode 2, set the value to 3. + # + # Default value zero allows platform to enumerate maximum supported mode. + # + # For a list of mode numbers look in HdLcdArmJuno.c + gArmJunoTokenSpaceGuid.PcdArmHdLcdMaxMode|0|UINT32|0x0017 + diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc index 851dc0f04ad693e4a88cee070b205f0234687d81..d5e87f1edfd5d60a543e51cb42dfbcc4489d3f7d 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dsc +++ b/Platform/ARM/JunoPkg/ArmJuno.dsc @@ -50,6 +50,11 @@ [LibraryClasses.common] # SCMI Mailbox Transport Layer ArmMtlLib|Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf +!ifndef HEADLESS_PLATFORM + LcdPlatformLib|Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf + LcdHwLib|ArmPlatformPkg/Library/HdLcd/HdLcd.inf +!endif + [LibraryClasses.common.SEC] PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf @@ -100,7 +105,15 @@ [PcdsFixedAtBuild.common] # System Memory (2GB - 16MB of Trusted DRAM at the top of the 32bit address space) gArmTokenSpaceGuid.PcdSystemMemoryBase|0x8000 + +!ifdef HEADLESS_PLATFORM gArmTokenSpaceGuid.PcdSystemMemorySize|0x7F00 +!else + # Default framebuffer size is 0x7E9000, reduce system memory size for framebuffer. + gArmTokenSpaceGuid.PcdSystemMemorySize|0x7E817000 + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase|0xFE817000 + gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect|TRUE +!endif # Juno Dual-Cluster profile gArmPlatformTokenSpaceGuid.PcdCoreCount|6 @@ -142,6 +155,11 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C01 gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C02F000 +!ifndef HEADLESS_PLATFORM + # ARM Juno HDLCD Base + gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x7FF6 +!endif + # # PLDA PCI Root Complex # @@ -315,6 +333,11 @@ [Components.common] MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf +!ifndef HEADLESS_PLATFORM + # Graphic Output Protocol + ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf +!endif + # # Juno platform driver # @@ -348,6 +371,9 @@ [Components.common] BdsLib|Platform
[edk2] [PATCH edk2-platforms v3 10/17] ARM/VExpressPkg: Redefine LcdPlatformGetTimings function
From: EvanLloyd The LcdPlatformGetTimings interface function takes similar sets of multiple parameters for horizontal and vertical timings which can be aggregated in a common data type. This change defines a structure SCAN_TIMINGS for this which can be used to describe both horizontal and vertical scan timings, and accordingly redefines the LcdPlatformGetTiming interface, greatly reducing the amount of data passed about. Similarly the mode definition tables are also changed to use this data type and thus enable pass through access. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 106 +--- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 168 2 files changed, 109 insertions(+), 165 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 97cbe77ee79f53d3430b0fdb057a3bf262834849..0c3a4efd6d8d1617965394f461c3f3e7bf70994d 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -30,57 +30,51 @@ typedef struct { UINT32 Mode; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; UINT32 OscFreq; // These are used by HDLCD - UINT32 HSync; - UINT32 HBackPorch; - UINT32 HFrontPorch; - UINT32 VSync; - UINT32 VBackPorch; - UINT32 VFrontPorch; -} LCD_RESOLUTION; + SCAN_TIMINGS Horizontal; + SCAN_TIMINGS Vertical; +} DISPLAY_MODE; /** The display modes supported by the platform. **/ -LCD_RESOLUTION mResolutions[] = { +STATIC DISPLAY_MODE mDisplayModes[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp -VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, +VGA, VGA_OSC_FREQUENCY, -VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, -VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH +{VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, +{VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp -SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, +SVGA, SVGA_OSC_FREQUENCY, -SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, -SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH +{SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH}, +{SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp -XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, +XGA, XGA_OSC_FREQUENCY, -XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, -XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH +{XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, +{XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp -SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, +SXGA, (SXGA_OSC_FREQUENCY/2), -SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, -SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH +{SXGA_H_RES_PIXELS, SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH}, +{SXGA_V_RES_PIXELS, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH} }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp -UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, +UXGA, (UXGA_OSC_FREQUENCY/2), -UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, -UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH +{UXGA_H_RES_PIXELS, UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH}, +{UXGA_V_RES_PIXELS, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH} }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp -HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, +HD, (HD_OSC_FREQUENCY/2), -HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, -HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH +{HD_H_RES_PIXELS, HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH}, +{HD_V_RES_PIXELS, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH} } }; @@ -205,7 +199,7 @@ LcdPlatformGetMaxMode (VOID) { // The following line will report correctly the total number of graphics modes // that could be supported by the graphics driver - return (sizeof (mResolutions) / sizeof (LCD_RESOLUTION)); + return (sizeof (mDisplayModes) / sizeof (DISPLAY_MODE)); } /** Set the requested display mode. @@ -232,7 +226,7 @@ LcdPlatformSetMode ( Status = ArmPlatform
[edk2] [PATCH edk2-platforms v3 07/17] ARM/VExpressPkg: PL111 and HDLCD: Use FixedPcdGet32
From: Girish Pathak This change replaces PcdGet32 with FixedPcdGet32 for the PCDs which are defined as fixed PCDs. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 2 +- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 2 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 4 ++-- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 6fe7360d55c85ab9137b245b2fa7abf661de270e..d6d63295688f9aa5a6b24cee142760609439941d 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -233,7 +233,7 @@ LcdPlatformSetMode ( do { Status = ArmPlatformSysConfigSetDevice ( SYS_CFG_OSC_SITE1, - PcdGet32 (PcdHdLcdVideoModeOscId), + FixedPcdGet32 (PcdHdLcdVideoModeOscId), mResolutions[ModeNumber].OscFreq ); } while (Status == EFI_TIMEOUT); diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index 34db24d4ee6162b0e963d500a8ed1097bd8a5ceb..eb2a3c94b80129a16bf9ae26b7c2a5403556dc71 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -39,5 +39,5 @@ [Protocols] gEfiEdidDiscoveredProtocolGuid# Produced gEfiEdidActiveProtocolGuid# Produced -[Pcd] +[FixedPcd] gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index c229530ce8e7156d0b834abbe461a4d3213afc79..c51540e1c00a1f46ca845d95306e28e7ca6bfde5 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -272,7 +272,7 @@ LcdPlatformGetMaxMode (VOID) // certain limitations. // Set the maximum mode allowed - return (PcdGet32 (PcdPL111LcdMaxMode)); + return (FixedPcdGet32 (PcdPL111LcdMaxMode)); } /** Set the requested display mode. @@ -306,7 +306,7 @@ LcdPlatformSetMode ( break; case ARM_VE_DAUGHTERBOARD_1_SITE: Function = SYS_CFG_OSC_SITE1; -OscillatorId = (UINT32)PcdGet32 (PcdPL111LcdVideoModeOscId); +OscillatorId = FixedPcdGet32 (PcdPL111LcdVideoModeOscId); break; default: return EFI_UNSUPPORTED; diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf index 9ca2ace9594d21050c3e53705054c25c69e238f4..f48936f394accc98e8d031fcd2900a6f4611 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf @@ -39,6 +39,6 @@ [Protocols] gEfiEdidDiscoveredProtocolGuid# Produced gEfiEdidActiveProtocolGuid# Produced -[Pcd] +[FixedPcd] gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 06/17] ARM/VExpressPkg: PL111Lcd/HdLcd plaform libs: Minor code cleanup
From: Girish Pathak This minor change removes some unecessary initializations and variables in PL111LcdArmVExpress.c and redudant return status checks in HdLcdArmVExpress.c Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 5 + Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 16 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 5247b8e038ac45ba800d0f6c79f8718c99b951da..6fe7360d55c85ab9137b245b2fa7abf661de270e 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -259,10 +259,7 @@ LcdPlatformSetMode ( SYS_CFG_MUXFPGA, ARM_VE_DAUGHTERBOARD_1_SITE ); - if (EFI_ERROR (Status)) { -ASSERT_EFI_ERROR (Status); -return Status; - } + ASSERT_EFI_ERROR (Status); return Status; } diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 3d2ec7b1bf658a5fd644cd82fd1341245ba0f5d3..c229530ce8e7156d0b834abbe461a4d3213afc79 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -203,8 +203,6 @@ LcdPlatformGetVram ( { EFI_STATUS Status; - Status = EFI_SUCCESS; - ASSERT (VramBaseAddress != NULL); ASSERT (VramSize != NULL); @@ -214,6 +212,7 @@ LcdPlatformGetVram ( case ARM_VE_MOTHERBOARD_SITE: *VramBaseAddress = (EFI_PHYSICAL_ADDRESS)PL111_CLCD_VRAM_MOTHERBOARD_BASE; *VramSize = LCD_VRAM_SIZE; +Status = EFI_SUCCESS; break; case ARM_VE_DAUGHTERBOARD_1_SITE: @@ -242,7 +241,6 @@ LcdPlatformGetVram ( if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); - return Status; } break; @@ -292,7 +290,6 @@ LcdPlatformSetMode ( ) { EFI_STATUSStatus; - UINT32LcdSite; UINT32OscillatorId; SYS_CONFIG_FUNCTION Function; UINT32SysId; @@ -302,9 +299,7 @@ LcdPlatformSetMode ( return EFI_INVALID_PARAMETER; } - LcdSite = PL111_CLCD_SITE; - - switch (LcdSite) { + switch (PL111_CLCD_SITE) { case ARM_VE_MOTHERBOARD_SITE: Function = SYS_CFG_OSC; OscillatorId = PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID; @@ -349,11 +344,8 @@ LcdPlatformSetMode ( } // Set the multiplexer - Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, LcdSite); - if (EFI_ERROR (Status)) { -ASSERT_EFI_ERROR (Status); -return Status; - } + Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, PL111_CLCD_SITE); + ASSERT_EFI_ERROR (Status); return Status; } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 11/17] ARM/VExpressPkg: PL111 and HDLCD: Add PCD to select pixel format
From: Girish Pathak Current HDLCD and PL111 platform libraries do not support display modes with PixelBlueGreenRedReserved8BitPerColor format, i.e. because of historical confusion, they do not support the UEFI default PixelBlueGreenRedReserved8BitPerColor LcdPlatformLib for PL111, LcdPlatformQueryMode function returns the pixel format as PixelRedGreenBlueReserved8BitPerColor which is wrong, because that does not match the display controller's pixel format which is set to BGR in PL111Lcd GOP driver. Also it is not possible to configure pixel format as RGB/BGR for the display modes for a platform at build time. This change adds PcdGopPixelFormat to configure pixel format as PixelRedGreenBlueReserved8BitPerColoror PixelBlueGreenRedReserved8BitPerColoror PixelBitMask. With this change, pixel format can be selected in the platform specific .dsc file for all supported display modes. Support for PixelBitMask is not implemented in PL111 or HDLCD GOP driver, hence HDLCD and PL111 platform libraries will return error EFI_UNSUPPORTED if PcdGopPixelFormat is set to PixelBitMask. Indeed, it is not clear what selecting PixelBitMask might mean, but the option is allowed as it might suit a custom platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Notes: v3: - Fix minor indentation [Ard] Done [Girish Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 23 Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 1 + Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 38 +--- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 1 + 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 0c3a4efd6d8d1617965394f461c3f3e7bf70994d..f7cae39c9cc9954ba4cad1bd597ebfc8baf10f11 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -93,6 +92,10 @@ EFI_EDID_ACTIVE_PROTOCOL mEdidActive = { @param[in] Handle Handle to the LCD device instance. @retval EFI_SUCCESSPlaform library initialized successfully. + @retval EFI_UNSUPPORTEDPcdGopPixelFormat must be + PixelRedGreenBlueReserved8BitPerColor OR + PixelBlueGreenRedReserved8BitPerColor + any other format is not supported. @retval !(EFI_SUCCESS) Other errors. **/ EFI_STATUS @@ -101,6 +104,17 @@ LcdPlatformInitializeDisplay ( ) { EFI_STATUS Status; + EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; + + // PixelBitMask and PixelBltOnly pixel formats are not supported + PixelFormat = FixedPcdGet32 (PcdGopPixelFormat); + if (PixelFormat != PixelRedGreenBlueReserved8BitPerColor && + PixelFormat != PixelBlueGreenRedReserved8BitPerColor) { + +ASSERT (PixelFormat == PixelRedGreenBlueReserved8BitPerColor || + PixelFormat == PixelBlueGreenRedReserved8BitPerColor); +return EFI_UNSUPPORTED; + } // Set the FPGA multiplexer to select the video output from the // motherboard or the daughterboard @@ -282,12 +296,7 @@ LcdPlatformQueryMode ( Info->VerticalResolution = mDisplayModes[ModeNumber].Vertical.Resolution; Info->PixelsPerScanLine = mDisplayModes[ModeNumber].Horizontal.Resolution; - /* Bits per Pixel is always LCD_BITS_PER_PIXEL_24 */ - Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; - Info->PixelInformation.RedMask = LCD_24BPP_RED_MASK; - Info->PixelInformation.GreenMask= LCD_24BPP_GREEN_MASK; - Info->PixelInformation.BlueMask = LCD_24BPP_BLUE_MASK; - Info->PixelInformation.ReservedMask = LCD_24BPP_RESERVED_MASK; + Info->PixelFormat = FixedPcdGet32 (PcdGopPixelFormat); return EFI_SUCCESS; } diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index eb2a3c94b80129a16bf9ae26b7c2a5403556dc71..9b0d358846bf367d7f9ff6f5d3fdffc204864528 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -41,3 +41,4 @@ [Protocols] [FixedPcd] gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOsc
[edk2] [PATCH edk2-platforms v3 12/17] ARM/VExpressPkg: Allocate framebuffer using EfiRuntimeServicesData
As per the UEFI specification(2.7) section 12.9, the GOP framebuffer memory can be accessed in the pre-boot and the post boot phase (by OS) Therefore the memory type EfiBootServicesData is incorrect for the framebuffer memory allocation. Change EfiBootServicesData with EfiRuntimeServicesData flag so that allocated memory can be access by the OS in the post boot phase. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 2 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index f7cae39c9cc9954ba4cad1bd597ebfc8baf10f11..c0a25a18d3fcfe91a76ee985ee58145b97900fa0 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -176,7 +176,7 @@ LcdPlatformGetVram ( } Status = gBS->AllocatePages ( AllocationType, - EfiBootServicesData, + EfiRuntimeServicesData, EFI_SIZE_TO_PAGES (((UINTN)LCD_VRAM_SIZE)), VramBaseAddress ); diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 2f4814a2adbf01517ba14d75ce579ff35c362379..61ddf77e903e6c33a26b2aa8b76121e807195a9a 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -232,7 +232,7 @@ LcdPlatformGetVram ( // Allocate the VRAM from the DRAM so that nobody else uses it. Status = gBS->AllocatePages ( AllocateAddress, -EfiBootServicesData, +EfiRuntimeServicesData, EFI_SIZE_TO_PAGES (((UINTN)LCD_VRAM_SIZE)), VramBaseAddress ); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 08/17] ARM/VExpressPkg: HdLcdArmVExpressLib: Remove status check EFI_TIMEOUT
From: Girish Pathak None of the ArmPlatformSys* functions returns EFI_TIMEOUT. Hence checking this in the do {} while loop in LcdPlatformSetMode is wrong. Therefore remove this comparision and as a result remove the do {} while loop. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 22 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index d6d63295688f9aa5a6b24cee142760609439941d..cd62cd61883dcd78c72aa614466c6f714cc73fc4 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -230,25 +230,21 @@ LcdPlatformSetMode ( } // Set the video mode oscillator - do { -Status = ArmPlatformSysConfigSetDevice ( - SYS_CFG_OSC_SITE1, - FixedPcdGet32 (PcdHdLcdVideoModeOscId), - mResolutions[ModeNumber].OscFreq - ); - } while (Status == EFI_TIMEOUT); + Status = ArmPlatformSysConfigSetDevice ( + SYS_CFG_OSC_SITE1, + FixedPcdGet32 (PcdHdLcdVideoModeOscId), + mResolutions[ModeNumber].OscFreq + ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; } // Set the DVI into the new mode - do { -Status = ArmPlatformSysConfigSet ( - SYS_CFG_DVIMODE, - mResolutions[ModeNumber].Mode - ); - } while (Status == EFI_TIMEOUT); + Status = ArmPlatformSysConfigSet ( + SYS_CFG_DVIMODE, + mResolutions[ModeNumber].Mode + ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 05/17] ARM/VExpressPkg: Add and update debug ASSERTS
From: Girish Pathak This change adds some debug assertions e.g to catch NULL pointer errors missing in PL11Lcd and HdLcd platform libraries. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: V3: - Use ASSERT_EFI_ERROR (Status) in place of ASSERT (FALSE) [Ard] Done [Girish] Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 22 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 24 +++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 80603f04df3793b8b62196990c846de9ba8f130d..5247b8e038ac45ba800d0f6c79f8718c99b951da 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -153,6 +153,9 @@ LcdPlatformGetVram ( EFI_STATUS Status; EFI_ALLOCATE_TYPE AllocationType; + ASSERT (VramBaseAddress != NULL); + ASSERT (VramSize != NULL); + // Set the vram size *VramSize = LCD_VRAM_SIZE; @@ -171,6 +174,7 @@ LcdPlatformGetVram ( VramBaseAddress ); if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); return Status; } @@ -181,8 +185,8 @@ LcdPlatformGetVram ( *VramSize, EFI_MEMORY_WC ); - ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { +ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); return Status; } @@ -221,6 +225,7 @@ LcdPlatformSetMode ( EFI_STATUSStatus; if (ModeNumber >= LcdPlatformGetMaxMode ()) { +ASSERT (FALSE); return EFI_INVALID_PARAMETER; } @@ -279,7 +284,10 @@ LcdPlatformQueryMode ( OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info ) { + ASSERT (Info != NULL); + if (ModeNumber >= LcdPlatformGetMaxMode ()) { +ASSERT (FALSE); return EFI_INVALID_PARAMETER; } @@ -343,7 +351,18 @@ LcdPlatformGetTimings ( OUT UINT32* VFrontPorch ) { + // One of the pointers is NULL + ASSERT (HRes != NULL); + ASSERT (HSync != NULL); + ASSERT (HBackPorch != NULL); + ASSERT (HFrontPorch != NULL); + ASSERT (VRes != NULL); + ASSERT (VSync != NULL); + ASSERT (VBackPorch != NULL); + ASSERT (VFrontPorch != NULL); + if (ModeNumber >= LcdPlatformGetMaxMode ()) { +ASSERT (FALSE); return EFI_INVALID_PARAMETER; } @@ -376,6 +395,7 @@ LcdPlatformGetBpp ( ) { if (ModeNumber >= LcdPlatformGetMaxMode ()) { +ASSERT (FALSE); return EFI_INVALID_PARAMETER; } diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 3e3102623ebc46cbe31b7f3500021f53f2281d1b..3d2ec7b1bf658a5fd644cd82fd1341245ba0f5d3 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -205,6 +205,9 @@ LcdPlatformGetVram ( Status = EFI_SUCCESS; + ASSERT (VramBaseAddress != NULL); + ASSERT (VramSize != NULL); + // Is it on the motherboard or on the daughterboard? switch (PL111_CLCD_SITE) { @@ -225,6 +228,7 @@ LcdPlatformGetVram ( VramBaseAddress ); if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); return Status; } @@ -235,8 +239,8 @@ LcdPlatformGetVram ( *VramSize, EFI_MEMORY_WC ); -ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); return Status; } @@ -294,6 +298,7 @@ LcdPlatformSetMode ( UINT32SysId; if (ModeNumber >= LcdPlatformGetMaxMode ()) { +ASSERT (FALSE); return EFI_INVALID_PARAMETER; } @@ -369,7 +374,10 @@ LcdPlatformQueryMode ( OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info ) { + ASSERT (Info != NULL); + if (ModeNumber >= LcdPlatformGetMaxMode ()) { +ASSERT (FALSE); return EFI_INVALID_PARAMETER; } @@ -433,7 +441,18 @@ LcdPlatformGetTimings ( OUT UINT32* VFrontPorch ) { + // One of the pointers is NULL + ASSERT (HRes != NULL); + ASSERT (HSync != NULL); + ASSERT (HBackPorch != NULL); + ASSERT (HFrontPorch != NULL); + ASSERT (VRes != NULL); + ASSERT (VSync != NULL); + ASSERT (VBackPorch != N
[edk2] [PATCH edk2-platforms v3 02/17] ARM/VExpressPkg: Tidy HDLCD and PL11LCD platform Lib: Coding standard
From: Girish Pathak There is no functional modification in this change As preparation for further work, the formatting is corrected to meet the EDKII coding standard. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 136 ++- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 5 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 238 +++- 3 files changed, 218 insertions(+), 161 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index b1106ee19b98cebac01820924514eac79b97d0d5..36ea484bbceac51566bfeaf029b1aa0ede93dee1 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -1,6 +1,6 @@ -/** +/** @file - Copyright (c) 2012, ARM Ltd. All rights reserved. + Copyright (c) 2012-2018, ARM Ltd. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -44,35 +44,40 @@ typedef struct { UINT32 VFrontPorch; } LCD_RESOLUTION; - LCD_RESOLUTION mResolutions[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp -VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, VGA_OSC_FREQUENCY, +VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +VGA_OSC_FREQUENCY, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp -SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, SVGA_OSC_FREQUENCY, +SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +SVGA_OSC_FREQUENCY, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp -XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, XGA_OSC_FREQUENCY, +XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +XGA_OSC_FREQUENCY, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp -SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (SXGA_OSC_FREQUENCY/2), +SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +(SXGA_OSC_FREQUENCY/2), SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp -UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (UXGA_OSC_FREQUENCY/2), +UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +(UXGA_OSC_FREQUENCY/2), UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp -HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, (HD_OSC_FREQUENCY/2), +HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, +(HD_OSC_FREQUENCY/2), HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH } @@ -95,19 +100,25 @@ LcdPlatformInitializeDisplay ( { EFI_STATUS Status; - // Set the FPGA multiplexer to select the video output from the motherboard or the daughterboard - Status = ArmPlatformSysConfigSet (SYS_CFG_MUXFPGA, ARM_VE_DAUGHTERBOARD_1_SITE); - if (EFI_ERROR(Status)) { + // Set the FPGA multiplexer to select the video output from the + // motherboard or the daughterboard + Status = ArmPlatformSysConfigSet ( + SYS_CFG_MUXFPGA, + ARM_VE_DAUGHTERBOARD_1_SITE + ); + if (EFI_ERROR (Status)) { return Status; } // Install the EDID Protocols Status = gBS->InstallMultipleProtocolInterfaces ( -, -, , -, , -NULL - ); + , + , + , + , + , + NULL + ); return Status; } @@ -132,16 +143,25 @@ LcdPlatformGetVram ( } else { AllocationType = AllocateAddress; } - Status = gBS->AllocatePages (AllocationType, EfiBootServicesData, EFI_SIZE_TO_PAGES(((UINTN)LCD_VRAM_SIZE)), VramBaseAddress); - if (EFI_ERROR(Status)) { + Status = gBS->AllocatePages ( + AllocationType, + EfiBootServicesData, + EFI_SIZE_TO_P
[edk2] [PATCH edk2-platforms v3 04/17] ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf
PCD PcdPL111LcdMaxMode is not used in HDLCD platform library. Presence of this PCD in HDLCD is probably due to copy/paste code from PL111 Lcd platform library. This change removes it from the HdLcdArmVExpressLib.inf file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 1 - 1 file changed, 1 deletion(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index bedbaea3a296bea5184564c582659381733d08a9..34db24d4ee6162b0e963d500a8ed1097bd8a5ceb 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -40,5 +40,4 @@ [Protocols] gEfiEdidActiveProtocolGuid# Produced [Pcd] - gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 03/17] ARM/VExpressPkg: Tidy HdLcd/PL111Lcd code: Updated comments
From: Girish Pathak There is no functional modification in this change. In this change some comments in HDLCD and PL111LCD platform library code are modified and a few new comments are added. This is to prevent mixing formatting changes with functional changes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 74 Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 73 +++ Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 2 +- 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index 36ea484bbceac51566bfeaf029b1aa0ede93dee1..80603f04df3793b8b62196990c846de9ba8f130d 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -44,6 +44,8 @@ typedef struct { UINT32 VFrontPorch; } LCD_RESOLUTION; +/** The display modes supported by the platform. +**/ LCD_RESOLUTION mResolutions[] = { { // Mode 0 : VGA : 640 x 480 x 24 bpp VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, @@ -93,6 +95,13 @@ EFI_EDID_ACTIVE_PROTOCOL mEdidActive = { NULL }; +/** HDLCD platform specific initialization function. + + @param[in] Handle Handle to the LCD device instance. + + @retval EFI_SUCCESSPlaform library initialized successfully. + @retval !(EFI_SUCCESS) Other errors. +**/ EFI_STATUS LcdPlatformInitializeDisplay ( IN EFI_HANDLE Handle @@ -123,6 +132,18 @@ LcdPlatformInitializeDisplay ( return Status; } +/** Allocate VRAM memory in DRAM for the framebuffer + (unless it is reserved already). + + The allocated address can be used to set the framebuffer. + + @param[out] VramBaseAddress A pointer to the framebuffer address. + @param[out] VramSizeA pointer to the size of the framebuffer + in bytes + + @retval EFI_SUCCESS Framebuffer memory allocated successfully. + @retval !(EFI_SUCCESS) Other errors. +**/ EFI_STATUS LcdPlatformGetVram ( OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress, @@ -169,6 +190,13 @@ LcdPlatformGetVram ( return EFI_SUCCESS; } +/** Return total number of modes supported. + + Note: Valid mode numbers are 0 to MaxMode - 1 + See Section 12.9 of the UEFI Specification 2.7 + + @retval UINT32 Mode Number. +**/ UINT32 LcdPlatformGetMaxMode (VOID) { @@ -177,6 +205,14 @@ LcdPlatformGetMaxMode (VOID) return (sizeof (mResolutions) / sizeof (LCD_RESOLUTION)); } +/** Set the requested display mode. + + @param[in] ModeNumber Mode Number. + + @retval EFI_SUCCESS Mode set successfully. + @retval EFI_INVALID_PARAMETER Requested mode not found. + @retval !(EFI_SUCCESS)Other errors. +**/ EFI_STATUS LcdPlatformSetMode ( IN UINT32 ModeNumber @@ -226,6 +262,17 @@ LcdPlatformSetMode ( return Status; } +/** Return information for the requested mode number. + + @param[in] ModeNumber Mode Number. + + @param[out] InfoPointer for returned mode information + (on success). + + @retval EFI_SUCCESS Mode information for the requested mode + returned successfully. + @retval EFI_INVALID_PARAMETER Requested mode not found. +**/ EFI_STATUS LcdPlatformQueryMode ( IN UINT32ModeNumber, @@ -266,6 +313,23 @@ LcdPlatformQueryMode ( return EFI_SUCCESS; } +/** Return display timing information for the requested mode number. + + @param[in] ModeNumber Mode Number. + + @param[out] HResPointer to horizontal resolution. + @param[out] HSync Pointer to horizontal sync width. + @param[out] HBackPorch Pointer to horizontal back porch. + @param[out] HFrontPorch Pointer to horizontal front porch. + @param[out] VResPointer to vertical resolution. + @param[out] VSync Pointer to vertical sync width. + @param[out] VBackPorch Pointer to vertical back porch. + @param[out] VFrontPorch Pointer to vertical front porch. + + @retval EFI_SUCCESS Display timing information for the requested + mode returned successfully. + @retval EFI_INVALID_PARAMETER Requested mode not found. +**/ EFI_STATUS LcdPlatformGetTimin
[edk2] [PATCH edk2-platforms v3 00/17] Update GOP
This patch series addresses comments on the patch v2 (https://lists.01.org/pipermail/edk2-devel/2017-December/019406.html) reworking of the Graphics Output Protocol code in ArmPlatformPkg. It also contains updates for the new SCMI protocol (MTL Library). Code is available for examination at: https://github.com/girishpathak/edk2-platforms/tree/201_gop_v3 Ard Biesheuvel (1): ARM/VExpressPkg: Fix MODULE_TYPE of HDLCD/PL111 platform libraries EvanLloyd (2): ARM/VExpressPkg: HdLcdArmVExpressLib: Remove redundant Bpp ARM/VExpressPkg: Redefine LcdPlatformGetTimings function Girish Pathak (14): ARM/VExpressPkg: Tidy HDLCD and PL11LCD platform Lib: Coding standard ARM/VExpressPkg: Tidy HdLcd/PL111Lcd code: Updated comments ARM/VExpressPkg: Remove unused PcdPL111LcdMaxMode from HDLCD inf ARM/VExpressPkg: Add and update debug ASSERTS ARM/VExpressPkg: PL111Lcd/HdLcd plaform libs: Minor code cleanup ARM/VExpressPkg: PL111 and HDLCD: Use FixedPcdGet32 ARM/VExpressPkg: HdLcdArmVExpressLib: Remove status check EFI_TIMEOUT ARM/VExpressPkg: PL111 and HDLCD: Add PCD to select pixel format ARM/VExpressPkg: Allocate framebuffer using EfiRuntimeServicesData ARM/VExpressPkg: Reserving framebuffer at build ARM/VExpressPkg: Set EFI_MEMORY_XP flag on GOP framebuffer ARM/VExpressPkg: New DP500/DP550/DP650 platform library ARM/JunoPkg: Adding SCMI MTL library ARM/JunoPkg: Add HDLCD platform library Platform/ARM/JunoPkg/ArmJuno.dec | 17 +- Platform/ARM/JunoPkg/ArmJuno.dsc | 31 +- Platform/ARM/JunoPkg/ArmJuno.fdf | 12 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoLib.inf | 5 +- Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c | 29 +- Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c | 198 +++ Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf | 39 ++ Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlPrivateLib.h | 94 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJuno.c | 555 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf | 41 ++ Platform/ARM/VExpressPkg/ArmVExpressPkg.dec | 3 +- Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c | 387 ++ Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf | 43 ++ Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 7 +- Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 53 +- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 310 +++ Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 14 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 389 +- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 10 +- 19 files changed, 1945 insertions(+), 292 deletions(-) create mode 100644 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.c create mode 100644 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf create mode 100644 Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlPrivateLib.h create mode 100644 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJuno.c create mode 100644 Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf create mode 100644 Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.c create mode 100644 Platform/ARM/VExpressPkg/Library/ArmMaliDpLib/ArmMaliDpLib.inf -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH edk2-platforms v3 01/17] ARM/VExpressPkg: Fix MODULE_TYPE of HDLCD/PL111 platform libraries
From: Ard Biesheuvel <ard.biesheu...@linaro.org> This change fixes incorrect MODULE_TYPE of HDLCD and PL111 LcdPlatformLibs. Currently set MODUL_TYPE DXE_DRIVER is incorrect for these platform libraries. Hence set this to type BASE. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf | 4 ++-- Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf index fc51c781b45122eaf4f2269af61b44c8630cdfb8..5bbfb7eabb5d475a8c6ef21d0a3f75490be47467 100644 --- a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf @@ -2,7 +2,7 @@ # # Component description file for HdLcdArmLib module # -# Copyright (c) 2011-2012, ARM Ltd. All rights reserved. +# Copyright (c) 2011-2018, ARM Ltd. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -18,7 +18,7 @@ [Defines] INF_VERSION= 0x00010005 BASE_NAME = HdLcdArmVExpress FILE_GUID = 535a720e-06c0-4bb9-b563-452216abbed4 - MODULE_TYPE= DXE_DRIVER + MODULE_TYPE= BASE VERSION_STRING = 1.0 LIBRARY_CLASS = LcdPlatformLib diff --git a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf index fd83d2412d4fd2dfa59204f21626c62e377e3c55..7ffd217a7d1eefb06b99042c2b2a9ed0079f2bd3 100644 --- a/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf +++ b/Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf @@ -2,7 +2,7 @@ # # Component description file for ArmVeGraphicsDxe module # -# Copyright (c) 2011-2012, ARM Ltd. All rights reserved. +# Copyright (c) 2011-2018, ARM Ltd. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -18,7 +18,7 @@ [Defines] INF_VERSION= 0x00010005 BASE_NAME = PL111LcdArmVExpressLib FILE_GUID = b7f06f20-496f-11e0-a8e8-0002a5d5c51b - MODULE_TYPE= DXE_DRIVER + MODULE_TYPE= BASE VERSION_STRING = 1.0 LIBRARY_CLASS = LcdPlatformLib -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol
This change introduces a new SCMI protocol driver for Arm systems. The driver currently supports only clock and performance management protocols. Other protocols will be added as and when needed. Clock management protocol is used to configure various clocks available on the platform e.g. HDLCD clock on the Juno platforms. Whereas performance management protocol allows adjustment of various performance domains. Currently this is used to evaluate performance of the Juno platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Please rename ArmMtl.h to ArmMtlLibi.h, and declare it as a library class in the package file. [Ard] Done, however ArmMtlLib.h is now part of earlier commit [Girish] - Move ArmScmiDxe to ArmPkg from ArmPlatformPkg [Ard] Done[Girish] - Declare gArmScmiBaseProtocolGuid and similar protocols Guids in ArmPkg.dec [Ard] Done[Girish] - Replace flexible array member [] with [1] [Ard] Done[Girish] - Move protocol init function which are not part of of protocol like ScmiBaseProtocolInit elsewhere[Ard] Done[Girish] - Please don't put stuff in Include/Drivers. [Ard] Moved headers to Include/Protocol. [Girish] ArmPkg/ArmPkg.dec | 13 + ArmPkg/ArmPkg.dsc | 6 +- ArmPkg/Drivers/ArmScmiDxe/ArmScmiBaseProtocolPrivate.h| 46 ++ ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h | 84 ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf | 53 +++ ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h | 55 +++ ArmPkg/Drivers/ArmScmiDxe/Scmi.c | 262 +++ ArmPkg/Drivers/ArmScmiDxe/ScmiBaseProtocol.c | 318 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c | 418 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 138 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 41 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c | 457 ArmPkg/Drivers/ArmScmiDxe/ScmiPrivate.h | 174 ArmPkg/Include/Protocol/ArmScmi.h | 27 ++ ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h | 174 ArmPkg/Include/Protocol/ArmScmiClockProtocol.h| 218 ++ ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h | 265 17 files changed, 2748 insertions(+), 1 deletion(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index 881751d81c6384a3eb0b4c180c76d01a58266a74..16f7e40046429142b44b526043b61a3d5e089d2c 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -51,6 +51,19 @@ [Guids.common] gArmGicDxeFileGuid = { 0xde371f7c, 0xdec4, 0x4d21, { 0xad, 0xf1, 0x59, 0x3a, 0xbc, 0xc1, 0x58, 0x82 } } +[Protocols.common] + ## Arm System Control and Management Interface(SCMI) Base protocol + ## ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h + gArmScmiBaseProtocolGuid = { 0xd7e5abe9, 0x33ab, 0x418e, { 0x9f, 0x91, 0x72, 0xda, 0xe2, 0xba, 0x8e, 0x2f } } + + ## Arm System Control and Management Interface(SCMI) Clock management protocol + ## ArmPkg/Include/Protocol/ArmScmiClockProtocol.h + gArmScmiClockProtocolGuid = { 0x91ce67a8, 0xe0aa, 0x4012, { 0xb9, 0x9f, 0xb6, 0xfc, 0xf3, 0x4, 0x8e, 0xaa } } + + ## Arm System Control and Management Interface(SCMI) Clock management protocol + ## ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h + gArmScmiPerformanceProtocolGuid = { 0x9b8ba84, 0x3dd3, 0x49a6, { 0xa0, 0x5a, 0x31, 0x34, 0xa5, 0xf0, 0x7b, 0xad } } + [Ppis] ## Include/Ppi/ArmMpCoreInfo.h gArmMpCoreInfoPpiGuid = { 0x6847cc74, 0xe9ec, 0x4f8f, {0xa2, 0x9d, 0xab, 0x44, 0xe7, 0x54, 0xa8, 0xfc} } diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc index 526909458e0d80dbc5a65c8ad12ec1095dda48d2..22332090db7111e0668607a16288cefc1bace926 100644 --- a/ArmPkg/ArmPkg.dsc +++ b/ArmPkg/ArmPkg.dsc @@ -2,7 +2,7 @@ # ARM processor package. # # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved. -# Copyright (c) 2011 - 2015, ARM Ltd. All rights reserved. +# Copyright (c) 2011 - 2018, ARM Ltd. All rights reserved. # Copyright (c) 2016, Linaro Ltd. All rights reserved. # #This program and the accompanying materials @@ -87,6 +87,8 @@ [LibraryClasses.common] ArmLib|Ar
[edk2] [PATCH v3 01/16] ArmPlatformPkg: Rectify line endings of LcdHwNullLib
This fix changes line endings of LcdHwNullLib.c to DOS style line endings from UNIX style line endings to meet the EDK2 coding standard. Note it also fixes an end of line whitespace. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- ArmPlatformPkg/Library/LcdHwNullLib/LcdHwNullLib.c | 150 ++-- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/ArmPlatformPkg/Library/LcdHwNullLib/LcdHwNullLib.c b/ArmPlatformPkg/Library/LcdHwNullLib/LcdHwNullLib.c index 2d31b5183c959c88eb1dab7703ec9b87f03eb50f..50e1c88112db690545979e7d008678c4f8ecd949 100644 --- a/ArmPlatformPkg/Library/LcdHwNullLib/LcdHwNullLib.c +++ b/ArmPlatformPkg/Library/LcdHwNullLib/LcdHwNullLib.c @@ -1,75 +1,75 @@ -/** @file - - Copyright (c) 2017, Linaro, Ltd. All rights reserved. - - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -/** - Check for presence of display - - @retval EFI_SUCCESSPlatform implements display. - @retval EFI_NOT_FOUND Display not found on the platform. - -**/ -EFI_STATUS -LcdIdentify ( - VOID - ) -{ - return EFI_SUCCESS; -} - -/** - Initialize display. - - @param FrameBaseAddress Address of the frame buffer. - @retval EFI_SUCCESSDisplay initialization success. - @retval !(EFI_SUCCESS) Display initialization failure. - -**/ -EFI_STATUS -LcdInitialize ( - EFI_PHYSICAL_ADDRESS FrameBaseAddress - ) -{ - return EFI_SUCCESS; -} - -/** - Set requested mode of the display. - - @param ModeNumber Display mode number. - @retval EFI_SUCCESSDisplay set mode success. - @retval EFI_DEVICE_ERROR If mode not found/supported. - -**/ -EFI_STATUS -LcdSetMode ( - IN UINT32 ModeNumber - ) -{ - return EFI_SUCCESS; -} - -/** - De-initializes the display. -**/ -VOID -LcdShutdown ( - VOID - ) -{ -} +/** @file + + Copyright (c) 2017, Linaro, Ltd. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include + +/** + Check for presence of display + + @retval EFI_SUCCESSPlatform implements display. + @retval EFI_NOT_FOUND Display not found on the platform. + +**/ +EFI_STATUS +LcdIdentify ( + VOID + ) +{ + return EFI_SUCCESS; +} + +/** + Initialize display. + + @param FrameBaseAddress Address of the frame buffer. + @retval EFI_SUCCESSDisplay initialization success. + @retval !(EFI_SUCCESS) Display initialization failure. + +**/ +EFI_STATUS +LcdInitialize ( + EFI_PHYSICAL_ADDRESS FrameBaseAddress + ) +{ + return EFI_SUCCESS; +} + +/** + Set requested mode of the display. + + @param ModeNumber Display mode number. + @retval EFI_SUCCESSDisplay set mode success. + @retval EFI_DEVICE_ERROR If mode not found/supported. + +**/ +EFI_STATUS +LcdSetMode ( + IN UINT32 ModeNumber + ) +{ + return EFI_SUCCESS; +} + +/** + De-initializes the display. +**/ +VOID +LcdShutdown ( + VOID + ) +{ +} -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 15/16] ArmPkg: MTL Library interface and Null library implementation
Upcoming new component ArmPkg/Drivers/ArmScmiDxe is dependent on platform specific ArmMtlLib library implementation, however in order to be able to build the ArmScmiDxe component outside of the context of a particular platform, this change adds Null implementation of the ArmMtlLib along with ARM MTL library header. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- ArmPkg/ArmPkg.dec | 3 +- ArmPkg/Include/Library/ArmMtlLib.h | 137 ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.c | 108 +++ ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf | 26 4 files changed, 273 insertions(+), 1 deletion(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index a55b6268ff85ffd7da140be813ec875f7f242c4d..881751d81c6384a3eb0b4c180c76d01a58266a74 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -2,7 +2,7 @@ # ARM processor package. # # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved. -# Copyright (c) 2011 - 2017, ARM Limited. All rights reserved. +# Copyright (c) 2011 - 2018, ARM Limited. All rights reserved. # #This program and the accompanying materials #are licensed and made available under the terms and conditions of the BSD License @@ -40,6 +40,7 @@ [LibraryClasses.common] ArmDisassemblerLib|Include/Library/ArmDisassemblerLib.h ArmGicArchLib|Include/Library/ArmGicArchLib.h ArmSvcLib|Include/Library/ArmSvcLib.h + ArmMtlLib|ArmPlatformPkg/Include/Library/ArmMtlLib.h [Guids.common] gArmTokenSpaceGuid = { 0xBB11ECFE, 0x820F, 0x4968, { 0xBB, 0xA6, 0xF7, 0x6A, 0xFE, 0x30, 0x25, 0x96 } } diff --git a/ArmPkg/Include/Library/ArmMtlLib.h b/ArmPkg/Include/Library/ArmMtlLib.h new file mode 100644 index ..4218a741e5ebddd08022b94354d5ef47576cd3b8 --- /dev/null +++ b/ArmPkg/Include/Library/ArmMtlLib.h @@ -0,0 +1,137 @@ +/** @file + + Copyright (c) 2017-2018, Arm Limited. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + System Control and Management Interface V1.0 +http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/ +DEN0056A_System_Control_and_Management_Interface.pdf +**/ + +#ifndef ARM_MTL_LIB_H_ +#define ARM_MTL_LIB_H_ + +#include + +// Ideally we don't need packed struct. However we can't rely on compilers. +#pragma pack(1) + +typedef struct { + UINT32 Reserved1; + UINT32 ChannelStatus; + UINT64 Reserved2; + UINT32 Flags; + UINT32 Length; + UINT32 MessageHeader; + + // NOTE: Since EDK2 does not allow flexible array member [] we declare + // here array of 1 element length. However below is used as a variable + // length array. + UINT32 Payload[1];// size less object gives offset to payload. +} MTL_MAILBOX; + +#pragma pack() + +// Channel Type, Low-priority, and High-priority +typedef enum { + MTL_CHANNEL_TYPE_LOW = 0, + MTL_CHANNEL_TYPE_HIGH = 1 +} MTL_CHANNEL_TYPE; + +typedef struct { + UINT64 PhysicalAddress; + UINT32 ModifyMask; + UINT32 PreserveMask; +} MTL_DOORBELL; + +typedef struct { + MTL_CHANNEL_TYPE ChannelType; + MTL_MAILBOX * CONST MailBox; + MTL_DOORBELL DoorBell; +} MTL_CHANNEL; + +/** Wait until channel is free. + + @param[in] ChannelPointer to a channel. + @param[in] TimeOutInMicroSeconds Time out in micro seconds. + + @retval EFI_SUCCESS Channel is free. + @retval EFI_TIMEOUT Time out error. +**/ +EFI_STATUS +MtlWaitUntilChannelFree ( + IN MTL_CHANNEL *Channel, + IN UINT64 TimeOutInMicroSeconds + ); + +/** Return the address of the message payload. + + @param[in] Channel Pointer to a channel. + + @retval UINT32* Pointer to the payload. +**/ +UINT32* +MtlGetChannelPayload ( + IN MTL_CHANNEL *Channel + ); + +/** Return pointer to a channel for the requested channel type. + + @param[in] ChannelTypeChannelType, Low or High priority channel. +MTL_CHANNEL_TYPE_LOW or +MTL_CHANNEL_TYPE_HIGH + + @param[out] Channel Holds pointer to the channel. + + @retval EFI_SUCCESS Pointer to channel is returned. + @retval EFI_UNSUPPORTED Requested channel type not supported. +**/ +EFI_STATUS +MtlGetChannel ( + IN MTL_CHANNEL_TYPE ChannelType, + OUT MTL_CHANNEL **Channel + ); + +/** Mark the channel busy and ring the doorbell. + + @param[in] Channel Pointer to a channel. + @p
[edk2] [PATCH v3 13/16] ArmPlatformPkg: Reserving framebuffer at build
From: Girish Pathak Currently framebuffer memory is either reserved in special VRAM or dynamically allocated using boot services memory allocation functions. When allocated using boot services calls the memory has to be allocated as EfiBootServicesData. Unfortunately failures have been seen with this case. There is also an unfortunate lack of control on the placement of the framebuffer. This change introduces two PCDs, PcdArmLcdFrameBufferBase and PcdArmLcdFrameBufferSize which enable build time reservation of the framebuffer, avoiding the need to allocate dynamically. This allows the framebuffer to appear as "I/O memory" outside of the normal RAM map, which is similar to the "VRAM" case. This change has no impact on current code, only enables the option of build time reservation of framebuffers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- ArmPlatformPkg/ArmPlatformPkg.dec | 5 + 1 file changed, 5 insertions(+) diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index 5231ea822f05c2f281a6190d6eae0fc7d0bc0cb3..5c702718a78a78e6c67ab407e198382e0a0df4be 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -93,6 +93,11 @@ [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x0|UINT32|0x0026 gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x0|UINT32|0x0027 + ## Default size for display modes upto 1920x1080 (1920 * 1080 * 4 Bytes Per Pixel) + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferSize|0x7E9000|UINT32|0x0043 + ## If set, framebuffer memory will be reserved and mapped in the system RAM + gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase|0x0|UINT64|0x0044 + ## PL180 MCI gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x|UINT32|0x0028 gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x|UINT32|0x0029 -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 04/16] ArmPlatformPkg: Tidy Lcd code: Updated comments
From: Girish Pathak There is no functional modification in this change some comments are modified and a few new comments are added. This is to prevent mixing formatting changes with functional changes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Propagated comments to LcdPlatformNullLib ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 20 ++--- ArmPlatformPkg/Include/Library/LcdPlatformLib.h| 92 +++- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 26 +- ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 65 ++ ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 24 - 5 files changed, 189 insertions(+), 38 deletions(-) diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c index 905eb26ee01b5037dfbaf3c054a62593837c8b5f..872361cd23fbdf52c5f128d0e172701e76d832b2 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c @@ -1,13 +1,14 @@ /** @file + This file implements the Graphics Output protocol for Arm platforms - Copyright (c) 2011-2018, ARM Ltd. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php + Copyright (c) 2011-2018, ARM Ltd. All rights reserved. + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ @@ -22,11 +23,6 @@ #include "LcdGraphicsOutputDxe.h" -/** This file implements the Graphics Output protocol on ArmVersatileExpress - using the Lcd controller - -**/ - // // Global variables // diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h index 3d13e417972c67cc51ae4410efd548053511e5d1..e51e78640ae7b1acd51ac333ba3faa8c78aea5a5 100644 --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h @@ -18,9 +18,7 @@ #define LCD_VRAM_SIZE SIZE_8MB -// // Modes definitions -// #define VGA 0 #define SVGA 1 #define XGA 2 @@ -29,9 +27,7 @@ #define UXGA 5 #define HD6 -// // VGA Mode: 640 x 480 -// #define VGA_H_RES_PIXELS 640 #define VGA_V_RES_PIXELS 480 #define VGA_OSC_FREQUENCY 2375 /* 0x016A6570 */ @@ -44,9 +40,7 @@ #define VGA_V_FRONT_PORCH ( 3 - 1) #define VGA_V_BACK_PORCH ( 13 - 1) -// // SVGA Mode: 800 x 600 -// #define SVGA_H_RES_PIXELS 800 #define SVGA_V_RES_PIXELS 600 #define SVGA_OSC_FREQUENCY3825 /* 0x0247A610 */ @@ -59,9 +53,7 @@ #define SVGA_V_FRONT_PORCH( 3 - 1) #define SVGA_V_BACK_PORCH ( 17 - 1) -// // XGA Mode: 1024 x 768 -// #define XGA_H_RES_PIXELS 1024 #define XGA_V_RES_PIXELS 768 #define XGA_OSC_FREQUENCY 6350 /* 0x03C8EEE0 */ @@ -74,9 +66,7 @@ #define XGA_V_FRONT_PORCH ( 3 - 1) #define XGA_V_BACK_PORCH ( 23 - 1) -// // SXGA Mode: 1280 x 1024 -// #define SXGA_H_RES_PIXELS 1280 #define SXGA_V_RES_PIXELS 1024 #define SXGA_OSC_FREQUENCY10900 /* 0x067F3540 */ @@ -89,9 +79,7 @@ #define SXGA_V_FRONT_PORCH( 3 - 1) #define SXGA_V_BACK_PORCH ( 29 - 1) -// // WSXGA+ Mode: 1680 x 1050 -// #define WSXGA_H_RES_PIXELS1680 #define WSXGA_V_RES_PIXELS1050 #define WSXGA_OSC_FREQUENCY 14700 /* 0x08C30AC0 */ @@ -104,9 +92,7 @@ #define WSXGA_V_FRONT_PORCH ( 4 - 1) #define WSXGA_V_BACK_PORCH( 41 - 1) -// // UXGA Mode: 1600 x 1200 -// #define UXGA_H_RES_PIXELS 1600 #def
[edk2] [PATCH v3 09/16] ArmPlatformPkg: Redefine LcdPlatformGetTimings function
From: Girish Pathak The LcdPlatformGetTimings interface function takes similar sets of multiple parameters for horizontal and vertical timings which can be aggregated in a common data type. This change defines a structure SCAN_TIMINGS for this which can be used to describe both horizontal and vertical scan timings, and accordingly redefines the LcdPlatformGetTiming interface, greatly reducing the amount of data passed about. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- ArmPlatformPkg/Include/Library/LcdPlatformLib.h| 31 ++-- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 50 +--- ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 10 +--- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 43 + 4 files changed, 64 insertions(+), 70 deletions(-) diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h index e51e78640ae7b1acd51ac333ba3faa8c78aea5a5..8338b327fd2dd0d6b31653e278e25da5ac850939 100644 --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h @@ -153,6 +153,14 @@ typedef enum { LCD_BITS_PER_PIXEL_12_444 } LCD_BPP; +// Display timing settings. +typedef struct { + UINT32 Resolution; + UINT32 Sync; + UINT32 BackPorch; + UINT32 FrontPorch; +} SCAN_TIMINGS; + /** Platform related initialization function. @param[in] Handle Handle to the LCD device instance. @@ -228,14 +236,11 @@ LcdPlatformQueryMode ( @param[in] ModeNumber Mode Number. - @param[out] HResPointer to horizontal resolution. - @param[out] HSync Pointer to horizontal sync width. - @param[out] HBackPorch Pointer to horizontal back porch. - @param[out] HFrontPorch Pointer to horizontal front porch. - @param[out] VResPointer to vertical resolution. - @param[out] VSync Pointer to vertical sync width. - @param[out] VBackPorch Pointer to vertical back porch. - @param[out] VFrontPorch Pointer to vertical front porch. + @param[out] Horizontal Pointer to horizontal timing parameters. + (Resolution, Sync, Back porch, Front porch) + @param[out] VerticalPointer to vertical timing parameters. + (Resolution, Sync, Back porch, Front porch) + @retval EFI_SUCCESS Display timing information for the requested mode returned successfully. @@ -244,14 +249,8 @@ LcdPlatformQueryMode ( EFI_STATUS LcdPlatformGetTimings ( IN UINT32 ModeNumber, - OUT UINT32* HRes, - OUT UINT32* HSync, - OUT UINT32* HBackPorch, - OUT UINT32* HFrontPorch, - OUT UINT32* VRes, - OUT UINT32* VSync, - OUT UINT32* VBackPorch, - OUT UINT32* VFrontPorch + OUT SCAN_TIMINGS**Horizontal, + OUT SCAN_TIMINGS**Vertical ); /** Return bits per pixel information for a mode number. diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index 039048398c531ec944bc4b43a5551a554a368481..f5886848ce582b475b597ccca015c816707ade0e 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -98,34 +98,25 @@ LcdSetMode ( ) { EFI_STATUSStatus; - UINT32HRes; - UINT32HSync; - UINT32HBackPorch; - UINT32HFrontPorch; - UINT32VRes; - UINT32VSync; - UINT32VBackPorch; - UINT32VFrontPorch; + SCAN_TIMINGS *Horizontal; + SCAN_TIMINGS *Vertical; UINT32BytesPerPixel; LCD_BPP LcdBpp; // Set the video mode timings and other relevant information Status = LcdPlatformGetTimings ( ModeNumber, - , - , - , - , - , - , - , - + , + ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; } + ASSERT (Horizontal != NULL); + ASSERT (Vertical != NULL); + Status = LcdPlatformGetBpp (ModeNumber, ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); @@ -138,21 +129,26 @@ LcdSetMode ( MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABL
[edk2] [PATCH v3 12/16] ArmPlatformPkg: Additional display modes
From: Girish Pathak Add definitions for new display modes such as HD 720. This has no effect on existing display drivers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- ArmPlatformPkg/Include/Library/LcdPlatformLib.h | 60 1 file changed, 60 insertions(+) diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h index 8338b327fd2dd0d6b31653e278e25da5ac850939..cc535f0cd42db5673d418cbec940023927408687 100644 --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h @@ -26,6 +26,11 @@ #define WSXGA 4 #define UXGA 5 #define HD6 +#define WVGA 7 +#define QHD 8 +#define WSVGA 9 +#define HD720 10 +#define WXGA 11 // VGA Mode: 640 x 480 #define VGA_H_RES_PIXELS 640 @@ -118,6 +123,61 @@ #define HD_V_FRONT_PORCH ( 3 - 1) #define HD_V_BACK_PORCH ( 32 - 1) +// WVGA Mode: 800 x 480 +#define WVGA_H_RES_PIXELS 800 +#define WVGA_V_RES_PIXELS 480 +#define WVGA_OSC_FREQUENCY2950 /* 0x01C22260 */ +#define WVGA_H_SYNC ( 72 - 1) +#define WVGA_H_FRONT_PORCH( 24 - 1) +#define WVGA_H_BACK_PORCH ( 96 - 1) +#define WVGA_V_SYNC ( 7 - 1) +#define WVGA_V_FRONT_PORCH( 3 - 1) +#define WVGA_V_BACK_PORCH ( 10 - 1) + +// QHD Mode: 960 x 540 +#define QHD_H_RES_PIXELS 960 +#define QHD_V_RES_PIXELS 540 +#define QHD_OSC_FREQUENCY 4075 /* 0x026DCBB0 */ +#define QHD_H_SYNC( 96 - 1) +#define QHD_H_FRONT_PORCH ( 32 - 1) +#define QHD_H_BACK_PORCH (128 - 1) +#define QHD_V_SYNC( 5 - 1) +#define QHD_V_FRONT_PORCH ( 3 - 1) +#define QHD_V_BACK_PORCH ( 14 - 1) + +// WSVGA Mode: 1024 x 600 +#define WSVGA_H_RES_PIXELS1024 +#define WSVGA_V_RES_PIXELS600 +#define WSVGA_OSC_FREQUENCY 4900 /* 0x02EBAE40 */ +#define WSVGA_H_SYNC (104 - 1) +#define WSVGA_H_FRONT_PORCH ( 40 - 1) +#define WSVGA_H_BACK_PORCH(144 - 1) +#define WSVGA_V_SYNC ( 10 - 1) +#define WSVGA_V_FRONT_PORCH ( 3 - 1) +#define WSVGA_V_BACK_PORCH( 11 - 1) + +// HD720 Mode: 1280 x 720 +#define HD720_H_RES_PIXELS 1280 +#define HD720_V_RES_PIXELS 720 +#define HD720_OSC_FREQUENCY7450 /* 0x0470C7A0 */ +#define HD720_H_SYNC (128 - 1) +#define HD720_H_FRONT_PORCH( 64 - 1) +#define HD720_H_BACK_PORCH (192 - 1) +#define HD720_V_SYNC ( 5 - 1) +#define HD720_V_FRONT_PORCH( 3 - 1) +#define HD720_V_BACK_PORCH ( 20 - 1) + +// WXGA Mode: 1280 x 800 +#define WXGA_H_RES_PIXELS 1280 +#define WXGA_V_RES_PIXELS 800 +#define WXGA_OSC_FREQUENCY 8350 /* 0x04FA1BE0 */ +#define WXGA_H_SYNC(128 - 1) +#define WXGA_H_FRONT_PORCH ( 72 - 1) +#define WXGA_H_BACK_PORCH (200 - 1) +#define WXGA_V_SYNC( 6 - 1) +#define WXGA_V_FRONT_PORCH ( 3 - 1) +#define WXGA_V_BACK_PORCH ( 22 - 1) + // Colour Masks #define LCD_24BPP_RED_MASK 0x00FF #define LCD_24BPP_GREEN_MASK0xFF00 -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 14/16] ArmPlatformPkg: New DP500/DP550/DP650 GOP driver
From: Girish Pathak This change adds support for the ARM Mali DP500/DP500/DP650 display processors using the GOP protocol. It has been tested on FVP base models + DP550 support. This change adds platform independant LcdHwLib library. A corresponding platform specific library will be submitted to edk-platforms/Platform/ARM/VExpressPkg. This change does not modify functionality provided by PL111 or HDLCD. This LcdHwLib implementation should be suitable for those platforms that implement ARM Mali DP500/DP550/DP650 replacing PL111/HDLCD. Only graphics layer of the ARM Mali DP is configured for rendering the RGB/BGR format frame buffer to satisfy the UEFI GOP requirements Other layers e.g. video layers are not configured. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Please add this library as a component to ArmPlatformPkg.dsc as well, so we can do build testing on it. [Ard] Done [Girish] - Please drop references to edk2-platforms. This driver should be able to be used independently from VExpress platform code [Ard] Done [Girish] ArmPlatformPkg/ArmPlatformPkg.dec | 4 + ArmPlatformPkg/ArmPlatformPkg.dsc | 4 +- ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c | 409 ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.h | 243 ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.inf | 43 ++ 5 files changed, 702 insertions(+), 1 deletion(-) diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index 5c702718a78a78e6c67ab407e198382e0a0df4be..28cdc259849da11b172ad52045bccc0276669852 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -98,6 +98,10 @@ [PcdsFixedAtBuild.common] ## If set, framebuffer memory will be reserved and mapped in the system RAM gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase|0x0|UINT64|0x0044 + ## ARM Mali Display Processor DP500/DP550/DP650 + gArmPlatformTokenSpaceGuid.PcdArmMaliDpBase|0x0|UINT64|0x0050 + gArmPlatformTokenSpaceGuid.PcdArmMaliDpMemoryRegionLength|0x0|UINT32|0x0051 + ## PL180 MCI gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x|UINT32|0x0028 gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x|UINT32|0x0029 diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc index 82adb9ef8891b7ba1628ede2f8eb124c25c2774a..0013106b94c371f827e01c6d402faa6aa42e4bdd 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg.dsc @@ -2,7 +2,7 @@ # ARM platform package. # # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved. -# Copyright (c) 2011 - 2015, ARM Ltd. All rights reserved. +# Copyright (c) 2011 - 2018, ARM Ltd. All rights reserved. # Copyright (c) 2016 - 2017, Linaro Ltd. All rights reserved. # #This program and the accompanying materials @@ -120,3 +120,5 @@ [Components.common] ArmPlatformPkg/PrePi/PeiMPCore.inf ArmPlatformPkg/PrePi/PeiUniCore.inf + + ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.inf diff --git a/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c b/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c new file mode 100644 index ..69c88416a448caa506bf8a772432144d8a138495 --- /dev/null +++ b/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c @@ -0,0 +1,409 @@ +/** @file + + ARM Mali DP 500/550/650 display controller driver + + Copyright (c) 2017-2018, Arm Limited. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include + +#include "ArmMaliDp.h" + +// CORE_ID of the MALI DP +STATIC UINT32 mDpDeviceId; + +/** Disable the graphics layer + + This is done by clearing the EN bit of the LG_CONTROL register. +**/ +STATIC +VOID +LayerGraphicsDisable (VOID) +{ + MmioAnd32 (DP_BASE + DP_DE_LG_CONTROL, ~DP_DE_LG_ENABLE); +} + +/** Enable the graphics layer + + This is done by setting the EN bit of the LG_CONTROL register. +**/ +STATIC +VOID +LayerGraphicsEnable (VOID) +{ + MmioOr32 (DP_BASE + DP_DE_LG_CONTROL, DP_DE_LG_ENABLE); +} + +/** Set the frame address of the graphics layer. + + @param[in] FrameBaseAddress Addre
[edk2] [PATCH v3 10/16] ArmPlatformPkg: Add PCD to select pixel format
From: Girish Pathak Current HDLCD and PL111 platform libraries do not support display modes with PixelBlueGreenRedReserved8BitPerColor format, i.e. because of historical confusion, they do not support the UEFI default PixelBlueGreenRedReserved8BitPerColor format In LcdPlatformLib for PL111, LcdPlatformQueryMode returns the pixel format as PixelRedGreenBlueReserved8BitPerColor which is wrong, because that does not match the display controller's pixel format which is set to BGR in PL111Lcd LcdHwLib. Also it is not possible to configure pixel format as RGB/BGR for the display modes for a platform at build time. This change adds PcdGopPixelFormat to configure pixel format as PixelRedGreenBlueReserved8BitPerColoror PixelBlueGreenRedReserved8BitPerColoror PixelBitMask. With this change, pixel format can be selected in the platform specific .dsc file for all supported display modes. Support for PixelBitMask is not implemented in PL111 or HDLCD LcdHwLib libraries, hence HDLCD and PL111 platform libraries will return error EFI_UNSUPPORTED if PcdGopPixelFormat is set to PixelBitMask. Indeed, it is not clear what selecting PixelBitMask might mean, but the option is allowed as it might suit a custom platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- ArmPlatformPkg/ArmPlatformPkg.dec | 9 +++- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 54 +++- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 15 +- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index 7cec775abeee219e6821488a2c5abe88d23bbed1..378bee9cbc9e4bd50c37b38156016424e24cba73 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -1,6 +1,6 @@ #/** @file # -# Copyright (c) 2011-2017, ARM Limited. All rights reserved. +# Copyright (c) 2011-2018, ARM Limited. All rights reserved. # Copyright (c) 2015, Intel Corporation. All rights reserved. # # This program and the accompanying materials @@ -97,6 +97,13 @@ [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x|UINT32|0x0028 gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x|UINT32|0x0029 + # Graphics Output Pixel format + # 0 : PixelRedGreenBlueReserved8BitPerColor + # 1 : PixelBlueGreenRedReserved8BitPerColor + # 2 : PixelBitMask + # Default is set to UEFI console font format PixelBlueGreenRedReserved8BitPerColor + gArmPlatformTokenSpaceGuid.PcdGopPixelFormat|0x0001|UINT32|0x0040 + [PcdsFixedAtBuild.common,PcdsDynamic.common] ## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0|UINT32|0x0024 diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index f5886848ce582b475b597ccca015c816707ade0e..96f2bf437fbabd2509f860c67c5442def5b5f03d 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -22,31 +22,7 @@ #include "HdLcd.h" -STATIC -UINTN -GetBytesPerPixel ( - IN LCD_BPP Bpp - ) -{ - switch (Bpp) { - case LCD_BITS_PER_PIXEL_24: -return 4; - - case LCD_BITS_PER_PIXEL_16_565: - case LCD_BITS_PER_PIXEL_16_555: - case LCD_BITS_PER_PIXEL_12_444: -return 2; - - case LCD_BITS_PER_PIXEL_8: - case LCD_BITS_PER_PIXEL_4: - case LCD_BITS_PER_PIXEL_2: - case LCD_BITS_PER_PIXEL_1: -return 1; - - default: -return 0; - } -} +#define BYTES_PER_PIXEL 4 /** Initialize display. @@ -78,10 +54,6 @@ LcdInitialize ( HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL ); - MmioWrite32 (HDLCD_REG_RED_SELECT, (0 << 16 | 8 << 8 | 0)); - MmioWrite32 (HDLCD_REG_GREEN_SELECT, (0 << 16 | 8 << 8 | 8)); - MmioWrite32 (HDLCD_REG_BLUE_SELECT, (0 << 16 | 8 << 8 | 16)); - return EFI_SUCCESS; } @@ -100,8 +72,8 @@ LcdSetMode ( EFI_STATUSStatus; SCAN_TIMINGS *Horizontal; SCAN_TIMINGS *Vertical; - UINT32BytesPerPixel; - LCD_BPP LcdBpp; + + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo; // Set the video mode timings and other relevant information Status = LcdPlatformGetTimings ( @@ -117,13 +89,22 @@ LcdSetMode ( ASSERT (Horizontal != NULL); ASSERT (Vertical != NULL); - Status = LcdPlatformGetBpp (ModeNumber, ); + // Get the pixel format information. + Status = LcdPlatformQueryMode (ModeNumber, ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; } - BytesPerPixel = GetBytesPerPixel (LcdBpp); + if (ModeInfo.PixelFormat == PixelBlueGreenRedReserved8BitPerColor) { +MmioWrite32 (HDLCD_REG_RED_SELECT, (8 << 8) | 16); +MmioWrite32 (HDLCD_REG_BLUE_SELECT, (8 <<
[edk2] [PATCH v3 03/16] ArmPlatformPkg: Tidy Lcd code: Coding standard
From: Girish Pathak There is no functional modification in this change As preparation for further work, the formatting is corrected to meet the EDKII coding standard. Of specific note, some invalid include guards were fixed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Minor coding style changes [Ard] Done[Girish] - Changing one style to the other is just pointless churn [Ard] Fixing the include guards: is a small improvement. (Ideally patchcheck should reject these.) Reducing lines to 80 columns: makes Leif (at least) happy, and aligns with formatter behaviour. Correcting Doxygen format comments: prevents Doxygen generating gibberish. Spaces before '(': Maintains consistency, and aligns with desired formatter behaviour. [Evan] ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 187 +++- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h | 10 +- ArmPlatformPkg/Include/Library/LcdPlatformLib.h| 14 +- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 88 + ArmPlatformPkg/Library/HdLcd/HdLcd.h | 21 ++- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 64 --- 6 files changed, 208 insertions(+), 176 deletions(-) diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c index b721061fc1df5695092e8c71da97ae0b9af46b3f..905eb26ee01b5037dfbaf3c054a62593837c8b5f 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2011-2014, ARM Ltd. All rights reserved. + Copyright (c) 2011-2018, ARM Ltd. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -9,7 +9,7 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - **/ +**/ #include #include @@ -22,12 +22,10 @@ #include "LcdGraphicsOutputDxe.h" -/** - * - * This file implements the Graphics Output protocol on ArmVersatileExpress - * using the Lcd controller - * - **/ +/** This file implements the Graphics Output protocol on ArmVersatileExpress + using the Lcd controller + +**/ // // Global variables @@ -64,7 +62,10 @@ LCD_INSTANCE mLcdTemplate = { { { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, -{ (UINT8) (sizeof(VENDOR_DEVICE_PATH)), (UINT8) ((sizeof(VENDOR_DEVICE_PATH)) >> 8) }, +{ + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) +}, }, // Hardware Device Path for Lcd EFI_CALLER_ID_GUID // Use the driver's GUID @@ -73,10 +74,13 @@ LCD_INSTANCE mLcdTemplate = { { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, - { sizeof(EFI_DEVICE_PATH_PROTOCOL), 0 } + { +sizeof (EFI_DEVICE_PATH_PROTOCOL), +0 + } } }, - (EFI_EVENT) NULL // ExitBootServicesEvent + (EFI_EVENT)NULL // ExitBootServicesEvent }; EFI_STATUS @@ -86,7 +90,7 @@ LcdInstanceContructor ( { LCD_INSTANCE* Instance; - Instance = AllocateCopyPool (sizeof(LCD_INSTANCE), ); + Instance = AllocateCopyPool (sizeof (LCD_INSTANCE), ); if (Instance == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -113,23 +117,23 @@ InitializeDisplay ( UINTN VramSize; Status = LcdPlatformGetVram (, ); - if (EFI_ERROR(Status)) { + if (EFI_ERROR (Status)) { return Status; } // Setup the LCD Status = LcdInitialize (VramBaseAddress); - if (EFI_ERROR(Status)) { + if (EFI_ERROR (Status)) { goto EXIT_ERROR_LCD_SHUTDOWN; } Status = LcdPlatformInitializeDisplay (Instance->Handle); - if (EFI_ERROR(Status)) { + if (EFI_ERROR (Status)) { goto EXIT_ERROR_LCD_SHUTDOWN; } // Setup all the relevant mode information - Instance->Gop.Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); + Instance->Gop.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); Instance->Gop.Mode->FrameBufferBase = VramBaseAddress; // Set the flag before changing the mode, to avoid in
[edk2] [PATCH v3 06/16] ArmPlatformPkg: PL111Lcd: Replace magic number with macro
From: Girish Pathak Minor code change, replaces magic number with macro in LCD disable. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c index cb64c57dd79f3bb1345e4d3dbda7f5b3ce859f40..287e3ca272c0c19f8045a3bf4e69a092d8da6fd8 100644 --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c @@ -119,8 +119,7 @@ LcdSetMode ( } // Disable the CLCD_LcdEn bit - LcdControl = MmioRead32 (PL111_REG_LCD_CONTROL); - MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl & ~1); + MmioAnd32 (PL111_REG_LCD_CONTROL, ~PL111_CTRL_LCD_EN); // Set Timings MmioWrite32 ( -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 11/16] ArmPlatformPkg: PCD to swap red/blue format for HDLCD
From: Girish Pathak This change adds a new PCD PcdArmHdlcdSwapBlueRedSelect to swap values for HDLCD RED_SELECT and BLUE_SELECT registers on platforms where blue and red hardware lines are swapped. If set to TRUE in the platform dsc, HDLCD library will swap the values while setting RED_SELECT and BLUE_SELECT registers. The default value of the PCD is FALSE. NOTE: The motive for this is that a discrepancy in the Red/Blue lines exists between some VersatileExpress platforms. Rather than have divergent code, this build switch allows a simple, pragmatic solution. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Please don't nest CPP and C conditionals like this. It is difficult to follow, and results in poor build time coverage (the non-taken branch at the CPP level is never seen by the compiler) [Ard] Done [Girish] ArmPlatformPkg/ArmPlatformPkg.dec | 3 +++ ArmPlatformPkg/Library/HdLcd/HdLcd.c | 11 ++- ArmPlatformPkg/Library/HdLcd/HdLcd.inf | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index 378bee9cbc9e4bd50c37b38156016424e24cba73..5231ea822f05c2f281a6190d6eae0fc7d0bc0cb3 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -104,6 +104,9 @@ [PcdsFixedAtBuild.common] # Default is set to UEFI console font format PixelBlueGreenRedReserved8BitPerColor gArmPlatformTokenSpaceGuid.PcdGopPixelFormat|0x0001|UINT32|0x0040 + ## If set, this will swap settings for HDLCD RED_SELECT and BLUE_SELECT registers + gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect|FALSE|BOOLEAN|0x0045 + [PcdsFixedAtBuild.common,PcdsDynamic.common] ## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0|UINT32|0x0024 diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index 96f2bf437fbabd2509f860c67c5442def5b5f03d..5396dde3ba6cd147a8333241a9bc71ab05d7fee3 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -73,6 +73,8 @@ LcdSetMode ( SCAN_TIMINGS *Horizontal; SCAN_TIMINGS *Vertical; + EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo; // Set the video mode timings and other relevant information @@ -96,7 +98,14 @@ LcdSetMode ( return Status; } - if (ModeInfo.PixelFormat == PixelBlueGreenRedReserved8BitPerColor) { + // By default PcdArmHdLcdSwapBlueRedSelect is set to false + // However on the Juno platform HW lines for BLUE and RED are swapped + // Therefore PcdArmHdLcdSwapBlueRedSelect is set to TRUE for the Juno platform + PixelFormat = FixedPcdGetBool (PcdArmHdLcdSwapBlueRedSelect) +? PixelRedGreenBlueReserved8BitPerColor +: PixelBlueGreenRedReserved8BitPerColor; + + if (ModeInfo.PixelFormat == PixelFormat) { MmioWrite32 (HDLCD_REG_RED_SELECT, (8 << 8) | 16); MmioWrite32 (HDLCD_REG_BLUE_SELECT, (8 << 8) | 0); } else { diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.inf b/ArmPlatformPkg/Library/HdLcd/HdLcd.inf index 67aad05d210b95b2d23b8e52e4392685efcf3795..7f2ba7bf1c602f4c214eacaa6425bf9ec7e6da15 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.inf +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.inf @@ -2,7 +2,7 @@ # # Component description file for HDLCD module # -# Copyright (c) 2011-2012, ARM Ltd. All rights reserved. +# Copyright (c) 2011-2018, ARM Ltd. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -40,3 +40,5 @@ [LibraryClasses] [FixedPcd] gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase + gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect + -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 05/16] ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS
From: Girish Pathak This change moves some ASSERTs in error handling code to improve efficiency in DEBUG build. This change also removes redundant error code returns. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- Notes: v3: - Reverted to ASSERT_EFI_ERROR (Status) from ASSERT (FALSE) ArmPlatformPkg/Library/HdLcd/HdLcd.c | 11 +-- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 12 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index be4ccfdc1f421060faec792c8e8acfcfb3232014..28306c530e08b5e0fcef4308435045da3c9e093c 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -90,8 +90,7 @@ LcdInitialize ( @param[in] ModeNumber Display mode number. @retval EFI_SUCCESSDisplay mode set successfully. - @retval EFI_DEVICE_ERROR Reurns an error if display timing - information is not available. + @retval !(EFI_SUCCESS) Other errors. **/ EFI_STATUS LcdSetMode ( @@ -122,15 +121,15 @@ LcdSetMode ( , ); - ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { -return EFI_DEVICE_ERROR; +ASSERT_EFI_ERROR (Status); +return Status; } Status = LcdPlatformGetBpp (ModeNumber, ); - ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { -return EFI_DEVICE_ERROR; +ASSERT_EFI_ERROR (Status); +return Status; } BytesPerPixel = GetBytesPerPixel (LcdBpp); diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c index ccd7a4d1d43ad5c2f495683ac68236e17f3b55a5..cb64c57dd79f3bb1345e4d3dbda7f5b3ce859f40 100644 --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c @@ -75,8 +75,8 @@ LcdInitialize ( @param[in] ModeNumbe Display mode number. @retval EFI_SUCCESSDisplay mode set successfuly. - @retval EFI_DEVICE_ERROR It returns an error if display timing - information is not available. + @retval !(EFI_SUCCESS) Other errors. + **/ EFI_STATUS LcdSetMode ( @@ -107,15 +107,15 @@ LcdSetMode ( , ); - ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { -return EFI_DEVICE_ERROR; +ASSERT_EFI_ERROR (Status); +return Status; } Status = LcdPlatformGetBpp (ModeNumber, ); - ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { -return EFI_DEVICE_ERROR; +ASSERT_EFI_ERROR (Status); +return Status; } // Disable the CLCD_LcdEn bit -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 02/16] ArmPlatformPkg: Rectify line endings of LcdPlatformNullLib
This fix changes line endings of LcdPlatformNullLib.c to DOS style line endings from UNIX style line endings to meet the EDK2 coding standard. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 184 ++-- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c b/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c index 071eb5ffd4be895a0ce2ed5144f1f99e8195d1a0..b78d9a3bbd3e1fac4238f2be961a343020360a32 100644 --- a/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c +++ b/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c @@ -1,92 +1,92 @@ -/** @file - - Copyright (c) 2017, Linaro, Ltd. All rights reserved. - - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include -#include - -EFI_STATUS -LcdPlatformInitializeDisplay ( - IN EFI_HANDLE Handle - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} - -EFI_STATUS -LcdPlatformGetVram ( - OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress, - OUT UINTN*VramSize - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} - -UINT32 -LcdPlatformGetMaxMode ( - VOID - ) -{ - ASSERT (FALSE); - return 0; -} - -EFI_STATUS -LcdPlatformSetMode ( - IN UINT32 ModeNumber - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} - -EFI_STATUS -LcdPlatformQueryMode ( - IN UINT32ModeNumber, - OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} - -EFI_STATUS -LcdPlatformGetTimings ( - IN UINT32 ModeNumber, - OUT UINT32* HRes, - OUT UINT32* HSync, - OUT UINT32* HBackPorch, - OUT UINT32* HFrontPorch, - OUT UINT32* VRes, - OUT UINT32* VSync, - OUT UINT32* VBackPorch, - OUT UINT32* VFrontPorch - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} - -EFI_STATUS -LcdPlatformGetBpp ( - IN UINT32ModeNumber, - OUT LCD_BPP* Bpp - ) -{ - ASSERT (FALSE); - return EFI_UNSUPPORTED; -} +/** @file + + Copyright (c) 2017, Linaro, Ltd. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include + +EFI_STATUS +LcdPlatformInitializeDisplay ( + IN EFI_HANDLE Handle + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +LcdPlatformGetVram ( + OUT EFI_PHYSICAL_ADDRESS* VramBaseAddress, + OUT UINTN*VramSize + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +UINT32 +LcdPlatformGetMaxMode ( + VOID + ) +{ + ASSERT (FALSE); + return 0; +} + +EFI_STATUS +LcdPlatformSetMode ( + IN UINT32 ModeNumber + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +LcdPlatformQueryMode ( + IN UINT32ModeNumber, + OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +LcdPlatformGetTimings ( + IN UINT32 ModeNumber, + OUT UINT32* HRes, + OUT UINT32* HSync, + OUT UINT32* HBackPorch, + OUT UINT32* HFrontPorch, + OUT UINT32* VRes, + OUT UINT32* VSync, + OUT UINT32* VBackPorch, + OUT UINT32* VFrontPorch + ) +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +LcdPlatformGetBpp ( + IN UINT32ModeNumber, + OUT LCD_BPP*
[edk2] [PATCH v3 00/16] Update GOP
This patch series addresses comments on the patch v2 (https://lists.01.org/pipermail/edk2-devel/2017-December/019389.html) reworking of the Graphics Output Protocol code in ArmPlatformPkg. It also contains updates for the new SCMI protocol. Corresponding edk2-platforms changes will follow shortly. Code is available for examination at: https://github.com/girishpathak/edk2/tree/201_gop_v3 Girish Pathak (16): ArmPlatformPkg: Rectify line endings of LcdHwNullLib ArmPlatformPkg: Rectify line endings of LcdPlatformNullLib ArmPlatformPkg: Tidy Lcd code: Coding standard ArmPlatformPkg: Tidy Lcd code: Updated comments ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS ArmPlatformPkg: PL111Lcd: Replace magic number with macro ArmPlatformPkg: PL111Lcd: Combine two writes to LCDControl ArmPlatformPkg: Implement LcdIdentify function for HDLCD GOP ArmPlatformPkg: Redefine LcdPlatformGetTimings function ArmPlatformPkg: Add PCD to select pixel format ArmPlatformPkg: PCD to swap red/blue format for HDLCD ArmPlatformPkg: Additional display modes ArmPlatformPkg: Reserving framebuffer at build ArmPlatformPkg: New DP500/DP550/DP650 GOP driver ArmPkg: MTL Library interface and Null library implementation ArmPkg: Introduce SCMI protocol ArmPkg/ArmPkg.dec | 16 +- ArmPkg/ArmPkg.dsc | 6 +- ArmPkg/Drivers/ArmScmiDxe/ArmScmiBaseProtocolPrivate.h | 46 ++ ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h| 84 ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf | 53 +++ ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h | 55 +++ ArmPkg/Drivers/ArmScmiDxe/Scmi.c | 262 +++ ArmPkg/Drivers/ArmScmiDxe/ScmiBaseProtocol.c | 318 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c | 418 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c| 138 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h| 41 ++ ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c| 457 ArmPkg/Drivers/ArmScmiDxe/ScmiPrivate.h| 174 ArmPkg/Include/Library/ArmMtlLib.h | 137 ++ ArmPkg/Include/Protocol/ArmScmi.h | 27 ++ ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h | 174 ArmPkg/Include/Protocol/ArmScmiClockProtocol.h | 218 ++ ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h | 265 ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.c | 108 + ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf | 26 ++ ArmPlatformPkg/ArmPlatformPkg.dec | 21 +- ArmPlatformPkg/ArmPlatformPkg.dsc | 4 +- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 197 + ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h | 10 +- ArmPlatformPkg/Include/Library/LcdPlatformLib.h| 177 ++-- ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c | 409 ++ ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.h | 243 +++ ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.inf | 43 ++ ArmPlatformPkg/Library/HdLcd/HdLcd.c | 174 ArmPlatformPkg/Library/HdLcd/HdLcd.h | 23 +- ArmPlatformPkg/Library/HdLcd/HdLcd.inf | 4 +- ArmPlatformPkg/Library/LcdHwNullLib/LcdHwNullLib.c | 150 +++ ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 243 +++ ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 125 -- 34 files changed, 4413 insertions(+), 433 deletions(-) create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ArmScmiBaseProtocolPrivate.h create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ArmScmiPerformanceProtocolPrivate.h create mode 100644 ArmPkg/Drivers/ArmScmiDxe/Scmi.c create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ScmiBaseProtocol.c create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c create mode 100644 ArmPkg/Drivers/ArmScmiDxe/ScmiPrivate.h create mode 100644 ArmPkg/Include/Library/ArmMtlLib.h create mode 100644 ArmPkg/Include/Protocol/ArmScmi.h create mode 100644 ArmPkg/Include
[edk2] [PATCH v3 07/16] ArmPlatformPkg: PL111Lcd: Combine two writes to LCDControl
Currenty bit LcdPwr of the LCDControl register is enabled immediately after setting other bits of the LCDControl register. This two write sequence is unnecessary. This change removes this extra write by setting LcdPwr bit along with other bits of the LcdControl register. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> --- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c index 287e3ca272c0c19f8045a3bf4e69a092d8da6fd8..465cb6845437f57d15f05a271d1b01f634e11b56 100644 --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c @@ -137,11 +137,7 @@ LcdSetMode ( // PL111_REG_LCD_CONTROL LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP (LcdBpp) | - PL111_CTRL_LCD_TFT | PL111_CTRL_BGR; - MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl); - - // Turn on power to the LCD Panel - LcdControl |= PL111_CTRL_LCD_PWR; + PL111_CTRL_LCD_TFT | PL111_CTRL_LCD_PWR | PL111_CTRL_BGR; MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl); return EFI_SUCCESS; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 08/16] ArmPlatformPkg: Implement LcdIdentify function for HDLCD GOP
From: Girish Pathak LcdIdentify function does not currently check presence of HDLCD controller. Implement this functionality by reading HDLCD_REG_VERSION and checking against the PRODUCT_ID field to detect presence of HDLCD controller. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak <girish.pat...@arm.com> Signed-off-by: Evan Lloyd <evan.ll...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 8 +++- ArmPlatformPkg/Library/HdLcd/HdLcd.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index 28306c530e08b5e0fcef4308435045da3c9e093c..039048398c531ec944bc4b43a5551a554a368481 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -175,11 +175,17 @@ LcdShutdown ( @retval EFI_SUCCESSReturns success if platform implements a HDLCD controller. + @retval EFI_NOT_FOUND HDLCD display controller not found on the + platform. **/ EFI_STATUS LcdIdentify ( VOID ) { - return EFI_SUCCESS; + if ((MmioRead32 (HDLCD_REG_VERSION) >> 16) == HDLCD_PRODUCT_ID) { +return EFI_SUCCESS; + } + + return EFI_NOT_FOUND; } diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.h b/ArmPlatformPkg/Library/HdLcd/HdLcd.h index cd2c0366c7b563d7fb313f82abeef7eb1aa3ef72..1efa78eedc3013b3ab4615181a59c7d15b851ab5 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.h +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.h @@ -85,4 +85,6 @@ // Number of bytes per pixel #define HDLCD_4BYTES_PER_PIXEL ((4 - 1) << 3) +#define HDLCD_PRODUCT_ID 0x1CDC + #endif /* HDLCD_H_ */ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH edk2-platforms v2 06/18] ARM/VExpressPkg: Add and update debug ASSERTS
Hi Ard, > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Ard Biesheuvel > Sent: 23 December 2017 14:12 > To: Evan Lloyd <evan.ll...@arm.com> > Cc: "matteo.carl...@arm.com"@arm.com; > "leif.lindh...@linaro.org"@arm.com; "n...@arm.com"@arm.com; edk2- > de...@lists.01.org; Thomas Abraham <thomas.abra...@arm.com>; Arvind > Chauhan <arvind.chau...@arm.com>; > "ard.biesheu...@linaro.org"@arm.com > Subject: Re: [edk2] [PATCH edk2-platforms v2 06/18] ARM/VExpressPkg: Add > and update debug ASSERTS > > On 22 December 2017 at 19:08, <evan.ll...@arm.com> wrote: > > From: Girish Pathak > > > > This change adds some debug assertions e.g to catch NULL pointer > > errors missing in PL11Lcd and HdLcd platform libraries. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Girish Pathak <girish.pat...@arm.com> > > Signed-off-by: Evan Lloyd <evan.ll...@arm.com> > > --- > > > Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpr > ess.c | 22 +- > > > > > Platform/ARM/VExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArm > VEx > > press.c | 24 +++- > > 2 files changed, 44 insertions(+), 2 deletions(-) > > > > diff --git > > > a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > s.c > > > b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > s.c index > > > 6afd764897f49c64490ce891682f99bb0f5d993b..a8fe8696da0653017ce9fa6e4a > 86 > > caf283bc04c9 100644 > > --- > > > a/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > pres > > s.c > > +++ > b/Platform/ARM/VExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx > > +++ press.c > > @@ -153,6 +153,9 @@ LcdPlatformGetVram ( > >EFI_STATUS Status; > >EFI_ALLOCATE_TYPE AllocationType; > > > > + ASSERT (VramBaseAddress != NULL); > > + ASSERT (VramSize != NULL); > > + > >// Set the vram size > >*VramSize = LCD_VRAM_SIZE; > > > > @@ -171,6 +174,7 @@ LcdPlatformGetVram ( > >VramBaseAddress > >); > >if (EFI_ERROR (Status)) { > > +ASSERT (FALSE); > > return Status; > >} > > > > @@ -181,8 +185,8 @@ LcdPlatformGetVram ( > >*VramSize, > >EFI_MEMORY_WC > >); > > - ASSERT_EFI_ERROR (Status); > >if (EFI_ERROR (Status)) { > > +ASSERT (FALSE); > > As in the sibling patch against EDK2, this patch makes it more difficult to > figure out what went wrong when you hit the ASSERT. > ASSERT_EFI_ERROR prints the value of Status, ASSERT(FALSE) only prints > '0 != 1' > This change(and other similar changes) is in response to review comments on patch v1 https://lists.01.org/pipermail/edk2-devel/2017-October/015995.html with above reference, Can you please confirm if we should revert to the patch v1 version ? > > gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); > > return Status; > >} > > @@ -221,6 +225,7 @@ LcdPlatformSetMode ( > >EFI_STATUSStatus; > > > >if (ModeNumber >= LcdPlatformGetMaxMode ()) { > > +ASSERT (FALSE); > > These are fine: the code itself explains adequately which condition triggered > the ASSERT to fire. > > > return EFI_INVALID_PARAMETER; > >} > > > > @@ -279,7 +284,10 @@ LcdPlatformQueryMode ( > >OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * CONST Info > >) > > { > > + ASSERT (Info != NULL); > > + > >if (ModeNumber >= LcdPlatformGetMaxMode ()) { > > +ASSERT (FALSE); > > return EFI_INVALID_PARAMETER; > >} > > > > @@ -343,7 +351,18 @@ LcdPlatformGetTimings ( > >OUT UINT32 * CONSTVFrontPorch > >) > > { > > + // One of the pointers is NULL > > + ASSERT (HRes != NULL); > > + ASSERT (HSync != NULL); > > + ASSERT (HBackPorch != NULL); > > + ASSERT (HFrontPorch != NULL); > > + ASSERT (VRes != NULL); > > + ASSERT (VSync != NULL); > > + ASSERT (VBackPorch != NULL); > > + ASSERT (VFrontPorch != NULL); > > + > >if (ModeNumber >= LcdPlatformGetMaxMode ()) { > > +ASSERT (FALSE); > > return EFI_INVALID_PARAMETER; > >} > > > >
[edk2] ArmPlatformPkg: LcdGraphicsOutputDxe, PL111, and HdLcd rejig
Hi, With a view to an upcoming change, we have been examining the current Graphics Output Protocol implementation. Currently for, ARM platforms, the UEFI Graphics Output Protocol is implemented using a platform specific Library (PL111LcdArmVExpressLib/HdLcdArmVExpressLib) and a DXE driver (PL111LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe). The platform specific library handles platform specific variations such as platform supported display modes, memory management of the frame buffer, and clock/mux setting. The DXE driver implements the GOP protocol and manages the respective display IP. Although this implementation works fine for current platforms, we think the way the current DXE driver sources are linked is sub-optimal and can be improved to meet recommendation of the EDKII Module Writer's Guide. The DXE driver source contains three source files per driver. The files LcdGraphicsOutputDxe.c and LcdGraphicsOutputBlt.c implement common functionality whereas HdLcd.c/PL111Lcd.c implement display IP specific part of the DXE. The problem is, there are two .inf files for HdLcdGraphicsOutputDxe and PL111LcdGraphicsOutputDxe and both link common code LcdGraphicsOutputDxe.c and LcdGraphicsOutputBlt.c with display IP source instead of a library instance , which seems incorrect and can be improved. We propose to separate HdLcd.c and PL111Lcd.c and create independent libraries managing only respective display IP which can then be instantiated as LcdHwLib and linked in a common LcdGraphicsOutputDxe DXE driver. This will help to clearly partition implementation of the Graphics Output Protocol into three separate components, a platform specific component for the display IP, a display IP specific component and GOP common code. So instead of the current structure in ArmPlatformPkg for display DXE: ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf (HDLCD GOP DXE) ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf (PL111 GOP DXE) We propose a structure like: ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf(GOP DXE independent of hardware/platform) ArmPlatformPkg/Drivers/HdLcd/HdLcd.inf(Library code managing HDLCD HW IP) ArmPlatformPkg/Drivers/PL111/PL11Lcd.inf(Library code managing PL111 HW IP) LcdGraphicsOutputDxe.inf will link to LcdPlatformLib and LcdHwLib which can be selected for the platform in the platform specific .dsc file. e.g. Under LibraryClasses we might have: LcdPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpressLib.inf LcdHwLib|ArmPlatformPkg/Drivers/HdLcd/HdLcd.inf And Under Components: ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf (Common GOP DXE code for ARM Platforms) This is a significant change and we would like to invite viewpoints before we proceed with implementing these. Since the change would only be with respect to display aspects of ArmPlatformPkg we don't foresee any impact on any other functionality. Please reply if you feel this intended change might impact you and why ? Unless objections are raised, we will soon submit the patches for review. Regards, Girish IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel