#include <sys/disklabel.h>
#include <sys/dkstat.h>
#include <sys/buf.h>
+#include <sys/malloc.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#include <machine/cpu.h>
/*
* Need to check that scripts is on a long word boundary
- * and that DS is on a long word boundary.
* Also should verify that dev doesn't span non-contiguous
* physical pages.
*/
sc->sc_scriptspa = kvtop(scripts);
+
+ /*
+ * malloc sc_acb to ensure that DS is on a long word boundary.
+ */
+
+ MALLOC(sc->sc_acb, struct siop_acb *,
+ sizeof(struct siop_acb) * SIOP_NACB, M_DEVBUF, M_NOWAIT);
+ if (sc->sc_acb == NULL)
+ panic("siopinitialize: ACB malloc failed!");
+
sc->sc_tcp[1] = 1000 / sc->sc_clock_freq;
sc->sc_tcp[2] = 1500 / sc->sc_clock_freq;
sc->sc_tcp[3] = 2000 / sc->sc_clock_freq;
TAILQ_INIT(&sc->free_list);
sc->sc_nexus = NULL;
acb = sc->sc_acb;
- bzero(acb, sizeof(sc->sc_acb));
- for (i = 0; i < sizeof(sc->sc_acb) / sizeof(*acb); i++) {
+ bzero(acb, sizeof(struct siop_acb) * SIOP_NACB);
+ for (i = 0; i < SIOP_NACB; i++) {
TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
acb++;
}
#endif
/* push data cache for all data the 53c710 needs to access */
- dma_cachectl (sc, sizeof (struct siop_softc));
+ dma_cachectl (acb, sizeof (struct siop_acb));
dma_cachectl (cbuf, clen);
if (buf != NULL && len != 0)
dma_cachectl (buf, len);