Changeset 36df4109 in mainline


Ignore:
Timestamp:
2016-06-06T16:29:56Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7510326
Parents:
7f0580d
Message:

Introduce architecure-specific operations

This replaces the arch_*_init() functions with an arch_ops_t structure
defined for each architecture. Undefined operations are treated as NOPs.

Location:
kernel
Files:
39 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/src/abs32le.c

    r7f0580d r36df4109  
    5151#include <memstr.h>
    5252
     53static void abs32le_post_mm_init(void);
     54
     55arch_ops_t abs32le_ops = {
     56        .post_mm_init = abs32le_post_mm_init,
     57};
     58
     59arch_ops_t *arch_ops = &abs32le_ops;
     60
    5361char memcpy_from_uspace_failover_address;
    5462char memcpy_to_uspace_failover_address;
    5563
    56 void arch_pre_mm_init(void)
    57 {
    58 }
    59 
    60 void arch_post_mm_init(void)
     64void abs32le_post_mm_init(void)
    6165{
    6266        if (config.cpu_active == 1) {
     
    6771                zone_merge_all();
    6872        }
    69 }
    70 
    71 void arch_post_cpu_init(void)
    72 {
    73 }
    74 
    75 void arch_pre_smp_init(void)
    76 {
    77 }
    78 
    79 void arch_post_smp_init(void)
    80 {
    8173}
    8274
  • kernel/arch/amd64/include/arch/arch.h

    r7f0580d r36df4109  
    3636#define KERN_amd64_ARCH_H_
    3737
    38 #include <genarch/multiboot/multiboot.h>
    39 
    40 extern void arch_pre_main(uint32_t, void *);
     38extern void amd64_pre_main(uint32_t, void *);
    4139
    4240#endif
  • kernel/arch/amd64/src/amd64.c

    r7f0580d r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <typedefs.h>
    3738#include <errno.h>
     
    6465#endif
    6566
     67static void amd64_pre_mm_init(void);
     68static void amd64_post_mm_init(void);
     69static void amd64_post_cpu_init(void);
     70static void amd64_pre_smp_init(void);
     71static void amd64_post_smp_init(void);
     72
     73arch_ops_t amd64_ops = {
     74        .pre_mm_init = amd64_pre_mm_init,
     75        .post_mm_init = amd64_post_mm_init,
     76        .post_cpu_init = amd64_post_cpu_init,
     77        .pre_smp_init = amd64_pre_smp_init,
     78        .post_smp_init = amd64_post_smp_init
     79};
     80
     81arch_ops_t *arch_ops = &amd64_ops;
     82
    6683/** Perform amd64-specific initialization before main_bsp() is called.
    6784 *
     
    7087 *
    7188 */
    72 void arch_pre_main(uint32_t signature, void *info)
     89void amd64_pre_main(uint32_t signature, void *info)
    7390{
    7491        /* Parse multiboot information obtained from the bootloader. */
     
    83100}
    84101
    85 void arch_pre_mm_init(void)
     102void amd64_pre_mm_init(void)
    86103{
    87104        /* Enable no-execute pages */
     
    107124}
    108125
    109 
    110 void arch_post_mm_init(void)
     126void amd64_post_mm_init(void)
    111127{
    112128        vreg_init();
     
    144160}
    145161
    146 void arch_post_cpu_init(void)
     162void amd64_post_cpu_init(void)
    147163{
    148164#ifdef CONFIG_SMP
     
    154170}
    155171
    156 void arch_pre_smp_init(void)
     172void amd64_pre_smp_init(void)
    157173{
    158174        if (config.cpu_active == 1) {
     
    163179}
    164180
    165 void arch_post_smp_init(void)
     181void amd64_post_smp_init(void)
    166182{
    167183        /* Currently the only supported platform for amd64 is 'pc'. */
  • kernel/arch/amd64/src/boot/multiboot.S

    r7f0580d r36df4109  
    427427        long_status $status_long
    428428       
    429         /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     429        /* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
    430430        movl multiboot_eax, %edi
    431431        movl multiboot_ebx, %esi
    432         callq arch_pre_main
     432        callq amd64_pre_main
    433433
    434434        long_status $status_main
  • kernel/arch/amd64/src/boot/multiboot2.S

    r7f0580d r36df4109  
    250250        movq %rsp, %rbp
    251251       
    252         /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     252        /* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
    253253        movl multiboot_eax, %edi
    254254        movl multiboot_ebx, %esi
    255         callq arch_pre_main
     255        callq amd64_pre_main
    256256       
    257257        /* Call main_bsp() */
  • kernel/arch/arm32/include/arch/arch.h

    r7f0580d r36df4109  
    5555} bootinfo_t;
    5656
    57 extern void arch_pre_main(void *entry, bootinfo_t *bootinfo);
     57extern void arm32_pre_main(void *entry, bootinfo_t *bootinfo);
    5858
    5959#endif
  • kernel/arch/arm32/src/arm32.c

    r7f0580d r36df4109  
    3535
    3636#include <arch.h>
     37#include <arch/arch.h>
    3738#include <config.h>
    3839#include <genarch/fb/fb.h>
     
    5152#include <sysinfo/sysinfo.h>
    5253
     54static void arm32_pre_mm_init(void);
     55static void arm32_post_mm_init(void);
     56static void arm32_post_smp_init(void);
     57
     58arch_ops_t arm32_ops = {
     59        .pre_mm_init = arm32_pre_mm_init,
     60        .post_mm_init = arm32_post_mm_init,
     61        .post_smp_init = arm32_post_smp_init,
     62};
     63
     64arch_ops_t *arch_ops = &arm32_ops;
     65
     66
    5367/** Performs arm32-specific initialization before main_bsp() is called. */
    54 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
     68void arm32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    5569{
    5670        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     
    6983
    7084/** Performs arm32 specific initialization before mm is initialized. */
    71 void arch_pre_mm_init(void)
     85void arm32_pre_mm_init(void)
    7286{
    7387        /* It is not assumed by default */
     
    7690
    7791/** Performs arm32 specific initialization afterr mm is initialized. */
    78 void arch_post_mm_init(void)
     92void arm32_post_mm_init(void)
    7993{
    8094        machine_init();
     
    90104}
    91105
    92 /** Performs arm32 specific tasks needed after cpu is initialized.
    93  *
    94  * Currently the function is empty.
    95  */
    96 void arch_post_cpu_init(void)
    97 {
    98 }
    99 
    100 
    101 /** Performs arm32 specific tasks needed before the multiprocessing is
    102  * initialized.
    103  *
    104  * Currently the function is empty because SMP is not supported.
    105  */
    106 void arch_pre_smp_init(void)
    107 {
    108 }
    109 
    110 
    111106/** Performs arm32 specific tasks needed after the multiprocessing is
    112107 * initialized.
     
    114109 * Currently the function is empty because SMP is not supported.
    115110 */
    116 void arch_post_smp_init(void)
     111void arm32_post_smp_init(void)
    117112{
    118113        machine_input_init();
  • kernel/arch/arm32/src/start.S

    r7f0580d r36df4109  
    6363        ldr sp, =temp_stack
    6464       
    65         bl arch_pre_main
     65        bl arm32_pre_main
    6666       
    6767        #
  • kernel/arch/ia32/include/arch/arch.h

    r7f0580d r36df4109  
    3838#include <typedefs.h>
    3939
    40 extern void arch_pre_main(uint32_t, void *);
     40extern void ia32_pre_main(uint32_t, void *);
    4141
    4242#endif
  • kernel/arch/ia32/src/boot/multiboot.S

    r7f0580d r36df4109  
    142142        pm2_status $status_prot3
    143143       
    144         /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     144        /* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
    145145        pushl multiboot_ebx
    146146        pushl multiboot_eax
    147         call arch_pre_main
     147        call ia32_pre_main
    148148       
    149149        pm2_status $status_main
  • kernel/arch/ia32/src/boot/multiboot2.S

    r7f0580d r36df4109  
    178178        movl %esp, %ebp
    179179       
    180         /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     180        /* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
    181181        pushl multiboot_ebx
    182182        pushl multiboot_eax
    183         call arch_pre_main
     183        call ia32_pre_main
    184184       
    185185        /* Call main_bsp() */
  • kernel/arch/ia32/src/ia32.c

    r7f0580d r36df4109  
    3636
    3737#include <arch.h>
     38#include <arch/arch.h>
    3839#include <typedefs.h>
    3940#include <errno.h>
     
    6465#endif
    6566
     67static void ia32_pre_mm_init(void);
     68static void ia32_post_mm_init(void);
     69static void ia32_post_cpu_init(void);
     70static void ia32_pre_smp_init(void);
     71static void ia32_post_smp_init(void);
     72
     73arch_ops_t ia32_ops = {
     74        .pre_mm_init = ia32_pre_mm_init,
     75        .post_mm_init = ia32_post_mm_init,
     76        .post_cpu_init = ia32_post_cpu_init,
     77        .pre_smp_init = ia32_pre_smp_init,
     78        .post_smp_init = ia32_post_smp_init,
     79};
     80
     81arch_ops_t *arch_ops = &ia32_ops;
     82
    6683/** Perform ia32-specific initialization before main_bsp() is called.
    6784 *
     
    7087 *
    7188 */
    72 void arch_pre_main(uint32_t signature, void *info)
     89void ia32_pre_main(uint32_t signature, void *info)
    7390{
    7491        /* Parse multiboot information obtained from the bootloader. */
     
    83100}
    84101
    85 void arch_pre_mm_init(void)
     102void ia32_pre_mm_init(void)
    86103{
    87104        pm_init();
     
    96113}
    97114
    98 void arch_post_mm_init(void)
     115void ia32_post_mm_init(void)
    99116{
    100117        vreg_init();
     
    129146}
    130147
    131 void arch_post_cpu_init(void)
     148void ia32_post_cpu_init(void)
    132149{
    133150#ifdef CONFIG_SMP
     
    139156}
    140157
    141 void arch_pre_smp_init(void)
     158void ia32_pre_smp_init(void)
    142159{
    143160        if (config.cpu_active == 1) {
     
    148165}
    149166
    150 void arch_post_smp_init(void)
     167void ia32_post_smp_init(void)
    151168{
    152169        /* Currently the only supported platform for ia32 is 'pc'. */
  • kernel/arch/ia64/include/arch/arch.h

    r7f0580d r36df4109  
    3636#define KERN_ia64_ARCH_H_
    3737
    38 extern void arch_pre_main(void);
     38extern void ia64_pre_main(void);
    3939
    4040#endif
  • kernel/arch/ia64/src/ia64.c

    r7f0580d r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <typedefs.h>
    3738#include <errno.h>
     
    6061#endif
    6162
     63static void ia64_pre_mm_init(void);
     64static void ia64_post_mm_init(void);
     65static void ia64_post_smp_init(void);
     66
     67arch_ops_t ia64_ops = {
     68        .pre_mm_init = ia64_pre_mm_init,
     69        .post_mm_init = ia64_post_mm_init,
     70        .post_smp_init = ia64_post_smp_init,
     71};
     72
     73arch_ops_t *arch_ops = &ia64_ops;
     74
    6275/* NS16550 as a COM 1 */
    6376#define NS16550_IRQ  (4 + LEGACY_INTERRUPT_BASE)
     
    6982
    7083/** Performs ia64-specific initialization before main_bsp() is called. */
    71 void arch_pre_main(void)
     84void ia64_pre_main(void)
    7285{
    7386        init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS,
     
    8497}
    8598
    86 void arch_pre_mm_init(void)
     99void ia64_pre_mm_init(void)
    87100{
    88101        if (config.cpu_active == 1)
     
    117130}
    118131
    119 void arch_post_mm_init(void)
     132void ia64_post_mm_init(void)
    120133{
    121134        if (config.cpu_active == 1) {
     
    130143}
    131144
    132 void arch_post_cpu_init(void)
    133 {
    134 }
    135 
    136 void arch_pre_smp_init(void)
    137 {
    138 }
    139 
    140 void arch_post_smp_init(void)
     145void ia64_post_smp_init(void)
    141146{
    142147        static const char *platform;
  • kernel/arch/ia64/src/start.S

    r7f0580d r36df4109  
    158158        srlz.d ;;
    159159       
    160         br.call.sptk.many b0 = arch_pre_main
     160        br.call.sptk.many b0 = ia64_pre_main
    1611610:
    162162        br.call.sptk.many b0 = main_bsp
  • kernel/arch/mips32/include/arch/arch.h

    r7f0580d r36df4109  
    6363} bootinfo_t;
    6464
    65 extern void arch_pre_main(void *entry, bootinfo_t *bootinfo);
     65extern void mips32_pre_main(void *entry, bootinfo_t *bootinfo);
    6666
    6767#endif
  • kernel/arch/mips32/src/mips32.c

    r7f0580d r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <typedefs.h>
    3738#include <errno.h>
     
    5657#define CACHE_EXC  ((char *) 0x80000100)
    5758
     59static void mips32_pre_mm_init(void);
     60static void mips32_post_mm_init(void);
     61static void mips32_post_smp_init(void);
     62
     63arch_ops_t mips32_ops = {
     64        .pre_mm_init = mips32_pre_mm_init,
     65        .post_mm_init = mips32_post_mm_init,
     66        .post_smp_init = mips32_post_smp_init,
     67};
     68
     69arch_ops_t *arch_ops = &mips32_ops;
    5870
    5971/* Why the linker moves the variable 64K away in assembler
     
    7183
    7284/** Performs mips32-specific initialization before main_bsp() is called. */
    73 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
     85void mips32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    7486{
    7587        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     
    96108}
    97109
    98 void arch_pre_mm_init(void)
     110void mips32_pre_mm_init(void)
    99111{
    100112        /* It is not assumed by default */
     
    127139}
    128140
    129 void arch_post_mm_init(void)
     141void mips32_post_mm_init(void)
    130142{
    131143        interrupt_init();
     
    135147}
    136148
    137 void arch_post_cpu_init(void)
    138 {
    139 }
    140 
    141 void arch_pre_smp_init(void)
    142 {
    143 }
    144 
    145 void arch_post_smp_init(void)
     149void mips32_post_smp_init(void)
    146150{
    147151        /* Set platform name. */
  • kernel/arch/mips32/src/start.S

    r7f0580d r36df4109  
    196196       
    197197        /* $a1 contains physical address of bootinfo_t */
    198         jal arch_pre_main
     198        jal mips32_pre_main
    199199        addiu $sp, -ABI_STACK_FRAME
    200200       
  • kernel/arch/ppc32/include/arch/arch.h

    r7f0580d r36df4109  
    3838#include <arch/boot/boot.h>
    3939
    40 extern void arch_pre_main(bootinfo_t *);
     40extern void ppc32_pre_main(bootinfo_t *);
    4141
    4242#endif
  • kernel/arch/ppc32/src/boot/boot.S

    r7f0580d r36df4109  
    4848       
    4949        addis r3, r3, 0x8000
    50         bl arch_pre_main
     50        bl ppc32_pre_main
    5151        b main_bsp
    5252
  • kernel/arch/ppc32/src/ppc32.c

    r7f0580d r36df4109  
    3333 */
    3434
     35#include <arch.h>
     36#include <arch/arch.h>
    3537#include <config.h>
    36 #include <arch.h>
    3738#include <arch/boot/boot.h>
    3839#include <genarch/drivers/via-cuda/cuda.h>
     
    6162#define IRQ_CUDA   10
    6263
     64static void ppc32_pre_mm_init(void);
     65static void ppc32_post_mm_init(void);
     66static void ppc32_post_smp_init(void);
     67
     68arch_ops_t ppc32_ops = {
     69        .pre_mm_init = ppc32_pre_mm_init,
     70        .post_mm_init = ppc32_post_mm_init,
     71        .post_smp_init = ppc32_post_smp_init,
     72};
     73
     74arch_ops_t *arch_ops = &ppc32_ops;
     75
    6376bootinfo_t bootinfo;
    6477
     
    6780
    6881/** Performs ppc32-specific initialization before main_bsp() is called. */
    69 void arch_pre_main(bootinfo_t *bootinfo)
     82void ppc32_pre_main(bootinfo_t *bootinfo)
    7083{
    7184        /* Copy tasks map. */
     
    95108}
    96109
    97 void arch_pre_mm_init(void)
     110void ppc32_pre_mm_init(void)
    98111{
    99112        /* Initialize dispatch table */
     
    192205#endif
    193206
    194 void arch_post_mm_init(void)
     207void ppc32_post_mm_init(void)
    195208{
    196209        if (config.cpu_active == 1) {
     
    207220                zone_merge_all();
    208221        }
    209 }
    210 
    211 void arch_post_cpu_init(void)
    212 {
    213 }
    214 
    215 void arch_pre_smp_init(void)
    216 {
    217222}
    218223
     
    273278}
    274279
    275 void arch_post_smp_init(void)
     280void ppc32_post_smp_init(void)
    276281{
    277282        /* Currently the only supported platform for ppc32 is 'mac'. */
  • kernel/arch/sparc32/include/arch/arch.h

    r7f0580d r36df4109  
    7575} bootinfo_t;
    7676
    77 extern void arch_pre_main(void *, bootinfo_t *);
     77extern void sparc32_pre_main(void *, bootinfo_t *);
    7878extern void write_to_invalid(uint32_t, uint32_t, uint32_t);
    7979extern void read_from_invalid(uint32_t *, uint32_t *, uint32_t *);
  • kernel/arch/sparc32/include/arch/machine_func.h

    r7f0580d r36df4109  
    4242#define KERN_sparc32_MACHINE_FUNC_H_
    4343
    44 #include <arch.h>
     44#include <arch/arch.h>
    4545
    4646#include <console/console.h>
  • kernel/arch/sparc32/src/debug/stacktrace.c

    r7f0580d r36df4109  
    3737#include <syscall/copy.h>
    3838#include <typedefs.h>
    39 #include <arch.h>
     39#include <arch/arch.h>
    4040#include <arch/stack.h>
    4141#include <proc/thread.h>
  • kernel/arch/sparc32/src/machine_func.c

    r7f0580d r36df4109  
    4040#include <arch/machine_func.h>
    4141#include <arch/machine/leon3/leon3.h>
     42#include <arch/arch.h>
    4243
    4344/** Pointer to machine_ops structure being used. */
  • kernel/arch/sparc32/src/mm/page.c

    r7f0580d r36df4109  
    4646#include <func.h>
    4747#include <arch/interrupt.h>
     48#include <arch/arch.h>
    4849#include <arch/asm.h>
    4950#include <debug.h>
  • kernel/arch/sparc32/src/sparc32.c

    r7f0580d r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <typedefs.h>
    3738#include <arch/interrupt.h>
     
    5455#include <str.h>
    5556
     57static void sparc32_post_mm_init(void);
     58static void sparc32_post_smp_init(void);
     59
     60arch_ops_t sparc32_ops = {
     61        .post_mm_init = sparc32_post_mm_init,
     62        .post_smp_init = sparc32_post_smp_init,
     63};
     64
     65arch_ops_t *arch_ops = &sparc32_ops;
     66
    5667char memcpy_from_uspace_failover_address;
    5768char memcpy_to_uspace_failover_address;
     
    5970static bootinfo_t machine_bootinfo;
    6071
    61 void arch_pre_main(void *unused, bootinfo_t *bootinfo)
     72void sparc32_pre_main(void *unused, bootinfo_t *bootinfo)
    6273{
    6374        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     
    7485}
    7586
    76 void arch_pre_mm_init(void)
    77 {
    78 }
    79 
    80 extern void func1(void);
    81 
    82 void arch_post_mm_init(void)
     87void sparc32_post_mm_init(void)
    8388{
    8489        machine_init(&machine_bootinfo);
     
    95100}
    96101
    97 
    98 void arch_post_cpu_init(void)
    99 {
    100 }
    101 
    102 void arch_pre_smp_init(void)
    103 {
    104 }
    105 
    106 void arch_post_smp_init(void)
     102void sparc32_post_smp_init(void)
    107103{
    108104        machine_input_init();
  • kernel/arch/sparc32/src/start.S

    r7f0580d r36df4109  
    5959       
    6060        mov %l1, %o1
    61         call arch_pre_main
     61        call sparc32_pre_main
    6262        nop
    6363       
  • kernel/arch/sparc32/src/userspace.c

    r7f0580d r36df4109  
    3535#include <userspace.h>
    3636#include <typedefs.h>
    37 #include <arch.h>
     37#include <arch/arch.h>
    3838#include <arch/asm.h>
    3939#include <abi/proc/uarg.h>
  • kernel/arch/sparc64/include/arch/arch.h

    r7f0580d r36df4109  
    5353#ifndef __ASM__
    5454
    55 extern void arch_pre_main(bootinfo_t *);
     55extern void sparc64_pre_main(bootinfo_t *);
    5656
    5757#endif /* __ASM__ */
  • kernel/arch/sparc64/src/sun4u/sparc64.c

    r7f0580d r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <debug.h>
    3738#include <config.h>
     
    5253#include <sysinfo/sysinfo.h>
    5354
     55static void sparc64_pre_mm_init(void);
     56static void sparc64_post_mm_init(void);
     57static void sparc64_post_smp_init(void);
     58
     59arch_ops_t sparc64_ops = {
     60        .pre_mm_init = sparc64_pre_mm_init,
     61        .post_mm_init = sparc64_post_mm_init,
     62        .post_smp_init = sparc64_post_smp_init,
     63};
     64
     65arch_ops_t *arch_ops = &sparc64_ops;
     66
    5467memmap_t memmap;
    5568
    5669/** Perform sparc64-specific initialization before main_bsp() is called. */
    57 void arch_pre_main(bootinfo_t *bootinfo)
     70void sparc64_pre_main(bootinfo_t *bootinfo)
    5871{
    5972        /* Copy init task info. */
     
    8497
    8598/** Perform sparc64 specific initialization before mm is initialized. */
    86 void arch_pre_mm_init(void)
     99void sparc64_pre_mm_init(void)
    87100{
    88101        if (config.cpu_active == 1) {
     
    93106
    94107/** Perform sparc64 specific initialization afterr mm is initialized. */
    95 void arch_post_mm_init(void)
     108void sparc64_post_mm_init(void)
    96109{
    97110        if (config.cpu_active == 1) {
     
    107120}
    108121
    109 void arch_post_cpu_init(void)
    110 {
    111 }
    112 
    113 void arch_pre_smp_init(void)
    114 {
    115 }
    116 
    117 void arch_post_smp_init(void)
     122void sparc64_post_smp_init(void)
    118123{
    119124        /* Currently the only supported platform for sparc64/sun4u is 'sun4u'. */
  • kernel/arch/sparc64/src/sun4u/start.S

    r7f0580d r36df4109  
    292292       
    293293        /*
    294          * Call arch_pre_main(bootinfo)
    295          */
    296         call arch_pre_main
     294         * Call sparc64_pre_main(bootinfo)
     295         */
     296        call sparc64_pre_main
    297297        mov %o1, %o0
    298298       
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    r7f0580d r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <debug.h>
    3738#include <config.h>
     
    5455#include <sysinfo/sysinfo.h>
    5556
     57static void sparc64_pre_mm_init(void);
     58static void sparc64_post_mm_init(void);
     59static void sparc64_post_smp_init(void);
     60
     61arch_ops_t sparc64_ops = {
     62        .pre_mm_init = sparc64_pre_mm_init,
     63        .post_mm_init = sparc64_post_mm_init,
     64        .post_smp_init = sparc64_post_smp_init,
     65};
     66
     67arch_ops_t *arch_ops = &sparc64_ops;
     68
    5669memmap_t memmap;
    5770
    5871/** Perform sparc64-specific initialization before main_bsp() is called. */
    59 void arch_pre_main(bootinfo_t *bootinfo)
     72void sparc64_pre_main(bootinfo_t *bootinfo)
    6073{
    6174        /* Copy init task info. */
     
    8295
    8396/** Perform sparc64 specific initialization before mm is initialized. */
    84 void arch_pre_mm_init(void)
     97void sparc64_pre_mm_init(void)
    8598{
    8699        if (config.cpu_active == 1) {
     
    91104
    92105/** Perform sparc64 specific initialization afterr mm is initialized. */
    93 void arch_post_mm_init(void)
     106void sparc64_post_mm_init(void)
    94107{
    95108        if (config.cpu_active == 1) {
     
    105118}
    106119
    107 void arch_post_cpu_init(void)
    108 {
    109 }
    110 
    111 void arch_pre_smp_init(void)
    112 {
    113 }
    114 
    115 void arch_post_smp_init(void)
     120void sparc64_post_smp_init(void)
    116121{
    117122        /* Currently the only supported platform for sparc64/sun4v is 'sun4v'. */
  • kernel/arch/sparc64/src/sun4v/start.S

    r7f0580d r36df4109  
    248248
    249249        /*
    250          * Call arch_pre_main(bootinfo)
    251          */
    252         call arch_pre_main
     250         * Call sparc64_pre_main(bootinfo)
     251         */
     252        call sparc64_pre_main
    253253        or %l1, %g0, %o0
    254254       
  • kernel/genarch/include/genarch/drivers/grlib/irqmp.h

    r7f0580d r36df4109  
    3939
    4040#include <typedefs.h>
    41 #include <arch.h>
     41#include <arch/arch.h>
    4242
    4343#define GRLIB_IRQMP_MASK_OFFSET   0x40
  • kernel/genarch/src/drivers/grlib/irqmp.c

    r7f0580d r36df4109  
    3636
    3737#include <genarch/drivers/grlib/irqmp.h>
     38#include <arch/arch.h>
    3839#include <arch/asm.h>
    3940#include <mm/km.h>
  • kernel/generic/include/arch.h

    r7f0580d r36df4109  
    3636#define KERN_ARCH_H_
    3737
    38 #include <arch/arch.h>  /* arch_pre_main() */
    3938#include <arch/asm.h>   /* get_stack_base() */
    4039#include <config.h>
     
    8079} the_t;
    8180
     81typedef struct {
     82        void (* pre_mm_init)(void);
     83        void (* post_mm_init)(void);
     84        void (* post_cpu_init)(void);
     85        void (* pre_smp_init)(void);
     86        void (* post_smp_init)(void);
     87} arch_ops_t;
     88
     89extern arch_ops_t *arch_ops;
     90
     91#define ARCH_OP(op) \
     92        do { \
     93                if (arch_ops->op) \
     94                        arch_ops->op(); \
     95        } while (0)
     96
    8297extern void the_initialize(the_t *);
    8398extern void the_copy(the_t *, the_t *);
    84 
    85 extern void arch_pre_mm_init(void);
    86 extern void arch_post_mm_init(void);
    87 extern void arch_post_cpu_init(void);
    88 extern void arch_pre_smp_init(void);
    89 extern void arch_post_smp_init(void);
    9099
    91100extern void calibrate_delay_loop(void);
     
    95104extern void *arch_construct_function(fncptr_t *, void *, void *);
    96105
    97 
    98106#endif
    99107
  • kernel/generic/src/main/kinit.c

    r7f0580d r36df4109  
    160160         * At this point SMP, if present, is configured.
    161161         */
    162         arch_post_smp_init();
     162        ARCH_OP(post_smp_init);
    163163       
    164164        /* Start thread computing system load */
  • kernel/generic/src/main/main.c

    r7f0580d r36df4109  
    238238         * Memory management subsystems initialization.
    239239         */
    240         arch_pre_mm_init();
     240        ARCH_OP(pre_mm_init);
    241241        km_identity_init();
    242242        frame_init();
     
    250250        km_non_identity_init();
    251251        ddi_init();
    252         arch_post_mm_init();
     252        ARCH_OP(post_mm_init);
    253253        reserve_init();
    254         arch_pre_smp_init();
     254        ARCH_OP(pre_smp_init);
    255255        smp_init();
    256256       
     
    266266        cpu_init();
    267267        calibrate_delay_loop();
    268         arch_post_cpu_init();
     268        ARCH_OP(post_cpu_init);
    269269
    270270        smp_call_init();
     
    341341        the_initialize(THE);
    342342       
    343         arch_pre_mm_init();
     343        ARCH_OP(pre_mm_init);
    344344        frame_init();
    345345        page_init();
    346346        tlb_init();
    347         arch_post_mm_init();
     347        ARCH_OP(post_mm_init);
    348348       
    349349        cpu_init();
    350350        calibrate_delay_loop();
    351         arch_post_cpu_init();
     351        ARCH_OP(post_cpu_init);
    352352       
    353353        the_copy(THE, (the_t *) CPU->stack);
Note: See TracChangeset for help on using the changeset viewer.