| 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 "system/address-spaces.h" |
| 16 | #include "hw/core/boards.h" |
| 17 | #include "hw/core/sysbus.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_AUDIO 0x04000 |
| 30 | #define LASI_UART 0x05000 |
| 31 | #define LASI_SCSI 0x06000 |
| 32 | #define LASI_LAN 0x07000 |
| 33 | #define LASI_PS2 0x08000 |
| 34 | #define LASI_RTC 0x09000 |
| 35 | #define LASI_FDC 0x0A000 |
| 36 | |
| 37 | #define LASI_PCR 0x0C000 /* LASI Power Control register */ |
| 38 | #define LASI_ERRLOG 0x0C004 /* LASI Error Logging register */ |
| 39 | #define LASI_VER 0x0C008 /* LASI Version Control register */ |
| 40 | #define LASI_IORESET 0x0C00C /* LASI I/O Reset register */ |
| 41 | #define LASI_AMR 0x0C010 /* LASI Arbitration Mask register */ |
| 42 | #define LASI_IO_CONF 0x7FFFE /* LASI primary configuration register */ |
| 43 | #define LASI_IO_CONF2 0x7FFFF /* LASI secondary configuration register */ |
| 44 | |
| 45 | #define LASI_BIT(x) (1ul << (x)) |
| 46 | #define LASI_IRQ_BITS (LASI_BIT(5) | LASI_BIT(7) | LASI_BIT(8) | LASI_BIT(9) \ |
| 47 | | LASI_BIT(13) | LASI_BIT(14) | LASI_BIT(16) | LASI_BIT(17) \ |
| 48 | | LASI_BIT(18) | LASI_BIT(19) | LASI_BIT(20) | LASI_BIT(21) \ |
| 49 | | LASI_BIT(26)) |
| 50 | |
| 51 | #define ICR_BUS_ERROR_BIT LASI_BIT(8) /* bit 8 in ICR */ |
| 52 | #define ICR_TOC_BIT LASI_BIT(1) /* bit 1 in ICR */ |
| 53 | |
| 54 | #define LASI_IRQS 27 |
| 55 | |
| 56 | #define LASI_IRQ_HPA 14 |
| 57 | #define LASI_IRQ_UART_HPA 5 |
| 58 | #define LASI_IRQ_LPT_HPA 7 |
| 59 | #define LASI_IRQ_LAN_HPA 8 |
| 60 | #define LASI_IRQ_SCSI_HPA 9 |
| 61 | #define LASI_IRQ_AUDIO_HPA 13 |
| 62 | #define LASI_IRQ_PS2KBD_HPA 26 |
| 63 | #define LASI_IRQ_PS2MOU_HPA 26 |
| 64 | |
| 65 | struct LasiState { |
| 66 | SysBusDevice parent_obj; |
| 67 | |
| 68 | uint32_t irr; |
| 69 | uint32_t imr; |
| 70 | uint32_t ipr; |
| 71 | uint32_t icr; |
| 72 | uint32_t iar; |
| 73 | |
| 74 | uint32_t errlog; |
| 75 | uint32_t amr; |
| 76 | uint32_t rtc_ref; |
| 77 | |
| 78 | MemoryRegion this_mem; |
| 79 | }; |
| 80 | |
| 81 | #endif |