> From: Andrew Baumann > Sent: Monday, 10 April 2017 10:05 > > From: Omar Rizwan [mailto:omar.riz...@gmail.com] > > Sent: Friday, 7 April 2017 23:13
> > I can't easily find documentation for that 0x40000000 memory mapping, > > which I figured I'd keep in; should it just be removed from bcm2835? > > Am I misunderstanding something? > > The various mapping aliases are intended to implement the bus addresses from > S1.2.3 / figure on page 5 of this document: > https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM- > Peripherals.pdf > > In ARM CPU physical addresses, the RAM is mapped at 0, and the peripherals at > 0x20000000 > > In VC CPU bus addresses (which get used for DMA), RAM is aliased four times, > at 0 0x40000000 0x80000000 and 0xC0000000. Peripherals are also aliased > four times at a fixed offset of 0x3e000000 from the base of the RAM alias, > which is how you get the 0x7e000000 peripheral base (0x40000000 + > 0x3e000000). > > This is implemented as follows: bcm2835_peripherals implements/exports one > memory region "peri_mr" which contains just the peripherals. It also builds a > private MR for the GPU ("VC CPU" in the spec) bus addresses, "gpu_mr", and > aliases RAM into it four times along with the peripheral MR at > BCM2835_VC_PERI_BASE (0x7e000000). Its parent, device, either bcm2835 or > bcm2836, maps the peripheral MR into the default sysbus mmio bus (i.e., the > CPU's physical address space) at the relevant CPU physical base address > (0x20000000 on pi1, 0x3F000000 on pi2). > > Now, as to why the mapping call fails: I'm confused where you saw that call > with the 0x40000000 address. The code in my tree for bcm2835.c is: > > /* Peripheral base address seen by the CPU */ > #define BCM2835_PERI_BASE 0x20000000 > ... > sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, > BCM2835_PERI_BASE, 1); Ok, I just looked at your patch, and it looks like you added the 0x40000000 mapping. It's definitely not in my tree (https://github.com/0xabu/qemu/blob/raspi/hw/arm/bcm2835.c). I would suggest taking it back out again and sanity-checking your patch against the code in my tree for any other spurious changes that may have snuck in... Andrew