1/*- 2 * Copyright (c) 2002, 2003 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-cbus.c 119450 2003-08-25 09:01:49Z 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/ata.h> 37#include <sys/bus.h> 38#include <sys/malloc.h> --- 29 unchanged lines hidden (view full) --- 68ata_cbus_probe(device_t dev) 69{ 70 struct resource *io; 71 int rid; 72 u_long tmp; 73 74 /* dont probe PnP devices */ 75 if (isa_get_vendorid(dev)) |
76 return (ENXIO); |
77 78 /* allocate the ioport range */ 79 rid = ATA_IOADDR_RID; 80 io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 81 ATA_PC98_IOSIZE, RF_ACTIVE); 82 if (!io) |
83 return ENOMEM; |
84 85 /* calculate & set the altport range */ 86 rid = ATA_PC98_ALTADDR_RID; 87 if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) { 88 bus_set_resource(dev, SYS_RES_IOPORT, rid, 89 rman_get_start(io)+ATA_PC98_ALTOFFSET, ATA_ALTIOSIZE); 90 } 91 --- 28 unchanged lines hidden (view full) --- 120 ATA_ALTIOSIZE, RF_ACTIVE); 121 if (!ctlr->altio) { 122 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); 123 return ENOMEM; 124 } 125 126 rid = ATA_PC98_BANKADDR_RID; 127 ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, |
128 ATA_PC98_BANK, ~0, 129 ATA_PC98_BANKIOSIZE, RF_ACTIVE); |
130 if (!ctlr->bankio) { 131 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); 132 bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, ctlr->altio); 133 return ENOMEM; 134 } 135 136 rid = ATA_IRQ_RID; 137 if (!(ctlr->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, --- 38 unchanged lines hidden (view full) --- 176 if (type == SYS_RES_IOPORT) { 177 switch (*rid) { 178 case ATA_IOADDR_RID: 179 return ctlr->io; 180 case ATA_ALTADDR_RID: 181 return ctlr->altio; 182 } 183 } |
184 if (type == SYS_RES_IRQ) |
185 return ctlr->irq; |
186 return 0; 187} 188 189static int 190ata_cbus_setup_intr(device_t dev, device_t child, struct resource *irq, 191 int flags, driver_intr_t *intr, void *arg, 192 void **cookiep) 193{ --- 133 unchanged lines hidden --- |