Changeset 7510326 in mainline


Ignore:
Timestamp:
2016-06-08T16:02:54Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8b420fa
Parents:
36df4109
Message:

Provide common arch_ops for sparc64 and separate arch_ops for sun4[uv]

The common sparc64 arch_ops are responsible for invoking the sun4u/sun4v
arch ops. This opens a way for partial deduplication of the sun4u/sun4v
arch ops and code sharing between the two subplatforms.

Location:
kernel
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/Makefile.inc

    r36df4109 r7510326  
    5858
    5959ARCH_SOURCES = \
     60        arch/$(KARCH)/src/sparc64.c \
    6061        arch/$(KARCH)/src/cpu/$(USARCH)/cpu.c \
    6162        arch/$(KARCH)/src/debug/stacktrace.c \
  • kernel/arch/sparc64/include/arch/arch.h

    r36df4109 r7510326  
    3838#define KERN_sparc64_ARCH_H_
    3939
     40#ifndef __ASM__
     41#include <arch.h>
     42#endif
     43
    4044#include <arch/boot/boot.h>
    4145
     
    5357#ifndef __ASM__
    5458
     59extern arch_ops_t *sparc64_ops;
     60
    5561extern void sparc64_pre_main(bootinfo_t *);
    5662
  • kernel/arch/sparc64/include/arch/asm.h

    r36df4109 r7510326  
    3636#define KERN_sparc64_ASM_H_
    3737
    38 #include <arch/arch.h>
    3938#include <typedefs.h>
    4039#include <align.h>
  • kernel/arch/sparc64/include/arch/sun4u/cpu.h

    r36df4109 r7510326  
    5858#include <arch/regdef.h>
    5959#include <arch/asm.h>
     60#include <arch/arch.h>
    6061#include <trace.h>
    6162
  • kernel/arch/sparc64/src/sun4u/sparc64.c

    r36df4109 r7510326  
    5353#include <sysinfo/sysinfo.h>
    5454
    55 static void sparc64_pre_mm_init(void);
    56 static void sparc64_post_mm_init(void);
    57 static void sparc64_post_smp_init(void);
    58 
    59 arch_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,
     55static void sun4u_pre_mm_init(void);
     56static void sun4u_post_mm_init(void);
     57static void sun4u_post_smp_init(void);
     58
     59arch_ops_t sun4u_ops = {
     60        .pre_mm_init = sun4u_pre_mm_init,
     61        .post_mm_init = sun4u_post_mm_init,
     62        .post_smp_init = sun4u_post_smp_init,
    6363};
    6464
    65 arch_ops_t *arch_ops = &sparc64_ops;
     65arch_ops_t *sparc64_ops = &sun4u_ops;
    6666
    6767memmap_t memmap;
     
    9797
    9898/** Perform sparc64 specific initialization before mm is initialized. */
    99 void sparc64_pre_mm_init(void)
     99void sun4u_pre_mm_init(void)
    100100{
    101101        if (config.cpu_active == 1) {
     
    106106
    107107/** Perform sparc64 specific initialization afterr mm is initialized. */
    108 void sparc64_post_mm_init(void)
     108void sun4u_post_mm_init(void)
    109109{
    110110        if (config.cpu_active == 1) {
     
    120120}
    121121
    122 void sparc64_post_smp_init(void)
     122void sun4u_post_smp_init(void)
    123123{
    124124        /* Currently the only supported platform for sparc64/sun4u is 'sun4u'. */
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    r36df4109 r7510326  
    5555#include <sysinfo/sysinfo.h>
    5656
    57 static void sparc64_pre_mm_init(void);
    58 static void sparc64_post_mm_init(void);
    59 static void sparc64_post_smp_init(void);
     57static void sun4v_pre_mm_init(void);
     58static void sun4v_post_mm_init(void);
     59static void sun4v_post_smp_init(void);
    6060
    61 arch_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,
     61arch_ops_t sun4v_ops = {
     62        .pre_mm_init = sun4v_pre_mm_init,
     63        .post_mm_init = sun4v_post_mm_init,
     64        .post_smp_init = sun4v_post_smp_init,
    6565};
    6666
    67 arch_ops_t *arch_ops = &sparc64_ops;
     67arch_ops_t *sparc64_ops = &sun4v_ops;
    6868
    6969memmap_t memmap;
     
    9595
    9696/** Perform sparc64 specific initialization before mm is initialized. */
    97 void sparc64_pre_mm_init(void)
     97void sun4v_pre_mm_init(void)
    9898{
    9999        if (config.cpu_active == 1) {
     
    104104
    105105/** Perform sparc64 specific initialization afterr mm is initialized. */
    106 void sparc64_post_mm_init(void)
     106void sun4v_post_mm_init(void)
    107107{
    108108        if (config.cpu_active == 1) {
     
    118118}
    119119
    120 void sparc64_post_smp_init(void)
     120void sun4v_post_smp_init(void)
    121121{
    122122        /* Currently the only supported platform for sparc64/sun4v is 'sun4v'. */
  • kernel/generic/include/arch.h

    r36df4109 r7510326  
    8989extern arch_ops_t *arch_ops;
    9090
    91 #define ARCH_OP(op) \
     91#define ARCH_STRUCT_OP(s, op) \
    9292        do { \
    93                 if (arch_ops->op) \
    94                         arch_ops->op(); \
     93                if ((s)->op) \
     94                        (s)->op(); \
    9595        } while (0)
     96
     97#define ARCH_OP(op)     ARCH_STRUCT_OP(arch_ops, op)
    9698
    9799extern void the_initialize(the_t *);
Note: See TracChangeset for help on using the changeset viewer.