Changeset 97f1691 in mainline for arch/sparc64


Ignore:
Timestamp:
2006-02-28T00:02:39Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d6ec87
Parents:
d87c3f3
Message:

sparc64 work.
Fix KBD_VIRT_ADDRESS.
Call before_thread_runs() prior to the switch to the thread's stack. Add comment why this is crucial.
Add after_thread_ran() to the scheduler.
Add before_thread_runs_arch() and after_thread_ran_arch() for sparc64, mapping/demapping thread's kernel stack.
Add dummy after_thread_ran_arch() to all other architectures.
Add dtlb_insert_mapping() to promote code reuse.

Location:
arch/sparc64
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • arch/sparc64/Makefile.inc

    rd87c3f3 r97f1691  
    8282        arch/$(ARCH)/src/sparc64.c \
    8383        arch/$(ARCH)/src/start.S \
     84        arch/$(ARCH)/src/proc/scheduler.c \
    8485        arch/$(ARCH)/src/trap/trap_table.S \
    8586        arch/$(ARCH)/src/trap/trap.c \
  • arch/sparc64/include/drivers/i8042.h

    rd87c3f3 r97f1691  
    3333
    3434#define KBD_PHYS_ADDRESS        0x1fff8904000ULL
    35 #define KBD_VIRT_ADDRESS        0x00000d00000ULL
     35#define KBD_VIRT_ADDRESS        0x000d0000000ULL
    3636
    3737#define STATUS_REG      4
     
    4141static inline void i8042_data_write(__u8 data)
    4242{
    43         ((__u8 *)(KBD_VIRT_ADDRESS))[DATA_REG] = data;
     43        ((volatile __u8 *)(KBD_VIRT_ADDRESS))[DATA_REG] = data;
    4444}
    4545
     
    5656static inline void i8042_command_write(__u8 command)
    5757{
    58         ((__u8 *)(KBD_VIRT_ADDRESS))[COMMAND_REG] = command;
     58        ((volatile __u8 *)(KBD_VIRT_ADDRESS))[COMMAND_REG] = command;
    5959}
    6060
  • arch/sparc64/include/mm/tlb.h

    rd87c3f3 r97f1691  
    406406extern void fast_data_access_protection(void);
    407407
     408extern void dtlb_insert_mapping(__address page, __address frame, int pagesize, bool locked, bool cacheable);
     409
    408410#endif
  • arch/sparc64/include/trap/exception.h

    rd87c3f3 r97f1691  
    3232#define TT_INSTRUCTION_ACCESS_EXCEPTION         0x08
    3333#define TT_ILLEGAL_INSTRUCTION                  0x10
     34#define TT_DATA_ACCESS_ERROR                    0x32
    3435#define TT_MEM_ADDRESS_NOT_ALIGNED              0x34
    3536
     
    3738extern void do_instruction_access_exc(void);
    3839extern void do_mem_address_not_aligned(void);
     40extern void do_data_access_error(void);
    3941extern void do_illegal_instruction(void);
    4042#endif /* !__ASM__ */
  • arch/sparc64/src/console.c

    rd87c3f3 r97f1691  
    4141#include <proc/thread.h>
    4242#include <synch/mutex.h>
     43#include <arch/mm/tlb.h>
    4344
    4445#define KEYBOARD_POLL_PAUSE     50000   /* 50ms */
     
    7677        ofw_console_active = 0;
    7778        stdin = NULL;
     79
     80        dtlb_insert_mapping(FB_VIRT_ADDRESS, FB_PHYS_ADDRESS, PAGESIZE_4M, true, false);
     81        dtlb_insert_mapping(KBD_VIRT_ADDRESS, KBD_PHYS_ADDRESS, PAGESIZE_8K, true, false);
     82
    7883        fb_init(FB_VIRT_ADDRESS, FB_X_RES, FB_Y_RES, FB_COLOR_DEPTH/8);
    7984        i8042_init();
  • arch/sparc64/src/mm/tlb.c

    rd87c3f3 r97f1691  
    110110        dmmu_enable();
    111111        immu_enable();
    112        
    113         /*
    114          * Quick hack: map frame buffer
    115          */
    116         fr.address = FB_PHYS_ADDRESS;
    117         pg.address = FB_VIRT_ADDRESS;
     112}
     113
     114/** Insert privileged mapping into DMMU TLB.
     115 *
     116 * @param page Virtual page address.
     117 * @param frame Physical frame address.
     118 * @param pagesize Page size.
     119 * @param locked True for permanent mappings, false otherwise.
     120 * @param cacheable True if the mapping is cacheable, false otherwise.
     121 */
     122void dtlb_insert_mapping(__address page, __address frame, int pagesize, bool locked, bool cacheable)
     123{
     124        tlb_tag_access_reg_t tag;
     125        tlb_data_t data;
     126        page_address_t pg;
     127        frame_address_t fr;
     128
     129        pg.address = page;
     130        fr.address = frame;
    118131
    119132        tag.value = ASID_KERNEL;
     
    124137        data.value = 0;
    125138        data.v = true;
    126         data.size = PAGESIZE_4M;
     139        data.size = pagesize;
    127140        data.pfn = fr.pfn;
    128         data.l = true;
    129         data.cp = 0;
    130         data.cv = 0;
     141        data.l = locked;
     142        data.cp = cacheable;
     143        data.cv = cacheable;
    131144        data.p = true;
    132145        data.w = true;
     
    134147
    135148        dtlb_data_in_write(data.value);
    136        
    137         /*
    138          * Quick hack: map keyboard
    139          */
    140         fr.address = KBD_PHYS_ADDRESS;
    141         pg.address = KBD_VIRT_ADDRESS;
    142 
    143         tag.value = ASID_KERNEL;
    144         tag.vpn = pg.vpn;
    145 
    146         dtlb_tag_access_write(tag.value);
    147 
    148         data.value = 0;
    149         data.v = true;
    150         data.size = PAGESIZE_8K;
    151         data.pfn = fr.pfn;
    152         data.l = true;
    153         data.cp = 0;
    154         data.cv = 0;
    155         data.p = true;
    156         data.w = true;
    157         data.g = true;
    158 
    159         dtlb_data_in_write(data.value);
    160149}
    161150
     
    170159{
    171160        tlb_tag_access_reg_t tag;
    172         tlb_data_t data;
    173161        __address tpc;
    174162        char *tpc_str;
     
    187175         * Identity map piece of faulting kernel address space.
    188176         */
    189         data.value = 0;
    190         data.v = true;
    191         data.size = PAGESIZE_8K;
    192         data.pfn = tag.vpn;
    193         data.l = false;
    194         data.cp = 1;
    195         data.cv = 1;
    196         data.p = true;
    197         data.w = true;
    198         data.g = true;
    199 
    200         dtlb_data_in_write(data.value);
     177        dtlb_insert_mapping(tag.vpn * PAGE_SIZE, tag.vpn * FRAME_SIZE, PAGESIZE_8K, false, true);
    201178}
    202179
  • arch/sparc64/src/sparc64.c

    rd87c3f3 r97f1691  
    7575{
    7676}
    77 
    78 void before_thread_runs_arch(void)
    79 {
    80 }
  • arch/sparc64/src/trap/exception.c

    rd87c3f3 r97f1691  
    4343}
    4444
     45/** Handle data_access_error. */
     46void do_data_access_error(void)
     47{
     48        panic("Data Access Error: %P\n", tpc_read());
     49}
     50
    4551/** Handle mem_address_not_aligned. */
    4652void do_illegal_instruction(void)
  • arch/sparc64/src/trap/trap_table.S

    rd87c3f3 r97f1691  
    7373        CLEAN_WINDOW_HANDLER
    7474
     75/* TT = 0x32, TL = 0, data_access_error */
     76.org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE
     77.global data_access_error
     78data_access_error:
     79        SIMPLE_HANDLER do_data_access_error
     80
    7581/* TT = 0x34, TL = 0, mem_address_not_aligned */
    7682.org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
     
    226232clean_window_handler_high:
    227233        CLEAN_WINDOW_HANDLER
     234
     235/* TT = 0x32, TL > 0, data_access_error */
     236.org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE
     237.global data_access_error_high
     238data_access_error_high:
     239        SIMPLE_HANDLER do_data_access_error
    228240
    229241/* TT = 0x34, TL > 0, mem_address_not_aligned */
Note: See TracChangeset for help on using the changeset viewer.