Ignore:
Timestamp:
2019-06-27T08:51:20Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
8add15e0
Parents:
ad40b74b (diff), aeba767 (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.
Message:

cpp: merge and resolve conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    rad40b74b rbc73be3  
    3939#include <genarch/drivers/ns16550/ns16550.h>
    4040#include <ddi/irq.h>
     41#include <ddi/ddi.h>
    4142#include <arch/asm.h>
    4243#include <console/chardev.h>
    4344#include <stdlib.h>
     45#include <align.h>
    4446#include <str.h>
    4547
     
    143145 *
    144146 */
    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));
     147ns16550_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));
    150154        if (instance) {
    151155                instance->ns16550 = dev;
     
    158162                        if (!instance->output) {
    159163                                free(instance);
     164                                pio_unmap((void *) dev_phys, (void *) dev,
     165                                    size);
    160166                                return NULL;
    161167                        }
     
    176182
    177183                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);
    180187                instance->parea.unpriv = false;
    181188                instance->parea.mapped = false;
Note: See TracChangeset for help on using the changeset viewer.