arm_adi_v5: fix access to 64-bit MEM-AP
Commitac22cdc573("target/adiv5: Large Physical Address Extension") reads the register MEM_AP_REG_CFG and keeps it in a new field of struct adiv5_ap. The test on LE bit (Large Extension) is used to identify if mem_ap addresses are 32 or 64 bits. But the register MEM_AP_REG_CFG is only read during mem_ap_init(), that is called only when the AP is used as a target debug AP or if a target mem_ap is attached to that AP. The openocd commands '<dapname> baseaddr', '<dapname> info' and 'dap info' can be executed on AP that has not been associated yet to a target, thus executed without any knowledge of MEM_AP_REG_CFG value. The initialization to ADI_BAD_CFG causes openocd to always use 32 bit mode on un-associated APs. Verify if MEM_AP_REG_CFG has not been read and eventually read it. In case of 32 bits mode AP, MEM_AP_REG_BASE64 is defined as 'RES0' (reserved, but readable); the code can queue both the read of MEM_AP_REG_CFG and MEM_AP_REG_BASE64, before knowing if the former is required. This speeds-up the operation. Rename ADI_BAD_CFG as MEM_AP_REG_CFG_INVALID. Change-Id: If3bbd792b56a483022c37ccc2ce82b5ba5c36caa Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes:ac22cdc573("target/adiv5: Large Physical Address Extension") Reviewed-on: http://openocd.zylin.com/6412 Tested-by: jenkins Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
This commit is contained in:
@@ -36,8 +36,6 @@ extern const struct dap_ops swd_dap_ops;
|
||||
extern const struct dap_ops jtag_dp_ops;
|
||||
extern struct adapter_driver *adapter_driver;
|
||||
|
||||
#define ADI_BAD_CFG 0xBAD00000
|
||||
|
||||
/* DAP command support */
|
||||
struct arm_dap_object {
|
||||
struct list_head lh;
|
||||
@@ -59,7 +57,7 @@ static void dap_instance_init(struct adiv5_dap *dap)
|
||||
dap->ap[i].tar_autoincr_block = (1<<10);
|
||||
/* default CSW value */
|
||||
dap->ap[i].csw_default = CSW_AHB_DEFAULT;
|
||||
dap->ap[i].cfg_reg = ADI_BAD_CFG; /* mem_ap configuration reg (large physical addr, etc.) */
|
||||
dap->ap[i].cfg_reg = MEM_AP_REG_CFG_INVALID; /* mem_ap configuration reg (large physical addr, etc.) */
|
||||
}
|
||||
INIT_LIST_HEAD(&dap->cmd_journal);
|
||||
INIT_LIST_HEAD(&dap->cmd_pool);
|
||||
|
||||
Reference in New Issue
Block a user