Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions booter/booter.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ void usage()
// FIXME: hack for setting noc table addresses
BOOTER_PRINTF(" --noc <master int> <slave int>\n\tSet NOC master and slave widget offsets from TCM base.\n");

BOOTER_PRINTF(" --local_mem <base address> <size>\n\tSet local memory base address and size.\n");

#ifdef MULTICORE
BOOTER_PRINTF(" --quiet <core bitmap>\n\tSuppress output from cores.\n");
#else
Expand Down Expand Up @@ -1422,6 +1424,8 @@ void print_infos() {
BOOTER_PRINTF("\t\tTCM base offset per core: 0x%08x\n", h2_info(INFO_TCM_OFFSET));
BOOTER_PRINTF("\t\tNOC master LUT base: 0x%08x\n", tcm_base + h2_info(INFO_NOC_MBASE));
BOOTER_PRINTF("\t\tNOC slave LUT base: 0x%08x\n", tcm_base + h2_info(INFO_NOC_SBASE));
BOOTER_PRINTF("\tCore local memory base address: 0x%08x\n", h2_info(INFO_LOCAL_MEM_BASE));
BOOTER_PRINTF("\tCore local memory size: 0x%08x\n", h2_info(INFO_LOCAL_MEM_SIZE));
#endif

BOOTER_PRINTF("\tCoprocessors:\n");
Expand Down Expand Up @@ -2060,6 +2064,13 @@ unsigned int process_line(int argc, char **argv, unsigned int idx) {
}
argc -= 3; argv += 3;
continue;
} else if (0 == strcmp(argv[0], "--local_mem")) {
if (argc < 3) die_usage();
if (h2_config_set_local_mem(strtoull(argv[1], NULL, 0), strtoull(argv[2], NULL, 0)) == -1) {
FAIL("CONFIG_LOCAL_MEM", "");
}
argc -= 3; argv += 3;
continue;

} else if (0 == strcmp(argv[0], "--help")) {
kernel_setup();
Expand Down
2 changes: 2 additions & 0 deletions kernel/data/globals/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ typedef struct {
u32_t tcm_offset;
u32_t noc_mbase; // 4k pages
u32_t noc_sbase; // 4k pages
u32_t local_mem_base;
u32_t local_mem_size;

H2K_spinlock_t logbuf_lock;
char *logbuf;
Expand Down
1 change: 1 addition & 0 deletions kernel/traps/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@ u32_t H2K_trap_config_fatal_hook(u32_t unused, u32_t funcaddr, u32_t arg, u32_t
u32_t H2K_trap_config_cluster_sched(u32_t unused, u32_t enable, u32_t unused2, u32_t unused3, u32_t unused4, H2K_thread_context *me) IN_SECTION(".text.config.config");
#endif
u32_t H2K_trap_config_noc(u32_t unused, u32_t master, u32_t slave, u32_t unused3, u32_t unused4, H2K_thread_context *me) IN_SECTION(".text.config.config");
u32_t H2K_trap_config_local_mem(u32_t unused, u32_t base, u32_t size, u32_t unused3, u32_t unused4, H2K_thread_context *me);
#endif

10 changes: 9 additions & 1 deletion kernel/traps/config/config.ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ static const configptr_t H2K_configtab[CONFIG_MAX] IN_SECTION(".data.config.conf
#ifdef CLUSTER_SCHED
H2K_trap_config_cluster_sched,
#endif
H2K_trap_config_noc
H2K_trap_config_noc,
H2K_trap_config_local_mem
};

u32_t H2K_trap_config(config_type_t configtype, u32_t val1, u32_t val2, u32_t val3, u32_t val4, H2K_thread_context *me)
Expand Down Expand Up @@ -319,3 +320,10 @@ u32_t H2K_trap_config_noc(u32_t unused, u32_t master, u32_t slave, u32_t unused3

return 0;
}

u32_t H2K_trap_config_local_mem(u32_t unused, u32_t base, u32_t size, u32_t unused3, u32_t unused4, H2K_thread_context *me) {
H2K_gp->local_mem_base = base;
H2K_gp->local_mem_size = size;

return 0;
}
8 changes: 7 additions & 1 deletion kernel/traps/info/info.ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ u32_t H2K_trap_info(info_type op, u32_t unit, h2_cfg_unit_entry entry, H2K_threa

case INFO_NOC_SBASE:
return H2K_gp->noc_sbase;


case INFO_LOCAL_MEM_SIZE:
return H2K_gp->local_mem_size;

case INFO_LOCAL_MEM_BASE:
return H2K_gp->local_mem_base;

default:
return -1;
}
Expand Down
1 change: 1 addition & 0 deletions libs/h2/common/h2_common_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ typedef enum {
CONFIG_CLUSTER_SCHED,
#endif
CONFIG_NOC, // FIXME: hack for setting noc table addresses
CONFIG_LOCAL_MEM,
CONFIG_MAX
} config_type_t;

Expand Down
2 changes: 2 additions & 0 deletions libs/h2/common/h2_common_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ typedef enum {
INFO_TCM_OFFSET, /**< Multicore TCM base offset */
INFO_NOC_MBASE, /**< Multicore NOC master widget base */
INFO_NOC_SBASE, /**< Multicore NOC slave widget base */
INFO_LOCAL_MEM_SIZE, /**< Multicore local memory size */
INFO_LOCAL_MEM_BASE, /**< Multicore local memory base address */
INFO_MAX
} info_type;

Expand Down
3 changes: 3 additions & 0 deletions libs/h2/config/h2_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ static inline int h2_config_set_noc(unsigned int master, unsigned int slave) {
return h2_config_trap(CONFIG_NOC, master, slave, 0, 0);
}

static inline int h2_config_set_local_mem(unsigned int base, unsigned int size) {
return h2_config_trap(CONFIG_LOCAL_MEM, base, size, 0, 0);
}
/** @} */

#endif
Loading