Changeset 965dc18 in mainline
- Timestamp:
- 2008-12-05T19:59:03Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 49093a4
- Parents:
- 0258e67
- Files:
-
- 14 added
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ppc64/Makefile.inc
r0258e67 r965dc18 27 27 # 28 28 29 DEFS += -DOPEN_BOOT 30 29 31 build: $(BASE)/image.boot 30 32 … … 36 38 37 39 arch/$(ARCH)/loader/image.boot: 38 make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNELDIR=../../../$(KERNELDIR) USPACEDIR=../../../$(USPACEDIR) 40 make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNELDIR=../../../$(KERNELDIR) USPACEDIR=../../../$(USPACEDIR) "DEFS=$(DEFS)" 39 41 40 42 clean: generic_clean -
boot/arch/sparc64/Makefile.inc
r0258e67 r965dc18 29 29 TMP = distroot 30 30 31 ifeq ($(CONFIG_AOUT_ISOFS_B),n) 32 SILO_PACKAGE=silo.patched.tar.gz 33 endif 34 35 ifeq ($(CONFIG_AOUT_ISOFS_B),y) 36 SILO_PACKAGE=silo.tar.gz 37 endif 38 31 39 build: $(BASE)/image.iso 32 40 … … 40 48 mkdir -p $(TMP)/boot 41 49 mkdir -p $(TMP)/HelenOS 42 cat arch/$(ARCH)/silo/ silo.tar.gz| (cd $(TMP)/boot; tar xvfz -)50 cat arch/$(ARCH)/silo/$(SILO_PACKAGE) | (cd $(TMP)/boot; tar xvfz -) 43 51 cp arch/$(ARCH)/silo/README arch/$(ARCH)/silo/COPYING $(TMP)/boot 44 52 cat arch/$(ARCH)/silo/silo.conf | $(SILO_CONF_FILTER) >$(TMP)/boot/silo.conf -
boot/arch/sparc64/loader/asm.S
r0258e67 r965dc18 106 106 * 2. Invalidate I-cache. 107 107 * 3. Flush instruction pipeline. 108 */ 109 call icache_flush 110 membar #StoreStore 108 */ 109 110 /* 111 * US3 processors have a write-invalidate cache, so explicitly 112 * invalidating it is not required. Whether to invalidate I-cache 113 * or not is decided according to the value of the global 114 * "subarchitecture" variable (set in the bootstrap). 115 */ 116 set subarchitecture, %g2 117 ldub [%g2], %g2 118 cmp %g2, 3 119 be 1f 120 nop 121 0: 122 call icache_flush 123 nop 124 1: 125 membar #StoreStore 126 127 /* 128 * Flush the instruction pipeline. 129 */ 111 130 flush %i7 112 131 … … 135 154 ! SF Erratum #51 136 155 nop 137 138 156 .global ofw 139 157 ofw: -
boot/arch/sparc64/loader/main.c
r0258e67 r965dc18 40 40 41 41 bootinfo_t bootinfo; 42 42 43 component_t components[COMPONENTS]; 43 44 … … 55 56 char *timestamp = ""; 56 57 #endif 58 59 /** UltraSPARC subarchitecture - 1 for US, 3 for US3 */ 60 uint8_t subarchitecture; 61 62 /** 63 * mask of the MID field inside the ICBUS_CONFIG register shifted by 64 * MID_SHIFT bits to the right 65 */ 66 uint16_t mid_mask; 57 67 58 68 /** Print version information. */ … … 64 74 } 65 75 76 /* the lowest ID (read from the VER register) of some US3 CPU model */ 77 #define FIRST_US3_CPU 0x14 78 79 /* the greatest ID (read from the VER register) of some US3 CPU model */ 80 #define LAST_US3_CPU 0x19 81 82 /* UltraSPARC IIIi processor implementation code */ 83 #define US_IIIi_CODE 0x15 84 85 /** 86 * Sets the global variables "subarchitecture" and "mid_mask" to 87 * correct values. 88 */ 89 static void detect_subarchitecture(void) 90 { 91 uint64_t v; 92 asm volatile ("rdpr %%ver, %0\n" : "=r" (v)); 93 94 v = (v << 16) >> 48; 95 if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) { 96 subarchitecture = SUBARCH_US3; 97 if (v == US_IIIi_CODE) 98 mid_mask = (1 << 5) - 1; 99 else 100 mid_mask = (1 << 10) - 1; 101 } else if (v < FIRST_US3_CPU) { 102 subarchitecture = SUBARCH_US; 103 mid_mask = (1 << 5) - 1; 104 } else { 105 printf("\nThis CPU is not supported by HelenOS."); 106 } 107 } 108 66 109 void bootstrap(void) 67 110 { … … 73 116 version_print(); 74 117 118 detect_subarchitecture(); 75 119 init_components(components); 76 120 … … 84 128 halt(); 85 129 } 86 130 87 131 if (bootinfo.memmap.total == 0) { 88 132 printf("Error: no memory detected, halting.\n"); -
boot/arch/sparc64/loader/main.h
r0258e67 r965dc18 42 42 #define AP_PROCESSOR 0 43 43 44 #define SUBARCH_US 1 45 #define SUBARCH_US3 3 46 44 47 typedef struct { 45 48 void *addr; -
boot/arch/sparc64/loader/ofwarch.c
r0258e67 r965dc18 41 41 #include "asm.h" 42 42 43 /* these tho variables will be set by the detect_subarchitecture function */ 44 extern uint8_t subarchitecture; 45 extern uint16_t mid_mask; 46 43 47 void write(const char *str, const int len) 44 48 { … … 57 61 } 58 62 59 int ofw_cpu(void) 63 /** 64 * Starts all CPUs represented by following siblings of the given node, 65 * except for the current CPU. 66 * 67 * @param child The first child of the OFW tree node whose children 68 * represent CPUs to be woken up. 69 * @param current_mid MID of the current CPU, the current CPU will 70 * (of course) not be woken up. 71 * @return Number of CPUs which have the same parent node as 72 * "child". 73 */ 74 static int wake_cpus_in_node(phandle child, uint64_t current_mid) 60 75 { 76 int cpus; 61 77 char type_name[BUF_SIZE]; 62 63 phandle node;64 node = ofw_get_child_node(ofw_root);65 if (node == 0 || node == -1) {66 printf("Could not find any child nodes of the root node.\n");67 return 0;68 }69 78 70 uint64_t current_mid; 71 72 asm volatile ("ldxa [%1] %2, %0\n" 73 : "=r" (current_mid) 74 : "r" (0), "i" (ASI_UPA_CONFIG)); 75 current_mid >>= UPA_CONFIG_MID_SHIFT; 76 current_mid &= UPA_CONFIG_MID_MASK; 77 78 int cpus; 79 80 for (cpus = 0; node != 0 && node != -1; node = ofw_get_peer_node(node), 81 cpus++) { 82 if (ofw_get_property(node, "device_type", type_name, 79 for (cpus = 0; child != 0 && child != -1; 80 child = ofw_get_peer_node(child), cpus++) { 81 if (ofw_get_property(child, "device_type", type_name, 83 82 sizeof(type_name)) > 0) { 84 83 if (strcmp(type_name, "cpu") == 0) { 85 84 uint32_t mid; 86 85 87 if (ofw_get_property(node, "upa-portid", &mid, 88 sizeof(mid)) <= 0) 86 /* 87 * "upa-portid" for US, "portid" for US-III, 88 * "cpuid" for US-IV 89 */ 90 if (ofw_get_property( 91 child, "upa-portid", 92 &mid, sizeof(mid)) <= 0 93 && ofw_get_property(child, "portid", 94 &mid, sizeof(mid)) <= 0 95 && ofw_get_property(child, "cpuid", 96 &mid, sizeof(mid)) <= 0) 89 97 continue; 90 98 … … 94 102 */ 95 103 (void) ofw_call("SUNW,start-cpu", 3, 1, 96 NULL, node, KERNEL_VIRTUAL_ADDRESS,104 NULL, child, KERNEL_VIRTUAL_ADDRESS, 97 105 bootinfo.physmem_start | 98 106 AP_PROCESSOR); … … 105 113 } 106 114 115 /** 116 * Finds out the current CPU's MID and wakes up all AP processors. 117 */ 118 int ofw_cpu(void) 119 { 120 int cpus; 121 phandle node; 122 phandle subnode; 123 phandle cpus_parent; 124 phandle cmp; 125 char name[BUF_SIZE]; 126 127 /* get the current CPU MID */ 128 uint64_t current_mid; 129 130 asm volatile ("ldxa [%1] %2, %0\n" 131 : "=r" (current_mid) 132 : "r" (0), "i" (ASI_ICBUS_CONFIG)); 133 current_mid >>= ICBUS_CONFIG_MID_SHIFT; 134 135 current_mid &= mid_mask; 136 137 /* wake up CPUs */ 138 139 cpus_parent = ofw_find_device("/ssm@0,0"); 140 if (cpus_parent == 0 || cpus_parent == -1) { 141 cpus_parent = ofw_find_device("/"); 142 } 143 144 node = ofw_get_child_node(cpus_parent); 145 cpus = wake_cpus_in_node(node, current_mid); 146 while (node != 0 && node != -1) { 147 if (ofw_get_property(node, "name", name, 148 sizeof(name)) > 0) { 149 if (strcmp(name, "cmp") == 0) { 150 subnode = ofw_get_child_node(node); 151 cpus += wake_cpus_in_node(subnode, 152 current_mid); 153 } 154 } 155 node = ofw_get_peer_node(node); 156 } 157 158 return cpus; 159 160 } 161 107 162 /** Get physical memory starting address. 108 163 * 109 * @param start 110 * 164 * @param start Pointer to variable where the physical memory starting 165 * address will be stored. 111 166 * 112 * @return 167 * @return Non-zero on succes, zero on failure. 113 168 */ 114 169 int ofw_get_physmem_start(uintptr_t *start) -
boot/arch/sparc64/loader/register.h
r0258e67 r965dc18 34 34 #define PSTATE_AM_BIT 8 35 35 36 #define ASI_UPA_CONFIG 0x4a 37 #define UPA_CONFIG_MID_SHIFT 17 38 #define UPA_CONFIG_MID_MASK 0x1f 36 #define ASI_ICBUS_CONFIG 0x4a 37 #define ICBUS_CONFIG_MID_SHIFT 17 39 38 40 39 #endif -
boot/boot.config
r0258e67 r965dc18 84 84 ! RDFMT (choice) 85 85 86 # Preserve A.OUT header in isofs.b 87 ! [ARCH=sparc64] CONFIG_AOUT_ISOFS_B (y/n) 88 86 89 # External ramdisk 87 90 ! [ARCH=sparc64] CONFIG_RD_EXTERNAL (y/n) -
boot/genarch/balloc.h
r0258e67 r965dc18 32 32 #include <types.h> 33 33 34 #define BALLOC_MAX_SIZE (1 024* 1024)34 #define BALLOC_MAX_SIZE (128 * 1024) 35 35 36 36 typedef struct { -
boot/genarch/ofw.c
r0258e67 r965dc18 49 49 halt(); 50 50 51 if (ofw_get_property(ofw_chosen, "stdout", &ofw_stdout, sizeof(ofw_stdout)) <= 0) 51 if (ofw_get_property(ofw_chosen, "stdout", &ofw_stdout, 52 sizeof(ofw_stdout)) <= 0) 52 53 ofw_stdout = 0; 53 54 … … 58 59 } 59 60 60 if (ofw_get_property(ofw_chosen, "mmu", &ofw_mmu, sizeof(ofw_mmu)) <= 0) { 61 if (ofw_get_property(ofw_chosen, "mmu", &ofw_mmu, 62 sizeof(ofw_mmu)) <= 0) { 61 63 puts("\r\nError: Unable to get mmu property, halted.\r\n"); 62 64 halt(); 63 65 } 64 if (ofw_get_property(ofw_chosen, "memory", &ofw_memory_prop, sizeof(ofw_memory_prop)) <= 0) { 66 if (ofw_get_property(ofw_chosen, "memory", &ofw_memory_prop, 67 sizeof(ofw_memory_prop)) <= 0) { 65 68 puts("\r\nError: Unable to get memory property, halted.\r\n"); 66 69 halt(); … … 82 85 /** Perform a call to OpenFirmware client interface. 83 86 * 84 * @param service String identifying the service requested. 85 * @param nargs Number of input arguments. 86 * @param nret Number of output arguments. This includes the return value. 87 * @param rets Buffer for output arguments or NULL. The buffer must accommodate nret - 1 items. 88 * 89 * @return Return value returned by the client interface. 87 * @param service String identifying the service requested. 88 * @param nargs Number of input arguments. 89 * @param nret Number of output arguments. This includes the return 90 * value. 91 * @param rets Buffer for output arguments or NULL. The buffer must 92 * accommodate nret - 1 items. 93 * 94 * @return Return value returned by the client interface. 90 95 */ 91 unsigned long ofw_call(const char *service, const int nargs, const int nret, ofw_arg_t *rets, ...) 96 unsigned long 97 ofw_call(const char *service, const int nargs, const int nret, ofw_arg_t *rets, 98 ...) 92 99 { 93 100 va_list list; … … 120 127 } 121 128 122 int ofw_get_property(const phandle device, const char *name, void *buf, const int buflen) 129 int 130 ofw_get_property(const phandle device, const char *name, void *buf, 131 const int buflen) 123 132 { 124 133 return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen); … … 145 154 146 155 if (ofw_get_property(device, "#address-cells", &ret, sizeof(ret)) <= 0) 147 if (ofw_get_property(ofw_root, "#address-cells", &ret, sizeof(ret)) <= 0) 156 if (ofw_get_property(ofw_root, "#address-cells", &ret, 157 sizeof(ret)) <= 0) 148 158 ret = OFW_ADDRESS_CELLS; 149 159 … … 157 167 158 168 if (ofw_get_property(device, "#size-cells", &ret, sizeof(ret)) <= 0) 159 if (ofw_get_property(ofw_root, "#size-cells", &ret, sizeof(ret)) <= 0) 169 if (ofw_get_property(ofw_root, "#size-cells", &ret, 170 sizeof(ret)) <= 0) 160 171 ret = OFW_SIZE_CELLS; 161 172 … … 193 204 int shift; 194 205 195 if (ofw_call("call-method", 3, 5, result, "translate", ofw_mmu, virt) != 0) { 206 if (ofw_call("call-method", 3, 5, result, "translate", ofw_mmu, 207 virt) != 0) { 196 208 puts("Error: MMU method translate() failed, halting.\n"); 197 209 halt(); … … 213 225 ofw_arg_t retaddr; 214 226 215 if (ofw_call("call-method", 5, 2, &retaddr, "claim", ofw_mmu, 0, len, virt) != 0) { 227 if (ofw_call("call-method", 5, 2, &retaddr, "claim", ofw_mmu, 0, len, 228 virt) != 0) { 216 229 puts("Error: MMU method claim() failed, halting.\n"); 217 230 halt(); … … 270 283 } 271 284 272 return ofw_call("call-method", 7, 1, NULL, "map", ofw_mmu, mode, size, virt,273 phys_hi, phys_lo);285 return ofw_call("call-method", 7, 1, NULL, "map", ofw_mmu, mode, size, 286 virt, phys_hi, phys_lo); 274 287 } 275 288 … … 282 295 int ofw_memmap(memmap_t *map) 283 296 { 284 unsigned int ac = ofw_get_address_cells(ofw_memory); 285 unsigned int sc = ofw_get_size_cells(ofw_memory); 286 287 uint32_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)]; 297 unsigned int ac = ofw_get_address_cells(ofw_memory) / 298 (sizeof(uintptr_t) / sizeof(uint32_t)); 299 unsigned int sc = ofw_get_size_cells(ofw_memory) / 300 (sizeof(uintptr_t) / sizeof(uint32_t)); 301 printf("address cells: %d, size cells: %d. ", ac, sc); 302 303 uintptr_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)]; 288 304 int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(buf)); 289 305 if (ret <= 0) /* ret is the number of written bytes */ … … 293 309 map->total = 0; 294 310 map->count = 0; 295 for (pos = 0; (pos < ret / sizeof(uint 32_t)) &&311 for (pos = 0; (pos < ret / sizeof(uintptr_t)) && 296 312 (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { 297 void * start = (void *) ((uintptr_t)buf[pos + ac - 1]);313 void *start = (void *) (buf[pos + ac - 1]); 298 314 unsigned int size = buf[pos + ac + sc - 1]; 299 315 316 /* 317 * This is a hot fix of the issue which occurs on machines 318 * where there are holes in the physical memory (such as 319 * SunBlade 1500). Should we detect a hole in the physical 320 * memory, we will ignore any memory detected behind 321 * the hole and pretend the hole does not exist. 322 */ 323 if ((map->count > 0) && (map->zones[map->count - 1].start + 324 map->zones[map->count - 1].size < start)) 325 break; 326 300 327 if (size > 0) { 301 328 map->zones[map->count].start = start; … … 309 336 } 310 337 311 312 338 int ofw_screen(screen_t *screen) 313 339 { … … 315 341 uint32_t virtaddr; 316 342 317 if (ofw_get_property(ofw_aliases, "screen", device_name, sizeof(device_name)) <= 0) 343 if (ofw_get_property(ofw_aliases, "screen", device_name, 344 sizeof(device_name)) <= 0) 318 345 return false; 319 346 … … 322 349 return false; 323 350 324 if (ofw_get_property(device, "address", &virtaddr, sizeof(virtaddr)) <= 0) 351 if (ofw_get_property(device, "address", &virtaddr, 352 sizeof(virtaddr)) <= 0) 325 353 return false; 326 354 327 355 screen->addr = (void *) ((uintptr_t) virtaddr); 328 356 329 if (ofw_get_property(device, "width", &screen->width, sizeof(screen->width)) <= 0) 330 return false; 331 332 if (ofw_get_property(device, "height", &screen->height, sizeof(screen->height)) <= 0) 333 return false; 334 335 if (ofw_get_property(device, "depth", &screen->bpp, sizeof(screen->bpp)) <= 0) 336 return false; 337 338 if (ofw_get_property(device, "linebytes", &screen->scanline, sizeof(screen->scanline)) <= 0) 357 if (ofw_get_property(device, "width", &screen->width, 358 sizeof(screen->width)) <= 0) 359 return false; 360 361 if (ofw_get_property(device, "height", &screen->height, 362 sizeof(screen->height)) <= 0) 363 return false; 364 365 if (ofw_get_property(device, "depth", &screen->bpp, 366 sizeof(screen->bpp)) <= 0) 367 return false; 368 369 if (ofw_get_property(device, "linebytes", &screen->scanline, 370 sizeof(screen->scanline)) <= 0) 339 371 return false; 340 372 -
boot/genarch/ofw_tree.c
r0258e67 r965dc18 121 121 memcpy(current_node->da_name, &path[i], len); 122 122 current_node->da_name[len] = '\0'; 123 124 123 125 124 /* … … 220 219 { 221 220 ofw_tree_node_t *root; 221 phandle ssm_node; 222 ofw_tree_node_t *ssm; 222 223 223 224 root = ofw_tree_node_alloc(); 224 225 if (root) 225 226 ofw_tree_node_process(root, NULL, ofw_root); 227 228 /* 229 * The firmware client interface does not automatically include the 230 * "ssm" node in the list of children of "/". A nasty yet working 231 * solution is to explicitly stick "ssm" to the OFW tree. 232 */ 233 ssm_node = ofw_find_device("/ssm@0,0"); 234 if (ssm_node != -1) { 235 ssm = ofw_tree_node_alloc(); 236 if (ssm) { 237 ofw_tree_node_process( 238 ssm, root, ofw_find_device("/ssm@0,0")); 239 ssm->peer = root->child; 240 root->child = ssm; 241 } 242 } 226 243 227 244 return root; -
kernel/arch/arm32/src/arm32.c
r0258e67 r965dc18 87 87 88 88 #ifdef CONFIG_FB 89 fb_init(machine_get_fb_address(), 640, 480, 1920, VISUAL_RGB_8_8_8); 89 fb_properties_t prop = { 90 .addr = machine_get_fb_address(), 91 .offset = 0, 92 .x = 640, 93 .y = 480, 94 .scan = 1920, 95 .visual = VISUAL_RGB_8_8_8, 96 }; 97 fb_init(&prop); 90 98 #endif 91 99 } -
kernel/arch/ia32/src/drivers/vesa.c
r0258e67 r965dc18 87 87 } 88 88 89 fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_scanline, visual); 89 fb_properties_t vesa_props = { 90 .addr = vesa_ph_addr, 91 .offset = 0, 92 .x = vesa_width, 93 .y = vesa_height, 94 .scan = vesa_scanline, 95 .visual = visual, 96 }; 97 fb_init(&vesa_props); 90 98 } 91 99 -
kernel/arch/mips32/src/mips32.c
r0258e67 r965dc18 127 127 #ifdef CONFIG_FB 128 128 /* GXemul framebuffer */ 129 fb_init(0x12000000, 640, 480, 1920, VISUAL_RGB_8_8_8); 129 fb_properties_t gxemul_prop = { 130 .addr = 0x12000000, 131 .offset = 0, 132 .x = 640, 133 .y = 480, 134 .scan = 1920, 135 .visual = VISUAL_RGB_8_8_8, 136 }; 137 fb_init(&gxemul_prop); 130 138 #endif 131 139 sysinfo_set_item_val("machine." STRING(MACHINE), NULL, 1); -
kernel/arch/ppc32/src/ppc32.c
r0258e67 r965dc18 95 95 panic("Unsupported bits per pixel"); 96 96 } 97 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.scanline, visual); 97 fb_properties_t prop = { 98 .addr = bootinfo.screen.addr, 99 .offset = 0, 100 .x = bootinfo.screen.width, 101 .y = bootinfo.screen.height, 102 .scan = bootinfo.screen.scanline, 103 .visual = visual, 104 }; 105 fb_init(&prop); 98 106 99 107 /* Initialize IRQ routing */ … … 104 112 105 113 /* Initialize I/O controller */ 106 cuda_init(device_assign_devno(), bootinfo.keyboard.addr + 0x16000, 2 * PAGE_SIZE); 114 cuda_init(device_assign_devno(), 115 bootinfo.keyboard.addr + 0x16000, 2 * PAGE_SIZE); 107 116 108 117 /* Merge all zones to 1 big zone */ … … 129 138 void userspace(uspace_arg_t *kernel_uarg) 130 139 { 131 userspace_asm((uintptr_t) kernel_uarg->uspace_uarg, (uintptr_t) kernel_uarg->uspace_stack + THREAD_STACK_SIZE - SP_DELTA, (uintptr_t) kernel_uarg->uspace_entry); 140 userspace_asm((uintptr_t) kernel_uarg->uspace_uarg, 141 (uintptr_t) kernel_uarg->uspace_stack + 142 THREAD_STACK_SIZE - SP_DELTA, 143 (uintptr_t) kernel_uarg->uspace_entry); 132 144 133 145 /* Unreachable */ -
kernel/arch/sparc64/Makefile.inc
r0258e67 r965dc18 81 81 endif 82 82 83 ifeq ($(CONFIG_SGCN),y) 84 DEFS += -DCONFIG_SGCN 85 endif 86 87 ifeq ($(MACHINE),us) 88 DEFS += -DUS 89 endif 90 91 ifeq ($(MACHINE),us3) 92 DEFS += -DUS3 93 endif 94 83 95 ARCH_SOURCES = \ 84 96 arch/$(ARCH)/src/cpu/cpu.c \ … … 107 119 arch/$(ARCH)/src/drivers/kbd.c \ 108 120 arch/$(ARCH)/src/drivers/scr.c \ 109 arch/$(ARCH)/src/drivers/pci.c 121 arch/$(ARCH)/src/drivers/sgcn.c \ 122 arch/$(ARCH)/src/drivers/pci.c 123 110 124 111 125 ifeq ($(CONFIG_SMP),y) -
kernel/arch/sparc64/include/arch.h
r0258e67 r965dc18 42 42 #define ASI_NUCLEUS_QUAD_LDD 0x24 /** ASI for 16-byte atomic loads. */ 43 43 #define ASI_DCACHE_TAG 0x47 /** ASI D-Cache Tag. */ 44 #define ASI_ UPA_CONFIG 0x4a /** ASI of the UPA_CONFIG register. */44 #define ASI_ICBUS_CONFIG 0x4a /** ASI of the UPA_CONFIG/FIREPLANE_CONFIG register. */ 45 45 46 46 #define NWINDOWS 8 /** Number of register window sets. */ -
kernel/arch/sparc64/include/asm.h
r0258e67 r965dc18 137 137 } 138 138 139 /** Read STICK_compare Register. 140 * 141 * @return Value of STICK_compare register. 142 */ 143 static inline uint64_t stick_compare_read(void) 144 { 145 uint64_t v; 146 147 asm volatile ("rd %%asr25, %0\n" : "=r" (v)); 148 149 return v; 150 } 151 152 /** Write STICK_compare Register. 153 * 154 * @param v New value of STICK_comapre register. 155 */ 156 static inline void stick_compare_write(uint64_t v) 157 { 158 asm volatile ("wr %0, %1, %%asr25\n" : : "r" (v), "i" (0)); 159 } 160 139 161 /** Read TICK Register. 140 162 * … … 408 430 } 409 431 410 /** Read UPA_CONFIG register.411 *412 * @return Value of the UPA_CONFIG register.413 */414 static inline uint64_t upa_config_read(void)415 {416 return asi_u64_read(ASI_UPA_CONFIG, 0);417 }418 419 432 extern void cpu_halt(void); 420 433 extern void cpu_sleep(void); -
kernel/arch/sparc64/include/cpu.h
r0258e67 r965dc18 36 36 #define KERN_sparc64_CPU_H_ 37 37 38 #include <arch/types.h>39 #include <typedefs.h>40 #include <arch/register.h>41 #include <arch/asm.h>42 43 #ifdef CONFIG_SMP44 #include <arch/mm/cache.h>45 #endif46 47 38 #define MANUF_FUJITSU 0x04 48 39 #define MANUF_ULTRASPARC 0x17 /**< UltraSPARC I, UltraSPARC II */ … … 53 44 #define IMPL_ULTRASPARCII_I 0x12 54 45 #define IMPL_ULTRASPARCII_E 0x13 55 #define IMPL_ULTRASPARCIII 0x15 46 #define IMPL_ULTRASPARCIII 0x14 47 #define IMPL_ULTRASPARCIII_PLUS 0x15 48 #define IMPL_ULTRASPARCIII_I 0x16 49 #define IMPL_ULTRASPARCIV 0x18 56 50 #define IMPL_ULTRASPARCIV_PLUS 0x19 57 51 58 52 #define IMPL_SPARC64V 0x5 59 53 54 #ifndef __ASM__ 55 56 #include <arch/types.h> 57 #include <typedefs.h> 58 #include <arch/register.h> 59 #include <arch/regdef.h> 60 #include <arch/asm.h> 61 62 #ifdef CONFIG_SMP 63 #include <arch/mm/cache.h> 64 #endif 65 60 66 typedef struct { 61 67 uint32_t mid; /**< Processor ID as read from 62 UPA_CONFIG . */68 UPA_CONFIG/FIREPLANE_CONFIG. */ 63 69 ver_reg_t ver; 64 70 uint32_t clock_frequency; /**< Processor frequency in Hz. */ … … 67 73 matches this value. */ 68 74 } cpu_arch_t; 69 75 76 77 /** 78 * Reads the module ID (agent ID/CPUID) of the current CPU. 79 */ 80 static inline uint32_t read_mid(void) 81 { 82 uint64_t icbus_config = asi_u64_read(ASI_ICBUS_CONFIG, 0); 83 icbus_config = icbus_config >> ICBUS_CONFIG_MID_SHIFT; 84 #if defined (US) 85 return icbus_config & 0x1f; 86 #elif defined (US3) 87 if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIII_I) 88 return icbus_config & 0x1f; 89 else 90 return icbus_config & 0x3ff; 91 #endif 92 } 93 94 #endif 95 70 96 #endif 71 97 -
kernel/arch/sparc64/include/drivers/kbd.h
r0258e67 r965dc18 42 42 KBD_UNKNOWN, 43 43 KBD_Z8530, 44 KBD_NS16550 44 KBD_NS16550, 45 KBD_SGCN 45 46 } kbd_type_t; 46 47 -
kernel/arch/sparc64/include/drivers/scr.h
r0258e67 r965dc18 43 43 SCR_ATYFB, 44 44 SCR_FFB, 45 SCR_CGSIX 45 SCR_CGSIX, 46 SCR_XVR 46 47 } scr_type_t; 47 48 -
kernel/arch/sparc64/include/mm/cache.h
r0258e67 r965dc18 39 39 #include <mm/frame.h> 40 40 41 #define dcache_flush_page(p) \42 dcache_flush_color(PAGE_COLOR((p)))43 #define dcache_flush_frame(p, f) \44 dcache_flush_tag(PAGE_COLOR((p)), ADDR2PFN((f)));45 46 extern void dcache_flush(void);47 extern void dcache_flush_color(int c);48 extern void dcache_flush_tag(int c, pfn_t tag);49 50 41 #endif 51 42 -
kernel/arch/sparc64/include/mm/cache_spec.h
r0258e67 r965dc18 39 39 * The following macros are valid for the following processors: 40 40 * 41 * UltraSPARC, UltraSPARC II, UltraSPARC IIi 41 * UltraSPARC, UltraSPARC II, UltraSPARC IIi, UltraSPARC III, 42 * UltraSPARC III+, UltraSPARC IV, UltraSPARC IV+ 42 43 * 43 44 * Should we support other UltraSPARC processors, we need to make sure that 44 45 * the macros are defined correctly for them. 45 46 */ 46 47 48 #if defined (US) 47 49 #define DCACHE_SIZE (16 * 1024) 50 #elif defined (US3) 51 #define DCACHE_SIZE (64 * 1024) 52 #endif 48 53 #define DCACHE_LINE_SIZE 32 49 50 #define ICACHE_SIZE (16 * 1024)51 #define ICACHE_WAYS 252 #define ICACHE_LINE_SIZE 3253 54 54 55 #endif -
kernel/arch/sparc64/include/mm/frame.h
r0258e67 r965dc18 60 60 uintptr_t address; 61 61 struct { 62 #if defined (US) 62 63 unsigned : 23; 63 64 uint64_t pfn : 28; /**< Physical Frame Number. */ 65 #elif defined (US3) 66 unsigned : 21; 67 uint64_t pfn : 30; /**< Physical Frame Number. */ 68 #endif 64 69 unsigned offset : 13; /**< Offset. */ 65 70 } __attribute__ ((packed)); -
kernel/arch/sparc64/include/mm/mmu.h
r0258e67 r965dc18 36 36 #define KERN_sparc64_MMU_H_ 37 37 38 #if defined(US) 38 39 /* LSU Control Register ASI. */ 39 40 #define ASI_LSU_CONTROL_REG 0x45 /**< Load/Store Unit Control Register. */ 41 #endif 40 42 41 43 /* I-MMU ASIs. */ … … 53 55 #define VA_IMMU_TSB_BASE 0x28 /**< IMMU TSB base register. */ 54 56 #define VA_IMMU_TAG_ACCESS 0x30 /**< IMMU TLB tag access register. */ 57 #if defined (US3) 58 #define VA_IMMU_PRIMARY_EXTENSION 0x48 /**< IMMU TSB primary extension register */ 59 #define VA_IMMU_NUCLEUS_EXTENSION 0x58 /**< IMMU TSB nucleus extension register */ 60 #endif 61 55 62 56 63 /* D-MMU ASIs. */ … … 74 81 #define VA_DMMU_VA_WATCHPOINT_REG 0x38 /**< DMMU VA data watchpoint register. */ 75 82 #define VA_DMMU_PA_WATCHPOINT_REG 0x40 /**< DMMU PA data watchpoint register. */ 83 #if defined (US3) 84 #define VA_DMMU_PRIMARY_EXTENSION 0x48 /**< DMMU TSB primary extension register */ 85 #define VA_DMMU_SECONDARY_EXTENSION 0x50 /**< DMMU TSB secondary extension register */ 86 #define VA_DMMU_NUCLEUS_EXTENSION 0x58 /**< DMMU TSB nucleus extension register */ 87 #endif 76 88 77 89 #ifndef __ASM__ … … 81 93 #include <arch/types.h> 82 94 95 #if defined(US) 83 96 /** LSU Control Register. */ 84 97 typedef union { … … 101 114 } __attribute__ ((packed)); 102 115 } lsu_cr_reg_t; 116 #endif /* US */ 103 117 104 118 #endif /* !def __ASM__ */ -
kernel/arch/sparc64/include/mm/tlb.h
r0258e67 r965dc18 36 36 #define KERN_sparc64_TLB_H_ 37 37 38 #if defined (US) 38 39 #define ITLB_ENTRY_COUNT 64 39 40 #define DTLB_ENTRY_COUNT 64 41 #define DTLB_MAX_LOCKED_ENTRIES DTLB_ENTRY_COUNT 42 #endif 43 44 /** TLB_DSMALL is the only of the three DMMUs that can hold locked entries. */ 45 #if defined (US3) 46 #define DTLB_MAX_LOCKED_ENTRIES 16 47 #endif 40 48 41 49 #define MEM_CONTEXT_KERNEL 0 … … 54 62 #define TLB_DEMAP_PAGE 0 55 63 #define TLB_DEMAP_CONTEXT 1 64 #if defined (US3) 65 #define TLB_DEMAP_ALL 2 66 #endif 56 67 57 68 #define TLB_DEMAP_TYPE_SHIFT 6 … … 61 72 #define TLB_DEMAP_SECONDARY 1 62 73 #define TLB_DEMAP_NUCLEUS 2 74 75 /* There are more TLBs in one MMU in US3, their codes are defined here. */ 76 #if defined (US3) 77 /* D-MMU: one small (16-entry) TLB and two big (512-entry) TLBs */ 78 #define TLB_DSMALL 0 79 #define TLB_DBIG_0 2 80 #define TLB_DBIG_1 3 81 82 /* I-MMU: one small (16-entry) TLB and one big TLB */ 83 #define TLB_ISMALL 0 84 #define TLB_IBIG 2 85 #endif 63 86 64 87 #define TLB_DEMAP_CONTEXT_SHIFT 4 … … 77 100 #include <arch/barrier.h> 78 101 #include <arch/types.h> 102 #include <arch/register.h> 103 #include <arch/cpu.h> 79 104 80 105 union tlb_context_reg { … … 91 116 92 117 /** I-/D-TLB Data Access Address in Alternate Space. */ 118 119 #if defined (US) 120 93 121 union tlb_data_access_addr { 94 122 uint64_t value; … … 99 127 } __attribute__ ((packed)); 100 128 }; 101 typedef union tlb_data_access_addr tlb_data_access_addr_t; 102 typedef union tlb_data_access_addr tlb_tag_read_addr_t; 129 typedef union tlb_data_access_addr dtlb_data_access_addr_t; 130 typedef union tlb_data_access_addr dtlb_tag_read_addr_t; 131 typedef union tlb_data_access_addr itlb_data_access_addr_t; 132 typedef union tlb_data_access_addr itlb_tag_read_addr_t; 133 134 #elif defined (US3) 135 136 /* 137 * In US3, I-MMU and D-MMU have different formats of the data 138 * access register virtual address. In the corresponding 139 * structures the member variable for the entry number is 140 * called "local_tlb_entry" - it contrasts with the "tlb_entry" 141 * for the US data access register VA structure. The rationale 142 * behind this is to prevent careless mistakes in the code 143 * caused by setting only the entry number and not the TLB 144 * number in the US3 code (when taking the code from US). 145 */ 146 147 union dtlb_data_access_addr { 148 uint64_t value; 149 struct { 150 uint64_t : 45; 151 unsigned : 1; 152 unsigned tlb_number : 2; 153 unsigned : 4; 154 unsigned local_tlb_entry : 9; 155 unsigned : 3; 156 } __attribute__ ((packed)); 157 }; 158 typedef union dtlb_data_access_addr dtlb_data_access_addr_t; 159 typedef union dtlb_data_access_addr dtlb_tag_read_addr_t; 160 161 union itlb_data_access_addr { 162 uint64_t value; 163 struct { 164 uint64_t : 45; 165 unsigned : 1; 166 unsigned tlb_number : 2; 167 unsigned : 6; 168 unsigned local_tlb_entry : 7; 169 unsigned : 3; 170 } __attribute__ ((packed)); 171 }; 172 typedef union itlb_data_access_addr itlb_data_access_addr_t; 173 typedef union itlb_data_access_addr itlb_tag_read_addr_t; 174 175 #endif 103 176 104 177 /** I-/D-TLB Tag Read Register. */ … … 119 192 struct { 120 193 uint64_t vpn: 51; /**< Virtual Address bits 63:13. */ 194 #if defined (US) 121 195 unsigned : 6; /**< Ignored. */ 122 196 unsigned type : 1; /**< The type of demap operation. */ 197 #elif defined (US3) 198 unsigned : 5; /**< Ignored. */ 199 unsigned type: 2; /**< The type of demap operation. */ 200 #endif 123 201 unsigned context : 2; /**< Context register selection. */ 124 202 unsigned : 4; /**< Zero. */ … … 131 209 uint64_t value; 132 210 struct { 211 #if defined (US) 133 212 unsigned long : 40; /**< Implementation dependent. */ 134 213 unsigned asi : 8; /**< ASI. */ 135 214 unsigned : 2; 136 215 unsigned ft : 7; /**< Fault type. */ 216 #elif defined (US3) 217 unsigned long : 39; /**< Implementation dependent. */ 218 unsigned nf : 1; /**< Non-faulting load. */ 219 unsigned asi : 8; /**< ASI. */ 220 unsigned tm : 1; /**< I-TLB miss. */ 221 unsigned : 3; /**< Reserved. */ 222 unsigned ft : 5; /**< Fault type. */ 223 #endif 137 224 unsigned e : 1; /**< Side-effect bit. */ 138 225 unsigned ct : 2; /**< Context Register selection. */ … … 145 232 typedef union tlb_sfsr_reg tlb_sfsr_reg_t; 146 233 234 #if defined (US3) 235 236 /* 237 * Functions for determining the number of entries in TLBs. They either return 238 * a constant value or a value based on the CPU autodetection. 239 */ 240 241 /** 242 * Determine the number of entries in the DMMU's small TLB. 243 */ 244 static inline uint16_t tlb_dsmall_size(void) 245 { 246 return 16; 247 } 248 249 /** 250 * Determine the number of entries in each DMMU's big TLB. 251 */ 252 static inline uint16_t tlb_dbig_size(void) 253 { 254 return 512; 255 } 256 257 /** 258 * Determine the number of entries in the IMMU's small TLB. 259 */ 260 static inline uint16_t tlb_ismall_size(void) 261 { 262 return 16; 263 } 264 265 /** 266 * Determine the number of entries in the IMMU's big TLB. 267 */ 268 static inline uint16_t tlb_ibig_size(void) 269 { 270 if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIV_PLUS) 271 return 512; 272 else 273 return 128; 274 } 275 276 #endif 277 147 278 /** Read MMU Primary Context Register. 148 279 * 149 * @return 280 * @return Current value of Primary Context Register. 150 281 */ 151 282 static inline uint64_t mmu_primary_context_read(void) … … 156 287 /** Write MMU Primary Context Register. 157 288 * 158 * @param v 289 * @param v New value of Primary Context Register. 159 290 */ 160 291 static inline void mmu_primary_context_write(uint64_t v) … … 166 297 /** Read MMU Secondary Context Register. 167 298 * 168 * @return 299 * @return Current value of Secondary Context Register. 169 300 */ 170 301 static inline uint64_t mmu_secondary_context_read(void) … … 175 306 /** Write MMU Primary Context Register. 176 307 * 177 * @param v 308 * @param v New value of Primary Context Register. 178 309 */ 179 310 static inline void mmu_secondary_context_write(uint64_t v) … … 183 314 } 184 315 316 #if defined (US) 317 185 318 /** Read IMMU TLB Data Access Register. 186 319 * 187 * @param entry TLB Entry index. 188 * 189 * @return Current value of specified IMMU TLB Data Access Register. 320 * @param entry TLB Entry index. 321 * 322 * @return Current value of specified IMMU TLB Data Access 323 * Register. 190 324 */ 191 325 static inline uint64_t itlb_data_access_read(index_t entry) 192 326 { 193 tlb_data_access_addr_t reg;327 itlb_data_access_addr_t reg; 194 328 195 329 reg.value = 0; … … 200 334 /** Write IMMU TLB Data Access Register. 201 335 * 202 * @param entry 203 * @param value 336 * @param entry TLB Entry index. 337 * @param value Value to be written. 204 338 */ 205 339 static inline void itlb_data_access_write(index_t entry, uint64_t value) 206 340 { 207 tlb_data_access_addr_t reg;341 itlb_data_access_addr_t reg; 208 342 209 343 reg.value = 0; … … 215 349 /** Read DMMU TLB Data Access Register. 216 350 * 217 * @param entry TLB Entry index. 218 * 219 * @return Current value of specified DMMU TLB Data Access Register. 351 * @param entry TLB Entry index. 352 * 353 * @return Current value of specified DMMU TLB Data Access 354 * Register. 220 355 */ 221 356 static inline uint64_t dtlb_data_access_read(index_t entry) 222 357 { 223 tlb_data_access_addr_t reg;358 dtlb_data_access_addr_t reg; 224 359 225 360 reg.value = 0; … … 230 365 /** Write DMMU TLB Data Access Register. 231 366 * 232 * @param entry 233 * @param value 367 * @param entry TLB Entry index. 368 * @param value Value to be written. 234 369 */ 235 370 static inline void dtlb_data_access_write(index_t entry, uint64_t value) 236 371 { 237 tlb_data_access_addr_t reg;372 dtlb_data_access_addr_t reg; 238 373 239 374 reg.value = 0; … … 245 380 /** Read IMMU TLB Tag Read Register. 246 381 * 247 * @param entry 248 * 249 * @return 382 * @param entry TLB Entry index. 383 * 384 * @return Current value of specified IMMU TLB Tag Read Register. 250 385 */ 251 386 static inline uint64_t itlb_tag_read_read(index_t entry) 252 387 { 253 tlb_tag_read_addr_t tag;388 itlb_tag_read_addr_t tag; 254 389 255 390 tag.value = 0; … … 260 395 /** Read DMMU TLB Tag Read Register. 261 396 * 262 * @param entry 263 * 264 * @return 397 * @param entry TLB Entry index. 398 * 399 * @return Current value of specified DMMU TLB Tag Read Register. 265 400 */ 266 401 static inline uint64_t dtlb_tag_read_read(index_t entry) 267 402 { 268 tlb_tag_read_addr_t tag;403 dtlb_tag_read_addr_t tag; 269 404 270 405 tag.value = 0; … … 273 408 } 274 409 410 #elif defined (US3) 411 412 413 /** Read IMMU TLB Data Access Register. 414 * 415 * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) 416 * @param entry TLB Entry index. 417 * 418 * @return Current value of specified IMMU TLB Data Access 419 * Register. 420 */ 421 static inline uint64_t itlb_data_access_read(int tlb, index_t entry) 422 { 423 itlb_data_access_addr_t reg; 424 425 reg.value = 0; 426 reg.tlb_number = tlb; 427 reg.local_tlb_entry = entry; 428 return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); 429 } 430 431 /** Write IMMU TLB Data Access Register. 432 * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) 433 * @param entry TLB Entry index. 434 * @param value Value to be written. 435 */ 436 static inline void itlb_data_access_write(int tlb, index_t entry, 437 uint64_t value) 438 { 439 itlb_data_access_addr_t reg; 440 441 reg.value = 0; 442 reg.tlb_number = tlb; 443 reg.local_tlb_entry = entry; 444 asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value); 445 flush_pipeline(); 446 } 447 448 /** Read DMMU TLB Data Access Register. 449 * 450 * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG, TLB_DBIG) 451 * @param entry TLB Entry index. 452 * 453 * @return Current value of specified DMMU TLB Data Access 454 * Register. 455 */ 456 static inline uint64_t dtlb_data_access_read(int tlb, index_t entry) 457 { 458 dtlb_data_access_addr_t reg; 459 460 reg.value = 0; 461 reg.tlb_number = tlb; 462 reg.local_tlb_entry = entry; 463 return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); 464 } 465 466 /** Write DMMU TLB Data Access Register. 467 * 468 * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1) 469 * @param entry TLB Entry index. 470 * @param value Value to be written. 471 */ 472 static inline void dtlb_data_access_write(int tlb, index_t entry, 473 uint64_t value) 474 { 475 dtlb_data_access_addr_t reg; 476 477 reg.value = 0; 478 reg.tlb_number = tlb; 479 reg.local_tlb_entry = entry; 480 asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value); 481 membar(); 482 } 483 484 /** Read IMMU TLB Tag Read Register. 485 * 486 * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) 487 * @param entry TLB Entry index. 488 * 489 * @return Current value of specified IMMU TLB Tag Read Register. 490 */ 491 static inline uint64_t itlb_tag_read_read(int tlb, index_t entry) 492 { 493 itlb_tag_read_addr_t tag; 494 495 tag.value = 0; 496 tag.tlb_number = tlb; 497 tag.local_tlb_entry = entry; 498 return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); 499 } 500 501 /** Read DMMU TLB Tag Read Register. 502 * 503 * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1) 504 * @param entry TLB Entry index. 505 * 506 * @return Current value of specified DMMU TLB Tag Read Register. 507 */ 508 static inline uint64_t dtlb_tag_read_read(int tlb, index_t entry) 509 { 510 dtlb_tag_read_addr_t tag; 511 512 tag.value = 0; 513 tag.tlb_number = tlb; 514 tag.local_tlb_entry = entry; 515 return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value); 516 } 517 518 #endif 519 520 275 521 /** Write IMMU TLB Tag Access Register. 276 522 * 277 * @param v 523 * @param v Value to be written. 278 524 */ 279 525 static inline void itlb_tag_access_write(uint64_t v) … … 285 531 /** Read IMMU TLB Tag Access Register. 286 532 * 287 * @return 533 * @return Current value of IMMU TLB Tag Access Register. 288 534 */ 289 535 static inline uint64_t itlb_tag_access_read(void) … … 294 540 /** Write DMMU TLB Tag Access Register. 295 541 * 296 * @param v 542 * @param v Value to be written. 297 543 */ 298 544 static inline void dtlb_tag_access_write(uint64_t v) … … 304 550 /** Read DMMU TLB Tag Access Register. 305 551 * 306 * @return Current value of DMMU TLB Tag Access Register.552 * @return Current value of DMMU TLB Tag Access Register. 307 553 */ 308 554 static inline uint64_t dtlb_tag_access_read(void) … … 314 560 /** Write IMMU TLB Data in Register. 315 561 * 316 * @param v 562 * @param v Value to be written. 317 563 */ 318 564 static inline void itlb_data_in_write(uint64_t v) … … 324 570 /** Write DMMU TLB Data in Register. 325 571 * 326 * @param v 572 * @param v Value to be written. 327 573 */ 328 574 static inline void dtlb_data_in_write(uint64_t v) … … 334 580 /** Read ITLB Synchronous Fault Status Register. 335 581 * 336 * @return 582 * @return Current content of I-SFSR register. 337 583 */ 338 584 static inline uint64_t itlb_sfsr_read(void) … … 343 589 /** Write ITLB Synchronous Fault Status Register. 344 590 * 345 * @param v 591 * @param v New value of I-SFSR register. 346 592 */ 347 593 static inline void itlb_sfsr_write(uint64_t v) … … 353 599 /** Read DTLB Synchronous Fault Status Register. 354 600 * 355 * @return 601 * @return Current content of D-SFSR register. 356 602 */ 357 603 static inline uint64_t dtlb_sfsr_read(void) … … 362 608 /** Write DTLB Synchronous Fault Status Register. 363 609 * 364 * @param v 610 * @param v New value of D-SFSR register. 365 611 */ 366 612 static inline void dtlb_sfsr_write(uint64_t v) … … 372 618 /** Read DTLB Synchronous Fault Address Register. 373 619 * 374 * @return 620 * @return Current content of D-SFAR register. 375 621 */ 376 622 static inline uint64_t dtlb_sfar_read(void) … … 381 627 /** Perform IMMU TLB Demap Operation. 382 628 * 383 * @param type Selects between context and page demap. 629 * @param type Selects between context and page demap (and entire MMU 630 * demap on US3). 384 631 * @param context_encoding Specifies which Context register has Context ID for 385 * demap.386 * @param page 632 * demap. 633 * @param page Address which is on the page to be demapped. 387 634 */ 388 635 static inline void itlb_demap(int type, int context_encoding, uintptr_t page) … … 398 645 da.vpn = pg.vpn; 399 646 400 asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); /* da.value is the401 * address within the402 * ASI */ 647 /* da.value is the address within the ASI */ 648 asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); 649 403 650 flush_pipeline(); 404 651 } … … 406 653 /** Perform DMMU TLB Demap Operation. 407 654 * 408 * @param type Selects between context and page demap. 655 * @param type Selects between context and page demap (and entire MMU 656 * demap on US3). 409 657 * @param context_encoding Specifies which Context register has Context ID for 410 * 411 * @param page 658 * demap. 659 * @param page Address which is on the page to be demapped. 412 660 */ 413 661 static inline void dtlb_demap(int type, int context_encoding, uintptr_t page) … … 423 671 da.vpn = pg.vpn; 424 672 425 asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); /* da.value is the426 * address within the427 * ASI */ 673 /* da.value is the address within the ASI */ 674 asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); 675 428 676 membar(); 429 677 } 430 678 431 extern void fast_instruction_access_mmu_miss(unative_t unused, istate_t *istate);432 extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate);433 extern void fast_data_access_protection(tlb_tag_access_reg_t tag , istate_t *istate);434 435 extern void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, bool locked, bool cacheable);679 extern void fast_instruction_access_mmu_miss(unative_t, istate_t *); 680 extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t, istate_t *); 681 extern void fast_data_access_protection(tlb_tag_access_reg_t , istate_t *); 682 683 extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool); 436 684 437 685 extern void dump_sfsr_and_sfar(void); -
kernel/arch/sparc64/include/mm/tsb.h
r0258e67 r965dc18 108 108 } 109 109 110 #if defined (US3) 111 112 /** Write DTSB Primary Extension register. 113 * 114 * @param v New content of the DTSB Primary Extension register. 115 */ 116 static inline void dtsb_primary_extension_write(uint64_t v) 117 { 118 asi_u64_write(ASI_DMMU, VA_DMMU_PRIMARY_EXTENSION, v); 119 } 120 121 /** Write DTSB Secondary Extension register. 122 * 123 * @param v New content of the DTSB Secondary Extension register. 124 */ 125 static inline void dtsb_secondary_extension_write(uint64_t v) 126 { 127 asi_u64_write(ASI_DMMU, VA_DMMU_SECONDARY_EXTENSION, v); 128 } 129 130 /** Write DTSB Nucleus Extension register. 131 * 132 * @param v New content of the DTSB Nucleus Extension register. 133 */ 134 static inline void dtsb_nucleus_extension_write(uint64_t v) 135 { 136 asi_u64_write(ASI_DMMU, VA_DMMU_NUCLEUS_EXTENSION, v); 137 } 138 139 /** Write ITSB Primary Extension register. 140 * 141 * @param v New content of the ITSB Primary Extension register. 142 */ 143 static inline void itsb_primary_extension_write(uint64_t v) 144 { 145 asi_u64_write(ASI_IMMU, VA_IMMU_PRIMARY_EXTENSION, v); 146 } 147 148 /** Write ITSB Nucleus Extension register. 149 * 150 * @param v New content of the ITSB Nucleus Extension register. 151 */ 152 static inline void itsb_nucleus_extension_write(uint64_t v) 153 { 154 asi_u64_write(ASI_IMMU, VA_IMMU_NUCLEUS_EXTENSION, v); 155 } 156 157 #endif 158 110 159 /* Forward declarations. */ 111 160 struct as; -
kernel/arch/sparc64/include/mm/tte.h
r0258e67 r965dc18 51 51 #include <arch/types.h> 52 52 53 /* TTE tag's VA_tag field contains bits <63:VA_TAG_PAGE_SHIFT> of the VA */ 53 54 #define VA_TAG_PAGE_SHIFT 22 54 55 … … 76 77 unsigned ie : 1; /**< Invert Endianness. */ 77 78 unsigned soft2 : 9; /**< Software defined field. */ 79 #if defined (US) 78 80 unsigned diag : 9; /**< Diagnostic data. */ 79 81 unsigned pfn : 28; /**< Physical Address bits, bits 40:13. */ 82 #elif defined (US3) 83 unsigned : 7; /**< Reserved. */ 84 unsigned pfn : 30; /**< Physical Address bits, bits 42:13 */ 85 #endif 80 86 unsigned soft : 6; /**< Software defined field. */ 81 87 unsigned l : 1; /**< Lock. */ -
kernel/arch/sparc64/include/regdef.h
r0258e67 r965dc18 56 56 #define WSTATE_OTHER(n) ((n) << 3) 57 57 58 #define UPA_CONFIG_MID_SHIFT 17 59 #define UPA_CONFIG_MID_MASK 0x1f 58 /* 59 * The following definitions concern the UPA_CONFIG register on US and the 60 * FIREPLANE_CONFIG register on US3. 61 */ 62 #define ICBUS_CONFIG_MID_SHIFT 17 60 63 61 64 #endif -
kernel/arch/sparc64/include/register.h
r0258e67 r965dc18 118 118 typedef union fprs_reg fprs_reg_t; 119 119 120 /** UPA_CONFIG register.121 *122 * Note that format of this register differs significantly from123 * processor version to version. The format defined here124 * is the common subset for all supported processor versions.125 */126 union upa_config {127 uint64_t value;128 struct {129 uint64_t : 34;130 unsigned pcon : 8; /**< Processor configuration. */131 unsigned mid : 5; /**< Module (processor) ID register. */132 unsigned pcap : 17; /**< Processor capabilities. */133 } __attribute__ ((packed));134 };135 typedef union upa_config upa_config_t;136 137 120 #endif 138 121 -
kernel/arch/sparc64/include/trap/interrupt.h
r0258e67 r965dc18 50 50 51 51 /* Interrupt ASI registers. */ 52 #define ASI_ UDB_INTR_W 0x7752 #define ASI_INTR_W 0x77 53 53 #define ASI_INTR_DISPATCH_STATUS 0x48 54 #define ASI_ UDB_INTR_R 0x7f54 #define ASI_INTR_R 0x7f 55 55 #define ASI_INTR_RECEIVE 0x49 56 56 57 /* VA's used with ASI_UDB_INTR_W register. */ 57 /* VA's used with ASI_INTR_W register. */ 58 #if defined (US) 58 59 #define ASI_UDB_INTR_W_DATA_0 0x40 59 60 #define ASI_UDB_INTR_W_DATA_1 0x50 60 61 #define ASI_UDB_INTR_W_DATA_2 0x60 61 #define ASI_UDB_INTR_W_DISPATCH 0x70 62 #elif defined (US3) 63 #define VA_INTR_W_DATA_0 0x40 64 #define VA_INTR_W_DATA_1 0x48 65 #define VA_INTR_W_DATA_2 0x50 66 #define VA_INTR_W_DATA_3 0x58 67 #define VA_INTR_W_DATA_4 0x60 68 #define VA_INTR_W_DATA_5 0x68 69 #define VA_INTR_W_DATA_6 0x80 70 #define VA_INTR_W_DATA_7 0x88 71 #endif 72 #define VA_INTR_W_DISPATCH 0x70 62 73 63 /* VA's used with ASI_UDB_INTR_R register. */ 74 /* VA's used with ASI_INTR_R register. */ 75 #if defined(US) 64 76 #define ASI_UDB_INTR_R_DATA_0 0x40 65 77 #define ASI_UDB_INTR_R_DATA_1 0x50 66 78 #define ASI_UDB_INTR_R_DATA_2 0x60 79 #elif defined (US3) 80 #define VA_INTR_R_DATA_0 0x40 81 #define VA_INTR_R_DATA_1 0x48 82 #define VA_INTR_R_DATA_2 0x50 83 #define VA_INTR_R_DATA_3 0x58 84 #define VA_INTR_R_DATA_4 0x60 85 #define VA_INTR_R_DATA_5 0x68 86 #define VA_INTR_R_DATA_6 0x80 87 #define VA_INTR_R_DATA_7 0x88 88 #endif 67 89 68 90 /* Shifts in the Interrupt Vector Dispatch virtual address. */ -
kernel/arch/sparc64/src/console.c
r0258e67 r965dc18 39 39 #include <arch/drivers/kbd.h> 40 40 41 #include <arch/drivers/sgcn.h> 42 41 43 #ifdef CONFIG_Z8530 42 44 #include <genarch/kbd/z8530.h> … … 55 57 #include <arch.h> 56 58 #include <panic.h> 59 #include <func.h> 57 60 #include <print.h> 58 61 59 62 #define KEYBOARD_POLL_PAUSE 50000 /* 50ms */ 60 63 61 /** Initialize kernel console to use framebuffer and keyboard directly. */ 62 void standalone_sparc64_console_init(void) 64 /** 65 * Initialize kernel console to use framebuffer and keyboard directly. 66 * Called on UltraSPARC machines with standard keyboard and framebuffer. 67 * 68 * @param aliases the "/aliases" OBP node 69 */ 70 static void standard_console_init(ofw_tree_node_t *aliases) 63 71 { 64 72 stdin = NULL; 65 73 66 ofw_tree_node_t *aliases;67 74 ofw_tree_property_t *prop; 68 75 ofw_tree_node_t *screen; 69 76 ofw_tree_node_t *keyboard; 70 71 aliases = ofw_tree_lookup("/aliases");72 if (!aliases)73 panic("Can't find /aliases.\n");74 77 75 78 prop = ofw_tree_getprop(aliases, "screen"); … … 96 99 } 97 100 101 /** Initilize I/O on the Serengeti machine. */ 102 static void serengeti_init(void) 103 { 104 sgcn_init(); 105 } 106 107 /** 108 * Initialize input/output. Auto-detects the type of machine 109 * and calls the appropriate I/O init routine. 110 */ 111 void standalone_sparc64_console_init(void) 112 { 113 ofw_tree_node_t *aliases; 114 ofw_tree_property_t *prop; 115 116 aliases = ofw_tree_lookup("/aliases"); 117 if (!aliases) 118 panic("Can't find /aliases.\n"); 119 120 /* "def-cn" = "default console" */ 121 prop = ofw_tree_getprop(aliases, "def-cn"); 122 123 if ((!prop) || (!prop->value) || (strcmp(prop->value, "/sgcn") != 0)) { 124 standard_console_init(aliases); 125 } else { 126 serengeti_init(); 127 } 128 } 129 130 98 131 /** Kernel thread for polling keyboard. 99 132 * … … 130 163 #endif 131 164 #endif 165 #ifdef CONFIG_SGCN 166 if (kbd_type == KBD_SGCN) 167 sgcn_poll(); 168 #endif 132 169 thread_usleep(KEYBOARD_POLL_PAUSE); 133 170 } … … 150 187 break; 151 188 #endif 189 #ifdef CONFIG_SGCN 190 case KBD_SGCN: 191 sgcn_grab(); 192 break; 193 #endif 152 194 default: 153 195 break; … … 171 213 break; 172 214 #endif 215 #ifdef CONFIG_SGCN 216 case KBD_SGCN: 217 sgcn_release(); 218 break; 219 #endif 173 220 default: 174 221 break; -
kernel/arch/sparc64/src/cpu/cpu.c
r0258e67 r965dc18 33 33 */ 34 34 35 #include <arch/cpu_family.h> 35 36 #include <cpu.h> 36 37 #include <arch.h> … … 38 39 #include <arch/drivers/tick.h> 39 40 #include <print.h> 41 #include <arch/cpu_node.h> 42 43 /** 44 * Finds out the clock frequency of the current CPU. 45 * 46 * @param node node representing the current CPU in the OFW tree 47 * @return clock frequency if "node" is the current CPU and no error 48 * occurs, -1 if "node" is not the current CPU or on error 49 */ 50 static int find_cpu_frequency(ofw_tree_node_t *node) 51 { 52 ofw_tree_property_t *prop; 53 uint32_t mid; 54 55 /* 'upa-portid' for US, 'portid' for US-III, 'cpuid' for US-IV */ 56 prop = ofw_tree_getprop(node, "upa-portid"); 57 if ((!prop) || (!prop->value)) 58 prop = ofw_tree_getprop(node, "portid"); 59 if ((!prop) || (!prop->value)) 60 prop = ofw_tree_getprop(node, "cpuid"); 61 62 if (prop && prop->value) { 63 mid = *((uint32_t *) prop->value); 64 if (mid == CPU->arch.mid) { 65 prop = ofw_tree_getprop(node, "clock-frequency"); 66 if (prop && prop->value) { 67 return *((uint32_t *) prop->value); 68 } 69 } 70 } 71 72 return -1; 73 } 40 74 41 75 /** Perform sparc64 specific initialization of the processor structure for the … … 45 79 { 46 80 ofw_tree_node_t *node; 47 uint32_t mid;48 81 uint32_t clock_frequency = 0; 49 upa_config_t upa_config;50 82 51 upa_config.value = upa_config_read(); 52 CPU->arch.mid = upa_config.mid; 83 CPU->arch.mid = read_mid(); 53 84 54 85 /* 55 86 * Detect processor frequency. 56 87 */ 57 node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu"); 58 while (node) { 59 ofw_tree_property_t *prop; 88 if (is_us() || is_us_iii()) { 89 node = ofw_tree_find_child_by_device_type(cpus_parent(), "cpu"); 90 while (node) { 91 int f = find_cpu_frequency(node); 92 if (f != -1) 93 clock_frequency = (uint32_t) f; 94 node = ofw_tree_find_peer_by_device_type(node, "cpu"); 95 } 96 } else if (is_us_iv()) { 97 node = ofw_tree_find_child(cpus_parent(), "cmp"); 98 while (node) { 99 int f; 100 f = find_cpu_frequency( 101 ofw_tree_find_child(node, "cpu@0")); 102 if (f != -1) 103 clock_frequency = (uint32_t) f; 104 f = find_cpu_frequency( 105 ofw_tree_find_child(node, "cpu@1")); 106 if (f != -1) 107 clock_frequency = (uint32_t) f; 108 node = ofw_tree_find_peer_by_name(node, "cmp"); 109 } 110 } 60 111 61 prop = ofw_tree_getprop(node, "upa-portid");62 if (prop && prop->value) {63 mid = *((uint32_t *) prop->value);64 if (mid == CPU->arch.mid) {65 prop = ofw_tree_getprop(node,66 "clock-frequency");67 if (prop && prop->value)68 clock_frequency = *((uint32_t *)69 prop->value);70 }71 }72 node = ofw_tree_find_peer_by_device_type(node, "cpu");73 }74 75 112 CPU->arch.clock_frequency = clock_frequency; 76 113 tick_init(); … … 125 162 impl = "UltraSPARC III"; 126 163 break; 164 case IMPL_ULTRASPARCIII_PLUS: 165 impl = "UltraSPARC III+"; 166 break; 167 case IMPL_ULTRASPARCIII_I: 168 impl = "UltraSPARC IIIi"; 169 break; 170 case IMPL_ULTRASPARCIV: 171 impl = "UltraSPARC IV"; 172 break; 127 173 case IMPL_ULTRASPARCIV_PLUS: 128 174 impl = "UltraSPARC IV+"; -
kernel/arch/sparc64/src/ddi/ddi.c
r0258e67 r965dc18 42 42 * 43 43 * @param task Task. 44 * @param ioaddr Starti gnI/O space address.44 * @param ioaddr Starting I/O space address. 45 45 * @param size Size of the enabled I/O range. 46 46 * -
kernel/arch/sparc64/src/drivers/scr.c
r0258e67 r965dc18 56 56 { 57 57 ofw_tree_property_t *prop; 58 ofw_pci_reg_t *pci_reg; 59 ofw_pci_reg_t pci_abs_reg; 60 ofw_upa_reg_t *upa_reg; 61 ofw_sbus_reg_t *sbus_reg; 58 62 const char *name; 59 63 … … 62 66 if (strcmp(name, "SUNW,m64B") == 0) 63 67 scr_type = SCR_ATYFB; 68 else if (strcmp(name, "SUNW,XVR-100") == 0) 69 scr_type = SCR_XVR; 64 70 else if (strcmp(name, "SUNW,ffb") == 0) 65 71 scr_type = SCR_FFB; … … 68 74 69 75 if (scr_type == SCR_UNKNOWN) { 70 printf("Unknown keyboarddevice.\n");76 printf("Unknown screen device.\n"); 71 77 return; 72 78 } … … 107 113 } 108 114 109 ofw_pci_reg_t *fb_reg = &((ofw_pci_reg_t *) prop->value)[1]; 110 ofw_pci_reg_t abs_reg; 111 112 if (!ofw_pci_reg_absolutize(node, fb_reg, &abs_reg)) { 115 pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; 116 117 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 113 118 printf("Failed to absolutize fb register.\n"); 114 119 return; 115 120 } 116 121 117 if (!ofw_pci_apply_ranges(node->parent, &abs_reg , &fb_addr)) { 122 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 123 &fb_addr)) { 118 124 printf("Failed to determine screen address.\n"); 119 125 return; … … 143 149 144 150 break; 151 case SCR_XVR: 152 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 153 printf("Too few screen registers.\n"); 154 return; 155 } 156 157 pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; 158 159 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 160 printf("Failed to absolutize fb register.\n"); 161 return; 162 } 163 164 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 165 &fb_addr)) { 166 printf("Failed to determine screen address.\n"); 167 return; 168 } 169 170 switch (fb_depth) { 171 case 8: 172 fb_scanline = fb_linebytes * (fb_depth >> 3); 173 visual = VISUAL_SB1500_PALETTE; 174 break; 175 case 16: 176 fb_scanline = fb_linebytes * (fb_depth >> 3); 177 visual = VISUAL_RGB_5_6_5; 178 break; 179 case 24: 180 fb_scanline = fb_linebytes * 4; 181 visual = VISUAL_RGB_8_8_8_0; 182 break; 183 case 32: 184 fb_scanline = fb_linebytes * (fb_depth >> 3); 185 visual = VISUAL_RGB_0_8_8_8; 186 break; 187 default: 188 printf("Unsupported bits per pixel.\n"); 189 return; 190 } 191 192 break; 145 193 case SCR_FFB: 146 194 fb_scanline = 8192; 147 195 visual = VISUAL_BGR_0_8_8_8; 148 196 149 ofw_upa_reg_t *reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP];150 if (!ofw_upa_apply_ranges(node->parent, reg, &fb_addr)) {197 upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; 198 if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) { 151 199 printf("Failed to determine screen address.\n"); 152 200 return; … … 165 213 } 166 214 167 ofw_sbus_reg_t *cg6_reg = &((ofw_sbus_reg_t *) prop->value)[0];168 if (!ofw_sbus_apply_ranges(node->parent, cg6_reg, &fb_addr)) {215 sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; 216 if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { 169 217 printf("Failed to determine screen address.\n"); 170 218 return; … … 176 224 } 177 225 178 fb_init(fb_addr, fb_width, fb_height, fb_scanline, visual); 226 fb_properties_t props = { 227 .addr = fb_addr, 228 .offset = 0, 229 .x = fb_width, 230 .y = fb_height, 231 .scan = fb_scanline, 232 .visual = visual, 233 }; 234 fb_init(&props); 179 235 } 180 236 -
kernel/arch/sparc64/src/drivers/tick.c
r0258e67 r965dc18 46 46 #define TICK_RESTART_TIME 50 /* Worst case estimate. */ 47 47 48 /** Initialize tick interrupt. */48 /** Initialize tick and stick interrupt. */ 49 49 void tick_init(void) 50 50 { 51 /* initialize TICK interrupt */ 51 52 tick_compare_reg_t compare; 52 53 53 54 interrupt_register(14, "tick_int", tick_interrupt); 54 55 compare.int_dis = false; … … 57 58 tick_compare_write(compare.value); 58 59 tick_write(0); 60 61 #if defined (US3) 62 /* disable STICK interrupts and clear any pending ones */ 63 tick_compare_reg_t stick_compare; 64 softint_reg_t clear; 65 66 stick_compare.value = stick_compare_read(); 67 stick_compare.int_dis = true; 68 stick_compare.tick_cmpr = 0; 69 stick_compare_write(stick_compare.value); 70 71 clear.value = 0; 72 clear.stick_int = 1; 73 clear_softint_write(clear.value); 74 #endif 59 75 } 60 76 … … 68 84 softint_reg_t softint, clear; 69 85 uint64_t drift; 70 86 71 87 softint.value = softint_read(); 72 88 -
kernel/arch/sparc64/src/mm/as.c
r0258e67 r965dc18 165 165 tsb_base.base = ((uintptr_t) as->arch.dtsb) >> MMU_PAGE_WIDTH; 166 166 dtsb_base_write(tsb_base.value); 167 168 #if defined (US3) 169 /* 170 * Clear the extension registers. 171 * In HelenOS, primary and secondary context registers contain 172 * equal values and kernel misses (context 0, ie. the nucleus context) 173 * are excluded from the TSB miss handler, so it makes no sense 174 * to have separate TSBs for primary, secondary and nucleus contexts. 175 * Clearing the extension registers will ensure that the value of the 176 * TSB Base register will be used as an address of TSB, making the code 177 * compatible with the US port. 178 */ 179 itsb_primary_extension_write(0); 180 itsb_nucleus_extension_write(0); 181 dtsb_primary_extension_write(0); 182 dtsb_secondary_extension_write(0); 183 dtsb_nucleus_extension_write(0); 184 #endif 167 185 #endif 168 186 } -
kernel/arch/sparc64/src/mm/cache.S
r0258e67 r965dc18 48 48 ! beware SF Erratum #51, do not put the MEMBAR here 49 49 nop 50 51 /** Flush only D-cache lines of one virtual color.52 *53 * @param o0 Virtual color to be flushed.54 */55 .global dcache_flush_color56 dcache_flush_color:57 mov (DCACHE_SIZE / DCACHE_LINE_SIZE) / 2, %g158 set DCACHE_SIZE / 2, %g259 sllx %g2, %o0, %g260 sub %g2, DCACHE_LINE_SIZE, %g261 0: stxa %g0, [%g2] ASI_DCACHE_TAG62 membar #Sync63 subcc %g1, 1, %g164 bnz,pt %xcc, 0b65 sub %g2, DCACHE_LINE_SIZE, %g266 retl67 nop68 69 /** Flush only D-cache lines of one virtual color and one tag.70 *71 * @param o0 Virtual color to lookup the tag.72 * @param o1 Tag of the cachelines to be flushed.73 */74 .global dcache_flush_tag75 dcache_flush_tag:76 mov (DCACHE_SIZE / DCACHE_LINE_SIZE) / 2, %g177 set DCACHE_SIZE / 2, %g278 sllx %g2, %o0, %g279 sub %g2, DCACHE_LINE_SIZE, %g280 0: ldxa [%g2] ASI_DCACHE_TAG, %g381 srlx %g3, DCACHE_TAG_SHIFT, %g382 cmp %g3, %o183 bnz 1f84 nop85 stxa %g0, [%g2] ASI_DCACHE_TAG86 membar #Sync87 1: subcc %g1, 1, %g188 bnz,pt %xcc, 0b89 sub %g2, DCACHE_LINE_SIZE, %g290 retl91 nop -
kernel/arch/sparc64/src/mm/page.c
r0258e67 r965dc18 53 53 uintptr_t phys_page; 54 54 int pagesize_code; 55 } bsp_locked_dtlb_entry[DTLB_ ENTRY_COUNT];55 } bsp_locked_dtlb_entry[DTLB_MAX_LOCKED_ENTRIES]; 56 56 57 57 /** Number of entries in bsp_locked_dtlb_entry array. */ … … 167 167 /** @} 168 168 */ 169 -
kernel/arch/sparc64/src/mm/tlb.c
r0258e67 r965dc18 55 55 #endif 56 56 57 static void dtlb_pte_copy(pte_t *t, index_t index, bool ro); 58 static void itlb_pte_copy(pte_t *t, index_t index); 59 static void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, 60 const char *str); 61 static void do_fast_data_access_mmu_miss_fault(istate_t *istate, 62 tlb_tag_access_reg_t tag, const char *str); 63 static void do_fast_data_access_protection_fault(istate_t *istate, 64 tlb_tag_access_reg_t tag, const char *str); 57 static void dtlb_pte_copy(pte_t *, index_t, bool); 58 static void itlb_pte_copy(pte_t *, index_t); 59 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, const char *); 60 static void do_fast_data_access_mmu_miss_fault(istate_t *, tlb_tag_access_reg_t, 61 const char *); 62 static void do_fast_data_access_protection_fault(istate_t *, 63 tlb_tag_access_reg_t, const char *); 65 64 66 65 char *context_encoding[] = { … … 87 86 /** Insert privileged mapping into DMMU TLB. 88 87 * 89 * @param page 90 * @param frame 91 * @param pagesize 92 * @param locked 93 * @param cacheable 88 * @param page Virtual page address. 89 * @param frame Physical frame address. 90 * @param pagesize Page size. 91 * @param locked True for permanent mappings, false otherwise. 92 * @param cacheable True if the mapping is cacheable, false otherwise. 94 93 */ 95 94 void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, … … 104 103 fr.address = frame; 105 104 106 tag. value= ASID_KERNEL;105 tag.context = ASID_KERNEL; 107 106 tag.vpn = pg.vpn; 108 107 … … 127 126 /** Copy PTE to TLB. 128 127 * 129 * @param t Page Table Entry to be copied.130 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.131 * @param ro If true, the entry will be created read-only, regardless of its132 * w field.128 * @param t Page Table Entry to be copied. 129 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage. 130 * @param ro If true, the entry will be created read-only, regardless 131 * of its w field. 133 132 */ 134 133 void dtlb_pte_copy(pte_t *t, index_t index, bool ro) … … 166 165 /** Copy PTE to ITLB. 167 166 * 168 * @param t 169 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.167 * @param t Page Table Entry to be copied. 168 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage. 170 169 */ 171 170 void itlb_pte_copy(pte_t *t, index_t index) … … 236 235 * low-level, assembly language part of the fast_data_access_mmu_miss handler. 237 236 * 238 * @param tag Content of the TLB Tag Access register as it existed when the 239 * trap happened. This is to prevent confusion created by clobbered 240 * Tag Access register during a nested DTLB miss. 241 * @param istate Interrupted state saved on the stack. 237 * @param tag Content of the TLB Tag Access register as it existed 238 * when the trap happened. This is to prevent confusion 239 * created by clobbered Tag Access register during a nested 240 * DTLB miss. 241 * @param istate Interrupted state saved on the stack. 242 242 */ 243 243 void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate) … … 288 288 /** DTLB protection fault handler. 289 289 * 290 * @param tag Content of the TLB Tag Access register as it existed when the 291 * trap happened. This is to prevent confusion created by clobbered 292 * Tag Access register during a nested DTLB miss. 293 * @param istate Interrupted state saved on the stack. 290 * @param tag Content of the TLB Tag Access register as it existed 291 * when the trap happened. This is to prevent confusion 292 * created by clobbered Tag Access register during a nested 293 * DTLB miss. 294 * @param istate Interrupted state saved on the stack. 294 295 */ 295 296 void fast_data_access_protection(tlb_tag_access_reg_t tag, istate_t *istate) … … 332 333 } 333 334 335 /** Print TLB entry (for debugging purposes). 336 * 337 * The diag field has been left out in order to make this function more generic 338 * (there is no diag field in US3 architeture). 339 * 340 * @param i TLB entry number 341 * @param t TLB entry tag 342 * @param d TLB entry data 343 */ 344 static void print_tlb_entry(int i, tlb_tag_read_reg_t t, tlb_data_t d) 345 { 346 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, " 347 "ie=%d, soft2=%#x, pfn=%#x, soft=%#x, l=%d, " 348 "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn, 349 t.context, d.v, d.size, d.nfo, d.ie, d.soft2, 350 d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 351 } 352 353 #if defined (US) 354 334 355 /** Print contents of both TLBs. */ 335 356 void tlb_print(void) … … 343 364 d.value = itlb_data_access_read(i); 344 365 t.value = itlb_tag_read_read(i); 345 346 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, " 347 "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, " 348 "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn, 349 t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, 350 d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 366 print_tlb_entry(i, t, d); 351 367 } 352 368 … … 355 371 d.value = dtlb_data_access_read(i); 356 372 t.value = dtlb_tag_read_read(i); 357 358 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, " 359 "ie=%d, soft2=%#x, diag=%#x, pfn=%#x, soft=%#x, l=%d, " 360 "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn, 361 t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, 362 d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 363 } 364 365 } 373 print_tlb_entry(i, t, d); 374 } 375 } 376 377 #elif defined (US3) 378 379 /** Print contents of all TLBs. */ 380 void tlb_print(void) 381 { 382 int i; 383 tlb_data_t d; 384 tlb_tag_read_reg_t t; 385 386 printf("TLB_ISMALL contents:\n"); 387 for (i = 0; i < tlb_ismall_size(); i++) { 388 d.value = dtlb_data_access_read(TLB_ISMALL, i); 389 t.value = dtlb_tag_read_read(TLB_ISMALL, i); 390 print_tlb_entry(i, t, d); 391 } 392 393 printf("TLB_IBIG contents:\n"); 394 for (i = 0; i < tlb_ibig_size(); i++) { 395 d.value = dtlb_data_access_read(TLB_IBIG, i); 396 t.value = dtlb_tag_read_read(TLB_IBIG, i); 397 print_tlb_entry(i, t, d); 398 } 399 400 printf("TLB_DSMALL contents:\n"); 401 for (i = 0; i < tlb_dsmall_size(); i++) { 402 d.value = dtlb_data_access_read(TLB_DSMALL, i); 403 t.value = dtlb_tag_read_read(TLB_DSMALL, i); 404 print_tlb_entry(i, t, d); 405 } 406 407 printf("TLB_DBIG_1 contents:\n"); 408 for (i = 0; i < tlb_dbig_size(); i++) { 409 d.value = dtlb_data_access_read(TLB_DBIG_0, i); 410 t.value = dtlb_tag_read_read(TLB_DBIG_0, i); 411 print_tlb_entry(i, t, d); 412 } 413 414 printf("TLB_DBIG_2 contents:\n"); 415 for (i = 0; i < tlb_dbig_size(); i++) { 416 d.value = dtlb_data_access_read(TLB_DBIG_1, i); 417 t.value = dtlb_tag_read_read(TLB_DBIG_1, i); 418 print_tlb_entry(i, t, d); 419 } 420 } 421 422 #endif 366 423 367 424 void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, … … 412 469 sfar = dtlb_sfar_read(); 413 470 471 #if defined (US) 414 472 printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, " 415 473 "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, 416 474 sfsr.ow, sfsr.fv); 475 #elif defined (US3) 476 printf("DTLB SFSR: nf=%d, asi=%#x, tm=%d, ft=%#x, e=%d, ct=%d, pr=%d, " 477 "w=%d, ow=%d, fv=%d\n", sfsr.nf, sfsr.asi, sfsr.tm, sfsr.ft, 478 sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv); 479 #endif 480 417 481 printf("DTLB SFAR: address=%p\n", sfar); 418 482 419 483 dtlb_sfsr_write(0); 420 484 } 485 486 #if defined (US3) 487 /** Invalidates given TLB entry if and only if it is non-locked or global. 488 * 489 * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1, 490 * TLB_ISMALL, TLB_IBIG). 491 * @param entry Entry index within the given TLB. 492 */ 493 static void tlb_invalidate_entry(int tlb, index_t entry) 494 { 495 tlb_data_t d; 496 tlb_tag_read_reg_t t; 497 498 if (tlb == TLB_DSMALL || tlb == TLB_DBIG_0 || tlb == TLB_DBIG_1) { 499 d.value = dtlb_data_access_read(tlb, entry); 500 if (!d.l || d.g) { 501 t.value = dtlb_tag_read_read(tlb, entry); 502 d.v = false; 503 dtlb_tag_access_write(t.value); 504 dtlb_data_access_write(tlb, entry, d.value); 505 } 506 } else if (tlb == TLB_ISMALL || tlb == TLB_IBIG) { 507 d.value = itlb_data_access_read(tlb, entry); 508 if (!d.l || d.g) { 509 t.value = itlb_tag_read_read(tlb, entry); 510 d.v = false; 511 itlb_tag_access_write(t.value); 512 itlb_data_access_write(tlb, entry, d.value); 513 } 514 } 515 } 516 #endif 421 517 422 518 /** Invalidate all unlocked ITLB and DTLB entries. */ … … 424 520 { 425 521 int i; 426 tlb_data_t d; 427 tlb_tag_read_reg_t t; 428 522 429 523 /* 430 524 * Walk all ITLB and DTLB entries and remove all unlocked mappings. 431 525 * 432 526 * The kernel doesn't use global mappings so any locked global mappings 433 * found 527 * found must have been created by someone else. Their only purpose now 434 528 * is to collide with proper mappings. Invalidate immediately. It should 435 529 * be safe to invalidate them as late as now. 436 530 */ 531 532 #if defined (US) 533 tlb_data_t d; 534 tlb_tag_read_reg_t t; 437 535 438 536 for (i = 0; i < ITLB_ENTRY_COUNT; i++) { … … 445 543 } 446 544 } 447 545 448 546 for (i = 0; i < DTLB_ENTRY_COUNT; i++) { 449 547 d.value = dtlb_data_access_read(i); … … 455 553 } 456 554 } 457 555 556 #elif defined (US3) 557 558 for (i = 0; i < tlb_ismall_size(); i++) 559 tlb_invalidate_entry(TLB_ISMALL, i); 560 for (i = 0; i < tlb_ibig_size(); i++) 561 tlb_invalidate_entry(TLB_IBIG, i); 562 for (i = 0; i < tlb_dsmall_size(); i++) 563 tlb_invalidate_entry(TLB_DSMALL, i); 564 for (i = 0; i < tlb_dbig_size(); i++) 565 tlb_invalidate_entry(TLB_DBIG_0, i); 566 for (i = 0; i < tlb_dbig_size(); i++) 567 tlb_invalidate_entry(TLB_DBIG_1, i); 568 #endif 569 458 570 } 459 571 … … 485 597 * address space. 486 598 * 487 * @param asid 488 * @param page 489 * @param cnt 599 * @param asid Address Space ID. 600 * @param page First page which to sweep out from ITLB and DTLB. 601 * @param cnt Number of ITLB and DTLB entries to invalidate. 490 602 */ 491 603 void tlb_invalidate_pages(asid_t asid, uintptr_t page, count_t cnt) -
kernel/arch/sparc64/src/mm/tsb.c
r0258e67 r965dc18 113 113 tsb->data.size = PAGESIZE_8K; 114 114 tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index; 115 tsb->data.cp = t->c; 116 tsb->data.p = t->k; /* p as privileged*/117 tsb->data.v = t->p; 115 tsb->data.cp = t->c; /* cp as cache in phys.-idxed, c as cacheable */ 116 tsb->data.p = t->k; /* p as privileged, k as kernel */ 117 tsb->data.v = t->p; /* v as valid, p as present */ 118 118 119 119 write_barrier(); … … 174 174 /** @} 175 175 */ 176 -
kernel/arch/sparc64/src/smp/ipi.c
r0258e67 r965dc18 47 47 #include <panic.h> 48 48 49 /** Set the contents of the outgoing interrupt vector data. 50 * 51 * The first data item (data 0) will be set to the value of func, the 52 * rest of the vector will contain zeros. 53 * 54 * This is a helper function used from within the cross_call function. 55 * 56 * @param func value the first data item of the vector will be set to 57 */ 58 static inline void set_intr_w_data(void (* func)(void)) 59 { 60 #if defined (US) 61 asi_u64_write(ASI_INTR_W, ASI_UDB_INTR_W_DATA_0, (uintptr_t) func); 62 asi_u64_write(ASI_INTR_W, ASI_UDB_INTR_W_DATA_1, 0); 63 asi_u64_write(ASI_INTR_W, ASI_UDB_INTR_W_DATA_2, 0); 64 #elif defined (US3) 65 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_0, (uintptr_t) func); 66 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_1, 0); 67 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_2, 0); 68 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_3, 0); 69 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_4, 0); 70 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_5, 0); 71 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_6, 0); 72 asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_7, 0); 73 #endif 74 } 75 49 76 /** Invoke function on another processor. 50 77 * … … 74 101 panic("Interrupt Dispatch Status busy bit set\n"); 75 102 103 ASSERT(!(pstate_read() & PSTATE_IE_BIT)); 104 76 105 do { 77 asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_0, 78 (uintptr_t) func); 79 asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_1, 0); 80 asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_2, 0); 81 asi_u64_write(ASI_UDB_INTR_W, 106 set_intr_w_data(func); 107 asi_u64_write(ASI_INTR_W, 82 108 (mid << INTR_VEC_DISPATCH_MID_SHIFT) | 83 ASI_UDB_INTR_W_DISPATCH, 0);109 VA_INTR_W_DISPATCH, 0); 84 110 85 111 membar(); -
kernel/arch/sparc64/src/smp/smp.c
r0258e67 r965dc18 36 36 #include <genarch/ofw/ofw_tree.h> 37 37 #include <cpu.h> 38 #include <arch/cpu_family.h> 38 39 #include <arch/cpu.h> 39 40 #include <arch.h> … … 44 45 #include <synch/waitq.h> 45 46 #include <print.h> 47 #include <arch/cpu_node.h> 46 48 47 49 /** … … 62 64 count_t cnt = 0; 63 65 64 node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu"); 65 while (node) { 66 cnt++; 67 node = ofw_tree_find_peer_by_device_type(node, "cpu"); 66 if (is_us() || is_us_iii()) { 67 node = ofw_tree_find_child_by_device_type(cpus_parent(), "cpu"); 68 while (node) { 69 cnt++; 70 node = ofw_tree_find_peer_by_device_type(node, "cpu"); 71 } 72 } else if (is_us_iv()) { 73 node = ofw_tree_find_child(cpus_parent(), "cmp"); 74 while (node) { 75 cnt += 2; 76 node = ofw_tree_find_peer_by_name(node, "cmp"); 77 } 68 78 } 69 79 70 80 config.cpu_count = max(1, cnt); 81 } 82 83 /** 84 * Wakes up the CPU which is represented by the "node" OFW tree node. 85 * If "node" represents the current CPU, calling the function has 86 * no effect. 87 */ 88 static void wakeup_cpu(ofw_tree_node_t *node) 89 { 90 uint32_t mid; 91 ofw_tree_property_t *prop; 92 93 /* 'upa-portid' for US, 'portid' for US-III, 'cpuid' for US-IV */ 94 prop = ofw_tree_getprop(node, "upa-portid"); 95 if ((!prop) || (!prop->value)) 96 prop = ofw_tree_getprop(node, "portid"); 97 if ((!prop) || (!prop->value)) 98 prop = ofw_tree_getprop(node, "cpuid"); 99 100 if (!prop || prop->value == NULL) 101 return; 102 103 mid = *((uint32_t *) prop->value); 104 if (CPU->arch.mid == mid) 105 return; 106 107 waking_up_mid = mid; 108 109 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == 110 ESYNCH_TIMEOUT) 111 printf("%s: waiting for processor (mid = %" PRIu32 112 ") timed out\n", __func__, mid); 71 113 } 72 114 … … 77 119 int i; 78 120 79 node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu"); 80 for (i = 0; node; node = ofw_tree_find_peer_by_device_type(node, "cpu"), i++) { 81 uint32_t mid; 82 ofw_tree_property_t *prop; 83 84 prop = ofw_tree_getprop(node, "upa-portid"); 85 if (!prop || !prop->value) 86 continue; 87 88 mid = *((uint32_t *) prop->value); 89 if (CPU->arch.mid == mid) { 90 /* 91 * Skip the current CPU. 92 */ 93 continue; 121 if (is_us() || is_us_iii()) { 122 node = ofw_tree_find_child_by_device_type(cpus_parent(), "cpu"); 123 for (i = 0; node; 124 node = ofw_tree_find_peer_by_device_type(node, "cpu"), i++) 125 wakeup_cpu(node); 126 } else if (is_us_iv()) { 127 node = ofw_tree_find_child(cpus_parent(), "cmp"); 128 while (node) { 129 wakeup_cpu(ofw_tree_find_child(node, "cpu@0")); 130 wakeup_cpu(ofw_tree_find_child(node, "cpu@1")); 131 node = ofw_tree_find_peer_by_name(node, "cmp"); 94 132 } 95 96 /*97 * Processor with ID == mid can proceed with its initialization.98 */99 waking_up_mid = mid;100 101 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT)102 printf("%s: waiting for processor (mid = %" PRIu32 ") timed out\n",103 __func__, mid);104 133 } 105 134 } -
kernel/arch/sparc64/src/sparc64.c
r0258e67 r965dc18 87 87 */ 88 88 irq_init(1 << 11, 128); 89 89 90 90 standalone_sparc64_console_init(); 91 91 } -
kernel/arch/sparc64/src/start.S
r0258e67 r965dc18 28 28 29 29 #include <arch/arch.h> 30 #include <arch/cpu.h> 30 31 #include <arch/regdef.h> 31 32 #include <arch/boot/boot.h> … … 46 47 47 48 #define BSP_FLAG 1 49 50 /* 51 * 2^PHYSMEM_ADDR_SIZE is the size of the physical address space on 52 * a given processor. 53 */ 54 #if defined (US) 55 #define PHYSMEM_ADDR_SIZE 41 56 #elif defined (US3) 57 #define PHYSMEM_ADDR_SIZE 43 58 #endif 48 59 49 60 /* … … 68 79 andn %o0, %l0, %l6 ! l6 <= start of physical memory 69 80 70 ! Get bits 40:13 of physmem_base.81 ! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base. 71 82 srlx %l6, 13, %l5 72 sllx %l5, 13 + (63 - 40), %l5 73 srlx %l5, 63 - 40, %l5 ! l5 <= physmem_base[40:13] 83 84 ! l5 <= physmem_base[(PHYSMEM_ADDR_SIZE - 1):13] 85 sllx %l5, 13 + (63 - (PHYSMEM_ADDR_SIZE - 1)), %l5 86 srlx %l5, 63 - (PHYSMEM_ADDR_SIZE - 1), %l5 74 87 75 88 /* … … 84 97 wrpr %g0, NWINDOWS - 1, %cleanwin ! prevent needless clean_window 85 98 ! traps for kernel 99 100 wrpr %g0, 0, %wstate ! use default spill/fill trap 86 101 87 102 wrpr %g0, 0, %tl ! TL = 0, primary context … … 245 260 /* 246 261 * Precompute kernel 8K TLB data template. 247 * %l5 contains starting physical address bits [40:13] 262 * %l5 contains starting physical address 263 * bits [(PHYSMEM_ADDR_SIZE - 1):13] 248 264 */ 249 265 sethi %hi(kernel_8k_tlb_data_template), %l4 … … 283 299 284 300 301 1: 302 #ifdef CONFIG_SMP 303 /* 304 * Determine the width of the MID and save its mask to %g3. The width 305 * is 306 * * 5 for US and US-IIIi, 307 * * 10 for US3 except US-IIIi. 308 */ 309 #if defined(US) 310 mov 0x1f, %g3 311 #elif defined(US3) 312 mov 0x3ff, %g3 313 rdpr %ver, %g2 314 sllx %g2, 16, %g2 315 srlx %g2, 48, %g2 316 cmp %g2, IMPL_ULTRASPARCIII_I 317 move %xcc, 0x1f, %g3 318 #endif 319 285 320 /* 286 321 * Read MID from the processor. 287 322 */ 288 1: 289 ldxa [%g0] ASI_UPA_CONFIG, %g1 290 srlx %g1, UPA_CONFIG_MID_SHIFT, %g1 291 and %g1, UPA_CONFIG_MID_MASK, %g1 292 293 #ifdef CONFIG_SMP 323 ldxa [%g0] ASI_ICBUS_CONFIG, %g1 324 srlx %g1, ICBUS_CONFIG_MID_SHIFT, %g1 325 and %g1, %g3, %g1 326 294 327 /* 295 328 * Active loop for APs until the BSP picks them up. A processor cannot -
kernel/arch/sparc64/src/trap/interrupt.c
r0258e67 r965dc18 68 68 void interrupt(int n, istate_t *istate) 69 69 { 70 uint64_t status; 70 71 uint64_t intrcv; 71 72 uint64_t data0; 73 status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0); 74 if (status & (!INTR_DISPATCH_STATUS_BUSY)) 75 panic("Interrupt Dispatch Status busy bit not set\n"); 72 76 73 77 intrcv = asi_u64_read(ASI_INTR_RECEIVE, 0); 74 data0 = asi_u64_read(ASI_UDB_INTR_R, ASI_UDB_INTR_R_DATA_0); 78 #if defined (US) 79 data0 = asi_u64_read(ASI_INTR_R, ASI_UDB_INTR_R_DATA_0); 80 #elif defined (US3) 81 data0 = asi_u64_read(ASI_INTR_R, VA_INTR_R_DATA_0); 82 #endif 75 83 76 84 irq_t *irq = irq_dispatch_and_lock(data0); -
kernel/genarch/include/fb/fb.h
r0258e67 r965dc18 39 39 #include <synch/spinlock.h> 40 40 41 /** 42 * Properties of the framebuffer device. 43 */ 44 typedef struct fb_properties { 45 /** Physical address of the framebuffer device. */ 46 uintptr_t addr; 47 48 /** 49 * Address where the first (top left) pixel is mapped, 50 * relative to "addr". 51 */ 52 unsigned int offset; 53 54 /** Screen width in pixels. */ 55 unsigned int x; 56 57 /** Screen height in pixels. */ 58 unsigned int y; 59 60 /** Bytes per one scanline. */ 61 unsigned int scan; 62 63 /** Color model. */ 64 unsigned int visual; 65 } fb_properties_t; 66 41 67 SPINLOCK_EXTERN(fb_lock); 42 void fb_init( uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan, unsigned int visual);68 void fb_init(fb_properties_t *props); 43 69 44 70 #endif -
kernel/genarch/include/fb/visuals.h
r0258e67 r965dc18 45 45 46 46 #define VISUAL_BGR_0_8_8_8 6 47 #define VISUAL_SB1500_PALETTE 7 47 48 48 49 #endif -
kernel/genarch/include/ofw/ofw_tree.h
r0258e67 r965dc18 173 173 extern ofw_tree_node_t *ofw_tree_find_peer_by_device_type(ofw_tree_node_t *, 174 174 const char *); 175 extern ofw_tree_node_t *ofw_tree_find_peer_by_name(ofw_tree_node_t *node, 176 const char *name); 175 177 extern ofw_tree_node_t *ofw_tree_find_node_by_handle(ofw_tree_node_t *, 176 178 uint32_t); -
kernel/genarch/src/fb/fb.c
r0258e67 r965dc18 190 190 *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | 191 191 BLUE(rgb, 3); 192 } 193 194 static void sb1500rgb_byte8(void *dst, int rgb) 195 { 196 if (RED(rgb, 1) && GREEN(rgb, 1) && BLUE(rgb, 1)) 197 *((uint8_t *) dst) = 255; 198 else if (RED(rgb, 1) && GREEN(rgb, 1)) 199 *((uint8_t *) dst) = 150; 200 else if (GREEN(rgb, 1) && BLUE(rgb, 1)) 201 *((uint8_t *) dst) = 47; 202 else if (RED(rgb, 1) && BLUE(rgb, 1)) 203 *((uint8_t *) dst) = 48; 204 else if (RED(rgb, 1)) 205 *((uint8_t *) dst) = 32; 206 else if (GREEN(rgb, 1)) 207 *((uint8_t *) dst) = 47; 208 else if (BLUE(rgb, 1)) 209 *((uint8_t *) dst) = 2; 210 else 211 *((uint8_t *) dst) = 1; 192 212 } 193 213 … … 437 457 /** Initialize framebuffer as a chardev output device 438 458 * 439 * @param addr Physical address of the framebuffer 440 * @param x Screen width in pixels 441 * @param y Screen height in pixels 442 * @param scan Bytes per one scanline 443 * @param visual Color model 444 * 445 */ 446 void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan, 447 unsigned int visual) 448 { 449 switch (visual) { 459 * @param props Properties of the framebuffer device. 460 */ 461 void fb_init(fb_properties_t *props) 462 { 463 switch (props->visual) { 450 464 case VISUAL_INDIRECT_8: 451 465 rgb2scr = rgb_byte8; … … 453 467 pixelbytes = 1; 454 468 break; 469 case VISUAL_SB1500_PALETTE: 470 rgb2scr = sb1500rgb_byte8; 471 scr2rgb = byte8_rgb; 472 pixelbytes = 1; 473 break; 455 474 case VISUAL_RGB_5_5_5: 456 475 rgb2scr = rgb_byte555; … … 487 506 } 488 507 489 unsigned int fbsize = scan * y;508 unsigned int fbsize = props->scan * props->y + props->offset; 490 509 491 510 /* Map the framebuffer */ 492 fbaddress = (uint8_t *) hw_map((uintptr_t) addr, fbsize); 493 494 xres = x; 495 yres = y; 496 scanline = scan; 497 498 rows = y / FONT_SCANLINES; 499 columns = x / COL_WIDTH; 500 501 fb_parea.pbase = (uintptr_t) addr; 511 fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr, fbsize); 512 fbaddress += props->offset; 513 514 xres = props->x; 515 yres = props->y; 516 scanline = props->scan; 517 518 rows = props->y / FONT_SCANLINES; 519 columns = props->x / COL_WIDTH; 520 521 fb_parea.pbase = (uintptr_t) props->addr; 502 522 fb_parea.vbase = (uintptr_t) fbaddress; 503 523 fb_parea.frames = SIZE2FRAMES(fbsize); … … 509 529 sysinfo_set_item_val("fb.width", NULL, xres); 510 530 sysinfo_set_item_val("fb.height", NULL, yres); 511 sysinfo_set_item_val("fb.scanline", NULL, scan);512 sysinfo_set_item_val("fb.visual", NULL, visual);513 sysinfo_set_item_val("fb.address.physical", NULL, addr);531 sysinfo_set_item_val("fb.scanline", NULL, props->scan); 532 sysinfo_set_item_val("fb.visual", NULL, props->visual); 533 sysinfo_set_item_val("fb.address.physical", NULL, props->addr); 514 534 sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors); 515 535 … … 525 545 if (!blankline) 526 546 panic("Failed to allocate blank line for framebuffer."); 547 unsigned int x, y; 527 548 for (y = 0; y < FONT_SCANLINES; y++) 528 549 for (x = 0; x < xres; x++) -
kernel/genarch/src/ofw/ofw_tree.c
r0258e67 r965dc18 55 55 /** Get OpenFirmware node property. 56 56 * 57 * @param node Node in which to lookup the property. 58 * @param name Name of the property. 59 * 60 * @return Pointer to the property structure or NULL if no such property. 61 */ 62 ofw_tree_property_t *ofw_tree_getprop(const ofw_tree_node_t *node, const char *name) 57 * @param node Node in which to lookup the property. 58 * @param name Name of the property. 59 * 60 * @return Pointer to the property structure or NULL if no such 61 * property. 62 */ 63 ofw_tree_property_t * 64 ofw_tree_getprop(const ofw_tree_node_t *node, const char *name) 63 65 { 64 66 unsigned int i; … … 74 76 /** Return value of the 'name' property. 75 77 * 76 * @param node 77 * 78 * @return 78 * @param node Node of interest. 79 * 80 * @return Value of the 'name' property belonging to the node. 79 81 */ 80 82 const char *ofw_tree_node_name(const ofw_tree_node_t *node) … … 94 96 /** Lookup child of given name. 95 97 * 96 * @param node Node whose child is being looked up. 97 * @param name Name of the child being looked up. 98 * 99 * @return NULL if there is no such child or pointer to the matching child node. 98 * @param node Node whose child is being looked up. 99 * @param name Name of the child being looked up. 100 * 101 * @return NULL if there is no such child or pointer to the 102 * matching child node. 100 103 */ 101 104 ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *node, const char *name) … … 128 131 /** Lookup first child of given device type. 129 132 * 130 * @param node Node whose child is being looked up. 131 * @param name Device type of the child being looked up. 132 * 133 * @return NULL if there is no such child or pointer to the matching child node. 134 */ 135 ofw_tree_node_t *ofw_tree_find_child_by_device_type(ofw_tree_node_t *node, const char *name) 133 * @param node Node whose child is being looked up. 134 * @param name Device type of the child being looked up. 135 * 136 * @return NULL if there is no such child or pointer to the 137 * matching child node. 138 */ 139 ofw_tree_node_t * 140 ofw_tree_find_child_by_device_type(ofw_tree_node_t *node, const char *name) 136 141 { 137 142 ofw_tree_node_t *cur; … … 154 159 * are looked up iteratively to avoid stack overflow. 155 160 * 156 * @param root Root of the searched subtree. 157 * @param handle OpenFirmware handle. 158 * 159 * @return NULL if there is no such node or pointer to the matching node. 160 */ 161 ofw_tree_node_t *ofw_tree_find_node_by_handle(ofw_tree_node_t *root, uint32_t handle) 161 * @param root Root of the searched subtree. 162 * @param handle OpenFirmware handle. 163 * 164 * @return NULL if there is no such node or pointer to the matching 165 * node. 166 */ 167 ofw_tree_node_t * 168 ofw_tree_find_node_by_handle(ofw_tree_node_t *root, uint32_t handle) 162 169 { 163 170 ofw_tree_node_t *cur; … … 181 188 /** Lookup first peer of given device type. 182 189 * 183 * @param node Node whose peer is being looked up. 184 * @param name Device type of the child being looked up. 185 * 186 * @return NULL if there is no such child or pointer to the matching child node. 187 */ 188 ofw_tree_node_t *ofw_tree_find_peer_by_device_type(ofw_tree_node_t *node, const char *name) 190 * @param node Node whose peer is being looked up. 191 * @param name Device type of the child being looked up. 192 * 193 * @return NULL if there is no such child or pointer to the 194 * matching child node. 195 */ 196 ofw_tree_node_t * 197 ofw_tree_find_peer_by_device_type(ofw_tree_node_t *node, const char *name) 189 198 { 190 199 ofw_tree_node_t *cur; … … 203 212 204 213 214 /** Lookup first peer of given name. 215 * 216 * @param node Node whose peer is being looked up. 217 * @param name Name of the child being looked up. 218 * 219 * @return NULL if there is no such peer or pointer to the matching 220 * peer node. 221 */ 222 ofw_tree_node_t * 223 ofw_tree_find_peer_by_name(ofw_tree_node_t *node, const char *name) 224 { 225 ofw_tree_node_t *cur; 226 ofw_tree_property_t *prop; 227 228 for (cur = node->peer; cur; cur = cur->peer) { 229 prop = ofw_tree_getprop(cur, "name"); 230 if (!prop || !prop->value) 231 continue; 232 if (strcmp(prop->value, name) == 0) 233 return cur; 234 } 235 236 return NULL; 237 } 238 205 239 /** Lookup OpenFirmware node by its path. 206 240 * 207 * @param path Path to the node. 208 * 209 * @return NULL if there is no such node or pointer to the leaf node. 241 * @param path Path to the node. 242 * 243 * @return NULL if there is no such node or pointer to the leaf 244 * node. 210 245 */ 211 246 ofw_tree_node_t *ofw_tree_lookup(const char *path) 212 247 { 213 char buf[NAME_BUF_LEN +1];248 char buf[NAME_BUF_LEN + 1]; 214 249 ofw_tree_node_t *node = ofw_root; 215 250 index_t i, j; … … 237 272 * iteratively in order to avoid stack overflow. 238 273 * 239 * @param node 240 * @param path 274 * @param node Root of the subtree. 275 * @param path Current path, NULL for the very root of the entire tree. 241 276 */ 242 277 static void ofw_tree_node_print(const ofw_tree_node_t *node, const char *path) -
kernel/kernel.config
r0258e67 r965dc18 77 77 ! [ARCH=amd64] MACHINE (choice) 78 78 79 # CPU type 80 @ "us" UltraSPARC I-II subarchitecture 81 @ "us3" UltraSPARC III-IV subarchitecture 82 ! [ARCH=sparc64] MACHINE (choice) 83 79 84 # Machine type 80 85 @ "msim" MSIM Simulator … … 139 144 ! [ARCH=sparc64] CONFIG_Z8530 (y/n) 140 145 141 # Support for NS16550 serial port (On IA64 as a console instead legacy keyboard)142 ! [ARCH=sparc64 ] CONFIG_NS16550 (y/n)146 # Support for NS16550 serial port 147 ! [ARCH=sparc64|(ARCH=ia64&MACHINE!=ski)] CONFIG_NS16550 (n/y) 143 148 144 # Support for NS16550 serial port (On IA64 as a console instead legacy keyboard)145 ! [ARCH= ia64&MACHINE!=ski] CONFIG_NS16550 (n/y)149 # Support for Serengeti console 150 ! [ARCH=sparc64] CONFIG_SGCN (y/n) 146 151 147 # IOSapic on default address support (including legacy IRQ)152 # IOSapic on default address support 148 153 ! [ARCH=ia64&MACHINE!=ski] CONFIG_IOSAPIC (y/n) 149 154 -
uspace/srv/console/console.c
r0258e67 r965dc18 328 328 case KBD_PUSHCHAR: 329 329 /* got key from keyboard driver */ 330 331 330 retval = 0; 332 331 c = IPC_GET_ARG1(call); -
uspace/srv/fb/Makefile
r0258e67 r965dc18 66 66 endif 67 67 ifeq ($(ARCH), mips32) 68 SOURCES += msim.c 68 SOURCES += msim.c \ 69 serial_console.c 69 70 CFLAGS += -DMSIM_ENABLED -DFB_INVERT_ENDIAN 71 endif 72 ifeq ($(ARCH), sparc64) 73 SOURCES += sgcn.c \ 74 serial_console.c 75 CFLAGS += -DSGCN_ENABLED 70 76 endif 71 77 -
uspace/srv/fb/main.c
r0258e67 r965dc18 39 39 #include "ega.h" 40 40 #include "msim.h" 41 #include "sgcn.h" 41 42 #include "main.h" 42 43 … … 80 81 } 81 82 #endif 83 #ifdef SGCN_ENABLED 84 if ((!initialized) && (sysinfo_value("fb.kind") == 4)) { 85 if (sgcn_init() == 0) 86 initialized = true; 87 } 88 #endif 82 89 83 90 if (!initialized) -
uspace/srv/fb/msim.c
r0258e67 r965dc18 50 50 #include <ddi.h> 51 51 52 #include "serial_console.h" 52 53 #include "msim.h" 53 54 … … 65 66 { 66 67 *virt_addr = c; 67 }68 69 static void msim_puts(char *str)70 {71 while (*str)72 *virt_addr = *(str++);73 }74 75 static void msim_clrscr(void)76 {77 msim_puts("\033[2J");78 }79 80 static void msim_goto(const unsigned int row, const unsigned int col)81 {82 if ((row > HEIGHT) || (col > WIDTH))83 return;84 85 char control[MAX_CONTROL];86 snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1);87 msim_puts(control);88 }89 90 static void msim_set_style(const unsigned int mode)91 {92 char control[MAX_CONTROL];93 snprintf(control, MAX_CONTROL, "\033[%um", mode);94 msim_puts(control);95 }96 97 static void msim_cursor_disable(void)98 {99 msim_puts("\033[?25l");100 }101 102 static void msim_cursor_enable(void)103 {104 msim_puts("\033[?25h");105 }106 107 static void msim_scroll(int i)108 {109 if (i > 0) {110 msim_goto(HEIGHT - 1, 0);111 while (i--)112 msim_puts("\033D");113 } else if (i < 0) {114 msim_goto(0, 0);115 while (i++)116 msim_puts("\033M");117 }118 68 } 119 69 … … 142 92 /* Clear the terminal, set scrolling region 143 93 to 0 - 25 lines */ 144 msim_clrscr();145 msim_goto(0, 0);146 msim_puts("\033[0;25r");94 serial_clrscr(); 95 serial_goto(0, 0); 96 serial_puts("\033[0;25r"); 147 97 148 98 while (true) { … … 158 108 newcol = IPC_GET_ARG3(call); 159 109 if ((lastcol != newcol) || (lastrow != newrow)) 160 msim_goto(newrow, newcol);110 serial_goto(newrow, newcol); 161 111 lastcol = newcol + 1; 162 112 lastrow = newrow; … … 167 117 newrow = IPC_GET_ARG1(call); 168 118 newcol = IPC_GET_ARG2(call); 169 msim_goto(newrow, newcol);119 serial_goto(newrow, newcol); 170 120 lastrow = newrow; 171 121 lastcol = newcol; … … 176 126 continue; 177 127 case FB_CLEAR: 178 msim_clrscr();128 serial_clrscr(); 179 129 retval = 0; 180 130 break; … … 183 133 bgcolor = IPC_GET_ARG2(call); 184 134 if (fgcolor < bgcolor) 185 msim_set_style(0);135 serial_set_style(0); 186 136 else 187 msim_set_style(7);137 serial_set_style(7); 188 138 retval = 0; 189 139 break; … … 194 144 break; 195 145 } 196 msim_scroll(i);197 msim_goto(lastrow, lastcol);146 serial_scroll(i); 147 serial_goto(lastrow, lastcol); 198 148 retval = 0; 199 149 break; 200 150 case FB_CURSOR_VISIBILITY: 201 151 if(IPC_GET_ARG1(call)) 202 msim_cursor_enable();152 serial_cursor_enable(); 203 153 else 204 msim_cursor_disable();154 serial_cursor_disable(); 205 155 retval = 0; 206 156 break; … … 219 169 physmem_map(phys_addr, virt_addr, 1, AS_AREA_READ | AS_AREA_WRITE); 220 170 171 serial_console_init(msim_putc, WIDTH, HEIGHT); 172 221 173 async_set_client_connection(msim_client_connection); 222 174 return 0; -
uspace/srv/kbd/Makefile
r0258e67 r965dc18 79 79 ifeq ($(ARCH), sparc64) 80 80 ARCH_SOURCES += \ 81 arch/$(ARCH)/src/scanc.c 81 arch/$(ARCH)/src/scanc.c \ 82 arch/$(ARCH)/src/sgcn.c 82 83 GENARCH_SOURCES = \ 83 genarch/src/kbd.c 84 genarch/src/kbd.c \ 85 genarch/src/nofb.c 84 86 endif 85 87 ifeq ($(ARCH), arm32) … … 87 89 arch/$(ARCH)/src/kbd_gxemul.c 88 90 endif 89 91 ifeq ($(ARCH), mips32) 92 GENARCH_SOURCES += \ 93 genarch/src/nofb.c 94 endif 90 95 91 96 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) -
uspace/srv/kbd/arch/mips32/src/kbd.c
r0258e67 r965dc18 35 35 */ 36 36 #include <arch/kbd.h> 37 #include <genarch/nofb.h> 37 38 #include <ipc/ipc.h> 38 39 #include <sysinfo.h> … … 100 101 */ 101 102 102 static int kbd_arch_process_no_fb(keybuffer_t *keybuffer, int scan_code)103 {104 105 static unsigned long buf = 0;106 static int count = 0;107 108 /* Please preserve this code (it can be used to determine scancodes)109 110 keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));111 keybuffer_push(keybuffer, to_hex(scan_code&0xf));112 keybuffer_push(keybuffer, ' ');113 keybuffer_push(keybuffer, ' ');114 115 return 1;116 */117 118 if(scan_code == 0x7e) {119 switch (buf) {120 case MSIM_KEY_F5:121 keybuffer_push(keybuffer,FUNCTION_KEYS | 5);122 buf = count = 0;123 return 1;124 case MSIM_KEY_F6:125 keybuffer_push(keybuffer,FUNCTION_KEYS | 6);126 buf = count = 0;127 return 1;128 case MSIM_KEY_F7:129 keybuffer_push(keybuffer,FUNCTION_KEYS | 7);130 buf = count = 0;131 return 1;132 case MSIM_KEY_F8:133 keybuffer_push(keybuffer,FUNCTION_KEYS | 8);134 buf = count = 0;135 return 1;136 case MSIM_KEY_F9:137 keybuffer_push(keybuffer,FUNCTION_KEYS | 9);138 buf = count = 0;139 return 1;140 case MSIM_KEY_F10:141 keybuffer_push(keybuffer,FUNCTION_KEYS | 10);142 buf = count = 0;143 return 1;144 case MSIM_KEY_F11:145 keybuffer_push(keybuffer,FUNCTION_KEYS | 11);146 buf = count = 0;147 return 1;148 case MSIM_KEY_F12:149 keybuffer_push(keybuffer,FUNCTION_KEYS | 12);150 buf = count = 0;151 return 1;152 default:153 keybuffer_push(keybuffer, buf & 0xff);154 keybuffer_push(keybuffer, (buf >> 8) &0xff);155 keybuffer_push(keybuffer, (buf >> 16) &0xff);156 keybuffer_push(keybuffer, (buf >> 24) &0xff);157 keybuffer_push(keybuffer, scan_code);158 buf = count = 0;159 return 1;160 }161 }162 163 buf |= ((unsigned long) scan_code)<<(8*(count++));164 165 if((buf & 0xff) != (MSIM_KEY_F1 & 0xff)) {166 keybuffer_push(keybuffer, buf);167 buf = count = 0;168 return 1;169 }170 171 if (count <= 1)172 return 1;173 174 if ((buf & 0xffff) != (MSIM_KEY_F1 & 0xffff)175 && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) {176 177 keybuffer_push(keybuffer, buf & 0xff);178 keybuffer_push(keybuffer, (buf >> 8) &0xff);179 buf = count = 0;180 return 1;181 }182 183 if (count <= 2)184 return 1;185 186 switch (buf) {187 case MSIM_KEY_F1:188 keybuffer_push(keybuffer,FUNCTION_KEYS | 1);189 buf = count = 0;190 return 1;191 case MSIM_KEY_F2:192 keybuffer_push(keybuffer,FUNCTION_KEYS | 2);193 buf = count = 0;194 return 1;195 case MSIM_KEY_F3:196 keybuffer_push(keybuffer,FUNCTION_KEYS | 3);197 buf = count = 0;198 return 1;199 case MSIM_KEY_F4:200 keybuffer_push(keybuffer,FUNCTION_KEYS | 4);201 buf = count = 0;202 return 1;203 }204 205 206 if((buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff)207 && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff)) {208 209 keybuffer_push(keybuffer, buf & 0xff);210 keybuffer_push(keybuffer, (buf >> 8) & 0xff);211 keybuffer_push(keybuffer, (buf >> 16) & 0xff);212 buf=count=0;213 return 1;214 }215 216 if (count <= 3)217 return 1;218 219 switch (buf) {220 case MSIM_KEY_F5:221 case MSIM_KEY_F6:222 case MSIM_KEY_F7:223 case MSIM_KEY_F8:224 case MSIM_KEY_F9:225 case MSIM_KEY_F10:226 case MSIM_KEY_F11:227 case MSIM_KEY_F12:228 return 1;229 default:230 keybuffer_push(keybuffer, buf & 0xff);231 keybuffer_push(keybuffer, (buf >> 8) &0xff);232 keybuffer_push(keybuffer, (buf >> 16) &0xff);233 keybuffer_push(keybuffer, (buf >> 24) &0xff);234 buf = count = 0;235 return 1;236 }237 return 1;238 }239 240 241 242 103 static int kbd_arch_process_fb(keybuffer_t *keybuffer, int scan_code) 243 104 { … … 372 233 return kbd_arch_process_fb(keybuffer, scan_code); 373 234 374 return kbd_ arch_process_no_fb(keybuffer, scan_code);235 return kbd_process_no_fb(keybuffer, scan_code); 375 236 } 376 237 /** @} -
uspace/srv/kbd/arch/sparc64/src/kbd.c
r0258e67 r965dc18 36 36 37 37 #include <arch/kbd.h> 38 #include <arch/sgcn.h> 38 39 #include <ipc/ipc.h> 39 40 #include <sysinfo.h> … … 79 80 #define KBD_Z8530 1 80 81 #define KBD_NS16550 2 82 #define KBD_SGCN 3 81 83 82 84 int kbd_arch_init(void) … … 92 94 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &ns16550_kbd); 93 95 break; 96 case KBD_SGCN: 97 sgcn_init(); 98 break; 94 99 default: 95 100 break; … … 101 106 int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call) 102 107 { 108 if (sysinfo_value("kbd.type") == KBD_SGCN) { 109 sgcn_key_pressed(); 110 return 1; 111 } 112 103 113 int scan_code = IPC_GET_ARG1(*call); 104 114
Note:
See TracChangeset
for help on using the changeset viewer.