Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/pci Apply patch, requested by msaitoh in ticket #...



details:   https://anonhg.NetBSD.org/src/rev/ef56eee8c12a
branches:  netbsd-9
changeset: 1026576:ef56eee8c12a
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 30 11:44:39 2021 +0000

description:
Apply patch, requested by msaitoh in ticket #1378:

        sys/dev/pci/piixpm.c                            patch

Fix a bug that I2C access panics on old AMD chipset (e.g SB600).
Fixes PR kern/56525.

diffstat:

 sys/dev/pci/piixpm.c |  32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diffs (67 lines):

diff -r d91cd89321f2 -r ef56eee8c12a sys/dev/pci/piixpm.c
--- a/sys/dev/pci/piixpm.c      Fri Nov 26 18:10:36 2021 +0000
+++ b/sys/dev/pci/piixpm.c      Tue Nov 30 11:44:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.54.2.1 2020/07/16 12:39:11 martin Exp $ */
+/* $NetBSD: piixpm.c,v 1.54.2.2 2021/11/30 11:44:39 martin Exp $ */
 /*     $OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $  */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.1 2020/07/16 12:39:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.54.2.2 2021/11/30 11:44:39 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,6 +123,8 @@
 
 static int     piixpm_sb800_init(struct piixpm_softc *);
 static void    piixpm_csb5_reset(void *);
+static int     piixpm_i2c_sb600_acquire_bus(void *, int);
+static void    piixpm_i2c_sb600_release_bus(void *, int);
 static int     piixpm_i2c_sb800_acquire_bus(void *, int);
 static void    piixpm_i2c_sb800_release_bus(void *, int);
 static int     piixpm_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *,
@@ -338,8 +340,8 @@
                        tag->ic_acquire_bus = piixpm_i2c_sb800_acquire_bus;
                        tag->ic_release_bus = piixpm_i2c_sb800_release_bus;
                } else {
-                       tag->ic_acquire_bus = NULL;
-                       tag->ic_release_bus = NULL;
+                       tag->ic_acquire_bus = piixpm_i2c_sb600_acquire_bus;
+                       tag->ic_release_bus = piixpm_i2c_sb600_release_bus;
                }
                tag->ic_exec = piixpm_i2c_exec;
                memset(&iba, 0, sizeof(iba));
@@ -487,6 +489,28 @@
 }
 
 static int
+piixpm_i2c_sb600_acquire_bus(void *cookie, int flags)
+{
+       struct piixpm_smbus *smbus = cookie;
+       struct piixpm_softc *sc = smbus->softc;
+
+       if (!cold)
+               mutex_enter(&sc->sc_i2c_mutex);
+
+       return 0;
+}
+
+static void
+piixpm_i2c_sb600_release_bus(void *cookie, int flags)
+{
+       struct piixpm_smbus *smbus = cookie;
+       struct piixpm_softc *sc = smbus->softc;
+
+       if (!cold)
+               mutex_exit(&sc->sc_i2c_mutex);
+}
+
+static int
 piixpm_i2c_sb800_acquire_bus(void *cookie, int flags)
 {
        struct piixpm_smbus *smbus = cookie;



Home | Main Index | Thread Index | Old Index