@@ -597,6 +597,6 @@ DECLARE_HW_UNIT(p9_adu);
__attribute__((constructor))
static void register_adu(void)
{
- pdbg_hwunit_register(&p8_adu_hw_unit);
- pdbg_hwunit_register(&p9_adu_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_adu_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_adu_hw_unit);
}
@@ -519,5 +519,5 @@ DECLARE_HW_UNIT(bmcfsi);
__attribute__((constructor))
static void register_bmcfsi(void)
{
- pdbg_hwunit_register(&bmcfsi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &bmcfsi_hw_unit);
}
@@ -353,8 +353,8 @@ DECLARE_HW_UNIT(cfam_hmfsi);
__attribute__((constructor))
static void register_cfam(void)
{
- pdbg_hwunit_register(&fsi_pib_hw_unit);
- pdbg_hwunit_register(&p8_opb_hw_unit);
- pdbg_hwunit_register(&p8_opb_hmfsi_hw_unit);
- pdbg_hwunit_register(&cfam_hmfsi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fsi_pib_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_opb_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_opb_hmfsi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &cfam_hmfsi_hw_unit);
}
@@ -679,5 +679,5 @@ DECLARE_HW_UNIT(proc);
__attribute__((constructor))
static void register_proc(void)
{
- pdbg_hwunit_register(&proc_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &proc_hw_unit);
}
@@ -219,7 +219,7 @@ DECLARE_HW_UNIT(cronus_sbefifo);
__attribute__((constructor))
static void register_cronus(void)
{
- pdbg_hwunit_register(&cronus_pib_hw_unit);
- pdbg_hwunit_register(&cronus_fsi_hw_unit);
- pdbg_hwunit_register(&cronus_sbefifo_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &cronus_pib_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &cronus_fsi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &cronus_sbefifo_hw_unit);
}
@@ -60,23 +60,16 @@ static struct pdbg_target *dt_pdbg_target_new(const void *fdt, int node_offset)
prop = fdt_get_property(fdt, node_offset, "compatible", NULL);
if (prop) {
- int i, prop_len = fdt32_to_cpu(prop->len);
+ uint32_t prop_len = fdt32_to_cpu(prop->len);
/*
* If I understand correctly, the property we have
* here can be a stringlist with a few compatible
* strings
*/
- i = 0;
- while (i < prop_len) {
- hw_info = pdbg_hwunit_find_compatible(&prop->data[i]);
- if (hw_info) {
- size = hw_info->size;
- break;
- }
-
- i += strlen(&prop->data[i]) + 1;
- }
+ hw_info = pdbg_hwunit_find_compatible(prop->data, prop_len);
+ if (hw_info)
+ size = hw_info->size;
}
if (!hw_info)
@@ -90,8 +90,8 @@ DECLARE_HW_UNIT(fake_thread);
__attribute__((constructor))
static void register_fake(void)
{
- pdbg_hwunit_register(&fake_fsi_hw_unit);
- pdbg_hwunit_register(&fake_pib_hw_unit);
- pdbg_hwunit_register(&fake_core_hw_unit);
- pdbg_hwunit_register(&fake_thread_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_fsi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_pib_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_core_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &fake_thread_hw_unit);
}
@@ -127,5 +127,5 @@ DECLARE_HW_UNIT(host_pib);
__attribute__((constructor))
static void register_host(void)
{
- pdbg_hwunit_register(&host_pib_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &host_pib_hw_unit);
}
@@ -1158,7 +1158,7 @@ DECLARE_HW_UNIT(p8_chtm);
__attribute__((constructor))
static void register_htm(void)
{
- pdbg_hwunit_register(&p8_nhtm_hw_unit);
- pdbg_hwunit_register(&p9_nhtm_hw_unit);
- pdbg_hwunit_register(&p8_chtm_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_nhtm_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_nhtm_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_chtm_hw_unit);
}
@@ -20,26 +20,28 @@
#include "hwunit.h"
#define MAX_HW_UNITS 1024
+#define MAX_BACKENDS 16
-static const struct hw_unit_info *g_hw_unit[MAX_HW_UNITS];
-static int g_hw_unit_count;
+static const struct hw_unit_info *g_hw_unit[MAX_BACKENDS][MAX_HW_UNITS];
+static int g_hw_unit_count[MAX_BACKENDS];
-void pdbg_hwunit_register(const struct hw_unit_info *hw_unit)
+void pdbg_hwunit_register(enum pdbg_backend backend, const struct hw_unit_info *hw_unit)
{
- assert(g_hw_unit_count < MAX_HW_UNITS);
+ assert(g_hw_unit_count[backend] < MAX_HW_UNITS);
- g_hw_unit[g_hw_unit_count] = hw_unit;
- g_hw_unit_count++;
+ g_hw_unit[backend][g_hw_unit_count[backend]] = hw_unit;
+ g_hw_unit_count[backend]++;
}
-const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat)
+static const struct hw_unit_info *find_driver(enum pdbg_backend backend,
+ const char *compat)
{
const struct hw_unit_info *p;
struct pdbg_target *target;
int i;
- for (i = 0; i < g_hw_unit_count; i++) {
- p = g_hw_unit[i];
+ for (i = 0; i < g_hw_unit_count[backend]; i++) {
+ p = g_hw_unit[backend][i];
target = p->hw_unit;
if (!strcmp(target->compatible, compat))
@@ -48,3 +50,34 @@ const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat)
return NULL;
}
+
+static const struct hw_unit_info *find_compatible(enum pdbg_backend backend,
+ const char *compat_list,
+ uint32_t len)
+{
+ const struct hw_unit_info *p;
+ uint32_t i;
+
+ i = 0;
+ while (i < len) {
+ p = find_driver(backend, &compat_list[i]);
+ if (p)
+ return p;
+
+ i += strlen(&compat_list[i]) + 1;
+ }
+
+ return NULL;
+}
+
+const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat_list,
+ uint32_t len)
+{
+ const struct hw_unit_info *p;
+
+ p = find_compatible(pdbg_get_backend(), compat_list, len);
+ if (!p)
+ p = find_compatible(PDBG_DEFAULT_BACKEND, compat_list, len);
+
+ return p;
+}
@@ -31,8 +31,9 @@ struct hw_unit_info {
size_t size;
};
-void pdbg_hwunit_register(const struct hw_unit_info *hw_unit);
-const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat);
+void pdbg_hwunit_register(enum pdbg_backend backend, const struct hw_unit_info *hw_unit);
+const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat_list,
+ uint32_t len);
/*
* If this macro fails to compile for you, you've probably not
@@ -177,5 +177,5 @@ DECLARE_HW_UNIT(p8_i2c_pib);
__attribute__((constructor))
static void register_i2c(void)
{
- pdbg_hwunit_register(&p8_i2c_pib_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_i2c_pib_hw_unit);
}
@@ -264,6 +264,6 @@ DECLARE_HW_UNIT(kernel_pib);
__attribute__((constructor))
static void register_kernel(void)
{
- pdbg_hwunit_register(&kernel_fsi_hw_unit);
- pdbg_hwunit_register(&kernel_pib_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_fsi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_pib_hw_unit);
}
@@ -738,6 +738,6 @@ DECLARE_HW_UNIT(p8_core);
__attribute__((constructor))
static void register_p8chip(void)
{
- pdbg_hwunit_register(&p8_thread_hw_unit);
- pdbg_hwunit_register(&p8_core_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_thread_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p8_core_hw_unit);
}
@@ -720,30 +720,30 @@ DECLARE_HW_UNIT(p9_capp);
__attribute__((constructor))
static void register_p9_fapi_targets(void)
{
- pdbg_hwunit_register(&p9_ex_hw_unit);
- pdbg_hwunit_register(&p9_mba_hw_unit);
- pdbg_hwunit_register(&p9_mcs_hw_unit);
- pdbg_hwunit_register(&p9_xbus_hw_unit);
- pdbg_hwunit_register(&p9_abus_hw_unit);
- pdbg_hwunit_register(&p9_l4_hw_unit);
- pdbg_hwunit_register(&p9_eq_hw_unit);
- pdbg_hwunit_register(&p9_mca_hw_unit);
- pdbg_hwunit_register(&p9_mcbist_hw_unit);
- pdbg_hwunit_register(&p9_mi_hw_unit);
- pdbg_hwunit_register(&p9_dmi_hw_unit);
- pdbg_hwunit_register(&p9_obus_hw_unit);
- pdbg_hwunit_register(&p9_obus_brick_hw_unit);
- pdbg_hwunit_register(&p9_sbe_hw_unit);
- pdbg_hwunit_register(&p9_ppe_hw_unit);
- pdbg_hwunit_register(&p9_pec_hw_unit);
- pdbg_hwunit_register(&p9_phb_hw_unit);
- pdbg_hwunit_register(&p9_mc_hw_unit);
- pdbg_hwunit_register(&p9_mem_port_hw_unit);
- pdbg_hwunit_register(&p9_nmmu_hw_unit);
- pdbg_hwunit_register(&p9_pau_hw_unit);
- pdbg_hwunit_register(&p9_iohs_hw_unit);
- pdbg_hwunit_register(&p9_fc_hw_unit);
- pdbg_hwunit_register(&p9_pauc_hw_unit);
- pdbg_hwunit_register(&p9_chiplet_hw_unit);
- pdbg_hwunit_register(&p9_capp_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_ex_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mba_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mcs_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_xbus_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_abus_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_l4_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_eq_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mca_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mcbist_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_dmi_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_obus_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_obus_brick_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_sbe_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_ppe_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_pec_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_phb_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mc_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_mem_port_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_nmmu_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_pau_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_iohs_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_fc_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_pauc_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_chiplet_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_capp_hw_unit);
}
@@ -510,6 +510,6 @@ DECLARE_HW_UNIT(p9_core);
__attribute__((constructor))
static void register_p9chip(void)
{
- pdbg_hwunit_register(&p9_thread_hw_unit);
- pdbg_hwunit_register(&p9_core_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_thread_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &p9_core_hw_unit);
}
@@ -321,8 +321,8 @@ DECLARE_HW_UNIT(kernel_sbefifo);
__attribute__((constructor))
static void register_sbefifo(void)
{
- pdbg_hwunit_register(&kernel_sbefifo_hw_unit);
- pdbg_hwunit_register(&sbefifo_chipop_hw_unit);
- pdbg_hwunit_register(&sbefifo_mem_hw_unit);
- pdbg_hwunit_register(&sbefifo_pba_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_sbefifo_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_chipop_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_mem_hw_unit);
+ pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_pba_hw_unit);
}