Exemple #1
0
static struct cac_ccb *
cac_pci_l0_completed(struct cac_softc *sc)
{
    struct cac_ccb *ccb;
    u_int32_t off;

    if ((off = cac_inl(sc, CAC_42REG_DONE_FIFO)) == 0xffffffffU)
        return (NULL);

    cac_outl(sc, CAC_42REG_DONE_FIFO, 0);

    if ((off & 3) != 0)
        printf("%s: failed command list returned: %lx\n",
               device_xname(sc->sc_dev), (long)off);

    off = (off & ~3) - sc->sc_ccbs_paddr;
    ccb = (struct cac_ccb *)((char *)sc->sc_ccbs + off);

    bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, off, sizeof(struct cac_ccb),
                    BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);

    if ((off & 3) != 0 && ccb->ccb_req.error == 0)
        ccb->ccb_req.error = CAC_RET_CMD_REJECTED;

    return (ccb);
}
Exemple #2
0
static struct cac_ccb *
cac_l0_completed(struct cac_softc *sc)
{
	struct cac_ccb *ccb;
	paddr_t off;

	KASSERT(mutex_owned(&sc->sc_mutex));

	if ((off = cac_inl(sc, CAC_REG_DONE_FIFO)) == 0)
		return (NULL);

	if ((off & 3) != 0)
		aprint_error_dev(sc->sc_dev, "failed command list returned: %lx\n",
		    (long)off);

	off = (off & ~3) - sc->sc_ccbs_paddr;
	ccb = (struct cac_ccb *)((char *)sc->sc_ccbs + off);

	bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, off, sizeof(struct cac_ccb),
	    BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);

	if ((off & 3) != 0 && ccb->ccb_req.error == 0)
		ccb->ccb_req.error = CAC_RET_CMD_REJECTED;

	return (ccb);
}
Exemple #3
0
static int
cac_l0_intr_pending(struct cac_softc *sc)
{

	KASSERT(mutex_owned(&sc->sc_mutex));

	return (cac_inl(sc, CAC_REG_INTR_PENDING) & CAC_INTR_ENABLE);
}
Exemple #4
0
static int
cac_l0_fifo_full(struct cac_softc *sc)
{

	KASSERT(mutex_owned(&sc->sc_mutex));

	return (cac_inl(sc, CAC_REG_CMD_FIFO) == 0);
}
Exemple #5
0
static int
cac_pci_l0_fifo_full(struct cac_softc *sc)
{

    return (cac_inl(sc, CAC_42REG_CMD_FIFO) != 0);
}
Exemple #6
0
static int
cac_pci_l0_intr_pending(struct cac_softc *sc)
{

    return ((cac_inl(sc, CAC_42REG_STATUS) & CAC_42_EXTINT) != 0);
}