Revision: 18308
          http://sourceforge.net/p/edk2/code/18308
Author:   abiesheuvel
Date:     2015-08-25 13:11:11 +0000 (Tue, 25 Aug 2015)
Log Message:
-----------
ArmPlatformPkg/LcdGraphicsOutputDxe: check PrimeCell ID before initializing

To deal gracefully with the absence of the PL111 hardware on
the Foundation model, check the PrimeCell ID before proceeding
with the installation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
    
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
    trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
    trunk/edk2/ArmPlatformPkg/Include/Drivers/PL111Lcd.h

Modified: 
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
===================================================================
--- 
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c   
    2015-08-25 13:11:02 UTC (rev 18307)
+++ 
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c   
    2015-08-25 13:11:11 UTC (rev 18308)
@@ -156,6 +156,11 @@
   EFI_STATUS  Status = EFI_SUCCESS;
   LCD_INSTANCE* Instance;
 
+  Status = LcdIdentify ();
+  if (EFI_ERROR(Status)) {
+    goto EXIT;
+  }
+
   Status = LcdInstanceContructor (&Instance);
   if (EFI_ERROR(Status)) {
     goto EXIT;

Modified: 
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
===================================================================
--- 
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h   
    2015-08-25 13:11:02 UTC (rev 18307)
+++ 
trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h   
    2015-08-25 13:11:11 UTC (rev 18308)
@@ -106,7 +106,7 @@
 );
 
 EFI_STATUS
-LcdIndentify (
+LcdIdentify (
   VOID
 );
 

Modified: trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c   
2015-08-25 13:11:02 UTC (rev 18307)
+++ trunk/edk2/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c   
2015-08-25 13:11:11 UTC (rev 18308)
@@ -27,6 +27,28 @@
  **********************************************************************/
 
 EFI_STATUS
+LcdIdentify (
+  VOID
+  )
+{
+  DEBUG ((EFI_D_WARN, "Probing ID registers at 0x%lx for a PL111\n",
+    PL111_REG_CLCD_PERIPH_ID_0));
+
+  // Check if this is a PL111
+  if (MmioRead8 (PL111_REG_CLCD_PERIPH_ID_0) == PL111_CLCD_PERIPH_ID_0 &&
+      MmioRead8 (PL111_REG_CLCD_PERIPH_ID_1) == PL111_CLCD_PERIPH_ID_1 &&
+     (MmioRead8 (PL111_REG_CLCD_PERIPH_ID_2) & 0xf) == PL111_CLCD_PERIPH_ID_2 
&&
+      MmioRead8 (PL111_REG_CLCD_PERIPH_ID_3) == PL111_CLCD_PERIPH_ID_3 &&
+      MmioRead8 (PL111_REG_CLCD_P_CELL_ID_0) == PL111_CLCD_P_CELL_ID_0 &&
+      MmioRead8 (PL111_REG_CLCD_P_CELL_ID_1) == PL111_CLCD_P_CELL_ID_1 &&
+      MmioRead8 (PL111_REG_CLCD_P_CELL_ID_2) == PL111_CLCD_P_CELL_ID_2 &&
+      MmioRead8 (PL111_REG_CLCD_P_CELL_ID_3) == PL111_CLCD_P_CELL_ID_3) {
+    return EFI_SUCCESS;
+  }
+  return EFI_NOT_FOUND;
+}
+
+EFI_STATUS
 LcdInitialize (
   IN EFI_PHYSICAL_ADDRESS   VramBaseAddress
   )

Modified: trunk/edk2/ArmPlatformPkg/Include/Drivers/PL111Lcd.h
===================================================================
--- trunk/edk2/ArmPlatformPkg/Include/Drivers/PL111Lcd.h        2015-08-25 
13:11:02 UTC (rev 18307)
+++ trunk/edk2/ArmPlatformPkg/Include/Drivers/PL111Lcd.h        2015-08-25 
13:11:11 UTC (rev 18308)
@@ -47,6 +47,15 @@
 #define PL111_REG_CLCD_P_CELL_ID_2        ((UINTN)PcdGet32 (PcdPL111LcdBase) + 
0xFF8)
 #define PL111_REG_CLCD_P_CELL_ID_3        ((UINTN)PcdGet32 (PcdPL111LcdBase) + 
0xFFC)
 
+#define PL111_CLCD_PERIPH_ID_0            0x11
+#define PL111_CLCD_PERIPH_ID_1            0x11
+#define PL111_CLCD_PERIPH_ID_2            0x04
+#define PL111_CLCD_PERIPH_ID_3            0x00
+#define PL111_CLCD_P_CELL_ID_0            0x0D
+#define PL111_CLCD_P_CELL_ID_1            0xF0
+#define PL111_CLCD_P_CELL_ID_2            0x05
+#define PL111_CLCD_P_CELL_ID_3            0xB1
+
 /**********************************************************************/
 
 // Register components (register bits)


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to