From 2a43137619e384bee38ea58d817a0d15876d2473 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sat, 21 Aug 2021 00:35:32 +0200 Subject: [PATCH] arm_adi_v5: drop ANY_ID from table dap_part_nums MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The initial version of the table dap_part_nums contains only the part number of the device and not the manufacturer ID. This causes collisions between devices with same part number but from different manufacturer. The table has been extended to include the manufacturer JEDEC code in commit 2f131d3c3004 ("ARM ADIv5: CoreSight ROM decode part number and designer id"). For two old/legacy table's entries reported without manufacturer code it was defined a special ANY_ID manufacturer, meaning skip the check for manufacturer! The two legacy entries report the comment "from OMAP3 memmap", and thanks to the associated string has been possible through Google to identify a Master Report [1] about using OpenOCD with the OMAP3 in a BeagleBoard. The ROM table is printed with OpenOCD command "dap info 1" at page 8 and reports the Peripheral ID required to extract the manufacturer ID that, out of any surprise, belong to Texas Instruments. Set the two missing manufacturer ID to Texas Instruments JEDEC code. Remove the now redundant definition and use of ANY_ID. While revisiting this old code, remove also the useless comment "0x113: what?". It was introduced in commit ddade10d4a93 ("ARM ADIv5: "dap info" gets more readable") and from the same dump in [1] it's clearly another element in OMAP3. It is listed as entry 0x8 in the ROM table and there is no further info available. OpenOCD will anyway list it as: Designer is 0x017, Texas Instruments Part is 0x113, Unrecognized Another link https://elinux.org/BeagleBoardOpenOCD reports the text "Part number 0x113: This is ????", which sounds familiar! No public document from Texas Instruments reports what is this device at address 0x54012000. [1] Warren Clay Grant - University of Texas at Austin "Implementation of an Open Source JTAG Debugging Development Chain for the BeagleBoard ARM® Cortex A-8" - May 2012 Link: https://repositories.lib.utexas.edu/bitstream/handle/2152/ETD-UT-2012-05-5478/GRANT-MASTERS-REPORT.pdf Change-Id: I7e007addbb5c6e90303e4e8c110c7d27810fbe9c Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/6454 Tested-by: jenkins Reviewed-by: Daniel Goehring --- src/target/arm_adi_v5.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index f813d85520..8d6d6618bc 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1107,14 +1107,6 @@ static int dap_read_part_id(struct adiv5_ap *ap, target_addr_t component_base, u * from chip observation (e.g. TI SDTI). */ -/* The legacy code only used the part number field to identify CoreSight peripherals. - * This meant that the same part number from two different manufacturers looked the same. - * It is desirable for all future additions to identify with both part number and JEP106. - * "ANY_ID" is a wildcard (any JEP106) only to preserve legacy behavior for legacy entries. - */ - -#define ANY_ID 0x1000 - static const struct dap_part_nums { uint16_t designer_id; uint16_t part_num; @@ -1227,6 +1219,8 @@ static const struct dap_part_nums { { ARM_ID, 0xd0c, "Neoverse N1", "(Debug Unit)", }, { ARM_ID, 0xd13, "Cortex-R52 Debug", "(Debug Unit)", }, { ARM_ID, 0xd49, "Neoverse N2", "(Debug Unit)", }, + { 0x017, 0x120, "TI SDTI", "(System Debug Trace Interface)", }, /* from OMAP3 memmap */ + { 0x017, 0x343, "TI DAPCTL", "", }, /* from OMAP3 memmap */ { 0x017, 0x9af, "MSP432 ROM", "(ROM Table)" }, { 0x01f, 0xcd0, "Atmel CPU with DSU", "(CPU)" }, { 0x041, 0x1db, "XMC4500 ROM", "(ROM Table)" }, @@ -1243,9 +1237,6 @@ static const struct dap_part_nums { { 0x1eb, 0x211, "Tegra 210 ROM", "(ROM Table)", }, { 0x1eb, 0x302, "Denver Debug", "(Debug Unit)", }, { 0x1eb, 0x402, "Denver PMU", "(Performance Monitor Unit)", }, - /* legacy comment: 0x113: what? */ - { ANY_ID, 0x120, "TI SDTI", "(System Debug Trace Interface)", }, /* from OMAP3 memmap */ - { ANY_ID, 0x343, "TI DAPCTL", "", }, /* from OMAP3 memmap */ }; static const struct dap_part_nums *pidr_to_part_num(unsigned int designer_id, unsigned int part_num) @@ -1255,12 +1246,10 @@ static const struct dap_part_nums *pidr_to_part_num(unsigned int designer_id, un .full = "", }; - for (unsigned int i = 0; i < ARRAY_SIZE(dap_part_nums); i++) { - if (dap_part_nums[i].designer_id != designer_id && dap_part_nums[i].designer_id != ANY_ID) - continue; - if (dap_part_nums[i].part_num == part_num) + for (unsigned int i = 0; i < ARRAY_SIZE(dap_part_nums); i++) + if (dap_part_nums[i].designer_id == designer_id && dap_part_nums[i].part_num == part_num) return &dap_part_nums[i]; - } + return &unknown; } -- 2.30.2