aboutsummaryrefslogtreecommitdiff
path: root/hw/hppa
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-05-04 10:25:49 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-05-08 18:52:37 +0100
commitca7b468be8944d2c166f6b7cf25cd5e8e006bc03 (patch)
tree29c6a41ec4e421a6440a9ecb96d36d42e80129bb /hw/hppa
parente881e3c83a47214d5d5d4141a1bc4ad99486f80a (diff)
downloadqemu-ca7b468be8944d2c166f6b7cf25cd5e8e006bc03.zip
qemu-ca7b468be8944d2c166f6b7cf25cd5e8e006bc03.tar.gz
qemu-ca7b468be8944d2c166f6b7cf25cd5e8e006bc03.tar.bz2
lasi: use constants for device register offsets
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>
Diffstat (limited to 'hw/hppa')
-rw-r--r--hw/hppa/lasi.c28
-rw-r--r--hw/hppa/lasi.h5
2 files changed, 19 insertions, 14 deletions
diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c
index ad50880..11ca33f 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 63a2be3..11cf7d6 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 */