Changeset 2b11c3c in mainline for uspace/drv/intctl/obio/obio.c


Ignore:
Timestamp:
2017-10-31T19:17:10Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f834dd81
Parents:
48adf0f
Message:

OBIO should not store base address in a global variable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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");
Note: See TracChangeset for help on using the changeset viewer.