Module Name: src Committed By: martin Date: Sun Jul 26 10:46:14 UTC 2020
Modified Files: src/sys/dev/pci [netbsd-9]: pci_subr.c Log Message: Pull up following revision(s) (requested by jdolecek in ticket #1024): sys/dev/pci/pci_subr.c: revision 1.224 change pci_conf_print() to allocate memory for the regs dynamically instead of on-stack To generate a diff of this commit: cvs rdiff -u -r1.215.2.3 -r1.215.2.4 src/sys/dev/pci/pci_subr.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/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.215.2.3 src/sys/dev/pci/pci_subr.c:1.215.2.4 --- src/sys/dev/pci/pci_subr.c:1.215.2.3 Thu Mar 19 19:05:34 2020 +++ src/sys/dev/pci/pci_subr.c Sun Jul 26 10:46:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $ */ +/* $NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v #include <sys/systm.h> #include <sys/intr.h> #include <sys/module.h> +#include <sys/kmem.h> + +#define MALLOC(sz) kmem_alloc(sz, KM_SLEEP) +#define FREE(p, sz) kmem_free(p, sz) + #else #include <pci.h> #include <stdarg.h> @@ -59,6 +64,10 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v #include <stdio.h> #include <stdlib.h> #include <string.h> + +#define MALLOC(sz) malloc(sz) +#define FREE(p, sz) free(p) + #endif #include <dev/pci/pcireg.h> @@ -4811,7 +4820,7 @@ pci_conf_print( #endif ) { - pcireg_t regs[o2i(PCI_EXTCONF_SIZE)]; + pcireg_t *regs; int off, capoff, endoff, hdrtype; const char *type_name; #ifdef _KERNEL @@ -4820,6 +4829,8 @@ pci_conf_print( void (*type_printfn)(const pcireg_t *); #endif + regs = MALLOC(PCI_EXTCONF_SIZE); + printf("PCI configuration registers:\n"); for (off = 0; off < PCI_EXTCONF_SIZE; off += 4) { @@ -4916,7 +4927,7 @@ pci_conf_print( if (regs[o2i(PCI_EXTCAPLIST_BASE)] == 0xffffffff || regs[o2i(PCI_EXTCAPLIST_BASE)] == 0) - return; + goto out; printf("\n"); #ifdef _KERNEL @@ -4929,4 +4940,7 @@ pci_conf_print( /* Extended Configuration Space, if present */ printf(" Extended Configuration Space:\n"); pci_conf_print_regs(regs, PCI_EXTCAPLIST_BASE, PCI_EXTCONF_SIZE); + +out: + FREE(regs, PCI_EXTCONF_SIZE); }