Deleted Added
full compact
dpt_pci.c (241593) dpt_pci.c (254263)
1/*-
2 * Copyright (c) 2000 Matthew N. Dodd <winter@jurai.net>
3 * All rights reserved.
4 *
5 * Copyright (c) 1997 Simon Shapiro
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) 2000 Matthew N. Dodd <winter@jurai.net>
3 * All rights reserved.
4 *
5 * Copyright (c) 1997 Simon Shapiro
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/dpt/dpt_pci.c 241593 2012-10-15 16:29:08Z jhb $");
31__FBSDID("$FreeBSD: head/sys/dev/dpt/dpt_pci.c 254263 2013-08-12 23:30:01Z scottl $");
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/lock.h>
38#include <sys/mutex.h>
39#include <sys/bus.h>

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

72}
73
74static int
75dpt_pci_attach (device_t dev)
76{
77 dpt_softc_t * dpt;
78 int error = 0;
79
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/lock.h>
38#include <sys/mutex.h>
39#include <sys/bus.h>

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

72}
73
74static int
75dpt_pci_attach (device_t dev)
76{
77 dpt_softc_t * dpt;
78 int error = 0;
79
80 u_int32_t command;
81
82 dpt = device_get_softc(dev);
83 dpt->dev = dev;
84 dpt_alloc(dev);
85
80 dpt = device_get_softc(dev);
81 dpt->dev = dev;
82 dpt_alloc(dev);
83
86 command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
87
88#ifdef DPT_ALLOW_MMIO
84#ifdef DPT_ALLOW_MMIO
89 if ((command & PCIM_CMD_MEMEN) != 0) {
90 dpt->io_rid = DPT_PCI_MEMADDR;
91 dpt->io_type = SYS_RES_MEMORY;
92 dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
93 &dpt->io_rid, RF_ACTIVE);
94 }
85 dpt->io_rid = DPT_PCI_MEMADDR;
86 dpt->io_type = SYS_RES_MEMORY;
87 dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
88 &dpt->io_rid, RF_ACTIVE);
95#endif
89#endif
96 if (dpt->io_res == NULL && (command & PCIM_CMD_PORTEN) != 0) {
90 if (dpt->io_res == NULL) {
97 dpt->io_rid = DPT_PCI_IOADDR;
98 dpt->io_type = SYS_RES_IOPORT;
99 dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
100 &dpt->io_rid, RF_ACTIVE);
101 }
102
103 if (dpt->io_res == NULL) {
104 device_printf(dev, "can't allocate register resources\n");

--- 88 unchanged lines hidden ---
91 dpt->io_rid = DPT_PCI_IOADDR;
92 dpt->io_type = SYS_RES_IOPORT;
93 dpt->io_res = bus_alloc_resource_any(dev, dpt->io_type,
94 &dpt->io_rid, RF_ACTIVE);
95 }
96
97 if (dpt->io_res == NULL) {
98 device_printf(dev, "can't allocate register resources\n");

--- 88 unchanged lines hidden ---