mlx_pci.c (67782) | mlx_pci.c (69292) |
---|---|
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 67782 2000-10-28 10:46:30Z msmith $ | 26 * $FreeBSD: head/sys/dev/mlx/mlx_pci.c 69292 2000-11-28 06:17:32Z mdodd $ |
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> --- 74 unchanged lines hidden (view full) --- 109 } 110 return(ENXIO); 111} 112 113static int 114mlx_pci_attach(device_t dev) 115{ 116 struct mlx_softc *sc; | 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> --- 74 unchanged lines hidden (view full) --- 109 } 110 return(ENXIO); 111} 112 113static int 114mlx_pci_attach(device_t dev) 115{ 116 struct mlx_softc *sc; |
117 int i, rid, error; | 117 int i, error; |
118 u_int32_t command; 119 120 debug_called(1); 121 122 /* 123 * Make sure we are going to be able to talk to this board. 124 */ 125 command = pci_read_config(dev, PCIR_COMMAND, 2); --- 30 unchanged lines hidden (view full) --- 156 /* 157 * Allocate the PCI register window. 158 */ 159 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: | 118 u_int32_t command; 119 120 debug_called(1); 121 122 /* 123 * Make sure we are going to be able to talk to this board. 124 */ 125 command = pci_read_config(dev, PCIR_COMMAND, 2); --- 30 unchanged lines hidden (view full) --- 156 /* 157 * Allocate the PCI register window. 158 */ 159 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; 165 sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); | 164 sc->mlx_mem_type = SYS_RES_MEMORY; 165 sc->mlx_mem_rid = MLX_CFG_BASE1; 166 sc->mlx_mem = bus_alloc_resource(dev, sc->mlx_mem_type, &sc->mlx_mem_rid, 0, ~0, 1, RF_ACTIVE); |
166 if (sc->mlx_mem == NULL) { | 167 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); | 168 sc->mlx_mem_type = SYS_RES_IOPORT; 169 sc->mlx_mem_rid = MLX_CFG_BASE0; 170 sc->mlx_mem = bus_alloc_resource(dev, sc->mlx_mem_type, &sc->mlx_mem_rid, 0, ~0, 1, RF_ACTIVE); |
169 } 170 break; 171 case MLX_IFTYPE_4: 172 case MLX_IFTYPE_5: | 171 } 172 break; 173 case MLX_IFTYPE_4: 174 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); | 175 sc->mlx_mem_type = SYS_RES_MEMORY; 176 sc->mlx_mem_rid = MLX_CFG_BASE0; 177 sc->mlx_mem = bus_alloc_resource(dev, sc->mlx_mem_type, &sc->mlx_mem_rid, 0, ~0, 1, RF_ACTIVE); |
175 break; 176 } 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); --- 35 unchanged lines hidden --- | 178 break; 179 } 180 if (sc->mlx_mem == NULL) { 181 device_printf(sc->mlx_dev, "couldn't allocate mailbox window\n"); 182 mlx_free(sc); 183 return(ENXIO); 184 } 185 sc->mlx_btag = rman_get_bustag(sc->mlx_mem); --- 35 unchanged lines hidden --- |