Merge branch 'main' of gitlab.ethz.ch:rueegges/aos into main

This commit is contained in:
Sparchatus 2022-05-20 09:53:21 +00:00
commit 12c1c2a23a
8 changed files with 128 additions and 79 deletions

View File

@ -5,6 +5,7 @@
bootdriver /armv8/sbin/boot_armv8_generic bootdriver /armv8/sbin/boot_armv8_generic
cpudriver /armv8/sbin/cpu_imx8x cpudriver /armv8/sbin/cpu_imx8x
module /armv8/sbin/init module /armv8/sbin/init
module /armv8/sbin/enet
module /armv8/sbin/hello echoclient module /armv8/sbin/hello echoclient
module /armv8/sbin/memeater module /armv8/sbin/memeater
module /armv8/sbin/mallocator module /armv8/sbin/mallocator

View File

@ -99,7 +99,7 @@ static inline bool capref_is_null(struct capref capref)
/* well-known cnodes */ /* well-known cnodes */
extern struct cnoderef cnode_root, cnode_task, cnode_base, cnode_super, extern struct cnoderef cnode_root, cnode_task, cnode_base, cnode_super,
cnode_page, cnode_module; cnode_page, cnode_module, cnode_arg;
/* well-known capabilities */ /* well-known capabilities */
extern struct capref cap_root, cap_monitorep, cap_irq, cap_io, cap_dispatcher, extern struct capref cap_root, cap_monitorep, cap_irq, cap_io, cap_dispatcher,

View File

@ -126,6 +126,7 @@
#define CPTR_PHYADDRCN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_PACN) #define CPTR_PHYADDRCN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_PACN)
#define CPTR_MODULECN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_MODULECN) #define CPTR_MODULECN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_MODULECN)
#define CPTR_PAGECN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_PAGECN) #define CPTR_PAGECN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_PAGECN)
#define CPTR_ARGCN_BASE ROOTCN_SLOT_ADDR(ROOTCN_SLOT_ARGCN)
/** /**
* Memory region types. * Memory region types.

View File

@ -43,6 +43,7 @@ struct spawninfo {
struct cnoderef cspace_l2_cnode_slot_alloc_2; // < A third L2 Node for the slot allocator to use. struct cnoderef cspace_l2_cnode_slot_alloc_2; // < A third L2 Node for the slot allocator to use.
struct cnoderef cspace_l2_cnode_base_pagecn; // < Each slot holds a BASE_PAGE_SIZEd RAM capability. struct cnoderef cspace_l2_cnode_base_pagecn; // < Each slot holds a BASE_PAGE_SIZEd RAM capability.
struct cnoderef cspace_l2_cnode_pagecn; // < Contains capabilites to the pagetable struct cnoderef cspace_l2_cnode_pagecn; // < Contains capabilites to the pagetable
struct cnoderef cspace_l2_cnode_argcn; // < Contains argument capabilites
// these capabilites are all stored in the taskcn cnode // these capabilites are all stored in the taskcn cnode
struct capref cspace_cap_selfep; // < Endpoint to itself. You can get this capability by retyping the dispatcher capability to ObjType_EndPointLMP. struct capref cspace_cap_selfep; // < Endpoint to itself. You can get this capability by retyping the dispatcher capability to ObjType_EndPointLMP.

View File

@ -45,6 +45,11 @@ struct cnoderef cnode_root = ROOT_CNODE_INIT;
.cnode = CPTR_MODULECN_BASE, \ .cnode = CPTR_MODULECN_BASE, \
.level = CNODE_TYPE_OTHER, } .level = CNODE_TYPE_OTHER, }
#define ARG_CNODE_INIT { \
.croot = CPTR_ROOTCN, \
.cnode = CPTR_ARGCN_BASE, \
.level = CNODE_TYPE_OTHER, }
/// Task CNode /// Task CNode
struct cnoderef cnode_task = TASK_CNODE_INIT; struct cnoderef cnode_task = TASK_CNODE_INIT;
@ -68,6 +73,9 @@ struct cnoderef cnode_page = PAGE_CNODE_INIT;
/// Module CNode /// Module CNode
struct cnoderef cnode_module = MODULE_CNODE_INIT; struct cnoderef cnode_module = MODULE_CNODE_INIT;
/// Arg CNode
struct cnoderef cnode_arg = ARG_CNODE_INIT;
struct capref cap_mmstrings = { struct capref cap_mmstrings = {
.cnode = MODULE_CNODE_INIT, .cnode = MODULE_CNODE_INIT,
.slot = 0 .slot = 0
@ -85,6 +93,12 @@ struct capref cap_irq = {
.slot = TASKCN_SLOT_IRQ .slot = TASKCN_SLOT_IRQ
}; };
/// Capability for Device Frame
struct capref cap_io = {
.cnode = TASK_CNODE_INIT,
.slot = TASKCN_SLOT_DEV
};
/// Capability for endpoint to self /// Capability for endpoint to self
struct capref cap_selfep = { struct capref cap_selfep = {
.cnode = TASK_CNODE_INIT, .cnode = TASK_CNODE_INIT,

View File

@ -14,6 +14,8 @@
#include <spawn/multiboot.h> #include <spawn/multiboot.h>
#include <spawn/argv.h> #include <spawn/argv.h>
#include <maps/imx8x_map.h>
extern struct bootinfo *bi; extern struct bootinfo *bi;
extern coreid_t my_core_id; extern coreid_t my_core_id;
extern struct aos_urpc urpc_to_bsp; extern struct aos_urpc urpc_to_bsp;
@ -500,6 +502,26 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
if (err_is_fail(err)) return err_push(err, LIB_ERR_CAP_COPY_FAIL); if (err_is_fail(err)) return err_push(err, LIB_ERR_CAP_COPY_FAIL);
si->init_chan.remote_cap = NULL_CAP; si->init_chan.remote_cap = NULL_CAP;
// Set up capability arguments. This would ideally be passed somehow as an argument to spawn instead.
size_t arg0_base = 0;
size_t arg0_size = 0;
if (strcmp(argv[0], "enet") == 0) {
arg0_base = IMX8X_ENET_BASE;
arg0_size = IMX8X_ENET_SIZE;
}
si->cspace_l2_cnode_argcn = NULL_CNODE;
if (arg0_base != 0) {
err = cnode_create_foreign_l2(si->cspace_l1_cnode_cap, ROOTCN_SLOT_ARGCN, &si->cspace_l2_cnode_argcn);
if (err_is_fail(err)) return err;
struct capref arg0_cap = {
.cnode = si->cspace_l2_cnode_argcn,
.slot = 0
};
err = cap_retype(arg0_cap, cap_io, (arg0_base - IMX8X_START_DEV_RANGE), ObjType_DevFrame, arg0_size, 1);
if (err_is_fail(err)) return err_push(err, LIB_ERR_CAP_RETYPE);
}
// - Setup the child's vspace // - Setup the child's vspace
// afeer: create level 0 page table // afeer: create level 0 page table
// the l0 page table is in the first slot (PAGECN_SLOT_VROOT) of the pagecn cnode. // the l0 page table is in the first slot (PAGECN_SLOT_VROOT) of the pagecn cnode.

View File

@ -12,7 +12,7 @@
let let
-- Default list of modules to build/install -- Default list of modules to build/install
modules_common = [ "/sbin/" ++ f | f <- [ "init", "hello", "memeater", "mallocator", "stackoverflow", "echoserver" modules_common = [ "/sbin/" ++ f | f <- [ "init", "hello", "memeater", "mallocator", "stackoverflow", "echoserver", "enet"
] ] ] ]
in in
[ [

View File

@ -22,6 +22,7 @@
#include <aos/deferred.h> #include <aos/deferred.h>
#include <driverkit/driverkit.h> #include <driverkit/driverkit.h>
#include <dev/imx8x/enet_dev.h> #include <dev/imx8x/enet_dev.h>
#include <maps/imx8x_map.h>
#include <netutil/etharp.h> #include <netutil/etharp.h>
@ -571,9 +572,18 @@ int main(int argc, char *argv[]) {
calloc(1, sizeof(struct enet_driver_state)); calloc(1, sizeof(struct enet_driver_state));
assert(st != NULL); assert(st != NULL);
/* TODO Net Project: get the capability to the register region /* Net Project: get the capability to the register region
* and then map it so it is accessible. * and then map it so it is accessible.
* TODO set st->d_vaddr to the memory mapped register region */ * set st->d_vaddr to the memory mapped register region */
struct capref cap_arg0 = {
.cnode = cnode_arg,
.slot = 0
};
err = paging_map_frame_attr(get_current_paging_state(),
(void **) &st->d_vaddr, IMX8X_ENET_SIZE,
cap_arg0, VREGION_FLAGS_READ_WRITE_NOCACHE);
if (err_is_fail(err)) return err;
if ((void *)st->d_vaddr == NULL) { if ((void *)st->d_vaddr == NULL) {
USER_PANIC("ENET: No register region mapped \n"); USER_PANIC("ENET: No register region mapped \n");
} }
@ -609,7 +619,7 @@ int main(int argc, char *argv[]) {
err = enet_tx_queue_create(&st->txq, st->d); err = enet_tx_queue_create(&st->txq, st->d);
if (err_is_fail(err)) { if (err_is_fail(err)) {
debug_printf("Failed creating RX devq \n"); debug_printf("Failed creating TX devq \n");
return err; return err;
} }