FreeBSD/sys/dev/ipmi/ipmi_kcs.c
/*
 * Read one byte of the reply message.
 */
Read one byte of the reply message.
Read one byte of the reply message .
static int
kcs_read_byte(struct ipmi_softc *sc, u_char *data)
{
	int status;
	u_char dummy;
	status = kcs_wait_for_ibf(sc, 0);
	if (KCS_STATUS_STATE(status) == KCS_STATUS_STATE_READ) {
		status = kcs_wait_for_obf(sc, 1);
		if ((status & KCS_STATUS_OBF) == 0)
			return (0);
		*data = INB(sc, KCS_DATA);
		OUTB(sc, KCS_DATA, KCS_DATA_IN_READ);
		return (1);
	}
	if (KCS_STATUS_STATE(status) == KCS_STATUS_STATE_IDLE) {
		status = kcs_wait_for_obf(sc, 1);
		if ((status & KCS_STATUS_OBF) == 0)
			return (0);
		dummy = INB(sc, KCS_DATA);
		return (2);
	}
	return (0);
}
static int kcs_read_byte ( struct ipmi_softc * sc , u_char * data ) { int status ; u_char dummy ; status = kcs_wait_for_ibf ( sc , 0 ) ; if ( KCS_STATUS_STATE ( status ) == KCS_STATUS_STATE_READ ) { status = kcs_wait_for_obf ( sc , 1 ) ; if ( ( status & KCS_STATUS_OBF ) == 0 ) return ( 0 ) ; * data = INB ( sc , KCS_DATA ) ; OUTB ( sc , KCS_DATA , KCS_DATA_IN_READ ) ; return ( 1 ) ; } if ( KCS_STATUS_STATE ( status ) == KCS_STATUS_STATE_IDLE ) { status = kcs_wait_for_obf ( sc , 1 ) ; if ( ( status & KCS_STATUS_OBF ) == 0 ) return ( 0 ) ; dummy = INB ( sc , KCS_DATA ) ; return ( 2 ) ; } return ( 0 ) ; }
Read one byte of the reply message.
Read one byte of the reply message .
/* Wait for IBF = 0 */ /* Read State */ /* Wait for OBF = 1 */ /* Read Data_out */ /* Write READ into Data_in */ /* Idle State */ /* Wait for OBF = 1*/ /* Read Dummy */ /* Error State */