tw_osl_freebsd.c (248583) | tw_osl_freebsd.c (254263) |
---|---|
1/* 2 * Copyright (c) 2004-07 Applied Micro Circuits Corporation. 3 * Copyright (c) 2004-05 Vinod Kashyap. 4 * Copyright (c) 2000 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2004-07 Applied Micro Circuits Corporation. 3 * Copyright (c) 2004-05 Vinod Kashyap. 4 * Copyright (c) 2000 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/twa/tw_osl_freebsd.c 248583 2013-03-21 13:06:28Z kib $"); | 31__FBSDID("$FreeBSD: head/sys/dev/twa/tw_osl_freebsd.c 254263 2013-08-12 23:30:01Z scottl $"); |
32 33/* 34 * AMCC'S 3ware driver for 9000 series storage controllers. 35 * 36 * Author: Vinod Kashyap 37 * Modifications by: Adam Radford 38 * Modifications by: Manjunath Ranganathaiah 39 */ --- 239 unchanged lines hidden (view full) --- 279 * Output: None 280 * Return value: 0 -- success 281 * non-zero-- failure 282 */ 283static TW_INT32 284twa_attach(device_t dev) 285{ 286 struct twa_softc *sc = device_get_softc(dev); | 32 33/* 34 * AMCC'S 3ware driver for 9000 series storage controllers. 35 * 36 * Author: Vinod Kashyap 37 * Modifications by: Adam Radford 38 * Modifications by: Manjunath Ranganathaiah 39 */ --- 239 unchanged lines hidden (view full) --- 279 * Output: None 280 * Return value: 0 -- success 281 * non-zero-- failure 282 */ 283static TW_INT32 284twa_attach(device_t dev) 285{ 286 struct twa_softc *sc = device_get_softc(dev); |
287 TW_UINT32 command; | |
288 TW_INT32 bar_num; 289 TW_INT32 bar0_offset; 290 TW_INT32 bar_size; 291 TW_INT32 error; 292 293 tw_osli_dbg_dprintf(3, sc, "entered"); 294 295 sc->ctlr_handle.osl_ctlr_ctxt = sc; --- 22 unchanged lines hidden (view full) --- 318 "Cannot add sysctl tree node", 319 ENXIO); 320 return(ENXIO); 321 } 322 SYSCTL_ADD_STRING(&sc->sysctl_ctxt, SYSCTL_CHILDREN(sc->sysctl_tree), 323 OID_AUTO, "driver_version", CTLFLAG_RD, 324 TW_OSL_DRIVER_VERSION_STRING, 0, "TWA driver version"); 325 | 287 TW_INT32 bar_num; 288 TW_INT32 bar0_offset; 289 TW_INT32 bar_size; 290 TW_INT32 error; 291 292 tw_osli_dbg_dprintf(3, sc, "entered"); 293 294 sc->ctlr_handle.osl_ctlr_ctxt = sc; --- 22 unchanged lines hidden (view full) --- 317 "Cannot add sysctl tree node", 318 ENXIO); 319 return(ENXIO); 320 } 321 SYSCTL_ADD_STRING(&sc->sysctl_ctxt, SYSCTL_CHILDREN(sc->sysctl_tree), 322 OID_AUTO, "driver_version", CTLFLAG_RD, 323 TW_OSL_DRIVER_VERSION_STRING, 0, "TWA driver version"); 324 |
326 /* Make sure we are going to be able to talk to this board. */ 327 command = pci_read_config(dev, PCIR_COMMAND, 2); 328 if ((command & PCIM_CMD_PORTEN) == 0) { 329 tw_osli_printf(sc, "error = %d", 330 TW_CL_SEVERITY_ERROR_STRING, 331 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, 332 0x2001, 333 "Register window not available", 334 ENXIO); 335 tw_osli_free_resources(sc); 336 return(ENXIO); 337 } 338 | |
339 /* Force the busmaster enable bit on, in case the BIOS forgot. */ | 325 /* Force the busmaster enable bit on, in case the BIOS forgot. */ |
340 command |= PCIM_CMD_BUSMASTEREN; 341 pci_write_config(dev, PCIR_COMMAND, command, 2); | 326 pci_enable_busmaster(dev); |
342 343 /* Allocate the PCI register window. */ 344 if ((error = tw_cl_get_pci_bar_info(sc->device_id, TW_CL_BAR_TYPE_MEM, 345 &bar_num, &bar0_offset, &bar_size))) { 346 tw_osli_printf(sc, "error = %d", 347 TW_CL_SEVERITY_ERROR_STRING, 348 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, 349 0x201F, --- 1378 unchanged lines hidden --- | 327 328 /* Allocate the PCI register window. */ 329 if ((error = tw_cl_get_pci_bar_info(sc->device_id, TW_CL_BAR_TYPE_MEM, 330 &bar_num, &bar0_offset, &bar_size))) { 331 tw_osli_printf(sc, "error = %d", 332 TW_CL_SEVERITY_ERROR_STRING, 333 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, 334 0x201F, --- 1378 unchanged lines hidden --- |