Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 82dcd25 in mainline


Ignore:
Timestamp:
2019-04-06T16:14:01Z (22 months ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
3ef901d0
Parents:
46e886f
Message:

Pass physical address / port to ns16550_init

We need to know the physical address of the device's registers so that
we can put it into the registered parea.

Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/include/arch/mach/malta/malta.h

    r46e886f r82dcd25  
    4141#include <typedefs.h>
    4242
    43 #define MALTA_PCI_BASE          PA2KSEG1(0x18000000UL)
     43#define MALTA_PCI_PHYSBASE      0x18000000UL
     44
     45#define MALTA_PCI_BASE          PA2KSEG1(MALTA_PCI_PHYSBASE)
    4446#define MALTA_GT64120_BASE      PA2KSEG1(0x1be00000UL)
    4547
     
    4951#define ISA_IRQ_COUNT           16
    5052
    51 #define TTY_BASE                (MALTA_PCI_BASE + 0x3f8)
     53#define TTY_BASE                (MALTA_PCI_PHYSBASE + 0x3f8)
    5254#define TTY_ISA_IRQ             4
    5355
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    r46e886f r82dcd25  
    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.