CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: matt Date: Tue Mar 25 16:40:28 UTC 2014 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_common.c Log Message: sprintf - snprintf To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/pci/pci_machdep_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_common.c diff -u src/sys/arch/powerpc/pci/pci_machdep_common.c:1.18 src/sys/arch/powerpc/pci/pci_machdep_common.c:1.19 --- src/sys/arch/powerpc/pci/pci_machdep_common.c:1.18 Sun Apr 28 00:45:45 2013 +++ src/sys/arch/powerpc/pci/pci_machdep_common.c Tue Mar 25 16:40:28 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_common.c,v 1.18 2013/04/28 00:45:45 macallan Exp $ */ +/* $NetBSD: pci_machdep_common.c,v 1.19 2014/03/25 16:40:28 matt Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.18 2013/04/28 00:45:45 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.19 2014/03/25 16:40:28 matt Exp $); #define _POWERPC_BUS_DMA_PRIVATE @@ -99,7 +99,7 @@ genppc_pci_intr_string(void *v, pci_intr panic(pci_intr_string: bogus handle 0x%x, ih); #endif - sprintf(irqstr, irq %d, ih); + snprintf(irqstr, sizeof(irqstr), irq %d, ih); return (irqstr); }
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: matt Date: Tue Mar 25 16:39:27 UTC 2014 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_ofw.c Log Message: sprintf - snprintf To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/pci/pci_machdep_ofw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_ofw.c diff -u src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.19 src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.20 --- src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.19 Sun Nov 3 22:22:03 2013 +++ src/sys/arch/powerpc/pci/pci_machdep_ofw.c Tue Mar 25 16:39:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_ofw.c,v 1.19 2013/11/03 22:22:03 mrg Exp $ */ +/* $NetBSD: pci_machdep_ofw.c,v 1.20 2014/03/25 16:39:27 matt Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_ofw.c,v 1.19 2013/11/03 22:22:03 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_ofw.c,v 1.20 2014/03/25 16:39:27 matt Exp $); #include sys/types.h #include sys/param.h @@ -238,12 +238,12 @@ genofw_setup_pciintr_map(void *v, struct sub = prop_dictionary_create_with_capacity(4); pin = map[i*reclen + acells]; intr_num = prop_number_create_integer(map[i*reclen + acells + icells + 1] + picnodes[pic].offset); - sprintf(key, pin-%c, 'A' + (pin-1)); + snprintf(key, sizeof(key), pin-%c, 'A' + (pin-1)); prop_dictionary_set(sub, key, intr_num); prop_object_release(intr_num); /* should we care about level? */ - sprintf(key, devfunc-%d, dev*0x8 + func); + snprintf(key, sizeof(key), devfunc-%d, dev*0x8 + func); prop_dictionary_set(dict, key, sub); if (curdev != dev) { prop_object_release(sub); @@ -293,10 +293,10 @@ nomap: if (OF_getprop(node, interrupts, pin, 4) 0) pin = 1; intr_num = prop_number_create_integer(irqs[0]); - sprintf(key, pin-%c, 'A' + (pin-1)); + snprintf(key, sizeof(key), pin-%c, 'A' + (pin-1)); prop_dictionary_set(sub, key, intr_num); prop_object_release(intr_num); - sprintf(key, devfunc-%d, dev*0x8 + func); + snprintf(key, sizeof(key), devfunc-%d, dev*0x8 + func); prop_dictionary_set(dict, key, sub); prop_object_release(sub); foundirqs++; @@ -331,10 +331,10 @@ nomap: if (OF_getprop(node, interrupts, pin, 4) 0) pin = 1; intr_num = prop_number_create_integer(irq); - sprintf(key, pin-%c, 'A' + (pin-1)); + snprintf(key, sizeof(key), pin-%c, 'A' + (pin-1)); prop_dictionary_set(sub, key, intr_num); prop_object_release(intr_num); - sprintf(key, devfunc-%d, dev*0x8 + func); + snprintf(key, sizeof(key), devfunc-%d, dev*0x8 + func); prop_dictionary_set(dict, key, sub); prop_object_release(sub); } @@ -430,11 +430,11 @@ genofw_pci_intr_map(const struct pci_att goto bad; } - sprintf(key, devfunc-%d, dev*0x8 + func); + snprintf(key, sizeof(key), devfunc-%d, dev*0x8 + func); devsub = prop_dictionary_get(dict, key); if (devsub == NULL) goto bad; - sprintf(key, pin-%c, 'A' + (pin-1)); + snprintf(key, sizeof(key), pin-%c, 'A' + (pin-1)); pinsub = prop_dictionary_get(devsub, key); if (pinsub == NULL) goto bad;
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: macallan Date: Sun Apr 28 00:45:45 UTC 2013 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_common.c Log Message: remove PMAC_G5 kludge - fixed this elsewhere To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/pci/pci_machdep_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_common.c diff -u src/sys/arch/powerpc/pci/pci_machdep_common.c:1.17 src/sys/arch/powerpc/pci/pci_machdep_common.c:1.18 --- src/sys/arch/powerpc/pci/pci_machdep_common.c:1.17 Thu Apr 11 18:14:40 2013 +++ src/sys/arch/powerpc/pci/pci_machdep_common.c Sun Apr 28 00:45:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_common.c,v 1.17 2013/04/11 18:14:40 macallan Exp $ */ +/* $NetBSD: pci_machdep_common.c,v 1.18 2013/04/28 00:45:45 macallan Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.17 2013/04/11 18:14:40 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.18 2013/04/28 00:45:45 macallan Exp $); #define _POWERPC_BUS_DMA_PRIVATE @@ -167,17 +167,12 @@ genppc_pci_intr_map(const struct pci_att printf(%s: pin: %d, line: %d\n, __func__, pin, line); #endif -/* - * XXX - * on my G5 some devices are configured with pin == 0 but a valid IRQ line - */ -#ifndef PMAC_G5 if (pin == 0) { /* No IRQ used. */ aprint_error(pci_intr_map: interrupt pin %d\n, pin); goto bad; } -#endif + if (pin 4) { aprint_error(pci_intr_map: bad interrupt pin %d\n, pin); goto bad;
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: macallan Date: Thu Apr 11 18:14:41 UTC 2013 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_common.c Log Message: temporary kludge for G5 - on mine some devices are configured with interrupt pin 0 but a valid IRQ line, so don't treat that as an error if PMAC_G5 is set To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/pci/pci_machdep_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_common.c diff -u src/sys/arch/powerpc/pci/pci_machdep_common.c:1.16 src/sys/arch/powerpc/pci/pci_machdep_common.c:1.17 --- src/sys/arch/powerpc/pci/pci_machdep_common.c:1.16 Fri Jan 18 06:21:12 2013 +++ src/sys/arch/powerpc/pci/pci_machdep_common.c Thu Apr 11 18:14:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_common.c,v 1.16 2013/01/18 06:21:12 matt Exp $ */ +/* $NetBSD: pci_machdep_common.c,v 1.17 2013/04/11 18:14:40 macallan Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.16 2013/01/18 06:21:12 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.17 2013/04/11 18:14:40 macallan Exp $); #define _POWERPC_BUS_DMA_PRIVATE @@ -167,12 +167,17 @@ genppc_pci_intr_map(const struct pci_att printf(%s: pin: %d, line: %d\n, __func__, pin, line); #endif +/* + * XXX + * on my G5 some devices are configured with pin == 0 but a valid IRQ line + */ +#ifndef PMAC_G5 if (pin == 0) { /* No IRQ used. */ aprint_error(pci_intr_map: interrupt pin %d\n, pin); goto bad; } - +#endif if (pin 4) { aprint_error(pci_intr_map: bad interrupt pin %d\n, pin); goto bad;
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: matt Date: Fri Jan 18 06:21:13 UTC 2013 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_common.c Log Message: Use structure initializers. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/pci/pci_machdep_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_common.c diff -u src/sys/arch/powerpc/pci/pci_machdep_common.c:1.15 src/sys/arch/powerpc/pci/pci_machdep_common.c:1.16 --- src/sys/arch/powerpc/pci/pci_machdep_common.c:1.15 Wed Feb 1 09:54:03 2012 +++ src/sys/arch/powerpc/pci/pci_machdep_common.c Fri Jan 18 06:21:12 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_common.c,v 1.15 2012/02/01 09:54:03 matt Exp $ */ +/* $NetBSD: pci_machdep_common.c,v 1.16 2013/01/18 06:21:12 matt Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.15 2012/02/01 09:54:03 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_common.c,v 1.16 2013/01/18 06:21:12 matt Exp $); #define _POWERPC_BUS_DMA_PRIVATE @@ -63,20 +63,19 @@ __KERNEL_RCSID(0, $NetBSD: pci_machdep_ * of these functions. */ struct powerpc_bus_dma_tag pci_bus_dma_tag = { - 0, /* _bounce_thresh */ - _bus_dmamap_create, - _bus_dmamap_destroy, - _bus_dmamap_load, - _bus_dmamap_load_mbuf, - _bus_dmamap_load_uio, - _bus_dmamap_load_raw, - _bus_dmamap_unload, - NULL, /* _dmamap_sync */ - _bus_dmamem_alloc, - _bus_dmamem_free, - _bus_dmamem_map, - _bus_dmamem_unmap, - _bus_dmamem_mmap, + ._dmamap_create = _bus_dmamap_create, + ._dmamap_destroy = _bus_dmamap_destroy, + ._dmamap_load = _bus_dmamap_load, + ._dmamap_load_mbuf = _bus_dmamap_load_mbuf, + ._dmamap_load_uio = _bus_dmamap_load_uio, + ._dmamap_load_raw = _bus_dmamap_load_raw, + ._dmamap_unload = _bus_dmamap_unload, + + ._dmamem_alloc = _bus_dmamem_alloc, + ._dmamem_free = _bus_dmamem_free, + ._dmamem_map = _bus_dmamem_map, + ._dmamem_unmap = _bus_dmamem_unmap, + ._dmamem_mmap = _bus_dmamem_mmap, }; int
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: matt Date: Wed Jun 22 18:20:59 UTC 2011 Added Files: src/sys/arch/powerpc/pci: pci_module.c Log Message: Provide the pci_* routines for modules to use. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/pci/pci_module.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/powerpc/pci/pci_module.c diff -u /dev/null src/sys/arch/powerpc/pci/pci_module.c:1.1 --- /dev/null Wed Jun 22 18:20:59 2011 +++ src/sys/arch/powerpc/pci/pci_module.c Wed Jun 22 18:20:59 2011 @@ -0,0 +1,48 @@ +/* $NetBSD: pci_module.c,v 1.1 2011/06/22 18:20:59 matt Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Through magic contained in powerpc/pci_machdep.h, this provide the + * pci_* routines (which just call through pci_chipset_tag_t) for loadable + * modules. This keeps pci_chipset_tag_t opaque for modules. + */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: pci_module.c,v 1.1 2011/06/22 18:20:59 matt Exp $); + +#define __PCI_NOINLINE + +#include sys/param.h +#include sys/bus.h +#include sys/device.h +#include sys/intr.h + +#include dev/pci/pcivar.h
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: kiyohara Date: Sat May 8 05:55:52 UTC 2010 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_ofw.c Log Message: Rename PCI_PRODUCT_MARVELL_MV64360 from PCI_PRODUCT_MARVELL_GT64360. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/pci/pci_machdep_ofw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_ofw.c diff -u src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.13 src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.14 --- src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.13 Mon Apr 19 06:55:11 2010 +++ src/sys/arch/powerpc/pci/pci_machdep_ofw.c Sat May 8 05:55:52 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_ofw.c,v 1.13 2010/04/19 06:55:11 kiyohara Exp $ */ +/* $NetBSD: pci_machdep_ofw.c,v 1.14 2010/05/08 05:55:52 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_ofw.c,v 1.13 2010/04/19 06:55:11 kiyohara Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_ofw.c,v 1.14 2010/05/08 05:55:52 kiyohara Exp $); #include sys/types.h #include sys/param.h @@ -486,7 +486,7 @@ /* never reconfigure the MV64361 host bridge */ if (PCI_VENDOR(id) == PCI_VENDOR_MARVELL - PCI_PRODUCT(id) == PCI_PRODUCT_MARVELL_GT64360) + PCI_PRODUCT(id) == PCI_PRODUCT_MARVELL_MV64360) return 0; /* we want to leave viaide(4) alone */
CVS commit: src/sys/arch/powerpc/pci
Module Name:src Committed By: kiyohara Date: Mon Apr 19 06:55:11 UTC 2010 Modified Files: src/sys/arch/powerpc/pci: pci_machdep_ofw.c Log Message: Remove white-spaces. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/pci/pci_machdep_ofw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/pci/pci_machdep_ofw.c diff -u src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.12 src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.13 --- src/sys/arch/powerpc/pci/pci_machdep_ofw.c:1.12 Mon Apr 28 20:23:32 2008 +++ src/sys/arch/powerpc/pci/pci_machdep_ofw.c Mon Apr 19 06:55:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_ofw.c,v 1.12 2008/04/28 20:23:32 martin Exp $ */ +/* $NetBSD: pci_machdep_ofw.c,v 1.13 2010/04/19 06:55:11 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_machdep_ofw.c,v 1.12 2008/04/28 20:23:32 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_machdep_ofw.c,v 1.13 2010/04/19 06:55:11 kiyohara Exp $); #include sys/types.h #include sys/param.h @@ -126,10 +126,10 @@ } irgot = OF_getprop(node, reg, reg, sizeof(reg)); - + if (!picnodes[nrofpics].intrs) picnodes[nrofpics].intrs = 16; - + if (nrofpics 0) picnodes[nrofpics].offset = picnodes[nrofpics-1].offset + picnodes[nrofpics-1].intrs; @@ -181,7 +181,7 @@ continue; if (picnodes[i].type == PICNODE_TYPE_IVR) continue; - + picnodes[i].offset = curoff; curoff += picnodes[i].intrs; } @@ -348,7 +348,7 @@ { int node, sz, p=0; uint32_t reg; - + for (node = startnode; node; node = p) { sz = OF_getprop(node, reg, reg, sizeof(reg)); if (sz != sizeof(reg)) @@ -500,14 +500,14 @@ return (PCI_CONF_ALL ~PCI_CONF_MAP_IO); } - + tag = pci_make_tag(pct, bus, dev, func); class = pci_conf_read(pct, tag, PCI_CLASS_REG); /* leave video cards alone */ if (PCI_CLASS(class) == PCI_CLASS_DISPLAY) return 0; - + /* NOTE, all device specific stuff must be above this line */ /* don't do this on the primary host bridge */ if (bus == 0 dev == 0 func == 0)