1/*- 2 * Copyright (c) 1998,1999,2000 S�ren Schmidt 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 --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 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 * $FreeBSD: head/sys/dev/ata/ata-all.c 67067 2000-10-13 12:09:23Z sos $ |
29 */ 30 31#include "ata.h" 32#include "isa.h" 33#include "card.h" 34#include "pci.h" 35#include "atadisk.h" 36#include "atapicd.h" --- 29 unchanged lines hidden (view full) --- 66#include <dev/ata/ata-disk.h> 67#include <dev/ata/atapi-all.h> 68 69/* misc defines */ 70#define IOMASK 0xfffffffc 71#define ATA_IOADDR_RID 0 72#define ATA_ALTADDR_RID 1 73#define ATA_BMADDR_RID 2 |
74#if NPCI > 0 |
75#define ATA_MASTERDEV(dev) ((pci_get_progif(dev) & 0x80) && \ 76 (pci_get_progif(dev) & 0x05) != 0x05) |
77#else 78#define ATA_MASTERDEV(dev) (1) 79#endif |
80 81/* prototypes */ 82static int ata_probe(device_t); 83static int ata_attach(device_t); 84static int ata_detach(device_t); 85static int ata_resume(device_t); 86static void ata_boot_attach(void); 87static void ata_intr(void *); --- 703 unchanged lines hidden (view full) --- 791 if (!io) 792 goto failure; 793 ioaddr = rman_get_start(io); 794 795 rid = ATA_ALTADDR_RID; 796 altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 797 ATA_ALTIOSIZE, RF_ACTIVE); 798 if (altio) { |
799 if (scp->flags & ATA_USE_16BIT || ATA_MASTERDEV(device_get_parent(dev))) |
800 altioaddr = rman_get_start(altio); 801 else 802 altioaddr = rman_get_start(altio) + 0x02; 803 } 804 else 805 altioaddr = ioaddr + ATA_IOSIZE; 806 807 rid = ATA_BMADDR_RID; --- 985 unchanged lines hidden --- |