Deleted Added
full compact
dpt_eisa.c (46743) dpt_eisa.c (49360)
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/*
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.5 1999/04/18 15:50:33 peter Exp $
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;
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;
81
82 desc = dpt_eisa_match(eisa_get_id(dev));
83 if (!desc)
84 return (ENXIO);
85 device_set_desc(dev, desc);
86
87 io_base = (eisa_get_slot(dev) * EISA_SLOT_SIZE)
88 + DPT_EISA_SLOT_OFFSET;
89
90 eisa_add_iospace(dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE);
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);
91
94
92 intdef = inb(DPT_EISA_INTDEF + io_base);
95 intdef = inb(DPT_EISA_INTDEF + io_base);
93
94 irq = intdef & DPT_EISA_INT_NUM_MASK;
96
97 irq = intdef & DPT_EISA_INT_NUM_MASK;
98 shared = (intdef & DPT_EISA_INT_LEVEL)
99 ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
95 switch (irq) {
96 case DPT_EISA_INT_NUM_11:
97 irq = 11;
98 break;
99 case DPT_EISA_INT_NUM_15:
100 irq = 15;
101 break;
102 case DPT_EISA_INT_NUM_14:
103 irq = 14;
104 break;
105 default:
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:
106 printf("dpt at slot %d: illegal irq setting %d\n",
111 device_printf(dev, "dpt at slot %d: illegal irq setting %d\n",
107 eisa_get_slot(dev), irq);
108 irq = 0;
109 break;
110 }
111 if (irq == 0)
112 eisa_get_slot(dev), irq);
113 irq = 0;
114 break;
115 }
116 if (irq == 0)
112 return ENXIO;
117 return (ENXIO);
113
118
114 eisa_add_intr(dev, irq);
119 eisa_add_intr(dev, irq, shared);
115
116 return 0;
117}
118
119static int
120dpt_eisa_attach(device_t dev)
121{
122 dpt_softc_t *dpt;
123 struct resource *io = 0;
124 struct resource *irq = 0;
125 int unit = device_get_unit(dev);
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);
126 int shared;
127 int s;
128 int rid;
129 void *ih;
130
131 rid = 0;
132 io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
133 0, ~0, 1, RF_ACTIVE);
134 if (!io) {
135 device_printf(dev, "No I/O space?!\n");
136 return ENOMEM;
137 }
138
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
139 shared = (inb(DPT_EISA_INTDEF + rman_get_start(io))
140 & DPT_EISA_INT_LEVEL) ? RF_SHAREABLE : 0;
141
142 dpt = dpt_alloc(unit, rman_get_bustag(io),
143 rman_get_bushandle(io) + DPT_EISA_EATA_REG_OFFSET);
144 if (dpt == NULL)
145 goto bad;
146
147 /* Allocate a dmatag representing the capabilities of this attachment */
148 /* XXX Should be a child of the EISA bus dma tag */
149 if (bus_dma_tag_create(/*parent*/NULL, /*alignemnt*/0, /*boundary*/0,

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

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

--- 89 unchanged lines hidden ---
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 ---