All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: richard.henderson@linaro.org, deller@gmx.de, qemu-devel@nongnu.org
Subject: [PATCH v2 39/50] lasi: use constants for device register offsets
Date: Wed,  4 May 2022 10:25:49 +0100	[thread overview]
Message-ID: <20220504092600.10048-40-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20220504092600.10048-1-mark.cave-ayland@ilande.co.uk>

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>
---
 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



  parent reply	other threads:[~2022-05-04 10:14 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04  9:25 [PATCH v2 00/50] hppa: general improvements and tidy-ups Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 01/50] dino: checkpatch fixes Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 02/50] dino: move registers from dino_init() to DINO_PCI_BRIDGE init function Mark Cave-Ayland
2022-05-04 15:44   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 03/50] dino: move PCI bus initialisation to dino_pcihost_init() Mark Cave-Ayland
2022-05-04 16:50   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 04/50] dino: move PCI windows " Mark Cave-Ayland
2022-05-04 16:51   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 05/50] dino: add memory-as property containing a link to the memory address space Mark Cave-Ayland
2022-05-04 16:52   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 06/50] dino: move pci_setup_iommu() to dino_pcihost_init() Mark Cave-Ayland
2022-05-04 16:54   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 07/50] dino: move PCI bus master address space setup to dino_pcihost_realize() Mark Cave-Ayland
2022-05-04 16:55   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 08/50] dino: move initial register configuration to new dino_pcihost_reset() function Mark Cave-Ayland
2022-05-04 16:55   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 09/50] dino: use QOM cast instead of directly referencing parent_obj Mark Cave-Ayland
2022-05-04 16:56   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 10/50] dino: return PCIBus from dino_init() using qdev_get_child_bus() Mark Cave-Ayland
2022-05-04 16:56   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 11/50] dino: split declarations from dino.c into dino.h Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 12/50] hppa: use new CONFIG_HPPA_B160L option instead of CONFIG_DINO to build hppa machine Mark Cave-Ayland
2022-05-04 15:41   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 13/50] dino: change dino_init() to return the DINO device instead of PCIBus Mark Cave-Ayland
2022-05-05 17:41   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 14/50] machine.c: map DINO device during board configuration Mark Cave-Ayland
2022-05-05 17:44   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 15/50] dino.h: add defines for DINO IRQ numbers Mark Cave-Ayland
2022-05-05 17:45   ` Richard Henderson
2022-05-05 17:46   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 16/50] dino: define IRQ inputs as qdev GPIOs Mark Cave-Ayland
2022-05-05 17:47   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 17/50] dino: wire up serial IRQ using a qdev GPIO in machine.c Mark Cave-Ayland
2022-05-05 17:48   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 18/50] dino: remove unused dino_set_timer_irq() IRQ handler Mark Cave-Ayland
2022-05-05 17:49   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 19/50] hppa: move dino_init() from dino.c to machine.c Mark Cave-Ayland
2022-05-05 17:50   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 20/50] dino: use numerical constant for iar0 and iar1 reset values Mark Cave-Ayland
2022-05-05 17:52   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 21/50] dino: move DINO HPA constants from hppa_hardware.h to dino.h Mark Cave-Ayland
2022-05-05 17:52   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 22/50] dino: move from hw/hppa to hw/pci-host Mark Cave-Ayland
2022-05-05 17:55   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 23/50] lasi: checkpatch fixes Mark Cave-Ayland
2022-05-04 15:44   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 24/50] lasi: move memory region initialisation to new lasi_init() function Mark Cave-Ayland
2022-05-05 18:08   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 25/50] lasi: move register memory mapping from lasi.c to machine.c Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 26/50] lasi: move initialisation of iar and rtc to new lasi_reset() function Mark Cave-Ayland
2022-05-06  4:19   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 27/50] lasi: move LASIState and associated QOM structures to lasi.h Mark Cave-Ayland
2022-05-06  4:20   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 28/50] lasi: replace lasi_get_irq() with defined constants Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 29/50] lasi: define IRQ inputs as qdev GPIOs Mark Cave-Ayland
2022-05-06  4:26   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 30/50] lasi: use qdev GPIOs to wire up IRQs in lasi_initfn() Mark Cave-Ayland
2022-05-08  2:21   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 31/50] lasi: fix serial port initialisation Mark Cave-Ayland
2022-05-08  2:23   ` Richard Henderson
2022-05-08  2:33   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 32/50] lasi: update lasi_initfn() to return LASIState Mark Cave-Ayland
2022-05-08  2:35   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 33/50] lasi: move LAN initialisation to machine.c Mark Cave-Ayland
2022-05-08  2:37   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 34/50] lasi: move parallel port " Mark Cave-Ayland
2022-05-08  2:41   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 35/50] lasi: move second serial " Mark Cave-Ayland
2022-05-08  2:50   ` Richard Henderson
2022-05-08  8:50     ` Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 36/50] lasi: move PS2 " Mark Cave-Ayland
2022-05-08  2:52   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 37/50] lasi: remove address space parameter from lasi_initfn() Mark Cave-Ayland
2022-05-08  2:53   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 38/50] lasi: move lasi_initfn() to machine.c Mark Cave-Ayland
2022-05-08  2:54   ` Richard Henderson
2022-05-04  9:25 ` Mark Cave-Ayland [this message]
2022-05-08  3:04   ` [PATCH v2 39/50] lasi: use constants for device register offsets Richard Henderson
2022-05-08  8:56     ` Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 40/50] lasi: use numerical constant for iar reset value Mark Cave-Ayland
2022-05-08  2:58   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 41/50] hppa: move device headers from hppa_sys.h into individual .c files Mark Cave-Ayland
2022-05-08  2:59   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 42/50] lasi: move from hw/hppa to hw/misc Mark Cave-Ayland
2022-05-08  3:07   ` Richard Henderson
2022-05-08  9:09     ` Mark Cave-Ayland
2022-05-04  9:25 ` [PATCH v2 43/50] hppa: move hppa_pci_ignore_ops from pci.c to machine.c Mark Cave-Ayland
2022-05-08  3:13   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 44/50] hppa: remove hw/hppa/pci.c Mark Cave-Ayland
2022-05-08  3:14   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 45/50] hppa: remove unused trace-events from from hw/hppa Mark Cave-Ayland
2022-05-08  3:15   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 46/50] hppa: move enable_lan() define from hppa_sys.h to machine.c Mark Cave-Ayland
2022-05-08  3:17   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 47/50] hppa: remove the empty hppa_sys.h file Mark Cave-Ayland
2022-05-08  3:17   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 48/50] hppa: use MACHINE QOM macros for defining the hppa machine Mark Cave-Ayland
2022-05-08  3:18   ` Richard Henderson
2022-05-04  9:25 ` [PATCH v2 49/50] hppa: fold machine_hppa_machine_init() into machine_hppa_machine_init_class_init() Mark Cave-Ayland
2022-05-08  3:19   ` Richard Henderson
2022-05-04  9:26 ` [PATCH v2 50/50] hppa: simplify machine function names in machine.c Mark Cave-Ayland
2022-05-08  3:19   ` Richard Henderson
2022-05-08  9:21 ` [PATCH v2 00/50] hppa: general improvements and tidy-ups Mark Cave-Ayland
2022-05-08 13:30   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220504092600.10048-40-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=deller@gmx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.