Changeset 8b863a62 in mainline for kernel/arch/sparc64
- Timestamp:
- 2014-04-16T17:14:06Z (12 years ago)
- 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. - Location:
- kernel/arch/sparc64
- Files:
-
- 17 edited
-
include/arch/mm/frame.h (modified) (1 diff)
-
include/arch/mm/sun4u/frame.h (modified) (4 diffs)
-
include/arch/mm/sun4v/frame.h (modified) (2 diffs)
-
include/arch/trap/sun4v/mmu.h (modified) (1 diff)
-
src/drivers/kbd.c (modified) (6 diffs)
-
src/drivers/niagara.c (modified) (1 diff)
-
src/drivers/pci.c (modified) (2 diffs)
-
src/drivers/scr.c (modified) (17 diffs)
-
src/mm/sun4u/as.c (modified) (1 diff)
-
src/mm/sun4v/as.c (modified) (2 diffs)
-
src/mm/sun4v/frame.c (modified) (1 diff)
-
src/mm/sun4v/tlb.c (modified) (5 diffs)
-
src/smp/sun4u/smp.c (modified) (2 diffs)
-
src/sun4v/md.c (modified) (2 diffs)
-
src/sun4v/start.S (modified) (1 diff)
-
src/trap/sun4u/interrupt.c (modified) (2 diffs)
-
src/trap/sun4v/interrupt.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/include/arch/mm/frame.h
rdba3e2c r8b863a62 46 46 #endif 47 47 48 #ifndef __ASM__ 49 50 #include <typedefs.h> 51 52 extern uintptr_t end_of_identity; 53 54 extern void frame_low_arch_init(void); 55 extern void frame_high_arch_init(void); 56 #define physmem_print() 57 58 #endif 59 48 60 #endif 49 61 -
kernel/arch/sparc64/include/arch/mm/sun4u/frame.h
rdba3e2c r8b863a62 27 27 */ 28 28 29 /** @addtogroup sparc64mm 29 /** @addtogroup sparc64mm 30 30 * @{ 31 31 */ … … 41 41 * Therefore, the kernel uses 8K only internally on the TLB and TSB levels. 42 42 */ 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) 45 45 46 46 /* … … 49 49 * each 16K page with a pair of adjacent 8K pages. 50 50 */ 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 53 55 54 56 #ifndef __ASM__ … … 72 74 typedef union frame_address frame_address_t; 73 75 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 80 76 #endif 81 77 -
kernel/arch/sparc64/include/arch/mm/sun4v/frame.h
rdba3e2c r8b863a62 27 27 */ 28 28 29 /** @addtogroup sparc64mm 29 /** @addtogroup sparc64mm 30 30 * @{ 31 31 */ … … 36 36 #define KERN_sparc64_sun4v_FRAME_H_ 37 37 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) 40 40 41 #define FRAME_WIDTH 1342 #define FRAME_SIZE (1 << FRAME_WIDTH)41 #define FRAME_WIDTH 13 42 #define FRAME_SIZE (1 << FRAME_WIDTH) 43 43 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 53 45 54 46 #endif -
kernel/arch/sparc64/include/arch/trap/sun4v/mmu.h
rdba3e2c r8b863a62 102 102 nop 103 103 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 104 111 /* 105 112 * Installing the identity does not fit into 32 instructions, call -
kernel/arch/sparc64/src/drivers/kbd.c
rdba3e2c r8b863a62 44 44 #include <align.h> 45 45 #include <str.h> 46 #include < print.h>46 #include <log.h> 47 47 #include <sysinfo/sysinfo.h> 48 48 … … 71 71 ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts"); 72 72 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"); 74 75 return false; 75 76 } … … 82 83 prop = ofw_tree_getprop(node, "reg"); 83 84 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"); 85 87 return false; 86 88 } … … 91 93 if (!ofw_ebus_apply_ranges(node->parent, 92 94 ((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"); 94 97 return false; 95 98 } … … 101 104 ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir, 102 105 &cir_arg)) { 103 printf("ns16550: Failed to determine interrupt\n"); 106 log(LF_ARCH, LVL_ERROR, 107 "ns16550: Failed to determine interrupt"); 104 108 return false; 105 109 } … … 117 121 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset); 118 122 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); 120 125 if (ns16550_instance) { 121 126 kbrd_instance_t *kbrd_instance = kbrd_init(); -
kernel/arch/sparc64/src/drivers/niagara.c
rdba3e2c r8b863a62 63 63 static outdev_operations_t niagara_ops = { 64 64 .write = niagara_putchar, 65 .redraw = NULL 65 .redraw = NULL, 66 .scroll_up = NULL, 67 .scroll_down = NULL 66 68 }; 67 69 -
kernel/arch/sparc64/src/drivers/pci.c
rdba3e2c r8b863a62 43 43 #include <typedefs.h> 44 44 #include <debug.h> 45 #include < print.h>45 #include <log.h> 46 46 #include <str.h> 47 47 #include <arch/asm.h> … … 213 213 * Unsupported model. 214 214 */ 215 printf("Unsupported PCI controller model (%s).\n",215 log(LF_ARCH, LVL_WARN, "Unsupported PCI controller model (%s).", 216 216 (char *) prop->value); 217 217 } -
kernel/arch/sparc64/src/drivers/scr.c
rdba3e2c r8b863a62 46 46 #include <align.h> 47 47 #include <print.h> 48 #include <log.h> 48 49 49 50 #define FFB_REG_24BPP 7 … … 81 82 82 83 if (scr_type == SCR_UNKNOWN) { 83 printf("Unknown screen device.\n");84 log(LF_ARCH, LVL_ERROR, "Unknown screen device."); 84 85 return; 85 86 } … … 117 118 case SCR_ATYFB: 118 119 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."); 120 121 return; 121 122 } … … 124 125 125 126 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."); 127 129 return; 128 130 } … … 130 132 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 131 133 &fb_addr)) { 132 printf("Failed to determine screen address.\n"); 134 log(LF_ARCH, LVL_ERROR, 135 "Failed to determine screen address."); 133 136 return; 134 137 } … … 152 155 break; 153 156 default: 154 printf("Unsupported bits per pixel.\n"); 157 log(LF_ARCH, LVL_ERROR, 158 "Unsupported bits per pixel."); 155 159 return; 156 160 } … … 159 163 case SCR_XVR: 160 164 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."); 162 167 return; 163 168 } … … 166 171 167 172 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."); 169 175 return; 170 176 } … … 172 178 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 173 179 &fb_addr)) { 174 printf("Failed to determine screen address.\n"); 180 log(LF_ARCH, LVL_ERROR, 181 "Failed to determine screen address."); 175 182 return; 176 183 } … … 196 203 break; 197 204 default: 198 printf("Unsupported bits per pixel.\n"); 205 log(LF_ARCH, LVL_ERROR, 206 "Unsupported bits per pixel."); 199 207 return; 200 208 } … … 207 215 upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; 208 216 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."); 210 219 return; 211 220 } … … 219 228 break; 220 229 default: 221 printf("Not implemented.\n");230 log(LF_ARCH, LVL_WARN, "Not implemented."); 222 231 return; 223 232 } … … 225 234 sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; 226 235 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."); 228 238 return; 229 239 } … … 233 243 case SCR_QEMU_VGA: 234 244 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."); 236 246 return; 237 247 } … … 240 250 241 251 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."); 243 254 return; 244 255 } … … 246 257 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 247 258 &fb_addr)) { 248 printf("Failed to determine screen address.\n"); 259 log(LF_ARCH, LVL_ERROR, 260 "Failed to determine screen address."); 249 261 return; 250 262 } … … 268 280 break; 269 281 default: 270 printf("Unsupported bits per pixel.\n");282 log(LF_ARCH, LVL_ERROR, "Unsupported bits per pixel."); 271 283 return; 272 284 } -
kernel/arch/sparc64/src/mm/sun4u/as.c
rdba3e2c r8b863a62 63 63 { 64 64 #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) 76 69 return -1; 77 70 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 83 int as_destructor_arch(as_t *as) 84 { 85 #ifdef CONFIG_TSB 86 size_t frames = SIZE2FRAMES((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * 80 87 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; 101 91 #else 102 92 return 0; -
kernel/arch/sparc64/src/mm/sun4v/as.c
rdba3e2c r8b863a62 66 66 { 67 67 #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); 73 71 if (!tsb) 74 72 return -1; … … 92 90 { 93 91 #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); 96 94 97 return cnt;95 return frames; 98 96 #else 99 97 return 0; -
kernel/arch/sparc64/src/mm/sun4v/frame.c
rdba3e2c r8b863a62 101 101 */ 102 102 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; 103 106 } 104 107 -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
rdba3e2c r8b863a62 46 46 #include <arch.h> 47 47 #include <print.h> 48 #include <log.h> 48 49 #include <typedefs.h> 49 50 #include <config.h> … … 251 252 uintptr_t va = DMISS_ADDRESS(page_and_ctx); 252 253 uint16_t ctx = DMISS_CONTEXT(page_and_ctx); 254 as_t *as = AS; 253 255 254 256 if (ctx == ASID_KERNEL) { … … 256 258 /* NULL access in kernel */ 257 259 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."); 258 265 } 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); 263 269 if (t) { 264 270 /* … … 295 301 uintptr_t va = DMISS_ADDRESS(page_and_ctx); 296 302 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); 299 309 if (t && PTE_WRITABLE(t)) { 300 310 /* … … 326 336 void tlb_print(void) 327 337 { 328 printf("Operation not possible on Niagara.\n");338 log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara."); 329 339 } 330 340 -
kernel/arch/sparc64/src/smp/sun4u/smp.c
rdba3e2c r8b863a62 43 43 #include <typedefs.h> 44 44 #include <synch/waitq.h> 45 #include < print.h>45 #include <log.h> 46 46 #include <arch/cpu_node.h> 47 47 … … 108 108 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == 109 109 ESYNCH_TIMEOUT) 110 printf("%s: waiting for processor (mid = %" PRIu32111 ") timed out \n", __func__, mid);110 log(LF_ARCH, LVL_NOTE, "%s: waiting for processor (mid = %" PRIu32 111 ") timed out", __func__, mid); 112 112 } 113 113 -
kernel/arch/sparc64/src/sun4v/md.c
rdba3e2c r8b863a62 36 36 #include <panic.h> 37 37 #include <func.h> 38 #include < print.h>38 #include <log.h> 39 39 #include <str.h> 40 40 #include <arch/sun4v/md.h> … … 310 310 retval = retval; 311 311 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); 314 314 } 315 315 } -
kernel/arch/sparc64/src/sun4v/start.S
rdba3e2c r8b863a62 345 345 .quad 0 346 346 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 353 end_of_identity: 354 .quad -1 355 347 356 .global kernel_8k_tlb_data_template 348 357 kernel_8k_tlb_data_template: -
kernel/arch/sparc64/src/trap/sun4u/interrupt.c
rdba3e2c r8b863a62 42 42 #include <arch/asm.h> 43 43 #include <arch/barrier.h> 44 #include < print.h>44 #include <log.h> 45 45 #include <arch.h> 46 46 #include <mm/tlb.h> … … 96 96 */ 97 97 #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); 100 101 #else 101 102 (void) intrcv; -
kernel/arch/sparc64/src/trap/sun4v/interrupt.c
rdba3e2c r8b863a62 42 42 #include <arch/asm.h> 43 43 #include <arch/barrier.h> 44 #include < print.h>44 #include <log.h> 45 45 #include <arch.h> 46 46 #include <mm/tlb.h> … … 111 111 ((void (*)(void)) data1)(); 112 112 } 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); 115 115 } 116 116 }
Note:
See TracChangeset
for help on using the changeset viewer.
