On Wed, Jul 27, 2016 at 02:24:35PM -0500, Jeremy Linton wrote:
The code to detect what juno revision we are running on is fairly small put it in a common header where it may be used in a couple places.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeremy Linton jeremy.linton@arm.com
ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h | 30 +++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h b/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h index d01d136..d39193d 100644 --- a/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h +++ b/ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h @@ -17,12 +17,18 @@ #include <VExpressMotherBoard.h> +#define EXTRACT_FIELD(word,offset,len) ((word>>offset)&((1<<(len+1))-1))
So ... I would prefer to not have this new macro here. On the one hand, because its completely generic, and as such shouldn't live in platform specific code. But also because the only user in this file could be implemented with a >> 28.
Am I OK to drop it on commit?
/ Leif
/*********************************************************************************** // Platform Memory Map ************************************************************************************/ // Motherboard Peripheral and On-chip peripheral #define ARM_VE_BOARD_PERIPH_BASE 0x1C010000 +#define ARM_VE_BOARD_SYS_ID 0x0000 +#define ARM_VE_BOARD_SYS_PCIE_GBE_L 0x0074 +#define ARM_VE_BOARD_SYS_PCIE_GBE_H 0x0078
+#define ARM_VE_BOARD_SYS_ID_REV(word) EXTRACT_FIELD(word,28,4) // NOR Flash 0 #define ARM_VE_SMB_NOR0_BASE 0x08000000 @@ -83,6 +89,26 @@ EFI_ACPI_ARM_CREATOR_REVISION /* UINT32 CreatorRevision */ \ } +// +// Hardware platform identifiers +// +#define JUNO_REVISION_PROTOTYPE 0 +#define JUNO_REVISION_R0 1 +#define JUNO_REVISION_R1 2 +#define JUNO_REVISION_R2 3 +#define JUNO_REVISION_UKNOWN 0xFF
+// +// We detect whether we are running on a Juno r0, r1 or r2 +// board at runtime by checking the value of board SYS_ID +// +#define GetJunoRevision(JunoRevision) \ +{ \
- UINT32 SysId; \
- SysId = MmioRead32 (ARM_VE_BOARD_PERIPH_BASE+ARM_VE_BOARD_SYS_ID); \
- JunoRevision = ARM_VE_BOARD_SYS_ID_REV( SysId ); \
+}
#define JUNO_WATCHDOG_COUNT 2 // Define if the exported ACPI Tables are based on ACPI 5.0 spec or latest @@ -93,7 +119,7 @@ // assigned to the PCI Gigabyte Ethernet device. // -#define ARM_JUNO_SYS_PCIGBE_L (ARM_VE_BOARD_PERIPH_BASE + 0x74) -#define ARM_JUNO_SYS_PCIGBE_H (ARM_VE_BOARD_PERIPH_BASE + 0x78) +#define ARM_JUNO_SYS_PCIGBE_L (ARM_VE_BOARD_PERIPH_BASE + ARM_VE_BOARD_SYS_PCIE_GBE_L) +#define ARM_JUNO_SYS_PCIGBE_H (ARM_VE_BOARD_PERIPH_BASE + ARM_VE_BOARD_SYS_PCIE_GBE_H)
#endif
2.5.5