[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 39/53] lasi: use constants for device register offsets
From: |
Mark Cave-Ayland |
Subject: |
[PULL 39/53] lasi: use constants for device register offsets |
Date: |
Sun, 8 May 2022 20:56:36 +0100 |
Instead of generating the offset based upon the physical address of the
register, add constants for each of the device registers to lasi.h and
update lasi.c to use them.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220504092600.10048-40-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/hppa/lasi.c | 28 ++++++++++++++--------------
hw/hppa/lasi.h | 5 +++++
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c
index ad50880a13..11ca33fba3 100644
--- a/hw/hppa/lasi.c
+++ b/hw/hppa/lasi.c
@@ -36,10 +36,10 @@ static bool lasi_chip_mem_valid(void *opaque, hwaddr addr,
case LASI_ICR:
case LASI_IAR:
- case (LASI_LAN_HPA - LASI_HPA):
- case (LASI_LPT_HPA - LASI_HPA):
- case (LASI_UART_HPA - LASI_HPA):
- case (LASI_RTC_HPA - LASI_HPA):
+ case LASI_LPT:
+ case LASI_UART:
+ case LASI_LAN:
+ case LASI_RTC:
case LASI_PCR ... LASI_AMR:
ret = true;
@@ -76,12 +76,12 @@ static MemTxResult lasi_chip_read_with_attrs(void *opaque,
hwaddr addr,
val = s->iar;
break;
- case (LASI_LAN_HPA - LASI_HPA):
- case (LASI_LPT_HPA - LASI_HPA):
- case (LASI_UART_HPA - LASI_HPA):
+ case LASI_LPT:
+ case LASI_UART:
+ case LASI_LAN:
val = 0;
break;
- case (LASI_RTC_HPA - LASI_HPA):
+ case LASI_RTC:
val = time(NULL);
val += s->rtc_ref;
break;
@@ -141,16 +141,16 @@ static MemTxResult lasi_chip_write_with_attrs(void
*opaque, hwaddr addr,
s->iar = val;
break;
- case (LASI_LAN_HPA - LASI_HPA):
- /* XXX: reset LAN card */
- break;
- case (LASI_LPT_HPA - LASI_HPA):
+ case LASI_LPT:
/* XXX: reset parallel port */
break;
- case (LASI_UART_HPA - LASI_HPA):
+ case LASI_UART:
/* XXX: reset serial port */
break;
- case (LASI_RTC_HPA - LASI_HPA):
+ case LASI_LAN:
+ /* XXX: reset LAN card */
+ break;
+ case LASI_RTC:
s->rtc_ref = val - time(NULL);
break;
diff --git a/hw/hppa/lasi.h b/hw/hppa/lasi.h
index 63a2be3740..11cf7d6b0b 100644
--- a/hw/hppa/lasi.h
+++ b/hw/hppa/lasi.h
@@ -21,6 +21,11 @@ OBJECT_DECLARE_SIMPLE_TYPE(LasiState, LASI_CHIP)
#define LASI_ICR 0x0c
#define LASI_IAR 0x10
+#define LASI_LPT 0x02000
+#define LASI_UART 0x05000
+#define LASI_LAN 0x07000
+#define LASI_RTC 0x09000
+
#define LASI_PCR 0x0C000 /* LASI Power Control register */
#define LASI_ERRLOG 0x0C004 /* LASI Error Logging register */
#define LASI_VER 0x0C008 /* LASI Version Control register */
--
2.20.1
- [PULL 30/53] lasi: use qdev GPIOs to wire up IRQs in lasi_initfn(), (continued)
- [PULL 30/53] lasi: use qdev GPIOs to wire up IRQs in lasi_initfn(), Mark Cave-Ayland, 2022/05/08
- [PULL 32/53] lasi: update lasi_initfn() to return LASIState, Mark Cave-Ayland, 2022/05/08
- [PULL 37/53] lasi: remove address space parameter from lasi_initfn(), Mark Cave-Ayland, 2022/05/08
- [PULL 33/53] lasi: move LAN initialisation to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 36/53] lasi: move PS2 initialisation to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 34/53] lasi: move parallel port initialisation to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 41/53] hppa: move device headers from hppa_sys.h into individual .c files, Mark Cave-Ayland, 2022/05/08
- [PULL 42/53] lasi: move from hw/hppa to hw/misc, Mark Cave-Ayland, 2022/05/08
- [PULL 38/53] lasi: move lasi_initfn() to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 35/53] lasi: move second serial port initialisation to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 39/53] lasi: use constants for device register offsets,
Mark Cave-Ayland <=
- [PULL 40/53] lasi: use numerical constant for iar reset value, Mark Cave-Ayland, 2022/05/08
- [PULL 43/53] hppa: move hppa_pci_ignore_ops from pci.c to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 44/53] hppa: remove hw/hppa/pci.c, Mark Cave-Ayland, 2022/05/08
- [PULL 45/53] hppa: remove unused trace-events from from hw/hppa, Mark Cave-Ayland, 2022/05/08
- [PULL 46/53] hppa: move enable_lan() define from hppa_sys.h to machine.c, Mark Cave-Ayland, 2022/05/08
- [PULL 47/53] hppa: remove the empty hppa_sys.h file, Mark Cave-Ayland, 2022/05/08
- [PULL 48/53] hppa: use MACHINE QOM macros for defining the hppa machine, Mark Cave-Ayland, 2022/05/08
- [PULL 49/53] hppa: fold machine_hppa_machine_init() into machine_hppa_machine_init_class_init(), Mark Cave-Ayland, 2022/05/08
- [PULL 51/53] artist: checkpatch and newline style fixes, Mark Cave-Ayland, 2022/05/08
- [PULL 50/53] hppa: simplify machine function names in machine.c, Mark Cave-Ayland, 2022/05/08