This source file includes following definitions.
- com_puc_match
- com_puc_attach
- com_puc_detach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/ioctl.h>
34 #include <sys/selinfo.h>
35 #include <sys/tty.h>
36 #include <sys/proc.h>
37 #include <sys/user.h>
38 #include <sys/conf.h>
39 #include <sys/file.h>
40 #include <sys/uio.h>
41 #include <sys/kernel.h>
42 #include <sys/syslog.h>
43 #include <sys/device.h>
44
45 #include <machine/intr.h>
46 #include <machine/bus.h>
47
48 #include <dev/pci/pucvar.h>
49
50 #include "com.h"
51 #ifdef i386
52 #include "pccom.h"
53 #endif
54
55 #include <dev/ic/comreg.h>
56 #if NPCCOM > 0
57 #include <i386/isa/pccomvar.h>
58 #endif
59 #if NCOM > 0
60 #include <dev/ic/comvar.h>
61 #endif
62 #include <dev/ic/ns16550reg.h>
63
64 #define com_lcr com_cfcr
65
66 int com_puc_match(struct device *, void *, void *);
67 void com_puc_attach(struct device *, struct device *, void *);
68 int com_puc_detach(struct device *, int );
69
70 #if NCOM > 0
71 struct cfattach com_puc_ca = {
72 sizeof(struct com_softc), com_puc_match, com_puc_attach, com_puc_detach
73 };
74 #endif
75
76 #if NPCCOM > 0
77 struct cfattach pccom_puc_ca = {
78 sizeof(struct com_softc), com_puc_match, com_puc_attach, com_puc_detach
79 };
80 #endif
81
82 int
83 com_puc_match(parent, match, aux)
84 struct device *parent;
85 void *match, *aux;
86 {
87 struct puc_attach_args *pa = aux;
88
89 if (pa->type == PUC_PORT_TYPE_COM)
90 return(1);
91
92 return(0);
93 }
94
95 void
96 com_puc_attach(parent, self, aux)
97 struct device *parent, *self;
98 void *aux;
99 {
100 struct com_softc *sc = (void *)self;
101 struct puc_attach_args *pa = aux;
102 const char *intrstr;
103
104
105 intrstr = pa->intr_string(pa);
106 sc->sc_ih = pa->intr_establish(pa, IPL_TTY, comintr, sc,
107 sc->sc_dev.dv_xname);
108 if (sc->sc_ih == NULL) {
109 printf(": couldn't establish interrupt");
110 if (intrstr != NULL)
111 printf(" at %s", intrstr);
112 printf("\n");
113 return;
114 }
115 printf(" %s", intrstr);
116
117 sc->sc_iot = pa->t;
118 sc->sc_ioh = pa->h;
119 sc->sc_iobase = pa->a;
120 sc->sc_frequency = COM_FREQ;
121
122 if (pa->flags)
123 sc->sc_frequency = pa->flags & PUC_COM_CLOCKMASK;
124 if (pa->hwtype)
125 sc->sc_uarttype = pa->hwtype;
126
127 sc->sc_hwflags = 0;
128 sc->sc_swflags = 0;
129
130 com_attach_subr(sc);
131 }
132
133 int
134 com_puc_detach(struct device *self, int flags)
135 {
136
137 int error;
138
139 if ((error = com_detach(self, flags)) != 0)
140 return (error);
141
142
143
144 return (0);
145 }