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

Changeset 2b11c3c in mainline


Ignore:
Timestamp:
2017-10-31T19:17:10Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
f834dd81
Parents:
48adf0f
Message:

OBIO should not store base address in a global variable.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r48adf0f r2b11c3c  
    1 #
     1x#
    22# Copyright (c) 2006 Martin Decky
    33# All rights reserved.
  • uspace/drv/intctl/obio/obio.c

    r48adf0f r2b11c3c  
    6868#define INO_MASK        0x1f
    6969
    70 static uintptr_t base_phys;
    71 static volatile uint64_t *base_virt = (volatile uint64_t *) AS_AREA_ANY;
    72 
    7370/** Handle one connection to obio.
    7471 *
     
    8178        ipc_callid_t callid;
    8279        ipc_call_t call;
     80        obio_t *obio;
    8381
    8482        /*
     
    8684         */
    8785        async_answer_0(iid, EOK);
     86
     87        obio = (obio_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
    8888
    8989        while (1) {
     
    9494                case IRC_ENABLE_INTERRUPT:
    9595                        inr = IPC_GET_ARG1(call);
    96                         base_virt[OBIO_IMR(inr & INO_MASK)] |= (1UL << 31);
     96                        ((volatile uint64_t *)(obio->regs))[OBIO_IMR(inr & INO_MASK)] |= (1UL << 31);
    9797                        async_answer_0(callid, EOK);
    9898                        break;
     
    103103                case IRC_CLEAR_INTERRUPT:
    104104                        inr = IPC_GET_ARG1(call);
    105                         base_virt[OBIO_CIR(inr & INO_MASK)] = 0;
     105                        ((volatile uint64_t *)(obio->regs))[OBIO_CIR(inr & INO_MASK)] = 0;
    106106                        async_answer_0(callid, EOK);
    107107                        break;
     
    117117{
    118118        ddf_fun_t *fun_a = NULL;
     119        int flags;
     120        int retval;
    119121        int rc;
    120122
    121         int flags = AS_AREA_READ | AS_AREA_WRITE;
    122         int retval = physmem_map(res->base,
     123        flags = AS_AREA_READ | AS_AREA_WRITE;
     124        obio->regs = (volatile uint64_t *)AS_AREA_ANY;
     125        retval = physmem_map(res->base,
    123126            ALIGN_UP(OBIO_SIZE, PAGE_SIZE) >> PAGE_WIDTH, flags,
    124             (void *) &base_virt);
     127            (void *) &obio->regs);
    125128
    126129        if (retval < 0) {
     
    130133        }
    131134
    132         ddf_msg(LVL_NOTE, "OBIO registers with base at 0x%" PRIun, base_phys);
     135        ddf_msg(LVL_NOTE, "OBIO registers with base at 0x%" PRIun, res->base);
    133136
    134137        fun_a = ddf_fun_create(obio->dev, fun_exposed, "a");
  • uspace/drv/intctl/obio/obio.h

    r48adf0f r2b11c3c  
    4747/** OBIO */
    4848typedef struct {
    49         ioport32_t *regs;
     49        volatile uint64_t *regs;
    5050        uintptr_t phys_base;
    5151        ddf_dev_t *dev;
Note: See TracChangeset for help on using the changeset viewer.