Changeset a35b458 in mainline for kernel/arch/sparc64/src/drivers
- Timestamp:
- 2018-03-02T20:10:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- Location:
- kernel/arch/sparc64/src/drivers
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/drivers/kbd.c
r3061bc1 ra35b458 62 62 { 63 63 const char *name = ofw_tree_node_name(node); 64 64 65 65 if (str_cmp(name, "su") != 0) 66 66 return false; 67 67 68 68 /* 69 69 * Read 'interrupts' property. … … 75 75 return false; 76 76 } 77 77 78 78 uint32_t interrupts = *((uint32_t *) prop->value); 79 79 80 80 /* 81 81 * Read 'reg' property. … … 87 87 return false; 88 88 } 89 89 90 90 size_t size = ((ofw_ebus_reg_t *) prop->value)->size; 91 91 92 92 uintptr_t pa = 0; // Prevent -Werror=maybe-uninitialized 93 93 if (!ofw_ebus_apply_ranges(node->parent, … … 97 97 return false; 98 98 } 99 99 100 100 inr_t inr; 101 101 cir_t cir; … … 108 108 return false; 109 109 } 110 110 111 111 /* 112 112 * We need to pass aligned address to hw_map(). … … 117 117 uintptr_t aligned_addr = ALIGN_DOWN(pa, PAGE_SIZE); 118 118 size_t offset = pa - aligned_addr; 119 119 120 120 ioport8_t *ns16550 = (ioport8_t *) (km_map(aligned_addr, offset + size, 121 121 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset); 122 122 123 123 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, 0, inr, cir, 124 124 cir_arg, NULL); … … 131 131 } 132 132 } 133 133 134 134 /* 135 135 * This is the necessary evil until the userspace drivers are … … 140 140 sysinfo_set_item_val("kbd.address.physical", NULL, pa); 141 141 sysinfo_set_item_val("kbd.type.ns16550", NULL, true); 142 142 143 143 return true; 144 144 } -
kernel/arch/sparc64/src/drivers/niagara.c
r3061bc1 ra35b458 126 126 * shared buffer to the console. 127 127 */ 128 128 129 129 while (output_buffer.read_ptr != output_buffer.write_ptr) { 130 130 do_putchar(output_buffer.data[output_buffer.read_ptr]); … … 132 132 ((output_buffer.read_ptr) + 1) % OUTPUT_BUFFER_SIZE; 133 133 } 134 134 135 135 /* 136 136 * Read character from keyboard. 137 137 */ 138 138 139 139 uint64_t c; 140 140 if (__hypercall_fast_ret1(0, 0, 0, 0, 0, CONS_GETCHAR, &c) == HV_EOK) { … … 174 174 if (instance) 175 175 return; 176 176 177 177 instance = malloc(sizeof(niagara_instance_t), FRAME_ATOMIC); 178 178 instance->thread = thread_create(kniagarapoll, NULL, TASK, 179 179 THREAD_FLAG_UNCOUNTED, "kniagarapoll"); 180 180 181 181 if (!instance->thread) { 182 182 free(instance); … … 184 184 return; 185 185 } 186 186 187 187 instance->srlnin = NULL; 188 188 189 189 output_buffer.read_ptr = 0; 190 190 output_buffer.write_ptr = 0; 191 191 input_buffer.write_ptr = 0; 192 192 input_buffer.read_ptr = 0; 193 193 194 194 /* 195 195 * Set sysinfos and pareas so that the userspace counterpart of the … … 197 197 * buffers. 198 198 */ 199 199 200 200 sysinfo_set_item_val("fb", NULL, true); 201 201 sysinfo_set_item_val("fb.kind", NULL, 5); 202 202 203 203 sysinfo_set_item_val("niagara.outbuf.address", NULL, 204 204 KA2PA(&output_buffer)); … … 207 207 sysinfo_set_item_val("niagara.outbuf.datasize", NULL, 208 208 OUTPUT_BUFFER_SIZE); 209 209 210 210 sysinfo_set_item_val("niagara.inbuf.address", NULL, 211 211 KA2PA(&input_buffer)); … … 214 214 sysinfo_set_item_val("niagara.inbuf.datasize", NULL, 215 215 INPUT_BUFFER_SIZE); 216 216 217 217 outbuf_parea.pbase = (uintptr_t) (KA2PA(&output_buffer)); 218 218 outbuf_parea.frames = 1; … … 220 220 outbuf_parea.mapped = false; 221 221 ddi_parea_register(&outbuf_parea); 222 222 223 223 inbuf_parea.pbase = (uintptr_t) (KA2PA(&input_buffer)); 224 224 inbuf_parea.frames = 1; … … 226 226 inbuf_parea.mapped = false; 227 227 ddi_parea_register(&inbuf_parea); 228 228 229 229 outdev_t *niagara_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC); 230 230 outdev_initialize("niagara_dev", niagara_dev, &niagara_ops); … … 238 238 { 239 239 niagara_init(); 240 240 241 241 if (instance) { 242 242 srln_instance_t *srln_instance = srln_init(); … … 244 244 indev_t *sink = stdin_wire(); 245 245 indev_t *srln = srln_wire(srln_instance, sink); 246 246 247 247 instance->srlnin = srln; 248 248 thread_ready(instance->thread); 249 249 } 250 250 } 251 251 252 252 return instance; 253 253 } -
kernel/arch/sparc64/src/drivers/pci.c
r3061bc1 ra35b458 183 183 if (!prop || !prop->value) 184 184 return NULL; 185 185 186 186 if (str_cmp(prop->value, "SUNW,sabre") == 0) { 187 187 /* -
kernel/arch/sparc64/src/drivers/scr.c
r3061bc1 ra35b458 67 67 ofw_sbus_reg_t *sbus_reg; 68 68 const char *name; 69 69 70 70 name = ofw_tree_node_name(node); 71 71 72 72 if (str_cmp(name, "SUNW,m64B") == 0) 73 73 scr_type = SCR_ATYFB; … … 80 80 else if (str_cmp(name, "QEMU,VGA") == 0) 81 81 scr_type = SCR_QEMU_VGA; 82 82 83 83 if (scr_type == SCR_UNKNOWN) { 84 84 log(LF_ARCH, LVL_ERROR, "Unknown screen device."); 85 85 return; 86 86 } 87 87 88 88 uintptr_t fb_addr; 89 89 unsigned int fb_offset = 0; … … 121 121 return; 122 122 } 123 123 124 124 pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; 125 125 126 126 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 127 127 log(LF_ARCH, LVL_ERROR, … … 129 129 return; 130 130 } 131 131 132 132 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 133 133 &fb_addr)) { … … 136 136 return; 137 137 } 138 138 139 139 switch (fb_depth) { 140 140 case 8: … … 159 159 return; 160 160 } 161 161 162 162 break; 163 163 case SCR_XVR: … … 167 167 return; 168 168 } 169 169 170 170 pci_reg = &((ofw_pci_reg_t *) prop->value)[1]; 171 171 172 172 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 173 173 log(LF_ARCH, LVL_ERROR, … … 175 175 return; 176 176 } 177 177 178 178 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 179 179 &fb_addr)) { … … 207 207 return; 208 208 } 209 209 210 210 break; 211 211 case SCR_FFB: … … 231 231 return; 232 232 } 233 233 234 234 sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; 235 235 if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { … … 238 238 return; 239 239 } 240 240 241 241 break; 242 242 … … 297 297 .visual = visual, 298 298 }; 299 299 300 300 outdev_t *fbdev = fb_init(&props); 301 301 if (fbdev) -
kernel/arch/sparc64/src/drivers/tick.c
r3061bc1 ra35b458 89 89 90 90 softint.value = softint_read(); 91 91 92 92 /* 93 93 * Make sure we are servicing interrupt_level_14 94 94 */ 95 95 assert(n == TT_INTERRUPT_LEVEL_14); 96 96 97 97 /* 98 98 * Make sure we are servicing TICK_INT. … … 106 106 clear.tick_int = 1; 107 107 clear_softint_write(clear.value); 108 108 109 109 /* 110 110 * Reprogram the compare register.
Note:
See TracChangeset
for help on using the changeset viewer.
