FreeBSD/sys/dev/cfi/cfi_core.c
/*
 * Write the Protection Lock Register to lock down the
 * user-settable segment of the Protection Register.
 * NOTE: this operation is not reversible.
 */
Write the Protection Lock Register to lock down the
user-settable segment of the Protection Register.
NOTE: this operation is not reversible.
Write the Protection Lock Register to lock down the user - settable segment of the Protection Register . NOTE : this operation is not reversible .
int 
cfi_intel_set_plr(struct cfi_softc *sc)
{
#ifdef CFI_ARMEDANDDANGEROUS
	register_t intr;
	int error;
	sbintime_t start;
#endif
	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
		return EOPNOTSUPP;
	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
#ifdef CFI_ARMEDANDDANGEROUS
	device_printf(sc->sc_dev, "set PLR\n");
	intr = intr_disable();
	binuptime(&start);
	cfi_write(sc, 0, CFI_INTEL_PP_SETUP);
	cfi_put16(sc, CFI_INTEL_PLR, 0xFFFD);
	intr_restore(intr);
	error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, start,
	    CFI_TIMEOUT_WRITE);
	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
	return error;
#else
	device_printf(sc->sc_dev, "%s: PLR not set, "
	    "CFI_ARMEDANDDANGEROUS not configured\n", __func__);
	return ENXIO;
#endif
}
int cfi_intel_set_plr ( struct cfi_softc * sc ) { #ifdef CFI_ARMEDANDDANGEROUS register_t intr ; int error ; sbintime_t start ; #endif if ( sc -> sc_cmdset != CFI_VEND_INTEL_ECS ) return EOPNOTSUPP ; KASSERT ( sc -> sc_width == 2 , ( " " , sc -> sc_width ) ) ; #ifdef CFI_ARMEDANDDANGEROUS device_printf ( sc -> sc_dev , " \n " ) ; intr = intr_disable ( ) ; binuptime ( & start ) ; cfi_write ( sc , 0 , CFI_INTEL_PP_SETUP ) ; cfi_put16 ( sc , CFI_INTEL_PLR , 0xFFFD ) ; intr_restore ( intr ) ; error = cfi_wait_ready ( sc , CFI_BCS_READ_STATUS , start , CFI_TIMEOUT_WRITE ) ; cfi_write ( sc , 0 , CFI_BCS_READ_ARRAY ) ; return error ; #else device_printf ( sc -> sc_dev , " " " \n " , __func__ ) ; return ENXIO ; #endif }
Write the Protection Lock Register to lock down the
 user-settable segment of the Protection Register.
Write the Protection Lock Register to lock down the user - settable segment of the Protection Register .
/* worthy of console msg */