summaryrefslogtreecommitdiff
path: root/util/inteltool/ahci.c
diff options
context:
space:
mode:
authorMichael Niewöhner <foss@mniewoehner.de>2020-03-13 19:08:21 +0100
committerFelix Held <felix-coreboot@felixheld.de>2020-03-21 22:12:10 +0000
commit10d522133ef7531c1777c89b1a9ba3cdca5e25ee (patch)
tree32b4a98ed45c12b9a5fd586fb869c150070d2397 /util/inteltool/ahci.c
parent96cf680c3d5e4f98ddc05ccb7d50f48452014d0b (diff)
util/inteltool: use read* macros instead of pointers
Switch to using read* macros instead of pointers. Change-Id: I1fe54b496a5998597b79cdd7108f3a4075744a78 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39503 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'util/inteltool/ahci.c')
-rw-r--r--util/inteltool/ahci.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/util/inteltool/ahci.c b/util/inteltool/ahci.c
index 90a1617f8f..82f792d0e6 100644
--- a/util/inteltool/ahci.c
+++ b/util/inteltool/ahci.c
@@ -84,9 +84,6 @@ static const io_register_t sunrise_ahci_sir_registers[] = {
#define NUM_GHC (sizeof(ghc_regs)/sizeof(ghc_regs[0]))
#define NUM_PORTCTL (sizeof(port_ctl_regs)/sizeof(port_ctl_regs[0]))
-#define MMIO(offset) (*(uint32_t *)(mmio + offset))
-#define MMIO_PORT(offset) (*(uint32_t *)(mmio_port + offset))
-
static void print_port(const uint8_t *const mmio, size_t port)
{
size_t i;
@@ -96,10 +93,11 @@ static void print_port(const uint8_t *const mmio, size_t port)
if (i / 4 < NUM_PORTCTL) {
printf("0x%03zx: 0x%08x (%s)\n",
(size_t)(mmio_port - mmio) + i,
- MMIO_PORT(i), port_ctl_regs[i / 4]);
- } else if (MMIO_PORT(i)) {
+ read32(mmio_port + i), port_ctl_regs[i / 4]);
+ } else if (read32(mmio_port + i)) {
printf("0x%03zx: 0x%08x (Reserved)\n",
- (size_t)(mmio_port - mmio) + i, MMIO_PORT(i));
+ (size_t)(mmio_port - mmio) + i,
+ read32(mmio_port + i));
}
}
}
@@ -195,22 +193,23 @@ int print_ahci(struct pci_dev *ahci)
for (i = 0; i < 0x100; i += 4) {
if (i / 4 < NUM_GHC) {
printf("0x%03zx: 0x%08x (%s)\n",
- i, MMIO(i), ghc_regs[i / 4]);
- } else if (MMIO(i)) {
- printf("0x%03zx: 0x%08x (Reserved)\n", i, MMIO(i));
+ i, read32(mmio + i), ghc_regs[i / 4]);
+ } else if (read32(mmio + i)) {
+ printf("0x%03zx: 0x%08x (Reserved)\n", i,
+ read32(mmio + i));
}
}
const size_t max_ports = (ahci_registers_size - 0x100) / 0x80;
for (i = 0; i < max_ports; i++) {
- if (MMIO(0x0c) & 1 << i)
+ if (read32(mmio + 0x0c) & 1 << i)
print_port(mmio, i);
}
puts("\nOther registers:");
for (i = 0x500; i < ahci_registers_size; i += 4) {
- if (MMIO(i))
- printf("0x%03zx: 0x%08x\n", i, MMIO(i));
+ if (read32(mmio + i))
+ printf("0x%03zx: 0x%08x\n", i, read32(mmio + i));
}
unmap_physical((void *)mmio, ahci_registers_size);