9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 17b0700723b5998f15e3d065104343211c75c33f
parent ef1f6e02acac83f1c32800a25739183bdeb2bed7
Author: Roberto Vargas <roberto.vargas@arm.com>
Date:   Wed, 10 Oct 2018 15:20:48 +0100

Commit headers and code generated from json

Diffstat:
Dinclude/.gitignore | 1-
Ainclude/types.h | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/libtypes/Makefile | 16+++++++++++++++-
Asrc/libtypes/pack_rscb.c | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/libtypes/pack_rscb_ctrl.c | 28++++++++++++++++++++++++++++
Asrc/libtypes/pack_rscb_event_ctx.c | 22++++++++++++++++++++++
Asrc/libtypes/pack_rscb_event_vec.c | 24++++++++++++++++++++++++
Asrc/libtypes/pack_rscb_l0rgt_hdr.c | 28++++++++++++++++++++++++++++
Asrc/libtypes/pack_rscb_rpu_cfg.c | 24++++++++++++++++++++++++
Asrc/libtypes/pack_rscb_state.c | 20++++++++++++++++++++
Asrc/libtypes/pack_rscb_sys_props.c | 25+++++++++++++++++++++++++
Asrc/libtypes/unpack_rscb.c | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/libtypes/unpack_rscb_ctrl.c | 28++++++++++++++++++++++++++++
Asrc/libtypes/unpack_rscb_event_ctx.c | 22++++++++++++++++++++++
Asrc/libtypes/unpack_rscb_event_vec.c | 24++++++++++++++++++++++++
Asrc/libtypes/unpack_rscb_l0rgt_hdr.c | 28++++++++++++++++++++++++++++
Asrc/libtypes/unpack_rscb_rpu_cfg.c | 24++++++++++++++++++++++++
Asrc/libtypes/unpack_rscb_state.c | 20++++++++++++++++++++
Asrc/libtypes/unpack_rscb_sys_props.c | 25+++++++++++++++++++++++++
19 files changed, 626 insertions(+), 2 deletions(-)

diff --git a/include/.gitignore b/include/.gitignore @@ -1 +0,0 @@ -types.h diff --git a/include/types.h b/include/types.h @@ -0,0 +1,115 @@ +#if __GNUC__ || __clang__ +#define UNPACKFMT __attribute__ ((format (scanf, 2, 3))) +#define PACKFMT __attribute__ ((format (printf, 2, 3))) +#else +#define UNPACKFMT +#define PACKFMT +#endif + +extern int unpack(uint64_t buf[], const char *fmt, ...) UNPACKFMT; +extern int pack(uint64_t buf[], const char *fmt, ...) PACKFMT; +struct rscb_ctrl { + unsigned char en; //#1 + unsigned char preg_lock; //#1 + unsigned char dbg; //#1 + unsigned char res0_0; //#1 + unsigned char rmu_wlock; //#1 + unsigned char rot_wlock; //#1 + unsigned char rscb_lock; //#1 + unsigned char alive; //#1 + unsigned long long res0_1; //#55 +}; + +struct rscb_rpu_cfg { + unsigned char rpgsize; //#1 + unsigned char res0_0; //#5 + unsigned char spec; //#1 + unsigned char res0_1; //#5 + unsigned char srpupriv; //#7 + unsigned char pepriv; //#7 +}; + +struct rscb_l0rgt_hdr { + unsigned char valid; //#1 + unsigned char entries; //#4 + unsigned char segsize; //#5 + unsigned long long baddr; //#39 + unsigned char res0_0; //#3 + unsigned char irgn; //#1 + unsigned char orgn; //#1 + unsigned char sh; //#1 + unsigned char res0_1; //#1 +}; + +struct rscb_sys_props { + unsigned char rpu; //#1 + unsigned char enc; //#2 + unsigned char res0_0; //#1 + unsigned char integ; //#1 + unsigned char zero; //#1 + unsigned char dram_pkg; //#1 + unsigned long res0_1; //#22 +}; + +struct rscb_state { + unsigned char extdbg; //#7 + unsigned long res0_0; //#23 +}; + +struct rscb_event_vec { + unsigned char fatal; //#1 + unsigned char sram_ras; //#1 + unsigned char preg_wb; //#1 + unsigned char rpu_err; //#1 + unsigned char mpe_err; //#1 + unsigned long res0_0; //#26 +}; + +struct rscb_event_ctx { + unsigned char index; //#5 + unsigned char client; //#5 + unsigned long long addr; //#39 + unsigned char subtype; //#3 +}; + +struct rscb { + struct rscb_ctrl ctrl; //#64 + struct rscb_rpu_cfg rpu_cfg; //#32 + struct rscb_l0rgt_hdr l0rgt_hdr; //#64 + unsigned char global_lock; //#64 + unsigned char hw_ver; //#32 + unsigned char rom_ver; //#32 + unsigned char ram_ver; //#32 + struct rscb_sys_props sys_props; //#32 + unsigned char gp0; //#32 + unsigned char gp1; //#32 + unsigned char gp2; //#32 + unsigned char gp3; //#32 + unsigned char nonce; //#64 + struct rscb_state state; //#32 + struct rscb_event_vec event_vec; //#32 + struct rscb_event_ctx event_ctx; //#64 +}; + +/* prototypes */ +extern int pack_rscb_state(uint64_t buf[], struct rscb_state *sp); +extern int unpack_rscb_state(uint64_t buf[], struct rscb_state *sp); + +extern int pack_rscb_event_ctx(uint64_t buf[], struct rscb_event_ctx *sp); +extern int unpack_rscb_event_ctx(uint64_t buf[], struct rscb_event_ctx *sp); + +extern int pack_rscb_sys_props(uint64_t buf[], struct rscb_sys_props *sp); +extern int unpack_rscb_sys_props(uint64_t buf[], struct rscb_sys_props *sp); + +extern int pack_rscb_event_vec(uint64_t buf[], struct rscb_event_vec *sp); +extern int unpack_rscb_event_vec(uint64_t buf[], struct rscb_event_vec *sp); + +extern int pack_rscb_l0rgt_hdr(uint64_t buf[], struct rscb_l0rgt_hdr *sp); +extern int unpack_rscb_l0rgt_hdr(uint64_t buf[], struct rscb_l0rgt_hdr *sp); + +extern int pack_rscb_rpu_cfg(uint64_t buf[], struct rscb_rpu_cfg *sp); +extern int unpack_rscb_rpu_cfg(uint64_t buf[], struct rscb_rpu_cfg *sp); + +extern int pack_rscb_ctrl(uint64_t buf[], struct rscb_ctrl *sp); +extern int unpack_rscb_ctrl(uint64_t buf[], struct rscb_ctrl *sp); + diff --git a/src/libtypes/Makefile b/src/libtypes/Makefile @@ -1,7 +1,21 @@ PROJECTDIR=../.. include $(PROJECTDIR)/scripts/rules.mk -OBJS = pack.o unpack.o +OBJS = pack.o unpack.o \ + pack_rscb_state.o \ + unpack_rscb_state.o \ + pack_rscb_event_ctx.o \ + unpack_rscb_event_ctx.o \ + pack_rscb_sys_props.o \ + unpack_rscb_sys_props.o \ + pack_rscb_event_vec.o \ + unpack_rscb_event_vec.o \ + pack_rscb_l0rgt_hdr.o \ + unpack_rscb_l0rgt_hdr.o \ + pack_rscb_rpu_cfg.o \ + unpack_rscb_rpu_cfg.o \ + pack_rscb_ctrl.o \ + unpack_rscb_ctrl.o \ RMSA = $(JSONDIR)/RMSA.json TARGET = $(LIBDIR)/libtypes.a diff --git a/src/libtypes/pack_rscb.c b/src/libtypes/pack_rscb.c @@ -0,0 +1,77 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb(uint64_t buf[], struct rscb *sp) +{ + int n; + + n = pack(buf, + "%1c %1c %1c %1c %1c %1c %1c" + "%1c %55llu %1c %5c %1c %5c %7c" + "%7c %1c %4c %5c %39llu %3c %1c" + "%1c %1c %1c %64c %32c %32c %32c" + "%1c %2c %1c %1c %1c %1c %22lu" + "%32c %32c %32c %32c %64c %7c %23lu" + "%1c %1c %1c %1c %1c %26lu %5c" + "%5c %39llu %3c", + sp->ctrl.en, + sp->ctrl.preg_lock, + sp->ctrl.dbg, + sp->ctrl.res0_0, + sp->ctrl.rmu_wlock, + sp->ctrl.rot_wlock, + sp->ctrl.rscb_lock, + sp->ctrl.alive, + sp->ctrl.res0_1, + sp->rpu_cfg.rpgsize, + sp->rpu_cfg.res0_0, + sp->rpu_cfg.spec, + sp->rpu_cfg.res0_1, + sp->rpu_cfg.srpupriv, + sp->rpu_cfg.pepriv, + sp->l0rgt_hdr.valid, + sp->l0rgt_hdr.entries, + sp->l0rgt_hdr.segsize, + sp->l0rgt_hdr.baddr, + sp->l0rgt_hdr.res0_0, + sp->l0rgt_hdr.irgn, + sp->l0rgt_hdr.orgn, + sp->l0rgt_hdr.sh, + sp->l0rgt_hdr.res0_1, + sp->global_lock, + sp->hw_ver, + sp->rom_ver, + sp->ram_ver, + sp->sys_props.rpu, + sp->sys_props.enc, + sp->sys_props.res0_0, + sp->sys_props.integ, + sp->sys_props.zero, + sp->sys_props.dram_pkg, + sp->sys_props.res0_1, + sp->gp0, + sp->gp1, + sp->gp2, + sp->gp3, + sp->nonce, + sp->state.extdbg, + sp->state.res0_0, + sp->event_vec.fatal, + sp->event_vec.sram_ras, + sp->event_vec.preg_wb, + sp->event_vec.rpu_err, + sp->event_vec.mpe_err, + sp->event_vec.res0_0, + sp->event_ctx.index, + sp->event_ctx.client, + sp->event_ctx.addr, + sp->event_ctx.subtype); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_ctrl.c b/src/libtypes/pack_rscb_ctrl.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_ctrl(uint64_t buf[], struct rscb_ctrl *sp) +{ + int n; + + n = pack(buf, + "%1c %1c %1c %1c %1c %1c %1c" + "%1c %55llu", + sp->en, + sp->preg_lock, + sp->dbg, + sp->res0_0, + sp->rmu_wlock, + sp->rot_wlock, + sp->rscb_lock, + sp->alive, + sp->res0_1); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_event_ctx.c b/src/libtypes/pack_rscb_event_ctx.c @@ -0,0 +1,22 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_event_ctx(uint64_t buf[], struct rscb_event_ctx *sp) +{ + int n; + + n = pack(buf, + "%5c %5c %39llu %3c", + sp->index, + sp->client, + sp->addr, + sp->subtype); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_event_vec.c b/src/libtypes/pack_rscb_event_vec.c @@ -0,0 +1,24 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_event_vec(uint64_t buf[], struct rscb_event_vec *sp) +{ + int n; + + n = pack(buf, + "%1c %1c %1c %1c %1c %26lu", + sp->fatal, + sp->sram_ras, + sp->preg_wb, + sp->rpu_err, + sp->mpe_err, + sp->res0_0); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_l0rgt_hdr.c b/src/libtypes/pack_rscb_l0rgt_hdr.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_l0rgt_hdr(uint64_t buf[], struct rscb_l0rgt_hdr *sp) +{ + int n; + + n = pack(buf, + "%1c %4c %5c %39llu %3c %1c %1c" + "%1c %1c", + sp->valid, + sp->entries, + sp->segsize, + sp->baddr, + sp->res0_0, + sp->irgn, + sp->orgn, + sp->sh, + sp->res0_1); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_rpu_cfg.c b/src/libtypes/pack_rscb_rpu_cfg.c @@ -0,0 +1,24 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_rpu_cfg(uint64_t buf[], struct rscb_rpu_cfg *sp) +{ + int n; + + n = pack(buf, + "%1c %5c %1c %5c %7c %7c", + sp->rpgsize, + sp->res0_0, + sp->spec, + sp->res0_1, + sp->srpupriv, + sp->pepriv); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_state.c b/src/libtypes/pack_rscb_state.c @@ -0,0 +1,20 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_state(uint64_t buf[], struct rscb_state *sp) +{ + int n; + + n = pack(buf, + "%7c %23lu", + sp->extdbg, + sp->res0_0); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/pack_rscb_sys_props.c b/src/libtypes/pack_rscb_sys_props.c @@ -0,0 +1,25 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +pack_rscb_sys_props(uint64_t buf[], struct rscb_sys_props *sp) +{ + int n; + + n = pack(buf, + "%1c %2c %1c %1c %1c %1c %22lu", + sp->rpu, + sp->enc, + sp->res0_0, + sp->integ, + sp->zero, + sp->dram_pkg, + sp->res0_1); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb.c b/src/libtypes/unpack_rscb.c @@ -0,0 +1,77 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb(uint64_t buf[], struct rscb *sp) +{ + int n; + + n = unpack(buf, + "%1c %1c %1c %1c %1c %1c %1c" + "%1c %55llu %1c %5c %1c %5c %7c" + "%7c %1c %4c %5c %39llu %3c %1c" + "%1c %1c %1c %64c %32c %32c %32c" + "%1c %2c %1c %1c %1c %1c %22lu" + "%32c %32c %32c %32c %64c %7c %23lu" + "%1c %1c %1c %1c %1c %26lu %5c" + "%5c %39llu %3c", + &sp->ctrl.en, + &sp->ctrl.preg_lock, + &sp->ctrl.dbg, + &sp->ctrl.res0_0, + &sp->ctrl.rmu_wlock, + &sp->ctrl.rot_wlock, + &sp->ctrl.rscb_lock, + &sp->ctrl.alive, + &sp->ctrl.res0_1, + &sp->rpu_cfg.rpgsize, + &sp->rpu_cfg.res0_0, + &sp->rpu_cfg.spec, + &sp->rpu_cfg.res0_1, + &sp->rpu_cfg.srpupriv, + &sp->rpu_cfg.pepriv, + &sp->l0rgt_hdr.valid, + &sp->l0rgt_hdr.entries, + &sp->l0rgt_hdr.segsize, + &sp->l0rgt_hdr.baddr, + &sp->l0rgt_hdr.res0_0, + &sp->l0rgt_hdr.irgn, + &sp->l0rgt_hdr.orgn, + &sp->l0rgt_hdr.sh, + &sp->l0rgt_hdr.res0_1, + &sp->global_lock, + &sp->hw_ver, + &sp->rom_ver, + &sp->ram_ver, + &sp->sys_props.rpu, + &sp->sys_props.enc, + &sp->sys_props.res0_0, + &sp->sys_props.integ, + &sp->sys_props.zero, + &sp->sys_props.dram_pkg, + &sp->sys_props.res0_1, + &sp->gp0, + &sp->gp1, + &sp->gp2, + &sp->gp3, + &sp->nonce, + &sp->state.extdbg, + &sp->state.res0_0, + &sp->event_vec.fatal, + &sp->event_vec.sram_ras, + &sp->event_vec.preg_wb, + &sp->event_vec.rpu_err, + &sp->event_vec.mpe_err, + &sp->event_vec.res0_0, + &sp->event_ctx.index, + &sp->event_ctx.client, + &sp->event_ctx.addr, + &sp->event_ctx.subtype); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_ctrl.c b/src/libtypes/unpack_rscb_ctrl.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_ctrl(uint64_t buf[], struct rscb_ctrl *sp) +{ + int n; + + n = unpack(buf, + "%1c %1c %1c %1c %1c %1c %1c" + "%1c %55llu", + &sp->en, + &sp->preg_lock, + &sp->dbg, + &sp->res0_0, + &sp->rmu_wlock, + &sp->rot_wlock, + &sp->rscb_lock, + &sp->alive, + &sp->res0_1); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_event_ctx.c b/src/libtypes/unpack_rscb_event_ctx.c @@ -0,0 +1,22 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_event_ctx(uint64_t buf[], struct rscb_event_ctx *sp) +{ + int n; + + n = unpack(buf, + "%5c %5c %39llu %3c", + &sp->index, + &sp->client, + &sp->addr, + &sp->subtype); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_event_vec.c b/src/libtypes/unpack_rscb_event_vec.c @@ -0,0 +1,24 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_event_vec(uint64_t buf[], struct rscb_event_vec *sp) +{ + int n; + + n = unpack(buf, + "%1c %1c %1c %1c %1c %26lu", + &sp->fatal, + &sp->sram_ras, + &sp->preg_wb, + &sp->rpu_err, + &sp->mpe_err, + &sp->res0_0); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_l0rgt_hdr.c b/src/libtypes/unpack_rscb_l0rgt_hdr.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_l0rgt_hdr(uint64_t buf[], struct rscb_l0rgt_hdr *sp) +{ + int n; + + n = unpack(buf, + "%1c %4c %5c %39llu %3c %1c %1c" + "%1c %1c", + &sp->valid, + &sp->entries, + &sp->segsize, + &sp->baddr, + &sp->res0_0, + &sp->irgn, + &sp->orgn, + &sp->sh, + &sp->res0_1); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_rpu_cfg.c b/src/libtypes/unpack_rscb_rpu_cfg.c @@ -0,0 +1,24 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_rpu_cfg(uint64_t buf[], struct rscb_rpu_cfg *sp) +{ + int n; + + n = unpack(buf, + "%1c %5c %1c %5c %7c %7c", + &sp->rpgsize, + &sp->res0_0, + &sp->spec, + &sp->res0_1, + &sp->srpupriv, + &sp->pepriv); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_state.c b/src/libtypes/unpack_rscb_state.c @@ -0,0 +1,20 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_state(uint64_t buf[], struct rscb_state *sp) +{ + int n; + + n = unpack(buf, + "%7c %23lu", + &sp->extdbg, + &sp->res0_0); + + assert(n == sizeof(*sp)); + + return n; +} diff --git a/src/libtypes/unpack_rscb_sys_props.c b/src/libtypes/unpack_rscb_sys_props.c @@ -0,0 +1,25 @@ +#include <assert.h> +#include <stdint.h> + +#include <types.h> +#include <arch/machine.h> + +int +unpack_rscb_sys_props(uint64_t buf[], struct rscb_sys_props *sp) +{ + int n; + + n = unpack(buf, + "%1c %2c %1c %1c %1c %1c %22lu", + &sp->rpu, + &sp->enc, + &sp->res0_0, + &sp->integ, + &sp->zero, + &sp->dram_pkg, + &sp->res0_1); + + assert(n == sizeof(*sp)); + + return n; +}