NetBSD-Bugs archive

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

Re: kern/55745: spdmem_i2c_match() panics



The following reply was made to PR kern/55745; it has been noted by GNATS.

From: Edgar =?iso-8859-1?B?RnXf?= <ef%math.uni-bonn.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: Hauke Fath <hf%spg.tu-darmstadt.de@localhost>
Subject: Re: kern/55745: spdmem_i2c_match() panics
Date: Mon, 16 Nov 2020 15:55:19 +0100

 --jq0ap7NbKX2Kqbes
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 The problem (at least on -8, didn't check -9) is that sys/dev/pci/piixpm.c 1.52.6.2 installs NULL handlers for ic_{acquire,release}_bus in some cases, but the rest of the I2C code isn't prepared for that. So I guess one needs to install dummy handlers that only acquire/release the i2c mutex.
 
 With that change, I can boot again.
 
 --jq0ap7NbKX2Kqbes
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="piixpm.c.diff"
 
 Index: sys/dev/pci/piixpm.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/piixpm.c,v
 retrieving revision 1.52.6.2
 diff -u -r1.52.6.2 piixpm.c
 --- sys/dev/pci/piixpm.c	5 Aug 2020 16:11:56 -0000	1.52.6.2
 +++ sys/dev/pci/piixpm.c	16 Nov 2020 14:35:58 -0000
 @@ -125,6 +125,8 @@
  static void	piixpm_csb5_reset(void *);
  static int	piixpm_i2c_sb800_acquire_bus(void *, int);
  static void	piixpm_i2c_sb800_release_bus(void *, int);
 +static int	piixpm_i2c_dummy_acquire_bus(void *, int);
 +static void	piixpm_i2c_dummy_release_bus(void *, int);
  static int	piixpm_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *,
      size_t, void *, size_t, int);
  
 @@ -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_dummy_acquire_bus;
 +			tag->ic_release_bus = piixpm_i2c_dummy_release_bus;
  		}
  		tag->ic_exec = piixpm_i2c_exec;
  		memset(&iba, 0, sizeof(iba));
 @@ -549,6 +551,18 @@
  	return 0;
  }
  
 +static int
 +piixpm_i2c_dummy_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_sb800_release_bus(void *cookie, int flags)
  {
 @@ -590,6 +604,16 @@
  		mutex_exit(&sc->sc_i2c_mutex);
  }
  
 +static void
 +piixpm_i2c_dummy_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_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
      const void *cmdbuf, size_t cmdlen, void *buf, size_t len, int flags)
 
 --jq0ap7NbKX2Kqbes--
 


Home | Main Index | Thread Index | Old Index