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

Ignore:
Timestamp:
2021-06-22T19:36:39Z (6 months ago)
Author:
Maurizio Lombardi <mlombard@…>
Branches:
master
Children:
37d0dd4
Parents:
73abf49
git-author:
Maurizio Lombardi <mlombard@…> (2021-06-22 19:26:24)
git-committer:
Maurizio Lombardi <mlombard@…> (2021-06-22 19:36:39)
Message:

raspberrypi: map the mbox address to memory

We should memory-map the mbox to memory
before trying to access it.
bcm2835_prop_get_memory() is an exception
because it's called early during the boot process
and we can't use km_map().

Signed-off-by: Maurizio Lombardi <mlombard@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/bcm2835/mbox.c

    r73abf49 r1b7b7af  
    132132        bool r;
    133133        MBOX_BUFF_ALLOC(msg, mbox_getfbsize_buf_t);
     134        bcm2835_mbox_t *mbox;
     135
     136        mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t),
     137            KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
     138        assert(mbox);
    134139
    135140        msg->buf_hdr.size = sizeof(mbox_getfbsize_buf_t);
     
    140145        msg->zero = 0;
    141146
    142         mbox_write((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR,
     147        mbox_write(mbox,
    143148            MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)msg));
    144         mbox_read((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR,
    145             MBOX_CHAN_PROP_A2V);
     149        mbox_read(mbox, MBOX_CHAN_PROP_A2V);
    146150
    147151        r = msg->buf_hdr.code == MBOX_PROP_CODE_RESP_OK;
     
    151155        }
    152156
     157        km_unmap((uintptr_t) mbox, sizeof(bcm2835_mbox_t));
    153158        return r;
    154159}
Note: See TracChangeset for help on using the changeset viewer.