Module Name: src
Committed By: knakahara
Date: Fri May 8 04:27:48 UTC 2015
Modified Files:
src/sys/arch/x86/include: pci_machdep_common.h
src/sys/arch/x86/pci: msipic.c msipic.h pci_msi_machdep.c
Log Message:
add a const qualifier to struct pci_attach_args *pa argument
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/include/pci_machdep_common.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/msipic.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/msipic.h \
src/sys/arch/x86/pci/pci_msi_machdep.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/x86/include/pci_machdep_common.h
diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.15 src/sys/arch/x86/include/pci_machdep_common.h:1.16
--- src/sys/arch/x86/include/pci_machdep_common.h:1.15 Mon Apr 27 07:03:58 2015
+++ src/sys/arch/x86/include/pci_machdep_common.h Fri May 8 04:27:48 2015
@@ -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 @@ void pci_intx_release(pci_chipset_tag_t
/* 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 *);
Index: src/sys/arch/x86/pci/msipic.c
diff -u src/sys/arch/x86/pci/msipic.c:1.3 src/sys/arch/x86/pci/msipic.c:1.4
--- src/sys/arch/x86/pci/msipic.c:1.3 Tue Apr 28 06:23:57 2015
+++ src/sys/arch/x86/pci/msipic.c Fri May 8 04:27:48 2015
@@ -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 @@ struct dev_last_used_seq {
/* 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 @@ static void msix_delroute(struct pic *,
* 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 @@ msipic_find_msi_pic(int devid)
* 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 @@ static struct pic msi_pic_tmpl = {
* 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 @@ static struct pic msix_pic_tmpl = {
};
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;
Index: src/sys/arch/x86/pci/msipic.h
diff -u src/sys/arch/x86/pci/msipic.h:1.1 src/sys/arch/x86/pci/msipic.h:1.2
--- src/sys/arch/x86/pci/msipic.h:1.1 Mon Apr 27 07:03:58 2015
+++ src/sys/arch/x86/pci/msipic.h Fri May 8 04:27:48 2015
@@ -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);
Index: src/sys/arch/x86/pci/pci_msi_machdep.c
diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.1 src/sys/arch/x86/pci/pci_msi_machdep.c:1.2
--- src/sys/arch/x86/pci/pci_msi_machdep.c:1.1 Mon Apr 27 07:03:58 2015
+++ src/sys/arch/x86/pci/pci_msi_machdep.c Fri May 8 04:27:48 2015
@@ -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 @@ pci_msi_free_vectors(struct pic *msi_pic
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 @@ pci_msi_alloc_md_common(pci_intr_handle_
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 @@ pci_msi_alloc_md(pci_intr_handle_t **ihp
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 @@ pci_msi_common_disestablish(pci_chipset_
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 @@ pci_msix_alloc_md_common(pci_intr_handle
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 @@ pci_msix_alloc_md(pci_intr_handle_t **ih
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 @@ pci_msix_alloc_exact_md(pci_intr_handle_
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 @@ pci_msix_release_md(pci_intr_handle_t **
* 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 @@ pci_msi_count(struct pci_attach_args *pa
* 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 @@ pci_msi_alloc(struct pci_attach_args *pa
* 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 @@ pci_msi_disestablish(pci_chipset_tag_t p
* 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 @@ pci_msix_count(struct pci_attach_args *p
* 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 @@ pci_msix_alloc(struct pci_attach_args *p
* 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 @@ pci_msix_alloc_exact(struct pci_attach_a
* 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;