FreeBSD/sys/dev/intpm/intpm.c
/*
 * Wait for completion and return result.
 */
Wait for completion and return result.
Wait for completion and return result .
static int
intsmb_stop(struct intsmb_softc *sc)
{
	int error, status;
	INTSMB_LOCK_ASSERT(sc);
	if (sc->poll || cold)
		return (intsmb_stop_poll(sc));
	error = msleep(sc, &sc->lock, PWAIT | PCATCH, "SMBWAI", hz / 8);
	if (error == 0) {
		status = bus_read_1(sc->io_res, PIIX4_SMBHSTSTS);
		if (!(status & PIIX4_SMBHSTSTAT_BUSY)) {
			error = intsmb_error(sc->dev, status);
			if (error == 0 && !(status & PIIX4_SMBHSTSTAT_INTR))
				device_printf(sc->dev, "unknown cause why?\n");
#ifdef ENABLE_ALART
			bus_write_1(sc->io_res, PIIX4_SMBSLVCNT,
			    PIIX4_SMBSLVCNT_ALTEN);
#endif
			return (error);
		}
	}
	sc->isbusy = 0;
	bus_write_1(sc->io_res, PIIX4_SMBSLVCNT, PIIX4_SMBSLVCNT_ALTEN);
	if (error == EWOULDBLOCK)
		return (SMB_ETIMEOUT);
	else
		return (SMB_EABORT);
}
static int intsmb_stop ( struct intsmb_softc * sc ) { int error , status ; INTSMB_LOCK_ASSERT ( sc ) ; if ( sc -> poll || cold ) return ( intsmb_stop_poll ( sc ) ) ; error = msleep ( sc , & sc -> lock , PWAIT | PCATCH , " " , hz / 8 ) ; if ( error == 0 ) { status = bus_read_1 ( sc -> io_res , PIIX4_SMBHSTSTS ) ; if ( ! ( status & PIIX4_SMBHSTSTAT_BUSY ) ) { error = intsmb_error ( sc -> dev , status ) ; if ( error == 0 && ! ( status & PIIX4_SMBHSTSTAT_INTR ) ) device_printf ( sc -> dev , " \n " ) ; #ifdef ENABLE_ALART bus_write_1 ( sc -> io_res , PIIX4_SMBSLVCNT , PIIX4_SMBSLVCNT_ALTEN ) ; #endif return ( error ) ; } } sc -> isbusy = 0 ; bus_write_1 ( sc -> io_res , PIIX4_SMBSLVCNT , PIIX4_SMBSLVCNT_ALTEN ) ; if ( error == EWOULDBLOCK ) return ( SMB_ETIMEOUT ) ; else return ( SMB_EABORT ) ; }
Wait for completion and return result.
Wait for completion and return result .
/* So that it can use device during device probe on SMBus. */ /* Timeout Procedure. */ /* Re-enable suppressed interrupt from slave part. */