CVS commit: src/sys/arch/powerpc/booke/pci

2022-07-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jul 22 19:55:38 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Stop using deprecated proplib functions.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/booke/pci/pq3pci.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/powerpc/booke/pci/pq3pci.c
diff -u src/sys/arch/powerpc/booke/pci/pq3pci.c:1.31 src/sys/arch/powerpc/booke/pci/pq3pci.c:1.32
--- src/sys/arch/powerpc/booke/pci/pq3pci.c:1.31	Sat May  7 05:08:16 2022
+++ src/sys/arch/powerpc/booke/pci/pq3pci.c	Fri Jul 22 19:55:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $	*/
+/*	$NetBSD: pq3pci.c,v 1.32 2022/07/22 19:55:38 thorpej Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,7 +39,7 @@
 #define	__INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.32 2022/07/22 19:55:38 thorpej Exp $");
 
 #include "locators.h"
 
@@ -712,7 +712,7 @@ pq3pci_intrmap_setup(struct pq3pci_softc
 	prop_number_t pn = prop_dictionary_get(sc->sc_intrmap, "interrupt-mask");
 	KASSERT(pn != NULL);
 
-	sc->sc_intrmask = prop_number_unsigned_integer_value(pn);
+	sc->sc_intrmask = prop_number_unsigned_value(pn);
 
 	sc->sc_ih = intr_establish_xname(cnl->cnl_intrs[0], IPL_VM, IST_ONCHIP,
 	pq3pci_onchip_intr, sc, device_xname(sc->sc_dev));
@@ -1393,11 +1393,11 @@ pq3pci_intr_handle_lookup(struct pq3pci_
 	prop_number_t pn_irq = prop_dictionary_get(entry, "interrupt");
 	KASSERT(pn_irq != NULL);
 	KASSERT(prop_object_type(pn_irq) == PROP_TYPE_NUMBER);
-	int irq = prop_number_unsigned_integer_value(pn_irq);
+	int irq = prop_number_unsigned_value(pn_irq);
 	prop_number_t pn_ist = prop_dictionary_get(entry, "type");
 	KASSERT(pn_ist != NULL);
 	KASSERT(prop_object_type(pn_ist) == PROP_TYPE_NUMBER);
-	int ist = prop_number_unsigned_integer_value(pn_ist);
+	int ist = prop_number_unsigned_value(pn_ist);
 
 	return PIH_MAKE(irq, ist, 0);
 }



CVS commit: src/sys/arch/powerpc/booke/pci

2022-07-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jul 22 19:55:38 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Stop using deprecated proplib functions.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/booke/pci/pq3pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke/pci

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:08:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.

These locks are typically used during autoconf(9), not from
interrupt context.

Found by LOCKDEBUG.

XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/pci/pq3pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke/pci

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:08:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.

These locks are typically used during autoconf(9), not from
interrupt context.

Found by LOCKDEBUG.

XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/pci/pq3pci.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/powerpc/booke/pci/pq3pci.c
diff -u src/sys/arch/powerpc/booke/pci/pq3pci.c:1.30 src/sys/arch/powerpc/booke/pci/pq3pci.c:1.31
--- src/sys/arch/powerpc/booke/pci/pq3pci.c:1.30	Tue Jan 11 22:45:56 2022
+++ src/sys/arch/powerpc/booke/pci/pq3pci.c	Sat May  7 05:08:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $	*/
+/*	$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,7 +39,7 @@
 #define	__INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $");
 
 #include "locators.h"
 
@@ -727,8 +727,11 @@ static int
 pq3pci_once_init(void)
 {
 
-	mutex_init(_intrsources_lock, MUTEX_DEFAULT, IPL_VM);
-	mutex_init(_msigroups_lock, MUTEX_DEFAULT, IPL_VM);
+	/*
+	 * XXX necessary??
+	 */
+	mutex_init(_intrsources_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(_msigroups_lock, MUTEX_DEFAULT, IPL_NONE);
 
 	return 0;
 }
@@ -1209,7 +1212,7 @@ pq3pci_msi_alloc_one(int ipl)
 	uint32_t bitmap[maplen];
 	pci_intr_handle_t handle;
 
-	mutex_spin_enter(_msigroups_lock);
+	mutex_enter(_msigroups_lock);
 	for (u_int i = 0; i < maplen; i++) {
 		struct pq3pci_msigroup * const msig = pq3pci_msigroups[i];
 		if (msig == NULL) {
@@ -1237,20 +1240,20 @@ pq3pci_msi_alloc_one(int ipl)
 			struct pq3pci_msihand * const msih __diagused =
 			pq3pci_msi_claim(handle);
 			KASSERT(msih != NULL);
-			mutex_spin_exit(_msigroups_lock);
+			mutex_exit(_msigroups_lock);
 			return handle;
 		}
 	}
 
 	if (freegroup-- == 0) {
-		mutex_spin_exit(_msigroups_lock);
+		mutex_exit(_msigroups_lock);
 		return 0;
 	}
 
 	struct pq3pci_msigroup * const msig =
 	kmem_zalloc(sizeof(*msig), KM_NOSLEEP);
 	if (msig == NULL) {
-		mutex_spin_exit(_msigroups_lock);
+		mutex_exit(_msigroups_lock);
 		return 0;
 	}
 	pq3pci_msi_group_setup(msig, freegroup, ipl);
@@ -1259,7 +1262,7 @@ pq3pci_msi_alloc_one(int ipl)
 	struct pq3pci_msihand * const msih __diagused =
 	pq3pci_msi_claim(handle);
 	KASSERT(msih != NULL);
-	mutex_spin_exit(_msigroups_lock);
+	mutex_exit(_msigroups_lock);
 	return handle;
 }
 
@@ -1327,17 +1330,17 @@ static struct pq3pci_intrsource *
 pq3pci_intr_source_lookup(struct pq3pci_softc *sc, pci_intr_handle_t handle)
 {
 	struct pq3pci_intrsource *pis;
-	mutex_spin_enter(_intrsources_lock);
+	mutex_enter(_intrsources_lock);
 	SIMPLEQ_FOREACH(pis, _intrsources, pis_link) {
 		if (pis->pis_handle == handle) {
-			mutex_spin_exit(_intrsources_lock);
+			mutex_exit(_intrsources_lock);
 			return pis;
 		}
 	}
 	pis = kmem_zalloc(sizeof(*pis), KM_NOSLEEP);
 	if (pis != NULL)
 		pq3pci_intr_source_setup(sc, pis, handle);
-	mutex_spin_exit(_intrsources_lock);
+	mutex_exit(_intrsources_lock);
 	return pis;
 }