diff options
author | Jason Thorpe <thorpej@me.com> | 2021-06-13 14:09:34 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-06-14 20:55:38 -0700 |
commit | 99d9b4dcf27d7fbcbadab71bdc88ef6531baf6bf (patch) | |
tree | 9fd924386b0e415c4e252c478b1c5c004decdbe6 /init.c | |
parent | 5e915346477f4f2f33345c7dbe711be828b58730 (diff) | |
download | qemu-palcode-master.tar.gz |
Provide a minimal Console Terminal Block in the HWRPB so that operating
systems that depend on it can correctly initialize the console device.
This is suffucient, at least, for the BSD operating systems, but may not
be sufficient for Digital UNIX.
In addition to defining and filling out the structures, there are a couple
of other key changes:
- Redefine the a2 register passed by Qemu at start-up to also include
some configuration flags, in addition to the CPU count, and define
a flag to mirror the "-nographics" option.
- We need to initialize the HWRPB *after* initializing VGA, so that
we'll know if a VGA device is present and in which slot for filling
out the CTB.
Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210613210934.21143-2-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 35 |
1 files changed, 32 insertions, 3 deletions
@@ -36,11 +36,20 @@ #define HZ 1024 +/* Upon entry, register a2 contains configuration information from the VM: + + bits 0-5 -- ncpus + bit 6 -- "nographics" option (used to initialize CTB) */ + +#define CONFIG_NCPUS(x) ((x) & 63) +#define CONFIG_NOGRAPHICS(x) ((x) & (1ull << 6)) + struct hwrpb_combine { struct hwrpb_struct hwrpb; struct percpu_struct processor[4]; struct memdesc_struct md; struct memclust_struct mc[2]; + struct ctb_struct ctb; struct crb_struct crb; struct procdesc_struct proc_dispatch; struct procdesc_struct proc_fixup; @@ -59,6 +68,8 @@ struct hwrpb_combine hwrpb __attribute__((aligned(PAGE_SIZE))); void *last_alloc; bool have_vga; +unsigned int pci_vga_bus; +unsigned int pci_vga_dev; static void * alloc (unsigned long size, unsigned long align) @@ -136,12 +147,13 @@ init_page_table(void) } static void -init_hwrpb (unsigned long memsize, unsigned long cpus) +init_hwrpb (unsigned long memsize, unsigned long config) { unsigned long pal_pages; unsigned long amask; unsigned long i; unsigned long proc_type = EV4_CPU; + unsigned long cpus = CONFIG_NCPUS(config); hwrpb.hwrpb.phys_addr = PA(&hwrpb); @@ -226,6 +238,22 @@ init_hwrpb (unsigned long memsize, unsigned long cpus) hwrpb.mc[1].start_pfn = pal_pages; hwrpb.mc[1].numpages = (memsize >> PAGE_SHIFT) - pal_pages; + hwrpb.hwrpb.ctbt_offset = offsetof(struct hwrpb_combine, ctb); + hwrpb.hwrpb.ctb_size = sizeof(hwrpb.ctb); + hwrpb.ctb.len = sizeof(hwrpb.ctb) - offsetof(struct ctb_struct, ipl); + if (have_vga && !CONFIG_NOGRAPHICS(config)) + { + hwrpb.ctb.type = CTB_MULTIPURPOSE; + hwrpb.ctb.term_type = CTB_GRAPHICS; + hwrpb.ctb.turboslot = (CTB_TURBOSLOT_TYPE_PCI << 16) | + (pci_vga_bus << 8) | pci_vga_dev; + } + else + { + hwrpb.ctb.type = CTB_PRINTERPORT; + hwrpb.ctb.term_type = CTB_PRINTERPORT; + } + hwrpb.hwrpb.crb_offset = offsetof(struct hwrpb_combine, crb); hwrpb.crb.dispatch_va = &hwrpb.proc_dispatch; hwrpb.crb.dispatch_pa = PA(&hwrpb.proc_dispatch); @@ -302,18 +330,19 @@ swppal(void *entry, void *pcb, unsigned long vptptr, unsigned long pv) } void -do_start(unsigned long memsize, void (*kernel_entry)(void), unsigned long cpus) +do_start(unsigned long memsize, void (*kernel_entry)(void), + unsigned long config) { last_alloc = _end; init_page_table(); - init_hwrpb(memsize, cpus); init_pcb(); init_i8259(); uart_init(); ps2port_setup(); pci_setup(); vgahw_init(); + init_hwrpb(memsize, config); void *new_pc = kernel_entry ? kernel_entry : do_console; |