On Sun, 23 Feb 2025 at 11:47, Bernhard Beschow <shen...@gmail.com> wrote: > > As a first step, implement the bare minimum: CPUs, RAM, interrupt controller, > serial. All other devices of the A53 memory map are represented as > TYPE_UNIMPLEMENTED_DEVICE, i.e. the whole memory map is provided. This allows > for running Linux without it crashing due to invalid memory accesses.
> +static const struct { > + hwaddr addr; > + size_t size; > + const char *name; > +} fsl_imx8mp_memmap[] = { > + [FSL_IMX8MP_UART2] = { 0x30890000, 64 * KiB, "uart2" }, > + [FSL_IMX8MP_UART3] = { 0x30880000, 64 * KiB, "uart3" }, > + [FSL_IMX8MP_UART1] = { 0x30860000, 64 * KiB, "uart1" }, > + /* UARTs */ > + for (i = 0; i < FSL_IMX8MP_NUM_UARTS; i++) { > + static const struct { > + hwaddr addr; > + unsigned int irq; > + } serial_table[FSL_IMX8MP_NUM_UARTS] = { > + { fsl_imx8mp_memmap[FSL_IMX8MP_UART1].addr, FSL_IMX8MP_UART1_IRQ > }, > + { fsl_imx8mp_memmap[FSL_IMX8MP_UART2].addr, FSL_IMX8MP_UART2_IRQ > }, > + { fsl_imx8mp_memmap[FSL_IMX8MP_UART3].addr, FSL_IMX8MP_UART3_IRQ > }, > + { fsl_imx8mp_memmap[FSL_IMX8MP_UART4].addr, FSL_IMX8MP_UART4_IRQ > }, > + }; The C compiler for the OpenSUSE CI job doesn't seem to like this: https://gitlab.com/pm215/qemu/-/jobs/9239416833 ../hw/arm/fsl-imx8mp.c: In function ‘fsl_imx8mp_realize’: ../hw/arm/fsl-imx8mp.c:382:15: error: initializer element is not constant { fsl_imx8mp_memmap[FSL_IMX8MP_UART1].addr, FSL_IMX8MP_UART1_IRQ }, ^~~~~~~~~~~~~~~~~ ../hw/arm/fsl-imx8mp.c:382:15: note: (near initialization for ‘serial_table[0].addr’) ../hw/arm/fsl-imx8mp.c:383:15: error: initializer element is not constant { fsl_imx8mp_memmap[FSL_IMX8MP_UART2].addr, FSL_IMX8MP_UART2_IRQ }, ^~~~~~~~~~~~~~~~~ This is (gcc 7.5.0 "cc (SUSE Linux) 7.5.0") apparently. That's a pretty old compiler, only just within the bounds of our version requirements (which are 7.4 or better), so I'm guessing it's just not as smart about figuring out that the initializer here really is a constant value. I'll fix this up by dropping the "const" from the serial_table[] etc definitions. -- PMM