Deleted Added
full compact
ata-pci.c (144914) ata-pci.c (145499)
1/*-
2 * Copyright (c) 1998 - 2005 S�ren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 - 2005 S�ren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/ata/ata-pci.c 144914 2005-04-11 20:28:15Z sos $");
30__FBSDID("$FreeBSD: head/sys/dev/ata/ata-pci.c 145499 2005-04-25 07:57:04Z sos $");
31
32#include "opt_ata.h"
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/ata.h>
38#include <sys/bus.h>

--- 344 unchanged lines hidden (view full) ---

383ata_pci_allocate(device_t dev)
384{
385 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
386 struct ata_channel *ch = device_get_softc(dev);
387 struct resource *io = NULL, *ctlio = NULL;
388 int i, rid;
389
390 rid = ATA_IOADDR_RID;
31
32#include "opt_ata.h"
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/ata.h>
38#include <sys/bus.h>

--- 344 unchanged lines hidden (view full) ---

383ata_pci_allocate(device_t dev)
384{
385 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
386 struct ata_channel *ch = device_get_softc(dev);
387 struct resource *io = NULL, *ctlio = NULL;
388 int i, rid;
389
390 rid = ATA_IOADDR_RID;
391 io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
392 if (!io)
391 if (!(io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE)))
393 return ENXIO;
394
395 rid = ATA_CTLADDR_RID;
392 return ENXIO;
393
394 rid = ATA_CTLADDR_RID;
396 ctlio = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
397 if (!ctlio) {
395 if (!(ctlio = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,RF_ACTIVE))){
398 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
399 return ENXIO;
400 }
401
402 for (i = ATA_DATA; i <= ATA_COMMAND; i ++) {
403 ch->r_io[i].res = io;
404 ch->r_io[i].offset = i;
405 }

--- 4 unchanged lines hidden (view full) ---

410 if (ctlr->r_res1) {
411 for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) {
412 ch->r_io[i].res = ctlr->r_res1;
413 ch->r_io[i].offset = (i - ATA_BMCMD_PORT) + (ch->unit*ATA_BMIOSIZE);
414 }
415 }
416
417 ata_generic_hw(ch);
396 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
397 return ENXIO;
398 }
399
400 for (i = ATA_DATA; i <= ATA_COMMAND; i ++) {
401 ch->r_io[i].res = io;
402 ch->r_io[i].offset = i;
403 }

--- 4 unchanged lines hidden (view full) ---

408 if (ctlr->r_res1) {
409 for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) {
410 ch->r_io[i].res = ctlr->r_res1;
411 ch->r_io[i].offset = (i - ATA_BMCMD_PORT) + (ch->unit*ATA_BMIOSIZE);
412 }
413 }
414
415 ata_generic_hw(ch);
418
419 return 0;
420}
421
422static int
423ata_pci_dmastart(struct ata_channel *ch)
424{
425 ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, (ATA_IDX_INB(ch, ATA_BMSTAT_PORT) |
426 (ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR)));

--- 191 unchanged lines hidden ---
416 return 0;
417}
418
419static int
420ata_pci_dmastart(struct ata_channel *ch)
421{
422 ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, (ATA_IDX_INB(ch, ATA_BMSTAT_PORT) |
423 (ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR)));

--- 191 unchanged lines hidden ---