Deleted Added
full compact
ata-cbus.c (145000) ata-cbus.c (145499)
1/*-
2 * Copyright (c) 2002 - 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) 2002 - 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-cbus.c 145000 2005-04-13 07:14:17Z sos $");
30__FBSDID("$FreeBSD: head/sys/dev/ata/ata-cbus.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/ata.h>
37#include <sys/bus.h>
38#include <sys/malloc.h>

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

77 u_long tmp;
78
79 /* dont probe PnP devices */
80 if (isa_get_vendorid(dev))
81 return (ENXIO);
82
83 /* allocate the ioport range */
84 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/ata.h>
37#include <sys/bus.h>
38#include <sys/malloc.h>

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

77 u_long tmp;
78
79 /* dont probe PnP devices */
80 if (isa_get_vendorid(dev))
81 return (ENXIO);
82
83 /* allocate the ioport range */
84 rid = ATA_IOADDR_RID;
85 io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
86 ATA_PC98_IOSIZE, RF_ACTIVE);
87 if (!io)
85 if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
86 ATA_PC98_IOSIZE, RF_ACTIVE)))
88 return ENOMEM;
89
90 /* calculate & set the altport range */
91 rid = ATA_PC98_CTLADDR_RID;
92 if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) {
93 bus_set_resource(dev, SYS_RES_IOPORT, rid,
94 rman_get_start(io)+ATA_PC98_CTLOFFSET, ATA_CTLIOSIZE);
95 }

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

108static int
109ata_cbus_attach(device_t dev)
110{
111 struct ata_cbus_controller *ctlr = device_get_softc(dev);
112 int rid;
113
114 /* allocate resources */
115 rid = ATA_IOADDR_RID;
87 return ENOMEM;
88
89 /* calculate & set the altport range */
90 rid = ATA_PC98_CTLADDR_RID;
91 if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) {
92 bus_set_resource(dev, SYS_RES_IOPORT, rid,
93 rman_get_start(io)+ATA_PC98_CTLOFFSET, ATA_CTLIOSIZE);
94 }

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

107static int
108ata_cbus_attach(device_t dev)
109{
110 struct ata_cbus_controller *ctlr = device_get_softc(dev);
111 int rid;
112
113 /* allocate resources */
114 rid = ATA_IOADDR_RID;
116 ctlr->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
117 ATA_PC98_IOSIZE, RF_ACTIVE);
118 if (!ctlr->io)
115 if (!(ctlr->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
116 ATA_PC98_IOSIZE, RF_ACTIVE)))
119 return ENOMEM;
120
121 rid = ATA_PC98_CTLADDR_RID;
117 return ENOMEM;
118
119 rid = ATA_PC98_CTLADDR_RID;
122 ctlr->ctlio =
123 bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
124 rman_get_start(ctlr->io) + ATA_PC98_CTLOFFSET, ~0,
125 ATA_CTLIOSIZE, RF_ACTIVE);
126 if (!ctlr->ctlio) {
120 if (!(ctlr->ctlio =
121 bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
122 rman_get_start(ctlr->io) + ATA_PC98_CTLOFFSET, ~0,
123 ATA_CTLIOSIZE, RF_ACTIVE))) {
127 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
128 return ENOMEM;
129 }
130
131 rid = ATA_PC98_BANKADDR_RID;
124 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
125 return ENOMEM;
126 }
127
128 rid = ATA_PC98_BANKADDR_RID;
132 ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
133 ATA_PC98_BANK, ~0,
134 ATA_PC98_BANKIOSIZE, RF_ACTIVE);
135 if (!ctlr->bankio) {
129 if (!(ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
130 ATA_PC98_BANK, ~0,
131 ATA_PC98_BANKIOSIZE, RF_ACTIVE))) {
136 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
137 bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio);
138 return ENOMEM;
139 }
140
141 rid = ATA_IRQ_RID;
142 if (!(ctlr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
143 RF_ACTIVE | RF_SHAREABLE))) {

--- 222 unchanged lines hidden ---
132 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
133 bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio);
134 return ENOMEM;
135 }
136
137 rid = ATA_IRQ_RID;
138 if (!(ctlr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
139 RF_ACTIVE | RF_SHAREABLE))) {

--- 222 unchanged lines hidden ---