Index: ata-all.h =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata-all.h,v retrieving revision 1.103.2.9 diff -u -r1.103.2.9 ata-all.h --- ata-all.h 2 Sep 2006 17:01:32 -0000 1.103.2.9 +++ ata-all.h 25 Apr 2007 18:18:56 -0000 @@ -418,6 +418,7 @@ u_int32_t segsize; /* DMA SG list segment size */ u_int32_t max_iosize; /* DMA data max IO size */ u_int32_t cur_iosize; /* DMA data current IO size */ + u_int64_t max_address; /* highest DMA'able address */ int flags; #define ATA_DMA_READ 0x01 /* transaction is a read */ #define ATA_DMA_LOADED 0x02 /* DMA tables etc loaded */ Index: ata-chipset.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata-chipset.c,v retrieving revision 1.126.2.16 diff -u -r1.126.2.16 ata-chipset.c --- ata-chipset.c 11 Feb 2007 23:46:45 -0000 1.126.2.16 +++ ata-chipset.c 26 Apr 2007 19:00:35 -0000 @@ -450,6 +450,7 @@ { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); + u_int64_t work; int offset = (ch->unit << 7); /* setup legacy cruft we need */ @@ -478,13 +479,13 @@ ch->hw.command = NULL; /* not used here */ /* setup the work areas */ - ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, - ch->dma->work_bus + ATA_AHCI_CL_OFFSET); - ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLBU + offset, 0x00000000); - - ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FB + offset, - ch->dma->work_bus + ATA_AHCI_FB_OFFSET); - ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBU + offset, 0x00000000); + work = ch->dma->work_bus + ATA_AHCI_CL_OFFSET; + ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff); + ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLBU + offset, work >> 32); + + work = ch->dma->work_bus + ATA_AHCI_FB_OFFSET; + ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FB + offset, work & 0xffffffff); + ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBU + offset, work >> 32); /* enable wanted port interrupts */ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset, @@ -727,6 +728,7 @@ static void ata_ahci_dmainit(device_t dev) { + struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); ata_dmainit(dev); @@ -734,6 +736,8 @@ /* note start and stop are not used here */ ch->dma->setprd = ata_ahci_dmasetprd; ch->dma->max_iosize = 8192 * DEV_BSIZE; + if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_64BIT) + ch->dma->max_address = BUS_SPACE_MAXADDR; } } @@ -2383,7 +2387,7 @@ { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); - bus_addr_t work = ch->dma->work_bus; + u_int64_t work = ch->dma->work_bus; int i; /* clear work area */ @@ -2436,7 +2440,7 @@ ATA_OUTL(ctlr->r_res1, 0x02000 + ATA_MV_EDMA_BASE(ch), (1<<11) | (1<<13)); /* request queue base high */ - ATA_OUTL(ctlr->r_res1, 0x02010 + ATA_MV_EDMA_BASE(ch), (work >> 16) >> 16); + ATA_OUTL(ctlr->r_res1, 0x02010 + ATA_MV_EDMA_BASE(ch), work >> 32); /* request queue in ptr */ ATA_OUTL(ctlr->r_res1, 0x02014 + ATA_MV_EDMA_BASE(ch), work & 0xffffffff); @@ -2446,7 +2450,7 @@ /* response queue base high */ work += 1024; - ATA_OUTL(ctlr->r_res1, 0x0201c + ATA_MV_EDMA_BASE(ch), (work >> 16) >> 16); + ATA_OUTL(ctlr->r_res1, 0x0201c + ATA_MV_EDMA_BASE(ch), work >> 32); /* response queue in ptr */ ATA_OUTL(ctlr->r_res1, 0x02020 + ATA_MV_EDMA_BASE(ch), 0x0); @@ -2566,7 +2570,7 @@ /* fill in this request */ quadp[0] = (long)ch->dma->sg_bus & 0xffffffff; - quadp[1] = (ch->dma->sg_bus & 0xffffffff00000000ull) >> 32; + quadp[1] = (u_int64_t)ch->dma->sg_bus >> 32; wordp[4] = (request->flags & ATA_R_READ ? 0x01 : 0x00) | (tag<<1); i = 10; @@ -2707,8 +2711,8 @@ for (i = 0; i < nsegs; i++) { prd[i].addrlo = htole32(segs[i].ds_addr); - prd[i].addrhi = 0; prd[i].count = htole32(segs[i].ds_len); + prd[i].addrhi = htole32((u_int64_t)segs[i].ds_addr >> 32); } prd[i - 1].count |= htole32(ATA_DMA_EOT); } @@ -2716,12 +2720,16 @@ static void ata_marvell_dmainit(device_t dev) { + struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); ata_dmainit(dev); if (ch->dma) { /* note start and stop are not used here */ ch->dma->setprd = ata_marvell_dmasetprd; + + if (ATA_INL(ctlr->r_res1, 0x00d00) & 0x00000004) + ch->dma->max_address = BUS_SPACE_MAXADDR; } } Index: ata-dma.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata-dma.c,v retrieving revision 1.137.2.2 diff -u -r1.137.2.2 ata-dma.c --- ata-dma.c 25 Jan 2006 08:13:44 -0000 1.137.2.2 +++ ata-dma.c 25 Apr 2007 18:27:06 -0000 @@ -78,6 +78,7 @@ ch->dma->boundary = 128 * DEV_BSIZE; ch->dma->segsize = 128 * DEV_BSIZE; ch->dma->max_iosize = 128 * DEV_BSIZE; + ch->dma->max_address = BUS_SPACE_MAXADDR_32BIT; } } @@ -97,20 +98,20 @@ struct ata_dc_cb_args ccba; if (bus_dma_tag_create(NULL, ch->dma->alignment, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, + ch->dma->max_address, BUS_SPACE_MAXADDR, NULL, NULL, ch->dma->max_iosize, ATA_DMA_ENTRIES, ch->dma->segsize, 0, NULL, NULL, &ch->dma->dmatag)) goto error; if (bus_dma_tag_create(ch->dma->dmatag, PAGE_SIZE, PAGE_SIZE, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, + ch->dma->max_address, BUS_SPACE_MAXADDR, NULL, NULL, MAXTABSZ, 1, MAXTABSZ, 0, NULL, NULL, &ch->dma->sg_tag)) goto error; if (bus_dma_tag_create(ch->dma->dmatag,ch->dma->alignment,ch->dma->boundary, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, + ch->dma->max_address, BUS_SPACE_MAXADDR, NULL, NULL, ch->dma->max_iosize, ATA_DMA_ENTRIES, ch->dma->segsize, 0, NULL, NULL, &ch->dma->data_tag)) @@ -131,7 +132,7 @@ goto error; if (bus_dma_tag_create(ch->dma->dmatag, PAGE_SIZE, 64 * 1024, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, + ch->dma->max_address, BUS_SPACE_MAXADDR, NULL, NULL, MAXWSPCSZ, 1, MAXWSPCSZ, 0, NULL, NULL, &ch->dma->work_tag)) goto error; @@ -271,7 +272,7 @@ BUS_DMASYNC_POSTWRITE); bus_dmamap_sync(ch->dma->data_tag, ch->dma->data_map, - (ch->dma->flags & ATA_DMA_READ) != 0 ? + (ch->dma->flags & ATA_DMA_READ) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(ch->dma->data_tag, ch->dma->data_map); Index: ata-lowlevel.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata-lowlevel.c,v retrieving revision 1.69.2.4 diff -u -r1.69.2.4 ata-lowlevel.c --- ata-lowlevel.c 2 Sep 2006 17:01:32 -0000 1.69.2.4 +++ ata-lowlevel.c 25 Apr 2007 18:27:54 -0000 @@ -102,6 +102,7 @@ /* device reset doesn't interrupt */ if (request->u.ata.command == ATA_DEVICE_RESET) { + int timeout = 1000000; do { DELAY(10); Index: ata_if.m =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata_if.m,v retrieving revision 1.5.2.1 diff -u -r1.5.2.1 ata_if.m --- ata_if.m 25 Jan 2006 08:13:45 -0000 1.5.2.1 +++ ata_if.m 25 Apr 2007 18:27:49 -0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2004 - 2006 Søren Schmidt +# Copyright (c) 2004 - 2007 Søren Schmidt # All rights reserved. # # Redistribution and use in source and binary forms, with or without