Changeset 8b863a62 in mainline for kernel/arch/sparc64


Ignore:
Timestamp:
2014-04-16T17:14:06Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f857e8b
Parents:
dba3e2c (diff), 70b570c (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 changes

Location:
kernel/arch/sparc64
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/arch/mm/frame.h

    rdba3e2c r8b863a62  
    4646#endif
    4747
     48#ifndef __ASM__
     49
     50#include <typedefs.h>
     51
     52extern uintptr_t end_of_identity;
     53
     54extern void frame_low_arch_init(void);
     55extern void frame_high_arch_init(void);
     56#define physmem_print()
     57
     58#endif
     59
    4860#endif
    4961
  • kernel/arch/sparc64/include/arch/mm/sun4u/frame.h

    rdba3e2c r8b863a62  
    2727 */
    2828
    29 /** @addtogroup sparc64mm       
     29/** @addtogroup sparc64mm
    3030 * @{
    3131 */
     
    4141 * Therefore, the kernel uses 8K only internally on the TLB and TSB levels.
    4242 */
    43 #define MMU_FRAME_WIDTH         13      /* 8K */
    44 #define MMU_FRAME_SIZE          (1 << MMU_FRAME_WIDTH)
     43#define MMU_FRAME_WIDTH  13  /* 8K */
     44#define MMU_FRAME_SIZE   (1 << MMU_FRAME_WIDTH)
    4545
    4646/*
     
    4949 * each 16K page with a pair of adjacent 8K pages.
    5050 */
    51 #define FRAME_WIDTH             14      /* 16K */
    52 #define FRAME_SIZE              (1 << FRAME_WIDTH)
     51#define FRAME_WIDTH  14  /* 16K */
     52#define FRAME_SIZE   (1 << FRAME_WIDTH)
     53
     54#define FRAME_LOWPRIO  0
    5355
    5456#ifndef __ASM__
     
    7274typedef union frame_address frame_address_t;
    7375
    74 extern uintptr_t end_of_identity;
    75 
    76 extern void frame_low_arch_init(void);
    77 extern void frame_high_arch_init(void);
    78 #define physmem_print()
    79 
    8076#endif
    8177
  • kernel/arch/sparc64/include/arch/mm/sun4v/frame.h

    rdba3e2c r8b863a62  
    2727 */
    2828
    29 /** @addtogroup sparc64mm       
     29/** @addtogroup sparc64mm
    3030 * @{
    3131 */
     
    3636#define KERN_sparc64_sun4v_FRAME_H_
    3737
    38 #define MMU_FRAME_WIDTH         13      /* 8K */
    39 #define MMU_FRAME_SIZE          (1 << MMU_FRAME_WIDTH)
     38#define MMU_FRAME_WIDTH  13  /* 8K */
     39#define MMU_FRAME_SIZE   (1 << MMU_FRAME_WIDTH)
    4040
    41 #define FRAME_WIDTH             13
    42 #define FRAME_SIZE              (1 << FRAME_WIDTH)
     41#define FRAME_WIDTH  13
     42#define FRAME_SIZE   (1 << FRAME_WIDTH)
    4343
    44 #ifndef __ASM__
    45 
    46 #include <typedefs.h>
    47 
    48 extern void frame_low_arch_init(void);
    49 extern void frame_high_arch_init(void);
    50 #define physmem_print()
    51 
    52 #endif
     44#define FRAME_LOWPRIO  0
    5345
    5446#endif
  • kernel/arch/sparc64/include/arch/trap/sun4v/mmu.h

    rdba3e2c r8b863a62  
    102102        nop
    103103
     104        /* exclude pages beyond the end of memory from the identity mapping */
     105        sethi %hi(end_of_identity), %g4
     106        ldx [%g4 + %lo(end_of_identity)], %g4
     107        cmp %g1, %g4
     108        bgeu %xcc, 0f
     109        nop
     110
    104111        /*
    105112         * Installing the identity does not fit into 32 instructions, call
  • kernel/arch/sparc64/src/drivers/kbd.c

    rdba3e2c r8b863a62  
    4444#include <align.h>
    4545#include <str.h>
    46 #include <print.h>
     46#include <log.h>
    4747#include <sysinfo/sysinfo.h>
    4848
     
    7171        ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts");
    7272        if ((!prop) || (!prop->value)) {
    73                 printf("ns16550: Unable to find interrupts property\n");
     73                log(LF_ARCH, LVL_ERROR,
     74                    "ns16550: Unable to find interrupts property");
    7475                return false;
    7576        }
     
    8283        prop = ofw_tree_getprop(node, "reg");
    8384        if ((!prop) || (!prop->value)) {
    84                 printf("ns16550: Unable to find reg property\n");
     85                log(LF_ARCH, LVL_ERROR,
     86                    "ns16550: Unable to find reg property");
    8587                return false;
    8688        }
     
    9193        if (!ofw_ebus_apply_ranges(node->parent,
    9294            ((ofw_ebus_reg_t *) prop->value), &pa)) {
    93                 printf("ns16550: Failed to determine address\n");
     95                log(LF_ARCH, LVL_ERROR,
     96                    "ns16550: Failed to determine address");
    9497                return false;
    9598        }
     
    101104            ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir,
    102105            &cir_arg)) {
    103                 printf("ns16550: Failed to determine interrupt\n");
     106                log(LF_ARCH, LVL_ERROR,
     107                    "ns16550: Failed to determine interrupt");
    104108                return false;
    105109        }
     
    117121            PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset);
    118122       
    119         ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, cir_arg);
     123        ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir,
     124            cir_arg);
    120125        if (ns16550_instance) {
    121126                kbrd_instance_t *kbrd_instance = kbrd_init();
  • kernel/arch/sparc64/src/drivers/niagara.c

    rdba3e2c r8b863a62  
    6363static outdev_operations_t niagara_ops = {
    6464        .write = niagara_putchar,
    65         .redraw = NULL
     65        .redraw = NULL,
     66        .scroll_up = NULL,
     67        .scroll_down = NULL
    6668};
    6769
  • kernel/arch/sparc64/src/drivers/pci.c

    rdba3e2c r8b863a62  
    4343#include <typedefs.h>
    4444#include <debug.h>
    45 #include <print.h>
     45#include <log.h>
    4646#include <str.h>
    4747#include <arch/asm.h>
     
    213213                 * Unsupported model.
    214214                 */
    215                 printf("Unsupported PCI controller model (%s).\n",
     215                log(LF_ARCH, LVL_WARN, "Unsupported PCI controller model (%s).",
    216216                    (char *) prop->value);
    217217        }
  • kernel/arch/sparc64/src/drivers/scr.c

    rdba3e2c r8b863a62  
    4646#include <align.h>
    4747#include <print.h>
     48#include <log.h>
    4849
    4950#define FFB_REG_24BPP   7
     
    8182       
    8283        if (scr_type == SCR_UNKNOWN) {
    83                 printf("Unknown screen device.\n");
     84                log(LF_ARCH, LVL_ERROR, "Unknown screen device.");
    8485                return;
    8586        }
     
    117118        case SCR_ATYFB:
    118119                if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
    119                         printf("Too few screen registers.\n");
     120                        log(LF_ARCH, LVL_ERROR, "Too few screen registers.");
    120121                        return;
    121122                }
     
    124125               
    125126                if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
    126                         printf("Failed to absolutize fb register.\n");
     127                        log(LF_ARCH, LVL_ERROR,
     128                            "Failed to absolutize fb register.");
    127129                        return;
    128130                }
     
    130132                if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
    131133                    &fb_addr)) {
    132                         printf("Failed to determine screen address.\n");
     134                        log(LF_ARCH, LVL_ERROR,
     135                            "Failed to determine screen address.");
    133136                        return;
    134137                }
     
    152155                        break;
    153156                default:
    154                         printf("Unsupported bits per pixel.\n");
     157                        log(LF_ARCH, LVL_ERROR,
     158                            "Unsupported bits per pixel.");
    155159                        return;
    156160                }
     
    159163        case SCR_XVR:
    160164                if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
    161                         printf("Too few screen registers.\n");
     165                        log(LF_ARCH, LVL_ERROR,
     166                            "Too few screen registers.");
    162167                        return;
    163168                }
     
    166171               
    167172                if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
    168                         printf("Failed to absolutize fb register.\n");
     173                        log(LF_ARCH, LVL_ERROR,
     174                            "Failed to absolutize fb register.");
    169175                        return;
    170176                }
     
    172178                if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
    173179                    &fb_addr)) {
    174                         printf("Failed to determine screen address.\n");
     180                        log(LF_ARCH, LVL_ERROR,
     181                            "Failed to determine screen address.");
    175182                        return;
    176183                }
     
    196203                        break;
    197204                default:
    198                         printf("Unsupported bits per pixel.\n");
     205                        log(LF_ARCH, LVL_ERROR,
     206                            "Unsupported bits per pixel.");
    199207                        return;
    200208                }
     
    207215                upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP];
    208216                if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) {
    209                         printf("Failed to determine screen address.\n");
     217                        log(LF_ARCH, LVL_ERROR,
     218                            "Failed to determine screen address.");
    210219                        return;
    211220                }
     
    219228                        break;
    220229                default:
    221                         printf("Not implemented.\n");
     230                        log(LF_ARCH, LVL_WARN, "Not implemented.");
    222231                        return;
    223232                }
     
    225234                sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0];
    226235                if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) {
    227                         printf("Failed to determine screen address.\n");
     236                        log(LF_ARCH, LVL_ERROR,
     237                            "Failed to determine screen address.");
    228238                        return;
    229239                }
     
    233243        case SCR_QEMU_VGA:
    234244                if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
    235                         printf("Too few screen registers.\n");
     245                        log(LF_ARCH, LVL_ERROR, "Too few screen registers.");
    236246                        return;
    237247                }
     
    240250
    241251                if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
    242                         printf("Failed to absolutize fb register.\n");
     252                        log(LF_ARCH, LVL_ERROR,
     253                            "Failed to absolutize fb register.");
    243254                        return;
    244255                }
     
    246257                if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
    247258                    &fb_addr)) {
    248                         printf("Failed to determine screen address.\n");
     259                        log(LF_ARCH, LVL_ERROR,
     260                            "Failed to determine screen address.");
    249261                        return;
    250262                }
     
    268280                        break;
    269281                default:
    270                         printf("Unsupported bits per pixel.\n");
     282                        log(LF_ARCH, LVL_ERROR, "Unsupported bits per pixel.");
    271283                        return;
    272284                }
  • kernel/arch/sparc64/src/mm/sun4u/as.c

    rdba3e2c r8b863a62  
    6363{
    6464#ifdef CONFIG_TSB
    65         /*
    66          * The order must be calculated with respect to the emulated
    67          * 16K page size.
    68          *
    69          */
    70         uint8_t order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    71             sizeof(tsb_entry_t)) >> FRAME_WIDTH);
    72        
    73         uintptr_t tsb = (uintptr_t) frame_alloc(order, flags | FRAME_KA);
    74        
    75         if (!tsb)
     65        uintptr_t tsb_phys =
     66            frame_alloc(SIZE2FRAMES((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
     67            sizeof(tsb_entry_t)), flags, 0);
     68        if (!tsb_phys)
    7669                return -1;
    7770       
    78         as->arch.itsb = (tsb_entry_t *) tsb;
    79         as->arch.dtsb = (tsb_entry_t *) (tsb + ITSB_ENTRY_COUNT *
     71        tsb_entry_t *tsb = (tsb_entry_t *) PA2KA(tsb_phys);
     72       
     73        as->arch.itsb = tsb;
     74        as->arch.dtsb = tsb + ITSB_ENTRY_COUNT;
     75       
     76        memsetb(as->arch.itsb, (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
     77            sizeof(tsb_entry_t), 0);
     78#endif
     79       
     80        return 0;
     81}
     82
     83int as_destructor_arch(as_t *as)
     84{
     85#ifdef CONFIG_TSB
     86        size_t frames = SIZE2FRAMES((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    8087            sizeof(tsb_entry_t));
    81        
    82         memsetb(as->arch.itsb,
    83             (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * sizeof(tsb_entry_t), 0);
    84 #endif
    85        
    86         return 0;
    87 }
    88 
    89 int as_destructor_arch(as_t *as)
    90 {
    91 #ifdef CONFIG_TSB
    92         /*
    93          * The count must be calculated with respect to the emualted 16K page
    94          * size.
    95          */
    96         size_t cnt = ((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    97             sizeof(tsb_entry_t)) >> FRAME_WIDTH;
    98         frame_free(KA2PA((uintptr_t) as->arch.itsb));
    99        
    100         return cnt;
     88        frame_free(KA2PA((uintptr_t) as->arch.itsb), frames);
     89       
     90        return frames;
    10191#else
    10292        return 0;
  • kernel/arch/sparc64/src/mm/sun4v/as.c

    rdba3e2c r8b863a62  
    6666{
    6767#ifdef CONFIG_TSB
    68         uint8_t order = fnzb32(
    69                 (TSB_ENTRY_COUNT * sizeof(tsb_entry_t)) >> FRAME_WIDTH);
    70        
    71         uintptr_t tsb = (uintptr_t) frame_alloc(order, flags);
    72        
     68        uintptr_t tsb =
     69            frame_alloc(SIZE2FRAMES(TSB_ENTRY_COUNT * sizeof(tsb_entry_t)),
     70            flags, 0);
    7371        if (!tsb)
    7472                return -1;
     
    9290{
    9391#ifdef CONFIG_TSB
    94         size_t cnt = (TSB_ENTRY_COUNT * sizeof(tsb_entry_t)) >> FRAME_WIDTH;
    95         frame_free((uintptr_t) as->arch.tsb_description.tsb_base);
     92        size_t frames = SIZE2FRAMES(TSB_ENTRY_COUNT * sizeof(tsb_entry_t));
     93        frame_free(as->arch.tsb_description.tsb_base, frames);
    9694       
    97         return cnt;
     95        return frames;
    9896#else
    9997        return 0;
  • kernel/arch/sparc64/src/mm/sun4v/frame.c

    rdba3e2c r8b863a62  
    101101         */
    102102        frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
     103
     104        /* PA2KA will work only on low-memory. */
     105        end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
    103106}
    104107
  • kernel/arch/sparc64/src/mm/sun4v/tlb.c

    rdba3e2c r8b863a62  
    4646#include <arch.h>
    4747#include <print.h>
     48#include <log.h>
    4849#include <typedefs.h>
    4950#include <config.h>
     
    251252        uintptr_t va = DMISS_ADDRESS(page_and_ctx);
    252253        uint16_t ctx = DMISS_CONTEXT(page_and_ctx);
     254        as_t *as = AS;
    253255
    254256        if (ctx == ASID_KERNEL) {
     
    256258                        /* NULL access in kernel */
    257259                        panic("NULL pointer dereference.");
     260                } else if (va >= end_of_identity) {
     261                        /* Kernel non-identity */
     262                        as = AS_KERNEL;
     263                } else {
     264                        panic("Unexpected kernel page fault.");
    258265                }
    259                 panic("Unexpected kernel page fault.");
    260         }
    261 
    262         t = page_mapping_find(AS, va, true);
     266        }
     267
     268        t = page_mapping_find(as, va, true);
    263269        if (t) {
    264270                /*
     
    295301        uintptr_t va = DMISS_ADDRESS(page_and_ctx);
    296302        uint16_t ctx = DMISS_CONTEXT(page_and_ctx);
    297 
    298         t = page_mapping_find(AS, va, true);
     303        as_t *as = AS;
     304
     305        if (ctx == ASID_KERNEL)
     306                as = AS_KERNEL;
     307
     308        t = page_mapping_find(as, va, true);
    299309        if (t && PTE_WRITABLE(t)) {
    300310                /*
     
    326336void tlb_print(void)
    327337{
    328         printf("Operation not possible on Niagara.\n");
     338        log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara.");
    329339}
    330340
  • kernel/arch/sparc64/src/smp/sun4u/smp.c

    rdba3e2c r8b863a62  
    4343#include <typedefs.h>
    4444#include <synch/waitq.h>
    45 #include <print.h>
     45#include <log.h>
    4646#include <arch/cpu_node.h>
    4747
     
    108108        if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) ==
    109109            ESYNCH_TIMEOUT)
    110                 printf("%s: waiting for processor (mid = %" PRIu32
    111                     ") timed out\n", __func__, mid);
     110                log(LF_ARCH, LVL_NOTE, "%s: waiting for processor (mid = %" PRIu32
     111                    ") timed out", __func__, mid);
    112112}
    113113
  • kernel/arch/sparc64/src/sun4v/md.c

    rdba3e2c r8b863a62  
    3636#include <panic.h>
    3737#include <func.h>
    38 #include <print.h>
     38#include <log.h>
    3939#include <str.h>
    4040#include <arch/sun4v/md.h>
     
    310310        retval = retval;
    311311        if (retval != HV_EOK) {
    312                 printf("Could not retrieve machine description, "
    313                     "error=%" PRIu64 ".\n", retval);
     312                log(LF_ARCH, LVL_ERROR, "Could not retrieve machine "
     313                    "description, error=%" PRIu64 ".", retval);
    314314        }
    315315}
  • kernel/arch/sparc64/src/sun4v/start.S

    rdba3e2c r8b863a62  
    345345        .quad 0
    346346
     347/*
     348 * This variable is used by the fast_data_access_MMU_miss trap handler.
     349 * In runtime, it is modified to contain the address of the end of physical
     350 * memory.
     351 */
     352.global end_of_identity
     353end_of_identity:
     354        .quad -1
     355
    347356.global kernel_8k_tlb_data_template
    348357kernel_8k_tlb_data_template:
  • kernel/arch/sparc64/src/trap/sun4u/interrupt.c

    rdba3e2c r8b863a62  
    4242#include <arch/asm.h>
    4343#include <arch/barrier.h>
    44 #include <print.h>
     44#include <log.h>
    4545#include <arch.h>
    4646#include <mm/tlb.h>
     
    9696                 */
    9797#ifdef CONFIG_DEBUG
    98                 printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64
    99                     ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0);
     98                log(LF_ARCH, LVL_DEBUG,
     99                    "cpu%u: spurious interrupt (intrcv=%#" PRIx64 ", data0=%#"
     100                    PRIx64 ")", CPU->id, intrcv, data0);
    100101#else
    101102                (void) intrcv;
  • kernel/arch/sparc64/src/trap/sun4v/interrupt.c

    rdba3e2c r8b863a62  
    4242#include <arch/asm.h>
    4343#include <arch/barrier.h>
    44 #include <print.h>
     44#include <log.h>
    4545#include <arch.h>
    4646#include <mm/tlb.h>
     
    111111                        ((void (*)(void)) data1)();
    112112                } else {
    113                         printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n",
    114                             CPU->arch.id, data1);
     113                        log(LF_ARCH, LVL_DEBUG, "Spurious interrupt on %" PRIu64
     114                            ", data = %" PRIx64 ".", CPU->arch.id, data1);
    115115                }
    116116        }
Note: See TracChangeset for help on using the changeset viewer.