Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86 add a const qualifier to struct pci_attach_args...



details:   https://anonhg.NetBSD.org/src/rev/beab135b186b
branches:  trunk
changeset: 338002:beab135b186b
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri May 08 04:27:48 2015 +0000

description:
add a const qualifier to struct pci_attach_args *pa argument

diffstat:

 sys/arch/x86/include/pci_machdep_common.h |  21 +++++++++++-------
 sys/arch/x86/pci/msipic.c                 |  16 +++++++-------
 sys/arch/x86/pci/msipic.h                 |   6 ++--
 sys/arch/x86/pci/pci_msi_machdep.c        |  34 ++++++++++++++++--------------
 4 files changed, 42 insertions(+), 35 deletions(-)

diffs (276 lines):

diff -r 585551867c9a -r beab135b186b sys/arch/x86/include/pci_machdep_common.h
--- a/sys/arch/x86/include/pci_machdep_common.h Thu May 07 23:55:31 2015 +0000
+++ b/sys/arch/x86/include/pci_machdep_common.h Fri May 08 04:27:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep_common.h,v 1.15 2015/04/27 07:03:58 knakahara Exp $        */
+/*     $NetBSD: pci_machdep_common.h,v 1.16 2015/05/08 04:27:48 knakahara Exp $        */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -131,19 +131,24 @@
 
 /* experimental MSI support */
 const char     *pci_msi_string(pci_chipset_tag_t, pci_intr_handle_t, char *, size_t);
-int            pci_msi_count(struct pci_attach_args *);
-int            pci_msi_alloc(struct pci_attach_args *, pci_intr_handle_t **, int *);
-int            pci_msi_alloc_exact(struct pci_attach_args *, pci_intr_handle_t **, int);
+int            pci_msi_count(const struct pci_attach_args *);
+int            pci_msi_alloc(const struct pci_attach_args *,
+                   pci_intr_handle_t **, int *);
+int            pci_msi_alloc_exact(const struct pci_attach_args *,
+                   pci_intr_handle_t **, int);
 void           pci_msi_release(pci_chipset_tag_t, pci_intr_handle_t **, int);
 void           *pci_msi_establish(pci_chipset_tag_t, pci_intr_handle_t,
                    int, int (*)(void *), void *);
 void           pci_msi_disestablish(pci_chipset_tag_t, void *);
 
 /* experimental MSI-X support */
-int            pci_msix_count(struct pci_attach_args *);
-int            pci_msix_alloc(struct pci_attach_args *, pci_intr_handle_t **, int *);
-int            pci_msix_alloc_exact(struct pci_attach_args *, pci_intr_handle_t **, int);
-int            pci_msix_alloc_map(struct pci_attach_args *, pci_intr_handle_t **, u_int *, int);
+int            pci_msix_count(const struct pci_attach_args *);
+int            pci_msix_alloc(const struct pci_attach_args *,
+                   pci_intr_handle_t **, int *);
+int            pci_msix_alloc_exact(const struct pci_attach_args *,
+                   pci_intr_handle_t **, int);
+int            pci_msix_alloc_map(const struct pci_attach_args *,
+                   pci_intr_handle_t **, u_int *, int);
 void           pci_msix_release(pci_chipset_tag_t, pci_intr_handle_t **, int);
 void           *pci_msix_establish(pci_chipset_tag_t, pci_intr_handle_t,
                    int, int (*)(void *), void *);
diff -r 585551867c9a -r beab135b186b sys/arch/x86/pci/msipic.c
--- a/sys/arch/x86/pci/msipic.c Thu May 07 23:55:31 2015 +0000
+++ b/sys/arch/x86/pci/msipic.c Fri May 08 04:27:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msipic.c,v 1.3 2015/04/28 06:23:57 martin Exp $        */
+/*     $NetBSD: msipic.c,v 1.4 2015/05/08 04:27:48 knakahara Exp $     */
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.3 2015/04/28 06:23:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.4 2015/05/08 04:27:48 knakahara Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -106,11 +106,11 @@
 /* Record devids to use the same devid when the device is re-attached. */
 static struct dev_last_used_seq dev_seqs[NUM_MSI_DEVS];
 
-static int msipic_allocate_common_msi_devid(struct pci_attach_args *);
+static int msipic_allocate_common_msi_devid(const struct pci_attach_args *);
 static void msipic_release_common_msi_devid(int);
 
 static struct pic *msipic_find_msi_pic_locked(int);
-static struct pic *msipic_construct_common_msi_pic(struct pci_attach_args *,
+static struct pic *msipic_construct_common_msi_pic(const struct pci_attach_args *,
                                                   struct pic *);
 static void msipic_destruct_common_msi_pic(struct pic *);
 
@@ -132,7 +132,7 @@
  * Return -1 if the number of attached MSI/MSI-X devices is over NUM_MSI_DEVS.
  */
 static int
-msipic_allocate_common_msi_devid(struct pci_attach_args *pa)
+msipic_allocate_common_msi_devid(const struct pci_attach_args *pa)
 {
        pci_chipset_tag_t pc;
        pcitag_t tag;
@@ -227,7 +227,7 @@
  * A common construct process of MSI and MSI-X.
  */
 static struct pic *
-msipic_construct_common_msi_pic(struct pci_attach_args *pa,
+msipic_construct_common_msi_pic(const struct pci_attach_args *pa,
     struct pic *pic_tmpl)
 {
        struct pic *pic;
@@ -437,7 +437,7 @@
  * Create pseudo pic for a MSI device.
  */
 struct pic *
-msipic_construct_msi_pic(struct pci_attach_args *pa)
+msipic_construct_msi_pic(const struct pci_attach_args *pa)
 {
        struct pic *msi_pic;
        char pic_name_buf[MSIPICNAMEBUF];
@@ -605,7 +605,7 @@
 };
 
 struct pic *
-msipic_construct_msix_pic(struct pci_attach_args *pa)
+msipic_construct_msix_pic(const struct pci_attach_args *pa)
 {
        struct pic *msix_pic;
        pci_chipset_tag_t pc;
diff -r 585551867c9a -r beab135b186b sys/arch/x86/pci/msipic.h
--- a/sys/arch/x86/pci/msipic.h Thu May 07 23:55:31 2015 +0000
+++ b/sys/arch/x86/pci/msipic.h Fri May 08 04:27:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msipic.h,v 1.1 2015/04/27 07:03:58 knakahara Exp $     */
+/*     $NetBSD: msipic.h,v 1.2 2015/05/08 04:27:48 knakahara Exp $     */
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -31,9 +31,9 @@
 
 #include <dev/pci/pcivar.h>
 
-struct pic     *msipic_construct_msi_pic(struct pci_attach_args *);
+struct pic     *msipic_construct_msi_pic(const struct pci_attach_args *);
 void           msipic_destruct_msi_pic(struct pic *);
-struct pic     *msipic_construct_msix_pic(struct pci_attach_args *);
+struct pic     *msipic_construct_msix_pic(const struct pci_attach_args *);
 void           msipic_destruct_msix_pic(struct pic *);
 struct pic     *msipic_find_msi_pic(int);
 int            msipic_set_msi_vectors(struct pic *, pci_intr_handle_t *, int);
diff -r 585551867c9a -r beab135b186b sys/arch/x86/pci/pci_msi_machdep.c
--- a/sys/arch/x86/pci/pci_msi_machdep.c        Thu May 07 23:55:31 2015 +0000
+++ b/sys/arch/x86/pci/pci_msi_machdep.c        Fri May 08 04:27:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_msi_machdep.c,v 1.1 2015/04/27 07:03:58 knakahara Exp $    */
+/*     $NetBSD: pci_msi_machdep.c,v 1.2 2015/05/08 04:27:48 knakahara Exp $    */
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.1 2015/04/27 07:03:58 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.2 2015/05/08 04:27:48 knakahara Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -172,7 +172,7 @@
 
 static int
 pci_msi_alloc_md_common(pci_intr_handle_t **ihps, int *count,
-    struct pci_attach_args *pa, bool exact)
+    const struct pci_attach_args *pa, bool exact)
 {
        struct pic *msi_pic;
        pci_intr_handle_t *vectors;
@@ -227,7 +227,7 @@
 
 static int
 pci_msi_alloc_md(pci_intr_handle_t **ihps, int *count,
-    struct pci_attach_args *pa)
+    const struct pci_attach_args *pa)
 {
 
        return pci_msi_alloc_md_common(ihps, count, pa, false);
@@ -235,7 +235,7 @@
 
 static int
 pci_msi_alloc_exact_md(pci_intr_handle_t **ihps, int count,
-    struct pci_attach_args *pa)
+    const struct pci_attach_args *pa)
 {
 
        return pci_msi_alloc_md_common(ihps, &count, pa, true);
@@ -282,7 +282,7 @@
 
 static int
 pci_msix_alloc_md_common(pci_intr_handle_t **ihps, u_int *table_indexes,
-    int *count, struct pci_attach_args *pa, bool exact)
+    int *count, const struct pci_attach_args *pa, bool exact)
 {
        struct pic *msix_pic;
        pci_intr_handle_t *vectors;
@@ -336,7 +336,7 @@
 
 static int
 pci_msix_alloc_md(pci_intr_handle_t **ihps, int *count,
-    struct pci_attach_args *pa)
+    const struct pci_attach_args *pa)
 {
 
        return pci_msix_alloc_md_common(ihps, NULL, count, pa, false);
@@ -344,7 +344,7 @@
 
 static int
 pci_msix_alloc_exact_md(pci_intr_handle_t **ihps, int count,
-    struct pci_attach_args *pa)
+    const struct pci_attach_args *pa)
 {
 
        return pci_msix_alloc_md_common(ihps, NULL, &count, pa, true);
@@ -352,7 +352,7 @@
 
 static int
 pci_msix_alloc_map_md(pci_intr_handle_t **ihps, u_int *table_indexes, int count,
-    struct pci_attach_args *pa)
+    const struct pci_attach_args *pa)
 {
 
        return pci_msix_alloc_md_common(ihps, table_indexes, &count, pa, true);
@@ -383,7 +383,7 @@
  * return 0 if the device does not support MSI
  */
 int
-pci_msi_count(struct pci_attach_args *pa)
+pci_msi_count(const struct pci_attach_args *pa)
 {
        pci_chipset_tag_t pc;
        pcitag_t tag;
@@ -416,7 +416,8 @@
  * if count == 0, return non-zero value.
  */
 int
-pci_msi_alloc(struct pci_attach_args *pa, pci_intr_handle_t **ihps, int *count)
+pci_msi_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
+    int *count)
 {
        int hw_max;
 
@@ -445,7 +446,7 @@
  * If "count" struct intrsources cannot be allocated, return non-zero value.
  */
 int
-pci_msi_alloc_exact(struct pci_attach_args *pa, pci_intr_handle_t **ihps,
+pci_msi_alloc_exact(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
     int count)
 {
        int hw_max;
@@ -516,7 +517,7 @@
  * return 0 if the device does not support MSI-X
  */
 int
-pci_msix_count(struct pci_attach_args *pa)
+pci_msix_count(const struct pci_attach_args *pa)
 {
        pci_chipset_tag_t pc;
        pcitag_t tag;
@@ -541,7 +542,8 @@
  * if count == 0, return non-zero value.
  */
 int
-pci_msix_alloc(struct pci_attach_args *pa, pci_intr_handle_t **ihps, int *count)
+pci_msix_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
+    int *count)
 {
        int hw_max;
 
@@ -567,7 +569,7 @@
  * If "count" struct intrsource cannot be allocated, return non-zero value.
  */
 int
-pci_msix_alloc_exact(struct pci_attach_args *pa, pci_intr_handle_t **ihps,
+pci_msix_alloc_exact(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
     int count)
 {
        int hw_max;
@@ -602,7 +604,7 @@
  *     3rd handle is bound to MSI-X index 0
  */
 int
-pci_msix_alloc_map(struct pci_attach_args *pa, pci_intr_handle_t **ihps,
+pci_msix_alloc_map(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
     u_int *table_indexes, int count)
 {
        int hw_max, i, j;



Home | Main Index | Thread Index | Old Index