Module Name: src Committed By: knakahara Date: Fri May 15 08:36:41 UTC 2015
Modified Files: src/sys/arch/x86/include: pci_machdep_common.h src/sys/arch/x86/pci: pci_intr_machdep.c pci_msi_machdep.c pci_msi_machdep.h src/sys/arch/x86/x86: intr.c Log Message: pci_msi_string() must be used by MD code only. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/include/pci_machdep_common.h cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/pci/pci_intr_machdep.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/pci_msi_machdep.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/pci_msi_machdep.h cvs rdiff -u -r1.84 -r1.85 src/sys/arch/x86/x86/intr.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.17 src/sys/arch/x86/include/pci_machdep_common.h:1.18 --- src/sys/arch/x86/include/pci_machdep_common.h:1.17 Fri May 15 08:26:44 2015 +++ src/sys/arch/x86/include/pci_machdep_common.h Fri May 15 08:36:41 2015 @@ -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 @@ int pci_intx_alloc(const struct pci_att 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 *); Index: src/sys/arch/x86/pci/pci_intr_machdep.c diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.32 src/sys/arch/x86/pci/pci_intr_machdep.c:1.33 --- src/sys/arch/x86/pci/pci_intr_machdep.c:1.32 Fri May 15 08:29:33 2015 +++ src/sys/arch/x86/pci/pci_intr_machdep.c Fri May 15 08:36:41 2015 @@ -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_intr_string(pci_chipset_tag_t pc, pc { 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 @@ pci_intr_string(pci_chipset_tag_t pc, pc buf, len); } + if (INT_VIA_MSI(ih)) + return x86_pci_msi_string(pc, ih, buf, len); + return intr_string(ih & ~MPSAFE_MASK, buf, len); } Index: src/sys/arch/x86/pci/pci_msi_machdep.c diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.4 src/sys/arch/x86/pci/pci_msi_machdep.c:1.5 --- src/sys/arch/x86/pci/pci_msi_machdep.c:1.4 Fri May 15 08:29:33 2015 +++ src/sys/arch/x86/pci/pci_msi_machdep.c Fri May 15 08:36:41 2015 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pci_msi_mach #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 @@ pci_msi_alloc_vectors(struct pic *msi_pi 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 @@ pci_msi_free_vectors(struct pic *msi_pic 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,10 +350,32 @@ x86_pci_msix_release_internal(pci_intr_h /*****************************************************************************/ /* - * 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. */ void @@ -467,7 +467,7 @@ x86_pci_msix_disestablish(pci_chipset_ta /*****************************************************************************/ /* - * these APIs may be MI code. + * extern for MI code. */ /* Index: src/sys/arch/x86/pci/pci_msi_machdep.h diff -u src/sys/arch/x86/pci/pci_msi_machdep.h:1.1 src/sys/arch/x86/pci/pci_msi_machdep.h:1.2 --- src/sys/arch/x86/pci/pci_msi_machdep.h:1.1 Fri May 15 08:26:44 2015 +++ src/sys/arch/x86/pci/pci_msi_machdep.h Fri May 15 08:36:41 2015 @@ -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, Index: src/sys/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.84 src/sys/arch/x86/x86/intr.c:1.85 --- src/sys/arch/x86/x86/intr.c:1.84 Sat May 9 13:05:51 2015 +++ src/sys/arch/x86/x86/intr.c Fri May 15 08:36:41 2015 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.8 #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 @@ create_intrid(int legacy_irq, struct pic 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