qemu-palcode.git
11 months agoProvide a minimal Console Terminal Block in the HWRPB. master
Jason Thorpe [Sun, 13 Jun 2021 21:09:34 +0000 (14:09 -0700)] 
Provide a minimal Console Terminal Block in the HWRPB.

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>
11 months agoFixes for secondary CPU start-up.
Jason Thorpe [Thu, 3 Jun 2021 03:53:17 +0000 (20:53 -0700)] 
Fixes for secondary CPU start-up.

Changes to make secondary CPU start-up work on NetBSD, which depends
on some specific behavior in the architecture specification:

- Change the internal swppal() function to take the new VPTPTR and
  Procedure Value as explicit arguments.  Adapt do_start() to the
  new the new swppal() signature.

- In do_start_wait(), extract the new VPTPTR and PV from the relevant
  HWRPB fields, which will have been initialized by the OS, and pass
  them to swppal().

- In the SWPPAL PAL call, get the value to stuff into PV (r27) from
  a4 (r20), and add a comment describing why this implementation detail
  is allowed by the architecture specification.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-9-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoProvide interrupt mapping information in PCI config registers.
Jason Thorpe [Thu, 3 Jun 2021 03:53:15 +0000 (20:53 -0700)] 
Provide interrupt mapping information in PCI config registers.

Use system-specific information to program the interrupt line register
with the interrupt mappings, which is what the SRM console does on real
hardware; some operating systems (e.g. NetBSD) use this information
rather than having interrupt mappings tables for every possible system
variation.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-7-thorpej@me.com>
[rth: Use inline not macro; fold -1 -> 0xff map into interface.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoFix incorrect initialization of PCI BARs
Jason Thorpe [Sun, 6 Jun 2021 00:36:16 +0000 (17:36 -0700)] 
Fix incorrect initialization of PCI BARs

Only program a BAR as a 64-bit MEM BAR if it really is a 64-bit MEM BAR.
Fixes an issue with the CMD646 IDE controller under NetBSD.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-6-thorpej@me.com>
[rth: Combine the two tests.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoMake some PCI macros available to other files. NFC.
Jason Thorpe [Thu, 3 Jun 2021 03:53:13 +0000 (20:53 -0700)] 
Make some PCI macros available to other files. NFC.

Move PCI_DEVFN(), PCI_BUS(), PCI_SLOT(), and PCI_FUNC() to pci.h.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-5-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoTidy comment re CY82C693UB vs PIIX
Jason Thorpe [Sun, 6 Jun 2021 00:29:30 +0000 (17:29 -0700)] 
Tidy comment re CY82C693UB vs PIIX

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-4-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoFix initialization of the hwrpb.hwrpb.cpuid field.
Jason Thorpe [Thu, 3 Jun 2021 03:53:12 +0000 (20:53 -0700)] 
Fix initialization of the hwrpb.hwrpb.cpuid field.

Initialize the hwrpb.hwrpb.cpuid field with the primary CPU ID, not
the processor type, as per the architecture specification.  Some
operating systems check and assert this.

Improve a couple of comments.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-4-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoFix delivery of unaligned access exceptions.
Jason Thorpe [Thu, 3 Jun 2021 03:53:11 +0000 (20:53 -0700)] 
Fix delivery of unaligned access exceptions.

In the unaligned access exception vector, actually pass the return PC
in the exception frame.  This is required in order for unaligned access
fixup handlers in the operating system to work.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-3-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11 months agoMake qemu-palcode build environment standalone. NFC.
Jason Thorpe [Thu, 3 Jun 2021 03:53:10 +0000 (20:53 -0700)] 
Make qemu-palcode build environment standalone. NFC.

Don't include system headers.  Instead, provide standalone definitions
and declarations of types needed and functions used by the PALcode that
are compatible with the standard Alpha / GCC ABI.

Signed-off-by: Jason Thorpe <thorpej@me.com>
Message-Id: <20210603035317.6814-2-thorpej@me.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoReport machine checks to the kernel github/master
Richard Henderson [Mon, 25 Mar 2019 20:09:53 +0000 (13:09 -0700)] 
Report machine checks to the kernel

Use a minimally populated logout frame.  This is good enough to
handle probing of devices using the kernel's mcheck_expected.

Signed-off-by: Richard Henderson <rth@twiddle.net>
3 years agoDo not increment PC for OPCDEC
Richard Henderson [Tue, 8 Jan 2019 02:08:37 +0000 (12:08 +1000)] 
Do not increment PC for OPCDEC

This will already have been done by QEMU.

Fixes: https://bugs.launchpad.net/bugs/1810545
Signed-off-by: Richard Henderson <rth@twiddle.net>
5 years agoReinstate do_console if kernel not provided
Richard Henderson [Sun, 13 Nov 2016 18:08:24 +0000 (19:08 +0100)] 
Reinstate do_console if kernel not provided

Signed-off-by: Richard Henderson <rth@twiddle.net>
5 years agoTidy clipper Sys_Setup
Richard Henderson [Sun, 13 Nov 2016 11:21:45 +0000 (12:21 +0100)] 
Tidy clipper Sys_Setup

Signed-off-by: Richard Henderson <rth@twiddle.net>
5 years agoAdd smp support
Richard Henderson [Sun, 13 Nov 2016 11:04:29 +0000 (12:04 +0100)] 
Add smp support

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agoAdd Cserve_Get_VM_Time
Richard Henderson [Tue, 16 Jul 2013 13:46:36 +0000 (06:46 -0700)] 
Add Cserve_Get_VM_Time

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agoBuild with -O2 and -g1.
Richard Henderson [Mon, 8 Jul 2013 19:13:01 +0000 (12:13 -0700)] 
Build with -O2 and -g1.

8 years agoDon't initialize COM2.
Richard Henderson [Mon, 8 Jul 2013 18:49:21 +0000 (11:49 -0700)] 
Don't initialize COM2.

At least not until we implement MCHK handling.  The current QEMU will
(properly) MCHK when accessing a non-existant device.

8 years agoOptimize memory layout.
Richard Henderson [Mon, 8 Jul 2013 18:48:03 +0000 (11:48 -0700)] 
Optimize memory layout.

Minimizing the amount of padding between page-aligned data structures.

8 years agoDeclare vgahw_init where init.c can find it.
Richard Henderson [Mon, 8 Jul 2013 18:46:21 +0000 (11:46 -0700)] 
Declare vgahw_init where init.c can find it.

8 years agoOmit video_save_pointer_table as unused.
Richard Henderson [Mon, 8 Jul 2013 18:45:58 +0000 (11:45 -0700)] 
Omit video_save_pointer_table as unused.

8 years agoFix use of undefined PACKED macro.
Richard Henderson [Mon, 8 Jul 2013 18:45:34 +0000 (11:45 -0700)] 
Fix use of undefined PACKED macro.

8 years agoMake vga fonts const
Richard Henderson [Mon, 8 Jul 2013 18:34:57 +0000 (11:34 -0700)] 
Make vga fonts const

10 years agoProperly detect the presence of a vga device.
Richard Henderson [Fri, 3 Jun 2011 22:12:52 +0000 (17:12 -0500)] 
Properly detect the presence of a vga device.

10 years agoInitialize a VGA controler.
Richard Henderson [Fri, 3 Jun 2011 04:15:49 +0000 (23:15 -0500)] 
Initialize a VGA controler.

Doesn't actually check to see that one exists yet...

11 years agoBegin initiallizing the VGA card.
Richard Henderson [Mon, 9 May 2011 17:59:50 +0000 (10:59 -0700)] 
Begin initiallizing the VGA card.

11 years agoAdd in/out functions for 16 and 32-bit quantities.
Richard Henderson [Mon, 9 May 2011 17:59:22 +0000 (10:59 -0700)] 
Add in/out functions for 16 and 32-bit quantities.

11 years agoHack: Move pci BAR ranges.
Richard Henderson [Mon, 9 May 2011 17:58:45 +0000 (10:58 -0700)] 
Hack: Move pci BAR ranges.

The Linux kernel will re-allocate all of these, tickling what appears
to be a bug in QEMU.  Work around this by moving the ranges allocated
by the console so that the new ranges don't overlap.

11 years agoDon't use alarms for ndelay.
Richard Henderson [Sat, 7 May 2011 01:05:46 +0000 (18:05 -0700)] 
Don't use alarms for ndelay.

11 years agoInitial PCI setup.
Richard Henderson [Sat, 7 May 2011 01:05:13 +0000 (18:05 -0700)] 
Initial PCI setup.

11 years agoInline i/o routines.
Richard Henderson [Sat, 7 May 2011 01:04:44 +0000 (18:04 -0700)] 
Inline i/o routines.

11 years agoHandle padding in printf numerical output.
Richard Henderson [Fri, 6 May 2011 22:50:07 +0000 (15:50 -0700)] 
Handle padding in printf numerical output.

11 years agoUse level-triggered ISA interrupts.
Richard Henderson [Fri, 6 May 2011 18:52:02 +0000 (11:52 -0700)] 
Use level-triggered ISA interrupts.

11 years agoAdd ps2 keyboard initialization.
Richard Henderson [Fri, 6 May 2011 18:07:37 +0000 (11:07 -0700)] 
Add ps2 keyboard initialization.

Which also requires that we properly initialize the i8259 (ISA)
interrupt controller.

11 years agoBeginnings of the SRM console prompt.
Richard Henderson [Thu, 5 May 2011 20:06:24 +0000 (13:06 -0700)] 
Beginnings of the SRM console prompt.

11 years agoRead the correct register for typhoon device interrupt ready.
Richard Henderson [Tue, 3 May 2011 14:49:58 +0000 (07:49 -0700)] 
Read the correct register for typhoon device interrupt ready.

11 years agoImplement the console callback interface.
Richard Henderson [Mon, 2 May 2011 17:46:14 +0000 (10:46 -0700)] 
Implement the console callback interface.

At least enough for GETC and PUTS.

11 years agoclipper: Report ISA interrupts properly.
Richard Henderson [Mon, 2 May 2011 15:48:14 +0000 (08:48 -0700)] 
clipper: Report ISA interrupts properly.

11 years agoFix SMP stack initialization.
Richard Henderson [Mon, 2 May 2011 03:17:07 +0000 (20:17 -0700)] 
Fix SMP stack initialization.

11 years agoAdd copyright information.
Richard Henderson [Sun, 1 May 2011 16:11:52 +0000 (09:11 -0700)] 
Add copyright information.

11 years agoRearrange Cserve. Add QMU clock/alarm related entry points.
Richard Henderson [Thu, 28 Apr 2011 15:45:05 +0000 (08:45 -0700)] 
Rearrange Cserve.  Add QMU clock/alarm related entry points.

11 years agoSet max_asn properly for the cpu.
Richard Henderson [Wed, 27 Apr 2011 21:46:50 +0000 (14:46 -0700)] 
Set max_asn properly for the cpu.

11 years agoRe-org for Clipper system.
Richard Henderson [Wed, 27 Apr 2011 16:43:00 +0000 (09:43 -0700)] 
Re-org for Clipper system.

11 years agoFix error in SWPCTX code.
Richard Henderson [Mon, 25 Apr 2011 21:09:29 +0000 (14:09 -0700)] 
Fix error in SWPCTX code.

11 years agoUse fixed frequency for rpcc.
Richard Henderson [Sun, 24 Apr 2011 20:40:23 +0000 (13:40 -0700)] 
Use fixed frequency for rpcc.

11 years agoImplement CallPal_Cserve.
Richard Henderson [Wed, 20 Apr 2011 22:20:43 +0000 (15:20 -0700)] 
Implement CallPal_Cserve.

This is just good enough to handle the cserve_ena/dis used by
the Linux kernel for managing interrupts.

11 years agoImplement WTINT.
Richard Henderson [Fri, 22 Apr 2011 13:48:21 +0000 (06:48 -0700)] 
Implement WTINT.

11 years agoUse qemu_sysval and qemu_usp, newly exported from QEMU.
Richard Henderson [Mon, 18 Apr 2011 22:20:38 +0000 (15:20 -0700)] 
Use qemu_sysval and qemu_usp, newly exported from QEMU.

11 years agoBuild palcode-sx164 instead of palcode.
Richard Henderson [Mon, 18 Apr 2011 22:17:40 +0000 (15:17 -0700)] 
Build palcode-sx164 instead of palcode.

11 years agoOptimize for size, and pca56.
Richard Henderson [Sat, 16 Apr 2011 15:24:30 +0000 (08:24 -0700)] 
Optimize for size, and pca56.

11 years agoUse explicit division avoidance in print_decimal.
Richard Henderson [Sat, 16 Apr 2011 15:24:15 +0000 (08:24 -0700)] 
Use explicit division avoidance in print_decimal.

11 years agoFix return value for early return in memset.
Richard Henderson [Sat, 16 Apr 2011 14:59:53 +0000 (07:59 -0700)] 
Fix return value for early return in memset.

11 years agoFix typos in rti implementation.
Richard Henderson [Fri, 15 Apr 2011 01:37:56 +0000 (18:37 -0700)] 
Fix typos in rti implementation.

11 years agoHandle timer interrupts specially.
Richard Henderson [Thu, 14 Apr 2011 23:49:28 +0000 (16:49 -0700)] 
Handle timer interrupts specially.

11 years agoRaise the interrupt level for entInt
Richard Henderson [Thu, 14 Apr 2011 03:07:56 +0000 (20:07 -0700)] 
Raise the interrupt level for entInt

11 years agoPCBB.PTBR contains a page frame number, not a physical address.
Richard Henderson [Wed, 13 Apr 2011 23:57:22 +0000 (16:57 -0700)] 
PCBB.PTBR contains a page frame number, not a physical address.

11 years agoUse -Wall.
Richard Henderson [Wed, 13 Apr 2011 19:57:57 +0000 (12:57 -0700)] 
Use -Wall.

11 years agoRely less on initialized data.
Richard Henderson [Wed, 13 Apr 2011 19:57:44 +0000 (12:57 -0700)] 
Rely less on initialized data.

(1) Don't statically initialize HWRPB and PCBB.
(2) Use SwpPal at the end of do_start to install the PCBB and PTBR,
    rather than setting those up in __start in PALmode.
(3) Use -mbuild-constants to prevent the compiler using static data.

11 years agoDon't hard-code paths to the cross-compiler.
Richard Henderson [Wed, 13 Apr 2011 00:07:34 +0000 (17:07 -0700)] 
Don't hard-code paths to the cross-compiler.

11 years agoFix WrEnt bounds checking.
Richard Henderson [Tue, 12 Apr 2011 06:04:50 +0000 (23:04 -0700)] 
Fix WrEnt bounds checking.

11 years agoMisc enhancements
Richard Henderson [Tue, 12 Apr 2011 03:59:02 +0000 (20:59 -0700)] 
Misc enhancements

(1) Mark symbols as functions,
(2) Fix STACK_FRAME in-kernel test
(3) Zero newly allocated memory

11 years agoDon't allow MMFault in PALmode.
Richard Henderson [Tue, 12 Apr 2011 00:08:18 +0000 (17:08 -0700)] 
Don't allow MMFault in PALmode.

11 years agoSignal halt properly.
Richard Henderson [Tue, 12 Apr 2011 00:07:58 +0000 (17:07 -0700)] 
Signal halt properly.

11 years agoDynamically allocate page tables; setup as per MILO.
Richard Henderson [Tue, 12 Apr 2011 00:07:22 +0000 (17:07 -0700)] 
Dynamically allocate page tables; setup as per MILO.

11 years agoAdd simplistic printf.
Richard Henderson [Mon, 11 Apr 2011 17:47:43 +0000 (10:47 -0700)] 
Add simplistic printf.

11 years agoAdd rudimentary printf.
Richard Henderson [Mon, 11 Apr 2011 05:58:07 +0000 (22:58 -0700)] 
Add rudimentary printf.

11 years agoMove stack to sbss section for easy access.
Richard Henderson [Mon, 11 Apr 2011 05:57:42 +0000 (22:57 -0700)] 
Move stack to sbss section for easy access.

11 years agoAdd uart printing support.
Richard Henderson [Mon, 11 Apr 2011 02:20:18 +0000 (19:20 -0700)] 
Add uart printing support.

11 years agoTEMP: finished through init_page_tables
Richard Henderson [Wed, 6 Apr 2011 23:02:23 +0000 (16:02 -0700)] 
TEMP: finished through init_page_tables

11 years agoTEMP
Richard Henderson [Wed, 6 Apr 2011 23:02:02 +0000 (16:02 -0700)] 
TEMP