Skip to content

Commit

Permalink
[top] add header declaration for lk_boot_args
Browse files Browse the repository at this point in the history
Update users of the boot args array to use the header.
  • Loading branch information
travisg committed Feb 11, 2024
1 parent f7121c7 commit d9b7d07
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
10 changes: 4 additions & 6 deletions lib/bootargs/bootargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,20 @@
*/
#include <lib/bootargs.h>

#include <lk/err.h>
#include <lk/init.h>
#include <lk/main.h>
#include <lk/trace.h>
#include <stdlib.h>
#include <stdio.h>
#include <lk/err.h>
#include <stdlib.h>
#include <string.h>
#include <lk/init.h>

#if WITH_KERNEL_VM
#include <kernel/vm.h>
#endif

#define LOCAL_TRACE 0

/* saved by the main entry point in lk */
extern ulong lk_boot_args[4];

static bool boot_args_valid = false;
static struct lk_boot_arg *boot_args;

Expand Down
3 changes: 1 addition & 2 deletions platform/jh7110/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#include <inttypes.h>
#include <lk/err.h>
#include <lk/main.h>
#include <lk/reg.h>
#include <lk/trace.h>
#include <kernel/thread.h>
Expand All @@ -30,8 +31,6 @@

#define LOCAL_TRACE 1

extern ulong lk_boot_args[4];

#if WITH_KERNEL_VM
#define DEFAULT_MEMORY_SIZE (MEMSIZE) /* try to fetch from the emulator via the fdt */

Expand Down
3 changes: 1 addition & 2 deletions platform/qemu-virt-riscv/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#include <inttypes.h>
#include <lk/err.h>
#include <lk/main.h>
#include <lk/reg.h>
#include <lk/trace.h>
#include <kernel/thread.h>
Expand Down Expand Up @@ -37,8 +38,6 @@

#define LOCAL_TRACE 0

extern ulong lk_boot_args[4];

#if WITH_KERNEL_VM
#define DEFAULT_MEMORY_SIZE (MEMSIZE) /* try to fetch from the emulator via the fdt */

Expand Down
9 changes: 5 additions & 4 deletions platform/rosco-m68k/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* https://opensource.org/licenses/MIT
*/
#include <lk/err.h>
#include <lk/main.h>
#include <lk/reg.h>
#include <lk/trace.h>
#include <kernel/thread.h>
Expand Down Expand Up @@ -44,19 +45,19 @@ struct rosco_system_data_block {
};
STATIC_ASSERT(sizeof(struct rosco_system_data_block) == 0x20);

const volatile struct rosco_system_data_block *sdb = (void *)0x400;

void platform_early_init(void) {
duart_early_init();

volatile struct rosco_system_data_block *sdb = (void *)lk_boot_args[0];

// default to 1MB memory at 0
uint32_t membase = 0x0;
uint32_t memsize = 0x100000; // 1MB

if (sdb->magic != ROSCO_SDB_MAGIC) {
dprintf(INFO, "ROSCO-M68K: firmware failed magic check\n");
dprintf(INFO, "ROSCO-M68K: firmware failed magic check at %p\n", sdb);
} else {
dprintf(INFO, "ROSCO-M68K: firmware structure at 0x400 - 0x41f:\n");
dprintf(INFO, "ROSCO-M68K: firmware structure at %p - %p:\n", sdb, sdb + 0x1f);
hexdump((void *)sdb, sizeof(*sdb));

printf("cpu family %u speed %u\n", sdb->cpu_info >> 29, sdb->cpu_info & 0x1fffffff);
Expand Down
3 changes: 3 additions & 0 deletions top/include/lk/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

__BEGIN_CDECLS

// Possible boot args passed from various arch's start.S
extern ulong lk_boot_args[4];

void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3) __NO_RETURN __EXTERNALLY_VISIBLE;
void lk_secondary_cpu_entry(void);
void lk_init_secondary_cpus(uint secondary_cpu_count);
Expand Down

0 comments on commit d9b7d07

Please sign in to comment.