safe.c (243857) | safe.c (254263) |
---|---|
1/*- 2 * Copyright (c) 2003 Sam Leffler, Errno Consulting 3 * Copyright (c) 2003 Global Technology Associates, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 Sam Leffler, Errno Consulting 3 * Copyright (c) 2003 Global Technology Associates, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/safe/safe.c 243857 2012-12-04 09:32:43Z glebius $"); | 29__FBSDID("$FreeBSD: head/sys/dev/safe/safe.c 254263 2013-08-12 23:30:01Z scottl $"); |
30 31/* 32 * SafeNet SafeXcel-1141 hardware crypto accelerator 33 */ 34#include "opt_safe.h" 35 36#include <sys/param.h> 37#include <sys/systm.h> --- 177 unchanged lines hidden (view full) --- 215} 216#endif /* SAFE_NO_RNG */ 217 218static int 219safe_attach(device_t dev) 220{ 221 struct safe_softc *sc = device_get_softc(dev); 222 u_int32_t raddr; | 30 31/* 32 * SafeNet SafeXcel-1141 hardware crypto accelerator 33 */ 34#include "opt_safe.h" 35 36#include <sys/param.h> 37#include <sys/systm.h> --- 177 unchanged lines hidden (view full) --- 215} 216#endif /* SAFE_NO_RNG */ 217 218static int 219safe_attach(device_t dev) 220{ 221 struct safe_softc *sc = device_get_softc(dev); 222 u_int32_t raddr; |
223 u_int32_t cmd, i, devinfo; | 223 u_int32_t i, devinfo; |
224 int rid; 225 226 bzero(sc, sizeof (*sc)); 227 sc->sc_dev = dev; 228 229 /* XXX handle power management */ | 224 int rid; 225 226 bzero(sc, sizeof (*sc)); 227 sc->sc_dev = dev; 228 229 /* XXX handle power management */ |
230 231 cmd = pci_read_config(dev, PCIR_COMMAND, 4); 232 cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN; 233 pci_write_config(dev, PCIR_COMMAND, cmd, 4); 234 cmd = pci_read_config(dev, PCIR_COMMAND, 4); | |
235 | 230 |
236 if (!(cmd & PCIM_CMD_MEMEN)) { 237 device_printf(dev, "failed to enable memory mapping\n"); 238 goto bad; 239 } | 231 pci_enable_busmaster(dev); |
240 | 232 |
241 if (!(cmd & PCIM_CMD_BUSMASTEREN)) { 242 device_printf(dev, "failed to enable bus mastering\n"); 243 goto bad; 244 } 245 | |
246 /* 247 * Setup memory-mapping of PCI registers. 248 */ 249 rid = BS_BAR; 250 sc->sc_sr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 251 RF_ACTIVE); 252 if (sc->sc_sr == NULL) { 253 device_printf(dev, "cannot map register space\n"); --- 2003 unchanged lines hidden --- | 233 /* 234 * Setup memory-mapping of PCI registers. 235 */ 236 rid = BS_BAR; 237 sc->sc_sr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 238 RF_ACTIVE); 239 if (sc->sc_sr == NULL) { 240 device_printf(dev, "cannot map register space\n"); --- 2003 unchanged lines hidden --- |