mlx_pci.c (60074) | mlx_pci.c (64223) |
---|---|
1/*- 2 * Copyright (c) 1999 Michael Smith 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999 Michael Smith 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/mlx/mlx_pci.c 60074 2000-05-06 08:54:33Z msmith $ | 26 * $FreeBSD: head/sys/dev/mlx/mlx_pci.c 64223 2000-08-04 06:52:00Z msmith $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32 33#include <sys/bus.h> 34#include <sys/bio.h> --- 117 unchanged lines hidden (view full) --- 152 } 153 if (sc->mlx_iftype == 0) /* shouldn't happen */ 154 return(ENXIO); 155 156 /* 157 * Allocate the PCI register window. 158 */ 159 | 27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32 33#include <sys/bus.h> 34#include <sys/bio.h> --- 117 unchanged lines hidden (view full) --- 152 } 153 if (sc->mlx_iftype == 0) /* shouldn't happen */ 154 return(ENXIO); 155 156 /* 157 * Allocate the PCI register window. 158 */ 159 |
160 /* type 2/3 adapters have an I/O region we don't use at base 0 */ | 160 /* type 2/3 adapters have an I/O region we don't prefer at base 0 */ |
161 switch(sc->mlx_iftype) { 162 case MLX_IFTYPE_2: 163 case MLX_IFTYPE_3: 164 rid = MLX_CFG_BASE1; | 161 switch(sc->mlx_iftype) { 162 case MLX_IFTYPE_2: 163 case MLX_IFTYPE_3: 164 rid = MLX_CFG_BASE1; |
165 sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); 166 if (sc->mlx_mem == NULL) { 167 rid = MLX_CFG_BASE0; 168 sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE); 169 } |
|
165 break; 166 case MLX_IFTYPE_4: 167 case MLX_IFTYPE_5: 168 rid = MLX_CFG_BASE0; | 170 break; 171 case MLX_IFTYPE_4: 172 case MLX_IFTYPE_5: 173 rid = MLX_CFG_BASE0; |
174 sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); |
|
169 break; 170 } | 175 break; 176 } |
171 sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); | |
172 if (sc->mlx_mem == NULL) { 173 device_printf(sc->mlx_dev, "couldn't allocate mailbox window\n"); 174 mlx_free(sc); 175 return(ENXIO); 176 } 177 sc->mlx_btag = rman_get_bustag(sc->mlx_mem); 178 sc->mlx_bhandle = rman_get_bushandle(sc->mlx_mem); 179 --- 33 unchanged lines hidden --- | 177 if (sc->mlx_mem == NULL) { 178 device_printf(sc->mlx_dev, "couldn't allocate mailbox window\n"); 179 mlx_free(sc); 180 return(ENXIO); 181 } 182 sc->mlx_btag = rman_get_bustag(sc->mlx_mem); 183 sc->mlx_bhandle = rman_get_bushandle(sc->mlx_mem); 184 --- 33 unchanged lines hidden --- |