示例#1
0
static void
cfi_jedec_id_4(struct cfi * const cfi)
{
	struct cfi_jedec_id_data *idp = &cfi->cfi_id_data;
	uint32_t data[0x10];

	bus_space_read_region_4(cfi->cfi_bst, cfi->cfi_bsh, 0, data,
		__arraycount(data));

	CFI_DUMP_JEDEC(0, data, sizeof(data), 1);

	idp->id_mid = data[0] & 0xffff;
	idp->id_did[0] = data[1] & 0xffff;
	idp->id_did[1] = data[0xe] & 0xffff;
	idp->id_did[2] = data[0xf] & 0xffff;
	idp->id_prot_state = data[2] & 0xffff;
	idp->id_indicators = data[3] & 0xffff;

	/* software bits, upper and lower
	 * - undefined on S29GL-P
	 * - defined   on S29GL-S
	 */
	idp->id_swb_lo = data[0xc] & 0xffff;
	idp->id_swb_hi = data[0xd] & 0xffff;

}
示例#2
0
static inline void
cpsw_get_rxdesc(struct cpsw_softc * const sc, const u_int i,
    struct cpsw_cpdma_bd * const bdp)
{
	const bus_size_t o = sizeof(struct cpsw_cpdma_bd) * i;
	bus_space_read_region_4(sc->sc_bst, sc->sc_bsh_rxdescs, o,
	    (uint32_t *)bdp, 4);
}
示例#3
0
static void
cfi_chip_query_4(struct cfi * const cfi)
{
	uint32_t data[0x80];

	bus_space_read_region_4(cfi->cfi_bst, cfi->cfi_bsh, 0, data,
	    __arraycount(data));
	CFI_DUMP_QRY(0, data, sizeof(data), 4);
	CFI_QRY_UNPACK_COMMON(cfi, data, uint32_t);
}
示例#4
0
static inline void
cpsw_get_txdesc(struct cpsw_softc * const sc, const u_int i,
    struct cpsw_cpdma_bd * const bdp)
{
	const bus_size_t o = sizeof(struct cpsw_cpdma_bd) * i;
	uint32_t * const dp = bdp->word;
	const bus_size_t c = __arraycount(bdp->word);

	KERNHIST_FUNC(__func__);
	KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0);

	bus_space_read_region_4(sc->sc_bst, sc->sc_bsh_txdescs, o, dp, c);
	KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n",
	    dp[0], dp[1], dp[2], dp[3]);
}
示例#5
0
static int
cfi_0002_read_page(device_t self, flash_off_t offset, uint8_t *datap)
{
	struct nor_softc * const sc = device_private(self);
	KASSERT(sc != NULL);
	KASSERT(sc->sc_nor_if != NULL);
	struct cfi *cfi = (struct cfi * const)sc->sc_nor_if->private;
	KASSERT(cfi != NULL);
	struct nor_chip * const chip = &sc->sc_chip;
	KASSERT(chip != NULL);
	KASSERT(chip->nc_page_mask != 0);
	KASSERT((offset & ~chip->nc_page_mask) == 0);
	KASSERT (chip->nc_page_size != 0);
	KASSERT((chip->nc_page_size & ((1 << cfi->cfi_portwidth) - 1)) == 0);

	CFI_0002_STATS_INC(cfi, read_page);

	bus_size_t count = chip->nc_page_size >> cfi->cfi_portwidth;
							/* #words/page */

	int error = cfi_0002_busy_wait(cfi, offset, cfi_0002_time_dflt(cfi));
	if (error != 0)
		return error;

	switch(cfi->cfi_portwidth) {
	case 0:
		bus_space_read_region_1(cfi->cfi_bst, cfi->cfi_bsh, offset,
			(uint8_t *)datap, count);
		break;
	case 1:
		bus_space_read_region_2(cfi->cfi_bst, cfi->cfi_bsh, offset,
			(uint16_t *)datap, count);
		break;
	case 2:
		bus_space_read_region_4(cfi->cfi_bst, cfi->cfi_bsh, offset,
			(uint32_t *)datap, count);
		break;
	default:
		panic("%s: bad port width %d\n", __func__, cfi->cfi_portwidth);
	};

	return 0;
}
示例#6
0
static void
ingenic_rng_get(struct ingenic_rng_softc *sc)
{
	uint32_t data;

	mutex_spin_enter(&sc->sc_intr_lock);
	while (sc->sc_bytes_wanted) {
		bus_space_read_region_4(sc->sc_bst, sc->sc_bsh, 0, &data, 1);
#if 0
		device_printf(sc->sc_dev, "random output: %x\n", data);
#endif
		mutex_spin_exit(&sc->sc_intr_lock);
		mutex_spin_enter(&sc->sc_rnd_lock);
		rnd_add_data(&sc->sc_rndsource, &data, sizeof(data),
		    sizeof(data) * NBBY);
		mutex_spin_exit(&sc->sc_rnd_lock);
		mutex_spin_enter(&sc->sc_intr_lock);
		sc->sc_bytes_wanted -= MIN(sc->sc_bytes_wanted, sizeof(data));
	}
	explicit_memset(&data, 0, sizeof(data));
	mutex_spin_exit(&sc->sc_intr_lock);
}
void
bs_through_bs_rr_4(bus_space_tag_t t, bus_space_handle_t bsh,
	    bus_size_t offset, u_int32_t *addr, bus_size_t count)
{
	bus_space_read_region_4(t->bs_base, bsh, offset, addr, count);
}