public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch][edk2-platforms/devel-MinnowBoard3] Clean up BOARD_ID identification code.
@ 2017-05-05  6:05 zwei4
  0 siblings, 0 replies; only message in thread
From: zwei4 @ 2017-05-05  6:05 UTC (permalink / raw)
  To: edk2-devel; +Cc: Mang Guo, Shifei Lu

BOARD_ID bits and GPIO pins mapping:
  BOARD_ID0   GPIO_224(J45)
  BOARD_ID1   GPIO_213(M47)
  BOARD_ID2   GPIO_223(H48)
  BOARD_ID3   GP_CAMERASB10(R34)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: zwei4 <david.wei@intel.com>
CC: Mang Guo <mang.guo@intel.com>
CC: Shifei Lu <shifeix.a.lu@intel.com>
---
 .../Board/LeafHill/BoardInitPreMem/PlatformId.c    | 268 ++++++++-------------
 .../MinnowBoard3/BoardInitPreMem/PlatformId.c      | 265 ++++++++------------
 .../Common/Include/Guid/PlatformInfo.h             |   4 +-
 .../Common/Include/Guid/PlatformInfo_Aplk.h        |   4 +-
 4 files changed, 211 insertions(+), 330 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPreMem/PlatformId.c b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPreMem/PlatformId.c
index 19c1bb561..d550fd400 100644
--- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPreMem/PlatformId.c
+++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPreMem/PlatformId.c
@@ -1,7 +1,7 @@
 /** @file
   Implement Platform ID code.
 
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -20,59 +20,6 @@
 #include <Guid/PlatformInfo.h>
 #include "PlatformId.h"
 
-/**
-  Read in GPIO state and return it.
-
-**/
-BOOLEAN
-IsThisMinnow (
-  VOID
-  )
-{
-  UINT32           CommAndOffset      = NW_GPIO_215;
-  BXT_CONF_PAD0    PadConfg0;
-  BXT_CONF_PAD1    PadConfg1;
-  BOOLEAN          ReturnValue;
-
-  if (PcdGetBool (PcdMinnowBoardDetectionRun)) {
-    //
-    // Already detected this. Return stored value.
-    //
-    ReturnValue = PcdGetBool (PcdMinnowBoardDetected);
-    DEBUG ((EFI_D_INFO, "Already detected. Returning stored value = %x\n", ReturnValue));
-  } else {
-    //
-    // Enable GPI mode with a pull-up
-    //
-    PadConfg0.padCnf0       = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    PadConfg1.padCnf1       = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET);
-    PadConfg0.r.PMode       = M0;      // Set to GPIO mode
-    PadConfg0.r.GPIORxTxDis = GPI;     // Set to GPI
-    PadConfg1.r.IOSTerm     = EnPu;    // Enable pull-up
-    PadConfg1.r.Term        = P_20K_H; // Set to 20K pull-up
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, PadConfg0.padCnf0);
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, PadConfg1.padCnf1);
-
-    //
-    // Read in GPI state and set return value
-    //
-    PadConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    ReturnValue       = (BOOLEAN) PadConfg0.r.GPIORxState;
-
-    //
-    // Set detection PCDs
-    //
-    PcdSetBoolS (PcdMinnowBoardDetectionRun, TRUE);
-    PcdSetBoolS (PcdMinnowBoardDetected, ReturnValue);
-  }
-
-  //
-  // Return answer
-  //
-  return ReturnValue;
-}
-
-
 EFI_STATUS
 EFIAPI
 GetEmbeddedBoardIdFabId(
@@ -88,121 +35,114 @@ GetEmbeddedBoardIdFabId(
   DEBUG ((DEBUG_INFO, "GetEmbeddedBoardIdFabId++\n"));
 
   //
-  // Set BoardId & FabId
+  // Board_ID0: PMIC_STDBY
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00F0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;         // Set to GPIO mode
+  padConfg0.r.GPIORxTxDis = 0x1; // Set to GPI
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  padConfg1.padCnf1 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Board_ID1: PMIC_SDWN_B
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00D0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Board_ID2: PMIC_RESET_B
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00C8);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Board_ID3: PMIC_PWRGOOD
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00C0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
   //
-  if (IsThisMinnow ()) {
-    //
-    // NW_PMIC_PWRGOOD says this is a Minnow board. Force Minnow defaults.
-    //
-    *BoardId = BOARD_ID_MINNOW;
-    *FabId   = PcdGet8 (PcdDefaultFabId);
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  
+  *BoardId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00F0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
+                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
+                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00C8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2) | \
+                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00C0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 3));
+
+  DEBUG ((DEBUG_INFO,  "BoardId from PMIC strap: %02X\n", *BoardId));
 
-    DEBUG ((EFI_D_INFO,  "BoardId forced from NW_GPIO_215 detection: %02X\n", *BoardId));
-    DEBUG ((EFI_D_INFO,  "  FabId forced from NW_GPIO_215 detection: %02X\n", *FabId));
-  } else {
-    //
-    // Board_ID0: PMIC_STDBY
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00F0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;         // Set to GPIO mode
-    padConfg0.r.GPIORxTxDis = 0x1; // Set to GPI
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    padConfg1.padCnf1 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Board_ID1: PMIC_SDWN_B
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00D0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Board_ID2: PMIC_RESET_B
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00C8);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Board_ID3: PMIC_PWRGOOD
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00C0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    *BoardId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00F0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
-                       (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
-                       (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00C8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2));
+  //
+  // Fab_ID0: PMIC_I2C_SDA
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x0108);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Fab_ID1: PMIC_I2C_SCL
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x0100);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //Set to Pull Up 20K
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Fab_ID2: PMIC_BCUDISW2
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00D8);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Fab_ID3: PMIC_BCUDISCRIT
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00E0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
 
-    DEBUG ((DEBUG_INFO,  "BoardId from PMIC strap: %02X\n", *BoardId));
-    //
-    // Fab_ID0: PMIC_I2C_SDA
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x0108);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Fab_ID1: PMIC_I2C_SCL
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x0100);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Fab_ID2: PMIC_BCUDISW2
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00D8);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Fab_ID3: PMIC_BCUDISCRIT
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00E0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  *FabId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0108) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
+                   (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0100) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
+                   (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2) | \
+                   (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00E0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 3));
 
-    *FabId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0108) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
-                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0100) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
-                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2) | \
-                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00E0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 3));
+  DEBUG ((EFI_D_INFO,  "FabId from PMIC strap: %02X\n", *FabId));
 
-    DEBUG ((EFI_D_INFO,  "FabId from PMIC strap: %02X\n", *FabId));
-  }
 
   return EFI_SUCCESS;
 }
diff --git a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPreMem/PlatformId.c b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPreMem/PlatformId.c
index e7135a9dc..d550fd400 100644
--- a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPreMem/PlatformId.c
+++ b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPreMem/PlatformId.c
@@ -1,7 +1,7 @@
 /** @file
   Implement Platform ID code.
 
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -20,59 +20,6 @@
 #include <Guid/PlatformInfo.h>
 #include "PlatformId.h"
 
-/**
-  Read in GPIO state and return it.
-
-**/
-BOOLEAN
-IsThisMinnow (
-  VOID
-  )
-{
-  UINT32           CommAndOffset      = NW_GPIO_215;
-  BXT_CONF_PAD0    PadConfg0;
-  BXT_CONF_PAD1    PadConfg1;
-  BOOLEAN          ReturnValue;
-
-  if (PcdGetBool (PcdMinnowBoardDetectionRun)) {
-    //
-    // Already detected this. Return stored value.
-    //
-    ReturnValue = PcdGetBool (PcdMinnowBoardDetected);
-    DEBUG ((EFI_D_INFO, "Already detected. Returning stored value = %x\n", ReturnValue));
-  } else {
-    //
-    // Enable GPI mode with a pull-up
-    //
-    PadConfg0.padCnf0       = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    PadConfg1.padCnf1       = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET);
-    PadConfg0.r.PMode       = M0;      // Set to GPIO mode
-    PadConfg0.r.GPIORxTxDis = GPI;     // Set to GPI
-    PadConfg1.r.IOSTerm     = EnPu;    // Enable pull-up
-    PadConfg1.r.Term        = P_20K_H; // Set to 20K pull-up
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, PadConfg0.padCnf0);
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, PadConfg1.padCnf1);
-
-    //
-    // Read in GPI state and set return value
-    //
-    PadConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    ReturnValue       = (BOOLEAN) PadConfg0.r.GPIORxState;
-
-    //
-    // Set detection PCDs
-    //
-    PcdSetBoolS (PcdMinnowBoardDetectionRun, TRUE);
-    PcdSetBoolS (PcdMinnowBoardDetected, ReturnValue);
-  }
-
-  //
-  // Return answer
-  //
-  return ReturnValue;
-}
-
-
 EFI_STATUS
 EFIAPI
 GetEmbeddedBoardIdFabId(
@@ -88,120 +35,114 @@ GetEmbeddedBoardIdFabId(
   DEBUG ((DEBUG_INFO, "GetEmbeddedBoardIdFabId++\n"));
 
   //
-  // Set BoardId & FabId
+  // Board_ID0: PMIC_STDBY
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00F0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;         // Set to GPIO mode
+  padConfg0.r.GPIORxTxDis = 0x1; // Set to GPI
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  padConfg1.padCnf1 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Board_ID1: PMIC_SDWN_B
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00D0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Board_ID2: PMIC_RESET_B
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00C8);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Board_ID3: PMIC_PWRGOOD
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00C0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
   //
-  if (IsThisMinnow ()) {
-    //
-    // NW_PMIC_PWRGOOD says this is a Minnow board. Force Minnow defaults.
-    //
-    *BoardId = BOARD_ID_MINNOW;
-    *FabId   = PcdGet8 (PcdDefaultFabId);
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  
+  *BoardId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00F0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
+                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
+                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00C8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2) | \
+                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00C0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 3));
 
-    DEBUG ((EFI_D_INFO,  "BoardId forced from NW_GPIO_215 detection: %02X\n", *BoardId));
-    DEBUG ((EFI_D_INFO,  "  FabId forced from NW_GPIO_215 detection: %02X\n", *FabId));
-  } else {
-    //
-    // Board_ID0: PMIC_STDBY
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00F0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;         // Set to GPIO mode
-    padConfg0.r.GPIORxTxDis = 0x1; // Set to GPI
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    padConfg1.padCnf1 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Board_ID1: PMIC_SDWN_B
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00D0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Board_ID2: PMIC_RESET_B
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00C8);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Board_ID3: PMIC_PWRGOOD
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00C0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    *BoardId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00F0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
-                       (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
-                       (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00C8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2));
+  DEBUG ((DEBUG_INFO,  "BoardId from PMIC strap: %02X\n", *BoardId));
 
-    DEBUG ((DEBUG_INFO,  "BoardId from PMIC strap: %02X\n", *BoardId));
+  //
+  // Fab_ID0: PMIC_I2C_SDA
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x0108);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Fab_ID1: PMIC_I2C_SCL
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x0100);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //Set to Pull Up 20K
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Fab_ID2: PMIC_BCUDISW2
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00D8);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  //
+  // Fab_ID3: PMIC_BCUDISCRIT
+  //
+  CommAndOffset = GetCommOffset (NORTHWEST, 0x00E0);
+  padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
+  padConfg0.r.PMode = 0;
+  padConfg0.r.GPIORxTxDis = 0x1;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
+  //
+  // Set to Pull Up 20K
+  //
+  padConfg1.r.Term = 0xC;
+  GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
 
-    //
-    // Fab_ID0: PMIC_I2C_SDA
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x0108);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Fab_ID1: PMIC_I2C_SCL
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x0100);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //Set to Pull Up 20K
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Fab_ID2: PMIC_BCUDISW2
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00D8);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
-    //
-    // Fab_ID3: PMIC_BCUDISCRIT
-    //
-    CommAndOffset = GetCommOffset (NORTHWEST, 0x00E0);
-    padConfg0.padCnf0 = GpioPadRead (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET);
-    padConfg0.r.PMode = 0;
-    padConfg0.r.GPIORxTxDis = 0x1;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF0_OFFSET, padConfg0.padCnf0);
-    //
-    // Set to Pull Up 20K
-    //
-    padConfg1.r.Term = 0xC;
-    GpioPadWrite (CommAndOffset + BXT_GPIO_PAD_CONF1_OFFSET, padConfg1.padCnf1);
+  *FabId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0108) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
+                   (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0100) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
+                   (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2) | \
+                   (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00E0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 3));
 
-    *FabId = (UINT8) (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0108) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) | \
-                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x0100) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 1) | \
-                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00D8) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 2) | \
-                     (((GpioPadRead (GetCommOffset (NORTHWEST, 0x00E0) + BXT_GPIO_PAD_CONF0_OFFSET) & BIT1) >> 1) << 3));
+  DEBUG ((EFI_D_INFO,  "FabId from PMIC strap: %02X\n", *FabId));
 
-    DEBUG ((EFI_D_INFO,  "FabId from PMIC strap: %02X\n", *FabId));
-  }
 
   return EFI_SUCCESS;
 }
diff --git a/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo.h b/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo.h
index aed58998c..5db0cbc33 100644
--- a/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo.h
+++ b/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo.h
@@ -1,7 +1,7 @@
 /** @file
   GUID used for Platform Info Data entries in the HOB list.
 
-  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -163,7 +163,7 @@ typedef enum {
 
 typedef enum {
   BOARD_ID_LFH_CRB         = 0x07,     // Leaf Hill
-  BOARD_ID_MINNOW          = 0x80,     // Minnow Board
+  BOARD_ID_MINNOW          = 0x0F,     // Minnow Board
   BOARD_ID_APL_UNKNOWN     = 0xFF
 } APL_BOARD_ID_LIST;
 
diff --git a/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo_Aplk.h b/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo_Aplk.h
index d02afcbd2..e8063de32 100644
--- a/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo_Aplk.h
+++ b/Platform/BroxtonPlatformPkg/Common/Include/Guid/PlatformInfo_Aplk.h
@@ -1,7 +1,7 @@
 /** @file
   GUID used for Platform Info Data entries in the HOB list.
 
-  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -149,7 +149,7 @@ typedef struct {
 
 typedef enum {
   BOARD_ID_LFH_CRB         = 0x07,     // Leaf Hill
-  BOARD_ID_MINNOW          = 0x80,     // Minnow Board
+  BOARD_ID_MINNOW          = 0x0F,     // Minnow Board
   BOARD_ID_APL_UNKNOWN     = 0xFF
 } APL_BOARD_ID_LIST;
 
-- 
2.11.0.windows.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-05  6:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-05  6:05 [Patch][edk2-platforms/devel-MinnowBoard3] Clean up BOARD_ID identification code zwei4

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox