diff options
-rw-r--r-- | hwp/perv/perverrors.mk | 5 | ||||
-rw-r--r-- | hwpf/plat/include/plat_target_parms.H | 21 | ||||
-rw-r--r-- | hwpf/plat/include/target_types.H | 3 | ||||
-rw-r--r-- | importtemp/xml/attribute_info/nest_attributes.xml | 95 | ||||
-rw-r--r-- | importtemp/xml/attribute_info/pervasive_attributes.xml | 7 | ||||
-rw-r--r-- | importtemp/xml/attribute_info/proc_attributes.xml | 26 | ||||
-rw-r--r-- | importtemp/xml/p9_ppe_attributes.xml | 20 | ||||
-rw-r--r-- | sbe/image/Makefile | 71 | ||||
-rw-r--r-- | sbe/image/base_ppe_header.S | 46 | ||||
-rw-r--r-- | sbe/image/base_sbe_fixed.S | 17 | ||||
-rw-r--r-- | sbe/image/img_defs.mk | 4 | ||||
-rw-r--r-- | sbe/image/proc_sbe_fixed.H | 51 | ||||
-rw-r--r-- | sbe/image/topfiles.mk | 1 | ||||
-rwxr-xr-x | tools/image/ppeSetFixed.pl | 125 | ||||
-rw-r--r-- | tools/image/sbe_default_tool.c | 10 | ||||
-rwxr-xr-x | tools/scripts/ppeCreateAttrGetSetMacros.pl | 30 | ||||
-rw-r--r-- | tools/scripts/ppeParseAttrGetSetMacros.pl | 51 | ||||
-rwxr-xr-x | tools/scripts/ppeParseAttributeInfo.pl | 765 | ||||
-rwxr-xr-x | tools/scripts/ppeParseProcSbeFixed.pl | 90 | ||||
-rw-r--r-- | tools/scripts/src/fapi2PlatAttributeService.H | 523 |
20 files changed, 1129 insertions, 832 deletions
diff --git a/hwp/perv/perverrors.mk b/hwp/perv/perverrors.mk index 1642766b..ef123c98 100644 --- a/hwp/perv/perverrors.mk +++ b/hwp/perv/perverrors.mk @@ -12,6 +12,11 @@ PERV_CURR_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) # This variable name must not change +ERROR_XML_FILES += $(PERV_CURR_DIR)/p9_sbe_chiplet_init_errors.xml +ERROR_XML_FILES += $(PERV_CURR_DIR)/p9_sbe_arrayinit_errors.xml +ERROR_XML_FILES += $(PERV_CURR_DIR)/p9_sbe_gear_switcher_errors.xml ERROR_XML_FILES += $(PERV_CURR_DIR)/p9_sbe_setup_evid_errors.xml + + diff --git a/hwpf/plat/include/plat_target_parms.H b/hwpf/plat/include/plat_target_parms.H index d495241a..ab78a3c5 100644 --- a/hwpf/plat/include/plat_target_parms.H +++ b/hwpf/plat/include/plat_target_parms.H @@ -38,34 +38,37 @@ CONST_UINT32_T(CHIP_TARGET_COUNT , 1); // Pervasive Targets (note; these include the MCS targets as well) CONST_UINT32_T(PERV_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT); -CONST_UINT32_T(PERV_CHIPLET_OFFSET, 0x1); +CONST_UINT32_T(PERV_CHIPLET_OFFSET, 0x1); CONST_UINT32_T(PERV_TARGET_COUNT, 15); // Cache Targets CONST_UINT32_T(EQ_TARGET_OFFSET, PERV_TARGET_OFFSET + PERV_TARGET_COUNT); -CONST_UINT32_T(EQ_CHIPLET_OFFSET, 0x10); -CONST_UINT32_T(EQ_TARGET_COUNT, 6); +CONST_UINT32_T(EQ_CHIPLET_OFFSET, 0x10); +CONST_UINT32_T(EQ_TARGET_COUNT, 6); // Core Targets -CONST_UINT32_T(CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT); +CONST_UINT32_T(CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT); CONST_UINT32_T(CORE_CHIPLET_OFFSET, 0x20); CONST_UINT32_T(CORE_TARGET_COUNT, 24); // MCS Targets (note: these are phyically Pervastive targets) CONST_UINT32_T(MCS_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT); -CONST_UINT32_T(MCS_CHIPLET_OFFSET, 0x7); +CONST_UINT32_T(MCS_CHIPLET_OFFSET, 0x7); CONST_UINT32_T(MCS_TARGET_COUNT, 2); -CONST_UINT32_T(EX_TARGET_OFFSET, MCS_TARGET_OFFSET + MCS_TARGET_COUNT); -CONST_UINT32_T(EX_CHIPLET_OFFSET, 0x10); +CONST_UINT32_T(EX_TARGET_OFFSET, MCS_TARGET_OFFSET + MCS_TARGET_COUNT); +CONST_UINT32_T(EX_CHIPLET_OFFSET, 0x10); CONST_UINT32_T(EX_TARGET_COUNT, 12); +CONST_UINT32_T(SYSTEM_TARGET_OFFSET, EX_TARGET_OFFSET + EX_TARGET_COUNT); +CONST_UINT32_T(SYSTEM_TARGET_COUNT, 1); + CONST_UINT32_T(TARGET_COUNT, CHIP_TARGET_COUNT + PERV_TARGET_COUNT + EQ_TARGET_COUNT + CORE_TARGET_COUNT + MCS_TARGET_COUNT + - EX_TARGET_COUNT); - + EX_TARGET_COUNT + + SYSTEM_TARGET_COUNT); #endif // __FAPI2_PPE_TARGET_PARMS__ diff --git a/hwpf/plat/include/target_types.H b/hwpf/plat/include/target_types.H index 352e4732..56470cd0 100644 --- a/hwpf/plat/include/target_types.H +++ b/hwpf/plat/include/target_types.H @@ -54,7 +54,8 @@ namespace fapi2 TARGET_TYPE_EQ = 0x08, ///< EQ type TARGET_TYPE_MCS = 0x10, ///< MCS type TARGET_TYPE_PERV = 0x20, ///< Pervasive type - TARGET_TYPE_MCAST = 0x80, ///< Multicast type + TARGET_TYPE_MCAST = 0x40, ///< Multicast type + TARGET_TYPE_SYSTEM = 0x80, ///< System type TARGET_TYPE_ALL = 0xFF, ///< Any/All types diff --git a/importtemp/xml/attribute_info/nest_attributes.xml b/importtemp/xml/attribute_info/nest_attributes.xml new file mode 100644 index 00000000..79703fa9 --- /dev/null +++ b/importtemp/xml/attribute_info/nest_attributes.xml @@ -0,0 +1,95 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: chips/p9/procedures/xml/attribute_info/nest_attributes.xml $ --> +<!-- --> +<!-- IBM CONFIDENTIAL --> +<!-- --> +<!-- EKB Project --> +<!-- --> +<!-- COPYRIGHT 2015 --> +<!-- [+] International Business Machines Corp. --> +<!-- --> +<!-- --> +<!-- The source code for this program is not published or otherwise --> +<!-- divested of its trade secrets, irrespective of what has been --> +<!-- deposited with the U.S. Copyright Office. --> +<!-- --> +<!-- IBM_PROLOG_END_TAG --> +<!-- This is an automatically generated file. --> +<!-- File: nest_attributes.xml. --> +<!-- XML file specifying attributes used by HW Procedures. Attributes are taken from model nest --> +<!--nest_attributes.xml--> +<attributes> + +<attribute> + <id>ATTR_DMI_REFCLOCK_SWIZZLE</id> + <targetType>TARGET_TYPE_MCS</targetType> + <description>Define DMI Ref clock/Swizzle for Centaur</description> + <valueType>uint8</valueType> + <persistRuntime/> + <platInit/> +</attribute> + + +<attribute> + <id>ATTR_FABRIC_GROUP_ID</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description>Logical fabric group ID associated with this chip. Provided by the MRW.</description> + <valueType>uint8</valueType> + <persistRuntime/> + <platInit/> +</attribute> + +<attribute> + <id>ATTR_FABRIC_SYSTEM_ID</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description>Logical fabric system ID associated with this chip. Provided by the MRW.</description> + <valueType>uint8</valueType> + <persistRuntime/> + <platInit/> +</attribute> + + +<attribute> + <id>ATTR_PROC_FABRIC_ADDR_BAR_MODE</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description>Processor memory map configuration.0 = default = large system address map1 = small system address map Provided by the MRW.</description> + <valueType>uint8</valueType> + <enum>LARGE_SYSTEM = 0x0,SMALL_SYSTEM = 0x1</enum> + <persistRuntime/> + <platInit/> +</attribute> + +<attribute> + <id>ATTR_PROC_SBE_MASTER_CHIP</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description>Indicates if SBE on this chip is serving as hosboot drawer master</description> + <valueType>uint8</valueType> + <enum>FALSE = 0x0,TRUE = 0x1</enum> + <persistRuntime/> + <platInit/> +</attribute> + +<attribute> + <id>ATTR_SYSTEM_IPL_PHASE</id> + <targetType>TARGET_TYPE_SYSTEM</targetType> + <description>Define context for current phase of system IPL</description> + <valueType>uint8</valueType> + <enum>HB_IPL = 0x1,HB_RUNTIME = 0x2,CACHE_CONTAINED = 0x4</enum> + <persistRuntime/> + <platInit/> +</attribute> + +<attribute> + <id>ATTR_ADU_XSCOM_BAR_BASE_ADDR</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description>Defines XSCOM base address on each processor level. + address provided by the MRW </description> + <valueType>uint64</valueType> + <persistRuntime/> + <platInit/> +</attribute> + +</attributes> + diff --git a/importtemp/xml/attribute_info/pervasive_attributes.xml b/importtemp/xml/attribute_info/pervasive_attributes.xml index c73224a7..e85a61a7 100644 --- a/importtemp/xml/attribute_info/pervasive_attributes.xml +++ b/importtemp/xml/attribute_info/pervasive_attributes.xml @@ -122,4 +122,11 @@ <valueType>uint8</valueType> </attribute> +<attribute> + <id>ATTR_BACKUP_SEEPROM_SELECT</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description></description> + <valueType>uint8</valueType> +</attribute> + </attributes> diff --git a/importtemp/xml/attribute_info/proc_attributes.xml b/importtemp/xml/attribute_info/proc_attributes.xml index 4273a93f..0eb45046 100644 --- a/importtemp/xml/attribute_info/proc_attributes.xml +++ b/importtemp/xml/attribute_info/proc_attributes.xml @@ -30,6 +30,7 @@ </description> <valueType>uint32</valueType> <platInit/> + <writeable/> <persistRuntime/> </attribute> <!-- ********************************************************************* --> @@ -40,6 +41,7 @@ </description> <valueType>uint32</valueType> <platInit/> + <writeable/> <persistRuntime/> </attribute> <!-- ********************************************************************* --> @@ -148,4 +150,28 @@ <persistRuntime/> </attribute> <!-- ********************************************************************* --> + <attribute> + <id>ATTR_SCRATCH_UINT32_ARRAY</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description> + </description> + <valueType>uint32</valueType> + <array>64</array> + <platInit/> + <writeable/> + <persistRuntime/> + </attribute> + <!-- ********************************************************************* --> + <attribute> + <id>ATTR_SCRATCH_UINT32_PERV_ARRAY</id> + <targetType>TARGET_TYPE_PERV</targetType> + <description> + </description> + <valueType>uint32</valueType> + <array>64</array> + <platInit/> + <writeable/> + <persistRuntime/> + </attribute> + <!-- ********************************************************************* --> </attributes> diff --git a/importtemp/xml/p9_ppe_attributes.xml b/importtemp/xml/p9_ppe_attributes.xml index d8c19074..e7e82e99 100644 --- a/importtemp/xml/p9_ppe_attributes.xml +++ b/importtemp/xml/p9_ppe_attributes.xml @@ -40,7 +40,13 @@ <entry> <name>ATTR_SCRATCH_INT64_2</name> </entry> - <entry> + <entry> + <name>ATTR_SCRATCH_UINT32_ARRAY</name> + </entry> + <entry> + <name>ATTR_SCRATCH_UINT32_PERV_ARRAY</name> + </entry> + <entry> <name>ATTR_REPR_RING</name> <value>0xcafe</value> <value>0xdead</value> @@ -294,4 +300,16 @@ <value>0x0E</value> <value>0x0F</value> </entry> + <entry> + <name>ATTR_FABRIC_SYSTEM_ID</name> + <value>0x1</value> + </entry> + <entry> + <name>ATTR_SYSTEM_IPL_PHASE</name> + <value>0x1</value> + </entry> + + <entry> + <name>ATTR_BACKUP_SEEPROM_SELECT</name> + </entry> </entries> diff --git a/sbe/image/Makefile b/sbe/image/Makefile index 84c0c969..24fa27b4 100644 --- a/sbe/image/Makefile +++ b/sbe/image/Makefile @@ -6,6 +6,13 @@ export P2P_ENABLE = 1 #remove this once we have a real compiler export SBEFW_ENABLE = 1 +# Force a non-interrupt variant of PK for FAPI2 testing. This allows the test to run +# on any of the PPE SIMICS models. +# This must be before the inclusion of img_defs.mk. +ifdef FAPI2_TEST +PPE_TYPE := ppe +endif + #Pull in the definitions that affect all makefiles for this image include img_defs.mk @@ -98,52 +105,68 @@ LINK_SCRIPT_SEEPROM = $(addprefix $(OBJDIR)/, linkscriptseeprom) LINK_SCRIPT_SBE = $(addprefix $(OBJDIR)/, linkscriptsbe) LINK_SCRIPT_LOADER = $(addprefix $(OBJDIR)/, linkscriptloader) - -#default target is to make a binary application image -#This removes all unecessary headers from the ELF executable +# ---- SEEPROM Image ------ +# This removes all unecessary headers from the ELF executable $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep "A _seeprom_end" | cut -d " " -f 1` $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis + +ifndef FAPI2_TEST +# This is the production build of the SEEPROM #create a linked ELF executable $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM) + @echo ">>>>> Production Build <<<<<<" $(LD) -e __system_reset -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJS) -#pass the link command file through the C preprocessor to evaluate macros and remove comments +else +# This a special build of the SEEPROM image that includes the PK to allow for test threads to be used. +# create a linked ELF executable +$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM) + @echo ">>>>> Special FAPI2 Test Build <<<<<<" + $(LD) -e __system_reset -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(LIB_DIRS) $(OBJS) --start-group $(LLIBS) --end-group + +endif + +# pass the link command file through the C preprocessor to evaluate macros and remove comments $(LINK_SCRIPT_SEEPROM): linkseeprom.cmd $(CPP) -E -x c++ -P $(DEFS) linkseeprom.cmd -o $(LINK_SCRIPT_SEEPROM) -#default target is to make a binary pibmem image +# ---- PIBMEM Image ------ #This removes all unecessary headers from the ELF executable $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).dis: $(OBJDIR)/$(IMAGE_SBE_NAME).out $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_SBE_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SBE_NAME).out | grep "A _sbe_end" | cut -d " " -f 1` $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SBE_NAME).dis -#create a linked ELF executable +# create a linked ELF executable $(OBJDIR)/$(IMAGE_SBE_NAME).out: $(OBJDIR)/base_sbe_fixed.o $(LINK_OBJS) $(LINK_SCRIPT_SBE) $(LD) -e __system_reset -T$(LINK_SCRIPT_SBE) -Map $(OBJDIR)/$(IMAGE_SBE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SBE_NAME).out $(LIB_DIRS) $(OBJDIR)/base_sbe_fixed.o --start-group $(LLIBS) --end-group -#pass the link command file through the C preprocessor to evaluate macros and remove comments +# pass the link command file through the C preprocessor to evaluate macros and remove comments $(LINK_SCRIPT_SBE): linksbe.cmd $(CPP) -E -x c++ -P $(DEFS) linksbe.cmd -o $(LINK_SCRIPT_SBE) - - - +# ---- Loader Image ------ $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).dis: $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_LOADER_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_LOADER_NAME).out | grep "A _loader_end" | cut -d " " -f 1` $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_LOADER_NAME).dis -#create a linked ELF executable +# create a linked ELF executable $(OBJDIR)/$(IMAGE_LOADER_NAME).out: $(OBJDIR)/$(BASE_LOADER_OBJECTS) $(LINK_OBJS) $(LINK_SCRIPT_LOADER) $(LD) -e base_loader -T$(LINK_SCRIPT_LOADER) -Map $(OBJDIR)/$(IMAGE_LOADER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(OBJDIR)/$(BASE_LOADER_OBJECTS) -#pass the link command file through the C preprocessor to evaluate macros and remove comments +# pass the link command file through the C preprocessor to evaluate macros and remove comments $(LINK_SCRIPT_LOADER): linkloader.cmd $(CPP) -E -x c++ -P $(DEFS) linkloader.cmd -o $(LINK_SCRIPT_LOADER) - - +# Remove the "all" rule if FAPI2_TEST as the SBE FW is incompatible with the +# option of PK enabled +ifndef FAPI2_TEST +all: seeprom $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(SBE_TOOLS) appendbase appendloader +else +all: + @echo "Makefile option error: ALL is not compatible with FAPI2_test" +endif all: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendbase appendloader add_entry_offset add_entry_address_sbe @@ -153,7 +176,7 @@ add_entry_offset: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out add_entry_address_sbe: $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin set entry_address_sbe 0x`nm $(OBJDIR)/$(IMAGE_LOADER_NAME).out | grep base_loader | cut -f 1 -d " "` -generic: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin +seeprom: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin $(TOOLS_IMAGE_DIR)/sbe_xip_tool $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin report > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).rpt #Create an obj directory if needed @@ -165,6 +188,7 @@ ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/proc_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/ex_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/eq_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/core_attributes.xml +ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/nest_attributes.xml $(OBJDIR): $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES) @@ -194,7 +218,7 @@ attrserv: $(PKLIB): $(MAKE) -I $(IMAGE_SRCDIR) -C $(PK_MAKE_DIR) -f Makefile -#Build macro-specific kernel code +#Build SBE firmware $(SBEFWLIB): $(MAKE) -I $(IMAGE_SRCDIR) -C $(SBEFW_MAKE_DIR) -f Makefile @@ -223,8 +247,6 @@ $(NESTLIB): @echo "Processing nest makefile" $(MAKE) -I $(IMAGE_SRCDIR) -C $(NEST_MAKE_DIR) -f Makefile -#Build the comming HWP lib procedures - #Build the HWP lib procedures $(HWPLIB): @echo "Processing HWP lib makefile" @@ -240,6 +262,7 @@ $(P2PLIB): $(MAKE) -I $(IMAGE_SRCDIR) -C $(P2P_SRCDIR) -f Makefile endif +#Build the SBE XIP Tools $(SBE_TOOLS): $(MAKE) -C $(TOOLS_IMAGE_DIR) -f Makefile @@ -306,21 +329,13 @@ dump: objdump -s $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out > $(IMAGE_SEEPROM_NAME).dump objdump -s $(OBJDIR)/$(IMAGE_SBE_NAME).out > $(IMAGE_SBE_NAME).dump -.PHONY : run_spgpe run_pmgpe +.PHONY : run_spgpe # load and run the SBE SeeProm image in a GPE simics environment -#run_spgpe: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out -run_spgpe: generic +run_spgpe: seeprom $(SIMICS_WS)/simics \ -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin;$$occ_gpe0_sym_tbl_file=$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out' \ modelsetup.simics -# load and run the SBE PibMem image in a GPE simics environment -run_pmgpe: $(OBJDIR)/$(IMAGE_NAME).out - $(SIMICS_WS)/simics \ - -e '$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SBE_NAME).bin;$$occ_gpe0_binary_to_load=$(OBJDIR)/$(IMAGE_SBE_NAME).bin' \ - modelsetup.simics - - #Add dependencies to header files ifneq ($(MAKECMDGOALS),clean) diff --git a/sbe/image/base_ppe_header.S b/sbe/image/base_ppe_header.S index 2de8f887..1220b170 100644 --- a/sbe/image/base_ppe_header.S +++ b/sbe/image/base_ppe_header.S @@ -12,13 +12,13 @@ #include "sbe_xip_image.h" #include "proc_sbe_fixed.H" - + #define IMAGE_SPACE_UNDEFINED 0xffff #define IMAGE_SPACE_OCI 0x8000 #define IMAGE_SPACE_PNOR 0x800b #define IMAGE_SPACE_OTPROM 0x0001 #define IMAGE_SPACE_SEEPROM 0x800c -#define IMAGE_SPACE_BASE 0x0008 +#define IMAGE_SPACE_BASE 0x0008 @@ -31,37 +31,37 @@ .iflt (\x) .error "An unsigned value is required here" .endif - + .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits)))) .error "\err" .endif - .endm + .endm .macro ..check_u16, u16 ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits" .endm - - + + .macro ..set_default_space, s ..check_u16 (\s) .set _PGAS_DEFAULT_SPACE, (\s) .endm - + .macro ..check_default_space .if (_PGAS_DEFAULT_SPACE == IMAGE_SPACE_UNDEFINED) .error "The PGAS default address space has not been defined" .endif - .endm - + .endm + .macro .quada, offset:req ..check_default_space .long _PGAS_DEFAULT_SPACE .long (\offset) - .endm + .endm + - // .macro SbeXipHeader, magic, link_address, entry_point, image_size .macro SbeXipSection, s:req, alignment=1, empty=0 @@ -79,7 +79,7 @@ __\s\()_section: .macro SbeXipHeader, magic, link_address, entry_point, image_size - + .section .header, "a", @progbits @@ -87,9 +87,9 @@ __\s\()_section: // Identification - 8-byte aligned; 8 Entries; TOC-Indexed ////////////////////////////////////////////////////////////////////// -__magic: +__magic: .quad (\magic) -__entry_offset: +__entry_offset: .quad ((\entry_point) - (\link_address)) __link_address: .quada (\link_address) @@ -102,8 +102,7 @@ __header_64_reserved: .xip_toc entry_offset, SBE_XIP_UINT64, __entry_offset .xip_toc link_address, SBE_XIP_UINT64, __link_address .xip_toc entry_address_sbe, SBE_XIP_UINT64, __entry_address_sbe - - + ////////////////////////////////////////////////////////////////////// // Section Table - 8-byte aligned; 16 entries; Not TOC-Indexed ////////////////////////////////////////////////////////////////////// @@ -122,7 +121,7 @@ __header_64_reserved: SbeXipSection overlay, 8, empty=1 SbeXipSection rings, 8, empty=1 - + ////////////////////////////////////////////////////////////////////// // Other Information - 4-byte aligned; 8 entries; TOC-Indexed ////////////////////////////////////////////////////////////////////// @@ -175,20 +174,21 @@ __header_string_reserved: .endm - + .section .fixed, "a", @progbits - .section .fixed_toc, "a", @progbits + .section .fixed_toc, "a", @progbits .section .loader_data, "a", @progbits - .section .loader_text, "a", @progbits - + .section .loader_text, "a", @progbits + .section .toc, "a", @progbits .section .strings, "aS", @progbits - + ..set_default_space IMAGE_SPACE_SEEPROM SbeXipHeader SBE_SEEPROM_MAGIC, 0xFFF00000, 0xFFF00C78, _seeprom_size - // Create the .fixed section + // Create the .fixed section + .proc_sbe_fixed_system .proc_sbe_fixed_proc_chip .proc_sbe_fixed_perv .proc_sbe_fixed_core diff --git a/sbe/image/base_sbe_fixed.S b/sbe/image/base_sbe_fixed.S index 08fc4f0c..496b7e82 100644 --- a/sbe/image/base_sbe_fixed.S +++ b/sbe/image/base_sbe_fixed.S @@ -4,7 +4,7 @@ #include "sbe_xip_image.h" #include "proc_sbe_fixed.H" - + .macro ..checku, x:req, bits:req, err="Unsigned value too large" .if (((\bits) <= 0) || ((\bits) > 63)) @@ -14,30 +14,29 @@ .iflt (\x) .error "An unsigned value is required here" .endif - + .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits)))) .error "\err" .endif - .endm + .endm + - .macro ..check_u16, u16 ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits" .endm - + .macro ..set_default_space, s ..check_u16 (\s) .set _PGAS_DEFAULT_SPACE, (\s) .endm - - .section .fixed, "a", @progbits - - // Create the .fixed section + + // Create the .fixed section + .proc_sbe_fixed_system .proc_sbe_fixed_proc_chip .proc_sbe_fixed_perv .proc_sbe_fixed_core diff --git a/sbe/image/img_defs.mk b/sbe/image/img_defs.mk index c1214c80..771214a9 100644 --- a/sbe/image/img_defs.mk +++ b/sbe/image/img_defs.mk @@ -276,8 +276,10 @@ endif #override the GNU Make implicit rule for going from a .C to a .o %.o: %.C +# -Wno-conversion-null is necesary to allow mapping of NULL to TARGET_TYPE_SYSTEM +# for attribute accesses $(OBJDIR)/%.s: %.C - $(TCC) $(PPE-CFLAGS) $(DEFS) -S -std=c++11 -o $@ $< + $(TCC) $(PPE-CFLAGS) $(DEFS) -Wno-conversion-null -S -std=c++11 -o $@ $< #override the GNU Make implicit rule for going from a .c to a .o diff --git a/sbe/image/proc_sbe_fixed.H b/sbe/image/proc_sbe_fixed.H index 2969e3b1..16701f74 100644 --- a/sbe/image/proc_sbe_fixed.H +++ b/sbe/image/proc_sbe_fixed.H @@ -21,19 +21,19 @@ /// TOC. /// /// This header file can be #include-ed into either C or SBE assembly language -/// source code. In C, it creates simple structures 'ProcChipAttributes', -/// 'PervAttributes', 'CoreAttributes', 'EQAttributes' and 'EXAttributes' that +/// source code. In C, it creates simple structures 'ProcChipAttributes', +/// 'PervAttributes', 'CoreAttributes', 'EQAttributes' and 'EXAttributes' that /// contain attribute information that are sized per XML definition per entry. /// -/// PPE image data is always stored big-endian, so applications on little-endian +/// PPE image data is always stored big-endian, so applications on little-endian /// hosts will need to perform the appropriate endian converison when reading or /// writing images via this header. /// /// In assembler code, this header creates macros '.proc_sbe_fixed_proc_chip', -/// '.proc_sbe_fixed_perv', '.proc_sbe_fixed_core', '.proc_sbe_fixed_ex', -/// '.proc_sbe_fixed_eq', that is expanded exactly once in the file -/// 'sbe_base_header.S', creating the actual data allocation of the data -/// equivalent to the C structure. Assembler code references the data symbols +/// '.proc_sbe_fixed_perv', '.proc_sbe_fixed_core', '.proc_sbe_fixed_ex', +/// '.proc_sbe_fixed_eq', that is expanded exactly once in the file +/// 'sbe_base_header.S', creating the actual data allocation of the data +/// equivalent to the C structure. Assembler code references the data symbols /// as normal. /// /// To simplify programming a 'mini-TOC' is also provided for this data in @@ -50,14 +50,37 @@ #include "plat_target_parms.H" #include "fapi2AttributeIds.H" +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_system + .section .fixed, "a", @progbits + .balign 8 + .global G_system_attributes +G_system_attributes: +#else + +extern "C" { +namespace fapi2attr { +typedef struct SystemAttributes_t { +#endif + +#include "proc_sbe_fixed_system.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} SystemAttributes; +} // fapi2 +} // C +#endif #ifdef __ASSEMBLER__ .macro .proc_sbe_fixed_proc_chip .section .fixed, "a", @progbits .balign 8 .global G_proc_chip_attributes -G_proc_chip_attributes: +G_proc_chip_attributes: #else + extern "C" { namespace fapi2attr { typedef struct ProcChipAttributes_t { @@ -80,7 +103,7 @@ typedef struct ProcChipAttributes_t { .section .fixed, "a", @progbits .balign 8 .global G_perv_attributes -G_perv_attributes: +G_perv_attributes: #else namespace fapi2attr { typedef struct PervAttributes_t { @@ -102,14 +125,14 @@ typedef struct PervAttributes_t { .section .fixed, "a", @progbits .balign 8 .global G_core_attributes -G_core_attributes: +G_core_attributes: #else namespace fapi2attr { typedef struct CoreAttributes_t { #endif #include "proc_sbe_fixed_core.H" - + #ifdef __ASSEMBLER__ .endm #else @@ -124,14 +147,14 @@ typedef struct CoreAttributes_t { .section .fixed, "a", @progbits .balign 8 .global G_ex_attributes -G_ex_attributes: +G_ex_attributes: #else namespace fapi2attr { typedef struct EXAttributes_t { #endif #include "proc_sbe_fixed_ex.H" - + #ifdef __ASSEMBLER__ .endm #else @@ -153,7 +176,7 @@ typedef struct EQAttributes_t { #endif #include "proc_sbe_fixed_eq.H" - + #ifdef __ASSEMBLER__ .endm #else diff --git a/sbe/image/topfiles.mk b/sbe/image/topfiles.mk index 78623f03..a8f95429 100644 --- a/sbe/image/topfiles.mk +++ b/sbe/image/topfiles.mk @@ -3,6 +3,7 @@ TOP-CPP-SOURCES = TOP-S-SOURCES = base_ppe_header.S # generated by ppeParseProcSbeFixed.pl +TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_system.H TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_perv.H TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_proc_chip.H TOP-FIXED-HEADERS += $(IMAGE_SRCDIR)/proc_sbe_fixed_core.H diff --git a/tools/image/ppeSetFixed.pl b/tools/image/ppeSetFixed.pl index 8d781d23..def03f5f 100755 --- a/tools/image/ppeSetFixed.pl +++ b/tools/image/ppeSetFixed.pl @@ -26,7 +26,8 @@ if ($numArgs < 3) print ("$attrpath/attribute_info/proc_attributes.xml \\\n" ); print ("$attrpath/attribute_info/ex_attributes.xml \\\n" ); print ("$attrpath/attribute_info/eq_attributes.xml \\\n" ); - print ("$attrpath/attribute_info/core_attributes.xml \n"); + print ("$attrpath/attribute_info/core_attributes.xml \\ \n"); + print ("$attrpath/attribute_info/nest_attributes.xml \n"); exit(1); } @@ -40,6 +41,7 @@ my $xml = new XML::Simple (KeyAttr=>[]); my $xmlFiles = 0; my $attCount = 0; my $numIfAttrFiles = 0; +my @attrSystemIds; my @attrChipIds; my @attrExIds; my @attrCoreIds; @@ -83,54 +85,54 @@ foreach my $entr (@{$entries->{entry}}) { #-------------------------------------------------------------------------- foreach my $attr (@{$attributes->{attribute}}) { - if($attr->{id} eq $inname) { - #------------------------------------------------------------------ - # Check that the AttributeId exists - #------------------------------------------------------------------ - if (! exists $attr->{id}) - { - print ("ppeSbeFixed.pl ERROR. Att 'id' missing\n"); - exit(1); - } + #------------------------------------------------------------------ + # Check that the AttributeId exists + #------------------------------------------------------------------ + if (! exists $attr->{id}) + { + print ("ppeSbeFixed.pl ERROR. Att 'id' missing\n"); + exit(1); + } + if($attr->{targetType} eq "TARGET_TYPE_SYSTEM") { - if($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") { + push(@attrSystemIds, $entr); - push(@attrChipIds, $entr); + } elsif($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") { - } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") { + push(@attrChipIds, $entr); - push(@attrCoreIds, $entr); - - } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") { + } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") { - push(@attrEqIds, $entr); + push(@attrCoreIds, $entr); - } elsif($attr->{targetType} eq "TARGET_TYPE_EX") { + } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") { - push(@attrExIds, $entr); + push(@attrEqIds, $entr); - } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") { + } elsif($attr->{targetType} eq "TARGET_TYPE_EX") { - push(@attrPervIds, $entr); + push(@attrExIds, $entr); - } else { + } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") { - print ("ppeSetFixed.pl ERROR. Wrong attribute type: $attr->{targetType}\n"); - exit(1); + push(@attrPervIds, $entr); - } + } else { + + print ("ppeSetFixed.pl ERROR. Wrong attribute type: $attr->{targetType}\n"); + exit(1); + } } } } - } - +setFixed("TARGET_TYPE_SYSTEM", @attrSystemIds); setFixed("TARGET_TYPE_PROC_CHIP", @attrChipIds); setFixed("TARGET_TYPE_CORE", @attrCoreIds); setFixed("TARGET_TYPE_EQ", @attrEqIds); @@ -143,68 +145,59 @@ sub setFixed { my ($string, @entries) = @_; -foreach my $attr (@entries) -{ - - my $inname = $attr->{name}; - - my @values = $attr->{value}; - - - if(scalar @values > 0) { - - foreach my $val (@values) + foreach my $attr (@entries) { - if(defined $val && ref($val) eq "") { + my $inname = $attr->{name}; - if ($val =~ /(0x)?[0-9a-fA-F]+/) { - - my $systemRc = system("$sbedefaultpath/sbe_default_tool $image $inname $val $string 0"); - - if ($systemRc) { - print "sbe_default_tool: error in execution\n"; - exit 1; - } - - } else { - print ("ppeSetFixed.pl ERROR. not hex\n"); - exit(1); - } + my @values = $attr->{value}; - } elsif(defined $val && ref($val) eq "ARRAY") { - my $index = 0; + if(scalar @values > 0) { + foreach my $val (@values) + { - foreach my $arr (@{$val}) { + if(defined $val && ref($val) eq "") { - if(defined $arr && ref($arr) eq "") { - if ($arr =~ /(0x)?[0-9a-fA-F]+/) { + if ($val =~ /(0x)?[0-9a-fA-F]+/) { - my $systemRc = system("$sbedefaultpath/sbe_default_tool $image $inname $arr $string $index"); + my $systemRc = system("$sbedefaultpath/sbe_default_tool $image $inname $val $string 0"); if ($systemRc) { print "sbe_default_tool: error in execution\n"; exit 1; } - + } else { + print ("ppeSetFixed.pl ERROR. not hex\n"); + exit(1); } - } - $index++; - } + } elsif(defined $val && ref($val) eq "ARRAY") { + my $index = 0; - } + foreach my $arr (@{$val}) { + if(defined $arr && ref($arr) eq "") { + if ($arr =~ /(0x)?[0-9a-fA-F]+/) { - } - } + my $systemRc = system("$sbedefaultpath/sbe_default_tool $image $inname $arr $string $index"); + if ($systemRc) { + print "sbe_default_tool: error in execution\n"; + exit 1; + } -} + } + } + $index++; + } + } + } + } + } } diff --git a/tools/image/sbe_default_tool.c b/tools/image/sbe_default_tool.c index 817eee09..975c017d 100644 --- a/tools/image/sbe_default_tool.c +++ b/tools/image/sbe_default_tool.c @@ -29,6 +29,7 @@ const char* g_usage = "The 'value' is the value of the attribute to be set.\n" "\n" "The 'target type' is the type of the target. The following targets are defined:\n" +"TARGET_TYPE_SYSTEM: system target\n" "TARGET_TYPE_PROC_CHIP: chip target\n" "TARGET_TYPE_PERV: pervasive target\n" "TARGET_TYPE_CORE: core target\n" @@ -45,48 +46,43 @@ const char* g_usage = void assertTarget(const char* str, unsigned int index) { - if(strcmp(str, "TARGET_TYPE_PROC_CHIP") == 0) { + if(strcmp(str, "TARGET_TYPE_SYSTEM") == 0 || (strcmp(str, "TARGET_TYPE_PROC_CHIP") == 0)) { if (index > 0) { fprintf(stderr, "sbe_default_tool: index (%d) is larger than 0\n", index); exit(1); } - return; } else if(strcmp(str, "TARGET_TYPE_EX") == 0) { if (index > EX_TARGET_COUNT) { fprintf(stderr, "sbe_default_tool: index (%d) is larger than EX_TARGET_COUNT (%d)\n", index, EX_TARGET_COUNT); exit(1); } - return; } else if(strcmp(str, "TARGET_TYPE_EQ") == 0) { if (index > EQ_TARGET_COUNT) { fprintf(stderr, "sbe_default_tool: index (%d) is larger than EQ_TARGET_COUNT (%d)\n", index, EQ_TARGET_COUNT); exit(1); } - return; } else if(strcmp(str, "TARGET_TYPE_CORE") == 0) { if (index > CORE_TARGET_COUNT) { fprintf(stderr, "sbe_default_tool: index (%d) is larger than CORE_TARGET_COUNT (%d)\n", index, CORE_TARGET_COUNT); exit(1); } - return; } else if(strcmp(str, "TARGET_TYPE_PERV") == 0) { if (index > PERV_TARGET_COUNT) { fprintf(stderr, "sbe_default_tool: index (%d) is larger than PERV_TARGET_COUNT (%d)\n", index, PERV_TARGET_COUNT); exit(1); } - return; } else { - if (index >= PERV_TARGET_COUNT) { fprintf(stderr, "sbe_default_tool: target not supported:"); fprintf(stderr, " %s\n", str); exit(1); } } + return; } void setAttribute(void* image, const char* attribute, unsigned int index, uint64_t val) { diff --git a/tools/scripts/ppeCreateAttrGetSetMacros.pl b/tools/scripts/ppeCreateAttrGetSetMacros.pl index 78e8552f..bdbbcae3 100755 --- a/tools/scripts/ppeCreateAttrGetSetMacros.pl +++ b/tools/scripts/ppeCreateAttrGetSetMacros.pl @@ -47,7 +47,7 @@ my @newTargetImplementations; my $servicePath; my $help; -GetOptions ("verbose" => \$VERBOSE, +GetOptions ("verbose" => \$VERBOSE, "help" => \$help, "debug" => \$DEBUG, "path=s" => \$servicePath, @@ -237,7 +237,9 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { my $macroTarget = ""; if(defined $targetMacro) { - if($targetMacro eq "TARGET_TYPE_PROC_CHIP") { + if($targetMacro eq "TARGET_TYPE_SYSTEM") { + $macroTarget = "SystemAttributes_t"; + } elsif ($targetMacro eq "TARGET_TYPE_PROC_CHIP") { $macroTarget = "ProcChipAttributes_t"; } elsif ($targetMacro eq "TARGET_TYPE_CORE") { $macroTarget = "CoreAttributes_t"; @@ -257,21 +259,21 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { if ($VERBOSE) { print "INFO:: did not find ${attribute}_GETMACRO\n"; } my $attributeDefine = "#define ${attribute}_GETMACRO ${macroPrefix}GET${macroPostfix}"; push(@newAttributeDefines, $attributeDefine); - + if(defined $targetMacro) { - my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type *value )"; + my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, const fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* o_pvalue )"; push(@newTargetDefines, $targetFunction . ";"); my $targetImplementation = ""; - if($targetMacro eq "TARGET_TYPE_PROC_CHIP") { + if($targetMacro eq "TARGET_TYPE_PROC_CHIP" | $targetMacro eq "TARGET_TYPE_SYSTEM") { + + $targetImplementation .= "\n" . $targetFunction . "\n{\n *o_pvalue = object->fapi2attr::${macroTarget}::${attribute};\n}\n"; - $targetImplementation .= "\n" . $targetFunction . "\n{\n *value = object->fapi2attr::${macroTarget}::${attribute};\n}\n"; - } else { - $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n *value = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"; + $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n *o_pvalue = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"; } push(@newTargetImplementations, $targetImplementation); @@ -284,16 +286,16 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { if(defined $targetMacro) { - my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* value )"; + my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, const $type& i_pvalue )"; push(@newTargetDefines, $targetFunction . ";"); my $targetImplementation = ""; - if($targetMacro eq "TARGET_TYPE_PROC_CHIP") { + if($targetMacro eq "TARGET_TYPE_PROC_CHIP" | $targetMacro eq "TARGET_TYPE_SYSTEM") { - $targetImplementation = "\n" . $targetFunction . "\n{\n object->fapi2attr::${macroTarget}::${attribute} = *value;\n}\n"; + $targetImplementation = "\n" . $targetFunction . "\n{\n object->fapi2attr::${macroTarget}::${attribute} = i_pvalue;\n}\n"; } else { - $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = *value;\n}\n"; + $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = i_pvalue;\n}\n"; } push(@newTargetImplementations, $targetImplementation); @@ -350,7 +352,7 @@ if (@newAttributeDefines != 0) { } - my $updatedFapiPlatAttributeServiceImpl = $srcPath . "/" . $fapiPlatAttributeServiceImpl; + my $updatedFapiPlatAttributeServiceImpl = $srcPath . "/" . $fapiPlatAttributeServiceImpl; open (OUTFILE, ">$updatedFapiPlatAttributeServiceImpl") or die "ERROR:: could not open $updatedFapiPlatAttributeServiceImpl\n"; print OUTFILE "// $fapiPlatAttributeServiceImpl\n"; @@ -364,7 +366,7 @@ if (@newAttributeDefines != 0) { foreach my $impl (@newTargetImplementations) { - + print OUTFILE $impl; } diff --git a/tools/scripts/ppeParseAttrGetSetMacros.pl b/tools/scripts/ppeParseAttrGetSetMacros.pl index 6968e2c2..cf573ae7 100644 --- a/tools/scripts/ppeParseAttrGetSetMacros.pl +++ b/tools/scripts/ppeParseAttrGetSetMacros.pl @@ -38,7 +38,7 @@ my $xml = new XML::Simple (KeyAttr=>[]); #------------------------------------------------------------------------------ my $chipFile = $ARGV[0]; $chipFile .= "/"; -$chipFile .= "fapi2_attribute_getsettemplates.h"; +$chipFile .= "proc_sbe_fixed_proc_chip.H"; open(CHFILE, ">", $chipFile); my $exFile = $ARGV[0]; @@ -77,6 +77,7 @@ open(PEFILE, ">", $pervFile); my $xmlFiles = 0; my $attCount = 0; my $numIfAttrFiles = 0; +my @attrSystemIds; my @attrChipIds; my @attrExIds; my @attrCoreIds; @@ -128,24 +129,27 @@ foreach my $entr (@{$entries->{entry}}) { exit(1); } + if($attr->{targetType} eq "TARGET_TYPE_SYSTEM") { - if($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") { + push(@attrSystemIds, $attr); + + } elsif($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") { push(@attrChipIds, $attr); } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") { push(@attrCoreIds, $attr); - + } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") { push(@attrEqIds, $attr); - } elsif($attr->{targetType} eq "TARGET_TYPE_EX") { + } elsif($attr->{targetType} eq "TARGET_TYPE_EX") { push(@attrExIds, $attr); - } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") { + } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") { # push(@attrPervIds, $attr->{id}); push(@attrPervIds, $attr); @@ -160,9 +164,21 @@ foreach my $entr (@{$entries->{entry}}) { } } } - } +print SYFILE "// proc_sbe_fixed_system.H\n"; +print SYFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n"; +print SYFILE "#ifndef __PROC_SBE_FIXED_SYSTEM_H__\n"; +print SYFILE "#define __PROC_SBE_FIXED_SYSTEM_H__\n\n"; +foreach my $attr (@attrSystemIds) +{ + + my $value = uc $attr->{valueType}; + print SYFILE "PROC_SBE_FIXED_$value($attr->{id});\n" + + +} +print SYFILE "\n#endif // __PROC_SBE_FIXED_SYSTEM_H__"; print CHFILE "// proc_sbe_fixed_proc_chip.H\n"; print CHFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n"; @@ -173,7 +189,7 @@ foreach my $attr (@attrChipIds) my $value = uc $attr->{valueType}; print CHFILE "PROC_SBE_FIXED_$value($attr->{id});\n" - + } print CHFILE "\n#endif // __PROC_SBE_FIXED_PROC_CHIP_H__"; @@ -187,12 +203,11 @@ foreach my $attr (@attrExIds) my $value = uc $attr->{valueType}; print EXFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EX_TARGET_COUNT);\n" - + } print EXFILE "\n#endif // __PROC_SBE_FIXED_EX_H__"; - print COFILE "// proc_sbe_fixed_co.H\n"; print COFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n"; print COFILE "#ifndef __PROC_SBE_FIXED_CO_H__\n"; @@ -202,13 +217,11 @@ foreach my $attr (@attrCoreIds) my $value = uc $attr->{valueType}; print COFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, CORE_TARGET_COUNT);\n" - + } print COFILE "\n#endif // __PROC_SBE_FIXED_CO_H__"; - - print EQFILE "// proc_sbe_fixed_eq.H\n"; print EQFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n"; print EQFILE "#ifndef __PROC_SBE_FIXED_EQ_H__\n"; @@ -218,13 +231,11 @@ foreach my $attr (@attrEqIds) my $value = uc $attr->{valueType}; print EQFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EQ_TARGET_COUNT);\n" - + } print EQFILE "\n#endif // __PROC_SBE_FIXED_EQ_H__"; - - print PEFILE "// proc_sbe_fixed_perv.H\n"; print PEFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n"; print PEFILE "#ifndef __PROC_SBE_FIXED_PERV_H__\n"; @@ -234,21 +245,13 @@ foreach my $attr (@attrPervIds) my $value = uc $attr->{valueType}; print PEFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, PERV_TARGET_COUNT);\n" - + } print PEFILE "\n#endif // __PROC_SBE_FIXED_PERV_H__"; - - - - - - - #print ASFILE "#endif // __PROC_SBE_FIXED_H__"; - #------------------------------------------------------------------------------ # Close output file #------------------------------------------------------------------------------ diff --git a/tools/scripts/ppeParseAttributeInfo.pl b/tools/scripts/ppeParseAttributeInfo.pl index 34e13edb..1ad5ba91 100755 --- a/tools/scripts/ppeParseAttributeInfo.pl +++ b/tools/scripts/ppeParseAttributeInfo.pl @@ -4,12 +4,7 @@ use strict; -#------------------------------------------------------------------------------ -# Print Command Line Help -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -if ($numArgs < 2) -{ +sub help { print ("Usage: ppeParseAttributeInfo.pl <output dir> <attr-xml-file1> [<attr-xml-file2> ...]\n"); print (" This perl script will parse attribute XML files and create the following files:\n"); print (" - fapi2AttributeIds.H. Contains IDs, type, value enums and other information\n"); @@ -19,16 +14,47 @@ if ($numArgs < 2) print (" - fapi2AttributesSupported.html Contains the HWPF attributes supported\n"); print (" - fapi2AttrInfo.csv Used to process Attribute Override Text files\n"); print (" - fapi2AttrEnumInfo.csv Used to process Attribute Override Text files\n"); +} + +my $DEBUG = 0; +my $VERBOSE = 0; +my $help = 0; + +#------------------------------------------------------------------------------ +# Print Command Line Help +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +if ($numArgs < 2) +{ + print ("Invalid number of arguments\n\n"); + help(); exit(1); } #------------------------------------------------------------------------------ # Specify perl modules to use #------------------------------------------------------------------------------ +use Getopt::Long; use Digest::MD5 qw(md5_hex); use XML::Simple; my $xml = new XML::Simple (KeyAttr=>[]); +GetOptions ("verbose" => \$VERBOSE, + "help" => \$help, + "debug" => \$DEBUG, + ); + +if ($help) +{ + help(); + exit(0); +} + +if ($DEBUG) +{ + print "DEBUG enabled!!!!\n"; +} + # Uncomment to enable debug output #use Data::Dumper; @@ -189,81 +215,78 @@ my %attrValHash; # Records which Attribute values have been used #------------------------------------------------------------------------------ #my $argfile = "p9_ppe_attributes.xml"; my $argfile = $ARGV[1]; +if ($DEBUG) { print "DEBUG:: XML filter file - $argfile\n" } my $entries = $xml->XMLin($argfile, ForceArray => ['entry']); foreach my $entr (@{$entries->{entry}}) { -# print " $entr->{file}, $entr->{name}\n"; - - #my $infile = $entr->{file}; my $inname = $entr->{name}; + if ($DEBUG) { print "DEBUG:: entr->file = $entr->{file}; \n" } -foreach my $argnum (2 .. $#ARGV) -{ - my $infile = $ARGV[$argnum]; - + foreach my $argnum (2 .. $#ARGV) + { + my $infile = $ARGV[$argnum]; - # read XML file. The ForceArray option ensures that there is an array of - # elements even if there is only one such element in the file - my $attributes = $xml->XMLin($infile, ForceArray => ['attribute']); + # read XML file. The ForceArray option ensures that there is an array of + # elements even if there is only one such element in the file + my $attributes = $xml->XMLin($infile, ForceArray => ['attribute']); - # Uncomment to get debug output of all attributes - #print "\nFile: ", $infile, "\n", Dumper($attributes), "\n"; + if ($DEBUG) { print "DEBUG:: File: ", $infile, "\n", Dumper($attributes), "\n"; } - #-------------------------------------------------------------------------- - # For each Attribute - #-------------------------------------------------------------------------- - foreach my $attr (@{$attributes->{attribute}}) - { + #-------------------------------------------------------------------------- + # For each Attribute + #-------------------------------------------------------------------------- + foreach my $attr (@{$attributes->{attribute}}) + { - #print "? $attr->{id}, $inname\n"; + #print "? $attr->{id}, $inname\n"; - if($attr->{id} eq $inname) { + if($attr->{id} eq $inname) { - #print "yes $attr->{id}, $inname\n"; + #print "yes $attr->{id}, $inname\n"; - #---------------------------------------------------------------------- - # Print the Attribute ID and calculated value to fapiAttributeIds.H and - # fapiAttributeIds.txt. The value for an attribute is a hash value - # generated from the attribute name, this ties a specific value to a - # specific attribute name. This is done for Cronus so that if a HWP is - # not recompiled against a new eCMD/Cronus version where the attributes - # have changed then there will not be a mismatch in enumerator values. - # This is a 28bit hash value because the Initfile compiler has a - # requirement that the top nibble of the 32 bit attribute ID be zero to - # store flags - #---------------------------------------------------------------------- - if (! exists $attr->{id}) - { - print ("fapiParseAttributeInfo.pl ERROR. Attribute 'id' missing in $infile\n"); - exit(1); - } + #---------------------------------------------------------------------- + # Print the Attribute ID and calculated value to fapiAttributeIds.H and + # fapiAttributeIds.txt. The value for an attribute is a hash value + # generated from the attribute name, this ties a specific value to a + # specific attribute name. This is done for Cronus so that if a HWP is + # not recompiled against a new eCMD/Cronus version where the attributes + # have changed then there will not be a mismatch in enumerator values. + # This is a 28bit hash value because the Initfile compiler has a + # requirement that the top nibble of the 32 bit attribute ID be zero to + # store flags + #---------------------------------------------------------------------- + if (! exists $attr->{id}) + { + print ("fapiParseAttributeInfo.pl ERROR. Attribute 'id' missing in $infile\n"); + exit(1); + } - if (exists($attrIdHash{$attr->{id}})) - { - # Two different attributes with the same id! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate Attribute id $attr->{id} in $infile\\n"); - exit(1); - } + if (exists($attrIdHash{$attr->{id}})) + { + # Two different attributes with the same id! + print ("fapiParseAttributeInfo.pl ERROR. Duplicate Attribute id $attr->{id} in $infile\\n"); + exit(1); + } - # Calculate a 28 bit hash value. - my $attrHash128Bit = md5_hex($attr->{id}); - my $attrHash28Bit = substr($attrHash128Bit, 0, 7); + # Calculate a 28 bit hash value. + my $attrHash128Bit = md5_hex($attr->{id}); + my $attrHash28Bit = substr($attrHash128Bit, 0, 7); - # Print the attribute ID/value to fapiAttributeIds.H - print AIFILE " $attr->{id} = 0x$attrHash28Bit,\n"; + # Print the attribute ID/value to fapiAttributeIds.H + print AIFILE " $attr->{id} = 0x$attrHash28Bit,\n"; - if (exists($attrValHash{$attrHash28Bit})) - { - # Two different attributes generate the same hash-value! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id hash value for $attr->{id} in $infile\ \n"); - exit(1); - } + if (exists($attrValHash{$attrHash28Bit})) + { + # Two different attributes generate the same hash-value! + print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id hash value for $attr->{id} in $infile\ \n"); + exit(1); + } - $attrIdHash{$attr->{id}} = $attrHash28Bit; - $attrValHash{$attrHash28Bit} = 1; - } - }; -} + $attrIdHash{$attr->{id}} = $attrHash28Bit; + $attrValHash{$attrHash28Bit} = 1; + } + }; + } } #------------------------------------------------------------------------------ @@ -289,374 +312,372 @@ foreach my $entr (@{$entries->{entry}}) { # read XML file. The ForceArray option ensures that there is an array of # elements even if there is only one such element in the file -foreach my $argnum (2 .. $#ARGV) -{ - my $infile = $ARGV[$argnum]; - - my $attributes = $xml->XMLin($infile, ForceArray => ['attribute']); - - # Uncomment to get debug output of all attributes - #print "\nFile: ", $infile, "\n", Dumper($attributes), "\n"; - - #-------------------------------------------------------------------------- - # For each Attribute - #-------------------------------------------------------------------------- - foreach my $attr (@{$attributes->{attribute}}) + foreach my $argnum (2 .. $#ARGV) { + my $infile = $ARGV[$argnum]; + my $attributes = $xml->XMLin($infile, ForceArray => ['attribute']); + # Uncomment to get debug output of all attributes + if ($DEBUG) { print "DEBUG:: File: ", $infile, "\n", Dumper($attributes), "\n"; } - if($attr->{id} eq $inname) { - - #---------------------------------------------------------------------- - # Print a comment with the attribute ID fapiAttributeIds.H - #---------------------------------------------------------------------- - print AIFILE "/* $attr->{id} */\n"; - - #---------------------------------------------------------------------- - # Print the AttributeId and description to fapiAttributesSupported.html - #---------------------------------------------------------------------- - if (! exists $attr->{description}) - { - print ("fapiParseAttributeInfo.pl ERROR. Attribute 'description' missing for $attr->{id} in $infile\n"); - exit(1); - } - - - #---------------------------------------------------------------------- - # Figure out the attribute array dimensions (if array) - #---------------------------------------------------------------------- - my $arrayDimensions = ""; - my $numArrayDimensions = 0; - if ($attr->{array}) + #-------------------------------------------------------------------------- + # For each Attribute + #-------------------------------------------------------------------------- + foreach my $attr (@{$attributes->{attribute}}) { - # Remove leading whitespace - my $dimText = $attr->{array}; - $dimText =~ s/^\s+//; - # Split on commas or whitespace - my @vals = split(/\s*,\s*|\s+/, $dimText); + if($attr->{id} eq $inname) { - foreach my $val (@vals) - { - $arrayDimensions .= "[${val}]"; - $numArrayDimensions++; - } - } + #---------------------------------------------------------------------- + # Print a comment with the attribute ID fapiAttributeIds.H + #---------------------------------------------------------------------- + print AIFILE "/* $attr->{id} */\n"; - #---------------------------------------------------------------------- - # Print the typedef for each attribute's val type to fapiAttributeIds.H - # Print the attribute information to fapiAttrInfo.csv - #---------------------------------------------------------------------- - if (exists $attr->{chipEcFeature}) - { - # The value type of chip EC feature attributes is uint8_t - print AIFILE "typedef uint8_t $attr->{id}_Type;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8\n" - } - else - { - if (! exists $attr->{valueType}) + #---------------------------------------------------------------------- + # Print the AttributeId and description to fapiAttributesSupported.html + #---------------------------------------------------------------------- + if (! exists $attr->{description}) { - print ("fapiParseAttributeInfo.pl ERROR. Att 'valueType' missing for $attr->{id} in $infile\n"); + print ("fapiParseAttributeInfo.pl ERROR. Attribute 'description' missing for $attr->{id} in $infile\n"); exit(1); } - if ($attr->{valueType} eq 'uint8') + + #---------------------------------------------------------------------- + # Figure out the attribute array dimensions (if array) + #---------------------------------------------------------------------- + my $arrayDimensions = ""; + my $numArrayDimensions = 0; + if ($attr->{array}) { - print AIFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" . - "$arrayDimensions\n"; + # Remove leading whitespace + my $dimText = $attr->{array}; + $dimText =~ s/^\s+//; + + # Split on commas or whitespace + my @vals = split(/\s*,\s*|\s+/, $dimText); + + foreach my $val (@vals) + { + $arrayDimensions .= "[${val}]"; + $numArrayDimensions++; + } } - elsif ($attr->{valueType} eq 'uint16') + + #---------------------------------------------------------------------- + # Print the typedef for each attribute's val type to fapiAttributeIds.H + # Print the attribute information to fapiAttrInfo.csv + #---------------------------------------------------------------------- + if (exists $attr->{chipEcFeature}) { - print AIFILE "typedef uint16_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" . - "$arrayDimensions\n"; + # The value type of chip EC feature attributes is uint8_t + print AIFILE "typedef uint8_t $attr->{id}_Type;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8\n" } - elsif ($attr->{valueType} eq 'uint32') + else { - print AIFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u32" . - "$arrayDimensions\n"; + if (! exists $attr->{valueType}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'valueType' missing for $attr->{id} in $infile\n"); + exit(1); + } + + if ($attr->{valueType} eq 'uint8') + { + print AIFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'uint16') + { + print AIFILE "typedef uint16_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'uint32') + { + print AIFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u32" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'uint64') + { + print AIFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u64" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'int8') + { + print AIFILE "typedef int8_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},8" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'int16') + { + print AIFILE "typedef int16_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},32" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'int32') + { + print AIFILE "typedef int32_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},32" . + "$arrayDimensions\n"; + } + elsif ($attr->{valueType} eq 'int64') + { + print AIFILE "typedef int64_t $attr->{id}_Type$arrayDimensions;\n"; + print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},64" . + "$arrayDimensions\n"; + } + else + { + print ("fapi2ParseAttributeInfo.pl ERROR. valueType not recognized: "); + print $attr->{valueType}, " for $attr->{id} in $infile\n"; + exit(1); + } } - elsif ($attr->{valueType} eq 'uint64') + + #---------------------------------------------------------------------- + # Print if the attribute is privileged + #---------------------------------------------------------------------- + if (exists $attr->{privileged}) { - print AIFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u64" . - "$arrayDimensions\n"; + print AIFILE "const bool $attr->{id}_Privileged = true;\n"; } - elsif ($attr->{valueType} eq 'int8') + else { - print AIFILE "typedef int8_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},8" . - "$arrayDimensions\n"; + print AIFILE "const bool $attr->{id}_Privileged = false;\n"; } - elsif ($attr->{valueType} eq 'int16') + + #---------------------------------------------------------------------- + # Print the target type(s) that the attribute is associated with + #---------------------------------------------------------------------- + if (! exists $attr->{targetType}) { - print AIFILE "typedef int16_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},32" . - "$arrayDimensions\n"; + print ("fapiParseAttributeInfo.pl ERROR. Att 'targetType' missing for $attr->{id} in $infile\n"); + exit(1); } - elsif ($attr->{valueType} eq 'int32') + + print AIFILE "const TargetTypes_t $attr->{id}_TargetTypes = "; + + # Split on commas + my @targTypes = split(',', $attr->{targetType}); + + my $targTypeCount = 0; + foreach my $targType (@targTypes) { - print AIFILE "typedef int32_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},32" . - "$arrayDimensions\n"; + # Remove newlines and leading/trailing whitespace + $targType =~ s/\n//; + $targType =~ s/^\s+//; + $targType =~ s/\s+$//; + + if ($targTypeCount != 0) + { + print AIFILE " | "; + } + print AIFILE "$targType"; + $targTypeCount++; } - elsif ($attr->{valueType} eq 'int64') + print AIFILE ";\n"; + + #---------------------------------------------------------------------- + # Print if the attribute is a platInit attribute + #---------------------------------------------------------------------- + if (exists $attr->{platInit}) { - print AIFILE "typedef int64_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},64" . - "$arrayDimensions\n"; + print AIFILE "const bool $attr->{id}_PlatInit = true;\n"; } else { - print ("fapi2ParseAttributeInfo.pl ERROR. valueType not recognized: "); - print $attr->{valueType}, " for $attr->{id} in $infile\n"; - exit(1); + print AIFILE "const bool $attr->{id}_PlatInit = false;\n"; } - } - - #---------------------------------------------------------------------- - # Print if the attribute is privileged - #---------------------------------------------------------------------- - if (exists $attr->{privileged}) - { - print AIFILE "const bool $attr->{id}_Privileged = true;\n"; - } - else - { - print AIFILE "const bool $attr->{id}_Privileged = false;\n"; - } - - #---------------------------------------------------------------------- - # Print the target type(s) that the attribute is associated with - #---------------------------------------------------------------------- - if (! exists $attr->{targetType}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'targetType' missing for $attr->{id} in $infile\n"); - exit(1); - } - - print AIFILE "const TargetTypes_t $attr->{id}_TargetTypes = "; - - # Split on commas - my @targTypes = split(',', $attr->{targetType}); - my $targTypeCount = 0; - foreach my $targType (@targTypes) - { - # Remove newlines and leading/trailing whitespace - $targType =~ s/\n//; - $targType =~ s/^\s+//; - $targType =~ s/\s+$//; - - if ($targTypeCount != 0) + #---------------------------------------------------------------------- + # Print if the attribute is a initToZero attribute + #---------------------------------------------------------------------- + if (exists $attr->{initToZero}) { - print AIFILE " | "; + print AIFILE "const bool $attr->{id}_InitToZero = true;\n"; + } + else + { + print AIFILE "const bool $attr->{id}_InitToZero = false;\n"; } - print AIFILE "$targType"; - $targTypeCount++; - } - print AIFILE ";\n"; - - #---------------------------------------------------------------------- - # Print if the attribute is a platInit attribute - #---------------------------------------------------------------------- - if (exists $attr->{platInit}) - { - print AIFILE "const bool $attr->{id}_PlatInit = true;\n"; - } - else - { - print AIFILE "const bool $attr->{id}_PlatInit = false;\n"; - } - #---------------------------------------------------------------------- - # Print if the attribute is a initToZero attribute - #---------------------------------------------------------------------- - if (exists $attr->{initToZero}) - { - print AIFILE "const bool $attr->{id}_InitToZero = true;\n"; - } - else - { - print AIFILE "const bool $attr->{id}_InitToZero = false;\n"; - } + #---------------------------------------------------------------------- + # Print the value enumeration (if specified) to fapiAttributeIds.H and + # fapiAttributeEnums.txt + #---------------------------------------------------------------------- + if (exists $attr->{enum}) + { + print AIFILE "enum $attr->{id}_Enum\n{\n"; - #---------------------------------------------------------------------- - # Print the value enumeration (if specified) to fapiAttributeIds.H and - # fapiAttributeEnums.txt - #---------------------------------------------------------------------- - if (exists $attr->{enum}) - { - print AIFILE "enum $attr->{id}_Enum\n{\n"; + # Values must be separated by commas to allow for values to be + # specified: <enum>VAL_A = 3, VAL_B = 5, VAL_C = 0x23</enum> + my @vals = split(',', $attr->{enum}); - # Values must be separated by commas to allow for values to be - # specified: <enum>VAL_A = 3, VAL_B = 5, VAL_C = 0x23</enum> - my @vals = split(',', $attr->{enum}); + foreach my $val (@vals) + { + # Remove newlines and leading/trailing whitespace + $val =~ s/\n//; + $val =~ s/^\s+//; + $val =~ s/\s+$//; - foreach my $val (@vals) - { - # Remove newlines and leading/trailing whitespace - $val =~ s/\n//; - $val =~ s/^\s+//; - $val =~ s/\s+$//; + # Print the attribute enum to fapiAttributeIds.H + print AIFILE " ENUM_$attr->{id}_${val}"; - # Print the attribute enum to fapiAttributeIds.H - print AIFILE " ENUM_$attr->{id}_${val}"; + # Print the attribute enum to fapiAttrEnumInfo.csv + my $attrEnumTxt = "$attr->{id}_${val}\n"; + $attrEnumTxt =~ s/ = /,/; + print ETFILE $attrEnumTxt; - # Print the attribute enum to fapiAttrEnumInfo.csv - my $attrEnumTxt = "$attr->{id}_${val}\n"; - $attrEnumTxt =~ s/ = /,/; - print ETFILE $attrEnumTxt; + if ($attr->{valueType} eq 'uint64') + { + print AIFILE "ULL"; + } - if ($attr->{valueType} eq 'uint64') - { - print AIFILE "ULL"; + print AIFILE ",\n"; } - print AIFILE ",\n"; + print AIFILE "};\n"; } - print AIFILE "};\n"; - } - - #---------------------------------------------------------------------- - # Print _GETMACRO and _SETMACRO where appropriate to fapiAttributeIds.H - #---------------------------------------------------------------------- - if (exists $attr->{chipEcFeature}) - { - #------------------------------------------------------------------ - # The attribute is a Chip EC Feature, define _GETMACRO to call a - # fapi function and define _SETMACRO to something that will cause a - # compile failure if a set is attempted - #------------------------------------------------------------------ - print AIFILE "#define $attr->{id}_GETMACRO(ID, PTARGET, VAL) \\\n"; - print AIFILE " PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : \\\n"; - print AIFILE " fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL)\n"; - print AIFILE "#define $attr->{id}_SETMACRO(ID, PTARGET, VAL) "; - print AIFILE "CHIP_EC_FEATURE_ATTRIBUTE_NOT_WRITABLE\n"; - } - elsif (! exists $attr->{writeable}) - { - #------------------------------------------------------------------ - # The attribute is read-only, define the _SETMACRO to something - # that will cause a compile failure if a set is attempted - #------------------------------------------------------------------ - if (! exists $attr->{writeable}) + #---------------------------------------------------------------------- + # Print _GETMACRO and _SETMACRO where appropriate to fapiAttributeIds.H + #---------------------------------------------------------------------- + if (exists $attr->{chipEcFeature}) { - print AIFILE "#define $attr->{id}_SETMACRO ATTRIBUTE_NOT_WRITABLE\n"; + #------------------------------------------------------------------ + # The attribute is a Chip EC Feature, define _GETMACRO to call a + # fapi function and define _SETMACRO to something that will cause a + # compile failure if a set is attempted + #------------------------------------------------------------------ + print AIFILE "#define $attr->{id}_GETMACRO(ID, PTARGET, VAL) \\\n"; + print AIFILE " PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : \\\n"; + print AIFILE " fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL)\n"; + print AIFILE "#define $attr->{id}_SETMACRO(ID, PTARGET, VAL) "; + print AIFILE "CHIP_EC_FEATURE_ATTRIBUTE_NOT_WRITABLE\n"; } - } - - #---------------------------------------------------------------------- - # If the attribute is a Chip EC Feature, print the chip EC feature - # query to fapiChipEcFeature.C - #---------------------------------------------------------------------- - if (exists $attr->{chipEcFeature}) - { - my $chipCount = 0; - print ECFILE " case $attr->{id}:\n"; - print ECFILE " if (\n"; - - foreach my $chip (@{$attr->{chipEcFeature}->{chip}}) + elsif (! exists $attr->{writeable}) { - $chipCount++; - - if (! exists $chip->{name}) + #------------------------------------------------------------------ + # The attribute is read-only, define the _SETMACRO to something + # that will cause a compile failure if a set is attempted + #------------------------------------------------------------------ + if (! exists $attr->{writeable}) { - print ("fapiParseAttributeInfo.pl ERROR. Att 'name' missing\n"); - exit(1); - } - - if (! exists $chip->{ec}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'ec' missing\n"); - exit(1); - } - - if (! exists $chip->{ec}->{value}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'value' missing\n"); - exit(1); + print AIFILE "#define $attr->{id}_SETMACRO ATTRIBUTE_NOT_WRITABLE\n"; } + } - if (! exists $chip->{ec}->{test}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'test' missing\n"); - exit(1); - } + #---------------------------------------------------------------------- + # If the attribute is a Chip EC Feature, print the chip EC feature + # query to fapiChipEcFeature.C + #---------------------------------------------------------------------- + if (exists $attr->{chipEcFeature}) + { + my $chipCount = 0; + print ECFILE " case $attr->{id}:\n"; + print ECFILE " if (\n"; - my $test; - if ($chip->{ec}->{test} eq 'EQUAL') - { - $test = '=='; - } - elsif ($chip->{ec}->{test} eq 'GREATER_THAN') - { - $test = '>'; - } - elsif ($chip->{ec}->{test} eq 'GREATER_THAN_OR_EQUAL') - { - $test = '>='; - } - elsif ($chip->{ec}->{test} eq 'LESS_THAN') - { - $test = '<'; - } - elsif ($chip->{ec}->{test} eq 'LESS_THAN_OR_EQUAL') + foreach my $chip (@{$attr->{chipEcFeature}->{chip}}) { - $test = '<='; - } - else - { - print ("fapiParseAttributeInfo.pl ERROR. test '$chip->{ec}->{test}' unrecognized\n"); - exit(1); + $chipCount++; + + if (! exists $chip->{name}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'name' missing\n"); + exit(1); + } + + if (! exists $chip->{ec}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'ec' missing\n"); + exit(1); + } + + if (! exists $chip->{ec}->{value}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'value' missing\n"); + exit(1); + } + + if (! exists $chip->{ec}->{test}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'test' missing\n"); + exit(1); + } + + my $test; + if ($chip->{ec}->{test} eq 'EQUAL') + { + $test = '=='; + } + elsif ($chip->{ec}->{test} eq 'GREATER_THAN') + { + $test = '>'; + } + elsif ($chip->{ec}->{test} eq 'GREATER_THAN_OR_EQUAL') + { + $test = '>='; + } + elsif ($chip->{ec}->{test} eq 'LESS_THAN') + { + $test = '<'; + } + elsif ($chip->{ec}->{test} eq 'LESS_THAN_OR_EQUAL') + { + $test = '<='; + } + else + { + print ("fapiParseAttributeInfo.pl ERROR. test '$chip->{ec}->{test}' unrecognized\n"); + exit(1); + } + + if ($chipCount > 1) + { + print ECFILE " ||\n"; + } + print ECFILE " ((l_chipName == $chip->{name}) &&\n"; + print ECFILE " (l_chipEc $test $chip->{ec}->{value}))\n"; } - if ($chipCount > 1) - { - print ECFILE " ||\n"; - } - print ECFILE " ((l_chipName == $chip->{name}) &&\n"; - print ECFILE " (l_chipEc $test $chip->{ec}->{value}))\n"; + print ECFILE " )\n"; + print ECFILE " {\n"; + print ECFILE " o_hasFeature = true;\n"; + print ECFILE " }\n"; + print ECFILE " break;\n"; } - print ECFILE " )\n"; - print ECFILE " {\n"; - print ECFILE " o_hasFeature = true;\n"; - print ECFILE " }\n"; - print ECFILE " break;\n"; - } - - #---------------------------------------------------------------------- - # Print the platform attribute checks to fapiAttributePlatCheck.H - #---------------------------------------------------------------------- - if (exists $attr->{writeable}) - { - print ACFILE "#ifndef $attr->{id}_SETMACRO\n"; - print ACFILE "#error Platform does not support set of HWPF attr $attr->{id}\n"; - print ACFILE "#endif\n"; - } + #---------------------------------------------------------------------- + # Print the platform attribute checks to fapiAttributePlatCheck.H + #---------------------------------------------------------------------- + if (exists $attr->{writeable}) + { + print ACFILE "#ifndef $attr->{id}_SETMACRO\n"; + print ACFILE "#error Platform does not support set of HWPF attr $attr->{id}\n"; + print ACFILE "#endif\n"; + } - print ACFILE "#ifndef $attr->{id}_GETMACRO\n"; - print ACFILE "#error Platform does not support get of HWPF attr $attr->{id}\n"; - print ACFILE "#endif\n\n"; + print ACFILE "#ifndef $attr->{id}_GETMACRO\n"; + print ACFILE "#error Platform does not support get of HWPF attr $attr->{id}\n"; + print ACFILE "#endif\n\n"; - #---------------------------------------------------------------------- - # Print newline between each attribute's info to fapiAttributeIds.H - #---------------------------------------------------------------------- - print AIFILE "\n"; + #---------------------------------------------------------------------- + # Print newline between each attribute's info to fapiAttributeIds.H + #---------------------------------------------------------------------- + print AIFILE "\n"; - } - }; -} + } + }; + } } @@ -1047,13 +1068,6 @@ print ASFILE "</body>\n"; print ASFILE "</html>\n"; - - - - - - - #------------------------------------------------------------------------------ # Close output files #------------------------------------------------------------------------------ @@ -1063,4 +1077,3 @@ close(ACFILE); close(ASFILE); close(ITFILE); close(ETFILE); - diff --git a/tools/scripts/ppeParseProcSbeFixed.pl b/tools/scripts/ppeParseProcSbeFixed.pl index e963bb50..ddcd5558 100755 --- a/tools/scripts/ppeParseProcSbeFixed.pl +++ b/tools/scripts/ppeParseProcSbeFixed.pl @@ -36,6 +36,11 @@ my $xml = new XML::Simple (KeyAttr=>[]); #------------------------------------------------------------------------------ # Open output file for writing #------------------------------------------------------------------------------ +my $sysFile = $ARGV[0]; +$sysFile .= "/"; +$sysFile .= "proc_sbe_fixed_system.H"; +open(SYFILE, ">", $sysFile); + my $chipFile = $ARGV[0]; $chipFile .= "/"; $chipFile .= "proc_sbe_fixed_proc_chip.H"; @@ -66,6 +71,7 @@ open(PEFILE, ">", $pervFile); my $xmlFiles = 0; my $attCount = 0; my $numIfAttrFiles = 0; +my @attrSystemIds; my @attrChipIds; my @attrExIds; my @attrCoreIds; @@ -108,55 +114,65 @@ foreach my $entr (@{$entries->{entry}}) { if($attr->{id} eq $inname) { - #------------------------------------------------------------------ - # Check that the AttributeId exists - #------------------------------------------------------------------ - if (! exists $attr->{id}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n"); - exit(1); - } + #------------------------------------------------------------------ + # Check that the AttributeId exists + #------------------------------------------------------------------ + if (! exists $attr->{id}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n"); + exit(1); + } + if ($attr->{targetType} eq "TARGET_TYPE_SYSTEM") { - if($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") { + push(@attrSystemIds, $attr); - #push(@attrChipIds, $attr->{id}); - push(@attrChipIds, $attr); + } elsif ($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") { - } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") { + push(@attrChipIds, $attr); - # push(@attrCoreIds, $attr->{id}); - push(@attrCoreIds, $attr); - - } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") { + } elsif ($attr->{targetType} eq "TARGET_TYPE_CORE") { - # push(@attrEqIds, $attr->{id}); - push(@attrEqIds, $attr); + push(@attrCoreIds, $attr); - } elsif($attr->{targetType} eq "TARGET_TYPE_EX") { + } elsif ($attr->{targetType} eq "TARGET_TYPE_EQ") { - # push(@attrExIds, $attr->{id}); - push(@attrExIds, $attr); + push(@attrEqIds, $attr); - } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") { + } elsif ($attr->{targetType} eq "TARGET_TYPE_EX") { -# push(@attrPervIds, $attr->{id}); - push(@attrPervIds, $attr); + push(@attrExIds, $attr); - } else { + } elsif ($attr->{targetType} eq "TARGET_TYPE_PERV") { - print ("ppeParseProcSbeFixed.pl ERROR. Wrong attribute type: $attr->{targetType} for attribute $attr->{id} in $infile\n"); - exit(1); + push(@attrPervIds, $attr); - } + } else { + print ("ppeParseProcSbeFixed.pl ERROR. Wrong attribute type: $attr->{targetType} for attribute $attr->{id} in $infile\n"); + exit(1); + + } } } } - } +print SYFILE "// proc_sbe_fixed_system.H\n"; +print SYFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n"; +print SYFILE "#ifndef __PROC_SBE_FIXED_SYSTEM_H__\n"; +print SYFILE "#define __PROC_SBE_FIXED_SYSTEM_H__\n\n"; +foreach my $attr (@attrSystemIds) +{ + + my $value = uc $attr->{valueType}; + print SYFILE "PROC_SBE_FIXED_$value($attr->{id});\n" + + +} +print SYFILE "\n#endif // __PROC_SBE_FIXED_SYSTEM_H__"; + print CHFILE "// proc_sbe_fixed_proc_chip.H\n"; print CHFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n"; print CHFILE "#ifndef __PROC_SBE_FIXED_PROC_CHIP_H__\n"; @@ -166,7 +182,7 @@ foreach my $attr (@attrChipIds) my $value = uc $attr->{valueType}; print CHFILE "PROC_SBE_FIXED_$value($attr->{id});\n" - + } print CHFILE "\n#endif // __PROC_SBE_FIXED_PROC_CHIP_H__"; @@ -180,7 +196,7 @@ foreach my $attr (@attrExIds) my $value = uc $attr->{valueType}; print EXFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EX_TARGET_COUNT);\n" - + } print EXFILE "\n#endif // __PROC_SBE_FIXED_EX_H__"; @@ -195,7 +211,7 @@ foreach my $attr (@attrCoreIds) my $value = uc $attr->{valueType}; print COFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, CORE_TARGET_COUNT);\n" - + } print COFILE "\n#endif // __PROC_SBE_FIXED_CO_H__"; @@ -211,7 +227,7 @@ foreach my $attr (@attrEqIds) my $value = uc $attr->{valueType}; print EQFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EQ_TARGET_COUNT);\n" - + } print EQFILE "\n#endif // __PROC_SBE_FIXED_EQ_H__"; @@ -227,18 +243,12 @@ foreach my $attr (@attrPervIds) my $value = uc $attr->{valueType}; print PEFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, PERV_TARGET_COUNT);\n" - + } print PEFILE "\n#endif // __PROC_SBE_FIXED_PERV_H__"; - - - - - - #print ASFILE "#endif // __PROC_SBE_FIXED_H__"; diff --git a/tools/scripts/src/fapi2PlatAttributeService.H b/tools/scripts/src/fapi2PlatAttributeService.H index 5010b2ea..ada3681c 100644 --- a/tools/scripts/src/fapi2PlatAttributeService.H +++ b/tools/scripts/src/fapi2PlatAttributeService.H @@ -32,12 +32,12 @@ /* global get uint8_t 1D array macro */ #define PLAT_ATTR_GET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ _getAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ - (ID, PTARGET, VAL) - + (ID, PTARGET, VAL) + /* global set uint8_t 1D array macro */ #define PLAT_ATTR_SET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ _setAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ - (ID, PTARGET, VAL) + (ID, PTARGET, VAL) /* global get uint8_t 2D array macro */ #define PLAT_ATTR_GET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ @@ -124,7 +124,7 @@ /* global set int macro (uint8_t, 16, 32 and 64) */ #define PLAT_ATTR_SET_GLOBAL_INT(ID, PTARGET, VAL) \ - _set<ID##_Type, static_cast<fapi2:TargetType>(ID##_TargetTypes), ID> \ + _set<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ (ID, PTARGET, VAL) @@ -179,36 +179,38 @@ _getOverride<ID##_Type>(ID, PTARGET, VAL) /******************************************************************************/ -// Get string +// Get string /******************************************************************************/ -extern "C" -{ +extern "C" +{ + extern fapi2attr::SystemAttributes_t G_system_attributes asm("G_system_attributes") __attribute__ ((section (".fixed"))); extern fapi2attr::ProcChipAttributes_t G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); extern fapi2attr::PervAttributes_t G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); extern fapi2attr::CoreAttributes_t G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); extern fapi2attr::EQAttributes_t G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); extern fapi2attr::EXAttributes_t G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); - - extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr ; - extern fapi2attr::PervAttributes_t* G_perv_attributes_ptr; - extern fapi2attr::CoreAttributes_t* G_core_attributes_ptr; - extern fapi2attr::EQAttributes_t* G_eq_attributes_ptr; - extern fapi2attr::EXAttributes_t* G_ex_attributes_ptr; + + extern fapi2attr::SystemAttributes_t* G_system_attributes_ptr; + extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr; + extern fapi2attr::PervAttributes_t* G_perv_attributes_ptr; + extern fapi2attr::CoreAttributes_t* G_core_attributes_ptr; + extern fapi2attr::EQAttributes_t* G_eq_attributes_ptr; + extern fapi2attr::EXAttributes_t* G_ex_attributes_ptr; } -namespace fapi2 +namespace fapi2 { -// Parameters are done as pointers (vs references) to allow the attribute +// Parameters are done as pointers (vs references) to allow the attribute // storage to be relocated template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> -void __set( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, TValue* value ); +void __set( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, const TValue& value ); template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> -void __get( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, TValue* value ); +void __get( const Target<K>& i_ptarget, const TAttrStruct* object, const AttributeId attrid, TValue* value ); /* INSERT NEW GETTER AND SETTER FUNCTIONS HERE */ @@ -219,15 +221,15 @@ void __get( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId a // Get base template //****************************************************************************** template<typename T, TargetType K, AttributeId A> -ReturnCode _get(const AttributeId i_Id, +ReturnCode _get(const AttributeId i_id, const Target<K> & i_pTarget, T& o_value) { - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get uint8_t +// Get uint8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -236,36 +238,41 @@ ReturnCode _get(const AttributeId i_id, { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } - + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get uint16_t +// Get uint16_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -273,38 +280,43 @@ ReturnCode _get(const AttributeId i_id, uint16_t& o_value) { static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); - + + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } - + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get uint32_t +// Get uint32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -312,38 +324,43 @@ ReturnCode _get(const AttributeId i_id, uint32_t& o_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); - + + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } - + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get uint64_t +// Get uint64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -351,39 +368,43 @@ ReturnCode _get(const AttributeId i_id, uint64_t& o_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); - + + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get Override uint8_t +// Get Override uint8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -392,12 +413,12 @@ ReturnCode _getOverride(const AttributeId i_id, { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get Override uint16_t +// Get Override uint16_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -406,12 +427,12 @@ ReturnCode _getOverride(const AttributeId i_id, { static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get Override uint32_t +// Get Override uint32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -420,12 +441,12 @@ ReturnCode _getOverride(const AttributeId i_id, { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get Override uint64_t +// Get Override uint64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -434,7 +455,7 @@ ReturnCode _getOverride(const AttributeId i_id, { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } @@ -448,12 +469,12 @@ ReturnCode _getEcFeatureOverride(const AttributeId i_id, { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); - // The way this is implemented, we want to return a non-zero return code if we found an override. + // The way this is implemented, we want to return a non-zero return code if we found an override. // Return 0 if there was an error. // This is how it's implemented: // PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL) - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } @@ -466,16 +487,16 @@ ReturnCode _getAttributeArrayShort(const AttributeId i_id, uint8_t * o_pValues) { // fapi2::Attributeta o_data; -// fapi2::ReturnCode l_fapi_rc(FAPI2_RC_SUCCESS); +// fapi2::ReturnCode l_fapi_rc(FAPI2_RC_SUCCESS); // uint32_t l_ecmd_rc = ECMD_SUCCESS; -// +// // ecmdChipTarget l_ecmd_target; // fapiTargetPointerToEcmdTarget(i_pTarget, l_ecmd_target); -// +// // o_data.faValidMask = FAPI_ATTRIBUTE_TYPE_UINT8ARY; // o_data.faUint8ary = o_pValues; -// -// l_ecmd_rc = fapi2GetAttribute(l_ecmd_target, i_id, o_data); +// +// l_ecmd_rc = fapi2GetAttribute(l_ecmd_target, i_id, o_data); // if (l_ecmd_rc) // { // l_fapi_rc = (ReturnCodes) l_ecmd_rc; @@ -492,31 +513,36 @@ ReturnCode _setAttributeArrayShort(const AttributeId i_id, const Target<K> & i_pTarget, uint8_t * i_pValues) { + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, *i_pValues ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, *i_pValues ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_pValues ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, *i_pValues ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, *i_pValues ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, *i_pValues ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, *i_pValues ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, *i_pValues ); } - + return FAPI2_RC_SUCCESS; } @@ -636,174 +662,193 @@ ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id, // Set base template //****************************************************************************** template<typename T, TargetType K, AttributeId A> -ReturnCode _set(const AttributeId i_Id, +ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - T& i_value) + const T& i_value) { - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set uint8_t +// Set uint8_t //****************************************************************************** -template<typename T, TargetType K, typename A> -ReturnCode _set(const AttributeId i_Id, +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - uint8_t& i_value) + const uint8_t& i_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set uint16_t +// Set uint16_t //****************************************************************************** -template<typename T, TargetType K, typename A> -ReturnCode _set( +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - uint16_t& i_value) + const uint16_t& i_value) { static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set uint32_t +// Set uint32_t //****************************************************************************** -template<typename T, TargetType K, typename A> -ReturnCode _set( +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - uint32_t& i_value) + const uint32_t& i_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id,i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set uint64_t +// Set uint64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> -ReturnCode _set(const AttributeId i_Id, +ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, const uint64_t & i_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get int8_t +// Get int8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -812,36 +857,41 @@ ReturnCode _get(const AttributeId i_id, { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get int16_t +// Get int16_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -850,37 +900,42 @@ ReturnCode _get(const AttributeId i_id, { static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get int32_t +// Get int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -889,37 +944,42 @@ ReturnCode _get(const AttributeId i_id, { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); + if(K & TARGET_TYPE_SYSTEM) + { + __get<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get int64_t +// Get int64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, @@ -928,37 +988,42 @@ ReturnCode _get(const AttributeId i_id, { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, &o_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } - + if(K & TARGET_TYPE_EX) - { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); - } + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } - return FAPI2_RC_SUCCESS; + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Get Override int8_t +// Get Override int8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -971,7 +1036,7 @@ ReturnCode _getOverride(const AttributeId i_id, } //****************************************************************************** -// Get Override int16_t +// Get Override int16_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -984,7 +1049,7 @@ ReturnCode _getOverride(const AttributeId i_id, } //****************************************************************************** -// Get Override int32_t +// Get Override int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -997,7 +1062,7 @@ ReturnCode _getOverride(const AttributeId i_id, } //****************************************************************************** -// Get Override int64_t +// Get Override int64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, @@ -1005,7 +1070,7 @@ ReturnCode _getOverride(const AttributeId i_id, int64_t& o_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); - + return FAPI2_RC_SUCCESS; } @@ -1149,122 +1214,137 @@ ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** -// Set int8_t +// Set int8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - int8_t& i_value) + const int8_t& i_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set int16_t +// Set int16_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - int16_t& i_value) + const int16_t& i_value) { static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set int32_t +// Set int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, const Target<K> & i_pTarget, - int32_t& i_value) + const int32_t& i_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } //****************************************************************************** -// Set int64_t +// Set int64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, @@ -1273,31 +1353,36 @@ ReturnCode _set(const AttributeId i_id, { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); // May need to remove + if(K & TARGET_TYPE_SYSTEM) + { + __set<K, fapi2attr::SystemAttributes_t, T, A>( i_pTarget, G_system_attributes_ptr, i_id, i_value ); + } + if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + __set<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, i_value ); } - + if(K & TARGET_TYPE_EX) - { - __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, i_value ); } - + return FAPI2_RC_SUCCESS; } |