Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 pci_msi_string() must be used by MD code only.
details: https://anonhg.NetBSD.org/src/rev/43d29d85276e
branches: trunk
changeset: 808368:43d29d85276e
user: knakahara <knakahara%NetBSD.org@localhost>
date: Fri May 15 08:36:41 2015 +0000
description:
pci_msi_string() must be used by MD code only.
diffstat:
sys/arch/x86/include/pci_machdep_common.h | 3 +-
sys/arch/x86/pci/pci_intr_machdep.c | 10 ++--
sys/arch/x86/pci/pci_msi_machdep.c | 56 +++++++++++++++---------------
sys/arch/x86/pci/pci_msi_machdep.h | 4 +-
sys/arch/x86/x86/intr.c | 7 ++-
5 files changed, 41 insertions(+), 39 deletions(-)
diffs (214 lines):
diff -r 5b10377fd650 -r 43d29d85276e sys/arch/x86/include/pci_machdep_common.h
--- a/sys/arch/x86/include/pci_machdep_common.h Fri May 15 08:29:33 2015 +0000
+++ b/sys/arch/x86/include/pci_machdep_common.h Fri May 15 08:36:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep_common.h,v 1.17 2015/05/15 08:26:44 knakahara Exp $ */
+/* $NetBSD: pci_machdep_common.h,v 1.18 2015/05/15 08:36:41 knakahara Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -129,7 +129,6 @@
pci_intr_handle_t **);
/* experimental MSI support */
-const char *pci_msi_string(pci_chipset_tag_t, pci_intr_handle_t, char *, size_t);
int pci_msi_count(const struct pci_attach_args *);
int pci_msi_alloc(const struct pci_attach_args *,
pci_intr_handle_t **, int *);
diff -r 5b10377fd650 -r 43d29d85276e sys/arch/x86/pci/pci_intr_machdep.c
--- a/sys/arch/x86/pci/pci_intr_machdep.c Fri May 15 08:29:33 2015 +0000
+++ b/sys/arch/x86/pci/pci_intr_machdep.c Fri May 15 08:36:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_intr_machdep.c,v 1.32 2015/05/15 08:29:33 knakahara Exp $ */
+/* $NetBSD: pci_intr_machdep.c,v 1.33 2015/05/15 08:36:41 knakahara Exp $ */
/*-
* Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.32 2015/05/15 08:29:33 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.33 2015/05/15 08:36:41 knakahara Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -226,9 +226,6 @@
{
pci_chipset_tag_t ipc;
- if (INT_VIA_MSI(ih))
- return pci_msi_string(pc, ih, buf, len);
-
for (ipc = pc; ipc != NULL; ipc = ipc->pc_super) {
if ((ipc->pc_present & PCI_OVERRIDE_INTR_STRING) == 0)
continue;
@@ -236,6 +233,9 @@
buf, len);
}
+ if (INT_VIA_MSI(ih))
+ return x86_pci_msi_string(pc, ih, buf, len);
+
return intr_string(ih & ~MPSAFE_MASK, buf, len);
}
diff -r 5b10377fd650 -r 43d29d85276e sys/arch/x86/pci/pci_msi_machdep.c
--- a/sys/arch/x86/pci/pci_msi_machdep.c Fri May 15 08:29:33 2015 +0000
+++ b/sys/arch/x86/pci/pci_msi_machdep.c Fri May 15 08:36:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_msi_machdep.c,v 1.4 2015/05/15 08:29:33 knakahara Exp $ */
+/* $NetBSD: pci_msi_machdep.c,v 1.5 2015/05/15 08:36:41 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.4 2015/05/15 08:29:33 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.5 2015/05/15 08:36:41 knakahara Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -65,28 +65,6 @@
#define DPRINTF(msg)
#endif
-/*
- * Return intrid for a MSI/MSI-X device.
- * "buf" must be allocated by caller.
- */
-const char *
-pci_msi_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char *buf,
- size_t len)
-{
- int dev, vec;
-
- KASSERT(INT_VIA_MSI(ih));
-
- dev = MSI_INT_DEV(ih);
- vec = MSI_INT_VEC(ih);
- if (MSI_INT_IS_MSIX(ih))
- snprintf(buf, len, "msix%d vec %d", dev, vec);
- else
- snprintf(buf, len, "msi%d vec %d", dev, vec);
-
- return buf;
-}
-
static pci_intr_handle_t
pci_msi_calculate_handle(struct pic *msi_pic, int vector)
{
@@ -134,7 +112,7 @@
pih = pci_msi_calculate_handle(msi_pic, table_index);
- intrstr = pci_msi_string(NULL, pih, intrstr_buf,
+ intrstr = x86_pci_msi_string(NULL, pih, intrstr_buf,
sizeof(intrstr_buf));
isp = intr_allocate_io_intrsource(intrstr);
if (isp == NULL) {
@@ -162,7 +140,7 @@
mutex_enter(&cpu_lock);
for (i = 0; i < count; i++) {
pih = pci_msi_calculate_handle(msi_pic, i);
- intrstr = pci_msi_string(NULL, pih, intrstr_buf,
+ intrstr = x86_pci_msi_string(NULL, pih, intrstr_buf,
sizeof(intrstr_buf));
intr_free_io_intrsource(intrstr);
}
@@ -372,8 +350,30 @@
/*****************************************************************************/
/*
- * extern for pci_intr_machdep.c
+ * extern for MD code.
+ */
+
+/*
+ * Return intrid for a MSI/MSI-X device.
+ * "buf" must be allocated by caller.
*/
+const char *
+x86_pci_msi_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char *buf,
+ size_t len)
+{
+ int dev, vec;
+
+ KASSERT(INT_VIA_MSI(ih));
+
+ dev = MSI_INT_DEV(ih);
+ vec = MSI_INT_VEC(ih);
+ if (MSI_INT_IS_MSIX(ih))
+ snprintf(buf, len, "msix%d vec %d", dev, vec);
+ else
+ snprintf(buf, len, "msi%d vec %d", dev, vec);
+
+ return buf;
+}
/*
* Release MSI handles.
@@ -467,7 +467,7 @@
/*****************************************************************************/
/*
- * these APIs may be MI code.
+ * extern for MI code.
*/
/*
diff -r 5b10377fd650 -r 43d29d85276e sys/arch/x86/pci/pci_msi_machdep.h
--- a/sys/arch/x86/pci/pci_msi_machdep.h Fri May 15 08:29:33 2015 +0000
+++ b/sys/arch/x86/pci/pci_msi_machdep.h Fri May 15 08:36:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_msi_machdep.h,v 1.1 2015/05/15 08:26:44 knakahara Exp $ */
+/* $NetBSD: pci_msi_machdep.h,v 1.2 2015/05/15 08:36:41 knakahara Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -29,6 +29,8 @@
#ifndef _X86_PCI_PCI_MSI_MACHDEP_H_
#define _X86_PCI_PCI_MSI_MACHDEP_H_
+const char *x86_pci_msi_string(pci_chipset_tag_t, pci_intr_handle_t,
+ char *, size_t);
void x86_pci_msi_release(pci_chipset_tag_t, pci_intr_handle_t *,
int);
void *x86_pci_msi_establish(pci_chipset_tag_t, pci_intr_handle_t,
diff -r 5b10377fd650 -r 43d29d85276e sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c Fri May 15 08:29:33 2015 +0000
+++ b/sys/arch/x86/x86/intr.c Fri May 15 08:36:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.84 2015/05/09 13:05:51 christos Exp $ */
+/* $NetBSD: intr.c,v 1.85 2015/05/15 08:36:41 knakahara Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.84 2015/05/09 13:05:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.85 2015/05/15 08:36:41 knakahara Exp $");
#include "opt_intrdebug.h"
#include "opt_multiprocessor.h"
@@ -177,6 +177,7 @@
#endif
#include <x86/pci/msipic.h>
+#include <x86/pci/pci_msi_machdep.h>
#if NPCI == 0
#define msipic_is_msi_pic(PIC) (false)
@@ -487,7 +488,7 @@
else if (pic->pic_type == PIC_MSIX)
MSI_INT_MAKE_MSIX(pih);
- return pci_msi_string(NULL, pih, buf, len);
+ return x86_pci_msi_string(NULL, pih, buf, len);
}
#endif
Home |
Main Index |
Thread Index |
Old Index