sys/dev/mfi/mfi_tbolt.c
/*
 * mfi_tbolt_adp_reset - For controller reset
 * @regs: MFI register set
 */
For controller reset
@regs: MFI register set
For controller reset @regs : MFI register set
int
mfi_tbolt_adp_reset(struct mfi_softc *sc)
{
	int retry = 0, i = 0;
	int HostDiag;
	MFI_WRITE4(sc, MFI_WSR, 0xF);
	MFI_WRITE4(sc, MFI_WSR, 4);
	MFI_WRITE4(sc, MFI_WSR, 0xB);
	MFI_WRITE4(sc, MFI_WSR, 2);
	MFI_WRITE4(sc, MFI_WSR, 7);
	MFI_WRITE4(sc, MFI_WSR, 0xD);
	for (i = 0; i < 10000; i++) ;
	HostDiag = (uint32_t)MFI_READ4(sc, MFI_HDR);
	while (!( HostDiag & DIAG_WRITE_ENABLE)) {
		for (i = 0; i < 1000; i++);
		HostDiag = (uint32_t)MFI_READ4(sc, MFI_HDR);
		device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: retry time=%d, "
		    "hostdiag=%#x\n", retry, HostDiag);
		if (retry++ >= 100)
			return 1;
	}
	device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: HostDiag=%#x\n", HostDiag);
	MFI_WRITE4(sc, MFI_HDR, (HostDiag | DIAG_RESET_ADAPTER));
	for (i=0; i < 10; i++) {
		for (i = 0; i < 10000; i++);
	}
	HostDiag = (uint32_t)MFI_READ4(sc, MFI_RSR);
	while (HostDiag & DIAG_RESET_ADAPTER) {
		for (i = 0; i < 1000; i++) ;
		HostDiag = (uint32_t)MFI_READ4(sc, MFI_RSR);
		device_printf(sc->mfi_dev, "ADP_RESET_TBOLT: retry time=%d, "
		    "hostdiag=%#x\n", retry, HostDiag);
		if (retry++ >= 1000)
			return 1;
	}
	return 0;
}
int mfi_tbolt_adp_reset ( struct mfi_softc * sc ) { int retry = 0 , i = 0 ; int HostDiag ; MFI_WRITE4 ( sc , MFI_WSR , 0xF ) ; MFI_WRITE4 ( sc , MFI_WSR , 4 ) ; MFI_WRITE4 ( sc , MFI_WSR , 0xB ) ; MFI_WRITE4 ( sc , MFI_WSR , 2 ) ; MFI_WRITE4 ( sc , MFI_WSR , 7 ) ; MFI_WRITE4 ( sc , MFI_WSR , 0xD ) ; for ( i = 0 ; i < 10000 ; i ++ ) ; HostDiag = ( uint32_t ) MFI_READ4 ( sc , MFI_HDR ) ; while ( ! ( HostDiag & DIAG_WRITE_ENABLE ) ) { for ( i = 0 ; i < 1000 ; i ++ ) ; HostDiag = ( uint32_t ) MFI_READ4 ( sc , MFI_HDR ) ; device_printf ( sc -> mfi_dev , " " " \n " , retry , HostDiag ) ; if ( retry ++ >= 100 ) return 1 ; } device_printf ( sc -> mfi_dev , " \n " , HostDiag ) ; MFI_WRITE4 ( sc , MFI_HDR , ( HostDiag | DIAG_RESET_ADAPTER ) ) ; for ( i = 0 ; i < 10 ; i ++ ) { for ( i = 0 ; i < 10000 ; i ++ ) ; } HostDiag = ( uint32_t ) MFI_READ4 ( sc , MFI_RSR ) ; while ( HostDiag & DIAG_RESET_ADAPTER ) { for ( i = 0 ; i < 1000 ; i ++ ) ; HostDiag = ( uint32_t ) MFI_READ4 ( sc , MFI_RSR ) ; device_printf ( sc -> mfi_dev , " " " \n " , retry , HostDiag ) ; if ( retry ++ >= 1000 ) return 1 ; } return 0 ; }
mfi_tbolt_adp_reset - For controller reset
 @regs: MFI register set
mfi_tbolt_adp_reset - For controller reset @regs : MFI register set