Deleted Added
full compact
rp_pci.c (196858) rp_pci.c (254263)
1/*-
2 * Copyright (c) Comtrol Corporation <support@comtrol.com>
3 * All rights reserved.
4 *
5 * PCI-specific part separated from:
6 * sys/i386/isa/rp.c,v 1.33 1999/09/28 11:45:27 phk Exp
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
1/*-
2 * Copyright (c) Comtrol Corporation <support@comtrol.com>
3 * All rights reserved.
4 *
5 * PCI-specific part separated from:
6 * sys/i386/isa/rp.c,v 1.33 1999/09/28 11:45:27 phk Exp
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/dev/rp/rp_pci.c 196858 2009-09-05 08:38:25Z imp $");
37__FBSDID("$FreeBSD: head/sys/dev/rp/rp_pci.c 254263 2013-08-12 23:30:01Z scottl $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/fcntl.h>
42#include <sys/malloc.h>
43#include <sys/tty.h>
44#include <sys/conf.h>
45#include <sys/kernel.h>

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

146static int
147rp_pciattach(device_t dev)
148{
149 int num_ports, num_aiops;
150 int aiop;
151 CONTROLLER_t *ctlp;
152 int unit;
153 int retval;
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/fcntl.h>
42#include <sys/malloc.h>
43#include <sys/tty.h>
44#include <sys/conf.h>
45#include <sys/kernel.h>

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

146static int
147rp_pciattach(device_t dev)
148{
149 int num_ports, num_aiops;
150 int aiop;
151 CONTROLLER_t *ctlp;
152 int unit;
153 int retval;
154 u_int32_t stcmd;
155
156 ctlp = device_get_softc(dev);
157 bzero(ctlp, sizeof(*ctlp));
158 ctlp->dev = dev;
159 unit = device_get_unit(dev);
160 ctlp->aiop2rid = rp_pci_aiop2rid;
161 ctlp->aiop2off = rp_pci_aiop2off;
162 ctlp->ctlmask = rp_pci_ctlmask;
163
154
155 ctlp = device_get_softc(dev);
156 bzero(ctlp, sizeof(*ctlp));
157 ctlp->dev = dev;
158 unit = device_get_unit(dev);
159 ctlp->aiop2rid = rp_pci_aiop2rid;
160 ctlp->aiop2off = rp_pci_aiop2off;
161 ctlp->ctlmask = rp_pci_ctlmask;
162
164 /* Wake up the device. */
165 stcmd = pci_read_config(dev, PCIR_COMMAND, 4);
166 if ((stcmd & PCIM_CMD_PORTEN) == 0) {
167 stcmd |= (PCIM_CMD_PORTEN);
168 pci_write_config(dev, PCIR_COMMAND, 4, stcmd);
169 }
170
171 /* The IO ports of AIOPs for a PCI controller are continuous. */
172 ctlp->io_num = 1;
173 ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
174 ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
175 if (ctlp->io_rid == NULL || ctlp->io == NULL) {
176 device_printf(dev, "rp_pciattach: Out of memory.\n");
177 retval = ENOMEM;
178 goto nogo;

--- 196 unchanged lines hidden ---
163 /* The IO ports of AIOPs for a PCI controller are continuous. */
164 ctlp->io_num = 1;
165 ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
166 ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
167 if (ctlp->io_rid == NULL || ctlp->io == NULL) {
168 device_printf(dev, "rp_pciattach: Out of memory.\n");
169 retval = ENOMEM;
170 goto nogo;

--- 196 unchanged lines hidden ---