Changeset 3e828ea in mainline for kernel/genarch/src/drivers/ns16550/ns16550.c
- Timestamp:
- 2019-09-23T12:49:29Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9be2358
- Parents:
- 9259d20 (diff), 1a4ec93f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
- File:
-
- 1 edited
-
kernel/genarch/src/drivers/ns16550/ns16550.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ns16550/ns16550.c
r9259d20 r3e828ea 39 39 #include <genarch/drivers/ns16550/ns16550.h> 40 40 #include <ddi/irq.h> 41 #include <ddi/ddi.h> 41 42 #include <arch/asm.h> 42 43 #include <console/chardev.h> 43 44 #include <stdlib.h> 45 #include <align.h> 44 46 #include <str.h> 45 47 … … 115 117 116 118 if ((!instance->parea.mapped) || (console_override)) { 119 if (ch == '\n') 120 ns16550_sendb(instance, '\r'); 121 117 122 if (ascii_check(ch)) 118 123 ns16550_sendb(instance, (uint8_t) ch); … … 143 148 * 144 149 */ 145 ns16550_instance_t *ns16550_init(ioport8_t *dev, unsigned reg_shift, inr_t inr, 146 cir_t cir, void *cir_arg, outdev_t **output) 147 { 148 ns16550_instance_t *instance = 149 malloc(sizeof(ns16550_instance_t)); 150 ns16550_instance_t *ns16550_init(ioport8_t *dev_phys, unsigned reg_shift, 151 inr_t inr, cir_t cir, void *cir_arg, outdev_t **output) 152 { 153 size_t size = 6 * (1U << reg_shift); 154 ioport8_t *dev = pio_map((void *) dev_phys, size); 155 156 ns16550_instance_t *instance = malloc(sizeof(ns16550_instance_t)); 150 157 if (instance) { 151 158 instance->ns16550 = dev; … … 158 165 if (!instance->output) { 159 166 free(instance); 167 pio_unmap((void *) dev_phys, (void *) dev, 168 size); 160 169 return NULL; 161 170 } … … 176 185 177 186 ddi_parea_init(&instance->parea); 178 instance->parea.pbase = (uintptr_t) dev; 179 instance->parea.frames = 1; 187 instance->parea.pbase = ALIGN_DOWN((uintptr_t) dev_phys, 188 PAGE_SIZE); 189 instance->parea.frames = ALIGN_UP(size, PAGE_SIZE); 180 190 instance->parea.unpriv = false; 181 191 instance->parea.mapped = false;
Note:
See TracChangeset
for help on using the changeset viewer.
