Deleted Added
sdiff udiff text old ( 46743 ) new ( 49360 )
full compact
1/*
2 * Copyright (c) 1997 by Matthew N. Dodd <winter@jurai.net>
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

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

28 */
29
30/*
31 * Credits: Based on and part of the DPT driver for FreeBSD written and
32 * maintained by Simon Shapiro <shimon@simon-shapiro.org>
33 */
34
35/*
36 * $Id: dpt_eisa.c,v 1.6 1999/05/08 21:59:19 dfr Exp $
37 */
38
39#include "eisa.h"
40#if NEISA > 0
41#include "opt_dpt.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>

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

73
74static int
75dpt_eisa_probe(device_t dev)
76{
77 const char *desc;
78 u_int32_t io_base;
79 u_int intdef;
80 u_int irq;
81 int shared;
82
83 desc = dpt_eisa_match(eisa_get_id(dev));
84 if (!desc)
85 return (ENXIO);
86 device_set_desc(dev, desc);
87
88 io_base = (eisa_get_slot(dev) * EISA_SLOT_SIZE)
89 + DPT_EISA_SLOT_OFFSET;
90
91 eisa_add_iospace(dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE);
92
93 outb((DPT_EISA_CFENABLE + io_base), 0xf8);
94
95 intdef = inb(DPT_EISA_INTDEF + io_base);
96
97 irq = intdef & DPT_EISA_INT_NUM_MASK;
98 shared = (intdef & DPT_EISA_INT_LEVEL)
99 ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
100 switch (irq) {
101 case DPT_EISA_INT_NUM_11:
102 irq = 11;
103 break;
104 case DPT_EISA_INT_NUM_15:
105 irq = 15;
106 break;
107 case DPT_EISA_INT_NUM_14:
108 irq = 14;
109 break;
110 default:
111 device_printf(dev, "dpt at slot %d: illegal irq setting %d\n",
112 eisa_get_slot(dev), irq);
113 irq = 0;
114 break;
115 }
116 if (irq == 0)
117 return (ENXIO);
118
119 eisa_add_intr(dev, irq, shared);
120
121 return 0;
122}
123
124static int
125dpt_eisa_attach(device_t dev)
126{
127 dpt_softc_t *dpt;
128 struct resource *io = 0;
129 struct resource *irq = 0;
130 int unit = device_get_unit(dev);
131 int s;
132 int rid;
133 void *ih;
134
135 rid = 0;
136 io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
137 0, ~0, 1, RF_ACTIVE);
138 if (!io) {
139 device_printf(dev, "No I/O space?!\n");
140 return ENOMEM;
141 }
142
143 dpt = dpt_alloc(unit, rman_get_bustag(io),
144 rman_get_bushandle(io) + DPT_EISA_EATA_REG_OFFSET);
145 if (dpt == NULL)
146 goto bad;
147
148 /* Allocate a dmatag representing the capabilities of this attachment */
149 /* XXX Should be a child of the EISA bus dma tag */
150 if (bus_dma_tag_create(/*parent*/NULL, /*alignemnt*/0, /*boundary*/0,

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

156 /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
157 /*flags*/0, &dpt->parent_dmat) != 0) {
158 dpt_free(dpt);
159 goto bad;
160 }
161
162 rid = 0;
163 irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
164 0, ~0, 1, RF_ACTIVE);
165 if (!irq) {
166 device_printf(dev, "No irq?!\n");
167 goto bad;
168 }
169
170 s = splcam();
171 if (dpt_init(dpt) != 0) {
172 dpt_free(dpt);

--- 89 unchanged lines hidden ---