From: patrick Date: Tue, 26 Jul 2016 22:10:10 +0000 (+0000) Subject: Rename struct fdt_memory to fdt_reg to match the member name X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b7952965205f031520bc848f33b525dc9cde2cfc;p=openbsd Rename struct fdt_memory to fdt_reg to match the member name used in the fdt attach args and the device tree. ok kettenis@ --- diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c index 5f9da10338f..1301edb2c80 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.c +++ b/sys/arch/armv7/armv7/armv7_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.c,v 1.32 2016/07/26 18:09:07 kettenis Exp $ */ +/* $OpenBSD: armv7_machdep.c,v 1.33 2016/07/26 22:10:10 patrick Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -450,17 +450,17 @@ initarm(void *arg0, void *arg1, void *arg2) } if (fdt_init(config) && fdt_get_size(config) != 0) { - struct fdt_memory mem; + struct fdt_reg reg; void *node; node = fdt_find_node("/memory"); - if (node == NULL || fdt_get_memory_address(node, 0, &mem)) + if (node == NULL || fdt_get_reg(node, 0, ®)) panic("initarm: no memory specificed"); - memstart = mem.addr; - memsize = mem.size; - physical_start = mem.addr; - physical_end = MIN(mem.addr + mem.size, (paddr_t)-PAGE_SIZE); + memstart = reg.addr; + memsize = reg.size; + physical_start = reg.addr; + physical_end = MIN(reg.addr + reg.size, (paddr_t)-PAGE_SIZE); node = fdt_find_node("/chosen"); if (node != NULL) { diff --git a/sys/arch/armv7/exynos/exclock.c b/sys/arch/armv7/exynos/exclock.c index d6c906c5a2b..c4fa7ea01e6 100644 --- a/sys/arch/armv7/exynos/exclock.c +++ b/sys/arch/armv7/exynos/exclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exclock.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exclock.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -132,12 +132,12 @@ exclock_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exdisplay.c b/sys/arch/armv7/exynos/exdisplay.c index 3326b0266f9..a80171fcc2b 100644 --- a/sys/arch/armv7/exynos/exdisplay.c +++ b/sys/arch/armv7/exynos/exdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exdisplay.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exdisplay.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2013 Patrick Wildt * @@ -126,12 +126,12 @@ exdisplay_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exdog.c b/sys/arch/armv7/exynos/exdog.c index 0f92a484756..853ba31b43d 100644 --- a/sys/arch/armv7/exynos/exdog.c +++ b/sys/arch/armv7/exynos/exdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exdog.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exdog.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -93,12 +93,12 @@ exdog_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exehci.c b/sys/arch/armv7/exynos/exehci.c index 9a1783bffcd..ec99b0dea44 100644 --- a/sys/arch/armv7/exynos/exehci.c +++ b/sys/arch/armv7/exynos/exehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exehci.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exehci.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -131,16 +131,16 @@ exehci_attach(struct device *parent, struct device *self, void *aux) #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fhmem, fpmem; + struct fdt_reg hreg, preg; uint32_t ints[3]; - if (fdt_get_memory_address(aa->aa_node, 0, &fhmem)) + if (fdt_get_reg(aa->aa_node, 0, &hreg)) panic("%s: could not extract memory data from FDT", __func__); /* XXX: In a different way, please. */ void *node = fdt_find_compatible("samsung,exynos5250-usb2-phy"); - if (node == NULL || fdt_get_memory_address(node, 0, &fpmem)) + if (node == NULL || fdt_get_reg(node, 0, &preg)) panic("%s: could not extract phy data from FDT", __func__); @@ -150,10 +150,10 @@ exehci_attach(struct device *parent, struct device *self, void *aux) panic("%s: could not extract interrupt data from FDT", __func__); - hmem.addr = fhmem.addr; - hmem.size = fhmem.size; - pmem.addr = fpmem.addr; - pmem.size = fpmem.size; + hmem.addr = hreg.addr; + hmem.size = hreg.size; + pmem.addr = preg.addr; + pmem.size = preg.size; irq = ints[1]; } else diff --git a/sys/arch/armv7/exynos/exesdhc.c b/sys/arch/armv7/exynos/exesdhc.c index 73ff91e2ac5..9f63345a6d7 100644 --- a/sys/arch/armv7/exynos/exesdhc.c +++ b/sys/arch/armv7/exynos/exesdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exesdhc.c,v 1.7 2016/05/05 11:01:08 kettenis Exp $ */ +/* $OpenBSD: exesdhc.c,v 1.8 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2009 Dale Rahn * Copyright (c) 2006 Uwe Stuehler @@ -273,13 +273,13 @@ exesdhc_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; + struct fdt_reg reg; static int unit = 0; uint32_t ints[3]; sc->unit = unit++; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); @@ -289,8 +289,8 @@ exesdhc_attach(struct device *parent, struct device *self, void *args) panic("%s: could not extract interrupt data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; irq = ints[1]; } else diff --git a/sys/arch/armv7/exynos/exgpio.c b/sys/arch/armv7/exynos/exgpio.c index 180fa79ac38..beaa9a2a8b7 100644 --- a/sys/arch/armv7/exynos/exgpio.c +++ b/sys/arch/armv7/exynos/exgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exgpio.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exgpio.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -125,12 +125,12 @@ exgpio_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exiic.c b/sys/arch/armv7/exynos/exiic.c index b9e9f0e2e08..de4f90da738 100644 --- a/sys/arch/armv7/exynos/exiic.c +++ b/sys/arch/armv7/exynos/exiic.c @@ -137,15 +137,15 @@ exiic_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; + struct fdt_reg reg; static int unit = 0; sc->unit = unit++; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exmct.c b/sys/arch/armv7/exynos/exmct.c index b032d123ba8..eea4480d2a2 100644 --- a/sys/arch/armv7/exynos/exmct.c +++ b/sys/arch/armv7/exynos/exmct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exmct.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exmct.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -86,12 +86,12 @@ exmct_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/expower.c b/sys/arch/armv7/exynos/expower.c index 644f9edb301..54874f72a5c 100644 --- a/sys/arch/armv7/exynos/expower.c +++ b/sys/arch/armv7/exynos/expower.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expower.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: expower.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -92,12 +92,12 @@ expower_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exsysreg.c b/sys/arch/armv7/exynos/exsysreg.c index d1552ee1271..28e5435ebe9 100644 --- a/sys/arch/armv7/exynos/exsysreg.c +++ b/sys/arch/armv7/exynos/exsysreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exsysreg.c,v 1.3 2016/04/24 00:57:23 patrick Exp $ */ +/* $OpenBSD: exsysreg.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -92,12 +92,12 @@ exsysreg_attach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + struct fdt_reg reg; + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; } else #endif { diff --git a/sys/arch/armv7/exynos/exuart.c b/sys/arch/armv7/exynos/exuart.c index 60cd751c9ec..58d24361765 100644 --- a/sys/arch/armv7/exynos/exuart.c +++ b/sys/arch/armv7/exynos/exuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exuart.c,v 1.5 2016/06/11 08:08:16 jsg Exp $ */ +/* $OpenBSD: exuart.c,v 1.6 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -137,19 +137,19 @@ int exuartdefaultrate = B115200; void exuart_init_cons(void) { - struct fdt_memory mem; + struct fdt_reg reg; void *node; if ((node = fdt_find_cons("samsung,exynos4210-uart")) == NULL) return; - if (fdt_get_memory_address(node, 0, &mem)) + if (fdt_get_reg(node, 0, ®)) return; /* dtb uses serial2, qemu uses serial0 */ if (board_id == BOARD_ID_EXYNOS4_SMDKC210) - mem.addr = 0x13800000; + reg.addr = 0x13800000; - exuartcnattach(&armv7_bs_tag, mem.addr, comcnspeed, comcnmode); + exuartcnattach(&armv7_bs_tag, reg.addr, comcnspeed, comcnmode); } int @@ -185,10 +185,10 @@ exuartattach(struct device *parent, struct device *self, void *args) sc->sc_iot = aa->aa_iot; #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; + struct fdt_reg reg; uint32_t ints[3]; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); @@ -198,8 +198,8 @@ exuartattach(struct device *parent, struct device *self, void *args) panic("%s: could not extract interrupt data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; irq = ints[1]; } else diff --git a/sys/arch/armv7/imx/imxuart.c b/sys/arch/armv7/imx/imxuart.c index e9b89d8a33a..4376be6570e 100644 --- a/sys/arch/armv7/imx/imxuart.c +++ b/sys/arch/armv7/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.8 2016/07/23 15:02:08 patrick Exp $ */ +/* $OpenBSD: imxuart.c,v 1.9 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -138,15 +138,15 @@ struct cdevsw imxuartdev = void imxuart_init_cons(void) { - struct fdt_memory mem; + struct fdt_reg reg; void *node; if ((node = fdt_find_cons("fsl,imx21-uart")) == NULL) return; - if (fdt_get_memory_address(node, 0, &mem)) + if (fdt_get_reg(node, 0, ®)) return; - imxuartcnattach(&armv7_bs_tag, mem.addr, comcnspeed, comcnmode); + imxuartcnattach(&armv7_bs_tag, reg.addr, comcnspeed, comcnmode); } int diff --git a/sys/arch/armv7/omap/omap_com.c b/sys/arch/armv7/omap/omap_com.c index d2f8c165822..72eea2731af 100644 --- a/sys/arch/armv7/omap/omap_com.c +++ b/sys/arch/armv7/omap/omap_com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omap_com.c,v 1.6 2016/07/17 02:45:05 jsg Exp $ */ +/* $OpenBSD: omap_com.c,v 1.7 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. * All rights reserved. @@ -74,16 +74,16 @@ struct cfattach com_omap_ca = { void omapuart_init_cons(void) { - struct fdt_memory mem; + struct fdt_reg reg; void *node; if ((node = fdt_find_cons("ti,omap3-uart")) == NULL) if ((node = fdt_find_cons("ti,omap4-uart")) == NULL) return; - if (fdt_get_memory_address(node, 0, &mem)) + if (fdt_get_reg(node, 0, ®)) return; - comcnattach(&armv7_a4x_bs_tag, mem.addr, comcnspeed, 48000000, + comcnattach(&armv7_a4x_bs_tag, reg.addr, comcnspeed, 48000000, comcnmode); comdefaultrate = comcnspeed; } diff --git a/sys/arch/armv7/sunxi/sxiuart.c b/sys/arch/armv7/sunxi/sxiuart.c index 91eaa0b160e..c7e6dda995d 100644 --- a/sys/arch/armv7/sunxi/sxiuart.c +++ b/sys/arch/armv7/sunxi/sxiuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxiuart.c,v 1.7 2016/06/12 06:58:39 jsg Exp $ */ +/* $OpenBSD: sxiuart.c,v 1.8 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2005 Dale Rahn * Copyright (c) 2013 Artturi Alm @@ -146,15 +146,15 @@ struct cdevsw sxiuartdev = void sxiuart_init_cons(void) { - struct fdt_memory mem; + struct fdt_reg reg; void *node; if ((node = fdt_find_cons("snps,dw-apb-uart")) == NULL) return; - if (fdt_get_memory_address(node, 0, &mem)) + if (fdt_get_reg(node, 0, ®)) return; - sxiuartcnattach(&armv7_a4x_bs_tag, mem.addr, comcnspeed, 24000000, + sxiuartcnattach(&armv7_a4x_bs_tag, reg.addr, comcnspeed, 24000000, comcnmode); } diff --git a/sys/arch/armv7/vexpress/pl011.c b/sys/arch/armv7/vexpress/pl011.c index 5006388ec7c..b4fa1b2e327 100644 --- a/sys/arch/armv7/vexpress/pl011.c +++ b/sys/arch/armv7/vexpress/pl011.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pl011.c,v 1.3 2016/06/08 15:27:05 jsg Exp $ */ +/* $OpenBSD: pl011.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2014 Patrick Wildt @@ -140,15 +140,15 @@ int pl011defaultrate = B38400; void pl011_init_cons(void) { - struct fdt_memory mem; + struct fdt_reg reg; void *node; if ((node = fdt_find_cons("arm,pl011")) == NULL) return; - if (fdt_get_memory_address(node, 0, &mem)) + if (fdt_get_reg(node, 0, ®)) return; - pl011cnattach(&armv7_bs_tag, mem.addr, comcnspeed, comcnmode); + pl011cnattach(&armv7_bs_tag, reg.addr, comcnspeed, comcnmode); } int @@ -177,13 +177,13 @@ pl011attach(struct device *parent, struct device *self, void *args) #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; + struct fdt_reg reg; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; if (fdt_node_property_ints(aa->aa_node, "interrupts", ints, 3) != 3) diff --git a/sys/arch/armv7/vexpress/virtio_mmio.c b/sys/arch/armv7/vexpress/virtio_mmio.c index 99e3384c426..911fada8dc6 100644 --- a/sys/arch/armv7/vexpress/virtio_mmio.c +++ b/sys/arch/armv7/vexpress/virtio_mmio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio_mmio.c,v 1.3 2016/07/14 12:42:00 sf Exp $ */ +/* $OpenBSD: virtio_mmio.c,v 1.4 2016/07/26 22:10:10 patrick Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -203,10 +203,10 @@ virtio_mmio_attach(struct device *parent, struct device *self, void *aux) #if NFDT > 0 if (aa->aa_node) { - struct fdt_memory fdtmem; + struct fdt_reg reg; uint32_t ints[3]; - if (fdt_get_memory_address(aa->aa_node, 0, &fdtmem)) + if (fdt_get_reg(aa->aa_node, 0, ®)) panic("%s: could not extract memory data from FDT", __func__); if (fdt_node_property_ints(aa->aa_node, "interrupts", @@ -214,8 +214,8 @@ virtio_mmio_attach(struct device *parent, struct device *self, void *aux) panic("%s: could not extract interrupt data from FDT", __func__); - mem.addr = fdtmem.addr; - mem.size = fdtmem.size; + mem.addr = reg.addr; + mem.size = reg.size; irq = ints[1]; } else diff --git a/sys/dev/ofw/fdt.c b/sys/dev/ofw/fdt.c index 96ca6284ef2..0a1f0138a1e 100644 --- a/sys/dev/ofw/fdt.c +++ b/sys/dev/ofw/fdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdt.c,v 1.17 2016/07/09 12:31:05 kettenis Exp $ */ +/* $OpenBSD: fdt.c,v 1.18 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2009 Dariusz Swiderski @@ -38,7 +38,7 @@ void *fdt_parent_node_recurse(void *, void *); void *fdt_find_phandle_recurse(void *, uint32_t); int fdt_node_property_int(void *, char *, int *); int fdt_node_property_ints(void *, char *, int *, int); -int fdt_translate_memory_address(void *, struct fdt_memory *); +int fdt_translate_reg(void *, struct fdt_reg *); #ifdef DEBUG void fdt_print_node_recurse(void *, int); #endif @@ -492,7 +492,7 @@ fdt_find_phandle(uint32_t phandle) * has a ranges attribute and ask the same questions again. */ int -fdt_translate_memory_address(void *node, struct fdt_memory *mem) +fdt_translate_reg(void *node, struct fdt_reg *reg) { void *parent; int pac, psc, ac, sc, ret, rlen, rone, *range; @@ -512,7 +512,7 @@ fdt_translate_memory_address(void *node, struct fdt_memory *mem) /* Empty ranges means 1:1 mapping. Continue translation on parent. */ if (rlen <= 0) - return fdt_translate_memory_address(parent, mem); + return fdt_translate_reg(parent, reg); /* We only support 32-bit (1), and 64-bit (2) wide addresses here. */ ret = fdt_node_property_int(parent, "#address-cells", &pac); @@ -554,7 +554,7 @@ fdt_translate_memory_address(void *node, struct fdt_memory *mem) size = (size << 32) + betoh32(range[ac + pac + 1]); /* Try next, if we're not in the range. */ - if (mem->addr < from || (mem->addr + mem->size) > (from + size)) + if (reg->addr < from || (reg->addr + reg->size) > (from + size)) continue; /* All good, extract to address and translate. */ @@ -562,9 +562,9 @@ fdt_translate_memory_address(void *node, struct fdt_memory *mem) if (pac == 2) to = (to << 32) + betoh32(range[ac + 1]); - mem->addr -= from; - mem->addr += to; - return fdt_translate_memory_address(parent, mem); + reg->addr -= from; + reg->addr += to; + return fdt_translate_reg(parent, reg); } /* To be successful, we must have returned in the for-loop. */ @@ -575,12 +575,12 @@ fdt_translate_memory_address(void *node, struct fdt_memory *mem) * Parse the memory address and size of a node. */ int -fdt_get_memory_address(void *node, int idx, struct fdt_memory *mem) +fdt_get_reg(void *node, int idx, struct fdt_reg *reg) { void *parent; int ac, sc, off, ret, *in, inlen; - if (node == NULL || mem == NULL) + if (node == NULL || reg == NULL) return EINVAL; parent = fdt_parent_node(node); @@ -603,15 +603,15 @@ fdt_get_memory_address(void *node, int idx, struct fdt_memory *mem) off = idx * (ac + sc); - mem->addr = betoh32(in[off]); + reg->addr = betoh32(in[off]); if (ac == 2) - mem->addr = (mem->addr << 32) + betoh32(in[off + 1]); + reg->addr = (reg->addr << 32) + betoh32(in[off + 1]); - mem->size = betoh32(in[off + ac]); + reg->size = betoh32(in[off + ac]); if (sc == 2) - mem->size = (mem->size << 32) + betoh32(in[off + ac + 1]); + reg->size = (reg->size << 32) + betoh32(in[off + ac + 1]); - return fdt_translate_memory_address(parent, mem); + return fdt_translate_reg(parent, reg); } int diff --git a/sys/dev/ofw/fdt.h b/sys/dev/ofw/fdt.h index 2e1c40517ab..1e4263cceba 100644 --- a/sys/dev/ofw/fdt.h +++ b/sys/dev/ofw/fdt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fdt.h,v 1.4 2016/07/09 12:31:05 kettenis Exp $ */ +/* $OpenBSD: fdt.h,v 1.5 2016/07/26 22:10:10 patrick Exp $ */ /* * Copyright (c) 2009 Dariusz Swiderski @@ -38,7 +38,7 @@ struct fdt { int strings_size; }; -struct fdt_memory { +struct fdt_reg { uint64_t addr; uint64_t size; }; @@ -61,7 +61,7 @@ void *fdt_find_node(char *); int fdt_node_property(void *, char *, char **); void *fdt_parent_node(void *); void *fdt_find_phandle(uint32_t); -int fdt_get_memory_address(void *, int, struct fdt_memory *); +int fdt_get_reg(void *, int, struct fdt_reg *); int fdt_is_compatible(void *, const char *); #ifdef DEBUG void *fdt_print_property(void *, int);