diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-01-04 12:02:50 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-01-04 12:02:50 +0000 |
commit | 5bb6200f2c008a19bccc02c73c782d50022e6e35 (patch) | |
tree | 42a3c4a33d9d5f1b06ea598627f47190cbffdc4e /sys/dev/pci | |
parent | 089602d9dabaa1c284a93f600abcad8d8570adde (diff) |
stash the dva for each command in the ccb, and program the hardware with
the dva of the rfis and command list.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/ahci.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c index b8db8b8c190..7890dcf1874 100644 --- a/sys/dev/pci/ahci.c +++ b/sys/dev/pci/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.34 2007/01/04 11:48:03 dlg Exp $ */ +/* $OpenBSD: ahci.c,v 1.35 2007/01/04 12:02:49 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -179,6 +179,7 @@ struct ahci_ccb { int ccb_id; struct ahci_cmd *ccb_cmd; + u_int64_t ccb_cmd_dva; bus_dmamap_t ccb_dmamap; @@ -434,6 +435,8 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port) struct ahci_port *ap; struct ahci_ccb *ccb; u_int8_t *kva; + u_int64_t dva; + int offset = 0; int i; ap = malloc(sizeof(struct ahci_port), M_DEVBUF, M_NOWAIT); @@ -474,6 +477,7 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port) goto freeccbs; } kva = AHCI_DMA_KVA(ap->ap_dmamem); + dva = AHCI_DMA_DVA(ap->ap_dmamem); for (i = 0; i < sc->sc_ncmds; i++) { ccb = &ap->ap_ccbs[i]; @@ -486,16 +490,21 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port) } ccb->ccb_id = i; - ccb->ccb_cmd = (struct ahci_cmd *)kva; - kva += sizeof(struct ahci_cmd); + ccb->ccb_cmd = (struct ahci_cmd *)(kva + offset); + ccb->ccb_cmd_dva = dva + offset; + offset += sizeof(struct ahci_cmd); ahci_put_ccb(ap, ccb); } - ap->ap_rfis = (struct ahci_rfis *)kva; - kva += sizeof(struct ahci_rfis); + ap->ap_rfis = (struct ahci_rfis *)(kva + offset); + ahci_pwrite(ap, AHCI_PREG_FB, (u_int32_t)(dva + offset)); + ahci_pwrite(ap, AHCI_PREG_FBU, (u_int32_t)((dva + offset) >> 32)); + offset += sizeof(struct ahci_rfis); - ap->ap_cmd_list = (struct ahci_cmd_list *)kva; + ap->ap_cmd_list = (struct ahci_cmd_list *)(kva + offset); + ahci_pwrite(ap, AHCI_PREG_CLB, (u_int32_t)(dva + offset)); + ahci_pwrite(ap, AHCI_PREG_CLBU, (u_int32_t)((dva + offset) >> 32)); sc->sc_ports[port] = ap; |