Changeset 95c675b in mainline for boot/arch


Ignore:
Timestamp:
2017-10-17T13:11:35Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
60af4cdb
Parents:
dbf32b1 (diff), a416d070 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline

Location:
boot/arch
Files:
1 added
46 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    rdbf32b1 r95c675b  
    7171
    7272BOOT_OUTPUT = $(ROOT_PATH)/image.iso
    73 PREBUILD = $(INITRD).img
    7473BUILD = Makefile.grub
  • boot/arch/arm32/Makefile.inc

    rdbf32b1 r95c675b  
    4545ifeq ($(MACHINE), raspberrypi)
    4646        BOOT_OUTPUT = image.boot
    47         POST_OUTPUT = $(ROOT_PATH)/uImage.bin   
     47        POST_OUTPUT = $(ROOT_PATH)/uImage.bin
    4848        LADDR = 0x00008000
    4949        SADDR = 0x00008000
    50         POSTBUILD = Makefile.uboot           
     50        POSTBUILD = Makefile.uboot
    5151endif
    5252
     
    7676                char/atkbd \
    7777                char/ps2mouse \
     78                intctl/icp-ic \
    7879                platform/icp
    79         RD_SRVS_ESSENTIAL += \
    80                 $(USPACE_PATH)/srv/hw/irc/icp-ic/icp-ic
    8180endif
    8281
     
    9695        arch/$(BARCH)/src/mm.c \
    9796        arch/$(BARCH)/src/putchar.c \
    98         $(COMPS_C) \
     97        $(COMPS).s \
     98        $(COMPS)_desc.c \
    9999        genarch/src/division.c \
    100100        generic/src/memstr.c \
     
    105105        generic/src/version.c \
    106106        generic/src/inflate.c
     107
     108PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE)
  • boot/arch/arm32/_link.ld.in

    rdbf32b1 r95c675b  
    2323                *(.bss);        /* uninitialized static variables */
    2424                *(COMMON);      /* global variables */
    25 [[COMPONENTS]]
     25                *(.components);
    2626        }
    2727        bdata_end = .;
  • boot/arch/arm32/include/mm.h

    rdbf32b1 r95c675b  
    4242#ifndef BOOT_arm32__MM_H
    4343#define BOOT_arm32__MM_H
    44 
    45 #include <typedefs.h>
    4644
    4745/** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
  • boot/arch/arm32/include/types.h

    rdbf32b1 r95c675b  
    3737#define BOOT_arm32_TYPES_H
    3838
     39#include <arch/common.h>
     40
    3941#define TASKMAP_MAX_RECORDS        32
    4042#define BOOTINFO_TASK_NAME_BUFLEN  32
  • boot/arch/arm32/src/main.c

    rdbf32b1 r95c675b  
    3737#include <arch/asm.h>
    3838#include <arch/mm.h>
    39 #include <arch/_components.h>
    4039#include <halt.h>
    4140#include <printf.h>
     
    4443#include <macros.h>
    4544#include <align.h>
     45#include <stdbool.h>
    4646#include <str.h>
    4747#include <errno.h>
    4848#include <inflate.h>
    4949#include <arch/cp15.h>
     50#include "../../components.h"
    5051
    5152#define TOP2ADDR(top)  (((void *) PA2KA(BOOT_OFFSET)) + (top))
     
    9899       
    99100        for (size_t i = 0; i < COMPONENTS; i++) {
    100                 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
    101                     components[i].start, components[i].name, components[i].inflated,
     101                printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].addr,
     102                    components[i].addr, components[i].name, components[i].inflated,
    102103                    components[i].size);
    103104        }
     
    128129       
    129130        for (size_t i = cnt; i > 0; i--) {
    130                 void *tail = components[i - 1].start + components[i - 1].size;
     131                void *tail = components[i - 1].addr + components[i - 1].size;
    131132                if (tail >= dest[i - 1]) {
    132133                        printf("\n%s: Image too large to fit (%p >= %p), halting.\n",
     
    137138                printf("%s ", components[i - 1].name);
    138139               
    139                 int err = inflate(components[i - 1].start, components[i - 1].size,
     140                int err = inflate(components[i - 1].addr, components[i - 1].size,
    140141                    dest[i - 1], components[i - 1].inflated);
    141142                if (err != EOK) {
  • boot/arch/arm32/src/mm.c

    rdbf32b1 r95c675b  
    3434 */
    3535
    36 #include <typedefs.h>
     36#include <stdint.h>
    3737#include <arch/asm.h>
    3838#include <arch/mm.h>
  • boot/arch/arm32/src/putchar.c

    rdbf32b1 r95c675b  
    3636 */
    3737
    38 #include <typedefs.h>
    3938#include <arch/main.h>
    4039#include <putchar.h>
     40#include <stddef.h>
     41#include <stdint.h>
    4142#include <str.h>
    4243
  • boot/arch/ia64/Makefile.inc

    rdbf32b1 r95c675b  
    4848        arch/$(BARCH)/src/pal_asm.S \
    4949        arch/$(BARCH)/src/putchar.c \
    50         $(COMPS_C) \
     50        $(COMPS).s \
     51        $(COMPS)_desc.c \
    5152        genarch/src/efi.c \
    5253        genarch/src/division.c \
     
    8889        bus/isa
    8990
     91PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE)
  • boot/arch/ia64/_link.ld.in

    rdbf32b1 r95c675b  
    1616                *(.bss);                /* uninitialized static variables */
    1717                *(COMMON);
    18 [[COMPONENTS]]
     18                *(.components);
    1919        }
    20 
     20       
    2121        /DISCARD/ : {
    2222                *(.*);
  • boot/arch/ia64/include/pal.h

    rdbf32b1 r95c675b  
    3131
    3232#include <arch/types.h>
    33 #include <typedefs.h>
     33#include <stddef.h>
     34#include <stdint.h>
    3435
    3536/*
  • boot/arch/ia64/include/sal.h

    rdbf32b1 r95c675b  
    3131
    3232#include <arch/types.h>
    33 #include <typedefs.h>
     33#include <stddef.h>
     34#include <stdint.h>
    3435
    3536/*
  • boot/arch/ia64/include/ski.h

    rdbf32b1 r95c675b  
    3030#define BOOT_ia64_SKI_H_
    3131
     32#include <stddef.h>
    3233#include <str.h>
    3334
  • boot/arch/ia64/src/main.c

    rdbf32b1 r95c675b  
    3333#include <arch/arch.h>
    3434#include <arch/asm.h>
    35 #include <arch/_components.h>
    3635#include <genarch/efi.h>
    3736#include <arch/sal.h>
     
    4645#include <errno.h>
    4746#include <inflate.h>
     47#include "../../components.h"
    4848
    4949#define DEFAULT_MEMORY_BASE             0x4000000ULL
     
    7878                memmap[items].size = DEFAULT_LEGACY_IO_SIZE;
    7979                memmap[items].type = MEMMAP_IO_PORTS;
    80                 items++;                 
     80                items++;
    8181        } else {
    8282                char *cur, *mm_base = (char *) bootpar->efi_memmap;
     
    159159        size_t i;
    160160        for (i = 0; i < COMPONENTS; i++)
    161                 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
    162                     components[i].start, components[i].name,
     161                printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr,
     162                    components[i].addr, components[i].name,
    163163                    components[i].inflated, components[i].size);
    164164       
     
    202202                 * overlap with the destination for inflate().
    203203                 */
    204                 memmove((void *) top, components[i - 1].start, components[i - 1].size);
     204                memmove((void *) top, components[i - 1].addr, components[i - 1].size);
    205205               
    206206                int err = inflate((void *) top, components[i - 1].size,
  • boot/arch/ia64/src/putchar.c

    rdbf32b1 r95c675b  
    2727 */
    2828
    29 #include <typedefs.h>
    3029#include <arch/arch.h>
    3130#include <putchar.h>
     31#include <stddef.h>
    3232#include <str.h>
    3333#include <arch/ski.h>
  • boot/arch/ia64/src/ski.c

    rdbf32b1 r95c675b  
    2828
    2929#include <arch/ski.h>
    30 #include <typedefs.h>
     30#include <stdbool.h>
     31#include <stddef.h>
    3132
    3233#define SKI_INIT_CONSOLE        20
  • boot/arch/mips32/Makefile.inc

    rdbf32b1 r95c675b  
    3030BITS = 32
    3131EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mabi=32
     32AS_PROLOG = .module softfloat;
    3233
    3334ifeq ($(MACHINE),msim)
     
    7475        arch/$(BARCH)/src/main.c \
    7576        arch/$(BARCH)/src/putchar.c \
    76         $(COMPS_C) \
     77        $(COMPS).s \
     78        $(COMPS)_desc.c \
    7779        genarch/src/division.c \
    7880        genarch/src/multiplication.c \
     
    8486        generic/src/version.c \
    8587        generic/src/inflate.c
     88
     89PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE)
  • boot/arch/mips32/_link.ld.in

    rdbf32b1 r95c675b  
    2121                *(.bss);        /* uninitialized static variables */
    2222                *(COMMON);      /* global variables */
    23 [[COMPONENTS]]
     23                *(.components);
    2424        }
    2525       
  • boot/arch/mips32/include/types.h

    rdbf32b1 r95c675b  
    3030#define BOOT_mips32_TYPES_H_
    3131
     32#include <arch/common.h>
     33
    3234#define TASKMAP_MAX_RECORDS        32
    3335#define CPUMAP_MAX_RECORDS         32
  • boot/arch/mips32/src/main.c

    rdbf32b1 r95c675b  
    3030#include <arch/arch.h>
    3131#include <arch/asm.h>
    32 #include <arch/_components.h>
    3332#include <halt.h>
    3433#include <printf.h>
     
    4039#include <errno.h>
    4140#include <inflate.h>
     41#include "../../components.h"
    4242
    4343#define TOP2ADDR(top)  (((void *) PA2KA(BOOT_OFFSET)) + (top))
     
    6464        size_t i;
    6565        for (i = 0; i < COMPONENTS; i++)
    66                 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
    67                     (uintptr_t) components[i].start >= PA2KSEG(0) ?
    68                     (void *) KSEG2PA(components[i].start) :
    69                     (void *) KA2PA(components[i].start),
     66                printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr,
     67                    (uintptr_t) components[i].addr >= PA2KSEG(0) ?
     68                    (void *) KSEG2PA(components[i].addr) :
     69                    (void *) KA2PA(components[i].addr),
    7070                    components[i].name, components[i].inflated,
    7171                    components[i].size);
     
    107107                printf("%s ", components[i - 1].name);
    108108               
    109                 int err = inflate(components[i - 1].start, components[i - 1].size,
     109                int err = inflate(components[i - 1].addr, components[i - 1].size,
    110110                    dest[i - 1], components[i - 1].inflated);
    111111               
  • boot/arch/mips32/src/putchar.c

    rdbf32b1 r95c675b  
    2727 */
    2828
    29 #include <typedefs.h>
     29#include <stddef.h>
     30#include <stdint.h>
    3031#include <arch/arch.h>
    3132#include <putchar.h>
  • boot/arch/ppc32/Makefile.inc

    rdbf32b1 r95c675b  
    4444RD_DRVS_ESSENTIAL += \
    4545        platform/mac \
     46        bus/adb/cuda_adb \
    4647        bus/pci/pciintel \
    4748        bus/usb/ohci \
     
    5758        arch/$(BARCH)/src/main.c \
    5859        arch/$(BARCH)/src/ofw.c \
    59         $(COMPS_C) \
     60        $(COMPS).s \
     61        $(COMPS)_desc.c \
    6062        genarch/src/ofw.c \
    6163        genarch/src/ofw_tree.c \
     
    7072        generic/src/version.c \
    7173        generic/src/inflate.c
     74
     75PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE)
  • boot/arch/ppc32/_link.ld.in

    rdbf32b1 r95c675b  
    1818                *(.bss);        /* uninitialized static variables */
    1919                *(COMMON);      /* global variables */
    20 [[COMPONENTS]]
     20                *(.components);
    2121        }
    2222       
  • boot/arch/ppc32/include/asm.h

    rdbf32b1 r95c675b  
    3030#define BOOT_ppc32_ASM_H_
    3131
    32 #include <typedefs.h>
     32#include <stddef.h>
    3333#include <arch/main.h>
    3434
  • boot/arch/ppc32/include/main.h

    rdbf32b1 r95c675b  
    3030#define BOOT_ppc32_MAIN_H_
    3131
    32 #include <typedefs.h>
     32#include <stddef.h>
    3333#include <balloc.h>
    3434#include <genarch/ofw_tree.h>
  • boot/arch/ppc32/include/types.h

    rdbf32b1 r95c675b  
    3030#define BOOT_ppc32_TYPES_H_
    3131
     32#include <arch/common.h>
     33
    3234#define TASKMAP_MAX_RECORDS        32
    3335#define BOOTINFO_TASK_NAME_BUFLEN  32
  • boot/arch/ppc32/src/main.c

    rdbf32b1 r95c675b  
    3030#include <arch/arch.h>
    3131#include <arch/asm.h>
    32 #include <arch/_components.h>
    3332#include <genarch/ofw.h>
    3433#include <genarch/ofw_tree.h>
     
    4241#include <errno.h>
    4342#include <inflate.h>
     43#include "../../components.h"
    4444
    4545#define BALLOC_MAX_SIZE  131072
     
    7575        size_t i;
    7676        for (i = 0; i < COMPONENTS; i++)
    77                 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
    78                     ofw_translate(components[i].start), components[i].name,
     77                printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr,
     78                    ofw_translate(components[i].addr), components[i].name,
    7979                    components[i].inflated, components[i].size);
    8080       
     
    139139                printf("%s ", components[i - 1].name);
    140140               
    141                 int err = inflate(components[i - 1].start, components[i - 1].size,
     141                int err = inflate(components[i - 1].addr, components[i - 1].size,
    142142                    inflate_base + dest[i - 1], components[i - 1].inflated);
    143143               
  • boot/arch/ppc32/src/ofw.c

    rdbf32b1 r95c675b  
    2828
    2929#include <genarch/ofw.h>
    30 #include <typedefs.h>
     30#include <stddef.h>
    3131#include <putchar.h>
    3232#include <str.h>
  • boot/arch/riscv64/Makefile.inc

    rdbf32b1 r95c675b  
    3434BITS = 64
    3535ENDIANESS = LE
     36EXTRA_CFLAGS = -mcmodel=medany
    3637
    3738SOURCES = \
     
    4041        arch/$(BARCH)/src/ucb.c \
    4142        arch/$(BARCH)/src/putchar.c \
    42         $(COMPS_C) \
     43        $(COMPS).s \
     44        $(COMPS)_desc.c \
    4345        generic/src/memstr.c \
    4446        generic/src/printf_core.c \
     
    4850        generic/src/version.c \
    4951        generic/src/inflate.c
     52
     53PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE)
  • boot/arch/riscv64/_link.ld.in

    rdbf32b1 r95c675b  
     1#include <arch/arch.h>
     2
    13ENTRY(start)
    24
    35SECTIONS {
     6        . = PHYSMEM_START;
     7       
    48        .text : {
    59                *(BOOTSTRAP);
    610                *(.text);
    711        }
     12       
     13        . = ALIGN(0x1000);
     14        .htif : {
     15                htif_page = .;
     16                *(.htif)
     17        }
     18        . = ALIGN(0x1000);
     19       
     20        . = ALIGN(0x1000);
     21        .pt : {
     22                pt_page = .;
     23                *(.pt)
     24        }
     25        . = ALIGN(0x1000);
    826       
    927        .data : {
     
    1735                *(.bss);        /* uninitialized static variables */
    1836                *(COMMON);      /* global variables */
    19 [[COMPONENTS]]
     37                *(.components);
    2038        }
    2139       
  • boot/arch/riscv64/include/arch.h

    rdbf32b1 r95c675b  
    3535#define BOOT_STACK_SIZE  PAGE_SIZE
    3636
     37#define PHYSMEM_START  0x40000000
     38#define PHYSMEM_SIZE   1073741824
     39#define BOOT_OFFSET    0x48000000
     40
    3741#define DEFAULT_MTVEC      0x00000100
    3842#define TRAP_VECTOR_RESET  0x0100
  • boot/arch/riscv64/include/asm.h

    rdbf32b1 r95c675b  
    3030#define BOOT_riscv64_ASM_H_
    3131
    32 #include <typedefs.h>
     32#include <stddef.h>
    3333
    34 extern void jump_to_kernel(void *, uintptr_t)
     34extern char htif_page[];
     35extern char pt_page[];
     36
     37extern void jump_to_kernel(uintptr_t)
    3538    __attribute__((noreturn));
    3639
  • boot/arch/riscv64/include/types.h

    rdbf32b1 r95c675b  
    3030#define BOOT_riscv64_TYPES_H_
    3131
     32#include <arch/common.h>
     33
    3234#define MEMMAP_MAX_RECORDS         32
    3335#define TASKMAP_MAX_RECORDS        32
     
    3840
    3941typedef int64_t ptrdiff_t;
     42
     43typedef struct {
     44        volatile uint64_t *tohost;
     45        volatile uint64_t *fromhost;
     46} ucbinfo_t;
    4047
    4148typedef struct {
     
    6572
    6673typedef struct {
     74        ucbinfo_t ucbinfo;
     75        uintptr_t physmem_start;
     76        uintptr_t htif_frame;
     77        uintptr_t pt_frame;
    6778        memmap_t memmap;
    6879        taskmap_t taskmap;
  • boot/arch/riscv64/include/ucb.h

    rdbf32b1 r95c675b  
    3636 */
    3737
    38 #include <typedefs.h>
     38#include <stddef.h>
    3939
    40 #define CSR_MTOHOST    0x780
    41 #define CSR_MFROMHOST  0x781
     40extern volatile uint64_t tohost;
     41extern volatile uint64_t fromhost;
    4242
    4343#define HTIF_DEVICE_CONSOLE  1
  • boot/arch/riscv64/src/asm.S

    rdbf32b1 r95c675b  
    2929#include <abi/asmtool.h>
    3030#include <arch/arch.h>
     31#include <arch/mm.h>
     32
     33#define MCOUNTEREN_CY_MASK  0x00000001
     34#define MCOUNTEREN_TM_MASK  0x00000002
     35#define MCOUNTEREN_IR_MASK  0x00000004
     36
     37#define MSTATUS_MPP_MASK        0x00001800
     38#define MSTATUS_MPP_USER        0x00000000
     39#define MSTATUS_MPP_SUPERVISOR  0x00000800
     40#define MSTATUS_MPP_MACHINE     0x00001800
     41
     42#define MSTATUS_SUM_MASK        0x00040000
     43
     44#define SATP_PFN_MASK  0x00000fffffffffff
     45
     46#define SATP_MODE_MASK  0xf000000000000000
     47#define SATP_MODE_BARE  0x0000000000000000
     48#define SATP_MODE_SV39  0x8000000000000000
     49#define SATP_MODE_SV48  0x9000000000000000
    3150
    3251.section BOOTSTRAP
     
    7695
    7796FUNCTION_BEGIN(jump_to_kernel)
    78         j halt
     97        /* Enable performance counters access in supervisor mode */
     98        csrsi mcounteren, MCOUNTEREN_CY_MASK | MCOUNTEREN_TM_MASK | MCOUNTEREN_IR_MASK
     99       
     100        /* Setup SV48 paging for supervisor mode */
     101        la t0, ptl_0
     102        srli t0, t0, 12
     103       
     104        li t1, SATP_PFN_MASK
     105        and t0, t0, t1
     106       
     107        li t1, SATP_MODE_SV48
     108        or t0, t0, t1
     109       
     110        csrw sptbr, t0
     111       
     112        /* Jump to supervisor mode */
     113        csrr t0, mstatus
     114       
     115        li t1, ~MSTATUS_MPP_MASK
     116        and t0, t0, t1
     117       
     118        /*
     119         * TODO: Enable running with Supervisor User Mode
     120         * access disabled.
     121         */
     122        li t1, MSTATUS_MPP_SUPERVISOR | MSTATUS_SUM_MASK
     123        or t0, t0, t1
     124       
     125        csrw mstatus, t0
     126       
     127        li ra, PA2KA(BOOT_OFFSET)
     128        csrw mepc, ra
     129       
     130        mret
    79131FUNCTION_END(jump_to_kernel)
    80132
     
    88140SYMBOL(boot_stack)
    89141        .space BOOT_STACK_SIZE
     142
     143.section .pt, "aw", @progbits
     144
     145.align PAGE_WIDTH
     146SYMBOL(ptl_0)
     147        .fill 256, 8, 0
     148        /* Identity mapping for [0; 512G) */
     149        .quad 0 + (PTL_DIRTY | PTL_ACCESSED | PTL_EXECUTABLE | PTL_WRITABLE | PTL_READABLE | PTL_VALID)
     150        .fill 255, 8, 0
  • boot/arch/riscv64/src/main.c

    rdbf32b1 r95c675b  
    3030#include <arch/arch.h>
    3131#include <arch/asm.h>
     32#include <arch/ucb.h>
     33#include <arch/mm.h>
    3234#include <version.h>
    33 #include <typedefs.h>
     35#include <stddef.h>
    3436#include <printf.h>
    3537#include <macros.h>
     
    3941#include <halt.h>
    4042#include <inflate.h>
    41 #include <arch/_components.h>
    42 
    43 #define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
    44 #define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
     43#include "../../components.h"
    4544
    4645static bootinfo_t bootinfo;
     
    5049        version_print();
    5150       
     51        bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH;
     52        bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH;
     53       
     54        bootinfo.ucbinfo.tohost =
     55            (volatile uint64_t *) PA2KA((uintptr_t) &tohost);
     56        bootinfo.ucbinfo.fromhost =
     57            (volatile uint64_t *) PA2KA((uintptr_t) &fromhost);
     58       
    5259        // FIXME TODO: read from device tree
    53         bootinfo.memmap.total = 1024 * 1024 * 1024;
    54         bootinfo.memmap.cnt = 0;
     60        bootinfo.physmem_start = PHYSMEM_START;
     61        bootinfo.memmap.total = PHYSMEM_SIZE;
     62        bootinfo.memmap.cnt = 1;
     63        bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START;
     64        bootinfo.memmap.zones[0].size = PHYSMEM_SIZE;
    5565       
    56         printf("\nMemory statistics (total %lu MB)\n\n", bootinfo.memmap.total >> 20);
     66        printf("\nMemory statistics (total %lu MB, starting at %p)\n\n",
     67            bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
    5768        printf(" %p: boot info structure\n", &bootinfo);
    5869       
    59         uintptr_t top = 0;
     70        uintptr_t top = BOOT_OFFSET;
    6071       
    6172        for (size_t i = 0; i < COMPONENTS; i++) {
    62                 printf(" %p: %s image (%zu/%zu bytes)\n", components[i].start,
     73                printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr,
    6374                    components[i].name, components[i].inflated,
    6475                    components[i].size);
    6576               
    66                 uintptr_t tail = (uintptr_t) components[i].start +
     77                uintptr_t tail = (uintptr_t) components[i].addr +
    6778                    components[i].size;
    68                 if (tail > top)
    69                         top = tail;
     79                if (tail > top) {
     80                        printf("\n%s: Image too large to fit (%p >= %p), halting.\n",
     81                            components[i].name, (void *) tail, (void *) top);
     82                        halt();
     83                }
    7084        }
    7185       
    72         top = ALIGN_UP(top, PAGE_SIZE);
    7386        printf(" %p: inflate area\n", (void *) top);
    7487       
     
    92105                        bootinfo.taskmap.cnt++;
    93106                } else
    94                         kernel_entry = (void *) top;
     107                        kernel_entry = (void *) PA2KA(top);
    95108               
    96109                dest[i] = (void *) top;
     
    101114        printf(" %p: kernel entry point\n", kernel_entry);
    102115       
    103         if (top >= bootinfo.memmap.total) {
     116        if (top >= bootinfo.physmem_start + bootinfo.memmap.total) {
    104117                printf("Not enough physical memory available.\n");
    105118                printf("The boot image is too large. Halting.\n");
     
    112125                printf("%s ", components[i - 1].name);
    113126               
    114                 int err = inflate(components[i - 1].start, components[i - 1].size,
     127                int err = inflate(components[i - 1].addr, components[i - 1].size,
    115128                    dest[i - 1], components[i - 1].inflated);
    116129               
     
    125138       
    126139        printf("Booting the kernel...\n");
    127         jump_to_kernel(kernel_entry, PA2KA(&bootinfo));
     140        jump_to_kernel(PA2KA(&bootinfo));
    128141}
  • boot/arch/riscv64/src/putchar.c

    rdbf32b1 r95c675b  
    2727 */
    2828
    29 #include <typedefs.h>
     29#include <stddef.h>
    3030#include <arch/arch.h>
    3131#include <putchar.h>
  • boot/arch/riscv64/src/ucb.c

    rdbf32b1 r95c675b  
    3131#include <macros.h>
    3232
     33volatile uint64_t tohost __attribute__((section(".htif")));
     34volatile uint64_t fromhost __attribute__((section(".htif")));
     35
     36static void poll_fromhost()
     37{
     38        uint64_t val = fromhost;
     39        if (!val)
     40                return;
     41       
     42        fromhost = 0;
     43}
     44
    3345void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload)
    3446{
     
    3648            (((uint64_t) cmd) << 48) |
    3749            (payload & UINT64_C(0xffffffffffff));
    38         uint64_t retval;
    3950       
    40         do {
    41                 asm volatile (
    42                         "csrrw %[retval], " STRING(CSR_MTOHOST) ", %[val]\n"
    43                         : [retval] "=r" (retval)
    44                         : [val] "r" (val)
    45                 );
    46         } while (retval != 0);
     51        while (tohost)
     52                poll_fromhost();
     53       
     54        tohost = val;
    4755}
  • boot/arch/sparc64/Makefile.inc

    rdbf32b1 r95c675b  
    5757        arch/$(BARCH)/src/main.c \
    5858        arch/$(BARCH)/src/ofw.c \
    59         $(COMPS_C) \
     59        $(COMPS).s \
     60        $(COMPS)_desc.c \
    6061        genarch/src/ofw.c \
    6162        genarch/src/ofw_tree.c \
     
    6869        generic/src/version.c \
    6970        generic/src/inflate.c
     71
     72PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE)
  • boot/arch/sparc64/_link.ld.in

    rdbf32b1 r95c675b  
    1515                *(.bss);        /* uninitialized static variables */
    1616                *(COMMON);      /* global variables */
    17 [[COMPONENTS]]
     17                *(.components);
    1818        }
    1919       
  • boot/arch/sparc64/include/asm.h

    rdbf32b1 r95c675b  
    3131#define BOOT_sparc64_ASM_H_
    3232
    33 #include <typedefs.h>
     33#include <stdint.h>
    3434
    3535extern void jump_to_kernel(uintptr_t physmem_start, bootinfo_t *bootinfo,
  • boot/arch/sparc64/include/main.h

    rdbf32b1 r95c675b  
    3030#define BOOT_sparc64_MAIN_H_
    3131
    32 #include <typedefs.h>
     32#include <stdint.h>
    3333#include <balloc.h>
    3434#include <genarch/ofw_tree.h>
  • boot/arch/sparc64/include/ofw.h

    rdbf32b1 r95c675b  
    3030#define BOOT_sparc64_OFW_H_
    3131
    32 #include <typedefs.h>
     32#include <stdint.h>
    3333
    3434#define OFW_ADDRESS_CELLS  2
  • boot/arch/sparc64/include/types.h

    rdbf32b1 r95c675b  
    3030#define BOOT_sparc64_TYPES_H_
    3131
     32#include <arch/common.h>
     33
    3234#define TASKMAP_MAX_RECORDS        32
    3335#define BOOTINFO_TASK_NAME_BUFLEN  32
  • boot/arch/sparc64/src/main.c

    rdbf32b1 r95c675b  
    3232#include <arch/asm.h>
    3333#include <arch/ofw.h>
    34 #include <arch/_components.h>
    3534#include <genarch/ofw.h>
    3635#include <genarch/ofw_tree.h>
     
    4443#include <errno.h>
    4544#include <inflate.h>
     45#include "../../components.h"
    4646
    4747/* The lowest ID (read from the VER register) of some US3 CPU model */
     
    220220        size_t i;
    221221        for (i = 0; i < COMPONENTS; i++)
    222                 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
    223                     ofw_translate(components[i].start), components[i].name,
     222                printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr,
     223                    ofw_translate(components[i].addr), components[i].name,
    224224                    components[i].inflated, components[i].size);
    225225       
     
    267267                    ALIGN_UP(components[i - 1].inflated, PAGE_SIZE), -1);
    268268               
    269                 int err = inflate(components[i - 1].start, components[i - 1].size,
     269                int err = inflate(components[i - 1].addr, components[i - 1].size,
    270270                    dest[i - 1], components[i - 1].inflated);
    271271               
  • boot/arch/sparc64/src/ofw.c

    rdbf32b1 r95c675b  
    3636#include <arch/ofw.h>
    3737#include <genarch/ofw.h>
    38 #include <typedefs.h>
     38#include <stddef.h>
     39#include <stdint.h>
    3940#include <printf.h>
    4041#include <halt.h>
Note: See TracChangeset for help on using the changeset viewer.