Tue Dec 29 15:49:45 2020 UTC ()
KNF a comment


(skrll)
diff -r1.43 -r1.44 src/sys/dev/pci/pci_map.c

cvs diff -r1.43 -r1.44 src/sys/dev/pci/pci_map.c (expand / switch to unified diff)

--- src/sys/dev/pci/pci_map.c 2020/12/29 15:49:13 1.43
+++ src/sys/dev/pci/pci_map.c 2020/12/29 15:49:45 1.44
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pci_map.c,v 1.43 2020/12/29 15:49:13 skrll Exp $ */ 1/* $NetBSD: pci_map.c,v 1.44 2020/12/29 15:49:45 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2000, 2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2000, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum; by William R. Studenmund; by Jason R. Thorpe. 8 * by Charles M. Hannum; by William R. Studenmund; by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * PCI device mapping. 33 * PCI device mapping.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.43 2020/12/29 15:49:13 skrll Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.44 2020/12/29 15:49:45 skrll Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/device.h> 41#include <sys/device.h>
42 42
43#include <dev/pci/pcireg.h> 43#include <dev/pci/pcireg.h>
44#include <dev/pci/pcivar.h> 44#include <dev/pci/pcivar.h>
45 45
46bool pci_mapreg_map_enable_decode = true; 46bool pci_mapreg_map_enable_decode = true;
47 47
48static int 48static int
49pci_io_find(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t type, 49pci_io_find(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t type,
50 bus_addr_t *basep, bus_size_t *sizep, int *flagsp) 50 bus_addr_t *basep, bus_size_t *sizep, int *flagsp)
@@ -626,27 +626,28 @@ pci_mapreg_submap(const struct pci_attac @@ -626,27 +626,28 @@ pci_mapreg_submap(const struct pci_attac
626 } else { 626 } else {
627 s = splhigh(); 627 s = splhigh();
628 pcireg_t mask = 628 pcireg_t mask =
629 pci_conf_read(pa->pa_pc, pa->pa_tag, reg); 629 pci_conf_read(pa->pa_pc, pa->pa_tag, reg);
630 if ((mask & PCI_MAPREG_ROM_ENABLE) == 0) { 630 if ((mask & PCI_MAPREG_ROM_ENABLE) == 0) {
631 mask |= PCI_MAPREG_ROM_ENABLE; 631 mask |= PCI_MAPREG_ROM_ENABLE;
632 pci_conf_write(pa->pa_pc, pa->pa_tag, reg, 632 pci_conf_write(pa->pa_pc, pa->pa_tag, reg,
633 mask); 633 mask);
634 } 634 }
635 splx(s); 635 splx(s);
636 } 636 }
637 } 637 }
638 638
639 /* If we're called with maxsize/offset of 0, behave like 639 /*
 640 * If we're called with maxsize/offset of 0, behave like
640 * pci_mapreg_map. 641 * pci_mapreg_map.
641 */ 642 */
642 643
643 reqsize = (reqsize != 0) ? reqsize : realmaxsize; 644 reqsize = (reqsize != 0) ? reqsize : realmaxsize;
644 base += offset; 645 base += offset;
645 646
646 if (realmaxsize < (offset + reqsize)) 647 if (realmaxsize < (offset + reqsize))
647 return 1; 648 return 1;
648 649
649 if (bus_space_map(tag, base, reqsize, busflags, &handle)) 650 if (bus_space_map(tag, base, reqsize, busflags, &handle))
650 return 1; 651 return 1;
651 652
652 if (pci_mapreg_map_enable_decode) { 653 if (pci_mapreg_map_enable_decode) {