xref: /openbmc/qemu/include/hw/misc/lasi.h (revision 2df1eb27)
1 /*
2  * HP-PARISC Lasi chipset emulation.
3  *
4  * (C) 2019 by Helge Deller <deller@gmx.de>
5  *
6  * This work is licensed under the GNU GPL license version 2 or later.
7  *
8  * Documentation available at:
9  * https://parisc.wiki.kernel.org/images-parisc/7/79/Lasi_ers.pdf
10  */
11 
12 #ifndef LASI_H
13 #define LASI_H
14 
15 #include "exec/address-spaces.h"
16 #include "hw/pci/pci_host.h"
17 #include "hw/boards.h"
18 
19 #define TYPE_LASI_CHIP "lasi-chip"
20 OBJECT_DECLARE_SIMPLE_TYPE(LasiState, LASI_CHIP)
21 
22 #define LASI_IRR        0x00    /* RO */
23 #define LASI_IMR        0x04
24 #define LASI_IPR        0x08
25 #define LASI_ICR        0x0c
26 #define LASI_IAR        0x10
27 
28 #define LASI_LPT        0x02000
29 #define LASI_UART       0x05000
30 #define LASI_LAN        0x07000
31 #define LASI_RTC        0x09000
32 
33 #define LASI_PCR        0x0C000 /* LASI Power Control register */
34 #define LASI_ERRLOG     0x0C004 /* LASI Error Logging register */
35 #define LASI_VER        0x0C008 /* LASI Version Control register */
36 #define LASI_IORESET    0x0C00C /* LASI I/O Reset register */
37 #define LASI_AMR        0x0C010 /* LASI Arbitration Mask register */
38 #define LASI_IO_CONF    0x7FFFE /* LASI primary configuration register */
39 #define LASI_IO_CONF2   0x7FFFF /* LASI secondary configuration register */
40 
41 #define LASI_BIT(x)     (1ul << (x))
42 #define LASI_IRQ_BITS   (LASI_BIT(5) | LASI_BIT(7) | LASI_BIT(8) | LASI_BIT(9) \
43             | LASI_BIT(13) | LASI_BIT(14) | LASI_BIT(16) | LASI_BIT(17) \
44             | LASI_BIT(18) | LASI_BIT(19) | LASI_BIT(20) | LASI_BIT(21) \
45             | LASI_BIT(26))
46 
47 #define ICR_BUS_ERROR_BIT  LASI_BIT(8)  /* bit 8 in ICR */
48 #define ICR_TOC_BIT        LASI_BIT(1)  /* bit 1 in ICR */
49 
50 #define LASI_IRQS           27
51 
52 #define LASI_IRQ_HPA        14
53 #define LASI_IRQ_UART_HPA   5
54 #define LASI_IRQ_LPT_HPA    7
55 #define LASI_IRQ_LAN_HPA    8
56 #define LASI_IRQ_SCSI_HPA   9
57 #define LASI_IRQ_AUDIO_HPA  13
58 #define LASI_IRQ_PS2KBD_HPA 26
59 #define LASI_IRQ_PS2MOU_HPA 26
60 
61 struct LasiState {
62     PCIHostState parent_obj;
63 
64     uint32_t irr;
65     uint32_t imr;
66     uint32_t ipr;
67     uint32_t icr;
68     uint32_t iar;
69 
70     uint32_t errlog;
71     uint32_t amr;
72     uint32_t rtc_ref;
73 
74     MemoryRegion this_mem;
75 };
76 
77 #endif
78