Commit 34b5b76b42226a2dcb2962f8a52ae581d6d24fb6

Authored by Ji Luo
Committed by Peng Fan
1 parent 5b27f2dca5

MA-14318-1 Support dual bootloader for xen

Trusty is not supported for xen so we don't need to check
the keyslot package or rollback index in spl. Reassign the
dram address for spl and u-boot to avoid conflicts.

Support serial init functions to enable debug console
in spl when xen is running.

Test: Boot and A/B slot switch on imx8qm_mek.

Change-Id: If6829252f1ec2e32255f951715c8747181951fd0
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 30beee3fe6d4b35166c6e17203909231d33bc2db)
(cherry picked from commit a4ffa905d90d14ccdd146e4b38a69d40a568b747)
(cherry picked from commit 4729a057e8ad699ec01357dd219abdf296afe354)

Showing 3 changed files with 61 additions and 6 deletions Side-by-side Diff

drivers/serial/serial.c
... ... @@ -121,6 +121,7 @@
121 121 serial_initfunc(mcf_serial_initialize);
122 122 serial_initfunc(mpc85xx_serial_initialize);
123 123 serial_initfunc(mxc_serial_initialize);
  124 +serial_initfunc(xen_serial_initialize);
124 125 serial_initfunc(ns16550_serial_initialize);
125 126 serial_initfunc(pl01x_serial_initialize);
126 127 serial_initfunc(pxa_serial_initialize);
... ... @@ -176,6 +177,7 @@
176 177 mcf_serial_initialize();
177 178 mpc85xx_serial_initialize();
178 179 mxc_serial_initialize();
  180 + xen_serial_initialize();
179 181 ns16550_serial_initialize();
180 182 pl01x_serial_initialize();
181 183 pxa_serial_initialize();
drivers/serial/serial_xen.c
... ... @@ -22,7 +22,7 @@
22 22  
23 23 DECLARE_GLOBAL_DATA_PTR;
24 24  
25   -#ifdef CONFIG_DM_SERIAL
  25 +#if CONFIG_IS_ENABLED(DM_SERIAL)
26 26 struct xen_uart_priv {
27 27 struct xencons_interface *intf;
28 28 u32 evtchn;
... ... @@ -149,7 +149,7 @@
149 149 static int xen_serial_puts(struct udevice *dev, const char *str)
150 150 {
151 151 #ifdef CONFIG_SPL_BUILD
152   - (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(str), str);
  152 + (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(str), (char *)str);
153 153 #else
154 154 write_console(dev, str, strlen(str));
155 155 #endif
... ... @@ -160,7 +160,7 @@
160 160 static int xen_serial_putc(struct udevice *dev, const char ch)
161 161 {
162 162 #ifdef CONFIG_SPL_BUILD
163   - (void)HYPERVISOR_console_io(CONSOLEIO_write, 1, &ch);
  163 + (void)HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
164 164 #else
165 165 write_console(dev, &ch, 1);
166 166 #endif
167 167  
... ... @@ -190,9 +190,44 @@
190 190 .flags = DM_FLAG_PRE_RELOC | DM_FLAG_IGNORE_DEFAULT_CLKS,
191 191 };
192 192 #else
  193 +static void xen_serial_putc(const char c)
  194 +{
  195 + (void)HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&c);
  196 +}
  197 +
  198 +static void xen_serial_puts(const char *str)
  199 +{
  200 + (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(str), (char *)str);
  201 +}
  202 +
  203 +static int xen_serial_tstc(void)
  204 +{
  205 + return 0;
  206 +}
  207 +
  208 +static int xen_serial_init(void)
  209 +{
  210 + return 0;
  211 +}
  212 +
  213 +static void xen_serial_setbrg(void)
  214 +{
  215 +}
  216 +
  217 +static struct serial_device xen_serial_drv = {
  218 + .name = "xen_serial",
  219 + .start = xen_serial_init,
  220 + .stop = NULL,
  221 + .setbrg = xen_serial_setbrg,
  222 + .getc = NULL,
  223 + .putc = xen_serial_putc,
  224 + .puts = xen_serial_puts,
  225 + .tstc = xen_serial_tstc,
  226 +};
  227 +
193 228 __weak struct serial_device *default_serial_console(void)
194 229 {
195   - return NULL;
  230 + return &xen_serial_drv;
196 231 }
197 232  
198 233 #endif
... ... @@ -208,7 +243,7 @@
208 243 if (ch == '\n')
209 244 serial_putc('\r');
210 245  
211   - (void)HYPERVISOR_console_io(CONSOLEIO_write, 1, &ch);
  246 + (void)HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
212 247  
213 248 return;
214 249 }
include/configs/imx8qm_mek_android_auto_xen.h
... ... @@ -24,7 +24,7 @@
24 24 #undef CONFIG_LOADADDR
25 25 #define CONFIG_LOADADDR 0x80080000
26 26 #undef CONFIG_SYS_INIT_SP_ADDR
27   -#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
  27 +#define CONFIG_SYS_INIT_SP_ADDR 0x81200000
28 28  
29 29 #undef CONFIG_REQUIRE_SERIAL_CONSOLE
30 30 #undef CONFIG_IMX_SMMU
... ... @@ -34,6 +34,24 @@
34 34  
35 35 /* This needs to be stay same in iomem in domu.cfg */
36 36 #define SC_IPC_CH 0x5d1d0000
  37 +
  38 +#ifdef CONFIG_SPL_BUILD
  39 +#undef CONFIG_SPL_BSS_START_ADDR
  40 +#undef CONFIG_SYS_SPL_MALLOC_START
  41 +#undef CONFIG_MALLOC_F_ADDR
  42 +#undef CONFIG_SPL_TEXT_BASE
  43 +#undef CONFIG_SPL_STACK
  44 +
  45 +#define CONFIG_SPL_TEXT_BASE 0x80080000
  46 +#define CONFIG_MALLOC_F_ADDR 0x80100000
  47 +#define CONFIG_SYS_SPL_MALLOC_START 0x80200000
  48 +#define CONFIG_SPL_BSS_START_ADDR 0x80300000
  49 +#define CONFIG_SPL_STACK 0x80400000
  50 +
  51 +#define CONFIG_SYS_SPL_PTE_RAM_BASE 0x80500000
  52 +#endif
  53 +
  54 +#define AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED
37 55  
38 56 #endif /* IMX8QM_MEK_ANDROID_AUTO_XEN_H */