Changeset 778c1e1 in mainline


Ignore:
Timestamp:
2006-02-22T14:52:18Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d53ef4
Parents:
effee6f
Message:

Move OFW functionality of ppc32 memory_init to genarch so that the code can also be used by sparc64.
sparc64 is now close to broken as it lacks functionality to provide identity mapping for the whole phyisical memory.

Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/include/mm/memory_init.h

    reffee6f r778c1e1  
    3030#define __ppc32_MEMORY_INIT_H__
    3131
    32 #include <config.h>
     32#include <typedefs.h>
    3333
    3434size_t get_memory_size(void);
    3535void preboot_read_config(void);
    36 void ppc_init_zones(void);
    3736
    3837#endif
  • arch/ppc32/src/mm/frame.c

    reffee6f r778c1e1  
    3030#include <arch/mm/memory_init.h>
    3131#include <mm/frame.h>
    32 #include <config.h>
    33 #include <panic.h>
     32#include <genarch/ofw/memory_init.h>
    3433
    3534void frame_arch_init(void)
    3635{
    37         ppc_init_zones();
     36        ofw_init_zones();
    3837        /* First is exception vector, second is 'implementation specific' */
    3938        frame_mark_unavailable(0, 2);
  • arch/ppc32/src/mm/memory_init.c

    reffee6f r778c1e1  
    2828
    2929#include <arch/mm/memory_init.h>
    30 #include <genarch/ofw/ofw.h>
    31 #include <panic.h>
    32 #include <mm/frame.h>
    33 #include <align.h>
    34 
    35 #define MEMMAP_MAX_RECORDS 32
    36 
    37 typedef struct {
    38         __u32 start;
    39         __u32 size;
    40 } memmap_t;
    41 
    42 static memmap_t memmap[MEMMAP_MAX_RECORDS];
    43 size_t total_mem = 0;
    44 
    45 static void init_memmap(void)
    46 {
    47         int i;
    48 
    49         phandle handle = ofw_find_device("/memory");
    50         if (handle == -1)
    51                 panic("No RAM\n");
    52        
    53         size_t ret = ofw_get_property(handle, "reg", &memmap, sizeof(memmap));
    54         if (ret == -1)
    55                 panic("Device /memory has no reg property\n");
    56        
    57        
    58         for (i = 0; i < MEMMAP_MAX_RECORDS; i++) {
    59                 if (memmap[i].size == 0)
    60                         break;
    61                 total_mem += memmap[i].size;
    62         }
    63 }
     30#include <genarch/ofw/memory_init.h>
     31#include <typedefs.h>
    6432
    6533void preboot_read_config(void)
    6634{
    67         init_memmap();
     35        ofw_init_memmap();
    6836}
    6937
    7038size_t get_memory_size(void)
    7139{
    72         return total_mem;
     40        return ofw_get_memory_size();
    7341}
    74 
    75 void ppc_init_zones(void)
    76 {
    77         int i;
    78         pfn_t confdata;
    79 
    80         for (i = 0; i < MEMMAP_MAX_RECORDS; i++) {
    81                 if (memmap[i].size == 0)
    82                         break;
    83                 confdata = ADDR2PFN(memmap[i].start);
    84                 if (confdata == 0)
    85                         confdata = 2;
    86                 zone_create(ADDR2PFN(memmap[i].start),
    87                             SIZE2FRAMES(ALIGN_DOWN(memmap[i].size,PAGE_SIZE)),
    88                             confdata, 0);
    89         }
    90 }
  • arch/sparc64/Makefile.inc

    reffee6f r778c1e1  
    6969        arch/$(ARCH)/src/mm/page.c \
    7070        arch/$(ARCH)/src/mm/tlb.c \
     71        arch/$(ARCH)/src/mm/memory_init.c \
    7172        arch/$(ARCH)/src/sparc64.c \
    7273        arch/$(ARCH)/src/start.S \
  • arch/sparc64/include/mm/memory_init.h

    reffee6f r778c1e1  
    3030#define __sparc64_MEMORY_INIT_H__
    3131
    32 #include <config.h>
     32#include <typedefs.h>
    3333
    34 #define get_memory_size()       CONFIG_MEMORY_SIZE
     34extern size_t get_memory_size(void);
    3535
    3636#endif
  • arch/sparc64/include/trap/mmu.h

    reffee6f r778c1e1  
    4040#define FAST_MMU_HANDLER_SIZE                   128
    4141
     42#ifdef __ASM__
    4243.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
    4344        call fast_instruction_access_mmu_miss
     
    5758        retry
    5859.endm
     60#endif /* __ASM__ */
    5961
    6062#endif
  • arch/sparc64/src/mm/frame.c

    reffee6f r778c1e1  
    2828
    2929#include <arch/mm/frame.h>
     30#include <genarch/ofw/memory_init.h>
    3031#include <mm/frame.h>
    3132#include <config.h>
     
    3435void frame_arch_init(void)
    3536{
    36         zone_create(0, config.memory_size >> FRAME_WIDTH, 1, 0);
     37        ofw_init_zones();
    3738
    3839        /*
  • arch/sparc64/src/start.S

    reffee6f r778c1e1  
    9999        stx %o4, [%l0]
    100100
     101        call ofw_init_memmap
     102        nop
     103
    101104        call main_bsp
    102105        nop
  • arch/sparc64/src/trap/trap.c

    reffee6f r778c1e1  
    3232#include <arch/trap/exception.h>
    3333#include <arch/trap/interrupt.h>
     34#include <arch/trap/mmu.h>
    3435#include <arch/asm.h>
    3536#include <memstr.h>
     
    8182        trap_install_handler(TT_INTERRUPT_LEVEL_15, INTERRUPT_LEVEL_N_HANDLER_SIZE, false);
    8283        trap_install_handler(TT_INTERRUPT_VECTOR_TRAP, INTERRUPT_VECTOR_TRAP_HANDLER_SIZE, false);
     84
     85        /*
     86         * Kernel must become independent on Open Firmware calls before MMU handlers are enabled.
     87         */
     88/*
     89        trap_install_handler(TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, FAST_MMU_HANDLER_SIZE, false);
     90        trap_install_handler(TT_FAST_DATA_ACCESS_MMU_MISS, FAST_MMU_HANDLER_SIZE, false);
     91        trap_install_handler(TT_FAST_DATA_ACCESS_PROTECTION, FAST_MMU_HANDLER_SIZE, false);
     92        trap_install_handler(TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, FAST_MMU_HANDLER_SIZE, true);
     93        trap_install_handler(TT_FAST_DATA_ACCESS_MMU_MISS, FAST_MMU_HANDLER_SIZE, true);
     94        trap_install_handler(TT_FAST_DATA_ACCESS_PROTECTION, FAST_MMU_HANDLER_SIZE, true);
     95*/
     96
    8397}
    8498
  • genarch/Makefile.inc

    reffee6f r778c1e1  
    3131ifeq ($(CONFIG_OFW),y)
    3232        GENARCH_SOURCES += \
    33                 genarch/src/ofw/ofw.c
     33                genarch/src/ofw/ofw.c \
     34                genarch/src/ofw/memory_init.c
    3435endif
    3536ifeq ($(CONFIG_ACPI),y)
Note: See TracChangeset for help on using the changeset viewer.