Skip to content

Commit

Permalink
add seperate class name for odyssey kernel pib and fsi targets
Browse files Browse the repository at this point in the history
adding seperate class name for the odyssey pib and fsi targets
so that searching for the matching pib and fsi targets for the
ocmb target is faster.

Signed-off-by: Marri Devender Rao <[email protected]>
Change-Id: I36a2c8a19688e543ba9198f69bb6c1b927bd7223
  • Loading branch information
devenrao committed Dec 6, 2023
1 parent e849972 commit e9d8cec
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bmc-kernel.dts.m4
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define(`PIB_ODY',
#address-cells = <0x2>;
#size-cells = <0x1>;
reg = <0x0 0x$1 0x8000>; /*dummy to fix dts warning*/
compatible = "ibm,kernel-pib";
compatible = "ibm,kernel-pib-ody";
index = <0x$1>;
proc = <0x$2>;
port = <$4>;
Expand Down Expand Up @@ -134,7 +134,7 @@ define(`HMFSI_ODY',
hmfsi-ody@$3$4 {
#address-cells = <0x2>;
#size-cells = <0x1>;
compatible = "ibm,kernel-fsi";
compatible = "ibm,kernel-fsi-ody";
device-path = "/i2cr$3$4/slave@00:00/raw";
reg = <0x0 0x$1 0x8000>; /*dummy to fix dts warning*/
index = <0x$1>;
Expand Down
36 changes: 31 additions & 5 deletions libpdbg/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ static struct fsi kernel_fsi = {
};
DECLARE_HW_UNIT(kernel_fsi);

static struct fsi kernel_fsi_ody = {
.target = {
.name = "Kernel based FSI master for oddyssey",
.compatible = "ibm,kernel-fsi-ody",
.class = "fsi-ody",
.probe = kernel_fsi_probe,
.release = kernel_fsi_release,
},
.read = kernel_fsi_getcfam,
.write = kernel_fsi_putcfam,
};
DECLARE_HW_UNIT(kernel_fsi_ody);


static int kernel_pib_getscom(struct pib *pib, uint64_t addr, uint64_t *value)
{
int rc;
Expand Down Expand Up @@ -263,13 +277,12 @@ static int kernel_pib_probe(struct pdbg_target *target)

struct pdbg_target* get_ody_pib_target(struct pdbg_target *target)
{
//TODO need to assert if the target passed is not of ocmb type
uint32_t ocmb_proc = pdbg_target_index(pdbg_target_parent("proc", target));
uint32_t ocmb_index = pdbg_target_index(target) % 0x8;

struct pdbg_target *pib = NULL;
struct pdbg_target *pib_target;
pdbg_for_each_class_target("pib", pib_target) {
pdbg_for_each_class_target("pib-ody", pib_target) {
uint32_t index = pdbg_target_index(pib_target);
uint32_t proc = 0;
if(!pdbg_target_u32_property(pib_target, "proc", &proc)) {
Expand All @@ -286,14 +299,12 @@ struct pdbg_target* get_ody_pib_target(struct pdbg_target *target)

struct pdbg_target* get_ody_fsi_target(struct pdbg_target *target)
{
//TODO need to assert if the target passed is not of ocmb type
uint32_t ocmb_proc = pdbg_target_index(pdbg_target_parent("proc", target));
uint32_t ocmb_index = pdbg_target_index(target) % 0x8;

printf("get_ody_fsi_target ocmb_proc %d ocmb_index %d \n", ocmb_proc, ocmb_index);
struct pdbg_target *fsi = NULL;
struct pdbg_target *fsi_target;
pdbg_for_each_class_target("fsi", fsi_target) {
pdbg_for_each_class_target("fsi-ody", fsi_target) {
uint32_t index = pdbg_target_index(fsi_target);
uint32_t proc = 0;
if(!pdbg_target_u32_property(fsi_target, "proc", &proc)) {
Expand All @@ -320,9 +331,24 @@ struct pib kernel_pib = {
};
DECLARE_HW_UNIT(kernel_pib);

struct pib kernel_pib_ody = {
.target = {
.name = "Kernel based FSI SCOM for oddyssey",
.compatible = "ibm,kernel-pib-ody",
.class = "pib-ody",
.probe = kernel_pib_probe,
},
.read = kernel_pib_getscom,
.write = kernel_pib_putscom,
};
DECLARE_HW_UNIT(kernel_pib_ody);


__attribute__((constructor))
static void register_kernel(void)
{
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_fsi_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_fsi_ody_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_pib_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_pib_ody_hw_unit);
}

0 comments on commit e9d8cec

Please sign in to comment.