Changes in kernel/genarch/src/drivers/ns16550/ns16550.c [aafed15:82dcd25] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ns16550/ns16550.c
raafed15 r82dcd25 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 … … 143 145 * 144 146 */ 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)); 147 ns16550_instance_t *ns16550_init(ioport8_t *dev_phys, unsigned reg_shift, 148 inr_t inr, cir_t cir, void *cir_arg, outdev_t **output) 149 { 150 size_t size = 6 * (1U << reg_shift); 151 ioport8_t *dev = pio_map((void *) dev_phys, size); 152 153 ns16550_instance_t *instance = malloc(sizeof(ns16550_instance_t)); 150 154 if (instance) { 151 155 instance->ns16550 = dev; … … 158 162 if (!instance->output) { 159 163 free(instance); 164 pio_unmap((void *) dev_phys, (void *) dev, 165 size); 160 166 return NULL; 161 167 } … … 176 182 177 183 ddi_parea_init(&instance->parea); 178 instance->parea.pbase = (uintptr_t) dev; 179 instance->parea.frames = 1; 184 instance->parea.pbase = ALIGN_DOWN((uintptr_t) dev_phys, 185 PAGE_SIZE); 186 instance->parea.frames = ALIGN_UP(size, PAGE_SIZE); 180 187 instance->parea.unpriv = false; 181 188 instance->parea.mapped = false;
Note:
See TracChangeset
for help on using the changeset viewer.