diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /include/linux | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'include/linux')
461 files changed, 52025 insertions, 0 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild new file mode 100644 index 00000000000..619b5657af7 --- /dev/null +++ b/include/linux/Kbuild | |||
@@ -0,0 +1,402 @@ | |||
1 | header-y += byteorder/ | ||
2 | header-y += can/ | ||
3 | header-y += caif/ | ||
4 | header-y += dvb/ | ||
5 | header-y += hdlc/ | ||
6 | header-y += isdn/ | ||
7 | header-y += mmc/ | ||
8 | header-y += nfsd/ | ||
9 | header-y += raid/ | ||
10 | header-y += spi/ | ||
11 | header-y += sunrpc/ | ||
12 | header-y += tc_act/ | ||
13 | header-y += tc_ematch/ | ||
14 | header-y += netfilter/ | ||
15 | header-y += netfilter_arp/ | ||
16 | header-y += netfilter_bridge/ | ||
17 | header-y += netfilter_ipv4/ | ||
18 | header-y += netfilter_ipv6/ | ||
19 | header-y += usb/ | ||
20 | header-y += wimax/ | ||
21 | |||
22 | objhdr-y += version.h | ||
23 | |||
24 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ | ||
25 | $(srctree)/include/asm-$(SRCARCH)/a.out.h \ | ||
26 | $(INSTALL_HDR_PATH)/include/asm-*/a.out.h),) | ||
27 | header-y += a.out.h | ||
28 | endif | ||
29 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ | ||
30 | $(srctree)/include/asm-$(SRCARCH)/kvm.h \ | ||
31 | $(INSTALL_HDR_PATH)/include/asm-*/kvm.h),) | ||
32 | header-y += kvm.h | ||
33 | endif | ||
34 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \ | ||
35 | $(srctree)/include/asm-$(SRCARCH)/kvm_para.h \ | ||
36 | $(INSTALL_HDR_PATH)/include/asm-*/kvm_para.h),) | ||
37 | header-y += kvm_para.h | ||
38 | endif | ||
39 | |||
40 | header-y += acct.h | ||
41 | header-y += adb.h | ||
42 | header-y += adfs_fs.h | ||
43 | header-y += affs_hardblocks.h | ||
44 | header-y += agpgart.h | ||
45 | header-y += aio_abi.h | ||
46 | header-y += apm_bios.h | ||
47 | header-y += arcfb.h | ||
48 | header-y += atalk.h | ||
49 | header-y += atm.h | ||
50 | header-y += atm_eni.h | ||
51 | header-y += atm_he.h | ||
52 | header-y += atm_idt77105.h | ||
53 | header-y += atm_nicstar.h | ||
54 | header-y += atm_tcp.h | ||
55 | header-y += atm_zatm.h | ||
56 | header-y += atmapi.h | ||
57 | header-y += atmarp.h | ||
58 | header-y += atmbr2684.h | ||
59 | header-y += atmclip.h | ||
60 | header-y += atmdev.h | ||
61 | header-y += atmioc.h | ||
62 | header-y += atmlec.h | ||
63 | header-y += atmmpc.h | ||
64 | header-y += atmppp.h | ||
65 | header-y += atmsap.h | ||
66 | header-y += atmsvc.h | ||
67 | header-y += audit.h | ||
68 | header-y += auto_fs.h | ||
69 | header-y += auto_fs4.h | ||
70 | header-y += auxvec.h | ||
71 | header-y += ax25.h | ||
72 | header-y += b1lli.h | ||
73 | header-y += baycom.h | ||
74 | header-y += bfs_fs.h | ||
75 | header-y += binfmts.h | ||
76 | header-y += blk_types.h | ||
77 | header-y += blkpg.h | ||
78 | header-y += blktrace_api.h | ||
79 | header-y += bpqether.h | ||
80 | header-y += bsg.h | ||
81 | header-y += can.h | ||
82 | header-y += capability.h | ||
83 | header-y += capi.h | ||
84 | header-y += cciss_defs.h | ||
85 | header-y += cciss_ioctl.h | ||
86 | header-y += cdk.h | ||
87 | header-y += cdrom.h | ||
88 | header-y += cgroupstats.h | ||
89 | header-y += chio.h | ||
90 | header-y += cm4000_cs.h | ||
91 | header-y += cn_proc.h | ||
92 | header-y += coda.h | ||
93 | header-y += coda_psdev.h | ||
94 | header-y += coff.h | ||
95 | header-y += comstats.h | ||
96 | header-y += connector.h | ||
97 | header-y += const.h | ||
98 | header-y += cramfs_fs.h | ||
99 | header-y += cuda.h | ||
100 | header-y += cyclades.h | ||
101 | header-y += cycx_cfm.h | ||
102 | header-y += dcbnl.h | ||
103 | header-y += dccp.h | ||
104 | header-y += dlm.h | ||
105 | header-y += dlm_device.h | ||
106 | header-y += dlm_netlink.h | ||
107 | header-y += dlm_plock.h | ||
108 | header-y += dlmconstants.h | ||
109 | header-y += dm-ioctl.h | ||
110 | header-y += dm-log-userspace.h | ||
111 | header-y += dn.h | ||
112 | header-y += dqblk_xfs.h | ||
113 | header-y += edd.h | ||
114 | header-y += efs_fs_sb.h | ||
115 | header-y += elf-em.h | ||
116 | header-y += elf-fdpic.h | ||
117 | header-y += elf.h | ||
118 | header-y += elfcore.h | ||
119 | header-y += errno.h | ||
120 | header-y += errqueue.h | ||
121 | header-y += ethtool.h | ||
122 | header-y += eventpoll.h | ||
123 | header-y += ext2_fs.h | ||
124 | header-y += fadvise.h | ||
125 | header-y += falloc.h | ||
126 | header-y += fanotify.h | ||
127 | header-y += fb.h | ||
128 | header-y += fcntl.h | ||
129 | header-y += fd.h | ||
130 | header-y += fdreg.h | ||
131 | header-y += fib_rules.h | ||
132 | header-y += fiemap.h | ||
133 | header-y += filter.h | ||
134 | header-y += firewire-cdev.h | ||
135 | header-y += firewire-constants.h | ||
136 | header-y += flat.h | ||
137 | header-y += fs.h | ||
138 | header-y += fsl_hypervisor.h | ||
139 | header-y += fuse.h | ||
140 | header-y += futex.h | ||
141 | header-y += gameport.h | ||
142 | header-y += gen_stats.h | ||
143 | header-y += generic_serial.h | ||
144 | header-y += genetlink.h | ||
145 | header-y += gfs2_ondisk.h | ||
146 | header-y += gigaset_dev.h | ||
147 | header-y += hdlc.h | ||
148 | header-y += hdlcdrv.h | ||
149 | header-y += hdreg.h | ||
150 | header-y += hid.h | ||
151 | header-y += hiddev.h | ||
152 | header-y += hidraw.h | ||
153 | header-y += hpet.h | ||
154 | header-y += hysdn_if.h | ||
155 | header-y += i2c-dev.h | ||
156 | header-y += i2c.h | ||
157 | header-y += i2o-dev.h | ||
158 | header-y += i8k.h | ||
159 | header-y += icmp.h | ||
160 | header-y += icmpv6.h | ||
161 | header-y += if.h | ||
162 | header-y += if_addr.h | ||
163 | header-y += if_addrlabel.h | ||
164 | header-y += if_alg.h | ||
165 | header-y += if_arcnet.h | ||
166 | header-y += if_arp.h | ||
167 | header-y += if_bonding.h | ||
168 | header-y += if_bridge.h | ||
169 | header-y += if_cablemodem.h | ||
170 | header-y += if_ec.h | ||
171 | header-y += if_eql.h | ||
172 | header-y += if_ether.h | ||
173 | header-y += if_fc.h | ||
174 | header-y += if_fddi.h | ||
175 | header-y += if_frad.h | ||
176 | header-y += if_hippi.h | ||
177 | header-y += if_infiniband.h | ||
178 | header-y += if_link.h | ||
179 | header-y += if_ltalk.h | ||
180 | header-y += if_packet.h | ||
181 | header-y += if_phonet.h | ||
182 | header-y += if_plip.h | ||
183 | header-y += if_ppp.h | ||
184 | header-y += if_pppol2tp.h | ||
185 | header-y += if_pppox.h | ||
186 | header-y += if_slip.h | ||
187 | header-y += if_strip.h | ||
188 | header-y += if_tr.h | ||
189 | header-y += if_tun.h | ||
190 | header-y += if_tunnel.h | ||
191 | header-y += if_vlan.h | ||
192 | header-y += if_x25.h | ||
193 | header-y += igmp.h | ||
194 | header-y += in.h | ||
195 | header-y += in6.h | ||
196 | header-y += in_route.h | ||
197 | header-y += inet_diag.h | ||
198 | header-y += inotify.h | ||
199 | header-y += input.h | ||
200 | header-y += ioctl.h | ||
201 | header-y += ip.h | ||
202 | header-y += ip6_tunnel.h | ||
203 | header-y += ip_vs.h | ||
204 | header-y += ipc.h | ||
205 | header-y += ipmi.h | ||
206 | header-y += ipmi_msgdefs.h | ||
207 | header-y += ipsec.h | ||
208 | header-y += ipv6.h | ||
209 | header-y += ipv6_route.h | ||
210 | header-y += ipx.h | ||
211 | header-y += irda.h | ||
212 | header-y += irqnr.h | ||
213 | header-y += isdn.h | ||
214 | header-y += isdn_divertif.h | ||
215 | header-y += isdn_ppp.h | ||
216 | header-y += isdnif.h | ||
217 | header-y += iso_fs.h | ||
218 | header-y += ivtv.h | ||
219 | header-y += ivtvfb.h | ||
220 | header-y += ixjuser.h | ||
221 | header-y += jffs2.h | ||
222 | header-y += joystick.h | ||
223 | header-y += kd.h | ||
224 | header-y += kdev_t.h | ||
225 | header-y += kernel.h | ||
226 | header-y += kernelcapi.h | ||
227 | header-y += keyboard.h | ||
228 | header-y += keyctl.h | ||
229 | header-y += l2tp.h | ||
230 | header-y += limits.h | ||
231 | header-y += llc.h | ||
232 | header-y += loop.h | ||
233 | header-y += lp.h | ||
234 | header-y += magic.h | ||
235 | header-y += major.h | ||
236 | header-y += map_to_7segment.h | ||
237 | header-y += matroxfb.h | ||
238 | header-y += media.h | ||
239 | header-y += mempolicy.h | ||
240 | header-y += meye.h | ||
241 | header-y += mii.h | ||
242 | header-y += minix_fs.h | ||
243 | header-y += mman.h | ||
244 | header-y += mmtimer.h | ||
245 | header-y += mqueue.h | ||
246 | header-y += mroute.h | ||
247 | header-y += mroute6.h | ||
248 | header-y += msdos_fs.h | ||
249 | header-y += msg.h | ||
250 | header-y += mtio.h | ||
251 | header-y += n_r3964.h | ||
252 | header-y += nbd.h | ||
253 | header-y += ncp.h | ||
254 | header-y += ncp_fs.h | ||
255 | header-y += ncp_mount.h | ||
256 | header-y += ncp_no.h | ||
257 | header-y += neighbour.h | ||
258 | header-y += net.h | ||
259 | header-y += net_dropmon.h | ||
260 | header-y += net_tstamp.h | ||
261 | header-y += netdevice.h | ||
262 | header-y += netfilter.h | ||
263 | header-y += netfilter_arp.h | ||
264 | header-y += netfilter_bridge.h | ||
265 | header-y += netfilter_decnet.h | ||
266 | header-y += netfilter_ipv4.h | ||
267 | header-y += netfilter_ipv6.h | ||
268 | header-y += netlink.h | ||
269 | header-y += netrom.h | ||
270 | header-y += nfs.h | ||
271 | header-y += nfs2.h | ||
272 | header-y += nfs3.h | ||
273 | header-y += nfs4.h | ||
274 | header-y += nfs4_mount.h | ||
275 | header-y += nfs_fs.h | ||
276 | header-y += nfs_idmap.h | ||
277 | header-y += nfs_mount.h | ||
278 | header-y += nfsacl.h | ||
279 | header-y += nl80211.h | ||
280 | header-y += nubus.h | ||
281 | header-y += nvram.h | ||
282 | header-y += omap3isp.h | ||
283 | header-y += omapfb.h | ||
284 | header-y += oom.h | ||
285 | header-y += param.h | ||
286 | header-y += parport.h | ||
287 | header-y += patchkey.h | ||
288 | header-y += pci.h | ||
289 | header-y += pci_regs.h | ||
290 | header-y += perf_event.h | ||
291 | header-y += personality.h | ||
292 | header-y += pfkeyv2.h | ||
293 | header-y += pg.h | ||
294 | header-y += phantom.h | ||
295 | header-y += phonet.h | ||
296 | header-y += pkt_cls.h | ||
297 | header-y += pkt_sched.h | ||
298 | header-y += pktcdvd.h | ||
299 | header-y += pmu.h | ||
300 | header-y += poll.h | ||
301 | header-y += posix_types.h | ||
302 | header-y += ppdev.h | ||
303 | header-y += ppp-comp.h | ||
304 | header-y += ppp_defs.h | ||
305 | header-y += pps.h | ||
306 | header-y += prctl.h | ||
307 | header-y += ptp_clock.h | ||
308 | header-y += ptrace.h | ||
309 | header-y += qnx4_fs.h | ||
310 | header-y += qnxtypes.h | ||
311 | header-y += quota.h | ||
312 | header-y += radeonfb.h | ||
313 | header-y += random.h | ||
314 | header-y += raw.h | ||
315 | header-y += rds.h | ||
316 | header-y += reboot.h | ||
317 | header-y += reiserfs_fs.h | ||
318 | header-y += reiserfs_xattr.h | ||
319 | header-y += resource.h | ||
320 | header-y += rfkill.h | ||
321 | header-y += romfs_fs.h | ||
322 | header-y += rose.h | ||
323 | header-y += route.h | ||
324 | header-y += rtc.h | ||
325 | header-y += rtnetlink.h | ||
326 | header-y += scc.h | ||
327 | header-y += sched.h | ||
328 | header-y += screen_info.h | ||
329 | header-y += sdla.h | ||
330 | header-y += securebits.h | ||
331 | header-y += selinux_netlink.h | ||
332 | header-y += sem.h | ||
333 | header-y += serial.h | ||
334 | header-y += serial_core.h | ||
335 | header-y += serial_reg.h | ||
336 | header-y += serio.h | ||
337 | header-y += shm.h | ||
338 | header-y += signal.h | ||
339 | header-y += signalfd.h | ||
340 | header-y += snmp.h | ||
341 | header-y += socket.h | ||
342 | header-y += sockios.h | ||
343 | header-y += som.h | ||
344 | header-y += sonet.h | ||
345 | header-y += sonypi.h | ||
346 | header-y += sound.h | ||
347 | header-y += soundcard.h | ||
348 | header-y += stat.h | ||
349 | header-y += stddef.h | ||
350 | header-y += string.h | ||
351 | header-y += suspend_ioctls.h | ||
352 | header-y += swab.h | ||
353 | header-y += synclink.h | ||
354 | header-y += sysctl.h | ||
355 | header-y += taskstats.h | ||
356 | header-y += tcp.h | ||
357 | header-y += telephony.h | ||
358 | header-y += termios.h | ||
359 | header-y += time.h | ||
360 | header-y += times.h | ||
361 | header-y += timex.h | ||
362 | header-y += tiocl.h | ||
363 | header-y += tipc.h | ||
364 | header-y += tipc_config.h | ||
365 | header-y += toshiba.h | ||
366 | header-y += tty.h | ||
367 | header-y += types.h | ||
368 | header-y += udf_fs_i.h | ||
369 | header-y += udp.h | ||
370 | header-y += uinput.h | ||
371 | header-y += uio.h | ||
372 | header-y += ultrasound.h | ||
373 | header-y += un.h | ||
374 | header-y += unistd.h | ||
375 | header-y += usbdevice_fs.h | ||
376 | header-y += utime.h | ||
377 | header-y += utsname.h | ||
378 | header-y += uvcvideo.h | ||
379 | header-y += v4l2-mediabus.h | ||
380 | header-y += v4l2-subdev.h | ||
381 | header-y += veth.h | ||
382 | header-y += vhost.h | ||
383 | header-y += videodev2.h | ||
384 | header-y += virtio_9p.h | ||
385 | header-y += virtio_balloon.h | ||
386 | header-y += virtio_blk.h | ||
387 | header-y += virtio_config.h | ||
388 | header-y += virtio_console.h | ||
389 | header-y += virtio_ids.h | ||
390 | header-y += virtio_net.h | ||
391 | header-y += virtio_pci.h | ||
392 | header-y += virtio_ring.h | ||
393 | header-y += virtio_rng.h | ||
394 | header-y += vt.h | ||
395 | header-y += wait.h | ||
396 | header-y += wanrouter.h | ||
397 | header-y += watchdog.h | ||
398 | header-y += wimax.h | ||
399 | header-y += wireless.h | ||
400 | header-y += x25.h | ||
401 | header-y += xattr.h | ||
402 | header-y += xfrm.h | ||
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h new file mode 100644 index 00000000000..0260c3e79fd --- /dev/null +++ b/include/linux/ac97_codec.h | |||
@@ -0,0 +1,362 @@ | |||
1 | #ifndef _AC97_CODEC_H_ | ||
2 | #define _AC97_CODEC_H_ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/soundcard.h> | ||
6 | |||
7 | /* AC97 1.0 */ | ||
8 | #define AC97_RESET 0x0000 // | ||
9 | #define AC97_MASTER_VOL_STEREO 0x0002 // Line Out | ||
10 | #define AC97_HEADPHONE_VOL 0x0004 // | ||
11 | #define AC97_MASTER_VOL_MONO 0x0006 // TAD Output | ||
12 | #define AC97_MASTER_TONE 0x0008 // | ||
13 | #define AC97_PCBEEP_VOL 0x000a // none | ||
14 | #define AC97_PHONE_VOL 0x000c // TAD Input (mono) | ||
15 | #define AC97_MIC_VOL 0x000e // MIC Input (mono) | ||
16 | #define AC97_LINEIN_VOL 0x0010 // Line Input (stereo) | ||
17 | #define AC97_CD_VOL 0x0012 // CD Input (stereo) | ||
18 | #define AC97_VIDEO_VOL 0x0014 // none | ||
19 | #define AC97_AUX_VOL 0x0016 // Aux Input (stereo) | ||
20 | #define AC97_PCMOUT_VOL 0x0018 // Wave Output (stereo) | ||
21 | #define AC97_RECORD_SELECT 0x001a // | ||
22 | #define AC97_RECORD_GAIN 0x001c | ||
23 | #define AC97_RECORD_GAIN_MIC 0x001e | ||
24 | #define AC97_GENERAL_PURPOSE 0x0020 | ||
25 | #define AC97_3D_CONTROL 0x0022 | ||
26 | #define AC97_MODEM_RATE 0x0024 | ||
27 | #define AC97_POWER_CONTROL 0x0026 | ||
28 | |||
29 | /* AC'97 2.0 */ | ||
30 | #define AC97_EXTENDED_ID 0x0028 /* Extended Audio ID */ | ||
31 | #define AC97_EXTENDED_STATUS 0x002A /* Extended Audio Status */ | ||
32 | #define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */ | ||
33 | #define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */ | ||
34 | #define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */ | ||
35 | #define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */ | ||
36 | #define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ | ||
37 | #define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ | ||
38 | #define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ | ||
39 | #define AC97_RESERVED_3A 0x003A /* Reserved in AC '97 < 2.2 */ | ||
40 | |||
41 | /* AC'97 2.2 */ | ||
42 | #define AC97_SPDIF_CONTROL 0x003A /* S/PDIF Control */ | ||
43 | |||
44 | /* range 0x3c-0x58 - MODEM */ | ||
45 | #define AC97_EXTENDED_MODEM_ID 0x003C | ||
46 | #define AC97_EXTEND_MODEM_STAT 0x003E | ||
47 | #define AC97_LINE1_RATE 0x0040 | ||
48 | #define AC97_LINE2_RATE 0x0042 | ||
49 | #define AC97_HANDSET_RATE 0x0044 | ||
50 | #define AC97_LINE1_LEVEL 0x0046 | ||
51 | #define AC97_LINE2_LEVEL 0x0048 | ||
52 | #define AC97_HANDSET_LEVEL 0x004A | ||
53 | #define AC97_GPIO_CONFIG 0x004C | ||
54 | #define AC97_GPIO_POLARITY 0x004E | ||
55 | #define AC97_GPIO_STICKY 0x0050 | ||
56 | #define AC97_GPIO_WAKE_UP 0x0052 | ||
57 | #define AC97_GPIO_STATUS 0x0054 | ||
58 | #define AC97_MISC_MODEM_STAT 0x0056 | ||
59 | #define AC97_RESERVED_58 0x0058 | ||
60 | |||
61 | /* registers 0x005a - 0x007a are vendor reserved */ | ||
62 | |||
63 | #define AC97_VENDOR_ID1 0x007c | ||
64 | #define AC97_VENDOR_ID2 0x007e | ||
65 | |||
66 | /* volume control bit defines */ | ||
67 | #define AC97_MUTE 0x8000 | ||
68 | #define AC97_MICBOOST 0x0040 | ||
69 | #define AC97_LEFTVOL 0x3f00 | ||
70 | #define AC97_RIGHTVOL 0x003f | ||
71 | |||
72 | /* record mux defines */ | ||
73 | #define AC97_RECMUX_MIC 0x0000 | ||
74 | #define AC97_RECMUX_CD 0x0101 | ||
75 | #define AC97_RECMUX_VIDEO 0x0202 | ||
76 | #define AC97_RECMUX_AUX 0x0303 | ||
77 | #define AC97_RECMUX_LINE 0x0404 | ||
78 | #define AC97_RECMUX_STEREO_MIX 0x0505 | ||
79 | #define AC97_RECMUX_MONO_MIX 0x0606 | ||
80 | #define AC97_RECMUX_PHONE 0x0707 | ||
81 | |||
82 | /* general purpose register bit defines */ | ||
83 | #define AC97_GP_LPBK 0x0080 /* Loopback mode */ | ||
84 | #define AC97_GP_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 */ | ||
85 | #define AC97_GP_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic */ | ||
86 | #define AC97_GP_RLBK 0x0400 /* Remote Loopback - Modem line codec */ | ||
87 | #define AC97_GP_LLBK 0x0800 /* Local Loopback - Modem Line codec */ | ||
88 | #define AC97_GP_LD 0x1000 /* Loudness 1=on */ | ||
89 | #define AC97_GP_3D 0x2000 /* 3D Enhancement 1=on */ | ||
90 | #define AC97_GP_ST 0x4000 /* Stereo Enhancement 1=on */ | ||
91 | #define AC97_GP_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */ | ||
92 | |||
93 | /* extended audio status and control bit defines */ | ||
94 | #define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */ | ||
95 | #define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */ | ||
96 | #define AC97_EA_SPDIF 0x0004 /* S/PDIF Enable bit */ | ||
97 | #define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */ | ||
98 | #define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */ | ||
99 | #define AC97_EA_SDAC 0x0040 /* PCM Surround DACs are ready (Read only) */ | ||
100 | #define AC97_EA_LDAC 0x0080 /* PCM LFE DAC is ready (Read only) */ | ||
101 | #define AC97_EA_MDAC 0x0100 /* MIC ADC is ready (Read only) */ | ||
102 | #define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */ | ||
103 | #define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */ | ||
104 | #define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */ | ||
105 | #define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */ | ||
106 | #define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */ | ||
107 | #define AC97_EA_SLOT_MASK 0xffcf /* Mask for slot assignment bits */ | ||
108 | #define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */ | ||
109 | #define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */ | ||
110 | #define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */ | ||
111 | #define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */ | ||
112 | |||
113 | /* S/PDIF control bit defines */ | ||
114 | #define AC97_SC_PRO 0x0001 /* Professional status */ | ||
115 | #define AC97_SC_NAUDIO 0x0002 /* Non audio stream */ | ||
116 | #define AC97_SC_COPY 0x0004 /* Copyright status */ | ||
117 | #define AC97_SC_PRE 0x0008 /* Preemphasis status */ | ||
118 | #define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */ | ||
119 | #define AC97_SC_L 0x0800 /* Generation Level status */ | ||
120 | #define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */ | ||
121 | #define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */ | ||
122 | #define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */ | ||
123 | #define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */ | ||
124 | #define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */ | ||
125 | #define AC97_SC_V 0x8000 /* Validity status */ | ||
126 | |||
127 | /* powerdown control and status bit defines */ | ||
128 | |||
129 | /* status */ | ||
130 | #define AC97_PWR_MDM 0x0010 /* Modem section ready */ | ||
131 | #define AC97_PWR_REF 0x0008 /* Vref nominal */ | ||
132 | #define AC97_PWR_ANL 0x0004 /* Analog section ready */ | ||
133 | #define AC97_PWR_DAC 0x0002 /* DAC section ready */ | ||
134 | #define AC97_PWR_ADC 0x0001 /* ADC section ready */ | ||
135 | |||
136 | /* control */ | ||
137 | #define AC97_PWR_PR0 0x0100 /* ADC and Mux powerdown */ | ||
138 | #define AC97_PWR_PR1 0x0200 /* DAC powerdown */ | ||
139 | #define AC97_PWR_PR2 0x0400 /* Output mixer powerdown (Vref on) */ | ||
140 | #define AC97_PWR_PR3 0x0800 /* Output mixer powerdown (Vref off) */ | ||
141 | #define AC97_PWR_PR4 0x1000 /* AC-link powerdown */ | ||
142 | #define AC97_PWR_PR5 0x2000 /* Internal Clk disable */ | ||
143 | #define AC97_PWR_PR6 0x4000 /* HP amp powerdown */ | ||
144 | #define AC97_PWR_PR7 0x8000 /* Modem off - if supported */ | ||
145 | |||
146 | /* extended audio ID register bit defines */ | ||
147 | #define AC97_EXTID_VRA 0x0001 | ||
148 | #define AC97_EXTID_DRA 0x0002 | ||
149 | #define AC97_EXTID_SPDIF 0x0004 | ||
150 | #define AC97_EXTID_VRM 0x0008 | ||
151 | #define AC97_EXTID_DSA0 0x0010 | ||
152 | #define AC97_EXTID_DSA1 0x0020 | ||
153 | #define AC97_EXTID_CDAC 0x0040 | ||
154 | #define AC97_EXTID_SDAC 0x0080 | ||
155 | #define AC97_EXTID_LDAC 0x0100 | ||
156 | #define AC97_EXTID_AMAP 0x0200 | ||
157 | #define AC97_EXTID_REV0 0x0400 | ||
158 | #define AC97_EXTID_REV1 0x0800 | ||
159 | #define AC97_EXTID_ID0 0x4000 | ||
160 | #define AC97_EXTID_ID1 0x8000 | ||
161 | |||
162 | /* extended status register bit defines */ | ||
163 | #define AC97_EXTSTAT_VRA 0x0001 | ||
164 | #define AC97_EXTSTAT_DRA 0x0002 | ||
165 | #define AC97_EXTSTAT_SPDIF 0x0004 | ||
166 | #define AC97_EXTSTAT_VRM 0x0008 | ||
167 | #define AC97_EXTSTAT_SPSA0 0x0010 | ||
168 | #define AC97_EXTSTAT_SPSA1 0x0020 | ||
169 | #define AC97_EXTSTAT_CDAC 0x0040 | ||
170 | #define AC97_EXTSTAT_SDAC 0x0080 | ||
171 | #define AC97_EXTSTAT_LDAC 0x0100 | ||
172 | #define AC97_EXTSTAT_MADC 0x0200 | ||
173 | #define AC97_EXTSTAT_SPCV 0x0400 | ||
174 | #define AC97_EXTSTAT_PRI 0x0800 | ||
175 | #define AC97_EXTSTAT_PRJ 0x1000 | ||
176 | #define AC97_EXTSTAT_PRK 0x2000 | ||
177 | #define AC97_EXTSTAT_PRL 0x4000 | ||
178 | |||
179 | /* extended audio ID register bit defines */ | ||
180 | #define AC97_EXTID_VRA 0x0001 | ||
181 | #define AC97_EXTID_DRA 0x0002 | ||
182 | #define AC97_EXTID_SPDIF 0x0004 | ||
183 | #define AC97_EXTID_VRM 0x0008 | ||
184 | #define AC97_EXTID_DSA0 0x0010 | ||
185 | #define AC97_EXTID_DSA1 0x0020 | ||
186 | #define AC97_EXTID_CDAC 0x0040 | ||
187 | #define AC97_EXTID_SDAC 0x0080 | ||
188 | #define AC97_EXTID_LDAC 0x0100 | ||
189 | #define AC97_EXTID_AMAP 0x0200 | ||
190 | #define AC97_EXTID_REV0 0x0400 | ||
191 | #define AC97_EXTID_REV1 0x0800 | ||
192 | #define AC97_EXTID_ID0 0x4000 | ||
193 | #define AC97_EXTID_ID1 0x8000 | ||
194 | |||
195 | /* extended status register bit defines */ | ||
196 | #define AC97_EXTSTAT_VRA 0x0001 | ||
197 | #define AC97_EXTSTAT_DRA 0x0002 | ||
198 | #define AC97_EXTSTAT_SPDIF 0x0004 | ||
199 | #define AC97_EXTSTAT_VRM 0x0008 | ||
200 | #define AC97_EXTSTAT_SPSA0 0x0010 | ||
201 | #define AC97_EXTSTAT_SPSA1 0x0020 | ||
202 | #define AC97_EXTSTAT_CDAC 0x0040 | ||
203 | #define AC97_EXTSTAT_SDAC 0x0080 | ||
204 | #define AC97_EXTSTAT_LDAC 0x0100 | ||
205 | #define AC97_EXTSTAT_MADC 0x0200 | ||
206 | #define AC97_EXTSTAT_SPCV 0x0400 | ||
207 | #define AC97_EXTSTAT_PRI 0x0800 | ||
208 | #define AC97_EXTSTAT_PRJ 0x1000 | ||
209 | #define AC97_EXTSTAT_PRK 0x2000 | ||
210 | #define AC97_EXTSTAT_PRL 0x4000 | ||
211 | |||
212 | /* useful power states */ | ||
213 | #define AC97_PWR_D0 0x0000 /* everything on */ | ||
214 | #define AC97_PWR_D1 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4 | ||
215 | #define AC97_PWR_D2 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4 | ||
216 | #define AC97_PWR_D3 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4 | ||
217 | #define AC97_PWR_ANLOFF AC97_PWR_PR2|AC97_PWR_PR3 /* analog section off */ | ||
218 | |||
219 | /* Total number of defined registers. */ | ||
220 | #define AC97_REG_CNT 64 | ||
221 | |||
222 | |||
223 | /* OSS interface to the ac97s.. */ | ||
224 | #define AC97_STEREO_MASK (SOUND_MASK_VOLUME|SOUND_MASK_PCM|\ | ||
225 | SOUND_MASK_LINE|SOUND_MASK_CD|\ | ||
226 | SOUND_MASK_ALTPCM|SOUND_MASK_IGAIN|\ | ||
227 | SOUND_MASK_LINE1|SOUND_MASK_VIDEO) | ||
228 | |||
229 | #define AC97_SUPPORTED_MASK (AC97_STEREO_MASK | \ | ||
230 | SOUND_MASK_BASS|SOUND_MASK_TREBLE|\ | ||
231 | SOUND_MASK_SPEAKER|SOUND_MASK_MIC|\ | ||
232 | SOUND_MASK_PHONEIN|SOUND_MASK_PHONEOUT) | ||
233 | |||
234 | #define AC97_RECORD_MASK (SOUND_MASK_MIC|\ | ||
235 | SOUND_MASK_CD|SOUND_MASK_IGAIN|SOUND_MASK_VIDEO|\ | ||
236 | SOUND_MASK_LINE1| SOUND_MASK_LINE|\ | ||
237 | SOUND_MASK_PHONEIN) | ||
238 | |||
239 | /* original check is not good enough in case FOO is greater than | ||
240 | * SOUND_MIXER_NRDEVICES because the supported_mixers has exactly | ||
241 | * SOUND_MIXER_NRDEVICES elements. | ||
242 | * before matching the given mixer against the bitmask in supported_mixers we | ||
243 | * check if mixer number exceeds maximum allowed size which is as mentioned | ||
244 | * above SOUND_MIXER_NRDEVICES */ | ||
245 | #define supported_mixer(CODEC,FOO) ((FOO >= 0) && \ | ||
246 | (FOO < SOUND_MIXER_NRDEVICES) && \ | ||
247 | (CODEC)->supported_mixers & (1<<FOO) ) | ||
248 | |||
249 | struct ac97_codec { | ||
250 | /* Linked list of codecs */ | ||
251 | struct list_head list; | ||
252 | |||
253 | /* AC97 controller connected with */ | ||
254 | void *private_data; | ||
255 | |||
256 | char *name; | ||
257 | int id; | ||
258 | int dev_mixer; | ||
259 | int type; | ||
260 | u32 model; | ||
261 | |||
262 | unsigned int modem:1; | ||
263 | |||
264 | struct ac97_ops *codec_ops; | ||
265 | |||
266 | /* controller specific lower leverl ac97 accessing routines. | ||
267 | must be re-entrant safe */ | ||
268 | u16 (*codec_read) (struct ac97_codec *codec, u8 reg); | ||
269 | void (*codec_write) (struct ac97_codec *codec, u8 reg, u16 val); | ||
270 | |||
271 | /* Wait for codec-ready. Ok to sleep here. */ | ||
272 | void (*codec_wait) (struct ac97_codec *codec); | ||
273 | |||
274 | /* callback used by helper drivers for interesting ac97 setups */ | ||
275 | void (*codec_unregister) (struct ac97_codec *codec); | ||
276 | |||
277 | struct ac97_driver *driver; | ||
278 | void *driver_private; /* Private data for the driver */ | ||
279 | |||
280 | spinlock_t lock; | ||
281 | |||
282 | /* OSS mixer masks */ | ||
283 | int modcnt; | ||
284 | int supported_mixers; | ||
285 | int stereo_mixers; | ||
286 | int record_sources; | ||
287 | |||
288 | /* Property flags */ | ||
289 | int flags; | ||
290 | |||
291 | int bit_resolution; | ||
292 | |||
293 | /* OSS mixer interface */ | ||
294 | int (*read_mixer) (struct ac97_codec *codec, int oss_channel); | ||
295 | void (*write_mixer)(struct ac97_codec *codec, int oss_channel, | ||
296 | unsigned int left, unsigned int right); | ||
297 | int (*recmask_io) (struct ac97_codec *codec, int rw, int mask); | ||
298 | int (*mixer_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg); | ||
299 | |||
300 | /* saved OSS mixer states */ | ||
301 | unsigned int mixer_state[SOUND_MIXER_NRDEVICES]; | ||
302 | |||
303 | /* Software Modem interface */ | ||
304 | int (*modem_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg); | ||
305 | }; | ||
306 | |||
307 | /* | ||
308 | * Operation structures for each known AC97 chip | ||
309 | */ | ||
310 | |||
311 | struct ac97_ops | ||
312 | { | ||
313 | /* Initialise */ | ||
314 | int (*init)(struct ac97_codec *c); | ||
315 | /* Amplifier control */ | ||
316 | int (*amplifier)(struct ac97_codec *codec, int on); | ||
317 | /* Digital mode control */ | ||
318 | int (*digital)(struct ac97_codec *codec, int slots, int rate, int mode); | ||
319 | #define AUDIO_DIGITAL 0x8000 | ||
320 | #define AUDIO_PRO 0x4000 | ||
321 | #define AUDIO_DRS 0x2000 | ||
322 | #define AUDIO_CCMASK 0x003F | ||
323 | |||
324 | #define AC97_DELUDED_MODEM 1 /* Audio codec reports its a modem */ | ||
325 | #define AC97_NO_PCM_VOLUME 2 /* Volume control is missing */ | ||
326 | #define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */ | ||
327 | }; | ||
328 | |||
329 | extern int ac97_probe_codec(struct ac97_codec *); | ||
330 | |||
331 | extern struct ac97_codec *ac97_alloc_codec(void); | ||
332 | extern void ac97_release_codec(struct ac97_codec *codec); | ||
333 | |||
334 | struct ac97_driver { | ||
335 | struct list_head list; | ||
336 | char *name; | ||
337 | u32 codec_id; | ||
338 | u32 codec_mask; | ||
339 | int (*probe) (struct ac97_codec *codec, struct ac97_driver *driver); | ||
340 | void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver); | ||
341 | }; | ||
342 | |||
343 | /* quirk types */ | ||
344 | enum { | ||
345 | AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */ | ||
346 | AC97_TUNE_NONE = 0, /* nothing extra to do */ | ||
347 | AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */ | ||
348 | AC97_TUNE_SWAP_HP, /* swap headphone and master controls */ | ||
349 | AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */ | ||
350 | AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */ | ||
351 | AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ | ||
352 | }; | ||
353 | |||
354 | struct ac97_quirk { | ||
355 | unsigned short vendor; /* PCI vendor id */ | ||
356 | unsigned short device; /* PCI device id */ | ||
357 | unsigned short mask; /* device id bit mask, 0 = accept all */ | ||
358 | const char *name; /* name shown as info */ | ||
359 | int type; /* quirk type above */ | ||
360 | }; | ||
361 | |||
362 | #endif /* _AC97_CODEC_H_ */ | ||
diff --git a/include/linux/adt7461.h b/include/linux/adt7461.h new file mode 100644 index 00000000000..36f637ad287 --- /dev/null +++ b/include/linux/adt7461.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * include/linux/adt8461.h | ||
3 | * | ||
4 | * ADT7461, temperature monitoring device from ON Semiconductors | ||
5 | * | ||
6 | * Copyright (c) 2011, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX_ADT7461_H | ||
24 | #define _LINUX_ADT7461_H | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | |||
28 | struct adt7461_platform_data { | ||
29 | bool supported_hwrev; | ||
30 | bool ext_range; | ||
31 | bool therm2; | ||
32 | u8 conv_rate; | ||
33 | u8 offset; | ||
34 | u8 hysteresis; | ||
35 | u8 shutdown_ext_limit; | ||
36 | u8 shutdown_local_limit; | ||
37 | u8 throttling_ext_limit; | ||
38 | void (*alarm_fn)(bool raised); | ||
39 | int irq_gpio; | ||
40 | }; | ||
41 | |||
42 | #endif /* _LINUX_ADT7461_H */ | ||
diff --git a/include/linux/affs_hardblocks.h b/include/linux/affs_hardblocks.h new file mode 100644 index 00000000000..f1b948c1f59 --- /dev/null +++ b/include/linux/affs_hardblocks.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef AFFS_HARDBLOCKS_H | ||
2 | #define AFFS_HARDBLOCKS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Just the needed definitions for the RDB of an Amiga HD. */ | ||
7 | |||
8 | struct RigidDiskBlock { | ||
9 | __u32 rdb_ID; | ||
10 | __be32 rdb_SummedLongs; | ||
11 | __s32 rdb_ChkSum; | ||
12 | __u32 rdb_HostID; | ||
13 | __be32 rdb_BlockBytes; | ||
14 | __u32 rdb_Flags; | ||
15 | __u32 rdb_BadBlockList; | ||
16 | __be32 rdb_PartitionList; | ||
17 | __u32 rdb_FileSysHeaderList; | ||
18 | __u32 rdb_DriveInit; | ||
19 | __u32 rdb_Reserved1[6]; | ||
20 | __u32 rdb_Cylinders; | ||
21 | __u32 rdb_Sectors; | ||
22 | __u32 rdb_Heads; | ||
23 | __u32 rdb_Interleave; | ||
24 | __u32 rdb_Park; | ||
25 | __u32 rdb_Reserved2[3]; | ||
26 | __u32 rdb_WritePreComp; | ||
27 | __u32 rdb_ReducedWrite; | ||
28 | __u32 rdb_StepRate; | ||
29 | __u32 rdb_Reserved3[5]; | ||
30 | __u32 rdb_RDBBlocksLo; | ||
31 | __u32 rdb_RDBBlocksHi; | ||
32 | __u32 rdb_LoCylinder; | ||
33 | __u32 rdb_HiCylinder; | ||
34 | __u32 rdb_CylBlocks; | ||
35 | __u32 rdb_AutoParkSeconds; | ||
36 | __u32 rdb_HighRDSKBlock; | ||
37 | __u32 rdb_Reserved4; | ||
38 | char rdb_DiskVendor[8]; | ||
39 | char rdb_DiskProduct[16]; | ||
40 | char rdb_DiskRevision[4]; | ||
41 | char rdb_ControllerVendor[8]; | ||
42 | char rdb_ControllerProduct[16]; | ||
43 | char rdb_ControllerRevision[4]; | ||
44 | __u32 rdb_Reserved5[10]; | ||
45 | }; | ||
46 | |||
47 | #define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ | ||
48 | |||
49 | struct PartitionBlock { | ||
50 | __be32 pb_ID; | ||
51 | __be32 pb_SummedLongs; | ||
52 | __s32 pb_ChkSum; | ||
53 | __u32 pb_HostID; | ||
54 | __be32 pb_Next; | ||
55 | __u32 pb_Flags; | ||
56 | __u32 pb_Reserved1[2]; | ||
57 | __u32 pb_DevFlags; | ||
58 | __u8 pb_DriveName[32]; | ||
59 | __u32 pb_Reserved2[15]; | ||
60 | __be32 pb_Environment[17]; | ||
61 | __u32 pb_EReserved[15]; | ||
62 | }; | ||
63 | |||
64 | #define IDNAME_PARTITION 0x50415254 /* "PART" */ | ||
65 | |||
66 | #define RDB_ALLOCATION_LIMIT 16 | ||
67 | |||
68 | #endif /* AFFS_HARDBLOCKS_H */ | ||
diff --git a/include/linux/aio_abi.h b/include/linux/aio_abi.h new file mode 100644 index 00000000000..2c873166418 --- /dev/null +++ b/include/linux/aio_abi.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* include/linux/aio_abi.h | ||
2 | * | ||
3 | * Copyright 2000,2001,2002 Red Hat. | ||
4 | * | ||
5 | * Written by Benjamin LaHaise <bcrl@kvack.org> | ||
6 | * | ||
7 | * Distribute under the terms of the GPLv2 (see ../../COPYING) or under | ||
8 | * the following terms. | ||
9 | * | ||
10 | * Permission to use, copy, modify, and distribute this software and its | ||
11 | * documentation is hereby granted, provided that the above copyright | ||
12 | * notice appears in all copies. This software is provided without any | ||
13 | * warranty, express or implied. Red Hat makes no representations about | ||
14 | * the suitability of this software for any purpose. | ||
15 | * | ||
16 | * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | ||
17 | * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF | ||
18 | * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED | ||
19 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
20 | * | ||
21 | * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND | ||
24 | * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, | ||
25 | * ENHANCEMENTS, OR MODIFICATIONS. | ||
26 | */ | ||
27 | #ifndef __LINUX__AIO_ABI_H | ||
28 | #define __LINUX__AIO_ABI_H | ||
29 | |||
30 | #include <linux/types.h> | ||
31 | #include <asm/byteorder.h> | ||
32 | |||
33 | typedef unsigned long aio_context_t; | ||
34 | |||
35 | enum { | ||
36 | IOCB_CMD_PREAD = 0, | ||
37 | IOCB_CMD_PWRITE = 1, | ||
38 | IOCB_CMD_FSYNC = 2, | ||
39 | IOCB_CMD_FDSYNC = 3, | ||
40 | /* These two are experimental. | ||
41 | * IOCB_CMD_PREADX = 4, | ||
42 | * IOCB_CMD_POLL = 5, | ||
43 | */ | ||
44 | IOCB_CMD_NOOP = 6, | ||
45 | IOCB_CMD_PREADV = 7, | ||
46 | IOCB_CMD_PWRITEV = 8, | ||
47 | }; | ||
48 | |||
49 | /* | ||
50 | * Valid flags for the "aio_flags" member of the "struct iocb". | ||
51 | * | ||
52 | * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb" | ||
53 | * is valid. | ||
54 | */ | ||
55 | #define IOCB_FLAG_RESFD (1 << 0) | ||
56 | |||
57 | /* read() from /dev/aio returns these structures. */ | ||
58 | struct io_event { | ||
59 | __u64 data; /* the data field from the iocb */ | ||
60 | __u64 obj; /* what iocb this event came from */ | ||
61 | __s64 res; /* result code for this event */ | ||
62 | __s64 res2; /* secondary result */ | ||
63 | }; | ||
64 | |||
65 | #if defined(__LITTLE_ENDIAN) | ||
66 | #define PADDED(x,y) x, y | ||
67 | #elif defined(__BIG_ENDIAN) | ||
68 | #define PADDED(x,y) y, x | ||
69 | #else | ||
70 | #error edit for your odd byteorder. | ||
71 | #endif | ||
72 | |||
73 | /* | ||
74 | * we always use a 64bit off_t when communicating | ||
75 | * with userland. its up to libraries to do the | ||
76 | * proper padding and aio_error abstraction | ||
77 | */ | ||
78 | |||
79 | struct iocb { | ||
80 | /* these are internal to the kernel/libc. */ | ||
81 | __u64 aio_data; /* data to be returned in event's data */ | ||
82 | __u32 PADDED(aio_key, aio_reserved1); | ||
83 | /* the kernel sets aio_key to the req # */ | ||
84 | |||
85 | /* common fields */ | ||
86 | __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ | ||
87 | __s16 aio_reqprio; | ||
88 | __u32 aio_fildes; | ||
89 | |||
90 | __u64 aio_buf; | ||
91 | __u64 aio_nbytes; | ||
92 | __s64 aio_offset; | ||
93 | |||
94 | /* extra parameters */ | ||
95 | __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ | ||
96 | |||
97 | /* flags for the "struct iocb" */ | ||
98 | __u32 aio_flags; | ||
99 | |||
100 | /* | ||
101 | * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an | ||
102 | * eventfd to signal AIO readiness to | ||
103 | */ | ||
104 | __u32 aio_resfd; | ||
105 | }; /* 64 bytes */ | ||
106 | |||
107 | #undef IFBIG | ||
108 | #undef IFLITTLE | ||
109 | |||
110 | #endif /* __LINUX__AIO_ABI_H */ | ||
111 | |||
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h new file mode 100644 index 00000000000..6a7c4326001 --- /dev/null +++ b/include/linux/akm8975.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Definitions for akm8975 compass chip. | ||
3 | */ | ||
4 | #ifndef AKM8975_H | ||
5 | #define AKM8975_H | ||
6 | |||
7 | #include <linux/ioctl.h> | ||
8 | |||
9 | /*! \name AK8975 operation mode | ||
10 | \anchor AK8975_Mode | ||
11 | Defines an operation mode of the AK8975.*/ | ||
12 | /*! @{*/ | ||
13 | #define AK8975_MODE_SNG_MEASURE 0x01 | ||
14 | #define AK8975_MODE_SELF_TEST 0x08 | ||
15 | #define AK8975_MODE_FUSE_ACCESS 0x0F | ||
16 | #define AK8975_MODE_POWER_DOWN 0x00 | ||
17 | /*! @}*/ | ||
18 | |||
19 | #define RBUFF_SIZE 8 /* Rx buffer size */ | ||
20 | |||
21 | /*! \name AK8975 register address | ||
22 | \anchor AK8975_REG | ||
23 | Defines a register address of the AK8975.*/ | ||
24 | /*! @{*/ | ||
25 | #define AK8975_REG_WIA 0x00 | ||
26 | #define AK8975_REG_INFO 0x01 | ||
27 | #define AK8975_REG_ST1 0x02 | ||
28 | #define AK8975_REG_HXL 0x03 | ||
29 | #define AK8975_REG_HXH 0x04 | ||
30 | #define AK8975_REG_HYL 0x05 | ||
31 | #define AK8975_REG_HYH 0x06 | ||
32 | #define AK8975_REG_HZL 0x07 | ||
33 | #define AK8975_REG_HZH 0x08 | ||
34 | #define AK8975_REG_ST2 0x09 | ||
35 | #define AK8975_REG_CNTL 0x0A | ||
36 | #define AK8975_REG_RSV 0x0B | ||
37 | #define AK8975_REG_ASTC 0x0C | ||
38 | #define AK8975_REG_TS1 0x0D | ||
39 | #define AK8975_REG_TS2 0x0E | ||
40 | #define AK8975_REG_I2CDIS 0x0F | ||
41 | /*! @}*/ | ||
42 | |||
43 | /*! \name AK8975 fuse-rom address | ||
44 | \anchor AK8975_FUSE | ||
45 | Defines a read-only address of the fuse ROM of the AK8975.*/ | ||
46 | /*! @{*/ | ||
47 | #define AK8975_FUSE_ASAX 0x10 | ||
48 | #define AK8975_FUSE_ASAY 0x11 | ||
49 | #define AK8975_FUSE_ASAZ 0x12 | ||
50 | /*! @}*/ | ||
51 | |||
52 | #define AKMIO 0xA1 | ||
53 | |||
54 | /* IOCTLs for AKM library */ | ||
55 | #define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5]) | ||
56 | #define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5]) | ||
57 | #define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE]) | ||
58 | #define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12]) | ||
59 | #define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int) | ||
60 | #define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int) | ||
61 | #define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short) | ||
62 | |||
63 | /* IOCTLs for APPs */ | ||
64 | #define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) | ||
65 | #define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short) | ||
66 | #define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) | ||
67 | #define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) | ||
68 | #define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short) | ||
69 | #define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY | ||
70 | /* Set raw magnetic vector flag */ | ||
71 | #define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) | ||
72 | /* Get raw magnetic vector flag */ | ||
73 | #define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) | ||
74 | #define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short) | ||
75 | |||
76 | |||
77 | struct akm8975_platform_data { | ||
78 | int intr; | ||
79 | |||
80 | int (*init)(void); | ||
81 | void (*exit)(void); | ||
82 | int (*power_on)(void); | ||
83 | int (*power_off)(void); | ||
84 | }; | ||
85 | |||
86 | #endif | ||
87 | |||
diff --git a/include/linux/android_aid.h b/include/linux/android_aid.h new file mode 100644 index 00000000000..0f904b3ba7f --- /dev/null +++ b/include/linux/android_aid.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* include/linux/android_aid.h | ||
2 | * | ||
3 | * Copyright (C) 2008 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_ANDROID_AID_H | ||
17 | #define _LINUX_ANDROID_AID_H | ||
18 | |||
19 | /* AIDs that the kernel treats differently */ | ||
20 | #define AID_NET_BT_ADMIN 3001 | ||
21 | #define AID_NET_BT 3002 | ||
22 | #define AID_INET 3003 | ||
23 | #define AID_NET_RAW 3004 | ||
24 | #define AID_NET_ADMIN 3005 | ||
25 | #define AID_NET_BW_STATS 3006 /* read bandwidth statistics */ | ||
26 | #define AID_NET_BW_ACCT 3007 /* change bandwidth statistics accounting */ | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/android_alarm.h b/include/linux/android_alarm.h new file mode 100644 index 00000000000..f8f14e793db --- /dev/null +++ b/include/linux/android_alarm.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* include/linux/android_alarm.h | ||
2 | * | ||
3 | * Copyright (C) 2006-2007 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_ANDROID_ALARM_H | ||
17 | #define _LINUX_ANDROID_ALARM_H | ||
18 | |||
19 | #include <linux/ioctl.h> | ||
20 | #include <linux/time.h> | ||
21 | |||
22 | enum android_alarm_type { | ||
23 | /* return code bit numbers or set alarm arg */ | ||
24 | ANDROID_ALARM_RTC_WAKEUP, | ||
25 | ANDROID_ALARM_RTC, | ||
26 | ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, | ||
27 | ANDROID_ALARM_ELAPSED_REALTIME, | ||
28 | ANDROID_ALARM_SYSTEMTIME, | ||
29 | |||
30 | ANDROID_ALARM_TYPE_COUNT, | ||
31 | |||
32 | /* return code bit numbers */ | ||
33 | /* ANDROID_ALARM_TIME_CHANGE = 16 */ | ||
34 | }; | ||
35 | |||
36 | #ifdef __KERNEL__ | ||
37 | |||
38 | #include <linux/ktime.h> | ||
39 | #include <linux/rbtree.h> | ||
40 | |||
41 | /* | ||
42 | * The alarm interface is similar to the hrtimer interface but adds support | ||
43 | * for wakeup from suspend. It also adds an elapsed realtime clock that can | ||
44 | * be used for periodic timers that need to keep runing while the system is | ||
45 | * suspended and not be disrupted when the wall time is set. | ||
46 | */ | ||
47 | |||
48 | /** | ||
49 | * struct alarm - the basic alarm structure | ||
50 | * @node: red black tree node for time ordered insertion | ||
51 | * @type: alarm type. rtc/elapsed-realtime/systemtime, wakeup/non-wakeup. | ||
52 | * @softexpires: the absolute earliest expiry time of the alarm. | ||
53 | * @expires: the absolute expiry time. | ||
54 | * @function: alarm expiry callback function | ||
55 | * | ||
56 | * The alarm structure must be initialized by alarm_init() | ||
57 | * | ||
58 | */ | ||
59 | |||
60 | struct alarm { | ||
61 | struct rb_node node; | ||
62 | enum android_alarm_type type; | ||
63 | ktime_t softexpires; | ||
64 | ktime_t expires; | ||
65 | void (*function)(struct alarm *); | ||
66 | }; | ||
67 | |||
68 | void alarm_init(struct alarm *alarm, | ||
69 | enum android_alarm_type type, void (*function)(struct alarm *)); | ||
70 | void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end); | ||
71 | int alarm_try_to_cancel(struct alarm *alarm); | ||
72 | int alarm_cancel(struct alarm *alarm); | ||
73 | ktime_t alarm_get_elapsed_realtime(void); | ||
74 | |||
75 | /* set rtc while preserving elapsed realtime */ | ||
76 | int alarm_set_rtc(const struct timespec ts); | ||
77 | |||
78 | #endif | ||
79 | |||
80 | enum android_alarm_return_flags { | ||
81 | ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP, | ||
82 | ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC, | ||
83 | ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK = | ||
84 | 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, | ||
85 | ANDROID_ALARM_ELAPSED_REALTIME_MASK = | ||
86 | 1U << ANDROID_ALARM_ELAPSED_REALTIME, | ||
87 | ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME, | ||
88 | ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16 | ||
89 | }; | ||
90 | |||
91 | /* Disable alarm */ | ||
92 | #define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4)) | ||
93 | |||
94 | /* Ack last alarm and wait for next */ | ||
95 | #define ANDROID_ALARM_WAIT _IO('a', 1) | ||
96 | |||
97 | #define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size) | ||
98 | /* Set alarm */ | ||
99 | #define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec) | ||
100 | #define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec) | ||
101 | #define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec) | ||
102 | #define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec) | ||
103 | #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0))) | ||
104 | #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4) | ||
105 | |||
106 | #endif | ||
diff --git a/include/linux/arcfb.h b/include/linux/arcfb.h new file mode 100644 index 00000000000..721e7654dae --- /dev/null +++ b/include/linux/arcfb.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __LINUX_ARCFB_H__ | ||
2 | #define __LINUX_ARCFB_H__ | ||
3 | |||
4 | #define FBIO_WAITEVENT _IO('F', 0x88) | ||
5 | #define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t) | ||
6 | |||
7 | #endif | ||
8 | |||
diff --git a/include/linux/ashmem.h b/include/linux/ashmem.h new file mode 100644 index 00000000000..1976b10ef93 --- /dev/null +++ b/include/linux/ashmem.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * include/linux/ashmem.h | ||
3 | * | ||
4 | * Copyright 2008 Google Inc. | ||
5 | * Author: Robert Love | ||
6 | * | ||
7 | * This file is dual licensed. It may be redistributed and/or modified | ||
8 | * under the terms of the Apache 2.0 License OR version 2 of the GNU | ||
9 | * General Public License. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_ASHMEM_H | ||
13 | #define _LINUX_ASHMEM_H | ||
14 | |||
15 | #include <linux/limits.h> | ||
16 | #include <linux/ioctl.h> | ||
17 | |||
18 | #define ASHMEM_NAME_LEN 256 | ||
19 | |||
20 | #define ASHMEM_NAME_DEF "dev/ashmem" | ||
21 | |||
22 | /* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ | ||
23 | #define ASHMEM_NOT_PURGED 0 | ||
24 | #define ASHMEM_WAS_PURGED 1 | ||
25 | |||
26 | /* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */ | ||
27 | #define ASHMEM_IS_UNPINNED 0 | ||
28 | #define ASHMEM_IS_PINNED 1 | ||
29 | |||
30 | struct ashmem_pin { | ||
31 | __u32 offset; /* offset into region, in bytes, page-aligned */ | ||
32 | __u32 len; /* length forward from offset, in bytes, page-aligned */ | ||
33 | }; | ||
34 | |||
35 | #define __ASHMEMIOC 0x77 | ||
36 | |||
37 | #define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) | ||
38 | #define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) | ||
39 | #define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) | ||
40 | #define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) | ||
41 | #define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) | ||
42 | #define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) | ||
43 | #define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) | ||
44 | #define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) | ||
45 | #define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9) | ||
46 | #define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) | ||
47 | |||
48 | #endif /* _LINUX_ASHMEM_H */ | ||
diff --git a/include/linux/atm_eni.h b/include/linux/atm_eni.h new file mode 100644 index 00000000000..34f31797255 --- /dev/null +++ b/include/linux/atm_eni.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* atm_eni.h - Driver-specific declarations of the ENI driver (for use by | ||
2 | driver-specific utilities) */ | ||
3 | |||
4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | ||
5 | |||
6 | |||
7 | #ifndef LINUX_ATM_ENI_H | ||
8 | #define LINUX_ATM_ENI_H | ||
9 | |||
10 | #include <linux/atmioc.h> | ||
11 | |||
12 | |||
13 | struct eni_multipliers { | ||
14 | int tx,rx; /* values are in percent and must be > 100 */ | ||
15 | }; | ||
16 | |||
17 | |||
18 | #define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc) | ||
19 | /* printk memory map */ | ||
20 | #define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc) | ||
21 | /* set buffer multipliers */ | ||
22 | |||
23 | #endif | ||
diff --git a/include/linux/atm_he.h b/include/linux/atm_he.h new file mode 100644 index 00000000000..2a7713b597c --- /dev/null +++ b/include/linux/atm_he.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* atm_he.h */ | ||
2 | |||
3 | #ifndef LINUX_ATM_HE_H | ||
4 | #define LINUX_ATM_HE_H | ||
5 | |||
6 | #include <linux/atmioc.h> | ||
7 | |||
8 | #define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc) | ||
9 | |||
10 | #define HE_REGTYPE_PCI 1 | ||
11 | #define HE_REGTYPE_RCM 2 | ||
12 | #define HE_REGTYPE_TCM 3 | ||
13 | #define HE_REGTYPE_MBOX 4 | ||
14 | |||
15 | struct he_ioctl_reg { | ||
16 | unsigned addr, val; | ||
17 | char type; | ||
18 | }; | ||
19 | |||
20 | #endif /* LINUX_ATM_HE_H */ | ||
diff --git a/include/linux/atm_idt77105.h b/include/linux/atm_idt77105.h new file mode 100644 index 00000000000..8b724000aa5 --- /dev/null +++ b/include/linux/atm_idt77105.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for | ||
2 | * use by driver-specific utilities) */ | ||
3 | |||
4 | /* Written 1999 by Greg Banks <gnb@linuxfan.com>. Copied from atm_suni.h. */ | ||
5 | |||
6 | |||
7 | #ifndef LINUX_ATM_IDT77105_H | ||
8 | #define LINUX_ATM_IDT77105_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/atmioc.h> | ||
12 | #include <linux/atmdev.h> | ||
13 | |||
14 | /* | ||
15 | * Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls. | ||
16 | * Pointed to by `arg' in atmif_sioc. | ||
17 | */ | ||
18 | struct idt77105_stats { | ||
19 | __u32 symbol_errors; /* wire symbol errors */ | ||
20 | __u32 tx_cells; /* cells transmitted */ | ||
21 | __u32 rx_cells; /* cells received */ | ||
22 | __u32 rx_hec_errors; /* Header Error Check errors on receive */ | ||
23 | }; | ||
24 | |||
25 | #define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */ | ||
26 | #define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */ | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/atm_nicstar.h b/include/linux/atm_nicstar.h new file mode 100644 index 00000000000..577b79f33e8 --- /dev/null +++ b/include/linux/atm_nicstar.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * atm_nicstar.h | ||
4 | * | ||
5 | * Driver-specific declarations for use by NICSTAR driver specific utils. | ||
6 | * | ||
7 | * Author: Rui Prior | ||
8 | * | ||
9 | * (C) INESC 1998 | ||
10 | * | ||
11 | ******************************************************************************/ | ||
12 | |||
13 | |||
14 | #ifndef LINUX_ATM_NICSTAR_H | ||
15 | #define LINUX_ATM_NICSTAR_H | ||
16 | |||
17 | /* Note: non-kernel programs including this file must also include | ||
18 | * sys/types.h for struct timeval | ||
19 | */ | ||
20 | |||
21 | #include <linux/atmapi.h> | ||
22 | #include <linux/atmioc.h> | ||
23 | |||
24 | #define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc) | ||
25 | /* get pool statistics */ | ||
26 | #define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) | ||
27 | /* set buffer level markers */ | ||
28 | #define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3) | ||
29 | /* adjust buffer level */ | ||
30 | |||
31 | typedef struct buf_nr | ||
32 | { | ||
33 | unsigned min; | ||
34 | unsigned init; | ||
35 | unsigned max; | ||
36 | }buf_nr; | ||
37 | |||
38 | |||
39 | typedef struct pool_levels | ||
40 | { | ||
41 | int buftype; | ||
42 | int count; /* (At least for now) only used in NS_GETPSTAT */ | ||
43 | buf_nr level; | ||
44 | } pool_levels; | ||
45 | |||
46 | /* type must be one of the following: */ | ||
47 | #define NS_BUFTYPE_SMALL 1 | ||
48 | #define NS_BUFTYPE_LARGE 2 | ||
49 | #define NS_BUFTYPE_HUGE 3 | ||
50 | #define NS_BUFTYPE_IOVEC 4 | ||
51 | |||
52 | |||
53 | #endif /* LINUX_ATM_NICSTAR_H */ | ||
diff --git a/include/linux/atm_zatm.h b/include/linux/atm_zatm.h new file mode 100644 index 00000000000..10f0fa29454 --- /dev/null +++ b/include/linux/atm_zatm.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by | ||
2 | driver-specific utilities) */ | ||
3 | |||
4 | /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | ||
5 | |||
6 | |||
7 | #ifndef LINUX_ATM_ZATM_H | ||
8 | #define LINUX_ATM_ZATM_H | ||
9 | |||
10 | /* | ||
11 | * Note: non-kernel programs including this file must also include | ||
12 | * sys/types.h for struct timeval | ||
13 | */ | ||
14 | |||
15 | #include <linux/atmapi.h> | ||
16 | #include <linux/atmioc.h> | ||
17 | |||
18 | #define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc) | ||
19 | /* get pool statistics */ | ||
20 | #define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) | ||
21 | /* get statistics and zero */ | ||
22 | #define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc) | ||
23 | /* set pool parameters */ | ||
24 | |||
25 | struct zatm_pool_info { | ||
26 | int ref_count; /* free buffer pool usage counters */ | ||
27 | int low_water,high_water; /* refill parameters */ | ||
28 | int rqa_count,rqu_count; /* queue condition counters */ | ||
29 | int offset,next_off; /* alignment optimizations: offset */ | ||
30 | int next_cnt,next_thres; /* repetition counter and threshold */ | ||
31 | }; | ||
32 | |||
33 | struct zatm_pool_req { | ||
34 | int pool_num; /* pool number */ | ||
35 | struct zatm_pool_info info; /* actual information */ | ||
36 | }; | ||
37 | |||
38 | struct zatm_t_hist { | ||
39 | struct timeval real; /* real (wall-clock) time */ | ||
40 | struct timeval expected; /* expected real time */ | ||
41 | }; | ||
42 | |||
43 | |||
44 | #define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */ | ||
45 | #define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */ | ||
46 | #define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */ | ||
47 | #define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */ | ||
48 | |||
49 | #define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to | ||
50 | record; must be 2^n */ | ||
51 | |||
52 | #endif | ||
diff --git a/include/linux/atmapi.h b/include/linux/atmapi.h new file mode 100644 index 00000000000..8fe54d90d95 --- /dev/null +++ b/include/linux/atmapi.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* atmapi.h - ATM API user space/kernel compatibility */ | ||
2 | |||
3 | /* Written 1999,2000 by Werner Almesberger, EPFL ICA */ | ||
4 | |||
5 | |||
6 | #ifndef _LINUX_ATMAPI_H | ||
7 | #define _LINUX_ATMAPI_H | ||
8 | |||
9 | #if defined(__sparc__) || defined(__ia64__) | ||
10 | /* such alignment is not required on 32 bit sparcs, but we can't | ||
11 | figure that we are on a sparc64 while compiling user-space programs. */ | ||
12 | #define __ATM_API_ALIGN __attribute__((aligned(8))) | ||
13 | #else | ||
14 | #define __ATM_API_ALIGN | ||
15 | #endif | ||
16 | |||
17 | |||
18 | /* | ||
19 | * Opaque type for kernel pointers. Note that _ is never accessed. We need | ||
20 | * the struct in order hide the array, so that we can make simple assignments | ||
21 | * instead of being forced to use memcpy. It also improves error reporting for | ||
22 | * code that still assumes that we're passing unsigned longs. | ||
23 | * | ||
24 | * Convention: NULL pointers are passed as a field of all zeroes. | ||
25 | */ | ||
26 | |||
27 | typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; | ||
28 | |||
29 | #endif | ||
diff --git a/include/linux/atmarp.h b/include/linux/atmarp.h new file mode 100644 index 00000000000..231f4bdec73 --- /dev/null +++ b/include/linux/atmarp.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ | ||
2 | |||
3 | /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | ||
4 | |||
5 | |||
6 | #ifndef _LINUX_ATMARP_H | ||
7 | #define _LINUX_ATMARP_H | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | #include <linux/atmapi.h> | ||
11 | #include <linux/atmioc.h> | ||
12 | |||
13 | |||
14 | #define ATMARP_RETRY_DELAY 30 /* request next resolution or forget | ||
15 | NAK after 30 sec - should go into | ||
16 | atmclip.h */ | ||
17 | #define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while | ||
18 | waiting for the resolver */ | ||
19 | |||
20 | |||
21 | #define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ | ||
22 | #define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ | ||
23 | #define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ | ||
24 | #define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ | ||
25 | |||
26 | |||
27 | enum atmarp_ctrl_type { | ||
28 | act_invalid, /* catch uninitialized structures */ | ||
29 | act_need, /* need address resolution */ | ||
30 | act_up, /* interface is coming up */ | ||
31 | act_down, /* interface is going down */ | ||
32 | act_change /* interface configuration has changed */ | ||
33 | }; | ||
34 | |||
35 | struct atmarp_ctrl { | ||
36 | enum atmarp_ctrl_type type; /* message type */ | ||
37 | int itf_num;/* interface number (if present) */ | ||
38 | __be32 ip; /* IP address (act_need only) */ | ||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h new file mode 100644 index 00000000000..fdb2629b618 --- /dev/null +++ b/include/linux/atmbr2684.h | |||
@@ -0,0 +1,117 @@ | |||
1 | #ifndef _LINUX_ATMBR2684_H | ||
2 | #define _LINUX_ATMBR2684_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/atm.h> | ||
6 | #include <linux/if.h> /* For IFNAMSIZ */ | ||
7 | |||
8 | /* | ||
9 | * Type of media we're bridging (ethernet, token ring, etc) Currently only | ||
10 | * ethernet is supported | ||
11 | */ | ||
12 | #define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ | ||
13 | #define BR2684_MEDIA_802_4 (1) /* 802.4 */ | ||
14 | #define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ | ||
15 | #define BR2684_MEDIA_FDDI (3) | ||
16 | #define BR2684_MEDIA_802_6 (4) /* 802.6 */ | ||
17 | |||
18 | /* used only at device creation: */ | ||
19 | #define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */ | ||
20 | |||
21 | /* | ||
22 | * Is there FCS inbound on this VC? This currently isn't supported. | ||
23 | */ | ||
24 | #define BR2684_FCSIN_NO (0) | ||
25 | #define BR2684_FCSIN_IGNORE (1) | ||
26 | #define BR2684_FCSIN_VERIFY (2) | ||
27 | |||
28 | /* | ||
29 | * Is there FCS outbound on this VC? This currently isn't supported. | ||
30 | */ | ||
31 | #define BR2684_FCSOUT_NO (0) | ||
32 | #define BR2684_FCSOUT_SENDZERO (1) | ||
33 | #define BR2684_FCSOUT_GENERATE (2) | ||
34 | |||
35 | /* | ||
36 | * Does this VC include LLC encapsulation? | ||
37 | */ | ||
38 | #define BR2684_ENCAPS_VC (0) /* VC-mux */ | ||
39 | #define BR2684_ENCAPS_LLC (1) | ||
40 | #define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ | ||
41 | |||
42 | /* | ||
43 | * Is this VC bridged or routed? | ||
44 | */ | ||
45 | |||
46 | #define BR2684_PAYLOAD_ROUTED (0) | ||
47 | #define BR2684_PAYLOAD_BRIDGED (1) | ||
48 | |||
49 | /* | ||
50 | * This is for the ATM_NEWBACKENDIF call - these are like socket families: | ||
51 | * the first element of the structure is the backend number and the rest | ||
52 | * is per-backend specific | ||
53 | */ | ||
54 | struct atm_newif_br2684 { | ||
55 | atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ | ||
56 | int media; /* BR2684_MEDIA_*, flags in upper bits */ | ||
57 | char ifname[IFNAMSIZ]; | ||
58 | int mtu; | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | * This structure is used to specify a br2684 interface - either by a | ||
63 | * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name | ||
64 | */ | ||
65 | #define BR2684_FIND_BYNOTHING (0) | ||
66 | #define BR2684_FIND_BYNUM (1) | ||
67 | #define BR2684_FIND_BYIFNAME (2) | ||
68 | struct br2684_if_spec { | ||
69 | int method; /* BR2684_FIND_* */ | ||
70 | union { | ||
71 | char ifname[IFNAMSIZ]; | ||
72 | int devnum; | ||
73 | } spec; | ||
74 | }; | ||
75 | |||
76 | /* | ||
77 | * This is for the ATM_SETBACKEND call - these are like socket families: | ||
78 | * the first element of the structure is the backend number and the rest | ||
79 | * is per-backend specific | ||
80 | */ | ||
81 | struct atm_backend_br2684 { | ||
82 | atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ | ||
83 | struct br2684_if_spec ifspec; | ||
84 | int fcs_in; /* BR2684_FCSIN_* */ | ||
85 | int fcs_out; /* BR2684_FCSOUT_* */ | ||
86 | int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ | ||
87 | int encaps; /* BR2684_ENCAPS_* */ | ||
88 | int has_vpiid; /* 1: use vpn_id - Unsupported */ | ||
89 | __u8 vpn_id[7]; | ||
90 | int send_padding; /* unsupported */ | ||
91 | int min_size; /* we will pad smaller packets than this */ | ||
92 | }; | ||
93 | |||
94 | /* | ||
95 | * The BR2684_SETFILT ioctl is an experimental mechanism for folks | ||
96 | * terminating a large number of IP-only vcc's. When netfilter allows | ||
97 | * efficient per-if in/out filters, this support will be removed | ||
98 | */ | ||
99 | struct br2684_filter { | ||
100 | __be32 prefix; /* network byte order */ | ||
101 | __be32 netmask; /* 0 = disable filter */ | ||
102 | }; | ||
103 | |||
104 | struct br2684_filter_set { | ||
105 | struct br2684_if_spec ifspec; | ||
106 | struct br2684_filter filter; | ||
107 | }; | ||
108 | |||
109 | enum br2684_payload { | ||
110 | p_routed = BR2684_PAYLOAD_ROUTED, | ||
111 | p_bridged = BR2684_PAYLOAD_BRIDGED, | ||
112 | }; | ||
113 | |||
114 | #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ | ||
115 | struct br2684_filter_set) | ||
116 | |||
117 | #endif /* _LINUX_ATMBR2684_H */ | ||
diff --git a/include/linux/atmclip.h b/include/linux/atmclip.h new file mode 100644 index 00000000000..02c94c448dd --- /dev/null +++ b/include/linux/atmclip.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* atmclip.h - Classical IP over ATM */ | ||
2 | |||
3 | /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ | ||
4 | |||
5 | |||
6 | #ifndef LINUX_ATMCLIP_H | ||
7 | #define LINUX_ATMCLIP_H | ||
8 | |||
9 | #include <linux/sockios.h> | ||
10 | #include <linux/atmioc.h> | ||
11 | |||
12 | |||
13 | #define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */ | ||
14 | #define RFC1626_MTU 9180 /* RFC1626 default MTU */ | ||
15 | |||
16 | #define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */ | ||
17 | #define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */ | ||
18 | |||
19 | #define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */ | ||
20 | |||
21 | #endif | ||
diff --git a/include/linux/atmioc.h b/include/linux/atmioc.h new file mode 100644 index 00000000000..37f67aa8f1c --- /dev/null +++ b/include/linux/atmioc.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* atmioc.h - ranges for ATM-related ioctl numbers */ | ||
2 | |||
3 | /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | ||
4 | |||
5 | |||
6 | /* | ||
7 | * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of | ||
8 | * "magic" ioctl numbers. | ||
9 | */ | ||
10 | |||
11 | |||
12 | #ifndef _LINUX_ATMIOC_H | ||
13 | #define _LINUX_ATMIOC_H | ||
14 | |||
15 | #include <asm/ioctl.h> | ||
16 | /* everybody including atmioc.h will also need _IO{,R,W,WR} */ | ||
17 | |||
18 | #define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ | ||
19 | #define ATMIOC_PHYCOM_END 0x0f | ||
20 | #define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ | ||
21 | #define ATMIOC_PHYTYP_END 0x2f | ||
22 | #define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ | ||
23 | #define ATMIOC_PHYPRV_END 0x4f | ||
24 | #define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ | ||
25 | #define ATMIOC_SARCOM_END 0x50 | ||
26 | #define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ | ||
27 | #define ATMIOC_SARPRV_END 0x7f | ||
28 | #define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ | ||
29 | #define ATMIOC_ITF_END 0x8f | ||
30 | #define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ | ||
31 | #define ATMIOC_BACKEND_END 0xaf | ||
32 | /* 0xb0-0xbf: Reserved for future use */ | ||
33 | #define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ | ||
34 | #define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ | ||
35 | #define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ | ||
36 | #define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ | ||
37 | #define ATMIOC_CLIP_END 0xef | ||
38 | #define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ | ||
39 | #define ATMIOC_SPECIAL_END 0xff | ||
40 | |||
41 | #endif | ||
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h new file mode 100644 index 00000000000..39c917fd1b9 --- /dev/null +++ b/include/linux/atmlec.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * ATM Lan Emulation Daemon driver interface | ||
3 | * | ||
4 | * Marko Kiiskila <mkiiskila@yahoo.com> | ||
5 | */ | ||
6 | |||
7 | #ifndef _ATMLEC_H_ | ||
8 | #define _ATMLEC_H_ | ||
9 | |||
10 | #include <linux/atmapi.h> | ||
11 | #include <linux/atmioc.h> | ||
12 | #include <linux/atm.h> | ||
13 | #include <linux/if_ether.h> | ||
14 | #include <linux/types.h> | ||
15 | |||
16 | /* ATM lec daemon control socket */ | ||
17 | #define ATMLEC_CTRL _IO('a', ATMIOC_LANE) | ||
18 | #define ATMLEC_DATA _IO('a', ATMIOC_LANE+1) | ||
19 | #define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2) | ||
20 | |||
21 | /* Maximum number of LEC interfaces (tweakable) */ | ||
22 | #define MAX_LEC_ITF 48 | ||
23 | |||
24 | /* | ||
25 | * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring. | ||
26 | * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for | ||
27 | * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS. | ||
28 | */ | ||
29 | #define NUM_TR_DEVS 8 | ||
30 | |||
31 | typedef enum { | ||
32 | l_set_mac_addr, | ||
33 | l_del_mac_addr, | ||
34 | l_svc_setup, | ||
35 | l_addr_delete, | ||
36 | l_topology_change, | ||
37 | l_flush_complete, | ||
38 | l_arp_update, | ||
39 | l_narp_req, /* LANE2 mandates the use of this */ | ||
40 | l_config, | ||
41 | l_flush_tran_id, | ||
42 | l_set_lecid, | ||
43 | l_arp_xmt, | ||
44 | l_rdesc_arp_xmt, | ||
45 | l_associate_req, | ||
46 | l_should_bridge /* should we bridge this MAC? */ | ||
47 | } atmlec_msg_type; | ||
48 | |||
49 | #define ATMLEC_MSG_TYPE_MAX l_should_bridge | ||
50 | |||
51 | struct atmlec_config_msg { | ||
52 | unsigned int maximum_unknown_frame_count; | ||
53 | unsigned int max_unknown_frame_time; | ||
54 | unsigned short max_retry_count; | ||
55 | unsigned int aging_time; | ||
56 | unsigned int forward_delay_time; | ||
57 | unsigned int arp_response_time; | ||
58 | unsigned int flush_timeout; | ||
59 | unsigned int path_switching_delay; | ||
60 | unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ | ||
61 | int mtu; | ||
62 | int is_proxy; | ||
63 | }; | ||
64 | |||
65 | struct atmlec_msg { | ||
66 | atmlec_msg_type type; | ||
67 | int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ | ||
68 | union { | ||
69 | struct { | ||
70 | unsigned char mac_addr[ETH_ALEN]; | ||
71 | unsigned char atm_addr[ATM_ESA_LEN]; | ||
72 | unsigned int flag; /* | ||
73 | * Topology_change flag, | ||
74 | * remoteflag, permanent flag, | ||
75 | * lecid, transaction id | ||
76 | */ | ||
77 | unsigned int targetless_le_arp; /* LANE2 */ | ||
78 | unsigned int no_source_le_narp; /* LANE2 */ | ||
79 | } normal; | ||
80 | struct atmlec_config_msg config; | ||
81 | struct { | ||
82 | __u16 lec_id; /* requestor lec_id */ | ||
83 | __u32 tran_id; /* transaction id */ | ||
84 | unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ | ||
85 | unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ | ||
86 | } proxy; /* | ||
87 | * For mapping LE_ARP requests to responses. Filled by | ||
88 | * zeppelin, returned by kernel. Used only when proxying | ||
89 | */ | ||
90 | } content; | ||
91 | } __ATM_API_ALIGN; | ||
92 | |||
93 | struct atmlec_ioc { | ||
94 | int dev_num; | ||
95 | unsigned char atm_addr[ATM_ESA_LEN]; | ||
96 | unsigned char receive; /* 1= receive vcc, 0 = send vcc */ | ||
97 | }; | ||
98 | #endif /* _ATMLEC_H_ */ | ||
diff --git a/include/linux/atmmpc.h b/include/linux/atmmpc.h new file mode 100644 index 00000000000..2aba5787fa6 --- /dev/null +++ b/include/linux/atmmpc.h | |||
@@ -0,0 +1,126 @@ | |||
1 | #ifndef _ATMMPC_H_ | ||
2 | #define _ATMMPC_H_ | ||
3 | |||
4 | #include <linux/atmapi.h> | ||
5 | #include <linux/atmioc.h> | ||
6 | #include <linux/atm.h> | ||
7 | #include <linux/types.h> | ||
8 | |||
9 | #define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) | ||
10 | #define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) | ||
11 | |||
12 | #define MPC_SOCKET_INGRESS 1 | ||
13 | #define MPC_SOCKET_EGRESS 2 | ||
14 | |||
15 | struct atmmpc_ioc { | ||
16 | int dev_num; | ||
17 | __be32 ipaddr; /* the IP address of the shortcut */ | ||
18 | int type; /* ingress or egress */ | ||
19 | }; | ||
20 | |||
21 | typedef struct in_ctrl_info { | ||
22 | __u8 Last_NHRP_CIE_code; | ||
23 | __u8 Last_Q2931_cause_value; | ||
24 | __u8 eg_MPC_ATM_addr[ATM_ESA_LEN]; | ||
25 | __be32 tag; | ||
26 | __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ | ||
27 | __u16 holding_time; | ||
28 | __u32 request_id; | ||
29 | } in_ctrl_info; | ||
30 | |||
31 | typedef struct eg_ctrl_info { | ||
32 | __u8 DLL_header[256]; | ||
33 | __u8 DH_length; | ||
34 | __be32 cache_id; | ||
35 | __be32 tag; | ||
36 | __be32 mps_ip; | ||
37 | __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ | ||
38 | __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN]; | ||
39 | __u16 holding_time; | ||
40 | } eg_ctrl_info; | ||
41 | |||
42 | struct mpc_parameters { | ||
43 | __u16 mpc_p1; /* Shortcut-Setup Frame Count */ | ||
44 | __u16 mpc_p2; /* Shortcut-Setup Frame Time */ | ||
45 | __u8 mpc_p3[8]; /* Flow-detection Protocols */ | ||
46 | __u16 mpc_p4; /* MPC Initial Retry Time */ | ||
47 | __u16 mpc_p5; /* MPC Retry Time Maximum */ | ||
48 | __u16 mpc_p6; /* Hold Down Time */ | ||
49 | } ; | ||
50 | |||
51 | struct k_message { | ||
52 | __u16 type; | ||
53 | __be32 ip_mask; | ||
54 | __u8 MPS_ctrl[ATM_ESA_LEN]; | ||
55 | union { | ||
56 | in_ctrl_info in_info; | ||
57 | eg_ctrl_info eg_info; | ||
58 | struct mpc_parameters params; | ||
59 | } content; | ||
60 | struct atm_qos qos; | ||
61 | } __ATM_API_ALIGN; | ||
62 | |||
63 | struct llc_snap_hdr { | ||
64 | /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ | ||
65 | __u8 dsap; /* Destination Service Access Point (0xAA) */ | ||
66 | __u8 ssap; /* Source Service Access Point (0xAA) */ | ||
67 | __u8 ui; /* Unnumbered Information (0x03) */ | ||
68 | __u8 org[3]; /* Organizational identification (0x000000) */ | ||
69 | __u8 type[2]; /* Ether type (for IP) (0x0800) */ | ||
70 | }; | ||
71 | |||
72 | /* TLVs this MPC recognizes */ | ||
73 | #define TLV_MPOA_DEVICE_TYPE 0x00a03e2a | ||
74 | |||
75 | /* MPOA device types in MPOA Device Type TLV */ | ||
76 | #define NON_MPOA 0 | ||
77 | #define MPS 1 | ||
78 | #define MPC 2 | ||
79 | #define MPS_AND_MPC 3 | ||
80 | |||
81 | |||
82 | /* MPC parameter defaults */ | ||
83 | |||
84 | #define MPC_P1 10 /* Shortcut-Setup Frame Count */ | ||
85 | #define MPC_P2 1 /* Shortcut-Setup Frame Time */ | ||
86 | #define MPC_P3 0 /* Flow-detection Protocols */ | ||
87 | #define MPC_P4 5 /* MPC Initial Retry Time */ | ||
88 | #define MPC_P5 40 /* MPC Retry Time Maximum */ | ||
89 | #define MPC_P6 160 /* Hold Down Time */ | ||
90 | #define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */ | ||
91 | |||
92 | /* MPC constants */ | ||
93 | |||
94 | #define MPC_C1 2 /* Retry Time Multiplier */ | ||
95 | #define MPC_C2 60 /* Initial Keep-Alive Lifetime */ | ||
96 | |||
97 | /* Message types - to MPOA daemon */ | ||
98 | |||
99 | #define SND_MPOA_RES_RQST 201 | ||
100 | #define SET_MPS_CTRL_ADDR 202 | ||
101 | #define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */ | ||
102 | #define STOP_KEEP_ALIVE_SM 204 | ||
103 | #define EGRESS_ENTRY_REMOVED 205 | ||
104 | #define SND_EGRESS_PURGE 206 | ||
105 | #define DIE 207 /* tell the daemon to exit() */ | ||
106 | #define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */ | ||
107 | #define OPEN_INGRESS_SVC 209 | ||
108 | |||
109 | /* Message types - from MPOA daemon */ | ||
110 | |||
111 | #define MPOA_TRIGGER_RCVD 101 | ||
112 | #define MPOA_RES_REPLY_RCVD 102 | ||
113 | #define INGRESS_PURGE_RCVD 103 | ||
114 | #define EGRESS_PURGE_RCVD 104 | ||
115 | #define MPS_DEATH 105 | ||
116 | #define CACHE_IMPOS_RCVD 106 | ||
117 | #define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */ | ||
118 | #define SET_MPS_MAC_ADDR 108 | ||
119 | #define CLEAN_UP_AND_EXIT 109 | ||
120 | #define SET_MPC_PARAMS 110 /* MPC configuration parameters */ | ||
121 | |||
122 | /* Message types - bidirectional */ | ||
123 | |||
124 | #define RELOAD 301 /* kill -HUP the daemon for reload */ | ||
125 | |||
126 | #endif /* _ATMMPC_H_ */ | ||
diff --git a/include/linux/atmppp.h b/include/linux/atmppp.h new file mode 100644 index 00000000000..300dcce0c83 --- /dev/null +++ b/include/linux/atmppp.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* atmppp.h - RFC2364 PPPoATM */ | ||
2 | |||
3 | /* Written 2000 by Mitchell Blank Jr */ | ||
4 | |||
5 | #ifndef _LINUX_ATMPPP_H | ||
6 | #define _LINUX_ATMPPP_H | ||
7 | |||
8 | #include <linux/atm.h> | ||
9 | |||
10 | #define PPPOATM_ENCAPS_AUTODETECT (0) | ||
11 | #define PPPOATM_ENCAPS_VC (1) | ||
12 | #define PPPOATM_ENCAPS_LLC (2) | ||
13 | |||
14 | /* | ||
15 | * This is for the ATM_SETBACKEND call - these are like socket families: | ||
16 | * the first element of the structure is the backend number and the rest | ||
17 | * is per-backend specific | ||
18 | */ | ||
19 | struct atm_backend_ppp { | ||
20 | atm_backend_t backend_num; /* ATM_BACKEND_PPP */ | ||
21 | int encaps; /* PPPOATM_ENCAPS_* */ | ||
22 | }; | ||
23 | |||
24 | #endif /* _LINUX_ATMPPP_H */ | ||
diff --git a/include/linux/atmsap.h b/include/linux/atmsap.h new file mode 100644 index 00000000000..799b104515d --- /dev/null +++ b/include/linux/atmsap.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* atmsap.h - ATM Service Access Point addressing definitions */ | ||
2 | |||
3 | /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | ||
4 | |||
5 | |||
6 | #ifndef _LINUX_ATMSAP_H | ||
7 | #define _LINUX_ATMSAP_H | ||
8 | |||
9 | #include <linux/atmapi.h> | ||
10 | |||
11 | /* | ||
12 | * BEGIN_xx and END_xx markers are used for automatic generation of | ||
13 | * documentation. Do not change them. | ||
14 | */ | ||
15 | |||
16 | |||
17 | /* | ||
18 | * Layer 2 protocol identifiers | ||
19 | */ | ||
20 | |||
21 | /* BEGIN_L2 */ | ||
22 | #define ATM_L2_NONE 0 /* L2 not specified */ | ||
23 | #define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ | ||
24 | #define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ | ||
25 | #define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ | ||
26 | #define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ | ||
27 | #define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ | ||
28 | #define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ | ||
29 | #define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ | ||
30 | #define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ | ||
31 | #define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ | ||
32 | #define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ | ||
33 | #define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ | ||
34 | #define ATM_L2_USER 0x10 /* user-specified */ | ||
35 | #define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ | ||
36 | /* END_L2 */ | ||
37 | |||
38 | |||
39 | /* | ||
40 | * Layer 3 protocol identifiers | ||
41 | */ | ||
42 | |||
43 | /* BEGIN_L3 */ | ||
44 | #define ATM_L3_NONE 0 /* L3 not specified */ | ||
45 | #define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ | ||
46 | #define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ | ||
47 | #define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ | ||
48 | #define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ | ||
49 | #define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ | ||
50 | #define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ | ||
51 | #define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ | ||
52 | #define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ | ||
53 | #define ATM_L3_USER 0x10 /* user-specified */ | ||
54 | /* END_L3 */ | ||
55 | |||
56 | |||
57 | /* | ||
58 | * High layer identifiers | ||
59 | */ | ||
60 | |||
61 | /* BEGIN_HL */ | ||
62 | #define ATM_HL_NONE 0 /* HL not specified */ | ||
63 | #define ATM_HL_ISO 0x01 /* ISO */ | ||
64 | #define ATM_HL_USER 0x02 /* user-specific */ | ||
65 | #define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ | ||
66 | #define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ | ||
67 | /* END_HL */ | ||
68 | |||
69 | |||
70 | /* | ||
71 | * ITU-T coded mode of operation | ||
72 | */ | ||
73 | |||
74 | /* BEGIN_IMD */ | ||
75 | #define ATM_IMD_NONE 0 /* mode not specified */ | ||
76 | #define ATM_IMD_NORMAL 1 /* normal mode of operation */ | ||
77 | #define ATM_IMD_EXTENDED 2 /* extended mode of operation */ | ||
78 | /* END_IMD */ | ||
79 | |||
80 | /* | ||
81 | * H.310 code points | ||
82 | */ | ||
83 | |||
84 | #define ATM_TT_NONE 0 /* terminal type not specified */ | ||
85 | #define ATM_TT_RX 1 /* receive only */ | ||
86 | #define ATM_TT_TX 2 /* send only */ | ||
87 | #define ATM_TT_RXTX 3 /* receive and send */ | ||
88 | |||
89 | #define ATM_MC_NONE 0 /* no multiplexing */ | ||
90 | #define ATM_MC_TS 1 /* transport stream (TS) */ | ||
91 | #define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ | ||
92 | #define ATM_MC_PS 3 /* program stream (PS) */ | ||
93 | #define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ | ||
94 | #define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ | ||
95 | |||
96 | /* | ||
97 | * SAP structures | ||
98 | */ | ||
99 | |||
100 | #define ATM_MAX_HLI 8 /* maximum high-layer information length */ | ||
101 | |||
102 | |||
103 | struct atm_blli { | ||
104 | unsigned char l2_proto; /* layer 2 protocol */ | ||
105 | union { | ||
106 | struct { | ||
107 | unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ | ||
108 | /* absent */ | ||
109 | unsigned char window; /* window size (k), 1-127 (0 to omit) */ | ||
110 | } itu; /* ITU-T encoding */ | ||
111 | unsigned char user; /* user-specified l2 information */ | ||
112 | } l2; | ||
113 | unsigned char l3_proto; /* layer 3 protocol */ | ||
114 | union { | ||
115 | struct { | ||
116 | unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ | ||
117 | /* absent */ | ||
118 | unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ | ||
119 | /* omit) */ | ||
120 | unsigned char window;/* packet window size, 1-127 (0 to omit) */ | ||
121 | } itu; /* ITU-T encoding */ | ||
122 | unsigned char user; /* user specified l3 information */ | ||
123 | struct { /* if l3_proto = ATM_L3_H310 */ | ||
124 | unsigned char term_type; /* terminal type */ | ||
125 | unsigned char fw_mpx_cap; /* forward multiplexing capability */ | ||
126 | /* only if term_type != ATM_TT_NONE */ | ||
127 | unsigned char bw_mpx_cap; /* backward multiplexing capability */ | ||
128 | /* only if term_type != ATM_TT_NONE */ | ||
129 | } h310; | ||
130 | struct { /* if l3_proto = ATM_L3_TR9577 */ | ||
131 | unsigned char ipi; /* initial protocol id */ | ||
132 | unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ | ||
133 | /* (only if ipi == NLPID_IEEE802_1_SNAP) */ | ||
134 | } tr9577; | ||
135 | } l3; | ||
136 | } __ATM_API_ALIGN; | ||
137 | |||
138 | |||
139 | struct atm_bhli { | ||
140 | unsigned char hl_type; /* high layer information type */ | ||
141 | unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ | ||
142 | /* hl_type == ATM_HL_ISO) */ | ||
143 | unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ | ||
144 | }; | ||
145 | |||
146 | |||
147 | #define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ | ||
148 | |||
149 | |||
150 | struct atm_sap { | ||
151 | struct atm_bhli bhli; /* local SAP, high-layer information */ | ||
152 | struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; | ||
153 | /* local SAP, low-layer info */ | ||
154 | }; | ||
155 | |||
156 | |||
157 | static __inline__ int blli_in_use(struct atm_blli blli) | ||
158 | { | ||
159 | return blli.l2_proto || blli.l3_proto; | ||
160 | } | ||
161 | |||
162 | #endif | ||
diff --git a/include/linux/atmsvc.h b/include/linux/atmsvc.h new file mode 100644 index 00000000000..aa71583b8da --- /dev/null +++ b/include/linux/atmsvc.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* atmsvc.h - ATM signaling kernel-demon interface definitions */ | ||
2 | |||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | ||
4 | |||
5 | |||
6 | #ifndef _LINUX_ATMSVC_H | ||
7 | #define _LINUX_ATMSVC_H | ||
8 | |||
9 | #include <linux/atmapi.h> | ||
10 | #include <linux/atm.h> | ||
11 | #include <linux/atmioc.h> | ||
12 | |||
13 | |||
14 | #define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL) | ||
15 | /* become ATM signaling demon control socket */ | ||
16 | |||
17 | enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject, | ||
18 | as_listen, as_okay, as_error, as_indicate, as_close, | ||
19 | as_itf_notify, as_modify, as_identify, as_terminate, | ||
20 | as_addparty, as_dropparty }; | ||
21 | |||
22 | struct atmsvc_msg { | ||
23 | enum atmsvc_msg_type type; | ||
24 | atm_kptr_t vcc; | ||
25 | atm_kptr_t listen_vcc; /* indicate */ | ||
26 | int reply; /* for okay and close: */ | ||
27 | /* < 0: error before active */ | ||
28 | /* (sigd has discarded ctx) */ | ||
29 | /* ==0: success */ | ||
30 | /* > 0: error when active (still */ | ||
31 | /* need to close) */ | ||
32 | struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */ | ||
33 | struct sockaddr_atmsvc local; /* local SVC address */ | ||
34 | struct atm_qos qos; /* QOS parameters */ | ||
35 | struct atm_sap sap; /* SAP */ | ||
36 | unsigned int session; /* for p2pm */ | ||
37 | struct sockaddr_atmsvc svc; /* SVC address */ | ||
38 | } __ATM_API_ALIGN; | ||
39 | |||
40 | /* | ||
41 | * Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz | ||
42 | */ | ||
43 | |||
44 | /* | ||
45 | * Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on | ||
46 | * what PCR is used to request bandwidth from the device driver. net/atm/svc.c | ||
47 | * tries to do better than that, but only if there's no routing decision (i.e. | ||
48 | * if signaling only uses one ATM interface). | ||
49 | */ | ||
50 | |||
51 | #define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \ | ||
52 | (tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \ | ||
53 | (tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR) | ||
54 | |||
55 | #endif | ||
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h new file mode 100644 index 00000000000..e02982fa295 --- /dev/null +++ b/include/linux/auto_fs4.h | |||
@@ -0,0 +1,164 @@ | |||
1 | /* -*- c -*- | ||
2 | * linux/include/linux/auto_fs4.h | ||
3 | * | ||
4 | * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> | ||
5 | * | ||
6 | * This file is part of the Linux kernel and is made available under | ||
7 | * the terms of the GNU General Public License, version 2, or at your | ||
8 | * option, any later version, incorporated herein by reference. | ||
9 | */ | ||
10 | |||
11 | #ifndef _LINUX_AUTO_FS4_H | ||
12 | #define _LINUX_AUTO_FS4_H | ||
13 | |||
14 | /* Include common v3 definitions */ | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/auto_fs.h> | ||
17 | |||
18 | /* autofs v4 definitions */ | ||
19 | #undef AUTOFS_PROTO_VERSION | ||
20 | #undef AUTOFS_MIN_PROTO_VERSION | ||
21 | #undef AUTOFS_MAX_PROTO_VERSION | ||
22 | |||
23 | #define AUTOFS_PROTO_VERSION 5 | ||
24 | #define AUTOFS_MIN_PROTO_VERSION 3 | ||
25 | #define AUTOFS_MAX_PROTO_VERSION 5 | ||
26 | |||
27 | #define AUTOFS_PROTO_SUBVERSION 2 | ||
28 | |||
29 | /* Mask for expire behaviour */ | ||
30 | #define AUTOFS_EXP_IMMEDIATE 1 | ||
31 | #define AUTOFS_EXP_LEAVES 2 | ||
32 | |||
33 | #define AUTOFS_TYPE_ANY 0U | ||
34 | #define AUTOFS_TYPE_INDIRECT 1U | ||
35 | #define AUTOFS_TYPE_DIRECT 2U | ||
36 | #define AUTOFS_TYPE_OFFSET 4U | ||
37 | |||
38 | static inline void set_autofs_type_indirect(unsigned int *type) | ||
39 | { | ||
40 | *type = AUTOFS_TYPE_INDIRECT; | ||
41 | return; | ||
42 | } | ||
43 | |||
44 | static inline unsigned int autofs_type_indirect(unsigned int type) | ||
45 | { | ||
46 | return (type == AUTOFS_TYPE_INDIRECT); | ||
47 | } | ||
48 | |||
49 | static inline void set_autofs_type_direct(unsigned int *type) | ||
50 | { | ||
51 | *type = AUTOFS_TYPE_DIRECT; | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | static inline unsigned int autofs_type_direct(unsigned int type) | ||
56 | { | ||
57 | return (type == AUTOFS_TYPE_DIRECT); | ||
58 | } | ||
59 | |||
60 | static inline void set_autofs_type_offset(unsigned int *type) | ||
61 | { | ||
62 | *type = AUTOFS_TYPE_OFFSET; | ||
63 | return; | ||
64 | } | ||
65 | |||
66 | static inline unsigned int autofs_type_offset(unsigned int type) | ||
67 | { | ||
68 | return (type == AUTOFS_TYPE_OFFSET); | ||
69 | } | ||
70 | |||
71 | static inline unsigned int autofs_type_trigger(unsigned int type) | ||
72 | { | ||
73 | return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET); | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * This isn't really a type as we use it to say "no type set" to | ||
78 | * indicate we want to search for "any" mount in the | ||
79 | * autofs_dev_ioctl_ismountpoint() device ioctl function. | ||
80 | */ | ||
81 | static inline void set_autofs_type_any(unsigned int *type) | ||
82 | { | ||
83 | *type = AUTOFS_TYPE_ANY; | ||
84 | return; | ||
85 | } | ||
86 | |||
87 | static inline unsigned int autofs_type_any(unsigned int type) | ||
88 | { | ||
89 | return (type == AUTOFS_TYPE_ANY); | ||
90 | } | ||
91 | |||
92 | /* Daemon notification packet types */ | ||
93 | enum autofs_notify { | ||
94 | NFY_NONE, | ||
95 | NFY_MOUNT, | ||
96 | NFY_EXPIRE | ||
97 | }; | ||
98 | |||
99 | /* Kernel protocol version 4 packet types */ | ||
100 | |||
101 | /* Expire entry (umount request) */ | ||
102 | #define autofs_ptype_expire_multi 2 | ||
103 | |||
104 | /* Kernel protocol version 5 packet types */ | ||
105 | |||
106 | /* Indirect mount missing and expire requests. */ | ||
107 | #define autofs_ptype_missing_indirect 3 | ||
108 | #define autofs_ptype_expire_indirect 4 | ||
109 | |||
110 | /* Direct mount missing and expire requests */ | ||
111 | #define autofs_ptype_missing_direct 5 | ||
112 | #define autofs_ptype_expire_direct 6 | ||
113 | |||
114 | /* v4 multi expire (via pipe) */ | ||
115 | struct autofs_packet_expire_multi { | ||
116 | struct autofs_packet_hdr hdr; | ||
117 | autofs_wqt_t wait_queue_token; | ||
118 | int len; | ||
119 | char name[NAME_MAX+1]; | ||
120 | }; | ||
121 | |||
122 | union autofs_packet_union { | ||
123 | struct autofs_packet_hdr hdr; | ||
124 | struct autofs_packet_missing missing; | ||
125 | struct autofs_packet_expire expire; | ||
126 | struct autofs_packet_expire_multi expire_multi; | ||
127 | }; | ||
128 | |||
129 | /* autofs v5 common packet struct */ | ||
130 | struct autofs_v5_packet { | ||
131 | struct autofs_packet_hdr hdr; | ||
132 | autofs_wqt_t wait_queue_token; | ||
133 | __u32 dev; | ||
134 | __u64 ino; | ||
135 | __u32 uid; | ||
136 | __u32 gid; | ||
137 | __u32 pid; | ||
138 | __u32 tgid; | ||
139 | __u32 len; | ||
140 | char name[NAME_MAX+1]; | ||
141 | }; | ||
142 | |||
143 | typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; | ||
144 | typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; | ||
145 | typedef struct autofs_v5_packet autofs_packet_missing_direct_t; | ||
146 | typedef struct autofs_v5_packet autofs_packet_expire_direct_t; | ||
147 | |||
148 | union autofs_v5_packet_union { | ||
149 | struct autofs_packet_hdr hdr; | ||
150 | struct autofs_v5_packet v5_packet; | ||
151 | autofs_packet_missing_indirect_t missing_indirect; | ||
152 | autofs_packet_expire_indirect_t expire_indirect; | ||
153 | autofs_packet_missing_direct_t missing_direct; | ||
154 | autofs_packet_expire_direct_t expire_direct; | ||
155 | }; | ||
156 | |||
157 | #define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) | ||
158 | #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI | ||
159 | #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI | ||
160 | #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) | ||
161 | #define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) | ||
162 | |||
163 | |||
164 | #endif /* _LINUX_AUTO_FS4_H */ | ||
diff --git a/include/linux/ax25.h b/include/linux/ax25.h new file mode 100644 index 00000000000..56c11f0dbd8 --- /dev/null +++ b/include/linux/ax25.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * These are the public elements of the Linux kernel AX.25 code. A similar | ||
3 | * file netrom.h exists for the NET/ROM protocol. | ||
4 | */ | ||
5 | |||
6 | #ifndef AX25_KERNEL_H | ||
7 | #define AX25_KERNEL_H | ||
8 | |||
9 | #include <linux/socket.h> | ||
10 | |||
11 | #define AX25_MTU 256 | ||
12 | #define AX25_MAX_DIGIS 8 | ||
13 | |||
14 | #define AX25_WINDOW 1 | ||
15 | #define AX25_T1 2 | ||
16 | #define AX25_N2 3 | ||
17 | #define AX25_T3 4 | ||
18 | #define AX25_T2 5 | ||
19 | #define AX25_BACKOFF 6 | ||
20 | #define AX25_EXTSEQ 7 | ||
21 | #define AX25_PIDINCL 8 | ||
22 | #define AX25_IDLE 9 | ||
23 | #define AX25_PACLEN 10 | ||
24 | #define AX25_IAMDIGI 12 | ||
25 | |||
26 | #define AX25_KILL 99 | ||
27 | |||
28 | #define SIOCAX25GETUID (SIOCPROTOPRIVATE+0) | ||
29 | #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) | ||
30 | #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) | ||
31 | #define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) | ||
32 | #define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) | ||
33 | #define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) | ||
34 | #define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9) | ||
35 | #define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) | ||
36 | #define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) | ||
37 | #define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12) | ||
38 | #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13) | ||
39 | |||
40 | #define AX25_SET_RT_IPMODE 2 | ||
41 | |||
42 | #define AX25_NOUID_DEFAULT 0 | ||
43 | #define AX25_NOUID_BLOCK 1 | ||
44 | |||
45 | typedef struct { | ||
46 | char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ | ||
47 | } ax25_address; | ||
48 | |||
49 | struct sockaddr_ax25 { | ||
50 | sa_family_t sax25_family; | ||
51 | ax25_address sax25_call; | ||
52 | int sax25_ndigis; | ||
53 | /* Digipeater ax25_address sets follow */ | ||
54 | }; | ||
55 | |||
56 | #define sax25_uid sax25_ndigis | ||
57 | |||
58 | struct full_sockaddr_ax25 { | ||
59 | struct sockaddr_ax25 fsa_ax25; | ||
60 | ax25_address fsa_digipeater[AX25_MAX_DIGIS]; | ||
61 | }; | ||
62 | |||
63 | struct ax25_routes_struct { | ||
64 | ax25_address port_addr; | ||
65 | ax25_address dest_addr; | ||
66 | unsigned char digi_count; | ||
67 | ax25_address digi_addr[AX25_MAX_DIGIS]; | ||
68 | }; | ||
69 | |||
70 | struct ax25_route_opt_struct { | ||
71 | ax25_address port_addr; | ||
72 | ax25_address dest_addr; | ||
73 | int cmd; | ||
74 | int arg; | ||
75 | }; | ||
76 | |||
77 | struct ax25_ctl_struct { | ||
78 | ax25_address port_addr; | ||
79 | ax25_address source_addr; | ||
80 | ax25_address dest_addr; | ||
81 | unsigned int cmd; | ||
82 | unsigned long arg; | ||
83 | unsigned char digi_count; | ||
84 | ax25_address digi_addr[AX25_MAX_DIGIS]; | ||
85 | }; | ||
86 | |||
87 | /* this will go away. Please do not export to user land */ | ||
88 | struct ax25_info_struct_deprecated { | ||
89 | unsigned int n2, n2count; | ||
90 | unsigned int t1, t1timer; | ||
91 | unsigned int t2, t2timer; | ||
92 | unsigned int t3, t3timer; | ||
93 | unsigned int idle, idletimer; | ||
94 | unsigned int state; | ||
95 | unsigned int rcv_q, snd_q; | ||
96 | }; | ||
97 | |||
98 | struct ax25_info_struct { | ||
99 | unsigned int n2, n2count; | ||
100 | unsigned int t1, t1timer; | ||
101 | unsigned int t2, t2timer; | ||
102 | unsigned int t3, t3timer; | ||
103 | unsigned int idle, idletimer; | ||
104 | unsigned int state; | ||
105 | unsigned int rcv_q, snd_q; | ||
106 | unsigned int vs, vr, va, vs_max; | ||
107 | unsigned int paclen; | ||
108 | unsigned int window; | ||
109 | }; | ||
110 | |||
111 | struct ax25_fwd_struct { | ||
112 | ax25_address port_from; | ||
113 | ax25_address port_to; | ||
114 | }; | ||
115 | |||
116 | #endif | ||
diff --git a/include/linux/b1lli.h b/include/linux/b1lli.h new file mode 100644 index 00000000000..713f712685d --- /dev/null +++ b/include/linux/b1lli.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $ | ||
2 | * | ||
3 | * ISDN lowlevel-module for AVM B1-card. | ||
4 | * | ||
5 | * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _B1LLI_H_ | ||
13 | #define _B1LLI_H_ | ||
14 | /* | ||
15 | * struct for loading t4 file | ||
16 | */ | ||
17 | typedef struct avmb1_t4file { | ||
18 | int len; | ||
19 | unsigned char *data; | ||
20 | } avmb1_t4file; | ||
21 | |||
22 | typedef struct avmb1_loaddef { | ||
23 | int contr; | ||
24 | avmb1_t4file t4file; | ||
25 | } avmb1_loaddef; | ||
26 | |||
27 | typedef struct avmb1_loadandconfigdef { | ||
28 | int contr; | ||
29 | avmb1_t4file t4file; | ||
30 | avmb1_t4file t4config; | ||
31 | } avmb1_loadandconfigdef; | ||
32 | |||
33 | typedef struct avmb1_resetdef { | ||
34 | int contr; | ||
35 | } avmb1_resetdef; | ||
36 | |||
37 | typedef struct avmb1_getdef { | ||
38 | int contr; | ||
39 | int cardtype; | ||
40 | int cardstate; | ||
41 | } avmb1_getdef; | ||
42 | |||
43 | /* | ||
44 | * struct for adding new cards | ||
45 | */ | ||
46 | typedef struct avmb1_carddef { | ||
47 | int port; | ||
48 | int irq; | ||
49 | } avmb1_carddef; | ||
50 | |||
51 | #define AVM_CARDTYPE_B1 0 | ||
52 | #define AVM_CARDTYPE_T1 1 | ||
53 | #define AVM_CARDTYPE_M1 2 | ||
54 | #define AVM_CARDTYPE_M2 3 | ||
55 | |||
56 | typedef struct avmb1_extcarddef { | ||
57 | int port; | ||
58 | int irq; | ||
59 | int cardtype; | ||
60 | int cardnr; /* for HEMA/T1 */ | ||
61 | } avmb1_extcarddef; | ||
62 | |||
63 | #define AVMB1_LOAD 0 /* load image to card */ | ||
64 | #define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */ | ||
65 | #define AVMB1_RESETCARD 2 /* reset a card */ | ||
66 | #define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */ | ||
67 | #define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */ | ||
68 | #define AVMB1_GET_CARDINFO 5 /* get cardtype */ | ||
69 | #define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */ | ||
70 | |||
71 | #define AVMB1_REGISTERCARD_IS_OBSOLETE | ||
72 | |||
73 | #endif /* _B1LLI_H_ */ | ||
diff --git a/include/linux/baycom.h b/include/linux/baycom.h new file mode 100644 index 00000000000..81249e029da --- /dev/null +++ b/include/linux/baycom.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * The Linux BAYCOM driver for the Baycom serial 1200 baud modem | ||
3 | * and the parallel 9600 baud modem | ||
4 | * (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA | ||
5 | */ | ||
6 | |||
7 | #ifndef _BAYCOM_H | ||
8 | #define _BAYCOM_H | ||
9 | |||
10 | /* -------------------------------------------------------------------- */ | ||
11 | /* | ||
12 | * structs for the IOCTL commands | ||
13 | */ | ||
14 | |||
15 | struct baycom_debug_data { | ||
16 | unsigned long debug1; | ||
17 | unsigned long debug2; | ||
18 | long debug3; | ||
19 | }; | ||
20 | |||
21 | struct baycom_ioctl { | ||
22 | int cmd; | ||
23 | union { | ||
24 | struct baycom_debug_data dbg; | ||
25 | } data; | ||
26 | }; | ||
27 | |||
28 | /* -------------------------------------------------------------------- */ | ||
29 | |||
30 | /* | ||
31 | * ioctl values change for baycom | ||
32 | */ | ||
33 | #define BAYCOMCTL_GETDEBUG 0x92 | ||
34 | |||
35 | /* -------------------------------------------------------------------- */ | ||
36 | |||
37 | #endif /* _BAYCOM_H */ | ||
38 | |||
39 | /* --------------------------------------------------------------------- */ | ||
diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h new file mode 100644 index 00000000000..1c0b355aa51 --- /dev/null +++ b/include/linux/bfs_fs.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * include/linux/bfs_fs.h - BFS data structures on disk. | ||
3 | * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_BFS_FS_H | ||
7 | #define _LINUX_BFS_FS_H | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | |||
11 | #define BFS_BSIZE_BITS 9 | ||
12 | #define BFS_BSIZE (1<<BFS_BSIZE_BITS) | ||
13 | |||
14 | #define BFS_MAGIC 0x1BADFACE | ||
15 | #define BFS_ROOT_INO 2 | ||
16 | #define BFS_INODES_PER_BLOCK 8 | ||
17 | |||
18 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ | ||
19 | #define BFS_VDIR 2L | ||
20 | #define BFS_VREG 1L | ||
21 | |||
22 | /* BFS inode layout on disk */ | ||
23 | struct bfs_inode { | ||
24 | __le16 i_ino; | ||
25 | __u16 i_unused; | ||
26 | __le32 i_sblock; | ||
27 | __le32 i_eblock; | ||
28 | __le32 i_eoffset; | ||
29 | __le32 i_vtype; | ||
30 | __le32 i_mode; | ||
31 | __le32 i_uid; | ||
32 | __le32 i_gid; | ||
33 | __le32 i_nlink; | ||
34 | __le32 i_atime; | ||
35 | __le32 i_mtime; | ||
36 | __le32 i_ctime; | ||
37 | __u32 i_padding[4]; | ||
38 | }; | ||
39 | |||
40 | #define BFS_NAMELEN 14 | ||
41 | #define BFS_DIRENT_SIZE 16 | ||
42 | #define BFS_DIRS_PER_BLOCK 32 | ||
43 | |||
44 | struct bfs_dirent { | ||
45 | __le16 ino; | ||
46 | char name[BFS_NAMELEN]; | ||
47 | }; | ||
48 | |||
49 | /* BFS superblock layout on disk */ | ||
50 | struct bfs_super_block { | ||
51 | __le32 s_magic; | ||
52 | __le32 s_start; | ||
53 | __le32 s_end; | ||
54 | __le32 s_from; | ||
55 | __le32 s_to; | ||
56 | __s32 s_bfrom; | ||
57 | __s32 s_bto; | ||
58 | char s_fsname[6]; | ||
59 | char s_volume[6]; | ||
60 | __u32 s_padding[118]; | ||
61 | }; | ||
62 | |||
63 | |||
64 | #define BFS_OFF2INO(offset) \ | ||
65 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) | ||
66 | |||
67 | #define BFS_INO2OFF(ino) \ | ||
68 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) | ||
69 | #define BFS_NZFILESIZE(ip) \ | ||
70 | ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) | ||
71 | |||
72 | #define BFS_FILESIZE(ip) \ | ||
73 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
74 | |||
75 | #define BFS_FILEBLOCKS(ip) \ | ||
76 | ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) | ||
77 | #define BFS_UNCLEAN(bfs_sb, sb) \ | ||
78 | ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) | ||
79 | |||
80 | |||
81 | #endif /* _LINUX_BFS_FS_H */ | ||
diff --git a/include/linux/blkpg.h b/include/linux/blkpg.h new file mode 100644 index 00000000000..faf8a45af21 --- /dev/null +++ b/include/linux/blkpg.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef _LINUX_BLKPG_H | ||
2 | #define _LINUX_BLKPG_H | ||
3 | |||
4 | /* | ||
5 | * Partition table and disk geometry handling | ||
6 | * | ||
7 | * A single ioctl with lots of subfunctions: | ||
8 | * | ||
9 | * Device number stuff: | ||
10 | * get_whole_disk() (given the device number of a partition, | ||
11 | * find the device number of the encompassing disk) | ||
12 | * get_all_partitions() (given the device number of a disk, return the | ||
13 | * device numbers of all its known partitions) | ||
14 | * | ||
15 | * Partition stuff: | ||
16 | * add_partition() | ||
17 | * delete_partition() | ||
18 | * test_partition_in_use() (also for test_disk_in_use) | ||
19 | * | ||
20 | * Geometry stuff: | ||
21 | * get_geometry() | ||
22 | * set_geometry() | ||
23 | * get_bios_drivedata() | ||
24 | * | ||
25 | * For today, only the partition stuff - aeb, 990515 | ||
26 | */ | ||
27 | #include <linux/compiler.h> | ||
28 | #include <linux/ioctl.h> | ||
29 | |||
30 | #define BLKPG _IO(0x12,105) | ||
31 | |||
32 | /* The argument structure */ | ||
33 | struct blkpg_ioctl_arg { | ||
34 | int op; | ||
35 | int flags; | ||
36 | int datalen; | ||
37 | void __user *data; | ||
38 | }; | ||
39 | |||
40 | /* The subfunctions (for the op field) */ | ||
41 | #define BLKPG_ADD_PARTITION 1 | ||
42 | #define BLKPG_DEL_PARTITION 2 | ||
43 | |||
44 | /* Sizes of name fields. Unused at present. */ | ||
45 | #define BLKPG_DEVNAMELTH 64 | ||
46 | #define BLKPG_VOLNAMELTH 64 | ||
47 | |||
48 | /* The data structure for ADD_PARTITION and DEL_PARTITION */ | ||
49 | struct blkpg_partition { | ||
50 | long long start; /* starting offset in bytes */ | ||
51 | long long length; /* length in bytes */ | ||
52 | int pno; /* partition number */ | ||
53 | char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, | ||
54 | to be used in kernel messages */ | ||
55 | char volname[BLKPG_VOLNAMELTH]; /* volume label */ | ||
56 | }; | ||
57 | |||
58 | #endif /* _LINUX_BLKPG_H */ | ||
diff --git a/include/linux/bpqether.h b/include/linux/bpqether.h new file mode 100644 index 00000000000..a6c35e1a89a --- /dev/null +++ b/include/linux/bpqether.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef __BPQETHER_H | ||
2 | #define __BPQETHER_H | ||
3 | |||
4 | /* | ||
5 | * Defines for the BPQETHER pseudo device driver | ||
6 | */ | ||
7 | |||
8 | #ifndef __LINUX_IF_ETHER_H | ||
9 | #include <linux/if_ether.h> | ||
10 | #endif | ||
11 | |||
12 | #define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */ | ||
13 | #define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1) | ||
14 | |||
15 | struct bpq_ethaddr { | ||
16 | unsigned char destination[ETH_ALEN]; | ||
17 | unsigned char accept[ETH_ALEN]; | ||
18 | }; | ||
19 | |||
20 | /* | ||
21 | * For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers, | ||
22 | * currently not implemented, though. If someone wants to hook a radio | ||
23 | * to his Ethernet card he may find this useful. ;-) | ||
24 | */ | ||
25 | |||
26 | #define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */ | ||
27 | #define SIOCSBPQETHPARAM 0x5001 /* set */ | ||
28 | |||
29 | struct bpq_req { | ||
30 | int cmd; | ||
31 | int speed; /* unused */ | ||
32 | int clockmode; /* unused */ | ||
33 | int txdelay; | ||
34 | unsigned char persist; /* unused */ | ||
35 | int slotime; /* unused */ | ||
36 | int squeldelay; | ||
37 | int dmachan; /* unused */ | ||
38 | int irq; /* unused */ | ||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/include/linux/bq27x00.h b/include/linux/bq27x00.h new file mode 100644 index 00000000000..b95cd203523 --- /dev/null +++ b/include/linux/bq27x00.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * include/linux/bq27x00.h | ||
3 | * | ||
4 | * BQ27x00 battery driver | ||
5 | * | ||
6 | * Copyright (c) 2011, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX_BQ27x00_H | ||
24 | #define _LINUX_BQ27x00_H | ||
25 | |||
26 | struct bq27x00_platform_data { | ||
27 | int ac_persent_gpio; | ||
28 | }; | ||
29 | |||
30 | #endif /* _LINUX_BQ27x00_H */ | ||
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild new file mode 100644 index 00000000000..5896e344ba6 --- /dev/null +++ b/include/linux/byteorder/Kbuild | |||
@@ -0,0 +1,2 @@ | |||
1 | header-y += big_endian.h | ||
2 | header-y += little_endian.h | ||
diff --git a/include/linux/caif/Kbuild b/include/linux/caif/Kbuild new file mode 100644 index 00000000000..a9cf250689d --- /dev/null +++ b/include/linux/caif/Kbuild | |||
@@ -0,0 +1,2 @@ | |||
1 | header-y += caif_socket.h | ||
2 | header-y += if_caif.h | ||
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h new file mode 100644 index 00000000000..d9cb19b7cff --- /dev/null +++ b/include/linux/caif/caif_socket.h | |||
@@ -0,0 +1,199 @@ | |||
1 | /* linux/caif_socket.h | ||
2 | * CAIF Definitions for CAIF socket and network layer | ||
3 | * Copyright (C) ST-Ericsson AB 2010 | ||
4 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | */ | ||
7 | |||
8 | #ifndef _LINUX_CAIF_SOCKET_H | ||
9 | #define _LINUX_CAIF_SOCKET_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | #include <linux/socket.h> | ||
15 | #else | ||
16 | #include <sys/socket.h> | ||
17 | #endif | ||
18 | |||
19 | /** | ||
20 | * enum caif_link_selector - Physical Link Selection. | ||
21 | * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth | ||
22 | * traffic. | ||
23 | * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency | ||
24 | * traffic. | ||
25 | * | ||
26 | * CAIF Link Layers can register their link properties. | ||
27 | * This enum is used for choosing between CAIF Link Layers when | ||
28 | * setting up CAIF Channels when multiple CAIF Link Layers exists. | ||
29 | */ | ||
30 | enum caif_link_selector { | ||
31 | CAIF_LINK_HIGH_BANDW, | ||
32 | CAIF_LINK_LOW_LATENCY | ||
33 | }; | ||
34 | |||
35 | /** | ||
36 | * enum caif_channel_priority - CAIF channel priorities. | ||
37 | * | ||
38 | * @CAIF_PRIO_MIN: Min priority for a channel. | ||
39 | * @CAIF_PRIO_LOW: Low-priority channel. | ||
40 | * @CAIF_PRIO_NORMAL: Normal/default priority level. | ||
41 | * @CAIF_PRIO_HIGH: High priority level | ||
42 | * @CAIF_PRIO_MAX: Max priority for channel | ||
43 | * | ||
44 | * Priority can be set on CAIF Channels in order to | ||
45 | * prioritize between traffic on different CAIF Channels. | ||
46 | * These priority levels are recommended, but the priority value | ||
47 | * is not restricted to the values defined in this enum, any value | ||
48 | * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. | ||
49 | */ | ||
50 | enum caif_channel_priority { | ||
51 | CAIF_PRIO_MIN = 0x01, | ||
52 | CAIF_PRIO_LOW = 0x04, | ||
53 | CAIF_PRIO_NORMAL = 0x0f, | ||
54 | CAIF_PRIO_HIGH = 0x14, | ||
55 | CAIF_PRIO_MAX = 0x1F | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * enum caif_protocol_type - CAIF Channel type. | ||
60 | * @CAIFPROTO_AT: Classic AT channel. | ||
61 | * @CAIFPROTO_DATAGRAM: Datagram channel. | ||
62 | * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. | ||
63 | * @CAIFPROTO_UTIL: Utility (Psock) channel. | ||
64 | * @CAIFPROTO_RFM: Remote File Manager | ||
65 | * @CAIFPROTO_DEBUG: Debug link | ||
66 | * | ||
67 | * This enum defines the CAIF Channel type to be used. This defines | ||
68 | * the service to connect to on the modem. | ||
69 | */ | ||
70 | enum caif_protocol_type { | ||
71 | CAIFPROTO_AT, | ||
72 | CAIFPROTO_DATAGRAM, | ||
73 | CAIFPROTO_DATAGRAM_LOOP, | ||
74 | CAIFPROTO_UTIL, | ||
75 | CAIFPROTO_RFM, | ||
76 | CAIFPROTO_DEBUG, | ||
77 | _CAIFPROTO_MAX | ||
78 | }; | ||
79 | #define CAIFPROTO_MAX _CAIFPROTO_MAX | ||
80 | |||
81 | /** | ||
82 | * enum caif_at_type - AT Service Endpoint | ||
83 | * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel. | ||
84 | */ | ||
85 | enum caif_at_type { | ||
86 | CAIF_ATTYPE_PLAIN = 2 | ||
87 | }; | ||
88 | /** | ||
89 | * enum caif_debug_type - Content selection for debug connection | ||
90 | * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain | ||
91 | * both trace and interactive debug. | ||
92 | * @CAIF_DEBUG_TRACE: Connection contains trace only. | ||
93 | * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug. | ||
94 | */ | ||
95 | enum caif_debug_type { | ||
96 | CAIF_DEBUG_TRACE_INTERACTIVE = 0, | ||
97 | CAIF_DEBUG_TRACE, | ||
98 | CAIF_DEBUG_INTERACTIVE, | ||
99 | }; | ||
100 | |||
101 | /** | ||
102 | * enum caif_debug_service - Debug Service Endpoint | ||
103 | * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system | ||
104 | * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system | ||
105 | */ | ||
106 | enum caif_debug_service { | ||
107 | CAIF_RADIO_DEBUG_SERVICE = 1, | ||
108 | CAIF_APP_DEBUG_SERVICE | ||
109 | }; | ||
110 | |||
111 | /** | ||
112 | * struct sockaddr_caif - the sockaddr structure for CAIF sockets. | ||
113 | * @family: Address family number, must be AF_CAIF. | ||
114 | * @u: Union of address data 'switched' by family. | ||
115 | * : | ||
116 | * @u.at: Applies when family = CAIFPROTO_AT. | ||
117 | * | ||
118 | * @u.at.type: Type of AT link to set up (enum caif_at_type). | ||
119 | * | ||
120 | * @u.util: Applies when family = CAIFPROTO_UTIL | ||
121 | * | ||
122 | * @u.util.service: Utility service name. | ||
123 | * | ||
124 | * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM | ||
125 | * | ||
126 | * @u.dgm.connection_id: Datagram connection id. | ||
127 | * | ||
128 | * @u.dgm.nsapi: NSAPI of the PDP-Context. | ||
129 | * | ||
130 | * @u.rfm: Applies when family = CAIFPROTO_RFM | ||
131 | * | ||
132 | * @u.rfm.connection_id: Connection ID for RFM. | ||
133 | * | ||
134 | * @u.rfm.volume: Volume to mount. | ||
135 | * | ||
136 | * @u.dbg: Applies when family = CAIFPROTO_DEBUG. | ||
137 | * | ||
138 | * @u.dbg.type: Type of debug connection to set up | ||
139 | * (caif_debug_type). | ||
140 | * | ||
141 | * @u.dbg.service: Service sub-system to connect (caif_debug_service | ||
142 | * Description: | ||
143 | * This structure holds the connect parameters used for setting up a | ||
144 | * CAIF Channel. It defines the service to connect to on the modem. | ||
145 | */ | ||
146 | struct sockaddr_caif { | ||
147 | sa_family_t family; | ||
148 | union { | ||
149 | struct { | ||
150 | __u8 type; /* type: enum caif_at_type */ | ||
151 | } at; /* CAIFPROTO_AT */ | ||
152 | struct { | ||
153 | char service[16]; | ||
154 | } util; /* CAIFPROTO_UTIL */ | ||
155 | union { | ||
156 | __u32 connection_id; | ||
157 | __u8 nsapi; | ||
158 | } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/ | ||
159 | struct { | ||
160 | __u32 connection_id; | ||
161 | char volume[16]; | ||
162 | } rfm; /* CAIFPROTO_RFM */ | ||
163 | struct { | ||
164 | __u8 type; /* type:enum caif_debug_type */ | ||
165 | __u8 service; /* service:caif_debug_service */ | ||
166 | } dbg; /* CAIFPROTO_DEBUG */ | ||
167 | } u; | ||
168 | }; | ||
169 | |||
170 | /** | ||
171 | * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. | ||
172 | * | ||
173 | * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are | ||
174 | * available. Either a high bandwidth | ||
175 | * link can be selected (CAIF_LINK_HIGH_BANDW) or | ||
176 | * or a low latency link (CAIF_LINK_LOW_LATENCY). | ||
177 | * This option is of type __u32. | ||
178 | * Alternatively SO_BINDTODEVICE can be used. | ||
179 | * | ||
180 | * @CAIFSO_REQ_PARAM: Used to set the request parameters for a | ||
181 | * utility channel. (maximum 256 bytes). This | ||
182 | * option must be set before connecting. | ||
183 | * | ||
184 | * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility | ||
185 | * channel. (maximum 256 bytes). This option | ||
186 | * is valid after a successful connect. | ||
187 | * | ||
188 | * | ||
189 | * This enum defines the CAIF Socket options to be used on a socket | ||
190 | * of type PF_CAIF. | ||
191 | * | ||
192 | */ | ||
193 | enum caif_socket_opts { | ||
194 | CAIFSO_LINK_SELECT = 127, | ||
195 | CAIFSO_REQ_PARAM = 128, | ||
196 | CAIFSO_RSP_PARAM = 129, | ||
197 | }; | ||
198 | |||
199 | #endif /* _LINUX_CAIF_SOCKET_H */ | ||
diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h new file mode 100644 index 00000000000..5e7eed4edf5 --- /dev/null +++ b/include/linux/caif/if_caif.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef IF_CAIF_H_ | ||
8 | #define IF_CAIF_H_ | ||
9 | #include <linux/sockios.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/socket.h> | ||
12 | |||
13 | /** | ||
14 | * enum ifla_caif - CAIF NetlinkRT parameters. | ||
15 | * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context. | ||
16 | * The type of attribute is NLA_U32. | ||
17 | * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context. | ||
18 | * The type of attribute is NLA_U32. | ||
19 | * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback | ||
20 | * The type of attribute is NLA_U8. | ||
21 | * | ||
22 | * When using RT Netlink to create, destroy or configure a CAIF IP interface, | ||
23 | * enum ifla_caif is used to specify the configuration attributes. | ||
24 | */ | ||
25 | enum ifla_caif { | ||
26 | __IFLA_CAIF_UNSPEC, | ||
27 | IFLA_CAIF_IPV4_CONNID, | ||
28 | IFLA_CAIF_IPV6_CONNID, | ||
29 | IFLA_CAIF_LOOPBACK, | ||
30 | __IFLA_CAIF_MAX | ||
31 | }; | ||
32 | #define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) | ||
33 | |||
34 | #endif /*IF_CAIF_H_*/ | ||
diff --git a/include/linux/can.h b/include/linux/can.h new file mode 100644 index 00000000000..d18333302cb --- /dev/null +++ b/include/linux/can.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * linux/can.h | ||
3 | * | ||
4 | * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) | ||
5 | * | ||
6 | * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Urs Thuermann <urs.thuermann@volkswagen.de> | ||
8 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef CAN_H | ||
16 | #define CAN_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | #include <linux/socket.h> | ||
20 | |||
21 | /* controller area network (CAN) kernel definitions */ | ||
22 | |||
23 | /* special address description flags for the CAN_ID */ | ||
24 | #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ | ||
25 | #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ | ||
26 | #define CAN_ERR_FLAG 0x20000000U /* error frame */ | ||
27 | |||
28 | /* valid bits in CAN ID for frame formats */ | ||
29 | #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ | ||
30 | #define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ | ||
31 | #define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ | ||
32 | |||
33 | /* | ||
34 | * Controller Area Network Identifier structure | ||
35 | * | ||
36 | * bit 0-28 : CAN identifier (11/29 bit) | ||
37 | * bit 29 : error frame flag (0 = data frame, 1 = error frame) | ||
38 | * bit 30 : remote transmission request flag (1 = rtr frame) | ||
39 | * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) | ||
40 | */ | ||
41 | typedef __u32 canid_t; | ||
42 | |||
43 | /* | ||
44 | * Controller Area Network Error Frame Mask structure | ||
45 | * | ||
46 | * bit 0-28 : error class mask (see include/linux/can/error.h) | ||
47 | * bit 29-31 : set to zero | ||
48 | */ | ||
49 | typedef __u32 can_err_mask_t; | ||
50 | |||
51 | /** | ||
52 | * struct can_frame - basic CAN frame structure | ||
53 | * @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above. | ||
54 | * @can_dlc: the data length field of the CAN frame | ||
55 | * @data: the CAN frame payload. | ||
56 | */ | ||
57 | struct can_frame { | ||
58 | canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ | ||
59 | __u8 can_dlc; /* data length code: 0 .. 8 */ | ||
60 | __u8 data[8] __attribute__((aligned(8))); | ||
61 | }; | ||
62 | |||
63 | /* particular protocols of the protocol family PF_CAN */ | ||
64 | #define CAN_RAW 1 /* RAW sockets */ | ||
65 | #define CAN_BCM 2 /* Broadcast Manager */ | ||
66 | #define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ | ||
67 | #define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ | ||
68 | #define CAN_MCNET 5 /* Bosch MCNet */ | ||
69 | #define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ | ||
70 | #define CAN_NPROTO 7 | ||
71 | |||
72 | #define SOL_CAN_BASE 100 | ||
73 | |||
74 | /** | ||
75 | * struct sockaddr_can - the sockaddr structure for CAN sockets | ||
76 | * @can_family: address family number AF_CAN. | ||
77 | * @can_ifindex: CAN network interface index. | ||
78 | * @can_addr: protocol specific address information | ||
79 | */ | ||
80 | struct sockaddr_can { | ||
81 | sa_family_t can_family; | ||
82 | int can_ifindex; | ||
83 | union { | ||
84 | /* transport protocol class address information (e.g. ISOTP) */ | ||
85 | struct { canid_t rx_id, tx_id; } tp; | ||
86 | |||
87 | /* reserved for future CAN protocols address information */ | ||
88 | } can_addr; | ||
89 | }; | ||
90 | |||
91 | /** | ||
92 | * struct can_filter - CAN ID based filter in can_register(). | ||
93 | * @can_id: relevant bits of CAN ID which are not masked out. | ||
94 | * @can_mask: CAN mask (see description) | ||
95 | * | ||
96 | * Description: | ||
97 | * A filter matches, when | ||
98 | * | ||
99 | * <received_can_id> & mask == can_id & mask | ||
100 | * | ||
101 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | ||
102 | * filter for error frames (CAN_ERR_FLAG bit set in mask). | ||
103 | */ | ||
104 | struct can_filter { | ||
105 | canid_t can_id; | ||
106 | canid_t can_mask; | ||
107 | }; | ||
108 | |||
109 | #define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ | ||
110 | |||
111 | #endif /* CAN_H */ | ||
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild new file mode 100644 index 00000000000..8cb05aae661 --- /dev/null +++ b/include/linux/can/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | header-y += raw.h | ||
2 | header-y += bcm.h | ||
3 | header-y += error.h | ||
4 | header-y += netlink.h | ||
diff --git a/include/linux/can/bcm.h b/include/linux/can/bcm.h new file mode 100644 index 00000000000..1432b278c52 --- /dev/null +++ b/include/linux/can/bcm.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * linux/can/bcm.h | ||
3 | * | ||
4 | * Definitions for CAN Broadcast Manager (BCM) | ||
5 | * | ||
6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef CAN_BCM_H | ||
15 | #define CAN_BCM_H | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | |||
19 | /** | ||
20 | * struct bcm_msg_head - head of messages to/from the broadcast manager | ||
21 | * @opcode: opcode, see enum below. | ||
22 | * @flags: special flags, see below. | ||
23 | * @count: number of frames to send before changing interval. | ||
24 | * @ival1: interval for the first @count frames. | ||
25 | * @ival2: interval for the following frames. | ||
26 | * @can_id: CAN ID of frames to be sent or received. | ||
27 | * @nframes: number of frames appended to the message head. | ||
28 | * @frames: array of CAN frames. | ||
29 | */ | ||
30 | struct bcm_msg_head { | ||
31 | __u32 opcode; | ||
32 | __u32 flags; | ||
33 | __u32 count; | ||
34 | struct timeval ival1, ival2; | ||
35 | canid_t can_id; | ||
36 | __u32 nframes; | ||
37 | struct can_frame frames[0]; | ||
38 | }; | ||
39 | |||
40 | enum { | ||
41 | TX_SETUP = 1, /* create (cyclic) transmission task */ | ||
42 | TX_DELETE, /* remove (cyclic) transmission task */ | ||
43 | TX_READ, /* read properties of (cyclic) transmission task */ | ||
44 | TX_SEND, /* send one CAN frame */ | ||
45 | RX_SETUP, /* create RX content filter subscription */ | ||
46 | RX_DELETE, /* remove RX content filter subscription */ | ||
47 | RX_READ, /* read properties of RX content filter subscription */ | ||
48 | TX_STATUS, /* reply to TX_READ request */ | ||
49 | TX_EXPIRED, /* notification on performed transmissions (count=0) */ | ||
50 | RX_STATUS, /* reply to RX_READ request */ | ||
51 | RX_TIMEOUT, /* cyclic message is absent */ | ||
52 | RX_CHANGED /* updated CAN frame (detected content change) */ | ||
53 | }; | ||
54 | |||
55 | #define SETTIMER 0x0001 | ||
56 | #define STARTTIMER 0x0002 | ||
57 | #define TX_COUNTEVT 0x0004 | ||
58 | #define TX_ANNOUNCE 0x0008 | ||
59 | #define TX_CP_CAN_ID 0x0010 | ||
60 | #define RX_FILTER_ID 0x0020 | ||
61 | #define RX_CHECK_DLC 0x0040 | ||
62 | #define RX_NO_AUTOTIMER 0x0080 | ||
63 | #define RX_ANNOUNCE_RESUME 0x0100 | ||
64 | #define TX_RESET_MULTI_IDX 0x0200 | ||
65 | #define RX_RTR_FRAME 0x0400 | ||
66 | |||
67 | #endif /* CAN_BCM_H */ | ||
diff --git a/include/linux/can/error.h b/include/linux/can/error.h new file mode 100644 index 00000000000..5958074302a --- /dev/null +++ b/include/linux/can/error.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * linux/can/error.h | ||
3 | * | ||
4 | * Definitions of the CAN error frame to be filtered and passed to the user. | ||
5 | * | ||
6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef CAN_ERROR_H | ||
15 | #define CAN_ERROR_H | ||
16 | |||
17 | #define CAN_ERR_DLC 8 /* dlc for error frames */ | ||
18 | |||
19 | /* error class (mask) in can_id */ | ||
20 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ | ||
21 | #define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ | ||
22 | #define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ | ||
23 | #define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ | ||
24 | #define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ | ||
25 | #define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ | ||
26 | #define CAN_ERR_BUSOFF 0x00000040U /* bus off */ | ||
27 | #define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ | ||
28 | #define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ | ||
29 | |||
30 | /* arbitration lost in bit ... / data[0] */ | ||
31 | #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ | ||
32 | /* else bit number in bitstream */ | ||
33 | |||
34 | /* error status of CAN-controller / data[1] */ | ||
35 | #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ | ||
36 | #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ | ||
37 | #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ | ||
38 | #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ | ||
39 | #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ | ||
40 | #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ | ||
41 | #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ | ||
42 | /* (at least one error counter exceeds */ | ||
43 | /* the protocol-defined level of 127) */ | ||
44 | |||
45 | /* error in CAN protocol (type) / data[2] */ | ||
46 | #define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ | ||
47 | #define CAN_ERR_PROT_BIT 0x01 /* single bit error */ | ||
48 | #define CAN_ERR_PROT_FORM 0x02 /* frame format error */ | ||
49 | #define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ | ||
50 | #define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ | ||
51 | #define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ | ||
52 | #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ | ||
53 | #define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ | ||
54 | #define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */ | ||
55 | |||
56 | /* error in CAN protocol (location) / data[3] */ | ||
57 | #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ | ||
58 | #define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ | ||
59 | #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ | ||
60 | #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ | ||
61 | #define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ | ||
62 | #define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ | ||
63 | #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ | ||
64 | #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ | ||
65 | #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ | ||
66 | #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ | ||
67 | #define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ | ||
68 | #define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ | ||
69 | #define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ | ||
70 | #define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ | ||
71 | #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ | ||
72 | #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ | ||
73 | #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ | ||
74 | #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ | ||
75 | #define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ | ||
76 | #define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ | ||
77 | |||
78 | /* error status of CAN-transceiver / data[4] */ | ||
79 | /* CANH CANL */ | ||
80 | #define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ | ||
81 | #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ | ||
82 | #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ | ||
83 | #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ | ||
84 | #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ | ||
85 | #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ | ||
86 | #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ | ||
87 | #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ | ||
88 | #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ | ||
89 | #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ | ||
90 | |||
91 | /* controller specific additional information / data[5..7] */ | ||
92 | |||
93 | #endif /* CAN_ERROR_H */ | ||
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h new file mode 100644 index 00000000000..34542d374dd --- /dev/null +++ b/include/linux/can/netlink.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * linux/can/netlink.h | ||
3 | * | ||
4 | * Definitions for the CAN netlink interface | ||
5 | * | ||
6 | * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com> | ||
7 | * | ||
8 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef CAN_NETLINK_H | ||
13 | #define CAN_NETLINK_H | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | /* | ||
18 | * CAN bit-timing parameters | ||
19 | * | ||
20 | * For further information, please read chapter "8 BIT TIMING | ||
21 | * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" | ||
22 | * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. | ||
23 | */ | ||
24 | struct can_bittiming { | ||
25 | __u32 bitrate; /* Bit-rate in bits/second */ | ||
26 | __u32 sample_point; /* Sample point in one-tenth of a percent */ | ||
27 | __u32 tq; /* Time quanta (TQ) in nanoseconds */ | ||
28 | __u32 prop_seg; /* Propagation segment in TQs */ | ||
29 | __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ | ||
30 | __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ | ||
31 | __u32 sjw; /* Synchronisation jump width in TQs */ | ||
32 | __u32 brp; /* Bit-rate prescaler */ | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | * CAN harware-dependent bit-timing constant | ||
37 | * | ||
38 | * Used for calculating and checking bit-timing parameters | ||
39 | */ | ||
40 | struct can_bittiming_const { | ||
41 | char name[16]; /* Name of the CAN controller hardware */ | ||
42 | __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ | ||
43 | __u32 tseg1_max; | ||
44 | __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ | ||
45 | __u32 tseg2_max; | ||
46 | __u32 sjw_max; /* Synchronisation jump width */ | ||
47 | __u32 brp_min; /* Bit-rate prescaler */ | ||
48 | __u32 brp_max; | ||
49 | __u32 brp_inc; | ||
50 | }; | ||
51 | |||
52 | /* | ||
53 | * CAN clock parameters | ||
54 | */ | ||
55 | struct can_clock { | ||
56 | __u32 freq; /* CAN system clock frequency in Hz */ | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * CAN operational and error states | ||
61 | */ | ||
62 | enum can_state { | ||
63 | CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ | ||
64 | CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ | ||
65 | CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ | ||
66 | CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ | ||
67 | CAN_STATE_STOPPED, /* Device is stopped */ | ||
68 | CAN_STATE_SLEEPING, /* Device is sleeping */ | ||
69 | CAN_STATE_MAX | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * CAN bus error counters | ||
74 | */ | ||
75 | struct can_berr_counter { | ||
76 | __u16 txerr; | ||
77 | __u16 rxerr; | ||
78 | }; | ||
79 | |||
80 | /* | ||
81 | * CAN controller mode | ||
82 | */ | ||
83 | struct can_ctrlmode { | ||
84 | __u32 mask; | ||
85 | __u32 flags; | ||
86 | }; | ||
87 | |||
88 | #define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ | ||
89 | #define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ | ||
90 | #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ | ||
91 | #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ | ||
92 | #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ | ||
93 | |||
94 | /* | ||
95 | * CAN device statistics | ||
96 | */ | ||
97 | struct can_device_stats { | ||
98 | __u32 bus_error; /* Bus errors */ | ||
99 | __u32 error_warning; /* Changes to error warning state */ | ||
100 | __u32 error_passive; /* Changes to error passive state */ | ||
101 | __u32 bus_off; /* Changes to bus off state */ | ||
102 | __u32 arbitration_lost; /* Arbitration lost errors */ | ||
103 | __u32 restarts; /* CAN controller re-starts */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * CAN netlink interface | ||
108 | */ | ||
109 | enum { | ||
110 | IFLA_CAN_UNSPEC, | ||
111 | IFLA_CAN_BITTIMING, | ||
112 | IFLA_CAN_BITTIMING_CONST, | ||
113 | IFLA_CAN_CLOCK, | ||
114 | IFLA_CAN_STATE, | ||
115 | IFLA_CAN_CTRLMODE, | ||
116 | IFLA_CAN_RESTART_MS, | ||
117 | IFLA_CAN_RESTART, | ||
118 | IFLA_CAN_BERR_COUNTER, | ||
119 | __IFLA_CAN_MAX | ||
120 | }; | ||
121 | |||
122 | #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) | ||
123 | |||
124 | #endif /* CAN_NETLINK_H */ | ||
diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h new file mode 100644 index 00000000000..b2a0f87492c --- /dev/null +++ b/include/linux/can/raw.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * linux/can/raw.h | ||
3 | * | ||
4 | * Definitions for raw CAN sockets | ||
5 | * | ||
6 | * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Urs Thuermann <urs.thuermann@volkswagen.de> | ||
8 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef CAN_RAW_H | ||
16 | #define CAN_RAW_H | ||
17 | |||
18 | #include <linux/can.h> | ||
19 | |||
20 | #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) | ||
21 | |||
22 | /* for socket options affecting the socket (not the global system) */ | ||
23 | |||
24 | enum { | ||
25 | CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ | ||
26 | CAN_RAW_ERR_FILTER, /* set filter for error frames */ | ||
27 | CAN_RAW_LOOPBACK, /* local loopback (default:on) */ | ||
28 | CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */ | ||
29 | }; | ||
30 | |||
31 | #endif | ||
diff --git a/include/linux/capi.h b/include/linux/capi.h new file mode 100644 index 00000000000..65100d6cb89 --- /dev/null +++ b/include/linux/capi.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ | ||
2 | * | ||
3 | * CAPI 2.0 Interface for Linux | ||
4 | * | ||
5 | * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_CAPI_H__ | ||
13 | #define __LINUX_CAPI_H__ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/ioctl.h> | ||
17 | #ifndef __KERNEL__ | ||
18 | #include <linux/kernelcapi.h> | ||
19 | #endif | ||
20 | |||
21 | /* | ||
22 | * CAPI_REGISTER | ||
23 | */ | ||
24 | |||
25 | typedef struct capi_register_params { /* CAPI_REGISTER */ | ||
26 | __u32 level3cnt; /* No. of simulatneous user data connections */ | ||
27 | __u32 datablkcnt; /* No. of buffered data messages */ | ||
28 | __u32 datablklen; /* Size of buffered data messages */ | ||
29 | } capi_register_params; | ||
30 | |||
31 | #define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params) | ||
32 | |||
33 | /* | ||
34 | * CAPI_GET_MANUFACTURER | ||
35 | */ | ||
36 | |||
37 | #define CAPI_MANUFACTURER_LEN 64 | ||
38 | |||
39 | #define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */ | ||
40 | |||
41 | /* | ||
42 | * CAPI_GET_VERSION | ||
43 | */ | ||
44 | |||
45 | typedef struct capi_version { | ||
46 | __u32 majorversion; | ||
47 | __u32 minorversion; | ||
48 | __u32 majormanuversion; | ||
49 | __u32 minormanuversion; | ||
50 | } capi_version; | ||
51 | |||
52 | #define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) | ||
53 | |||
54 | /* | ||
55 | * CAPI_GET_SERIAL | ||
56 | */ | ||
57 | |||
58 | #define CAPI_SERIAL_LEN 8 | ||
59 | #define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ | ||
60 | |||
61 | /* | ||
62 | * CAPI_GET_PROFILE | ||
63 | */ | ||
64 | |||
65 | typedef struct capi_profile { | ||
66 | __u16 ncontroller; /* number of installed controller */ | ||
67 | __u16 nbchannel; /* number of B-Channels */ | ||
68 | __u32 goptions; /* global options */ | ||
69 | __u32 support1; /* B1 protocols support */ | ||
70 | __u32 support2; /* B2 protocols support */ | ||
71 | __u32 support3; /* B3 protocols support */ | ||
72 | __u32 reserved[6]; /* reserved */ | ||
73 | __u32 manu[5]; /* manufacturer specific information */ | ||
74 | } capi_profile; | ||
75 | |||
76 | #define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) | ||
77 | |||
78 | typedef struct capi_manufacturer_cmd { | ||
79 | unsigned long cmd; | ||
80 | void __user *data; | ||
81 | } capi_manufacturer_cmd; | ||
82 | |||
83 | /* | ||
84 | * CAPI_MANUFACTURER_CMD | ||
85 | */ | ||
86 | |||
87 | #define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd) | ||
88 | |||
89 | /* | ||
90 | * CAPI_GET_ERRCODE | ||
91 | * capi errcode is set, * if read, write, or ioctl returns EIO, | ||
92 | * ioctl returns errcode directly, and in arg, if != 0 | ||
93 | */ | ||
94 | |||
95 | #define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) | ||
96 | |||
97 | /* | ||
98 | * CAPI_INSTALLED | ||
99 | */ | ||
100 | #define CAPI_INSTALLED _IOR('C',0x22, __u16) | ||
101 | |||
102 | |||
103 | /* | ||
104 | * member contr is input for | ||
105 | * CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL | ||
106 | * and CAPI_GET_PROFILE | ||
107 | */ | ||
108 | typedef union capi_ioctl_struct { | ||
109 | __u32 contr; | ||
110 | capi_register_params rparams; | ||
111 | __u8 manufacturer[CAPI_MANUFACTURER_LEN]; | ||
112 | capi_version version; | ||
113 | __u8 serial[CAPI_SERIAL_LEN]; | ||
114 | capi_profile profile; | ||
115 | capi_manufacturer_cmd cmd; | ||
116 | __u16 errcode; | ||
117 | } capi_ioctl_struct; | ||
118 | |||
119 | /* | ||
120 | * Middleware extension | ||
121 | */ | ||
122 | |||
123 | #define CAPIFLAG_HIGHJACKING 0x0001 | ||
124 | |||
125 | #define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) | ||
126 | #define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) | ||
127 | #define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) | ||
128 | |||
129 | #define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) | ||
130 | |||
131 | #define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) | ||
132 | |||
133 | #endif /* __LINUX_CAPI_H__ */ | ||
diff --git a/include/linux/cciss_defs.h b/include/linux/cciss_defs.h new file mode 100644 index 00000000000..316b670d4e3 --- /dev/null +++ b/include/linux/cciss_defs.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef CCISS_DEFS_H | ||
2 | #define CCISS_DEFS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* general boundary definitions */ | ||
7 | #define SENSEINFOBYTES 32 /* note that this value may vary | ||
8 | between host implementations */ | ||
9 | |||
10 | /* Command Status value */ | ||
11 | #define CMD_SUCCESS 0x0000 | ||
12 | #define CMD_TARGET_STATUS 0x0001 | ||
13 | #define CMD_DATA_UNDERRUN 0x0002 | ||
14 | #define CMD_DATA_OVERRUN 0x0003 | ||
15 | #define CMD_INVALID 0x0004 | ||
16 | #define CMD_PROTOCOL_ERR 0x0005 | ||
17 | #define CMD_HARDWARE_ERR 0x0006 | ||
18 | #define CMD_CONNECTION_LOST 0x0007 | ||
19 | #define CMD_ABORTED 0x0008 | ||
20 | #define CMD_ABORT_FAILED 0x0009 | ||
21 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
22 | #define CMD_TIMEOUT 0x000B | ||
23 | #define CMD_UNABORTABLE 0x000C | ||
24 | |||
25 | /* transfer direction */ | ||
26 | #define XFER_NONE 0x00 | ||
27 | #define XFER_WRITE 0x01 | ||
28 | #define XFER_READ 0x02 | ||
29 | #define XFER_RSVD 0x03 | ||
30 | |||
31 | /* task attribute */ | ||
32 | #define ATTR_UNTAGGED 0x00 | ||
33 | #define ATTR_SIMPLE 0x04 | ||
34 | #define ATTR_HEADOFQUEUE 0x05 | ||
35 | #define ATTR_ORDERED 0x06 | ||
36 | #define ATTR_ACA 0x07 | ||
37 | |||
38 | /* cdb type */ | ||
39 | #define TYPE_CMD 0x00 | ||
40 | #define TYPE_MSG 0x01 | ||
41 | |||
42 | /* Type defs used in the following structs */ | ||
43 | #define BYTE __u8 | ||
44 | #define WORD __u16 | ||
45 | #define HWORD __u16 | ||
46 | #define DWORD __u32 | ||
47 | |||
48 | #define CISS_MAX_LUN 1024 | ||
49 | |||
50 | #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */ | ||
51 | #define LEVEL3LUN 0 | ||
52 | |||
53 | #pragma pack(1) | ||
54 | |||
55 | /* Command List Structure */ | ||
56 | typedef union _SCSI3Addr_struct { | ||
57 | struct { | ||
58 | BYTE Dev; | ||
59 | BYTE Bus:6; | ||
60 | BYTE Mode:2; /* b00 */ | ||
61 | } PeripDev; | ||
62 | struct { | ||
63 | BYTE DevLSB; | ||
64 | BYTE DevMSB:6; | ||
65 | BYTE Mode:2; /* b01 */ | ||
66 | } LogDev; | ||
67 | struct { | ||
68 | BYTE Dev:5; | ||
69 | BYTE Bus:3; | ||
70 | BYTE Targ:6; | ||
71 | BYTE Mode:2; /* b10 */ | ||
72 | } LogUnit; | ||
73 | } SCSI3Addr_struct; | ||
74 | |||
75 | typedef struct _PhysDevAddr_struct { | ||
76 | DWORD TargetId:24; | ||
77 | DWORD Bus:6; | ||
78 | DWORD Mode:2; | ||
79 | SCSI3Addr_struct Target[2]; /* 2 level target device addr */ | ||
80 | } PhysDevAddr_struct; | ||
81 | |||
82 | typedef struct _LogDevAddr_struct { | ||
83 | DWORD VolId:30; | ||
84 | DWORD Mode:2; | ||
85 | BYTE reserved[4]; | ||
86 | } LogDevAddr_struct; | ||
87 | |||
88 | typedef union _LUNAddr_struct { | ||
89 | BYTE LunAddrBytes[8]; | ||
90 | SCSI3Addr_struct SCSI3Lun[4]; | ||
91 | PhysDevAddr_struct PhysDev; | ||
92 | LogDevAddr_struct LogDev; | ||
93 | } LUNAddr_struct; | ||
94 | |||
95 | typedef struct _RequestBlock_struct { | ||
96 | BYTE CDBLen; | ||
97 | struct { | ||
98 | BYTE Type:3; | ||
99 | BYTE Attribute:3; | ||
100 | BYTE Direction:2; | ||
101 | } Type; | ||
102 | HWORD Timeout; | ||
103 | BYTE CDB[16]; | ||
104 | } RequestBlock_struct; | ||
105 | |||
106 | typedef union _MoreErrInfo_struct{ | ||
107 | struct { | ||
108 | BYTE Reserved[3]; | ||
109 | BYTE Type; | ||
110 | DWORD ErrorInfo; | ||
111 | } Common_Info; | ||
112 | struct{ | ||
113 | BYTE Reserved[2]; | ||
114 | BYTE offense_size; /* size of offending entry */ | ||
115 | BYTE offense_num; /* byte # of offense 0-base */ | ||
116 | DWORD offense_value; | ||
117 | } Invalid_Cmd; | ||
118 | } MoreErrInfo_struct; | ||
119 | typedef struct _ErrorInfo_struct { | ||
120 | BYTE ScsiStatus; | ||
121 | BYTE SenseLen; | ||
122 | HWORD CommandStatus; | ||
123 | DWORD ResidualCnt; | ||
124 | MoreErrInfo_struct MoreErrInfo; | ||
125 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
126 | } ErrorInfo_struct; | ||
127 | |||
128 | #pragma pack() | ||
129 | |||
130 | #endif /* CCISS_DEFS_H */ | ||
diff --git a/include/linux/cd1400.h b/include/linux/cd1400.h new file mode 100644 index 00000000000..1dc3ab0523f --- /dev/null +++ b/include/linux/cd1400.h | |||
@@ -0,0 +1,292 @@ | |||
1 | /*****************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * cd1400.h -- cd1400 UART hardware info. | ||
5 | * | ||
6 | * Copyright (C) 1996-1998 Stallion Technologies | ||
7 | * Copyright (C) 1994-1996 Greg Ungerer. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | /*****************************************************************************/ | ||
25 | #ifndef _CD1400_H | ||
26 | #define _CD1400_H | ||
27 | /*****************************************************************************/ | ||
28 | |||
29 | /* | ||
30 | * Define the number of async ports per cd1400 uart chip. | ||
31 | */ | ||
32 | #define CD1400_PORTS 4 | ||
33 | |||
34 | /* | ||
35 | * Define the cd1400 uarts internal FIFO sizes. | ||
36 | */ | ||
37 | #define CD1400_TXFIFOSIZE 12 | ||
38 | #define CD1400_RXFIFOSIZE 12 | ||
39 | |||
40 | /* | ||
41 | * Local RX FIFO thresh hold level. Also define the RTS thresh hold | ||
42 | * based on the RX thresh hold. | ||
43 | */ | ||
44 | #define FIFO_RXTHRESHOLD 6 | ||
45 | #define FIFO_RTSTHRESHOLD 7 | ||
46 | |||
47 | /*****************************************************************************/ | ||
48 | |||
49 | /* | ||
50 | * Define the cd1400 register addresses. These are all the valid | ||
51 | * registers with the cd1400. Some are global, some virtual, some | ||
52 | * per port. | ||
53 | */ | ||
54 | #define GFRCR 0x40 | ||
55 | #define CAR 0x68 | ||
56 | #define GCR 0x4b | ||
57 | #define SVRR 0x67 | ||
58 | #define RICR 0x44 | ||
59 | #define TICR 0x45 | ||
60 | #define MICR 0x46 | ||
61 | #define RIR 0x6b | ||
62 | #define TIR 0x6a | ||
63 | #define MIR 0x69 | ||
64 | #define PPR 0x7e | ||
65 | |||
66 | #define RIVR 0x43 | ||
67 | #define TIVR 0x42 | ||
68 | #define MIVR 0x41 | ||
69 | #define TDR 0x63 | ||
70 | #define RDSR 0x62 | ||
71 | #define MISR 0x4c | ||
72 | #define EOSRR 0x60 | ||
73 | |||
74 | #define LIVR 0x18 | ||
75 | #define CCR 0x05 | ||
76 | #define SRER 0x06 | ||
77 | #define COR1 0x08 | ||
78 | #define COR2 0x09 | ||
79 | #define COR3 0x0a | ||
80 | #define COR4 0x1e | ||
81 | #define COR5 0x1f | ||
82 | #define CCSR 0x0b | ||
83 | #define RDCR 0x0e | ||
84 | #define SCHR1 0x1a | ||
85 | #define SCHR2 0x1b | ||
86 | #define SCHR3 0x1c | ||
87 | #define SCHR4 0x1d | ||
88 | #define SCRL 0x22 | ||
89 | #define SCRH 0x23 | ||
90 | #define LNC 0x24 | ||
91 | #define MCOR1 0x15 | ||
92 | #define MCOR2 0x16 | ||
93 | #define RTPR 0x21 | ||
94 | #define MSVR1 0x6c | ||
95 | #define MSVR2 0x6d | ||
96 | #define PSVR 0x6f | ||
97 | #define RBPR 0x78 | ||
98 | #define RCOR 0x7c | ||
99 | #define TBPR 0x72 | ||
100 | #define TCOR 0x76 | ||
101 | |||
102 | /*****************************************************************************/ | ||
103 | |||
104 | /* | ||
105 | * Define the set of baud rate clock divisors. | ||
106 | */ | ||
107 | #define CD1400_CLK0 8 | ||
108 | #define CD1400_CLK1 32 | ||
109 | #define CD1400_CLK2 128 | ||
110 | #define CD1400_CLK3 512 | ||
111 | #define CD1400_CLK4 2048 | ||
112 | |||
113 | #define CD1400_NUMCLKS 5 | ||
114 | |||
115 | /*****************************************************************************/ | ||
116 | |||
117 | /* | ||
118 | * Define the clock pre-scalar value to be a 5 ms clock. This should be | ||
119 | * OK for now. It would probably be better to make it 10 ms, but we | ||
120 | * can't fit that divisor into 8 bits! | ||
121 | */ | ||
122 | #define PPR_SCALAR 244 | ||
123 | |||
124 | /*****************************************************************************/ | ||
125 | |||
126 | /* | ||
127 | * Define values used to set character size options. | ||
128 | */ | ||
129 | #define COR1_CHL5 0x00 | ||
130 | #define COR1_CHL6 0x01 | ||
131 | #define COR1_CHL7 0x02 | ||
132 | #define COR1_CHL8 0x03 | ||
133 | |||
134 | /* | ||
135 | * Define values used to set the number of stop bits. | ||
136 | */ | ||
137 | #define COR1_STOP1 0x00 | ||
138 | #define COR1_STOP15 0x04 | ||
139 | #define COR1_STOP2 0x08 | ||
140 | |||
141 | /* | ||
142 | * Define values used to set the parity scheme in use. | ||
143 | */ | ||
144 | #define COR1_PARNONE 0x00 | ||
145 | #define COR1_PARFORCE 0x20 | ||
146 | #define COR1_PARENB 0x40 | ||
147 | #define COR1_PARIGNORE 0x10 | ||
148 | |||
149 | #define COR1_PARODD 0x80 | ||
150 | #define COR1_PAREVEN 0x00 | ||
151 | |||
152 | #define COR2_IXM 0x80 | ||
153 | #define COR2_TXIBE 0x40 | ||
154 | #define COR2_ETC 0x20 | ||
155 | #define COR2_LLM 0x10 | ||
156 | #define COR2_RLM 0x08 | ||
157 | #define COR2_RTSAO 0x04 | ||
158 | #define COR2_CTSAE 0x02 | ||
159 | |||
160 | #define COR3_SCDRNG 0x80 | ||
161 | #define COR3_SCD34 0x40 | ||
162 | #define COR3_FCT 0x20 | ||
163 | #define COR3_SCD12 0x10 | ||
164 | |||
165 | /* | ||
166 | * Define values used by COR4. | ||
167 | */ | ||
168 | #define COR4_BRKINT 0x08 | ||
169 | #define COR4_IGNBRK 0x18 | ||
170 | |||
171 | /*****************************************************************************/ | ||
172 | |||
173 | /* | ||
174 | * Define the modem control register values. | ||
175 | * Note that the actual hardware is a little different to the conventional | ||
176 | * pin names on the cd1400. | ||
177 | */ | ||
178 | #define MSVR1_DTR 0x01 | ||
179 | #define MSVR1_DSR 0x10 | ||
180 | #define MSVR1_RI 0x20 | ||
181 | #define MSVR1_CTS 0x40 | ||
182 | #define MSVR1_DCD 0x80 | ||
183 | |||
184 | #define MSVR2_RTS 0x02 | ||
185 | #define MSVR2_DSR 0x10 | ||
186 | #define MSVR2_RI 0x20 | ||
187 | #define MSVR2_CTS 0x40 | ||
188 | #define MSVR2_DCD 0x80 | ||
189 | |||
190 | #define MCOR1_DCD 0x80 | ||
191 | #define MCOR1_CTS 0x40 | ||
192 | #define MCOR1_RI 0x20 | ||
193 | #define MCOR1_DSR 0x10 | ||
194 | |||
195 | #define MCOR2_DCD 0x80 | ||
196 | #define MCOR2_CTS 0x40 | ||
197 | #define MCOR2_RI 0x20 | ||
198 | #define MCOR2_DSR 0x10 | ||
199 | |||
200 | /*****************************************************************************/ | ||
201 | |||
202 | /* | ||
203 | * Define the bits used with the service (interrupt) enable register. | ||
204 | */ | ||
205 | #define SRER_NNDT 0x01 | ||
206 | #define SRER_TXEMPTY 0x02 | ||
207 | #define SRER_TXDATA 0x04 | ||
208 | #define SRER_RXDATA 0x10 | ||
209 | #define SRER_MODEM 0x80 | ||
210 | |||
211 | /*****************************************************************************/ | ||
212 | |||
213 | /* | ||
214 | * Define operational commands for the command register. | ||
215 | */ | ||
216 | #define CCR_RESET 0x80 | ||
217 | #define CCR_CORCHANGE 0x4e | ||
218 | #define CCR_SENDCH 0x20 | ||
219 | #define CCR_CHANCTRL 0x10 | ||
220 | |||
221 | #define CCR_TXENABLE (CCR_CHANCTRL | 0x08) | ||
222 | #define CCR_TXDISABLE (CCR_CHANCTRL | 0x04) | ||
223 | #define CCR_RXENABLE (CCR_CHANCTRL | 0x02) | ||
224 | #define CCR_RXDISABLE (CCR_CHANCTRL | 0x01) | ||
225 | |||
226 | #define CCR_SENDSCHR1 (CCR_SENDCH | 0x01) | ||
227 | #define CCR_SENDSCHR2 (CCR_SENDCH | 0x02) | ||
228 | #define CCR_SENDSCHR3 (CCR_SENDCH | 0x03) | ||
229 | #define CCR_SENDSCHR4 (CCR_SENDCH | 0x04) | ||
230 | |||
231 | #define CCR_RESETCHAN (CCR_RESET | 0x00) | ||
232 | #define CCR_RESETFULL (CCR_RESET | 0x01) | ||
233 | #define CCR_TXFLUSHFIFO (CCR_RESET | 0x02) | ||
234 | |||
235 | #define CCR_MAXWAIT 10000 | ||
236 | |||
237 | /*****************************************************************************/ | ||
238 | |||
239 | /* | ||
240 | * Define the valid acknowledgement types (for hw ack cycle). | ||
241 | */ | ||
242 | #define ACK_TYPMASK 0x07 | ||
243 | #define ACK_TYPTX 0x02 | ||
244 | #define ACK_TYPMDM 0x01 | ||
245 | #define ACK_TYPRXGOOD 0x03 | ||
246 | #define ACK_TYPRXBAD 0x07 | ||
247 | |||
248 | #define SVRR_RX 0x01 | ||
249 | #define SVRR_TX 0x02 | ||
250 | #define SVRR_MDM 0x04 | ||
251 | |||
252 | #define ST_OVERRUN 0x01 | ||
253 | #define ST_FRAMING 0x02 | ||
254 | #define ST_PARITY 0x04 | ||
255 | #define ST_BREAK 0x08 | ||
256 | #define ST_SCHAR1 0x10 | ||
257 | #define ST_SCHAR2 0x20 | ||
258 | #define ST_SCHAR3 0x30 | ||
259 | #define ST_SCHAR4 0x40 | ||
260 | #define ST_RANGE 0x70 | ||
261 | #define ST_SCHARMASK 0x70 | ||
262 | #define ST_TIMEOUT 0x80 | ||
263 | |||
264 | #define MISR_DCD 0x80 | ||
265 | #define MISR_CTS 0x40 | ||
266 | #define MISR_RI 0x20 | ||
267 | #define MISR_DSR 0x10 | ||
268 | |||
269 | /*****************************************************************************/ | ||
270 | |||
271 | /* | ||
272 | * Defines for the CCSR status register. | ||
273 | */ | ||
274 | #define CCSR_RXENABLED 0x80 | ||
275 | #define CCSR_RXFLOWON 0x40 | ||
276 | #define CCSR_RXFLOWOFF 0x20 | ||
277 | #define CCSR_TXENABLED 0x08 | ||
278 | #define CCSR_TXFLOWON 0x04 | ||
279 | #define CCSR_TXFLOWOFF 0x02 | ||
280 | |||
281 | /*****************************************************************************/ | ||
282 | |||
283 | /* | ||
284 | * Define the embedded commands. | ||
285 | */ | ||
286 | #define ETC_CMD 0x00 | ||
287 | #define ETC_STARTBREAK 0x81 | ||
288 | #define ETC_DELAY 0x82 | ||
289 | #define ETC_STOPBREAK 0x83 | ||
290 | |||
291 | /*****************************************************************************/ | ||
292 | #endif | ||
diff --git a/include/linux/cdk.h b/include/linux/cdk.h new file mode 100644 index 00000000000..80093a8d4f6 --- /dev/null +++ b/include/linux/cdk.h | |||
@@ -0,0 +1,486 @@ | |||
1 | /*****************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * cdk.h -- CDK interface definitions. | ||
5 | * | ||
6 | * Copyright (C) 1996-1998 Stallion Technologies | ||
7 | * Copyright (C) 1994-1996 Greg Ungerer. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | /*****************************************************************************/ | ||
25 | #ifndef _CDK_H | ||
26 | #define _CDK_H | ||
27 | /*****************************************************************************/ | ||
28 | |||
29 | #pragma pack(2) | ||
30 | |||
31 | /* | ||
32 | * The following set of definitions is used to communicate with the | ||
33 | * shared memory interface of the Stallion intelligent multiport serial | ||
34 | * boards. The definitions in this file are taken directly from the | ||
35 | * document titled "Generic Stackable Interface, Downloader and | ||
36 | * Communications Development Kit". | ||
37 | */ | ||
38 | |||
39 | /* | ||
40 | * Define the set of important shared memory addresses. These are | ||
41 | * required to initialize the board and get things started. All of these | ||
42 | * addresses are relative to the start of the shared memory. | ||
43 | */ | ||
44 | #define CDK_SIGADDR 0x200 | ||
45 | #define CDK_FEATADDR 0x280 | ||
46 | #define CDK_CDKADDR 0x300 | ||
47 | #define CDK_RDYADDR 0x262 | ||
48 | |||
49 | #define CDK_ALIVEMARKER 13 | ||
50 | |||
51 | /* | ||
52 | * On hardware power up the ROMs located on the EasyConnection 8/64 will | ||
53 | * fill out the following signature information into shared memory. This | ||
54 | * way the host system can quickly determine that the board is present | ||
55 | * and is operational. | ||
56 | */ | ||
57 | typedef struct cdkecpsig { | ||
58 | unsigned long magic; | ||
59 | unsigned short romver; | ||
60 | unsigned short cputype; | ||
61 | unsigned char panelid[8]; | ||
62 | } cdkecpsig_t; | ||
63 | |||
64 | #define ECP_MAGIC 0x21504345 | ||
65 | |||
66 | /* | ||
67 | * On hardware power up the ROMs located on the ONboard, Stallion and | ||
68 | * Brumbys will fill out the following signature information into shared | ||
69 | * memory. This way the host system can quickly determine that the board | ||
70 | * is present and is operational. | ||
71 | */ | ||
72 | typedef struct cdkonbsig { | ||
73 | unsigned short magic0; | ||
74 | unsigned short magic1; | ||
75 | unsigned short magic2; | ||
76 | unsigned short magic3; | ||
77 | unsigned short romver; | ||
78 | unsigned short memoff; | ||
79 | unsigned short memseg; | ||
80 | unsigned short amask0; | ||
81 | unsigned short pic; | ||
82 | unsigned short status; | ||
83 | unsigned short btype; | ||
84 | unsigned short clkticks; | ||
85 | unsigned short clkspeed; | ||
86 | unsigned short amask1; | ||
87 | unsigned short amask2; | ||
88 | } cdkonbsig_t; | ||
89 | |||
90 | #define ONB_MAGIC0 0xf2a7 | ||
91 | #define ONB_MAGIC1 0xa149 | ||
92 | #define ONB_MAGIC2 0x6352 | ||
93 | #define ONB_MAGIC3 0xf121 | ||
94 | |||
95 | /* | ||
96 | * Define the feature area structure. The feature area is the set of | ||
97 | * startup parameters used by the slave image when it starts executing. | ||
98 | * They allow for the specification of buffer sizes, debug trace, etc. | ||
99 | */ | ||
100 | typedef struct cdkfeature { | ||
101 | unsigned long debug; | ||
102 | unsigned long banner; | ||
103 | unsigned long etype; | ||
104 | unsigned long nrdevs; | ||
105 | unsigned long brdspec; | ||
106 | unsigned long txrqsize; | ||
107 | unsigned long rxrqsize; | ||
108 | unsigned long flags; | ||
109 | } cdkfeature_t; | ||
110 | |||
111 | #define ETYP_DDK 0 | ||
112 | #define ETYP_CDK 1 | ||
113 | |||
114 | /* | ||
115 | * Define the CDK header structure. This is the info that the slave | ||
116 | * environment sets up after it has been downloaded and started. It | ||
117 | * essentially provides a memory map for the shared memory interface. | ||
118 | */ | ||
119 | typedef struct cdkhdr { | ||
120 | unsigned short command; | ||
121 | unsigned short status; | ||
122 | unsigned short port; | ||
123 | unsigned short mode; | ||
124 | unsigned long cmd_buf[14]; | ||
125 | unsigned short alive_cnt; | ||
126 | unsigned short intrpt_mode; | ||
127 | unsigned char intrpt_id[8]; | ||
128 | unsigned char ver_release; | ||
129 | unsigned char ver_modification; | ||
130 | unsigned char ver_fix; | ||
131 | unsigned char deadman_restart; | ||
132 | unsigned short deadman; | ||
133 | unsigned short nrdevs; | ||
134 | unsigned long memp; | ||
135 | unsigned long hostp; | ||
136 | unsigned long slavep; | ||
137 | unsigned char hostreq; | ||
138 | unsigned char slavereq; | ||
139 | unsigned char cmd_reserved[30]; | ||
140 | } cdkhdr_t; | ||
141 | |||
142 | #define MODE_DDK 0 | ||
143 | #define MODE_CDK 1 | ||
144 | |||
145 | #define IMD_INTR 0x0 | ||
146 | #define IMD_PPINTR 0x1 | ||
147 | #define IMD_POLL 0xff | ||
148 | |||
149 | /* | ||
150 | * Define the memory mapping structure. This structure is pointed to by | ||
151 | * the memp field in the stlcdkhdr struct. As many as these structures | ||
152 | * as required are laid out in shared memory to define how the rest of | ||
153 | * shared memory is divided up. There will be one for each port. | ||
154 | */ | ||
155 | typedef struct cdkmem { | ||
156 | unsigned short dtype; | ||
157 | unsigned long offset; | ||
158 | } cdkmem_t; | ||
159 | |||
160 | #define TYP_UNDEFINED 0x0 | ||
161 | #define TYP_ASYNCTRL 0x1 | ||
162 | #define TYP_ASYNC 0x20 | ||
163 | #define TYP_PARALLEL 0x40 | ||
164 | #define TYP_SYNCX21 0x60 | ||
165 | |||
166 | /*****************************************************************************/ | ||
167 | |||
168 | /* | ||
169 | * Following is a set of defines and structures used to actually deal | ||
170 | * with the serial ports on the board. Firstly is the set of commands | ||
171 | * that can be applied to ports. | ||
172 | */ | ||
173 | #define ASYCMD (((unsigned long) 'a') << 8) | ||
174 | |||
175 | #define A_NULL (ASYCMD | 0) | ||
176 | #define A_FLUSH (ASYCMD | 1) | ||
177 | #define A_BREAK (ASYCMD | 2) | ||
178 | #define A_GETPORT (ASYCMD | 3) | ||
179 | #define A_SETPORT (ASYCMD | 4) | ||
180 | #define A_SETPORTF (ASYCMD | 5) | ||
181 | #define A_SETPORTFTX (ASYCMD | 6) | ||
182 | #define A_SETPORTFRX (ASYCMD | 7) | ||
183 | #define A_GETSIGNALS (ASYCMD | 8) | ||
184 | #define A_SETSIGNALS (ASYCMD | 9) | ||
185 | #define A_SETSIGNALSF (ASYCMD | 10) | ||
186 | #define A_SETSIGNALSFTX (ASYCMD | 11) | ||
187 | #define A_SETSIGNALSFRX (ASYCMD | 12) | ||
188 | #define A_GETNOTIFY (ASYCMD | 13) | ||
189 | #define A_SETNOTIFY (ASYCMD | 14) | ||
190 | #define A_NOTIFY (ASYCMD | 15) | ||
191 | #define A_PORTCTRL (ASYCMD | 16) | ||
192 | #define A_GETSTATS (ASYCMD | 17) | ||
193 | #define A_RQSTATE (ASYCMD | 18) | ||
194 | #define A_FLOWSTATE (ASYCMD | 19) | ||
195 | #define A_CLEARSTATS (ASYCMD | 20) | ||
196 | |||
197 | /* | ||
198 | * Define those arguments used for simple commands. | ||
199 | */ | ||
200 | #define FLUSHRX 0x1 | ||
201 | #define FLUSHTX 0x2 | ||
202 | |||
203 | #define BREAKON -1 | ||
204 | #define BREAKOFF -2 | ||
205 | |||
206 | /* | ||
207 | * Define the port setting structure, and all those defines that go along | ||
208 | * with it. Basically this structure defines the characteristics of this | ||
209 | * port: baud rate, chars, parity, input/output char cooking etc. | ||
210 | */ | ||
211 | typedef struct asyport { | ||
212 | unsigned long baudout; | ||
213 | unsigned long baudin; | ||
214 | unsigned long iflag; | ||
215 | unsigned long oflag; | ||
216 | unsigned long lflag; | ||
217 | unsigned long pflag; | ||
218 | unsigned long flow; | ||
219 | unsigned long spare1; | ||
220 | unsigned short vtime; | ||
221 | unsigned short vmin; | ||
222 | unsigned short txlo; | ||
223 | unsigned short txhi; | ||
224 | unsigned short rxlo; | ||
225 | unsigned short rxhi; | ||
226 | unsigned short rxhog; | ||
227 | unsigned short spare2; | ||
228 | unsigned char csize; | ||
229 | unsigned char stopbs; | ||
230 | unsigned char parity; | ||
231 | unsigned char stopin; | ||
232 | unsigned char startin; | ||
233 | unsigned char stopout; | ||
234 | unsigned char startout; | ||
235 | unsigned char parmark; | ||
236 | unsigned char brkmark; | ||
237 | unsigned char cc[11]; | ||
238 | } asyport_t; | ||
239 | |||
240 | #define PT_STOP1 0x0 | ||
241 | #define PT_STOP15 0x1 | ||
242 | #define PT_STOP2 0x2 | ||
243 | |||
244 | #define PT_NOPARITY 0x0 | ||
245 | #define PT_ODDPARITY 0x1 | ||
246 | #define PT_EVENPARITY 0x2 | ||
247 | #define PT_MARKPARITY 0x3 | ||
248 | #define PT_SPACEPARITY 0x4 | ||
249 | |||
250 | #define F_NONE 0x0 | ||
251 | #define F_IXON 0x1 | ||
252 | #define F_IXOFF 0x2 | ||
253 | #define F_IXANY 0x4 | ||
254 | #define F_IOXANY 0x8 | ||
255 | #define F_RTSFLOW 0x10 | ||
256 | #define F_CTSFLOW 0x20 | ||
257 | #define F_DTRFLOW 0x40 | ||
258 | #define F_DCDFLOW 0x80 | ||
259 | #define F_DSROFLOW 0x100 | ||
260 | #define F_DSRIFLOW 0x200 | ||
261 | |||
262 | #define FI_NORX 0x1 | ||
263 | #define FI_RAW 0x2 | ||
264 | #define FI_ISTRIP 0x4 | ||
265 | #define FI_UCLC 0x8 | ||
266 | #define FI_INLCR 0x10 | ||
267 | #define FI_ICRNL 0x20 | ||
268 | #define FI_IGNCR 0x40 | ||
269 | #define FI_IGNBREAK 0x80 | ||
270 | #define FI_DSCRDBREAK 0x100 | ||
271 | #define FI_1MARKBREAK 0x200 | ||
272 | #define FI_2MARKBREAK 0x400 | ||
273 | #define FI_XCHNGBREAK 0x800 | ||
274 | #define FI_IGNRXERRS 0x1000 | ||
275 | #define FI_DSCDRXERRS 0x2000 | ||
276 | #define FI_1MARKRXERRS 0x4000 | ||
277 | #define FI_2MARKRXERRS 0x8000 | ||
278 | #define FI_XCHNGRXERRS 0x10000 | ||
279 | #define FI_DSCRDNULL 0x20000 | ||
280 | |||
281 | #define FO_OLCUC 0x1 | ||
282 | #define FO_ONLCR 0x2 | ||
283 | #define FO_OOCRNL 0x4 | ||
284 | #define FO_ONOCR 0x8 | ||
285 | #define FO_ONLRET 0x10 | ||
286 | #define FO_ONL 0x20 | ||
287 | #define FO_OBS 0x40 | ||
288 | #define FO_OVT 0x80 | ||
289 | #define FO_OFF 0x100 | ||
290 | #define FO_OTAB1 0x200 | ||
291 | #define FO_OTAB2 0x400 | ||
292 | #define FO_OTAB3 0x800 | ||
293 | #define FO_OCR1 0x1000 | ||
294 | #define FO_OCR2 0x2000 | ||
295 | #define FO_OCR3 0x4000 | ||
296 | #define FO_OFILL 0x8000 | ||
297 | #define FO_ODELL 0x10000 | ||
298 | |||
299 | #define P_RTSLOCK 0x1 | ||
300 | #define P_CTSLOCK 0x2 | ||
301 | #define P_MAPRTS 0x4 | ||
302 | #define P_MAPCTS 0x8 | ||
303 | #define P_LOOPBACK 0x10 | ||
304 | #define P_DTRFOLLOW 0x20 | ||
305 | #define P_FAKEDCD 0x40 | ||
306 | |||
307 | #define P_RXIMIN 0x10000 | ||
308 | #define P_RXITIME 0x20000 | ||
309 | #define P_RXTHOLD 0x40000 | ||
310 | |||
311 | /* | ||
312 | * Define a structure to communicate serial port signal and data state | ||
313 | * information. | ||
314 | */ | ||
315 | typedef struct asysigs { | ||
316 | unsigned long data; | ||
317 | unsigned long signal; | ||
318 | unsigned long sigvalue; | ||
319 | } asysigs_t; | ||
320 | |||
321 | #define DT_TXBUSY 0x1 | ||
322 | #define DT_TXEMPTY 0x2 | ||
323 | #define DT_TXLOW 0x4 | ||
324 | #define DT_TXHIGH 0x8 | ||
325 | #define DT_TXFULL 0x10 | ||
326 | #define DT_TXHOG 0x20 | ||
327 | #define DT_TXFLOWED 0x40 | ||
328 | #define DT_TXBREAK 0x80 | ||
329 | |||
330 | #define DT_RXBUSY 0x100 | ||
331 | #define DT_RXEMPTY 0x200 | ||
332 | #define DT_RXLOW 0x400 | ||
333 | #define DT_RXHIGH 0x800 | ||
334 | #define DT_RXFULL 0x1000 | ||
335 | #define DT_RXHOG 0x2000 | ||
336 | #define DT_RXFLOWED 0x4000 | ||
337 | #define DT_RXBREAK 0x8000 | ||
338 | |||
339 | #define SG_DTR 0x1 | ||
340 | #define SG_DCD 0x2 | ||
341 | #define SG_RTS 0x4 | ||
342 | #define SG_CTS 0x8 | ||
343 | #define SG_DSR 0x10 | ||
344 | #define SG_RI 0x20 | ||
345 | |||
346 | /* | ||
347 | * Define the notification setting structure. This is used to tell the | ||
348 | * port what events we want to be informed about. Fields here use the | ||
349 | * same defines as for the asysigs structure above. | ||
350 | */ | ||
351 | typedef struct asynotify { | ||
352 | unsigned long ctrl; | ||
353 | unsigned long data; | ||
354 | unsigned long signal; | ||
355 | unsigned long sigvalue; | ||
356 | } asynotify_t; | ||
357 | |||
358 | /* | ||
359 | * Define the port control structure. It is used to do fine grain | ||
360 | * control operations on the port. | ||
361 | */ | ||
362 | typedef struct { | ||
363 | unsigned long rxctrl; | ||
364 | unsigned long txctrl; | ||
365 | char rximdch; | ||
366 | char tximdch; | ||
367 | char spare1; | ||
368 | char spare2; | ||
369 | } asyctrl_t; | ||
370 | |||
371 | #define CT_ENABLE 0x1 | ||
372 | #define CT_DISABLE 0x2 | ||
373 | #define CT_STOP 0x4 | ||
374 | #define CT_START 0x8 | ||
375 | #define CT_STARTFLOW 0x10 | ||
376 | #define CT_STOPFLOW 0x20 | ||
377 | #define CT_SENDCHR 0x40 | ||
378 | |||
379 | /* | ||
380 | * Define the stats structure kept for each port. This is a useful set | ||
381 | * of data collected for each port on the slave. The A_GETSTATS command | ||
382 | * is used to retrieve this data from the slave. | ||
383 | */ | ||
384 | typedef struct asystats { | ||
385 | unsigned long opens; | ||
386 | unsigned long txchars; | ||
387 | unsigned long rxchars; | ||
388 | unsigned long txringq; | ||
389 | unsigned long rxringq; | ||
390 | unsigned long txmsgs; | ||
391 | unsigned long rxmsgs; | ||
392 | unsigned long txflushes; | ||
393 | unsigned long rxflushes; | ||
394 | unsigned long overruns; | ||
395 | unsigned long framing; | ||
396 | unsigned long parity; | ||
397 | unsigned long ringover; | ||
398 | unsigned long lost; | ||
399 | unsigned long rxstart; | ||
400 | unsigned long rxstop; | ||
401 | unsigned long txstart; | ||
402 | unsigned long txstop; | ||
403 | unsigned long dcdcnt; | ||
404 | unsigned long dtrcnt; | ||
405 | unsigned long ctscnt; | ||
406 | unsigned long rtscnt; | ||
407 | unsigned long dsrcnt; | ||
408 | unsigned long ricnt; | ||
409 | unsigned long txbreaks; | ||
410 | unsigned long rxbreaks; | ||
411 | unsigned long signals; | ||
412 | unsigned long state; | ||
413 | unsigned long hwid; | ||
414 | } asystats_t; | ||
415 | |||
416 | /*****************************************************************************/ | ||
417 | |||
418 | /* | ||
419 | * All command and control communication with a device on the slave is | ||
420 | * via a control block in shared memory. Each device has its own control | ||
421 | * block, defined by the following structure. The control block allows | ||
422 | * the host to open, close and control the device on the slave. | ||
423 | */ | ||
424 | typedef struct cdkctrl { | ||
425 | unsigned char open; | ||
426 | unsigned char close; | ||
427 | unsigned long openarg; | ||
428 | unsigned long closearg; | ||
429 | unsigned long cmd; | ||
430 | unsigned long status; | ||
431 | unsigned long args[32]; | ||
432 | } cdkctrl_t; | ||
433 | |||
434 | /* | ||
435 | * Each device on the slave passes data to and from the host via a ring | ||
436 | * queue in shared memory. Define a ring queue structure to hold the | ||
437 | * vital information about each ring queue. Two ring queues will be | ||
438 | * allocated for each port, one for receive data and one for transmit | ||
439 | * data. | ||
440 | */ | ||
441 | typedef struct cdkasyrq { | ||
442 | unsigned long offset; | ||
443 | unsigned short size; | ||
444 | unsigned short head; | ||
445 | unsigned short tail; | ||
446 | } cdkasyrq_t; | ||
447 | |||
448 | /* | ||
449 | * Each asynchronous port is defined in shared memory by the following | ||
450 | * structure. It contains a control block to command a device, and also | ||
451 | * the necessary data channel information as well. | ||
452 | */ | ||
453 | typedef struct cdkasy { | ||
454 | cdkctrl_t ctrl; | ||
455 | unsigned short notify; | ||
456 | asynotify_t changed; | ||
457 | unsigned short receive; | ||
458 | cdkasyrq_t rxq; | ||
459 | unsigned short transmit; | ||
460 | cdkasyrq_t txq; | ||
461 | } cdkasy_t; | ||
462 | |||
463 | #pragma pack() | ||
464 | |||
465 | /*****************************************************************************/ | ||
466 | |||
467 | /* | ||
468 | * Define the set of ioctls used by the driver to do special things | ||
469 | * to the board. These include interrupting it, and initializing | ||
470 | * the driver after board startup and shutdown. | ||
471 | */ | ||
472 | #include <linux/ioctl.h> | ||
473 | |||
474 | #define STL_BINTR _IO('s',20) | ||
475 | #define STL_BSTART _IO('s',21) | ||
476 | #define STL_BSTOP _IO('s',22) | ||
477 | #define STL_BRESET _IO('s',23) | ||
478 | |||
479 | /* | ||
480 | * Define a set of ioctl extensions, used to get at special stuff. | ||
481 | */ | ||
482 | #define STL_GETPFLAG _IO('s',80) | ||
483 | #define STL_SETPFLAG _IO('s',81) | ||
484 | |||
485 | /*****************************************************************************/ | ||
486 | #endif | ||
diff --git a/include/linux/cgroupstats.h b/include/linux/cgroupstats.h new file mode 100644 index 00000000000..3753c33160d --- /dev/null +++ b/include/linux/cgroupstats.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* cgroupstats.h - exporting per-cgroup statistics | ||
2 | * | ||
3 | * Copyright IBM Corporation, 2007 | ||
4 | * Author Balbir Singh <balbir@linux.vnet.ibm.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of version 2.1 of the GNU Lesser General Public License | ||
8 | * as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it would be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_CGROUPSTATS_H | ||
16 | #define _LINUX_CGROUPSTATS_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | #include <linux/taskstats.h> | ||
20 | |||
21 | /* | ||
22 | * Data shared between user space and kernel space on a per cgroup | ||
23 | * basis. This data is shared using taskstats. | ||
24 | * | ||
25 | * Most of these states are derived by looking at the task->state value | ||
26 | * For the nr_io_wait state, a flag in the delay accounting structure | ||
27 | * indicates that the task is waiting on IO | ||
28 | * | ||
29 | * Each member is aligned to a 8 byte boundary. | ||
30 | */ | ||
31 | struct cgroupstats { | ||
32 | __u64 nr_sleeping; /* Number of tasks sleeping */ | ||
33 | __u64 nr_running; /* Number of tasks running */ | ||
34 | __u64 nr_stopped; /* Number of tasks in stopped state */ | ||
35 | __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */ | ||
36 | /* state */ | ||
37 | __u64 nr_io_wait; /* Number of tasks waiting on IO */ | ||
38 | }; | ||
39 | |||
40 | /* | ||
41 | * Commands sent from userspace | ||
42 | * Not versioned. New commands should only be inserted at the enum's end | ||
43 | * prior to __CGROUPSTATS_CMD_MAX | ||
44 | */ | ||
45 | |||
46 | enum { | ||
47 | CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */ | ||
48 | CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */ | ||
49 | CGROUPSTATS_CMD_NEW, /* kernel->user event */ | ||
50 | __CGROUPSTATS_CMD_MAX, | ||
51 | }; | ||
52 | |||
53 | #define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1) | ||
54 | |||
55 | enum { | ||
56 | CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */ | ||
57 | CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */ | ||
58 | __CGROUPSTATS_TYPE_MAX, | ||
59 | }; | ||
60 | |||
61 | #define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1) | ||
62 | |||
63 | enum { | ||
64 | CGROUPSTATS_CMD_ATTR_UNSPEC = 0, | ||
65 | CGROUPSTATS_CMD_ATTR_FD, | ||
66 | __CGROUPSTATS_CMD_ATTR_MAX, | ||
67 | }; | ||
68 | |||
69 | #define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1) | ||
70 | |||
71 | #endif /* _LINUX_CGROUPSTATS_H */ | ||
diff --git a/include/linux/chio.h b/include/linux/chio.h new file mode 100644 index 00000000000..d9bac7f9728 --- /dev/null +++ b/include/linux/chio.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * ioctl interface for the scsi media changer driver | ||
3 | */ | ||
4 | |||
5 | /* changer element types */ | ||
6 | #define CHET_MT 0 /* media transport element (robot) */ | ||
7 | #define CHET_ST 1 /* storage element (media slots) */ | ||
8 | #define CHET_IE 2 /* import/export element */ | ||
9 | #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */ | ||
10 | #define CHET_V1 4 /* vendor specific #1 */ | ||
11 | #define CHET_V2 5 /* vendor specific #2 */ | ||
12 | #define CHET_V3 6 /* vendor specific #3 */ | ||
13 | #define CHET_V4 7 /* vendor specific #4 */ | ||
14 | |||
15 | |||
16 | /* | ||
17 | * CHIOGPARAMS | ||
18 | * query changer properties | ||
19 | * | ||
20 | * CHIOVGPARAMS | ||
21 | * query vendor-specific element types | ||
22 | * | ||
23 | * accessing elements works by specifing type and unit of the element. | ||
24 | * for example, storage elements are addressed with type = CHET_ST and | ||
25 | * unit = 0 .. cp_nslots-1 | ||
26 | * | ||
27 | */ | ||
28 | struct changer_params { | ||
29 | int cp_curpicker; /* current transport element */ | ||
30 | int cp_npickers; /* number of transport elements (CHET_MT) */ | ||
31 | int cp_nslots; /* number of storage elements (CHET_ST) */ | ||
32 | int cp_nportals; /* number of import/export elements (CHET_IE) */ | ||
33 | int cp_ndrives; /* number of data transfer elements (CHET_DT) */ | ||
34 | }; | ||
35 | struct changer_vendor_params { | ||
36 | int cvp_n1; /* number of vendor specific elems (CHET_V1) */ | ||
37 | char cvp_label1[16]; | ||
38 | int cvp_n2; /* number of vendor specific elems (CHET_V2) */ | ||
39 | char cvp_label2[16]; | ||
40 | int cvp_n3; /* number of vendor specific elems (CHET_V3) */ | ||
41 | char cvp_label3[16]; | ||
42 | int cvp_n4; /* number of vendor specific elems (CHET_V4) */ | ||
43 | char cvp_label4[16]; | ||
44 | int reserved[8]; | ||
45 | }; | ||
46 | |||
47 | |||
48 | /* | ||
49 | * CHIOMOVE | ||
50 | * move a medium from one element to another | ||
51 | */ | ||
52 | struct changer_move { | ||
53 | int cm_fromtype; /* type/unit of source element */ | ||
54 | int cm_fromunit; | ||
55 | int cm_totype; /* type/unit of destination element */ | ||
56 | int cm_tounit; | ||
57 | int cm_flags; | ||
58 | }; | ||
59 | #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */ | ||
60 | |||
61 | |||
62 | /* | ||
63 | * CHIOEXCHANGE | ||
64 | * move one medium from element #1 to element #2, | ||
65 | * and another one from element #2 to element #3. | ||
66 | * element #1 and #3 are allowed to be identical. | ||
67 | */ | ||
68 | struct changer_exchange { | ||
69 | int ce_srctype; /* type/unit of element #1 */ | ||
70 | int ce_srcunit; | ||
71 | int ce_fdsttype; /* type/unit of element #2 */ | ||
72 | int ce_fdstunit; | ||
73 | int ce_sdsttype; /* type/unit of element #3 */ | ||
74 | int ce_sdstunit; | ||
75 | int ce_flags; | ||
76 | }; | ||
77 | #define CE_INVERT1 1 | ||
78 | #define CE_INVERT2 2 | ||
79 | |||
80 | |||
81 | /* | ||
82 | * CHIOPOSITION | ||
83 | * move the transport element (robot arm) to a specific element. | ||
84 | */ | ||
85 | struct changer_position { | ||
86 | int cp_type; | ||
87 | int cp_unit; | ||
88 | int cp_flags; | ||
89 | }; | ||
90 | #define CP_INVERT 1 | ||
91 | |||
92 | |||
93 | /* | ||
94 | * CHIOGSTATUS | ||
95 | * get element status for all elements of a specific type | ||
96 | */ | ||
97 | struct changer_element_status { | ||
98 | int ces_type; | ||
99 | unsigned char __user *ces_data; | ||
100 | }; | ||
101 | #define CESTATUS_FULL 0x01 /* full */ | ||
102 | #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ | ||
103 | #define CESTATUS_EXCEPT 0x04 /* error condition */ | ||
104 | #define CESTATUS_ACCESS 0x08 /* access allowed */ | ||
105 | #define CESTATUS_EXENAB 0x10 /* element can export media */ | ||
106 | #define CESTATUS_INENAB 0x20 /* element can import media */ | ||
107 | |||
108 | |||
109 | /* | ||
110 | * CHIOGELEM | ||
111 | * get more detailed status information for a single element | ||
112 | */ | ||
113 | struct changer_get_element { | ||
114 | int cge_type; /* type/unit */ | ||
115 | int cge_unit; | ||
116 | int cge_status; /* status */ | ||
117 | int cge_errno; /* errno */ | ||
118 | int cge_srctype; /* source element of the last move/exchange */ | ||
119 | int cge_srcunit; | ||
120 | int cge_id; /* scsi id (for data transfer elements) */ | ||
121 | int cge_lun; /* scsi lun (for data transfer elements) */ | ||
122 | char cge_pvoltag[36]; /* primary volume tag */ | ||
123 | char cge_avoltag[36]; /* alternate volume tag */ | ||
124 | int cge_flags; | ||
125 | }; | ||
126 | /* flags */ | ||
127 | #define CGE_ERRNO 0x01 /* errno available */ | ||
128 | #define CGE_INVERT 0x02 /* media inverted */ | ||
129 | #define CGE_SRC 0x04 /* media src available */ | ||
130 | #define CGE_IDLUN 0x08 /* ID+LUN available */ | ||
131 | #define CGE_PVOLTAG 0x10 /* primary volume tag available */ | ||
132 | #define CGE_AVOLTAG 0x20 /* alternate volume tag available */ | ||
133 | |||
134 | |||
135 | /* | ||
136 | * CHIOSVOLTAG | ||
137 | * set volume tag | ||
138 | */ | ||
139 | struct changer_set_voltag { | ||
140 | int csv_type; /* type/unit */ | ||
141 | int csv_unit; | ||
142 | char csv_voltag[36]; /* volume tag */ | ||
143 | int csv_flags; | ||
144 | }; | ||
145 | #define CSV_PVOLTAG 0x01 /* primary volume tag */ | ||
146 | #define CSV_AVOLTAG 0x02 /* alternate volume tag */ | ||
147 | #define CSV_CLEARTAG 0x04 /* clear volume tag */ | ||
148 | |||
149 | /* ioctls */ | ||
150 | #define CHIOMOVE _IOW('c', 1,struct changer_move) | ||
151 | #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange) | ||
152 | #define CHIOPOSITION _IOW('c', 3,struct changer_position) | ||
153 | #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */ | ||
154 | #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */ | ||
155 | #define CHIOGPARAMS _IOR('c', 6,struct changer_params) | ||
156 | #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status) | ||
157 | #define CHIOGELEM _IOW('c',16,struct changer_get_element) | ||
158 | #define CHIOINITELEM _IO('c',17) | ||
159 | #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag) | ||
160 | #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params) | ||
161 | |||
162 | /* ---------------------------------------------------------------------- */ | ||
163 | |||
164 | /* | ||
165 | * Local variables: | ||
166 | * c-basic-offset: 8 | ||
167 | * End: | ||
168 | */ | ||
diff --git a/include/linux/cm3217.h b/include/linux/cm3217.h new file mode 100644 index 00000000000..29c72b58f8e --- /dev/null +++ b/include/linux/cm3217.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* include/linux/cm3217.h | ||
2 | * | ||
3 | * Copyright (C) 2011 Capella Microsystems Inc. | ||
4 | * Author: Frank Hsieh <pengyueh@gmail.com> | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef __LINUX_CM3217_H | ||
18 | #define __LINUX_CM3217_H | ||
19 | |||
20 | #define CM3217_I2C_NAME "cm3217" | ||
21 | |||
22 | #define ALS_W_CMD1_addr (0x20 >> 1) | ||
23 | #define ALS_W_CMD2_addr (0x22 >> 1) | ||
24 | #define ALS_R_MSB_addr (0x21 >> 1) | ||
25 | #define ALS_R_LSB_addr (0x23 >> 1) | ||
26 | |||
27 | #define ALS_CALIBRATED 0x6E93 | ||
28 | |||
29 | /* cm3217 */ | ||
30 | |||
31 | /* for ALS command 20h */ | ||
32 | #define CM3217_ALS_BIT5_Default_1 (1 << 5) | ||
33 | #define CM3217_ALS_IT_HALF_T (0 << 2) | ||
34 | #define CM3217_ALS_IT_1_T (1 << 2) | ||
35 | #define CM3217_ALS_IT_2_T (2 << 2) | ||
36 | #define CM3217_ALS_IT_4_T (4 << 2) | ||
37 | #define CM3217_ALS_WDM_DEFAULT_1 (1 << 1) | ||
38 | #define CM3217_ALS_SD (1 << 0) | ||
39 | |||
40 | /* for ALS command 22h */ | ||
41 | #define CM3217_ALS_IT_800ms (0 << 5) | ||
42 | #define CM3217_ALS_IT_400ms (1 << 5) | ||
43 | #define CM3217_ALS_IT_266ms (2 << 5) | ||
44 | #define CM3217_ALS_IT_200ms (3 << 5) | ||
45 | #define CM3217_ALS_IT_130ms (4 << 5) | ||
46 | #define CM3217_ALS_IT_100ms (5 << 5) | ||
47 | #define CM3217_ALS_IT_80ms (6 << 5) | ||
48 | #define CM3217_ALS_IT_66ms (7 << 5) | ||
49 | |||
50 | struct cm3217_platform_data { | ||
51 | uint16_t levels[10]; | ||
52 | uint16_t golden_adc; | ||
53 | int (*power) (int, uint8_t); /* power to the chip */ | ||
54 | uint16_t ALS_slave_address; | ||
55 | }; | ||
56 | |||
57 | #define LS_PWR_ON (1 << 0) | ||
58 | |||
59 | #endif | ||
diff --git a/include/linux/coff.h b/include/linux/coff.h new file mode 100644 index 00000000000..6354a7fe22b --- /dev/null +++ b/include/linux/coff.h | |||
@@ -0,0 +1,351 @@ | |||
1 | /* This file is derived from the GAS 2.1.4 assembler control file. | ||
2 | The GAS product is under the GNU General Public License, version 2 or later. | ||
3 | As such, this file is also under that license. | ||
4 | |||
5 | If the file format changes in the COFF object, this file should be | ||
6 | subsequently updated to reflect the changes. | ||
7 | |||
8 | The actual loader module only uses a few of these structures. The full | ||
9 | set is documented here because I received the full set. If you wish | ||
10 | more information about COFF, then O'Reilly has a very excellent book. | ||
11 | */ | ||
12 | |||
13 | #define E_SYMNMLEN 8 /* Number of characters in a symbol name */ | ||
14 | #define E_FILNMLEN 14 /* Number of characters in a file name */ | ||
15 | #define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */ | ||
16 | |||
17 | /* | ||
18 | * These defines are byte order independent. There is no alignment of fields | ||
19 | * permitted in the structures. Therefore they are declared as characters | ||
20 | * and the values loaded from the character positions. It also makes it | ||
21 | * nice to have it "endian" independent. | ||
22 | */ | ||
23 | |||
24 | /* Load a short int from the following tables with little-endian formats */ | ||
25 | #define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ | ||
26 | ((unsigned short)((unsigned char)ps[0])))) | ||
27 | |||
28 | /* Load a long int from the following tables with little-endian formats */ | ||
29 | #define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ | ||
30 | ((unsigned long)((unsigned char)ps[2])<<16) |\ | ||
31 | ((unsigned long)((unsigned char)ps[1])<<8) |\ | ||
32 | ((unsigned long)((unsigned char)ps[0]))))) | ||
33 | |||
34 | /* Load a short int from the following tables with big-endian formats */ | ||
35 | #define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\ | ||
36 | ((unsigned short)((unsigned char)ps[1])))) | ||
37 | |||
38 | /* Load a long int from the following tables with big-endian formats */ | ||
39 | #define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ | ||
40 | ((unsigned long)((unsigned char)ps[1])<<16) |\ | ||
41 | ((unsigned long)((unsigned char)ps[2])<<8) |\ | ||
42 | ((unsigned long)((unsigned char)ps[3]))))) | ||
43 | |||
44 | /* These may be overridden later by brain dead implementations which generate | ||
45 | a big-endian header with little-endian data. In that case, generate a | ||
46 | replacement macro which tests a flag and uses either of the two above | ||
47 | as appropriate. */ | ||
48 | |||
49 | #define COFF_LONG(v) COFF_LONG_L(v) | ||
50 | #define COFF_SHORT(v) COFF_SHORT_L(v) | ||
51 | |||
52 | /*** coff information for Intel 386/486. */ | ||
53 | |||
54 | /********************** FILE HEADER **********************/ | ||
55 | |||
56 | struct COFF_filehdr { | ||
57 | char f_magic[2]; /* magic number */ | ||
58 | char f_nscns[2]; /* number of sections */ | ||
59 | char f_timdat[4]; /* time & date stamp */ | ||
60 | char f_symptr[4]; /* file pointer to symtab */ | ||
61 | char f_nsyms[4]; /* number of symtab entries */ | ||
62 | char f_opthdr[2]; /* sizeof(optional hdr) */ | ||
63 | char f_flags[2]; /* flags */ | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | * Bits for f_flags: | ||
68 | * | ||
69 | * F_RELFLG relocation info stripped from file | ||
70 | * F_EXEC file is executable (i.e. no unresolved external | ||
71 | * references) | ||
72 | * F_LNNO line numbers stripped from file | ||
73 | * F_LSYMS local symbols stripped from file | ||
74 | * F_MINMAL this is a minimal object file (".m") output of fextract | ||
75 | * F_UPDATE this is a fully bound update file, output of ogen | ||
76 | * F_SWABD this file has had its bytes swabbed (in names) | ||
77 | * F_AR16WR this file has the byte ordering of an AR16WR | ||
78 | * (e.g. 11/70) machine | ||
79 | * F_AR32WR this file has the byte ordering of an AR32WR machine | ||
80 | * (e.g. vax and iNTEL 386) | ||
81 | * F_AR32W this file has the byte ordering of an AR32W machine | ||
82 | * (e.g. 3b,maxi) | ||
83 | * F_PATCH file contains "patch" list in optional header | ||
84 | * F_NODF (minimal file only) no decision functions for | ||
85 | * replaced functions | ||
86 | */ | ||
87 | |||
88 | #define COFF_F_RELFLG 0000001 | ||
89 | #define COFF_F_EXEC 0000002 | ||
90 | #define COFF_F_LNNO 0000004 | ||
91 | #define COFF_F_LSYMS 0000010 | ||
92 | #define COFF_F_MINMAL 0000020 | ||
93 | #define COFF_F_UPDATE 0000040 | ||
94 | #define COFF_F_SWABD 0000100 | ||
95 | #define COFF_F_AR16WR 0000200 | ||
96 | #define COFF_F_AR32WR 0000400 | ||
97 | #define COFF_F_AR32W 0001000 | ||
98 | #define COFF_F_PATCH 0002000 | ||
99 | #define COFF_F_NODF 0002000 | ||
100 | |||
101 | #define COFF_I386MAGIC 0x14c /* Linux's system */ | ||
102 | |||
103 | #if 0 /* Perhaps, someday, these formats may be used. */ | ||
104 | #define COFF_I386PTXMAGIC 0x154 | ||
105 | #define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */ | ||
106 | #define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \ | ||
107 | && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \ | ||
108 | && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC) | ||
109 | #else | ||
110 | #define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) | ||
111 | #endif | ||
112 | |||
113 | #define COFF_FILHDR struct COFF_filehdr | ||
114 | #define COFF_FILHSZ sizeof(COFF_FILHDR) | ||
115 | |||
116 | /********************** AOUT "OPTIONAL HEADER" **********************/ | ||
117 | |||
118 | /* Linux COFF must have this "optional" header. Standard COFF has no entry | ||
119 | location for the "entry" point. They normally would start with the first | ||
120 | location of the .text section. This is not a good idea for linux. So, | ||
121 | the use of this "optional" header is not optional. It is required. | ||
122 | |||
123 | Do not be tempted to assume that the size of the optional header is | ||
124 | a constant and simply index the next byte by the size of this structure. | ||
125 | Use the 'f_opthdr' field in the main coff header for the size of the | ||
126 | structure actually written to the file!! | ||
127 | */ | ||
128 | |||
129 | typedef struct | ||
130 | { | ||
131 | char magic[2]; /* type of file */ | ||
132 | char vstamp[2]; /* version stamp */ | ||
133 | char tsize[4]; /* text size in bytes, padded to FW bdry */ | ||
134 | char dsize[4]; /* initialized data " " */ | ||
135 | char bsize[4]; /* uninitialized data " " */ | ||
136 | char entry[4]; /* entry pt. */ | ||
137 | char text_start[4]; /* base of text used for this file */ | ||
138 | char data_start[4]; /* base of data used for this file */ | ||
139 | } | ||
140 | COFF_AOUTHDR; | ||
141 | |||
142 | #define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) | ||
143 | |||
144 | #define COFF_STMAGIC 0401 | ||
145 | #define COFF_OMAGIC 0404 | ||
146 | #define COFF_JMAGIC 0407 /* dirty text and data image, can't share */ | ||
147 | #define COFF_DMAGIC 0410 /* dirty text segment, data aligned */ | ||
148 | #define COFF_ZMAGIC 0413 /* The proper magic number for executables */ | ||
149 | #define COFF_SHMAGIC 0443 /* shared library header */ | ||
150 | |||
151 | /********************** SECTION HEADER **********************/ | ||
152 | |||
153 | struct COFF_scnhdr { | ||
154 | char s_name[8]; /* section name */ | ||
155 | char s_paddr[4]; /* physical address, aliased s_nlib */ | ||
156 | char s_vaddr[4]; /* virtual address */ | ||
157 | char s_size[4]; /* section size */ | ||
158 | char s_scnptr[4]; /* file ptr to raw data for section */ | ||
159 | char s_relptr[4]; /* file ptr to relocation */ | ||
160 | char s_lnnoptr[4]; /* file ptr to line numbers */ | ||
161 | char s_nreloc[2]; /* number of relocation entries */ | ||
162 | char s_nlnno[2]; /* number of line number entries */ | ||
163 | char s_flags[4]; /* flags */ | ||
164 | }; | ||
165 | |||
166 | #define COFF_SCNHDR struct COFF_scnhdr | ||
167 | #define COFF_SCNHSZ sizeof(COFF_SCNHDR) | ||
168 | |||
169 | /* | ||
170 | * names of "special" sections | ||
171 | */ | ||
172 | |||
173 | #define COFF_TEXT ".text" | ||
174 | #define COFF_DATA ".data" | ||
175 | #define COFF_BSS ".bss" | ||
176 | #define COFF_COMMENT ".comment" | ||
177 | #define COFF_LIB ".lib" | ||
178 | |||
179 | #define COFF_SECT_TEXT 0 /* Section for instruction code */ | ||
180 | #define COFF_SECT_DATA 1 /* Section for initialized globals */ | ||
181 | #define COFF_SECT_BSS 2 /* Section for un-initialized globals */ | ||
182 | #define COFF_SECT_REQD 3 /* Minimum number of sections for good file */ | ||
183 | |||
184 | #define COFF_STYP_REG 0x00 /* regular segment */ | ||
185 | #define COFF_STYP_DSECT 0x01 /* dummy segment */ | ||
186 | #define COFF_STYP_NOLOAD 0x02 /* no-load segment */ | ||
187 | #define COFF_STYP_GROUP 0x04 /* group segment */ | ||
188 | #define COFF_STYP_PAD 0x08 /* .pad segment */ | ||
189 | #define COFF_STYP_COPY 0x10 /* copy section */ | ||
190 | #define COFF_STYP_TEXT 0x20 /* .text segment */ | ||
191 | #define COFF_STYP_DATA 0x40 /* .data segment */ | ||
192 | #define COFF_STYP_BSS 0x80 /* .bss segment */ | ||
193 | #define COFF_STYP_INFO 0x200 /* .comment section */ | ||
194 | #define COFF_STYP_OVER 0x400 /* overlay section */ | ||
195 | #define COFF_STYP_LIB 0x800 /* library section */ | ||
196 | |||
197 | /* | ||
198 | * Shared libraries have the following section header in the data field for | ||
199 | * each library. | ||
200 | */ | ||
201 | |||
202 | struct COFF_slib { | ||
203 | char sl_entsz[4]; /* Size of this entry */ | ||
204 | char sl_pathndx[4]; /* size of the header field */ | ||
205 | }; | ||
206 | |||
207 | #define COFF_SLIBHD struct COFF_slib | ||
208 | #define COFF_SLIBSZ sizeof(COFF_SLIBHD) | ||
209 | |||
210 | /********************** LINE NUMBERS **********************/ | ||
211 | |||
212 | /* 1 line number entry for every "breakpointable" source line in a section. | ||
213 | * Line numbers are grouped on a per function basis; first entry in a function | ||
214 | * grouping will have l_lnno = 0 and in place of physical address will be the | ||
215 | * symbol table index of the function name. | ||
216 | */ | ||
217 | |||
218 | struct COFF_lineno { | ||
219 | union { | ||
220 | char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ | ||
221 | char l_paddr[4]; /* (physical) address of line number */ | ||
222 | } l_addr; | ||
223 | char l_lnno[2]; /* line number */ | ||
224 | }; | ||
225 | |||
226 | #define COFF_LINENO struct COFF_lineno | ||
227 | #define COFF_LINESZ 6 | ||
228 | |||
229 | /********************** SYMBOLS **********************/ | ||
230 | |||
231 | #define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */ | ||
232 | #define COFF_E_FILNMLEN 14 /* # characters in a file name */ | ||
233 | #define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */ | ||
234 | |||
235 | /* | ||
236 | * All symbols and sections have the following definition | ||
237 | */ | ||
238 | |||
239 | struct COFF_syment | ||
240 | { | ||
241 | union { | ||
242 | char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */ | ||
243 | struct { | ||
244 | char e_zeroes[4]; /* Leading zeros */ | ||
245 | char e_offset[4]; /* Offset if this is a header section */ | ||
246 | } e; | ||
247 | } e; | ||
248 | |||
249 | char e_value[4]; /* Value (address) of the segment */ | ||
250 | char e_scnum[2]; /* Section number */ | ||
251 | char e_type[2]; /* Type of section */ | ||
252 | char e_sclass[1]; /* Loader class */ | ||
253 | char e_numaux[1]; /* Number of auxiliary entries which follow */ | ||
254 | }; | ||
255 | |||
256 | #define COFF_N_BTMASK (0xf) /* Mask for important class bits */ | ||
257 | #define COFF_N_TMASK (0x30) /* Mask for important type bits */ | ||
258 | #define COFF_N_BTSHFT (4) /* # bits to shift class field */ | ||
259 | #define COFF_N_TSHIFT (2) /* # bits to shift type field */ | ||
260 | |||
261 | /* | ||
262 | * Auxiliary entries because the main table is too limiting. | ||
263 | */ | ||
264 | |||
265 | union COFF_auxent { | ||
266 | |||
267 | /* | ||
268 | * Debugger information | ||
269 | */ | ||
270 | |||
271 | struct { | ||
272 | char x_tagndx[4]; /* str, un, or enum tag indx */ | ||
273 | union { | ||
274 | struct { | ||
275 | char x_lnno[2]; /* declaration line number */ | ||
276 | char x_size[2]; /* str/union/array size */ | ||
277 | } x_lnsz; | ||
278 | char x_fsize[4]; /* size of function */ | ||
279 | } x_misc; | ||
280 | |||
281 | union { | ||
282 | struct { /* if ISFCN, tag, or .bb */ | ||
283 | char x_lnnoptr[4]; /* ptr to fcn line # */ | ||
284 | char x_endndx[4]; /* entry ndx past block end */ | ||
285 | } x_fcn; | ||
286 | |||
287 | struct { /* if ISARY, up to 4 dimen. */ | ||
288 | char x_dimen[E_DIMNUM][2]; | ||
289 | } x_ary; | ||
290 | } x_fcnary; | ||
291 | |||
292 | char x_tvndx[2]; /* tv index */ | ||
293 | } x_sym; | ||
294 | |||
295 | /* | ||
296 | * Source file names (debugger information) | ||
297 | */ | ||
298 | |||
299 | union { | ||
300 | char x_fname[E_FILNMLEN]; | ||
301 | struct { | ||
302 | char x_zeroes[4]; | ||
303 | char x_offset[4]; | ||
304 | } x_n; | ||
305 | } x_file; | ||
306 | |||
307 | /* | ||
308 | * Section information | ||
309 | */ | ||
310 | |||
311 | struct { | ||
312 | char x_scnlen[4]; /* section length */ | ||
313 | char x_nreloc[2]; /* # relocation entries */ | ||
314 | char x_nlinno[2]; /* # line numbers */ | ||
315 | } x_scn; | ||
316 | |||
317 | /* | ||
318 | * Transfer vector (branch table) | ||
319 | */ | ||
320 | |||
321 | struct { | ||
322 | char x_tvfill[4]; /* tv fill value */ | ||
323 | char x_tvlen[2]; /* length of .tv */ | ||
324 | char x_tvran[2][2]; /* tv range */ | ||
325 | } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | ||
326 | }; | ||
327 | |||
328 | #define COFF_SYMENT struct COFF_syment | ||
329 | #define COFF_SYMESZ 18 | ||
330 | #define COFF_AUXENT union COFF_auxent | ||
331 | #define COFF_AUXESZ 18 | ||
332 | |||
333 | #define COFF_ETEXT "etext" | ||
334 | |||
335 | /********************** RELOCATION DIRECTIVES **********************/ | ||
336 | |||
337 | struct COFF_reloc { | ||
338 | char r_vaddr[4]; /* Virtual address of item */ | ||
339 | char r_symndx[4]; /* Symbol index in the symtab */ | ||
340 | char r_type[2]; /* Relocation type */ | ||
341 | }; | ||
342 | |||
343 | #define COFF_RELOC struct COFF_reloc | ||
344 | #define COFF_RELSZ 10 | ||
345 | |||
346 | #define COFF_DEF_DATA_SECTION_ALIGNMENT 4 | ||
347 | #define COFF_DEF_BSS_SECTION_ALIGNMENT 4 | ||
348 | #define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 | ||
349 | |||
350 | /* For new sections we haven't heard of before */ | ||
351 | #define COFF_DEF_SECTION_ALIGNMENT 4 | ||
diff --git a/include/linux/comstats.h b/include/linux/comstats.h new file mode 100644 index 00000000000..3f5ea8e8026 --- /dev/null +++ b/include/linux/comstats.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /*****************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * comstats.h -- Serial Port Stats. | ||
5 | * | ||
6 | * Copyright (C) 1996-1998 Stallion Technologies | ||
7 | * Copyright (C) 1994-1996 Greg Ungerer. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | /*****************************************************************************/ | ||
25 | #ifndef _COMSTATS_H | ||
26 | #define _COMSTATS_H | ||
27 | /*****************************************************************************/ | ||
28 | |||
29 | /* | ||
30 | * Serial port stats structure. The structure itself is UART | ||
31 | * independent, but some fields may be UART/driver specific (for | ||
32 | * example state). | ||
33 | */ | ||
34 | |||
35 | typedef struct { | ||
36 | unsigned long brd; | ||
37 | unsigned long panel; | ||
38 | unsigned long port; | ||
39 | unsigned long hwid; | ||
40 | unsigned long type; | ||
41 | unsigned long txtotal; | ||
42 | unsigned long rxtotal; | ||
43 | unsigned long txbuffered; | ||
44 | unsigned long rxbuffered; | ||
45 | unsigned long rxoverrun; | ||
46 | unsigned long rxparity; | ||
47 | unsigned long rxframing; | ||
48 | unsigned long rxlost; | ||
49 | unsigned long txbreaks; | ||
50 | unsigned long rxbreaks; | ||
51 | unsigned long txxon; | ||
52 | unsigned long txxoff; | ||
53 | unsigned long rxxon; | ||
54 | unsigned long rxxoff; | ||
55 | unsigned long txctson; | ||
56 | unsigned long txctsoff; | ||
57 | unsigned long rxrtson; | ||
58 | unsigned long rxrtsoff; | ||
59 | unsigned long modem; | ||
60 | unsigned long state; | ||
61 | unsigned long flags; | ||
62 | unsigned long ttystate; | ||
63 | unsigned long cflags; | ||
64 | unsigned long iflags; | ||
65 | unsigned long oflags; | ||
66 | unsigned long lflags; | ||
67 | unsigned long signals; | ||
68 | } comstats_t; | ||
69 | |||
70 | |||
71 | /* | ||
72 | * Board stats structure. Returns useful info about the board. | ||
73 | */ | ||
74 | |||
75 | #define COM_MAXPANELS 8 | ||
76 | |||
77 | typedef struct { | ||
78 | unsigned long panel; | ||
79 | unsigned long type; | ||
80 | unsigned long hwid; | ||
81 | unsigned long nrports; | ||
82 | } companel_t; | ||
83 | |||
84 | typedef struct { | ||
85 | unsigned long brd; | ||
86 | unsigned long type; | ||
87 | unsigned long hwid; | ||
88 | unsigned long state; | ||
89 | unsigned long ioaddr; | ||
90 | unsigned long ioaddr2; | ||
91 | unsigned long memaddr; | ||
92 | unsigned long irq; | ||
93 | unsigned long nrpanels; | ||
94 | unsigned long nrports; | ||
95 | companel_t panels[COM_MAXPANELS]; | ||
96 | } combrd_t; | ||
97 | |||
98 | |||
99 | /* | ||
100 | * Define the ioctl operations for stats stuff. | ||
101 | */ | ||
102 | #include <linux/ioctl.h> | ||
103 | |||
104 | #define COM_GETPORTSTATS _IO('c',30) | ||
105 | #define COM_CLRPORTSTATS _IO('c',31) | ||
106 | #define COM_GETBRDSTATS _IO('c',32) | ||
107 | |||
108 | |||
109 | /* | ||
110 | * Define the set of ioctls that give user level access to the | ||
111 | * private port, panel and board structures. The argument required | ||
112 | * will be driver dependent! | ||
113 | */ | ||
114 | #define COM_READPORT _IO('c',40) | ||
115 | #define COM_READBOARD _IO('c',41) | ||
116 | #define COM_READPANEL _IO('c',42) | ||
117 | |||
118 | /*****************************************************************************/ | ||
119 | #endif | ||
diff --git a/include/linux/const.h b/include/linux/const.h new file mode 100644 index 00000000000..c22c707c455 --- /dev/null +++ b/include/linux/const.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* const.h: Macros for dealing with constants. */ | ||
2 | |||
3 | #ifndef _LINUX_CONST_H | ||
4 | #define _LINUX_CONST_H | ||
5 | |||
6 | /* Some constant macros are used in both assembler and | ||
7 | * C code. Therefore we cannot annotate them always with | ||
8 | * 'UL' and other type specifiers unilaterally. We | ||
9 | * use the following macros to deal with this. | ||
10 | * | ||
11 | * Similarly, _AT() will cast an expression with a type in C, but | ||
12 | * leave it unchanged in asm. | ||
13 | */ | ||
14 | |||
15 | #ifdef __ASSEMBLY__ | ||
16 | #define _AC(X,Y) X | ||
17 | #define _AT(T,X) X | ||
18 | #else | ||
19 | #define __AC(X,Y) (X##Y) | ||
20 | #define _AC(X,Y) __AC(X,Y) | ||
21 | #define _AT(T,X) ((T)(X)) | ||
22 | #endif | ||
23 | |||
24 | #endif /* !(_LINUX_CONST_H) */ | ||
diff --git a/include/linux/cpuacct.h b/include/linux/cpuacct.h new file mode 100644 index 00000000000..8f68e733fe1 --- /dev/null +++ b/include/linux/cpuacct.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* include/linux/cpuacct.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _CPUACCT_H_ | ||
17 | #define _CPUACCT_H_ | ||
18 | |||
19 | #include <linux/cgroup.h> | ||
20 | |||
21 | #ifdef CONFIG_CGROUP_CPUACCT | ||
22 | |||
23 | /* | ||
24 | * Platform specific CPU frequency hooks for cpuacct. These functions are | ||
25 | * called from the scheduler. | ||
26 | */ | ||
27 | struct cpuacct_charge_calls { | ||
28 | /* | ||
29 | * Platforms can take advantage of this data and use | ||
30 | * per-cpu allocations if necessary. | ||
31 | */ | ||
32 | void (*init) (void **cpuacct_data); | ||
33 | void (*charge) (void *cpuacct_data, u64 cputime, unsigned int cpu); | ||
34 | void (*cpufreq_show) (void *cpuacct_data, struct cgroup_map_cb *cb); | ||
35 | /* Returns power consumed in milliWatt seconds */ | ||
36 | u64 (*power_usage) (void *cpuacct_data); | ||
37 | }; | ||
38 | |||
39 | int cpuacct_charge_register(struct cpuacct_charge_calls *fn); | ||
40 | |||
41 | #endif /* CONFIG_CGROUP_CPUACCT */ | ||
42 | |||
43 | #endif // _CPUACCT_H_ | ||
diff --git a/include/linux/cycx_cfm.h b/include/linux/cycx_cfm.h new file mode 100644 index 00000000000..032d26ed838 --- /dev/null +++ b/include/linux/cycx_cfm.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * cycx_cfm.h Cyclom 2X WAN Link Driver. | ||
3 | * Definitions for the Cyclom 2X Firmware Module (CFM). | ||
4 | * | ||
5 | * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | ||
6 | * | ||
7 | * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo | ||
8 | * | ||
9 | * Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | * ============================================================================ | ||
16 | * 1998/08/08 acme Initial version. | ||
17 | */ | ||
18 | #ifndef _CYCX_CFM_H | ||
19 | #define _CYCX_CFM_H | ||
20 | |||
21 | /* Defines */ | ||
22 | |||
23 | #define CFM_VERSION 2 | ||
24 | #define CFM_SIGNATURE "CFM - Cyclades CYCX Firmware Module" | ||
25 | |||
26 | /* min/max */ | ||
27 | #define CFM_IMAGE_SIZE 0x20000 /* max size of CYCX code image file */ | ||
28 | #define CFM_DESCR_LEN 256 /* max length of description string */ | ||
29 | #define CFM_MAX_CYCX 1 /* max number of compatible adapters */ | ||
30 | #define CFM_LOAD_BUFSZ 0x400 /* buffer size for reset code (buffer_load) */ | ||
31 | |||
32 | /* Firmware Commands */ | ||
33 | #define GEN_POWER_ON 0x1280 | ||
34 | |||
35 | #define GEN_SET_SEG 0x1401 /* boot segment setting. */ | ||
36 | #define GEN_BOOT_DAT 0x1402 /* boot data. */ | ||
37 | #define GEN_START 0x1403 /* board start. */ | ||
38 | #define GEN_DEFPAR 0x1404 /* buffer length for boot. */ | ||
39 | |||
40 | /* Adapter Types */ | ||
41 | #define CYCX_2X 2 | ||
42 | /* for now only the 2X is supported, no plans to support 8X or 16X */ | ||
43 | #define CYCX_8X 8 | ||
44 | #define CYCX_16X 16 | ||
45 | |||
46 | #define CFID_X25_2X 5200 | ||
47 | |||
48 | /** | ||
49 | * struct cycx_fw_info - firmware module information. | ||
50 | * @codeid - firmware ID | ||
51 | * @version - firmware version number | ||
52 | * @adapter - compatible adapter types | ||
53 | * @memsize - minimum memory size | ||
54 | * @reserved - reserved | ||
55 | * @startoffs - entry point offset | ||
56 | * @winoffs - dual-port memory window offset | ||
57 | * @codeoffs - code load offset | ||
58 | * @codesize - code size | ||
59 | * @dataoffs - configuration data load offset | ||
60 | * @datasize - configuration data size | ||
61 | */ | ||
62 | struct cycx_fw_info { | ||
63 | unsigned short codeid; | ||
64 | unsigned short version; | ||
65 | unsigned short adapter[CFM_MAX_CYCX]; | ||
66 | unsigned long memsize; | ||
67 | unsigned short reserved[2]; | ||
68 | unsigned short startoffs; | ||
69 | unsigned short winoffs; | ||
70 | unsigned short codeoffs; | ||
71 | unsigned long codesize; | ||
72 | unsigned short dataoffs; | ||
73 | unsigned long datasize; | ||
74 | }; | ||
75 | |||
76 | /** | ||
77 | * struct cycx_firmware - CYCX firmware file structure | ||
78 | * @signature - CFM file signature | ||
79 | * @version - file format version | ||
80 | * @checksum - info + image | ||
81 | * @reserved - reserved | ||
82 | * @descr - description string | ||
83 | * @info - firmware module info | ||
84 | * @image - code image (variable size) | ||
85 | */ | ||
86 | struct cycx_firmware { | ||
87 | char signature[80]; | ||
88 | unsigned short version; | ||
89 | unsigned short checksum; | ||
90 | unsigned short reserved[6]; | ||
91 | char descr[CFM_DESCR_LEN]; | ||
92 | struct cycx_fw_info info; | ||
93 | unsigned char image[0]; | ||
94 | }; | ||
95 | |||
96 | struct cycx_fw_header { | ||
97 | unsigned long reset_size; | ||
98 | unsigned long data_size; | ||
99 | unsigned long code_size; | ||
100 | }; | ||
101 | #endif /* _CYCX_CFM_H */ | ||
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h new file mode 100644 index 00000000000..65a2562f66b --- /dev/null +++ b/include/linux/dcbnl.h | |||
@@ -0,0 +1,672 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2011, Intel Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Author: Lucy Liu <lucy.liu@intel.com> | ||
18 | */ | ||
19 | |||
20 | #ifndef __LINUX_DCBNL_H__ | ||
21 | #define __LINUX_DCBNL_H__ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | /* IEEE 802.1Qaz std supported values */ | ||
26 | #define IEEE_8021QAZ_MAX_TCS 8 | ||
27 | |||
28 | #define IEEE_8021QAZ_TSA_STRICT 0 | ||
29 | #define IEEE_8021QAZ_TSA_CB_SHAPER 1 | ||
30 | #define IEEE_8021QAZ_TSA_ETS 2 | ||
31 | #define IEEE_8021QAZ_TSA_VENDOR 255 | ||
32 | |||
33 | /* This structure contains the IEEE 802.1Qaz ETS managed object | ||
34 | * | ||
35 | * @willing: willing bit in ETS configuration TLV | ||
36 | * @ets_cap: indicates supported capacity of ets feature | ||
37 | * @cbs: credit based shaper ets algorithm supported | ||
38 | * @tc_tx_bw: tc tx bandwidth indexed by traffic class | ||
39 | * @tc_rx_bw: tc rx bandwidth indexed by traffic class | ||
40 | * @tc_tsa: TSA Assignment table, indexed by traffic class | ||
41 | * @prio_tc: priority assignment table mapping 8021Qp to traffic class | ||
42 | * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV | ||
43 | * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV | ||
44 | * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV | ||
45 | * | ||
46 | * Recommended values are used to set fields in the ETS recommendation TLV | ||
47 | * with hardware offloaded LLDP. | ||
48 | * | ||
49 | * ---- | ||
50 | * TSA Assignment 8 bit identifiers | ||
51 | * 0 strict priority | ||
52 | * 1 credit-based shaper | ||
53 | * 2 enhanced transmission selection | ||
54 | * 3-254 reserved | ||
55 | * 255 vendor specific | ||
56 | */ | ||
57 | struct ieee_ets { | ||
58 | __u8 willing; | ||
59 | __u8 ets_cap; | ||
60 | __u8 cbs; | ||
61 | __u8 tc_tx_bw[IEEE_8021QAZ_MAX_TCS]; | ||
62 | __u8 tc_rx_bw[IEEE_8021QAZ_MAX_TCS]; | ||
63 | __u8 tc_tsa[IEEE_8021QAZ_MAX_TCS]; | ||
64 | __u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; | ||
65 | __u8 tc_reco_bw[IEEE_8021QAZ_MAX_TCS]; | ||
66 | __u8 tc_reco_tsa[IEEE_8021QAZ_MAX_TCS]; | ||
67 | __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; | ||
68 | }; | ||
69 | |||
70 | /* This structure contains the IEEE 802.1Qaz PFC managed object | ||
71 | * | ||
72 | * @pfc_cap: Indicates the number of traffic classes on the local device | ||
73 | * that may simultaneously have PFC enabled. | ||
74 | * @pfc_en: bitmap indicating pfc enabled traffic classes | ||
75 | * @mbc: enable macsec bypass capability | ||
76 | * @delay: the allowance made for a round-trip propagation delay of the | ||
77 | * link in bits. | ||
78 | * @requests: count of the sent pfc frames | ||
79 | * @indications: count of the received pfc frames | ||
80 | */ | ||
81 | struct ieee_pfc { | ||
82 | __u8 pfc_cap; | ||
83 | __u8 pfc_en; | ||
84 | __u8 mbc; | ||
85 | __u16 delay; | ||
86 | __u64 requests[IEEE_8021QAZ_MAX_TCS]; | ||
87 | __u64 indications[IEEE_8021QAZ_MAX_TCS]; | ||
88 | }; | ||
89 | |||
90 | /* CEE DCBX std supported values */ | ||
91 | #define CEE_DCBX_MAX_PGS 8 | ||
92 | #define CEE_DCBX_MAX_PRIO 8 | ||
93 | |||
94 | /** | ||
95 | * struct cee_pg - CEE Priority-Group managed object | ||
96 | * | ||
97 | * @willing: willing bit in the PG tlv | ||
98 | * @error: error bit in the PG tlv | ||
99 | * @pg_en: enable bit of the PG feature | ||
100 | * @tcs_supported: number of traffic classes supported | ||
101 | * @pg_bw: bandwidth percentage for each priority group | ||
102 | * @prio_pg: priority to PG mapping indexed by priority | ||
103 | */ | ||
104 | struct cee_pg { | ||
105 | __u8 willing; | ||
106 | __u8 error; | ||
107 | __u8 pg_en; | ||
108 | __u8 tcs_supported; | ||
109 | __u8 pg_bw[CEE_DCBX_MAX_PGS]; | ||
110 | __u8 prio_pg[CEE_DCBX_MAX_PGS]; | ||
111 | }; | ||
112 | |||
113 | /** | ||
114 | * struct cee_pfc - CEE PFC managed object | ||
115 | * | ||
116 | * @willing: willing bit in the PFC tlv | ||
117 | * @error: error bit in the PFC tlv | ||
118 | * @pfc_en: bitmap indicating pfc enabled traffic classes | ||
119 | * @tcs_supported: number of traffic classes supported | ||
120 | */ | ||
121 | struct cee_pfc { | ||
122 | __u8 willing; | ||
123 | __u8 error; | ||
124 | __u8 pfc_en; | ||
125 | __u8 tcs_supported; | ||
126 | }; | ||
127 | |||
128 | /* IEEE 802.1Qaz std supported values */ | ||
129 | #define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1 | ||
130 | #define IEEE_8021QAZ_APP_SEL_STREAM 2 | ||
131 | #define IEEE_8021QAZ_APP_SEL_DGRAM 3 | ||
132 | #define IEEE_8021QAZ_APP_SEL_ANY 4 | ||
133 | |||
134 | /* This structure contains the IEEE 802.1Qaz APP managed object. This | ||
135 | * object is also used for the CEE std as well. There is no difference | ||
136 | * between the objects. | ||
137 | * | ||
138 | * @selector: protocol identifier type | ||
139 | * @protocol: protocol of type indicated | ||
140 | * @priority: 3-bit unsigned integer indicating priority | ||
141 | * | ||
142 | * ---- | ||
143 | * Selector field values | ||
144 | * 0 Reserved | ||
145 | * 1 Ethertype | ||
146 | * 2 Well known port number over TCP or SCTP | ||
147 | * 3 Well known port number over UDP or DCCP | ||
148 | * 4 Well known port number over TCP, SCTP, UDP, or DCCP | ||
149 | * 5-7 Reserved | ||
150 | */ | ||
151 | struct dcb_app { | ||
152 | __u8 selector; | ||
153 | __u8 priority; | ||
154 | __u16 protocol; | ||
155 | }; | ||
156 | |||
157 | /** | ||
158 | * struct dcb_peer_app_info - APP feature information sent by the peer | ||
159 | * | ||
160 | * @willing: willing bit in the peer APP tlv | ||
161 | * @error: error bit in the peer APP tlv | ||
162 | * | ||
163 | * In addition to this information the full peer APP tlv also contains | ||
164 | * a table of 'app_count' APP objects defined above. | ||
165 | */ | ||
166 | struct dcb_peer_app_info { | ||
167 | __u8 willing; | ||
168 | __u8 error; | ||
169 | }; | ||
170 | |||
171 | struct dcbmsg { | ||
172 | __u8 dcb_family; | ||
173 | __u8 cmd; | ||
174 | __u16 dcb_pad; | ||
175 | }; | ||
176 | |||
177 | /** | ||
178 | * enum dcbnl_commands - supported DCB commands | ||
179 | * | ||
180 | * @DCB_CMD_UNDEFINED: unspecified command to catch errors | ||
181 | * @DCB_CMD_GSTATE: request the state of DCB in the device | ||
182 | * @DCB_CMD_SSTATE: set the state of DCB in the device | ||
183 | * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx | ||
184 | * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx | ||
185 | * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx | ||
186 | * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx | ||
187 | * @DCB_CMD_PFC_GCFG: request the priority flow control configuration | ||
188 | * @DCB_CMD_PFC_SCFG: set the priority flow control configuration | ||
189 | * @DCB_CMD_SET_ALL: apply all changes to the underlying device | ||
190 | * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying | ||
191 | * device. Only useful when using bonding. | ||
192 | * @DCB_CMD_GCAP: request the DCB capabilities of the device | ||
193 | * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported | ||
194 | * @DCB_CMD_SNUMTCS: set the number of traffic classes | ||
195 | * @DCB_CMD_GBCN: set backward congestion notification configuration | ||
196 | * @DCB_CMD_SBCN: get backward congestion notification configration. | ||
197 | * @DCB_CMD_GAPP: get application protocol configuration | ||
198 | * @DCB_CMD_SAPP: set application protocol configuration | ||
199 | * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration | ||
200 | * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration | ||
201 | * @DCB_CMD_GDCBX: get DCBX engine configuration | ||
202 | * @DCB_CMD_SDCBX: set DCBX engine configuration | ||
203 | * @DCB_CMD_GFEATCFG: get DCBX features flags | ||
204 | * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags | ||
205 | * @DCB_CMD_CEE_GET: get CEE aggregated configuration | ||
206 | * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration | ||
207 | */ | ||
208 | enum dcbnl_commands { | ||
209 | DCB_CMD_UNDEFINED, | ||
210 | |||
211 | DCB_CMD_GSTATE, | ||
212 | DCB_CMD_SSTATE, | ||
213 | |||
214 | DCB_CMD_PGTX_GCFG, | ||
215 | DCB_CMD_PGTX_SCFG, | ||
216 | DCB_CMD_PGRX_GCFG, | ||
217 | DCB_CMD_PGRX_SCFG, | ||
218 | |||
219 | DCB_CMD_PFC_GCFG, | ||
220 | DCB_CMD_PFC_SCFG, | ||
221 | |||
222 | DCB_CMD_SET_ALL, | ||
223 | |||
224 | DCB_CMD_GPERM_HWADDR, | ||
225 | |||
226 | DCB_CMD_GCAP, | ||
227 | |||
228 | DCB_CMD_GNUMTCS, | ||
229 | DCB_CMD_SNUMTCS, | ||
230 | |||
231 | DCB_CMD_PFC_GSTATE, | ||
232 | DCB_CMD_PFC_SSTATE, | ||
233 | |||
234 | DCB_CMD_BCN_GCFG, | ||
235 | DCB_CMD_BCN_SCFG, | ||
236 | |||
237 | DCB_CMD_GAPP, | ||
238 | DCB_CMD_SAPP, | ||
239 | |||
240 | DCB_CMD_IEEE_SET, | ||
241 | DCB_CMD_IEEE_GET, | ||
242 | |||
243 | DCB_CMD_GDCBX, | ||
244 | DCB_CMD_SDCBX, | ||
245 | |||
246 | DCB_CMD_GFEATCFG, | ||
247 | DCB_CMD_SFEATCFG, | ||
248 | |||
249 | DCB_CMD_CEE_GET, | ||
250 | DCB_CMD_IEEE_DEL, | ||
251 | |||
252 | __DCB_CMD_ENUM_MAX, | ||
253 | DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, | ||
254 | }; | ||
255 | |||
256 | /** | ||
257 | * enum dcbnl_attrs - DCB top-level netlink attributes | ||
258 | * | ||
259 | * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors | ||
260 | * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING) | ||
261 | * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8) | ||
262 | * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8) | ||
263 | * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED) | ||
264 | * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8) | ||
265 | * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED) | ||
266 | * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8) | ||
267 | * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED) | ||
268 | * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED) | ||
269 | * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED) | ||
270 | * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED) | ||
271 | * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) | ||
272 | * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) | ||
273 | * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) | ||
274 | * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED) | ||
275 | */ | ||
276 | enum dcbnl_attrs { | ||
277 | DCB_ATTR_UNDEFINED, | ||
278 | |||
279 | DCB_ATTR_IFNAME, | ||
280 | DCB_ATTR_STATE, | ||
281 | DCB_ATTR_PFC_STATE, | ||
282 | DCB_ATTR_PFC_CFG, | ||
283 | DCB_ATTR_NUM_TC, | ||
284 | DCB_ATTR_PG_CFG, | ||
285 | DCB_ATTR_SET_ALL, | ||
286 | DCB_ATTR_PERM_HWADDR, | ||
287 | DCB_ATTR_CAP, | ||
288 | DCB_ATTR_NUMTCS, | ||
289 | DCB_ATTR_BCN, | ||
290 | DCB_ATTR_APP, | ||
291 | |||
292 | /* IEEE std attributes */ | ||
293 | DCB_ATTR_IEEE, | ||
294 | |||
295 | DCB_ATTR_DCBX, | ||
296 | DCB_ATTR_FEATCFG, | ||
297 | |||
298 | /* CEE nested attributes */ | ||
299 | DCB_ATTR_CEE, | ||
300 | |||
301 | __DCB_ATTR_ENUM_MAX, | ||
302 | DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, | ||
303 | }; | ||
304 | |||
305 | /** | ||
306 | * enum ieee_attrs - IEEE 802.1Qaz get/set attributes | ||
307 | * | ||
308 | * @DCB_ATTR_IEEE_UNSPEC: unspecified | ||
309 | * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration | ||
310 | * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration | ||
311 | * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration | ||
312 | * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only | ||
313 | * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only | ||
314 | * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only | ||
315 | */ | ||
316 | enum ieee_attrs { | ||
317 | DCB_ATTR_IEEE_UNSPEC, | ||
318 | DCB_ATTR_IEEE_ETS, | ||
319 | DCB_ATTR_IEEE_PFC, | ||
320 | DCB_ATTR_IEEE_APP_TABLE, | ||
321 | DCB_ATTR_IEEE_PEER_ETS, | ||
322 | DCB_ATTR_IEEE_PEER_PFC, | ||
323 | DCB_ATTR_IEEE_PEER_APP, | ||
324 | __DCB_ATTR_IEEE_MAX | ||
325 | }; | ||
326 | #define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) | ||
327 | |||
328 | enum ieee_attrs_app { | ||
329 | DCB_ATTR_IEEE_APP_UNSPEC, | ||
330 | DCB_ATTR_IEEE_APP, | ||
331 | __DCB_ATTR_IEEE_APP_MAX | ||
332 | }; | ||
333 | #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) | ||
334 | |||
335 | /** | ||
336 | * enum cee_attrs - CEE DCBX get attributes. | ||
337 | * | ||
338 | * @DCB_ATTR_CEE_UNSPEC: unspecified | ||
339 | * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only | ||
340 | * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only | ||
341 | * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only | ||
342 | * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG) | ||
343 | * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG) | ||
344 | * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG) | ||
345 | * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP) | ||
346 | * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG) | ||
347 | * | ||
348 | * An aggregated collection of the cee std negotiated parameters. | ||
349 | */ | ||
350 | enum cee_attrs { | ||
351 | DCB_ATTR_CEE_UNSPEC, | ||
352 | DCB_ATTR_CEE_PEER_PG, | ||
353 | DCB_ATTR_CEE_PEER_PFC, | ||
354 | DCB_ATTR_CEE_PEER_APP_TABLE, | ||
355 | DCB_ATTR_CEE_TX_PG, | ||
356 | DCB_ATTR_CEE_RX_PG, | ||
357 | DCB_ATTR_CEE_PFC, | ||
358 | DCB_ATTR_CEE_APP_TABLE, | ||
359 | DCB_ATTR_CEE_FEAT, | ||
360 | __DCB_ATTR_CEE_MAX | ||
361 | }; | ||
362 | #define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1) | ||
363 | |||
364 | enum peer_app_attr { | ||
365 | DCB_ATTR_CEE_PEER_APP_UNSPEC, | ||
366 | DCB_ATTR_CEE_PEER_APP_INFO, | ||
367 | DCB_ATTR_CEE_PEER_APP, | ||
368 | __DCB_ATTR_CEE_PEER_APP_MAX | ||
369 | }; | ||
370 | #define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1) | ||
371 | |||
372 | enum cee_attrs_app { | ||
373 | DCB_ATTR_CEE_APP_UNSPEC, | ||
374 | DCB_ATTR_CEE_APP, | ||
375 | __DCB_ATTR_CEE_APP_MAX | ||
376 | }; | ||
377 | #define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1) | ||
378 | |||
379 | /** | ||
380 | * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs | ||
381 | * | ||
382 | * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors | ||
383 | * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8) | ||
384 | * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8) | ||
385 | * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8) | ||
386 | * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8) | ||
387 | * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8) | ||
388 | * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8) | ||
389 | * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8) | ||
390 | * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8) | ||
391 | * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined | ||
392 | * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG) | ||
393 | * | ||
394 | */ | ||
395 | enum dcbnl_pfc_up_attrs { | ||
396 | DCB_PFC_UP_ATTR_UNDEFINED, | ||
397 | |||
398 | DCB_PFC_UP_ATTR_0, | ||
399 | DCB_PFC_UP_ATTR_1, | ||
400 | DCB_PFC_UP_ATTR_2, | ||
401 | DCB_PFC_UP_ATTR_3, | ||
402 | DCB_PFC_UP_ATTR_4, | ||
403 | DCB_PFC_UP_ATTR_5, | ||
404 | DCB_PFC_UP_ATTR_6, | ||
405 | DCB_PFC_UP_ATTR_7, | ||
406 | DCB_PFC_UP_ATTR_ALL, | ||
407 | |||
408 | __DCB_PFC_UP_ATTR_ENUM_MAX, | ||
409 | DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1, | ||
410 | }; | ||
411 | |||
412 | /** | ||
413 | * enum dcbnl_pg_attrs - DCB Priority Group attributes | ||
414 | * | ||
415 | * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors | ||
416 | * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED) | ||
417 | * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED) | ||
418 | * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED) | ||
419 | * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED) | ||
420 | * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED) | ||
421 | * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED) | ||
422 | * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED) | ||
423 | * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED) | ||
424 | * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined | ||
425 | * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED) | ||
426 | * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8) | ||
427 | * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8) | ||
428 | * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8) | ||
429 | * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8) | ||
430 | * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8) | ||
431 | * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8) | ||
432 | * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8) | ||
433 | * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8) | ||
434 | * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined | ||
435 | * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG) | ||
436 | * | ||
437 | */ | ||
438 | enum dcbnl_pg_attrs { | ||
439 | DCB_PG_ATTR_UNDEFINED, | ||
440 | |||
441 | DCB_PG_ATTR_TC_0, | ||
442 | DCB_PG_ATTR_TC_1, | ||
443 | DCB_PG_ATTR_TC_2, | ||
444 | DCB_PG_ATTR_TC_3, | ||
445 | DCB_PG_ATTR_TC_4, | ||
446 | DCB_PG_ATTR_TC_5, | ||
447 | DCB_PG_ATTR_TC_6, | ||
448 | DCB_PG_ATTR_TC_7, | ||
449 | DCB_PG_ATTR_TC_MAX, | ||
450 | DCB_PG_ATTR_TC_ALL, | ||
451 | |||
452 | DCB_PG_ATTR_BW_ID_0, | ||
453 | DCB_PG_ATTR_BW_ID_1, | ||
454 | DCB_PG_ATTR_BW_ID_2, | ||
455 | DCB_PG_ATTR_BW_ID_3, | ||
456 | DCB_PG_ATTR_BW_ID_4, | ||
457 | DCB_PG_ATTR_BW_ID_5, | ||
458 | DCB_PG_ATTR_BW_ID_6, | ||
459 | DCB_PG_ATTR_BW_ID_7, | ||
460 | DCB_PG_ATTR_BW_ID_MAX, | ||
461 | DCB_PG_ATTR_BW_ID_ALL, | ||
462 | |||
463 | __DCB_PG_ATTR_ENUM_MAX, | ||
464 | DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1, | ||
465 | }; | ||
466 | |||
467 | /** | ||
468 | * enum dcbnl_tc_attrs - DCB Traffic Class attributes | ||
469 | * | ||
470 | * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors | ||
471 | * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to | ||
472 | * Valid values are: 0-7 | ||
473 | * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map | ||
474 | * Some devices may not support changing the | ||
475 | * user priority map of a TC. | ||
476 | * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting | ||
477 | * 0 - none | ||
478 | * 1 - group strict | ||
479 | * 2 - link strict | ||
480 | * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and | ||
481 | * not configured to use link strict priority, | ||
482 | * this is the percentage of bandwidth of the | ||
483 | * priority group this traffic class belongs to | ||
484 | * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters | ||
485 | * | ||
486 | */ | ||
487 | enum dcbnl_tc_attrs { | ||
488 | DCB_TC_ATTR_PARAM_UNDEFINED, | ||
489 | |||
490 | DCB_TC_ATTR_PARAM_PGID, | ||
491 | DCB_TC_ATTR_PARAM_UP_MAPPING, | ||
492 | DCB_TC_ATTR_PARAM_STRICT_PRIO, | ||
493 | DCB_TC_ATTR_PARAM_BW_PCT, | ||
494 | DCB_TC_ATTR_PARAM_ALL, | ||
495 | |||
496 | __DCB_TC_ATTR_PARAM_ENUM_MAX, | ||
497 | DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1, | ||
498 | }; | ||
499 | |||
500 | /** | ||
501 | * enum dcbnl_cap_attrs - DCB Capability attributes | ||
502 | * | ||
503 | * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors | ||
504 | * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters | ||
505 | * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups | ||
506 | * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control | ||
507 | * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to | ||
508 | * traffic class mapping | ||
509 | * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a | ||
510 | * number of traffic classes the device | ||
511 | * can be configured to use for Priority Groups | ||
512 | * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a | ||
513 | * number of traffic classes the device can be | ||
514 | * configured to use for Priority Flow Control | ||
515 | * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority | ||
516 | * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion | ||
517 | * Notification | ||
518 | * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine | ||
519 | * | ||
520 | */ | ||
521 | enum dcbnl_cap_attrs { | ||
522 | DCB_CAP_ATTR_UNDEFINED, | ||
523 | DCB_CAP_ATTR_ALL, | ||
524 | DCB_CAP_ATTR_PG, | ||
525 | DCB_CAP_ATTR_PFC, | ||
526 | DCB_CAP_ATTR_UP2TC, | ||
527 | DCB_CAP_ATTR_PG_TCS, | ||
528 | DCB_CAP_ATTR_PFC_TCS, | ||
529 | DCB_CAP_ATTR_GSP, | ||
530 | DCB_CAP_ATTR_BCN, | ||
531 | DCB_CAP_ATTR_DCBX, | ||
532 | |||
533 | __DCB_CAP_ATTR_ENUM_MAX, | ||
534 | DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, | ||
535 | }; | ||
536 | |||
537 | /** | ||
538 | * DCBX capability flags | ||
539 | * | ||
540 | * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent. | ||
541 | * 'set' routines are used to configure the device with | ||
542 | * the negotiated parameters | ||
543 | * | ||
544 | * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but | ||
545 | * by another entity | ||
546 | * 'get' routines are used to retrieve the | ||
547 | * negotiated parameters | ||
548 | * 'set' routines can be used to set the initial | ||
549 | * negotiation configuration | ||
550 | * | ||
551 | * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine | ||
552 | * supports the CEE protocol flavor | ||
553 | * | ||
554 | * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine | ||
555 | * supports the IEEE protocol flavor | ||
556 | * | ||
557 | * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine | ||
558 | * supports static configuration (i.e no actual | ||
559 | * negotiation is performed negotiated parameters equal | ||
560 | * the initial configuration) | ||
561 | * | ||
562 | */ | ||
563 | #define DCB_CAP_DCBX_HOST 0x01 | ||
564 | #define DCB_CAP_DCBX_LLD_MANAGED 0x02 | ||
565 | #define DCB_CAP_DCBX_VER_CEE 0x04 | ||
566 | #define DCB_CAP_DCBX_VER_IEEE 0x08 | ||
567 | #define DCB_CAP_DCBX_STATIC 0x10 | ||
568 | |||
569 | /** | ||
570 | * enum dcbnl_numtcs_attrs - number of traffic classes | ||
571 | * | ||
572 | * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors | ||
573 | * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes | ||
574 | * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for | ||
575 | * priority groups | ||
576 | * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can | ||
577 | * support priority flow control | ||
578 | */ | ||
579 | enum dcbnl_numtcs_attrs { | ||
580 | DCB_NUMTCS_ATTR_UNDEFINED, | ||
581 | DCB_NUMTCS_ATTR_ALL, | ||
582 | DCB_NUMTCS_ATTR_PG, | ||
583 | DCB_NUMTCS_ATTR_PFC, | ||
584 | |||
585 | __DCB_NUMTCS_ATTR_ENUM_MAX, | ||
586 | DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1, | ||
587 | }; | ||
588 | |||
589 | enum dcbnl_bcn_attrs{ | ||
590 | DCB_BCN_ATTR_UNDEFINED = 0, | ||
591 | |||
592 | DCB_BCN_ATTR_RP_0, | ||
593 | DCB_BCN_ATTR_RP_1, | ||
594 | DCB_BCN_ATTR_RP_2, | ||
595 | DCB_BCN_ATTR_RP_3, | ||
596 | DCB_BCN_ATTR_RP_4, | ||
597 | DCB_BCN_ATTR_RP_5, | ||
598 | DCB_BCN_ATTR_RP_6, | ||
599 | DCB_BCN_ATTR_RP_7, | ||
600 | DCB_BCN_ATTR_RP_ALL, | ||
601 | |||
602 | DCB_BCN_ATTR_BCNA_0, | ||
603 | DCB_BCN_ATTR_BCNA_1, | ||
604 | DCB_BCN_ATTR_ALPHA, | ||
605 | DCB_BCN_ATTR_BETA, | ||
606 | DCB_BCN_ATTR_GD, | ||
607 | DCB_BCN_ATTR_GI, | ||
608 | DCB_BCN_ATTR_TMAX, | ||
609 | DCB_BCN_ATTR_TD, | ||
610 | DCB_BCN_ATTR_RMIN, | ||
611 | DCB_BCN_ATTR_W, | ||
612 | DCB_BCN_ATTR_RD, | ||
613 | DCB_BCN_ATTR_RU, | ||
614 | DCB_BCN_ATTR_WRTT, | ||
615 | DCB_BCN_ATTR_RI, | ||
616 | DCB_BCN_ATTR_C, | ||
617 | DCB_BCN_ATTR_ALL, | ||
618 | |||
619 | __DCB_BCN_ATTR_ENUM_MAX, | ||
620 | DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1, | ||
621 | }; | ||
622 | |||
623 | /** | ||
624 | * enum dcb_general_attr_values - general DCB attribute values | ||
625 | * | ||
626 | * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported | ||
627 | * | ||
628 | */ | ||
629 | enum dcb_general_attr_values { | ||
630 | DCB_ATTR_VALUE_UNDEFINED = 0xff | ||
631 | }; | ||
632 | |||
633 | #define DCB_APP_IDTYPE_ETHTYPE 0x00 | ||
634 | #define DCB_APP_IDTYPE_PORTNUM 0x01 | ||
635 | enum dcbnl_app_attrs { | ||
636 | DCB_APP_ATTR_UNDEFINED, | ||
637 | |||
638 | DCB_APP_ATTR_IDTYPE, | ||
639 | DCB_APP_ATTR_ID, | ||
640 | DCB_APP_ATTR_PRIORITY, | ||
641 | |||
642 | __DCB_APP_ATTR_ENUM_MAX, | ||
643 | DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1, | ||
644 | }; | ||
645 | |||
646 | /** | ||
647 | * enum dcbnl_featcfg_attrs - features conifiguration flags | ||
648 | * | ||
649 | * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors | ||
650 | * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes | ||
651 | * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups | ||
652 | * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority | ||
653 | * flow control | ||
654 | * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV | ||
655 | * | ||
656 | */ | ||
657 | #define DCB_FEATCFG_ERROR 0x01 /* error in feature resolution */ | ||
658 | #define DCB_FEATCFG_ENABLE 0x02 /* enable feature */ | ||
659 | #define DCB_FEATCFG_WILLING 0x04 /* feature is willing */ | ||
660 | #define DCB_FEATCFG_ADVERTISE 0x08 /* advertise feature */ | ||
661 | enum dcbnl_featcfg_attrs { | ||
662 | DCB_FEATCFG_ATTR_UNDEFINED, | ||
663 | DCB_FEATCFG_ATTR_ALL, | ||
664 | DCB_FEATCFG_ATTR_PG, | ||
665 | DCB_FEATCFG_ATTR_PFC, | ||
666 | DCB_FEATCFG_ATTR_APP, | ||
667 | |||
668 | __DCB_FEATCFG_ATTR_ENUM_MAX, | ||
669 | DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1, | ||
670 | }; | ||
671 | |||
672 | #endif /* __LINUX_DCBNL_H__ */ | ||
diff --git a/include/linux/display.h b/include/linux/display.h new file mode 100644 index 00000000000..3bf70d63972 --- /dev/null +++ b/include/linux/display.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 James Simmons <jsimmons@infradead.org> | ||
3 | * | ||
4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or (at | ||
9 | * your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
19 | * | ||
20 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX_DISPLAY_H | ||
24 | #define _LINUX_DISPLAY_H | ||
25 | |||
26 | #include <linux/device.h> | ||
27 | |||
28 | struct display_device; | ||
29 | |||
30 | /* This structure defines all the properties of a Display. */ | ||
31 | struct display_driver { | ||
32 | int (*set_contrast)(struct display_device *, unsigned int); | ||
33 | int (*get_contrast)(struct display_device *); | ||
34 | void (*suspend)(struct display_device *, pm_message_t state); | ||
35 | void (*resume)(struct display_device *); | ||
36 | int (*probe)(struct display_device *, void *); | ||
37 | int (*remove)(struct display_device *); | ||
38 | int max_contrast; | ||
39 | }; | ||
40 | |||
41 | struct display_device { | ||
42 | struct module *owner; /* Owner module */ | ||
43 | struct display_driver *driver; | ||
44 | struct device *parent; /* This is the parent */ | ||
45 | struct device *dev; /* This is this display device */ | ||
46 | struct mutex lock; | ||
47 | void *priv_data; | ||
48 | char type[16]; | ||
49 | char *name; | ||
50 | int idx; | ||
51 | }; | ||
52 | |||
53 | extern struct display_device *display_device_register(struct display_driver *driver, | ||
54 | struct device *dev, void *devdata); | ||
55 | extern void display_device_unregister(struct display_device *dev); | ||
56 | |||
57 | extern int probe_edid(struct display_device *dev, void *devdata); | ||
58 | |||
59 | #define to_display_device(obj) container_of(obj, struct display_device, class_dev) | ||
60 | |||
61 | #endif | ||
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h new file mode 100644 index 00000000000..3060783c419 --- /dev/null +++ b/include/linux/dlm_device.h | |||
@@ -0,0 +1,108 @@ | |||
1 | /****************************************************************************** | ||
2 | ******************************************************************************* | ||
3 | ** | ||
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | ||
5 | ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | ||
6 | ** | ||
7 | ** This copyrighted material is made available to anyone wishing to use, | ||
8 | ** modify, copy, or redistribute it subject to the terms and conditions | ||
9 | ** of the GNU General Public License v.2. | ||
10 | ** | ||
11 | ******************************************************************************* | ||
12 | ******************************************************************************/ | ||
13 | |||
14 | #ifndef _LINUX_DLM_DEVICE_H | ||
15 | #define _LINUX_DLM_DEVICE_H | ||
16 | |||
17 | /* This is the device interface for dlm, most users will use a library | ||
18 | * interface. | ||
19 | */ | ||
20 | |||
21 | #include <linux/dlm.h> | ||
22 | #include <linux/types.h> | ||
23 | |||
24 | #define DLM_USER_LVB_LEN 32 | ||
25 | |||
26 | /* Version of the device interface */ | ||
27 | #define DLM_DEVICE_VERSION_MAJOR 6 | ||
28 | #define DLM_DEVICE_VERSION_MINOR 0 | ||
29 | #define DLM_DEVICE_VERSION_PATCH 1 | ||
30 | |||
31 | /* struct passed to the lock write */ | ||
32 | struct dlm_lock_params { | ||
33 | __u8 mode; | ||
34 | __u8 namelen; | ||
35 | __u16 unused; | ||
36 | __u32 flags; | ||
37 | __u32 lkid; | ||
38 | __u32 parent; | ||
39 | __u64 xid; | ||
40 | __u64 timeout; | ||
41 | void __user *castparam; | ||
42 | void __user *castaddr; | ||
43 | void __user *bastparam; | ||
44 | void __user *bastaddr; | ||
45 | struct dlm_lksb __user *lksb; | ||
46 | char lvb[DLM_USER_LVB_LEN]; | ||
47 | char name[0]; | ||
48 | }; | ||
49 | |||
50 | struct dlm_lspace_params { | ||
51 | __u32 flags; | ||
52 | __u32 minor; | ||
53 | char name[0]; | ||
54 | }; | ||
55 | |||
56 | struct dlm_purge_params { | ||
57 | __u32 nodeid; | ||
58 | __u32 pid; | ||
59 | }; | ||
60 | |||
61 | struct dlm_write_request { | ||
62 | __u32 version[3]; | ||
63 | __u8 cmd; | ||
64 | __u8 is64bit; | ||
65 | __u8 unused[2]; | ||
66 | |||
67 | union { | ||
68 | struct dlm_lock_params lock; | ||
69 | struct dlm_lspace_params lspace; | ||
70 | struct dlm_purge_params purge; | ||
71 | } i; | ||
72 | }; | ||
73 | |||
74 | struct dlm_device_version { | ||
75 | __u32 version[3]; | ||
76 | }; | ||
77 | |||
78 | /* struct read from the "device" fd, | ||
79 | consists mainly of userspace pointers for the library to use */ | ||
80 | |||
81 | struct dlm_lock_result { | ||
82 | __u32 version[3]; | ||
83 | __u32 length; | ||
84 | void __user * user_astaddr; | ||
85 | void __user * user_astparam; | ||
86 | struct dlm_lksb __user * user_lksb; | ||
87 | struct dlm_lksb lksb; | ||
88 | __u8 bast_mode; | ||
89 | __u8 unused[3]; | ||
90 | /* Offsets may be zero if no data is present */ | ||
91 | __u32 lvb_offset; | ||
92 | }; | ||
93 | |||
94 | /* Commands passed to the device */ | ||
95 | #define DLM_USER_LOCK 1 | ||
96 | #define DLM_USER_UNLOCK 2 | ||
97 | #define DLM_USER_QUERY 3 | ||
98 | #define DLM_USER_CREATE_LOCKSPACE 4 | ||
99 | #define DLM_USER_REMOVE_LOCKSPACE 5 | ||
100 | #define DLM_USER_PURGE 6 | ||
101 | #define DLM_USER_DEADLOCK 7 | ||
102 | |||
103 | /* Lockspace flags */ | ||
104 | #define DLM_USER_LSFLG_AUTOFREE 1 | ||
105 | #define DLM_USER_LSFLG_FORCEFREE 2 | ||
106 | |||
107 | #endif | ||
108 | |||
diff --git a/include/linux/dlm_netlink.h b/include/linux/dlm_netlink.h new file mode 100644 index 00000000000..647c8ef2722 --- /dev/null +++ b/include/linux/dlm_netlink.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Red Hat, Inc. All rights reserved. | ||
3 | * | ||
4 | * This copyrighted material is made available to anyone wishing to use, | ||
5 | * modify, copy, or redistribute it subject to the terms and conditions | ||
6 | * of the GNU General Public License v.2. | ||
7 | */ | ||
8 | |||
9 | #ifndef _DLM_NETLINK_H | ||
10 | #define _DLM_NETLINK_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | |||
14 | enum { | ||
15 | DLM_STATUS_WAITING = 1, | ||
16 | DLM_STATUS_GRANTED = 2, | ||
17 | DLM_STATUS_CONVERT = 3, | ||
18 | }; | ||
19 | |||
20 | #define DLM_LOCK_DATA_VERSION 1 | ||
21 | |||
22 | struct dlm_lock_data { | ||
23 | __u16 version; | ||
24 | __u32 lockspace_id; | ||
25 | int nodeid; | ||
26 | int ownpid; | ||
27 | __u32 id; | ||
28 | __u32 remid; | ||
29 | __u64 xid; | ||
30 | __s8 status; | ||
31 | __s8 grmode; | ||
32 | __s8 rqmode; | ||
33 | unsigned long timestamp; | ||
34 | int resource_namelen; | ||
35 | char resource_name[DLM_RESNAME_MAXLEN]; | ||
36 | }; | ||
37 | |||
38 | enum { | ||
39 | DLM_CMD_UNSPEC = 0, | ||
40 | DLM_CMD_HELLO, /* user->kernel */ | ||
41 | DLM_CMD_TIMEOUT, /* kernel->user */ | ||
42 | __DLM_CMD_MAX, | ||
43 | }; | ||
44 | |||
45 | #define DLM_CMD_MAX (__DLM_CMD_MAX - 1) | ||
46 | |||
47 | enum { | ||
48 | DLM_TYPE_UNSPEC = 0, | ||
49 | DLM_TYPE_LOCK, | ||
50 | __DLM_TYPE_MAX, | ||
51 | }; | ||
52 | |||
53 | #define DLM_TYPE_MAX (__DLM_TYPE_MAX - 1) | ||
54 | |||
55 | #define DLM_GENL_VERSION 0x1 | ||
56 | #define DLM_GENL_NAME "DLM" | ||
57 | |||
58 | #endif /* _DLM_NETLINK_H */ | ||
diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h new file mode 100644 index 00000000000..47bf08dc756 --- /dev/null +++ b/include/linux/dlmconstants.h | |||
@@ -0,0 +1,163 @@ | |||
1 | /****************************************************************************** | ||
2 | ******************************************************************************* | ||
3 | ** | ||
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | ||
5 | ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | ||
6 | ** | ||
7 | ** This copyrighted material is made available to anyone wishing to use, | ||
8 | ** modify, copy, or redistribute it subject to the terms and conditions | ||
9 | ** of the GNU General Public License v.2. | ||
10 | ** | ||
11 | ******************************************************************************* | ||
12 | ******************************************************************************/ | ||
13 | |||
14 | #ifndef __DLMCONSTANTS_DOT_H__ | ||
15 | #define __DLMCONSTANTS_DOT_H__ | ||
16 | |||
17 | /* | ||
18 | * Constants used by DLM interface. | ||
19 | */ | ||
20 | |||
21 | #define DLM_LOCKSPACE_LEN 64 | ||
22 | #define DLM_RESNAME_MAXLEN 64 | ||
23 | |||
24 | |||
25 | /* | ||
26 | * Lock Modes | ||
27 | */ | ||
28 | |||
29 | #define DLM_LOCK_IV (-1) /* invalid */ | ||
30 | #define DLM_LOCK_NL 0 /* null */ | ||
31 | #define DLM_LOCK_CR 1 /* concurrent read */ | ||
32 | #define DLM_LOCK_CW 2 /* concurrent write */ | ||
33 | #define DLM_LOCK_PR 3 /* protected read */ | ||
34 | #define DLM_LOCK_PW 4 /* protected write */ | ||
35 | #define DLM_LOCK_EX 5 /* exclusive */ | ||
36 | |||
37 | |||
38 | /* | ||
39 | * Flags to dlm_lock | ||
40 | * | ||
41 | * DLM_LKF_NOQUEUE | ||
42 | * | ||
43 | * Do not queue the lock request on the wait queue if it cannot be granted | ||
44 | * immediately. If the lock cannot be granted because of this flag, DLM will | ||
45 | * either return -EAGAIN from the dlm_lock call or will return 0 from | ||
46 | * dlm_lock and -EAGAIN in the lock status block when the AST is executed. | ||
47 | * | ||
48 | * DLM_LKF_CANCEL | ||
49 | * | ||
50 | * Used to cancel a pending lock request or conversion. A converting lock is | ||
51 | * returned to its previously granted mode. | ||
52 | * | ||
53 | * DLM_LKF_CONVERT | ||
54 | * | ||
55 | * Indicates a lock conversion request. For conversions the name and namelen | ||
56 | * are ignored and the lock ID in the LKSB is used to identify the lock. | ||
57 | * | ||
58 | * DLM_LKF_VALBLK | ||
59 | * | ||
60 | * Requests DLM to return the current contents of the lock value block in the | ||
61 | * lock status block. When this flag is set in a lock conversion from PW or EX | ||
62 | * modes, DLM assigns the value specified in the lock status block to the lock | ||
63 | * value block of the lock resource. The LVB is a DLM_LVB_LEN size array | ||
64 | * containing application-specific information. | ||
65 | * | ||
66 | * DLM_LKF_QUECVT | ||
67 | * | ||
68 | * Force a conversion request to be queued, even if it is compatible with | ||
69 | * the granted modes of other locks on the same resource. | ||
70 | * | ||
71 | * DLM_LKF_IVVALBLK | ||
72 | * | ||
73 | * Invalidate the lock value block. | ||
74 | * | ||
75 | * DLM_LKF_CONVDEADLK | ||
76 | * | ||
77 | * Allows the dlm to resolve conversion deadlocks internally by demoting the | ||
78 | * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is | ||
79 | * returned for a conversion that's been effected by this. | ||
80 | * | ||
81 | * DLM_LKF_PERSISTENT | ||
82 | * | ||
83 | * Only relevant to locks originating in userspace. A persistent lock will not | ||
84 | * be removed if the process holding the lock exits. | ||
85 | * | ||
86 | * DLM_LKF_NODLCKWT | ||
87 | * | ||
88 | * Do not cancel the lock if it gets into conversion deadlock. | ||
89 | * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN. | ||
90 | * | ||
91 | * DLM_LKF_NODLCKBLK | ||
92 | * | ||
93 | * net yet implemented | ||
94 | * | ||
95 | * DLM_LKF_EXPEDITE | ||
96 | * | ||
97 | * Used only with new requests for NL mode locks. Tells the lock manager | ||
98 | * to grant the lock, ignoring other locks in convert and wait queues. | ||
99 | * | ||
100 | * DLM_LKF_NOQUEUEBAST | ||
101 | * | ||
102 | * Send blocking AST's before returning -EAGAIN to the caller. It is only | ||
103 | * used along with the NOQUEUE flag. Blocking AST's are not sent for failed | ||
104 | * NOQUEUE requests otherwise. | ||
105 | * | ||
106 | * DLM_LKF_HEADQUE | ||
107 | * | ||
108 | * Add a lock to the head of the convert or wait queue rather than the tail. | ||
109 | * | ||
110 | * DLM_LKF_NOORDER | ||
111 | * | ||
112 | * Disregard the standard grant order rules and grant a lock as soon as it | ||
113 | * is compatible with other granted locks. | ||
114 | * | ||
115 | * DLM_LKF_ORPHAN | ||
116 | * | ||
117 | * not yet implemented | ||
118 | * | ||
119 | * DLM_LKF_ALTPR | ||
120 | * | ||
121 | * If the requested mode cannot be granted immediately, try to grant the lock | ||
122 | * in PR mode instead. If this alternate mode is granted instead of the | ||
123 | * requested mode, DLM_SBF_ALTMODE is returned in the lksb. | ||
124 | * | ||
125 | * DLM_LKF_ALTCW | ||
126 | * | ||
127 | * The same as ALTPR, but the alternate mode is CW. | ||
128 | * | ||
129 | * DLM_LKF_FORCEUNLOCK | ||
130 | * | ||
131 | * Unlock the lock even if it is converting or waiting or has sublocks. | ||
132 | * Only really for use by the userland device.c code. | ||
133 | * | ||
134 | */ | ||
135 | |||
136 | #define DLM_LKF_NOQUEUE 0x00000001 | ||
137 | #define DLM_LKF_CANCEL 0x00000002 | ||
138 | #define DLM_LKF_CONVERT 0x00000004 | ||
139 | #define DLM_LKF_VALBLK 0x00000008 | ||
140 | #define DLM_LKF_QUECVT 0x00000010 | ||
141 | #define DLM_LKF_IVVALBLK 0x00000020 | ||
142 | #define DLM_LKF_CONVDEADLK 0x00000040 | ||
143 | #define DLM_LKF_PERSISTENT 0x00000080 | ||
144 | #define DLM_LKF_NODLCKWT 0x00000100 | ||
145 | #define DLM_LKF_NODLCKBLK 0x00000200 | ||
146 | #define DLM_LKF_EXPEDITE 0x00000400 | ||
147 | #define DLM_LKF_NOQUEUEBAST 0x00000800 | ||
148 | #define DLM_LKF_HEADQUE 0x00001000 | ||
149 | #define DLM_LKF_NOORDER 0x00002000 | ||
150 | #define DLM_LKF_ORPHAN 0x00004000 | ||
151 | #define DLM_LKF_ALTPR 0x00008000 | ||
152 | #define DLM_LKF_ALTCW 0x00010000 | ||
153 | #define DLM_LKF_FORCEUNLOCK 0x00020000 | ||
154 | #define DLM_LKF_TIMEOUT 0x00040000 | ||
155 | |||
156 | /* | ||
157 | * Some return codes that are not in errno.h | ||
158 | */ | ||
159 | |||
160 | #define DLM_ECANCEL 0x10001 | ||
161 | #define DLM_EUNLOCK 0x10002 | ||
162 | |||
163 | #endif /* __DLMCONSTANTS_DOT_H__ */ | ||
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h new file mode 100644 index 00000000000..0cb8eff76bd --- /dev/null +++ b/include/linux/dm-ioctl.h | |||
@@ -0,0 +1,337 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. | ||
3 | * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * This file is released under the LGPL. | ||
6 | */ | ||
7 | |||
8 | #ifndef _LINUX_DM_IOCTL_V4_H | ||
9 | #define _LINUX_DM_IOCTL_V4_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | #define DM_DIR "mapper" /* Slashes not supported */ | ||
14 | #define DM_CONTROL_NODE "control" | ||
15 | #define DM_MAX_TYPE_NAME 16 | ||
16 | #define DM_NAME_LEN 128 | ||
17 | #define DM_UUID_LEN 129 | ||
18 | |||
19 | /* | ||
20 | * A traditional ioctl interface for the device mapper. | ||
21 | * | ||
22 | * Each device can have two tables associated with it, an | ||
23 | * 'active' table which is the one currently used by io passing | ||
24 | * through the device, and an 'inactive' one which is a table | ||
25 | * that is being prepared as a replacement for the 'active' one. | ||
26 | * | ||
27 | * DM_VERSION: | ||
28 | * Just get the version information for the ioctl interface. | ||
29 | * | ||
30 | * DM_REMOVE_ALL: | ||
31 | * Remove all dm devices, destroy all tables. Only really used | ||
32 | * for debug. | ||
33 | * | ||
34 | * DM_LIST_DEVICES: | ||
35 | * Get a list of all the dm device names. | ||
36 | * | ||
37 | * DM_DEV_CREATE: | ||
38 | * Create a new device, neither the 'active' or 'inactive' table | ||
39 | * slots will be filled. The device will be in suspended state | ||
40 | * after creation, however any io to the device will get errored | ||
41 | * since it will be out-of-bounds. | ||
42 | * | ||
43 | * DM_DEV_REMOVE: | ||
44 | * Remove a device, destroy any tables. | ||
45 | * | ||
46 | * DM_DEV_RENAME: | ||
47 | * Rename a device or set its uuid if none was previously supplied. | ||
48 | * | ||
49 | * DM_SUSPEND: | ||
50 | * This performs both suspend and resume, depending which flag is | ||
51 | * passed in. | ||
52 | * Suspend: This command will not return until all pending io to | ||
53 | * the device has completed. Further io will be deferred until | ||
54 | * the device is resumed. | ||
55 | * Resume: It is no longer an error to issue this command on an | ||
56 | * unsuspended device. If a table is present in the 'inactive' | ||
57 | * slot, it will be moved to the active slot, then the old table | ||
58 | * from the active slot will be _destroyed_. Finally the device | ||
59 | * is resumed. | ||
60 | * | ||
61 | * DM_DEV_STATUS: | ||
62 | * Retrieves the status for the table in the 'active' slot. | ||
63 | * | ||
64 | * DM_DEV_WAIT: | ||
65 | * Wait for a significant event to occur to the device. This | ||
66 | * could either be caused by an event triggered by one of the | ||
67 | * targets of the table in the 'active' slot, or a table change. | ||
68 | * | ||
69 | * DM_TABLE_LOAD: | ||
70 | * Load a table into the 'inactive' slot for the device. The | ||
71 | * device does _not_ need to be suspended prior to this command. | ||
72 | * | ||
73 | * DM_TABLE_CLEAR: | ||
74 | * Destroy any table in the 'inactive' slot (ie. abort). | ||
75 | * | ||
76 | * DM_TABLE_DEPS: | ||
77 | * Return a set of device dependencies for the 'active' table. | ||
78 | * | ||
79 | * DM_TABLE_STATUS: | ||
80 | * Return the targets status for the 'active' table. | ||
81 | * | ||
82 | * DM_TARGET_MSG: | ||
83 | * Pass a message string to the target at a specific offset of a device. | ||
84 | * | ||
85 | * DM_DEV_SET_GEOMETRY: | ||
86 | * Set the geometry of a device by passing in a string in this format: | ||
87 | * | ||
88 | * "cylinders heads sectors_per_track start_sector" | ||
89 | * | ||
90 | * Beware that CHS geometry is nearly obsolete and only provided | ||
91 | * for compatibility with dm devices that can be booted by a PC | ||
92 | * BIOS. See struct hd_geometry for range limits. Also note that | ||
93 | * the geometry is erased if the device size changes. | ||
94 | */ | ||
95 | |||
96 | /* | ||
97 | * All ioctl arguments consist of a single chunk of memory, with | ||
98 | * this structure at the start. If a uuid is specified any | ||
99 | * lookup (eg. for a DM_INFO) will be done on that, *not* the | ||
100 | * name. | ||
101 | */ | ||
102 | struct dm_ioctl { | ||
103 | /* | ||
104 | * The version number is made up of three parts: | ||
105 | * major - no backward or forward compatibility, | ||
106 | * minor - only backwards compatible, | ||
107 | * patch - both backwards and forwards compatible. | ||
108 | * | ||
109 | * All clients of the ioctl interface should fill in the | ||
110 | * version number of the interface that they were | ||
111 | * compiled with. | ||
112 | * | ||
113 | * All recognised ioctl commands (ie. those that don't | ||
114 | * return -ENOTTY) fill out this field, even if the | ||
115 | * command failed. | ||
116 | */ | ||
117 | __u32 version[3]; /* in/out */ | ||
118 | __u32 data_size; /* total size of data passed in | ||
119 | * including this struct */ | ||
120 | |||
121 | __u32 data_start; /* offset to start of data | ||
122 | * relative to start of this struct */ | ||
123 | |||
124 | __u32 target_count; /* in/out */ | ||
125 | __s32 open_count; /* out */ | ||
126 | __u32 flags; /* in/out */ | ||
127 | |||
128 | /* | ||
129 | * event_nr holds either the event number (input and output) or the | ||
130 | * udev cookie value (input only). | ||
131 | * The DM_DEV_WAIT ioctl takes an event number as input. | ||
132 | * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls | ||
133 | * use the field as a cookie to return in the DM_COOKIE | ||
134 | * variable with the uevents they issue. | ||
135 | * For output, the ioctls return the event number, not the cookie. | ||
136 | */ | ||
137 | __u32 event_nr; /* in/out */ | ||
138 | __u32 padding; | ||
139 | |||
140 | __u64 dev; /* in/out */ | ||
141 | |||
142 | char name[DM_NAME_LEN]; /* device name */ | ||
143 | char uuid[DM_UUID_LEN]; /* unique identifier for | ||
144 | * the block device */ | ||
145 | char data[7]; /* padding or data */ | ||
146 | }; | ||
147 | |||
148 | /* | ||
149 | * Used to specify tables. These structures appear after the | ||
150 | * dm_ioctl. | ||
151 | */ | ||
152 | struct dm_target_spec { | ||
153 | __u64 sector_start; | ||
154 | __u64 length; | ||
155 | __s32 status; /* used when reading from kernel only */ | ||
156 | |||
157 | /* | ||
158 | * Location of the next dm_target_spec. | ||
159 | * - When specifying targets on a DM_TABLE_LOAD command, this value is | ||
160 | * the number of bytes from the start of the "current" dm_target_spec | ||
161 | * to the start of the "next" dm_target_spec. | ||
162 | * - When retrieving targets on a DM_TABLE_STATUS command, this value | ||
163 | * is the number of bytes from the start of the first dm_target_spec | ||
164 | * (that follows the dm_ioctl struct) to the start of the "next" | ||
165 | * dm_target_spec. | ||
166 | */ | ||
167 | __u32 next; | ||
168 | |||
169 | char target_type[DM_MAX_TYPE_NAME]; | ||
170 | |||
171 | /* | ||
172 | * Parameter string starts immediately after this object. | ||
173 | * Be careful to add padding after string to ensure correct | ||
174 | * alignment of subsequent dm_target_spec. | ||
175 | */ | ||
176 | }; | ||
177 | |||
178 | /* | ||
179 | * Used to retrieve the target dependencies. | ||
180 | */ | ||
181 | struct dm_target_deps { | ||
182 | __u32 count; /* Array size */ | ||
183 | __u32 padding; /* unused */ | ||
184 | __u64 dev[0]; /* out */ | ||
185 | }; | ||
186 | |||
187 | /* | ||
188 | * Used to get a list of all dm devices. | ||
189 | */ | ||
190 | struct dm_name_list { | ||
191 | __u64 dev; | ||
192 | __u32 next; /* offset to the next record from | ||
193 | the _start_ of this */ | ||
194 | char name[0]; | ||
195 | }; | ||
196 | |||
197 | /* | ||
198 | * Used to retrieve the target versions | ||
199 | */ | ||
200 | struct dm_target_versions { | ||
201 | __u32 next; | ||
202 | __u32 version[3]; | ||
203 | |||
204 | char name[0]; | ||
205 | }; | ||
206 | |||
207 | /* | ||
208 | * Used to pass message to a target | ||
209 | */ | ||
210 | struct dm_target_msg { | ||
211 | __u64 sector; /* Device sector */ | ||
212 | |||
213 | char message[0]; | ||
214 | }; | ||
215 | |||
216 | /* | ||
217 | * If you change this make sure you make the corresponding change | ||
218 | * to dm-ioctl.c:lookup_ioctl() | ||
219 | */ | ||
220 | enum { | ||
221 | /* Top level cmds */ | ||
222 | DM_VERSION_CMD = 0, | ||
223 | DM_REMOVE_ALL_CMD, | ||
224 | DM_LIST_DEVICES_CMD, | ||
225 | |||
226 | /* device level cmds */ | ||
227 | DM_DEV_CREATE_CMD, | ||
228 | DM_DEV_REMOVE_CMD, | ||
229 | DM_DEV_RENAME_CMD, | ||
230 | DM_DEV_SUSPEND_CMD, | ||
231 | DM_DEV_STATUS_CMD, | ||
232 | DM_DEV_WAIT_CMD, | ||
233 | |||
234 | /* Table level cmds */ | ||
235 | DM_TABLE_LOAD_CMD, | ||
236 | DM_TABLE_CLEAR_CMD, | ||
237 | DM_TABLE_DEPS_CMD, | ||
238 | DM_TABLE_STATUS_CMD, | ||
239 | |||
240 | /* Added later */ | ||
241 | DM_LIST_VERSIONS_CMD, | ||
242 | DM_TARGET_MSG_CMD, | ||
243 | DM_DEV_SET_GEOMETRY_CMD | ||
244 | }; | ||
245 | |||
246 | #define DM_IOCTL 0xfd | ||
247 | |||
248 | #define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) | ||
249 | #define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) | ||
250 | #define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) | ||
251 | |||
252 | #define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) | ||
253 | #define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) | ||
254 | #define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) | ||
255 | #define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) | ||
256 | #define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) | ||
257 | #define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) | ||
258 | |||
259 | #define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) | ||
260 | #define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) | ||
261 | #define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) | ||
262 | #define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) | ||
263 | |||
264 | #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) | ||
265 | |||
266 | #define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) | ||
267 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | ||
268 | |||
269 | #define DM_VERSION_MAJOR 4 | ||
270 | #define DM_VERSION_MINOR 21 | ||
271 | #define DM_VERSION_PATCHLEVEL 0 | ||
272 | #define DM_VERSION_EXTRA "-ioctl (2011-07-06)" | ||
273 | |||
274 | /* Status bits */ | ||
275 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | ||
276 | #define DM_SUSPEND_FLAG (1 << 1) /* In/Out */ | ||
277 | #define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */ | ||
278 | |||
279 | /* | ||
280 | * Flag passed into ioctl STATUS command to get table information | ||
281 | * rather than current status. | ||
282 | */ | ||
283 | #define DM_STATUS_TABLE_FLAG (1 << 4) /* In */ | ||
284 | |||
285 | /* | ||
286 | * Flags that indicate whether a table is present in either of | ||
287 | * the two table slots that a device has. | ||
288 | */ | ||
289 | #define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */ | ||
290 | #define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */ | ||
291 | |||
292 | /* | ||
293 | * Indicates that the buffer passed in wasn't big enough for the | ||
294 | * results. | ||
295 | */ | ||
296 | #define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ | ||
297 | |||
298 | /* | ||
299 | * This flag is now ignored. | ||
300 | */ | ||
301 | #define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ | ||
302 | |||
303 | /* | ||
304 | * Set this to avoid attempting to freeze any filesystem when suspending. | ||
305 | */ | ||
306 | #define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */ | ||
307 | |||
308 | /* | ||
309 | * Set this to suspend without flushing queued ios. | ||
310 | */ | ||
311 | #define DM_NOFLUSH_FLAG (1 << 11) /* In */ | ||
312 | |||
313 | /* | ||
314 | * If set, any table information returned will relate to the inactive | ||
315 | * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG | ||
316 | * is set before using the data returned. | ||
317 | */ | ||
318 | #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ | ||
319 | |||
320 | /* | ||
321 | * If set, a uevent was generated for which the caller may need to wait. | ||
322 | */ | ||
323 | #define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */ | ||
324 | |||
325 | /* | ||
326 | * If set, rename changes the uuid not the name. Only permitted | ||
327 | * if no uuid was previously supplied: an existing uuid cannot be changed. | ||
328 | */ | ||
329 | #define DM_UUID_FLAG (1 << 14) /* In */ | ||
330 | |||
331 | /* | ||
332 | * If set, all buffers are wiped after use. Use when sending | ||
333 | * or requesting sensitive data such as an encryption key. | ||
334 | */ | ||
335 | #define DM_SECURE_DATA_FLAG (1 << 15) /* In */ | ||
336 | |||
337 | #endif /* _LINUX_DM_IOCTL_H */ | ||
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h new file mode 100644 index 00000000000..eeace7d3ff1 --- /dev/null +++ b/include/linux/dm-log-userspace.h | |||
@@ -0,0 +1,408 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006-2009 Red Hat, Inc. | ||
3 | * | ||
4 | * This file is released under the LGPL. | ||
5 | */ | ||
6 | |||
7 | #ifndef __DM_LOG_USERSPACE_H__ | ||
8 | #define __DM_LOG_USERSPACE_H__ | ||
9 | |||
10 | #include <linux/dm-ioctl.h> /* For DM_UUID_LEN */ | ||
11 | |||
12 | /* | ||
13 | * The device-mapper userspace log module consists of a kernel component and | ||
14 | * a user-space component. The kernel component implements the API defined | ||
15 | * in dm-dirty-log.h. Its purpose is simply to pass the parameters and | ||
16 | * return values of those API functions between kernel and user-space. | ||
17 | * | ||
18 | * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. | ||
19 | * These request types represent the different functions in the device-mapper | ||
20 | * dirty log API. Each of these is described in more detail below. | ||
21 | * | ||
22 | * The user-space program must listen for requests from the kernel (representing | ||
23 | * the various API functions) and process them. | ||
24 | * | ||
25 | * User-space begins by setting up the communication link (error checking | ||
26 | * removed for clarity): | ||
27 | * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); | ||
28 | * addr.nl_family = AF_NETLINK; | ||
29 | * addr.nl_groups = CN_IDX_DM; | ||
30 | * addr.nl_pid = 0; | ||
31 | * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); | ||
32 | * opt = addr.nl_groups; | ||
33 | * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); | ||
34 | * | ||
35 | * User-space will then wait to receive requests form the kernel, which it | ||
36 | * will process as described below. The requests are received in the form, | ||
37 | * ((struct dm_ulog_request) + (additional data)). Depending on the request | ||
38 | * type, there may or may not be 'additional data'. In the descriptions below, | ||
39 | * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The | ||
40 | * 'Payload-to-userspace' is what the kernel sends in 'additional data' as | ||
41 | * necessary parameters to complete the request. The 'Payload-to-kernel' is | ||
42 | * the 'additional data' returned to the kernel that contains the necessary | ||
43 | * results of the request. The 'data_size' field in the dm_ulog_request | ||
44 | * structure denotes the availability and amount of payload data. | ||
45 | */ | ||
46 | |||
47 | /* | ||
48 | * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): | ||
49 | * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, | ||
50 | * unsigned argc, char **argv); | ||
51 | * | ||
52 | * Payload-to-userspace: | ||
53 | * A single string containing all the argv arguments separated by ' 's | ||
54 | * Payload-to-kernel: | ||
55 | * None. ('data_size' in the dm_ulog_request struct should be 0.) | ||
56 | * | ||
57 | * The UUID contained in the dm_ulog_request structure is the reference that | ||
58 | * will be used by all request types to a specific log. The constructor must | ||
59 | * record this assotiation with instance created. | ||
60 | * | ||
61 | * When the request has been processed, user-space must return the | ||
62 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
63 | * 'data_size' appropriately. | ||
64 | */ | ||
65 | #define DM_ULOG_CTR 1 | ||
66 | |||
67 | /* | ||
68 | * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): | ||
69 | * void (*dtr)(struct dm_dirty_log *log); | ||
70 | * | ||
71 | * Payload-to-userspace: | ||
72 | * A single string containing all the argv arguments separated by ' 's | ||
73 | * Payload-to-kernel: | ||
74 | * None. ('data_size' in the dm_ulog_request struct should be 0.) | ||
75 | * | ||
76 | * The UUID contained in the dm_ulog_request structure is all that is | ||
77 | * necessary to identify the log instance being destroyed. There is no | ||
78 | * payload data. | ||
79 | * | ||
80 | * When the request has been processed, user-space must return the | ||
81 | * dm_ulog_request to the kernel - setting the 'error' field and clearing | ||
82 | * 'data_size' appropriately. | ||
83 | */ | ||
84 | #define DM_ULOG_DTR 2 | ||
85 | |||
86 | /* | ||
87 | * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): | ||
88 | * int (*presuspend)(struct dm_dirty_log *log); | ||
89 | * | ||
90 | * Payload-to-userspace: | ||
91 | * None. | ||
92 | * Payload-to-kernel: | ||
93 | * None. | ||
94 | * | ||
95 | * The UUID contained in the dm_ulog_request structure is all that is | ||
96 | * necessary to identify the log instance being presuspended. There is no | ||
97 | * payload data. | ||
98 | * | ||
99 | * When the request has been processed, user-space must return the | ||
100 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
101 | * 'data_size' appropriately. | ||
102 | */ | ||
103 | #define DM_ULOG_PRESUSPEND 3 | ||
104 | |||
105 | /* | ||
106 | * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): | ||
107 | * int (*postsuspend)(struct dm_dirty_log *log); | ||
108 | * | ||
109 | * Payload-to-userspace: | ||
110 | * None. | ||
111 | * Payload-to-kernel: | ||
112 | * None. | ||
113 | * | ||
114 | * The UUID contained in the dm_ulog_request structure is all that is | ||
115 | * necessary to identify the log instance being postsuspended. There is no | ||
116 | * payload data. | ||
117 | * | ||
118 | * When the request has been processed, user-space must return the | ||
119 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
120 | * 'data_size' appropriately. | ||
121 | */ | ||
122 | #define DM_ULOG_POSTSUSPEND 4 | ||
123 | |||
124 | /* | ||
125 | * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): | ||
126 | * int (*resume)(struct dm_dirty_log *log); | ||
127 | * | ||
128 | * Payload-to-userspace: | ||
129 | * None. | ||
130 | * Payload-to-kernel: | ||
131 | * None. | ||
132 | * | ||
133 | * The UUID contained in the dm_ulog_request structure is all that is | ||
134 | * necessary to identify the log instance being resumed. There is no | ||
135 | * payload data. | ||
136 | * | ||
137 | * When the request has been processed, user-space must return the | ||
138 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
139 | * 'data_size' appropriately. | ||
140 | */ | ||
141 | #define DM_ULOG_RESUME 5 | ||
142 | |||
143 | /* | ||
144 | * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): | ||
145 | * uint32_t (*get_region_size)(struct dm_dirty_log *log); | ||
146 | * | ||
147 | * Payload-to-userspace: | ||
148 | * None. | ||
149 | * Payload-to-kernel: | ||
150 | * uint64_t - contains the region size | ||
151 | * | ||
152 | * The region size is something that was determined at constructor time. | ||
153 | * It is returned in the payload area and 'data_size' is set to | ||
154 | * reflect this. | ||
155 | * | ||
156 | * When the request has been processed, user-space must return the | ||
157 | * dm_ulog_request to the kernel - setting the 'error' field appropriately. | ||
158 | */ | ||
159 | #define DM_ULOG_GET_REGION_SIZE 6 | ||
160 | |||
161 | /* | ||
162 | * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): | ||
163 | * int (*is_clean)(struct dm_dirty_log *log, region_t region); | ||
164 | * | ||
165 | * Payload-to-userspace: | ||
166 | * uint64_t - the region to get clean status on | ||
167 | * Payload-to-kernel: | ||
168 | * int64_t - 1 if clean, 0 otherwise | ||
169 | * | ||
170 | * Payload is sizeof(uint64_t) and contains the region for which the clean | ||
171 | * status is being made. | ||
172 | * | ||
173 | * When the request has been processed, user-space must return the | ||
174 | * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or | ||
175 | * 1 (clean), setting 'data_size' and 'error' appropriately. | ||
176 | */ | ||
177 | #define DM_ULOG_IS_CLEAN 7 | ||
178 | |||
179 | /* | ||
180 | * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): | ||
181 | * int (*in_sync)(struct dm_dirty_log *log, region_t region, | ||
182 | * int can_block); | ||
183 | * | ||
184 | * Payload-to-userspace: | ||
185 | * uint64_t - the region to get sync status on | ||
186 | * Payload-to-kernel: | ||
187 | * int64_t - 1 if in-sync, 0 otherwise | ||
188 | * | ||
189 | * Exactly the same as 'is_clean' above, except this time asking "has the | ||
190 | * region been recovered?" vs. "is the region not being modified?" | ||
191 | */ | ||
192 | #define DM_ULOG_IN_SYNC 8 | ||
193 | |||
194 | /* | ||
195 | * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): | ||
196 | * int (*flush)(struct dm_dirty_log *log); | ||
197 | * | ||
198 | * Payload-to-userspace: | ||
199 | * None. | ||
200 | * Payload-to-kernel: | ||
201 | * None. | ||
202 | * | ||
203 | * No incoming or outgoing payload. Simply flush log state to disk. | ||
204 | * | ||
205 | * When the request has been processed, user-space must return the | ||
206 | * dm_ulog_request to the kernel - setting the 'error' field and clearing | ||
207 | * 'data_size' appropriately. | ||
208 | */ | ||
209 | #define DM_ULOG_FLUSH 9 | ||
210 | |||
211 | /* | ||
212 | * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): | ||
213 | * void (*mark_region)(struct dm_dirty_log *log, region_t region); | ||
214 | * | ||
215 | * Payload-to-userspace: | ||
216 | * uint64_t [] - region(s) to mark | ||
217 | * Payload-to-kernel: | ||
218 | * None. | ||
219 | * | ||
220 | * Incoming payload contains the one or more regions to mark dirty. | ||
221 | * The number of regions contained in the payload can be determined from | ||
222 | * 'data_size/sizeof(uint64_t)'. | ||
223 | * | ||
224 | * When the request has been processed, user-space must return the | ||
225 | * dm_ulog_request to the kernel - setting the 'error' field and clearing | ||
226 | * 'data_size' appropriately. | ||
227 | */ | ||
228 | #define DM_ULOG_MARK_REGION 10 | ||
229 | |||
230 | /* | ||
231 | * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): | ||
232 | * void (*clear_region)(struct dm_dirty_log *log, region_t region); | ||
233 | * | ||
234 | * Payload-to-userspace: | ||
235 | * uint64_t [] - region(s) to clear | ||
236 | * Payload-to-kernel: | ||
237 | * None. | ||
238 | * | ||
239 | * Incoming payload contains the one or more regions to mark clean. | ||
240 | * The number of regions contained in the payload can be determined from | ||
241 | * 'data_size/sizeof(uint64_t)'. | ||
242 | * | ||
243 | * When the request has been processed, user-space must return the | ||
244 | * dm_ulog_request to the kernel - setting the 'error' field and clearing | ||
245 | * 'data_size' appropriately. | ||
246 | */ | ||
247 | #define DM_ULOG_CLEAR_REGION 11 | ||
248 | |||
249 | /* | ||
250 | * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): | ||
251 | * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); | ||
252 | * | ||
253 | * Payload-to-userspace: | ||
254 | * None. | ||
255 | * Payload-to-kernel: | ||
256 | * { | ||
257 | * int64_t i; -- 1 if recovery necessary, 0 otherwise | ||
258 | * uint64_t r; -- The region to recover if i=1 | ||
259 | * } | ||
260 | * 'data_size' should be set appropriately. | ||
261 | * | ||
262 | * When the request has been processed, user-space must return the | ||
263 | * dm_ulog_request to the kernel - setting the 'error' field appropriately. | ||
264 | */ | ||
265 | #define DM_ULOG_GET_RESYNC_WORK 12 | ||
266 | |||
267 | /* | ||
268 | * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): | ||
269 | * void (*set_region_sync)(struct dm_dirty_log *log, | ||
270 | * region_t region, int in_sync); | ||
271 | * | ||
272 | * Payload-to-userspace: | ||
273 | * { | ||
274 | * uint64_t - region to set sync state on | ||
275 | * int64_t - 0 if not-in-sync, 1 if in-sync | ||
276 | * } | ||
277 | * Payload-to-kernel: | ||
278 | * None. | ||
279 | * | ||
280 | * When the request has been processed, user-space must return the | ||
281 | * dm_ulog_request to the kernel - setting the 'error' field and clearing | ||
282 | * 'data_size' appropriately. | ||
283 | */ | ||
284 | #define DM_ULOG_SET_REGION_SYNC 13 | ||
285 | |||
286 | /* | ||
287 | * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): | ||
288 | * region_t (*get_sync_count)(struct dm_dirty_log *log); | ||
289 | * | ||
290 | * Payload-to-userspace: | ||
291 | * None. | ||
292 | * Payload-to-kernel: | ||
293 | * uint64_t - the number of in-sync regions | ||
294 | * | ||
295 | * No incoming payload. Kernel-bound payload contains the number of | ||
296 | * regions that are in-sync (in a size_t). | ||
297 | * | ||
298 | * When the request has been processed, user-space must return the | ||
299 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
300 | * 'data_size' appropriately. | ||
301 | */ | ||
302 | #define DM_ULOG_GET_SYNC_COUNT 14 | ||
303 | |||
304 | /* | ||
305 | * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): | ||
306 | * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, | ||
307 | * char *result, unsigned maxlen); | ||
308 | * | ||
309 | * Payload-to-userspace: | ||
310 | * None. | ||
311 | * Payload-to-kernel: | ||
312 | * Character string containing STATUSTYPE_INFO | ||
313 | * | ||
314 | * When the request has been processed, user-space must return the | ||
315 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
316 | * 'data_size' appropriately. | ||
317 | */ | ||
318 | #define DM_ULOG_STATUS_INFO 15 | ||
319 | |||
320 | /* | ||
321 | * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): | ||
322 | * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, | ||
323 | * char *result, unsigned maxlen); | ||
324 | * | ||
325 | * Payload-to-userspace: | ||
326 | * None. | ||
327 | * Payload-to-kernel: | ||
328 | * Character string containing STATUSTYPE_TABLE | ||
329 | * | ||
330 | * When the request has been processed, user-space must return the | ||
331 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
332 | * 'data_size' appropriately. | ||
333 | */ | ||
334 | #define DM_ULOG_STATUS_TABLE 16 | ||
335 | |||
336 | /* | ||
337 | * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): | ||
338 | * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); | ||
339 | * | ||
340 | * Payload-to-userspace: | ||
341 | * uint64_t - region to determine recovery status on | ||
342 | * Payload-to-kernel: | ||
343 | * { | ||
344 | * int64_t is_recovering; -- 0 if no, 1 if yes | ||
345 | * uint64_t in_sync_hint; -- lowest region still needing resync | ||
346 | * } | ||
347 | * | ||
348 | * When the request has been processed, user-space must return the | ||
349 | * dm_ulog_request to the kernel - setting the 'error' field and | ||
350 | * 'data_size' appropriately. | ||
351 | */ | ||
352 | #define DM_ULOG_IS_REMOTE_RECOVERING 17 | ||
353 | |||
354 | /* | ||
355 | * (DM_ULOG_REQUEST_MASK & request_type) to get the request type | ||
356 | * | ||
357 | * Payload-to-userspace: | ||
358 | * A single string containing all the argv arguments separated by ' 's | ||
359 | * Payload-to-kernel: | ||
360 | * None. ('data_size' in the dm_ulog_request struct should be 0.) | ||
361 | * | ||
362 | * We are reserving 8 bits of the 32-bit 'request_type' field for the | ||
363 | * various request types above. The remaining 24-bits are currently | ||
364 | * set to zero and are reserved for future use and compatibility concerns. | ||
365 | * | ||
366 | * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the | ||
367 | * request type from the 'request_type' field to maintain forward compatibility. | ||
368 | */ | ||
369 | #define DM_ULOG_REQUEST_MASK 0xFF | ||
370 | #define DM_ULOG_REQUEST_TYPE(request_type) \ | ||
371 | (DM_ULOG_REQUEST_MASK & (request_type)) | ||
372 | |||
373 | /* | ||
374 | * DM_ULOG_REQUEST_VERSION is incremented when there is a | ||
375 | * change to the way information is passed between kernel | ||
376 | * and userspace. This could be a structure change of | ||
377 | * dm_ulog_request or a change in the way requests are | ||
378 | * issued/handled. Changes are outlined here: | ||
379 | * version 1: Initial implementation | ||
380 | */ | ||
381 | #define DM_ULOG_REQUEST_VERSION 1 | ||
382 | |||
383 | struct dm_ulog_request { | ||
384 | /* | ||
385 | * The local unique identifier (luid) and the universally unique | ||
386 | * identifier (uuid) are used to tie a request to a specific | ||
387 | * mirror log. A single machine log could probably make due with | ||
388 | * just the 'luid', but a cluster-aware log must use the 'uuid' and | ||
389 | * the 'luid'. The uuid is what is required for node to node | ||
390 | * communication concerning a particular log, but the 'luid' helps | ||
391 | * differentiate between logs that are being swapped and have the | ||
392 | * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) | ||
393 | */ | ||
394 | uint64_t luid; | ||
395 | char uuid[DM_UUID_LEN]; | ||
396 | char padding[3]; /* Padding because DM_UUID_LEN = 129 */ | ||
397 | |||
398 | uint32_t version; /* See DM_ULOG_REQUEST_VERSION */ | ||
399 | int32_t error; /* Used to report back processing errors */ | ||
400 | |||
401 | uint32_t seq; /* Sequence number for request */ | ||
402 | uint32_t request_type; /* DM_ULOG_* defined above */ | ||
403 | uint32_t data_size; /* How much data (not including this struct) */ | ||
404 | |||
405 | char data[0]; | ||
406 | }; | ||
407 | |||
408 | #endif /* __DM_LOG_USERSPACE_H__ */ | ||
diff --git a/include/linux/dn.h b/include/linux/dn.h new file mode 100644 index 00000000000..9c50445462d --- /dev/null +++ b/include/linux/dn.h | |||
@@ -0,0 +1,146 @@ | |||
1 | #ifndef _LINUX_DN_H | ||
2 | #define _LINUX_DN_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* | ||
7 | |||
8 | DECnet Data Structures and Constants | ||
9 | |||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * DNPROTO_NSP can't be the same as SOL_SOCKET, | ||
14 | * so increment each by one (compared to ULTRIX) | ||
15 | */ | ||
16 | #define DNPROTO_NSP 2 /* NSP protocol number */ | ||
17 | #define DNPROTO_ROU 3 /* Routing protocol number */ | ||
18 | #define DNPROTO_NML 4 /* Net mgt protocol number */ | ||
19 | #define DNPROTO_EVL 5 /* Evl protocol number (usr) */ | ||
20 | #define DNPROTO_EVR 6 /* Evl protocol number (evl) */ | ||
21 | #define DNPROTO_NSPT 7 /* NSP trace protocol number */ | ||
22 | |||
23 | |||
24 | #define DN_ADDL 2 | ||
25 | #define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */ | ||
26 | #define DN_MAXOPTL 16 | ||
27 | #define DN_MAXOBJL 16 | ||
28 | #define DN_MAXACCL 40 | ||
29 | #define DN_MAXALIASL 128 | ||
30 | #define DN_MAXNODEL 256 | ||
31 | #define DNBUFSIZE 65023 | ||
32 | |||
33 | /* | ||
34 | * SET/GET Socket options - must match the DSO_ numbers below | ||
35 | */ | ||
36 | #define SO_CONDATA 1 | ||
37 | #define SO_CONACCESS 2 | ||
38 | #define SO_PROXYUSR 3 | ||
39 | #define SO_LINKINFO 7 | ||
40 | |||
41 | #define DSO_CONDATA 1 /* Set/Get connect data */ | ||
42 | #define DSO_DISDATA 10 /* Set/Get disconnect data */ | ||
43 | #define DSO_CONACCESS 2 /* Set/Get connect access data */ | ||
44 | #define DSO_ACCEPTMODE 4 /* Set/Get accept mode */ | ||
45 | #define DSO_CONACCEPT 5 /* Accept deferred connection */ | ||
46 | #define DSO_CONREJECT 6 /* Reject deferred connection */ | ||
47 | #define DSO_LINKINFO 7 /* Set/Get link information */ | ||
48 | #define DSO_STREAM 8 /* Set socket type to stream */ | ||
49 | #define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */ | ||
50 | #define DSO_MAXWINDOW 11 /* Maximum window size allowed */ | ||
51 | #define DSO_NODELAY 12 /* Turn off nagle */ | ||
52 | #define DSO_CORK 13 /* Wait for more data! */ | ||
53 | #define DSO_SERVICES 14 /* NSP Services field */ | ||
54 | #define DSO_INFO 15 /* NSP Info field */ | ||
55 | #define DSO_MAX 15 /* Maximum option number */ | ||
56 | |||
57 | |||
58 | /* LINK States */ | ||
59 | #define LL_INACTIVE 0 | ||
60 | #define LL_CONNECTING 1 | ||
61 | #define LL_RUNNING 2 | ||
62 | #define LL_DISCONNECTING 3 | ||
63 | |||
64 | #define ACC_IMMED 0 | ||
65 | #define ACC_DEFER 1 | ||
66 | |||
67 | #define SDF_WILD 1 /* Wild card object */ | ||
68 | #define SDF_PROXY 2 /* Addr eligible for proxy */ | ||
69 | #define SDF_UICPROXY 4 /* Use uic-based proxy */ | ||
70 | |||
71 | /* Structures */ | ||
72 | |||
73 | |||
74 | struct dn_naddr { | ||
75 | __le16 a_len; | ||
76 | __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ | ||
77 | }; | ||
78 | |||
79 | struct sockaddr_dn { | ||
80 | __u16 sdn_family; | ||
81 | __u8 sdn_flags; | ||
82 | __u8 sdn_objnum; | ||
83 | __le16 sdn_objnamel; | ||
84 | __u8 sdn_objname[DN_MAXOBJL]; | ||
85 | struct dn_naddr sdn_add; | ||
86 | }; | ||
87 | #define sdn_nodeaddrl sdn_add.a_len /* Node address length */ | ||
88 | #define sdn_nodeaddr sdn_add.a_addr /* Node address */ | ||
89 | |||
90 | |||
91 | |||
92 | /* | ||
93 | * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure | ||
94 | */ | ||
95 | struct optdata_dn { | ||
96 | __le16 opt_status; /* Extended status return */ | ||
97 | #define opt_sts opt_status | ||
98 | __le16 opt_optl; /* Length of user data */ | ||
99 | __u8 opt_data[16]; /* User data */ | ||
100 | }; | ||
101 | |||
102 | struct accessdata_dn { | ||
103 | __u8 acc_accl; | ||
104 | __u8 acc_acc[DN_MAXACCL]; | ||
105 | __u8 acc_passl; | ||
106 | __u8 acc_pass[DN_MAXACCL]; | ||
107 | __u8 acc_userl; | ||
108 | __u8 acc_user[DN_MAXACCL]; | ||
109 | }; | ||
110 | |||
111 | /* | ||
112 | * DECnet logical link information structure | ||
113 | */ | ||
114 | struct linkinfo_dn { | ||
115 | __u16 idn_segsize; /* Segment size for link */ | ||
116 | __u8 idn_linkstate; /* Logical link state */ | ||
117 | }; | ||
118 | |||
119 | /* | ||
120 | * Ethernet address format (for DECnet) | ||
121 | */ | ||
122 | union etheraddress { | ||
123 | __u8 dne_addr[6]; /* Full ethernet address */ | ||
124 | struct { | ||
125 | __u8 dne_hiord[4]; /* DECnet HIORD prefix */ | ||
126 | __u8 dne_nodeaddr[2]; /* DECnet node address */ | ||
127 | } dne_remote; | ||
128 | }; | ||
129 | |||
130 | |||
131 | /* | ||
132 | * DECnet physical socket address format | ||
133 | */ | ||
134 | struct dn_addr { | ||
135 | __le16 dna_family; /* AF_DECnet */ | ||
136 | union etheraddress dna_netaddr; /* DECnet ethernet address */ | ||
137 | }; | ||
138 | |||
139 | #define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */ | ||
140 | |||
141 | #define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr) | ||
142 | #define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr) | ||
143 | #define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int) | ||
144 | #define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int) | ||
145 | |||
146 | #endif /* _LINUX_DN_H */ | ||
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h new file mode 100644 index 00000000000..86552807aed --- /dev/null +++ b/include/linux/dqblk_xfs.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public License | ||
6 | * as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU Lesser General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU Lesset General Public License | ||
14 | * along with this program; if not, write to the Free Software Foundation, | ||
15 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
16 | */ | ||
17 | #ifndef _LINUX_DQBLK_XFS_H | ||
18 | #define _LINUX_DQBLK_XFS_H | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | |||
22 | /* | ||
23 | * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM). | ||
24 | */ | ||
25 | |||
26 | #define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ | ||
27 | #define XQM_COMMAND(x) (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */ | ||
28 | |||
29 | #define XQM_USRQUOTA 0 /* system call user quota type */ | ||
30 | #define XQM_GRPQUOTA 1 /* system call group quota type */ | ||
31 | #define XQM_PRJQUOTA 2 /* system call project quota type */ | ||
32 | #define XQM_MAXQUOTAS 3 | ||
33 | |||
34 | #define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ | ||
35 | #define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ | ||
36 | #define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */ | ||
37 | #define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ | ||
38 | #define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ | ||
39 | #define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ | ||
40 | #define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ | ||
41 | |||
42 | /* | ||
43 | * fs_disk_quota structure: | ||
44 | * | ||
45 | * This contains the current quota information regarding a user/proj/group. | ||
46 | * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of | ||
47 | * 512 bytes. | ||
48 | */ | ||
49 | #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ | ||
50 | typedef struct fs_disk_quota { | ||
51 | __s8 d_version; /* version of this structure */ | ||
52 | __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */ | ||
53 | __u16 d_fieldmask; /* field specifier */ | ||
54 | __u32 d_id; /* user, project, or group ID */ | ||
55 | __u64 d_blk_hardlimit;/* absolute limit on disk blks */ | ||
56 | __u64 d_blk_softlimit;/* preferred limit on disk blks */ | ||
57 | __u64 d_ino_hardlimit;/* maximum # allocated inodes */ | ||
58 | __u64 d_ino_softlimit;/* preferred inode limit */ | ||
59 | __u64 d_bcount; /* # disk blocks owned by the user */ | ||
60 | __u64 d_icount; /* # inodes owned by the user */ | ||
61 | __s32 d_itimer; /* zero if within inode limits */ | ||
62 | /* if not, we refuse service */ | ||
63 | __s32 d_btimer; /* similar to above; for disk blocks */ | ||
64 | __u16 d_iwarns; /* # warnings issued wrt num inodes */ | ||
65 | __u16 d_bwarns; /* # warnings issued wrt disk blocks */ | ||
66 | __s32 d_padding2; /* padding2 - for future use */ | ||
67 | __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ | ||
68 | __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ | ||
69 | __u64 d_rtbcount; /* # realtime blocks owned */ | ||
70 | __s32 d_rtbtimer; /* similar to above; for RT disk blks */ | ||
71 | __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ | ||
72 | __s16 d_padding3; /* padding3 - for future use */ | ||
73 | char d_padding4[8]; /* yet more padding */ | ||
74 | } fs_disk_quota_t; | ||
75 | |||
76 | /* | ||
77 | * These fields are sent to Q_XSETQLIM to specify fields that need to change. | ||
78 | */ | ||
79 | #define FS_DQ_ISOFT (1<<0) | ||
80 | #define FS_DQ_IHARD (1<<1) | ||
81 | #define FS_DQ_BSOFT (1<<2) | ||
82 | #define FS_DQ_BHARD (1<<3) | ||
83 | #define FS_DQ_RTBSOFT (1<<4) | ||
84 | #define FS_DQ_RTBHARD (1<<5) | ||
85 | #define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ | ||
86 | FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) | ||
87 | /* | ||
88 | * These timers can only be set in super user's dquot. For others, timers are | ||
89 | * automatically started and stopped. Superusers timer values set the limits | ||
90 | * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values | ||
91 | * defined below are used. | ||
92 | * These values also apply only to the d_fieldmask field for Q_XSETQLIM. | ||
93 | */ | ||
94 | #define FS_DQ_BTIMER (1<<6) | ||
95 | #define FS_DQ_ITIMER (1<<7) | ||
96 | #define FS_DQ_RTBTIMER (1<<8) | ||
97 | #define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) | ||
98 | |||
99 | /* | ||
100 | * Warning counts are set in both super user's dquot and others. For others, | ||
101 | * warnings are set/cleared by the administrators (or automatically by going | ||
102 | * below the soft limit). Superusers warning values set the warning limits | ||
103 | * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values | ||
104 | * defined below are used. | ||
105 | * These values also apply only to the d_fieldmask field for Q_XSETQLIM. | ||
106 | */ | ||
107 | #define FS_DQ_BWARNS (1<<9) | ||
108 | #define FS_DQ_IWARNS (1<<10) | ||
109 | #define FS_DQ_RTBWARNS (1<<11) | ||
110 | #define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) | ||
111 | |||
112 | /* | ||
113 | * Accounting values. These can only be set for filesystem with | ||
114 | * non-transactional quotas that require quotacheck(8) in userspace. | ||
115 | */ | ||
116 | #define FS_DQ_BCOUNT (1<<12) | ||
117 | #define FS_DQ_ICOUNT (1<<13) | ||
118 | #define FS_DQ_RTBCOUNT (1<<14) | ||
119 | #define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT) | ||
120 | |||
121 | /* | ||
122 | * Various flags related to quotactl(2). | ||
123 | */ | ||
124 | #define FS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ | ||
125 | #define FS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ | ||
126 | #define FS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ | ||
127 | #define FS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ | ||
128 | #define FS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ | ||
129 | #define FS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ | ||
130 | |||
131 | #define FS_USER_QUOTA (1<<0) /* user quota type */ | ||
132 | #define FS_PROJ_QUOTA (1<<1) /* project quota type */ | ||
133 | #define FS_GROUP_QUOTA (1<<2) /* group quota type */ | ||
134 | |||
135 | /* | ||
136 | * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. | ||
137 | * Provides a centralized way to get meta information about the quota subsystem. | ||
138 | * eg. space taken up for user and group quotas, number of dquots currently | ||
139 | * incore. | ||
140 | */ | ||
141 | #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ | ||
142 | |||
143 | /* | ||
144 | * Some basic information about 'quota files'. | ||
145 | */ | ||
146 | typedef struct fs_qfilestat { | ||
147 | __u64 qfs_ino; /* inode number */ | ||
148 | __u64 qfs_nblks; /* number of BBs 512-byte-blks */ | ||
149 | __u32 qfs_nextents; /* number of extents */ | ||
150 | } fs_qfilestat_t; | ||
151 | |||
152 | typedef struct fs_quota_stat { | ||
153 | __s8 qs_version; /* version number for future changes */ | ||
154 | __u16 qs_flags; /* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ | ||
155 | __s8 qs_pad; /* unused */ | ||
156 | fs_qfilestat_t qs_uquota; /* user quota storage information */ | ||
157 | fs_qfilestat_t qs_gquota; /* group quota storage information */ | ||
158 | __u32 qs_incoredqs; /* number of dquots incore */ | ||
159 | __s32 qs_btimelimit; /* limit for blks timer */ | ||
160 | __s32 qs_itimelimit; /* limit for inodes timer */ | ||
161 | __s32 qs_rtbtimelimit;/* limit for rt blks timer */ | ||
162 | __u16 qs_bwarnlimit; /* limit for num warnings */ | ||
163 | __u16 qs_iwarnlimit; /* limit for num warnings */ | ||
164 | } fs_quota_stat_t; | ||
165 | |||
166 | #endif /* _LINUX_DQBLK_XFS_H */ | ||
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h new file mode 100644 index 00000000000..ab6159e4fcf --- /dev/null +++ b/include/linux/drbd_nl.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | PAKET( name, | ||
3 | TYPE ( pn, pr, member ) | ||
4 | ... | ||
5 | ) | ||
6 | |||
7 | You may never reissue one of the pn arguments | ||
8 | */ | ||
9 | |||
10 | #if !defined(NL_PACKET) || !defined(NL_STRING) || !defined(NL_INTEGER) || !defined(NL_BIT) || !defined(NL_INT64) | ||
11 | #error "The macros NL_PACKET, NL_STRING, NL_INTEGER, NL_INT64 and NL_BIT needs to be defined" | ||
12 | #endif | ||
13 | |||
14 | NL_PACKET(primary, 1, | ||
15 | NL_BIT( 1, T_MAY_IGNORE, primary_force) | ||
16 | ) | ||
17 | |||
18 | NL_PACKET(secondary, 2, ) | ||
19 | |||
20 | NL_PACKET(disk_conf, 3, | ||
21 | NL_INT64( 2, T_MAY_IGNORE, disk_size) | ||
22 | NL_STRING( 3, T_MANDATORY, backing_dev, 128) | ||
23 | NL_STRING( 4, T_MANDATORY, meta_dev, 128) | ||
24 | NL_INTEGER( 5, T_MANDATORY, meta_dev_idx) | ||
25 | NL_INTEGER( 6, T_MAY_IGNORE, on_io_error) | ||
26 | NL_INTEGER( 7, T_MAY_IGNORE, fencing) | ||
27 | NL_BIT( 37, T_MAY_IGNORE, use_bmbv) | ||
28 | NL_BIT( 53, T_MAY_IGNORE, no_disk_flush) | ||
29 | NL_BIT( 54, T_MAY_IGNORE, no_md_flush) | ||
30 | /* 55 max_bio_size was available in 8.2.6rc2 */ | ||
31 | NL_INTEGER( 56, T_MAY_IGNORE, max_bio_bvecs) | ||
32 | NL_BIT( 57, T_MAY_IGNORE, no_disk_barrier) | ||
33 | NL_BIT( 58, T_MAY_IGNORE, no_disk_drain) | ||
34 | ) | ||
35 | |||
36 | NL_PACKET(detach, 4, ) | ||
37 | |||
38 | NL_PACKET(net_conf, 5, | ||
39 | NL_STRING( 8, T_MANDATORY, my_addr, 128) | ||
40 | NL_STRING( 9, T_MANDATORY, peer_addr, 128) | ||
41 | NL_STRING( 10, T_MAY_IGNORE, shared_secret, SHARED_SECRET_MAX) | ||
42 | NL_STRING( 11, T_MAY_IGNORE, cram_hmac_alg, SHARED_SECRET_MAX) | ||
43 | NL_STRING( 44, T_MAY_IGNORE, integrity_alg, SHARED_SECRET_MAX) | ||
44 | NL_INTEGER( 14, T_MAY_IGNORE, timeout) | ||
45 | NL_INTEGER( 15, T_MANDATORY, wire_protocol) | ||
46 | NL_INTEGER( 16, T_MAY_IGNORE, try_connect_int) | ||
47 | NL_INTEGER( 17, T_MAY_IGNORE, ping_int) | ||
48 | NL_INTEGER( 18, T_MAY_IGNORE, max_epoch_size) | ||
49 | NL_INTEGER( 19, T_MAY_IGNORE, max_buffers) | ||
50 | NL_INTEGER( 20, T_MAY_IGNORE, unplug_watermark) | ||
51 | NL_INTEGER( 21, T_MAY_IGNORE, sndbuf_size) | ||
52 | NL_INTEGER( 22, T_MAY_IGNORE, ko_count) | ||
53 | NL_INTEGER( 24, T_MAY_IGNORE, after_sb_0p) | ||
54 | NL_INTEGER( 25, T_MAY_IGNORE, after_sb_1p) | ||
55 | NL_INTEGER( 26, T_MAY_IGNORE, after_sb_2p) | ||
56 | NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict) | ||
57 | NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo) | ||
58 | NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size) | ||
59 | NL_INTEGER( 81, T_MAY_IGNORE, on_congestion) | ||
60 | NL_INTEGER( 82, T_MAY_IGNORE, cong_fill) | ||
61 | NL_INTEGER( 83, T_MAY_IGNORE, cong_extents) | ||
62 | /* 59 addr_family was available in GIT, never released */ | ||
63 | NL_BIT( 60, T_MANDATORY, mind_af) | ||
64 | NL_BIT( 27, T_MAY_IGNORE, want_lose) | ||
65 | NL_BIT( 28, T_MAY_IGNORE, two_primaries) | ||
66 | NL_BIT( 41, T_MAY_IGNORE, always_asbp) | ||
67 | NL_BIT( 61, T_MAY_IGNORE, no_cork) | ||
68 | NL_BIT( 62, T_MANDATORY, auto_sndbuf_size) | ||
69 | NL_BIT( 70, T_MANDATORY, dry_run) | ||
70 | ) | ||
71 | |||
72 | NL_PACKET(disconnect, 6, | ||
73 | NL_BIT( 84, T_MAY_IGNORE, force) | ||
74 | ) | ||
75 | |||
76 | NL_PACKET(resize, 7, | ||
77 | NL_INT64( 29, T_MAY_IGNORE, resize_size) | ||
78 | NL_BIT( 68, T_MAY_IGNORE, resize_force) | ||
79 | NL_BIT( 69, T_MANDATORY, no_resync) | ||
80 | ) | ||
81 | |||
82 | NL_PACKET(syncer_conf, 8, | ||
83 | NL_INTEGER( 30, T_MAY_IGNORE, rate) | ||
84 | NL_INTEGER( 31, T_MAY_IGNORE, after) | ||
85 | NL_INTEGER( 32, T_MAY_IGNORE, al_extents) | ||
86 | /* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume) | ||
87 | * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval) | ||
88 | * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th) | ||
89 | * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th) | ||
90 | * feature will be reimplemented differently with 8.3.9 */ | ||
91 | NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) | ||
92 | NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) | ||
93 | NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) | ||
94 | NL_BIT( 65, T_MAY_IGNORE, use_rle) | ||
95 | NL_INTEGER( 75, T_MAY_IGNORE, on_no_data) | ||
96 | NL_INTEGER( 76, T_MAY_IGNORE, c_plan_ahead) | ||
97 | NL_INTEGER( 77, T_MAY_IGNORE, c_delay_target) | ||
98 | NL_INTEGER( 78, T_MAY_IGNORE, c_fill_target) | ||
99 | NL_INTEGER( 79, T_MAY_IGNORE, c_max_rate) | ||
100 | NL_INTEGER( 80, T_MAY_IGNORE, c_min_rate) | ||
101 | ) | ||
102 | |||
103 | NL_PACKET(invalidate, 9, ) | ||
104 | NL_PACKET(invalidate_peer, 10, ) | ||
105 | NL_PACKET(pause_sync, 11, ) | ||
106 | NL_PACKET(resume_sync, 12, ) | ||
107 | NL_PACKET(suspend_io, 13, ) | ||
108 | NL_PACKET(resume_io, 14, ) | ||
109 | NL_PACKET(outdate, 15, ) | ||
110 | NL_PACKET(get_config, 16, ) | ||
111 | NL_PACKET(get_state, 17, | ||
112 | NL_INTEGER( 33, T_MAY_IGNORE, state_i) | ||
113 | ) | ||
114 | |||
115 | NL_PACKET(get_uuids, 18, | ||
116 | NL_STRING( 34, T_MAY_IGNORE, uuids, (UI_SIZE*sizeof(__u64))) | ||
117 | NL_INTEGER( 35, T_MAY_IGNORE, uuids_flags) | ||
118 | ) | ||
119 | |||
120 | NL_PACKET(get_timeout_flag, 19, | ||
121 | NL_BIT( 36, T_MAY_IGNORE, use_degraded) | ||
122 | ) | ||
123 | |||
124 | NL_PACKET(call_helper, 20, | ||
125 | NL_STRING( 38, T_MAY_IGNORE, helper, 32) | ||
126 | ) | ||
127 | |||
128 | /* Tag nr 42 already allocated in drbd-8.1 development. */ | ||
129 | |||
130 | NL_PACKET(sync_progress, 23, | ||
131 | NL_INTEGER( 43, T_MAY_IGNORE, sync_progress) | ||
132 | ) | ||
133 | |||
134 | NL_PACKET(dump_ee, 24, | ||
135 | NL_STRING( 45, T_MAY_IGNORE, dump_ee_reason, 32) | ||
136 | NL_STRING( 46, T_MAY_IGNORE, seen_digest, SHARED_SECRET_MAX) | ||
137 | NL_STRING( 47, T_MAY_IGNORE, calc_digest, SHARED_SECRET_MAX) | ||
138 | NL_INT64( 48, T_MAY_IGNORE, ee_sector) | ||
139 | NL_INT64( 49, T_MAY_IGNORE, ee_block_id) | ||
140 | NL_STRING( 50, T_MAY_IGNORE, ee_data, 32 << 10) | ||
141 | ) | ||
142 | |||
143 | NL_PACKET(start_ov, 25, | ||
144 | NL_INT64( 66, T_MAY_IGNORE, start_sector) | ||
145 | ) | ||
146 | |||
147 | NL_PACKET(new_c_uuid, 26, | ||
148 | NL_BIT( 63, T_MANDATORY, clear_bm) | ||
149 | ) | ||
150 | |||
151 | #ifdef NL_RESPONSE | ||
152 | NL_RESPONSE(return_code_only, 27) | ||
153 | #endif | ||
154 | |||
155 | #undef NL_PACKET | ||
156 | #undef NL_INTEGER | ||
157 | #undef NL_INT64 | ||
158 | #undef NL_BIT | ||
159 | #undef NL_STRING | ||
160 | #undef NL_RESPONSE | ||
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h new file mode 100644 index 00000000000..06954319051 --- /dev/null +++ b/include/linux/drbd_tag_magic.h | |||
@@ -0,0 +1,84 @@ | |||
1 | #ifndef DRBD_TAG_MAGIC_H | ||
2 | #define DRBD_TAG_MAGIC_H | ||
3 | |||
4 | #define TT_END 0 | ||
5 | #define TT_REMOVED 0xE000 | ||
6 | |||
7 | /* declare packet_type enums */ | ||
8 | enum packet_types { | ||
9 | #define NL_PACKET(name, number, fields) P_ ## name = number, | ||
10 | #define NL_RESPONSE(name, number) P_ ## name = number, | ||
11 | #define NL_INTEGER(pn, pr, member) | ||
12 | #define NL_INT64(pn, pr, member) | ||
13 | #define NL_BIT(pn, pr, member) | ||
14 | #define NL_STRING(pn, pr, member, len) | ||
15 | #include "drbd_nl.h" | ||
16 | P_nl_after_last_packet, | ||
17 | }; | ||
18 | |||
19 | /* These struct are used to deduce the size of the tag lists: */ | ||
20 | #define NL_PACKET(name, number, fields) \ | ||
21 | struct name ## _tag_len_struct { fields }; | ||
22 | #define NL_INTEGER(pn, pr, member) \ | ||
23 | int member; int tag_and_len ## member; | ||
24 | #define NL_INT64(pn, pr, member) \ | ||
25 | __u64 member; int tag_and_len ## member; | ||
26 | #define NL_BIT(pn, pr, member) \ | ||
27 | unsigned char member:1; int tag_and_len ## member; | ||
28 | #define NL_STRING(pn, pr, member, len) \ | ||
29 | unsigned char member[len]; int member ## _len; \ | ||
30 | int tag_and_len ## member; | ||
31 | #include "linux/drbd_nl.h" | ||
32 | |||
33 | /* declare tag-list-sizes */ | ||
34 | static const int tag_list_sizes[] = { | ||
35 | #define NL_PACKET(name, number, fields) 2 fields , | ||
36 | #define NL_INTEGER(pn, pr, member) + 4 + 4 | ||
37 | #define NL_INT64(pn, pr, member) + 4 + 8 | ||
38 | #define NL_BIT(pn, pr, member) + 4 + 1 | ||
39 | #define NL_STRING(pn, pr, member, len) + 4 + (len) | ||
40 | #include "drbd_nl.h" | ||
41 | }; | ||
42 | |||
43 | /* The two highest bits are used for the tag type */ | ||
44 | #define TT_MASK 0xC000 | ||
45 | #define TT_INTEGER 0x0000 | ||
46 | #define TT_INT64 0x4000 | ||
47 | #define TT_BIT 0x8000 | ||
48 | #define TT_STRING 0xC000 | ||
49 | /* The next bit indicates if processing of the tag is mandatory */ | ||
50 | #define T_MANDATORY 0x2000 | ||
51 | #define T_MAY_IGNORE 0x0000 | ||
52 | #define TN_MASK 0x1fff | ||
53 | /* The remaining 13 bits are used to enumerate the tags */ | ||
54 | |||
55 | #define tag_type(T) ((T) & TT_MASK) | ||
56 | #define tag_number(T) ((T) & TN_MASK) | ||
57 | |||
58 | /* declare tag enums */ | ||
59 | #define NL_PACKET(name, number, fields) fields | ||
60 | enum drbd_tags { | ||
61 | #define NL_INTEGER(pn, pr, member) T_ ## member = pn | TT_INTEGER | pr , | ||
62 | #define NL_INT64(pn, pr, member) T_ ## member = pn | TT_INT64 | pr , | ||
63 | #define NL_BIT(pn, pr, member) T_ ## member = pn | TT_BIT | pr , | ||
64 | #define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING | pr , | ||
65 | #include "drbd_nl.h" | ||
66 | }; | ||
67 | |||
68 | struct tag { | ||
69 | const char *name; | ||
70 | int type_n_flags; | ||
71 | int max_len; | ||
72 | }; | ||
73 | |||
74 | /* declare tag names */ | ||
75 | #define NL_PACKET(name, number, fields) fields | ||
76 | static const struct tag tag_descriptions[] = { | ||
77 | #define NL_INTEGER(pn, pr, member) [ pn ] = { #member, TT_INTEGER | pr, sizeof(int) }, | ||
78 | #define NL_INT64(pn, pr, member) [ pn ] = { #member, TT_INT64 | pr, sizeof(__u64) }, | ||
79 | #define NL_BIT(pn, pr, member) [ pn ] = { #member, TT_BIT | pr, sizeof(int) }, | ||
80 | #define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING | pr, (len) }, | ||
81 | #include "drbd_nl.h" | ||
82 | }; | ||
83 | |||
84 | #endif | ||
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild new file mode 100644 index 00000000000..f4dba8637f9 --- /dev/null +++ b/include/linux/dvb/Kbuild | |||
@@ -0,0 +1,8 @@ | |||
1 | header-y += audio.h | ||
2 | header-y += ca.h | ||
3 | header-y += dmx.h | ||
4 | header-y += frontend.h | ||
5 | header-y += net.h | ||
6 | header-y += osd.h | ||
7 | header-y += version.h | ||
8 | header-y += video.h | ||
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h new file mode 100644 index 00000000000..d47bccd604e --- /dev/null +++ b/include/linux/dvb/audio.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * audio.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> | ||
5 | * & Marcus Metzler <marcus@convergence.de> | ||
6 | * for convergence integrated media GmbH | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Lesser Public License | ||
10 | * as published by the Free Software Foundation; either version 2.1 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _DVBAUDIO_H_ | ||
25 | #define _DVBAUDIO_H_ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | |||
29 | typedef enum { | ||
30 | AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ | ||
31 | AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */ | ||
32 | } audio_stream_source_t; | ||
33 | |||
34 | |||
35 | typedef enum { | ||
36 | AUDIO_STOPPED, /* Device is stopped */ | ||
37 | AUDIO_PLAYING, /* Device is currently playing */ | ||
38 | AUDIO_PAUSED /* Device is paused */ | ||
39 | } audio_play_state_t; | ||
40 | |||
41 | |||
42 | typedef enum { | ||
43 | AUDIO_STEREO, | ||
44 | AUDIO_MONO_LEFT, | ||
45 | AUDIO_MONO_RIGHT, | ||
46 | AUDIO_MONO, | ||
47 | AUDIO_STEREO_SWAPPED | ||
48 | } audio_channel_select_t; | ||
49 | |||
50 | |||
51 | typedef struct audio_mixer { | ||
52 | unsigned int volume_left; | ||
53 | unsigned int volume_right; | ||
54 | // what else do we need? bass, pass-through, ... | ||
55 | } audio_mixer_t; | ||
56 | |||
57 | |||
58 | typedef struct audio_status { | ||
59 | int AV_sync_state; /* sync audio and video? */ | ||
60 | int mute_state; /* audio is muted */ | ||
61 | audio_play_state_t play_state; /* current playback state */ | ||
62 | audio_stream_source_t stream_source; /* current stream source */ | ||
63 | audio_channel_select_t channel_select; /* currently selected channel */ | ||
64 | int bypass_mode; /* pass on audio data to */ | ||
65 | audio_mixer_t mixer_state; /* current mixer state */ | ||
66 | } audio_status_t; /* separate decoder hardware */ | ||
67 | |||
68 | |||
69 | typedef | ||
70 | struct audio_karaoke { /* if Vocal1 or Vocal2 are non-zero, they get mixed */ | ||
71 | int vocal1; /* into left and right t at 70% each */ | ||
72 | int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ | ||
73 | int melody; /* mixed into the left channel and */ | ||
74 | /* Vocal2 into the right channel at 100% each. */ | ||
75 | /* if Melody is non-zero, the melody channel gets mixed*/ | ||
76 | } audio_karaoke_t; /* into left and right */ | ||
77 | |||
78 | |||
79 | typedef __u16 audio_attributes_t; | ||
80 | /* bits: descr. */ | ||
81 | /* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ | ||
82 | /* 12 multichannel extension */ | ||
83 | /* 11-10 audio type (0=not spec, 1=language included) */ | ||
84 | /* 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */ | ||
85 | /* 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, */ | ||
86 | /* 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */ | ||
87 | /* 2- 0 number of audio channels (n+1 channels) */ | ||
88 | |||
89 | |||
90 | /* for GET_CAPABILITIES and SET_FORMAT, the latter should only set one bit */ | ||
91 | #define AUDIO_CAP_DTS 1 | ||
92 | #define AUDIO_CAP_LPCM 2 | ||
93 | #define AUDIO_CAP_MP1 4 | ||
94 | #define AUDIO_CAP_MP2 8 | ||
95 | #define AUDIO_CAP_MP3 16 | ||
96 | #define AUDIO_CAP_AAC 32 | ||
97 | #define AUDIO_CAP_OGG 64 | ||
98 | #define AUDIO_CAP_SDDS 128 | ||
99 | #define AUDIO_CAP_AC3 256 | ||
100 | |||
101 | #define AUDIO_STOP _IO('o', 1) | ||
102 | #define AUDIO_PLAY _IO('o', 2) | ||
103 | #define AUDIO_PAUSE _IO('o', 3) | ||
104 | #define AUDIO_CONTINUE _IO('o', 4) | ||
105 | #define AUDIO_SELECT_SOURCE _IO('o', 5) | ||
106 | #define AUDIO_SET_MUTE _IO('o', 6) | ||
107 | #define AUDIO_SET_AV_SYNC _IO('o', 7) | ||
108 | #define AUDIO_SET_BYPASS_MODE _IO('o', 8) | ||
109 | #define AUDIO_CHANNEL_SELECT _IO('o', 9) | ||
110 | #define AUDIO_GET_STATUS _IOR('o', 10, audio_status_t) | ||
111 | |||
112 | #define AUDIO_GET_CAPABILITIES _IOR('o', 11, unsigned int) | ||
113 | #define AUDIO_CLEAR_BUFFER _IO('o', 12) | ||
114 | #define AUDIO_SET_ID _IO('o', 13) | ||
115 | #define AUDIO_SET_MIXER _IOW('o', 14, audio_mixer_t) | ||
116 | #define AUDIO_SET_STREAMTYPE _IO('o', 15) | ||
117 | #define AUDIO_SET_EXT_ID _IO('o', 16) | ||
118 | #define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) | ||
119 | #define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) | ||
120 | |||
121 | /** | ||
122 | * AUDIO_GET_PTS | ||
123 | * | ||
124 | * Read the 33 bit presentation time stamp as defined | ||
125 | * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. | ||
126 | * | ||
127 | * The PTS should belong to the currently played | ||
128 | * frame if possible, but may also be a value close to it | ||
129 | * like the PTS of the last decoded frame or the last PTS | ||
130 | * extracted by the PES parser. | ||
131 | */ | ||
132 | #define AUDIO_GET_PTS _IOR('o', 19, __u64) | ||
133 | #define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) | ||
134 | |||
135 | #endif /* _DVBAUDIO_H_ */ | ||
diff --git a/include/linux/dvb/ca.h b/include/linux/dvb/ca.h new file mode 100644 index 00000000000..c18537f3e44 --- /dev/null +++ b/include/linux/dvb/ca.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * ca.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> | ||
5 | * & Marcus Metzler <marcus@convergence.de> | ||
6 | * for convergence integrated media GmbH | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Lesser Public License | ||
10 | * as published by the Free Software Foundation; either version 2.1 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _DVBCA_H_ | ||
25 | #define _DVBCA_H_ | ||
26 | |||
27 | /* slot interface types and info */ | ||
28 | |||
29 | typedef struct ca_slot_info { | ||
30 | int num; /* slot number */ | ||
31 | |||
32 | int type; /* CA interface this slot supports */ | ||
33 | #define CA_CI 1 /* CI high level interface */ | ||
34 | #define CA_CI_LINK 2 /* CI link layer level interface */ | ||
35 | #define CA_CI_PHYS 4 /* CI physical layer level interface */ | ||
36 | #define CA_DESCR 8 /* built-in descrambler */ | ||
37 | #define CA_SC 128 /* simple smart card interface */ | ||
38 | |||
39 | unsigned int flags; | ||
40 | #define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */ | ||
41 | #define CA_CI_MODULE_READY 2 | ||
42 | } ca_slot_info_t; | ||
43 | |||
44 | |||
45 | /* descrambler types and info */ | ||
46 | |||
47 | typedef struct ca_descr_info { | ||
48 | unsigned int num; /* number of available descramblers (keys) */ | ||
49 | unsigned int type; /* type of supported scrambling system */ | ||
50 | #define CA_ECD 1 | ||
51 | #define CA_NDS 2 | ||
52 | #define CA_DSS 4 | ||
53 | } ca_descr_info_t; | ||
54 | |||
55 | typedef struct ca_caps { | ||
56 | unsigned int slot_num; /* total number of CA card and module slots */ | ||
57 | unsigned int slot_type; /* OR of all supported types */ | ||
58 | unsigned int descr_num; /* total number of descrambler slots (keys) */ | ||
59 | unsigned int descr_type; /* OR of all supported types */ | ||
60 | } ca_caps_t; | ||
61 | |||
62 | /* a message to/from a CI-CAM */ | ||
63 | typedef struct ca_msg { | ||
64 | unsigned int index; | ||
65 | unsigned int type; | ||
66 | unsigned int length; | ||
67 | unsigned char msg[256]; | ||
68 | } ca_msg_t; | ||
69 | |||
70 | typedef struct ca_descr { | ||
71 | unsigned int index; | ||
72 | unsigned int parity; /* 0 == even, 1 == odd */ | ||
73 | unsigned char cw[8]; | ||
74 | } ca_descr_t; | ||
75 | |||
76 | typedef struct ca_pid { | ||
77 | unsigned int pid; | ||
78 | int index; /* -1 == disable*/ | ||
79 | } ca_pid_t; | ||
80 | |||
81 | #define CA_RESET _IO('o', 128) | ||
82 | #define CA_GET_CAP _IOR('o', 129, ca_caps_t) | ||
83 | #define CA_GET_SLOT_INFO _IOR('o', 130, ca_slot_info_t) | ||
84 | #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t) | ||
85 | #define CA_GET_MSG _IOR('o', 132, ca_msg_t) | ||
86 | #define CA_SEND_MSG _IOW('o', 133, ca_msg_t) | ||
87 | #define CA_SET_DESCR _IOW('o', 134, ca_descr_t) | ||
88 | #define CA_SET_PID _IOW('o', 135, ca_pid_t) | ||
89 | |||
90 | #endif | ||
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h new file mode 100644 index 00000000000..f078f3ac82d --- /dev/null +++ b/include/linux/dvb/dmx.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * dmx.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> | ||
5 | * & Ralph Metzler <ralph@convergence.de> | ||
6 | * for convergence integrated media GmbH | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public License | ||
10 | * as published by the Free Software Foundation; either version 2.1 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _DVBDMX_H_ | ||
25 | #define _DVBDMX_H_ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #ifdef __KERNEL__ | ||
29 | #include <linux/time.h> | ||
30 | #else | ||
31 | #include <time.h> | ||
32 | #endif | ||
33 | |||
34 | |||
35 | #define DMX_FILTER_SIZE 16 | ||
36 | |||
37 | typedef enum | ||
38 | { | ||
39 | DMX_OUT_DECODER, /* Streaming directly to decoder. */ | ||
40 | DMX_OUT_TAP, /* Output going to a memory buffer */ | ||
41 | /* (to be retrieved via the read command).*/ | ||
42 | DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */ | ||
43 | /* (to be retrieved by reading from the */ | ||
44 | /* logical DVR device). */ | ||
45 | DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */ | ||
46 | } dmx_output_t; | ||
47 | |||
48 | |||
49 | typedef enum | ||
50 | { | ||
51 | DMX_IN_FRONTEND, /* Input from a front-end device. */ | ||
52 | DMX_IN_DVR /* Input from the logical DVR device. */ | ||
53 | } dmx_input_t; | ||
54 | |||
55 | |||
56 | typedef enum | ||
57 | { | ||
58 | DMX_PES_AUDIO0, | ||
59 | DMX_PES_VIDEO0, | ||
60 | DMX_PES_TELETEXT0, | ||
61 | DMX_PES_SUBTITLE0, | ||
62 | DMX_PES_PCR0, | ||
63 | |||
64 | DMX_PES_AUDIO1, | ||
65 | DMX_PES_VIDEO1, | ||
66 | DMX_PES_TELETEXT1, | ||
67 | DMX_PES_SUBTITLE1, | ||
68 | DMX_PES_PCR1, | ||
69 | |||
70 | DMX_PES_AUDIO2, | ||
71 | DMX_PES_VIDEO2, | ||
72 | DMX_PES_TELETEXT2, | ||
73 | DMX_PES_SUBTITLE2, | ||
74 | DMX_PES_PCR2, | ||
75 | |||
76 | DMX_PES_AUDIO3, | ||
77 | DMX_PES_VIDEO3, | ||
78 | DMX_PES_TELETEXT3, | ||
79 | DMX_PES_SUBTITLE3, | ||
80 | DMX_PES_PCR3, | ||
81 | |||
82 | DMX_PES_OTHER | ||
83 | } dmx_pes_type_t; | ||
84 | |||
85 | #define DMX_PES_AUDIO DMX_PES_AUDIO0 | ||
86 | #define DMX_PES_VIDEO DMX_PES_VIDEO0 | ||
87 | #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 | ||
88 | #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 | ||
89 | #define DMX_PES_PCR DMX_PES_PCR0 | ||
90 | |||
91 | |||
92 | typedef struct dmx_filter | ||
93 | { | ||
94 | __u8 filter[DMX_FILTER_SIZE]; | ||
95 | __u8 mask[DMX_FILTER_SIZE]; | ||
96 | __u8 mode[DMX_FILTER_SIZE]; | ||
97 | } dmx_filter_t; | ||
98 | |||
99 | |||
100 | struct dmx_sct_filter_params | ||
101 | { | ||
102 | __u16 pid; | ||
103 | dmx_filter_t filter; | ||
104 | __u32 timeout; | ||
105 | __u32 flags; | ||
106 | #define DMX_CHECK_CRC 1 | ||
107 | #define DMX_ONESHOT 2 | ||
108 | #define DMX_IMMEDIATE_START 4 | ||
109 | #define DMX_KERNEL_CLIENT 0x8000 | ||
110 | }; | ||
111 | |||
112 | |||
113 | struct dmx_pes_filter_params | ||
114 | { | ||
115 | __u16 pid; | ||
116 | dmx_input_t input; | ||
117 | dmx_output_t output; | ||
118 | dmx_pes_type_t pes_type; | ||
119 | __u32 flags; | ||
120 | }; | ||
121 | |||
122 | typedef struct dmx_caps { | ||
123 | __u32 caps; | ||
124 | int num_decoders; | ||
125 | } dmx_caps_t; | ||
126 | |||
127 | typedef enum { | ||
128 | DMX_SOURCE_FRONT0 = 0, | ||
129 | DMX_SOURCE_FRONT1, | ||
130 | DMX_SOURCE_FRONT2, | ||
131 | DMX_SOURCE_FRONT3, | ||
132 | DMX_SOURCE_DVR0 = 16, | ||
133 | DMX_SOURCE_DVR1, | ||
134 | DMX_SOURCE_DVR2, | ||
135 | DMX_SOURCE_DVR3 | ||
136 | } dmx_source_t; | ||
137 | |||
138 | struct dmx_stc { | ||
139 | unsigned int num; /* input : which STC? 0..N */ | ||
140 | unsigned int base; /* output: divisor for stc to get 90 kHz clock */ | ||
141 | __u64 stc; /* output: stc in 'base'*90 kHz units */ | ||
142 | }; | ||
143 | |||
144 | |||
145 | #define DMX_START _IO('o', 41) | ||
146 | #define DMX_STOP _IO('o', 42) | ||
147 | #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) | ||
148 | #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) | ||
149 | #define DMX_SET_BUFFER_SIZE _IO('o', 45) | ||
150 | #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) | ||
151 | #define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) | ||
152 | #define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) | ||
153 | #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) | ||
154 | #define DMX_ADD_PID _IOW('o', 51, __u16) | ||
155 | #define DMX_REMOVE_PID _IOW('o', 52, __u16) | ||
156 | |||
157 | #endif /*_DVBDMX_H_*/ | ||
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h new file mode 100644 index 00000000000..36a3ed63f57 --- /dev/null +++ b/include/linux/dvb/frontend.h | |||
@@ -0,0 +1,426 @@ | |||
1 | /* | ||
2 | * frontend.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> | ||
5 | * Ralph Metzler <ralph@convergence.de> | ||
6 | * Holger Waechtler <holger@convergence.de> | ||
7 | * Andre Draszik <ad@convergence.de> | ||
8 | * for convergence integrated media GmbH | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU Lesser General Public License | ||
12 | * as published by the Free Software Foundation; either version 2.1 | ||
13 | * of the License, or (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU Lesser General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef _DVBFRONTEND_H_ | ||
27 | #define _DVBFRONTEND_H_ | ||
28 | |||
29 | #include <linux/types.h> | ||
30 | |||
31 | typedef enum fe_type { | ||
32 | FE_QPSK, | ||
33 | FE_QAM, | ||
34 | FE_OFDM, | ||
35 | FE_ATSC | ||
36 | } fe_type_t; | ||
37 | |||
38 | |||
39 | typedef enum fe_caps { | ||
40 | FE_IS_STUPID = 0, | ||
41 | FE_CAN_INVERSION_AUTO = 0x1, | ||
42 | FE_CAN_FEC_1_2 = 0x2, | ||
43 | FE_CAN_FEC_2_3 = 0x4, | ||
44 | FE_CAN_FEC_3_4 = 0x8, | ||
45 | FE_CAN_FEC_4_5 = 0x10, | ||
46 | FE_CAN_FEC_5_6 = 0x20, | ||
47 | FE_CAN_FEC_6_7 = 0x40, | ||
48 | FE_CAN_FEC_7_8 = 0x80, | ||
49 | FE_CAN_FEC_8_9 = 0x100, | ||
50 | FE_CAN_FEC_AUTO = 0x200, | ||
51 | FE_CAN_QPSK = 0x400, | ||
52 | FE_CAN_QAM_16 = 0x800, | ||
53 | FE_CAN_QAM_32 = 0x1000, | ||
54 | FE_CAN_QAM_64 = 0x2000, | ||
55 | FE_CAN_QAM_128 = 0x4000, | ||
56 | FE_CAN_QAM_256 = 0x8000, | ||
57 | FE_CAN_QAM_AUTO = 0x10000, | ||
58 | FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, | ||
59 | FE_CAN_BANDWIDTH_AUTO = 0x40000, | ||
60 | FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, | ||
61 | FE_CAN_HIERARCHY_AUTO = 0x100000, | ||
62 | FE_CAN_8VSB = 0x200000, | ||
63 | FE_CAN_16VSB = 0x400000, | ||
64 | FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ | ||
65 | FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ | ||
66 | FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ | ||
67 | FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ | ||
68 | FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ | ||
69 | FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ | ||
70 | } fe_caps_t; | ||
71 | |||
72 | |||
73 | struct dvb_frontend_info { | ||
74 | char name[128]; | ||
75 | fe_type_t type; | ||
76 | __u32 frequency_min; | ||
77 | __u32 frequency_max; | ||
78 | __u32 frequency_stepsize; | ||
79 | __u32 frequency_tolerance; | ||
80 | __u32 symbol_rate_min; | ||
81 | __u32 symbol_rate_max; | ||
82 | __u32 symbol_rate_tolerance; /* ppm */ | ||
83 | __u32 notifier_delay; /* DEPRECATED */ | ||
84 | fe_caps_t caps; | ||
85 | }; | ||
86 | |||
87 | |||
88 | /** | ||
89 | * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for | ||
90 | * the meaning of this struct... | ||
91 | */ | ||
92 | struct dvb_diseqc_master_cmd { | ||
93 | __u8 msg [6]; /* { framing, address, command, data [3] } */ | ||
94 | __u8 msg_len; /* valid values are 3...6 */ | ||
95 | }; | ||
96 | |||
97 | |||
98 | struct dvb_diseqc_slave_reply { | ||
99 | __u8 msg [4]; /* { framing, data [3] } */ | ||
100 | __u8 msg_len; /* valid values are 0...4, 0 means no msg */ | ||
101 | int timeout; /* return from ioctl after timeout ms with */ | ||
102 | }; /* errorcode when no message was received */ | ||
103 | |||
104 | |||
105 | typedef enum fe_sec_voltage { | ||
106 | SEC_VOLTAGE_13, | ||
107 | SEC_VOLTAGE_18, | ||
108 | SEC_VOLTAGE_OFF | ||
109 | } fe_sec_voltage_t; | ||
110 | |||
111 | |||
112 | typedef enum fe_sec_tone_mode { | ||
113 | SEC_TONE_ON, | ||
114 | SEC_TONE_OFF | ||
115 | } fe_sec_tone_mode_t; | ||
116 | |||
117 | |||
118 | typedef enum fe_sec_mini_cmd { | ||
119 | SEC_MINI_A, | ||
120 | SEC_MINI_B | ||
121 | } fe_sec_mini_cmd_t; | ||
122 | |||
123 | |||
124 | typedef enum fe_status { | ||
125 | FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ | ||
126 | FE_HAS_CARRIER = 0x02, /* found a DVB signal */ | ||
127 | FE_HAS_VITERBI = 0x04, /* FEC is stable */ | ||
128 | FE_HAS_SYNC = 0x08, /* found sync bytes */ | ||
129 | FE_HAS_LOCK = 0x10, /* everything's working... */ | ||
130 | FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ | ||
131 | FE_REINIT = 0x40 /* frontend was reinitialized, */ | ||
132 | } fe_status_t; /* application is recommended to reset */ | ||
133 | /* DiSEqC, tone and parameters */ | ||
134 | |||
135 | typedef enum fe_spectral_inversion { | ||
136 | INVERSION_OFF, | ||
137 | INVERSION_ON, | ||
138 | INVERSION_AUTO | ||
139 | } fe_spectral_inversion_t; | ||
140 | |||
141 | |||
142 | typedef enum fe_code_rate { | ||
143 | FEC_NONE = 0, | ||
144 | FEC_1_2, | ||
145 | FEC_2_3, | ||
146 | FEC_3_4, | ||
147 | FEC_4_5, | ||
148 | FEC_5_6, | ||
149 | FEC_6_7, | ||
150 | FEC_7_8, | ||
151 | FEC_8_9, | ||
152 | FEC_AUTO, | ||
153 | FEC_3_5, | ||
154 | FEC_9_10, | ||
155 | } fe_code_rate_t; | ||
156 | |||
157 | |||
158 | typedef enum fe_modulation { | ||
159 | QPSK, | ||
160 | QAM_16, | ||
161 | QAM_32, | ||
162 | QAM_64, | ||
163 | QAM_128, | ||
164 | QAM_256, | ||
165 | QAM_AUTO, | ||
166 | VSB_8, | ||
167 | VSB_16, | ||
168 | PSK_8, | ||
169 | APSK_16, | ||
170 | APSK_32, | ||
171 | DQPSK, | ||
172 | } fe_modulation_t; | ||
173 | |||
174 | typedef enum fe_transmit_mode { | ||
175 | TRANSMISSION_MODE_2K, | ||
176 | TRANSMISSION_MODE_8K, | ||
177 | TRANSMISSION_MODE_AUTO, | ||
178 | TRANSMISSION_MODE_4K, | ||
179 | TRANSMISSION_MODE_1K, | ||
180 | TRANSMISSION_MODE_16K, | ||
181 | TRANSMISSION_MODE_32K, | ||
182 | } fe_transmit_mode_t; | ||
183 | |||
184 | typedef enum fe_bandwidth { | ||
185 | BANDWIDTH_8_MHZ, | ||
186 | BANDWIDTH_7_MHZ, | ||
187 | BANDWIDTH_6_MHZ, | ||
188 | BANDWIDTH_AUTO, | ||
189 | BANDWIDTH_5_MHZ, | ||
190 | BANDWIDTH_10_MHZ, | ||
191 | BANDWIDTH_1_712_MHZ, | ||
192 | } fe_bandwidth_t; | ||
193 | |||
194 | |||
195 | typedef enum fe_guard_interval { | ||
196 | GUARD_INTERVAL_1_32, | ||
197 | GUARD_INTERVAL_1_16, | ||
198 | GUARD_INTERVAL_1_8, | ||
199 | GUARD_INTERVAL_1_4, | ||
200 | GUARD_INTERVAL_AUTO, | ||
201 | GUARD_INTERVAL_1_128, | ||
202 | GUARD_INTERVAL_19_128, | ||
203 | GUARD_INTERVAL_19_256, | ||
204 | } fe_guard_interval_t; | ||
205 | |||
206 | |||
207 | typedef enum fe_hierarchy { | ||
208 | HIERARCHY_NONE, | ||
209 | HIERARCHY_1, | ||
210 | HIERARCHY_2, | ||
211 | HIERARCHY_4, | ||
212 | HIERARCHY_AUTO | ||
213 | } fe_hierarchy_t; | ||
214 | |||
215 | |||
216 | struct dvb_qpsk_parameters { | ||
217 | __u32 symbol_rate; /* symbol rate in Symbols per second */ | ||
218 | fe_code_rate_t fec_inner; /* forward error correction (see above) */ | ||
219 | }; | ||
220 | |||
221 | struct dvb_qam_parameters { | ||
222 | __u32 symbol_rate; /* symbol rate in Symbols per second */ | ||
223 | fe_code_rate_t fec_inner; /* forward error correction (see above) */ | ||
224 | fe_modulation_t modulation; /* modulation type (see above) */ | ||
225 | }; | ||
226 | |||
227 | struct dvb_vsb_parameters { | ||
228 | fe_modulation_t modulation; /* modulation type (see above) */ | ||
229 | }; | ||
230 | |||
231 | struct dvb_ofdm_parameters { | ||
232 | fe_bandwidth_t bandwidth; | ||
233 | fe_code_rate_t code_rate_HP; /* high priority stream code rate */ | ||
234 | fe_code_rate_t code_rate_LP; /* low priority stream code rate */ | ||
235 | fe_modulation_t constellation; /* modulation type (see above) */ | ||
236 | fe_transmit_mode_t transmission_mode; | ||
237 | fe_guard_interval_t guard_interval; | ||
238 | fe_hierarchy_t hierarchy_information; | ||
239 | }; | ||
240 | |||
241 | |||
242 | struct dvb_frontend_parameters { | ||
243 | __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */ | ||
244 | /* intermediate frequency in kHz for QPSK */ | ||
245 | fe_spectral_inversion_t inversion; | ||
246 | union { | ||
247 | struct dvb_qpsk_parameters qpsk; | ||
248 | struct dvb_qam_parameters qam; | ||
249 | struct dvb_ofdm_parameters ofdm; | ||
250 | struct dvb_vsb_parameters vsb; | ||
251 | } u; | ||
252 | }; | ||
253 | |||
254 | |||
255 | struct dvb_frontend_event { | ||
256 | fe_status_t status; | ||
257 | struct dvb_frontend_parameters parameters; | ||
258 | }; | ||
259 | |||
260 | /* S2API Commands */ | ||
261 | #define DTV_UNDEFINED 0 | ||
262 | #define DTV_TUNE 1 | ||
263 | #define DTV_CLEAR 2 | ||
264 | #define DTV_FREQUENCY 3 | ||
265 | #define DTV_MODULATION 4 | ||
266 | #define DTV_BANDWIDTH_HZ 5 | ||
267 | #define DTV_INVERSION 6 | ||
268 | #define DTV_DISEQC_MASTER 7 | ||
269 | #define DTV_SYMBOL_RATE 8 | ||
270 | #define DTV_INNER_FEC 9 | ||
271 | #define DTV_VOLTAGE 10 | ||
272 | #define DTV_TONE 11 | ||
273 | #define DTV_PILOT 12 | ||
274 | #define DTV_ROLLOFF 13 | ||
275 | #define DTV_DISEQC_SLAVE_REPLY 14 | ||
276 | |||
277 | /* Basic enumeration set for querying unlimited capabilities */ | ||
278 | #define DTV_FE_CAPABILITY_COUNT 15 | ||
279 | #define DTV_FE_CAPABILITY 16 | ||
280 | #define DTV_DELIVERY_SYSTEM 17 | ||
281 | |||
282 | /* ISDB-T and ISDB-Tsb */ | ||
283 | #define DTV_ISDBT_PARTIAL_RECEPTION 18 | ||
284 | #define DTV_ISDBT_SOUND_BROADCASTING 19 | ||
285 | |||
286 | #define DTV_ISDBT_SB_SUBCHANNEL_ID 20 | ||
287 | #define DTV_ISDBT_SB_SEGMENT_IDX 21 | ||
288 | #define DTV_ISDBT_SB_SEGMENT_COUNT 22 | ||
289 | |||
290 | #define DTV_ISDBT_LAYERA_FEC 23 | ||
291 | #define DTV_ISDBT_LAYERA_MODULATION 24 | ||
292 | #define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 | ||
293 | #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 | ||
294 | |||
295 | #define DTV_ISDBT_LAYERB_FEC 27 | ||
296 | #define DTV_ISDBT_LAYERB_MODULATION 28 | ||
297 | #define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 | ||
298 | #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 | ||
299 | |||
300 | #define DTV_ISDBT_LAYERC_FEC 31 | ||
301 | #define DTV_ISDBT_LAYERC_MODULATION 32 | ||
302 | #define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 | ||
303 | #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 | ||
304 | |||
305 | #define DTV_API_VERSION 35 | ||
306 | |||
307 | #define DTV_CODE_RATE_HP 36 | ||
308 | #define DTV_CODE_RATE_LP 37 | ||
309 | #define DTV_GUARD_INTERVAL 38 | ||
310 | #define DTV_TRANSMISSION_MODE 39 | ||
311 | #define DTV_HIERARCHY 40 | ||
312 | |||
313 | #define DTV_ISDBT_LAYER_ENABLED 41 | ||
314 | |||
315 | #define DTV_ISDBS_TS_ID 42 | ||
316 | |||
317 | #define DTV_DVBT2_PLP_ID 43 | ||
318 | |||
319 | #define DTV_MAX_COMMAND DTV_DVBT2_PLP_ID | ||
320 | |||
321 | typedef enum fe_pilot { | ||
322 | PILOT_ON, | ||
323 | PILOT_OFF, | ||
324 | PILOT_AUTO, | ||
325 | } fe_pilot_t; | ||
326 | |||
327 | typedef enum fe_rolloff { | ||
328 | ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ | ||
329 | ROLLOFF_20, | ||
330 | ROLLOFF_25, | ||
331 | ROLLOFF_AUTO, | ||
332 | } fe_rolloff_t; | ||
333 | |||
334 | typedef enum fe_delivery_system { | ||
335 | SYS_UNDEFINED, | ||
336 | SYS_DVBC_ANNEX_AC, | ||
337 | SYS_DVBC_ANNEX_B, | ||
338 | SYS_DVBT, | ||
339 | SYS_DSS, | ||
340 | SYS_DVBS, | ||
341 | SYS_DVBS2, | ||
342 | SYS_DVBH, | ||
343 | SYS_ISDBT, | ||
344 | SYS_ISDBS, | ||
345 | SYS_ISDBC, | ||
346 | SYS_ATSC, | ||
347 | SYS_ATSCMH, | ||
348 | SYS_DMBTH, | ||
349 | SYS_CMMB, | ||
350 | SYS_DAB, | ||
351 | SYS_DVBT2, | ||
352 | } fe_delivery_system_t; | ||
353 | |||
354 | struct dtv_cmds_h { | ||
355 | char *name; /* A display name for debugging purposes */ | ||
356 | |||
357 | __u32 cmd; /* A unique ID */ | ||
358 | |||
359 | /* Flags */ | ||
360 | __u32 set:1; /* Either a set or get property */ | ||
361 | __u32 buffer:1; /* Does this property use the buffer? */ | ||
362 | __u32 reserved:30; /* Align */ | ||
363 | }; | ||
364 | |||
365 | struct dtv_property { | ||
366 | __u32 cmd; | ||
367 | __u32 reserved[3]; | ||
368 | union { | ||
369 | __u32 data; | ||
370 | struct { | ||
371 | __u8 data[32]; | ||
372 | __u32 len; | ||
373 | __u32 reserved1[3]; | ||
374 | void *reserved2; | ||
375 | } buffer; | ||
376 | } u; | ||
377 | int result; | ||
378 | } __attribute__ ((packed)); | ||
379 | |||
380 | /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ | ||
381 | #define DTV_IOCTL_MAX_MSGS 64 | ||
382 | |||
383 | struct dtv_properties { | ||
384 | __u32 num; | ||
385 | struct dtv_property *props; | ||
386 | }; | ||
387 | |||
388 | #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) | ||
389 | #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) | ||
390 | |||
391 | |||
392 | /** | ||
393 | * When set, this flag will disable any zigzagging or other "normal" tuning | ||
394 | * behaviour. Additionally, there will be no automatic monitoring of the lock | ||
395 | * status, and hence no frontend events will be generated. If a frontend device | ||
396 | * is closed, this flag will be automatically turned off when the device is | ||
397 | * reopened read-write. | ||
398 | */ | ||
399 | #define FE_TUNE_MODE_ONESHOT 0x01 | ||
400 | |||
401 | |||
402 | #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) | ||
403 | |||
404 | #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) | ||
405 | #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) | ||
406 | #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) | ||
407 | #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ | ||
408 | |||
409 | #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ | ||
410 | #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ | ||
411 | #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ | ||
412 | |||
413 | #define FE_READ_STATUS _IOR('o', 69, fe_status_t) | ||
414 | #define FE_READ_BER _IOR('o', 70, __u32) | ||
415 | #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) | ||
416 | #define FE_READ_SNR _IOR('o', 72, __u16) | ||
417 | #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) | ||
418 | |||
419 | #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) | ||
420 | #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) | ||
421 | #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ | ||
422 | #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) | ||
423 | |||
424 | #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ | ||
425 | |||
426 | #endif /*_DVBFRONTEND_H_*/ | ||
diff --git a/include/linux/dvb/net.h b/include/linux/dvb/net.h new file mode 100644 index 00000000000..f451e7eb0b0 --- /dev/null +++ b/include/linux/dvb/net.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * net.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> | ||
5 | * & Ralph Metzler <ralph@convergence.de> | ||
6 | * for convergence integrated media GmbH | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public License | ||
10 | * as published by the Free Software Foundation; either version 2.1 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _DVBNET_H_ | ||
25 | #define _DVBNET_H_ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | |||
29 | struct dvb_net_if { | ||
30 | __u16 pid; | ||
31 | __u16 if_num; | ||
32 | __u8 feedtype; | ||
33 | #define DVB_NET_FEEDTYPE_MPE 0 /* multi protocol encapsulation */ | ||
34 | #define DVB_NET_FEEDTYPE_ULE 1 /* ultra lightweight encapsulation */ | ||
35 | }; | ||
36 | |||
37 | |||
38 | #define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if) | ||
39 | #define NET_REMOVE_IF _IO('o', 53) | ||
40 | #define NET_GET_IF _IOWR('o', 54, struct dvb_net_if) | ||
41 | |||
42 | |||
43 | /* binary compatibility cruft: */ | ||
44 | struct __dvb_net_if_old { | ||
45 | __u16 pid; | ||
46 | __u16 if_num; | ||
47 | }; | ||
48 | #define __NET_ADD_IF_OLD _IOWR('o', 52, struct __dvb_net_if_old) | ||
49 | #define __NET_GET_IF_OLD _IOWR('o', 54, struct __dvb_net_if_old) | ||
50 | |||
51 | |||
52 | #endif /*_DVBNET_H_*/ | ||
diff --git a/include/linux/dvb/osd.h b/include/linux/dvb/osd.h new file mode 100644 index 00000000000..880e6843583 --- /dev/null +++ b/include/linux/dvb/osd.h | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * osd.h | ||
3 | * | ||
4 | * Copyright (C) 2001 Ralph Metzler <ralph@convergence.de> | ||
5 | * & Marcus Metzler <marcus@convergence.de> | ||
6 | * for convergence integrated media GmbH | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Lesser Public License | ||
10 | * as published by the Free Software Foundation; either version 2.1 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _DVBOSD_H_ | ||
25 | #define _DVBOSD_H_ | ||
26 | |||
27 | #include <linux/compiler.h> | ||
28 | |||
29 | typedef enum { | ||
30 | // All functions return -2 on "not open" | ||
31 | OSD_Close=1, // () | ||
32 | // Disables OSD and releases the buffers | ||
33 | // returns 0 on success | ||
34 | OSD_Open, // (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) | ||
35 | // Opens OSD with this size and bit depth | ||
36 | // returns 0 on success, -1 on DRAM allocation error, -2 on "already open" | ||
37 | OSD_Show, // () | ||
38 | // enables OSD mode | ||
39 | // returns 0 on success | ||
40 | OSD_Hide, // () | ||
41 | // disables OSD mode | ||
42 | // returns 0 on success | ||
43 | OSD_Clear, // () | ||
44 | // Sets all pixel to color 0 | ||
45 | // returns 0 on success | ||
46 | OSD_Fill, // (color) | ||
47 | // Sets all pixel to color <col> | ||
48 | // returns 0 on success | ||
49 | OSD_SetColor, // (color,R{x0},G{y0},B{x1},opacity{y1}) | ||
50 | // set palette entry <num> to <r,g,b>, <mix> and <trans> apply | ||
51 | // R,G,B: 0..255 | ||
52 | // R=Red, G=Green, B=Blue | ||
53 | // opacity=0: pixel opacity 0% (only video pixel shows) | ||
54 | // opacity=1..254: pixel opacity as specified in header | ||
55 | // opacity=255: pixel opacity 100% (only OSD pixel shows) | ||
56 | // returns 0 on success, -1 on error | ||
57 | OSD_SetPalette, // (firstcolor{color},lastcolor{x0},data) | ||
58 | // Set a number of entries in the palette | ||
59 | // sets the entries "firstcolor" through "lastcolor" from the array "data" | ||
60 | // data has 4 byte for each color: | ||
61 | // R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel | ||
62 | OSD_SetTrans, // (transparency{color}) | ||
63 | // Sets transparency of mixed pixel (0..15) | ||
64 | // returns 0 on success | ||
65 | OSD_SetPixel, // (x0,y0,color) | ||
66 | // sets pixel <x>,<y> to color number <col> | ||
67 | // returns 0 on success, -1 on error | ||
68 | OSD_GetPixel, // (x0,y0) | ||
69 | // returns color number of pixel <x>,<y>, or -1 | ||
70 | OSD_SetRow, // (x0,y0,x1,data) | ||
71 | // fills pixels x0,y through x1,y with the content of data[] | ||
72 | // returns 0 on success, -1 on clipping all pixel (no pixel drawn) | ||
73 | OSD_SetBlock, // (x0,y0,x1,y1,increment{color},data) | ||
74 | // fills pixels x0,y0 through x1,y1 with the content of data[] | ||
75 | // inc contains the width of one line in the data block, | ||
76 | // inc<=0 uses blockwidth as linewidth | ||
77 | // returns 0 on success, -1 on clipping all pixel | ||
78 | OSD_FillRow, // (x0,y0,x1,color) | ||
79 | // fills pixels x0,y through x1,y with the color <col> | ||
80 | // returns 0 on success, -1 on clipping all pixel | ||
81 | OSD_FillBlock, // (x0,y0,x1,y1,color) | ||
82 | // fills pixels x0,y0 through x1,y1 with the color <col> | ||
83 | // returns 0 on success, -1 on clipping all pixel | ||
84 | OSD_Line, // (x0,y0,x1,y1,color) | ||
85 | // draw a line from x0,y0 to x1,y1 with the color <col> | ||
86 | // returns 0 on success | ||
87 | OSD_Query, // (x0,y0,x1,y1,xasp{color}}), yasp=11 | ||
88 | // fills parameters with the picture dimensions and the pixel aspect ratio | ||
89 | // returns 0 on success | ||
90 | OSD_Test, // () | ||
91 | // draws a test picture. for debugging purposes only | ||
92 | // returns 0 on success | ||
93 | // TODO: remove "test" in final version | ||
94 | OSD_Text, // (x0,y0,size,color,text) | ||
95 | OSD_SetWindow, // (x0) set window with number 0<x0<8 as current | ||
96 | OSD_MoveWindow, // move current window to (x0, y0) | ||
97 | OSD_OpenRaw, // Open other types of OSD windows | ||
98 | } OSD_Command; | ||
99 | |||
100 | typedef struct osd_cmd_s { | ||
101 | OSD_Command cmd; | ||
102 | int x0; | ||
103 | int y0; | ||
104 | int x1; | ||
105 | int y1; | ||
106 | int color; | ||
107 | void __user *data; | ||
108 | } osd_cmd_t; | ||
109 | |||
110 | /* OSD_OpenRaw: set 'color' to desired window type */ | ||
111 | typedef enum { | ||
112 | OSD_BITMAP1, /* 1 bit bitmap */ | ||
113 | OSD_BITMAP2, /* 2 bit bitmap */ | ||
114 | OSD_BITMAP4, /* 4 bit bitmap */ | ||
115 | OSD_BITMAP8, /* 8 bit bitmap */ | ||
116 | OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */ | ||
117 | OSD_BITMAP2HR, /* 2 bit bitmap half resolution */ | ||
118 | OSD_BITMAP4HR, /* 4 bit bitmap half resolution */ | ||
119 | OSD_BITMAP8HR, /* 8 bit bitmap half resolution */ | ||
120 | OSD_YCRCB422, /* 4:2:2 YCRCB Graphic Display */ | ||
121 | OSD_YCRCB444, /* 4:4:4 YCRCB Graphic Display */ | ||
122 | OSD_YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */ | ||
123 | OSD_VIDEOTSIZE, /* True Size Normal MPEG Video Display */ | ||
124 | OSD_VIDEOHSIZE, /* MPEG Video Display Half Resolution */ | ||
125 | OSD_VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */ | ||
126 | OSD_VIDEODSIZE, /* MPEG Video Display Double Resolution */ | ||
127 | OSD_VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */ | ||
128 | OSD_VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/ | ||
129 | OSD_VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */ | ||
130 | OSD_VIDEONSIZE, /* Full Size MPEG Video Display */ | ||
131 | OSD_CURSOR /* Cursor */ | ||
132 | } osd_raw_window_t; | ||
133 | |||
134 | typedef struct osd_cap_s { | ||
135 | int cmd; | ||
136 | #define OSD_CAP_MEMSIZE 1 /* memory size */ | ||
137 | long val; | ||
138 | } osd_cap_t; | ||
139 | |||
140 | |||
141 | #define OSD_SEND_CMD _IOW('o', 160, osd_cmd_t) | ||
142 | #define OSD_GET_CAPABILITY _IOR('o', 161, osd_cap_t) | ||
143 | |||
144 | #endif | ||
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h new file mode 100644 index 00000000000..1421cc84afa --- /dev/null +++ b/include/linux/dvb/version.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * version.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Holger Waechtler <holger@convergence.de> | ||
5 | * for convergence integrated media GmbH | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public License | ||
9 | * as published by the Free Software Foundation; either version 2.1 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef _DVBVERSION_H_ | ||
24 | #define _DVBVERSION_H_ | ||
25 | |||
26 | #define DVB_API_VERSION 5 | ||
27 | #define DVB_API_VERSION_MINOR 3 | ||
28 | |||
29 | #endif /*_DVBVERSION_H_*/ | ||
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h new file mode 100644 index 00000000000..1d750c0fd86 --- /dev/null +++ b/include/linux/dvb/video.h | |||
@@ -0,0 +1,276 @@ | |||
1 | /* | ||
2 | * video.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> | ||
5 | * & Ralph Metzler <ralph@convergence.de> | ||
6 | * for convergence integrated media GmbH | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public License | ||
10 | * as published by the Free Software Foundation; either version 2.1 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _DVBVIDEO_H_ | ||
25 | #define _DVBVIDEO_H_ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #ifdef __KERNEL__ | ||
29 | #include <linux/compiler.h> | ||
30 | #else | ||
31 | #include <stdint.h> | ||
32 | #include <time.h> | ||
33 | #endif | ||
34 | |||
35 | typedef enum { | ||
36 | VIDEO_FORMAT_4_3, /* Select 4:3 format */ | ||
37 | VIDEO_FORMAT_16_9, /* Select 16:9 format. */ | ||
38 | VIDEO_FORMAT_221_1 /* 2.21:1 */ | ||
39 | } video_format_t; | ||
40 | |||
41 | |||
42 | typedef enum { | ||
43 | VIDEO_SYSTEM_PAL, | ||
44 | VIDEO_SYSTEM_NTSC, | ||
45 | VIDEO_SYSTEM_PALN, | ||
46 | VIDEO_SYSTEM_PALNc, | ||
47 | VIDEO_SYSTEM_PALM, | ||
48 | VIDEO_SYSTEM_NTSC60, | ||
49 | VIDEO_SYSTEM_PAL60, | ||
50 | VIDEO_SYSTEM_PALM60 | ||
51 | } video_system_t; | ||
52 | |||
53 | |||
54 | typedef enum { | ||
55 | VIDEO_PAN_SCAN, /* use pan and scan format */ | ||
56 | VIDEO_LETTER_BOX, /* use letterbox format */ | ||
57 | VIDEO_CENTER_CUT_OUT /* use center cut out format */ | ||
58 | } video_displayformat_t; | ||
59 | |||
60 | typedef struct { | ||
61 | int w; | ||
62 | int h; | ||
63 | video_format_t aspect_ratio; | ||
64 | } video_size_t; | ||
65 | |||
66 | typedef enum { | ||
67 | VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ | ||
68 | VIDEO_SOURCE_MEMORY /* If this source is selected, the stream | ||
69 | comes from the user through the write | ||
70 | system call */ | ||
71 | } video_stream_source_t; | ||
72 | |||
73 | |||
74 | typedef enum { | ||
75 | VIDEO_STOPPED, /* Video is stopped */ | ||
76 | VIDEO_PLAYING, /* Video is currently playing */ | ||
77 | VIDEO_FREEZED /* Video is freezed */ | ||
78 | } video_play_state_t; | ||
79 | |||
80 | |||
81 | /* Decoder commands */ | ||
82 | #define VIDEO_CMD_PLAY (0) | ||
83 | #define VIDEO_CMD_STOP (1) | ||
84 | #define VIDEO_CMD_FREEZE (2) | ||
85 | #define VIDEO_CMD_CONTINUE (3) | ||
86 | |||
87 | /* Flags for VIDEO_CMD_FREEZE */ | ||
88 | #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0) | ||
89 | |||
90 | /* Flags for VIDEO_CMD_STOP */ | ||
91 | #define VIDEO_CMD_STOP_TO_BLACK (1 << 0) | ||
92 | #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1) | ||
93 | |||
94 | /* Play input formats: */ | ||
95 | /* The decoder has no special format requirements */ | ||
96 | #define VIDEO_PLAY_FMT_NONE (0) | ||
97 | /* The decoder requires full GOPs */ | ||
98 | #define VIDEO_PLAY_FMT_GOP (1) | ||
99 | |||
100 | /* The structure must be zeroed before use by the application | ||
101 | This ensures it can be extended safely in the future. */ | ||
102 | struct video_command { | ||
103 | __u32 cmd; | ||
104 | __u32 flags; | ||
105 | union { | ||
106 | struct { | ||
107 | __u64 pts; | ||
108 | } stop; | ||
109 | |||
110 | struct { | ||
111 | /* 0 or 1000 specifies normal speed, | ||
112 | 1 specifies forward single stepping, | ||
113 | -1 specifies backward single stepping, | ||
114 | >1: playback at speed/1000 of the normal speed, | ||
115 | <-1: reverse playback at (-speed/1000) of the normal speed. */ | ||
116 | __s32 speed; | ||
117 | __u32 format; | ||
118 | } play; | ||
119 | |||
120 | struct { | ||
121 | __u32 data[16]; | ||
122 | } raw; | ||
123 | }; | ||
124 | }; | ||
125 | |||
126 | /* FIELD_UNKNOWN can be used if the hardware does not know whether | ||
127 | the Vsync is for an odd, even or progressive (i.e. non-interlaced) | ||
128 | field. */ | ||
129 | #define VIDEO_VSYNC_FIELD_UNKNOWN (0) | ||
130 | #define VIDEO_VSYNC_FIELD_ODD (1) | ||
131 | #define VIDEO_VSYNC_FIELD_EVEN (2) | ||
132 | #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) | ||
133 | |||
134 | struct video_event { | ||
135 | __s32 type; | ||
136 | #define VIDEO_EVENT_SIZE_CHANGED 1 | ||
137 | #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 | ||
138 | #define VIDEO_EVENT_DECODER_STOPPED 3 | ||
139 | #define VIDEO_EVENT_VSYNC 4 | ||
140 | __kernel_time_t timestamp; | ||
141 | union { | ||
142 | video_size_t size; | ||
143 | unsigned int frame_rate; /* in frames per 1000sec */ | ||
144 | unsigned char vsync_field; /* unknown/odd/even/progressive */ | ||
145 | } u; | ||
146 | }; | ||
147 | |||
148 | |||
149 | struct video_status { | ||
150 | int video_blank; /* blank video on freeze? */ | ||
151 | video_play_state_t play_state; /* current state of playback */ | ||
152 | video_stream_source_t stream_source; /* current source (demux/memory) */ | ||
153 | video_format_t video_format; /* current aspect ratio of stream*/ | ||
154 | video_displayformat_t display_format;/* selected cropping mode */ | ||
155 | }; | ||
156 | |||
157 | |||
158 | struct video_still_picture { | ||
159 | char __user *iFrame; /* pointer to a single iframe in memory */ | ||
160 | __s32 size; | ||
161 | }; | ||
162 | |||
163 | |||
164 | typedef | ||
165 | struct video_highlight { | ||
166 | int active; /* 1=show highlight, 0=hide highlight */ | ||
167 | __u8 contrast1; /* 7- 4 Pattern pixel contrast */ | ||
168 | /* 3- 0 Background pixel contrast */ | ||
169 | __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */ | ||
170 | /* 3- 0 Emphasis pixel-1 contrast */ | ||
171 | __u8 color1; /* 7- 4 Pattern pixel color */ | ||
172 | /* 3- 0 Background pixel color */ | ||
173 | __u8 color2; /* 7- 4 Emphasis pixel-2 color */ | ||
174 | /* 3- 0 Emphasis pixel-1 color */ | ||
175 | __u32 ypos; /* 23-22 auto action mode */ | ||
176 | /* 21-12 start y */ | ||
177 | /* 9- 0 end y */ | ||
178 | __u32 xpos; /* 23-22 button color number */ | ||
179 | /* 21-12 start x */ | ||
180 | /* 9- 0 end x */ | ||
181 | } video_highlight_t; | ||
182 | |||
183 | |||
184 | typedef struct video_spu { | ||
185 | int active; | ||
186 | int stream_id; | ||
187 | } video_spu_t; | ||
188 | |||
189 | |||
190 | typedef struct video_spu_palette { /* SPU Palette information */ | ||
191 | int length; | ||
192 | __u8 __user *palette; | ||
193 | } video_spu_palette_t; | ||
194 | |||
195 | |||
196 | typedef struct video_navi_pack { | ||
197 | int length; /* 0 ... 1024 */ | ||
198 | __u8 data[1024]; | ||
199 | } video_navi_pack_t; | ||
200 | |||
201 | |||
202 | typedef __u16 video_attributes_t; | ||
203 | /* bits: descr. */ | ||
204 | /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ | ||
205 | /* 13-12 TV system (0=525/60, 1=625/50) */ | ||
206 | /* 11-10 Aspect ratio (0=4:3, 3=16:9) */ | ||
207 | /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ | ||
208 | /* 7 line 21-1 data present in GOP (1=yes, 0=no) */ | ||
209 | /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ | ||
210 | /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ | ||
211 | /* 2 source letterboxed (1=yes, 0=no) */ | ||
212 | /* 0 film/camera mode (0=camera, 1=film (625/50 only)) */ | ||
213 | |||
214 | |||
215 | /* bit definitions for capabilities: */ | ||
216 | /* can the hardware decode MPEG1 and/or MPEG2? */ | ||
217 | #define VIDEO_CAP_MPEG1 1 | ||
218 | #define VIDEO_CAP_MPEG2 2 | ||
219 | /* can you send a system and/or program stream to video device? | ||
220 | (you still have to open the video and the audio device but only | ||
221 | send the stream to the video device) */ | ||
222 | #define VIDEO_CAP_SYS 4 | ||
223 | #define VIDEO_CAP_PROG 8 | ||
224 | /* can the driver also handle SPU, NAVI and CSS encoded data? | ||
225 | (CSS API is not present yet) */ | ||
226 | #define VIDEO_CAP_SPU 16 | ||
227 | #define VIDEO_CAP_NAVI 32 | ||
228 | #define VIDEO_CAP_CSS 64 | ||
229 | |||
230 | |||
231 | #define VIDEO_STOP _IO('o', 21) | ||
232 | #define VIDEO_PLAY _IO('o', 22) | ||
233 | #define VIDEO_FREEZE _IO('o', 23) | ||
234 | #define VIDEO_CONTINUE _IO('o', 24) | ||
235 | #define VIDEO_SELECT_SOURCE _IO('o', 25) | ||
236 | #define VIDEO_SET_BLANK _IO('o', 26) | ||
237 | #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status) | ||
238 | #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event) | ||
239 | #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29) | ||
240 | #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture) | ||
241 | #define VIDEO_FAST_FORWARD _IO('o', 31) | ||
242 | #define VIDEO_SLOWMOTION _IO('o', 32) | ||
243 | #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int) | ||
244 | #define VIDEO_CLEAR_BUFFER _IO('o', 34) | ||
245 | #define VIDEO_SET_ID _IO('o', 35) | ||
246 | #define VIDEO_SET_STREAMTYPE _IO('o', 36) | ||
247 | #define VIDEO_SET_FORMAT _IO('o', 37) | ||
248 | #define VIDEO_SET_SYSTEM _IO('o', 38) | ||
249 | #define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t) | ||
250 | #define VIDEO_SET_SPU _IOW('o', 50, video_spu_t) | ||
251 | #define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t) | ||
252 | #define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t) | ||
253 | #define VIDEO_SET_ATTRIBUTES _IO('o', 53) | ||
254 | #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) | ||
255 | #define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) | ||
256 | |||
257 | /** | ||
258 | * VIDEO_GET_PTS | ||
259 | * | ||
260 | * Read the 33 bit presentation time stamp as defined | ||
261 | * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. | ||
262 | * | ||
263 | * The PTS should belong to the currently played | ||
264 | * frame if possible, but may also be a value close to it | ||
265 | * like the PTS of the last decoded frame or the last PTS | ||
266 | * extracted by the PES parser. | ||
267 | */ | ||
268 | #define VIDEO_GET_PTS _IOR('o', 57, __u64) | ||
269 | |||
270 | /* Read the number of displayed frames since the decoder was started */ | ||
271 | #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64) | ||
272 | |||
273 | #define VIDEO_COMMAND _IOWR('o', 59, struct video_command) | ||
274 | #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command) | ||
275 | |||
276 | #endif /*_DVBVIDEO_H_*/ | ||
diff --git a/include/linux/earlysuspend.h b/include/linux/earlysuspend.h new file mode 100644 index 00000000000..8343b817af3 --- /dev/null +++ b/include/linux/earlysuspend.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* include/linux/earlysuspend.h | ||
2 | * | ||
3 | * Copyright (C) 2007-2008 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EARLYSUSPEND_H | ||
17 | #define _LINUX_EARLYSUSPEND_H | ||
18 | |||
19 | #ifdef CONFIG_HAS_EARLYSUSPEND | ||
20 | #include <linux/list.h> | ||
21 | #endif | ||
22 | |||
23 | /* The early_suspend structure defines suspend and resume hooks to be called | ||
24 | * when the user visible sleep state of the system changes, and a level to | ||
25 | * control the order. They can be used to turn off the screen and input | ||
26 | * devices that are not used for wakeup. | ||
27 | * Suspend handlers are called in low to high level order, resume handlers are | ||
28 | * called in the opposite order. If, when calling register_early_suspend, | ||
29 | * the suspend handlers have already been called without a matching call to the | ||
30 | * resume handlers, the suspend handler will be called directly from | ||
31 | * register_early_suspend. This direct call can violate the normal level order. | ||
32 | */ | ||
33 | enum { | ||
34 | EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50, | ||
35 | EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100, | ||
36 | EARLY_SUSPEND_LEVEL_DISABLE_FB = 150, | ||
37 | }; | ||
38 | struct early_suspend { | ||
39 | #ifdef CONFIG_HAS_EARLYSUSPEND | ||
40 | struct list_head link; | ||
41 | int level; | ||
42 | void (*suspend)(struct early_suspend *h); | ||
43 | void (*resume)(struct early_suspend *h); | ||
44 | #endif | ||
45 | }; | ||
46 | |||
47 | #ifdef CONFIG_HAS_EARLYSUSPEND | ||
48 | void register_early_suspend(struct early_suspend *handler); | ||
49 | void unregister_early_suspend(struct early_suspend *handler); | ||
50 | #else | ||
51 | #define register_early_suspend(handler) do { } while (0) | ||
52 | #define unregister_early_suspend(handler) do { } while (0) | ||
53 | #endif | ||
54 | |||
55 | #endif | ||
56 | |||
diff --git a/include/linux/edac_mce.h b/include/linux/edac_mce.h new file mode 100644 index 00000000000..f974fc03536 --- /dev/null +++ b/include/linux/edac_mce.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* Provides edac interface to mcelog events | ||
2 | * | ||
3 | * This file may be distributed under the terms of the | ||
4 | * GNU General Public License version 2. | ||
5 | * | ||
6 | * Copyright (c) 2009 by: | ||
7 | * Mauro Carvalho Chehab <mchehab@redhat.com> | ||
8 | * | ||
9 | * Red Hat Inc. http://www.redhat.com | ||
10 | */ | ||
11 | |||
12 | #if defined(CONFIG_EDAC_MCE) || \ | ||
13 | (defined(CONFIG_EDAC_MCE_MODULE) && defined(MODULE)) | ||
14 | |||
15 | #include <asm/mce.h> | ||
16 | #include <linux/list.h> | ||
17 | |||
18 | struct edac_mce { | ||
19 | struct list_head list; | ||
20 | |||
21 | void *priv; | ||
22 | int (*check_error)(void *priv, struct mce *mce); | ||
23 | }; | ||
24 | |||
25 | int edac_mce_register(struct edac_mce *edac_mce); | ||
26 | void edac_mce_unregister(struct edac_mce *edac_mce); | ||
27 | int edac_mce_parse(struct mce *mce); | ||
28 | |||
29 | #else | ||
30 | #define edac_mce_parse(mce) (0) | ||
31 | #endif | ||
diff --git a/include/linux/efs_fs_sb.h b/include/linux/efs_fs_sb.h new file mode 100644 index 00000000000..a01be90c58c --- /dev/null +++ b/include/linux/efs_fs_sb.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * efs_fs_sb.h | ||
3 | * | ||
4 | * Copyright (c) 1999 Al Smith | ||
5 | * | ||
6 | * Portions derived from IRIX header files (c) 1988 Silicon Graphics | ||
7 | */ | ||
8 | |||
9 | #ifndef __EFS_FS_SB_H__ | ||
10 | #define __EFS_FS_SB_H__ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/magic.h> | ||
14 | |||
15 | /* EFS superblock magic numbers */ | ||
16 | #define EFS_MAGIC 0x072959 | ||
17 | #define EFS_NEWMAGIC 0x07295a | ||
18 | |||
19 | #define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) | ||
20 | |||
21 | #define EFS_SUPER 1 | ||
22 | #define EFS_ROOTINODE 2 | ||
23 | |||
24 | /* efs superblock on disk */ | ||
25 | struct efs_super { | ||
26 | __be32 fs_size; /* size of filesystem, in sectors */ | ||
27 | __be32 fs_firstcg; /* bb offset to first cg */ | ||
28 | __be32 fs_cgfsize; /* size of cylinder group in bb's */ | ||
29 | __be16 fs_cgisize; /* bb's of inodes per cylinder group */ | ||
30 | __be16 fs_sectors; /* sectors per track */ | ||
31 | __be16 fs_heads; /* heads per cylinder */ | ||
32 | __be16 fs_ncg; /* # of cylinder groups in filesystem */ | ||
33 | __be16 fs_dirty; /* fs needs to be fsck'd */ | ||
34 | __be32 fs_time; /* last super-block update */ | ||
35 | __be32 fs_magic; /* magic number */ | ||
36 | char fs_fname[6]; /* file system name */ | ||
37 | char fs_fpack[6]; /* file system pack name */ | ||
38 | __be32 fs_bmsize; /* size of bitmap in bytes */ | ||
39 | __be32 fs_tfree; /* total free data blocks */ | ||
40 | __be32 fs_tinode; /* total free inodes */ | ||
41 | __be32 fs_bmblock; /* bitmap location. */ | ||
42 | __be32 fs_replsb; /* Location of replicated superblock. */ | ||
43 | __be32 fs_lastialloc; /* last allocated inode */ | ||
44 | char fs_spare[20]; /* space for expansion - MUST BE ZERO */ | ||
45 | __be32 fs_checksum; /* checksum of volume portion of fs */ | ||
46 | }; | ||
47 | |||
48 | /* efs superblock information in memory */ | ||
49 | struct efs_sb_info { | ||
50 | __u32 fs_magic; /* superblock magic number */ | ||
51 | __u32 fs_start; /* first block of filesystem */ | ||
52 | __u32 first_block; /* first data block in filesystem */ | ||
53 | __u32 total_blocks; /* total number of blocks in filesystem */ | ||
54 | __u32 group_size; /* # of blocks a group consists of */ | ||
55 | __u32 data_free; /* # of free data blocks */ | ||
56 | __u32 inode_free; /* # of free inodes */ | ||
57 | __u16 inode_blocks; /* # of blocks used for inodes in every grp */ | ||
58 | __u16 total_groups; /* # of groups */ | ||
59 | }; | ||
60 | |||
61 | #endif /* __EFS_FS_SB_H__ */ | ||
62 | |||
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h new file mode 100644 index 00000000000..18bea78fe47 --- /dev/null +++ b/include/linux/elf-em.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifndef _LINUX_ELF_EM_H | ||
2 | #define _LINUX_ELF_EM_H | ||
3 | |||
4 | /* These constants define the various ELF target machines */ | ||
5 | #define EM_NONE 0 | ||
6 | #define EM_M32 1 | ||
7 | #define EM_SPARC 2 | ||
8 | #define EM_386 3 | ||
9 | #define EM_68K 4 | ||
10 | #define EM_88K 5 | ||
11 | #define EM_486 6 /* Perhaps disused */ | ||
12 | #define EM_860 7 | ||
13 | #define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ | ||
14 | /* Next two are historical and binaries and | ||
15 | modules of these types will be rejected by | ||
16 | Linux. */ | ||
17 | #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ | ||
18 | #define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ | ||
19 | |||
20 | #define EM_PARISC 15 /* HPPA */ | ||
21 | #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ | ||
22 | #define EM_PPC 20 /* PowerPC */ | ||
23 | #define EM_PPC64 21 /* PowerPC64 */ | ||
24 | #define EM_SPU 23 /* Cell BE SPU */ | ||
25 | #define EM_SH 42 /* SuperH */ | ||
26 | #define EM_SPARCV9 43 /* SPARC v9 64-bit */ | ||
27 | #define EM_IA_64 50 /* HP/Intel IA-64 */ | ||
28 | #define EM_X86_64 62 /* AMD x86-64 */ | ||
29 | #define EM_S390 22 /* IBM S/390 */ | ||
30 | #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ | ||
31 | #define EM_V850 87 /* NEC v850 */ | ||
32 | #define EM_M32R 88 /* Renesas M32R */ | ||
33 | #define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ | ||
34 | #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ | ||
35 | #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ | ||
36 | #define EM_FRV 0x5441 /* Fujitsu FR-V */ | ||
37 | #define EM_AVR32 0x18ad /* Atmel AVR32 */ | ||
38 | |||
39 | /* | ||
40 | * This is an interim value that we will use until the committee comes | ||
41 | * up with a final number. | ||
42 | */ | ||
43 | #define EM_ALPHA 0x9026 | ||
44 | |||
45 | /* Bogus old v850 magic number, used by old tools. */ | ||
46 | #define EM_CYGNUS_V850 0x9080 | ||
47 | /* Bogus old m32r magic number, used by old tools. */ | ||
48 | #define EM_CYGNUS_M32R 0x9041 | ||
49 | /* This is the old interim value for S/390 architecture */ | ||
50 | #define EM_S390_OLD 0xA390 | ||
51 | /* Also Panasonic/MEI MN10300, AM33 */ | ||
52 | #define EM_CYGNUS_MN10300 0xbeef | ||
53 | |||
54 | |||
55 | #endif /* _LINUX_ELF_EM_H */ | ||
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h new file mode 100644 index 00000000000..db4d9f586bb --- /dev/null +++ b/include/linux/ext2_fs_sb.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext2_fs_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT2_FS_SB | ||
17 | #define _LINUX_EXT2_FS_SB | ||
18 | |||
19 | #include <linux/blockgroup_lock.h> | ||
20 | #include <linux/percpu_counter.h> | ||
21 | #include <linux/rbtree.h> | ||
22 | |||
23 | /* XXX Here for now... not interested in restructing headers JUST now */ | ||
24 | |||
25 | /* data type for block offset of block group */ | ||
26 | typedef int ext2_grpblk_t; | ||
27 | |||
28 | /* data type for filesystem-wide blocks number */ | ||
29 | typedef unsigned long ext2_fsblk_t; | ||
30 | |||
31 | #define E2FSBLK "%lu" | ||
32 | |||
33 | struct ext2_reserve_window { | ||
34 | ext2_fsblk_t _rsv_start; /* First byte reserved */ | ||
35 | ext2_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
36 | }; | ||
37 | |||
38 | struct ext2_reserve_window_node { | ||
39 | struct rb_node rsv_node; | ||
40 | __u32 rsv_goal_size; | ||
41 | __u32 rsv_alloc_hit; | ||
42 | struct ext2_reserve_window rsv_window; | ||
43 | }; | ||
44 | |||
45 | struct ext2_block_alloc_info { | ||
46 | /* information about reservation window */ | ||
47 | struct ext2_reserve_window_node rsv_window_node; | ||
48 | /* | ||
49 | * was i_next_alloc_block in ext2_inode_info | ||
50 | * is the logical (file-relative) number of the | ||
51 | * most-recently-allocated block in this file. | ||
52 | * We use this for detecting linearly ascending allocation requests. | ||
53 | */ | ||
54 | __u32 last_alloc_logical_block; | ||
55 | /* | ||
56 | * Was i_next_alloc_goal in ext2_inode_info | ||
57 | * is the *physical* companion to i_next_alloc_block. | ||
58 | * it the the physical block number of the block which was most-recentl | ||
59 | * allocated to this file. This give us the goal (target) for the next | ||
60 | * allocation when we detect linearly ascending requests. | ||
61 | */ | ||
62 | ext2_fsblk_t last_alloc_physical_block; | ||
63 | }; | ||
64 | |||
65 | #define rsv_start rsv_window._rsv_start | ||
66 | #define rsv_end rsv_window._rsv_end | ||
67 | |||
68 | /* | ||
69 | * second extended-fs super-block data in memory | ||
70 | */ | ||
71 | struct ext2_sb_info { | ||
72 | unsigned long s_frag_size; /* Size of a fragment in bytes */ | ||
73 | unsigned long s_frags_per_block;/* Number of fragments per block */ | ||
74 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
75 | unsigned long s_frags_per_group;/* Number of fragments in a group */ | ||
76 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
77 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
78 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
79 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
80 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
81 | unsigned long s_groups_count; /* Number of groups in the fs */ | ||
82 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
83 | unsigned long s_blocks_last; /* Last seen block count */ | ||
84 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
85 | struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
86 | struct buffer_head ** s_group_desc; | ||
87 | unsigned long s_mount_opt; | ||
88 | unsigned long s_sb_block; | ||
89 | uid_t s_resuid; | ||
90 | gid_t s_resgid; | ||
91 | unsigned short s_mount_state; | ||
92 | unsigned short s_pad; | ||
93 | int s_addr_per_block_bits; | ||
94 | int s_desc_per_block_bits; | ||
95 | int s_inode_size; | ||
96 | int s_first_ino; | ||
97 | spinlock_t s_next_gen_lock; | ||
98 | u32 s_next_generation; | ||
99 | unsigned long s_dir_count; | ||
100 | u8 *s_debts; | ||
101 | struct percpu_counter s_freeblocks_counter; | ||
102 | struct percpu_counter s_freeinodes_counter; | ||
103 | struct percpu_counter s_dirs_counter; | ||
104 | struct blockgroup_lock *s_blockgroup_lock; | ||
105 | /* root of the per fs reservation window tree */ | ||
106 | spinlock_t s_rsv_window_lock; | ||
107 | struct rb_root s_rsv_window_root; | ||
108 | struct ext2_reserve_window_node s_rsv_window_head; | ||
109 | /* | ||
110 | * s_lock protects against concurrent modifications of s_mount_state, | ||
111 | * s_blocks_last, s_overhead_last and the content of superblock's | ||
112 | * buffer pointed to by sbi->s_es. | ||
113 | * | ||
114 | * Note: It is used in ext2_show_options() to provide a consistent view | ||
115 | * of the mount options. | ||
116 | */ | ||
117 | spinlock_t s_lock; | ||
118 | }; | ||
119 | |||
120 | static inline spinlock_t * | ||
121 | sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group) | ||
122 | { | ||
123 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
124 | } | ||
125 | |||
126 | #endif /* _LINUX_EXT2_FS_SB */ | ||
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h new file mode 100644 index 00000000000..0244611eb2b --- /dev/null +++ b/include/linux/ext3_fs.h | |||
@@ -0,0 +1,979 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_H | ||
17 | #define _LINUX_EXT3_FS_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/magic.h> | ||
21 | |||
22 | /* | ||
23 | * The second extended filesystem constants/structures | ||
24 | */ | ||
25 | |||
26 | /* | ||
27 | * Define EXT3FS_DEBUG to produce debug messages | ||
28 | */ | ||
29 | #undef EXT3FS_DEBUG | ||
30 | |||
31 | /* | ||
32 | * Define EXT3_RESERVATION to reserve data blocks for expanding files | ||
33 | */ | ||
34 | #define EXT3_DEFAULT_RESERVE_BLOCKS 8 | ||
35 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ | ||
36 | #define EXT3_MAX_RESERVE_BLOCKS 1027 | ||
37 | #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 | ||
38 | |||
39 | /* | ||
40 | * Debug code | ||
41 | */ | ||
42 | #ifdef EXT3FS_DEBUG | ||
43 | #define ext3_debug(f, a...) \ | ||
44 | do { \ | ||
45 | printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ | ||
46 | __FILE__, __LINE__, __func__); \ | ||
47 | printk (KERN_DEBUG f, ## a); \ | ||
48 | } while (0) | ||
49 | #else | ||
50 | #define ext3_debug(f, a...) do {} while (0) | ||
51 | #endif | ||
52 | |||
53 | /* | ||
54 | * Special inodes numbers | ||
55 | */ | ||
56 | #define EXT3_BAD_INO 1 /* Bad blocks inode */ | ||
57 | #define EXT3_ROOT_INO 2 /* Root inode */ | ||
58 | #define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */ | ||
59 | #define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */ | ||
60 | #define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */ | ||
61 | #define EXT3_JOURNAL_INO 8 /* Journal inode */ | ||
62 | |||
63 | /* First non-reserved inode for old ext3 filesystems */ | ||
64 | #define EXT3_GOOD_OLD_FIRST_INO 11 | ||
65 | |||
66 | /* | ||
67 | * Maximal count of links to a file | ||
68 | */ | ||
69 | #define EXT3_LINK_MAX 32000 | ||
70 | |||
71 | /* | ||
72 | * Macro-instructions used to manage several block sizes | ||
73 | */ | ||
74 | #define EXT3_MIN_BLOCK_SIZE 1024 | ||
75 | #define EXT3_MAX_BLOCK_SIZE 65536 | ||
76 | #define EXT3_MIN_BLOCK_LOG_SIZE 10 | ||
77 | #ifdef __KERNEL__ | ||
78 | # define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize) | ||
79 | #else | ||
80 | # define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size) | ||
81 | #endif | ||
82 | #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32)) | ||
83 | #ifdef __KERNEL__ | ||
84 | # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) | ||
85 | #else | ||
86 | # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) | ||
87 | #endif | ||
88 | #ifdef __KERNEL__ | ||
89 | #define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits) | ||
90 | #define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size) | ||
91 | #define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino) | ||
92 | #else | ||
93 | #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ | ||
94 | EXT3_GOOD_OLD_INODE_SIZE : \ | ||
95 | (s)->s_inode_size) | ||
96 | #define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ | ||
97 | EXT3_GOOD_OLD_FIRST_INO : \ | ||
98 | (s)->s_first_ino) | ||
99 | #endif | ||
100 | |||
101 | /* | ||
102 | * Macro-instructions used to manage fragments | ||
103 | */ | ||
104 | #define EXT3_MIN_FRAG_SIZE 1024 | ||
105 | #define EXT3_MAX_FRAG_SIZE 4096 | ||
106 | #define EXT3_MIN_FRAG_LOG_SIZE 10 | ||
107 | #ifdef __KERNEL__ | ||
108 | # define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size) | ||
109 | # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block) | ||
110 | #else | ||
111 | # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size) | ||
112 | # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s)) | ||
113 | #endif | ||
114 | |||
115 | /* | ||
116 | * Structure of a blocks group descriptor | ||
117 | */ | ||
118 | struct ext3_group_desc | ||
119 | { | ||
120 | __le32 bg_block_bitmap; /* Blocks bitmap block */ | ||
121 | __le32 bg_inode_bitmap; /* Inodes bitmap block */ | ||
122 | __le32 bg_inode_table; /* Inodes table block */ | ||
123 | __le16 bg_free_blocks_count; /* Free blocks count */ | ||
124 | __le16 bg_free_inodes_count; /* Free inodes count */ | ||
125 | __le16 bg_used_dirs_count; /* Directories count */ | ||
126 | __u16 bg_pad; | ||
127 | __le32 bg_reserved[3]; | ||
128 | }; | ||
129 | |||
130 | /* | ||
131 | * Macro-instructions used to manage group descriptors | ||
132 | */ | ||
133 | #ifdef __KERNEL__ | ||
134 | # define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group) | ||
135 | # define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block) | ||
136 | # define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group) | ||
137 | # define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits) | ||
138 | #else | ||
139 | # define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) | ||
140 | # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc)) | ||
141 | # define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) | ||
142 | #endif | ||
143 | |||
144 | /* | ||
145 | * Constants relative to the data blocks | ||
146 | */ | ||
147 | #define EXT3_NDIR_BLOCKS 12 | ||
148 | #define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS | ||
149 | #define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1) | ||
150 | #define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1) | ||
151 | #define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1) | ||
152 | |||
153 | /* | ||
154 | * Inode flags | ||
155 | */ | ||
156 | #define EXT3_SECRM_FL 0x00000001 /* Secure deletion */ | ||
157 | #define EXT3_UNRM_FL 0x00000002 /* Undelete */ | ||
158 | #define EXT3_COMPR_FL 0x00000004 /* Compress file */ | ||
159 | #define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */ | ||
160 | #define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */ | ||
161 | #define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */ | ||
162 | #define EXT3_NODUMP_FL 0x00000040 /* do not dump file */ | ||
163 | #define EXT3_NOATIME_FL 0x00000080 /* do not update atime */ | ||
164 | /* Reserved for compression usage... */ | ||
165 | #define EXT3_DIRTY_FL 0x00000100 | ||
166 | #define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ | ||
167 | #define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */ | ||
168 | #define EXT3_ECOMPR_FL 0x00000800 /* Compression error */ | ||
169 | /* End compression flags --- maybe not all used */ | ||
170 | #define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */ | ||
171 | #define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */ | ||
172 | #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ | ||
173 | #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | ||
174 | #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ | ||
175 | #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | ||
176 | #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */ | ||
177 | |||
178 | #define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | ||
179 | #define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ | ||
180 | |||
181 | /* Flags that should be inherited by new inodes from their parent. */ | ||
182 | #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\ | ||
183 | EXT3_SYNC_FL | EXT3_NODUMP_FL |\ | ||
184 | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\ | ||
185 | EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\ | ||
186 | EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL) | ||
187 | |||
188 | /* Flags that are appropriate for regular files (all but dir-specific ones). */ | ||
189 | #define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL)) | ||
190 | |||
191 | /* Flags that are appropriate for non-directories/regular files. */ | ||
192 | #define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL) | ||
193 | |||
194 | /* Mask out flags that are inappropriate for the given type of inode. */ | ||
195 | static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags) | ||
196 | { | ||
197 | if (S_ISDIR(mode)) | ||
198 | return flags; | ||
199 | else if (S_ISREG(mode)) | ||
200 | return flags & EXT3_REG_FLMASK; | ||
201 | else | ||
202 | return flags & EXT3_OTHER_FLMASK; | ||
203 | } | ||
204 | |||
205 | /* Used to pass group descriptor data when online resize is done */ | ||
206 | struct ext3_new_group_input { | ||
207 | __u32 group; /* Group number for this data */ | ||
208 | __u32 block_bitmap; /* Absolute block number of block bitmap */ | ||
209 | __u32 inode_bitmap; /* Absolute block number of inode bitmap */ | ||
210 | __u32 inode_table; /* Absolute block number of inode table start */ | ||
211 | __u32 blocks_count; /* Total number of blocks in this group */ | ||
212 | __u16 reserved_blocks; /* Number of reserved blocks in this group */ | ||
213 | __u16 unused; | ||
214 | }; | ||
215 | |||
216 | /* The struct ext3_new_group_input in kernel space, with free_blocks_count */ | ||
217 | struct ext3_new_group_data { | ||
218 | __u32 group; | ||
219 | __u32 block_bitmap; | ||
220 | __u32 inode_bitmap; | ||
221 | __u32 inode_table; | ||
222 | __u32 blocks_count; | ||
223 | __u16 reserved_blocks; | ||
224 | __u16 unused; | ||
225 | __u32 free_blocks_count; | ||
226 | }; | ||
227 | |||
228 | |||
229 | /* | ||
230 | * ioctl commands | ||
231 | */ | ||
232 | #define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
233 | #define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
234 | #define EXT3_IOC_GETVERSION _IOR('f', 3, long) | ||
235 | #define EXT3_IOC_SETVERSION _IOW('f', 4, long) | ||
236 | #define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) | ||
237 | #define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input) | ||
238 | #define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION | ||
239 | #define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION | ||
240 | #ifdef CONFIG_JBD_DEBUG | ||
241 | #define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) | ||
242 | #endif | ||
243 | #define EXT3_IOC_GETRSVSZ _IOR('f', 5, long) | ||
244 | #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) | ||
245 | |||
246 | /* | ||
247 | * ioctl commands in 32 bit emulation | ||
248 | */ | ||
249 | #define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
250 | #define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
251 | #define EXT3_IOC32_GETVERSION _IOR('f', 3, int) | ||
252 | #define EXT3_IOC32_SETVERSION _IOW('f', 4, int) | ||
253 | #define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int) | ||
254 | #define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int) | ||
255 | #define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) | ||
256 | #ifdef CONFIG_JBD_DEBUG | ||
257 | #define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) | ||
258 | #endif | ||
259 | #define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION | ||
260 | #define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION | ||
261 | |||
262 | |||
263 | /* | ||
264 | * Mount options | ||
265 | */ | ||
266 | struct ext3_mount_options { | ||
267 | unsigned long s_mount_opt; | ||
268 | uid_t s_resuid; | ||
269 | gid_t s_resgid; | ||
270 | unsigned long s_commit_interval; | ||
271 | #ifdef CONFIG_QUOTA | ||
272 | int s_jquota_fmt; | ||
273 | char *s_qf_names[MAXQUOTAS]; | ||
274 | #endif | ||
275 | }; | ||
276 | |||
277 | /* | ||
278 | * Structure of an inode on the disk | ||
279 | */ | ||
280 | struct ext3_inode { | ||
281 | __le16 i_mode; /* File mode */ | ||
282 | __le16 i_uid; /* Low 16 bits of Owner Uid */ | ||
283 | __le32 i_size; /* Size in bytes */ | ||
284 | __le32 i_atime; /* Access time */ | ||
285 | __le32 i_ctime; /* Creation time */ | ||
286 | __le32 i_mtime; /* Modification time */ | ||
287 | __le32 i_dtime; /* Deletion Time */ | ||
288 | __le16 i_gid; /* Low 16 bits of Group Id */ | ||
289 | __le16 i_links_count; /* Links count */ | ||
290 | __le32 i_blocks; /* Blocks count */ | ||
291 | __le32 i_flags; /* File flags */ | ||
292 | union { | ||
293 | struct { | ||
294 | __u32 l_i_reserved1; | ||
295 | } linux1; | ||
296 | struct { | ||
297 | __u32 h_i_translator; | ||
298 | } hurd1; | ||
299 | struct { | ||
300 | __u32 m_i_reserved1; | ||
301 | } masix1; | ||
302 | } osd1; /* OS dependent 1 */ | ||
303 | __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ | ||
304 | __le32 i_generation; /* File version (for NFS) */ | ||
305 | __le32 i_file_acl; /* File ACL */ | ||
306 | __le32 i_dir_acl; /* Directory ACL */ | ||
307 | __le32 i_faddr; /* Fragment address */ | ||
308 | union { | ||
309 | struct { | ||
310 | __u8 l_i_frag; /* Fragment number */ | ||
311 | __u8 l_i_fsize; /* Fragment size */ | ||
312 | __u16 i_pad1; | ||
313 | __le16 l_i_uid_high; /* these 2 fields */ | ||
314 | __le16 l_i_gid_high; /* were reserved2[0] */ | ||
315 | __u32 l_i_reserved2; | ||
316 | } linux2; | ||
317 | struct { | ||
318 | __u8 h_i_frag; /* Fragment number */ | ||
319 | __u8 h_i_fsize; /* Fragment size */ | ||
320 | __u16 h_i_mode_high; | ||
321 | __u16 h_i_uid_high; | ||
322 | __u16 h_i_gid_high; | ||
323 | __u32 h_i_author; | ||
324 | } hurd2; | ||
325 | struct { | ||
326 | __u8 m_i_frag; /* Fragment number */ | ||
327 | __u8 m_i_fsize; /* Fragment size */ | ||
328 | __u16 m_pad1; | ||
329 | __u32 m_i_reserved2[2]; | ||
330 | } masix2; | ||
331 | } osd2; /* OS dependent 2 */ | ||
332 | __le16 i_extra_isize; | ||
333 | __le16 i_pad1; | ||
334 | }; | ||
335 | |||
336 | #define i_size_high i_dir_acl | ||
337 | |||
338 | #if defined(__KERNEL__) || defined(__linux__) | ||
339 | #define i_reserved1 osd1.linux1.l_i_reserved1 | ||
340 | #define i_frag osd2.linux2.l_i_frag | ||
341 | #define i_fsize osd2.linux2.l_i_fsize | ||
342 | #define i_uid_low i_uid | ||
343 | #define i_gid_low i_gid | ||
344 | #define i_uid_high osd2.linux2.l_i_uid_high | ||
345 | #define i_gid_high osd2.linux2.l_i_gid_high | ||
346 | #define i_reserved2 osd2.linux2.l_i_reserved2 | ||
347 | |||
348 | #elif defined(__GNU__) | ||
349 | |||
350 | #define i_translator osd1.hurd1.h_i_translator | ||
351 | #define i_frag osd2.hurd2.h_i_frag; | ||
352 | #define i_fsize osd2.hurd2.h_i_fsize; | ||
353 | #define i_uid_high osd2.hurd2.h_i_uid_high | ||
354 | #define i_gid_high osd2.hurd2.h_i_gid_high | ||
355 | #define i_author osd2.hurd2.h_i_author | ||
356 | |||
357 | #elif defined(__masix__) | ||
358 | |||
359 | #define i_reserved1 osd1.masix1.m_i_reserved1 | ||
360 | #define i_frag osd2.masix2.m_i_frag | ||
361 | #define i_fsize osd2.masix2.m_i_fsize | ||
362 | #define i_reserved2 osd2.masix2.m_i_reserved2 | ||
363 | |||
364 | #endif /* defined(__KERNEL__) || defined(__linux__) */ | ||
365 | |||
366 | /* | ||
367 | * File system states | ||
368 | */ | ||
369 | #define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */ | ||
370 | #define EXT3_ERROR_FS 0x0002 /* Errors detected */ | ||
371 | #define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ | ||
372 | |||
373 | /* | ||
374 | * Misc. filesystem flags | ||
375 | */ | ||
376 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ | ||
377 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ | ||
378 | #define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */ | ||
379 | |||
380 | /* | ||
381 | * Mount flags | ||
382 | */ | ||
383 | #define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */ | ||
384 | #define EXT3_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */ | ||
385 | #define EXT3_MOUNT_GRPID 0x00004 /* Create files with directory's group */ | ||
386 | #define EXT3_MOUNT_DEBUG 0x00008 /* Some debugging messages */ | ||
387 | #define EXT3_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */ | ||
388 | #define EXT3_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */ | ||
389 | #define EXT3_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ | ||
390 | #define EXT3_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ | ||
391 | #define EXT3_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ | ||
392 | #define EXT3_MOUNT_ABORT 0x00200 /* Fatal error detected */ | ||
393 | #define EXT3_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ | ||
394 | #define EXT3_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */ | ||
395 | #define EXT3_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */ | ||
396 | #define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */ | ||
397 | #define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */ | ||
398 | #define EXT3_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */ | ||
399 | #define EXT3_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */ | ||
400 | #define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ | ||
401 | #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ | ||
402 | #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ | ||
403 | #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ | ||
404 | #define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | ||
405 | #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | ||
406 | #define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write | ||
407 | * error in ordered mode */ | ||
408 | |||
409 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ | ||
410 | #ifndef _LINUX_EXT2_FS_H | ||
411 | #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt | ||
412 | #define set_opt(o, opt) o |= EXT3_MOUNT_##opt | ||
413 | #define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \ | ||
414 | EXT3_MOUNT_##opt) | ||
415 | #else | ||
416 | #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD | ||
417 | #define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT | ||
418 | #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS | ||
419 | #endif | ||
420 | |||
421 | #define ext3_set_bit __set_bit_le | ||
422 | #define ext3_set_bit_atomic ext2_set_bit_atomic | ||
423 | #define ext3_clear_bit __clear_bit_le | ||
424 | #define ext3_clear_bit_atomic ext2_clear_bit_atomic | ||
425 | #define ext3_test_bit test_bit_le | ||
426 | #define ext3_find_next_zero_bit find_next_zero_bit_le | ||
427 | |||
428 | /* | ||
429 | * Maximal mount counts between two filesystem checks | ||
430 | */ | ||
431 | #define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ | ||
432 | #define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */ | ||
433 | |||
434 | /* | ||
435 | * Behaviour when detecting errors | ||
436 | */ | ||
437 | #define EXT3_ERRORS_CONTINUE 1 /* Continue execution */ | ||
438 | #define EXT3_ERRORS_RO 2 /* Remount fs read-only */ | ||
439 | #define EXT3_ERRORS_PANIC 3 /* Panic */ | ||
440 | #define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE | ||
441 | |||
442 | /* | ||
443 | * Structure of the super block | ||
444 | */ | ||
445 | struct ext3_super_block { | ||
446 | /*00*/ __le32 s_inodes_count; /* Inodes count */ | ||
447 | __le32 s_blocks_count; /* Blocks count */ | ||
448 | __le32 s_r_blocks_count; /* Reserved blocks count */ | ||
449 | __le32 s_free_blocks_count; /* Free blocks count */ | ||
450 | /*10*/ __le32 s_free_inodes_count; /* Free inodes count */ | ||
451 | __le32 s_first_data_block; /* First Data Block */ | ||
452 | __le32 s_log_block_size; /* Block size */ | ||
453 | __le32 s_log_frag_size; /* Fragment size */ | ||
454 | /*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ | ||
455 | __le32 s_frags_per_group; /* # Fragments per group */ | ||
456 | __le32 s_inodes_per_group; /* # Inodes per group */ | ||
457 | __le32 s_mtime; /* Mount time */ | ||
458 | /*30*/ __le32 s_wtime; /* Write time */ | ||
459 | __le16 s_mnt_count; /* Mount count */ | ||
460 | __le16 s_max_mnt_count; /* Maximal mount count */ | ||
461 | __le16 s_magic; /* Magic signature */ | ||
462 | __le16 s_state; /* File system state */ | ||
463 | __le16 s_errors; /* Behaviour when detecting errors */ | ||
464 | __le16 s_minor_rev_level; /* minor revision level */ | ||
465 | /*40*/ __le32 s_lastcheck; /* time of last check */ | ||
466 | __le32 s_checkinterval; /* max. time between checks */ | ||
467 | __le32 s_creator_os; /* OS */ | ||
468 | __le32 s_rev_level; /* Revision level */ | ||
469 | /*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */ | ||
470 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | ||
471 | /* | ||
472 | * These fields are for EXT3_DYNAMIC_REV superblocks only. | ||
473 | * | ||
474 | * Note: the difference between the compatible feature set and | ||
475 | * the incompatible feature set is that if there is a bit set | ||
476 | * in the incompatible feature set that the kernel doesn't | ||
477 | * know about, it should refuse to mount the filesystem. | ||
478 | * | ||
479 | * e2fsck's requirements are more strict; if it doesn't know | ||
480 | * about a feature in either the compatible or incompatible | ||
481 | * feature set, it must abort and not try to meddle with | ||
482 | * things it doesn't understand... | ||
483 | */ | ||
484 | __le32 s_first_ino; /* First non-reserved inode */ | ||
485 | __le16 s_inode_size; /* size of inode structure */ | ||
486 | __le16 s_block_group_nr; /* block group # of this superblock */ | ||
487 | __le32 s_feature_compat; /* compatible feature set */ | ||
488 | /*60*/ __le32 s_feature_incompat; /* incompatible feature set */ | ||
489 | __le32 s_feature_ro_compat; /* readonly-compatible feature set */ | ||
490 | /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ | ||
491 | /*78*/ char s_volume_name[16]; /* volume name */ | ||
492 | /*88*/ char s_last_mounted[64]; /* directory where last mounted */ | ||
493 | /*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */ | ||
494 | /* | ||
495 | * Performance hints. Directory preallocation should only | ||
496 | * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on. | ||
497 | */ | ||
498 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ | ||
499 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ | ||
500 | __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */ | ||
501 | /* | ||
502 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. | ||
503 | */ | ||
504 | /*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ | ||
505 | /*E0*/ __le32 s_journal_inum; /* inode number of journal file */ | ||
506 | __le32 s_journal_dev; /* device number of journal file */ | ||
507 | __le32 s_last_orphan; /* start of list of inodes to delete */ | ||
508 | __le32 s_hash_seed[4]; /* HTREE hash seed */ | ||
509 | __u8 s_def_hash_version; /* Default hash version to use */ | ||
510 | __u8 s_reserved_char_pad; | ||
511 | __u16 s_reserved_word_pad; | ||
512 | __le32 s_default_mount_opts; | ||
513 | __le32 s_first_meta_bg; /* First metablock block group */ | ||
514 | __le32 s_mkfs_time; /* When the filesystem was created */ | ||
515 | __le32 s_jnl_blocks[17]; /* Backup of the journal inode */ | ||
516 | /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */ | ||
517 | /*150*/ __le32 s_blocks_count_hi; /* Blocks count */ | ||
518 | __le32 s_r_blocks_count_hi; /* Reserved blocks count */ | ||
519 | __le32 s_free_blocks_count_hi; /* Free blocks count */ | ||
520 | __le16 s_min_extra_isize; /* All inodes have at least # bytes */ | ||
521 | __le16 s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
522 | __le32 s_flags; /* Miscellaneous flags */ | ||
523 | __le16 s_raid_stride; /* RAID stride */ | ||
524 | __le16 s_mmp_interval; /* # seconds to wait in MMP checking */ | ||
525 | __le64 s_mmp_block; /* Block for multi-mount protection */ | ||
526 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | ||
527 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ | ||
528 | __u8 s_reserved_char_pad2; | ||
529 | __le16 s_reserved_pad; | ||
530 | __u32 s_reserved[162]; /* Padding to the end of the block */ | ||
531 | }; | ||
532 | |||
533 | #ifdef __KERNEL__ | ||
534 | #include <linux/ext3_fs_i.h> | ||
535 | #include <linux/ext3_fs_sb.h> | ||
536 | static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb) | ||
537 | { | ||
538 | return sb->s_fs_info; | ||
539 | } | ||
540 | static inline struct ext3_inode_info *EXT3_I(struct inode *inode) | ||
541 | { | ||
542 | return container_of(inode, struct ext3_inode_info, vfs_inode); | ||
543 | } | ||
544 | |||
545 | static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino) | ||
546 | { | ||
547 | return ino == EXT3_ROOT_INO || | ||
548 | ino == EXT3_JOURNAL_INO || | ||
549 | ino == EXT3_RESIZE_INO || | ||
550 | (ino >= EXT3_FIRST_INO(sb) && | ||
551 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); | ||
552 | } | ||
553 | |||
554 | /* | ||
555 | * Inode dynamic state flags | ||
556 | */ | ||
557 | enum { | ||
558 | EXT3_STATE_JDATA, /* journaled data exists */ | ||
559 | EXT3_STATE_NEW, /* inode is newly created */ | ||
560 | EXT3_STATE_XATTR, /* has in-inode xattrs */ | ||
561 | EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */ | ||
562 | }; | ||
563 | |||
564 | static inline int ext3_test_inode_state(struct inode *inode, int bit) | ||
565 | { | ||
566 | return test_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
567 | } | ||
568 | |||
569 | static inline void ext3_set_inode_state(struct inode *inode, int bit) | ||
570 | { | ||
571 | set_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
572 | } | ||
573 | |||
574 | static inline void ext3_clear_inode_state(struct inode *inode, int bit) | ||
575 | { | ||
576 | clear_bit(bit, &EXT3_I(inode)->i_state_flags); | ||
577 | } | ||
578 | #else | ||
579 | /* Assume that user mode programs are passing in an ext3fs superblock, not | ||
580 | * a kernel struct super_block. This will allow us to call the feature-test | ||
581 | * macros from user land. */ | ||
582 | #define EXT3_SB(sb) (sb) | ||
583 | #endif | ||
584 | |||
585 | #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime | ||
586 | |||
587 | /* | ||
588 | * Codes for operating systems | ||
589 | */ | ||
590 | #define EXT3_OS_LINUX 0 | ||
591 | #define EXT3_OS_HURD 1 | ||
592 | #define EXT3_OS_MASIX 2 | ||
593 | #define EXT3_OS_FREEBSD 3 | ||
594 | #define EXT3_OS_LITES 4 | ||
595 | |||
596 | /* | ||
597 | * Revision levels | ||
598 | */ | ||
599 | #define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */ | ||
600 | #define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ | ||
601 | |||
602 | #define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV | ||
603 | #define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV | ||
604 | |||
605 | #define EXT3_GOOD_OLD_INODE_SIZE 128 | ||
606 | |||
607 | /* | ||
608 | * Feature set definitions | ||
609 | */ | ||
610 | |||
611 | #define EXT3_HAS_COMPAT_FEATURE(sb,mask) \ | ||
612 | ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) | ||
613 | #define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \ | ||
614 | ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) | ||
615 | #define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \ | ||
616 | ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) | ||
617 | #define EXT3_SET_COMPAT_FEATURE(sb,mask) \ | ||
618 | EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) | ||
619 | #define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \ | ||
620 | EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) | ||
621 | #define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \ | ||
622 | EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) | ||
623 | #define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \ | ||
624 | EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) | ||
625 | #define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ | ||
626 | EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) | ||
627 | #define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \ | ||
628 | EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) | ||
629 | |||
630 | #define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001 | ||
631 | #define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002 | ||
632 | #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 | ||
633 | #define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008 | ||
634 | #define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010 | ||
635 | #define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020 | ||
636 | |||
637 | #define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 | ||
638 | #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 | ||
639 | #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 | ||
640 | |||
641 | #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001 | ||
642 | #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002 | ||
643 | #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ | ||
644 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ | ||
645 | #define EXT3_FEATURE_INCOMPAT_META_BG 0x0010 | ||
646 | |||
647 | #define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR | ||
648 | #define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \ | ||
649 | EXT3_FEATURE_INCOMPAT_RECOVER| \ | ||
650 | EXT3_FEATURE_INCOMPAT_META_BG) | ||
651 | #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | ||
652 | EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \ | ||
653 | EXT3_FEATURE_RO_COMPAT_BTREE_DIR) | ||
654 | |||
655 | /* | ||
656 | * Default values for user and/or group using reserved blocks | ||
657 | */ | ||
658 | #define EXT3_DEF_RESUID 0 | ||
659 | #define EXT3_DEF_RESGID 0 | ||
660 | |||
661 | /* | ||
662 | * Default mount options | ||
663 | */ | ||
664 | #define EXT3_DEFM_DEBUG 0x0001 | ||
665 | #define EXT3_DEFM_BSDGROUPS 0x0002 | ||
666 | #define EXT3_DEFM_XATTR_USER 0x0004 | ||
667 | #define EXT3_DEFM_ACL 0x0008 | ||
668 | #define EXT3_DEFM_UID16 0x0010 | ||
669 | #define EXT3_DEFM_JMODE 0x0060 | ||
670 | #define EXT3_DEFM_JMODE_DATA 0x0020 | ||
671 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 | ||
672 | #define EXT3_DEFM_JMODE_WBACK 0x0060 | ||
673 | |||
674 | /* | ||
675 | * Structure of a directory entry | ||
676 | */ | ||
677 | #define EXT3_NAME_LEN 255 | ||
678 | |||
679 | struct ext3_dir_entry { | ||
680 | __le32 inode; /* Inode number */ | ||
681 | __le16 rec_len; /* Directory entry length */ | ||
682 | __le16 name_len; /* Name length */ | ||
683 | char name[EXT3_NAME_LEN]; /* File name */ | ||
684 | }; | ||
685 | |||
686 | /* | ||
687 | * The new version of the directory entry. Since EXT3 structures are | ||
688 | * stored in intel byte order, and the name_len field could never be | ||
689 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | ||
690 | * file_type field. | ||
691 | */ | ||
692 | struct ext3_dir_entry_2 { | ||
693 | __le32 inode; /* Inode number */ | ||
694 | __le16 rec_len; /* Directory entry length */ | ||
695 | __u8 name_len; /* Name length */ | ||
696 | __u8 file_type; | ||
697 | char name[EXT3_NAME_LEN]; /* File name */ | ||
698 | }; | ||
699 | |||
700 | /* | ||
701 | * Ext3 directory file types. Only the low 3 bits are used. The | ||
702 | * other bits are reserved for now. | ||
703 | */ | ||
704 | #define EXT3_FT_UNKNOWN 0 | ||
705 | #define EXT3_FT_REG_FILE 1 | ||
706 | #define EXT3_FT_DIR 2 | ||
707 | #define EXT3_FT_CHRDEV 3 | ||
708 | #define EXT3_FT_BLKDEV 4 | ||
709 | #define EXT3_FT_FIFO 5 | ||
710 | #define EXT3_FT_SOCK 6 | ||
711 | #define EXT3_FT_SYMLINK 7 | ||
712 | |||
713 | #define EXT3_FT_MAX 8 | ||
714 | |||
715 | /* | ||
716 | * EXT3_DIR_PAD defines the directory entries boundaries | ||
717 | * | ||
718 | * NOTE: It must be a multiple of 4 | ||
719 | */ | ||
720 | #define EXT3_DIR_PAD 4 | ||
721 | #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) | ||
722 | #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ | ||
723 | ~EXT3_DIR_ROUND) | ||
724 | #define EXT3_MAX_REC_LEN ((1<<16)-1) | ||
725 | |||
726 | /* | ||
727 | * Tests against MAX_REC_LEN etc were put in place for 64k block | ||
728 | * sizes; if that is not possible on this arch, we can skip | ||
729 | * those tests and speed things up. | ||
730 | */ | ||
731 | static inline unsigned ext3_rec_len_from_disk(__le16 dlen) | ||
732 | { | ||
733 | unsigned len = le16_to_cpu(dlen); | ||
734 | |||
735 | #if (PAGE_CACHE_SIZE >= 65536) | ||
736 | if (len == EXT3_MAX_REC_LEN) | ||
737 | return 1 << 16; | ||
738 | #endif | ||
739 | return len; | ||
740 | } | ||
741 | |||
742 | static inline __le16 ext3_rec_len_to_disk(unsigned len) | ||
743 | { | ||
744 | #if (PAGE_CACHE_SIZE >= 65536) | ||
745 | if (len == (1 << 16)) | ||
746 | return cpu_to_le16(EXT3_MAX_REC_LEN); | ||
747 | else if (len > (1 << 16)) | ||
748 | BUG(); | ||
749 | #endif | ||
750 | return cpu_to_le16(len); | ||
751 | } | ||
752 | |||
753 | /* | ||
754 | * Hash Tree Directory indexing | ||
755 | * (c) Daniel Phillips, 2001 | ||
756 | */ | ||
757 | |||
758 | #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \ | ||
759 | EXT3_FEATURE_COMPAT_DIR_INDEX) && \ | ||
760 | (EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) | ||
761 | #define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX) | ||
762 | #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) | ||
763 | |||
764 | /* Legal values for the dx_root hash_version field: */ | ||
765 | |||
766 | #define DX_HASH_LEGACY 0 | ||
767 | #define DX_HASH_HALF_MD4 1 | ||
768 | #define DX_HASH_TEA 2 | ||
769 | #define DX_HASH_LEGACY_UNSIGNED 3 | ||
770 | #define DX_HASH_HALF_MD4_UNSIGNED 4 | ||
771 | #define DX_HASH_TEA_UNSIGNED 5 | ||
772 | |||
773 | #ifdef __KERNEL__ | ||
774 | |||
775 | /* hash info structure used by the directory hash */ | ||
776 | struct dx_hash_info | ||
777 | { | ||
778 | u32 hash; | ||
779 | u32 minor_hash; | ||
780 | int hash_version; | ||
781 | u32 *seed; | ||
782 | }; | ||
783 | |||
784 | #define EXT3_HTREE_EOF 0x7fffffff | ||
785 | |||
786 | /* | ||
787 | * Control parameters used by ext3_htree_next_block | ||
788 | */ | ||
789 | #define HASH_NB_ALWAYS 1 | ||
790 | |||
791 | |||
792 | /* | ||
793 | * Describe an inode's exact location on disk and in memory | ||
794 | */ | ||
795 | struct ext3_iloc | ||
796 | { | ||
797 | struct buffer_head *bh; | ||
798 | unsigned long offset; | ||
799 | unsigned long block_group; | ||
800 | }; | ||
801 | |||
802 | static inline struct ext3_inode *ext3_raw_inode(struct ext3_iloc *iloc) | ||
803 | { | ||
804 | return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset); | ||
805 | } | ||
806 | |||
807 | /* | ||
808 | * This structure is stuffed into the struct file's private_data field | ||
809 | * for directories. It is where we put information so that we can do | ||
810 | * readdir operations in hash tree order. | ||
811 | */ | ||
812 | struct dir_private_info { | ||
813 | struct rb_root root; | ||
814 | struct rb_node *curr_node; | ||
815 | struct fname *extra_fname; | ||
816 | loff_t last_pos; | ||
817 | __u32 curr_hash; | ||
818 | __u32 curr_minor_hash; | ||
819 | __u32 next_hash; | ||
820 | }; | ||
821 | |||
822 | /* calculate the first block number of the group */ | ||
823 | static inline ext3_fsblk_t | ||
824 | ext3_group_first_block_no(struct super_block *sb, unsigned long group_no) | ||
825 | { | ||
826 | return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) + | ||
827 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block); | ||
828 | } | ||
829 | |||
830 | /* | ||
831 | * Special error return code only used by dx_probe() and its callers. | ||
832 | */ | ||
833 | #define ERR_BAD_DX_DIR -75000 | ||
834 | |||
835 | /* | ||
836 | * Function prototypes | ||
837 | */ | ||
838 | |||
839 | /* | ||
840 | * Ok, these declarations are also in <linux/kernel.h> but none of the | ||
841 | * ext3 source programs needs to include it so they are duplicated here. | ||
842 | */ | ||
843 | # define NORET_TYPE /**/ | ||
844 | # define ATTRIB_NORET __attribute__((noreturn)) | ||
845 | # define NORET_AND noreturn, | ||
846 | |||
847 | /* balloc.c */ | ||
848 | extern int ext3_bg_has_super(struct super_block *sb, int group); | ||
849 | extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); | ||
850 | extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode, | ||
851 | ext3_fsblk_t goal, int *errp); | ||
852 | extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode, | ||
853 | ext3_fsblk_t goal, unsigned long *count, int *errp); | ||
854 | extern void ext3_free_blocks (handle_t *handle, struct inode *inode, | ||
855 | ext3_fsblk_t block, unsigned long count); | ||
856 | extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb, | ||
857 | ext3_fsblk_t block, unsigned long count, | ||
858 | unsigned long *pdquot_freed_blocks); | ||
859 | extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *); | ||
860 | extern void ext3_check_blocks_bitmap (struct super_block *); | ||
861 | extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, | ||
862 | unsigned int block_group, | ||
863 | struct buffer_head ** bh); | ||
864 | extern int ext3_should_retry_alloc(struct super_block *sb, int *retries); | ||
865 | extern void ext3_init_block_alloc_info(struct inode *); | ||
866 | extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv); | ||
867 | extern int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range); | ||
868 | |||
869 | /* dir.c */ | ||
870 | extern int ext3_check_dir_entry(const char *, struct inode *, | ||
871 | struct ext3_dir_entry_2 *, | ||
872 | struct buffer_head *, unsigned long); | ||
873 | extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash, | ||
874 | __u32 minor_hash, | ||
875 | struct ext3_dir_entry_2 *dirent); | ||
876 | extern void ext3_htree_free_dir_info(struct dir_private_info *p); | ||
877 | |||
878 | /* fsync.c */ | ||
879 | extern int ext3_sync_file(struct file *, loff_t, loff_t, int); | ||
880 | |||
881 | /* hash.c */ | ||
882 | extern int ext3fs_dirhash(const char *name, int len, struct | ||
883 | dx_hash_info *hinfo); | ||
884 | |||
885 | /* ialloc.c */ | ||
886 | extern struct inode * ext3_new_inode (handle_t *, struct inode *, | ||
887 | const struct qstr *, int); | ||
888 | extern void ext3_free_inode (handle_t *, struct inode *); | ||
889 | extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); | ||
890 | extern unsigned long ext3_count_free_inodes (struct super_block *); | ||
891 | extern unsigned long ext3_count_dirs (struct super_block *); | ||
892 | extern void ext3_check_inodes_bitmap (struct super_block *); | ||
893 | extern unsigned long ext3_count_free (struct buffer_head *, unsigned); | ||
894 | |||
895 | |||
896 | /* inode.c */ | ||
897 | int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, | ||
898 | struct buffer_head *bh, ext3_fsblk_t blocknr); | ||
899 | struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); | ||
900 | struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); | ||
901 | int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, | ||
902 | sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, | ||
903 | int create); | ||
904 | |||
905 | extern struct inode *ext3_iget(struct super_block *, unsigned long); | ||
906 | extern int ext3_write_inode (struct inode *, struct writeback_control *); | ||
907 | extern int ext3_setattr (struct dentry *, struct iattr *); | ||
908 | extern void ext3_evict_inode (struct inode *); | ||
909 | extern int ext3_sync_inode (handle_t *, struct inode *); | ||
910 | extern void ext3_discard_reservation (struct inode *); | ||
911 | extern void ext3_dirty_inode(struct inode *, int); | ||
912 | extern int ext3_change_inode_journal_flag(struct inode *, int); | ||
913 | extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); | ||
914 | extern int ext3_can_truncate(struct inode *inode); | ||
915 | extern void ext3_truncate(struct inode *inode); | ||
916 | extern void ext3_set_inode_flags(struct inode *); | ||
917 | extern void ext3_get_inode_flags(struct ext3_inode_info *); | ||
918 | extern void ext3_set_aops(struct inode *inode); | ||
919 | extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
920 | u64 start, u64 len); | ||
921 | |||
922 | /* ioctl.c */ | ||
923 | extern long ext3_ioctl(struct file *, unsigned int, unsigned long); | ||
924 | extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long); | ||
925 | |||
926 | /* namei.c */ | ||
927 | extern int ext3_orphan_add(handle_t *, struct inode *); | ||
928 | extern int ext3_orphan_del(handle_t *, struct inode *); | ||
929 | extern int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, | ||
930 | __u32 start_minor_hash, __u32 *next_hash); | ||
931 | |||
932 | /* resize.c */ | ||
933 | extern int ext3_group_add(struct super_block *sb, | ||
934 | struct ext3_new_group_data *input); | ||
935 | extern int ext3_group_extend(struct super_block *sb, | ||
936 | struct ext3_super_block *es, | ||
937 | ext3_fsblk_t n_blocks_count); | ||
938 | |||
939 | /* super.c */ | ||
940 | extern void ext3_error (struct super_block *, const char *, const char *, ...) | ||
941 | __attribute__ ((format (printf, 3, 4))); | ||
942 | extern void __ext3_std_error (struct super_block *, const char *, int); | ||
943 | extern void ext3_abort (struct super_block *, const char *, const char *, ...) | ||
944 | __attribute__ ((format (printf, 3, 4))); | ||
945 | extern void ext3_warning (struct super_block *, const char *, const char *, ...) | ||
946 | __attribute__ ((format (printf, 3, 4))); | ||
947 | extern void ext3_msg(struct super_block *, const char *, const char *, ...) | ||
948 | __attribute__ ((format (printf, 3, 4))); | ||
949 | extern void ext3_update_dynamic_rev (struct super_block *sb); | ||
950 | |||
951 | #define ext3_std_error(sb, errno) \ | ||
952 | do { \ | ||
953 | if ((errno)) \ | ||
954 | __ext3_std_error((sb), __func__, (errno)); \ | ||
955 | } while (0) | ||
956 | |||
957 | /* | ||
958 | * Inodes and files operations | ||
959 | */ | ||
960 | |||
961 | /* dir.c */ | ||
962 | extern const struct file_operations ext3_dir_operations; | ||
963 | |||
964 | /* file.c */ | ||
965 | extern const struct inode_operations ext3_file_inode_operations; | ||
966 | extern const struct file_operations ext3_file_operations; | ||
967 | |||
968 | /* namei.c */ | ||
969 | extern const struct inode_operations ext3_dir_inode_operations; | ||
970 | extern const struct inode_operations ext3_special_inode_operations; | ||
971 | |||
972 | /* symlink.c */ | ||
973 | extern const struct inode_operations ext3_symlink_inode_operations; | ||
974 | extern const struct inode_operations ext3_fast_symlink_inode_operations; | ||
975 | |||
976 | |||
977 | #endif /* __KERNEL__ */ | ||
978 | |||
979 | #endif /* _LINUX_EXT3_FS_H */ | ||
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h new file mode 100644 index 00000000000..f42c098aed8 --- /dev/null +++ b/include/linux/ext3_fs_i.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs_i.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_i.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_I | ||
17 | #define _LINUX_EXT3_FS_I | ||
18 | |||
19 | #include <linux/rwsem.h> | ||
20 | #include <linux/rbtree.h> | ||
21 | #include <linux/seqlock.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | /* data type for block offset of block group */ | ||
25 | typedef int ext3_grpblk_t; | ||
26 | |||
27 | /* data type for filesystem-wide blocks number */ | ||
28 | typedef unsigned long ext3_fsblk_t; | ||
29 | |||
30 | #define E3FSBLK "%lu" | ||
31 | |||
32 | struct ext3_reserve_window { | ||
33 | ext3_fsblk_t _rsv_start; /* First byte reserved */ | ||
34 | ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
35 | }; | ||
36 | |||
37 | struct ext3_reserve_window_node { | ||
38 | struct rb_node rsv_node; | ||
39 | __u32 rsv_goal_size; | ||
40 | __u32 rsv_alloc_hit; | ||
41 | struct ext3_reserve_window rsv_window; | ||
42 | }; | ||
43 | |||
44 | struct ext3_block_alloc_info { | ||
45 | /* information about reservation window */ | ||
46 | struct ext3_reserve_window_node rsv_window_node; | ||
47 | /* | ||
48 | * was i_next_alloc_block in ext3_inode_info | ||
49 | * is the logical (file-relative) number of the | ||
50 | * most-recently-allocated block in this file. | ||
51 | * We use this for detecting linearly ascending allocation requests. | ||
52 | */ | ||
53 | __u32 last_alloc_logical_block; | ||
54 | /* | ||
55 | * Was i_next_alloc_goal in ext3_inode_info | ||
56 | * is the *physical* companion to i_next_alloc_block. | ||
57 | * it the physical block number of the block which was most-recentl | ||
58 | * allocated to this file. This give us the goal (target) for the next | ||
59 | * allocation when we detect linearly ascending requests. | ||
60 | */ | ||
61 | ext3_fsblk_t last_alloc_physical_block; | ||
62 | }; | ||
63 | |||
64 | #define rsv_start rsv_window._rsv_start | ||
65 | #define rsv_end rsv_window._rsv_end | ||
66 | |||
67 | /* | ||
68 | * third extended file system inode data in memory | ||
69 | */ | ||
70 | struct ext3_inode_info { | ||
71 | __le32 i_data[15]; /* unconverted */ | ||
72 | __u32 i_flags; | ||
73 | #ifdef EXT3_FRAGMENTS | ||
74 | __u32 i_faddr; | ||
75 | __u8 i_frag_no; | ||
76 | __u8 i_frag_size; | ||
77 | #endif | ||
78 | ext3_fsblk_t i_file_acl; | ||
79 | __u32 i_dir_acl; | ||
80 | __u32 i_dtime; | ||
81 | |||
82 | /* | ||
83 | * i_block_group is the number of the block group which contains | ||
84 | * this file's inode. Constant across the lifetime of the inode, | ||
85 | * it is ued for making block allocation decisions - we try to | ||
86 | * place a file's data blocks near its inode block, and new inodes | ||
87 | * near to their parent directory's inode. | ||
88 | */ | ||
89 | __u32 i_block_group; | ||
90 | unsigned long i_state_flags; /* Dynamic state flags for ext3 */ | ||
91 | |||
92 | /* block reservation info */ | ||
93 | struct ext3_block_alloc_info *i_block_alloc_info; | ||
94 | |||
95 | __u32 i_dir_start_lookup; | ||
96 | #ifdef CONFIG_EXT3_FS_XATTR | ||
97 | /* | ||
98 | * Extended attributes can be read independently of the main file | ||
99 | * data. Taking i_mutex even when reading would cause contention | ||
100 | * between readers of EAs and writers of regular file data, so | ||
101 | * instead we synchronize on xattr_sem when reading or changing | ||
102 | * EAs. | ||
103 | */ | ||
104 | struct rw_semaphore xattr_sem; | ||
105 | #endif | ||
106 | |||
107 | struct list_head i_orphan; /* unlinked but open inodes */ | ||
108 | |||
109 | /* | ||
110 | * i_disksize keeps track of what the inode size is ON DISK, not | ||
111 | * in memory. During truncate, i_size is set to the new size by | ||
112 | * the VFS prior to calling ext3_truncate(), but the filesystem won't | ||
113 | * set i_disksize to 0 until the truncate is actually under way. | ||
114 | * | ||
115 | * The intent is that i_disksize always represents the blocks which | ||
116 | * are used by this file. This allows recovery to restart truncate | ||
117 | * on orphans if we crash during truncate. We actually write i_disksize | ||
118 | * into the on-disk inode when writing inodes out, instead of i_size. | ||
119 | * | ||
120 | * The only time when i_disksize and i_size may be different is when | ||
121 | * a truncate is in progress. The only things which change i_disksize | ||
122 | * are ext3_get_block (growth) and ext3_truncate (shrinkth). | ||
123 | */ | ||
124 | loff_t i_disksize; | ||
125 | |||
126 | /* on-disk additional length */ | ||
127 | __u16 i_extra_isize; | ||
128 | |||
129 | /* | ||
130 | * truncate_mutex is for serialising ext3_truncate() against | ||
131 | * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's | ||
132 | * data tree are chopped off during truncate. We can't do that in | ||
133 | * ext3 because whenever we perform intermediate commits during | ||
134 | * truncate, the inode and all the metadata blocks *must* be in a | ||
135 | * consistent state which allows truncation of the orphans to restart | ||
136 | * during recovery. Hence we must fix the get_block-vs-truncate race | ||
137 | * by other means, so we have truncate_mutex. | ||
138 | */ | ||
139 | struct mutex truncate_mutex; | ||
140 | |||
141 | /* | ||
142 | * Transactions that contain inode's metadata needed to complete | ||
143 | * fsync and fdatasync, respectively. | ||
144 | */ | ||
145 | atomic_t i_sync_tid; | ||
146 | atomic_t i_datasync_tid; | ||
147 | |||
148 | struct inode vfs_inode; | ||
149 | }; | ||
150 | |||
151 | #endif /* _LINUX_EXT3_FS_I */ | ||
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h new file mode 100644 index 00000000000..258088ab3c6 --- /dev/null +++ b/include/linux/ext3_fs_sb.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_SB | ||
17 | #define _LINUX_EXT3_FS_SB | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/wait.h> | ||
22 | #include <linux/blockgroup_lock.h> | ||
23 | #include <linux/percpu_counter.h> | ||
24 | #endif | ||
25 | #include <linux/rbtree.h> | ||
26 | |||
27 | /* | ||
28 | * third extended-fs super-block data in memory | ||
29 | */ | ||
30 | struct ext3_sb_info { | ||
31 | unsigned long s_frag_size; /* Size of a fragment in bytes */ | ||
32 | unsigned long s_frags_per_block;/* Number of fragments per block */ | ||
33 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
34 | unsigned long s_frags_per_group;/* Number of fragments in a group */ | ||
35 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
36 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
37 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
38 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
39 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
40 | unsigned long s_groups_count; /* Number of groups in the fs */ | ||
41 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
42 | unsigned long s_blocks_last; /* Last seen block count */ | ||
43 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
44 | struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
45 | struct buffer_head ** s_group_desc; | ||
46 | unsigned long s_mount_opt; | ||
47 | ext3_fsblk_t s_sb_block; | ||
48 | uid_t s_resuid; | ||
49 | gid_t s_resgid; | ||
50 | unsigned short s_mount_state; | ||
51 | unsigned short s_pad; | ||
52 | int s_addr_per_block_bits; | ||
53 | int s_desc_per_block_bits; | ||
54 | int s_inode_size; | ||
55 | int s_first_ino; | ||
56 | spinlock_t s_next_gen_lock; | ||
57 | u32 s_next_generation; | ||
58 | u32 s_hash_seed[4]; | ||
59 | int s_def_hash_version; | ||
60 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | ||
61 | struct percpu_counter s_freeblocks_counter; | ||
62 | struct percpu_counter s_freeinodes_counter; | ||
63 | struct percpu_counter s_dirs_counter; | ||
64 | struct blockgroup_lock *s_blockgroup_lock; | ||
65 | |||
66 | /* root of the per fs reservation window tree */ | ||
67 | spinlock_t s_rsv_window_lock; | ||
68 | struct rb_root s_rsv_window_root; | ||
69 | struct ext3_reserve_window_node s_rsv_window_head; | ||
70 | |||
71 | /* Journaling */ | ||
72 | struct inode * s_journal_inode; | ||
73 | struct journal_s * s_journal; | ||
74 | struct list_head s_orphan; | ||
75 | struct mutex s_orphan_lock; | ||
76 | struct mutex s_resize_lock; | ||
77 | unsigned long s_commit_interval; | ||
78 | struct block_device *journal_bdev; | ||
79 | #ifdef CONFIG_JBD_DEBUG | ||
80 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ | ||
81 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ | ||
82 | #endif | ||
83 | #ifdef CONFIG_QUOTA | ||
84 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
85 | int s_jquota_fmt; /* Format of quota to use */ | ||
86 | #endif | ||
87 | }; | ||
88 | |||
89 | static inline spinlock_t * | ||
90 | sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group) | ||
91 | { | ||
92 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
93 | } | ||
94 | |||
95 | #endif /* _LINUX_EXT3_FS_SB */ | ||
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h new file mode 100644 index 00000000000..d7b5ddca99c --- /dev/null +++ b/include/linux/ext3_jbd.h | |||
@@ -0,0 +1,229 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_jbd.h | ||
3 | * | ||
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 | ||
5 | * | ||
6 | * Copyright 1998--1999 Red Hat corp --- All Rights Reserved | ||
7 | * | ||
8 | * This file is part of the Linux kernel and is made available under | ||
9 | * the terms of the GNU General Public License, version 2, or at your | ||
10 | * option, any later version, incorporated herein by reference. | ||
11 | * | ||
12 | * Ext3-specific journaling extensions. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_EXT3_JBD_H | ||
16 | #define _LINUX_EXT3_JBD_H | ||
17 | |||
18 | #include <linux/fs.h> | ||
19 | #include <linux/jbd.h> | ||
20 | #include <linux/ext3_fs.h> | ||
21 | |||
22 | #define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal) | ||
23 | |||
24 | /* Define the number of blocks we need to account to a transaction to | ||
25 | * modify one block of data. | ||
26 | * | ||
27 | * We may have to touch one inode, one bitmap buffer, up to three | ||
28 | * indirection blocks, the group and superblock summaries, and the data | ||
29 | * block to complete the transaction. */ | ||
30 | |||
31 | #define EXT3_SINGLEDATA_TRANS_BLOCKS 8U | ||
32 | |||
33 | /* Extended attribute operations touch at most two data buffers, | ||
34 | * two bitmap buffers, and two group summaries, in addition to the inode | ||
35 | * and the superblock, which are already accounted for. */ | ||
36 | |||
37 | #define EXT3_XATTR_TRANS_BLOCKS 6U | ||
38 | |||
39 | /* Define the minimum size for a transaction which modifies data. This | ||
40 | * needs to take into account the fact that we may end up modifying two | ||
41 | * quota files too (one for the group, one for the user quota). The | ||
42 | * superblock only gets updated once, of course, so don't bother | ||
43 | * counting that again for the quota updates. */ | ||
44 | |||
45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | ||
46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | ||
47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) | ||
48 | |||
49 | /* Delete operations potentially hit one directory's namespace plus an | ||
50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | ||
51 | * generous. We can grow the delete transaction later if necessary. */ | ||
52 | |||
53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) | ||
54 | |||
55 | /* Define an arbitrary limit for the amount of data we will anticipate | ||
56 | * writing to any given transaction. For unbounded transactions such as | ||
57 | * write(2) and truncate(2) we can write more than this, but we always | ||
58 | * start off at the maximum transaction size and grow the transaction | ||
59 | * optimistically as we go. */ | ||
60 | |||
61 | #define EXT3_MAX_TRANS_DATA 64U | ||
62 | |||
63 | /* We break up a large truncate or write transaction once the handle's | ||
64 | * buffer credits gets this low, we need either to extend the | ||
65 | * transaction or to start a new one. Reserve enough space here for | ||
66 | * inode, bitmap, superblock, group and indirection updates for at least | ||
67 | * one block, plus two quota updates. Quota allocations are not | ||
68 | * needed. */ | ||
69 | |||
70 | #define EXT3_RESERVE_TRANS_BLOCKS 12U | ||
71 | |||
72 | #define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8 | ||
73 | |||
74 | #ifdef CONFIG_QUOTA | ||
75 | /* Amount of blocks needed for quota update - we know that the structure was | ||
76 | * allocated so we need to update only inode+data */ | ||
77 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) | ||
78 | /* Amount of blocks needed for quota insert/delete - we do some block writes | ||
79 | * but inode, sb and group updates are done only once */ | ||
80 | #define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ | ||
81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) | ||
82 | #define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
83 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
84 | #else | ||
85 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 | ||
86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | ||
87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | ||
88 | #endif | ||
89 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
90 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
91 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
92 | |||
93 | int | ||
94 | ext3_mark_iloc_dirty(handle_t *handle, | ||
95 | struct inode *inode, | ||
96 | struct ext3_iloc *iloc); | ||
97 | |||
98 | /* | ||
99 | * On success, We end up with an outstanding reference count against | ||
100 | * iloc->bh. This _must_ be cleaned up later. | ||
101 | */ | ||
102 | |||
103 | int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, | ||
104 | struct ext3_iloc *iloc); | ||
105 | |||
106 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); | ||
107 | |||
108 | /* | ||
109 | * Wrapper functions with which ext3 calls into JBD. The intent here is | ||
110 | * to allow these to be turned into appropriate stubs so ext3 can control | ||
111 | * ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't | ||
112 | * been done yet. | ||
113 | */ | ||
114 | |||
115 | static inline void ext3_journal_release_buffer(handle_t *handle, | ||
116 | struct buffer_head *bh) | ||
117 | { | ||
118 | journal_release_buffer(handle, bh); | ||
119 | } | ||
120 | |||
121 | void ext3_journal_abort_handle(const char *caller, const char *err_fn, | ||
122 | struct buffer_head *bh, handle_t *handle, int err); | ||
123 | |||
124 | int __ext3_journal_get_undo_access(const char *where, handle_t *handle, | ||
125 | struct buffer_head *bh); | ||
126 | |||
127 | int __ext3_journal_get_write_access(const char *where, handle_t *handle, | ||
128 | struct buffer_head *bh); | ||
129 | |||
130 | int __ext3_journal_forget(const char *where, handle_t *handle, | ||
131 | struct buffer_head *bh); | ||
132 | |||
133 | int __ext3_journal_revoke(const char *where, handle_t *handle, | ||
134 | unsigned long blocknr, struct buffer_head *bh); | ||
135 | |||
136 | int __ext3_journal_get_create_access(const char *where, | ||
137 | handle_t *handle, struct buffer_head *bh); | ||
138 | |||
139 | int __ext3_journal_dirty_metadata(const char *where, | ||
140 | handle_t *handle, struct buffer_head *bh); | ||
141 | |||
142 | #define ext3_journal_get_undo_access(handle, bh) \ | ||
143 | __ext3_journal_get_undo_access(__func__, (handle), (bh)) | ||
144 | #define ext3_journal_get_write_access(handle, bh) \ | ||
145 | __ext3_journal_get_write_access(__func__, (handle), (bh)) | ||
146 | #define ext3_journal_revoke(handle, blocknr, bh) \ | ||
147 | __ext3_journal_revoke(__func__, (handle), (blocknr), (bh)) | ||
148 | #define ext3_journal_get_create_access(handle, bh) \ | ||
149 | __ext3_journal_get_create_access(__func__, (handle), (bh)) | ||
150 | #define ext3_journal_dirty_metadata(handle, bh) \ | ||
151 | __ext3_journal_dirty_metadata(__func__, (handle), (bh)) | ||
152 | #define ext3_journal_forget(handle, bh) \ | ||
153 | __ext3_journal_forget(__func__, (handle), (bh)) | ||
154 | |||
155 | int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); | ||
156 | |||
157 | handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks); | ||
158 | int __ext3_journal_stop(const char *where, handle_t *handle); | ||
159 | |||
160 | static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) | ||
161 | { | ||
162 | return ext3_journal_start_sb(inode->i_sb, nblocks); | ||
163 | } | ||
164 | |||
165 | #define ext3_journal_stop(handle) \ | ||
166 | __ext3_journal_stop(__func__, (handle)) | ||
167 | |||
168 | static inline handle_t *ext3_journal_current_handle(void) | ||
169 | { | ||
170 | return journal_current_handle(); | ||
171 | } | ||
172 | |||
173 | static inline int ext3_journal_extend(handle_t *handle, int nblocks) | ||
174 | { | ||
175 | return journal_extend(handle, nblocks); | ||
176 | } | ||
177 | |||
178 | static inline int ext3_journal_restart(handle_t *handle, int nblocks) | ||
179 | { | ||
180 | return journal_restart(handle, nblocks); | ||
181 | } | ||
182 | |||
183 | static inline int ext3_journal_blocks_per_page(struct inode *inode) | ||
184 | { | ||
185 | return journal_blocks_per_page(inode); | ||
186 | } | ||
187 | |||
188 | static inline int ext3_journal_force_commit(journal_t *journal) | ||
189 | { | ||
190 | return journal_force_commit(journal); | ||
191 | } | ||
192 | |||
193 | /* super.c */ | ||
194 | int ext3_force_commit(struct super_block *sb); | ||
195 | |||
196 | static inline int ext3_should_journal_data(struct inode *inode) | ||
197 | { | ||
198 | if (!S_ISREG(inode->i_mode)) | ||
199 | return 1; | ||
200 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | ||
201 | return 1; | ||
202 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
203 | return 1; | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static inline int ext3_should_order_data(struct inode *inode) | ||
208 | { | ||
209 | if (!S_ISREG(inode->i_mode)) | ||
210 | return 0; | ||
211 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
212 | return 0; | ||
213 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
214 | return 1; | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static inline int ext3_should_writeback_data(struct inode *inode) | ||
219 | { | ||
220 | if (!S_ISREG(inode->i_mode)) | ||
221 | return 0; | ||
222 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
223 | return 0; | ||
224 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
225 | return 1; | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | #endif /* _LINUX_EXT3_JBD_H */ | ||
diff --git a/include/linux/fadvise.h b/include/linux/fadvise.h new file mode 100644 index 00000000000..e8e747139b9 --- /dev/null +++ b/include/linux/fadvise.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef FADVISE_H_INCLUDED | ||
2 | #define FADVISE_H_INCLUDED | ||
3 | |||
4 | #define POSIX_FADV_NORMAL 0 /* No further special treatment. */ | ||
5 | #define POSIX_FADV_RANDOM 1 /* Expect random page references. */ | ||
6 | #define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ | ||
7 | #define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ | ||
8 | |||
9 | /* | ||
10 | * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE | ||
11 | * for s390-64 differ from the values for the rest of the world. | ||
12 | */ | ||
13 | #if defined(__s390x__) | ||
14 | #define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ | ||
15 | #define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ | ||
16 | #else | ||
17 | #define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ | ||
18 | #define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ | ||
19 | #endif | ||
20 | |||
21 | #endif /* FADVISE_H_INCLUDED */ | ||
diff --git a/include/linux/fdreg.h b/include/linux/fdreg.h new file mode 100644 index 00000000000..61ce6416900 --- /dev/null +++ b/include/linux/fdreg.h | |||
@@ -0,0 +1,137 @@ | |||
1 | #ifndef _LINUX_FDREG_H | ||
2 | #define _LINUX_FDREG_H | ||
3 | /* | ||
4 | * This file contains some defines for the floppy disk controller. | ||
5 | * Various sources. Mostly "IBM Microcomputers: A Programmers | ||
6 | * Handbook", Sanches and Canton. | ||
7 | */ | ||
8 | |||
9 | #ifdef FDPATCHES | ||
10 | #define FD_IOPORT fdc_state[fdc].address | ||
11 | #else | ||
12 | /* It would be a lot saner just to force fdc_state[fdc].address to always | ||
13 | be set ! FIXME */ | ||
14 | #define FD_IOPORT 0x3f0 | ||
15 | #endif | ||
16 | |||
17 | /* Fd controller regs. S&C, about page 340 */ | ||
18 | #define FD_STATUS (4 + FD_IOPORT ) | ||
19 | #define FD_DATA (5 + FD_IOPORT ) | ||
20 | |||
21 | /* Digital Output Register */ | ||
22 | #define FD_DOR (2 + FD_IOPORT ) | ||
23 | |||
24 | /* Digital Input Register (read) */ | ||
25 | #define FD_DIR (7 + FD_IOPORT ) | ||
26 | |||
27 | /* Diskette Control Register (write)*/ | ||
28 | #define FD_DCR (7 + FD_IOPORT ) | ||
29 | |||
30 | /* Bits of main status register */ | ||
31 | #define STATUS_BUSYMASK 0x0F /* drive busy mask */ | ||
32 | #define STATUS_BUSY 0x10 /* FDC busy */ | ||
33 | #define STATUS_DMA 0x20 /* 0- DMA mode */ | ||
34 | #define STATUS_DIR 0x40 /* 0- cpu->fdc */ | ||
35 | #define STATUS_READY 0x80 /* Data reg ready */ | ||
36 | |||
37 | /* Bits of FD_ST0 */ | ||
38 | #define ST0_DS 0x03 /* drive select mask */ | ||
39 | #define ST0_HA 0x04 /* Head (Address) */ | ||
40 | #define ST0_NR 0x08 /* Not Ready */ | ||
41 | #define ST0_ECE 0x10 /* Equipment check error */ | ||
42 | #define ST0_SE 0x20 /* Seek end */ | ||
43 | #define ST0_INTR 0xC0 /* Interrupt code mask */ | ||
44 | |||
45 | /* Bits of FD_ST1 */ | ||
46 | #define ST1_MAM 0x01 /* Missing Address Mark */ | ||
47 | #define ST1_WP 0x02 /* Write Protect */ | ||
48 | #define ST1_ND 0x04 /* No Data - unreadable */ | ||
49 | #define ST1_OR 0x10 /* OverRun */ | ||
50 | #define ST1_CRC 0x20 /* CRC error in data or addr */ | ||
51 | #define ST1_EOC 0x80 /* End Of Cylinder */ | ||
52 | |||
53 | /* Bits of FD_ST2 */ | ||
54 | #define ST2_MAM 0x01 /* Missing Address Mark (again) */ | ||
55 | #define ST2_BC 0x02 /* Bad Cylinder */ | ||
56 | #define ST2_SNS 0x04 /* Scan Not Satisfied */ | ||
57 | #define ST2_SEH 0x08 /* Scan Equal Hit */ | ||
58 | #define ST2_WC 0x10 /* Wrong Cylinder */ | ||
59 | #define ST2_CRC 0x20 /* CRC error in data field */ | ||
60 | #define ST2_CM 0x40 /* Control Mark = deleted */ | ||
61 | |||
62 | /* Bits of FD_ST3 */ | ||
63 | #define ST3_HA 0x04 /* Head (Address) */ | ||
64 | #define ST3_DS 0x08 /* drive is double-sided */ | ||
65 | #define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */ | ||
66 | #define ST3_RY 0x20 /* drive is ready */ | ||
67 | #define ST3_WP 0x40 /* Write Protect */ | ||
68 | #define ST3_FT 0x80 /* Drive Fault */ | ||
69 | |||
70 | /* Values for FD_COMMAND */ | ||
71 | #define FD_RECALIBRATE 0x07 /* move to track 0 */ | ||
72 | #define FD_SEEK 0x0F /* seek track */ | ||
73 | #define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */ | ||
74 | #define FD_WRITE 0xC5 /* write with MT, MFM */ | ||
75 | #define FD_SENSEI 0x08 /* Sense Interrupt Status */ | ||
76 | #define FD_SPECIFY 0x03 /* specify HUT etc */ | ||
77 | #define FD_FORMAT 0x4D /* format one track */ | ||
78 | #define FD_VERSION 0x10 /* get version code */ | ||
79 | #define FD_CONFIGURE 0x13 /* configure FIFO operation */ | ||
80 | #define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */ | ||
81 | #define FD_GETSTATUS 0x04 /* read ST3 */ | ||
82 | #define FD_DUMPREGS 0x0E /* dump the contents of the fdc regs */ | ||
83 | #define FD_READID 0xEA /* prints the header of a sector */ | ||
84 | #define FD_UNLOCK 0x14 /* Fifo config unlock */ | ||
85 | #define FD_LOCK 0x94 /* Fifo config lock */ | ||
86 | #define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */ | ||
87 | #define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */ | ||
88 | |||
89 | /* the following commands are new in the 82078. They are not used in the | ||
90 | * floppy driver, except the first three. These commands may be useful for apps | ||
91 | * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at | ||
92 | * http://www.intel.com/design/archives/periphrl/docs/29046803.htm */ | ||
93 | |||
94 | #define FD_PARTID 0x18 /* part id ("extended" version cmd) */ | ||
95 | #define FD_SAVE 0x2e /* save fdc regs for later restore */ | ||
96 | #define FD_DRIVESPEC 0x8e /* drive specification: Access to the | ||
97 | * 2 Mbps data transfer rate for tape | ||
98 | * drives */ | ||
99 | |||
100 | #define FD_RESTORE 0x4e /* later restore */ | ||
101 | #define FD_POWERDOWN 0x27 /* configure FDC's powersave features */ | ||
102 | #define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */ | ||
103 | #define FD_OPTION 0x33 /* ISO format (which is a clean way to | ||
104 | * pack more sectors on a track) */ | ||
105 | |||
106 | /* DMA commands */ | ||
107 | #define DMA_READ 0x46 | ||
108 | #define DMA_WRITE 0x4A | ||
109 | |||
110 | /* FDC version return types */ | ||
111 | #define FDC_NONE 0x00 | ||
112 | #define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION | ||
113 | FAILS EARLY */ | ||
114 | #define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */ | ||
115 | #define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */ | ||
116 | #define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */ | ||
117 | #define FDC_82072A 0x45 /* 82072A (on Sparcs) */ | ||
118 | #define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */ | ||
119 | #define FDC_82077 0x52 /* 82077AA-1 */ | ||
120 | #define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */ | ||
121 | #define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */ | ||
122 | #define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */ | ||
123 | #define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB | ||
124 | * SCSI/EIDE/Floppy controller) */ | ||
125 | #define FDC_87306 0x63 /* National Semiconductor PC 87306 */ | ||
126 | |||
127 | /* | ||
128 | * Beware: the fdc type list is roughly sorted by increasing features. | ||
129 | * Presence of features is tested by comparing the FDC version id with the | ||
130 | * "oldest" version that has the needed feature. | ||
131 | * If during FDC detection, an obscure test fails late in the sequence, don't | ||
132 | * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse. | ||
133 | * This is especially true if the tests are unneeded. | ||
134 | */ | ||
135 | |||
136 | #define FD_RESET_DELAY 20 | ||
137 | #endif | ||
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h new file mode 100644 index 00000000000..51da65b68b8 --- /dev/null +++ b/include/linux/fib_rules.h | |||
@@ -0,0 +1,72 @@ | |||
1 | #ifndef __LINUX_FIB_RULES_H | ||
2 | #define __LINUX_FIB_RULES_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/rtnetlink.h> | ||
6 | |||
7 | /* rule is permanent, and cannot be deleted */ | ||
8 | #define FIB_RULE_PERMANENT 0x00000001 | ||
9 | #define FIB_RULE_INVERT 0x00000002 | ||
10 | #define FIB_RULE_UNRESOLVED 0x00000004 | ||
11 | #define FIB_RULE_IIF_DETACHED 0x00000008 | ||
12 | #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED | ||
13 | #define FIB_RULE_OIF_DETACHED 0x00000010 | ||
14 | |||
15 | /* try to find source address in routing lookups */ | ||
16 | #define FIB_RULE_FIND_SADDR 0x00010000 | ||
17 | |||
18 | struct fib_rule_hdr { | ||
19 | __u8 family; | ||
20 | __u8 dst_len; | ||
21 | __u8 src_len; | ||
22 | __u8 tos; | ||
23 | |||
24 | __u8 table; | ||
25 | __u8 res1; /* reserved */ | ||
26 | __u8 res2; /* reserved */ | ||
27 | __u8 action; | ||
28 | |||
29 | __u32 flags; | ||
30 | }; | ||
31 | |||
32 | enum { | ||
33 | FRA_UNSPEC, | ||
34 | FRA_DST, /* destination address */ | ||
35 | FRA_SRC, /* source address */ | ||
36 | FRA_IIFNAME, /* interface name */ | ||
37 | #define FRA_IFNAME FRA_IIFNAME | ||
38 | FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ | ||
39 | FRA_UNUSED2, | ||
40 | FRA_PRIORITY, /* priority/preference */ | ||
41 | FRA_UNUSED3, | ||
42 | FRA_UNUSED4, | ||
43 | FRA_UNUSED5, | ||
44 | FRA_FWMARK, /* mark */ | ||
45 | FRA_FLOW, /* flow/class id */ | ||
46 | FRA_UNUSED6, | ||
47 | FRA_UNUSED7, | ||
48 | FRA_UNUSED8, | ||
49 | FRA_TABLE, /* Extended table id */ | ||
50 | FRA_FWMASK, /* mask for netfilter mark */ | ||
51 | FRA_OIFNAME, | ||
52 | __FRA_MAX | ||
53 | }; | ||
54 | |||
55 | #define FRA_MAX (__FRA_MAX - 1) | ||
56 | |||
57 | enum { | ||
58 | FR_ACT_UNSPEC, | ||
59 | FR_ACT_TO_TBL, /* Pass to fixed table */ | ||
60 | FR_ACT_GOTO, /* Jump to another rule */ | ||
61 | FR_ACT_NOP, /* No operation */ | ||
62 | FR_ACT_RES3, | ||
63 | FR_ACT_RES4, | ||
64 | FR_ACT_BLACKHOLE, /* Drop without notification */ | ||
65 | FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ | ||
66 | FR_ACT_PROHIBIT, /* Drop with EACCES */ | ||
67 | __FR_ACT_MAX, | ||
68 | }; | ||
69 | |||
70 | #define FR_ACT_MAX (__FR_ACT_MAX - 1) | ||
71 | |||
72 | #endif | ||
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h new file mode 100644 index 00000000000..d830747f5c0 --- /dev/null +++ b/include/linux/fiemap.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * FS_IOC_FIEMAP ioctl infrastructure. | ||
3 | * | ||
4 | * Some portions copyright (C) 2007 Cluster File Systems, Inc | ||
5 | * | ||
6 | * Authors: Mark Fasheh <mfasheh@suse.com> | ||
7 | * Kalpak Shah <kalpak.shah@sun.com> | ||
8 | * Andreas Dilger <adilger@sun.com> | ||
9 | */ | ||
10 | |||
11 | #ifndef _LINUX_FIEMAP_H | ||
12 | #define _LINUX_FIEMAP_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | struct fiemap_extent { | ||
17 | __u64 fe_logical; /* logical offset in bytes for the start of | ||
18 | * the extent from the beginning of the file */ | ||
19 | __u64 fe_physical; /* physical offset in bytes for the start | ||
20 | * of the extent from the beginning of the disk */ | ||
21 | __u64 fe_length; /* length in bytes for this extent */ | ||
22 | __u64 fe_reserved64[2]; | ||
23 | __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ | ||
24 | __u32 fe_reserved[3]; | ||
25 | }; | ||
26 | |||
27 | struct fiemap { | ||
28 | __u64 fm_start; /* logical offset (inclusive) at | ||
29 | * which to start mapping (in) */ | ||
30 | __u64 fm_length; /* logical length of mapping which | ||
31 | * userspace wants (in) */ | ||
32 | __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ | ||
33 | __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ | ||
34 | __u32 fm_extent_count; /* size of fm_extents array (in) */ | ||
35 | __u32 fm_reserved; | ||
36 | struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ | ||
37 | }; | ||
38 | |||
39 | #define FIEMAP_MAX_OFFSET (~0ULL) | ||
40 | |||
41 | #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ | ||
42 | #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ | ||
43 | |||
44 | #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) | ||
45 | |||
46 | #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ | ||
47 | #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ | ||
48 | #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. | ||
49 | * Sets EXTENT_UNKNOWN. */ | ||
50 | #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read | ||
51 | * while fs is unmounted */ | ||
52 | #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. | ||
53 | * Sets EXTENT_NO_BYPASS. */ | ||
54 | #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be | ||
55 | * block aligned. */ | ||
56 | #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. | ||
57 | * Sets EXTENT_NOT_ALIGNED.*/ | ||
58 | #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. | ||
59 | * Sets EXTENT_NOT_ALIGNED.*/ | ||
60 | #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but | ||
61 | * no data (i.e. zero). */ | ||
62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | ||
63 | * support extents. Result | ||
64 | * merged for efficiency. */ | ||
65 | #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other | ||
66 | * files. */ | ||
67 | |||
68 | #endif /* _LINUX_FIEMAP_H */ | ||
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h new file mode 100644 index 00000000000..357dbfc2829 --- /dev/null +++ b/include/linux/firewire-cdev.h | |||
@@ -0,0 +1,1010 @@ | |||
1 | /* | ||
2 | * Char device interface. | ||
3 | * | ||
4 | * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the next | ||
14 | * paragraph) shall be included in all copies or substantial portions of the | ||
15 | * Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | * DEALINGS IN THE SOFTWARE. | ||
24 | */ | ||
25 | |||
26 | #ifndef _LINUX_FIREWIRE_CDEV_H | ||
27 | #define _LINUX_FIREWIRE_CDEV_H | ||
28 | |||
29 | #include <linux/ioctl.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/firewire-constants.h> | ||
32 | |||
33 | /* available since kernel version 2.6.22 */ | ||
34 | #define FW_CDEV_EVENT_BUS_RESET 0x00 | ||
35 | #define FW_CDEV_EVENT_RESPONSE 0x01 | ||
36 | #define FW_CDEV_EVENT_REQUEST 0x02 | ||
37 | #define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 | ||
38 | |||
39 | /* available since kernel version 2.6.30 */ | ||
40 | #define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 | ||
41 | #define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 | ||
42 | |||
43 | /* available since kernel version 2.6.36 */ | ||
44 | #define FW_CDEV_EVENT_REQUEST2 0x06 | ||
45 | #define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07 | ||
46 | #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08 | ||
47 | #define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09 | ||
48 | |||
49 | /** | ||
50 | * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types | ||
51 | * @closure: For arbitrary use by userspace | ||
52 | * @type: Discriminates the fw_cdev_event_ types | ||
53 | * | ||
54 | * This struct may be used to access generic members of all fw_cdev_event_ | ||
55 | * types regardless of the specific type. | ||
56 | * | ||
57 | * Data passed in the @closure field for a request will be returned in the | ||
58 | * corresponding event. It is big enough to hold a pointer on all platforms. | ||
59 | * The ioctl used to set @closure depends on the @type of event. | ||
60 | */ | ||
61 | struct fw_cdev_event_common { | ||
62 | __u64 closure; | ||
63 | __u32 type; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred | ||
68 | * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl | ||
69 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET | ||
70 | * @node_id: New node ID of this node | ||
71 | * @local_node_id: Node ID of the local node, i.e. of the controller | ||
72 | * @bm_node_id: Node ID of the bus manager | ||
73 | * @irm_node_id: Node ID of the iso resource manager | ||
74 | * @root_node_id: Node ID of the root node | ||
75 | * @generation: New bus generation | ||
76 | * | ||
77 | * This event is sent when the bus the device belongs to goes through a bus | ||
78 | * reset. It provides information about the new bus configuration, such as | ||
79 | * new node ID for this device, new root ID, and others. | ||
80 | * | ||
81 | * If @bm_node_id is 0xffff right after bus reset it can be reread by an | ||
82 | * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished. | ||
83 | * Kernels with ABI version < 4 do not set @bm_node_id. | ||
84 | */ | ||
85 | struct fw_cdev_event_bus_reset { | ||
86 | __u64 closure; | ||
87 | __u32 type; | ||
88 | __u32 node_id; | ||
89 | __u32 local_node_id; | ||
90 | __u32 bm_node_id; | ||
91 | __u32 irm_node_id; | ||
92 | __u32 root_node_id; | ||
93 | __u32 generation; | ||
94 | }; | ||
95 | |||
96 | /** | ||
97 | * struct fw_cdev_event_response - Sent when a response packet was received | ||
98 | * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST | ||
99 | * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST | ||
100 | * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl | ||
101 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE | ||
102 | * @rcode: Response code returned by the remote node | ||
103 | * @length: Data length, i.e. the response's payload size in bytes | ||
104 | * @data: Payload data, if any | ||
105 | * | ||
106 | * This event is sent when the stack receives a response to an outgoing request | ||
107 | * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses | ||
108 | * carrying data (read and lock responses) follows immediately and can be | ||
109 | * accessed through the @data field. | ||
110 | * | ||
111 | * The event is also generated after conclusions of transactions that do not | ||
112 | * involve response packets. This includes unified write transactions, | ||
113 | * broadcast write transactions, and transmission of asynchronous stream | ||
114 | * packets. @rcode indicates success or failure of such transmissions. | ||
115 | */ | ||
116 | struct fw_cdev_event_response { | ||
117 | __u64 closure; | ||
118 | __u32 type; | ||
119 | __u32 rcode; | ||
120 | __u32 length; | ||
121 | __u32 data[0]; | ||
122 | }; | ||
123 | |||
124 | /** | ||
125 | * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2 | ||
126 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST | ||
127 | * | ||
128 | * This event is sent instead of &fw_cdev_event_request2 if the kernel or | ||
129 | * the client implements ABI version <= 3. &fw_cdev_event_request lacks | ||
130 | * essential information; use &fw_cdev_event_request2 instead. | ||
131 | */ | ||
132 | struct fw_cdev_event_request { | ||
133 | __u64 closure; | ||
134 | __u32 type; | ||
135 | __u32 tcode; | ||
136 | __u64 offset; | ||
137 | __u32 handle; | ||
138 | __u32 length; | ||
139 | __u32 data[0]; | ||
140 | }; | ||
141 | |||
142 | /** | ||
143 | * struct fw_cdev_event_request2 - Sent on incoming request to an address region | ||
144 | * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl | ||
145 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2 | ||
146 | * @tcode: Transaction code of the incoming request | ||
147 | * @offset: The offset into the 48-bit per-node address space | ||
148 | * @source_node_id: Sender node ID | ||
149 | * @destination_node_id: Destination node ID | ||
150 | * @card: The index of the card from which the request came | ||
151 | * @generation: Bus generation in which the request is valid | ||
152 | * @handle: Reference to the kernel-side pending request | ||
153 | * @length: Data length, i.e. the request's payload size in bytes | ||
154 | * @data: Incoming data, if any | ||
155 | * | ||
156 | * This event is sent when the stack receives an incoming request to an address | ||
157 | * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is | ||
158 | * guaranteed to be completely contained in the specified region. Userspace is | ||
159 | * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, | ||
160 | * using the same @handle. | ||
161 | * | ||
162 | * The payload data for requests carrying data (write and lock requests) | ||
163 | * follows immediately and can be accessed through the @data field. | ||
164 | * | ||
165 | * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the | ||
166 | * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT, | ||
167 | * i.e. encodes the extended transaction code. | ||
168 | * | ||
169 | * @card may differ from &fw_cdev_get_info.card because requests are received | ||
170 | * from all cards of the Linux host. @source_node_id, @destination_node_id, and | ||
171 | * @generation pertain to that card. Destination node ID and bus generation may | ||
172 | * therefore differ from the corresponding fields of the last | ||
173 | * &fw_cdev_event_bus_reset. | ||
174 | * | ||
175 | * @destination_node_id may also differ from the current node ID because of a | ||
176 | * non-local bus ID part or in case of a broadcast write request. Note, a | ||
177 | * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a | ||
178 | * broadcast write request; the kernel will then release the kernel-side pending | ||
179 | * request but will not actually send a response packet. | ||
180 | * | ||
181 | * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already | ||
182 | * sent a write response immediately after the request was received; in this | ||
183 | * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to | ||
184 | * release the kernel-side pending request, though another response won't be | ||
185 | * sent. | ||
186 | * | ||
187 | * If the client subsequently needs to initiate requests to the sender node of | ||
188 | * an &fw_cdev_event_request2, it needs to use a device file with matching | ||
189 | * card index, node ID, and generation for outbound requests. | ||
190 | */ | ||
191 | struct fw_cdev_event_request2 { | ||
192 | __u64 closure; | ||
193 | __u32 type; | ||
194 | __u32 tcode; | ||
195 | __u64 offset; | ||
196 | __u32 source_node_id; | ||
197 | __u32 destination_node_id; | ||
198 | __u32 card; | ||
199 | __u32 generation; | ||
200 | __u32 handle; | ||
201 | __u32 length; | ||
202 | __u32 data[0]; | ||
203 | }; | ||
204 | |||
205 | /** | ||
206 | * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed | ||
207 | * @closure: See &fw_cdev_event_common; | ||
208 | * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl | ||
209 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT | ||
210 | * @cycle: Cycle counter of the interrupt packet | ||
211 | * @header_length: Total length of following headers, in bytes | ||
212 | * @header: Stripped headers, if any | ||
213 | * | ||
214 | * This event is sent when the controller has completed an &fw_cdev_iso_packet | ||
215 | * with the %FW_CDEV_ISO_INTERRUPT bit set. | ||
216 | * | ||
217 | * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): | ||
218 | * | ||
219 | * In version 3 and some implementations of version 2 of the ABI, &header_length | ||
220 | * is a multiple of 4 and &header contains timestamps of all packets up until | ||
221 | * the interrupt packet. The format of the timestamps is as described below for | ||
222 | * isochronous reception. In version 1 of the ABI, &header_length was 0. | ||
223 | * | ||
224 | * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE): | ||
225 | * | ||
226 | * The headers stripped of all packets up until and including the interrupt | ||
227 | * packet are returned in the @header field. The amount of header data per | ||
228 | * packet is as specified at iso context creation by | ||
229 | * &fw_cdev_create_iso_context.header_size. | ||
230 | * | ||
231 | * Hence, _interrupt.header_length / _context.header_size is the number of | ||
232 | * packets received in this interrupt event. The client can now iterate | ||
233 | * through the mmap()'ed DMA buffer according to this number of packets and | ||
234 | * to the buffer sizes as the client specified in &fw_cdev_queue_iso. | ||
235 | * | ||
236 | * Since version 2 of this ABI, the portion for each packet in _interrupt.header | ||
237 | * consists of the 1394 isochronous packet header, followed by a timestamp | ||
238 | * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets | ||
239 | * from the packet payload if &fw_cdev_create_iso_context.header_size > 8. | ||
240 | * | ||
241 | * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits | ||
242 | * channel, 4 bits tcode, 4 bits sy, in big endian byte order. | ||
243 | * data_length is the actual received size of the packet without the four | ||
244 | * 1394 iso packet header bytes. | ||
245 | * | ||
246 | * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits | ||
247 | * cycleCount, in big endian byte order. | ||
248 | * | ||
249 | * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload | ||
250 | * data followed directly after the 1394 is header if header_size > 4. | ||
251 | * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. | ||
252 | */ | ||
253 | struct fw_cdev_event_iso_interrupt { | ||
254 | __u64 closure; | ||
255 | __u32 type; | ||
256 | __u32 cycle; | ||
257 | __u32 header_length; | ||
258 | __u32 header[0]; | ||
259 | }; | ||
260 | |||
261 | /** | ||
262 | * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed | ||
263 | * @closure: See &fw_cdev_event_common; | ||
264 | * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl | ||
265 | * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | ||
266 | * @completed: Offset into the receive buffer; data before this offset is valid | ||
267 | * | ||
268 | * This event is sent in multichannel contexts (context type | ||
269 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer | ||
270 | * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens | ||
271 | * when a packet is completed and/or when a buffer chunk is completed depends | ||
272 | * on the hardware implementation. | ||
273 | * | ||
274 | * The buffer is continuously filled with the following data, per packet: | ||
275 | * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, | ||
276 | * but in little endian byte order, | ||
277 | * - packet payload (as many bytes as specified in the data_length field of | ||
278 | * the 1394 iso packet header) in big endian byte order, | ||
279 | * - 0...3 padding bytes as needed to align the following trailer quadlet, | ||
280 | * - trailer quadlet, containing the reception timestamp as described at | ||
281 | * &fw_cdev_event_iso_interrupt, but in little endian byte order. | ||
282 | * | ||
283 | * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8. | ||
284 | * When processing the data, stop before a packet that would cross the | ||
285 | * @completed offset. | ||
286 | * | ||
287 | * A packet near the end of a buffer chunk will typically spill over into the | ||
288 | * next queued buffer chunk. It is the responsibility of the client to check | ||
289 | * for this condition, assemble a broken-up packet from its parts, and not to | ||
290 | * re-queue any buffer chunks in which as yet unread packet parts reside. | ||
291 | */ | ||
292 | struct fw_cdev_event_iso_interrupt_mc { | ||
293 | __u64 closure; | ||
294 | __u32 type; | ||
295 | __u32 completed; | ||
296 | }; | ||
297 | |||
298 | /** | ||
299 | * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed | ||
300 | * @closure: See &fw_cdev_event_common; | ||
301 | * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl | ||
302 | * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or | ||
303 | * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED | ||
304 | * @handle: Reference by which an allocated resource can be deallocated | ||
305 | * @channel: Isochronous channel which was (de)allocated, if any | ||
306 | * @bandwidth: Bandwidth allocation units which were (de)allocated, if any | ||
307 | * | ||
308 | * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous | ||
309 | * resource was allocated at the IRM. The client has to check @channel and | ||
310 | * @bandwidth for whether the allocation actually succeeded. | ||
311 | * | ||
312 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous | ||
313 | * resource was deallocated at the IRM. It is also sent when automatic | ||
314 | * reallocation after a bus reset failed. | ||
315 | * | ||
316 | * @channel is <0 if no channel was (de)allocated or if reallocation failed. | ||
317 | * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed. | ||
318 | */ | ||
319 | struct fw_cdev_event_iso_resource { | ||
320 | __u64 closure; | ||
321 | __u32 type; | ||
322 | __u32 handle; | ||
323 | __s32 channel; | ||
324 | __s32 bandwidth; | ||
325 | }; | ||
326 | |||
327 | /** | ||
328 | * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received | ||
329 | * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET | ||
330 | * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl | ||
331 | * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED | ||
332 | * @rcode: %RCODE_..., indicates success or failure of transmission | ||
333 | * @length: Data length in bytes | ||
334 | * @data: Incoming data | ||
335 | * | ||
336 | * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty, | ||
337 | * except in case of a ping packet: Then, @length is 4, and @data[0] is the | ||
338 | * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE. | ||
339 | * | ||
340 | * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data | ||
341 | * consists of the two PHY packet quadlets, in host byte order. | ||
342 | */ | ||
343 | struct fw_cdev_event_phy_packet { | ||
344 | __u64 closure; | ||
345 | __u32 type; | ||
346 | __u32 rcode; | ||
347 | __u32 length; | ||
348 | __u32 data[0]; | ||
349 | }; | ||
350 | |||
351 | /** | ||
352 | * union fw_cdev_event - Convenience union of fw_cdev_event_ types | ||
353 | * @common: Valid for all types | ||
354 | * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET | ||
355 | * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE | ||
356 | * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST | ||
357 | * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2 | ||
358 | * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT | ||
359 | * @iso_interrupt_mc: Valid if @common.type == | ||
360 | * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | ||
361 | * @iso_resource: Valid if @common.type == | ||
362 | * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or | ||
363 | * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED | ||
364 | * @phy_packet: Valid if @common.type == | ||
365 | * %FW_CDEV_EVENT_PHY_PACKET_SENT or | ||
366 | * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED | ||
367 | * | ||
368 | * Convenience union for userspace use. Events could be read(2) into an | ||
369 | * appropriately aligned char buffer and then cast to this union for further | ||
370 | * processing. Note that for a request, response or iso_interrupt event, | ||
371 | * the data[] or header[] may make the size of the full event larger than | ||
372 | * sizeof(union fw_cdev_event). Also note that if you attempt to read(2) | ||
373 | * an event into a buffer that is not large enough for it, the data that does | ||
374 | * not fit will be discarded so that the next read(2) will return a new event. | ||
375 | */ | ||
376 | union fw_cdev_event { | ||
377 | struct fw_cdev_event_common common; | ||
378 | struct fw_cdev_event_bus_reset bus_reset; | ||
379 | struct fw_cdev_event_response response; | ||
380 | struct fw_cdev_event_request request; | ||
381 | struct fw_cdev_event_request2 request2; /* added in 2.6.36 */ | ||
382 | struct fw_cdev_event_iso_interrupt iso_interrupt; | ||
383 | struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */ | ||
384 | struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */ | ||
385 | struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */ | ||
386 | }; | ||
387 | |||
388 | /* available since kernel version 2.6.22 */ | ||
389 | #define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) | ||
390 | #define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) | ||
391 | #define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) | ||
392 | #define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) | ||
393 | #define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) | ||
394 | #define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) | ||
395 | #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) | ||
396 | #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) | ||
397 | #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) | ||
398 | #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) | ||
399 | #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) | ||
400 | #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) | ||
401 | |||
402 | /* available since kernel version 2.6.24 */ | ||
403 | #define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) | ||
404 | |||
405 | /* available since kernel version 2.6.30 */ | ||
406 | #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource) | ||
407 | #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate) | ||
408 | #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource) | ||
409 | #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource) | ||
410 | #define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */ | ||
411 | #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) | ||
412 | #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) | ||
413 | |||
414 | /* available since kernel version 2.6.34 */ | ||
415 | #define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) | ||
416 | |||
417 | /* available since kernel version 2.6.36 */ | ||
418 | #define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet) | ||
419 | #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) | ||
420 | #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) | ||
421 | |||
422 | /* | ||
423 | * ABI version history | ||
424 | * 1 (2.6.22) - initial version | ||
425 | * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER | ||
426 | * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if | ||
427 | * &fw_cdev_create_iso_context.header_size is 8 or more | ||
428 | * - added %FW_CDEV_IOC_*_ISO_RESOURCE*, | ||
429 | * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST, | ||
430 | * %FW_CDEV_IOC_SEND_STREAM_PACKET | ||
431 | * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt | ||
432 | * (2.6.33) - IR has always packet-per-buffer semantics now, not one of | ||
433 | * dual-buffer or packet-per-buffer depending on hardware | ||
434 | * - shared use and auto-response for FCP registers | ||
435 | * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable | ||
436 | * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2 | ||
437 | * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*, | ||
438 | * and &fw_cdev_allocate.region_end | ||
439 | * - implemented &fw_cdev_event_bus_reset.bm_node_id | ||
440 | * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS | ||
441 | * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, | ||
442 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and | ||
443 | * %FW_CDEV_IOC_SET_ISO_CHANNELS | ||
444 | */ | ||
445 | |||
446 | /** | ||
447 | * struct fw_cdev_get_info - General purpose information ioctl | ||
448 | * @version: The version field is just a running serial number. Both an | ||
449 | * input parameter (ABI version implemented by the client) and | ||
450 | * output parameter (ABI version implemented by the kernel). | ||
451 | * A client shall fill in the ABI @version for which the client | ||
452 | * was implemented. This is necessary for forward compatibility. | ||
453 | * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration | ||
454 | * ROM will be copied into that user space address. In either | ||
455 | * case, @rom_length is updated with the actual length of the | ||
456 | * Configuration ROM. | ||
457 | * @rom: If non-zero, address of a buffer to be filled by a copy of the | ||
458 | * device's Configuration ROM | ||
459 | * @bus_reset: If non-zero, address of a buffer to be filled by a | ||
460 | * &struct fw_cdev_event_bus_reset with the current state | ||
461 | * of the bus. This does not cause a bus reset to happen. | ||
462 | * @bus_reset_closure: Value of &closure in this and subsequent bus reset events | ||
463 | * @card: The index of the card this device belongs to | ||
464 | * | ||
465 | * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client | ||
466 | * performs right after it opened a /dev/fw* file. | ||
467 | * | ||
468 | * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2) | ||
469 | * is started by this ioctl. | ||
470 | */ | ||
471 | struct fw_cdev_get_info { | ||
472 | __u32 version; | ||
473 | __u32 rom_length; | ||
474 | __u64 rom; | ||
475 | __u64 bus_reset; | ||
476 | __u64 bus_reset_closure; | ||
477 | __u32 card; | ||
478 | }; | ||
479 | |||
480 | /** | ||
481 | * struct fw_cdev_send_request - Send an asynchronous request packet | ||
482 | * @tcode: Transaction code of the request | ||
483 | * @length: Length of outgoing payload, in bytes | ||
484 | * @offset: 48-bit offset at destination node | ||
485 | * @closure: Passed back to userspace in the response event | ||
486 | * @data: Userspace pointer to payload | ||
487 | * @generation: The bus generation where packet is valid | ||
488 | * | ||
489 | * Send a request to the device. This ioctl implements all outgoing requests. | ||
490 | * Both quadlet and block request specify the payload as a pointer to the data | ||
491 | * in the @data field. Once the transaction completes, the kernel writes an | ||
492 | * &fw_cdev_event_response event back. The @closure field is passed back to | ||
493 | * user space in the response event. | ||
494 | */ | ||
495 | struct fw_cdev_send_request { | ||
496 | __u32 tcode; | ||
497 | __u32 length; | ||
498 | __u64 offset; | ||
499 | __u64 closure; | ||
500 | __u64 data; | ||
501 | __u32 generation; | ||
502 | }; | ||
503 | |||
504 | /** | ||
505 | * struct fw_cdev_send_response - Send an asynchronous response packet | ||
506 | * @rcode: Response code as determined by the userspace handler | ||
507 | * @length: Length of outgoing payload, in bytes | ||
508 | * @data: Userspace pointer to payload | ||
509 | * @handle: The handle from the &fw_cdev_event_request | ||
510 | * | ||
511 | * Send a response to an incoming request. By setting up an address range using | ||
512 | * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An | ||
513 | * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must | ||
514 | * send a reply using this ioctl. The event has a handle to the kernel-side | ||
515 | * pending transaction, which should be used with this ioctl. | ||
516 | */ | ||
517 | struct fw_cdev_send_response { | ||
518 | __u32 rcode; | ||
519 | __u32 length; | ||
520 | __u64 data; | ||
521 | __u32 handle; | ||
522 | }; | ||
523 | |||
524 | /** | ||
525 | * struct fw_cdev_allocate - Allocate a CSR in an address range | ||
526 | * @offset: Start offset of the address range | ||
527 | * @closure: To be passed back to userspace in request events | ||
528 | * @length: Length of the CSR, in bytes | ||
529 | * @handle: Handle to the allocation, written by the kernel | ||
530 | * @region_end: First address above the address range (added in ABI v4, 2.6.36) | ||
531 | * | ||
532 | * Allocate an address range in the 48-bit address space on the local node | ||
533 | * (the controller). This allows userspace to listen for requests with an | ||
534 | * offset within that address range. Every time when the kernel receives a | ||
535 | * request within the range, an &fw_cdev_event_request2 event will be emitted. | ||
536 | * (If the kernel or the client implements ABI version <= 3, an | ||
537 | * &fw_cdev_event_request will be generated instead.) | ||
538 | * | ||
539 | * The @closure field is passed back to userspace in these request events. | ||
540 | * The @handle field is an out parameter, returning a handle to the allocated | ||
541 | * range to be used for later deallocation of the range. | ||
542 | * | ||
543 | * The address range is allocated on all local nodes. The address allocation | ||
544 | * is exclusive except for the FCP command and response registers. If an | ||
545 | * exclusive address region is already in use, the ioctl fails with errno set | ||
546 | * to %EBUSY. | ||
547 | * | ||
548 | * If kernel and client implement ABI version >= 4, the kernel looks up a free | ||
549 | * spot of size @length inside [@offset..@region_end) and, if found, writes | ||
550 | * the start address of the new CSR back in @offset. I.e. @offset is an | ||
551 | * in and out parameter. If this automatic placement of a CSR in a bigger | ||
552 | * address range is not desired, the client simply needs to set @region_end | ||
553 | * = @offset + @length. | ||
554 | * | ||
555 | * If the kernel or the client implements ABI version <= 3, @region_end is | ||
556 | * ignored and effectively assumed to be @offset + @length. | ||
557 | * | ||
558 | * @region_end is only present in a kernel header >= 2.6.36. If necessary, | ||
559 | * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2. | ||
560 | */ | ||
561 | struct fw_cdev_allocate { | ||
562 | __u64 offset; | ||
563 | __u64 closure; | ||
564 | __u32 length; | ||
565 | __u32 handle; | ||
566 | __u64 region_end; /* available since kernel version 2.6.36 */ | ||
567 | }; | ||
568 | |||
569 | /** | ||
570 | * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource | ||
571 | * @handle: Handle to the address range or iso resource, as returned by the | ||
572 | * kernel when the range or resource was allocated | ||
573 | */ | ||
574 | struct fw_cdev_deallocate { | ||
575 | __u32 handle; | ||
576 | }; | ||
577 | |||
578 | #define FW_CDEV_LONG_RESET 0 | ||
579 | #define FW_CDEV_SHORT_RESET 1 | ||
580 | |||
581 | /** | ||
582 | * struct fw_cdev_initiate_bus_reset - Initiate a bus reset | ||
583 | * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET | ||
584 | * | ||
585 | * Initiate a bus reset for the bus this device is on. The bus reset can be | ||
586 | * either the original (long) bus reset or the arbitrated (short) bus reset | ||
587 | * introduced in 1394a-2000. | ||
588 | * | ||
589 | * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset | ||
590 | * indicates when the reset actually happened. Since ABI v4, this may be | ||
591 | * considerably later than the ioctl because the kernel ensures a grace period | ||
592 | * between subsequent bus resets as per IEEE 1394 bus management specification. | ||
593 | */ | ||
594 | struct fw_cdev_initiate_bus_reset { | ||
595 | __u32 type; | ||
596 | }; | ||
597 | |||
598 | /** | ||
599 | * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM | ||
600 | * @immediate: If non-zero, immediate key to insert before pointer | ||
601 | * @key: Upper 8 bits of root directory pointer | ||
602 | * @data: Userspace pointer to contents of descriptor block | ||
603 | * @length: Length of descriptor block data, in quadlets | ||
604 | * @handle: Handle to the descriptor, written by the kernel | ||
605 | * | ||
606 | * Add a descriptor block and optionally a preceding immediate key to the local | ||
607 | * node's Configuration ROM. | ||
608 | * | ||
609 | * The @key field specifies the upper 8 bits of the descriptor root directory | ||
610 | * pointer and the @data and @length fields specify the contents. The @key | ||
611 | * should be of the form 0xXX000000. The offset part of the root directory entry | ||
612 | * will be filled in by the kernel. | ||
613 | * | ||
614 | * If not 0, the @immediate field specifies an immediate key which will be | ||
615 | * inserted before the root directory pointer. | ||
616 | * | ||
617 | * @immediate, @key, and @data array elements are CPU-endian quadlets. | ||
618 | * | ||
619 | * If successful, the kernel adds the descriptor and writes back a @handle to | ||
620 | * the kernel-side object to be used for later removal of the descriptor block | ||
621 | * and immediate key. The kernel will also generate a bus reset to signal the | ||
622 | * change of the Configuration ROM to other nodes. | ||
623 | * | ||
624 | * This ioctl affects the Configuration ROMs of all local nodes. | ||
625 | * The ioctl only succeeds on device files which represent a local node. | ||
626 | */ | ||
627 | struct fw_cdev_add_descriptor { | ||
628 | __u32 immediate; | ||
629 | __u32 key; | ||
630 | __u64 data; | ||
631 | __u32 length; | ||
632 | __u32 handle; | ||
633 | }; | ||
634 | |||
635 | /** | ||
636 | * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM | ||
637 | * @handle: Handle to the descriptor, as returned by the kernel when the | ||
638 | * descriptor was added | ||
639 | * | ||
640 | * Remove a descriptor block and accompanying immediate key from the local | ||
641 | * nodes' Configuration ROMs. The kernel will also generate a bus reset to | ||
642 | * signal the change of the Configuration ROM to other nodes. | ||
643 | */ | ||
644 | struct fw_cdev_remove_descriptor { | ||
645 | __u32 handle; | ||
646 | }; | ||
647 | |||
648 | #define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 | ||
649 | #define FW_CDEV_ISO_CONTEXT_RECEIVE 1 | ||
650 | #define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */ | ||
651 | |||
652 | /** | ||
653 | * struct fw_cdev_create_iso_context - Create a context for isochronous I/O | ||
654 | * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or | ||
655 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL | ||
656 | * @header_size: Header size to strip in single-channel reception | ||
657 | * @channel: Channel to bind to in single-channel reception or transmission | ||
658 | * @speed: Transmission speed | ||
659 | * @closure: To be returned in &fw_cdev_event_iso_interrupt or | ||
660 | * &fw_cdev_event_iso_interrupt_multichannel | ||
661 | * @handle: Handle to context, written back by kernel | ||
662 | * | ||
663 | * Prior to sending or receiving isochronous I/O, a context must be created. | ||
664 | * The context records information about the transmit or receive configuration | ||
665 | * and typically maps to an underlying hardware resource. A context is set up | ||
666 | * for either sending or receiving. It is bound to a specific isochronous | ||
667 | * @channel. | ||
668 | * | ||
669 | * In case of multichannel reception, @header_size and @channel are ignored | ||
670 | * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS. | ||
671 | * | ||
672 | * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4 | ||
673 | * and must be a multiple of 4. It is ignored in other context types. | ||
674 | * | ||
675 | * @speed is ignored in receive context types. | ||
676 | * | ||
677 | * If a context was successfully created, the kernel writes back a handle to the | ||
678 | * context, which must be passed in for subsequent operations on that context. | ||
679 | * | ||
680 | * Limitations: | ||
681 | * No more than one iso context can be created per fd. | ||
682 | * The total number of contexts that all userspace and kernelspace drivers can | ||
683 | * create on a card at a time is a hardware limit, typically 4 or 8 contexts per | ||
684 | * direction, and of them at most one multichannel receive context. | ||
685 | */ | ||
686 | struct fw_cdev_create_iso_context { | ||
687 | __u32 type; | ||
688 | __u32 header_size; | ||
689 | __u32 channel; | ||
690 | __u32 speed; | ||
691 | __u64 closure; | ||
692 | __u32 handle; | ||
693 | }; | ||
694 | |||
695 | /** | ||
696 | * struct fw_cdev_set_iso_channels - Select channels in multichannel reception | ||
697 | * @channels: Bitmask of channels to listen to | ||
698 | * @handle: Handle of the mutichannel receive context | ||
699 | * | ||
700 | * @channels is the bitwise or of 1ULL << n for each channel n to listen to. | ||
701 | * | ||
702 | * The ioctl fails with errno %EBUSY if there is already another receive context | ||
703 | * on a channel in @channels. In that case, the bitmask of all unoccupied | ||
704 | * channels is returned in @channels. | ||
705 | */ | ||
706 | struct fw_cdev_set_iso_channels { | ||
707 | __u64 channels; | ||
708 | __u32 handle; | ||
709 | }; | ||
710 | |||
711 | #define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) | ||
712 | #define FW_CDEV_ISO_INTERRUPT (1 << 16) | ||
713 | #define FW_CDEV_ISO_SKIP (1 << 17) | ||
714 | #define FW_CDEV_ISO_SYNC (1 << 17) | ||
715 | #define FW_CDEV_ISO_TAG(v) ((v) << 18) | ||
716 | #define FW_CDEV_ISO_SY(v) ((v) << 20) | ||
717 | #define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24) | ||
718 | |||
719 | /** | ||
720 | * struct fw_cdev_iso_packet - Isochronous packet | ||
721 | * @control: Contains the header length (8 uppermost bits), | ||
722 | * the sy field (4 bits), the tag field (2 bits), a sync flag | ||
723 | * or a skip flag (1 bit), an interrupt flag (1 bit), and the | ||
724 | * payload length (16 lowermost bits) | ||
725 | * @header: Header and payload in case of a transmit context. | ||
726 | * | ||
727 | * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. | ||
728 | * Use the FW_CDEV_ISO_ macros to fill in @control. | ||
729 | * The @header array is empty in case of receive contexts. | ||
730 | * | ||
731 | * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT: | ||
732 | * | ||
733 | * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of | ||
734 | * bytes in @header that will be prepended to the packet's payload. These bytes | ||
735 | * are copied into the kernel and will not be accessed after the ioctl has | ||
736 | * returned. | ||
737 | * | ||
738 | * The @control.SY and TAG fields are copied to the iso packet header. These | ||
739 | * fields are specified by IEEE 1394a and IEC 61883-1. | ||
740 | * | ||
741 | * The @control.SKIP flag specifies that no packet is to be sent in a frame. | ||
742 | * When using this, all other fields except @control.INTERRUPT must be zero. | ||
743 | * | ||
744 | * When a packet with the @control.INTERRUPT flag set has been completed, an | ||
745 | * &fw_cdev_event_iso_interrupt event will be sent. | ||
746 | * | ||
747 | * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE: | ||
748 | * | ||
749 | * @control.HEADER_LENGTH must be a multiple of the context's header_size. | ||
750 | * If the HEADER_LENGTH is larger than the context's header_size, multiple | ||
751 | * packets are queued for this entry. | ||
752 | * | ||
753 | * The @control.SY and TAG fields are ignored. | ||
754 | * | ||
755 | * If the @control.SYNC flag is set, the context drops all packets until a | ||
756 | * packet with a sy field is received which matches &fw_cdev_start_iso.sync. | ||
757 | * | ||
758 | * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for | ||
759 | * one packet (in addition to payload quadlets that have been defined as headers | ||
760 | * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure). | ||
761 | * If more bytes are received, the additional bytes are dropped. If less bytes | ||
762 | * are received, the remaining bytes in this part of the payload buffer will not | ||
763 | * be written to, not even by the next packet. I.e., packets received in | ||
764 | * consecutive frames will not necessarily be consecutive in memory. If an | ||
765 | * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally | ||
766 | * among them. | ||
767 | * | ||
768 | * When a packet with the @control.INTERRUPT flag set has been completed, an | ||
769 | * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued | ||
770 | * multiple receive packets is completed when its last packet is completed. | ||
771 | * | ||
772 | * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL: | ||
773 | * | ||
774 | * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since | ||
775 | * it specifies a chunk of the mmap()'ed buffer, while the number and alignment | ||
776 | * of packets to be placed into the buffer chunk is not known beforehand. | ||
777 | * | ||
778 | * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room | ||
779 | * for header, payload, padding, and trailer bytes of one or more packets. | ||
780 | * It must be a multiple of 4. | ||
781 | * | ||
782 | * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described | ||
783 | * for single-channel reception. | ||
784 | * | ||
785 | * When a buffer chunk with the @control.INTERRUPT flag set has been filled | ||
786 | * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent. | ||
787 | */ | ||
788 | struct fw_cdev_iso_packet { | ||
789 | __u32 control; | ||
790 | __u32 header[0]; | ||
791 | }; | ||
792 | |||
793 | /** | ||
794 | * struct fw_cdev_queue_iso - Queue isochronous packets for I/O | ||
795 | * @packets: Userspace pointer to an array of &fw_cdev_iso_packet | ||
796 | * @data: Pointer into mmap()'ed payload buffer | ||
797 | * @size: Size of the @packets array, in bytes | ||
798 | * @handle: Isochronous context handle | ||
799 | * | ||
800 | * Queue a number of isochronous packets for reception or transmission. | ||
801 | * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, | ||
802 | * which describe how to transmit from or receive into a contiguous region | ||
803 | * of a mmap()'ed payload buffer. As part of transmit packet descriptors, | ||
804 | * a series of headers can be supplied, which will be prepended to the | ||
805 | * payload during DMA. | ||
806 | * | ||
807 | * The kernel may or may not queue all packets, but will write back updated | ||
808 | * values of the @packets, @data and @size fields, so the ioctl can be | ||
809 | * resubmitted easily. | ||
810 | * | ||
811 | * In case of a multichannel receive context, @data must be quadlet-aligned | ||
812 | * relative to the buffer start. | ||
813 | */ | ||
814 | struct fw_cdev_queue_iso { | ||
815 | __u64 packets; | ||
816 | __u64 data; | ||
817 | __u32 size; | ||
818 | __u32 handle; | ||
819 | }; | ||
820 | |||
821 | #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 | ||
822 | #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 | ||
823 | #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 | ||
824 | #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 | ||
825 | #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 | ||
826 | |||
827 | /** | ||
828 | * struct fw_cdev_start_iso - Start an isochronous transmission or reception | ||
829 | * @cycle: Cycle in which to start I/O. If @cycle is greater than or | ||
830 | * equal to 0, the I/O will start on that cycle. | ||
831 | * @sync: Determines the value to wait for for receive packets that have | ||
832 | * the %FW_CDEV_ISO_SYNC bit set | ||
833 | * @tags: Tag filter bit mask. Only valid for isochronous reception. | ||
834 | * Determines the tag values for which packets will be accepted. | ||
835 | * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags. | ||
836 | * @handle: Isochronous context handle within which to transmit or receive | ||
837 | */ | ||
838 | struct fw_cdev_start_iso { | ||
839 | __s32 cycle; | ||
840 | __u32 sync; | ||
841 | __u32 tags; | ||
842 | __u32 handle; | ||
843 | }; | ||
844 | |||
845 | /** | ||
846 | * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception | ||
847 | * @handle: Handle of isochronous context to stop | ||
848 | */ | ||
849 | struct fw_cdev_stop_iso { | ||
850 | __u32 handle; | ||
851 | }; | ||
852 | |||
853 | /** | ||
854 | * struct fw_cdev_get_cycle_timer - read cycle timer register | ||
855 | * @local_time: system time, in microseconds since the Epoch | ||
856 | * @cycle_timer: Cycle Time register contents | ||
857 | * | ||
858 | * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME | ||
859 | * and only with microseconds resolution. | ||
860 | * | ||
861 | * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- | ||
862 | * monotonic) @cycle_timer values on certain controllers. | ||
863 | */ | ||
864 | struct fw_cdev_get_cycle_timer { | ||
865 | __u64 local_time; | ||
866 | __u32 cycle_timer; | ||
867 | }; | ||
868 | |||
869 | /** | ||
870 | * struct fw_cdev_get_cycle_timer2 - read cycle timer register | ||
871 | * @tv_sec: system time, seconds | ||
872 | * @tv_nsec: system time, sub-seconds part in nanoseconds | ||
873 | * @clk_id: input parameter, clock from which to get the system time | ||
874 | * @cycle_timer: Cycle Time register contents | ||
875 | * | ||
876 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer | ||
877 | * and also the system clock. This allows to correlate reception time of | ||
878 | * isochronous packets with system time. | ||
879 | * | ||
880 | * @clk_id lets you choose a clock like with POSIX' clock_gettime function. | ||
881 | * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC | ||
882 | * and Linux' %CLOCK_MONOTONIC_RAW. | ||
883 | * | ||
884 | * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and | ||
885 | * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register | ||
886 | * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394. | ||
887 | */ | ||
888 | struct fw_cdev_get_cycle_timer2 { | ||
889 | __s64 tv_sec; | ||
890 | __s32 tv_nsec; | ||
891 | __s32 clk_id; | ||
892 | __u32 cycle_timer; | ||
893 | }; | ||
894 | |||
895 | /** | ||
896 | * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth | ||
897 | * @closure: Passed back to userspace in corresponding iso resource events | ||
898 | * @channels: Isochronous channels of which one is to be (de)allocated | ||
899 | * @bandwidth: Isochronous bandwidth units to be (de)allocated | ||
900 | * @handle: Handle to the allocation, written by the kernel (only valid in | ||
901 | * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls) | ||
902 | * | ||
903 | * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an | ||
904 | * isochronous channel and/or of isochronous bandwidth at the isochronous | ||
905 | * resource manager (IRM). Only one of the channels specified in @channels is | ||
906 | * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after | ||
907 | * communication with the IRM, indicating success or failure in the event data. | ||
908 | * The kernel will automatically reallocate the resources after bus resets. | ||
909 | * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event | ||
910 | * will be sent. The kernel will also automatically deallocate the resources | ||
911 | * when the file descriptor is closed. | ||
912 | * | ||
913 | * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate | ||
914 | * deallocation of resources which were allocated as described above. | ||
915 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | ||
916 | * | ||
917 | * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation | ||
918 | * without automatic re- or deallocation. | ||
919 | * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation, | ||
920 | * indicating success or failure in its data. | ||
921 | * | ||
922 | * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like | ||
923 | * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed | ||
924 | * instead of allocated. | ||
925 | * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | ||
926 | * | ||
927 | * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources | ||
928 | * for the lifetime of the fd or @handle. | ||
929 | * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources | ||
930 | * for the duration of a bus generation. | ||
931 | * | ||
932 | * @channels is a host-endian bitfield with the least significant bit | ||
933 | * representing channel 0 and the most significant bit representing channel 63: | ||
934 | * 1ULL << c for each channel c that is a candidate for (de)allocation. | ||
935 | * | ||
936 | * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send | ||
937 | * one quadlet of data (payload or header data) at speed S1600. | ||
938 | */ | ||
939 | struct fw_cdev_allocate_iso_resource { | ||
940 | __u64 closure; | ||
941 | __u64 channels; | ||
942 | __u32 bandwidth; | ||
943 | __u32 handle; | ||
944 | }; | ||
945 | |||
946 | /** | ||
947 | * struct fw_cdev_send_stream_packet - send an asynchronous stream packet | ||
948 | * @length: Length of outgoing payload, in bytes | ||
949 | * @tag: Data format tag | ||
950 | * @channel: Isochronous channel to transmit to | ||
951 | * @sy: Synchronization code | ||
952 | * @closure: Passed back to userspace in the response event | ||
953 | * @data: Userspace pointer to payload | ||
954 | * @generation: The bus generation where packet is valid | ||
955 | * @speed: Speed to transmit at | ||
956 | * | ||
957 | * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet | ||
958 | * to every device which is listening to the specified channel. The kernel | ||
959 | * writes an &fw_cdev_event_response event which indicates success or failure of | ||
960 | * the transmission. | ||
961 | */ | ||
962 | struct fw_cdev_send_stream_packet { | ||
963 | __u32 length; | ||
964 | __u32 tag; | ||
965 | __u32 channel; | ||
966 | __u32 sy; | ||
967 | __u64 closure; | ||
968 | __u64 data; | ||
969 | __u32 generation; | ||
970 | __u32 speed; | ||
971 | }; | ||
972 | |||
973 | /** | ||
974 | * struct fw_cdev_send_phy_packet - send a PHY packet | ||
975 | * @closure: Passed back to userspace in the PHY-packet-sent event | ||
976 | * @data: First and second quadlet of the PHY packet | ||
977 | * @generation: The bus generation where packet is valid | ||
978 | * | ||
979 | * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes | ||
980 | * on the same card as this device. After transmission, an | ||
981 | * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated. | ||
982 | * | ||
983 | * The payload @data[] shall be specified in host byte order. Usually, | ||
984 | * @data[1] needs to be the bitwise inverse of @data[0]. VersaPHY packets | ||
985 | * are an exception to this rule. | ||
986 | * | ||
987 | * The ioctl is only permitted on device files which represent a local node. | ||
988 | */ | ||
989 | struct fw_cdev_send_phy_packet { | ||
990 | __u64 closure; | ||
991 | __u32 data[2]; | ||
992 | __u32 generation; | ||
993 | }; | ||
994 | |||
995 | /** | ||
996 | * struct fw_cdev_receive_phy_packets - start reception of PHY packets | ||
997 | * @closure: Passed back to userspace in phy packet events | ||
998 | * | ||
999 | * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to | ||
1000 | * incoming PHY packets from any node on the same bus as the device. | ||
1001 | * | ||
1002 | * The ioctl is only permitted on device files which represent a local node. | ||
1003 | */ | ||
1004 | struct fw_cdev_receive_phy_packets { | ||
1005 | __u64 closure; | ||
1006 | }; | ||
1007 | |||
1008 | #define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */ | ||
1009 | |||
1010 | #endif /* _LINUX_FIREWIRE_CDEV_H */ | ||
diff --git a/include/linux/firewire-constants.h b/include/linux/firewire-constants.h new file mode 100644 index 00000000000..9b4bb5fbba4 --- /dev/null +++ b/include/linux/firewire-constants.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * IEEE 1394 constants. | ||
3 | * | ||
4 | * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the next | ||
14 | * paragraph) shall be included in all copies or substantial portions of the | ||
15 | * Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | * DEALINGS IN THE SOFTWARE. | ||
24 | */ | ||
25 | |||
26 | #ifndef _LINUX_FIREWIRE_CONSTANTS_H | ||
27 | #define _LINUX_FIREWIRE_CONSTANTS_H | ||
28 | |||
29 | #define TCODE_WRITE_QUADLET_REQUEST 0x0 | ||
30 | #define TCODE_WRITE_BLOCK_REQUEST 0x1 | ||
31 | #define TCODE_WRITE_RESPONSE 0x2 | ||
32 | #define TCODE_READ_QUADLET_REQUEST 0x4 | ||
33 | #define TCODE_READ_BLOCK_REQUEST 0x5 | ||
34 | #define TCODE_READ_QUADLET_RESPONSE 0x6 | ||
35 | #define TCODE_READ_BLOCK_RESPONSE 0x7 | ||
36 | #define TCODE_CYCLE_START 0x8 | ||
37 | #define TCODE_LOCK_REQUEST 0x9 | ||
38 | #define TCODE_STREAM_DATA 0xa | ||
39 | #define TCODE_LOCK_RESPONSE 0xb | ||
40 | |||
41 | #define EXTCODE_MASK_SWAP 0x1 | ||
42 | #define EXTCODE_COMPARE_SWAP 0x2 | ||
43 | #define EXTCODE_FETCH_ADD 0x3 | ||
44 | #define EXTCODE_LITTLE_ADD 0x4 | ||
45 | #define EXTCODE_BOUNDED_ADD 0x5 | ||
46 | #define EXTCODE_WRAP_ADD 0x6 | ||
47 | #define EXTCODE_VENDOR_DEPENDENT 0x7 | ||
48 | |||
49 | /* Linux firewire-core (Juju) specific tcodes */ | ||
50 | #define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) | ||
51 | #define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) | ||
52 | #define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) | ||
53 | #define TCODE_LOCK_LITTLE_ADD (0x10 | EXTCODE_LITTLE_ADD) | ||
54 | #define TCODE_LOCK_BOUNDED_ADD (0x10 | EXTCODE_BOUNDED_ADD) | ||
55 | #define TCODE_LOCK_WRAP_ADD (0x10 | EXTCODE_WRAP_ADD) | ||
56 | #define TCODE_LOCK_VENDOR_DEPENDENT (0x10 | EXTCODE_VENDOR_DEPENDENT) | ||
57 | |||
58 | #define RCODE_COMPLETE 0x0 | ||
59 | #define RCODE_CONFLICT_ERROR 0x4 | ||
60 | #define RCODE_DATA_ERROR 0x5 | ||
61 | #define RCODE_TYPE_ERROR 0x6 | ||
62 | #define RCODE_ADDRESS_ERROR 0x7 | ||
63 | |||
64 | /* Linux firewire-core (Juju) specific rcodes */ | ||
65 | #define RCODE_SEND_ERROR 0x10 | ||
66 | #define RCODE_CANCELLED 0x11 | ||
67 | #define RCODE_BUSY 0x12 | ||
68 | #define RCODE_GENERATION 0x13 | ||
69 | #define RCODE_NO_ACK 0x14 | ||
70 | |||
71 | #define SCODE_100 0x0 | ||
72 | #define SCODE_200 0x1 | ||
73 | #define SCODE_400 0x2 | ||
74 | #define SCODE_800 0x3 | ||
75 | #define SCODE_1600 0x4 | ||
76 | #define SCODE_3200 0x5 | ||
77 | #define SCODE_BETA 0x3 | ||
78 | |||
79 | #define ACK_COMPLETE 0x1 | ||
80 | #define ACK_PENDING 0x2 | ||
81 | #define ACK_BUSY_X 0x4 | ||
82 | #define ACK_BUSY_A 0x5 | ||
83 | #define ACK_BUSY_B 0x6 | ||
84 | #define ACK_DATA_ERROR 0xd | ||
85 | #define ACK_TYPE_ERROR 0xe | ||
86 | |||
87 | #define RETRY_1 0x00 | ||
88 | #define RETRY_X 0x01 | ||
89 | #define RETRY_A 0x02 | ||
90 | #define RETRY_B 0x03 | ||
91 | |||
92 | #endif /* _LINUX_FIREWIRE_CONSTANTS_H */ | ||
diff --git a/include/linux/fuse.h b/include/linux/fuse.h new file mode 100644 index 00000000000..464cff52686 --- /dev/null +++ b/include/linux/fuse.h | |||
@@ -0,0 +1,634 @@ | |||
1 | /* | ||
2 | FUSE: Filesystem in Userspace | ||
3 | Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> | ||
4 | |||
5 | This program can be distributed under the terms of the GNU GPL. | ||
6 | See the file COPYING. | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * This file defines the kernel interface of FUSE | ||
11 | * | ||
12 | * Protocol changelog: | ||
13 | * | ||
14 | * 7.9: | ||
15 | * - new fuse_getattr_in input argument of GETATTR | ||
16 | * - add lk_flags in fuse_lk_in | ||
17 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in | ||
18 | * - add blksize field to fuse_attr | ||
19 | * - add file flags field to fuse_read_in and fuse_write_in | ||
20 | * | ||
21 | * 7.10 | ||
22 | * - add nonseekable open flag | ||
23 | * | ||
24 | * 7.11 | ||
25 | * - add IOCTL message | ||
26 | * - add unsolicited notification support | ||
27 | * - add POLL message and NOTIFY_POLL notification | ||
28 | * | ||
29 | * 7.12 | ||
30 | * - add umask flag to input argument of open, mknod and mkdir | ||
31 | * - add notification messages for invalidation of inodes and | ||
32 | * directory entries | ||
33 | * | ||
34 | * 7.13 | ||
35 | * - make max number of background requests and congestion threshold | ||
36 | * tunables | ||
37 | * | ||
38 | * 7.14 | ||
39 | * - add splice support to fuse device | ||
40 | * | ||
41 | * 7.15 | ||
42 | * - add store notify | ||
43 | * - add retrieve notify | ||
44 | * | ||
45 | * 7.16 | ||
46 | * - add BATCH_FORGET request | ||
47 | * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct | ||
48 | * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' | ||
49 | * - add FUSE_IOCTL_32BIT flag | ||
50 | * | ||
51 | * 7.17 | ||
52 | * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK | ||
53 | */ | ||
54 | |||
55 | #ifndef _LINUX_FUSE_H | ||
56 | #define _LINUX_FUSE_H | ||
57 | |||
58 | #include <linux/types.h> | ||
59 | |||
60 | /* | ||
61 | * Version negotiation: | ||
62 | * | ||
63 | * Both the kernel and userspace send the version they support in the | ||
64 | * INIT request and reply respectively. | ||
65 | * | ||
66 | * If the major versions match then both shall use the smallest | ||
67 | * of the two minor versions for communication. | ||
68 | * | ||
69 | * If the kernel supports a larger major version, then userspace shall | ||
70 | * reply with the major version it supports, ignore the rest of the | ||
71 | * INIT message and expect a new INIT message from the kernel with a | ||
72 | * matching major version. | ||
73 | * | ||
74 | * If the library supports a larger major version, then it shall fall | ||
75 | * back to the major protocol version sent by the kernel for | ||
76 | * communication and reply with that major version (and an arbitrary | ||
77 | * supported minor version). | ||
78 | */ | ||
79 | |||
80 | /** Version number of this interface */ | ||
81 | #define FUSE_KERNEL_VERSION 7 | ||
82 | |||
83 | /** Minor version number of this interface */ | ||
84 | #define FUSE_KERNEL_MINOR_VERSION 17 | ||
85 | |||
86 | /** The node ID of the root inode */ | ||
87 | #define FUSE_ROOT_ID 1 | ||
88 | |||
89 | /* Make sure all structures are padded to 64bit boundary, so 32bit | ||
90 | userspace works under 64bit kernels */ | ||
91 | |||
92 | struct fuse_attr { | ||
93 | __u64 ino; | ||
94 | __u64 size; | ||
95 | __u64 blocks; | ||
96 | __u64 atime; | ||
97 | __u64 mtime; | ||
98 | __u64 ctime; | ||
99 | __u32 atimensec; | ||
100 | __u32 mtimensec; | ||
101 | __u32 ctimensec; | ||
102 | __u32 mode; | ||
103 | __u32 nlink; | ||
104 | __u32 uid; | ||
105 | __u32 gid; | ||
106 | __u32 rdev; | ||
107 | __u32 blksize; | ||
108 | __u32 padding; | ||
109 | }; | ||
110 | |||
111 | struct fuse_kstatfs { | ||
112 | __u64 blocks; | ||
113 | __u64 bfree; | ||
114 | __u64 bavail; | ||
115 | __u64 files; | ||
116 | __u64 ffree; | ||
117 | __u32 bsize; | ||
118 | __u32 namelen; | ||
119 | __u32 frsize; | ||
120 | __u32 padding; | ||
121 | __u32 spare[6]; | ||
122 | }; | ||
123 | |||
124 | struct fuse_file_lock { | ||
125 | __u64 start; | ||
126 | __u64 end; | ||
127 | __u32 type; | ||
128 | __u32 pid; /* tgid */ | ||
129 | }; | ||
130 | |||
131 | /** | ||
132 | * Bitmasks for fuse_setattr_in.valid | ||
133 | */ | ||
134 | #define FATTR_MODE (1 << 0) | ||
135 | #define FATTR_UID (1 << 1) | ||
136 | #define FATTR_GID (1 << 2) | ||
137 | #define FATTR_SIZE (1 << 3) | ||
138 | #define FATTR_ATIME (1 << 4) | ||
139 | #define FATTR_MTIME (1 << 5) | ||
140 | #define FATTR_FH (1 << 6) | ||
141 | #define FATTR_ATIME_NOW (1 << 7) | ||
142 | #define FATTR_MTIME_NOW (1 << 8) | ||
143 | #define FATTR_LOCKOWNER (1 << 9) | ||
144 | |||
145 | /** | ||
146 | * Flags returned by the OPEN request | ||
147 | * | ||
148 | * FOPEN_DIRECT_IO: bypass page cache for this open file | ||
149 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open | ||
150 | * FOPEN_NONSEEKABLE: the file is not seekable | ||
151 | */ | ||
152 | #define FOPEN_DIRECT_IO (1 << 0) | ||
153 | #define FOPEN_KEEP_CACHE (1 << 1) | ||
154 | #define FOPEN_NONSEEKABLE (1 << 2) | ||
155 | |||
156 | /** | ||
157 | * INIT request/reply flags | ||
158 | * | ||
159 | * FUSE_POSIX_LOCKS: remote locking for POSIX file locks | ||
160 | * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." | ||
161 | * FUSE_DONT_MASK: don't apply umask to file mode on create operations | ||
162 | * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks | ||
163 | */ | ||
164 | #define FUSE_ASYNC_READ (1 << 0) | ||
165 | #define FUSE_POSIX_LOCKS (1 << 1) | ||
166 | #define FUSE_FILE_OPS (1 << 2) | ||
167 | #define FUSE_ATOMIC_O_TRUNC (1 << 3) | ||
168 | #define FUSE_EXPORT_SUPPORT (1 << 4) | ||
169 | #define FUSE_BIG_WRITES (1 << 5) | ||
170 | #define FUSE_DONT_MASK (1 << 6) | ||
171 | #define FUSE_FLOCK_LOCKS (1 << 10) | ||
172 | |||
173 | /** | ||
174 | * CUSE INIT request/reply flags | ||
175 | * | ||
176 | * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl | ||
177 | */ | ||
178 | #define CUSE_UNRESTRICTED_IOCTL (1 << 0) | ||
179 | |||
180 | /** | ||
181 | * Release flags | ||
182 | */ | ||
183 | #define FUSE_RELEASE_FLUSH (1 << 0) | ||
184 | #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) | ||
185 | |||
186 | /** | ||
187 | * Getattr flags | ||
188 | */ | ||
189 | #define FUSE_GETATTR_FH (1 << 0) | ||
190 | |||
191 | /** | ||
192 | * Lock flags | ||
193 | */ | ||
194 | #define FUSE_LK_FLOCK (1 << 0) | ||
195 | |||
196 | /** | ||
197 | * WRITE flags | ||
198 | * | ||
199 | * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed | ||
200 | * FUSE_WRITE_LOCKOWNER: lock_owner field is valid | ||
201 | */ | ||
202 | #define FUSE_WRITE_CACHE (1 << 0) | ||
203 | #define FUSE_WRITE_LOCKOWNER (1 << 1) | ||
204 | |||
205 | /** | ||
206 | * Read flags | ||
207 | */ | ||
208 | #define FUSE_READ_LOCKOWNER (1 << 1) | ||
209 | |||
210 | /** | ||
211 | * Ioctl flags | ||
212 | * | ||
213 | * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine | ||
214 | * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed | ||
215 | * FUSE_IOCTL_RETRY: retry with new iovecs | ||
216 | * FUSE_IOCTL_32BIT: 32bit ioctl | ||
217 | * | ||
218 | * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs | ||
219 | */ | ||
220 | #define FUSE_IOCTL_COMPAT (1 << 0) | ||
221 | #define FUSE_IOCTL_UNRESTRICTED (1 << 1) | ||
222 | #define FUSE_IOCTL_RETRY (1 << 2) | ||
223 | #define FUSE_IOCTL_32BIT (1 << 3) | ||
224 | |||
225 | #define FUSE_IOCTL_MAX_IOV 256 | ||
226 | |||
227 | /** | ||
228 | * Poll flags | ||
229 | * | ||
230 | * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify | ||
231 | */ | ||
232 | #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) | ||
233 | |||
234 | enum fuse_opcode { | ||
235 | FUSE_LOOKUP = 1, | ||
236 | FUSE_FORGET = 2, /* no reply */ | ||
237 | FUSE_GETATTR = 3, | ||
238 | FUSE_SETATTR = 4, | ||
239 | FUSE_READLINK = 5, | ||
240 | FUSE_SYMLINK = 6, | ||
241 | FUSE_MKNOD = 8, | ||
242 | FUSE_MKDIR = 9, | ||
243 | FUSE_UNLINK = 10, | ||
244 | FUSE_RMDIR = 11, | ||
245 | FUSE_RENAME = 12, | ||
246 | FUSE_LINK = 13, | ||
247 | FUSE_OPEN = 14, | ||
248 | FUSE_READ = 15, | ||
249 | FUSE_WRITE = 16, | ||
250 | FUSE_STATFS = 17, | ||
251 | FUSE_RELEASE = 18, | ||
252 | FUSE_FSYNC = 20, | ||
253 | FUSE_SETXATTR = 21, | ||
254 | FUSE_GETXATTR = 22, | ||
255 | FUSE_LISTXATTR = 23, | ||
256 | FUSE_REMOVEXATTR = 24, | ||
257 | FUSE_FLUSH = 25, | ||
258 | FUSE_INIT = 26, | ||
259 | FUSE_OPENDIR = 27, | ||
260 | FUSE_READDIR = 28, | ||
261 | FUSE_RELEASEDIR = 29, | ||
262 | FUSE_FSYNCDIR = 30, | ||
263 | FUSE_GETLK = 31, | ||
264 | FUSE_SETLK = 32, | ||
265 | FUSE_SETLKW = 33, | ||
266 | FUSE_ACCESS = 34, | ||
267 | FUSE_CREATE = 35, | ||
268 | FUSE_INTERRUPT = 36, | ||
269 | FUSE_BMAP = 37, | ||
270 | FUSE_DESTROY = 38, | ||
271 | FUSE_IOCTL = 39, | ||
272 | FUSE_POLL = 40, | ||
273 | FUSE_NOTIFY_REPLY = 41, | ||
274 | FUSE_BATCH_FORGET = 42, | ||
275 | |||
276 | /* CUSE specific operations */ | ||
277 | CUSE_INIT = 4096, | ||
278 | }; | ||
279 | |||
280 | enum fuse_notify_code { | ||
281 | FUSE_NOTIFY_POLL = 1, | ||
282 | FUSE_NOTIFY_INVAL_INODE = 2, | ||
283 | FUSE_NOTIFY_INVAL_ENTRY = 3, | ||
284 | FUSE_NOTIFY_STORE = 4, | ||
285 | FUSE_NOTIFY_RETRIEVE = 5, | ||
286 | FUSE_NOTIFY_CODE_MAX, | ||
287 | }; | ||
288 | |||
289 | /* The read buffer is required to be at least 8k, but may be much larger */ | ||
290 | #define FUSE_MIN_READ_BUFFER 8192 | ||
291 | |||
292 | #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 | ||
293 | |||
294 | struct fuse_entry_out { | ||
295 | __u64 nodeid; /* Inode ID */ | ||
296 | __u64 generation; /* Inode generation: nodeid:gen must | ||
297 | be unique for the fs's lifetime */ | ||
298 | __u64 entry_valid; /* Cache timeout for the name */ | ||
299 | __u64 attr_valid; /* Cache timeout for the attributes */ | ||
300 | __u32 entry_valid_nsec; | ||
301 | __u32 attr_valid_nsec; | ||
302 | struct fuse_attr attr; | ||
303 | }; | ||
304 | |||
305 | struct fuse_forget_in { | ||
306 | __u64 nlookup; | ||
307 | }; | ||
308 | |||
309 | struct fuse_forget_one { | ||
310 | __u64 nodeid; | ||
311 | __u64 nlookup; | ||
312 | }; | ||
313 | |||
314 | struct fuse_batch_forget_in { | ||
315 | __u32 count; | ||
316 | __u32 dummy; | ||
317 | }; | ||
318 | |||
319 | struct fuse_getattr_in { | ||
320 | __u32 getattr_flags; | ||
321 | __u32 dummy; | ||
322 | __u64 fh; | ||
323 | }; | ||
324 | |||
325 | #define FUSE_COMPAT_ATTR_OUT_SIZE 96 | ||
326 | |||
327 | struct fuse_attr_out { | ||
328 | __u64 attr_valid; /* Cache timeout for the attributes */ | ||
329 | __u32 attr_valid_nsec; | ||
330 | __u32 dummy; | ||
331 | struct fuse_attr attr; | ||
332 | }; | ||
333 | |||
334 | #define FUSE_COMPAT_MKNOD_IN_SIZE 8 | ||
335 | |||
336 | struct fuse_mknod_in { | ||
337 | __u32 mode; | ||
338 | __u32 rdev; | ||
339 | __u32 umask; | ||
340 | __u32 padding; | ||
341 | }; | ||
342 | |||
343 | struct fuse_mkdir_in { | ||
344 | __u32 mode; | ||
345 | __u32 umask; | ||
346 | }; | ||
347 | |||
348 | struct fuse_rename_in { | ||
349 | __u64 newdir; | ||
350 | }; | ||
351 | |||
352 | struct fuse_link_in { | ||
353 | __u64 oldnodeid; | ||
354 | }; | ||
355 | |||
356 | struct fuse_setattr_in { | ||
357 | __u32 valid; | ||
358 | __u32 padding; | ||
359 | __u64 fh; | ||
360 | __u64 size; | ||
361 | __u64 lock_owner; | ||
362 | __u64 atime; | ||
363 | __u64 mtime; | ||
364 | __u64 unused2; | ||
365 | __u32 atimensec; | ||
366 | __u32 mtimensec; | ||
367 | __u32 unused3; | ||
368 | __u32 mode; | ||
369 | __u32 unused4; | ||
370 | __u32 uid; | ||
371 | __u32 gid; | ||
372 | __u32 unused5; | ||
373 | }; | ||
374 | |||
375 | struct fuse_open_in { | ||
376 | __u32 flags; | ||
377 | __u32 unused; | ||
378 | }; | ||
379 | |||
380 | struct fuse_create_in { | ||
381 | __u32 flags; | ||
382 | __u32 mode; | ||
383 | __u32 umask; | ||
384 | __u32 padding; | ||
385 | }; | ||
386 | |||
387 | struct fuse_open_out { | ||
388 | __u64 fh; | ||
389 | __u32 open_flags; | ||
390 | __u32 padding; | ||
391 | }; | ||
392 | |||
393 | struct fuse_release_in { | ||
394 | __u64 fh; | ||
395 | __u32 flags; | ||
396 | __u32 release_flags; | ||
397 | __u64 lock_owner; | ||
398 | }; | ||
399 | |||
400 | struct fuse_flush_in { | ||
401 | __u64 fh; | ||
402 | __u32 unused; | ||
403 | __u32 padding; | ||
404 | __u64 lock_owner; | ||
405 | }; | ||
406 | |||
407 | struct fuse_read_in { | ||
408 | __u64 fh; | ||
409 | __u64 offset; | ||
410 | __u32 size; | ||
411 | __u32 read_flags; | ||
412 | __u64 lock_owner; | ||
413 | __u32 flags; | ||
414 | __u32 padding; | ||
415 | }; | ||
416 | |||
417 | #define FUSE_COMPAT_WRITE_IN_SIZE 24 | ||
418 | |||
419 | struct fuse_write_in { | ||
420 | __u64 fh; | ||
421 | __u64 offset; | ||
422 | __u32 size; | ||
423 | __u32 write_flags; | ||
424 | __u64 lock_owner; | ||
425 | __u32 flags; | ||
426 | __u32 padding; | ||
427 | }; | ||
428 | |||
429 | struct fuse_write_out { | ||
430 | __u32 size; | ||
431 | __u32 padding; | ||
432 | }; | ||
433 | |||
434 | #define FUSE_COMPAT_STATFS_SIZE 48 | ||
435 | |||
436 | struct fuse_statfs_out { | ||
437 | struct fuse_kstatfs st; | ||
438 | }; | ||
439 | |||
440 | struct fuse_fsync_in { | ||
441 | __u64 fh; | ||
442 | __u32 fsync_flags; | ||
443 | __u32 padding; | ||
444 | }; | ||
445 | |||
446 | struct fuse_setxattr_in { | ||
447 | __u32 size; | ||
448 | __u32 flags; | ||
449 | }; | ||
450 | |||
451 | struct fuse_getxattr_in { | ||
452 | __u32 size; | ||
453 | __u32 padding; | ||
454 | }; | ||
455 | |||
456 | struct fuse_getxattr_out { | ||
457 | __u32 size; | ||
458 | __u32 padding; | ||
459 | }; | ||
460 | |||
461 | struct fuse_lk_in { | ||
462 | __u64 fh; | ||
463 | __u64 owner; | ||
464 | struct fuse_file_lock lk; | ||
465 | __u32 lk_flags; | ||
466 | __u32 padding; | ||
467 | }; | ||
468 | |||
469 | struct fuse_lk_out { | ||
470 | struct fuse_file_lock lk; | ||
471 | }; | ||
472 | |||
473 | struct fuse_access_in { | ||
474 | __u32 mask; | ||
475 | __u32 padding; | ||
476 | }; | ||
477 | |||
478 | struct fuse_init_in { | ||
479 | __u32 major; | ||
480 | __u32 minor; | ||
481 | __u32 max_readahead; | ||
482 | __u32 flags; | ||
483 | }; | ||
484 | |||
485 | struct fuse_init_out { | ||
486 | __u32 major; | ||
487 | __u32 minor; | ||
488 | __u32 max_readahead; | ||
489 | __u32 flags; | ||
490 | __u16 max_background; | ||
491 | __u16 congestion_threshold; | ||
492 | __u32 max_write; | ||
493 | }; | ||
494 | |||
495 | #define CUSE_INIT_INFO_MAX 4096 | ||
496 | |||
497 | struct cuse_init_in { | ||
498 | __u32 major; | ||
499 | __u32 minor; | ||
500 | __u32 unused; | ||
501 | __u32 flags; | ||
502 | }; | ||
503 | |||
504 | struct cuse_init_out { | ||
505 | __u32 major; | ||
506 | __u32 minor; | ||
507 | __u32 unused; | ||
508 | __u32 flags; | ||
509 | __u32 max_read; | ||
510 | __u32 max_write; | ||
511 | __u32 dev_major; /* chardev major */ | ||
512 | __u32 dev_minor; /* chardev minor */ | ||
513 | __u32 spare[10]; | ||
514 | }; | ||
515 | |||
516 | struct fuse_interrupt_in { | ||
517 | __u64 unique; | ||
518 | }; | ||
519 | |||
520 | struct fuse_bmap_in { | ||
521 | __u64 block; | ||
522 | __u32 blocksize; | ||
523 | __u32 padding; | ||
524 | }; | ||
525 | |||
526 | struct fuse_bmap_out { | ||
527 | __u64 block; | ||
528 | }; | ||
529 | |||
530 | struct fuse_ioctl_in { | ||
531 | __u64 fh; | ||
532 | __u32 flags; | ||
533 | __u32 cmd; | ||
534 | __u64 arg; | ||
535 | __u32 in_size; | ||
536 | __u32 out_size; | ||
537 | }; | ||
538 | |||
539 | struct fuse_ioctl_iovec { | ||
540 | __u64 base; | ||
541 | __u64 len; | ||
542 | }; | ||
543 | |||
544 | struct fuse_ioctl_out { | ||
545 | __s32 result; | ||
546 | __u32 flags; | ||
547 | __u32 in_iovs; | ||
548 | __u32 out_iovs; | ||
549 | }; | ||
550 | |||
551 | struct fuse_poll_in { | ||
552 | __u64 fh; | ||
553 | __u64 kh; | ||
554 | __u32 flags; | ||
555 | __u32 padding; | ||
556 | }; | ||
557 | |||
558 | struct fuse_poll_out { | ||
559 | __u32 revents; | ||
560 | __u32 padding; | ||
561 | }; | ||
562 | |||
563 | struct fuse_notify_poll_wakeup_out { | ||
564 | __u64 kh; | ||
565 | }; | ||
566 | |||
567 | struct fuse_in_header { | ||
568 | __u32 len; | ||
569 | __u32 opcode; | ||
570 | __u64 unique; | ||
571 | __u64 nodeid; | ||
572 | __u32 uid; | ||
573 | __u32 gid; | ||
574 | __u32 pid; | ||
575 | __u32 padding; | ||
576 | }; | ||
577 | |||
578 | struct fuse_out_header { | ||
579 | __u32 len; | ||
580 | __s32 error; | ||
581 | __u64 unique; | ||
582 | }; | ||
583 | |||
584 | struct fuse_dirent { | ||
585 | __u64 ino; | ||
586 | __u64 off; | ||
587 | __u32 namelen; | ||
588 | __u32 type; | ||
589 | char name[0]; | ||
590 | }; | ||
591 | |||
592 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) | ||
593 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | ||
594 | #define FUSE_DIRENT_SIZE(d) \ | ||
595 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | ||
596 | |||
597 | struct fuse_notify_inval_inode_out { | ||
598 | __u64 ino; | ||
599 | __s64 off; | ||
600 | __s64 len; | ||
601 | }; | ||
602 | |||
603 | struct fuse_notify_inval_entry_out { | ||
604 | __u64 parent; | ||
605 | __u32 namelen; | ||
606 | __u32 padding; | ||
607 | }; | ||
608 | |||
609 | struct fuse_notify_store_out { | ||
610 | __u64 nodeid; | ||
611 | __u64 offset; | ||
612 | __u32 size; | ||
613 | __u32 padding; | ||
614 | }; | ||
615 | |||
616 | struct fuse_notify_retrieve_out { | ||
617 | __u64 notify_unique; | ||
618 | __u64 nodeid; | ||
619 | __u64 offset; | ||
620 | __u32 size; | ||
621 | __u32 padding; | ||
622 | }; | ||
623 | |||
624 | /* Matches the size of fuse_write_in */ | ||
625 | struct fuse_notify_retrieve_in { | ||
626 | __u64 dummy1; | ||
627 | __u64 offset; | ||
628 | __u32 size; | ||
629 | __u32 dummy2; | ||
630 | __u64 dummy3; | ||
631 | __u64 dummy4; | ||
632 | }; | ||
633 | |||
634 | #endif /* _LINUX_FUSE_H */ | ||
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h new file mode 100644 index 00000000000..552c8a0a12d --- /dev/null +++ b/include/linux/gen_stats.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef __LINUX_GEN_STATS_H | ||
2 | #define __LINUX_GEN_STATS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | TCA_STATS_UNSPEC, | ||
8 | TCA_STATS_BASIC, | ||
9 | TCA_STATS_RATE_EST, | ||
10 | TCA_STATS_QUEUE, | ||
11 | TCA_STATS_APP, | ||
12 | __TCA_STATS_MAX, | ||
13 | }; | ||
14 | #define TCA_STATS_MAX (__TCA_STATS_MAX - 1) | ||
15 | |||
16 | /** | ||
17 | * struct gnet_stats_basic - byte/packet throughput statistics | ||
18 | * @bytes: number of seen bytes | ||
19 | * @packets: number of seen packets | ||
20 | */ | ||
21 | struct gnet_stats_basic { | ||
22 | __u64 bytes; | ||
23 | __u32 packets; | ||
24 | }; | ||
25 | struct gnet_stats_basic_packed { | ||
26 | __u64 bytes; | ||
27 | __u32 packets; | ||
28 | } __attribute__ ((packed)); | ||
29 | |||
30 | /** | ||
31 | * struct gnet_stats_rate_est - rate estimator | ||
32 | * @bps: current byte rate | ||
33 | * @pps: current packet rate | ||
34 | */ | ||
35 | struct gnet_stats_rate_est { | ||
36 | __u32 bps; | ||
37 | __u32 pps; | ||
38 | }; | ||
39 | |||
40 | /** | ||
41 | * struct gnet_stats_queue - queuing statistics | ||
42 | * @qlen: queue length | ||
43 | * @backlog: backlog size of queue | ||
44 | * @drops: number of dropped packets | ||
45 | * @requeues: number of requeues | ||
46 | * @overlimits: number of enqueues over the limit | ||
47 | */ | ||
48 | struct gnet_stats_queue { | ||
49 | __u32 qlen; | ||
50 | __u32 backlog; | ||
51 | __u32 drops; | ||
52 | __u32 requeues; | ||
53 | __u32 overlimits; | ||
54 | }; | ||
55 | |||
56 | /** | ||
57 | * struct gnet_estimator - rate estimator configuration | ||
58 | * @interval: sampling period | ||
59 | * @ewma_log: the log of measurement window weight | ||
60 | */ | ||
61 | struct gnet_estimator { | ||
62 | signed char interval; | ||
63 | unsigned char ewma_log; | ||
64 | }; | ||
65 | |||
66 | |||
67 | #endif /* __LINUX_GEN_STATS_H */ | ||
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h new file mode 100644 index 00000000000..fadff28505b --- /dev/null +++ b/include/linux/generic_serial.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * generic_serial.h | ||
3 | * | ||
4 | * Copyright (C) 1998 R.E.Wolff@BitWizard.nl | ||
5 | * | ||
6 | * written for the SX serial driver. | ||
7 | * Contains the code that should be shared over all the serial drivers. | ||
8 | * | ||
9 | * Version 0.1 -- December, 1998. | ||
10 | */ | ||
11 | |||
12 | #ifndef GENERIC_SERIAL_H | ||
13 | #define GENERIC_SERIAL_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | #include <linux/mutex.h> | ||
17 | #include <linux/tty.h> | ||
18 | |||
19 | struct real_driver { | ||
20 | void (*disable_tx_interrupts) (void *); | ||
21 | void (*enable_tx_interrupts) (void *); | ||
22 | void (*disable_rx_interrupts) (void *); | ||
23 | void (*enable_rx_interrupts) (void *); | ||
24 | void (*shutdown_port) (void*); | ||
25 | int (*set_real_termios) (void*); | ||
26 | int (*chars_in_buffer) (void*); | ||
27 | void (*close) (void*); | ||
28 | void (*hungup) (void*); | ||
29 | void (*getserial) (void*, struct serial_struct *sp); | ||
30 | }; | ||
31 | |||
32 | |||
33 | |||
34 | struct gs_port { | ||
35 | int magic; | ||
36 | struct tty_port port; | ||
37 | unsigned char *xmit_buf; | ||
38 | int xmit_head; | ||
39 | int xmit_tail; | ||
40 | int xmit_cnt; | ||
41 | struct mutex port_write_mutex; | ||
42 | unsigned long event; | ||
43 | unsigned short closing_wait; | ||
44 | int close_delay; | ||
45 | struct real_driver *rd; | ||
46 | int wakeup_chars; | ||
47 | int baud_base; | ||
48 | int baud; | ||
49 | int custom_divisor; | ||
50 | spinlock_t driver_lock; | ||
51 | }; | ||
52 | |||
53 | #endif /* __KERNEL__ */ | ||
54 | |||
55 | /* Flags */ | ||
56 | /* Warning: serial.h defines some ASYNC_ flags, they say they are "only" | ||
57 | used in serial.c, but they are also used in all other serial drivers. | ||
58 | Make sure they don't clash with these here... */ | ||
59 | #define GS_TX_INTEN 0x00800000 | ||
60 | #define GS_RX_INTEN 0x00400000 | ||
61 | #define GS_ACTIVE 0x00200000 | ||
62 | |||
63 | |||
64 | |||
65 | #define GS_TYPE_NORMAL 1 | ||
66 | |||
67 | #define GS_DEBUG_FLUSH 0x00000001 | ||
68 | #define GS_DEBUG_BTR 0x00000002 | ||
69 | #define GS_DEBUG_TERMIOS 0x00000004 | ||
70 | #define GS_DEBUG_STUFF 0x00000008 | ||
71 | #define GS_DEBUG_CLOSE 0x00000010 | ||
72 | #define GS_DEBUG_FLOW 0x00000020 | ||
73 | #define GS_DEBUG_WRITE 0x00000040 | ||
74 | |||
75 | #ifdef __KERNEL__ | ||
76 | int gs_put_char(struct tty_struct *tty, unsigned char ch); | ||
77 | int gs_write(struct tty_struct *tty, | ||
78 | const unsigned char *buf, int count); | ||
79 | int gs_write_room(struct tty_struct *tty); | ||
80 | int gs_chars_in_buffer(struct tty_struct *tty); | ||
81 | void gs_flush_buffer(struct tty_struct *tty); | ||
82 | void gs_flush_chars(struct tty_struct *tty); | ||
83 | void gs_stop(struct tty_struct *tty); | ||
84 | void gs_start(struct tty_struct *tty); | ||
85 | void gs_hangup(struct tty_struct *tty); | ||
86 | int gs_block_til_ready(void *port, struct file *filp); | ||
87 | void gs_close(struct tty_struct *tty, struct file *filp); | ||
88 | void gs_set_termios (struct tty_struct * tty, | ||
89 | struct ktermios * old_termios); | ||
90 | int gs_init_port(struct gs_port *port); | ||
91 | int gs_setserial(struct gs_port *port, struct serial_struct __user *sp); | ||
92 | int gs_getserial(struct gs_port *port, struct serial_struct __user *sp); | ||
93 | void gs_got_break(struct gs_port *port); | ||
94 | #endif /* __KERNEL__ */ | ||
95 | #endif | ||
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h new file mode 100644 index 00000000000..4f4462974c1 --- /dev/null +++ b/include/linux/gfs2_ondisk.h | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | ||
3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * This copyrighted material is made available to anyone wishing to use, | ||
6 | * modify, copy, or redistribute it subject to the terms and conditions | ||
7 | * of the GNU General Public License v.2. | ||
8 | */ | ||
9 | |||
10 | #ifndef __GFS2_ONDISK_DOT_H__ | ||
11 | #define __GFS2_ONDISK_DOT_H__ | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | #define GFS2_MAGIC 0x01161970 | ||
16 | #define GFS2_BASIC_BLOCK 512 | ||
17 | #define GFS2_BASIC_BLOCK_SHIFT 9 | ||
18 | |||
19 | /* Lock numbers of the LM_TYPE_NONDISK type */ | ||
20 | |||
21 | #define GFS2_MOUNT_LOCK 0 | ||
22 | #define GFS2_LIVE_LOCK 1 | ||
23 | #define GFS2_TRANS_LOCK 2 | ||
24 | #define GFS2_RENAME_LOCK 3 | ||
25 | |||
26 | /* Format numbers for various metadata types */ | ||
27 | |||
28 | #define GFS2_FORMAT_NONE 0 | ||
29 | #define GFS2_FORMAT_SB 100 | ||
30 | #define GFS2_FORMAT_RG 200 | ||
31 | #define GFS2_FORMAT_RB 300 | ||
32 | #define GFS2_FORMAT_DI 400 | ||
33 | #define GFS2_FORMAT_IN 500 | ||
34 | #define GFS2_FORMAT_LF 600 | ||
35 | #define GFS2_FORMAT_JD 700 | ||
36 | #define GFS2_FORMAT_LH 800 | ||
37 | #define GFS2_FORMAT_LD 900 | ||
38 | #define GFS2_FORMAT_LB 1000 | ||
39 | #define GFS2_FORMAT_EA 1600 | ||
40 | #define GFS2_FORMAT_ED 1700 | ||
41 | #define GFS2_FORMAT_QC 1400 | ||
42 | /* These are format numbers for entities contained in files */ | ||
43 | #define GFS2_FORMAT_RI 1100 | ||
44 | #define GFS2_FORMAT_DE 1200 | ||
45 | #define GFS2_FORMAT_QU 1500 | ||
46 | /* These are part of the superblock */ | ||
47 | #define GFS2_FORMAT_FS 1801 | ||
48 | #define GFS2_FORMAT_MULTI 1900 | ||
49 | |||
50 | /* | ||
51 | * An on-disk inode number | ||
52 | */ | ||
53 | |||
54 | struct gfs2_inum { | ||
55 | __be64 no_formal_ino; | ||
56 | __be64 no_addr; | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * Generic metadata head structure | ||
61 | * Every inplace buffer logged in the journal must start with this. | ||
62 | */ | ||
63 | |||
64 | #define GFS2_METATYPE_NONE 0 | ||
65 | #define GFS2_METATYPE_SB 1 | ||
66 | #define GFS2_METATYPE_RG 2 | ||
67 | #define GFS2_METATYPE_RB 3 | ||
68 | #define GFS2_METATYPE_DI 4 | ||
69 | #define GFS2_METATYPE_IN 5 | ||
70 | #define GFS2_METATYPE_LF 6 | ||
71 | #define GFS2_METATYPE_JD 7 | ||
72 | #define GFS2_METATYPE_LH 8 | ||
73 | #define GFS2_METATYPE_LD 9 | ||
74 | #define GFS2_METATYPE_LB 12 | ||
75 | #define GFS2_METATYPE_EA 10 | ||
76 | #define GFS2_METATYPE_ED 11 | ||
77 | #define GFS2_METATYPE_QC 14 | ||
78 | |||
79 | struct gfs2_meta_header { | ||
80 | __be32 mh_magic; | ||
81 | __be32 mh_type; | ||
82 | __be64 __pad0; /* Was generation number in gfs1 */ | ||
83 | __be32 mh_format; | ||
84 | /* This union is to keep userspace happy */ | ||
85 | union { | ||
86 | __be32 mh_jid; /* Was incarnation number in gfs1 */ | ||
87 | __be32 __pad1; | ||
88 | }; | ||
89 | }; | ||
90 | |||
91 | /* | ||
92 | * super-block structure | ||
93 | * | ||
94 | * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes) | ||
95 | * | ||
96 | * Order is important, need to be able to read old superblocks to do on-disk | ||
97 | * version upgrades. | ||
98 | */ | ||
99 | |||
100 | /* Address of superblock in GFS2 basic blocks */ | ||
101 | #define GFS2_SB_ADDR 128 | ||
102 | |||
103 | /* The lock number for the superblock (must be zero) */ | ||
104 | #define GFS2_SB_LOCK 0 | ||
105 | |||
106 | /* Requirement: GFS2_LOCKNAME_LEN % 8 == 0 | ||
107 | Includes: the fencing zero at the end */ | ||
108 | #define GFS2_LOCKNAME_LEN 64 | ||
109 | |||
110 | struct gfs2_sb { | ||
111 | struct gfs2_meta_header sb_header; | ||
112 | |||
113 | __be32 sb_fs_format; | ||
114 | __be32 sb_multihost_format; | ||
115 | __u32 __pad0; /* Was superblock flags in gfs1 */ | ||
116 | |||
117 | __be32 sb_bsize; | ||
118 | __be32 sb_bsize_shift; | ||
119 | __u32 __pad1; /* Was journal segment size in gfs1 */ | ||
120 | |||
121 | struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ | ||
122 | struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ | ||
123 | struct gfs2_inum sb_root_dir; | ||
124 | |||
125 | char sb_lockproto[GFS2_LOCKNAME_LEN]; | ||
126 | char sb_locktable[GFS2_LOCKNAME_LEN]; | ||
127 | |||
128 | struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ | ||
129 | struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ | ||
130 | #define GFS2_HAS_UUID 1 | ||
131 | __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ | ||
132 | }; | ||
133 | |||
134 | /* | ||
135 | * resource index structure | ||
136 | */ | ||
137 | |||
138 | struct gfs2_rindex { | ||
139 | __be64 ri_addr; /* grp block disk address */ | ||
140 | __be32 ri_length; /* length of rgrp header in fs blocks */ | ||
141 | __u32 __pad; | ||
142 | |||
143 | __be64 ri_data0; /* first data location */ | ||
144 | __be32 ri_data; /* num of data blocks in rgrp */ | ||
145 | |||
146 | __be32 ri_bitbytes; /* number of bytes in data bitmaps */ | ||
147 | |||
148 | __u8 ri_reserved[64]; | ||
149 | }; | ||
150 | |||
151 | /* | ||
152 | * resource group header structure | ||
153 | */ | ||
154 | |||
155 | /* Number of blocks per byte in rgrp */ | ||
156 | #define GFS2_NBBY 4 | ||
157 | #define GFS2_BIT_SIZE 2 | ||
158 | #define GFS2_BIT_MASK 0x00000003 | ||
159 | |||
160 | #define GFS2_BLKST_FREE 0 | ||
161 | #define GFS2_BLKST_USED 1 | ||
162 | #define GFS2_BLKST_UNLINKED 2 | ||
163 | #define GFS2_BLKST_DINODE 3 | ||
164 | |||
165 | #define GFS2_RGF_JOURNAL 0x00000001 | ||
166 | #define GFS2_RGF_METAONLY 0x00000002 | ||
167 | #define GFS2_RGF_DATAONLY 0x00000004 | ||
168 | #define GFS2_RGF_NOALLOC 0x00000008 | ||
169 | |||
170 | struct gfs2_rgrp { | ||
171 | struct gfs2_meta_header rg_header; | ||
172 | |||
173 | __be32 rg_flags; | ||
174 | __be32 rg_free; | ||
175 | __be32 rg_dinodes; | ||
176 | __be32 __pad; | ||
177 | __be64 rg_igeneration; | ||
178 | |||
179 | __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */ | ||
180 | }; | ||
181 | |||
182 | /* | ||
183 | * quota structure | ||
184 | */ | ||
185 | |||
186 | struct gfs2_quota { | ||
187 | __be64 qu_limit; | ||
188 | __be64 qu_warn; | ||
189 | __be64 qu_value; | ||
190 | __u8 qu_reserved[64]; | ||
191 | }; | ||
192 | |||
193 | /* | ||
194 | * dinode structure | ||
195 | */ | ||
196 | |||
197 | #define GFS2_MAX_META_HEIGHT 10 | ||
198 | #define GFS2_DIR_MAX_DEPTH 17 | ||
199 | |||
200 | #define DT2IF(dt) (((dt) << 12) & S_IFMT) | ||
201 | #define IF2DT(sif) (((sif) & S_IFMT) >> 12) | ||
202 | |||
203 | enum { | ||
204 | gfs2fl_Jdata = 0, | ||
205 | gfs2fl_ExHash = 1, | ||
206 | gfs2fl_Unused = 2, | ||
207 | gfs2fl_EaIndirect = 3, | ||
208 | gfs2fl_Directio = 4, | ||
209 | gfs2fl_Immutable = 5, | ||
210 | gfs2fl_AppendOnly = 6, | ||
211 | gfs2fl_NoAtime = 7, | ||
212 | gfs2fl_Sync = 8, | ||
213 | gfs2fl_System = 9, | ||
214 | gfs2fl_TruncInProg = 29, | ||
215 | gfs2fl_InheritDirectio = 30, | ||
216 | gfs2fl_InheritJdata = 31, | ||
217 | }; | ||
218 | |||
219 | /* Dinode flags */ | ||
220 | #define GFS2_DIF_JDATA 0x00000001 | ||
221 | #define GFS2_DIF_EXHASH 0x00000002 | ||
222 | #define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */ | ||
223 | #define GFS2_DIF_EA_INDIRECT 0x00000008 | ||
224 | #define GFS2_DIF_DIRECTIO 0x00000010 | ||
225 | #define GFS2_DIF_IMMUTABLE 0x00000020 | ||
226 | #define GFS2_DIF_APPENDONLY 0x00000040 | ||
227 | #define GFS2_DIF_NOATIME 0x00000080 | ||
228 | #define GFS2_DIF_SYNC 0x00000100 | ||
229 | #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ | ||
230 | #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ | ||
231 | #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 | ||
232 | #define GFS2_DIF_INHERIT_JDATA 0x80000000 | ||
233 | |||
234 | struct gfs2_dinode { | ||
235 | struct gfs2_meta_header di_header; | ||
236 | |||
237 | struct gfs2_inum di_num; | ||
238 | |||
239 | __be32 di_mode; /* mode of file */ | ||
240 | __be32 di_uid; /* owner's user id */ | ||
241 | __be32 di_gid; /* owner's group id */ | ||
242 | __be32 di_nlink; /* number of links to this file */ | ||
243 | __be64 di_size; /* number of bytes in file */ | ||
244 | __be64 di_blocks; /* number of blocks in file */ | ||
245 | __be64 di_atime; /* time last accessed */ | ||
246 | __be64 di_mtime; /* time last modified */ | ||
247 | __be64 di_ctime; /* time last changed */ | ||
248 | __be32 di_major; /* device major number */ | ||
249 | __be32 di_minor; /* device minor number */ | ||
250 | |||
251 | /* This section varies from gfs1. Padding added to align with | ||
252 | * remainder of dinode | ||
253 | */ | ||
254 | __be64 di_goal_meta; /* rgrp to alloc from next */ | ||
255 | __be64 di_goal_data; /* data block goal */ | ||
256 | __be64 di_generation; /* generation number for NFS */ | ||
257 | |||
258 | __be32 di_flags; /* GFS2_DIF_... */ | ||
259 | __be32 di_payload_format; /* GFS2_FORMAT_... */ | ||
260 | __u16 __pad1; /* Was ditype in gfs1 */ | ||
261 | __be16 di_height; /* height of metadata */ | ||
262 | __u32 __pad2; /* Unused incarnation number from gfs1 */ | ||
263 | |||
264 | /* These only apply to directories */ | ||
265 | __u16 __pad3; /* Padding */ | ||
266 | __be16 di_depth; /* Number of bits in the table */ | ||
267 | __be32 di_entries; /* The number of entries in the directory */ | ||
268 | |||
269 | struct gfs2_inum __pad4; /* Unused even in current gfs1 */ | ||
270 | |||
271 | __be64 di_eattr; /* extended attribute block number */ | ||
272 | __be32 di_atime_nsec; /* nsec portion of atime */ | ||
273 | __be32 di_mtime_nsec; /* nsec portion of mtime */ | ||
274 | __be32 di_ctime_nsec; /* nsec portion of ctime */ | ||
275 | |||
276 | __u8 di_reserved[44]; | ||
277 | }; | ||
278 | |||
279 | /* | ||
280 | * directory structure - many of these per directory file | ||
281 | */ | ||
282 | |||
283 | #define GFS2_FNAMESIZE 255 | ||
284 | #define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7) | ||
285 | |||
286 | struct gfs2_dirent { | ||
287 | struct gfs2_inum de_inum; | ||
288 | __be32 de_hash; | ||
289 | __be16 de_rec_len; | ||
290 | __be16 de_name_len; | ||
291 | __be16 de_type; | ||
292 | __u8 __pad[14]; | ||
293 | }; | ||
294 | |||
295 | /* | ||
296 | * Header of leaf directory nodes | ||
297 | */ | ||
298 | |||
299 | struct gfs2_leaf { | ||
300 | struct gfs2_meta_header lf_header; | ||
301 | |||
302 | __be16 lf_depth; /* Depth of leaf */ | ||
303 | __be16 lf_entries; /* Number of dirents in leaf */ | ||
304 | __be32 lf_dirent_format; /* Format of the dirents */ | ||
305 | __be64 lf_next; /* Next leaf, if overflow */ | ||
306 | |||
307 | __u8 lf_reserved[64]; | ||
308 | }; | ||
309 | |||
310 | /* | ||
311 | * Extended attribute header format | ||
312 | * | ||
313 | * This works in a similar way to dirents. There is a fixed size header | ||
314 | * followed by a variable length section made up of the name and the | ||
315 | * associated data. In the case of a "stuffed" entry, the value is | ||
316 | * inline directly after the name, the ea_num_ptrs entry will be | ||
317 | * zero in that case. For non-"stuffed" entries, there will be | ||
318 | * a set of pointers (aligned to 8 byte boundary) to the block(s) | ||
319 | * containing the value. | ||
320 | * | ||
321 | * The blocks containing the values and the blocks containing the | ||
322 | * extended attribute headers themselves all start with the common | ||
323 | * metadata header. Each inode, if it has extended attributes, will | ||
324 | * have either a single block containing the extended attribute headers | ||
325 | * or a single indirect block pointing to blocks containing the | ||
326 | * extended attribure headers. | ||
327 | * | ||
328 | * The maximim size of the data part of an extended attribute is 64k | ||
329 | * so the number of blocks required depends upon block size. Since the | ||
330 | * block size also determines the number of pointers in an indirect | ||
331 | * block, its a fairly complicated calculation to work out the maximum | ||
332 | * number of blocks that an inode may have relating to extended attributes. | ||
333 | * | ||
334 | */ | ||
335 | |||
336 | #define GFS2_EA_MAX_NAME_LEN 255 | ||
337 | #define GFS2_EA_MAX_DATA_LEN 65536 | ||
338 | |||
339 | #define GFS2_EATYPE_UNUSED 0 | ||
340 | #define GFS2_EATYPE_USR 1 | ||
341 | #define GFS2_EATYPE_SYS 2 | ||
342 | #define GFS2_EATYPE_SECURITY 3 | ||
343 | |||
344 | #define GFS2_EATYPE_LAST 3 | ||
345 | #define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST) | ||
346 | |||
347 | #define GFS2_EAFLAG_LAST 0x01 /* last ea in block */ | ||
348 | |||
349 | struct gfs2_ea_header { | ||
350 | __be32 ea_rec_len; | ||
351 | __be32 ea_data_len; | ||
352 | __u8 ea_name_len; /* no NULL pointer after the string */ | ||
353 | __u8 ea_type; /* GFS2_EATYPE_... */ | ||
354 | __u8 ea_flags; /* GFS2_EAFLAG_... */ | ||
355 | __u8 ea_num_ptrs; | ||
356 | __u32 __pad; | ||
357 | }; | ||
358 | |||
359 | /* | ||
360 | * Log header structure | ||
361 | */ | ||
362 | |||
363 | #define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */ | ||
364 | |||
365 | struct gfs2_log_header { | ||
366 | struct gfs2_meta_header lh_header; | ||
367 | |||
368 | __be64 lh_sequence; /* Sequence number of this transaction */ | ||
369 | __be32 lh_flags; /* GFS2_LOG_HEAD_... */ | ||
370 | __be32 lh_tail; /* Block number of log tail */ | ||
371 | __be32 lh_blkno; | ||
372 | __be32 lh_hash; | ||
373 | }; | ||
374 | |||
375 | /* | ||
376 | * Log type descriptor | ||
377 | */ | ||
378 | |||
379 | #define GFS2_LOG_DESC_METADATA 300 | ||
380 | /* ld_data1 is the number of metadata blocks in the descriptor. | ||
381 | ld_data2 is unused. */ | ||
382 | |||
383 | #define GFS2_LOG_DESC_REVOKE 301 | ||
384 | /* ld_data1 is the number of revoke blocks in the descriptor. | ||
385 | ld_data2 is unused. */ | ||
386 | |||
387 | #define GFS2_LOG_DESC_JDATA 302 | ||
388 | /* ld_data1 is the number of data blocks in the descriptor. | ||
389 | ld_data2 is unused. */ | ||
390 | |||
391 | struct gfs2_log_descriptor { | ||
392 | struct gfs2_meta_header ld_header; | ||
393 | |||
394 | __be32 ld_type; /* GFS2_LOG_DESC_... */ | ||
395 | __be32 ld_length; /* Number of buffers in this chunk */ | ||
396 | __be32 ld_data1; /* descriptor-specific field */ | ||
397 | __be32 ld_data2; /* descriptor-specific field */ | ||
398 | |||
399 | __u8 ld_reserved[32]; | ||
400 | }; | ||
401 | |||
402 | /* | ||
403 | * Inum Range | ||
404 | * Describe a range of formal inode numbers allocated to | ||
405 | * one machine to assign to inodes. | ||
406 | */ | ||
407 | |||
408 | #define GFS2_INUM_QUANTUM 1048576 | ||
409 | |||
410 | struct gfs2_inum_range { | ||
411 | __be64 ir_start; | ||
412 | __be64 ir_length; | ||
413 | }; | ||
414 | |||
415 | /* | ||
416 | * Statfs change | ||
417 | * Describes an change to the pool of free and allocated | ||
418 | * blocks. | ||
419 | */ | ||
420 | |||
421 | struct gfs2_statfs_change { | ||
422 | __be64 sc_total; | ||
423 | __be64 sc_free; | ||
424 | __be64 sc_dinodes; | ||
425 | }; | ||
426 | |||
427 | /* | ||
428 | * Quota change | ||
429 | * Describes an allocation change for a particular | ||
430 | * user or group. | ||
431 | */ | ||
432 | |||
433 | #define GFS2_QCF_USER 0x00000001 | ||
434 | |||
435 | struct gfs2_quota_change { | ||
436 | __be64 qc_change; | ||
437 | __be32 qc_flags; /* GFS2_QCF_... */ | ||
438 | __be32 qc_id; | ||
439 | }; | ||
440 | |||
441 | struct gfs2_quota_lvb { | ||
442 | __be32 qb_magic; | ||
443 | __u32 __pad; | ||
444 | __be64 qb_limit; /* Hard limit of # blocks to alloc */ | ||
445 | __be64 qb_warn; /* Warn user when alloc is above this # */ | ||
446 | __be64 qb_value; /* Current # blocks allocated */ | ||
447 | }; | ||
448 | |||
449 | #endif /* __GFS2_ONDISK_DOT_H__ */ | ||
diff --git a/include/linux/gigaset_dev.h b/include/linux/gigaset_dev.h new file mode 100644 index 00000000000..258ba82937e --- /dev/null +++ b/include/linux/gigaset_dev.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * interface to user space for the gigaset driver | ||
3 | * | ||
4 | * Copyright (c) 2004 by Hansjoerg Lipp <hjlipp@web.de> | ||
5 | * | ||
6 | * ===================================================================== | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License as | ||
9 | * published by the Free Software Foundation; either version 2 of | ||
10 | * the License, or (at your option) any later version. | ||
11 | * ===================================================================== | ||
12 | */ | ||
13 | |||
14 | #ifndef GIGASET_INTERFACE_H | ||
15 | #define GIGASET_INTERFACE_H | ||
16 | |||
17 | #include <linux/ioctl.h> | ||
18 | |||
19 | /* The magic IOCTL value for this interface. */ | ||
20 | #define GIGASET_IOCTL 0x47 | ||
21 | |||
22 | /* enable/disable device control via character device (lock out ISDN subsys) */ | ||
23 | #define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int) | ||
24 | |||
25 | /* enable adapter configuration mode (M10x only) */ | ||
26 | #define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int) | ||
27 | |||
28 | /* set break characters (M105 only) */ | ||
29 | #define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6]) | ||
30 | |||
31 | /* get version information selected by arg[0] */ | ||
32 | #define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4]) | ||
33 | /* values for GIGASET_VERSION arg[0] */ | ||
34 | #define GIGVER_DRIVER 0 /* get driver version */ | ||
35 | #define GIGVER_COMPAT 1 /* get interface compatibility version */ | ||
36 | #define GIGVER_FWBASE 2 /* get base station firmware version */ | ||
37 | |||
38 | #endif | ||
diff --git a/include/linux/gpio-i2cmux.h b/include/linux/gpio-i2cmux.h new file mode 100644 index 00000000000..4a333bb0bd0 --- /dev/null +++ b/include/linux/gpio-i2cmux.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * gpio-i2cmux interface to platform code | ||
3 | * | ||
4 | * Peter Korsgaard <peter.korsgaard@barco.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef _LINUX_GPIO_I2CMUX_H | ||
12 | #define _LINUX_GPIO_I2CMUX_H | ||
13 | |||
14 | /* MUX has no specific idle mode */ | ||
15 | #define GPIO_I2CMUX_NO_IDLE ((unsigned)-1) | ||
16 | |||
17 | /** | ||
18 | * struct gpio_i2cmux_platform_data - Platform-dependent data for gpio-i2cmux | ||
19 | * @parent: Parent I2C bus adapter number | ||
20 | * @base_nr: Base I2C bus number to number adapters from or zero for dynamic | ||
21 | * @values: Array of bitmasks of GPIO settings (low/high) for each | ||
22 | * position | ||
23 | * @n_values: Number of multiplexer positions (busses to instantiate) | ||
24 | * @gpios: Array of GPIO numbers used to control MUX | ||
25 | * @n_gpios: Number of GPIOs used to control MUX | ||
26 | * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used | ||
27 | */ | ||
28 | struct gpio_i2cmux_platform_data { | ||
29 | int parent; | ||
30 | int base_nr; | ||
31 | const unsigned *values; | ||
32 | int n_values; | ||
33 | const unsigned *gpios; | ||
34 | int n_gpios; | ||
35 | unsigned idle; | ||
36 | }; | ||
37 | |||
38 | #endif /* _LINUX_GPIO_I2CMUX_H */ | ||
diff --git a/include/linux/gpio_event.h b/include/linux/gpio_event.h new file mode 100644 index 00000000000..2613fc5e4a9 --- /dev/null +++ b/include/linux/gpio_event.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /* include/linux/gpio_event.h | ||
2 | * | ||
3 | * Copyright (C) 2007 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_GPIO_EVENT_H | ||
17 | #define _LINUX_GPIO_EVENT_H | ||
18 | |||
19 | #include <linux/input.h> | ||
20 | |||
21 | struct gpio_event_input_devs { | ||
22 | int count; | ||
23 | struct input_dev *dev[]; | ||
24 | }; | ||
25 | enum { | ||
26 | GPIO_EVENT_FUNC_UNINIT = 0x0, | ||
27 | GPIO_EVENT_FUNC_INIT = 0x1, | ||
28 | GPIO_EVENT_FUNC_SUSPEND = 0x2, | ||
29 | GPIO_EVENT_FUNC_RESUME = 0x3, | ||
30 | }; | ||
31 | struct gpio_event_info { | ||
32 | int (*func)(struct gpio_event_input_devs *input_devs, | ||
33 | struct gpio_event_info *info, | ||
34 | void **data, int func); | ||
35 | int (*event)(struct gpio_event_input_devs *input_devs, | ||
36 | struct gpio_event_info *info, | ||
37 | void **data, unsigned int dev, unsigned int type, | ||
38 | unsigned int code, int value); /* out events */ | ||
39 | bool no_suspend; | ||
40 | }; | ||
41 | |||
42 | struct gpio_event_platform_data { | ||
43 | const char *name; | ||
44 | struct gpio_event_info **info; | ||
45 | size_t info_count; | ||
46 | int (*power)(const struct gpio_event_platform_data *pdata, bool on); | ||
47 | const char *names[]; /* If name is NULL, names contain a NULL */ | ||
48 | /* terminated list of input devices to create */ | ||
49 | }; | ||
50 | |||
51 | #define GPIO_EVENT_DEV_NAME "gpio-event" | ||
52 | |||
53 | /* Key matrix */ | ||
54 | |||
55 | enum gpio_event_matrix_flags { | ||
56 | /* unset: drive active output low, set: drive active output high */ | ||
57 | GPIOKPF_ACTIVE_HIGH = 1U << 0, | ||
58 | GPIOKPF_DEBOUNCE = 1U << 1, | ||
59 | GPIOKPF_REMOVE_SOME_PHANTOM_KEYS = 1U << 2, | ||
60 | GPIOKPF_REMOVE_PHANTOM_KEYS = GPIOKPF_REMOVE_SOME_PHANTOM_KEYS | | ||
61 | GPIOKPF_DEBOUNCE, | ||
62 | GPIOKPF_DRIVE_INACTIVE = 1U << 3, | ||
63 | GPIOKPF_LEVEL_TRIGGERED_IRQ = 1U << 4, | ||
64 | GPIOKPF_PRINT_UNMAPPED_KEYS = 1U << 16, | ||
65 | GPIOKPF_PRINT_MAPPED_KEYS = 1U << 17, | ||
66 | GPIOKPF_PRINT_PHANTOM_KEYS = 1U << 18, | ||
67 | }; | ||
68 | |||
69 | #define MATRIX_CODE_BITS (10) | ||
70 | #define MATRIX_KEY_MASK ((1U << MATRIX_CODE_BITS) - 1) | ||
71 | #define MATRIX_KEY(dev, code) \ | ||
72 | (((dev) << MATRIX_CODE_BITS) | (code & MATRIX_KEY_MASK)) | ||
73 | |||
74 | extern int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs, | ||
75 | struct gpio_event_info *info, void **data, int func); | ||
76 | struct gpio_event_matrix_info { | ||
77 | /* initialize to gpio_event_matrix_func */ | ||
78 | struct gpio_event_info info; | ||
79 | /* size must be ninputs * noutputs */ | ||
80 | const unsigned short *keymap; | ||
81 | unsigned int *input_gpios; | ||
82 | unsigned int *output_gpios; | ||
83 | unsigned int ninputs; | ||
84 | unsigned int noutputs; | ||
85 | /* time to wait before reading inputs after driving each output */ | ||
86 | ktime_t settle_time; | ||
87 | /* time to wait before scanning the keypad a second time */ | ||
88 | ktime_t debounce_delay; | ||
89 | ktime_t poll_time; | ||
90 | unsigned flags; | ||
91 | }; | ||
92 | |||
93 | /* Directly connected inputs and outputs */ | ||
94 | |||
95 | enum gpio_event_direct_flags { | ||
96 | GPIOEDF_ACTIVE_HIGH = 1U << 0, | ||
97 | /* GPIOEDF_USE_DOWN_IRQ = 1U << 1, */ | ||
98 | /* GPIOEDF_USE_IRQ = (1U << 2) | GPIOIDF_USE_DOWN_IRQ, */ | ||
99 | GPIOEDF_PRINT_KEYS = 1U << 8, | ||
100 | GPIOEDF_PRINT_KEY_DEBOUNCE = 1U << 9, | ||
101 | GPIOEDF_PRINT_KEY_UNSTABLE = 1U << 10, | ||
102 | }; | ||
103 | |||
104 | struct gpio_event_direct_entry { | ||
105 | uint32_t gpio:16; | ||
106 | uint32_t code:10; | ||
107 | uint32_t dev:6; | ||
108 | }; | ||
109 | |||
110 | /* inputs */ | ||
111 | extern int gpio_event_input_func(struct gpio_event_input_devs *input_devs, | ||
112 | struct gpio_event_info *info, void **data, int func); | ||
113 | struct gpio_event_input_info { | ||
114 | /* initialize to gpio_event_input_func */ | ||
115 | struct gpio_event_info info; | ||
116 | ktime_t debounce_time; | ||
117 | ktime_t poll_time; | ||
118 | uint16_t flags; | ||
119 | uint16_t type; | ||
120 | const struct gpio_event_direct_entry *keymap; | ||
121 | size_t keymap_size; | ||
122 | }; | ||
123 | |||
124 | /* outputs */ | ||
125 | extern int gpio_event_output_func(struct gpio_event_input_devs *input_devs, | ||
126 | struct gpio_event_info *info, void **data, int func); | ||
127 | extern int gpio_event_output_event(struct gpio_event_input_devs *input_devs, | ||
128 | struct gpio_event_info *info, void **data, | ||
129 | unsigned int dev, unsigned int type, | ||
130 | unsigned int code, int value); | ||
131 | struct gpio_event_output_info { | ||
132 | /* initialize to gpio_event_output_func and gpio_event_output_event */ | ||
133 | struct gpio_event_info info; | ||
134 | uint16_t flags; | ||
135 | uint16_t type; | ||
136 | const struct gpio_event_direct_entry *keymap; | ||
137 | size_t keymap_size; | ||
138 | }; | ||
139 | |||
140 | |||
141 | /* axes */ | ||
142 | |||
143 | enum gpio_event_axis_flags { | ||
144 | GPIOEAF_PRINT_UNKNOWN_DIRECTION = 1U << 16, | ||
145 | GPIOEAF_PRINT_RAW = 1U << 17, | ||
146 | GPIOEAF_PRINT_EVENT = 1U << 18, | ||
147 | }; | ||
148 | |||
149 | extern int gpio_event_axis_func(struct gpio_event_input_devs *input_devs, | ||
150 | struct gpio_event_info *info, void **data, int func); | ||
151 | struct gpio_event_axis_info { | ||
152 | /* initialize to gpio_event_axis_func */ | ||
153 | struct gpio_event_info info; | ||
154 | uint8_t count; /* number of gpios for this axis */ | ||
155 | uint8_t dev; /* device index when using multiple input devices */ | ||
156 | uint8_t type; /* EV_REL or EV_ABS */ | ||
157 | uint16_t code; | ||
158 | uint16_t decoded_size; | ||
159 | uint16_t (*map)(struct gpio_event_axis_info *info, uint16_t in); | ||
160 | uint32_t *gpio; | ||
161 | uint32_t flags; | ||
162 | }; | ||
163 | #define gpio_axis_2bit_gray_map gpio_axis_4bit_gray_map | ||
164 | #define gpio_axis_3bit_gray_map gpio_axis_4bit_gray_map | ||
165 | uint16_t gpio_axis_4bit_gray_map( | ||
166 | struct gpio_event_axis_info *info, uint16_t in); | ||
167 | uint16_t gpio_axis_5bit_singletrack_map( | ||
168 | struct gpio_event_axis_info *info, uint16_t in); | ||
169 | |||
170 | #endif | ||
diff --git a/include/linux/gpio_scrollwheel.h b/include/linux/gpio_scrollwheel.h new file mode 100644 index 00000000000..33d17a0199e --- /dev/null +++ b/include/linux/gpio_scrollwheel.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010, NVIDIA Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef _GPIO_SCROLLWHEEL_H | ||
20 | #define _GPIO_SCROLLWHEEL_H | ||
21 | |||
22 | #define GPIO_SCROLLWHEEL_PIN_ONOFF 0 | ||
23 | #define GPIO_SCROLLWHEEL_PIN_PRESS 1 | ||
24 | #define GPIO_SCROLLWHEEL_PIN_ROT1 2 | ||
25 | #define GPIO_SCROLLWHEEL_PIN_ROT2 3 | ||
26 | #define GPIO_SCROLLWHEEL_PIN_MAX 4 | ||
27 | |||
28 | struct gpio_scrollwheel_button { | ||
29 | /* Configuration parameters */ | ||
30 | int pinaction; /* GPIO_SCROLLWHEEL_PIN_* */ | ||
31 | int gpio; | ||
32 | char *desc; | ||
33 | int active_low; | ||
34 | int debounce_interval; /* debounce ticks interval in msecs */ | ||
35 | }; | ||
36 | |||
37 | struct gpio_scrollwheel_platform_data { | ||
38 | struct gpio_scrollwheel_button *buttons; | ||
39 | int nbuttons; | ||
40 | unsigned int rep:1; /* enable input subsystem auto repeat */ | ||
41 | int (*enable)(struct device *dev); | ||
42 | void (*disable)(struct device *dev); | ||
43 | }; | ||
44 | |||
45 | #endif | ||
46 | |||
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild new file mode 100644 index 00000000000..1fb26448faa --- /dev/null +++ b/include/linux/hdlc/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += ioctl.h | |||
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h new file mode 100644 index 00000000000..58397236435 --- /dev/null +++ b/include/linux/hdlc/ioctl.h | |||
@@ -0,0 +1,81 @@ | |||
1 | #ifndef __HDLC_IOCTL_H__ | ||
2 | #define __HDLC_IOCTL_H__ | ||
3 | |||
4 | |||
5 | #define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ | ||
6 | |||
7 | #define CLOCK_DEFAULT 0 /* Default setting */ | ||
8 | #define CLOCK_EXT 1 /* External TX and RX clock - DTE */ | ||
9 | #define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ | ||
10 | #define CLOCK_TXINT 3 /* Internal TX and external RX clock */ | ||
11 | #define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ | ||
12 | |||
13 | |||
14 | #define ENCODING_DEFAULT 0 /* Default setting */ | ||
15 | #define ENCODING_NRZ 1 | ||
16 | #define ENCODING_NRZI 2 | ||
17 | #define ENCODING_FM_MARK 3 | ||
18 | #define ENCODING_FM_SPACE 4 | ||
19 | #define ENCODING_MANCHESTER 5 | ||
20 | |||
21 | |||
22 | #define PARITY_DEFAULT 0 /* Default setting */ | ||
23 | #define PARITY_NONE 1 /* No parity */ | ||
24 | #define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ | ||
25 | #define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ | ||
26 | #define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ | ||
27 | #define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ | ||
28 | #define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ | ||
29 | #define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ | ||
30 | |||
31 | #define LMI_DEFAULT 0 /* Default setting */ | ||
32 | #define LMI_NONE 1 /* No LMI, all PVCs are static */ | ||
33 | #define LMI_ANSI 2 /* ANSI Annex D */ | ||
34 | #define LMI_CCITT 3 /* ITU-T Annex A */ | ||
35 | #define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ | ||
36 | |||
37 | typedef struct { | ||
38 | unsigned int clock_rate; /* bits per second */ | ||
39 | unsigned int clock_type; /* internal, external, TX-internal etc. */ | ||
40 | unsigned short loopback; | ||
41 | } sync_serial_settings; /* V.35, V.24, X.21 */ | ||
42 | |||
43 | typedef struct { | ||
44 | unsigned int clock_rate; /* bits per second */ | ||
45 | unsigned int clock_type; /* internal, external, TX-internal etc. */ | ||
46 | unsigned short loopback; | ||
47 | unsigned int slot_map; | ||
48 | } te1_settings; /* T1, E1 */ | ||
49 | |||
50 | typedef struct { | ||
51 | unsigned short encoding; | ||
52 | unsigned short parity; | ||
53 | } raw_hdlc_proto; | ||
54 | |||
55 | typedef struct { | ||
56 | unsigned int t391; | ||
57 | unsigned int t392; | ||
58 | unsigned int n391; | ||
59 | unsigned int n392; | ||
60 | unsigned int n393; | ||
61 | unsigned short lmi; | ||
62 | unsigned short dce; /* 1 for DCE (network side) operation */ | ||
63 | } fr_proto; | ||
64 | |||
65 | typedef struct { | ||
66 | unsigned int dlci; | ||
67 | } fr_proto_pvc; /* for creating/deleting FR PVCs */ | ||
68 | |||
69 | typedef struct { | ||
70 | unsigned int dlci; | ||
71 | char master[IFNAMSIZ]; /* Name of master FRAD device */ | ||
72 | }fr_proto_pvc_info; /* for returning PVC information only */ | ||
73 | |||
74 | typedef struct { | ||
75 | unsigned int interval; | ||
76 | unsigned int timeout; | ||
77 | } cisco_proto; | ||
78 | |||
79 | /* PPP doesn't need any info now - supply length = 0 to ioctl */ | ||
80 | |||
81 | #endif /* __HDLC_IOCTL_H__ */ | ||
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h new file mode 100644 index 00000000000..29ee2873f4a --- /dev/null +++ b/include/linux/hdreg.h | |||
@@ -0,0 +1,658 @@ | |||
1 | #ifndef _LINUX_HDREG_H | ||
2 | #define _LINUX_HDREG_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* | ||
7 | * Command Header sizes for IOCTL commands | ||
8 | */ | ||
9 | |||
10 | #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8)) | ||
11 | #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) | ||
12 | #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) | ||
13 | |||
14 | #define IDE_DRIVE_TASK_NO_DATA 0 | ||
15 | #ifndef __KERNEL__ | ||
16 | #define IDE_DRIVE_TASK_INVALID -1 | ||
17 | #define IDE_DRIVE_TASK_SET_XFER 1 | ||
18 | #define IDE_DRIVE_TASK_IN 2 | ||
19 | #define IDE_DRIVE_TASK_OUT 3 | ||
20 | #endif | ||
21 | #define IDE_DRIVE_TASK_RAW_WRITE 4 | ||
22 | |||
23 | /* | ||
24 | * Define standard taskfile in/out register | ||
25 | */ | ||
26 | #define IDE_TASKFILE_STD_IN_FLAGS 0xFE | ||
27 | #define IDE_HOB_STD_IN_FLAGS 0x3C | ||
28 | #ifndef __KERNEL__ | ||
29 | #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE | ||
30 | #define IDE_HOB_STD_OUT_FLAGS 0x3C | ||
31 | |||
32 | typedef unsigned char task_ioreg_t; | ||
33 | typedef unsigned long sata_ioreg_t; | ||
34 | #endif | ||
35 | |||
36 | typedef union ide_reg_valid_s { | ||
37 | unsigned all : 16; | ||
38 | struct { | ||
39 | unsigned data : 1; | ||
40 | unsigned error_feature : 1; | ||
41 | unsigned sector : 1; | ||
42 | unsigned nsector : 1; | ||
43 | unsigned lcyl : 1; | ||
44 | unsigned hcyl : 1; | ||
45 | unsigned select : 1; | ||
46 | unsigned status_command : 1; | ||
47 | |||
48 | unsigned data_hob : 1; | ||
49 | unsigned error_feature_hob : 1; | ||
50 | unsigned sector_hob : 1; | ||
51 | unsigned nsector_hob : 1; | ||
52 | unsigned lcyl_hob : 1; | ||
53 | unsigned hcyl_hob : 1; | ||
54 | unsigned select_hob : 1; | ||
55 | unsigned control_hob : 1; | ||
56 | } b; | ||
57 | } ide_reg_valid_t; | ||
58 | |||
59 | typedef struct ide_task_request_s { | ||
60 | __u8 io_ports[8]; | ||
61 | __u8 hob_ports[8]; /* bytes 6 and 7 are unused */ | ||
62 | ide_reg_valid_t out_flags; | ||
63 | ide_reg_valid_t in_flags; | ||
64 | int data_phase; | ||
65 | int req_cmd; | ||
66 | unsigned long out_size; | ||
67 | unsigned long in_size; | ||
68 | } ide_task_request_t; | ||
69 | |||
70 | typedef struct ide_ioctl_request_s { | ||
71 | ide_task_request_t *task_request; | ||
72 | unsigned char *out_buffer; | ||
73 | unsigned char *in_buffer; | ||
74 | } ide_ioctl_request_t; | ||
75 | |||
76 | struct hd_drive_cmd_hdr { | ||
77 | __u8 command; | ||
78 | __u8 sector_number; | ||
79 | __u8 feature; | ||
80 | __u8 sector_count; | ||
81 | }; | ||
82 | |||
83 | #ifndef __KERNEL__ | ||
84 | typedef struct hd_drive_task_hdr { | ||
85 | __u8 data; | ||
86 | __u8 feature; | ||
87 | __u8 sector_count; | ||
88 | __u8 sector_number; | ||
89 | __u8 low_cylinder; | ||
90 | __u8 high_cylinder; | ||
91 | __u8 device_head; | ||
92 | __u8 command; | ||
93 | } task_struct_t; | ||
94 | |||
95 | typedef struct hd_drive_hob_hdr { | ||
96 | __u8 data; | ||
97 | __u8 feature; | ||
98 | __u8 sector_count; | ||
99 | __u8 sector_number; | ||
100 | __u8 low_cylinder; | ||
101 | __u8 high_cylinder; | ||
102 | __u8 device_head; | ||
103 | __u8 control; | ||
104 | } hob_struct_t; | ||
105 | #endif | ||
106 | |||
107 | #define TASKFILE_NO_DATA 0x0000 | ||
108 | |||
109 | #define TASKFILE_IN 0x0001 | ||
110 | #define TASKFILE_MULTI_IN 0x0002 | ||
111 | |||
112 | #define TASKFILE_OUT 0x0004 | ||
113 | #define TASKFILE_MULTI_OUT 0x0008 | ||
114 | #define TASKFILE_IN_OUT 0x0010 | ||
115 | |||
116 | #define TASKFILE_IN_DMA 0x0020 | ||
117 | #define TASKFILE_OUT_DMA 0x0040 | ||
118 | #define TASKFILE_IN_DMAQ 0x0080 | ||
119 | #define TASKFILE_OUT_DMAQ 0x0100 | ||
120 | |||
121 | #ifndef __KERNEL__ | ||
122 | #define TASKFILE_P_IN 0x0200 | ||
123 | #define TASKFILE_P_OUT 0x0400 | ||
124 | #define TASKFILE_P_IN_DMA 0x0800 | ||
125 | #define TASKFILE_P_OUT_DMA 0x1000 | ||
126 | #define TASKFILE_P_IN_DMAQ 0x2000 | ||
127 | #define TASKFILE_P_OUT_DMAQ 0x4000 | ||
128 | #define TASKFILE_48 0x8000 | ||
129 | #define TASKFILE_INVALID 0x7fff | ||
130 | #endif | ||
131 | |||
132 | #ifndef __KERNEL__ | ||
133 | /* ATA/ATAPI Commands pre T13 Spec */ | ||
134 | #define WIN_NOP 0x00 | ||
135 | /* | ||
136 | * 0x01->0x02 Reserved | ||
137 | */ | ||
138 | #define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ | ||
139 | /* | ||
140 | * 0x04->0x07 Reserved | ||
141 | */ | ||
142 | #define WIN_SRST 0x08 /* ATAPI soft reset command */ | ||
143 | #define WIN_DEVICE_RESET 0x08 | ||
144 | /* | ||
145 | * 0x09->0x0F Reserved | ||
146 | */ | ||
147 | #define WIN_RECAL 0x10 | ||
148 | #define WIN_RESTORE WIN_RECAL | ||
149 | /* | ||
150 | * 0x10->0x1F Reserved | ||
151 | */ | ||
152 | #define WIN_READ 0x20 /* 28-Bit */ | ||
153 | #define WIN_READ_ONCE 0x21 /* 28-Bit without retries */ | ||
154 | #define WIN_READ_LONG 0x22 /* 28-Bit */ | ||
155 | #define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */ | ||
156 | #define WIN_READ_EXT 0x24 /* 48-Bit */ | ||
157 | #define WIN_READDMA_EXT 0x25 /* 48-Bit */ | ||
158 | #define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */ | ||
159 | #define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ | ||
160 | /* | ||
161 | * 0x28 | ||
162 | */ | ||
163 | #define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ | ||
164 | /* | ||
165 | * 0x2A->0x2F Reserved | ||
166 | */ | ||
167 | #define WIN_WRITE 0x30 /* 28-Bit */ | ||
168 | #define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */ | ||
169 | #define WIN_WRITE_LONG 0x32 /* 28-Bit */ | ||
170 | #define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */ | ||
171 | #define WIN_WRITE_EXT 0x34 /* 48-Bit */ | ||
172 | #define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ | ||
173 | #define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ | ||
174 | #define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ | ||
175 | #define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ | ||
176 | #define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ | ||
177 | /* | ||
178 | * 0x3A->0x3B Reserved | ||
179 | */ | ||
180 | #define WIN_WRITE_VERIFY 0x3C /* 28-Bit */ | ||
181 | /* | ||
182 | * 0x3D->0x3F Reserved | ||
183 | */ | ||
184 | #define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ | ||
185 | #define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */ | ||
186 | #define WIN_VERIFY_EXT 0x42 /* 48-Bit */ | ||
187 | /* | ||
188 | * 0x43->0x4F Reserved | ||
189 | */ | ||
190 | #define WIN_FORMAT 0x50 | ||
191 | /* | ||
192 | * 0x51->0x5F Reserved | ||
193 | */ | ||
194 | #define WIN_INIT 0x60 | ||
195 | /* | ||
196 | * 0x61->0x5F Reserved | ||
197 | */ | ||
198 | #define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */ | ||
199 | |||
200 | #define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ | ||
201 | #define WIN_DIAGNOSE 0x90 | ||
202 | #define WIN_SPECIFY 0x91 /* set drive geometry translation */ | ||
203 | #define WIN_DOWNLOAD_MICROCODE 0x92 | ||
204 | #define WIN_STANDBYNOW2 0x94 | ||
205 | #define WIN_STANDBY2 0x96 | ||
206 | #define WIN_SETIDLE2 0x97 | ||
207 | #define WIN_CHECKPOWERMODE2 0x98 | ||
208 | #define WIN_SLEEPNOW2 0x99 | ||
209 | /* | ||
210 | * 0x9A VENDOR | ||
211 | */ | ||
212 | #define WIN_PACKETCMD 0xA0 /* Send a packet command. */ | ||
213 | #define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ | ||
214 | #define WIN_QUEUED_SERVICE 0xA2 | ||
215 | #define WIN_SMART 0xB0 /* self-monitoring and reporting */ | ||
216 | #define CFA_ERASE_SECTORS 0xC0 | ||
217 | #define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ | ||
218 | #define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ | ||
219 | #define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ | ||
220 | #define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */ | ||
221 | #define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ | ||
222 | #define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */ | ||
223 | #define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ | ||
224 | #define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */ | ||
225 | #define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */ | ||
226 | #define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ | ||
227 | #define WIN_GETMEDIASTATUS 0xDA | ||
228 | #define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */ | ||
229 | #define WIN_POSTBOOT 0xDC | ||
230 | #define WIN_PREBOOT 0xDD | ||
231 | #define WIN_DOORLOCK 0xDE /* lock door on removable drives */ | ||
232 | #define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */ | ||
233 | #define WIN_STANDBYNOW1 0xE0 | ||
234 | #define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ | ||
235 | #define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ | ||
236 | #define WIN_SETIDLE1 0xE3 | ||
237 | #define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ | ||
238 | #define WIN_CHECKPOWERMODE1 0xE5 | ||
239 | #define WIN_SLEEPNOW1 0xE6 | ||
240 | #define WIN_FLUSH_CACHE 0xE7 | ||
241 | #define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ | ||
242 | #define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */ | ||
243 | /* SET_FEATURES 0x22 or 0xDD */ | ||
244 | #define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ | ||
245 | #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ | ||
246 | #define WIN_MEDIAEJECT 0xED | ||
247 | #define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ | ||
248 | #define WIN_SETFEATURES 0xEF /* set special drive features */ | ||
249 | #define EXABYTE_ENABLE_NEST 0xF0 | ||
250 | #define WIN_SECURITY_SET_PASS 0xF1 | ||
251 | #define WIN_SECURITY_UNLOCK 0xF2 | ||
252 | #define WIN_SECURITY_ERASE_PREPARE 0xF3 | ||
253 | #define WIN_SECURITY_ERASE_UNIT 0xF4 | ||
254 | #define WIN_SECURITY_FREEZE_LOCK 0xF5 | ||
255 | #define WIN_SECURITY_DISABLE 0xF6 | ||
256 | #define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ | ||
257 | #define WIN_SET_MAX 0xF9 | ||
258 | #define DISABLE_SEAGATE 0xFB | ||
259 | |||
260 | /* WIN_SMART sub-commands */ | ||
261 | |||
262 | #define SMART_READ_VALUES 0xD0 | ||
263 | #define SMART_READ_THRESHOLDS 0xD1 | ||
264 | #define SMART_AUTOSAVE 0xD2 | ||
265 | #define SMART_SAVE 0xD3 | ||
266 | #define SMART_IMMEDIATE_OFFLINE 0xD4 | ||
267 | #define SMART_READ_LOG_SECTOR 0xD5 | ||
268 | #define SMART_WRITE_LOG_SECTOR 0xD6 | ||
269 | #define SMART_WRITE_THRESHOLDS 0xD7 | ||
270 | #define SMART_ENABLE 0xD8 | ||
271 | #define SMART_DISABLE 0xD9 | ||
272 | #define SMART_STATUS 0xDA | ||
273 | #define SMART_AUTO_OFFLINE 0xDB | ||
274 | |||
275 | /* Password used in TF4 & TF5 executing SMART commands */ | ||
276 | |||
277 | #define SMART_LCYL_PASS 0x4F | ||
278 | #define SMART_HCYL_PASS 0xC2 | ||
279 | |||
280 | /* WIN_SETFEATURES sub-commands */ | ||
281 | #define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ | ||
282 | #define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ | ||
283 | #define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ | ||
284 | #define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ | ||
285 | #define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ | ||
286 | #define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */ | ||
287 | #define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */ | ||
288 | #define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */ | ||
289 | #define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */ | ||
290 | #define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */ | ||
291 | #define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */ | ||
292 | #define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */ | ||
293 | #define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */ | ||
294 | #define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */ | ||
295 | #define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */ | ||
296 | #define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */ | ||
297 | #define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */ | ||
298 | #define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */ | ||
299 | #define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */ | ||
300 | #define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */ | ||
301 | #define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */ | ||
302 | #define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */ | ||
303 | #define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ | ||
304 | #define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ | ||
305 | #define SETFEATURES_EN_REST 0xAC /* ATA-1 */ | ||
306 | #define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */ | ||
307 | #define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ | ||
308 | #define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ | ||
309 | #define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ | ||
310 | #define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */ | ||
311 | #define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */ | ||
312 | |||
313 | /* WIN_SECURITY sub-commands */ | ||
314 | |||
315 | #define SECURITY_SET_PASSWORD 0xBA | ||
316 | #define SECURITY_UNLOCK 0xBB | ||
317 | #define SECURITY_ERASE_PREPARE 0xBC | ||
318 | #define SECURITY_ERASE_UNIT 0xBD | ||
319 | #define SECURITY_FREEZE_LOCK 0xBE | ||
320 | #define SECURITY_DISABLE_PASSWORD 0xBF | ||
321 | #endif /* __KERNEL__ */ | ||
322 | |||
323 | struct hd_geometry { | ||
324 | unsigned char heads; | ||
325 | unsigned char sectors; | ||
326 | unsigned short cylinders; | ||
327 | unsigned long start; | ||
328 | }; | ||
329 | |||
330 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ | ||
331 | #define HDIO_GETGEO 0x0301 /* get device geometry */ | ||
332 | #define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ | ||
333 | #define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ | ||
334 | #define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */ | ||
335 | |||
336 | #define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */ | ||
337 | |||
338 | #define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */ | ||
339 | #define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ | ||
340 | #define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ | ||
341 | #define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ | ||
342 | #define HDIO_GET_DMA 0x030b /* get use-dma flag */ | ||
343 | #define HDIO_GET_NICE 0x030c /* get nice flags */ | ||
344 | #define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ | ||
345 | #define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */ | ||
346 | #define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */ | ||
347 | #define HDIO_GET_ADDRESS 0x0310 /* */ | ||
348 | |||
349 | #define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */ | ||
350 | #define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */ | ||
351 | #define HDIO_DRIVE_RESET 0x031c /* execute a device reset */ | ||
352 | #define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */ | ||
353 | #define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */ | ||
354 | #define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ | ||
355 | #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK | ||
356 | |||
357 | /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ | ||
358 | #define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ | ||
359 | #define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ | ||
360 | #define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ | ||
361 | #define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ | ||
362 | #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ | ||
363 | #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ | ||
364 | #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ | ||
365 | #ifndef __KERNEL__ | ||
366 | #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ | ||
367 | #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ | ||
368 | #endif | ||
369 | #define HDIO_SET_NICE 0x0329 /* set nice flags */ | ||
370 | #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ | ||
371 | #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ | ||
372 | #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ | ||
373 | #define HDIO_SET_QDMA 0x032e /* change use-qdma flag */ | ||
374 | #define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */ | ||
375 | |||
376 | /* bus states */ | ||
377 | enum { | ||
378 | BUSSTATE_OFF = 0, | ||
379 | BUSSTATE_ON, | ||
380 | BUSSTATE_TRISTATE | ||
381 | }; | ||
382 | |||
383 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ | ||
384 | /* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ | ||
385 | /* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ | ||
386 | /* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ | ||
387 | /* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ | ||
388 | |||
389 | #define __NEW_HD_DRIVE_ID | ||
390 | |||
391 | #ifndef __KERNEL__ | ||
392 | /* | ||
393 | * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. | ||
394 | * | ||
395 | * If you change something here, please remember to update fix_driveid() in | ||
396 | * ide/probe.c. | ||
397 | */ | ||
398 | struct hd_driveid { | ||
399 | unsigned short config; /* lots of obsolete bit flags */ | ||
400 | unsigned short cyls; /* Obsolete, "physical" cyls */ | ||
401 | unsigned short reserved2; /* reserved (word 2) */ | ||
402 | unsigned short heads; /* Obsolete, "physical" heads */ | ||
403 | unsigned short track_bytes; /* unformatted bytes per track */ | ||
404 | unsigned short sector_bytes; /* unformatted bytes per sector */ | ||
405 | unsigned short sectors; /* Obsolete, "physical" sectors per track */ | ||
406 | unsigned short vendor0; /* vendor unique */ | ||
407 | unsigned short vendor1; /* vendor unique */ | ||
408 | unsigned short vendor2; /* Retired vendor unique */ | ||
409 | unsigned char serial_no[20]; /* 0 = not_specified */ | ||
410 | unsigned short buf_type; /* Retired */ | ||
411 | unsigned short buf_size; /* Retired, 512 byte increments | ||
412 | * 0 = not_specified | ||
413 | */ | ||
414 | unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */ | ||
415 | unsigned char fw_rev[8]; /* 0 = not_specified */ | ||
416 | unsigned char model[40]; /* 0 = not_specified */ | ||
417 | unsigned char max_multsect; /* 0=not_implemented */ | ||
418 | unsigned char vendor3; /* vendor unique */ | ||
419 | unsigned short dword_io; /* 0=not_implemented; 1=implemented */ | ||
420 | unsigned char vendor4; /* vendor unique */ | ||
421 | unsigned char capability; /* (upper byte of word 49) | ||
422 | * 3: IORDYsup | ||
423 | * 2: IORDYsw | ||
424 | * 1: LBA | ||
425 | * 0: DMA | ||
426 | */ | ||
427 | unsigned short reserved50; /* reserved (word 50) */ | ||
428 | unsigned char vendor5; /* Obsolete, vendor unique */ | ||
429 | unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */ | ||
430 | unsigned char vendor6; /* Obsolete, vendor unique */ | ||
431 | unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */ | ||
432 | unsigned short field_valid; /* (word 53) | ||
433 | * 2: ultra_ok word 88 | ||
434 | * 1: eide_ok words 64-70 | ||
435 | * 0: cur_ok words 54-58 | ||
436 | */ | ||
437 | unsigned short cur_cyls; /* Obsolete, logical cylinders */ | ||
438 | unsigned short cur_heads; /* Obsolete, l heads */ | ||
439 | unsigned short cur_sectors; /* Obsolete, l sectors per track */ | ||
440 | unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */ | ||
441 | unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */ | ||
442 | unsigned char multsect; /* current multiple sector count */ | ||
443 | unsigned char multsect_valid; /* when (bit0==1) multsect is ok */ | ||
444 | unsigned int lba_capacity; /* Obsolete, total number of sectors */ | ||
445 | unsigned short dma_1word; /* Obsolete, single-word dma info */ | ||
446 | unsigned short dma_mword; /* multiple-word dma info */ | ||
447 | unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */ | ||
448 | unsigned short eide_dma_min; /* min mword dma cycle time (ns) */ | ||
449 | unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ | ||
450 | unsigned short eide_pio; /* min cycle time (ns), no IORDY */ | ||
451 | unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ | ||
452 | unsigned short words69_70[2]; /* reserved words 69-70 | ||
453 | * future command overlap and queuing | ||
454 | */ | ||
455 | unsigned short words71_74[4]; /* reserved words 71-74 | ||
456 | * for IDENTIFY PACKET DEVICE command | ||
457 | */ | ||
458 | unsigned short queue_depth; /* (word 75) | ||
459 | * 15:5 reserved | ||
460 | * 4:0 Maximum queue depth -1 | ||
461 | */ | ||
462 | unsigned short words76_79[4]; /* reserved words 76-79 */ | ||
463 | unsigned short major_rev_num; /* (word 80) */ | ||
464 | unsigned short minor_rev_num; /* (word 81) */ | ||
465 | unsigned short command_set_1; /* (word 82) supported | ||
466 | * 15: Obsolete | ||
467 | * 14: NOP command | ||
468 | * 13: READ_BUFFER | ||
469 | * 12: WRITE_BUFFER | ||
470 | * 11: Obsolete | ||
471 | * 10: Host Protected Area | ||
472 | * 9: DEVICE Reset | ||
473 | * 8: SERVICE Interrupt | ||
474 | * 7: Release Interrupt | ||
475 | * 6: look-ahead | ||
476 | * 5: write cache | ||
477 | * 4: PACKET Command | ||
478 | * 3: Power Management Feature Set | ||
479 | * 2: Removable Feature Set | ||
480 | * 1: Security Feature Set | ||
481 | * 0: SMART Feature Set | ||
482 | */ | ||
483 | unsigned short command_set_2; /* (word 83) | ||
484 | * 15: Shall be ZERO | ||
485 | * 14: Shall be ONE | ||
486 | * 13: FLUSH CACHE EXT | ||
487 | * 12: FLUSH CACHE | ||
488 | * 11: Device Configuration Overlay | ||
489 | * 10: 48-bit Address Feature Set | ||
490 | * 9: Automatic Acoustic Management | ||
491 | * 8: SET MAX security | ||
492 | * 7: reserved 1407DT PARTIES | ||
493 | * 6: SetF sub-command Power-Up | ||
494 | * 5: Power-Up in Standby Feature Set | ||
495 | * 4: Removable Media Notification | ||
496 | * 3: APM Feature Set | ||
497 | * 2: CFA Feature Set | ||
498 | * 1: READ/WRITE DMA QUEUED | ||
499 | * 0: Download MicroCode | ||
500 | */ | ||
501 | unsigned short cfsse; /* (word 84) | ||
502 | * cmd set-feature supported extensions | ||
503 | * 15: Shall be ZERO | ||
504 | * 14: Shall be ONE | ||
505 | * 13:6 reserved | ||
506 | * 5: General Purpose Logging | ||
507 | * 4: Streaming Feature Set | ||
508 | * 3: Media Card Pass Through | ||
509 | * 2: Media Serial Number Valid | ||
510 | * 1: SMART selt-test supported | ||
511 | * 0: SMART error logging | ||
512 | */ | ||
513 | unsigned short cfs_enable_1; /* (word 85) | ||
514 | * command set-feature enabled | ||
515 | * 15: Obsolete | ||
516 | * 14: NOP command | ||
517 | * 13: READ_BUFFER | ||
518 | * 12: WRITE_BUFFER | ||
519 | * 11: Obsolete | ||
520 | * 10: Host Protected Area | ||
521 | * 9: DEVICE Reset | ||
522 | * 8: SERVICE Interrupt | ||
523 | * 7: Release Interrupt | ||
524 | * 6: look-ahead | ||
525 | * 5: write cache | ||
526 | * 4: PACKET Command | ||
527 | * 3: Power Management Feature Set | ||
528 | * 2: Removable Feature Set | ||
529 | * 1: Security Feature Set | ||
530 | * 0: SMART Feature Set | ||
531 | */ | ||
532 | unsigned short cfs_enable_2; /* (word 86) | ||
533 | * command set-feature enabled | ||
534 | * 15: Shall be ZERO | ||
535 | * 14: Shall be ONE | ||
536 | * 13: FLUSH CACHE EXT | ||
537 | * 12: FLUSH CACHE | ||
538 | * 11: Device Configuration Overlay | ||
539 | * 10: 48-bit Address Feature Set | ||
540 | * 9: Automatic Acoustic Management | ||
541 | * 8: SET MAX security | ||
542 | * 7: reserved 1407DT PARTIES | ||
543 | * 6: SetF sub-command Power-Up | ||
544 | * 5: Power-Up in Standby Feature Set | ||
545 | * 4: Removable Media Notification | ||
546 | * 3: APM Feature Set | ||
547 | * 2: CFA Feature Set | ||
548 | * 1: READ/WRITE DMA QUEUED | ||
549 | * 0: Download MicroCode | ||
550 | */ | ||
551 | unsigned short csf_default; /* (word 87) | ||
552 | * command set-feature default | ||
553 | * 15: Shall be ZERO | ||
554 | * 14: Shall be ONE | ||
555 | * 13:6 reserved | ||
556 | * 5: General Purpose Logging enabled | ||
557 | * 4: Valid CONFIGURE STREAM executed | ||
558 | * 3: Media Card Pass Through enabled | ||
559 | * 2: Media Serial Number Valid | ||
560 | * 1: SMART selt-test supported | ||
561 | * 0: SMART error logging | ||
562 | */ | ||
563 | unsigned short dma_ultra; /* (word 88) */ | ||
564 | unsigned short trseuc; /* time required for security erase */ | ||
565 | unsigned short trsEuc; /* time required for enhanced erase */ | ||
566 | unsigned short CurAPMvalues; /* current APM values */ | ||
567 | unsigned short mprc; /* master password revision code */ | ||
568 | unsigned short hw_config; /* hardware config (word 93) | ||
569 | * 15: Shall be ZERO | ||
570 | * 14: Shall be ONE | ||
571 | * 13: | ||
572 | * 12: | ||
573 | * 11: | ||
574 | * 10: | ||
575 | * 9: | ||
576 | * 8: | ||
577 | * 7: | ||
578 | * 6: | ||
579 | * 5: | ||
580 | * 4: | ||
581 | * 3: | ||
582 | * 2: | ||
583 | * 1: | ||
584 | * 0: Shall be ONE | ||
585 | */ | ||
586 | unsigned short acoustic; /* (word 94) | ||
587 | * 15:8 Vendor's recommended value | ||
588 | * 7:0 current value | ||
589 | */ | ||
590 | unsigned short msrqs; /* min stream request size */ | ||
591 | unsigned short sxfert; /* stream transfer time */ | ||
592 | unsigned short sal; /* stream access latency */ | ||
593 | unsigned int spg; /* stream performance granularity */ | ||
594 | unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ | ||
595 | unsigned short words104_125[22];/* reserved words 104-125 */ | ||
596 | unsigned short last_lun; /* (word 126) */ | ||
597 | unsigned short word127; /* (word 127) Feature Set | ||
598 | * Removable Media Notification | ||
599 | * 15:2 reserved | ||
600 | * 1:0 00 = not supported | ||
601 | * 01 = supported | ||
602 | * 10 = reserved | ||
603 | * 11 = reserved | ||
604 | */ | ||
605 | unsigned short dlf; /* (word 128) | ||
606 | * device lock function | ||
607 | * 15:9 reserved | ||
608 | * 8 security level 1:max 0:high | ||
609 | * 7:6 reserved | ||
610 | * 5 enhanced erase | ||
611 | * 4 expire | ||
612 | * 3 frozen | ||
613 | * 2 locked | ||
614 | * 1 en/disabled | ||
615 | * 0 capability | ||
616 | */ | ||
617 | unsigned short csfo; /* (word 129) | ||
618 | * current set features options | ||
619 | * 15:4 reserved | ||
620 | * 3: auto reassign | ||
621 | * 2: reverting | ||
622 | * 1: read-look-ahead | ||
623 | * 0: write cache | ||
624 | */ | ||
625 | unsigned short words130_155[26];/* reserved vendor words 130-155 */ | ||
626 | unsigned short word156; /* reserved vendor word 156 */ | ||
627 | unsigned short words157_159[3];/* reserved vendor words 157-159 */ | ||
628 | unsigned short cfa_power; /* (word 160) CFA Power Mode | ||
629 | * 15 word 160 supported | ||
630 | * 14 reserved | ||
631 | * 13 | ||
632 | * 12 | ||
633 | * 11:0 | ||
634 | */ | ||
635 | unsigned short words161_175[15];/* Reserved for CFA */ | ||
636 | unsigned short words176_205[30];/* Current Media Serial Number */ | ||
637 | unsigned short words206_254[49];/* reserved words 206-254 */ | ||
638 | unsigned short integrity_word; /* (word 255) | ||
639 | * 15:8 Checksum | ||
640 | * 7:0 Signature | ||
641 | */ | ||
642 | }; | ||
643 | #endif /* __KERNEL__ */ | ||
644 | |||
645 | /* | ||
646 | * IDE "nice" flags. These are used on a per drive basis to determine | ||
647 | * when to be nice and give more bandwidth to the other devices which | ||
648 | * share the same IDE bus. | ||
649 | */ | ||
650 | #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ | ||
651 | #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ | ||
652 | #define IDE_NICE_1 (3) /* when probably won't affect us much */ | ||
653 | #ifndef __KERNEL__ | ||
654 | #define IDE_NICE_0 (2) /* when sure that it won't affect us */ | ||
655 | #define IDE_NICE_2 (4) /* when we know it's on our expense */ | ||
656 | #endif | ||
657 | |||
658 | #endif /* _LINUX_HDREG_H */ | ||
diff --git a/include/linux/hysdn_if.h b/include/linux/hysdn_if.h new file mode 100644 index 00000000000..00236ae3b04 --- /dev/null +++ b/include/linux/hysdn_if.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $ | ||
2 | * | ||
3 | * Linux driver for HYSDN cards | ||
4 | * ioctl definitions shared by hynetmgr and driver. | ||
5 | * | ||
6 | * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH | ||
7 | * Copyright 1999 by Werner Cornelius (werner@titro.de) | ||
8 | * | ||
9 | * This software may be used and distributed according to the terms | ||
10 | * of the GNU General Public License, incorporated herein by reference. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | /****************/ | ||
15 | /* error values */ | ||
16 | /****************/ | ||
17 | #define ERR_NONE 0 /* no error occurred */ | ||
18 | #define ERR_ALREADY_BOOT 1000 /* we are already booting */ | ||
19 | #define EPOF_BAD_MAGIC 1001 /* bad magic in POF header */ | ||
20 | #define ERR_BOARD_DPRAM 1002 /* board DPRAM failed */ | ||
21 | #define EPOF_INTERNAL 1003 /* internal POF handler error */ | ||
22 | #define EPOF_BAD_IMG_SIZE 1004 /* POF boot image size invalid */ | ||
23 | #define ERR_BOOTIMG_FAIL 1005 /* 1. stage boot image did not start */ | ||
24 | #define ERR_BOOTSEQ_FAIL 1006 /* 2. stage boot seq handshake timeout */ | ||
25 | #define ERR_POF_TIMEOUT 1007 /* timeout waiting for card pof ready */ | ||
26 | #define ERR_NOT_BOOTED 1008 /* operation only allowed when booted */ | ||
27 | #define ERR_CONF_LONG 1009 /* conf line is too long */ | ||
28 | #define ERR_INV_CHAN 1010 /* invalid channel number */ | ||
29 | #define ERR_ASYNC_TIME 1011 /* timeout sending async data */ | ||
30 | |||
31 | |||
32 | |||
33 | |||
diff --git a/include/linux/i2c-slave.h b/include/linux/i2c-slave.h new file mode 100644 index 00000000000..34df64f73f6 --- /dev/null +++ b/include/linux/i2c-slave.h | |||
@@ -0,0 +1,259 @@ | |||
1 | /* | ||
2 | * i2c-slave.h - definitions for the i2c-slave-bus interface | ||
3 | * | ||
4 | * Copyright (c) 2009-2011, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /* ------------------------------------------------------------------------- */ | ||
22 | |||
23 | #ifndef _LINUX_I2C_SLAVE_H | ||
24 | #define _LINUX_I2C_SLAVE_H | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | #ifdef __KERNEL__ | ||
28 | /* --- General options ------------------------------------------------ */ | ||
29 | |||
30 | struct i2c_client; | ||
31 | struct i2c_slave_algorithm; | ||
32 | struct i2c_slave_adapter; | ||
33 | #if defined(CONFIG_I2C_SLAVE) && defined(CONFIG_I2C) | ||
34 | |||
35 | /** | ||
36 | * i2c_slave_send - Sends data to master. When master issues a read cycle, the | ||
37 | * data is sent by the slave. | ||
38 | * This function copies the client data into the slave tx buffer and return to | ||
39 | * client. This is not a blocking call. Data will be sent to master later once | ||
40 | * slave got the master-ready cycle transfer. | ||
41 | * if there is no sufficient space to write the client buffer, it will return | ||
42 | * error. it will not write partial data. | ||
43 | * @client: Handle to i2c-slave client. | ||
44 | * @buf: Data that will be written to the master | ||
45 | * @count: How many bytes to write. | ||
46 | * | ||
47 | * Returns negative errno, or else the number of bytes written. | ||
48 | */ | ||
49 | extern int i2c_slave_send(struct i2c_client *client, const char *buf, | ||
50 | int count); | ||
51 | |||
52 | /** | ||
53 | * i2c_slave_get_tx_status - Get amount of data available in tx buffer. If there | ||
54 | * is still data in tx buffer then wait for given time to transfer complete | ||
55 | * for a give timeout. | ||
56 | * @client: Handle to i2c-slave client. | ||
57 | * @timeout_ms: Time to wait for transfer to complete. | ||
58 | * | ||
59 | * Returns negative errno, or else the number of bytes remaining in tx buffer. | ||
60 | */ | ||
61 | extern int i2c_slave_get_tx_status(struct i2c_client *client, int timeout_ms); | ||
62 | |||
63 | /** | ||
64 | * i2c_slave_recv - Receive data from master. The data received from master is | ||
65 | * stored on slave rx buffer. When this api will be called, the data will be | ||
66 | * copied from the slave rx buffer to client buffer. If requested amount (count) | ||
67 | * of data is not available then it will wait for either min_count to be receive | ||
68 | * or timeout whatever first. | ||
69 | * | ||
70 | * if timeout_ms = 0, then wait for min_count data to be read. | ||
71 | * if timoue_ms non zero then wait for the data till timeout happen. | ||
72 | * @client: Handle to i2c-slave client. | ||
73 | * @buf: Data that will be read from the master | ||
74 | * @count: How many bytes to read. | ||
75 | * @min_count: Block till read min_count of data. | ||
76 | * @timeout_ms: Time to wait for read to be complete. | ||
77 | * | ||
78 | * Returns negative errno, or else the number of bytes read. | ||
79 | */ | ||
80 | extern int i2c_slave_recv(struct i2c_client *client, char *buf, int count, | ||
81 | int min_count, int timeout_ms); | ||
82 | |||
83 | /** | ||
84 | * i2c_slave_start - Start the i2c slave to receive/transmit data. | ||
85 | * After this i2c controller starts responding master. | ||
86 | * The dummy-char will send to master if there is no data to send on slave tx | ||
87 | * buffer. | ||
88 | * @client: Handle to i2c-slave client. | ||
89 | * @dummy_char: Data which will be send to master if there is no data to be send | ||
90 | * in slave tx buffer. | ||
91 | * | ||
92 | * Returns negative errno, or else 0 for success. | ||
93 | */ | ||
94 | extern int i2c_slave_start(struct i2c_client *client, unsigned char dummy_char); | ||
95 | |||
96 | /** | ||
97 | * i2c_slave_stop - Stop slave to receive/transmit data. | ||
98 | * After this i2c controller stops responding master. | ||
99 | * @client: Handle to i2c-slave client. | ||
100 | * @is_buffer_clear: Reset the tx and rx slave buffer or not. | ||
101 | */ | ||
102 | extern void i2c_slave_stop(struct i2c_client *client, int is_buffer_clear); | ||
103 | |||
104 | /** | ||
105 | * i2c_slave_flush_buffer - Flush the receive and transmit buffer. | ||
106 | * @client: Handle to i2c-slave client. | ||
107 | * @is_flush_tx_buffer: Reset the tx slave buffer or not. | ||
108 | * @is_flush_rx_buffer: Reset the rx slave buffer or not. | ||
109 | * | ||
110 | * Returns negative errno, or else 0 for success. | ||
111 | */ | ||
112 | extern int i2c_slave_flush_buffer(struct i2c_client *client, | ||
113 | int is_flush_tx_buffer, int is_flush_rx_buffer); | ||
114 | |||
115 | /** | ||
116 | * i2c_slave_get_nack_cycle - Get the number of master read cycle on which | ||
117 | * dummy char sent. This is the way to find that how much cycle slave sent the | ||
118 | * NACK packet. | ||
119 | * | ||
120 | * @client: Handle to i2c-slave client. | ||
121 | * @is_cout_reset: Reset the nack count or not. | ||
122 | * | ||
123 | * Returns negative errno, or else 0 for success. | ||
124 | */ | ||
125 | extern int i2c_slave_get_nack_cycle(struct i2c_client *client, | ||
126 | int is_cout_reset); | ||
127 | |||
128 | |||
129 | /** | ||
130 | * i2c_add_slave_adapter - Add slave adapter. | ||
131 | * | ||
132 | * @slv_adap: Slave adapter. | ||
133 | * @force_nr: Adapter number. | ||
134 | * | ||
135 | * Returns negative errno, or else 0 for success. | ||
136 | */ | ||
137 | extern int i2c_add_slave_adapter(struct i2c_slave_adapter *slv_adap, | ||
138 | bool force_nr); | ||
139 | |||
140 | /** | ||
141 | * i2c_del_slave_adapter - Delete slave adapter. | ||
142 | * | ||
143 | * @slv_adap: Slave adapter. | ||
144 | * | ||
145 | * Returns negative errno, or else 0 for success. | ||
146 | */ | ||
147 | extern int i2c_del_slave_adapter(struct i2c_slave_adapter *slv_adap); | ||
148 | |||
149 | #endif /* I2C_SLAVE */ | ||
150 | |||
151 | /* | ||
152 | * i2c_slave_adapter is the structure used to identify a physical i2c bus along | ||
153 | * with the access algorithms necessary to access it. | ||
154 | */ | ||
155 | struct i2c_slave_adapter { | ||
156 | struct module *owner; | ||
157 | unsigned int id; | ||
158 | unsigned int class; /* classes to allow probing for */ | ||
159 | /* the algorithm to access the i2c-slave bus */ | ||
160 | const struct i2c_slave_algorithm *slv_algo; | ||
161 | void *algo_data; | ||
162 | void *parent_data; | ||
163 | |||
164 | /* data fields that are valid for all devices */ | ||
165 | u8 level; /* nesting level for lockdep */ | ||
166 | struct mutex bus_lock; | ||
167 | |||
168 | int timeout; /* in jiffies */ | ||
169 | int retries; | ||
170 | struct device *dev; /* the adapter device */ | ||
171 | struct device *parent_dev; /* the adapter device */ | ||
172 | |||
173 | int nr; | ||
174 | char name[48]; | ||
175 | struct completion dev_released; | ||
176 | }; | ||
177 | |||
178 | static inline void *i2c_get_slave_adapdata(const struct i2c_slave_adapter *dev) | ||
179 | { | ||
180 | return dev_get_drvdata(dev->dev); | ||
181 | } | ||
182 | |||
183 | static inline void i2c_set_slave_adapdata(struct i2c_slave_adapter *dev, | ||
184 | void *data) | ||
185 | { | ||
186 | dev_set_drvdata(dev->dev, data); | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * The following struct are for those who like to implement new i2c slave | ||
191 | * bus drivers: | ||
192 | * i2c_slave_algorithm is the interface to a class of hardware solutions which | ||
193 | * can be addressed using the same bus algorithms. | ||
194 | */ | ||
195 | struct i2c_slave_algorithm { | ||
196 | /* Start the slave to receive/transmit data. | ||
197 | * The dummy-char will send to master if there is no data to send on | ||
198 | * slave tx buffer. | ||
199 | */ | ||
200 | int (*slave_start)(struct i2c_slave_adapter *slv_adap, int addr, | ||
201 | int is_ten_bit_addr, unsigned char dummy_char); | ||
202 | |||
203 | /* Stop slave to receive/transmit data. | ||
204 | * Required information to reset the slave rx and tx buffer to reset | ||
205 | * or not. | ||
206 | */ | ||
207 | void (*slave_stop)(struct i2c_slave_adapter *slv_adap, | ||
208 | int is_buffer_clear); | ||
209 | |||
210 | /* | ||
211 | * Send data to master. The data will be copied on the slave tx buffer | ||
212 | * and will send to master once master initiates the master-read cycle. | ||
213 | * Function will return immediately once the buffer copied into slave | ||
214 | * tx buffer. | ||
215 | * Client will not wait till data is sent to master. | ||
216 | * This function will not copy data partially. If sufficient space is | ||
217 | * not available, it will return error. | ||
218 | */ | ||
219 | int (*slave_send)(struct i2c_slave_adapter *slv_adap, const char *buf, | ||
220 | int count); | ||
221 | |||
222 | /* | ||
223 | * Get amount of data available in tx buffer. If there is still data in | ||
224 | * tx buffer wait for given time to get slave tx buffer emptied. | ||
225 | * returns number of data available in slave tx buffer. | ||
226 | */ | ||
227 | int (*slave_get_tx_status)(struct i2c_slave_adapter *slv_adap, | ||
228 | int timeout_ms); | ||
229 | |||
230 | /* | ||
231 | * Receive data to master. The data received from master is stored on | ||
232 | * slave rx buffer. When this api will be called, the data will be | ||
233 | * coped from the slave rx buffer to client buffer. If requested (count) | ||
234 | * data is not available then it will wait for either min_count to be | ||
235 | * receive or timeout whatever first. | ||
236 | * | ||
237 | * if timeout_ms = 0, then wait for min_count data to be read. | ||
238 | * if timoue_ms non zero then wait for the data till timeout happen. | ||
239 | * returns number of bytes read as positive integer otherwise error. | ||
240 | */ | ||
241 | int (*slave_recv)(struct i2c_slave_adapter *slv_adap, char *buf, | ||
242 | int count, int min_count, int timeout_ms); | ||
243 | |||
244 | /* Flush the receive and transmit buffer. | ||
245 | */ | ||
246 | int (*slave_flush_buffer)(struct i2c_slave_adapter *slv_adap, | ||
247 | int is_flush_tx_buffer, int is_flush_rx_buffer); | ||
248 | |||
249 | /* Get the number of dummy char cycle. | ||
250 | * Get the number of master read cycle on which dummy character has | ||
251 | * been sent. | ||
252 | * This can be treat as NACK cycle from slave side. | ||
253 | * Pass option whether count need to be reset or not. | ||
254 | */ | ||
255 | int (*slave_get_nack_cycle)(struct i2c_slave_adapter *slv_adap, | ||
256 | int is_cout_reset); | ||
257 | }; | ||
258 | #endif /* __KERNEL__ */ | ||
259 | #endif /* _LINUX_I2C_SLAVE_H */ | ||
diff --git a/include/linux/i2c/panjit_ts.h b/include/linux/i2c/panjit_ts.h new file mode 100644 index 00000000000..1dd51e1ecae --- /dev/null +++ b/include/linux/i2c/panjit_ts.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * include/linux/i2c/panjit_ts.h | ||
3 | * | ||
4 | * Copyright (c) 2010, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_I2C_PANJIT_TS_H | ||
22 | #define _LINUX_I2C_PANJIT_TS_H | ||
23 | |||
24 | struct device; | ||
25 | |||
26 | struct panjit_i2c_ts_platform_data { | ||
27 | int gpio_reset; | ||
28 | }; | ||
29 | |||
30 | #endif | ||
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h new file mode 100644 index 00000000000..a0b23dd4523 --- /dev/null +++ b/include/linux/i2o-dev.h | |||
@@ -0,0 +1,421 @@ | |||
1 | /* | ||
2 | * I2O user space accessible structures/APIs | ||
3 | * | ||
4 | * (c) Copyright 1999, 2000 Red Hat Software | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | ************************************************************************* | ||
12 | * | ||
13 | * This header file defines the I2O APIs that are available to both | ||
14 | * the kernel and user level applications. Kernel specific structures | ||
15 | * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which | ||
16 | * automatically includes this file. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef _I2O_DEV_H | ||
21 | #define _I2O_DEV_H | ||
22 | |||
23 | /* How many controllers are we allowing */ | ||
24 | #define MAX_I2O_CONTROLLERS 32 | ||
25 | |||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/types.h> | ||
28 | |||
29 | /* | ||
30 | * I2O Control IOCTLs and structures | ||
31 | */ | ||
32 | #define I2O_MAGIC_NUMBER 'i' | ||
33 | #define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS]) | ||
34 | #define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) | ||
35 | #define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) | ||
36 | #define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) | ||
37 | #define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) | ||
38 | #define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) | ||
39 | #define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) | ||
40 | #define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) | ||
41 | #define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32) | ||
42 | #define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) | ||
43 | #define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) | ||
44 | #define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) | ||
45 | #define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru) | ||
46 | #define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32) | ||
47 | |||
48 | struct i2o_cmd_passthru32 { | ||
49 | unsigned int iop; /* IOP unit number */ | ||
50 | __u32 msg; /* message */ | ||
51 | }; | ||
52 | |||
53 | struct i2o_cmd_passthru { | ||
54 | unsigned int iop; /* IOP unit number */ | ||
55 | void __user *msg; /* message */ | ||
56 | }; | ||
57 | |||
58 | struct i2o_cmd_hrtlct { | ||
59 | unsigned int iop; /* IOP unit number */ | ||
60 | void __user *resbuf; /* Buffer for result */ | ||
61 | unsigned int __user *reslen; /* Buffer length in bytes */ | ||
62 | }; | ||
63 | |||
64 | struct i2o_cmd_psetget { | ||
65 | unsigned int iop; /* IOP unit number */ | ||
66 | unsigned int tid; /* Target device TID */ | ||
67 | void __user *opbuf; /* Operation List buffer */ | ||
68 | unsigned int oplen; /* Operation List buffer length in bytes */ | ||
69 | void __user *resbuf; /* Result List buffer */ | ||
70 | unsigned int __user *reslen; /* Result List buffer length in bytes */ | ||
71 | }; | ||
72 | |||
73 | struct i2o_sw_xfer { | ||
74 | unsigned int iop; /* IOP unit number */ | ||
75 | unsigned char flags; /* Flags field */ | ||
76 | unsigned char sw_type; /* Software type */ | ||
77 | unsigned int sw_id; /* Software ID */ | ||
78 | void __user *buf; /* Pointer to software buffer */ | ||
79 | unsigned int __user *swlen; /* Length of software data */ | ||
80 | unsigned int __user *maxfrag; /* Maximum fragment count */ | ||
81 | unsigned int __user *curfrag; /* Current fragment count */ | ||
82 | }; | ||
83 | |||
84 | struct i2o_html { | ||
85 | unsigned int iop; /* IOP unit number */ | ||
86 | unsigned int tid; /* Target device ID */ | ||
87 | unsigned int page; /* HTML page */ | ||
88 | void __user *resbuf; /* Buffer for reply HTML page */ | ||
89 | unsigned int __user *reslen; /* Length in bytes of reply buffer */ | ||
90 | void __user *qbuf; /* Pointer to HTTP query string */ | ||
91 | unsigned int qlen; /* Length in bytes of query string buffer */ | ||
92 | }; | ||
93 | |||
94 | #define I2O_EVT_Q_LEN 32 | ||
95 | |||
96 | struct i2o_evt_id { | ||
97 | unsigned int iop; | ||
98 | unsigned int tid; | ||
99 | unsigned int evt_mask; | ||
100 | }; | ||
101 | |||
102 | /* Event data size = frame size - message header + evt indicator */ | ||
103 | #define I2O_EVT_DATA_SIZE 88 | ||
104 | |||
105 | struct i2o_evt_info { | ||
106 | struct i2o_evt_id id; | ||
107 | unsigned char evt_data[I2O_EVT_DATA_SIZE]; | ||
108 | unsigned int data_size; | ||
109 | }; | ||
110 | |||
111 | struct i2o_evt_get { | ||
112 | struct i2o_evt_info info; | ||
113 | int pending; | ||
114 | int lost; | ||
115 | }; | ||
116 | |||
117 | typedef struct i2o_sg_io_hdr { | ||
118 | unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ | ||
119 | } i2o_sg_io_hdr_t; | ||
120 | |||
121 | /************************************************************************** | ||
122 | * HRT related constants and structures | ||
123 | **************************************************************************/ | ||
124 | #define I2O_BUS_LOCAL 0 | ||
125 | #define I2O_BUS_ISA 1 | ||
126 | #define I2O_BUS_EISA 2 | ||
127 | #define I2O_BUS_MCA 3 | ||
128 | #define I2O_BUS_PCI 4 | ||
129 | #define I2O_BUS_PCMCIA 5 | ||
130 | #define I2O_BUS_NUBUS 6 | ||
131 | #define I2O_BUS_CARDBUS 7 | ||
132 | #define I2O_BUS_UNKNOWN 0x80 | ||
133 | |||
134 | typedef struct _i2o_pci_bus { | ||
135 | __u8 PciFunctionNumber; | ||
136 | __u8 PciDeviceNumber; | ||
137 | __u8 PciBusNumber; | ||
138 | __u8 reserved; | ||
139 | __u16 PciVendorID; | ||
140 | __u16 PciDeviceID; | ||
141 | } i2o_pci_bus; | ||
142 | |||
143 | typedef struct _i2o_local_bus { | ||
144 | __u16 LbBaseIOPort; | ||
145 | __u16 reserved; | ||
146 | __u32 LbBaseMemoryAddress; | ||
147 | } i2o_local_bus; | ||
148 | |||
149 | typedef struct _i2o_isa_bus { | ||
150 | __u16 IsaBaseIOPort; | ||
151 | __u8 CSN; | ||
152 | __u8 reserved; | ||
153 | __u32 IsaBaseMemoryAddress; | ||
154 | } i2o_isa_bus; | ||
155 | |||
156 | typedef struct _i2o_eisa_bus_info { | ||
157 | __u16 EisaBaseIOPort; | ||
158 | __u8 reserved; | ||
159 | __u8 EisaSlotNumber; | ||
160 | __u32 EisaBaseMemoryAddress; | ||
161 | } i2o_eisa_bus; | ||
162 | |||
163 | typedef struct _i2o_mca_bus { | ||
164 | __u16 McaBaseIOPort; | ||
165 | __u8 reserved; | ||
166 | __u8 McaSlotNumber; | ||
167 | __u32 McaBaseMemoryAddress; | ||
168 | } i2o_mca_bus; | ||
169 | |||
170 | typedef struct _i2o_other_bus { | ||
171 | __u16 BaseIOPort; | ||
172 | __u16 reserved; | ||
173 | __u32 BaseMemoryAddress; | ||
174 | } i2o_other_bus; | ||
175 | |||
176 | typedef struct _i2o_hrt_entry { | ||
177 | __u32 adapter_id; | ||
178 | __u32 parent_tid:12; | ||
179 | __u32 state:4; | ||
180 | __u32 bus_num:8; | ||
181 | __u32 bus_type:8; | ||
182 | union { | ||
183 | i2o_pci_bus pci_bus; | ||
184 | i2o_local_bus local_bus; | ||
185 | i2o_isa_bus isa_bus; | ||
186 | i2o_eisa_bus eisa_bus; | ||
187 | i2o_mca_bus mca_bus; | ||
188 | i2o_other_bus other_bus; | ||
189 | } bus; | ||
190 | } i2o_hrt_entry; | ||
191 | |||
192 | typedef struct _i2o_hrt { | ||
193 | __u16 num_entries; | ||
194 | __u8 entry_len; | ||
195 | __u8 hrt_version; | ||
196 | __u32 change_ind; | ||
197 | i2o_hrt_entry hrt_entry[1]; | ||
198 | } i2o_hrt; | ||
199 | |||
200 | typedef struct _i2o_lct_entry { | ||
201 | __u32 entry_size:16; | ||
202 | __u32 tid:12; | ||
203 | __u32 reserved:4; | ||
204 | __u32 change_ind; | ||
205 | __u32 device_flags; | ||
206 | __u32 class_id:12; | ||
207 | __u32 version:4; | ||
208 | __u32 vendor_id:16; | ||
209 | __u32 sub_class; | ||
210 | __u32 user_tid:12; | ||
211 | __u32 parent_tid:12; | ||
212 | __u32 bios_info:8; | ||
213 | __u8 identity_tag[8]; | ||
214 | __u32 event_capabilities; | ||
215 | } i2o_lct_entry; | ||
216 | |||
217 | typedef struct _i2o_lct { | ||
218 | __u32 table_size:16; | ||
219 | __u32 boot_tid:12; | ||
220 | __u32 lct_ver:4; | ||
221 | __u32 iop_flags; | ||
222 | __u32 change_ind; | ||
223 | i2o_lct_entry lct_entry[1]; | ||
224 | } i2o_lct; | ||
225 | |||
226 | typedef struct _i2o_status_block { | ||
227 | __u16 org_id; | ||
228 | __u16 reserved; | ||
229 | __u16 iop_id:12; | ||
230 | __u16 reserved1:4; | ||
231 | __u16 host_unit_id; | ||
232 | __u16 segment_number:12; | ||
233 | __u16 i2o_version:4; | ||
234 | __u8 iop_state; | ||
235 | __u8 msg_type; | ||
236 | __u16 inbound_frame_size; | ||
237 | __u8 init_code; | ||
238 | __u8 reserved2; | ||
239 | __u32 max_inbound_frames; | ||
240 | __u32 cur_inbound_frames; | ||
241 | __u32 max_outbound_frames; | ||
242 | char product_id[24]; | ||
243 | __u32 expected_lct_size; | ||
244 | __u32 iop_capabilities; | ||
245 | __u32 desired_mem_size; | ||
246 | __u32 current_mem_size; | ||
247 | __u32 current_mem_base; | ||
248 | __u32 desired_io_size; | ||
249 | __u32 current_io_size; | ||
250 | __u32 current_io_base; | ||
251 | __u32 reserved3:24; | ||
252 | __u32 cmd_status:8; | ||
253 | } i2o_status_block; | ||
254 | |||
255 | /* Event indicator mask flags */ | ||
256 | #define I2O_EVT_IND_STATE_CHANGE 0x80000000 | ||
257 | #define I2O_EVT_IND_GENERAL_WARNING 0x40000000 | ||
258 | #define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 | ||
259 | #define I2O_EVT_IND_LOCK_RELEASE 0x10000000 | ||
260 | #define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 | ||
261 | #define I2O_EVT_IND_DEVICE_RESET 0x04000000 | ||
262 | #define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 | ||
263 | #define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 | ||
264 | #define I2O_EVT_IND_VENDOR_EVT 0x00800000 | ||
265 | #define I2O_EVT_IND_DEVICE_STATE 0x00400000 | ||
266 | |||
267 | /* Executive event indicitors */ | ||
268 | #define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001 | ||
269 | #define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002 | ||
270 | #define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004 | ||
271 | #define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008 | ||
272 | #define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010 | ||
273 | #define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020 | ||
274 | #define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040 | ||
275 | #define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080 | ||
276 | #define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100 | ||
277 | #define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200 | ||
278 | #define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400 | ||
279 | |||
280 | /* Random Block Storage Event Indicators */ | ||
281 | #define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001 | ||
282 | #define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002 | ||
283 | #define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004 | ||
284 | #define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008 | ||
285 | #define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010 | ||
286 | |||
287 | /* Event data for generic events */ | ||
288 | #define I2O_EVT_STATE_CHANGE_NORMAL 0x00 | ||
289 | #define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 | ||
290 | #define I2O_EVT_STATE_CHANGE_RESTART 0x02 | ||
291 | #define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 | ||
292 | #define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 | ||
293 | #define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 | ||
294 | #define I2O_EVT_STATE_CHANGE_FAILED 0x10 | ||
295 | #define I2O_EVT_STATE_CHANGE_FAULTED 0x11 | ||
296 | |||
297 | #define I2O_EVT_GEN_WARNING_NORMAL 0x00 | ||
298 | #define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 | ||
299 | #define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 | ||
300 | |||
301 | #define I2O_EVT_CAPABILITY_OTHER 0x01 | ||
302 | #define I2O_EVT_CAPABILITY_CHANGED 0x02 | ||
303 | |||
304 | #define I2O_EVT_SENSOR_STATE_CHANGED 0x01 | ||
305 | |||
306 | /* | ||
307 | * I2O classes / subclasses | ||
308 | */ | ||
309 | |||
310 | /* Class ID and Code Assignments | ||
311 | * (LCT.ClassID.Version field) | ||
312 | */ | ||
313 | #define I2O_CLASS_VERSION_10 0x00 | ||
314 | #define I2O_CLASS_VERSION_11 0x01 | ||
315 | |||
316 | /* Class code names | ||
317 | * (from v1.5 Table 6-1 Class Code Assignments.) | ||
318 | */ | ||
319 | |||
320 | #define I2O_CLASS_EXECUTIVE 0x000 | ||
321 | #define I2O_CLASS_DDM 0x001 | ||
322 | #define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 | ||
323 | #define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 | ||
324 | #define I2O_CLASS_LAN 0x020 | ||
325 | #define I2O_CLASS_WAN 0x030 | ||
326 | #define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 | ||
327 | #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 | ||
328 | #define I2O_CLASS_SCSI_PERIPHERAL 0x051 | ||
329 | #define I2O_CLASS_ATE_PORT 0x060 | ||
330 | #define I2O_CLASS_ATE_PERIPHERAL 0x061 | ||
331 | #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 | ||
332 | #define I2O_CLASS_FLOPPY_DEVICE 0x071 | ||
333 | #define I2O_CLASS_BUS_ADAPTER 0x080 | ||
334 | #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 | ||
335 | #define I2O_CLASS_PEER_TRANSPORT 0x091 | ||
336 | #define I2O_CLASS_END 0xfff | ||
337 | |||
338 | /* | ||
339 | * Rest of 0x092 - 0x09f reserved for peer-to-peer classes | ||
340 | */ | ||
341 | |||
342 | #define I2O_CLASS_MATCH_ANYCLASS 0xffffffff | ||
343 | |||
344 | /* | ||
345 | * Subclasses | ||
346 | */ | ||
347 | |||
348 | #define I2O_SUBCLASS_i960 0x001 | ||
349 | #define I2O_SUBCLASS_HDM 0x020 | ||
350 | #define I2O_SUBCLASS_ISM 0x021 | ||
351 | |||
352 | /* Operation functions */ | ||
353 | |||
354 | #define I2O_PARAMS_FIELD_GET 0x0001 | ||
355 | #define I2O_PARAMS_LIST_GET 0x0002 | ||
356 | #define I2O_PARAMS_MORE_GET 0x0003 | ||
357 | #define I2O_PARAMS_SIZE_GET 0x0004 | ||
358 | #define I2O_PARAMS_TABLE_GET 0x0005 | ||
359 | #define I2O_PARAMS_FIELD_SET 0x0006 | ||
360 | #define I2O_PARAMS_LIST_SET 0x0007 | ||
361 | #define I2O_PARAMS_ROW_ADD 0x0008 | ||
362 | #define I2O_PARAMS_ROW_DELETE 0x0009 | ||
363 | #define I2O_PARAMS_TABLE_CLEAR 0x000A | ||
364 | |||
365 | /* | ||
366 | * I2O serial number conventions / formats | ||
367 | * (circa v1.5) | ||
368 | */ | ||
369 | |||
370 | #define I2O_SNFORMAT_UNKNOWN 0 | ||
371 | #define I2O_SNFORMAT_BINARY 1 | ||
372 | #define I2O_SNFORMAT_ASCII 2 | ||
373 | #define I2O_SNFORMAT_UNICODE 3 | ||
374 | #define I2O_SNFORMAT_LAN48_MAC 4 | ||
375 | #define I2O_SNFORMAT_WAN 5 | ||
376 | |||
377 | /* | ||
378 | * Plus new in v2.0 (Yellowstone pdf doc) | ||
379 | */ | ||
380 | |||
381 | #define I2O_SNFORMAT_LAN64_MAC 6 | ||
382 | #define I2O_SNFORMAT_DDM 7 | ||
383 | #define I2O_SNFORMAT_IEEE_REG64 8 | ||
384 | #define I2O_SNFORMAT_IEEE_REG128 9 | ||
385 | #define I2O_SNFORMAT_UNKNOWN2 0xff | ||
386 | |||
387 | /* | ||
388 | * I2O Get Status State values | ||
389 | */ | ||
390 | |||
391 | #define ADAPTER_STATE_INITIALIZING 0x01 | ||
392 | #define ADAPTER_STATE_RESET 0x02 | ||
393 | #define ADAPTER_STATE_HOLD 0x04 | ||
394 | #define ADAPTER_STATE_READY 0x05 | ||
395 | #define ADAPTER_STATE_OPERATIONAL 0x08 | ||
396 | #define ADAPTER_STATE_FAILED 0x10 | ||
397 | #define ADAPTER_STATE_FAULTED 0x11 | ||
398 | |||
399 | /* | ||
400 | * Software module types | ||
401 | */ | ||
402 | #define I2O_SOFTWARE_MODULE_IRTOS 0x11 | ||
403 | #define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 | ||
404 | #define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 | ||
405 | |||
406 | /* | ||
407 | * Vendors | ||
408 | */ | ||
409 | #define I2O_VENDOR_DPT 0x001b | ||
410 | |||
411 | /* | ||
412 | * DPT / Adaptec specific values for i2o_sg_io_hdr flags. | ||
413 | */ | ||
414 | #define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 | ||
415 | #define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 | ||
416 | |||
417 | #define I2O_DPT_FLASH_FRAG_SIZE 0x10000 | ||
418 | #define I2O_DPT_FLASH_READ 0x0101 | ||
419 | #define I2O_DPT_FLASH_WRITE 0x0102 | ||
420 | |||
421 | #endif /* _I2O_DEV_H */ | ||
diff --git a/include/linux/i8k.h b/include/linux/i8k.h new file mode 100644 index 00000000000..1c45ba50511 --- /dev/null +++ b/include/linux/i8k.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops | ||
3 | * | ||
4 | * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2, or (at your option) any | ||
9 | * later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_I8K_H | ||
18 | #define _LINUX_I8K_H | ||
19 | |||
20 | #define I8K_PROC "/proc/i8k" | ||
21 | #define I8K_PROC_FMT "1.0" | ||
22 | |||
23 | #define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */ | ||
24 | #define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */ | ||
25 | #define I8K_POWER_STATUS _IOR ('i', 0x82, size_t) | ||
26 | #define I8K_FN_STATUS _IOR ('i', 0x83, size_t) | ||
27 | #define I8K_GET_TEMP _IOR ('i', 0x84, size_t) | ||
28 | #define I8K_GET_SPEED _IOWR('i', 0x85, size_t) | ||
29 | #define I8K_GET_FAN _IOWR('i', 0x86, size_t) | ||
30 | #define I8K_SET_FAN _IOWR('i', 0x87, size_t) | ||
31 | |||
32 | #define I8K_FAN_LEFT 1 | ||
33 | #define I8K_FAN_RIGHT 0 | ||
34 | #define I8K_FAN_OFF 0 | ||
35 | #define I8K_FAN_LOW 1 | ||
36 | #define I8K_FAN_HIGH 2 | ||
37 | #define I8K_FAN_MAX I8K_FAN_HIGH | ||
38 | |||
39 | #define I8K_VOL_UP 1 | ||
40 | #define I8K_VOL_DOWN 2 | ||
41 | #define I8K_VOL_MUTE 4 | ||
42 | |||
43 | #define I8K_AC 1 | ||
44 | #define I8K_BATTERY 0 | ||
45 | |||
46 | #endif | ||
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h new file mode 100644 index 00000000000..06695b74d40 --- /dev/null +++ b/include/linux/ibmtr.h | |||
@@ -0,0 +1,373 @@ | |||
1 | #ifndef __LINUX_IBMTR_H__ | ||
2 | #define __LINUX_IBMTR_H__ | ||
3 | |||
4 | /* Definitions for an IBM Token Ring card. */ | ||
5 | /* This file is distributed under the GNU GPL */ | ||
6 | |||
7 | /* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */ | ||
8 | |||
9 | #define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */ | ||
10 | #define TR_RST_TIME (msecs_to_jiffies(50)) /* 5 on PC = 50 ms */ | ||
11 | #define TR_BUSY_INTERVAL (msecs_to_jiffies(200)) /* 5 on PC = 200 ms */ | ||
12 | #define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */ | ||
13 | |||
14 | #define TR_ISA 1 | ||
15 | #define TR_MCA 2 | ||
16 | #define TR_ISAPNP 3 | ||
17 | #define NOTOK 0 | ||
18 | |||
19 | #define IBMTR_SHARED_RAM_SIZE 0x10000 | ||
20 | #define IBMTR_IO_EXTENT 4 | ||
21 | #define IBMTR_MAX_ADAPTERS 4 | ||
22 | |||
23 | #define CHANNEL_ID 0X1F30 | ||
24 | #define AIP 0X1F00 | ||
25 | #define AIPADAPTYPE 0X1FA0 | ||
26 | #define AIPDATARATE 0X1FA2 | ||
27 | #define AIPEARLYTOKEN 0X1FA4 | ||
28 | #define AIPAVAILSHRAM 0X1FA6 | ||
29 | #define AIPSHRAMPAGE 0X1FA8 | ||
30 | #define AIP4MBDHB 0X1FAA | ||
31 | #define AIP16MBDHB 0X1FAC | ||
32 | #define AIPFID 0X1FBA | ||
33 | |||
34 | #define ADAPTRESET 0x1 /* Control Adapter reset (add to base) */ | ||
35 | #define ADAPTRESETREL 0x2 /* Release Adapter from reset ( """) */ | ||
36 | #define ADAPTINTREL 0x3 /* Adapter interrupt release */ | ||
37 | |||
38 | #define GLOBAL_INT_ENABLE 0x02f0 | ||
39 | |||
40 | /* MMIO bits 0-4 select register */ | ||
41 | #define RRR_EVEN 0x00 /* Shared RAM relocation registers - even and odd */ | ||
42 | /* Used to set the starting address of shared RAM */ | ||
43 | /* Bits 1 through 7 of this register map to bits 13 through 19 of the shared | ||
44 | RAM address.*/ | ||
45 | /* ie: 0x02 sets RAM address to ...ato! issy su wazzoo !! GODZILLA!!! */ | ||
46 | #define RRR_ODD 0x01 | ||
47 | /* Bits 2 and 3 of this register can be read to determine shared RAM size */ | ||
48 | /* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k */ | ||
49 | #define WRBR_EVEN 0x02 /* Write region base registers - even and odd */ | ||
50 | #define WRBR_ODD 0x03 | ||
51 | #define WWOR_EVEN 0x04 /* Write window open registers - even and odd */ | ||
52 | #define WWOR_ODD 0x05 | ||
53 | #define WWCR_EVEN 0x06 /* Write window close registers - even and odd */ | ||
54 | #define WWCR_ODD 0x07 | ||
55 | |||
56 | /* Interrupt status registers - PC system - even and odd */ | ||
57 | #define ISRP_EVEN 0x08 | ||
58 | |||
59 | #define TCR_INT 0x10 /* Bit 4 - Timer interrupt. The TVR_EVEN timer has | ||
60 | expired. */ | ||
61 | #define ERR_INT 0x08 /* Bit 3 - Error interrupt. The adapter has had an | ||
62 | internal error. */ | ||
63 | #define ACCESS_INT 0x04 /* Bit 2 - Access interrupt. You have attempted to | ||
64 | write to an invalid area of shared RAM | ||
65 | or an invalid register within the MMIO. */ | ||
66 | /* In addition, the following bits within ISRP_EVEN can be turned on or off */ | ||
67 | /* by you to control the interrupt processing: */ | ||
68 | #define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable. If 0, no interrupts will | ||
69 | occur. If 1, interrupts will occur normally. | ||
70 | Normally set to 1. */ | ||
71 | /* Bit 0 - Primary or alternate adapter. Set to zero if this adapter is the | ||
72 | primary adapter, 1 if this adapter is the alternate adapter. */ | ||
73 | |||
74 | |||
75 | #define ISRP_ODD 0x09 | ||
76 | |||
77 | #define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check. the adapter has | ||
78 | encountered a serious problem and has closed | ||
79 | itself. Whoa. */ | ||
80 | #define SRB_RESP_INT 0x20 /* Bit 5 - SRB response. The adapter has accepted | ||
81 | an SRB request and set the return code within | ||
82 | the SRB. */ | ||
83 | #define ASB_FREE_INT 0x10 /* Bit 4 - ASB free. The adapter has read the ASB | ||
84 | and this area can be safely reused. This interrupt | ||
85 | is only used if your application has set the ASB | ||
86 | free request bit in ISRA_ODD or if an error was | ||
87 | detected in your response. */ | ||
88 | #define ARB_CMD_INT 0x08 /* Bit 3 - ARB command. The adapter has given you a | ||
89 | command for action. The command is located in the | ||
90 | ARB area of shared memory. */ | ||
91 | #define SSB_RESP_INT 0x04 /* Bit 2 - SSB response. The adapter has posted a | ||
92 | response to your SRB (the response is located in | ||
93 | the SSB area of shared memory). */ | ||
94 | /* Bit 1 - Bridge frame forward complete. */ | ||
95 | |||
96 | |||
97 | |||
98 | #define ISRA_EVEN 0x0A /*Interrupt status registers - adapter - even and odd */ | ||
99 | /* Bit 7 - Internal parity error (on adapter's internal bus) */ | ||
100 | /* Bit 6 - Timer interrupt pending */ | ||
101 | /* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */ | ||
102 | /* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */ | ||
103 | /* Bit 3 - Adapter processor check status */ | ||
104 | /* Bit 2 - Reserved */ | ||
105 | /* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */ | ||
106 | /* Bit 0 - Adapter software interrupt mask (prevents internal software ints) */ | ||
107 | |||
108 | #define ISRA_ODD 0x0B | ||
109 | #define CMD_IN_SRB 0x20 /* Bit 5 - Indicates that you have placed a new | ||
110 | command in the SRB and are ready for the adapter to | ||
111 | process the command. */ | ||
112 | #define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response | ||
113 | (an ASB) in the shared RAM which is available for | ||
114 | the adapter's use. */ | ||
115 | /* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but | ||
116 | that a previous command is still pending. The adapter will then | ||
117 | interrupt you when the previous command is completed */ | ||
118 | /* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but | ||
119 | that a previous ASB is still pending. The adapter will then interrupt | ||
120 | you when the previous ASB is copied. */ | ||
121 | #define ARB_FREE 0x2 | ||
122 | #define SSB_FREE 0x1 | ||
123 | |||
124 | #define TCR_EVEN 0x0C /* Timer control registers - even and odd */ | ||
125 | #define TCR_ODD 0x0D | ||
126 | #define TVR_EVEN 0x0E /* Timer value registers - even and odd */ | ||
127 | #define TVR_ODD 0x0F | ||
128 | #define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */ | ||
129 | #define SRPR_ENABLE_PAGING 0xc0 | ||
130 | #define SRPR_ODD 0x19 /* Not used. */ | ||
131 | #define TOKREAD 0x60 | ||
132 | #define TOKOR 0x40 | ||
133 | #define TOKAND 0x20 | ||
134 | #define TOKWRITE 0x00 | ||
135 | |||
136 | /* MMIO bits 5-6 select operation */ | ||
137 | /* 00 is used to write to a register */ | ||
138 | /* 01 is used to bitwise AND a byte with a register */ | ||
139 | /* 10 is used to bitwise OR a byte with a register */ | ||
140 | /* 11 is used to read from a register */ | ||
141 | |||
142 | /* MMIO bits 7-8 select area of interest.. see below */ | ||
143 | /* 00 selects attachment control area. */ | ||
144 | /* 01 is reserved. */ | ||
145 | /* 10 selects adapter identification area A containing the adapter encoded | ||
146 | address. */ | ||
147 | /* 11 selects the adapter identification area B containing test patterns. */ | ||
148 | |||
149 | #define PCCHANNELID 5049434F3631313039393020 | ||
150 | #define MCCHANNELID 4D4152533633583435313820 | ||
151 | |||
152 | #define ACA_OFFSET 0x1e00 | ||
153 | #define ACA_SET 0x40 | ||
154 | #define ACA_RESET 0x20 | ||
155 | #define ACA_RW 0x00 | ||
156 | |||
157 | #ifdef ENABLE_PAGING | ||
158 | #define SET_PAGE(x) (writeb((x), ti->mmio + ACA_OFFSET+ ACA_RW + SRPR_EVEN)) | ||
159 | #else | ||
160 | #define SET_PAGE(x) | ||
161 | #endif | ||
162 | |||
163 | /* do_tok_int possible values */ | ||
164 | #define FIRST_INT 1 | ||
165 | #define NOT_FIRST 2 | ||
166 | |||
167 | typedef enum { CLOSED, OPEN } open_state; | ||
168 | //staic const char *printstate[] = { "CLOSED","OPEN"}; | ||
169 | |||
170 | struct tok_info { | ||
171 | unsigned char irq; | ||
172 | void __iomem *mmio; | ||
173 | unsigned char hw_address[32]; | ||
174 | unsigned char adapter_type; | ||
175 | unsigned char data_rate; | ||
176 | unsigned char token_release; | ||
177 | unsigned char avail_shared_ram; | ||
178 | unsigned char shared_ram_paging; | ||
179 | unsigned char turbo; | ||
180 | unsigned short dhb_size4mb; | ||
181 | unsigned short rbuf_len4; | ||
182 | unsigned short rbuf_cnt4; | ||
183 | unsigned short maxmtu4; | ||
184 | unsigned short dhb_size16mb; | ||
185 | unsigned short rbuf_len16; | ||
186 | unsigned short rbuf_cnt16; | ||
187 | unsigned short maxmtu16; | ||
188 | /* Additions by David Morris */ | ||
189 | unsigned char do_tok_int; | ||
190 | wait_queue_head_t wait_for_reset; | ||
191 | unsigned char sram_base; | ||
192 | /* Additions by Peter De Schrijver */ | ||
193 | unsigned char page_mask; /* mask to select RAM page to Map*/ | ||
194 | unsigned char mapped_ram_size; /* size of RAM page */ | ||
195 | __u32 sram_phys; /* Shared memory base address */ | ||
196 | void __iomem *sram_virt; /* Shared memory base address */ | ||
197 | void __iomem *init_srb; /* Initial System Request Block address */ | ||
198 | void __iomem *srb; /* System Request Block address */ | ||
199 | void __iomem *ssb; /* System Status Block address */ | ||
200 | void __iomem *arb; /* Adapter Request Block address */ | ||
201 | void __iomem *asb; /* Adapter Status Block address */ | ||
202 | __u8 init_srb_page; | ||
203 | __u8 srb_page; | ||
204 | __u8 ssb_page; | ||
205 | __u8 arb_page; | ||
206 | __u8 asb_page; | ||
207 | unsigned short exsap_station_id; | ||
208 | unsigned short global_int_enable; | ||
209 | struct sk_buff *current_skb; | ||
210 | |||
211 | unsigned char auto_speedsave; | ||
212 | open_state open_status, sap_status; | ||
213 | enum {MANUAL, AUTOMATIC} open_mode; | ||
214 | enum {FAIL, RESTART, REOPEN} open_action; | ||
215 | enum {NO, YES} open_failure; | ||
216 | unsigned char readlog_pending; | ||
217 | unsigned short adapter_int_enable; /* Adapter-specific int enable */ | ||
218 | struct timer_list tr_timer; | ||
219 | unsigned char ring_speed; | ||
220 | spinlock_t lock; /* SMP protection */ | ||
221 | }; | ||
222 | |||
223 | /* token ring adapter commands */ | ||
224 | #define DIR_INTERRUPT 0x00 /* struct srb_interrupt */ | ||
225 | #define DIR_MOD_OPEN_PARAMS 0x01 | ||
226 | #define DIR_OPEN_ADAPTER 0x03 /* struct dir_open_adapter */ | ||
227 | #define DIR_CLOSE_ADAPTER 0x04 | ||
228 | #define DIR_SET_GRP_ADDR 0x06 | ||
229 | #define DIR_SET_FUNC_ADDR 0x07 /* struct srb_set_funct_addr */ | ||
230 | #define DIR_READ_LOG 0x08 /* struct srb_read_log */ | ||
231 | #define DLC_OPEN_SAP 0x15 /* struct dlc_open_sap */ | ||
232 | #define DLC_CLOSE_SAP 0x16 | ||
233 | #define DATA_LOST 0x20 /* struct asb_rec */ | ||
234 | #define REC_DATA 0x81 /* struct arb_rec_req */ | ||
235 | #define XMIT_DATA_REQ 0x82 /* struct arb_xmit_req */ | ||
236 | #define DLC_STATUS 0x83 /* struct arb_dlc_status */ | ||
237 | #define RING_STAT_CHANGE 0x84 /* struct dlc_open_sap ??? */ | ||
238 | |||
239 | /* DIR_OPEN_ADAPTER options */ | ||
240 | #define OPEN_PASS_BCON_MAC 0x0100 | ||
241 | #define NUM_RCV_BUF 2 | ||
242 | #define RCV_BUF_LEN 1024 | ||
243 | #define DHB_LENGTH 2048 | ||
244 | #define NUM_DHB 2 | ||
245 | #define DLC_MAX_SAP 2 | ||
246 | #define DLC_MAX_STA 1 | ||
247 | |||
248 | /* DLC_OPEN_SAP options */ | ||
249 | #define MAX_I_FIELD 0x0088 | ||
250 | #define SAP_OPEN_IND_SAP 0x04 | ||
251 | #define SAP_OPEN_PRIORITY 0x20 | ||
252 | #define SAP_OPEN_STATION_CNT 0x1 | ||
253 | #define XMIT_DIR_FRAME 0x0A | ||
254 | #define XMIT_UI_FRAME 0x0d | ||
255 | #define XMIT_XID_CMD 0x0e | ||
256 | #define XMIT_TEST_CMD 0x11 | ||
257 | |||
258 | /* srb close return code */ | ||
259 | #define SIGNAL_LOSS 0x8000 | ||
260 | #define HARD_ERROR 0x4000 | ||
261 | #define XMIT_BEACON 0x1000 | ||
262 | #define LOBE_FAULT 0x0800 | ||
263 | #define AUTO_REMOVAL 0x0400 | ||
264 | #define REMOVE_RECV 0x0100 | ||
265 | #define LOG_OVERFLOW 0x0080 | ||
266 | #define RING_RECOVER 0x0020 | ||
267 | |||
268 | struct srb_init_response { | ||
269 | unsigned char command; | ||
270 | unsigned char init_status; | ||
271 | unsigned char init_status_2; | ||
272 | unsigned char reserved[3]; | ||
273 | __u16 bring_up_code; | ||
274 | __u16 encoded_address; | ||
275 | __u16 level_address; | ||
276 | __u16 adapter_address; | ||
277 | __u16 parms_address; | ||
278 | __u16 mac_address; | ||
279 | }; | ||
280 | |||
281 | struct dir_open_adapter { | ||
282 | unsigned char command; | ||
283 | char reserved[7]; | ||
284 | __u16 open_options; | ||
285 | unsigned char node_address[6]; | ||
286 | unsigned char group_address[4]; | ||
287 | unsigned char funct_address[4]; | ||
288 | __u16 num_rcv_buf; | ||
289 | __u16 rcv_buf_len; | ||
290 | __u16 dhb_length; | ||
291 | unsigned char num_dhb; | ||
292 | char reserved2; | ||
293 | unsigned char dlc_max_sap; | ||
294 | unsigned char dlc_max_sta; | ||
295 | unsigned char dlc_max_gsap; | ||
296 | unsigned char dlc_max_gmem; | ||
297 | unsigned char dlc_t1_tick_1; | ||
298 | unsigned char dlc_t2_tick_1; | ||
299 | unsigned char dlc_ti_tick_1; | ||
300 | unsigned char dlc_t1_tick_2; | ||
301 | unsigned char dlc_t2_tick_2; | ||
302 | unsigned char dlc_ti_tick_2; | ||
303 | unsigned char product_id[18]; | ||
304 | }; | ||
305 | |||
306 | struct dlc_open_sap { | ||
307 | unsigned char command; | ||
308 | unsigned char reserved1; | ||
309 | unsigned char ret_code; | ||
310 | unsigned char reserved2; | ||
311 | __u16 station_id; | ||
312 | unsigned char timer_t1; | ||
313 | unsigned char timer_t2; | ||
314 | unsigned char timer_ti; | ||
315 | unsigned char maxout; | ||
316 | unsigned char maxin; | ||
317 | unsigned char maxout_incr; | ||
318 | unsigned char max_retry_count; | ||
319 | unsigned char gsap_max_mem; | ||
320 | __u16 max_i_field; | ||
321 | unsigned char sap_value; | ||
322 | unsigned char sap_options; | ||
323 | unsigned char station_count; | ||
324 | unsigned char sap_gsap_mem; | ||
325 | unsigned char gsap[0]; | ||
326 | }; | ||
327 | |||
328 | struct srb_xmit { | ||
329 | unsigned char command; | ||
330 | unsigned char cmd_corr; | ||
331 | unsigned char ret_code; | ||
332 | unsigned char reserved1; | ||
333 | __u16 station_id; | ||
334 | }; | ||
335 | |||
336 | struct arb_rec_req { | ||
337 | unsigned char command; | ||
338 | unsigned char reserved1[3]; | ||
339 | __u16 station_id; | ||
340 | __u16 rec_buf_addr; | ||
341 | unsigned char lan_hdr_len; | ||
342 | unsigned char dlc_hdr_len; | ||
343 | __u16 frame_len; | ||
344 | unsigned char msg_type; | ||
345 | }; | ||
346 | |||
347 | struct asb_rec { | ||
348 | unsigned char command; | ||
349 | unsigned char reserved1; | ||
350 | unsigned char ret_code; | ||
351 | unsigned char reserved2; | ||
352 | __u16 station_id; | ||
353 | __u16 rec_buf_addr; | ||
354 | }; | ||
355 | |||
356 | struct rec_buf { | ||
357 | unsigned char reserved1[2]; | ||
358 | __u16 buf_ptr; | ||
359 | unsigned char reserved2; | ||
360 | unsigned char receive_fs; | ||
361 | __u16 buf_len; | ||
362 | unsigned char data[0]; | ||
363 | }; | ||
364 | |||
365 | struct srb_set_funct_addr { | ||
366 | unsigned char command; | ||
367 | unsigned char reserved1; | ||
368 | unsigned char ret_code; | ||
369 | unsigned char reserved2[3]; | ||
370 | unsigned char funct_address[4]; | ||
371 | }; | ||
372 | |||
373 | #endif | ||
diff --git a/include/linux/if.h b/include/linux/if.h new file mode 100644 index 00000000000..03489ca92de --- /dev/null +++ b/include/linux/if.h | |||
@@ -0,0 +1,229 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Global definitions for the INET interface module. | ||
7 | * | ||
8 | * Version: @(#)if.h 1.0.2 04/18/93 | ||
9 | * | ||
10 | * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 | ||
11 | * Ross Biro | ||
12 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #ifndef _LINUX_IF_H | ||
20 | #define _LINUX_IF_H | ||
21 | |||
22 | #include <linux/types.h> /* for "__kernel_caddr_t" et al */ | ||
23 | #include <linux/socket.h> /* for "struct sockaddr" et al */ | ||
24 | #include <linux/compiler.h> /* for "__user" et al */ | ||
25 | |||
26 | #define IFNAMSIZ 16 | ||
27 | #define IFALIASZ 256 | ||
28 | #include <linux/hdlc/ioctl.h> | ||
29 | |||
30 | /* Standard interface flags (netdevice->flags). */ | ||
31 | #define IFF_UP 0x1 /* interface is up */ | ||
32 | #define IFF_BROADCAST 0x2 /* broadcast address valid */ | ||
33 | #define IFF_DEBUG 0x4 /* turn on debugging */ | ||
34 | #define IFF_LOOPBACK 0x8 /* is a loopback net */ | ||
35 | #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ | ||
36 | #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ | ||
37 | #define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */ | ||
38 | #define IFF_NOARP 0x80 /* no ARP protocol */ | ||
39 | #define IFF_PROMISC 0x100 /* receive all packets */ | ||
40 | #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ | ||
41 | |||
42 | #define IFF_MASTER 0x400 /* master of a load balancer */ | ||
43 | #define IFF_SLAVE 0x800 /* slave of a load balancer */ | ||
44 | |||
45 | #define IFF_MULTICAST 0x1000 /* Supports multicast */ | ||
46 | |||
47 | #define IFF_PORTSEL 0x2000 /* can set media type */ | ||
48 | #define IFF_AUTOMEDIA 0x4000 /* auto media select active */ | ||
49 | #define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ | ||
50 | |||
51 | #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ | ||
52 | #define IFF_DORMANT 0x20000 /* driver signals dormant */ | ||
53 | |||
54 | #define IFF_ECHO 0x40000 /* echo sent packets */ | ||
55 | |||
56 | #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ | ||
57 | IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) | ||
58 | |||
59 | /* Private (from user) interface flags (netdevice->priv_flags). */ | ||
60 | #define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */ | ||
61 | #define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */ | ||
62 | #define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ | ||
63 | #define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ | ||
64 | #define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ | ||
65 | #define IFF_BONDING 0x20 /* bonding master or slave */ | ||
66 | #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ | ||
67 | #define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ | ||
68 | #define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ | ||
69 | #define IFF_WAN_HDLC 0x200 /* WAN HDLC device */ | ||
70 | #define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to | ||
71 | * release skb->dst | ||
72 | */ | ||
73 | #define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ | ||
74 | #define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */ | ||
75 | #define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */ | ||
76 | #define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */ | ||
77 | #define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch | ||
78 | * datapath port */ | ||
79 | #define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing | ||
80 | * skbs on transmit */ | ||
81 | |||
82 | #define IF_GET_IFACE 0x0001 /* for querying only */ | ||
83 | #define IF_GET_PROTO 0x0002 | ||
84 | |||
85 | /* For definitions see hdlc.h */ | ||
86 | #define IF_IFACE_V35 0x1000 /* V.35 serial interface */ | ||
87 | #define IF_IFACE_V24 0x1001 /* V.24 serial interface */ | ||
88 | #define IF_IFACE_X21 0x1002 /* X.21 serial interface */ | ||
89 | #define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ | ||
90 | #define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ | ||
91 | #define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ | ||
92 | #define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ | ||
93 | |||
94 | /* For definitions see hdlc.h */ | ||
95 | #define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ | ||
96 | #define IF_PROTO_PPP 0x2001 /* PPP protocol */ | ||
97 | #define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ | ||
98 | #define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ | ||
99 | #define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ | ||
100 | #define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ | ||
101 | #define IF_PROTO_X25 0x2006 /* X.25 */ | ||
102 | #define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ | ||
103 | #define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ | ||
104 | #define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ | ||
105 | #define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ | ||
106 | #define IF_PROTO_FR_ETH_PVC 0x200B | ||
107 | #define IF_PROTO_RAW 0x200C /* RAW Socket */ | ||
108 | |||
109 | /* RFC 2863 operational status */ | ||
110 | enum { | ||
111 | IF_OPER_UNKNOWN, | ||
112 | IF_OPER_NOTPRESENT, | ||
113 | IF_OPER_DOWN, | ||
114 | IF_OPER_LOWERLAYERDOWN, | ||
115 | IF_OPER_TESTING, | ||
116 | IF_OPER_DORMANT, | ||
117 | IF_OPER_UP, | ||
118 | }; | ||
119 | |||
120 | /* link modes */ | ||
121 | enum { | ||
122 | IF_LINK_MODE_DEFAULT, | ||
123 | IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ | ||
124 | }; | ||
125 | |||
126 | /* | ||
127 | * Device mapping structure. I'd just gone off and designed a | ||
128 | * beautiful scheme using only loadable modules with arguments | ||
129 | * for driver options and along come the PCMCIA people 8) | ||
130 | * | ||
131 | * Ah well. The get() side of this is good for WDSETUP, and it'll | ||
132 | * be handy for debugging things. The set side is fine for now and | ||
133 | * being very small might be worth keeping for clean configuration. | ||
134 | */ | ||
135 | |||
136 | struct ifmap { | ||
137 | unsigned long mem_start; | ||
138 | unsigned long mem_end; | ||
139 | unsigned short base_addr; | ||
140 | unsigned char irq; | ||
141 | unsigned char dma; | ||
142 | unsigned char port; | ||
143 | /* 3 bytes spare */ | ||
144 | }; | ||
145 | |||
146 | struct if_settings { | ||
147 | unsigned int type; /* Type of physical device or protocol */ | ||
148 | unsigned int size; /* Size of the data allocated by the caller */ | ||
149 | union { | ||
150 | /* {atm/eth/dsl}_settings anyone ? */ | ||
151 | raw_hdlc_proto __user *raw_hdlc; | ||
152 | cisco_proto __user *cisco; | ||
153 | fr_proto __user *fr; | ||
154 | fr_proto_pvc __user *fr_pvc; | ||
155 | fr_proto_pvc_info __user *fr_pvc_info; | ||
156 | |||
157 | /* interface settings */ | ||
158 | sync_serial_settings __user *sync; | ||
159 | te1_settings __user *te1; | ||
160 | } ifs_ifsu; | ||
161 | }; | ||
162 | |||
163 | /* | ||
164 | * Interface request structure used for socket | ||
165 | * ioctl's. All interface ioctl's must have parameter | ||
166 | * definitions which begin with ifr_name. The | ||
167 | * remainder may be interface specific. | ||
168 | */ | ||
169 | |||
170 | struct ifreq { | ||
171 | #define IFHWADDRLEN 6 | ||
172 | union | ||
173 | { | ||
174 | char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | ||
175 | } ifr_ifrn; | ||
176 | |||
177 | union { | ||
178 | struct sockaddr ifru_addr; | ||
179 | struct sockaddr ifru_dstaddr; | ||
180 | struct sockaddr ifru_broadaddr; | ||
181 | struct sockaddr ifru_netmask; | ||
182 | struct sockaddr ifru_hwaddr; | ||
183 | short ifru_flags; | ||
184 | int ifru_ivalue; | ||
185 | int ifru_mtu; | ||
186 | struct ifmap ifru_map; | ||
187 | char ifru_slave[IFNAMSIZ]; /* Just fits the size */ | ||
188 | char ifru_newname[IFNAMSIZ]; | ||
189 | void __user * ifru_data; | ||
190 | struct if_settings ifru_settings; | ||
191 | } ifr_ifru; | ||
192 | }; | ||
193 | |||
194 | #define ifr_name ifr_ifrn.ifrn_name /* interface name */ | ||
195 | #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ | ||
196 | #define ifr_addr ifr_ifru.ifru_addr /* address */ | ||
197 | #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ | ||
198 | #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ | ||
199 | #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ | ||
200 | #define ifr_flags ifr_ifru.ifru_flags /* flags */ | ||
201 | #define ifr_metric ifr_ifru.ifru_ivalue /* metric */ | ||
202 | #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ | ||
203 | #define ifr_map ifr_ifru.ifru_map /* device map */ | ||
204 | #define ifr_slave ifr_ifru.ifru_slave /* slave device */ | ||
205 | #define ifr_data ifr_ifru.ifru_data /* for use by interface */ | ||
206 | #define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ | ||
207 | #define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ | ||
208 | #define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ | ||
209 | #define ifr_newname ifr_ifru.ifru_newname /* New name */ | ||
210 | #define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ | ||
211 | |||
212 | /* | ||
213 | * Structure used in SIOCGIFCONF request. | ||
214 | * Used to retrieve interface configuration | ||
215 | * for machine (useful for programs which | ||
216 | * must know all networks accessible). | ||
217 | */ | ||
218 | |||
219 | struct ifconf { | ||
220 | int ifc_len; /* size of buffer */ | ||
221 | union { | ||
222 | char __user *ifcu_buf; | ||
223 | struct ifreq __user *ifcu_req; | ||
224 | } ifc_ifcu; | ||
225 | }; | ||
226 | #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ | ||
227 | #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ | ||
228 | |||
229 | #endif /* _LINUX_IF_H */ | ||
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h new file mode 100644 index 00000000000..23357ab81a7 --- /dev/null +++ b/include/linux/if_addr.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef __LINUX_IF_ADDR_H | ||
2 | #define __LINUX_IF_ADDR_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netlink.h> | ||
6 | |||
7 | struct ifaddrmsg { | ||
8 | __u8 ifa_family; | ||
9 | __u8 ifa_prefixlen; /* The prefix length */ | ||
10 | __u8 ifa_flags; /* Flags */ | ||
11 | __u8 ifa_scope; /* Address scope */ | ||
12 | __u32 ifa_index; /* Link index */ | ||
13 | }; | ||
14 | |||
15 | /* | ||
16 | * Important comment: | ||
17 | * IFA_ADDRESS is prefix address, rather than local interface address. | ||
18 | * It makes no difference for normally configured broadcast interfaces, | ||
19 | * but for point-to-point IFA_ADDRESS is DESTINATION address, | ||
20 | * local address is supplied in IFA_LOCAL attribute. | ||
21 | */ | ||
22 | enum { | ||
23 | IFA_UNSPEC, | ||
24 | IFA_ADDRESS, | ||
25 | IFA_LOCAL, | ||
26 | IFA_LABEL, | ||
27 | IFA_BROADCAST, | ||
28 | IFA_ANYCAST, | ||
29 | IFA_CACHEINFO, | ||
30 | IFA_MULTICAST, | ||
31 | __IFA_MAX, | ||
32 | }; | ||
33 | |||
34 | #define IFA_MAX (__IFA_MAX - 1) | ||
35 | |||
36 | /* ifa_flags */ | ||
37 | #define IFA_F_SECONDARY 0x01 | ||
38 | #define IFA_F_TEMPORARY IFA_F_SECONDARY | ||
39 | |||
40 | #define IFA_F_NODAD 0x02 | ||
41 | #define IFA_F_OPTIMISTIC 0x04 | ||
42 | #define IFA_F_DADFAILED 0x08 | ||
43 | #define IFA_F_HOMEADDRESS 0x10 | ||
44 | #define IFA_F_DEPRECATED 0x20 | ||
45 | #define IFA_F_TENTATIVE 0x40 | ||
46 | #define IFA_F_PERMANENT 0x80 | ||
47 | |||
48 | struct ifa_cacheinfo { | ||
49 | __u32 ifa_prefered; | ||
50 | __u32 ifa_valid; | ||
51 | __u32 cstamp; /* created timestamp, hundredths of seconds */ | ||
52 | __u32 tstamp; /* updated timestamp, hundredths of seconds */ | ||
53 | }; | ||
54 | |||
55 | /* backwards compatibility for userspace */ | ||
56 | #ifndef __KERNEL__ | ||
57 | #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) | ||
58 | #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) | ||
59 | #endif | ||
60 | |||
61 | #endif | ||
diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h new file mode 100644 index 00000000000..54580c29818 --- /dev/null +++ b/include/linux/if_addrlabel.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * if_addrlabel.h - netlink interface for address labels | ||
3 | * | ||
4 | * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org> | ||
8 | */ | ||
9 | |||
10 | #ifndef __LINUX_IF_ADDRLABEL_H | ||
11 | #define __LINUX_IF_ADDRLABEL_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | struct ifaddrlblmsg { | ||
16 | __u8 ifal_family; /* Address family */ | ||
17 | __u8 __ifal_reserved; /* Reserved */ | ||
18 | __u8 ifal_prefixlen; /* Prefix length */ | ||
19 | __u8 ifal_flags; /* Flags */ | ||
20 | __u32 ifal_index; /* Link index */ | ||
21 | __u32 ifal_seq; /* sequence number */ | ||
22 | }; | ||
23 | |||
24 | enum { | ||
25 | IFAL_ADDRESS = 1, | ||
26 | IFAL_LABEL = 2, | ||
27 | __IFAL_MAX | ||
28 | }; | ||
29 | |||
30 | #define IFAL_MAX (__IFAL_MAX - 1) | ||
31 | |||
32 | #endif | ||
diff --git a/include/linux/if_alg.h b/include/linux/if_alg.h new file mode 100644 index 00000000000..0f9acce5b1f --- /dev/null +++ b/include/linux/if_alg.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * if_alg: User-space algorithm interface | ||
3 | * | ||
4 | * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation; either version 2 of the License, or (at your option) | ||
9 | * any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _LINUX_IF_ALG_H | ||
14 | #define _LINUX_IF_ALG_H | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | struct sockaddr_alg { | ||
19 | __u16 salg_family; | ||
20 | __u8 salg_type[14]; | ||
21 | __u32 salg_feat; | ||
22 | __u32 salg_mask; | ||
23 | __u8 salg_name[64]; | ||
24 | }; | ||
25 | |||
26 | struct af_alg_iv { | ||
27 | __u32 ivlen; | ||
28 | __u8 iv[0]; | ||
29 | }; | ||
30 | |||
31 | /* Socket options */ | ||
32 | #define ALG_SET_KEY 1 | ||
33 | #define ALG_SET_IV 2 | ||
34 | #define ALG_SET_OP 3 | ||
35 | |||
36 | /* Operations */ | ||
37 | #define ALG_OP_DECRYPT 0 | ||
38 | #define ALG_OP_ENCRYPT 1 | ||
39 | |||
40 | #endif /* _LINUX_IF_ALG_H */ | ||
diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h new file mode 100644 index 00000000000..46e34bd0e78 --- /dev/null +++ b/include/linux/if_arcnet.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Global definitions for the ARCnet interface. | ||
7 | * | ||
8 | * Authors: David Woodhouse and Avery Pennarun | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_IF_ARCNET_H | ||
17 | #define _LINUX_IF_ARCNET_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/if_ether.h> | ||
21 | |||
22 | |||
23 | /* | ||
24 | * These are the defined ARCnet Protocol ID's. | ||
25 | */ | ||
26 | |||
27 | /* CAP mode */ | ||
28 | /* No macro but uses 1-8 */ | ||
29 | |||
30 | /* RFC1201 Protocol ID's */ | ||
31 | #define ARC_P_IP 212 /* 0xD4 */ | ||
32 | #define ARC_P_IPV6 196 /* 0xC4: RFC2497 */ | ||
33 | #define ARC_P_ARP 213 /* 0xD5 */ | ||
34 | #define ARC_P_RARP 214 /* 0xD6 */ | ||
35 | #define ARC_P_IPX 250 /* 0xFA */ | ||
36 | #define ARC_P_NOVELL_EC 236 /* 0xEC */ | ||
37 | |||
38 | /* Old RFC1051 Protocol ID's */ | ||
39 | #define ARC_P_IP_RFC1051 240 /* 0xF0 */ | ||
40 | #define ARC_P_ARP_RFC1051 241 /* 0xF1 */ | ||
41 | |||
42 | /* MS LanMan/WfWg "NDIS" encapsulation */ | ||
43 | #define ARC_P_ETHER 232 /* 0xE8 */ | ||
44 | |||
45 | /* Unsupported/indirectly supported protocols */ | ||
46 | #define ARC_P_DATAPOINT_BOOT 0 /* very old Datapoint equipment */ | ||
47 | #define ARC_P_DATAPOINT_MOUNT 1 | ||
48 | #define ARC_P_POWERLAN_BEACON 8 /* Probably ATA-Netbios related */ | ||
49 | #define ARC_P_POWERLAN_BEACON2 243 /* 0xF3 */ | ||
50 | #define ARC_P_LANSOFT 251 /* 0xFB - what is this? */ | ||
51 | #define ARC_P_ATALK 0xDD | ||
52 | |||
53 | /* Hardware address length */ | ||
54 | #define ARCNET_ALEN 1 | ||
55 | |||
56 | /* | ||
57 | * The RFC1201-specific components of an arcnet packet header. | ||
58 | */ | ||
59 | struct arc_rfc1201 { | ||
60 | __u8 proto; /* protocol ID field - varies */ | ||
61 | __u8 split_flag; /* for use with split packets */ | ||
62 | __be16 sequence; /* sequence number */ | ||
63 | __u8 payload[0]; /* space remaining in packet (504 bytes)*/ | ||
64 | }; | ||
65 | #define RFC1201_HDR_SIZE 4 | ||
66 | |||
67 | |||
68 | /* | ||
69 | * The RFC1051-specific components. | ||
70 | */ | ||
71 | struct arc_rfc1051 { | ||
72 | __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ | ||
73 | __u8 payload[0]; /* 507 bytes */ | ||
74 | }; | ||
75 | #define RFC1051_HDR_SIZE 1 | ||
76 | |||
77 | |||
78 | /* | ||
79 | * The ethernet-encap-specific components. We have a real ethernet header | ||
80 | * and some data. | ||
81 | */ | ||
82 | struct arc_eth_encap { | ||
83 | __u8 proto; /* Always ARC_P_ETHER */ | ||
84 | struct ethhdr eth; /* standard ethernet header (yuck!) */ | ||
85 | __u8 payload[0]; /* 493 bytes */ | ||
86 | }; | ||
87 | #define ETH_ENCAP_HDR_SIZE 14 | ||
88 | |||
89 | |||
90 | struct arc_cap { | ||
91 | __u8 proto; | ||
92 | __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */ | ||
93 | union { | ||
94 | __u8 ack; | ||
95 | __u8 raw[0]; /* 507 bytes */ | ||
96 | } mes; | ||
97 | }; | ||
98 | |||
99 | /* | ||
100 | * The data needed by the actual arcnet hardware. | ||
101 | * | ||
102 | * Now, in the real arcnet hardware, the third and fourth bytes are the | ||
103 | * 'offset' specification instead of the length, and the soft data is at | ||
104 | * the _end_ of the 512-byte buffer. We hide this complexity inside the | ||
105 | * driver. | ||
106 | */ | ||
107 | struct arc_hardware { | ||
108 | __u8 source, /* source ARCnet - filled in automagically */ | ||
109 | dest, /* destination ARCnet - 0 for broadcast */ | ||
110 | offset[2]; /* offset bytes (some weird semantics) */ | ||
111 | }; | ||
112 | #define ARC_HDR_SIZE 4 | ||
113 | |||
114 | /* | ||
115 | * This is an ARCnet frame header, as seen by the kernel (and userspace, | ||
116 | * when you do a raw packet capture). | ||
117 | */ | ||
118 | struct archdr { | ||
119 | /* hardware requirements */ | ||
120 | struct arc_hardware hard; | ||
121 | |||
122 | /* arcnet encapsulation-specific bits */ | ||
123 | union { | ||
124 | struct arc_rfc1201 rfc1201; | ||
125 | struct arc_rfc1051 rfc1051; | ||
126 | struct arc_eth_encap eth_encap; | ||
127 | struct arc_cap cap; | ||
128 | __u8 raw[0]; /* 508 bytes */ | ||
129 | } soft; | ||
130 | }; | ||
131 | |||
132 | #endif /* _LINUX_IF_ARCNET_H */ | ||
diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h new file mode 100644 index 00000000000..a17edda8a78 --- /dev/null +++ b/include/linux/if_bonding.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. | ||
3 | * | ||
4 | * | ||
5 | * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes | ||
6 | * NCM: Network and Communications Management, Inc. | ||
7 | * | ||
8 | * BUT, I'm the one who modified it for ethernet, so: | ||
9 | * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov | ||
10 | * | ||
11 | * This software may be used and distributed according to the terms | ||
12 | * of the GNU Public License, incorporated herein by reference. | ||
13 | * | ||
14 | * 2003/03/18 - Amir Noam <amir.noam at intel dot com> | ||
15 | * - Added support for getting slave's speed and duplex via ethtool. | ||
16 | * Needed for 802.3ad and other future modes. | ||
17 | * | ||
18 | * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and | ||
19 | * Shmulik Hen <shmulik.hen at intel dot com> | ||
20 | * - Enable support of modes that need to use the unique mac address of | ||
21 | * each slave. | ||
22 | * | ||
23 | * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and | ||
24 | * Amir Noam <amir.noam at intel dot com> | ||
25 | * - Moved driver's private data types to bonding.h | ||
26 | * | ||
27 | * 2003/03/18 - Amir Noam <amir.noam at intel dot com>, | ||
28 | * Tsippy Mendelson <tsippy.mendelson at intel dot com> and | ||
29 | * Shmulik Hen <shmulik.hen at intel dot com> | ||
30 | * - Added support for IEEE 802.3ad Dynamic link aggregation mode. | ||
31 | * | ||
32 | * 2003/05/01 - Amir Noam <amir.noam at intel dot com> | ||
33 | * - Added ABI version control to restore compatibility between | ||
34 | * new/old ifenslave and new/old bonding. | ||
35 | * | ||
36 | * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> | ||
37 | * - Code cleanup and style changes | ||
38 | * | ||
39 | * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov> | ||
40 | * - added definitions for various XOR hashing policies | ||
41 | */ | ||
42 | |||
43 | #ifndef _LINUX_IF_BONDING_H | ||
44 | #define _LINUX_IF_BONDING_H | ||
45 | |||
46 | #include <linux/if.h> | ||
47 | #include <linux/types.h> | ||
48 | #include <linux/if_ether.h> | ||
49 | |||
50 | /* userland - kernel ABI version (2003/05/08) */ | ||
51 | #define BOND_ABI_VERSION 2 | ||
52 | |||
53 | /* | ||
54 | * We can remove these ioctl definitions in 2.5. People should use the | ||
55 | * SIOC*** versions of them instead | ||
56 | */ | ||
57 | #define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) | ||
58 | #define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) | ||
59 | #define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) | ||
60 | #define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) | ||
61 | #define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) | ||
62 | #define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) | ||
63 | |||
64 | #define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) | ||
65 | |||
66 | #define BOND_MODE_ROUNDROBIN 0 | ||
67 | #define BOND_MODE_ACTIVEBACKUP 1 | ||
68 | #define BOND_MODE_XOR 2 | ||
69 | #define BOND_MODE_BROADCAST 3 | ||
70 | #define BOND_MODE_8023AD 4 | ||
71 | #define BOND_MODE_TLB 5 | ||
72 | #define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ | ||
73 | |||
74 | /* each slave's link has 4 states */ | ||
75 | #define BOND_LINK_UP 0 /* link is up and running */ | ||
76 | #define BOND_LINK_FAIL 1 /* link has just gone down */ | ||
77 | #define BOND_LINK_DOWN 2 /* link has been down for too long time */ | ||
78 | #define BOND_LINK_BACK 3 /* link is going back */ | ||
79 | |||
80 | /* each slave has several states */ | ||
81 | #define BOND_STATE_ACTIVE 0 /* link is active */ | ||
82 | #define BOND_STATE_BACKUP 1 /* link is backup */ | ||
83 | |||
84 | #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ | ||
85 | |||
86 | #define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ | ||
87 | |||
88 | #define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ | ||
89 | |||
90 | /* hashing types */ | ||
91 | #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ | ||
92 | #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ | ||
93 | #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ | ||
94 | |||
95 | typedef struct ifbond { | ||
96 | __s32 bond_mode; | ||
97 | __s32 num_slaves; | ||
98 | __s32 miimon; | ||
99 | } ifbond; | ||
100 | |||
101 | typedef struct ifslave { | ||
102 | __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ | ||
103 | char slave_name[IFNAMSIZ]; | ||
104 | __s8 link; | ||
105 | __s8 state; | ||
106 | __u32 link_failure_count; | ||
107 | } ifslave; | ||
108 | |||
109 | struct ad_info { | ||
110 | __u16 aggregator_id; | ||
111 | __u16 ports; | ||
112 | __u16 actor_key; | ||
113 | __u16 partner_key; | ||
114 | __u8 partner_system[ETH_ALEN]; | ||
115 | }; | ||
116 | |||
117 | #endif /* _LINUX_IF_BONDING_H */ | ||
118 | |||
119 | /* | ||
120 | * Local variables: | ||
121 | * version-control: t | ||
122 | * kept-new-versions: 5 | ||
123 | * c-indent-level: 8 | ||
124 | * c-basic-offset: 8 | ||
125 | * tab-width: 8 | ||
126 | * End: | ||
127 | */ | ||
128 | |||
diff --git a/include/linux/if_cablemodem.h b/include/linux/if_cablemodem.h new file mode 100644 index 00000000000..9ca1007edd9 --- /dev/null +++ b/include/linux/if_cablemodem.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _LINUX_CABLEMODEM_H_ | ||
2 | #define _LINUX_CABLEMODEM_H_ | ||
3 | /* | ||
4 | * Author: Franco Venturi <fventuri@mediaone.net> | ||
5 | * Copyright 1998 Franco Venturi | ||
6 | * | ||
7 | * This program is free software; you can redistribute it | ||
8 | * and/or modify it under the terms of the GNU General | ||
9 | * Public License as published by the Free Software | ||
10 | * Foundation; either version 2 of the License, or (at | ||
11 | * your option) any later version. | ||
12 | */ | ||
13 | |||
14 | /* some useful defines for sb1000.c e cmconfig.c - fv */ | ||
15 | #define SIOCGCMSTATS SIOCDEVPRIVATE+0 /* get cable modem stats */ | ||
16 | #define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1 /* get cm firmware version */ | ||
17 | #define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2 /* get cable modem frequency */ | ||
18 | #define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3 /* set cable modem frequency */ | ||
19 | #define SIOCGCMPIDS SIOCDEVPRIVATE+4 /* get cable modem PIDs */ | ||
20 | #define SIOCSCMPIDS SIOCDEVPRIVATE+5 /* set cable modem PIDs */ | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h new file mode 100644 index 00000000000..d85f9f48129 --- /dev/null +++ b/include/linux/if_ec.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* Definitions for Econet sockets. */ | ||
2 | |||
3 | #ifndef __LINUX_IF_EC | ||
4 | #define __LINUX_IF_EC | ||
5 | |||
6 | /* User visible stuff. Glibc provides its own but libc5 folk will use these */ | ||
7 | |||
8 | struct ec_addr { | ||
9 | unsigned char station; /* Station number. */ | ||
10 | unsigned char net; /* Network number. */ | ||
11 | }; | ||
12 | |||
13 | struct sockaddr_ec { | ||
14 | unsigned short sec_family; | ||
15 | unsigned char port; /* Port number. */ | ||
16 | unsigned char cb; /* Control/flag byte. */ | ||
17 | unsigned char type; /* Type of message. */ | ||
18 | struct ec_addr addr; | ||
19 | unsigned long cookie; | ||
20 | }; | ||
21 | |||
22 | #define ECTYPE_PACKET_RECEIVED 0 /* Packet received */ | ||
23 | #define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed, | ||
24 | low nibble holds status */ | ||
25 | |||
26 | #define ECTYPE_TRANSMIT_OK 1 | ||
27 | #define ECTYPE_TRANSMIT_NOT_LISTENING 2 | ||
28 | #define ECTYPE_TRANSMIT_NET_ERROR 3 | ||
29 | #define ECTYPE_TRANSMIT_NO_CLOCK 4 | ||
30 | #define ECTYPE_TRANSMIT_LINE_JAMMED 5 | ||
31 | #define ECTYPE_TRANSMIT_NOT_PRESENT 6 | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | #define EC_HLEN 6 | ||
36 | |||
37 | /* This is what an Econet frame looks like on the wire. */ | ||
38 | struct ec_framehdr { | ||
39 | unsigned char dst_stn; | ||
40 | unsigned char dst_net; | ||
41 | unsigned char src_stn; | ||
42 | unsigned char src_net; | ||
43 | unsigned char cb; | ||
44 | unsigned char port; | ||
45 | }; | ||
46 | |||
47 | struct econet_sock { | ||
48 | /* struct sock has to be the first member of econet_sock */ | ||
49 | struct sock sk; | ||
50 | unsigned char cb; | ||
51 | unsigned char port; | ||
52 | unsigned char station; | ||
53 | unsigned char net; | ||
54 | unsigned short num; | ||
55 | }; | ||
56 | |||
57 | static inline struct econet_sock *ec_sk(const struct sock *sk) | ||
58 | { | ||
59 | return (struct econet_sock *)sk; | ||
60 | } | ||
61 | |||
62 | struct ec_device { | ||
63 | unsigned char station, net; /* Econet protocol address */ | ||
64 | }; | ||
65 | |||
66 | #endif | ||
67 | |||
68 | #endif | ||
diff --git a/include/linux/if_fc.h b/include/linux/if_fc.h new file mode 100644 index 00000000000..6ed7f1bf35c --- /dev/null +++ b/include/linux/if_fc.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Global definitions for Fibre Channel. | ||
7 | * | ||
8 | * Version: @(#)if_fc.h 0.0 11/20/98 | ||
9 | * | ||
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
11 | * Donald Becker, <becker@super.org> | ||
12 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> | ||
13 | * Vineet Abraham, <vma@iol.unh.edu> | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version | ||
18 | * 2 of the License, or (at your option) any later version. | ||
19 | */ | ||
20 | #ifndef _LINUX_IF_FC_H | ||
21 | #define _LINUX_IF_FC_H | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | #define FC_ALEN 6 /* Octets in one ethernet addr */ | ||
26 | #define FC_HLEN (sizeof(struct fch_hdr)+sizeof(struct fcllc)) | ||
27 | #define FC_ID_LEN 3 /* Octets in a Fibre Channel Address */ | ||
28 | |||
29 | /* LLC and SNAP constants */ | ||
30 | #define EXTENDED_SAP 0xAA | ||
31 | #define UI_CMD 0x03 | ||
32 | |||
33 | /* This is NOT the Fibre Channel frame header. The FC frame header is | ||
34 | * constructed in the driver as the Tachyon needs certain fields in | ||
35 | * certains positions. So, it can't be generalized here.*/ | ||
36 | |||
37 | struct fch_hdr { | ||
38 | __u8 daddr[FC_ALEN]; /* destination address */ | ||
39 | __u8 saddr[FC_ALEN]; /* source address */ | ||
40 | }; | ||
41 | |||
42 | /* This is a Fibre Channel LLC structure */ | ||
43 | struct fcllc { | ||
44 | __u8 dsap; /* destination SAP */ | ||
45 | __u8 ssap; /* source SAP */ | ||
46 | __u8 llc; /* LLC control field */ | ||
47 | __u8 protid[3]; /* protocol id */ | ||
48 | __be16 ethertype; /* ether type field */ | ||
49 | }; | ||
50 | |||
51 | #endif /* _LINUX_IF_FC_H */ | ||
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h new file mode 100644 index 00000000000..cdc049f1829 --- /dev/null +++ b/include/linux/if_hippi.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Global definitions for the HIPPI interface. | ||
7 | * | ||
8 | * Version: @(#)if_hippi.h 1.0.0 05/26/97 | ||
9 | * | ||
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
11 | * Donald Becker, <becker@super.org> | ||
12 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> | ||
13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | ||
14 | * Jes Sorensen, <Jes.Sorensen@cern.ch> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or | ||
17 | * modify it under the terms of the GNU General Public License | ||
18 | * as published by the Free Software Foundation; either version | ||
19 | * 2 of the License, or (at your option) any later version. | ||
20 | */ | ||
21 | |||
22 | #ifndef _LINUX_IF_HIPPI_H | ||
23 | #define _LINUX_IF_HIPPI_H | ||
24 | |||
25 | #include <linux/types.h> | ||
26 | #include <asm/byteorder.h> | ||
27 | |||
28 | /* | ||
29 | * HIPPI magic constants. | ||
30 | */ | ||
31 | |||
32 | #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ | ||
33 | #define HIPPI_HLEN sizeof(struct hippi_hdr) | ||
34 | #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ | ||
35 | #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ | ||
36 | #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) | ||
37 | /* Max. bytes in frame without FCS */ | ||
38 | |||
39 | /* | ||
40 | * Define LLC and SNAP constants. | ||
41 | */ | ||
42 | #define HIPPI_EXTENDED_SAP 0xAA | ||
43 | #define HIPPI_UI_CMD 0x03 | ||
44 | |||
45 | |||
46 | /* | ||
47 | * Do we need to list some sort of ID's here? | ||
48 | */ | ||
49 | |||
50 | /* | ||
51 | * HIPPI statistics collection data. | ||
52 | */ | ||
53 | |||
54 | struct hipnet_statistics { | ||
55 | int rx_packets; /* total packets received */ | ||
56 | int tx_packets; /* total packets transmitted */ | ||
57 | int rx_errors; /* bad packets received */ | ||
58 | int tx_errors; /* packet transmit problems */ | ||
59 | int rx_dropped; /* no space in linux buffers */ | ||
60 | int tx_dropped; /* no space available in linux */ | ||
61 | |||
62 | /* detailed rx_errors: */ | ||
63 | int rx_length_errors; | ||
64 | int rx_over_errors; /* receiver ring buff overflow */ | ||
65 | int rx_crc_errors; /* recved pkt with crc error */ | ||
66 | int rx_frame_errors; /* recv'd frame alignment error */ | ||
67 | int rx_fifo_errors; /* recv'r fifo overrun */ | ||
68 | int rx_missed_errors; /* receiver missed packet */ | ||
69 | |||
70 | /* detailed tx_errors */ | ||
71 | int tx_aborted_errors; | ||
72 | int tx_carrier_errors; | ||
73 | int tx_fifo_errors; | ||
74 | int tx_heartbeat_errors; | ||
75 | int tx_window_errors; | ||
76 | }; | ||
77 | |||
78 | |||
79 | struct hippi_fp_hdr { | ||
80 | #if 0 | ||
81 | __u8 ulp; /* must contain 4 */ | ||
82 | #if defined (__BIG_ENDIAN_BITFIELD) | ||
83 | __u8 d1_data_present:1; /* must be 1 */ | ||
84 | __u8 start_d2_burst_boundary:1; /* must be zero */ | ||
85 | __u8 reserved:6; /* must be zero */ | ||
86 | #if 0 | ||
87 | __u16 reserved1:5; | ||
88 | __u16 d1_area_size:8; /* must be 3 */ | ||
89 | __u16 d2_offset:3; /* must be zero */ | ||
90 | #endif | ||
91 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | ||
92 | __u8 reserved:6; /* must be zero */ | ||
93 | __u8 start_d2_burst_boundary:1; /* must be zero */ | ||
94 | __u8 d1_data_present:1; /* must be 1 */ | ||
95 | #if 0 | ||
96 | __u16 d2_offset:3; /* must be zero */ | ||
97 | __u16 d1_area_size:8; /* must be 3 */ | ||
98 | __u16 reserved1:5; /* must be zero */ | ||
99 | #endif | ||
100 | #else | ||
101 | #error "Please fix <asm/byteorder.h>" | ||
102 | #endif | ||
103 | #else | ||
104 | __be32 fixed; | ||
105 | #endif | ||
106 | __be32 d2_size; | ||
107 | } __attribute__((packed)); | ||
108 | |||
109 | struct hippi_le_hdr { | ||
110 | #if defined (__BIG_ENDIAN_BITFIELD) | ||
111 | __u8 fc:3; | ||
112 | __u8 double_wide:1; | ||
113 | __u8 message_type:4; | ||
114 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | ||
115 | __u8 message_type:4; | ||
116 | __u8 double_wide:1; | ||
117 | __u8 fc:3; | ||
118 | #endif | ||
119 | __u8 dest_switch_addr[3]; | ||
120 | #if defined (__BIG_ENDIAN_BITFIELD) | ||
121 | __u8 dest_addr_type:4, | ||
122 | src_addr_type:4; | ||
123 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | ||
124 | __u8 src_addr_type:4, | ||
125 | dest_addr_type:4; | ||
126 | #endif | ||
127 | __u8 src_switch_addr[3]; | ||
128 | __u16 reserved; | ||
129 | __u8 daddr[HIPPI_ALEN]; | ||
130 | __u16 locally_administered; | ||
131 | __u8 saddr[HIPPI_ALEN]; | ||
132 | } __attribute__((packed)); | ||
133 | |||
134 | #define HIPPI_OUI_LEN 3 | ||
135 | /* | ||
136 | * Looks like the dsap and ssap fields have been swapped by mistake in | ||
137 | * RFC 2067 "IP over HIPPI". | ||
138 | */ | ||
139 | struct hippi_snap_hdr { | ||
140 | __u8 dsap; /* always 0xAA */ | ||
141 | __u8 ssap; /* always 0xAA */ | ||
142 | __u8 ctrl; /* always 0x03 */ | ||
143 | __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ | ||
144 | __be16 ethertype; /* packet type ID field */ | ||
145 | } __attribute__((packed)); | ||
146 | |||
147 | struct hippi_hdr { | ||
148 | struct hippi_fp_hdr fp; | ||
149 | struct hippi_le_hdr le; | ||
150 | struct hippi_snap_hdr snap; | ||
151 | } __attribute__((packed)); | ||
152 | |||
153 | #endif /* _LINUX_IF_HIPPI_H */ | ||
diff --git a/include/linux/if_infiniband.h b/include/linux/if_infiniband.h new file mode 100644 index 00000000000..7d958475d4a --- /dev/null +++ b/include/linux/if_infiniband.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * This software is available to you under a choice of one of two | ||
3 | * licenses. You may choose to be licensed under the terms of the GNU | ||
4 | * General Public License (GPL) Version 2, available at | ||
5 | * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD | ||
6 | * license, available in the LICENSE.TXT file accompanying this | ||
7 | * software. These details are also available at | ||
8 | * <http://www.openfabrics.org/software_license.htm>. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
11 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
12 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
13 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
14 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
16 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
17 | * SOFTWARE. | ||
18 | * | ||
19 | * Copyright (c) 2004 Topspin Communications. All rights reserved. | ||
20 | * | ||
21 | * $Id$ | ||
22 | */ | ||
23 | |||
24 | #ifndef _LINUX_IF_INFINIBAND_H | ||
25 | #define _LINUX_IF_INFINIBAND_H | ||
26 | |||
27 | #define INFINIBAND_ALEN 20 /* Octets in IPoIB HW addr */ | ||
28 | |||
29 | #endif /* _LINUX_IF_INFINIBAND_H */ | ||
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h new file mode 100644 index 00000000000..c1486060f5e --- /dev/null +++ b/include/linux/if_packet.h | |||
@@ -0,0 +1,153 @@ | |||
1 | #ifndef __LINUX_IF_PACKET_H | ||
2 | #define __LINUX_IF_PACKET_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct sockaddr_pkt { | ||
7 | unsigned short spkt_family; | ||
8 | unsigned char spkt_device[14]; | ||
9 | __be16 spkt_protocol; | ||
10 | }; | ||
11 | |||
12 | struct sockaddr_ll { | ||
13 | unsigned short sll_family; | ||
14 | __be16 sll_protocol; | ||
15 | int sll_ifindex; | ||
16 | unsigned short sll_hatype; | ||
17 | unsigned char sll_pkttype; | ||
18 | unsigned char sll_halen; | ||
19 | unsigned char sll_addr[8]; | ||
20 | }; | ||
21 | |||
22 | /* Packet types */ | ||
23 | |||
24 | #define PACKET_HOST 0 /* To us */ | ||
25 | #define PACKET_BROADCAST 1 /* To all */ | ||
26 | #define PACKET_MULTICAST 2 /* To group */ | ||
27 | #define PACKET_OTHERHOST 3 /* To someone else */ | ||
28 | #define PACKET_OUTGOING 4 /* Outgoing of any type */ | ||
29 | /* These ones are invisible by user level */ | ||
30 | #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ | ||
31 | #define PACKET_FASTROUTE 6 /* Fastrouted frame */ | ||
32 | |||
33 | /* Packet socket options */ | ||
34 | |||
35 | #define PACKET_ADD_MEMBERSHIP 1 | ||
36 | #define PACKET_DROP_MEMBERSHIP 2 | ||
37 | #define PACKET_RECV_OUTPUT 3 | ||
38 | /* Value 4 is still used by obsolete turbo-packet. */ | ||
39 | #define PACKET_RX_RING 5 | ||
40 | #define PACKET_STATISTICS 6 | ||
41 | #define PACKET_COPY_THRESH 7 | ||
42 | #define PACKET_AUXDATA 8 | ||
43 | #define PACKET_ORIGDEV 9 | ||
44 | #define PACKET_VERSION 10 | ||
45 | #define PACKET_HDRLEN 11 | ||
46 | #define PACKET_RESERVE 12 | ||
47 | #define PACKET_TX_RING 13 | ||
48 | #define PACKET_LOSS 14 | ||
49 | #define PACKET_VNET_HDR 15 | ||
50 | #define PACKET_TX_TIMESTAMP 16 | ||
51 | #define PACKET_TIMESTAMP 17 | ||
52 | #define PACKET_FANOUT 18 | ||
53 | |||
54 | #define PACKET_FANOUT_HASH 0 | ||
55 | #define PACKET_FANOUT_LB 1 | ||
56 | #define PACKET_FANOUT_CPU 2 | ||
57 | #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 | ||
58 | |||
59 | struct tpacket_stats { | ||
60 | unsigned int tp_packets; | ||
61 | unsigned int tp_drops; | ||
62 | }; | ||
63 | |||
64 | struct tpacket_auxdata { | ||
65 | __u32 tp_status; | ||
66 | __u32 tp_len; | ||
67 | __u32 tp_snaplen; | ||
68 | __u16 tp_mac; | ||
69 | __u16 tp_net; | ||
70 | __u16 tp_vlan_tci; | ||
71 | __u16 tp_padding; | ||
72 | }; | ||
73 | |||
74 | /* Rx ring - header status */ | ||
75 | #define TP_STATUS_KERNEL 0x0 | ||
76 | #define TP_STATUS_USER 0x1 | ||
77 | #define TP_STATUS_COPY 0x2 | ||
78 | #define TP_STATUS_LOSING 0x4 | ||
79 | #define TP_STATUS_CSUMNOTREADY 0x8 | ||
80 | #define TP_STATUS_VLAN_VALID 0x10 /* auxdata has valid tp_vlan_tci */ | ||
81 | |||
82 | /* Tx ring - header status */ | ||
83 | #define TP_STATUS_AVAILABLE 0x0 | ||
84 | #define TP_STATUS_SEND_REQUEST 0x1 | ||
85 | #define TP_STATUS_SENDING 0x2 | ||
86 | #define TP_STATUS_WRONG_FORMAT 0x4 | ||
87 | |||
88 | struct tpacket_hdr { | ||
89 | unsigned long tp_status; | ||
90 | unsigned int tp_len; | ||
91 | unsigned int tp_snaplen; | ||
92 | unsigned short tp_mac; | ||
93 | unsigned short tp_net; | ||
94 | unsigned int tp_sec; | ||
95 | unsigned int tp_usec; | ||
96 | }; | ||
97 | |||
98 | #define TPACKET_ALIGNMENT 16 | ||
99 | #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) | ||
100 | #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) | ||
101 | |||
102 | struct tpacket2_hdr { | ||
103 | __u32 tp_status; | ||
104 | __u32 tp_len; | ||
105 | __u32 tp_snaplen; | ||
106 | __u16 tp_mac; | ||
107 | __u16 tp_net; | ||
108 | __u32 tp_sec; | ||
109 | __u32 tp_nsec; | ||
110 | __u16 tp_vlan_tci; | ||
111 | __u16 tp_padding; | ||
112 | }; | ||
113 | |||
114 | #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) | ||
115 | |||
116 | enum tpacket_versions { | ||
117 | TPACKET_V1, | ||
118 | TPACKET_V2, | ||
119 | }; | ||
120 | |||
121 | /* | ||
122 | Frame structure: | ||
123 | |||
124 | - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 | ||
125 | - struct tpacket_hdr | ||
126 | - pad to TPACKET_ALIGNMENT=16 | ||
127 | - struct sockaddr_ll | ||
128 | - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 | ||
129 | - Start+tp_mac: [ Optional MAC header ] | ||
130 | - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. | ||
131 | - Pad to align to TPACKET_ALIGNMENT=16 | ||
132 | */ | ||
133 | |||
134 | struct tpacket_req { | ||
135 | unsigned int tp_block_size; /* Minimal size of contiguous block */ | ||
136 | unsigned int tp_block_nr; /* Number of blocks */ | ||
137 | unsigned int tp_frame_size; /* Size of frame */ | ||
138 | unsigned int tp_frame_nr; /* Total number of frames */ | ||
139 | }; | ||
140 | |||
141 | struct packet_mreq { | ||
142 | int mr_ifindex; | ||
143 | unsigned short mr_type; | ||
144 | unsigned short mr_alen; | ||
145 | unsigned char mr_address[8]; | ||
146 | }; | ||
147 | |||
148 | #define PACKET_MR_MULTICAST 0 | ||
149 | #define PACKET_MR_PROMISC 1 | ||
150 | #define PACKET_MR_ALLMULTI 2 | ||
151 | #define PACKET_MR_UNICAST 3 | ||
152 | |||
153 | #endif | ||
diff --git a/include/linux/if_plip.h b/include/linux/if_plip.h new file mode 100644 index 00000000000..6298c7e88b2 --- /dev/null +++ b/include/linux/if_plip.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * NET3 PLIP tuning facilities for the new Niibe PLIP. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #ifndef _LINUX_IF_PLIP_H | ||
12 | #define _LINUX_IF_PLIP_H | ||
13 | |||
14 | #include <linux/sockios.h> | ||
15 | |||
16 | #define SIOCDEVPLIP SIOCDEVPRIVATE | ||
17 | |||
18 | struct plipconf { | ||
19 | unsigned short pcmd; | ||
20 | unsigned long nibble; | ||
21 | unsigned long trigger; | ||
22 | }; | ||
23 | |||
24 | #define PLIP_GET_TIMEOUT 0x1 | ||
25 | #define PLIP_SET_TIMEOUT 0x2 | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h new file mode 100644 index 00000000000..c9ad3832257 --- /dev/null +++ b/include/linux/if_ppp.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * if_ppp.h - Point-to-Point Protocol definitions. | ||
3 | * | ||
4 | * Copyright (c) 1989 Carnegie Mellon University. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms are permitted | ||
8 | * provided that the above copyright notice and this paragraph are | ||
9 | * duplicated in all such forms and that any documentation, | ||
10 | * advertising materials, and other materials related to such | ||
11 | * distribution and use acknowledge that the software was developed | ||
12 | * by Carnegie Mellon University. The name of the | ||
13 | * University may not be used to endorse or promote products derived | ||
14 | * from this software without specific prior written permission. | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | ||
16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * ==FILEVERSION 20050812== | ||
23 | * | ||
24 | * NOTE TO MAINTAINERS: | ||
25 | * If you modify this file at all, please set the above date. | ||
26 | * if_ppp.h is shipped with a PPP distribution as well as with the kernel; | ||
27 | * if everyone increases the FILEVERSION number above, then scripts | ||
28 | * can do the right thing when deciding whether to install a new if_ppp.h | ||
29 | * file. Don't change the format of that line otherwise, so the | ||
30 | * installation script can recognize it. | ||
31 | */ | ||
32 | |||
33 | #ifndef _IF_PPP_H_ | ||
34 | #define _IF_PPP_H_ | ||
35 | |||
36 | #include <linux/types.h> | ||
37 | #include <linux/compiler.h> | ||
38 | |||
39 | /* | ||
40 | * Packet sizes | ||
41 | */ | ||
42 | |||
43 | #define PPP_MTU 1500 /* Default MTU (size of Info field) */ | ||
44 | #define PPP_MAXMRU 65000 /* Largest MRU we allow */ | ||
45 | #define PROTO_IPX 0x002b /* protocol numbers */ | ||
46 | #define PROTO_DNA_RT 0x0027 /* DNA Routing */ | ||
47 | |||
48 | |||
49 | /* | ||
50 | * Bit definitions for flags. | ||
51 | */ | ||
52 | |||
53 | #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ | ||
54 | #define SC_COMP_AC 0x00000002 /* header compression (output) */ | ||
55 | #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ | ||
56 | #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ | ||
57 | #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ | ||
58 | #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ | ||
59 | #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ | ||
60 | #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ | ||
61 | #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ | ||
62 | #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ | ||
63 | #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ | ||
64 | #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ | ||
65 | #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ | ||
66 | #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ | ||
67 | #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ | ||
68 | #define SC_DEBUG 0x00010000 /* enable debug messages */ | ||
69 | #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ | ||
70 | #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ | ||
71 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ | ||
72 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ | ||
73 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ | ||
74 | #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ | ||
75 | #define SC_MASK 0x0f600fff /* bits that user can change */ | ||
76 | |||
77 | /* state bits */ | ||
78 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ | ||
79 | #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ | ||
80 | #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ | ||
81 | #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ | ||
82 | #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ | ||
83 | #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ | ||
84 | #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ | ||
85 | |||
86 | /* | ||
87 | * Ioctl definitions. | ||
88 | */ | ||
89 | |||
90 | struct npioctl { | ||
91 | int protocol; /* PPP protocol, e.g. PPP_IP */ | ||
92 | enum NPmode mode; | ||
93 | }; | ||
94 | |||
95 | /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ | ||
96 | struct ppp_option_data { | ||
97 | __u8 __user *ptr; | ||
98 | __u32 length; | ||
99 | int transmit; | ||
100 | }; | ||
101 | |||
102 | struct ifpppstatsreq { | ||
103 | struct ifreq b; | ||
104 | struct ppp_stats stats; /* statistic information */ | ||
105 | }; | ||
106 | |||
107 | struct ifpppcstatsreq { | ||
108 | struct ifreq b; | ||
109 | struct ppp_comp_stats stats; | ||
110 | }; | ||
111 | |||
112 | /* For PPPIOCGL2TPSTATS */ | ||
113 | struct pppol2tp_ioc_stats { | ||
114 | __u16 tunnel_id; /* redundant */ | ||
115 | __u16 session_id; /* if zero, get tunnel stats */ | ||
116 | __u32 using_ipsec:1; /* valid only for session_id == 0 */ | ||
117 | __aligned_u64 tx_packets; | ||
118 | __aligned_u64 tx_bytes; | ||
119 | __aligned_u64 tx_errors; | ||
120 | __aligned_u64 rx_packets; | ||
121 | __aligned_u64 rx_bytes; | ||
122 | __aligned_u64 rx_seq_discards; | ||
123 | __aligned_u64 rx_oos_packets; | ||
124 | __aligned_u64 rx_errors; | ||
125 | }; | ||
126 | |||
127 | #define ifr__name b.ifr_ifrn.ifrn_name | ||
128 | #define stats_ptr b.ifr_ifru.ifru_data | ||
129 | |||
130 | /* | ||
131 | * Ioctl definitions. | ||
132 | */ | ||
133 | |||
134 | #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ | ||
135 | #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ | ||
136 | #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ | ||
137 | #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ | ||
138 | #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ | ||
139 | #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ | ||
140 | #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ | ||
141 | #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ | ||
142 | #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ | ||
143 | #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ | ||
144 | #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ | ||
145 | #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ | ||
146 | #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ | ||
147 | #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) | ||
148 | #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ | ||
149 | #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ | ||
150 | #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ | ||
151 | #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ | ||
152 | #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ | ||
153 | #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ | ||
154 | #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ | ||
155 | #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ | ||
156 | #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ | ||
157 | #define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ | ||
158 | #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ | ||
159 | #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ | ||
160 | #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ | ||
161 | #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ | ||
162 | #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ | ||
163 | #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) | ||
164 | |||
165 | #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) | ||
166 | #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ | ||
167 | #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) | ||
168 | |||
169 | #if !defined(ifr_mtu) | ||
170 | #define ifr_mtu ifr_ifru.ifru_metric | ||
171 | #endif | ||
172 | |||
173 | #endif /* _IF_PPP_H_ */ | ||
diff --git a/include/linux/if_pppolac.h b/include/linux/if_pppolac.h new file mode 100644 index 00000000000..c06bd6c8ba2 --- /dev/null +++ b/include/linux/if_pppolac.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* include/linux/if_pppolac.h | ||
2 | * | ||
3 | * Header for PPP on L2TP Access Concentrator / PPPoLAC Socket (RFC 2661) | ||
4 | * | ||
5 | * Copyright (C) 2009 Google, Inc. | ||
6 | * Author: Chia-chi Yeh <chiachi@android.com> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_IF_PPPOLAC_H | ||
19 | #define __LINUX_IF_PPPOLAC_H | ||
20 | |||
21 | #include <linux/socket.h> | ||
22 | #include <linux/types.h> | ||
23 | |||
24 | struct sockaddr_pppolac { | ||
25 | sa_family_t sa_family; /* AF_PPPOX */ | ||
26 | unsigned int sa_protocol; /* PX_PROTO_OLAC */ | ||
27 | int udp_socket; | ||
28 | struct __attribute__((packed)) { | ||
29 | __u16 tunnel, session; | ||
30 | } local, remote; | ||
31 | } __attribute__((packed)); | ||
32 | |||
33 | #endif /* __LINUX_IF_PPPOLAC_H */ | ||
diff --git a/include/linux/if_pppopns.h b/include/linux/if_pppopns.h new file mode 100644 index 00000000000..0cf34b4d551 --- /dev/null +++ b/include/linux/if_pppopns.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* include/linux/if_pppopns.h | ||
2 | * | ||
3 | * Header for PPP on PPTP Network Server / PPPoPNS Socket (RFC 2637) | ||
4 | * | ||
5 | * Copyright (C) 2009 Google, Inc. | ||
6 | * Author: Chia-chi Yeh <chiachi@android.com> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_IF_PPPOPNS_H | ||
19 | #define __LINUX_IF_PPPOPNS_H | ||
20 | |||
21 | #include <linux/socket.h> | ||
22 | #include <linux/types.h> | ||
23 | |||
24 | struct sockaddr_pppopns { | ||
25 | sa_family_t sa_family; /* AF_PPPOX */ | ||
26 | unsigned int sa_protocol; /* PX_PROTO_OPNS */ | ||
27 | int tcp_socket; | ||
28 | __u16 local; | ||
29 | __u16 remote; | ||
30 | } __attribute__((packed)); | ||
31 | |||
32 | #endif /* __LINUX_IF_PPPOPNS_H */ | ||
diff --git a/include/linux/if_slip.h b/include/linux/if_slip.h new file mode 100644 index 00000000000..1eb4e3a8397 --- /dev/null +++ b/include/linux/if_slip.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Swansea University Computer Society NET3 | ||
3 | * | ||
4 | * This file declares the constants of special use with the SLIP/CSLIP/ | ||
5 | * KISS TNC driver. | ||
6 | */ | ||
7 | |||
8 | #ifndef __LINUX_SLIP_H | ||
9 | #define __LINUX_SLIP_H | ||
10 | |||
11 | #define SL_MODE_SLIP 0 | ||
12 | #define SL_MODE_CSLIP 1 | ||
13 | #define SL_MODE_KISS 4 | ||
14 | |||
15 | #define SL_OPT_SIXBIT 2 | ||
16 | #define SL_OPT_ADAPTIVE 8 | ||
17 | |||
18 | /* | ||
19 | * VSV = ioctl for keepalive & outfill in SLIP driver | ||
20 | */ | ||
21 | |||
22 | #define SIOCSKEEPALIVE (SIOCDEVPRIVATE) /* Set keepalive timeout in sec */ | ||
23 | #define SIOCGKEEPALIVE (SIOCDEVPRIVATE+1) /* Get keepalive timeout */ | ||
24 | #define SIOCSOUTFILL (SIOCDEVPRIVATE+2) /* Set outfill timeout */ | ||
25 | #define SIOCGOUTFILL (SIOCDEVPRIVATE+3) /* Get outfill timeout */ | ||
26 | #define SIOCSLEASE (SIOCDEVPRIVATE+4) /* Set "leased" line type */ | ||
27 | #define SIOCGLEASE (SIOCDEVPRIVATE+5) /* Get line type */ | ||
28 | |||
29 | |||
30 | #endif | ||
diff --git a/include/linux/if_strip.h b/include/linux/if_strip.h new file mode 100644 index 00000000000..6526a623583 --- /dev/null +++ b/include/linux/if_strip.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * if_strip.h -- | ||
3 | * | ||
4 | * Definitions for the STRIP interface | ||
5 | * | ||
6 | * Copyright 1996 The Board of Trustees of The Leland Stanford | ||
7 | * Junior University. All Rights Reserved. | ||
8 | * | ||
9 | * Permission to use, copy, modify, and distribute this | ||
10 | * software and its documentation for any purpose and without | ||
11 | * fee is hereby granted, provided that the above copyright | ||
12 | * notice appear in all copies. Stanford University | ||
13 | * makes no representations about the suitability of this | ||
14 | * software for any purpose. It is provided "as is" without | ||
15 | * express or implied warranty. | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_STRIP_H | ||
19 | #define __LINUX_STRIP_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | typedef struct { | ||
24 | __u8 c[6]; | ||
25 | } MetricomAddress; | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h new file mode 100644 index 00000000000..fc23aeb0f20 --- /dev/null +++ b/include/linux/if_tr.h | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Global definitions for the Token-Ring IEEE 802.5 interface. | ||
7 | * | ||
8 | * Version: @(#)if_tr.h 0.0 07/11/94 | ||
9 | * | ||
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
11 | * Donald Becker, <becker@super.org> | ||
12 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #ifndef _LINUX_IF_TR_H | ||
20 | #define _LINUX_IF_TR_H | ||
21 | |||
22 | #include <linux/types.h> | ||
23 | #include <asm/byteorder.h> /* For __be16 */ | ||
24 | |||
25 | /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble | ||
26 | and FCS/CRC (frame check sequence). */ | ||
27 | #define TR_ALEN 6 /* Octets in one token-ring addr */ | ||
28 | #define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) | ||
29 | #define AC 0x10 | ||
30 | #define LLC_FRAME 0x40 | ||
31 | |||
32 | /* LLC and SNAP constants */ | ||
33 | #define EXTENDED_SAP 0xAA | ||
34 | #define UI_CMD 0x03 | ||
35 | |||
36 | /* This is an Token-Ring frame header. */ | ||
37 | struct trh_hdr { | ||
38 | __u8 ac; /* access control field */ | ||
39 | __u8 fc; /* frame control field */ | ||
40 | __u8 daddr[TR_ALEN]; /* destination address */ | ||
41 | __u8 saddr[TR_ALEN]; /* source address */ | ||
42 | __be16 rcf; /* route control field */ | ||
43 | __be16 rseg[8]; /* routing registers */ | ||
44 | }; | ||
45 | |||
46 | #ifdef __KERNEL__ | ||
47 | #include <linux/skbuff.h> | ||
48 | |||
49 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) | ||
50 | { | ||
51 | return (struct trh_hdr *)skb_mac_header(skb); | ||
52 | } | ||
53 | #endif | ||
54 | |||
55 | /* This is an Token-Ring LLC structure */ | ||
56 | struct trllc { | ||
57 | __u8 dsap; /* destination SAP */ | ||
58 | __u8 ssap; /* source SAP */ | ||
59 | __u8 llc; /* LLC control field */ | ||
60 | __u8 protid[3]; /* protocol id */ | ||
61 | __be16 ethertype; /* ether type field */ | ||
62 | }; | ||
63 | |||
64 | /* Token-Ring statistics collection data. */ | ||
65 | struct tr_statistics { | ||
66 | unsigned long rx_packets; /* total packets received */ | ||
67 | unsigned long tx_packets; /* total packets transmitted */ | ||
68 | unsigned long rx_bytes; /* total bytes received */ | ||
69 | unsigned long tx_bytes; /* total bytes transmitted */ | ||
70 | unsigned long rx_errors; /* bad packets received */ | ||
71 | unsigned long tx_errors; /* packet transmit problems */ | ||
72 | unsigned long rx_dropped; /* no space in linux buffers */ | ||
73 | unsigned long tx_dropped; /* no space available in linux */ | ||
74 | unsigned long multicast; /* multicast packets received */ | ||
75 | unsigned long transmit_collision; | ||
76 | |||
77 | /* detailed Token-Ring errors. See IBM Token-Ring Network | ||
78 | Architecture for more info */ | ||
79 | |||
80 | unsigned long line_errors; | ||
81 | unsigned long internal_errors; | ||
82 | unsigned long burst_errors; | ||
83 | unsigned long A_C_errors; | ||
84 | unsigned long abort_delimiters; | ||
85 | unsigned long lost_frames; | ||
86 | unsigned long recv_congest_count; | ||
87 | unsigned long frame_copied_errors; | ||
88 | unsigned long frequency_errors; | ||
89 | unsigned long token_errors; | ||
90 | unsigned long dummy1; | ||
91 | }; | ||
92 | |||
93 | /* source routing stuff */ | ||
94 | #define TR_RII 0x80 | ||
95 | #define TR_RCF_DIR_BIT 0x80 | ||
96 | #define TR_RCF_LEN_MASK 0x1f00 | ||
97 | #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ | ||
98 | #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ | ||
99 | #define TR_RCF_FRAME2K 0x20 | ||
100 | #define TR_RCF_BROADCAST_MASK 0xC000 | ||
101 | #define TR_MAXRIFLEN 18 | ||
102 | |||
103 | #endif /* _LINUX_IF_TR_H */ | ||
diff --git a/include/linux/if_x25.h b/include/linux/if_x25.h new file mode 100644 index 00000000000..897765f5feb --- /dev/null +++ b/include/linux/if_x25.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Linux X.25 packet to device interface | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef _IF_X25_H | ||
16 | #define _IF_X25_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | /* Documentation/networking/x25-iface.txt */ | ||
21 | #define X25_IFACE_DATA 0x00 | ||
22 | #define X25_IFACE_CONNECT 0x01 | ||
23 | #define X25_IFACE_DISCONNECT 0x02 | ||
24 | #define X25_IFACE_PARAMS 0x03 | ||
25 | |||
26 | #endif /* _IF_X25_H */ | ||
diff --git a/include/linux/in_route.h b/include/linux/in_route.h new file mode 100644 index 00000000000..b261b8c915f --- /dev/null +++ b/include/linux/in_route.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _LINUX_IN_ROUTE_H | ||
2 | #define _LINUX_IN_ROUTE_H | ||
3 | |||
4 | /* IPv4 routing cache flags */ | ||
5 | |||
6 | #define RTCF_DEAD RTNH_F_DEAD | ||
7 | #define RTCF_ONLINK RTNH_F_ONLINK | ||
8 | |||
9 | /* Obsolete flag. About to be deleted */ | ||
10 | #define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC | ||
11 | |||
12 | #define RTCF_NOTIFY 0x00010000 | ||
13 | #define RTCF_DIRECTDST 0x00020000 /* unused */ | ||
14 | #define RTCF_REDIRECTED 0x00040000 | ||
15 | #define RTCF_TPROXY 0x00080000 /* unused */ | ||
16 | |||
17 | #define RTCF_FAST 0x00200000 /* unused */ | ||
18 | #define RTCF_MASQ 0x00400000 /* unused */ | ||
19 | #define RTCF_SNAT 0x00800000 /* unused */ | ||
20 | #define RTCF_DOREDIRECT 0x01000000 | ||
21 | #define RTCF_DIRECTSRC 0x04000000 | ||
22 | #define RTCF_DNAT 0x08000000 | ||
23 | #define RTCF_BROADCAST 0x10000000 | ||
24 | #define RTCF_MULTICAST 0x20000000 | ||
25 | #define RTCF_REJECT 0x40000000 /* unused */ | ||
26 | #define RTCF_LOCAL 0x80000000 | ||
27 | |||
28 | #define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) | ||
29 | |||
30 | #define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) | ||
31 | |||
32 | #endif /* _LINUX_IN_ROUTE_H */ | ||
diff --git a/include/linux/ina219.h b/include/linux/ina219.h new file mode 100644 index 00000000000..c27fa26c575 --- /dev/null +++ b/include/linux/ina219.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ina219.h | ||
3 | * | ||
4 | * Copyright (c) 2011, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _INA219_H | ||
22 | #define _INA219_H | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | |||
26 | struct ina219_platform_data { | ||
27 | u8 divisor; /*divisor needed to get current value */ | ||
28 | u32 calibration_data; | ||
29 | u32 power_lsb; | ||
30 | char rail_name[20]; | ||
31 | }; | ||
32 | |||
33 | #endif /* _LINUX_INA219_H */ | ||
34 | |||
diff --git a/include/linux/interrupt_keys.h b/include/linux/interrupt_keys.h new file mode 100644 index 00000000000..8be6e9a6b0a --- /dev/null +++ b/include/linux/interrupt_keys.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * include/linux/interrupt_keys.h | ||
3 | * | ||
4 | * Key driver for keys directly connected to intrrupt lines. | ||
5 | * | ||
6 | * Copyright (c) 2011, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _INTERRUPT_KEYS_H | ||
24 | #define _INTERRUPT_KEYS_H | ||
25 | |||
26 | struct interrupt_keys_button { | ||
27 | /* Configuration parameters */ | ||
28 | int code; /* input event code (KEY_*, SW_*) */ | ||
29 | int irq; | ||
30 | int active_low; | ||
31 | char *desc; | ||
32 | int type; /* input event type (EV_KEY, EV_SW) */ | ||
33 | int wakeup; /* configure the interrupt source as a wake-up | ||
34 | * source */ | ||
35 | int debounce_interval; /* debounce ticks interval in msecs */ | ||
36 | bool can_disable; | ||
37 | }; | ||
38 | |||
39 | struct interrupt_keys_platform_data { | ||
40 | struct interrupt_keys_button *int_buttons; | ||
41 | int nbuttons; | ||
42 | unsigned int rep:1; /* enable input subsystem auto repeat */ | ||
43 | int (*enable)(struct device *dev); | ||
44 | void (*disable)(struct device *dev); | ||
45 | }; | ||
46 | |||
47 | #endif | ||
diff --git a/include/linux/ioctl.h b/include/linux/ioctl.h new file mode 100644 index 00000000000..aa91eb3951e --- /dev/null +++ b/include/linux/ioctl.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _LINUX_IOCTL_H | ||
2 | #define _LINUX_IOCTL_H | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | |||
6 | #endif /* _LINUX_IOCTL_H */ | ||
7 | |||
diff --git a/include/linux/ion.h b/include/linux/ion.h new file mode 100644 index 00000000000..9a322437a97 --- /dev/null +++ b/include/linux/ion.h | |||
@@ -0,0 +1,347 @@ | |||
1 | /* | ||
2 | * include/linux/ion.h | ||
3 | * | ||
4 | * Copyright (C) 2011 Google, Inc. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_ION_H | ||
18 | #define _LINUX_ION_H | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | |||
22 | struct ion_handle; | ||
23 | /** | ||
24 | * enum ion_heap_types - list of all possible types of heaps | ||
25 | * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc | ||
26 | * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc | ||
27 | * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved | ||
28 | * carveout heap, allocations are physically | ||
29 | * contiguous | ||
30 | * @ION_HEAP_END: helper for iterating over heaps | ||
31 | */ | ||
32 | enum ion_heap_type { | ||
33 | ION_HEAP_TYPE_SYSTEM, | ||
34 | ION_HEAP_TYPE_SYSTEM_CONTIG, | ||
35 | ION_HEAP_TYPE_CARVEOUT, | ||
36 | ION_HEAP_TYPE_IOMMU, | ||
37 | ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always | ||
38 | are at the end of this enum */ | ||
39 | ION_NUM_HEAPS, | ||
40 | }; | ||
41 | |||
42 | #define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM) | ||
43 | #define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG) | ||
44 | #define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT) | ||
45 | |||
46 | #ifdef __KERNEL__ | ||
47 | struct ion_device; | ||
48 | struct ion_heap; | ||
49 | struct ion_mapper; | ||
50 | struct ion_client; | ||
51 | struct ion_buffer; | ||
52 | |||
53 | /* This should be removed some day when phys_addr_t's are fully | ||
54 | plumbed in the kernel, and all instances of ion_phys_addr_t should | ||
55 | be converted to phys_addr_t. For the time being many kernel interfaces | ||
56 | do not accept phys_addr_t's that would have to */ | ||
57 | #define ion_phys_addr_t unsigned long | ||
58 | |||
59 | /** | ||
60 | * struct ion_platform_heap - defines a heap in the given platform | ||
61 | * @type: type of the heap from ion_heap_type enum | ||
62 | * @id: unique identifier for heap. When allocating (lower numbers | ||
63 | * will be allocated from first) | ||
64 | * @name: used for debug purposes | ||
65 | * @base: base address of heap in physical memory if applicable | ||
66 | * @size: size of the heap in bytes if applicable | ||
67 | * @priv: heap specific data | ||
68 | * | ||
69 | * Provided by the board file. | ||
70 | */ | ||
71 | struct ion_platform_heap { | ||
72 | enum ion_heap_type type; | ||
73 | unsigned int id; | ||
74 | const char *name; | ||
75 | ion_phys_addr_t base; | ||
76 | size_t size; | ||
77 | void *priv; | ||
78 | }; | ||
79 | |||
80 | /** | ||
81 | * struct ion_platform_data - array of platform heaps passed from board file | ||
82 | * @nr: number of structures in the array | ||
83 | * @heaps: array of platform_heap structions | ||
84 | * | ||
85 | * Provided by the board file in the form of platform data to a platform device. | ||
86 | */ | ||
87 | struct ion_platform_data { | ||
88 | int nr; | ||
89 | struct ion_platform_heap heaps[]; | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * ion_client_create() - allocate a client and returns it | ||
94 | * @dev: the global ion device | ||
95 | * @heap_mask: mask of heaps this client can allocate from | ||
96 | * @name: used for debugging | ||
97 | */ | ||
98 | struct ion_client *ion_client_create(struct ion_device *dev, | ||
99 | unsigned int heap_mask, const char *name); | ||
100 | |||
101 | /** | ||
102 | * ion_client_destroy() - free's a client and all it's handles | ||
103 | * @client: the client | ||
104 | * | ||
105 | * Free the provided client and all it's resources including | ||
106 | * any handles it is holding. | ||
107 | */ | ||
108 | void ion_client_destroy(struct ion_client *client); | ||
109 | |||
110 | /** | ||
111 | * ion_alloc - allocate ion memory | ||
112 | * @client: the client | ||
113 | * @len: size of the allocation | ||
114 | * @align: requested allocation alignment, lots of hardware blocks have | ||
115 | * alignment requirements of some kind | ||
116 | * @flags: mask of heaps to allocate from, if multiple bits are set | ||
117 | * heaps will be tried in order from lowest to highest order bit | ||
118 | * | ||
119 | * Allocate memory in one of the heaps provided in heap mask and return | ||
120 | * an opaque handle to it. | ||
121 | */ | ||
122 | struct ion_handle *ion_alloc(struct ion_client *client, size_t len, | ||
123 | size_t align, unsigned int flags); | ||
124 | |||
125 | /** | ||
126 | * ion_free - free a handle | ||
127 | * @client: the client | ||
128 | * @handle: the handle to free | ||
129 | * | ||
130 | * Free the provided handle. | ||
131 | */ | ||
132 | void ion_free(struct ion_client *client, struct ion_handle *handle); | ||
133 | |||
134 | /** | ||
135 | * ion_phys - returns the physical address and len of a handle | ||
136 | * @client: the client | ||
137 | * @handle: the handle | ||
138 | * @addr: a pointer to put the address in | ||
139 | * @len: a pointer to put the length in | ||
140 | * | ||
141 | * This function queries the heap for a particular handle to get the | ||
142 | * handle's physical address. It't output is only correct if | ||
143 | * a heap returns physically contiguous memory -- in other cases | ||
144 | * this api should not be implemented -- ion_map_dma should be used | ||
145 | * instead. Returns -EINVAL if the handle is invalid. This has | ||
146 | * no implications on the reference counting of the handle -- | ||
147 | * the returned value may not be valid if the caller is not | ||
148 | * holding a reference. | ||
149 | */ | ||
150 | int ion_phys(struct ion_client *client, struct ion_handle *handle, | ||
151 | ion_phys_addr_t *addr, size_t *len); | ||
152 | |||
153 | /** | ||
154 | * ion_map_kernel - create mapping for the given handle | ||
155 | * @client: the client | ||
156 | * @handle: handle to map | ||
157 | * | ||
158 | * Map the given handle into the kernel and return a kernel address that | ||
159 | * can be used to access this address. | ||
160 | */ | ||
161 | void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle); | ||
162 | |||
163 | /** | ||
164 | * ion_unmap_kernel() - destroy a kernel mapping for a handle | ||
165 | * @client: the client | ||
166 | * @handle: handle to unmap | ||
167 | */ | ||
168 | void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle); | ||
169 | |||
170 | /** | ||
171 | * ion_map_dma - create a dma mapping for a given handle | ||
172 | * @client: the client | ||
173 | * @handle: handle to map | ||
174 | * | ||
175 | * Return an sglist describing the given handle | ||
176 | */ | ||
177 | struct scatterlist *ion_map_dma(struct ion_client *client, | ||
178 | struct ion_handle *handle); | ||
179 | |||
180 | /** | ||
181 | * ion_unmap_dma() - destroy a dma mapping for a handle | ||
182 | * @client: the client | ||
183 | * @handle: handle to unmap | ||
184 | */ | ||
185 | void ion_unmap_dma(struct ion_client *client, struct ion_handle *handle); | ||
186 | |||
187 | /** | ||
188 | * ion_share() - given a handle, obtain a buffer to pass to other clients | ||
189 | * @client: the client | ||
190 | * @handle: the handle to share | ||
191 | * | ||
192 | * Given a handle, return a buffer, which exists in a global name | ||
193 | * space, and can be passed to other clients. Should be passed into ion_import | ||
194 | * to obtain a new handle for this buffer. | ||
195 | * | ||
196 | * NOTE: This function does do not an extra reference. The burden is on the | ||
197 | * caller to make sure the buffer doesn't go away while it's being passed to | ||
198 | * another client. That is, ion_free should not be called on this handle until | ||
199 | * the buffer has been imported into the other client. | ||
200 | */ | ||
201 | struct ion_buffer *ion_share(struct ion_client *client, | ||
202 | struct ion_handle *handle); | ||
203 | |||
204 | /** | ||
205 | * ion_import() - given an buffer in another client, import it | ||
206 | * @client: this blocks client | ||
207 | * @buffer: the buffer to import (as obtained from ion_share) | ||
208 | * | ||
209 | * Given a buffer, add it to the client and return the handle to use to refer | ||
210 | * to it further. This is called to share a handle from one kernel client to | ||
211 | * another. | ||
212 | */ | ||
213 | struct ion_handle *ion_import(struct ion_client *client, | ||
214 | struct ion_buffer *buffer); | ||
215 | |||
216 | /** | ||
217 | * ion_import_fd() - given an fd obtained via ION_IOC_SHARE ioctl, import it | ||
218 | * @client: this blocks client | ||
219 | * @fd: the fd | ||
220 | * | ||
221 | * A helper function for drivers that will be recieving ion buffers shared | ||
222 | * with them from userspace. These buffers are represented by a file | ||
223 | * descriptor obtained as the return from the ION_IOC_SHARE ioctl. | ||
224 | * This function coverts that fd into the underlying buffer, and returns | ||
225 | * the handle to use to refer to it further. | ||
226 | */ | ||
227 | struct ion_handle *ion_import_fd(struct ion_client *client, int fd); | ||
228 | #endif /* __KERNEL__ */ | ||
229 | |||
230 | /** | ||
231 | * DOC: Ion Userspace API | ||
232 | * | ||
233 | * create a client by opening /dev/ion | ||
234 | * most operations handled via following ioctls | ||
235 | * | ||
236 | */ | ||
237 | |||
238 | /** | ||
239 | * struct ion_allocation_data - metadata passed from userspace for allocations | ||
240 | * @len: size of the allocation | ||
241 | * @align: required alignment of the allocation | ||
242 | * @flags: flags passed to heap | ||
243 | * @handle: pointer that will be populated with a cookie to use to refer | ||
244 | * to this allocation | ||
245 | * | ||
246 | * Provided by userspace as an argument to the ioctl | ||
247 | */ | ||
248 | struct ion_allocation_data { | ||
249 | size_t len; | ||
250 | size_t align; | ||
251 | unsigned int flags; | ||
252 | struct ion_handle *handle; | ||
253 | }; | ||
254 | |||
255 | /** | ||
256 | * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair | ||
257 | * @handle: a handle | ||
258 | * @fd: a file descriptor representing that handle | ||
259 | * | ||
260 | * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with | ||
261 | * the handle returned from ion alloc, and the kernel returns the file | ||
262 | * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace | ||
263 | * provides the file descriptor and the kernel returns the handle. | ||
264 | */ | ||
265 | struct ion_fd_data { | ||
266 | struct ion_handle *handle; | ||
267 | int fd; | ||
268 | }; | ||
269 | |||
270 | /** | ||
271 | * struct ion_handle_data - a handle passed to/from the kernel | ||
272 | * @handle: a handle | ||
273 | */ | ||
274 | struct ion_handle_data { | ||
275 | struct ion_handle *handle; | ||
276 | }; | ||
277 | |||
278 | /** | ||
279 | * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl | ||
280 | * @cmd: the custom ioctl function to call | ||
281 | * @arg: additional data to pass to the custom ioctl, typically a user | ||
282 | * pointer to a predefined structure | ||
283 | * | ||
284 | * This works just like the regular cmd and arg fields of an ioctl. | ||
285 | */ | ||
286 | struct ion_custom_data { | ||
287 | unsigned int cmd; | ||
288 | unsigned long arg; | ||
289 | }; | ||
290 | |||
291 | #define ION_IOC_MAGIC 'I' | ||
292 | |||
293 | /** | ||
294 | * DOC: ION_IOC_ALLOC - allocate memory | ||
295 | * | ||
296 | * Takes an ion_allocation_data struct and returns it with the handle field | ||
297 | * populated with the opaque handle for the allocation. | ||
298 | */ | ||
299 | #define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ | ||
300 | struct ion_allocation_data) | ||
301 | |||
302 | /** | ||
303 | * DOC: ION_IOC_FREE - free memory | ||
304 | * | ||
305 | * Takes an ion_handle_data struct and frees the handle. | ||
306 | */ | ||
307 | #define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) | ||
308 | |||
309 | /** | ||
310 | * DOC: ION_IOC_MAP - get a file descriptor to mmap | ||
311 | * | ||
312 | * Takes an ion_fd_data struct with the handle field populated with a valid | ||
313 | * opaque handle. Returns the struct with the fd field set to a file | ||
314 | * descriptor open in the current address space. This file descriptor | ||
315 | * can then be used as an argument to mmap. | ||
316 | */ | ||
317 | #define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data) | ||
318 | |||
319 | /** | ||
320 | * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation | ||
321 | * | ||
322 | * Takes an ion_fd_data struct with the handle field populated with a valid | ||
323 | * opaque handle. Returns the struct with the fd field set to a file | ||
324 | * descriptor open in the current address space. This file descriptor | ||
325 | * can then be passed to another process. The corresponding opaque handle can | ||
326 | * be retrieved via ION_IOC_IMPORT. | ||
327 | */ | ||
328 | #define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data) | ||
329 | |||
330 | /** | ||
331 | * DOC: ION_IOC_IMPORT - imports a shared file descriptor | ||
332 | * | ||
333 | * Takes an ion_fd_data struct with the fd field populated with a valid file | ||
334 | * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle | ||
335 | * filed set to the corresponding opaque handle. | ||
336 | */ | ||
337 | #define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int) | ||
338 | |||
339 | /** | ||
340 | * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl | ||
341 | * | ||
342 | * Takes the argument of the architecture specific ioctl to call and | ||
343 | * passes appropriate userdata for that ioctl | ||
344 | */ | ||
345 | #define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data) | ||
346 | |||
347 | #endif /* _LINUX_ION_H */ | ||
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h new file mode 100644 index 00000000000..acb9ad684d6 --- /dev/null +++ b/include/linux/ip6_tunnel.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _IP6_TUNNEL_H | ||
2 | #define _IP6_TUNNEL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define IPV6_TLV_TNL_ENCAP_LIMIT 4 | ||
7 | #define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 | ||
8 | |||
9 | /* don't add encapsulation limit if one isn't present in inner packet */ | ||
10 | #define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 | ||
11 | /* copy the traffic class field from the inner packet */ | ||
12 | #define IP6_TNL_F_USE_ORIG_TCLASS 0x2 | ||
13 | /* copy the flowlabel from the inner packet */ | ||
14 | #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 | ||
15 | /* being used for Mobile IPv6 */ | ||
16 | #define IP6_TNL_F_MIP6_DEV 0x8 | ||
17 | /* copy DSCP from the outer packet */ | ||
18 | #define IP6_TNL_F_RCV_DSCP_COPY 0x10 | ||
19 | |||
20 | struct ip6_tnl_parm { | ||
21 | char name[IFNAMSIZ]; /* name of tunnel device */ | ||
22 | int link; /* ifindex of underlying L2 interface */ | ||
23 | __u8 proto; /* tunnel protocol */ | ||
24 | __u8 encap_limit; /* encapsulation limit for tunnel */ | ||
25 | __u8 hop_limit; /* hop limit for tunnel */ | ||
26 | __be32 flowinfo; /* traffic class and flowlabel for tunnel */ | ||
27 | __u32 flags; /* tunnel flags */ | ||
28 | struct in6_addr laddr; /* local tunnel end-point address */ | ||
29 | struct in6_addr raddr; /* remote tunnel end-point address */ | ||
30 | }; | ||
31 | |||
32 | #endif | ||
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h new file mode 100644 index 00000000000..4deb3834d62 --- /dev/null +++ b/include/linux/ip_vs.h | |||
@@ -0,0 +1,429 @@ | |||
1 | /* | ||
2 | * IP Virtual Server | ||
3 | * data structure and functionality definitions | ||
4 | */ | ||
5 | |||
6 | #ifndef _IP_VS_H | ||
7 | #define _IP_VS_H | ||
8 | |||
9 | #include <linux/types.h> /* For __beXX types in userland */ | ||
10 | |||
11 | #define IP_VS_VERSION_CODE 0x010201 | ||
12 | #define NVERSION(version) \ | ||
13 | (version >> 16) & 0xFF, \ | ||
14 | (version >> 8) & 0xFF, \ | ||
15 | version & 0xFF | ||
16 | |||
17 | /* | ||
18 | * Virtual Service Flags | ||
19 | */ | ||
20 | #define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ | ||
21 | #define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ | ||
22 | #define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */ | ||
23 | |||
24 | /* | ||
25 | * Destination Server Flags | ||
26 | */ | ||
27 | #define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */ | ||
28 | #define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */ | ||
29 | |||
30 | /* | ||
31 | * IPVS sync daemon states | ||
32 | */ | ||
33 | #define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */ | ||
34 | #define IP_VS_STATE_MASTER 0x0001 /* started as master */ | ||
35 | #define IP_VS_STATE_BACKUP 0x0002 /* started as backup */ | ||
36 | |||
37 | /* | ||
38 | * IPVS socket options | ||
39 | */ | ||
40 | #define IP_VS_BASE_CTL (64+1024+64) /* base */ | ||
41 | |||
42 | #define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */ | ||
43 | #define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1) | ||
44 | #define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2) | ||
45 | #define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3) | ||
46 | #define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4) | ||
47 | #define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5) | ||
48 | #define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6) | ||
49 | #define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7) | ||
50 | #define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8) | ||
51 | #define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9) | ||
52 | #define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10) | ||
53 | #define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11) | ||
54 | #define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12) | ||
55 | #define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13) | ||
56 | #define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14) | ||
57 | #define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15) | ||
58 | #define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO | ||
59 | |||
60 | #define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL | ||
61 | #define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1) | ||
62 | #define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2) | ||
63 | #define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3) | ||
64 | #define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4) | ||
65 | #define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */ | ||
66 | #define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6) | ||
67 | #define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7) | ||
68 | #define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON | ||
69 | |||
70 | |||
71 | /* | ||
72 | * IPVS Connection Flags | ||
73 | * Only flags 0..15 are sent to backup server | ||
74 | */ | ||
75 | #define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */ | ||
76 | #define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */ | ||
77 | #define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */ | ||
78 | #define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */ | ||
79 | #define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */ | ||
80 | #define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */ | ||
81 | #define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */ | ||
82 | #define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */ | ||
83 | #define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */ | ||
84 | #define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */ | ||
85 | #define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */ | ||
86 | #define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */ | ||
87 | #define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ | ||
88 | #define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ | ||
89 | #define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ | ||
90 | #define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ | ||
91 | |||
92 | #define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ | ||
93 | IP_VS_CONN_F_NOOUTPUT | \ | ||
94 | IP_VS_CONN_F_INACTIVE | \ | ||
95 | IP_VS_CONN_F_SEQ_MASK | \ | ||
96 | IP_VS_CONN_F_NO_CPORT | \ | ||
97 | IP_VS_CONN_F_TEMPLATE \ | ||
98 | ) | ||
99 | |||
100 | /* Flags that are not sent to backup server start from bit 16 */ | ||
101 | #define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ | ||
102 | |||
103 | /* Connection flags from destination that can be changed by user space */ | ||
104 | #define IP_VS_CONN_F_DEST_MASK (IP_VS_CONN_F_FWD_MASK | \ | ||
105 | IP_VS_CONN_F_ONE_PACKET | \ | ||
106 | IP_VS_CONN_F_NFCT | \ | ||
107 | 0) | ||
108 | |||
109 | #define IP_VS_SCHEDNAME_MAXLEN 16 | ||
110 | #define IP_VS_PENAME_MAXLEN 16 | ||
111 | #define IP_VS_IFNAME_MAXLEN 16 | ||
112 | |||
113 | #define IP_VS_PEDATA_MAXLEN 255 | ||
114 | |||
115 | /* | ||
116 | * The struct ip_vs_service_user and struct ip_vs_dest_user are | ||
117 | * used to set IPVS rules through setsockopt. | ||
118 | */ | ||
119 | struct ip_vs_service_user { | ||
120 | /* virtual service addresses */ | ||
121 | __u16 protocol; | ||
122 | __be32 addr; /* virtual ip address */ | ||
123 | __be16 port; | ||
124 | __u32 fwmark; /* firwall mark of service */ | ||
125 | |||
126 | /* virtual service options */ | ||
127 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | ||
128 | unsigned flags; /* virtual service flags */ | ||
129 | unsigned timeout; /* persistent timeout in sec */ | ||
130 | __be32 netmask; /* persistent netmask */ | ||
131 | }; | ||
132 | |||
133 | |||
134 | struct ip_vs_dest_user { | ||
135 | /* destination server address */ | ||
136 | __be32 addr; | ||
137 | __be16 port; | ||
138 | |||
139 | /* real server options */ | ||
140 | unsigned conn_flags; /* connection flags */ | ||
141 | int weight; /* destination weight */ | ||
142 | |||
143 | /* thresholds for active connections */ | ||
144 | __u32 u_threshold; /* upper threshold */ | ||
145 | __u32 l_threshold; /* lower threshold */ | ||
146 | }; | ||
147 | |||
148 | |||
149 | /* | ||
150 | * IPVS statistics object (for user space) | ||
151 | */ | ||
152 | struct ip_vs_stats_user { | ||
153 | __u32 conns; /* connections scheduled */ | ||
154 | __u32 inpkts; /* incoming packets */ | ||
155 | __u32 outpkts; /* outgoing packets */ | ||
156 | __u64 inbytes; /* incoming bytes */ | ||
157 | __u64 outbytes; /* outgoing bytes */ | ||
158 | |||
159 | __u32 cps; /* current connection rate */ | ||
160 | __u32 inpps; /* current in packet rate */ | ||
161 | __u32 outpps; /* current out packet rate */ | ||
162 | __u32 inbps; /* current in byte rate */ | ||
163 | __u32 outbps; /* current out byte rate */ | ||
164 | }; | ||
165 | |||
166 | |||
167 | /* The argument to IP_VS_SO_GET_INFO */ | ||
168 | struct ip_vs_getinfo { | ||
169 | /* version number */ | ||
170 | unsigned int version; | ||
171 | |||
172 | /* size of connection hash table */ | ||
173 | unsigned int size; | ||
174 | |||
175 | /* number of virtual services */ | ||
176 | unsigned int num_services; | ||
177 | }; | ||
178 | |||
179 | |||
180 | /* The argument to IP_VS_SO_GET_SERVICE */ | ||
181 | struct ip_vs_service_entry { | ||
182 | /* which service: user fills in these */ | ||
183 | __u16 protocol; | ||
184 | __be32 addr; /* virtual address */ | ||
185 | __be16 port; | ||
186 | __u32 fwmark; /* firwall mark of service */ | ||
187 | |||
188 | /* service options */ | ||
189 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | ||
190 | unsigned flags; /* virtual service flags */ | ||
191 | unsigned timeout; /* persistent timeout */ | ||
192 | __be32 netmask; /* persistent netmask */ | ||
193 | |||
194 | /* number of real servers */ | ||
195 | unsigned int num_dests; | ||
196 | |||
197 | /* statistics */ | ||
198 | struct ip_vs_stats_user stats; | ||
199 | }; | ||
200 | |||
201 | |||
202 | struct ip_vs_dest_entry { | ||
203 | __be32 addr; /* destination address */ | ||
204 | __be16 port; | ||
205 | unsigned conn_flags; /* connection flags */ | ||
206 | int weight; /* destination weight */ | ||
207 | |||
208 | __u32 u_threshold; /* upper threshold */ | ||
209 | __u32 l_threshold; /* lower threshold */ | ||
210 | |||
211 | __u32 activeconns; /* active connections */ | ||
212 | __u32 inactconns; /* inactive connections */ | ||
213 | __u32 persistconns; /* persistent connections */ | ||
214 | |||
215 | /* statistics */ | ||
216 | struct ip_vs_stats_user stats; | ||
217 | }; | ||
218 | |||
219 | |||
220 | /* The argument to IP_VS_SO_GET_DESTS */ | ||
221 | struct ip_vs_get_dests { | ||
222 | /* which service: user fills in these */ | ||
223 | __u16 protocol; | ||
224 | __be32 addr; /* virtual address */ | ||
225 | __be16 port; | ||
226 | __u32 fwmark; /* firwall mark of service */ | ||
227 | |||
228 | /* number of real servers */ | ||
229 | unsigned int num_dests; | ||
230 | |||
231 | /* the real servers */ | ||
232 | struct ip_vs_dest_entry entrytable[0]; | ||
233 | }; | ||
234 | |||
235 | |||
236 | /* The argument to IP_VS_SO_GET_SERVICES */ | ||
237 | struct ip_vs_get_services { | ||
238 | /* number of virtual services */ | ||
239 | unsigned int num_services; | ||
240 | |||
241 | /* service table */ | ||
242 | struct ip_vs_service_entry entrytable[0]; | ||
243 | }; | ||
244 | |||
245 | |||
246 | /* The argument to IP_VS_SO_GET_TIMEOUT */ | ||
247 | struct ip_vs_timeout_user { | ||
248 | int tcp_timeout; | ||
249 | int tcp_fin_timeout; | ||
250 | int udp_timeout; | ||
251 | }; | ||
252 | |||
253 | |||
254 | /* The argument to IP_VS_SO_GET_DAEMON */ | ||
255 | struct ip_vs_daemon_user { | ||
256 | /* sync daemon state (master/backup) */ | ||
257 | int state; | ||
258 | |||
259 | /* multicast interface name */ | ||
260 | char mcast_ifn[IP_VS_IFNAME_MAXLEN]; | ||
261 | |||
262 | /* SyncID we belong to */ | ||
263 | int syncid; | ||
264 | }; | ||
265 | |||
266 | /* | ||
267 | * | ||
268 | * IPVS Generic Netlink interface definitions | ||
269 | * | ||
270 | */ | ||
271 | |||
272 | /* Generic Netlink family info */ | ||
273 | |||
274 | #define IPVS_GENL_NAME "IPVS" | ||
275 | #define IPVS_GENL_VERSION 0x1 | ||
276 | |||
277 | struct ip_vs_flags { | ||
278 | __be32 flags; | ||
279 | __be32 mask; | ||
280 | }; | ||
281 | |||
282 | /* Generic Netlink command attributes */ | ||
283 | enum { | ||
284 | IPVS_CMD_UNSPEC = 0, | ||
285 | |||
286 | IPVS_CMD_NEW_SERVICE, /* add service */ | ||
287 | IPVS_CMD_SET_SERVICE, /* modify service */ | ||
288 | IPVS_CMD_DEL_SERVICE, /* delete service */ | ||
289 | IPVS_CMD_GET_SERVICE, /* get service info */ | ||
290 | |||
291 | IPVS_CMD_NEW_DEST, /* add destination */ | ||
292 | IPVS_CMD_SET_DEST, /* modify destination */ | ||
293 | IPVS_CMD_DEL_DEST, /* delete destination */ | ||
294 | IPVS_CMD_GET_DEST, /* get destination info */ | ||
295 | |||
296 | IPVS_CMD_NEW_DAEMON, /* start sync daemon */ | ||
297 | IPVS_CMD_DEL_DAEMON, /* stop sync daemon */ | ||
298 | IPVS_CMD_GET_DAEMON, /* get sync daemon status */ | ||
299 | |||
300 | IPVS_CMD_SET_CONFIG, /* set config settings */ | ||
301 | IPVS_CMD_GET_CONFIG, /* get config settings */ | ||
302 | |||
303 | IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */ | ||
304 | IPVS_CMD_GET_INFO, /* get general IPVS info */ | ||
305 | |||
306 | IPVS_CMD_ZERO, /* zero all counters and stats */ | ||
307 | IPVS_CMD_FLUSH, /* flush services and dests */ | ||
308 | |||
309 | __IPVS_CMD_MAX, | ||
310 | }; | ||
311 | |||
312 | #define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1) | ||
313 | |||
314 | /* Attributes used in the first level of commands */ | ||
315 | enum { | ||
316 | IPVS_CMD_ATTR_UNSPEC = 0, | ||
317 | IPVS_CMD_ATTR_SERVICE, /* nested service attribute */ | ||
318 | IPVS_CMD_ATTR_DEST, /* nested destination attribute */ | ||
319 | IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */ | ||
320 | IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */ | ||
321 | IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */ | ||
322 | IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */ | ||
323 | __IPVS_CMD_ATTR_MAX, | ||
324 | }; | ||
325 | |||
326 | #define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) | ||
327 | |||
328 | /* | ||
329 | * Attributes used to describe a service | ||
330 | * | ||
331 | * Used inside nested attribute IPVS_CMD_ATTR_SERVICE | ||
332 | */ | ||
333 | enum { | ||
334 | IPVS_SVC_ATTR_UNSPEC = 0, | ||
335 | IPVS_SVC_ATTR_AF, /* address family */ | ||
336 | IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */ | ||
337 | IPVS_SVC_ATTR_ADDR, /* virtual service address */ | ||
338 | IPVS_SVC_ATTR_PORT, /* virtual service port */ | ||
339 | IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */ | ||
340 | |||
341 | IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */ | ||
342 | IPVS_SVC_ATTR_FLAGS, /* virtual service flags */ | ||
343 | IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */ | ||
344 | IPVS_SVC_ATTR_NETMASK, /* persistent netmask */ | ||
345 | |||
346 | IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */ | ||
347 | |||
348 | IPVS_SVC_ATTR_PE_NAME, /* name of ct retriever */ | ||
349 | |||
350 | __IPVS_SVC_ATTR_MAX, | ||
351 | }; | ||
352 | |||
353 | #define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) | ||
354 | |||
355 | /* | ||
356 | * Attributes used to describe a destination (real server) | ||
357 | * | ||
358 | * Used inside nested attribute IPVS_CMD_ATTR_DEST | ||
359 | */ | ||
360 | enum { | ||
361 | IPVS_DEST_ATTR_UNSPEC = 0, | ||
362 | IPVS_DEST_ATTR_ADDR, /* real server address */ | ||
363 | IPVS_DEST_ATTR_PORT, /* real server port */ | ||
364 | |||
365 | IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */ | ||
366 | IPVS_DEST_ATTR_WEIGHT, /* destination weight */ | ||
367 | |||
368 | IPVS_DEST_ATTR_U_THRESH, /* upper threshold */ | ||
369 | IPVS_DEST_ATTR_L_THRESH, /* lower threshold */ | ||
370 | |||
371 | IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */ | ||
372 | IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */ | ||
373 | IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ | ||
374 | |||
375 | IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ | ||
376 | __IPVS_DEST_ATTR_MAX, | ||
377 | }; | ||
378 | |||
379 | #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1) | ||
380 | |||
381 | /* | ||
382 | * Attributes describing a sync daemon | ||
383 | * | ||
384 | * Used inside nested attribute IPVS_CMD_ATTR_DAEMON | ||
385 | */ | ||
386 | enum { | ||
387 | IPVS_DAEMON_ATTR_UNSPEC = 0, | ||
388 | IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */ | ||
389 | IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */ | ||
390 | IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */ | ||
391 | __IPVS_DAEMON_ATTR_MAX, | ||
392 | }; | ||
393 | |||
394 | #define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1) | ||
395 | |||
396 | /* | ||
397 | * Attributes used to describe service or destination entry statistics | ||
398 | * | ||
399 | * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS | ||
400 | */ | ||
401 | enum { | ||
402 | IPVS_STATS_ATTR_UNSPEC = 0, | ||
403 | IPVS_STATS_ATTR_CONNS, /* connections scheduled */ | ||
404 | IPVS_STATS_ATTR_INPKTS, /* incoming packets */ | ||
405 | IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */ | ||
406 | IPVS_STATS_ATTR_INBYTES, /* incoming bytes */ | ||
407 | IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */ | ||
408 | |||
409 | IPVS_STATS_ATTR_CPS, /* current connection rate */ | ||
410 | IPVS_STATS_ATTR_INPPS, /* current in packet rate */ | ||
411 | IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */ | ||
412 | IPVS_STATS_ATTR_INBPS, /* current in byte rate */ | ||
413 | IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */ | ||
414 | __IPVS_STATS_ATTR_MAX, | ||
415 | }; | ||
416 | |||
417 | #define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1) | ||
418 | |||
419 | /* Attributes used in response to IPVS_CMD_GET_INFO command */ | ||
420 | enum { | ||
421 | IPVS_INFO_ATTR_UNSPEC = 0, | ||
422 | IPVS_INFO_ATTR_VERSION, /* IPVS version number */ | ||
423 | IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */ | ||
424 | __IPVS_INFO_ATTR_MAX, | ||
425 | }; | ||
426 | |||
427 | #define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1) | ||
428 | |||
429 | #endif /* _IP_VS_H */ | ||
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h new file mode 100644 index 00000000000..df97e6e31e8 --- /dev/null +++ b/include/linux/ipmi_msgdefs.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * ipmi_smi.h | ||
3 | * | ||
4 | * MontaVista IPMI system management interface | ||
5 | * | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * Corey Minyard <minyard@mvista.com> | ||
8 | * source@mvista.com | ||
9 | * | ||
10 | * Copyright 2002 MontaVista Software Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
26 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
27 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License along | ||
30 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
31 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
32 | */ | ||
33 | |||
34 | #ifndef __LINUX_IPMI_MSGDEFS_H | ||
35 | #define __LINUX_IPMI_MSGDEFS_H | ||
36 | |||
37 | /* Various definitions for IPMI messages used by almost everything in | ||
38 | the IPMI stack. */ | ||
39 | |||
40 | /* NetFNs and commands used inside the IPMI stack. */ | ||
41 | |||
42 | #define IPMI_NETFN_SENSOR_EVENT_REQUEST 0x04 | ||
43 | #define IPMI_NETFN_SENSOR_EVENT_RESPONSE 0x05 | ||
44 | #define IPMI_GET_EVENT_RECEIVER_CMD 0x01 | ||
45 | |||
46 | #define IPMI_NETFN_APP_REQUEST 0x06 | ||
47 | #define IPMI_NETFN_APP_RESPONSE 0x07 | ||
48 | #define IPMI_GET_DEVICE_ID_CMD 0x01 | ||
49 | #define IPMI_COLD_RESET_CMD 0x02 | ||
50 | #define IPMI_WARM_RESET_CMD 0x03 | ||
51 | #define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 | ||
52 | #define IPMI_GET_DEVICE_GUID_CMD 0x08 | ||
53 | #define IPMI_GET_MSG_FLAGS_CMD 0x31 | ||
54 | #define IPMI_SEND_MSG_CMD 0x34 | ||
55 | #define IPMI_GET_MSG_CMD 0x33 | ||
56 | #define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e | ||
57 | #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f | ||
58 | #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 | ||
59 | #define IPMI_GET_CHANNEL_INFO_CMD 0x42 | ||
60 | |||
61 | /* Bit for BMC global enables. */ | ||
62 | #define IPMI_BMC_RCV_MSG_INTR 0x01 | ||
63 | #define IPMI_BMC_EVT_MSG_INTR 0x02 | ||
64 | #define IPMI_BMC_EVT_MSG_BUFF 0x04 | ||
65 | #define IPMI_BMC_SYS_LOG 0x08 | ||
66 | |||
67 | #define IPMI_NETFN_STORAGE_REQUEST 0x0a | ||
68 | #define IPMI_NETFN_STORAGE_RESPONSE 0x0b | ||
69 | #define IPMI_ADD_SEL_ENTRY_CMD 0x44 | ||
70 | |||
71 | #define IPMI_NETFN_FIRMWARE_REQUEST 0x08 | ||
72 | #define IPMI_NETFN_FIRMWARE_RESPONSE 0x09 | ||
73 | |||
74 | /* The default slave address */ | ||
75 | #define IPMI_BMC_SLAVE_ADDR 0x20 | ||
76 | |||
77 | /* The BT interface on high-end HP systems supports up to 255 bytes in | ||
78 | * one transfer. Its "virtual" BMC supports some commands that are longer | ||
79 | * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus | ||
80 | * some overhead; it's not worth the effort to dynamically size this based | ||
81 | * on the results of the "Get BT Capabilities" command. */ | ||
82 | #define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */ | ||
83 | |||
84 | #define IPMI_CC_NO_ERROR 0x00 | ||
85 | #define IPMI_NODE_BUSY_ERR 0xc0 | ||
86 | #define IPMI_INVALID_COMMAND_ERR 0xc1 | ||
87 | #define IPMI_TIMEOUT_ERR 0xc3 | ||
88 | #define IPMI_ERR_MSG_TRUNCATED 0xc6 | ||
89 | #define IPMI_REQ_LEN_INVALID_ERR 0xc7 | ||
90 | #define IPMI_REQ_LEN_EXCEEDED_ERR 0xc8 | ||
91 | #define IPMI_NOT_IN_MY_STATE_ERR 0xd5 /* IPMI 2.0 */ | ||
92 | #define IPMI_LOST_ARBITRATION_ERR 0x81 | ||
93 | #define IPMI_BUS_ERR 0x82 | ||
94 | #define IPMI_NAK_ON_WRITE_ERR 0x83 | ||
95 | #define IPMI_ERR_UNSPECIFIED 0xff | ||
96 | |||
97 | #define IPMI_CHANNEL_PROTOCOL_IPMB 1 | ||
98 | #define IPMI_CHANNEL_PROTOCOL_ICMB 2 | ||
99 | #define IPMI_CHANNEL_PROTOCOL_SMBUS 4 | ||
100 | #define IPMI_CHANNEL_PROTOCOL_KCS 5 | ||
101 | #define IPMI_CHANNEL_PROTOCOL_SMIC 6 | ||
102 | #define IPMI_CHANNEL_PROTOCOL_BT10 7 | ||
103 | #define IPMI_CHANNEL_PROTOCOL_BT15 8 | ||
104 | #define IPMI_CHANNEL_PROTOCOL_TMODE 9 | ||
105 | |||
106 | #define IPMI_CHANNEL_MEDIUM_IPMB 1 | ||
107 | #define IPMI_CHANNEL_MEDIUM_ICMB10 2 | ||
108 | #define IPMI_CHANNEL_MEDIUM_ICMB09 3 | ||
109 | #define IPMI_CHANNEL_MEDIUM_8023LAN 4 | ||
110 | #define IPMI_CHANNEL_MEDIUM_ASYNC 5 | ||
111 | #define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 | ||
112 | #define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 | ||
113 | #define IPMI_CHANNEL_MEDIUM_SMBUS1 8 | ||
114 | #define IPMI_CHANNEL_MEDIUM_SMBUS2 9 | ||
115 | #define IPMI_CHANNEL_MEDIUM_USB1 10 | ||
116 | #define IPMI_CHANNEL_MEDIUM_USB2 11 | ||
117 | #define IPMI_CHANNEL_MEDIUM_SYSINTF 12 | ||
118 | #define IPMI_CHANNEL_MEDIUM_OEM_MIN 0x60 | ||
119 | #define IPMI_CHANNEL_MEDIUM_OEM_MAX 0x7f | ||
120 | |||
121 | #endif /* __LINUX_IPMI_MSGDEFS_H */ | ||
diff --git a/include/linux/ipsec.h b/include/linux/ipsec.h new file mode 100644 index 00000000000..d17a6302a0e --- /dev/null +++ b/include/linux/ipsec.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef _LINUX_IPSEC_H | ||
2 | #define _LINUX_IPSEC_H | ||
3 | |||
4 | /* The definitions, required to talk to KAME racoon IKE. */ | ||
5 | |||
6 | #include <linux/pfkeyv2.h> | ||
7 | |||
8 | #define IPSEC_PORT_ANY 0 | ||
9 | #define IPSEC_ULPROTO_ANY 255 | ||
10 | #define IPSEC_PROTO_ANY 255 | ||
11 | |||
12 | enum { | ||
13 | IPSEC_MODE_ANY = 0, /* We do not support this for SA */ | ||
14 | IPSEC_MODE_TRANSPORT = 1, | ||
15 | IPSEC_MODE_TUNNEL = 2, | ||
16 | IPSEC_MODE_BEET = 3 | ||
17 | }; | ||
18 | |||
19 | enum { | ||
20 | IPSEC_DIR_ANY = 0, | ||
21 | IPSEC_DIR_INBOUND = 1, | ||
22 | IPSEC_DIR_OUTBOUND = 2, | ||
23 | IPSEC_DIR_FWD = 3, /* It is our own */ | ||
24 | IPSEC_DIR_MAX = 4, | ||
25 | IPSEC_DIR_INVALID = 5 | ||
26 | }; | ||
27 | |||
28 | enum { | ||
29 | IPSEC_POLICY_DISCARD = 0, | ||
30 | IPSEC_POLICY_NONE = 1, | ||
31 | IPSEC_POLICY_IPSEC = 2, | ||
32 | IPSEC_POLICY_ENTRUST = 3, | ||
33 | IPSEC_POLICY_BYPASS = 4 | ||
34 | }; | ||
35 | |||
36 | enum { | ||
37 | IPSEC_LEVEL_DEFAULT = 0, | ||
38 | IPSEC_LEVEL_USE = 1, | ||
39 | IPSEC_LEVEL_REQUIRE = 2, | ||
40 | IPSEC_LEVEL_UNIQUE = 3 | ||
41 | }; | ||
42 | |||
43 | #define IPSEC_MANUAL_REQID_MAX 0x3fff | ||
44 | |||
45 | #define IPSEC_REPLAYWSIZE 32 | ||
46 | |||
47 | #endif /* _LINUX_IPSEC_H */ | ||
diff --git a/include/linux/ipx.h b/include/linux/ipx.h new file mode 100644 index 00000000000..aabb1d29402 --- /dev/null +++ b/include/linux/ipx.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef _IPX_H_ | ||
2 | #define _IPX_H_ | ||
3 | #include <linux/types.h> | ||
4 | #include <linux/sockios.h> | ||
5 | #include <linux/socket.h> | ||
6 | #define IPX_NODE_LEN 6 | ||
7 | #define IPX_MTU 576 | ||
8 | |||
9 | struct sockaddr_ipx { | ||
10 | sa_family_t sipx_family; | ||
11 | __be16 sipx_port; | ||
12 | __be32 sipx_network; | ||
13 | unsigned char sipx_node[IPX_NODE_LEN]; | ||
14 | __u8 sipx_type; | ||
15 | unsigned char sipx_zero; /* 16 byte fill */ | ||
16 | }; | ||
17 | |||
18 | /* | ||
19 | * So we can fit the extra info for SIOCSIFADDR into the address nicely | ||
20 | */ | ||
21 | #define sipx_special sipx_port | ||
22 | #define sipx_action sipx_zero | ||
23 | #define IPX_DLTITF 0 | ||
24 | #define IPX_CRTITF 1 | ||
25 | |||
26 | struct ipx_route_definition { | ||
27 | __be32 ipx_network; | ||
28 | __be32 ipx_router_network; | ||
29 | unsigned char ipx_router_node[IPX_NODE_LEN]; | ||
30 | }; | ||
31 | |||
32 | struct ipx_interface_definition { | ||
33 | __be32 ipx_network; | ||
34 | unsigned char ipx_device[16]; | ||
35 | unsigned char ipx_dlink_type; | ||
36 | #define IPX_FRAME_NONE 0 | ||
37 | #define IPX_FRAME_SNAP 1 | ||
38 | #define IPX_FRAME_8022 2 | ||
39 | #define IPX_FRAME_ETHERII 3 | ||
40 | #define IPX_FRAME_8023 4 | ||
41 | #define IPX_FRAME_TR_8022 5 /* obsolete */ | ||
42 | unsigned char ipx_special; | ||
43 | #define IPX_SPECIAL_NONE 0 | ||
44 | #define IPX_PRIMARY 1 | ||
45 | #define IPX_INTERNAL 2 | ||
46 | unsigned char ipx_node[IPX_NODE_LEN]; | ||
47 | }; | ||
48 | |||
49 | struct ipx_config_data { | ||
50 | unsigned char ipxcfg_auto_select_primary; | ||
51 | unsigned char ipxcfg_auto_create_interfaces; | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * OLD Route Definition for backward compatibility. | ||
56 | */ | ||
57 | |||
58 | struct ipx_route_def { | ||
59 | __be32 ipx_network; | ||
60 | __be32 ipx_router_network; | ||
61 | #define IPX_ROUTE_NO_ROUTER 0 | ||
62 | unsigned char ipx_router_node[IPX_NODE_LEN]; | ||
63 | unsigned char ipx_device[16]; | ||
64 | unsigned short ipx_flags; | ||
65 | #define IPX_RT_SNAP 8 | ||
66 | #define IPX_RT_8022 4 | ||
67 | #define IPX_RT_BLUEBOOK 2 | ||
68 | #define IPX_RT_ROUTED 1 | ||
69 | }; | ||
70 | |||
71 | #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) | ||
72 | #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) | ||
73 | #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) | ||
74 | #define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) | ||
75 | #endif /* _IPX_H_ */ | ||
diff --git a/include/linux/irda.h b/include/linux/irda.h new file mode 100644 index 00000000000..00bdad0e851 --- /dev/null +++ b/include/linux/irda.h | |||
@@ -0,0 +1,254 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: irda.h | ||
4 | * Version: | ||
5 | * Description: | ||
6 | * Status: Experimental. | ||
7 | * Author: Dag Brattli <dagb@cs.uit.no> | ||
8 | * Created at: Mon Mar 8 14:06:12 1999 | ||
9 | * Modified at: Sat Dec 25 16:06:42 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * Neither Dag Brattli nor University of Tromsø admit liability nor | ||
20 | * provide warranty for any of this software. This material is | ||
21 | * provided "AS-IS" and at no charge. | ||
22 | * | ||
23 | ********************************************************************/ | ||
24 | |||
25 | #ifndef KERNEL_IRDA_H | ||
26 | #define KERNEL_IRDA_H | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | |||
30 | /* Please do *not* add any #include in this file, this file is | ||
31 | * included as-is in user space. | ||
32 | * Please fix the calling file to properly included needed files before | ||
33 | * this one, or preferably to include <net/irda/irda.h> instead. | ||
34 | * Jean II */ | ||
35 | |||
36 | /* Hint bit positions for first hint byte */ | ||
37 | #define HINT_PNP 0x01 | ||
38 | #define HINT_PDA 0x02 | ||
39 | #define HINT_COMPUTER 0x04 | ||
40 | #define HINT_PRINTER 0x08 | ||
41 | #define HINT_MODEM 0x10 | ||
42 | #define HINT_FAX 0x20 | ||
43 | #define HINT_LAN 0x40 | ||
44 | #define HINT_EXTENSION 0x80 | ||
45 | |||
46 | /* Hint bit positions for second hint byte (first extension byte) */ | ||
47 | #define HINT_TELEPHONY 0x01 | ||
48 | #define HINT_FILE_SERVER 0x02 | ||
49 | #define HINT_COMM 0x04 | ||
50 | #define HINT_MESSAGE 0x08 | ||
51 | #define HINT_HTTP 0x10 | ||
52 | #define HINT_OBEX 0x20 | ||
53 | |||
54 | /* IrLMP character code values */ | ||
55 | #define CS_ASCII 0x00 | ||
56 | #define CS_ISO_8859_1 0x01 | ||
57 | #define CS_ISO_8859_2 0x02 | ||
58 | #define CS_ISO_8859_3 0x03 | ||
59 | #define CS_ISO_8859_4 0x04 | ||
60 | #define CS_ISO_8859_5 0x05 | ||
61 | #define CS_ISO_8859_6 0x06 | ||
62 | #define CS_ISO_8859_7 0x07 | ||
63 | #define CS_ISO_8859_8 0x08 | ||
64 | #define CS_ISO_8859_9 0x09 | ||
65 | #define CS_UNICODE 0xff | ||
66 | |||
67 | /* These are the currently known dongles */ | ||
68 | typedef enum { | ||
69 | IRDA_TEKRAM_DONGLE = 0, | ||
70 | IRDA_ESI_DONGLE = 1, | ||
71 | IRDA_ACTISYS_DONGLE = 2, | ||
72 | IRDA_ACTISYS_PLUS_DONGLE = 3, | ||
73 | IRDA_GIRBIL_DONGLE = 4, | ||
74 | IRDA_LITELINK_DONGLE = 5, | ||
75 | IRDA_AIRPORT_DONGLE = 6, | ||
76 | IRDA_OLD_BELKIN_DONGLE = 7, | ||
77 | IRDA_EP7211_IR = 8, | ||
78 | IRDA_MCP2120_DONGLE = 9, | ||
79 | IRDA_ACT200L_DONGLE = 10, | ||
80 | IRDA_MA600_DONGLE = 11, | ||
81 | IRDA_TOIM3232_DONGLE = 12, | ||
82 | IRDA_EP7211_DONGLE = 13, | ||
83 | } IRDA_DONGLE; | ||
84 | |||
85 | /* Protocol types to be used for SOCK_DGRAM */ | ||
86 | enum { | ||
87 | IRDAPROTO_UNITDATA = 0, | ||
88 | IRDAPROTO_ULTRA = 1, | ||
89 | IRDAPROTO_MAX | ||
90 | }; | ||
91 | |||
92 | #define SOL_IRLMP 266 /* Same as SOL_IRDA for now */ | ||
93 | #define SOL_IRTTP 266 /* Same as SOL_IRDA for now */ | ||
94 | |||
95 | #define IRLMP_ENUMDEVICES 1 /* Return discovery log */ | ||
96 | #define IRLMP_IAS_SET 2 /* Set an attribute in local IAS */ | ||
97 | #define IRLMP_IAS_QUERY 3 /* Query remote IAS for attribute */ | ||
98 | #define IRLMP_HINTS_SET 4 /* Set hint bits advertised */ | ||
99 | #define IRLMP_QOS_SET 5 | ||
100 | #define IRLMP_QOS_GET 6 | ||
101 | #define IRLMP_MAX_SDU_SIZE 7 | ||
102 | #define IRLMP_IAS_GET 8 /* Get an attribute from local IAS */ | ||
103 | #define IRLMP_IAS_DEL 9 /* Remove attribute from local IAS */ | ||
104 | #define IRLMP_HINT_MASK_SET 10 /* Set discovery filter */ | ||
105 | #define IRLMP_WAITDEVICE 11 /* Wait for a new discovery */ | ||
106 | |||
107 | #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */ | ||
108 | |||
109 | #define IAS_MAX_STRING 256 /* See IrLMP 1.1, 4.3.3.2 */ | ||
110 | #define IAS_MAX_OCTET_STRING 1024 /* See IrLMP 1.1, 4.3.3.2 */ | ||
111 | #define IAS_MAX_CLASSNAME 60 /* See IrLMP 1.1, 4.3.1 */ | ||
112 | #define IAS_MAX_ATTRIBNAME 60 /* See IrLMP 1.1, 4.3.3.1 */ | ||
113 | #define IAS_MAX_ATTRIBNUMBER 256 /* See IrLMP 1.1, 4.3.3.1 */ | ||
114 | /* For user space backward compatibility - may be fixed in kernel 2.5.X | ||
115 | * Note : need 60+1 ('\0'), make it 64 for alignement - Jean II */ | ||
116 | #define IAS_EXPORT_CLASSNAME 64 | ||
117 | #define IAS_EXPORT_ATTRIBNAME 256 | ||
118 | |||
119 | /* Attribute type needed for struct irda_ias_set */ | ||
120 | #define IAS_MISSING 0 | ||
121 | #define IAS_INTEGER 1 | ||
122 | #define IAS_OCT_SEQ 2 | ||
123 | #define IAS_STRING 3 | ||
124 | |||
125 | #define LSAP_ANY 0xff | ||
126 | |||
127 | struct sockaddr_irda { | ||
128 | sa_family_t sir_family; /* AF_IRDA */ | ||
129 | __u8 sir_lsap_sel; /* LSAP selector */ | ||
130 | __u32 sir_addr; /* Device address */ | ||
131 | char sir_name[25]; /* Usually <service>:IrDA:TinyTP */ | ||
132 | }; | ||
133 | |||
134 | struct irda_device_info { | ||
135 | __u32 saddr; /* Address of local interface */ | ||
136 | __u32 daddr; /* Address of remote device */ | ||
137 | char info[22]; /* Description */ | ||
138 | __u8 charset; /* Charset used for description */ | ||
139 | __u8 hints[2]; /* Hint bits */ | ||
140 | }; | ||
141 | |||
142 | struct irda_device_list { | ||
143 | __u32 len; | ||
144 | struct irda_device_info dev[1]; | ||
145 | }; | ||
146 | |||
147 | struct irda_ias_set { | ||
148 | char irda_class_name[IAS_EXPORT_CLASSNAME]; | ||
149 | char irda_attrib_name[IAS_EXPORT_ATTRIBNAME]; | ||
150 | unsigned int irda_attrib_type; | ||
151 | union { | ||
152 | unsigned int irda_attrib_int; | ||
153 | struct { | ||
154 | unsigned short len; | ||
155 | __u8 octet_seq[IAS_MAX_OCTET_STRING]; | ||
156 | } irda_attrib_octet_seq; | ||
157 | struct { | ||
158 | __u8 len; | ||
159 | __u8 charset; | ||
160 | __u8 string[IAS_MAX_STRING]; | ||
161 | } irda_attrib_string; | ||
162 | } attribute; | ||
163 | __u32 daddr; /* Address of device (for some queries only) */ | ||
164 | }; | ||
165 | |||
166 | /* Some private IOCTL's (max 16) */ | ||
167 | #define SIOCSDONGLE (SIOCDEVPRIVATE + 0) | ||
168 | #define SIOCGDONGLE (SIOCDEVPRIVATE + 1) | ||
169 | #define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 2) | ||
170 | #define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 3) | ||
171 | #define SIOCGMEDIABUSY (SIOCDEVPRIVATE + 4) | ||
172 | #define SIOCGRECEIVING (SIOCDEVPRIVATE + 5) | ||
173 | #define SIOCSMODE (SIOCDEVPRIVATE + 6) | ||
174 | #define SIOCGMODE (SIOCDEVPRIVATE + 7) | ||
175 | #define SIOCSDTRRTS (SIOCDEVPRIVATE + 8) | ||
176 | #define SIOCGQOS (SIOCDEVPRIVATE + 9) | ||
177 | |||
178 | /* No reason to include <linux/if.h> just because of this one ;-) */ | ||
179 | #define IRNAMSIZ 16 | ||
180 | |||
181 | /* IrDA quality of service information (must not exceed 16 bytes) */ | ||
182 | struct if_irda_qos { | ||
183 | unsigned long baudrate; | ||
184 | unsigned short data_size; | ||
185 | unsigned short window_size; | ||
186 | unsigned short min_turn_time; | ||
187 | unsigned short max_turn_time; | ||
188 | unsigned char add_bofs; | ||
189 | unsigned char link_disc; | ||
190 | }; | ||
191 | |||
192 | /* For setting RTS and DTR lines of a dongle */ | ||
193 | struct if_irda_line { | ||
194 | __u8 dtr; | ||
195 | __u8 rts; | ||
196 | }; | ||
197 | |||
198 | /* IrDA interface configuration (data part must not exceed 16 bytes) */ | ||
199 | struct if_irda_req { | ||
200 | union { | ||
201 | char ifrn_name[IRNAMSIZ]; /* if name, e.g. "irda0" */ | ||
202 | } ifr_ifrn; | ||
203 | |||
204 | /* Data part */ | ||
205 | union { | ||
206 | struct if_irda_line ifru_line; | ||
207 | struct if_irda_qos ifru_qos; | ||
208 | unsigned short ifru_flags; | ||
209 | unsigned int ifru_receiving; | ||
210 | unsigned int ifru_mode; | ||
211 | unsigned int ifru_dongle; | ||
212 | } ifr_ifru; | ||
213 | }; | ||
214 | |||
215 | #define ifr_baudrate ifr_ifru.ifru_qos.baudrate | ||
216 | #define ifr_receiving ifr_ifru.ifru_receiving | ||
217 | #define ifr_dongle ifr_ifru.ifru_dongle | ||
218 | #define ifr_mode ifr_ifru.ifru_mode | ||
219 | #define ifr_dtr ifr_ifru.ifru_line.dtr | ||
220 | #define ifr_rts ifr_ifru.ifru_line.rts | ||
221 | |||
222 | |||
223 | /* IrDA netlink definitions */ | ||
224 | #define IRDA_NL_NAME "irda" | ||
225 | #define IRDA_NL_VERSION 1 | ||
226 | |||
227 | enum irda_nl_commands { | ||
228 | IRDA_NL_CMD_UNSPEC, | ||
229 | IRDA_NL_CMD_SET_MODE, | ||
230 | IRDA_NL_CMD_GET_MODE, | ||
231 | |||
232 | __IRDA_NL_CMD_AFTER_LAST | ||
233 | }; | ||
234 | #define IRDA_NL_CMD_MAX (__IRDA_NL_CMD_AFTER_LAST - 1) | ||
235 | |||
236 | enum nl80211_attrs { | ||
237 | IRDA_NL_ATTR_UNSPEC, | ||
238 | IRDA_NL_ATTR_IFNAME, | ||
239 | IRDA_NL_ATTR_MODE, | ||
240 | |||
241 | __IRDA_NL_ATTR_AFTER_LAST | ||
242 | }; | ||
243 | #define IRDA_NL_ATTR_MAX (__IRDA_NL_ATTR_AFTER_LAST - 1) | ||
244 | |||
245 | /* IrDA modes */ | ||
246 | #define IRDA_MODE_PRIMARY 0x1 | ||
247 | #define IRDA_MODE_SECONDARY 0x2 | ||
248 | #define IRDA_MODE_MONITOR 0x4 | ||
249 | |||
250 | #endif /* KERNEL_IRDA_H */ | ||
251 | |||
252 | |||
253 | |||
254 | |||
diff --git a/include/linux/isdn/Kbuild b/include/linux/isdn/Kbuild new file mode 100644 index 00000000000..991cdb29ab2 --- /dev/null +++ b/include/linux/isdn/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += capicmd.h | |||
diff --git a/include/linux/isdn/capicmd.h b/include/linux/isdn/capicmd.h new file mode 100644 index 00000000000..b58635f722d --- /dev/null +++ b/include/linux/isdn/capicmd.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* $Id: capicmd.h,v 1.2.6.2 2001/09/23 22:24:33 kai Exp $ | ||
2 | * | ||
3 | * CAPI 2.0 Interface for Linux | ||
4 | * | ||
5 | * Copyright 1997 by Carsten Paeth <calle@calle.de> | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef __CAPICMD_H__ | ||
13 | #define __CAPICMD_H__ | ||
14 | |||
15 | #define CAPI_MSG_BASELEN 8 | ||
16 | #define CAPI_DATA_B3_REQ_LEN (CAPI_MSG_BASELEN+4+4+2+2+2) | ||
17 | #define CAPI_DATA_B3_RESP_LEN (CAPI_MSG_BASELEN+4+2) | ||
18 | |||
19 | /*----- CAPI commands -----*/ | ||
20 | #define CAPI_ALERT 0x01 | ||
21 | #define CAPI_CONNECT 0x02 | ||
22 | #define CAPI_CONNECT_ACTIVE 0x03 | ||
23 | #define CAPI_CONNECT_B3_ACTIVE 0x83 | ||
24 | #define CAPI_CONNECT_B3 0x82 | ||
25 | #define CAPI_CONNECT_B3_T90_ACTIVE 0x88 | ||
26 | #define CAPI_DATA_B3 0x86 | ||
27 | #define CAPI_DISCONNECT_B3 0x84 | ||
28 | #define CAPI_DISCONNECT 0x04 | ||
29 | #define CAPI_FACILITY 0x80 | ||
30 | #define CAPI_INFO 0x08 | ||
31 | #define CAPI_LISTEN 0x05 | ||
32 | #define CAPI_MANUFACTURER 0xff | ||
33 | #define CAPI_RESET_B3 0x87 | ||
34 | #define CAPI_SELECT_B_PROTOCOL 0x41 | ||
35 | |||
36 | /*----- CAPI subcommands -----*/ | ||
37 | |||
38 | #define CAPI_REQ 0x80 | ||
39 | #define CAPI_CONF 0x81 | ||
40 | #define CAPI_IND 0x82 | ||
41 | #define CAPI_RESP 0x83 | ||
42 | |||
43 | /*----- CAPI combined commands -----*/ | ||
44 | |||
45 | #define CAPICMD(cmd,subcmd) (((cmd)<<8)|(subcmd)) | ||
46 | |||
47 | #define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) | ||
48 | #define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) | ||
49 | #define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) | ||
50 | #define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) | ||
51 | |||
52 | #define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) | ||
53 | #define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) | ||
54 | |||
55 | #define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) | ||
56 | #define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) | ||
57 | #define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) | ||
58 | #define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) | ||
59 | |||
60 | #define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) | ||
61 | #define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) | ||
62 | #define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) | ||
63 | #define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) | ||
64 | |||
65 | #define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) | ||
66 | #define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) | ||
67 | |||
68 | #define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) | ||
69 | #define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) | ||
70 | #define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) | ||
71 | #define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) | ||
72 | |||
73 | #define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) | ||
74 | #define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) | ||
75 | #define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) | ||
76 | #define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) | ||
77 | |||
78 | |||
79 | #define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) | ||
80 | #define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) | ||
81 | |||
82 | #define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) | ||
83 | #define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) | ||
84 | #define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) | ||
85 | #define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) | ||
86 | |||
87 | #define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) | ||
88 | #define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) | ||
89 | #define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) | ||
90 | #define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) | ||
91 | |||
92 | #define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) | ||
93 | #define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) | ||
94 | #define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) | ||
95 | #define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) | ||
96 | |||
97 | #define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) | ||
98 | #define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) | ||
99 | |||
100 | #define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) | ||
101 | #define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) | ||
102 | #define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) | ||
103 | #define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) | ||
104 | |||
105 | #define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) | ||
106 | #define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) | ||
107 | #define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) | ||
108 | #define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) | ||
109 | |||
110 | #define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) | ||
111 | #define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) | ||
112 | #define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) | ||
113 | #define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) | ||
114 | |||
115 | #endif /* __CAPICMD_H__ */ | ||
diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h new file mode 100644 index 00000000000..4688ac4284e --- /dev/null +++ b/include/linux/iso_fs.h | |||
@@ -0,0 +1,165 @@ | |||
1 | #ifndef _ISOFS_FS_H | ||
2 | #define _ISOFS_FS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/magic.h> | ||
6 | |||
7 | /* | ||
8 | * The isofs filesystem constants/structures | ||
9 | */ | ||
10 | |||
11 | /* This part borrowed from the bsd386 isofs */ | ||
12 | #define ISODCL(from, to) (to - from + 1) | ||
13 | |||
14 | struct iso_volume_descriptor { | ||
15 | char type[ISODCL(1,1)]; /* 711 */ | ||
16 | char id[ISODCL(2,6)]; | ||
17 | char version[ISODCL(7,7)]; | ||
18 | char data[ISODCL(8,2048)]; | ||
19 | }; | ||
20 | |||
21 | /* volume descriptor types */ | ||
22 | #define ISO_VD_PRIMARY 1 | ||
23 | #define ISO_VD_SUPPLEMENTARY 2 | ||
24 | #define ISO_VD_END 255 | ||
25 | |||
26 | #define ISO_STANDARD_ID "CD001" | ||
27 | |||
28 | struct iso_primary_descriptor { | ||
29 | char type [ISODCL ( 1, 1)]; /* 711 */ | ||
30 | char id [ISODCL ( 2, 6)]; | ||
31 | char version [ISODCL ( 7, 7)]; /* 711 */ | ||
32 | char unused1 [ISODCL ( 8, 8)]; | ||
33 | char system_id [ISODCL ( 9, 40)]; /* achars */ | ||
34 | char volume_id [ISODCL ( 41, 72)]; /* dchars */ | ||
35 | char unused2 [ISODCL ( 73, 80)]; | ||
36 | char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ | ||
37 | char unused3 [ISODCL ( 89, 120)]; | ||
38 | char volume_set_size [ISODCL (121, 124)]; /* 723 */ | ||
39 | char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ | ||
40 | char logical_block_size [ISODCL (129, 132)]; /* 723 */ | ||
41 | char path_table_size [ISODCL (133, 140)]; /* 733 */ | ||
42 | char type_l_path_table [ISODCL (141, 144)]; /* 731 */ | ||
43 | char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ | ||
44 | char type_m_path_table [ISODCL (149, 152)]; /* 732 */ | ||
45 | char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ | ||
46 | char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ | ||
47 | char volume_set_id [ISODCL (191, 318)]; /* dchars */ | ||
48 | char publisher_id [ISODCL (319, 446)]; /* achars */ | ||
49 | char preparer_id [ISODCL (447, 574)]; /* achars */ | ||
50 | char application_id [ISODCL (575, 702)]; /* achars */ | ||
51 | char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ | ||
52 | char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ | ||
53 | char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ | ||
54 | char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ | ||
55 | char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ | ||
56 | char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ | ||
57 | char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ | ||
58 | char file_structure_version [ISODCL (882, 882)]; /* 711 */ | ||
59 | char unused4 [ISODCL (883, 883)]; | ||
60 | char application_data [ISODCL (884, 1395)]; | ||
61 | char unused5 [ISODCL (1396, 2048)]; | ||
62 | }; | ||
63 | |||
64 | /* Almost the same as the primary descriptor but two fields are specified */ | ||
65 | struct iso_supplementary_descriptor { | ||
66 | char type [ISODCL ( 1, 1)]; /* 711 */ | ||
67 | char id [ISODCL ( 2, 6)]; | ||
68 | char version [ISODCL ( 7, 7)]; /* 711 */ | ||
69 | char flags [ISODCL ( 8, 8)]; /* 853 */ | ||
70 | char system_id [ISODCL ( 9, 40)]; /* achars */ | ||
71 | char volume_id [ISODCL ( 41, 72)]; /* dchars */ | ||
72 | char unused2 [ISODCL ( 73, 80)]; | ||
73 | char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ | ||
74 | char escape [ISODCL ( 89, 120)]; /* 856 */ | ||
75 | char volume_set_size [ISODCL (121, 124)]; /* 723 */ | ||
76 | char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ | ||
77 | char logical_block_size [ISODCL (129, 132)]; /* 723 */ | ||
78 | char path_table_size [ISODCL (133, 140)]; /* 733 */ | ||
79 | char type_l_path_table [ISODCL (141, 144)]; /* 731 */ | ||
80 | char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ | ||
81 | char type_m_path_table [ISODCL (149, 152)]; /* 732 */ | ||
82 | char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ | ||
83 | char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ | ||
84 | char volume_set_id [ISODCL (191, 318)]; /* dchars */ | ||
85 | char publisher_id [ISODCL (319, 446)]; /* achars */ | ||
86 | char preparer_id [ISODCL (447, 574)]; /* achars */ | ||
87 | char application_id [ISODCL (575, 702)]; /* achars */ | ||
88 | char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ | ||
89 | char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ | ||
90 | char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ | ||
91 | char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ | ||
92 | char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ | ||
93 | char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ | ||
94 | char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ | ||
95 | char file_structure_version [ISODCL (882, 882)]; /* 711 */ | ||
96 | char unused4 [ISODCL (883, 883)]; | ||
97 | char application_data [ISODCL (884, 1395)]; | ||
98 | char unused5 [ISODCL (1396, 2048)]; | ||
99 | }; | ||
100 | |||
101 | |||
102 | #define HS_STANDARD_ID "CDROM" | ||
103 | |||
104 | struct hs_volume_descriptor { | ||
105 | char foo [ISODCL ( 1, 8)]; /* 733 */ | ||
106 | char type [ISODCL ( 9, 9)]; /* 711 */ | ||
107 | char id [ISODCL ( 10, 14)]; | ||
108 | char version [ISODCL ( 15, 15)]; /* 711 */ | ||
109 | char data[ISODCL(16,2048)]; | ||
110 | }; | ||
111 | |||
112 | |||
113 | struct hs_primary_descriptor { | ||
114 | char foo [ISODCL ( 1, 8)]; /* 733 */ | ||
115 | char type [ISODCL ( 9, 9)]; /* 711 */ | ||
116 | char id [ISODCL ( 10, 14)]; | ||
117 | char version [ISODCL ( 15, 15)]; /* 711 */ | ||
118 | char unused1 [ISODCL ( 16, 16)]; /* 711 */ | ||
119 | char system_id [ISODCL ( 17, 48)]; /* achars */ | ||
120 | char volume_id [ISODCL ( 49, 80)]; /* dchars */ | ||
121 | char unused2 [ISODCL ( 81, 88)]; /* 733 */ | ||
122 | char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ | ||
123 | char unused3 [ISODCL ( 97, 128)]; /* 733 */ | ||
124 | char volume_set_size [ISODCL (129, 132)]; /* 723 */ | ||
125 | char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ | ||
126 | char logical_block_size [ISODCL (137, 140)]; /* 723 */ | ||
127 | char path_table_size [ISODCL (141, 148)]; /* 733 */ | ||
128 | char type_l_path_table [ISODCL (149, 152)]; /* 731 */ | ||
129 | char unused4 [ISODCL (153, 180)]; /* 733 */ | ||
130 | char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ | ||
131 | }; | ||
132 | |||
133 | /* We use this to help us look up the parent inode numbers. */ | ||
134 | |||
135 | struct iso_path_table{ | ||
136 | unsigned char name_len[2]; /* 721 */ | ||
137 | char extent[4]; /* 731 */ | ||
138 | char parent[2]; /* 721 */ | ||
139 | char name[0]; | ||
140 | } __attribute__((packed)); | ||
141 | |||
142 | /* high sierra is identical to iso, except that the date is only 6 bytes, and | ||
143 | there is an extra reserved byte after the flags */ | ||
144 | |||
145 | struct iso_directory_record { | ||
146 | char length [ISODCL (1, 1)]; /* 711 */ | ||
147 | char ext_attr_length [ISODCL (2, 2)]; /* 711 */ | ||
148 | char extent [ISODCL (3, 10)]; /* 733 */ | ||
149 | char size [ISODCL (11, 18)]; /* 733 */ | ||
150 | char date [ISODCL (19, 25)]; /* 7 by 711 */ | ||
151 | char flags [ISODCL (26, 26)]; | ||
152 | char file_unit_size [ISODCL (27, 27)]; /* 711 */ | ||
153 | char interleave [ISODCL (28, 28)]; /* 711 */ | ||
154 | char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ | ||
155 | unsigned char name_len [ISODCL (33, 33)]; /* 711 */ | ||
156 | char name [0]; | ||
157 | } __attribute__((packed)); | ||
158 | |||
159 | #define ISOFS_BLOCK_BITS 11 | ||
160 | #define ISOFS_BLOCK_SIZE 2048 | ||
161 | |||
162 | #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) | ||
163 | #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) | ||
164 | |||
165 | #endif /* _ISOFS_FS_H */ | ||
diff --git a/include/linux/istallion.h b/include/linux/istallion.h new file mode 100644 index 00000000000..ad700a60c15 --- /dev/null +++ b/include/linux/istallion.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /*****************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * istallion.h -- stallion intelligent multiport serial driver. | ||
5 | * | ||
6 | * Copyright (C) 1996-1998 Stallion Technologies | ||
7 | * Copyright (C) 1994-1996 Greg Ungerer. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | /*****************************************************************************/ | ||
25 | #ifndef _ISTALLION_H | ||
26 | #define _ISTALLION_H | ||
27 | /*****************************************************************************/ | ||
28 | |||
29 | /* | ||
30 | * Define important driver constants here. | ||
31 | */ | ||
32 | #define STL_MAXBRDS 4 | ||
33 | #define STL_MAXPANELS 4 | ||
34 | #define STL_MAXPORTS 64 | ||
35 | #define STL_MAXCHANS (STL_MAXPORTS + 1) | ||
36 | #define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) | ||
37 | |||
38 | |||
39 | /* | ||
40 | * Define a set of structures to hold all the board/panel/port info | ||
41 | * for our ports. These will be dynamically allocated as required at | ||
42 | * driver initialization time. | ||
43 | */ | ||
44 | |||
45 | /* | ||
46 | * Port and board structures to hold status info about each object. | ||
47 | * The board structure contains pointers to structures for each port | ||
48 | * connected to it. Panels are not distinguished here, since | ||
49 | * communication with the slave board will always be on a per port | ||
50 | * basis. | ||
51 | */ | ||
52 | struct stliport { | ||
53 | unsigned long magic; | ||
54 | struct tty_port port; | ||
55 | unsigned int portnr; | ||
56 | unsigned int panelnr; | ||
57 | unsigned int brdnr; | ||
58 | unsigned long state; | ||
59 | unsigned int devnr; | ||
60 | int baud_base; | ||
61 | int custom_divisor; | ||
62 | int closing_wait; | ||
63 | int rc; | ||
64 | int argsize; | ||
65 | void *argp; | ||
66 | unsigned int rxmarkmsk; | ||
67 | wait_queue_head_t raw_wait; | ||
68 | struct asysigs asig; | ||
69 | unsigned long addr; | ||
70 | unsigned long rxoffset; | ||
71 | unsigned long txoffset; | ||
72 | unsigned long sigs; | ||
73 | unsigned long pflag; | ||
74 | unsigned int rxsize; | ||
75 | unsigned int txsize; | ||
76 | unsigned char reqbit; | ||
77 | unsigned char portidx; | ||
78 | unsigned char portbit; | ||
79 | }; | ||
80 | |||
81 | /* | ||
82 | * Use a structure of function pointers to do board level operations. | ||
83 | * These include, enable/disable, paging shared memory, interrupting, etc. | ||
84 | */ | ||
85 | struct stlibrd { | ||
86 | unsigned long magic; | ||
87 | unsigned int brdnr; | ||
88 | unsigned int brdtype; | ||
89 | unsigned long state; | ||
90 | unsigned int nrpanels; | ||
91 | unsigned int nrports; | ||
92 | unsigned int nrdevs; | ||
93 | unsigned int iobase; | ||
94 | int iosize; | ||
95 | unsigned long memaddr; | ||
96 | void __iomem *membase; | ||
97 | unsigned long memsize; | ||
98 | int pagesize; | ||
99 | int hostoffset; | ||
100 | int slaveoffset; | ||
101 | int bitsize; | ||
102 | int enabval; | ||
103 | unsigned int panels[STL_MAXPANELS]; | ||
104 | int panelids[STL_MAXPANELS]; | ||
105 | void (*init)(struct stlibrd *brdp); | ||
106 | void (*enable)(struct stlibrd *brdp); | ||
107 | void (*reenable)(struct stlibrd *brdp); | ||
108 | void (*disable)(struct stlibrd *brdp); | ||
109 | void __iomem *(*getmemptr)(struct stlibrd *brdp, unsigned long offset, int line); | ||
110 | void (*intr)(struct stlibrd *brdp); | ||
111 | void (*reset)(struct stlibrd *brdp); | ||
112 | struct stliport *ports[STL_MAXPORTS]; | ||
113 | }; | ||
114 | |||
115 | |||
116 | /* | ||
117 | * Define MAGIC numbers used for above structures. | ||
118 | */ | ||
119 | #define STLI_PORTMAGIC 0xe671c7a1 | ||
120 | #define STLI_BOARDMAGIC 0x4bc6c825 | ||
121 | |||
122 | /*****************************************************************************/ | ||
123 | #endif | ||
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h new file mode 100644 index 00000000000..062d20f7432 --- /dev/null +++ b/include/linux/ivtv.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | Public ivtv API header | ||
3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> | ||
4 | Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_IVTV_H__ | ||
22 | #define __LINUX_IVTV_H__ | ||
23 | |||
24 | #include <linux/compiler.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/videodev2.h> | ||
27 | |||
28 | /* ivtv knows several distinct output modes: MPEG streaming, | ||
29 | YUV streaming, YUV updates through user DMA and the passthrough | ||
30 | mode. | ||
31 | |||
32 | In order to clearly tell the driver that we are in user DMA | ||
33 | YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL | ||
34 | first (althrough if you don't then the first time | ||
35 | DMA_FRAME is called the mode switch is done automatically). | ||
36 | |||
37 | When you close the file handle the user DMA mode is exited again. | ||
38 | |||
39 | While in one mode, you cannot use another mode (EBUSY is returned). | ||
40 | |||
41 | All this means that if you want to change the YUV interlacing | ||
42 | for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME | ||
43 | with y_source == NULL before you can set the correct format using | ||
44 | VIDIOC_S_FMT. | ||
45 | |||
46 | Eventually all this should be replaced with a proper V4L2 API, | ||
47 | but for now we have to do it this way. */ | ||
48 | |||
49 | struct ivtv_dma_frame { | ||
50 | enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */ | ||
51 | __u32 pixelformat; /* 0 == same as destination */ | ||
52 | void __user *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, | ||
53 | then just switch to user DMA YUV output mode */ | ||
54 | void __user *uv_source; /* Unused for RGB pixelformats */ | ||
55 | struct v4l2_rect src; | ||
56 | struct v4l2_rect dst; | ||
57 | __u32 src_width; | ||
58 | __u32 src_height; | ||
59 | }; | ||
60 | |||
61 | #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) | ||
62 | |||
63 | /* Deprecated defines: applications should use the defines from videodev2.h */ | ||
64 | #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B | ||
65 | #define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525 | ||
66 | #define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625 | ||
67 | #define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS | ||
68 | |||
69 | #endif /* _LINUX_IVTV_H */ | ||
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h new file mode 100644 index 00000000000..e8b92f67f10 --- /dev/null +++ b/include/linux/ivtvfb.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | On Screen Display cx23415 Framebuffer driver | ||
3 | |||
4 | Copyright (C) 2006, 2007 Ian Armstrong <ian@iarmst.demon.co.uk> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_IVTVFB_H__ | ||
22 | #define __LINUX_IVTVFB_H__ | ||
23 | |||
24 | #include <linux/compiler.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | /* Framebuffer external API */ | ||
28 | |||
29 | struct ivtvfb_dma_frame { | ||
30 | void __user *source; | ||
31 | unsigned long dest_offset; | ||
32 | int count; | ||
33 | }; | ||
34 | |||
35 | #define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) | ||
36 | |||
37 | #endif | ||
diff --git a/include/linux/ixjuser.h b/include/linux/ixjuser.h new file mode 100644 index 00000000000..94ab5e942e5 --- /dev/null +++ b/include/linux/ixjuser.h | |||
@@ -0,0 +1,720 @@ | |||
1 | #ifndef __LINUX_IXJUSER_H | ||
2 | #define __LINUX_IXJUSER_H | ||
3 | |||
4 | /****************************************************************************** | ||
5 | * | ||
6 | * ixjuser.h | ||
7 | * | ||
8 | * Device Driver for Quicknet Technologies, Inc.'s Telephony cards | ||
9 | * including the Internet PhoneJACK, Internet PhoneJACK Lite, | ||
10 | * Internet PhoneJACK PCI, Internet LineJACK, Internet PhoneCARD and | ||
11 | * SmartCABLE | ||
12 | * | ||
13 | * (c) Copyright 1999-2001 Quicknet Technologies, Inc. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version | ||
18 | * 2 of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * Author: Ed Okerson, <eokerson@quicknet.net> | ||
21 | * | ||
22 | * Contributors: Greg Herlein, <gherlein@quicknet.net> | ||
23 | * David W. Erhart, <derhart@quicknet.net> | ||
24 | * John Sellers, <jsellers@quicknet.net> | ||
25 | * Mike Preston, <mpreston@quicknet.net> | ||
26 | * | ||
27 | * More information about the hardware related to this driver can be found | ||
28 | * at our website: http://www.quicknet.net | ||
29 | * | ||
30 | * Fixes: | ||
31 | * | ||
32 | * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR | ||
33 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT | ||
34 | * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET | ||
35 | * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
36 | * | ||
37 | * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, | ||
38 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
39 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | ||
40 | * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION | ||
41 | * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | ||
42 | * | ||
43 | *****************************************************************************/ | ||
44 | |||
45 | #include <linux/telephony.h> | ||
46 | |||
47 | |||
48 | /****************************************************************************** | ||
49 | * | ||
50 | * IOCTL's used for the Quicknet Telephony Cards | ||
51 | * | ||
52 | * If you use the IXJCTL_TESTRAM command, the card must be power cycled to | ||
53 | * reset the SRAM values before further use. | ||
54 | * | ||
55 | ******************************************************************************/ | ||
56 | |||
57 | #define IXJCTL_DSP_RESET _IO ('q', 0xC0) | ||
58 | |||
59 | #define IXJCTL_RING PHONE_RING | ||
60 | #define IXJCTL_HOOKSTATE PHONE_HOOKSTATE | ||
61 | #define IXJCTL_MAXRINGS PHONE_MAXRINGS | ||
62 | #define IXJCTL_RING_CADENCE PHONE_RING_CADENCE | ||
63 | #define IXJCTL_RING_START PHONE_RING_START | ||
64 | #define IXJCTL_RING_STOP PHONE_RING_STOP | ||
65 | |||
66 | #define IXJCTL_CARDTYPE _IOR ('q', 0xC1, int) | ||
67 | #define IXJCTL_SERIAL _IOR ('q', 0xC2, int) | ||
68 | #define IXJCTL_DSP_TYPE _IOR ('q', 0xC3, int) | ||
69 | #define IXJCTL_DSP_VERSION _IOR ('q', 0xC4, int) | ||
70 | #define IXJCTL_VERSION _IOR ('q', 0xDA, char *) | ||
71 | #define IXJCTL_DSP_IDLE _IO ('q', 0xC5) | ||
72 | #define IXJCTL_TESTRAM _IO ('q', 0xC6) | ||
73 | |||
74 | /****************************************************************************** | ||
75 | * | ||
76 | * This group of IOCTLs deal with the record settings of the DSP | ||
77 | * | ||
78 | * The IXJCTL_REC_DEPTH command sets the internal buffer depth of the DSP. | ||
79 | * Setting a lower depth reduces latency, but increases the demand of the | ||
80 | * application to service the driver without frame loss. The DSP has 480 | ||
81 | * bytes of physical buffer memory for the record channel so the true | ||
82 | * maximum limit is determined by how many frames will fit in the buffer. | ||
83 | * | ||
84 | * 1 uncompressed (480 byte) 16-bit linear frame. | ||
85 | * 2 uncompressed (240 byte) 8-bit A-law/mu-law frames. | ||
86 | * 15 TrueSpeech 8.5 frames. | ||
87 | * 20 TrueSpeech 6.3,5.3,4.8 or 4.1 frames. | ||
88 | * | ||
89 | * The default in the driver is currently set to 2 frames. | ||
90 | * | ||
91 | * The IXJCTL_REC_VOLUME and IXJCTL_PLAY_VOLUME commands both use a Q8 | ||
92 | * number as a parameter, 0x100 scales the signal by 1.0, 0x200 scales the | ||
93 | * signal by 2.0, 0x80 scales the signal by 0.5. No protection is given | ||
94 | * against over-scaling, if the multiplication factor times the input | ||
95 | * signal exceeds 16 bits, overflow distortion will occur. The default | ||
96 | * setting is 0x100 (1.0). | ||
97 | * | ||
98 | * The IXJCTL_REC_LEVEL returns the average signal level (not r.m.s.) on | ||
99 | * the most recently recorded frame as a 16 bit value. | ||
100 | ******************************************************************************/ | ||
101 | |||
102 | #define IXJCTL_REC_CODEC PHONE_REC_CODEC | ||
103 | #define IXJCTL_REC_START PHONE_REC_START | ||
104 | #define IXJCTL_REC_STOP PHONE_REC_STOP | ||
105 | #define IXJCTL_REC_DEPTH PHONE_REC_DEPTH | ||
106 | #define IXJCTL_FRAME PHONE_FRAME | ||
107 | #define IXJCTL_REC_VOLUME PHONE_REC_VOLUME | ||
108 | #define IXJCTL_REC_LEVEL PHONE_REC_LEVEL | ||
109 | |||
110 | typedef enum { | ||
111 | f300_640 = 4, f300_500, f1100, f350, f400, f480, f440, f620, f20_50, | ||
112 | f133_200, f300, f300_420, f330, f300_425, f330_440, f340, f350_400, | ||
113 | f350_440, f350_450, f360, f380_420, f392, f400_425, f400_440, f400_450, | ||
114 | f420, f425, f425_450, f425_475, f435, f440_450, f440_480, f445, f450, | ||
115 | f452, f475, f480_620, f494, f500, f520, f523, f525, f540_660, f587, | ||
116 | f590, f600, f660, f700, f740, f750, f750_1450, f770, f800, f816, f850, | ||
117 | f857_1645, f900, f900_1300, f935_1215, f941_1477, f942, f950, f950_1400, | ||
118 | f975, f1000, f1020, f1050, f1100_1750, f1140, f1200, f1209, f1330, f1336, | ||
119 | lf1366, f1380, f1400, f1477, f1600, f1633_1638, f1800, f1860 | ||
120 | } IXJ_FILTER_FREQ; | ||
121 | |||
122 | typedef struct { | ||
123 | unsigned int filter; | ||
124 | IXJ_FILTER_FREQ freq; | ||
125 | char enable; | ||
126 | } IXJ_FILTER; | ||
127 | |||
128 | typedef struct { | ||
129 | char enable; | ||
130 | char en_filter; | ||
131 | unsigned int filter; | ||
132 | unsigned int on1; | ||
133 | unsigned int off1; | ||
134 | unsigned int on2; | ||
135 | unsigned int off2; | ||
136 | unsigned int on3; | ||
137 | unsigned int off3; | ||
138 | } IXJ_FILTER_CADENCE; | ||
139 | |||
140 | #define IXJCTL_SET_FILTER _IOW ('q', 0xC7, IXJ_FILTER *) | ||
141 | #define IXJCTL_SET_FILTER_RAW _IOW ('q', 0xDD, IXJ_FILTER_RAW *) | ||
142 | #define IXJCTL_GET_FILTER_HIST _IOW ('q', 0xC8, int) | ||
143 | #define IXJCTL_FILTER_CADENCE _IOW ('q', 0xD6, IXJ_FILTER_CADENCE *) | ||
144 | #define IXJCTL_PLAY_CID _IO ('q', 0xD7) | ||
145 | /****************************************************************************** | ||
146 | * | ||
147 | * This IOCTL allows you to reassign values in the tone index table. The | ||
148 | * tone table has 32 entries (0 - 31), but the driver only allows entries | ||
149 | * 13 - 27 to be modified, entry 0 is reserved for silence and 1 - 12 are | ||
150 | * the standard DTMF digits and 28 - 31 are the DTMF tones for A, B, C & D. | ||
151 | * The positions used internally for Call Progress Tones are as follows: | ||
152 | * Dial Tone - 25 | ||
153 | * Ring Back - 26 | ||
154 | * Busy Signal - 27 | ||
155 | * | ||
156 | * The freq values are calculated as: | ||
157 | * freq = cos(2 * PI * frequency / 8000) | ||
158 | * | ||
159 | * The most commonly needed values are already calculated and listed in the | ||
160 | * enum IXJ_TONE_FREQ. Each tone index can have two frequencies with | ||
161 | * different gains, if you are only using a single frequency set the unused | ||
162 | * one to 0. | ||
163 | * | ||
164 | * The gain values range from 0 to 15 indicating +6dB to -24dB in 2dB | ||
165 | * increments. | ||
166 | * | ||
167 | ******************************************************************************/ | ||
168 | |||
169 | typedef enum { | ||
170 | hz20 = 0x7ffa, | ||
171 | hz50 = 0x7fe5, | ||
172 | hz133 = 0x7f4c, | ||
173 | hz200 = 0x7e6b, | ||
174 | hz261 = 0x7d50, /* .63 C1 */ | ||
175 | hz277 = 0x7cfa, /* .18 CS1 */ | ||
176 | hz293 = 0x7c9f, /* .66 D1 */ | ||
177 | hz300 = 0x7c75, | ||
178 | hz311 = 0x7c32, /* .13 DS1 */ | ||
179 | hz329 = 0x7bbf, /* .63 E1 */ | ||
180 | hz330 = 0x7bb8, | ||
181 | hz340 = 0x7b75, | ||
182 | hz349 = 0x7b37, /* .23 F1 */ | ||
183 | hz350 = 0x7b30, | ||
184 | hz360 = 0x7ae9, | ||
185 | hz369 = 0x7aa8, /* .99 FS1 */ | ||
186 | hz380 = 0x7a56, | ||
187 | hz392 = 0x79fa, /* .00 G1 */ | ||
188 | hz400 = 0x79bb, | ||
189 | hz415 = 0x7941, /* .30 GS1 */ | ||
190 | hz420 = 0x7918, | ||
191 | hz425 = 0x78ee, | ||
192 | hz435 = 0x7899, | ||
193 | hz440 = 0x786d, /* .00 A1 */ | ||
194 | hz445 = 0x7842, | ||
195 | hz450 = 0x7815, | ||
196 | hz452 = 0x7803, | ||
197 | hz466 = 0x7784, /* .16 AS1 */ | ||
198 | hz475 = 0x7731, | ||
199 | hz480 = 0x7701, | ||
200 | hz493 = 0x7685, /* .88 B1 */ | ||
201 | hz494 = 0x767b, | ||
202 | hz500 = 0x7640, | ||
203 | hz520 = 0x7578, | ||
204 | hz523 = 0x7559, /* .25 C2 */ | ||
205 | hz525 = 0x7544, | ||
206 | hz540 = 0x74a7, | ||
207 | hz554 = 0x7411, /* .37 CS2 */ | ||
208 | hz587 = 0x72a1, /* .33 D2 */ | ||
209 | hz590 = 0x727f, | ||
210 | hz600 = 0x720b, | ||
211 | hz620 = 0x711e, | ||
212 | hz622 = 0x7106, /* .25 DS2 */ | ||
213 | hz659 = 0x6f3b, /* .26 E2 */ | ||
214 | hz660 = 0x6f2e, | ||
215 | hz698 = 0x6d3d, /* .46 F2 */ | ||
216 | hz700 = 0x6d22, | ||
217 | hz739 = 0x6b09, /* .99 FS2 */ | ||
218 | hz740 = 0x6afa, | ||
219 | hz750 = 0x6a6c, | ||
220 | hz770 = 0x694b, | ||
221 | hz783 = 0x688b, /* .99 G2 */ | ||
222 | hz800 = 0x678d, | ||
223 | hz816 = 0x6698, | ||
224 | hz830 = 0x65bf, /* .61 GS2 */ | ||
225 | hz850 = 0x6484, | ||
226 | hz857 = 0x6414, | ||
227 | hz880 = 0x629f, /* .00 A2 */ | ||
228 | hz900 = 0x6154, | ||
229 | hz932 = 0x5f35, /* .33 AS2 */ | ||
230 | hz935 = 0x5f01, | ||
231 | hz941 = 0x5e9a, | ||
232 | hz942 = 0x5e88, | ||
233 | hz950 = 0x5dfd, | ||
234 | hz975 = 0x5c44, | ||
235 | hz1000 = 0x5a81, | ||
236 | hz1020 = 0x5912, | ||
237 | hz1050 = 0x56e2, | ||
238 | hz1100 = 0x5320, | ||
239 | hz1140 = 0x5007, | ||
240 | hz1200 = 0x4b3b, | ||
241 | hz1209 = 0x4a80, | ||
242 | hz1215 = 0x4a02, | ||
243 | hz1250 = 0x471c, | ||
244 | hz1300 = 0x42e0, | ||
245 | hz1330 = 0x4049, | ||
246 | hz1336 = 0x3fc4, | ||
247 | hz1366 = 0x3d22, | ||
248 | hz1380 = 0x3be4, | ||
249 | hz1400 = 0x3a1b, | ||
250 | hz1450 = 0x3596, | ||
251 | hz1477 = 0x331c, | ||
252 | hz1500 = 0x30fb, | ||
253 | hz1600 = 0x278d, | ||
254 | hz1633 = 0x2462, | ||
255 | hz1638 = 0x23e7, | ||
256 | hz1645 = 0x233a, | ||
257 | hz1750 = 0x18f8, | ||
258 | hz1800 = 0x1405, | ||
259 | hz1860 = 0xe0b, | ||
260 | hz2100 = 0xf5f6, | ||
261 | hz2130 = 0xf2f5, | ||
262 | hz2450 = 0xd3b3, | ||
263 | hz2750 = 0xb8e4 | ||
264 | } IXJ_FREQ; | ||
265 | |||
266 | typedef enum { | ||
267 | C1 = hz261, | ||
268 | CS1 = hz277, | ||
269 | D1 = hz293, | ||
270 | DS1 = hz311, | ||
271 | E1 = hz329, | ||
272 | F1 = hz349, | ||
273 | FS1 = hz369, | ||
274 | G1 = hz392, | ||
275 | GS1 = hz415, | ||
276 | A1 = hz440, | ||
277 | AS1 = hz466, | ||
278 | B1 = hz493, | ||
279 | C2 = hz523, | ||
280 | CS2 = hz554, | ||
281 | D2 = hz587, | ||
282 | DS2 = hz622, | ||
283 | E2 = hz659, | ||
284 | F2 = hz698, | ||
285 | FS2 = hz739, | ||
286 | G2 = hz783, | ||
287 | GS2 = hz830, | ||
288 | A2 = hz880, | ||
289 | AS2 = hz932, | ||
290 | } IXJ_NOTE; | ||
291 | |||
292 | typedef struct { | ||
293 | int tone_index; | ||
294 | int freq0; | ||
295 | int gain0; | ||
296 | int freq1; | ||
297 | int gain1; | ||
298 | } IXJ_TONE; | ||
299 | |||
300 | #define IXJCTL_INIT_TONE _IOW ('q', 0xC9, IXJ_TONE *) | ||
301 | |||
302 | /****************************************************************************** | ||
303 | * | ||
304 | * The IXJCTL_TONE_CADENCE ioctl defines tone sequences used for various | ||
305 | * Call Progress Tones (CPT). This is accomplished by setting up an array of | ||
306 | * IXJ_CADENCE_ELEMENT structures that sequentially define the states of | ||
307 | * the tone sequence. The tone_on_time and tone_off time are in | ||
308 | * 250 microsecond intervals. A pointer to this array is passed to the | ||
309 | * driver as the ce element of an IXJ_CADENCE structure. The elements_used | ||
310 | * must be set to the number of IXJ_CADENCE_ELEMENTS in the array. The | ||
311 | * termination variable defines what to do at the end of a cadence, the | ||
312 | * options are to play the cadence once and stop, to repeat the last | ||
313 | * element of the cadence indefinitely, or to repeat the entire cadence | ||
314 | * indefinitely. The ce variable is a pointer to the array of IXJ_TONE | ||
315 | * structures. If the freq0 variable is non-zero, the tone table contents | ||
316 | * for the tone_index are updated to the frequencies and gains defined. It | ||
317 | * should be noted that DTMF tones cannot be reassigned, so if DTMF tone | ||
318 | * table indexes are used in a cadence the frequency and gain variables will | ||
319 | * be ignored. | ||
320 | * | ||
321 | * If the array elements contain frequency parameters the driver will | ||
322 | * initialize the needed tone table elements and begin playing the tone, | ||
323 | * there is no preset limit on the number of elements in the cadence. If | ||
324 | * there is more than one frequency used in the cadence, sequential elements | ||
325 | * of different frequencies MUST use different tone table indexes. Only one | ||
326 | * cadence can be played at a time. It is possible to build complex | ||
327 | * cadences with multiple frequencies using 2 tone table indexes by | ||
328 | * alternating between them. | ||
329 | * | ||
330 | ******************************************************************************/ | ||
331 | |||
332 | typedef struct { | ||
333 | int index; | ||
334 | int tone_on_time; | ||
335 | int tone_off_time; | ||
336 | int freq0; | ||
337 | int gain0; | ||
338 | int freq1; | ||
339 | int gain1; | ||
340 | } IXJ_CADENCE_ELEMENT; | ||
341 | |||
342 | typedef enum { | ||
343 | PLAY_ONCE, | ||
344 | REPEAT_LAST_ELEMENT, | ||
345 | REPEAT_ALL | ||
346 | } IXJ_CADENCE_TERM; | ||
347 | |||
348 | typedef struct { | ||
349 | int elements_used; | ||
350 | IXJ_CADENCE_TERM termination; | ||
351 | IXJ_CADENCE_ELEMENT __user *ce; | ||
352 | } IXJ_CADENCE; | ||
353 | |||
354 | #define IXJCTL_TONE_CADENCE _IOW ('q', 0xCA, IXJ_CADENCE *) | ||
355 | /****************************************************************************** | ||
356 | * | ||
357 | * This group of IOCTLs deal with the playback settings of the DSP | ||
358 | * | ||
359 | ******************************************************************************/ | ||
360 | |||
361 | #define IXJCTL_PLAY_CODEC PHONE_PLAY_CODEC | ||
362 | #define IXJCTL_PLAY_START PHONE_PLAY_START | ||
363 | #define IXJCTL_PLAY_STOP PHONE_PLAY_STOP | ||
364 | #define IXJCTL_PLAY_DEPTH PHONE_PLAY_DEPTH | ||
365 | #define IXJCTL_PLAY_VOLUME PHONE_PLAY_VOLUME | ||
366 | #define IXJCTL_PLAY_LEVEL PHONE_PLAY_LEVEL | ||
367 | |||
368 | /****************************************************************************** | ||
369 | * | ||
370 | * This group of IOCTLs deal with the Acoustic Echo Cancellation settings | ||
371 | * of the DSP | ||
372 | * | ||
373 | * Issuing the IXJCTL_AEC_START command with a value of AEC_OFF has the | ||
374 | * same effect as IXJCTL_AEC_STOP. This is to simplify slider bar | ||
375 | * controls. IXJCTL_AEC_GET_LEVEL returns the current setting of the AEC. | ||
376 | ******************************************************************************/ | ||
377 | #define IXJCTL_AEC_START _IOW ('q', 0xCB, int) | ||
378 | #define IXJCTL_AEC_STOP _IO ('q', 0xCC) | ||
379 | #define IXJCTL_AEC_GET_LEVEL _IO ('q', 0xCD) | ||
380 | |||
381 | #define AEC_OFF 0 | ||
382 | #define AEC_LOW 1 | ||
383 | #define AEC_MED 2 | ||
384 | #define AEC_HIGH 3 | ||
385 | #define AEC_AUTO 4 | ||
386 | #define AEC_AGC 5 | ||
387 | /****************************************************************************** | ||
388 | * | ||
389 | * Call Progress Tones, DTMF, etc. | ||
390 | * IXJCTL_DTMF_OOB determines if DTMF signaling is sent as Out-Of-Band | ||
391 | * only. If you pass a 1, DTMF is suppressed from the audio stream. | ||
392 | * Tone on and off times are in 250 microsecond intervals so | ||
393 | * ioctl(ixj1, IXJCTL_SET_TONE_ON_TIME, 360); | ||
394 | * will set the tone on time of board ixj1 to 360 * 250us = 90ms | ||
395 | * the default values of tone on and off times is 840 or 210ms | ||
396 | ******************************************************************************/ | ||
397 | |||
398 | #define IXJCTL_DTMF_READY PHONE_DTMF_READY | ||
399 | #define IXJCTL_GET_DTMF PHONE_GET_DTMF | ||
400 | #define IXJCTL_GET_DTMF_ASCII PHONE_GET_DTMF_ASCII | ||
401 | #define IXJCTL_DTMF_OOB PHONE_DTMF_OOB | ||
402 | #define IXJCTL_EXCEPTION PHONE_EXCEPTION | ||
403 | #define IXJCTL_PLAY_TONE PHONE_PLAY_TONE | ||
404 | #define IXJCTL_SET_TONE_ON_TIME PHONE_SET_TONE_ON_TIME | ||
405 | #define IXJCTL_SET_TONE_OFF_TIME PHONE_SET_TONE_OFF_TIME | ||
406 | #define IXJCTL_GET_TONE_ON_TIME PHONE_GET_TONE_ON_TIME | ||
407 | #define IXJCTL_GET_TONE_OFF_TIME PHONE_GET_TONE_OFF_TIME | ||
408 | #define IXJCTL_GET_TONE_STATE PHONE_GET_TONE_STATE | ||
409 | #define IXJCTL_BUSY PHONE_BUSY | ||
410 | #define IXJCTL_RINGBACK PHONE_RINGBACK | ||
411 | #define IXJCTL_DIALTONE PHONE_DIALTONE | ||
412 | #define IXJCTL_CPT_STOP PHONE_CPT_STOP | ||
413 | |||
414 | /****************************************************************************** | ||
415 | * LineJACK specific IOCTLs | ||
416 | * | ||
417 | * The lsb 4 bits of the LED argument represent the state of each of the 4 | ||
418 | * LED's on the LineJACK | ||
419 | ******************************************************************************/ | ||
420 | |||
421 | #define IXJCTL_SET_LED _IOW ('q', 0xCE, int) | ||
422 | #define IXJCTL_MIXER _IOW ('q', 0xCF, int) | ||
423 | |||
424 | /****************************************************************************** | ||
425 | * | ||
426 | * The master volume controls use attenuation with 32 levels from 0 to -62dB | ||
427 | * with steps of 2dB each, the defines should be OR'ed together then sent | ||
428 | * as the parameter to the mixer command to change the mixer settings. | ||
429 | * | ||
430 | ******************************************************************************/ | ||
431 | #define MIXER_MASTER_L 0x0000 | ||
432 | #define MIXER_MASTER_R 0x0100 | ||
433 | #define ATT00DB 0x00 | ||
434 | #define ATT02DB 0x01 | ||
435 | #define ATT04DB 0x02 | ||
436 | #define ATT06DB 0x03 | ||
437 | #define ATT08DB 0x04 | ||
438 | #define ATT10DB 0x05 | ||
439 | #define ATT12DB 0x06 | ||
440 | #define ATT14DB 0x07 | ||
441 | #define ATT16DB 0x08 | ||
442 | #define ATT18DB 0x09 | ||
443 | #define ATT20DB 0x0A | ||
444 | #define ATT22DB 0x0B | ||
445 | #define ATT24DB 0x0C | ||
446 | #define ATT26DB 0x0D | ||
447 | #define ATT28DB 0x0E | ||
448 | #define ATT30DB 0x0F | ||
449 | #define ATT32DB 0x10 | ||
450 | #define ATT34DB 0x11 | ||
451 | #define ATT36DB 0x12 | ||
452 | #define ATT38DB 0x13 | ||
453 | #define ATT40DB 0x14 | ||
454 | #define ATT42DB 0x15 | ||
455 | #define ATT44DB 0x16 | ||
456 | #define ATT46DB 0x17 | ||
457 | #define ATT48DB 0x18 | ||
458 | #define ATT50DB 0x19 | ||
459 | #define ATT52DB 0x1A | ||
460 | #define ATT54DB 0x1B | ||
461 | #define ATT56DB 0x1C | ||
462 | #define ATT58DB 0x1D | ||
463 | #define ATT60DB 0x1E | ||
464 | #define ATT62DB 0x1F | ||
465 | #define MASTER_MUTE 0x80 | ||
466 | |||
467 | /****************************************************************************** | ||
468 | * | ||
469 | * The input volume controls use gain with 32 levels from +12dB to -50dB | ||
470 | * with steps of 2dB each, the defines should be OR'ed together then sent | ||
471 | * as the parameter to the mixer command to change the mixer settings. | ||
472 | * | ||
473 | ******************************************************************************/ | ||
474 | #define MIXER_PORT_CD_L 0x0600 | ||
475 | #define MIXER_PORT_CD_R 0x0700 | ||
476 | #define MIXER_PORT_LINE_IN_L 0x0800 | ||
477 | #define MIXER_PORT_LINE_IN_R 0x0900 | ||
478 | #define MIXER_PORT_POTS_REC 0x0C00 | ||
479 | #define MIXER_PORT_MIC 0x0E00 | ||
480 | |||
481 | #define GAIN12DB 0x00 | ||
482 | #define GAIN10DB 0x01 | ||
483 | #define GAIN08DB 0x02 | ||
484 | #define GAIN06DB 0x03 | ||
485 | #define GAIN04DB 0x04 | ||
486 | #define GAIN02DB 0x05 | ||
487 | #define GAIN00DB 0x06 | ||
488 | #define GAIN_02DB 0x07 | ||
489 | #define GAIN_04DB 0x08 | ||
490 | #define GAIN_06DB 0x09 | ||
491 | #define GAIN_08DB 0x0A | ||
492 | #define GAIN_10DB 0x0B | ||
493 | #define GAIN_12DB 0x0C | ||
494 | #define GAIN_14DB 0x0D | ||
495 | #define GAIN_16DB 0x0E | ||
496 | #define GAIN_18DB 0x0F | ||
497 | #define GAIN_20DB 0x10 | ||
498 | #define GAIN_22DB 0x11 | ||
499 | #define GAIN_24DB 0x12 | ||
500 | #define GAIN_26DB 0x13 | ||
501 | #define GAIN_28DB 0x14 | ||
502 | #define GAIN_30DB 0x15 | ||
503 | #define GAIN_32DB 0x16 | ||
504 | #define GAIN_34DB 0x17 | ||
505 | #define GAIN_36DB 0x18 | ||
506 | #define GAIN_38DB 0x19 | ||
507 | #define GAIN_40DB 0x1A | ||
508 | #define GAIN_42DB 0x1B | ||
509 | #define GAIN_44DB 0x1C | ||
510 | #define GAIN_46DB 0x1D | ||
511 | #define GAIN_48DB 0x1E | ||
512 | #define GAIN_50DB 0x1F | ||
513 | #define INPUT_MUTE 0x80 | ||
514 | |||
515 | /****************************************************************************** | ||
516 | * | ||
517 | * The POTS volume control use attenuation with 8 levels from 0dB to -28dB | ||
518 | * with steps of 4dB each, the defines should be OR'ed together then sent | ||
519 | * as the parameter to the mixer command to change the mixer settings. | ||
520 | * | ||
521 | ******************************************************************************/ | ||
522 | #define MIXER_PORT_POTS_PLAY 0x0F00 | ||
523 | |||
524 | #define POTS_ATT_00DB 0x00 | ||
525 | #define POTS_ATT_04DB 0x01 | ||
526 | #define POTS_ATT_08DB 0x02 | ||
527 | #define POTS_ATT_12DB 0x03 | ||
528 | #define POTS_ATT_16DB 0x04 | ||
529 | #define POTS_ATT_20DB 0x05 | ||
530 | #define POTS_ATT_24DB 0x06 | ||
531 | #define POTS_ATT_28DB 0x07 | ||
532 | #define POTS_MUTE 0x80 | ||
533 | |||
534 | /****************************************************************************** | ||
535 | * | ||
536 | * The DAA controls the interface to the PSTN port. The driver loads the | ||
537 | * US coefficients by default, so if you live in a different country you | ||
538 | * need to load the set for your countries phone system. | ||
539 | * | ||
540 | ******************************************************************************/ | ||
541 | #define IXJCTL_DAA_COEFF_SET _IOW ('q', 0xD0, int) | ||
542 | |||
543 | #define DAA_US 1 /*PITA 8kHz */ | ||
544 | #define DAA_UK 2 /*ISAR34 8kHz */ | ||
545 | #define DAA_FRANCE 3 /* */ | ||
546 | #define DAA_GERMANY 4 | ||
547 | #define DAA_AUSTRALIA 5 | ||
548 | #define DAA_JAPAN 6 | ||
549 | |||
550 | /****************************************************************************** | ||
551 | * | ||
552 | * Use IXJCTL_PORT to set or query the port the card is set to. If the | ||
553 | * argument is set to PORT_QUERY, the return value of the ioctl will | ||
554 | * indicate which port is currently in use, otherwise it will change the | ||
555 | * port. | ||
556 | * | ||
557 | ******************************************************************************/ | ||
558 | #define IXJCTL_PORT _IOW ('q', 0xD1, int) | ||
559 | |||
560 | #define PORT_QUERY 0 | ||
561 | #define PORT_POTS 1 | ||
562 | #define PORT_PSTN 2 | ||
563 | #define PORT_SPEAKER 3 | ||
564 | #define PORT_HANDSET 4 | ||
565 | |||
566 | #define IXJCTL_PSTN_SET_STATE PHONE_PSTN_SET_STATE | ||
567 | #define IXJCTL_PSTN_GET_STATE PHONE_PSTN_GET_STATE | ||
568 | |||
569 | #define PSTN_ON_HOOK 0 | ||
570 | #define PSTN_RINGING 1 | ||
571 | #define PSTN_OFF_HOOK 2 | ||
572 | #define PSTN_PULSE_DIAL 3 | ||
573 | |||
574 | /****************************************************************************** | ||
575 | * | ||
576 | * The DAA Analog GAIN sets 2 parameters at one time, the receive gain (AGRR), | ||
577 | * and the transmit gain (AGX). OR together the components and pass them | ||
578 | * as the parameter to IXJCTL_DAA_AGAIN. The default setting is both at 0dB. | ||
579 | * | ||
580 | ******************************************************************************/ | ||
581 | #define IXJCTL_DAA_AGAIN _IOW ('q', 0xD2, int) | ||
582 | |||
583 | #define AGRR00DB 0x00 /* Analog gain in receive direction 0dB */ | ||
584 | #define AGRR3_5DB 0x10 /* Analog gain in receive direction 3.5dB */ | ||
585 | #define AGRR06DB 0x30 /* Analog gain in receive direction 6dB */ | ||
586 | |||
587 | #define AGX00DB 0x00 /* Analog gain in transmit direction 0dB */ | ||
588 | #define AGX_6DB 0x04 /* Analog gain in transmit direction -6dB */ | ||
589 | #define AGX3_5DB 0x08 /* Analog gain in transmit direction 3.5dB */ | ||
590 | #define AGX_2_5B 0x0C /* Analog gain in transmit direction -2.5dB */ | ||
591 | |||
592 | #define IXJCTL_PSTN_LINETEST _IO ('q', 0xD3) | ||
593 | |||
594 | #define IXJCTL_CID _IOR ('q', 0xD4, PHONE_CID *) | ||
595 | #define IXJCTL_VMWI _IOR ('q', 0xD8, int) | ||
596 | #define IXJCTL_CIDCW _IOW ('q', 0xD9, PHONE_CID *) | ||
597 | /****************************************************************************** | ||
598 | * | ||
599 | * The wink duration is tunable with this ioctl. The default wink duration | ||
600 | * is 320ms. You do not need to use this ioctl if you do not require a | ||
601 | * different wink duration. | ||
602 | * | ||
603 | ******************************************************************************/ | ||
604 | #define IXJCTL_WINK_DURATION PHONE_WINK_DURATION | ||
605 | |||
606 | /****************************************************************************** | ||
607 | * | ||
608 | * This ioctl will connect the POTS port to the PSTN port on the LineJACK | ||
609 | * In order for this to work properly the port selection should be set to | ||
610 | * the PSTN port with IXJCTL_PORT prior to calling this ioctl. This will | ||
611 | * enable conference calls between PSTN callers and network callers. | ||
612 | * Passing a 1 to this ioctl enables the POTS<->PSTN connection while | ||
613 | * passing a 0 turns it back off. | ||
614 | * | ||
615 | ******************************************************************************/ | ||
616 | #define IXJCTL_POTS_PSTN _IOW ('q', 0xD5, int) | ||
617 | |||
618 | /****************************************************************************** | ||
619 | * | ||
620 | * IOCTLs added by request. | ||
621 | * | ||
622 | * IXJCTL_HZ sets the value your Linux kernel uses for HZ as defined in | ||
623 | * /usr/include/asm/param.h, this determines the fundamental | ||
624 | * frequency of the clock ticks on your Linux system. The kernel | ||
625 | * must be rebuilt if you change this value, also all modules you | ||
626 | * use (except this one) must be recompiled. The default value | ||
627 | * is 100, and you only need to use this IOCTL if you use some | ||
628 | * other value. | ||
629 | * | ||
630 | * | ||
631 | * IXJCTL_RATE sets the number of times per second that the driver polls | ||
632 | * the DSP. This value cannot be larger than HZ. By | ||
633 | * increasing both of these values, you may be able to reduce | ||
634 | * latency because the max hang time that can exist between the | ||
635 | * driver and the DSP will be reduced. | ||
636 | * | ||
637 | ******************************************************************************/ | ||
638 | |||
639 | #define IXJCTL_HZ _IOW ('q', 0xE0, int) | ||
640 | #define IXJCTL_RATE _IOW ('q', 0xE1, int) | ||
641 | #define IXJCTL_FRAMES_READ _IOR ('q', 0xE2, unsigned long) | ||
642 | #define IXJCTL_FRAMES_WRITTEN _IOR ('q', 0xE3, unsigned long) | ||
643 | #define IXJCTL_READ_WAIT _IOR ('q', 0xE4, unsigned long) | ||
644 | #define IXJCTL_WRITE_WAIT _IOR ('q', 0xE5, unsigned long) | ||
645 | #define IXJCTL_DRYBUFFER_READ _IOR ('q', 0xE6, unsigned long) | ||
646 | #define IXJCTL_DRYBUFFER_CLEAR _IO ('q', 0xE7) | ||
647 | #define IXJCTL_DTMF_PRESCALE _IOW ('q', 0xE8, int) | ||
648 | |||
649 | /****************************************************************************** | ||
650 | * | ||
651 | * This ioctl allows the user application to control what events the driver | ||
652 | * will send signals for, and what signals it will send for which event. | ||
653 | * By default, if signaling is enabled, all events will send SIGIO when | ||
654 | * they occur. To disable signals for an event set the signal to 0. | ||
655 | * | ||
656 | ******************************************************************************/ | ||
657 | typedef enum { | ||
658 | SIG_DTMF_READY, | ||
659 | SIG_HOOKSTATE, | ||
660 | SIG_FLASH, | ||
661 | SIG_PSTN_RING, | ||
662 | SIG_CALLER_ID, | ||
663 | SIG_PSTN_WINK, | ||
664 | SIG_F0, SIG_F1, SIG_F2, SIG_F3, | ||
665 | SIG_FC0, SIG_FC1, SIG_FC2, SIG_FC3, | ||
666 | SIG_READ_READY = 33, | ||
667 | SIG_WRITE_READY = 34 | ||
668 | } IXJ_SIGEVENT; | ||
669 | |||
670 | typedef struct { | ||
671 | unsigned int event; | ||
672 | int signal; | ||
673 | } IXJ_SIGDEF; | ||
674 | |||
675 | #define IXJCTL_SIGCTL _IOW ('q', 0xE9, IXJ_SIGDEF *) | ||
676 | |||
677 | /****************************************************************************** | ||
678 | * | ||
679 | * These ioctls allow the user application to change the gain in the | ||
680 | * Smart Cable of the Internet Phone Card. Sending -1 as a value will cause | ||
681 | * return value to be the current setting. Valid values to set are 0x00 - 0x1F | ||
682 | * | ||
683 | * 11111 = +12 dB | ||
684 | * 10111 = 0 dB | ||
685 | * 00000 = -34.5 dB | ||
686 | * | ||
687 | * IXJCTL_SC_RXG sets the Receive gain | ||
688 | * IXJCTL_SC_TXG sets the Transmit gain | ||
689 | * | ||
690 | ******************************************************************************/ | ||
691 | #define IXJCTL_SC_RXG _IOW ('q', 0xEA, int) | ||
692 | #define IXJCTL_SC_TXG _IOW ('q', 0xEB, int) | ||
693 | |||
694 | /****************************************************************************** | ||
695 | * | ||
696 | * The intercom IOCTL's short the output from one card to the input of the | ||
697 | * other and vice versa (actually done in the DSP read function). It is only | ||
698 | * necessary to execute the IOCTL on one card, but it is necessary to have | ||
699 | * both devices open to be able to detect hook switch changes. The record | ||
700 | * codec and rate of each card must match the playback codec and rate of | ||
701 | * the other card for this to work properly. | ||
702 | * | ||
703 | ******************************************************************************/ | ||
704 | |||
705 | #define IXJCTL_INTERCOM_START _IOW ('q', 0xFD, int) | ||
706 | #define IXJCTL_INTERCOM_STOP _IOW ('q', 0xFE, int) | ||
707 | |||
708 | /****************************************************************************** | ||
709 | * | ||
710 | * new structure for accessing raw filter information | ||
711 | * | ||
712 | ******************************************************************************/ | ||
713 | |||
714 | typedef struct { | ||
715 | unsigned int filter; | ||
716 | char enable; | ||
717 | unsigned int coeff[19]; | ||
718 | } IXJ_FILTER_RAW; | ||
719 | |||
720 | #endif | ||
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h new file mode 100644 index 00000000000..a18b719f49d --- /dev/null +++ b/include/linux/jffs2.h | |||
@@ -0,0 +1,223 @@ | |||
1 | /* | ||
2 | * JFFS2 -- Journalling Flash File System, Version 2. | ||
3 | * | ||
4 | * Copyright © 2001-2007 Red Hat, Inc. | ||
5 | * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org> | ||
6 | * | ||
7 | * Created by David Woodhouse <dwmw2@infradead.org> | ||
8 | * | ||
9 | * For licensing information, see the file 'LICENCE' in the | ||
10 | * jffs2 directory. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_JFFS2_H__ | ||
14 | #define __LINUX_JFFS2_H__ | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | #include <linux/magic.h> | ||
18 | |||
19 | /* You must include something which defines the C99 uintXX_t types. | ||
20 | We don't do it from here because this file is used in too many | ||
21 | different environments. */ | ||
22 | |||
23 | /* Values we may expect to find in the 'magic' field */ | ||
24 | #define JFFS2_OLD_MAGIC_BITMASK 0x1984 | ||
25 | #define JFFS2_MAGIC_BITMASK 0x1985 | ||
26 | #define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */ | ||
27 | #define JFFS2_EMPTY_BITMASK 0xffff | ||
28 | #define JFFS2_DIRTY_BITMASK 0x0000 | ||
29 | |||
30 | /* Summary node MAGIC marker */ | ||
31 | #define JFFS2_SUM_MAGIC 0x02851885 | ||
32 | |||
33 | /* We only allow a single char for length, and 0xFF is empty flash so | ||
34 | we don't want it confused with a real length. Hence max 254. | ||
35 | */ | ||
36 | #define JFFS2_MAX_NAME_LEN 254 | ||
37 | |||
38 | /* How small can we sensibly write nodes? */ | ||
39 | #define JFFS2_MIN_DATA_LEN 128 | ||
40 | |||
41 | #define JFFS2_COMPR_NONE 0x00 | ||
42 | #define JFFS2_COMPR_ZERO 0x01 | ||
43 | #define JFFS2_COMPR_RTIME 0x02 | ||
44 | #define JFFS2_COMPR_RUBINMIPS 0x03 | ||
45 | #define JFFS2_COMPR_COPY 0x04 | ||
46 | #define JFFS2_COMPR_DYNRUBIN 0x05 | ||
47 | #define JFFS2_COMPR_ZLIB 0x06 | ||
48 | #define JFFS2_COMPR_LZO 0x07 | ||
49 | /* Compatibility flags. */ | ||
50 | #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ | ||
51 | #define JFFS2_NODE_ACCURATE 0x2000 | ||
52 | /* INCOMPAT: Fail to mount the filesystem */ | ||
53 | #define JFFS2_FEATURE_INCOMPAT 0xc000 | ||
54 | /* ROCOMPAT: Mount read-only */ | ||
55 | #define JFFS2_FEATURE_ROCOMPAT 0x8000 | ||
56 | /* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ | ||
57 | #define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 | ||
58 | /* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ | ||
59 | #define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 | ||
60 | |||
61 | #define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) | ||
62 | #define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) | ||
63 | #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) | ||
64 | #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) | ||
65 | |||
66 | #define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) | ||
67 | |||
68 | #define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8) | ||
69 | #define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9) | ||
70 | |||
71 | /* XATTR Related */ | ||
72 | #define JFFS2_XPREFIX_USER 1 /* for "user." */ | ||
73 | #define JFFS2_XPREFIX_SECURITY 2 /* for "security." */ | ||
74 | #define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */ | ||
75 | #define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */ | ||
76 | #define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */ | ||
77 | |||
78 | #define JFFS2_ACL_VERSION 0x0001 | ||
79 | |||
80 | // Maybe later... | ||
81 | //#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) | ||
82 | //#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) | ||
83 | |||
84 | |||
85 | #define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at | ||
86 | mount time, don't wait for it to | ||
87 | happen later */ | ||
88 | #define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific | ||
89 | compression type */ | ||
90 | |||
91 | |||
92 | /* These can go once we've made sure we've caught all uses without | ||
93 | byteswapping */ | ||
94 | |||
95 | typedef struct { | ||
96 | __u32 v32; | ||
97 | } __attribute__((packed)) jint32_t; | ||
98 | |||
99 | typedef struct { | ||
100 | __u32 m; | ||
101 | } __attribute__((packed)) jmode_t; | ||
102 | |||
103 | typedef struct { | ||
104 | __u16 v16; | ||
105 | } __attribute__((packed)) jint16_t; | ||
106 | |||
107 | struct jffs2_unknown_node | ||
108 | { | ||
109 | /* All start like this */ | ||
110 | jint16_t magic; | ||
111 | jint16_t nodetype; | ||
112 | jint32_t totlen; /* So we can skip over nodes we don't grok */ | ||
113 | jint32_t hdr_crc; | ||
114 | }; | ||
115 | |||
116 | struct jffs2_raw_dirent | ||
117 | { | ||
118 | jint16_t magic; | ||
119 | jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ | ||
120 | jint32_t totlen; | ||
121 | jint32_t hdr_crc; | ||
122 | jint32_t pino; | ||
123 | jint32_t version; | ||
124 | jint32_t ino; /* == zero for unlink */ | ||
125 | jint32_t mctime; | ||
126 | __u8 nsize; | ||
127 | __u8 type; | ||
128 | __u8 unused[2]; | ||
129 | jint32_t node_crc; | ||
130 | jint32_t name_crc; | ||
131 | __u8 name[0]; | ||
132 | }; | ||
133 | |||
134 | /* The JFFS2 raw inode structure: Used for storage on physical media. */ | ||
135 | /* The uid, gid, atime, mtime and ctime members could be longer, but | ||
136 | are left like this for space efficiency. If and when people decide | ||
137 | they really need them extended, it's simple enough to add support for | ||
138 | a new type of raw node. | ||
139 | */ | ||
140 | struct jffs2_raw_inode | ||
141 | { | ||
142 | jint16_t magic; /* A constant magic number. */ | ||
143 | jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ | ||
144 | jint32_t totlen; /* Total length of this node (inc data, etc.) */ | ||
145 | jint32_t hdr_crc; | ||
146 | jint32_t ino; /* Inode number. */ | ||
147 | jint32_t version; /* Version number. */ | ||
148 | jmode_t mode; /* The file's type or mode. */ | ||
149 | jint16_t uid; /* The file's owner. */ | ||
150 | jint16_t gid; /* The file's group. */ | ||
151 | jint32_t isize; /* Total resultant size of this inode (used for truncations) */ | ||
152 | jint32_t atime; /* Last access time. */ | ||
153 | jint32_t mtime; /* Last modification time. */ | ||
154 | jint32_t ctime; /* Change time. */ | ||
155 | jint32_t offset; /* Where to begin to write. */ | ||
156 | jint32_t csize; /* (Compressed) data size */ | ||
157 | jint32_t dsize; /* Size of the node's data. (after decompression) */ | ||
158 | __u8 compr; /* Compression algorithm used */ | ||
159 | __u8 usercompr; /* Compression algorithm requested by the user */ | ||
160 | jint16_t flags; /* See JFFS2_INO_FLAG_* */ | ||
161 | jint32_t data_crc; /* CRC for the (compressed) data. */ | ||
162 | jint32_t node_crc; /* CRC for the raw inode (excluding data) */ | ||
163 | __u8 data[0]; | ||
164 | }; | ||
165 | |||
166 | struct jffs2_raw_xattr { | ||
167 | jint16_t magic; | ||
168 | jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */ | ||
169 | jint32_t totlen; | ||
170 | jint32_t hdr_crc; | ||
171 | jint32_t xid; /* XATTR identifier number */ | ||
172 | jint32_t version; | ||
173 | __u8 xprefix; | ||
174 | __u8 name_len; | ||
175 | jint16_t value_len; | ||
176 | jint32_t data_crc; | ||
177 | jint32_t node_crc; | ||
178 | __u8 data[0]; | ||
179 | } __attribute__((packed)); | ||
180 | |||
181 | struct jffs2_raw_xref | ||
182 | { | ||
183 | jint16_t magic; | ||
184 | jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */ | ||
185 | jint32_t totlen; | ||
186 | jint32_t hdr_crc; | ||
187 | jint32_t ino; /* inode number */ | ||
188 | jint32_t xid; /* XATTR identifier number */ | ||
189 | jint32_t xseqno; /* xref sequential number */ | ||
190 | jint32_t node_crc; | ||
191 | } __attribute__((packed)); | ||
192 | |||
193 | struct jffs2_raw_summary | ||
194 | { | ||
195 | jint16_t magic; | ||
196 | jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */ | ||
197 | jint32_t totlen; | ||
198 | jint32_t hdr_crc; | ||
199 | jint32_t sum_num; /* number of sum entries*/ | ||
200 | jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */ | ||
201 | jint32_t padded; /* sum of the size of padding nodes */ | ||
202 | jint32_t sum_crc; /* summary information crc */ | ||
203 | jint32_t node_crc; /* node crc */ | ||
204 | jint32_t sum[0]; /* inode summary info */ | ||
205 | }; | ||
206 | |||
207 | union jffs2_node_union | ||
208 | { | ||
209 | struct jffs2_raw_inode i; | ||
210 | struct jffs2_raw_dirent d; | ||
211 | struct jffs2_raw_xattr x; | ||
212 | struct jffs2_raw_xref r; | ||
213 | struct jffs2_raw_summary s; | ||
214 | struct jffs2_unknown_node u; | ||
215 | }; | ||
216 | |||
217 | /* Data payload for device nodes. */ | ||
218 | union jffs2_device_node { | ||
219 | jint16_t old_id; | ||
220 | jint32_t new_id; | ||
221 | }; | ||
222 | |||
223 | #endif /* __LINUX_JFFS2_H__ */ | ||
diff --git a/include/linux/keychord.h b/include/linux/keychord.h new file mode 100644 index 00000000000..856a5850217 --- /dev/null +++ b/include/linux/keychord.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Key chord input driver | ||
3 | * | ||
4 | * Copyright (C) 2008 Google, Inc. | ||
5 | * Author: Mike Lockwood <lockwood@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_KEYCHORD_H_ | ||
19 | #define __LINUX_KEYCHORD_H_ | ||
20 | |||
21 | #include <linux/input.h> | ||
22 | |||
23 | #define KEYCHORD_VERSION 1 | ||
24 | |||
25 | /* | ||
26 | * One or more input_keychord structs are written to /dev/keychord | ||
27 | * at once to specify the list of keychords to monitor. | ||
28 | * Reading /dev/keychord returns the id of a keychord when the | ||
29 | * keychord combination is pressed. A keychord is signalled when | ||
30 | * all of the keys in the keycode list are in the pressed state. | ||
31 | * The order in which the keys are pressed does not matter. | ||
32 | * The keychord will not be signalled if keys not in the keycode | ||
33 | * list are pressed. | ||
34 | * Keychords will not be signalled on key release events. | ||
35 | */ | ||
36 | struct input_keychord { | ||
37 | /* should be KEYCHORD_VERSION */ | ||
38 | __u16 version; | ||
39 | /* | ||
40 | * client specified ID, returned from read() | ||
41 | * when this keychord is pressed. | ||
42 | */ | ||
43 | __u16 id; | ||
44 | |||
45 | /* number of keycodes in this keychord */ | ||
46 | __u16 count; | ||
47 | |||
48 | /* variable length array of keycodes */ | ||
49 | __u16 keycodes[]; | ||
50 | }; | ||
51 | |||
52 | #endif /* __LINUX_KEYCHORD_H_ */ | ||
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h new file mode 100644 index 00000000000..9b0b865ce62 --- /dev/null +++ b/include/linux/keyctl.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* keyctl.h: keyctl command IDs | ||
2 | * | ||
3 | * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_KEYCTL_H | ||
13 | #define _LINUX_KEYCTL_H | ||
14 | |||
15 | /* special process keyring shortcut IDs */ | ||
16 | #define KEY_SPEC_THREAD_KEYRING -1 /* - key ID for thread-specific keyring */ | ||
17 | #define KEY_SPEC_PROCESS_KEYRING -2 /* - key ID for process-specific keyring */ | ||
18 | #define KEY_SPEC_SESSION_KEYRING -3 /* - key ID for session-specific keyring */ | ||
19 | #define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ | ||
20 | #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ | ||
21 | #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ | ||
22 | #define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ | ||
23 | #define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */ | ||
24 | |||
25 | /* request-key default keyrings */ | ||
26 | #define KEY_REQKEY_DEFL_NO_CHANGE -1 | ||
27 | #define KEY_REQKEY_DEFL_DEFAULT 0 | ||
28 | #define KEY_REQKEY_DEFL_THREAD_KEYRING 1 | ||
29 | #define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 | ||
30 | #define KEY_REQKEY_DEFL_SESSION_KEYRING 3 | ||
31 | #define KEY_REQKEY_DEFL_USER_KEYRING 4 | ||
32 | #define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 | ||
33 | #define KEY_REQKEY_DEFL_GROUP_KEYRING 6 | ||
34 | #define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7 | ||
35 | |||
36 | /* keyctl commands */ | ||
37 | #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ | ||
38 | #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ | ||
39 | #define KEYCTL_UPDATE 2 /* update a key */ | ||
40 | #define KEYCTL_REVOKE 3 /* revoke a key */ | ||
41 | #define KEYCTL_CHOWN 4 /* set ownership of a key */ | ||
42 | #define KEYCTL_SETPERM 5 /* set perms on a key */ | ||
43 | #define KEYCTL_DESCRIBE 6 /* describe a key */ | ||
44 | #define KEYCTL_CLEAR 7 /* clear contents of a keyring */ | ||
45 | #define KEYCTL_LINK 8 /* link a key into a keyring */ | ||
46 | #define KEYCTL_UNLINK 9 /* unlink a key from a keyring */ | ||
47 | #define KEYCTL_SEARCH 10 /* search for a key in a keyring */ | ||
48 | #define KEYCTL_READ 11 /* read a key or keyring's contents */ | ||
49 | #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ | ||
50 | #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ | ||
51 | #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ | ||
52 | #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ | ||
53 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ | ||
54 | #define KEYCTL_GET_SECURITY 17 /* get key security label */ | ||
55 | #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ | ||
56 | #define KEYCTL_REJECT 19 /* reject a partially constructed key */ | ||
57 | #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ | ||
58 | |||
59 | #endif /* _LINUX_KEYCTL_H */ | ||
diff --git a/include/linux/keyreset.h b/include/linux/keyreset.h new file mode 100644 index 00000000000..a2ac49e5b68 --- /dev/null +++ b/include/linux/keyreset.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * include/linux/keyreset.h - platform data structure for resetkeys driver | ||
3 | * | ||
4 | * Copyright (C) 2008 Google, Inc. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_KEYRESET_H | ||
18 | #define _LINUX_KEYRESET_H | ||
19 | |||
20 | #define KEYRESET_NAME "keyreset" | ||
21 | |||
22 | struct keyreset_platform_data { | ||
23 | int (*reset_fn)(void); | ||
24 | int *keys_up; | ||
25 | int keys_down[]; /* 0 terminated */ | ||
26 | }; | ||
27 | |||
28 | #endif /* _LINUX_KEYRESET_H */ | ||
diff --git a/include/linux/kvm.h b/include/linux/kvm.h new file mode 100644 index 00000000000..aace6b8691a --- /dev/null +++ b/include/linux/kvm.h | |||
@@ -0,0 +1,811 @@ | |||
1 | #ifndef __LINUX_KVM_H | ||
2 | #define __LINUX_KVM_H | ||
3 | |||
4 | /* | ||
5 | * Userspace interface for /dev/kvm - kernel based virtual machine | ||
6 | * | ||
7 | * Note: you must update KVM_API_VERSION if you change this interface. | ||
8 | */ | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/compiler.h> | ||
12 | #include <linux/ioctl.h> | ||
13 | #include <asm/kvm.h> | ||
14 | |||
15 | #define KVM_API_VERSION 12 | ||
16 | |||
17 | /* *** Deprecated interfaces *** */ | ||
18 | |||
19 | #define KVM_TRC_SHIFT 16 | ||
20 | |||
21 | #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) | ||
22 | #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) | ||
23 | |||
24 | #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) | ||
25 | #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) | ||
26 | #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) | ||
27 | |||
28 | #define KVM_TRC_HEAD_SIZE 12 | ||
29 | #define KVM_TRC_CYCLE_SIZE 8 | ||
30 | #define KVM_TRC_EXTRA_MAX 7 | ||
31 | |||
32 | #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) | ||
33 | #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) | ||
34 | #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) | ||
35 | #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) | ||
36 | #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) | ||
37 | #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) | ||
38 | #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) | ||
39 | #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) | ||
40 | #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) | ||
41 | #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) | ||
42 | #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) | ||
43 | #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) | ||
44 | #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) | ||
45 | #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) | ||
46 | #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) | ||
47 | #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) | ||
48 | #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) | ||
49 | #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) | ||
50 | #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) | ||
51 | #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) | ||
52 | #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) | ||
53 | #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) | ||
54 | #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) | ||
55 | #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) | ||
56 | |||
57 | struct kvm_user_trace_setup { | ||
58 | __u32 buf_size; | ||
59 | __u32 buf_nr; | ||
60 | }; | ||
61 | |||
62 | #define __KVM_DEPRECATED_MAIN_W_0x06 \ | ||
63 | _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) | ||
64 | #define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) | ||
65 | #define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) | ||
66 | |||
67 | #define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) | ||
68 | |||
69 | struct kvm_breakpoint { | ||
70 | __u32 enabled; | ||
71 | __u32 padding; | ||
72 | __u64 address; | ||
73 | }; | ||
74 | |||
75 | struct kvm_debug_guest { | ||
76 | __u32 enabled; | ||
77 | __u32 pad; | ||
78 | struct kvm_breakpoint breakpoints[4]; | ||
79 | __u32 singlestep; | ||
80 | }; | ||
81 | |||
82 | #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) | ||
83 | |||
84 | /* *** End of deprecated interfaces *** */ | ||
85 | |||
86 | |||
87 | /* for KVM_CREATE_MEMORY_REGION */ | ||
88 | struct kvm_memory_region { | ||
89 | __u32 slot; | ||
90 | __u32 flags; | ||
91 | __u64 guest_phys_addr; | ||
92 | __u64 memory_size; /* bytes */ | ||
93 | }; | ||
94 | |||
95 | /* for KVM_SET_USER_MEMORY_REGION */ | ||
96 | struct kvm_userspace_memory_region { | ||
97 | __u32 slot; | ||
98 | __u32 flags; | ||
99 | __u64 guest_phys_addr; | ||
100 | __u64 memory_size; /* bytes */ | ||
101 | __u64 userspace_addr; /* start of the userspace allocated memory */ | ||
102 | }; | ||
103 | |||
104 | /* for kvm_memory_region::flags */ | ||
105 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | ||
106 | #define KVM_MEMSLOT_INVALID (1UL << 1) | ||
107 | |||
108 | /* for KVM_IRQ_LINE */ | ||
109 | struct kvm_irq_level { | ||
110 | /* | ||
111 | * ACPI gsi notion of irq. | ||
112 | * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. | ||
113 | * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. | ||
114 | */ | ||
115 | union { | ||
116 | __u32 irq; | ||
117 | __s32 status; | ||
118 | }; | ||
119 | __u32 level; | ||
120 | }; | ||
121 | |||
122 | |||
123 | struct kvm_irqchip { | ||
124 | __u32 chip_id; | ||
125 | __u32 pad; | ||
126 | union { | ||
127 | char dummy[512]; /* reserving space */ | ||
128 | #ifdef __KVM_HAVE_PIT | ||
129 | struct kvm_pic_state pic; | ||
130 | #endif | ||
131 | #ifdef __KVM_HAVE_IOAPIC | ||
132 | struct kvm_ioapic_state ioapic; | ||
133 | #endif | ||
134 | } chip; | ||
135 | }; | ||
136 | |||
137 | /* for KVM_CREATE_PIT2 */ | ||
138 | struct kvm_pit_config { | ||
139 | __u32 flags; | ||
140 | __u32 pad[15]; | ||
141 | }; | ||
142 | |||
143 | #define KVM_PIT_SPEAKER_DUMMY 1 | ||
144 | |||
145 | #define KVM_EXIT_UNKNOWN 0 | ||
146 | #define KVM_EXIT_EXCEPTION 1 | ||
147 | #define KVM_EXIT_IO 2 | ||
148 | #define KVM_EXIT_HYPERCALL 3 | ||
149 | #define KVM_EXIT_DEBUG 4 | ||
150 | #define KVM_EXIT_HLT 5 | ||
151 | #define KVM_EXIT_MMIO 6 | ||
152 | #define KVM_EXIT_IRQ_WINDOW_OPEN 7 | ||
153 | #define KVM_EXIT_SHUTDOWN 8 | ||
154 | #define KVM_EXIT_FAIL_ENTRY 9 | ||
155 | #define KVM_EXIT_INTR 10 | ||
156 | #define KVM_EXIT_SET_TPR 11 | ||
157 | #define KVM_EXIT_TPR_ACCESS 12 | ||
158 | #define KVM_EXIT_S390_SIEIC 13 | ||
159 | #define KVM_EXIT_S390_RESET 14 | ||
160 | #define KVM_EXIT_DCR 15 | ||
161 | #define KVM_EXIT_NMI 16 | ||
162 | #define KVM_EXIT_INTERNAL_ERROR 17 | ||
163 | #define KVM_EXIT_OSI 18 | ||
164 | #define KVM_EXIT_PAPR_HCALL 19 | ||
165 | |||
166 | /* For KVM_EXIT_INTERNAL_ERROR */ | ||
167 | #define KVM_INTERNAL_ERROR_EMULATION 1 | ||
168 | #define KVM_INTERNAL_ERROR_SIMUL_EX 2 | ||
169 | |||
170 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ | ||
171 | struct kvm_run { | ||
172 | /* in */ | ||
173 | __u8 request_interrupt_window; | ||
174 | __u8 padding1[7]; | ||
175 | |||
176 | /* out */ | ||
177 | __u32 exit_reason; | ||
178 | __u8 ready_for_interrupt_injection; | ||
179 | __u8 if_flag; | ||
180 | __u8 padding2[2]; | ||
181 | |||
182 | /* in (pre_kvm_run), out (post_kvm_run) */ | ||
183 | __u64 cr8; | ||
184 | __u64 apic_base; | ||
185 | |||
186 | #ifdef __KVM_S390 | ||
187 | /* the processor status word for s390 */ | ||
188 | __u64 psw_mask; /* psw upper half */ | ||
189 | __u64 psw_addr; /* psw lower half */ | ||
190 | #endif | ||
191 | union { | ||
192 | /* KVM_EXIT_UNKNOWN */ | ||
193 | struct { | ||
194 | __u64 hardware_exit_reason; | ||
195 | } hw; | ||
196 | /* KVM_EXIT_FAIL_ENTRY */ | ||
197 | struct { | ||
198 | __u64 hardware_entry_failure_reason; | ||
199 | } fail_entry; | ||
200 | /* KVM_EXIT_EXCEPTION */ | ||
201 | struct { | ||
202 | __u32 exception; | ||
203 | __u32 error_code; | ||
204 | } ex; | ||
205 | /* KVM_EXIT_IO */ | ||
206 | struct { | ||
207 | #define KVM_EXIT_IO_IN 0 | ||
208 | #define KVM_EXIT_IO_OUT 1 | ||
209 | __u8 direction; | ||
210 | __u8 size; /* bytes */ | ||
211 | __u16 port; | ||
212 | __u32 count; | ||
213 | __u64 data_offset; /* relative to kvm_run start */ | ||
214 | } io; | ||
215 | struct { | ||
216 | struct kvm_debug_exit_arch arch; | ||
217 | } debug; | ||
218 | /* KVM_EXIT_MMIO */ | ||
219 | struct { | ||
220 | __u64 phys_addr; | ||
221 | __u8 data[8]; | ||
222 | __u32 len; | ||
223 | __u8 is_write; | ||
224 | } mmio; | ||
225 | /* KVM_EXIT_HYPERCALL */ | ||
226 | struct { | ||
227 | __u64 nr; | ||
228 | __u64 args[6]; | ||
229 | __u64 ret; | ||
230 | __u32 longmode; | ||
231 | __u32 pad; | ||
232 | } hypercall; | ||
233 | /* KVM_EXIT_TPR_ACCESS */ | ||
234 | struct { | ||
235 | __u64 rip; | ||
236 | __u32 is_write; | ||
237 | __u32 pad; | ||
238 | } tpr_access; | ||
239 | /* KVM_EXIT_S390_SIEIC */ | ||
240 | struct { | ||
241 | __u8 icptcode; | ||
242 | __u16 ipa; | ||
243 | __u32 ipb; | ||
244 | } s390_sieic; | ||
245 | /* KVM_EXIT_S390_RESET */ | ||
246 | #define KVM_S390_RESET_POR 1 | ||
247 | #define KVM_S390_RESET_CLEAR 2 | ||
248 | #define KVM_S390_RESET_SUBSYSTEM 4 | ||
249 | #define KVM_S390_RESET_CPU_INIT 8 | ||
250 | #define KVM_S390_RESET_IPL 16 | ||
251 | __u64 s390_reset_flags; | ||
252 | /* KVM_EXIT_DCR */ | ||
253 | struct { | ||
254 | __u32 dcrn; | ||
255 | __u32 data; | ||
256 | __u8 is_write; | ||
257 | } dcr; | ||
258 | struct { | ||
259 | __u32 suberror; | ||
260 | /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ | ||
261 | __u32 ndata; | ||
262 | __u64 data[16]; | ||
263 | } internal; | ||
264 | /* KVM_EXIT_OSI */ | ||
265 | struct { | ||
266 | __u64 gprs[32]; | ||
267 | } osi; | ||
268 | struct { | ||
269 | __u64 nr; | ||
270 | __u64 ret; | ||
271 | __u64 args[9]; | ||
272 | } papr_hcall; | ||
273 | /* Fix the size of the union. */ | ||
274 | char padding[256]; | ||
275 | }; | ||
276 | }; | ||
277 | |||
278 | /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ | ||
279 | |||
280 | struct kvm_coalesced_mmio_zone { | ||
281 | __u64 addr; | ||
282 | __u32 size; | ||
283 | __u32 pad; | ||
284 | }; | ||
285 | |||
286 | struct kvm_coalesced_mmio { | ||
287 | __u64 phys_addr; | ||
288 | __u32 len; | ||
289 | __u32 pad; | ||
290 | __u8 data[8]; | ||
291 | }; | ||
292 | |||
293 | struct kvm_coalesced_mmio_ring { | ||
294 | __u32 first, last; | ||
295 | struct kvm_coalesced_mmio coalesced_mmio[0]; | ||
296 | }; | ||
297 | |||
298 | #define KVM_COALESCED_MMIO_MAX \ | ||
299 | ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / \ | ||
300 | sizeof(struct kvm_coalesced_mmio)) | ||
301 | |||
302 | /* for KVM_TRANSLATE */ | ||
303 | struct kvm_translation { | ||
304 | /* in */ | ||
305 | __u64 linear_address; | ||
306 | |||
307 | /* out */ | ||
308 | __u64 physical_address; | ||
309 | __u8 valid; | ||
310 | __u8 writeable; | ||
311 | __u8 usermode; | ||
312 | __u8 pad[5]; | ||
313 | }; | ||
314 | |||
315 | /* for KVM_INTERRUPT */ | ||
316 | struct kvm_interrupt { | ||
317 | /* in */ | ||
318 | __u32 irq; | ||
319 | }; | ||
320 | |||
321 | /* for KVM_GET_DIRTY_LOG */ | ||
322 | struct kvm_dirty_log { | ||
323 | __u32 slot; | ||
324 | __u32 padding1; | ||
325 | union { | ||
326 | void __user *dirty_bitmap; /* one bit per page */ | ||
327 | __u64 padding2; | ||
328 | }; | ||
329 | }; | ||
330 | |||
331 | /* for KVM_SET_SIGNAL_MASK */ | ||
332 | struct kvm_signal_mask { | ||
333 | __u32 len; | ||
334 | __u8 sigset[0]; | ||
335 | }; | ||
336 | |||
337 | /* for KVM_TPR_ACCESS_REPORTING */ | ||
338 | struct kvm_tpr_access_ctl { | ||
339 | __u32 enabled; | ||
340 | __u32 flags; | ||
341 | __u32 reserved[8]; | ||
342 | }; | ||
343 | |||
344 | /* for KVM_SET_VAPIC_ADDR */ | ||
345 | struct kvm_vapic_addr { | ||
346 | __u64 vapic_addr; | ||
347 | }; | ||
348 | |||
349 | /* for KVM_SET_MPSTATE */ | ||
350 | |||
351 | #define KVM_MP_STATE_RUNNABLE 0 | ||
352 | #define KVM_MP_STATE_UNINITIALIZED 1 | ||
353 | #define KVM_MP_STATE_INIT_RECEIVED 2 | ||
354 | #define KVM_MP_STATE_HALTED 3 | ||
355 | #define KVM_MP_STATE_SIPI_RECEIVED 4 | ||
356 | |||
357 | struct kvm_mp_state { | ||
358 | __u32 mp_state; | ||
359 | }; | ||
360 | |||
361 | struct kvm_s390_psw { | ||
362 | __u64 mask; | ||
363 | __u64 addr; | ||
364 | }; | ||
365 | |||
366 | /* valid values for type in kvm_s390_interrupt */ | ||
367 | #define KVM_S390_SIGP_STOP 0xfffe0000u | ||
368 | #define KVM_S390_PROGRAM_INT 0xfffe0001u | ||
369 | #define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u | ||
370 | #define KVM_S390_RESTART 0xfffe0003u | ||
371 | #define KVM_S390_INT_VIRTIO 0xffff2603u | ||
372 | #define KVM_S390_INT_SERVICE 0xffff2401u | ||
373 | #define KVM_S390_INT_EMERGENCY 0xffff1201u | ||
374 | |||
375 | struct kvm_s390_interrupt { | ||
376 | __u32 type; | ||
377 | __u32 parm; | ||
378 | __u64 parm64; | ||
379 | }; | ||
380 | |||
381 | /* for KVM_SET_GUEST_DEBUG */ | ||
382 | |||
383 | #define KVM_GUESTDBG_ENABLE 0x00000001 | ||
384 | #define KVM_GUESTDBG_SINGLESTEP 0x00000002 | ||
385 | |||
386 | struct kvm_guest_debug { | ||
387 | __u32 control; | ||
388 | __u32 pad; | ||
389 | struct kvm_guest_debug_arch arch; | ||
390 | }; | ||
391 | |||
392 | enum { | ||
393 | kvm_ioeventfd_flag_nr_datamatch, | ||
394 | kvm_ioeventfd_flag_nr_pio, | ||
395 | kvm_ioeventfd_flag_nr_deassign, | ||
396 | kvm_ioeventfd_flag_nr_max, | ||
397 | }; | ||
398 | |||
399 | #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) | ||
400 | #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) | ||
401 | #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) | ||
402 | |||
403 | #define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) | ||
404 | |||
405 | struct kvm_ioeventfd { | ||
406 | __u64 datamatch; | ||
407 | __u64 addr; /* legal pio/mmio address */ | ||
408 | __u32 len; /* 1, 2, 4, or 8 bytes */ | ||
409 | __s32 fd; | ||
410 | __u32 flags; | ||
411 | __u8 pad[36]; | ||
412 | }; | ||
413 | |||
414 | /* for KVM_ENABLE_CAP */ | ||
415 | struct kvm_enable_cap { | ||
416 | /* in */ | ||
417 | __u32 cap; | ||
418 | __u32 flags; | ||
419 | __u64 args[4]; | ||
420 | __u8 pad[64]; | ||
421 | }; | ||
422 | |||
423 | /* for KVM_PPC_GET_PVINFO */ | ||
424 | struct kvm_ppc_pvinfo { | ||
425 | /* out */ | ||
426 | __u32 flags; | ||
427 | __u32 hcall[4]; | ||
428 | __u8 pad[108]; | ||
429 | }; | ||
430 | |||
431 | #define KVMIO 0xAE | ||
432 | |||
433 | /* | ||
434 | * ioctls for /dev/kvm fds: | ||
435 | */ | ||
436 | #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) | ||
437 | #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ | ||
438 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) | ||
439 | |||
440 | #define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06) | ||
441 | /* | ||
442 | * Check if a kvm extension is available. Argument is extension number, | ||
443 | * return is 1 (yes) or 0 (no, sorry). | ||
444 | */ | ||
445 | #define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03) | ||
446 | /* | ||
447 | * Get size for mmap(vcpu_fd) | ||
448 | */ | ||
449 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ | ||
450 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) | ||
451 | #define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 | ||
452 | #define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 | ||
453 | #define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 | ||
454 | |||
455 | /* | ||
456 | * Extension capability list. | ||
457 | */ | ||
458 | #define KVM_CAP_IRQCHIP 0 | ||
459 | #define KVM_CAP_HLT 1 | ||
460 | #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 | ||
461 | #define KVM_CAP_USER_MEMORY 3 | ||
462 | #define KVM_CAP_SET_TSS_ADDR 4 | ||
463 | #define KVM_CAP_VAPIC 6 | ||
464 | #define KVM_CAP_EXT_CPUID 7 | ||
465 | #define KVM_CAP_CLOCKSOURCE 8 | ||
466 | #define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */ | ||
467 | #define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */ | ||
468 | #define KVM_CAP_PIT 11 | ||
469 | #define KVM_CAP_NOP_IO_DELAY 12 | ||
470 | #define KVM_CAP_PV_MMU 13 | ||
471 | #define KVM_CAP_MP_STATE 14 | ||
472 | #define KVM_CAP_COALESCED_MMIO 15 | ||
473 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ | ||
474 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT | ||
475 | #define KVM_CAP_DEVICE_ASSIGNMENT 17 | ||
476 | #endif | ||
477 | #define KVM_CAP_IOMMU 18 | ||
478 | #ifdef __KVM_HAVE_MSI | ||
479 | #define KVM_CAP_DEVICE_MSI 20 | ||
480 | #endif | ||
481 | /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ | ||
482 | #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 | ||
483 | #ifdef __KVM_HAVE_USER_NMI | ||
484 | #define KVM_CAP_USER_NMI 22 | ||
485 | #endif | ||
486 | #ifdef __KVM_HAVE_GUEST_DEBUG | ||
487 | #define KVM_CAP_SET_GUEST_DEBUG 23 | ||
488 | #endif | ||
489 | #ifdef __KVM_HAVE_PIT | ||
490 | #define KVM_CAP_REINJECT_CONTROL 24 | ||
491 | #endif | ||
492 | #ifdef __KVM_HAVE_IOAPIC | ||
493 | #define KVM_CAP_IRQ_ROUTING 25 | ||
494 | #endif | ||
495 | #define KVM_CAP_IRQ_INJECT_STATUS 26 | ||
496 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT | ||
497 | #define KVM_CAP_DEVICE_DEASSIGNMENT 27 | ||
498 | #endif | ||
499 | #ifdef __KVM_HAVE_MSIX | ||
500 | #define KVM_CAP_DEVICE_MSIX 28 | ||
501 | #endif | ||
502 | #define KVM_CAP_ASSIGN_DEV_IRQ 29 | ||
503 | /* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ | ||
504 | #define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 | ||
505 | #ifdef __KVM_HAVE_MCE | ||
506 | #define KVM_CAP_MCE 31 | ||
507 | #endif | ||
508 | #define KVM_CAP_IRQFD 32 | ||
509 | #ifdef __KVM_HAVE_PIT | ||
510 | #define KVM_CAP_PIT2 33 | ||
511 | #endif | ||
512 | #define KVM_CAP_SET_BOOT_CPU_ID 34 | ||
513 | #ifdef __KVM_HAVE_PIT_STATE2 | ||
514 | #define KVM_CAP_PIT_STATE2 35 | ||
515 | #endif | ||
516 | #define KVM_CAP_IOEVENTFD 36 | ||
517 | #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 | ||
518 | #ifdef __KVM_HAVE_XEN_HVM | ||
519 | #define KVM_CAP_XEN_HVM 38 | ||
520 | #endif | ||
521 | #define KVM_CAP_ADJUST_CLOCK 39 | ||
522 | #define KVM_CAP_INTERNAL_ERROR_DATA 40 | ||
523 | #ifdef __KVM_HAVE_VCPU_EVENTS | ||
524 | #define KVM_CAP_VCPU_EVENTS 41 | ||
525 | #endif | ||
526 | #define KVM_CAP_S390_PSW 42 | ||
527 | #define KVM_CAP_PPC_SEGSTATE 43 | ||
528 | #define KVM_CAP_HYPERV 44 | ||
529 | #define KVM_CAP_HYPERV_VAPIC 45 | ||
530 | #define KVM_CAP_HYPERV_SPIN 46 | ||
531 | #define KVM_CAP_PCI_SEGMENT 47 | ||
532 | #define KVM_CAP_PPC_PAIRED_SINGLES 48 | ||
533 | #define KVM_CAP_INTR_SHADOW 49 | ||
534 | #ifdef __KVM_HAVE_DEBUGREGS | ||
535 | #define KVM_CAP_DEBUGREGS 50 | ||
536 | #endif | ||
537 | #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 | ||
538 | #define KVM_CAP_PPC_OSI 52 | ||
539 | #define KVM_CAP_PPC_UNSET_IRQ 53 | ||
540 | #define KVM_CAP_ENABLE_CAP 54 | ||
541 | #ifdef __KVM_HAVE_XSAVE | ||
542 | #define KVM_CAP_XSAVE 55 | ||
543 | #endif | ||
544 | #ifdef __KVM_HAVE_XCRS | ||
545 | #define KVM_CAP_XCRS 56 | ||
546 | #endif | ||
547 | #define KVM_CAP_PPC_GET_PVINFO 57 | ||
548 | #define KVM_CAP_PPC_IRQ_LEVEL 58 | ||
549 | #define KVM_CAP_ASYNC_PF 59 | ||
550 | #define KVM_CAP_TSC_CONTROL 60 | ||
551 | #define KVM_CAP_GET_TSC_KHZ 61 | ||
552 | #define KVM_CAP_PPC_BOOKE_SREGS 62 | ||
553 | #define KVM_CAP_SPAPR_TCE 63 | ||
554 | #define KVM_CAP_PPC_SMT 64 | ||
555 | #define KVM_CAP_PPC_RMA 65 | ||
556 | #define KVM_CAP_S390_GMAP 71 | ||
557 | |||
558 | #ifdef KVM_CAP_IRQ_ROUTING | ||
559 | |||
560 | struct kvm_irq_routing_irqchip { | ||
561 | __u32 irqchip; | ||
562 | __u32 pin; | ||
563 | }; | ||
564 | |||
565 | struct kvm_irq_routing_msi { | ||
566 | __u32 address_lo; | ||
567 | __u32 address_hi; | ||
568 | __u32 data; | ||
569 | __u32 pad; | ||
570 | }; | ||
571 | |||
572 | /* gsi routing entry types */ | ||
573 | #define KVM_IRQ_ROUTING_IRQCHIP 1 | ||
574 | #define KVM_IRQ_ROUTING_MSI 2 | ||
575 | |||
576 | struct kvm_irq_routing_entry { | ||
577 | __u32 gsi; | ||
578 | __u32 type; | ||
579 | __u32 flags; | ||
580 | __u32 pad; | ||
581 | union { | ||
582 | struct kvm_irq_routing_irqchip irqchip; | ||
583 | struct kvm_irq_routing_msi msi; | ||
584 | __u32 pad[8]; | ||
585 | } u; | ||
586 | }; | ||
587 | |||
588 | struct kvm_irq_routing { | ||
589 | __u32 nr; | ||
590 | __u32 flags; | ||
591 | struct kvm_irq_routing_entry entries[0]; | ||
592 | }; | ||
593 | |||
594 | #endif | ||
595 | |||
596 | #ifdef KVM_CAP_MCE | ||
597 | /* x86 MCE */ | ||
598 | struct kvm_x86_mce { | ||
599 | __u64 status; | ||
600 | __u64 addr; | ||
601 | __u64 misc; | ||
602 | __u64 mcg_status; | ||
603 | __u8 bank; | ||
604 | __u8 pad1[7]; | ||
605 | __u64 pad2[3]; | ||
606 | }; | ||
607 | #endif | ||
608 | |||
609 | #ifdef KVM_CAP_XEN_HVM | ||
610 | struct kvm_xen_hvm_config { | ||
611 | __u32 flags; | ||
612 | __u32 msr; | ||
613 | __u64 blob_addr_32; | ||
614 | __u64 blob_addr_64; | ||
615 | __u8 blob_size_32; | ||
616 | __u8 blob_size_64; | ||
617 | __u8 pad2[30]; | ||
618 | }; | ||
619 | #endif | ||
620 | |||
621 | #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) | ||
622 | |||
623 | struct kvm_irqfd { | ||
624 | __u32 fd; | ||
625 | __u32 gsi; | ||
626 | __u32 flags; | ||
627 | __u8 pad[20]; | ||
628 | }; | ||
629 | |||
630 | struct kvm_clock_data { | ||
631 | __u64 clock; | ||
632 | __u32 flags; | ||
633 | __u32 pad[9]; | ||
634 | }; | ||
635 | |||
636 | /* | ||
637 | * ioctls for VM fds | ||
638 | */ | ||
639 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) | ||
640 | /* | ||
641 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns | ||
642 | * a vcpu fd. | ||
643 | */ | ||
644 | #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) | ||
645 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) | ||
646 | /* KVM_SET_MEMORY_ALIAS is obsolete: */ | ||
647 | #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) | ||
648 | #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) | ||
649 | #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) | ||
650 | #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ | ||
651 | struct kvm_userspace_memory_region) | ||
652 | #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) | ||
653 | #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) | ||
654 | /* Device model IOC */ | ||
655 | #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) | ||
656 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) | ||
657 | #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) | ||
658 | #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) | ||
659 | #define KVM_CREATE_PIT _IO(KVMIO, 0x64) | ||
660 | #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) | ||
661 | #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) | ||
662 | #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) | ||
663 | #define KVM_REGISTER_COALESCED_MMIO \ | ||
664 | _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) | ||
665 | #define KVM_UNREGISTER_COALESCED_MMIO \ | ||
666 | _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) | ||
667 | #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ | ||
668 | struct kvm_assigned_pci_dev) | ||
669 | #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) | ||
670 | /* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ | ||
671 | #define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 | ||
672 | #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) | ||
673 | #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) | ||
674 | #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ | ||
675 | struct kvm_assigned_pci_dev) | ||
676 | #define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \ | ||
677 | struct kvm_assigned_msix_nr) | ||
678 | #define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \ | ||
679 | struct kvm_assigned_msix_entry) | ||
680 | #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) | ||
681 | #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) | ||
682 | #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) | ||
683 | #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) | ||
684 | #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) | ||
685 | #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) | ||
686 | #define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data) | ||
687 | #define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data) | ||
688 | /* Available with KVM_CAP_PIT_STATE2 */ | ||
689 | #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) | ||
690 | #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) | ||
691 | /* Available with KVM_CAP_PPC_GET_PVINFO */ | ||
692 | #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) | ||
693 | /* Available with KVM_CAP_TSC_CONTROL */ | ||
694 | #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) | ||
695 | #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) | ||
696 | |||
697 | /* | ||
698 | * ioctls for vcpu fds | ||
699 | */ | ||
700 | #define KVM_RUN _IO(KVMIO, 0x80) | ||
701 | #define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs) | ||
702 | #define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs) | ||
703 | #define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs) | ||
704 | #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) | ||
705 | #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) | ||
706 | #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) | ||
707 | /* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ | ||
708 | #define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 | ||
709 | #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) | ||
710 | #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) | ||
711 | #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) | ||
712 | #define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) | ||
713 | #define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) | ||
714 | #define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) | ||
715 | #define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) | ||
716 | #define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) | ||
717 | #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) | ||
718 | #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) | ||
719 | /* Available with KVM_CAP_VAPIC */ | ||
720 | #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) | ||
721 | /* Available with KVM_CAP_VAPIC */ | ||
722 | #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) | ||
723 | /* valid for virtual machine (for floating interrupt)_and_ vcpu */ | ||
724 | #define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt) | ||
725 | /* store status for s390 */ | ||
726 | #define KVM_S390_STORE_STATUS_NOADDR (-1ul) | ||
727 | #define KVM_S390_STORE_STATUS_PREFIXED (-2ul) | ||
728 | #define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long) | ||
729 | /* initial ipl psw for s390 */ | ||
730 | #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) | ||
731 | /* initial reset for s390 */ | ||
732 | #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) | ||
733 | #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) | ||
734 | #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) | ||
735 | /* Available with KVM_CAP_NMI */ | ||
736 | #define KVM_NMI _IO(KVMIO, 0x9a) | ||
737 | /* Available with KVM_CAP_SET_GUEST_DEBUG */ | ||
738 | #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) | ||
739 | /* MCE for x86 */ | ||
740 | #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) | ||
741 | #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) | ||
742 | #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) | ||
743 | /* IA64 stack access */ | ||
744 | #define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) | ||
745 | #define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) | ||
746 | /* Available with KVM_CAP_VCPU_EVENTS */ | ||
747 | #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) | ||
748 | #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) | ||
749 | /* Available with KVM_CAP_DEBUGREGS */ | ||
750 | #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) | ||
751 | #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) | ||
752 | #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) | ||
753 | /* Available with KVM_CAP_XSAVE */ | ||
754 | #define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) | ||
755 | #define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave) | ||
756 | /* Available with KVM_CAP_XCRS */ | ||
757 | #define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) | ||
758 | #define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) | ||
759 | #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) | ||
760 | /* Available with KVM_CAP_RMA */ | ||
761 | #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) | ||
762 | |||
763 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | ||
764 | |||
765 | struct kvm_assigned_pci_dev { | ||
766 | __u32 assigned_dev_id; | ||
767 | __u32 busnr; | ||
768 | __u32 devfn; | ||
769 | __u32 flags; | ||
770 | __u32 segnr; | ||
771 | union { | ||
772 | __u32 reserved[11]; | ||
773 | }; | ||
774 | }; | ||
775 | |||
776 | #define KVM_DEV_IRQ_HOST_INTX (1 << 0) | ||
777 | #define KVM_DEV_IRQ_HOST_MSI (1 << 1) | ||
778 | #define KVM_DEV_IRQ_HOST_MSIX (1 << 2) | ||
779 | |||
780 | #define KVM_DEV_IRQ_GUEST_INTX (1 << 8) | ||
781 | #define KVM_DEV_IRQ_GUEST_MSI (1 << 9) | ||
782 | #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) | ||
783 | |||
784 | #define KVM_DEV_IRQ_HOST_MASK 0x00ff | ||
785 | #define KVM_DEV_IRQ_GUEST_MASK 0xff00 | ||
786 | |||
787 | struct kvm_assigned_irq { | ||
788 | __u32 assigned_dev_id; | ||
789 | __u32 host_irq; /* ignored (legacy field) */ | ||
790 | __u32 guest_irq; | ||
791 | __u32 flags; | ||
792 | union { | ||
793 | __u32 reserved[12]; | ||
794 | }; | ||
795 | }; | ||
796 | |||
797 | struct kvm_assigned_msix_nr { | ||
798 | __u32 assigned_dev_id; | ||
799 | __u16 entry_nr; | ||
800 | __u16 padding; | ||
801 | }; | ||
802 | |||
803 | #define KVM_MAX_MSIX_PER_DEV 256 | ||
804 | struct kvm_assigned_msix_entry { | ||
805 | __u32 assigned_dev_id; | ||
806 | __u32 gsi; | ||
807 | __u16 entry; /* The index of entry in the MSI-X table */ | ||
808 | __u16 padding[3]; | ||
809 | }; | ||
810 | |||
811 | #endif /* __LINUX_KVM_H */ | ||
diff --git a/include/linux/lightsensor.h b/include/linux/lightsensor.h new file mode 100644 index 00000000000..7a87853ac06 --- /dev/null +++ b/include/linux/lightsensor.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* include/linux/lightsensor.h | ||
2 | * | ||
3 | * Copyright (C) 2011 Capella Microsystems Inc. | ||
4 | * Author: Frank Hsieh <pengyueh@gmail.com> | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef __LINUX_LIGHTSENSOR_H | ||
18 | #define __LINUX_LIGHTSENSOR_H | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | #include <linux/ioctl.h> | ||
22 | |||
23 | #define LIGHTSENSOR_IOCTL_MAGIC 'l' | ||
24 | |||
25 | #define LIGHTSENSOR_IOCTL_GET_ENABLED _IOR(LIGHTSENSOR_IOCTL_MAGIC, 1, int *) | ||
26 | #define LIGHTSENSOR_IOCTL_ENABLE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 2, int *) | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/limits.h b/include/linux/limits.h new file mode 100644 index 00000000000..2d0f94162fb --- /dev/null +++ b/include/linux/limits.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _LINUX_LIMITS_H | ||
2 | #define _LINUX_LIMITS_H | ||
3 | |||
4 | #define NR_OPEN 1024 | ||
5 | |||
6 | #define NGROUPS_MAX 65536 /* supplemental group IDs are available */ | ||
7 | #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ | ||
8 | #define LINK_MAX 127 /* # links a file may have */ | ||
9 | #define MAX_CANON 255 /* size of the canonical input queue */ | ||
10 | #define MAX_INPUT 255 /* size of the type-ahead buffer */ | ||
11 | #define NAME_MAX 255 /* # chars in a file name */ | ||
12 | #define PATH_MAX 4096 /* # chars in a path name including nul */ | ||
13 | #define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ | ||
14 | #define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ | ||
15 | #define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ | ||
16 | #define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ | ||
17 | |||
18 | #define RTSIG_MAX 32 | ||
19 | |||
20 | #endif | ||
diff --git a/include/linux/magic.h b/include/linux/magic.h new file mode 100644 index 00000000000..1e5df2af8d8 --- /dev/null +++ b/include/linux/magic.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef __LINUX_MAGIC_H__ | ||
2 | #define __LINUX_MAGIC_H__ | ||
3 | |||
4 | #define ADFS_SUPER_MAGIC 0xadf5 | ||
5 | #define AFFS_SUPER_MAGIC 0xadff | ||
6 | #define AFS_SUPER_MAGIC 0x5346414F | ||
7 | #define AUTOFS_SUPER_MAGIC 0x0187 | ||
8 | #define CODA_SUPER_MAGIC 0x73757245 | ||
9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ | ||
10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ | ||
11 | #define DEBUGFS_MAGIC 0x64626720 | ||
12 | #define SYSFS_MAGIC 0x62656572 | ||
13 | #define SECURITYFS_MAGIC 0x73636673 | ||
14 | #define SELINUX_MAGIC 0xf97cff8c | ||
15 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ | ||
16 | #define TMPFS_MAGIC 0x01021994 | ||
17 | #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ | ||
18 | #define SQUASHFS_MAGIC 0x73717368 | ||
19 | #define ECRYPTFS_SUPER_MAGIC 0xf15f | ||
20 | #define EFS_SUPER_MAGIC 0x414A53 | ||
21 | #define EXT2_SUPER_MAGIC 0xEF53 | ||
22 | #define EXT3_SUPER_MAGIC 0xEF53 | ||
23 | #define XENFS_SUPER_MAGIC 0xabba1974 | ||
24 | #define EXT4_SUPER_MAGIC 0xEF53 | ||
25 | #define BTRFS_SUPER_MAGIC 0x9123683E | ||
26 | #define NILFS_SUPER_MAGIC 0x3434 | ||
27 | #define HPFS_SUPER_MAGIC 0xf995e849 | ||
28 | #define ISOFS_SUPER_MAGIC 0x9660 | ||
29 | #define JFFS2_SUPER_MAGIC 0x72b6 | ||
30 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
31 | #define PSTOREFS_MAGIC 0x6165676C | ||
32 | |||
33 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ | ||
34 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ | ||
35 | #define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ | ||
36 | #define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ | ||
37 | #define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ | ||
38 | |||
39 | #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ | ||
40 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ | ||
41 | #define NFS_SUPER_MAGIC 0x6969 | ||
42 | #define OPENPROM_SUPER_MAGIC 0x9fa1 | ||
43 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
44 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ | ||
45 | |||
46 | #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ | ||
47 | /* used by file system utilities that | ||
48 | look at the superblock, etc. */ | ||
49 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" | ||
50 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" | ||
51 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | ||
52 | |||
53 | #define SMB_SUPER_MAGIC 0x517B | ||
54 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
55 | #define CGROUP_SUPER_MAGIC 0x27e0eb | ||
56 | |||
57 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
58 | |||
59 | #define STACK_END_MAGIC 0x57AC6E9D | ||
60 | |||
61 | #define DEVPTS_SUPER_MAGIC 0x1cd1 | ||
62 | #define SOCKFS_MAGIC 0x534F434B | ||
63 | #define V9FS_MAGIC 0x01021997 | ||
64 | |||
65 | #endif /* __LINUX_MAGIC_H__ */ | ||
diff --git a/include/linux/major.h b/include/linux/major.h new file mode 100644 index 00000000000..6a8ca98c9a9 --- /dev/null +++ b/include/linux/major.h | |||
@@ -0,0 +1,177 @@ | |||
1 | #ifndef _LINUX_MAJOR_H | ||
2 | #define _LINUX_MAJOR_H | ||
3 | |||
4 | /* | ||
5 | * This file has definitions for major device numbers. | ||
6 | * For the device number assignments, see Documentation/devices.txt. | ||
7 | */ | ||
8 | |||
9 | #define UNNAMED_MAJOR 0 | ||
10 | #define MEM_MAJOR 1 | ||
11 | #define RAMDISK_MAJOR 1 | ||
12 | #define FLOPPY_MAJOR 2 | ||
13 | #define PTY_MASTER_MAJOR 2 | ||
14 | #define IDE0_MAJOR 3 | ||
15 | #define HD_MAJOR IDE0_MAJOR | ||
16 | #define PTY_SLAVE_MAJOR 3 | ||
17 | #define TTY_MAJOR 4 | ||
18 | #define TTYAUX_MAJOR 5 | ||
19 | #define LP_MAJOR 6 | ||
20 | #define VCS_MAJOR 7 | ||
21 | #define LOOP_MAJOR 7 | ||
22 | #define SCSI_DISK0_MAJOR 8 | ||
23 | #define SCSI_TAPE_MAJOR 9 | ||
24 | #define MD_MAJOR 9 | ||
25 | #define MISC_MAJOR 10 | ||
26 | #define SCSI_CDROM_MAJOR 11 | ||
27 | #define MUX_MAJOR 11 /* PA-RISC only */ | ||
28 | #define XT_DISK_MAJOR 13 | ||
29 | #define INPUT_MAJOR 13 | ||
30 | #define SOUND_MAJOR 14 | ||
31 | #define CDU31A_CDROM_MAJOR 15 | ||
32 | #define JOYSTICK_MAJOR 15 | ||
33 | #define GOLDSTAR_CDROM_MAJOR 16 | ||
34 | #define OPTICS_CDROM_MAJOR 17 | ||
35 | #define SANYO_CDROM_MAJOR 18 | ||
36 | #define CYCLADES_MAJOR 19 | ||
37 | #define CYCLADESAUX_MAJOR 20 | ||
38 | #define MITSUMI_X_CDROM_MAJOR 20 | ||
39 | #define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */ | ||
40 | #define SCSI_GENERIC_MAJOR 21 | ||
41 | #define IDE1_MAJOR 22 | ||
42 | #define DIGICU_MAJOR 22 | ||
43 | #define DIGI_MAJOR 23 | ||
44 | #define MITSUMI_CDROM_MAJOR 23 | ||
45 | #define CDU535_CDROM_MAJOR 24 | ||
46 | #define STL_SERIALMAJOR 24 | ||
47 | #define MATSUSHITA_CDROM_MAJOR 25 | ||
48 | #define STL_CALLOUTMAJOR 25 | ||
49 | #define MATSUSHITA_CDROM2_MAJOR 26 | ||
50 | #define QIC117_TAPE_MAJOR 27 | ||
51 | #define MATSUSHITA_CDROM3_MAJOR 27 | ||
52 | #define MATSUSHITA_CDROM4_MAJOR 28 | ||
53 | #define STL_SIOMEMMAJOR 28 | ||
54 | #define ACSI_MAJOR 28 | ||
55 | #define AZTECH_CDROM_MAJOR 29 | ||
56 | #define FB_MAJOR 29 /* /dev/fb* framebuffers */ | ||
57 | #define CM206_CDROM_MAJOR 32 | ||
58 | #define IDE2_MAJOR 33 | ||
59 | #define IDE3_MAJOR 34 | ||
60 | #define Z8530_MAJOR 34 | ||
61 | #define XPRAM_MAJOR 35 /* Expanded storage on S/390: "slow ram"*/ | ||
62 | #define NETLINK_MAJOR 36 | ||
63 | #define PS2ESDI_MAJOR 36 | ||
64 | #define IDETAPE_MAJOR 37 | ||
65 | #define Z2RAM_MAJOR 37 | ||
66 | #define APBLOCK_MAJOR 38 /* AP1000 Block device */ | ||
67 | #define DDV_MAJOR 39 /* AP1000 DDV block device */ | ||
68 | #define NBD_MAJOR 43 /* Network block device */ | ||
69 | #define RISCOM8_NORMAL_MAJOR 48 | ||
70 | #define DAC960_MAJOR 48 /* 48..55 */ | ||
71 | #define RISCOM8_CALLOUT_MAJOR 49 | ||
72 | #define MKISS_MAJOR 55 | ||
73 | #define DSP56K_MAJOR 55 /* DSP56001 processor device */ | ||
74 | |||
75 | #define IDE4_MAJOR 56 | ||
76 | #define IDE5_MAJOR 57 | ||
77 | |||
78 | #define SCSI_DISK1_MAJOR 65 | ||
79 | #define SCSI_DISK2_MAJOR 66 | ||
80 | #define SCSI_DISK3_MAJOR 67 | ||
81 | #define SCSI_DISK4_MAJOR 68 | ||
82 | #define SCSI_DISK5_MAJOR 69 | ||
83 | #define SCSI_DISK6_MAJOR 70 | ||
84 | #define SCSI_DISK7_MAJOR 71 | ||
85 | |||
86 | #define COMPAQ_SMART2_MAJOR 72 | ||
87 | #define COMPAQ_SMART2_MAJOR1 73 | ||
88 | #define COMPAQ_SMART2_MAJOR2 74 | ||
89 | #define COMPAQ_SMART2_MAJOR3 75 | ||
90 | #define COMPAQ_SMART2_MAJOR4 76 | ||
91 | #define COMPAQ_SMART2_MAJOR5 77 | ||
92 | #define COMPAQ_SMART2_MAJOR6 78 | ||
93 | #define COMPAQ_SMART2_MAJOR7 79 | ||
94 | |||
95 | #define SPECIALIX_NORMAL_MAJOR 75 | ||
96 | #define SPECIALIX_CALLOUT_MAJOR 76 | ||
97 | |||
98 | #define AURORA_MAJOR 79 | ||
99 | |||
100 | #define I2O_MAJOR 80 /* 80->87 */ | ||
101 | |||
102 | #define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ | ||
103 | #define SCSI_CHANGER_MAJOR 86 | ||
104 | |||
105 | #define IDE6_MAJOR 88 | ||
106 | #define IDE7_MAJOR 89 | ||
107 | #define IDE8_MAJOR 90 | ||
108 | #define IDE9_MAJOR 91 | ||
109 | |||
110 | #define DASD_MAJOR 94 | ||
111 | |||
112 | #define MDISK_MAJOR 95 | ||
113 | |||
114 | #define UBD_MAJOR 98 | ||
115 | |||
116 | #define PP_MAJOR 99 | ||
117 | #define JSFD_MAJOR 99 | ||
118 | |||
119 | #define PHONE_MAJOR 100 | ||
120 | |||
121 | #define COMPAQ_CISS_MAJOR 104 | ||
122 | #define COMPAQ_CISS_MAJOR1 105 | ||
123 | #define COMPAQ_CISS_MAJOR2 106 | ||
124 | #define COMPAQ_CISS_MAJOR3 107 | ||
125 | #define COMPAQ_CISS_MAJOR4 108 | ||
126 | #define COMPAQ_CISS_MAJOR5 109 | ||
127 | #define COMPAQ_CISS_MAJOR6 110 | ||
128 | #define COMPAQ_CISS_MAJOR7 111 | ||
129 | |||
130 | #define VIODASD_MAJOR 112 | ||
131 | #define VIOCD_MAJOR 113 | ||
132 | |||
133 | #define ATARAID_MAJOR 114 | ||
134 | |||
135 | #define SCSI_DISK8_MAJOR 128 | ||
136 | #define SCSI_DISK9_MAJOR 129 | ||
137 | #define SCSI_DISK10_MAJOR 130 | ||
138 | #define SCSI_DISK11_MAJOR 131 | ||
139 | #define SCSI_DISK12_MAJOR 132 | ||
140 | #define SCSI_DISK13_MAJOR 133 | ||
141 | #define SCSI_DISK14_MAJOR 134 | ||
142 | #define SCSI_DISK15_MAJOR 135 | ||
143 | |||
144 | #define UNIX98_PTY_MASTER_MAJOR 128 | ||
145 | #define UNIX98_PTY_MAJOR_COUNT 8 | ||
146 | #define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) | ||
147 | |||
148 | #define DRBD_MAJOR 147 | ||
149 | #define RTF_MAJOR 150 | ||
150 | #define RAW_MAJOR 162 | ||
151 | |||
152 | #define USB_ACM_MAJOR 166 | ||
153 | #define USB_ACM_AUX_MAJOR 167 | ||
154 | #define USB_CHAR_MAJOR 180 | ||
155 | |||
156 | #define MMC_BLOCK_MAJOR 179 | ||
157 | |||
158 | #define VXVM_MAJOR 199 /* VERITAS volume i/o driver */ | ||
159 | #define VXSPEC_MAJOR 200 /* VERITAS volume config driver */ | ||
160 | #define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */ | ||
161 | |||
162 | #define XENVBD_MAJOR 202 /* Xen virtual block device */ | ||
163 | |||
164 | #define MSR_MAJOR 202 | ||
165 | #define CPUID_MAJOR 203 | ||
166 | |||
167 | #define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ | ||
168 | |||
169 | #define IBM_TTY3270_MAJOR 227 | ||
170 | #define IBM_FS3270_MAJOR 228 | ||
171 | |||
172 | #define VIOTAPE_MAJOR 230 | ||
173 | |||
174 | #define BLOCK_EXT_MAJOR 259 | ||
175 | #define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ | ||
176 | |||
177 | #endif | ||
diff --git a/include/linux/map_to_7segment.h b/include/linux/map_to_7segment.h new file mode 100644 index 00000000000..12d62a54d47 --- /dev/null +++ b/include/linux/map_to_7segment.h | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | |||
19 | #ifndef MAP_TO_7SEGMENT_H | ||
20 | #define MAP_TO_7SEGMENT_H | ||
21 | |||
22 | /* This file provides translation primitives and tables for the conversion | ||
23 | * of (ASCII) characters to a 7-segments notation. | ||
24 | * | ||
25 | * The 7 segment's wikipedia notation below is used as standard. | ||
26 | * See: http://en.wikipedia.org/wiki/Seven_segment_display | ||
27 | * | ||
28 | * Notation: +-a-+ | ||
29 | * f b | ||
30 | * +-g-+ | ||
31 | * e c | ||
32 | * +-d-+ | ||
33 | * | ||
34 | * Usage: | ||
35 | * | ||
36 | * Register a map variable, and fill it with a character set: | ||
37 | * static SEG7_DEFAULT_MAP(map_seg7); | ||
38 | * | ||
39 | * | ||
40 | * Then use for conversion: | ||
41 | * seg7 = map_to_seg7(&map_seg7, some_char); | ||
42 | * ... | ||
43 | * | ||
44 | * In device drivers it is recommended, if required, to make the char map | ||
45 | * accessible via the sysfs interface using the following scheme: | ||
46 | * | ||
47 | * static ssize_t show_map(struct device *dev, char *buf) { | ||
48 | * memcpy(buf, &map_seg7, sizeof(map_seg7)); | ||
49 | * return sizeof(map_seg7); | ||
50 | * } | ||
51 | * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) { | ||
52 | * if(cnt != sizeof(map_seg7)) | ||
53 | * return -EINVAL; | ||
54 | * memcpy(&map_seg7, buf, cnt); | ||
55 | * return cnt; | ||
56 | * } | ||
57 | * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map); | ||
58 | * | ||
59 | * History: | ||
60 | * 2005-05-31 RFC linux-kernel@vger.kernel.org | ||
61 | */ | ||
62 | #include <linux/errno.h> | ||
63 | |||
64 | |||
65 | #define BIT_SEG7_A 0 | ||
66 | #define BIT_SEG7_B 1 | ||
67 | #define BIT_SEG7_C 2 | ||
68 | #define BIT_SEG7_D 3 | ||
69 | #define BIT_SEG7_E 4 | ||
70 | #define BIT_SEG7_F 5 | ||
71 | #define BIT_SEG7_G 6 | ||
72 | #define BIT_SEG7_RESERVED 7 | ||
73 | |||
74 | struct seg7_conversion_map { | ||
75 | unsigned char table[128]; | ||
76 | }; | ||
77 | |||
78 | static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c) | ||
79 | { | ||
80 | return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; | ||
81 | } | ||
82 | |||
83 | #define SEG7_CONVERSION_MAP(_name, _map) \ | ||
84 | struct seg7_conversion_map _name = { .table = { _map } } | ||
85 | |||
86 | /* | ||
87 | * It is recommended to use a facility that allows user space to redefine | ||
88 | * custom character sets for LCD devices. Please use a sysfs interface | ||
89 | * as described above. | ||
90 | */ | ||
91 | #define MAP_TO_SEG7_SYSFS_FILE "map_seg7" | ||
92 | |||
93 | /******************************************************************************* | ||
94 | * ASCII conversion table | ||
95 | ******************************************************************************/ | ||
96 | |||
97 | #define _SEG7(l,a,b,c,d,e,f,g) \ | ||
98 | ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \ | ||
99 | e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G ) | ||
100 | |||
101 | #define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ | ||
102 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
103 | |||
104 | #define _MAP_33_47_ASCII_SEG7_SYMBOL \ | ||
105 | _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\ | ||
106 | _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\ | ||
107 | _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\ | ||
108 | _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\ | ||
109 | _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1), | ||
110 | |||
111 | #define _MAP_48_57_ASCII_SEG7_NUMERIC \ | ||
112 | _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\ | ||
113 | _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\ | ||
114 | _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\ | ||
115 | _SEG7('9',1,1,1,1,0,1,1), | ||
116 | |||
117 | #define _MAP_58_64_ASCII_SEG7_SYMBOL \ | ||
118 | _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\ | ||
119 | _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\ | ||
120 | _SEG7('@',1,1,0,1,1,1,1), | ||
121 | |||
122 | #define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ | ||
123 | _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\ | ||
124 | _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ | ||
125 | _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\ | ||
126 | _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ | ||
127 | _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\ | ||
128 | _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\ | ||
129 | _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\ | ||
130 | _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ | ||
131 | _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), | ||
132 | |||
133 | #define _MAP_91_96_ASCII_SEG7_SYMBOL \ | ||
134 | _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\ | ||
135 | _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0), | ||
136 | |||
137 | #define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
138 | _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\ | ||
139 | _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ | ||
140 | _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\ | ||
141 | _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ | ||
142 | _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\ | ||
143 | _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\ | ||
144 | _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\ | ||
145 | _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ | ||
146 | _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), | ||
147 | |||
148 | #define _MAP_123_126_ASCII_SEG7_SYMBOL \ | ||
149 | _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\ | ||
150 | _SEG7('~',1,0,0,0,0,0,0), | ||
151 | |||
152 | /* Maps */ | ||
153 | |||
154 | /* This set tries to map as close as possible to the visible characteristics | ||
155 | * of the ASCII symbol, lowercase and uppercase letters may differ in | ||
156 | * presentation on the display. | ||
157 | */ | ||
158 | #define MAP_ASCII7SEG_ALPHANUM \ | ||
159 | _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ | ||
160 | _MAP_33_47_ASCII_SEG7_SYMBOL \ | ||
161 | _MAP_48_57_ASCII_SEG7_NUMERIC \ | ||
162 | _MAP_58_64_ASCII_SEG7_SYMBOL \ | ||
163 | _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ | ||
164 | _MAP_91_96_ASCII_SEG7_SYMBOL \ | ||
165 | _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
166 | _MAP_123_126_ASCII_SEG7_SYMBOL | ||
167 | |||
168 | /* This set tries to map as close as possible to the symbolic characteristics | ||
169 | * of the ASCII character for maximum discrimination. | ||
170 | * For now this means all alpha chars are in lower case representations. | ||
171 | * (This for example facilitates the use of hex numbers with uppercase input.) | ||
172 | */ | ||
173 | #define MAP_ASCII7SEG_ALPHANUM_LC \ | ||
174 | _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ | ||
175 | _MAP_33_47_ASCII_SEG7_SYMBOL \ | ||
176 | _MAP_48_57_ASCII_SEG7_NUMERIC \ | ||
177 | _MAP_58_64_ASCII_SEG7_SYMBOL \ | ||
178 | _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
179 | _MAP_91_96_ASCII_SEG7_SYMBOL \ | ||
180 | _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
181 | _MAP_123_126_ASCII_SEG7_SYMBOL | ||
182 | |||
183 | #define SEG7_DEFAULT_MAP(_name) \ | ||
184 | SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM) | ||
185 | |||
186 | #endif /* MAP_TO_7SEGMENT_H */ | ||
187 | |||
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h new file mode 100644 index 00000000000..8c22a893864 --- /dev/null +++ b/include/linux/matroxfb.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef __LINUX_MATROXFB_H__ | ||
2 | #define __LINUX_MATROXFB_H__ | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | #include <linux/types.h> | ||
6 | #include <linux/videodev2.h> | ||
7 | #include <linux/fb.h> | ||
8 | |||
9 | struct matroxioc_output_mode { | ||
10 | __u32 output; /* which output */ | ||
11 | #define MATROXFB_OUTPUT_PRIMARY 0x0000 | ||
12 | #define MATROXFB_OUTPUT_SECONDARY 0x0001 | ||
13 | #define MATROXFB_OUTPUT_DFP 0x0002 | ||
14 | __u32 mode; /* which mode */ | ||
15 | #define MATROXFB_OUTPUT_MODE_PAL 0x0001 | ||
16 | #define MATROXFB_OUTPUT_MODE_NTSC 0x0002 | ||
17 | #define MATROXFB_OUTPUT_MODE_MONITOR 0x0080 | ||
18 | }; | ||
19 | #define MATROXFB_SET_OUTPUT_MODE _IOW('n',0xFA,size_t) | ||
20 | #define MATROXFB_GET_OUTPUT_MODE _IOWR('n',0xFA,size_t) | ||
21 | |||
22 | /* bitfield */ | ||
23 | #define MATROXFB_OUTPUT_CONN_PRIMARY (1 << MATROXFB_OUTPUT_PRIMARY) | ||
24 | #define MATROXFB_OUTPUT_CONN_SECONDARY (1 << MATROXFB_OUTPUT_SECONDARY) | ||
25 | #define MATROXFB_OUTPUT_CONN_DFP (1 << MATROXFB_OUTPUT_DFP) | ||
26 | /* connect these outputs to this framebuffer */ | ||
27 | #define MATROXFB_SET_OUTPUT_CONNECTION _IOW('n',0xF8,size_t) | ||
28 | /* which outputs are connected to this framebuffer */ | ||
29 | #define MATROXFB_GET_OUTPUT_CONNECTION _IOR('n',0xF8,size_t) | ||
30 | /* which outputs are available for this framebuffer */ | ||
31 | #define MATROXFB_GET_AVAILABLE_OUTPUTS _IOR('n',0xF9,size_t) | ||
32 | /* which outputs exist on this framebuffer */ | ||
33 | #define MATROXFB_GET_ALL_OUTPUTS _IOR('n',0xFB,size_t) | ||
34 | |||
35 | enum matroxfb_ctrl_id { | ||
36 | MATROXFB_CID_TESTOUT = V4L2_CID_PRIVATE_BASE, | ||
37 | MATROXFB_CID_DEFLICKER, | ||
38 | MATROXFB_CID_LAST | ||
39 | }; | ||
40 | |||
41 | #endif | ||
42 | |||
diff --git a/include/linux/max17048_battery.h b/include/linux/max17048_battery.h new file mode 100644 index 00000000000..d997082fb5a --- /dev/null +++ b/include/linux/max17048_battery.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Samsung Electronics | ||
3 | * Copyright (C) 2012 Nvidia Cooperation | ||
4 | * Minkyu Kang <mk7.kang@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __MAX17048_BATTERY_H_ | ||
12 | #define __MAX17048_BATTERY_H_ | ||
13 | #include <linux/smb349-charger.h> | ||
14 | |||
15 | struct max17048_battery_model { | ||
16 | uint8_t rcomp; | ||
17 | uint8_t soccheck_A; | ||
18 | uint8_t soccheck_B; | ||
19 | uint8_t bits; | ||
20 | uint8_t alert_threshold; | ||
21 | uint8_t one_percent_alerts; | ||
22 | uint8_t alert_on_reset; | ||
23 | uint16_t rcomp_seg; | ||
24 | uint16_t hibernate; | ||
25 | uint16_t vreset; | ||
26 | uint16_t valert; | ||
27 | uint16_t ocvtest; | ||
28 | }; | ||
29 | |||
30 | struct max17048_platform_data { | ||
31 | int (*battery_online)(void); | ||
32 | int (*charging_status)(void); | ||
33 | int (*charger_online)(void); | ||
34 | }; | ||
35 | #endif | ||
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h new file mode 100644 index 00000000000..7a3aea84590 --- /dev/null +++ b/include/linux/mca-legacy.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8 -*- */ | ||
2 | |||
3 | /* This is the function prototypes for the old legacy MCA interface | ||
4 | * | ||
5 | * Please move your driver to the new sysfs based one instead */ | ||
6 | |||
7 | #ifndef _LINUX_MCA_LEGACY_H | ||
8 | #define _LINUX_MCA_LEGACY_H | ||
9 | |||
10 | #include <linux/mca.h> | ||
11 | |||
12 | #warning "MCA legacy - please move your driver to the new sysfs api" | ||
13 | |||
14 | /* MCA_NOTFOUND is an error condition. The other two indicate | ||
15 | * motherboard POS registers contain the adapter. They might be | ||
16 | * returned by the mca_find_adapter() function, and can be used as | ||
17 | * arguments to mca_read_stored_pos(). I'm not going to allow direct | ||
18 | * access to the motherboard registers until we run across an adapter | ||
19 | * that requires it. We don't know enough about them to know if it's | ||
20 | * safe. | ||
21 | * | ||
22 | * See Documentation/mca.txt or one of the existing drivers for | ||
23 | * more information. | ||
24 | */ | ||
25 | #define MCA_NOTFOUND (-1) | ||
26 | |||
27 | |||
28 | |||
29 | /* Returns the slot of the first enabled adapter matching id. User can | ||
30 | * specify a starting slot beyond zero, to deal with detecting multiple | ||
31 | * devices. Returns MCA_NOTFOUND if id not found. Also checks the | ||
32 | * integrated adapters. | ||
33 | */ | ||
34 | extern int mca_find_adapter(int id, int start); | ||
35 | extern int mca_find_unused_adapter(int id, int start); | ||
36 | |||
37 | extern int mca_mark_as_used(int slot); | ||
38 | extern void mca_mark_as_unused(int slot); | ||
39 | |||
40 | /* gets a byte out of POS register (stored in memory) */ | ||
41 | extern unsigned char mca_read_stored_pos(int slot, int reg); | ||
42 | |||
43 | /* This can be expanded later. Right now, it gives us a way of | ||
44 | * getting meaningful information into the MCA_info structure, | ||
45 | * so we can have a more interesting /proc/mca. | ||
46 | */ | ||
47 | extern void mca_set_adapter_name(int slot, char* name); | ||
48 | |||
49 | /* These routines actually mess with the hardware POS registers. They | ||
50 | * temporarily disable the device (and interrupts), so make sure you know | ||
51 | * what you're doing if you use them. Furthermore, writing to a POS may | ||
52 | * result in two devices trying to share a resource, which in turn can | ||
53 | * result in multiple devices sharing memory spaces, IRQs, or even trashing | ||
54 | * hardware. YOU HAVE BEEN WARNED. | ||
55 | * | ||
56 | * You can only access slots with this. Motherboard registers are off | ||
57 | * limits. | ||
58 | */ | ||
59 | |||
60 | /* read a byte from the specified POS register. */ | ||
61 | extern unsigned char mca_read_pos(int slot, int reg); | ||
62 | |||
63 | /* write a byte to the specified POS register. */ | ||
64 | extern void mca_write_pos(int slot, int reg, unsigned char byte); | ||
65 | |||
66 | #endif | ||
diff --git a/include/linux/mca.h b/include/linux/mca.h new file mode 100644 index 00000000000..37972704617 --- /dev/null +++ b/include/linux/mca.h | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Header for Microchannel Architecture Bus | ||
3 | * Written by Martin Kolinek, February 1996 | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_MCA_H | ||
7 | #define _LINUX_MCA_H | ||
8 | |||
9 | #include <linux/device.h> | ||
10 | |||
11 | #ifdef CONFIG_MCA | ||
12 | #include <asm/mca.h> | ||
13 | |||
14 | extern int MCA_bus; | ||
15 | #else | ||
16 | #define MCA_bus 0 | ||
17 | #endif | ||
18 | |||
19 | /* This sets up an information callback for /proc/mca/slot?. The | ||
20 | * function is called with the buffer, slot, and device pointer (or | ||
21 | * some equally informative context information, or nothing, if you | ||
22 | * prefer), and is expected to put useful information into the | ||
23 | * buffer. The adapter name, id, and POS registers get printed | ||
24 | * before this is called though, so don't do it again. | ||
25 | * | ||
26 | * This should be called with a NULL procfn when a module | ||
27 | * unregisters, thus preventing kernel crashes and other such | ||
28 | * nastiness. | ||
29 | */ | ||
30 | typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev); | ||
31 | |||
32 | /* Should only be called by the NMI interrupt handler, this will do some | ||
33 | * fancy stuff to figure out what might have generated a NMI. | ||
34 | */ | ||
35 | extern void mca_handle_nmi(void); | ||
36 | |||
37 | enum MCA_AdapterStatus { | ||
38 | MCA_ADAPTER_NORMAL = 0, | ||
39 | MCA_ADAPTER_NONE = 1, | ||
40 | MCA_ADAPTER_DISABLED = 2, | ||
41 | MCA_ADAPTER_ERROR = 3 | ||
42 | }; | ||
43 | |||
44 | struct mca_device { | ||
45 | u64 dma_mask; | ||
46 | int pos_id; | ||
47 | int slot; | ||
48 | |||
49 | /* index into id_table, set by the bus match routine */ | ||
50 | int index; | ||
51 | |||
52 | /* is there a driver installed? 0 - No, 1 - Yes */ | ||
53 | int driver_loaded; | ||
54 | /* POS registers */ | ||
55 | unsigned char pos[8]; | ||
56 | /* if a pseudo adapter of the motherboard, this is the motherboard | ||
57 | * register value to use for setup cycles */ | ||
58 | short pos_register; | ||
59 | |||
60 | enum MCA_AdapterStatus status; | ||
61 | #ifdef CONFIG_MCA_PROC_FS | ||
62 | /* name of the proc/mca file */ | ||
63 | char procname[8]; | ||
64 | /* /proc info callback */ | ||
65 | MCA_ProcFn procfn; | ||
66 | /* device/context info for proc callback */ | ||
67 | void *proc_dev; | ||
68 | #endif | ||
69 | struct device dev; | ||
70 | char name[32]; | ||
71 | }; | ||
72 | #define to_mca_device(mdev) container_of(mdev, struct mca_device, dev) | ||
73 | |||
74 | struct mca_bus_accessor_functions { | ||
75 | unsigned char (*mca_read_pos)(struct mca_device *, int reg); | ||
76 | void (*mca_write_pos)(struct mca_device *, int reg, | ||
77 | unsigned char byte); | ||
78 | int (*mca_transform_irq)(struct mca_device *, int irq); | ||
79 | int (*mca_transform_ioport)(struct mca_device *, | ||
80 | int region); | ||
81 | void * (*mca_transform_memory)(struct mca_device *, | ||
82 | void *memory); | ||
83 | }; | ||
84 | |||
85 | struct mca_bus { | ||
86 | u64 default_dma_mask; | ||
87 | int number; | ||
88 | struct mca_bus_accessor_functions f; | ||
89 | struct device dev; | ||
90 | char name[32]; | ||
91 | }; | ||
92 | #define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev) | ||
93 | |||
94 | struct mca_driver { | ||
95 | const short *id_table; | ||
96 | void *driver_data; | ||
97 | int integrated_id; | ||
98 | struct device_driver driver; | ||
99 | }; | ||
100 | #define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver) | ||
101 | |||
102 | /* Ongoing supported API functions */ | ||
103 | extern struct mca_device *mca_find_device_by_slot(int slot); | ||
104 | extern int mca_system_init(void); | ||
105 | extern struct mca_bus *mca_attach_bus(int); | ||
106 | |||
107 | extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev, | ||
108 | int reg); | ||
109 | extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg); | ||
110 | extern void mca_device_write_pos(struct mca_device *mca_dev, int reg, | ||
111 | unsigned char byte); | ||
112 | extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq); | ||
113 | extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port); | ||
114 | extern void *mca_device_transform_memory(struct mca_device *mca_dev, | ||
115 | void *mem); | ||
116 | extern int mca_device_claimed(struct mca_device *mca_dev); | ||
117 | extern void mca_device_set_claim(struct mca_device *mca_dev, int val); | ||
118 | extern void mca_device_set_name(struct mca_device *mca_dev, const char *name); | ||
119 | static inline char *mca_device_get_name(struct mca_device *mca_dev) | ||
120 | { | ||
121 | return mca_dev ? mca_dev->name : NULL; | ||
122 | } | ||
123 | |||
124 | extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev); | ||
125 | |||
126 | extern struct bus_type mca_bus_type; | ||
127 | |||
128 | extern int mca_register_driver(struct mca_driver *drv); | ||
129 | extern int mca_register_driver_integrated(struct mca_driver *, int); | ||
130 | extern void mca_unregister_driver(struct mca_driver *drv); | ||
131 | |||
132 | /* WARNING: only called by the boot time device setup */ | ||
133 | extern int mca_register_device(int bus, struct mca_device *mca_dev); | ||
134 | |||
135 | #ifdef CONFIG_MCA_PROC_FS | ||
136 | extern void mca_do_proc_init(void); | ||
137 | extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev); | ||
138 | #else | ||
139 | static inline void mca_do_proc_init(void) | ||
140 | { | ||
141 | } | ||
142 | |||
143 | static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev) | ||
144 | { | ||
145 | } | ||
146 | #endif | ||
147 | |||
148 | #endif /* _LINUX_MCA_H */ | ||
diff --git a/include/linux/media.h b/include/linux/media.h new file mode 100644 index 00000000000..0ef883327de --- /dev/null +++ b/include/linux/media.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * Multimedia device API | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation | ||
5 | * | ||
6 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
7 | * Sakari Ailus <sakari.ailus@iki.fi> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_MEDIA_H | ||
24 | #define __LINUX_MEDIA_H | ||
25 | |||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/version.h> | ||
29 | |||
30 | #define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) | ||
31 | |||
32 | struct media_device_info { | ||
33 | char driver[16]; | ||
34 | char model[32]; | ||
35 | char serial[40]; | ||
36 | char bus_info[32]; | ||
37 | __u32 media_version; | ||
38 | __u32 hw_revision; | ||
39 | __u32 driver_version; | ||
40 | __u32 reserved[31]; | ||
41 | }; | ||
42 | |||
43 | #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) | ||
44 | |||
45 | #define MEDIA_ENT_TYPE_SHIFT 16 | ||
46 | #define MEDIA_ENT_TYPE_MASK 0x00ff0000 | ||
47 | #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff | ||
48 | |||
49 | #define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) | ||
50 | #define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) | ||
51 | #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) | ||
52 | #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) | ||
53 | #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) | ||
54 | |||
55 | #define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) | ||
56 | #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) | ||
57 | #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) | ||
58 | #define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) | ||
59 | |||
60 | #define MEDIA_ENT_FL_DEFAULT (1 << 0) | ||
61 | |||
62 | struct media_entity_desc { | ||
63 | __u32 id; | ||
64 | char name[32]; | ||
65 | __u32 type; | ||
66 | __u32 revision; | ||
67 | __u32 flags; | ||
68 | __u32 group_id; | ||
69 | __u16 pads; | ||
70 | __u16 links; | ||
71 | |||
72 | __u32 reserved[4]; | ||
73 | |||
74 | union { | ||
75 | /* Node specifications */ | ||
76 | struct { | ||
77 | __u32 major; | ||
78 | __u32 minor; | ||
79 | } v4l; | ||
80 | struct { | ||
81 | __u32 major; | ||
82 | __u32 minor; | ||
83 | } fb; | ||
84 | struct { | ||
85 | __u32 card; | ||
86 | __u32 device; | ||
87 | __u32 subdevice; | ||
88 | } alsa; | ||
89 | int dvb; | ||
90 | |||
91 | /* Sub-device specifications */ | ||
92 | /* Nothing needed yet */ | ||
93 | __u8 raw[184]; | ||
94 | }; | ||
95 | }; | ||
96 | |||
97 | #define MEDIA_PAD_FL_SINK (1 << 0) | ||
98 | #define MEDIA_PAD_FL_SOURCE (1 << 1) | ||
99 | |||
100 | struct media_pad_desc { | ||
101 | __u32 entity; /* entity ID */ | ||
102 | __u16 index; /* pad index */ | ||
103 | __u32 flags; /* pad flags */ | ||
104 | __u32 reserved[2]; | ||
105 | }; | ||
106 | |||
107 | #define MEDIA_LNK_FL_ENABLED (1 << 0) | ||
108 | #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) | ||
109 | #define MEDIA_LNK_FL_DYNAMIC (1 << 2) | ||
110 | |||
111 | struct media_link_desc { | ||
112 | struct media_pad_desc source; | ||
113 | struct media_pad_desc sink; | ||
114 | __u32 flags; | ||
115 | __u32 reserved[2]; | ||
116 | }; | ||
117 | |||
118 | struct media_links_enum { | ||
119 | __u32 entity; | ||
120 | /* Should have enough room for pads elements */ | ||
121 | struct media_pad_desc __user *pads; | ||
122 | /* Should have enough room for links elements */ | ||
123 | struct media_link_desc __user *links; | ||
124 | __u32 reserved[4]; | ||
125 | }; | ||
126 | |||
127 | #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) | ||
128 | #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) | ||
129 | #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) | ||
130 | #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) | ||
131 | |||
132 | #endif /* __LINUX_MEDIA_H */ | ||
diff --git a/include/linux/meye.h b/include/linux/meye.h new file mode 100644 index 00000000000..0dd49954f74 --- /dev/null +++ b/include/linux/meye.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Motion Eye video4linux driver for Sony Vaio PictureBook | ||
3 | * | ||
4 | * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net> | ||
5 | * | ||
6 | * Copyright (C) 2001-2002 Alcôve <www.alcove.com> | ||
7 | * | ||
8 | * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> | ||
9 | * | ||
10 | * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. | ||
11 | * | ||
12 | * Some parts borrowed from various video4linux drivers, especially | ||
13 | * bttv-driver.c and zoran.c, see original files for credits. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * This program is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | * GNU General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; if not, write to the Free Software | ||
27 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #ifndef _MEYE_H_ | ||
31 | #define _MEYE_H_ | ||
32 | |||
33 | /****************************************************************************/ | ||
34 | /* Private API for handling mjpeg capture / playback. */ | ||
35 | /****************************************************************************/ | ||
36 | |||
37 | struct meye_params { | ||
38 | unsigned char subsample; | ||
39 | unsigned char quality; | ||
40 | unsigned char sharpness; | ||
41 | unsigned char agc; | ||
42 | unsigned char picture; | ||
43 | unsigned char framerate; | ||
44 | }; | ||
45 | |||
46 | /* query the extended parameters */ | ||
47 | #define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params) | ||
48 | /* set the extended parameters */ | ||
49 | #define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params) | ||
50 | /* queue a buffer for mjpeg capture */ | ||
51 | #define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int) | ||
52 | /* sync a previously queued mjpeg buffer */ | ||
53 | #define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int) | ||
54 | /* get a still uncompressed snapshot */ | ||
55 | #define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4) | ||
56 | /* get a jpeg compressed snapshot */ | ||
57 | #define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int) | ||
58 | |||
59 | /* V4L2 private controls */ | ||
60 | #define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE | ||
61 | #define V4L2_CID_MEYE_SHARPNESS (V4L2_CID_PRIVATE_BASE + 1) | ||
62 | #define V4L2_CID_PICTURE (V4L2_CID_PRIVATE_BASE + 2) | ||
63 | #define V4L2_CID_JPEGQUAL (V4L2_CID_PRIVATE_BASE + 3) | ||
64 | #define V4L2_CID_FRAMERATE (V4L2_CID_PRIVATE_BASE + 4) | ||
65 | |||
66 | #endif | ||
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h new file mode 100644 index 00000000000..838c6b487cc --- /dev/null +++ b/include/linux/mfd/ab8500.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> | ||
6 | */ | ||
7 | #ifndef MFD_AB8500_H | ||
8 | #define MFD_AB8500_H | ||
9 | |||
10 | #include <linux/device.h> | ||
11 | |||
12 | /* | ||
13 | * AB8500 bank addresses | ||
14 | */ | ||
15 | #define AB8500_SYS_CTRL1_BLOCK 0x1 | ||
16 | #define AB8500_SYS_CTRL2_BLOCK 0x2 | ||
17 | #define AB8500_REGU_CTRL1 0x3 | ||
18 | #define AB8500_REGU_CTRL2 0x4 | ||
19 | #define AB8500_USB 0x5 | ||
20 | #define AB8500_TVOUT 0x6 | ||
21 | #define AB8500_DBI 0x7 | ||
22 | #define AB8500_ECI_AV_ACC 0x8 | ||
23 | #define AB8500_RESERVED 0x9 | ||
24 | #define AB8500_GPADC 0xA | ||
25 | #define AB8500_CHARGER 0xB | ||
26 | #define AB8500_GAS_GAUGE 0xC | ||
27 | #define AB8500_AUDIO 0xD | ||
28 | #define AB8500_INTERRUPT 0xE | ||
29 | #define AB8500_RTC 0xF | ||
30 | #define AB8500_MISC 0x10 | ||
31 | #define AB8500_DEVELOPMENT 0x11 | ||
32 | #define AB8500_DEBUG 0x12 | ||
33 | #define AB8500_PROD_TEST 0x13 | ||
34 | #define AB8500_OTP_EMUL 0x15 | ||
35 | |||
36 | /* | ||
37 | * Interrupts | ||
38 | */ | ||
39 | |||
40 | #define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 | ||
41 | #define AB8500_INT_UN_PLUG_TV_DET 1 | ||
42 | #define AB8500_INT_PLUG_TV_DET 2 | ||
43 | #define AB8500_INT_TEMP_WARM 3 | ||
44 | #define AB8500_INT_PON_KEY2DB_F 4 | ||
45 | #define AB8500_INT_PON_KEY2DB_R 5 | ||
46 | #define AB8500_INT_PON_KEY1DB_F 6 | ||
47 | #define AB8500_INT_PON_KEY1DB_R 7 | ||
48 | #define AB8500_INT_BATT_OVV 8 | ||
49 | #define AB8500_INT_MAIN_CH_UNPLUG_DET 10 | ||
50 | #define AB8500_INT_MAIN_CH_PLUG_DET 11 | ||
51 | #define AB8500_INT_USB_ID_DET_F 12 | ||
52 | #define AB8500_INT_USB_ID_DET_R 13 | ||
53 | #define AB8500_INT_VBUS_DET_F 14 | ||
54 | #define AB8500_INT_VBUS_DET_R 15 | ||
55 | #define AB8500_INT_VBUS_CH_DROP_END 16 | ||
56 | #define AB8500_INT_RTC_60S 17 | ||
57 | #define AB8500_INT_RTC_ALARM 18 | ||
58 | #define AB8500_INT_BAT_CTRL_INDB 20 | ||
59 | #define AB8500_INT_CH_WD_EXP 21 | ||
60 | #define AB8500_INT_VBUS_OVV 22 | ||
61 | #define AB8500_INT_MAIN_CH_DROP_END 23 | ||
62 | #define AB8500_INT_CCN_CONV_ACC 24 | ||
63 | #define AB8500_INT_INT_AUD 25 | ||
64 | #define AB8500_INT_CCEOC 26 | ||
65 | #define AB8500_INT_CC_INT_CALIB 27 | ||
66 | #define AB8500_INT_LOW_BAT_F 28 | ||
67 | #define AB8500_INT_LOW_BAT_R 29 | ||
68 | #define AB8500_INT_BUP_CHG_NOT_OK 30 | ||
69 | #define AB8500_INT_BUP_CHG_OK 31 | ||
70 | #define AB8500_INT_GP_HW_ADC_CONV_END 32 | ||
71 | #define AB8500_INT_ACC_DETECT_1DB_F 33 | ||
72 | #define AB8500_INT_ACC_DETECT_1DB_R 34 | ||
73 | #define AB8500_INT_ACC_DETECT_22DB_F 35 | ||
74 | #define AB8500_INT_ACC_DETECT_22DB_R 36 | ||
75 | #define AB8500_INT_ACC_DETECT_21DB_F 37 | ||
76 | #define AB8500_INT_ACC_DETECT_21DB_R 38 | ||
77 | #define AB8500_INT_GP_SW_ADC_CONV_END 39 | ||
78 | #define AB8500_INT_GPIO6R 40 | ||
79 | #define AB8500_INT_GPIO7R 41 | ||
80 | #define AB8500_INT_GPIO8R 42 | ||
81 | #define AB8500_INT_GPIO9R 43 | ||
82 | #define AB8500_INT_GPIO10R 44 | ||
83 | #define AB8500_INT_GPIO11R 45 | ||
84 | #define AB8500_INT_GPIO12R 46 | ||
85 | #define AB8500_INT_GPIO13R 47 | ||
86 | #define AB8500_INT_GPIO24R 48 | ||
87 | #define AB8500_INT_GPIO25R 49 | ||
88 | #define AB8500_INT_GPIO36R 50 | ||
89 | #define AB8500_INT_GPIO37R 51 | ||
90 | #define AB8500_INT_GPIO38R 52 | ||
91 | #define AB8500_INT_GPIO39R 53 | ||
92 | #define AB8500_INT_GPIO40R 54 | ||
93 | #define AB8500_INT_GPIO41R 55 | ||
94 | #define AB8500_INT_GPIO6F 56 | ||
95 | #define AB8500_INT_GPIO7F 57 | ||
96 | #define AB8500_INT_GPIO8F 58 | ||
97 | #define AB8500_INT_GPIO9F 59 | ||
98 | #define AB8500_INT_GPIO10F 60 | ||
99 | #define AB8500_INT_GPIO11F 61 | ||
100 | #define AB8500_INT_GPIO12F 62 | ||
101 | #define AB8500_INT_GPIO13F 63 | ||
102 | #define AB8500_INT_GPIO24F 64 | ||
103 | #define AB8500_INT_GPIO25F 65 | ||
104 | #define AB8500_INT_GPIO36F 66 | ||
105 | #define AB8500_INT_GPIO37F 67 | ||
106 | #define AB8500_INT_GPIO38F 68 | ||
107 | #define AB8500_INT_GPIO39F 69 | ||
108 | #define AB8500_INT_GPIO40F 70 | ||
109 | #define AB8500_INT_GPIO41F 71 | ||
110 | #define AB8500_INT_ADP_SOURCE_ERROR 72 | ||
111 | #define AB8500_INT_ADP_SINK_ERROR 73 | ||
112 | #define AB8500_INT_ADP_PROBE_PLUG 74 | ||
113 | #define AB8500_INT_ADP_PROBE_UNPLUG 75 | ||
114 | #define AB8500_INT_ADP_SENSE_OFF 76 | ||
115 | #define AB8500_INT_USB_PHY_POWER_ERR 78 | ||
116 | #define AB8500_INT_USB_LINK_STATUS 79 | ||
117 | #define AB8500_INT_BTEMP_LOW 80 | ||
118 | #define AB8500_INT_BTEMP_LOW_MEDIUM 81 | ||
119 | #define AB8500_INT_BTEMP_MEDIUM_HIGH 82 | ||
120 | #define AB8500_INT_BTEMP_HIGH 83 | ||
121 | #define AB8500_INT_USB_CHARGER_NOT_OK 89 | ||
122 | #define AB8500_INT_ID_WAKEUP_R 90 | ||
123 | #define AB8500_INT_ID_DET_R1R 92 | ||
124 | #define AB8500_INT_ID_DET_R2R 93 | ||
125 | #define AB8500_INT_ID_DET_R3R 94 | ||
126 | #define AB8500_INT_ID_DET_R4R 95 | ||
127 | #define AB8500_INT_ID_WAKEUP_F 96 | ||
128 | #define AB8500_INT_ID_DET_R1F 98 | ||
129 | #define AB8500_INT_ID_DET_R2F 99 | ||
130 | #define AB8500_INT_ID_DET_R3F 100 | ||
131 | #define AB8500_INT_ID_DET_R4F 101 | ||
132 | #define AB8500_INT_USB_CHG_DET_DONE 102 | ||
133 | #define AB8500_INT_USB_CH_TH_PROT_F 104 | ||
134 | #define AB8500_INT_USB_CH_TH_PROT_R 105 | ||
135 | #define AB8500_INT_MAIN_CH_TH_PROT_F 106 | ||
136 | #define AB8500_INT_MAIN_CH_TH_PROT_R 107 | ||
137 | #define AB8500_INT_USB_CHARGER_NOT_OKF 111 | ||
138 | |||
139 | #define AB8500_NR_IRQS 112 | ||
140 | #define AB8500_NUM_IRQ_REGS 14 | ||
141 | |||
142 | /** | ||
143 | * struct ab8500 - ab8500 internal structure | ||
144 | * @dev: parent device | ||
145 | * @lock: read/write operations lock | ||
146 | * @irq_lock: genirq bus lock | ||
147 | * @irq: irq line | ||
148 | * @chip_id: chip revision id | ||
149 | * @write: register write | ||
150 | * @read: register read | ||
151 | * @rx_buf: rx buf for SPI | ||
152 | * @tx_buf: tx buf for SPI | ||
153 | * @mask: cache of IRQ regs for bus lock | ||
154 | * @oldmask: cache of previous IRQ regs for bus lock | ||
155 | */ | ||
156 | struct ab8500 { | ||
157 | struct device *dev; | ||
158 | struct mutex lock; | ||
159 | struct mutex irq_lock; | ||
160 | |||
161 | int irq_base; | ||
162 | int irq; | ||
163 | u8 chip_id; | ||
164 | |||
165 | int (*write) (struct ab8500 *a8500, u16 addr, u8 data); | ||
166 | int (*read) (struct ab8500 *a8500, u16 addr); | ||
167 | |||
168 | unsigned long tx_buf[4]; | ||
169 | unsigned long rx_buf[4]; | ||
170 | |||
171 | u8 mask[AB8500_NUM_IRQ_REGS]; | ||
172 | u8 oldmask[AB8500_NUM_IRQ_REGS]; | ||
173 | }; | ||
174 | |||
175 | struct regulator_reg_init; | ||
176 | struct regulator_init_data; | ||
177 | struct ab8500_gpio_platform_data; | ||
178 | |||
179 | /** | ||
180 | * struct ab8500_platform_data - AB8500 platform data | ||
181 | * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used | ||
182 | * @init: board-specific initialization after detection of ab8500 | ||
183 | * @num_regulator_reg_init: number of regulator init registers | ||
184 | * @regulator_reg_init: regulator init registers | ||
185 | * @num_regulator: number of regulators | ||
186 | * @regulator: machine-specific constraints for regulators | ||
187 | */ | ||
188 | struct ab8500_platform_data { | ||
189 | int irq_base; | ||
190 | void (*init) (struct ab8500 *); | ||
191 | int num_regulator_reg_init; | ||
192 | struct ab8500_regulator_reg_init *regulator_reg_init; | ||
193 | int num_regulator; | ||
194 | struct regulator_init_data *regulator; | ||
195 | struct ab8500_gpio_platform_data *gpio; | ||
196 | }; | ||
197 | |||
198 | extern int __devinit ab8500_init(struct ab8500 *ab8500); | ||
199 | extern int __devexit ab8500_exit(struct ab8500 *ab8500); | ||
200 | |||
201 | #endif /* MFD_AB8500_H */ | ||
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/ab8500/gpadc.h new file mode 100644 index 00000000000..46b954011f1 --- /dev/null +++ b/include/linux/mfd/ab8500/gpadc.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 ST-Ericsson SA | ||
3 | * Licensed under GPLv2. | ||
4 | * | ||
5 | * Author: Arun R Murthy <arun.murthy@stericsson.com> | ||
6 | * Author: Daniel Willerud <daniel.willerud@stericsson.com> | ||
7 | */ | ||
8 | |||
9 | #ifndef _AB8500_GPADC_H | ||
10 | #define _AB8500_GPADC_H | ||
11 | |||
12 | /* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */ | ||
13 | #define BAT_CTRL 0x01 | ||
14 | #define BTEMP_BALL 0x02 | ||
15 | #define MAIN_CHARGER_V 0x03 | ||
16 | #define ACC_DETECT1 0x04 | ||
17 | #define ACC_DETECT2 0x05 | ||
18 | #define ADC_AUX1 0x06 | ||
19 | #define ADC_AUX2 0x07 | ||
20 | #define MAIN_BAT_V 0x08 | ||
21 | #define VBUS_V 0x09 | ||
22 | #define MAIN_CHARGER_C 0x0A | ||
23 | #define USB_CHARGER_C 0x0B | ||
24 | #define BK_BAT_V 0x0C | ||
25 | #define DIE_TEMP 0x0D | ||
26 | |||
27 | struct ab8500_gpadc; | ||
28 | |||
29 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); | ||
30 | int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input); | ||
31 | |||
32 | #endif /* _AB8500_GPADC_H */ | ||
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/ab8500/gpio.h new file mode 100644 index 00000000000..488a8c920a2 --- /dev/null +++ b/include/linux/mfd/ab8500/gpio.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright ST-Ericsson 2010. | ||
3 | * | ||
4 | * Author: Bibek Basu <bibek.basu@stericsson.com> | ||
5 | * Licensed under GPLv2. | ||
6 | */ | ||
7 | |||
8 | #ifndef _AB8500_GPIO_H | ||
9 | #define _AB8500_GPIO_H | ||
10 | |||
11 | /* | ||
12 | * Platform data to register a block: only the initial gpio/irq number. | ||
13 | */ | ||
14 | |||
15 | struct ab8500_gpio_platform_data { | ||
16 | int gpio_base; | ||
17 | u32 irq_base; | ||
18 | u8 config_reg[7]; | ||
19 | }; | ||
20 | |||
21 | #endif /* _AB8500_GPIO_H */ | ||
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/ab8500/sysctrl.h new file mode 100644 index 00000000000..10da0291f8f --- /dev/null +++ b/include/linux/mfd/ab8500/sysctrl.h | |||
@@ -0,0 +1,254 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson. | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | #ifndef __AB8500_SYSCTRL_H | ||
7 | #define __AB8500_SYSCTRL_H | ||
8 | |||
9 | #include <linux/bitops.h> | ||
10 | |||
11 | #ifdef CONFIG_AB8500_CORE | ||
12 | |||
13 | int ab8500_sysctrl_read(u16 reg, u8 *value); | ||
14 | int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value); | ||
15 | |||
16 | #else | ||
17 | |||
18 | static inline int ab8500_sysctrl_read(u16 reg, u8 *value) | ||
19 | { | ||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value) | ||
24 | { | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | #endif /* CONFIG_AB8500_CORE */ | ||
29 | |||
30 | static inline int ab8500_sysctrl_set(u16 reg, u8 bits) | ||
31 | { | ||
32 | return ab8500_sysctrl_write(reg, bits, bits); | ||
33 | } | ||
34 | |||
35 | static inline int ab8500_sysctrl_clear(u16 reg, u8 bits) | ||
36 | { | ||
37 | return ab8500_sysctrl_write(reg, bits, 0); | ||
38 | } | ||
39 | |||
40 | /* Registers */ | ||
41 | #define AB8500_TURNONSTATUS 0x100 | ||
42 | #define AB8500_RESETSTATUS 0x101 | ||
43 | #define AB8500_PONKEY1PRESSSTATUS 0x102 | ||
44 | #define AB8500_SYSCLKREQSTATUS 0x142 | ||
45 | #define AB8500_STW4500CTRL1 0x180 | ||
46 | #define AB8500_STW4500CTRL2 0x181 | ||
47 | #define AB8500_STW4500CTRL3 0x200 | ||
48 | #define AB8500_MAINWDOGCTRL 0x201 | ||
49 | #define AB8500_MAINWDOGTIMER 0x202 | ||
50 | #define AB8500_LOWBAT 0x203 | ||
51 | #define AB8500_BATTOK 0x204 | ||
52 | #define AB8500_SYSCLKTIMER 0x205 | ||
53 | #define AB8500_SMPSCLKCTRL 0x206 | ||
54 | #define AB8500_SMPSCLKSEL1 0x207 | ||
55 | #define AB8500_SMPSCLKSEL2 0x208 | ||
56 | #define AB8500_SMPSCLKSEL3 0x209 | ||
57 | #define AB8500_SYSULPCLKCONF 0x20A | ||
58 | #define AB8500_SYSULPCLKCTRL1 0x20B | ||
59 | #define AB8500_SYSCLKCTRL 0x20C | ||
60 | #define AB8500_SYSCLKREQ1VALID 0x20D | ||
61 | #define AB8500_SYSTEMCTRLSUP 0x20F | ||
62 | #define AB8500_SYSCLKREQ1RFCLKBUF 0x210 | ||
63 | #define AB8500_SYSCLKREQ2RFCLKBUF 0x211 | ||
64 | #define AB8500_SYSCLKREQ3RFCLKBUF 0x212 | ||
65 | #define AB8500_SYSCLKREQ4RFCLKBUF 0x213 | ||
66 | #define AB8500_SYSCLKREQ5RFCLKBUF 0x214 | ||
67 | #define AB8500_SYSCLKREQ6RFCLKBUF 0x215 | ||
68 | #define AB8500_SYSCLKREQ7RFCLKBUF 0x216 | ||
69 | #define AB8500_SYSCLKREQ8RFCLKBUF 0x217 | ||
70 | #define AB8500_DITHERCLKCTRL 0x220 | ||
71 | #define AB8500_SWATCTRL 0x230 | ||
72 | #define AB8500_HIQCLKCTRL 0x232 | ||
73 | #define AB8500_VSIMSYSCLKCTRL 0x233 | ||
74 | |||
75 | /* Bits */ | ||
76 | #define AB8500_TURNONSTATUS_PORNVBAT BIT(0) | ||
77 | #define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1) | ||
78 | #define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2) | ||
79 | #define AB8500_TURNONSTATUS_RTCALARM BIT(3) | ||
80 | #define AB8500_TURNONSTATUS_MAINCHDET BIT(4) | ||
81 | #define AB8500_TURNONSTATUS_VBUSDET BIT(5) | ||
82 | #define AB8500_TURNONSTATUS_USBIDDETECT BIT(6) | ||
83 | |||
84 | #define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0) | ||
85 | #define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2) | ||
86 | |||
87 | #define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F | ||
88 | #define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0 | ||
89 | |||
90 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0) | ||
91 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1) | ||
92 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2) | ||
93 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3) | ||
94 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4) | ||
95 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5) | ||
96 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6) | ||
97 | #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7) | ||
98 | |||
99 | #define AB8500_STW4500CTRL1_SWOFF BIT(0) | ||
100 | #define AB8500_STW4500CTRL1_SWRESET4500N BIT(1) | ||
101 | #define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2) | ||
102 | |||
103 | #define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0) | ||
104 | #define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1) | ||
105 | #define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2) | ||
106 | #define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3) | ||
107 | #define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4) | ||
108 | #define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5) | ||
109 | #define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6) | ||
110 | #define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7) | ||
111 | |||
112 | #define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0) | ||
113 | #define AB8500_STW4500CTRL3_RESETAUDN BIT(1) | ||
114 | #define AB8500_STW4500CTRL3_RESETDENCN BIT(2) | ||
115 | #define AB8500_STW4500CTRL3_THSDENA BIT(3) | ||
116 | |||
117 | #define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0) | ||
118 | #define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1) | ||
119 | #define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4) | ||
120 | |||
121 | #define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F | ||
122 | #define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0 | ||
123 | |||
124 | #define AB8500_LOWBAT_LOWBATENA BIT(0) | ||
125 | #define AB8500_LOWBAT_LOWBAT_MASK 0x7E | ||
126 | #define AB8500_LOWBAT_LOWBAT_SHIFT 1 | ||
127 | |||
128 | #define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F | ||
129 | #define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0 | ||
130 | #define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0 | ||
131 | #define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4 | ||
132 | |||
133 | #define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F | ||
134 | #define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0 | ||
135 | #define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0 | ||
136 | #define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4 | ||
137 | |||
138 | #define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03 | ||
139 | #define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0 | ||
140 | #define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2) | ||
141 | |||
142 | #define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07 | ||
143 | #define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0 | ||
144 | #define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38 | ||
145 | #define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3 | ||
146 | |||
147 | #define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07 | ||
148 | #define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0 | ||
149 | #define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38 | ||
150 | #define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3 | ||
151 | |||
152 | #define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07 | ||
153 | #define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0 | ||
154 | #define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38 | ||
155 | #define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3 | ||
156 | |||
157 | #define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03 | ||
158 | #define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0 | ||
159 | #define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2) | ||
160 | #define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3) | ||
161 | #define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4) | ||
162 | #define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5) | ||
163 | #define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6) | ||
164 | #define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7) | ||
165 | |||
166 | #define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03 | ||
167 | #define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0 | ||
168 | #define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2) | ||
169 | #define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3) | ||
170 | #define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4) | ||
171 | #define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5) | ||
172 | #define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6) | ||
173 | #define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7) | ||
174 | |||
175 | #define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0) | ||
176 | #define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1) | ||
177 | #define AB8500_SYSCLKCTRL_USBCLKENA BIT(2) | ||
178 | |||
179 | #define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0) | ||
180 | #define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1) | ||
181 | #define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2) | ||
182 | |||
183 | #define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03 | ||
184 | #define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0 | ||
185 | #define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C | ||
186 | #define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2 | ||
187 | #define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4) | ||
188 | |||
189 | #define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2) | ||
190 | #define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3) | ||
191 | #define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4) | ||
192 | |||
193 | #define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2) | ||
194 | #define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3) | ||
195 | #define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4) | ||
196 | |||
197 | #define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2) | ||
198 | #define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3) | ||
199 | #define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4) | ||
200 | |||
201 | #define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2) | ||
202 | #define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3) | ||
203 | #define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4) | ||
204 | |||
205 | #define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2) | ||
206 | #define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3) | ||
207 | #define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4) | ||
208 | |||
209 | #define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2) | ||
210 | #define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3) | ||
211 | #define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4) | ||
212 | |||
213 | #define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2) | ||
214 | #define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3) | ||
215 | #define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4) | ||
216 | |||
217 | #define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2) | ||
218 | #define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3) | ||
219 | #define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4) | ||
220 | |||
221 | #define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0) | ||
222 | #define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1) | ||
223 | #define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2) | ||
224 | #define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3) | ||
225 | #define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4) | ||
226 | #define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5) | ||
227 | #define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0 | ||
228 | #define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6 | ||
229 | |||
230 | #define AB8500_SWATCTRL_UPDATERF BIT(0) | ||
231 | #define AB8500_SWATCTRL_SWATENABLE BIT(1) | ||
232 | #define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C | ||
233 | #define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2 | ||
234 | #define AB8500_SWATCTRL_SWATBIT5 BIT(6) | ||
235 | |||
236 | #define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0) | ||
237 | #define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1) | ||
238 | #define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2) | ||
239 | #define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3) | ||
240 | #define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4) | ||
241 | #define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5) | ||
242 | #define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6) | ||
243 | #define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7) | ||
244 | |||
245 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0) | ||
246 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1) | ||
247 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2) | ||
248 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3) | ||
249 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4) | ||
250 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5) | ||
251 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6) | ||
252 | #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7) | ||
253 | |||
254 | #endif /* __AB8500_SYSCTRL_H */ | ||
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h new file mode 100644 index 00000000000..f0977986402 --- /dev/null +++ b/include/linux/mfd/db5500-prcmu.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * | ||
6 | * U5500 PRCMU API. | ||
7 | */ | ||
8 | #ifndef __MACH_PRCMU_U5500_H | ||
9 | #define __MACH_PRCMU_U5500_H | ||
10 | |||
11 | #ifdef CONFIG_UX500_SOC_DB5500 | ||
12 | |||
13 | void db5500_prcmu_early_init(void); | ||
14 | |||
15 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
16 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
17 | |||
18 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
19 | |||
20 | static inline void db5500_prcmu_early_init(void) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
25 | { | ||
26 | return -ENOSYS; | ||
27 | } | ||
28 | |||
29 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | ||
30 | { | ||
31 | return -ENOSYS; | ||
32 | } | ||
33 | |||
34 | #endif /* CONFIG_UX500_SOC_DB5500 */ | ||
35 | |||
36 | static inline int db5500_prcmu_config_abb_event_readout(u32 abb_events) | ||
37 | { | ||
38 | #ifdef CONFIG_MACH_U5500_SIMULATOR | ||
39 | return 0; | ||
40 | #else | ||
41 | return -1; | ||
42 | #endif | ||
43 | } | ||
44 | |||
45 | #endif /* __MACH_PRCMU_U5500_H */ | ||
diff --git a/include/linux/mfd/max77663-core.h b/include/linux/mfd/max77663-core.h new file mode 100644 index 00000000000..acfe22aac53 --- /dev/null +++ b/include/linux/mfd/max77663-core.h | |||
@@ -0,0 +1,178 @@ | |||
1 | /* | ||
2 | * include/linux/mfd/max77663-core.h | ||
3 | * | ||
4 | * Copyright 2011 Maxim Integrated Products, Inc. | ||
5 | * Copyright (C) 2011-2012 NVIDIA Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License as | ||
9 | * published by the Free Software Foundation; either version 2 of the | ||
10 | * License, or (at your option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_MFD_MAX77663_CORE_H__ | ||
15 | #define __LINUX_MFD_MAX77663_CORE_H__ | ||
16 | |||
17 | #include <linux/irq.h> | ||
18 | #include <linux/mfd/core.h> | ||
19 | |||
20 | /* | ||
21 | * Interrupts | ||
22 | */ | ||
23 | enum { | ||
24 | MAX77663_IRQ_LBT_LB, /* Low-Battery */ | ||
25 | MAX77663_IRQ_LBT_THERM_ALRM1, /* Thermal alarm status, > 120C */ | ||
26 | MAX77663_IRQ_LBT_THERM_ALRM2, /* Thermal alarm status, > 140C */ | ||
27 | |||
28 | MAX77663_IRQ_GPIO0, /* GPIO0 edge detection */ | ||
29 | MAX77663_IRQ_GPIO1, /* GPIO1 edge detection */ | ||
30 | MAX77663_IRQ_GPIO2, /* GPIO2 edge detection */ | ||
31 | MAX77663_IRQ_GPIO3, /* GPIO3 edge detection */ | ||
32 | MAX77663_IRQ_GPIO4, /* GPIO4 edge detection */ | ||
33 | MAX77663_IRQ_GPIO5, /* GPIO5 edge detection */ | ||
34 | MAX77663_IRQ_GPIO6, /* GPIO6 edge detection */ | ||
35 | MAX77663_IRQ_GPIO7, /* GPIO7 edge detection */ | ||
36 | |||
37 | MAX77663_IRQ_ONOFF_HRDPOWRN, /* Hard power off warnning */ | ||
38 | MAX77663_IRQ_ONOFF_EN0_1SEC, /* EN0 active for 1s */ | ||
39 | MAX77663_IRQ_ONOFF_EN0_FALLING, /* EN0 falling */ | ||
40 | MAX77663_IRQ_ONOFF_EN0_RISING, /* EN0 rising */ | ||
41 | MAX77663_IRQ_ONOFF_LID_FALLING, /* LID falling */ | ||
42 | MAX77663_IRQ_ONOFF_LID_RISING, /* LID rising */ | ||
43 | MAX77663_IRQ_ONOFF_ACOK_FALLING,/* ACOK falling */ | ||
44 | MAX77663_IRQ_ONOFF_ACOK_RISING, /* ACOK rising */ | ||
45 | |||
46 | MAX77663_IRQ_RTC, /* RTC */ | ||
47 | MAX77663_IRQ_SD_PF, /* SD power fail */ | ||
48 | MAX77663_IRQ_LDO_PF, /* LDO power fail */ | ||
49 | MAX77663_IRQ_32K, /* 32kHz oscillator */ | ||
50 | MAX77663_IRQ_NVER, /* Non-Volatile Event Recorder */ | ||
51 | |||
52 | MAX77663_IRQ_NR, | ||
53 | }; | ||
54 | |||
55 | /* | ||
56 | *GPIOs | ||
57 | */ | ||
58 | enum { | ||
59 | MAX77663_GPIO0, | ||
60 | MAX77663_GPIO1, | ||
61 | MAX77663_GPIO2, | ||
62 | MAX77663_GPIO3, | ||
63 | MAX77663_GPIO4, | ||
64 | MAX77663_GPIO5, | ||
65 | MAX77663_GPIO6, | ||
66 | MAX77663_GPIO7, | ||
67 | |||
68 | MAX77663_GPIO_NR, | ||
69 | }; | ||
70 | |||
71 | /* Direction */ | ||
72 | enum max77663_gpio_dir { | ||
73 | GPIO_DIR_DEF, | ||
74 | GPIO_DIR_IN, | ||
75 | GPIO_DIR_OUT, | ||
76 | }; | ||
77 | |||
78 | /* Data output */ | ||
79 | enum max77663_gpio_data_out { | ||
80 | GPIO_DOUT_DEF, | ||
81 | GPIO_DOUT_HIGH, | ||
82 | GPIO_DOUT_LOW, | ||
83 | }; | ||
84 | |||
85 | /* Output drive */ | ||
86 | enum max77663_gpio_out_drv { | ||
87 | GPIO_OUT_DRV_DEF, | ||
88 | GPIO_OUT_DRV_PUSH_PULL, | ||
89 | GPIO_OUT_DRV_OPEN_DRAIN, | ||
90 | }; | ||
91 | |||
92 | /* Pull-up */ | ||
93 | enum max77663_gpio_pull_up { | ||
94 | GPIO_PU_DEF, | ||
95 | GPIO_PU_ENABLE, | ||
96 | GPIO_PU_DISABLE, | ||
97 | }; | ||
98 | |||
99 | /* Pull-down */ | ||
100 | enum max77663_gpio_pull_down { | ||
101 | GPIO_PD_DEF, | ||
102 | GPIO_PD_ENABLE, | ||
103 | GPIO_PD_DISABLE, | ||
104 | }; | ||
105 | |||
106 | /* Alternate */ | ||
107 | enum max77663_gpio_alt { | ||
108 | GPIO_ALT_DEF, | ||
109 | GPIO_ALT_ENABLE, | ||
110 | GPIO_ALT_DISABLE, | ||
111 | }; | ||
112 | |||
113 | /* | ||
114 | * Flags | ||
115 | */ | ||
116 | #define SLP_LPM_ENABLE 0x01 | ||
117 | |||
118 | struct max77663_gpio_config { | ||
119 | int gpio; /* gpio number */ | ||
120 | enum max77663_gpio_dir dir; | ||
121 | enum max77663_gpio_data_out dout; | ||
122 | enum max77663_gpio_out_drv out_drv; | ||
123 | enum max77663_gpio_pull_up pull_up; | ||
124 | enum max77663_gpio_pull_down pull_down; | ||
125 | enum max77663_gpio_alt alternate; | ||
126 | }; | ||
127 | |||
128 | struct max77663_platform_data { | ||
129 | int irq_base; | ||
130 | int gpio_base; | ||
131 | |||
132 | int num_gpio_cfgs; | ||
133 | struct max77663_gpio_config *gpio_cfgs; | ||
134 | |||
135 | int num_subdevs; | ||
136 | struct mfd_cell *sub_devices; | ||
137 | |||
138 | unsigned int flags; | ||
139 | |||
140 | unsigned char rtc_i2c_addr; | ||
141 | |||
142 | bool use_power_off; | ||
143 | }; | ||
144 | |||
145 | #if defined(CONFIG_MFD_MAX77663) | ||
146 | int max77663_read(struct device *dev, u8 addr, void *values, u32 len, | ||
147 | bool is_rtc); | ||
148 | int max77663_write(struct device *dev, u8 addr, void *values, u32 len, | ||
149 | bool is_rtc); | ||
150 | int max77663_set_bits(struct device *dev, u8 addr, u8 mask, u8 value, | ||
151 | bool is_rtc); | ||
152 | int max77663_gpio_set_alternate(int gpio, int alternate); | ||
153 | #else | ||
154 | static inline int max77663_read(struct device *dev, u8 addr, void *values, | ||
155 | u32 len, bool is_rtc) | ||
156 | { | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static inline int max77663_write(struct device *dev, u8 addr, void *values, | ||
161 | u32 len, bool is_rtc) | ||
162 | { | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static inline int max77663_set_bits(struct device *dev, u8 addr, u8 mask, | ||
167 | u8 value, bool is_rtc) | ||
168 | { | ||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static inline int max77663_gpio_set_alternate(int gpio, int alternate) | ||
173 | { | ||
174 | return 0; | ||
175 | } | ||
176 | #endif /* defined(CONFIG_MFD_MAX77663) */ | ||
177 | |||
178 | #endif /* __LINUX_MFD_MAX77663_CORE_H__ */ | ||
diff --git a/include/linux/mfd/max8907c.h b/include/linux/mfd/max8907c.h new file mode 100644 index 00000000000..48014b0485c --- /dev/null +++ b/include/linux/mfd/max8907c.h | |||
@@ -0,0 +1,259 @@ | |||
1 | /* linux/mfd/max8907c.h | ||
2 | * | ||
3 | * Functions to access MAX8907C power management chip. | ||
4 | * | ||
5 | * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_MAX8907C_H | ||
13 | #define __LINUX_MFD_MAX8907C_H | ||
14 | |||
15 | /* MAX8907C register map */ | ||
16 | #define MAX8907C_REG_SYSENSEL 0x00 | ||
17 | #define MAX8907C_REG_ON_OFF_IRQ1 0x01 | ||
18 | #define MAX8907C_REG_ON_OFF_IRQ1_MASK 0x02 | ||
19 | #define MAX8907C_REG_ON_OFF_STAT 0x03 | ||
20 | #define MAX8907C_REG_SDCTL1 0x04 | ||
21 | #define MAX8907C_REG_SDSEQCNT1 0x05 | ||
22 | #define MAX8907C_REG_SDV1 0x06 | ||
23 | #define MAX8907C_REG_SDCTL2 0x07 | ||
24 | #define MAX8907C_REG_SDSEQCNT2 0x08 | ||
25 | #define MAX8907C_REG_SDV2 0x09 | ||
26 | #define MAX8907C_REG_SDCTL3 0x0A | ||
27 | #define MAX8907C_REG_SDSEQCNT3 0x0B | ||
28 | #define MAX8907C_REG_SDV3 0x0C | ||
29 | #define MAX8907C_REG_ON_OFF_IRQ2 0x0D | ||
30 | #define MAX8907C_REG_ON_OFF_IRQ2_MASK 0x0E | ||
31 | #define MAX8907C_REG_RESET_CNFG 0x0F | ||
32 | #define MAX8907C_REG_LDOCTL16 0x10 | ||
33 | #define MAX8907C_REG_LDOSEQCNT16 0x11 | ||
34 | #define MAX8907C_REG_LDO16VOUT 0x12 | ||
35 | #define MAX8907C_REG_SDBYSEQCNT 0x13 | ||
36 | #define MAX8907C_REG_LDOCTL17 0x14 | ||
37 | #define MAX8907C_REG_LDOSEQCNT17 0x15 | ||
38 | #define MAX8907C_REG_LDO17VOUT 0x16 | ||
39 | #define MAX8907C_REG_LDOCTL1 0x18 | ||
40 | #define MAX8907C_REG_LDOSEQCNT1 0x19 | ||
41 | #define MAX8907C_REG_LDO1VOUT 0x1A | ||
42 | #define MAX8907C_REG_LDOCTL2 0x1C | ||
43 | #define MAX8907C_REG_LDOSEQCNT2 0x1D | ||
44 | #define MAX8907C_REG_LDO2VOUT 0x1E | ||
45 | #define MAX8907C_REG_LDOCTL3 0x20 | ||
46 | #define MAX8907C_REG_LDOSEQCNT3 0x21 | ||
47 | #define MAX8907C_REG_LDO3VOUT 0x22 | ||
48 | #define MAX8907C_REG_LDOCTL4 0x24 | ||
49 | #define MAX8907C_REG_LDOSEQCNT4 0x25 | ||
50 | #define MAX8907C_REG_LDO4VOUT 0x26 | ||
51 | #define MAX8907C_REG_LDOCTL5 0x28 | ||
52 | #define MAX8907C_REG_LDOSEQCNT5 0x29 | ||
53 | #define MAX8907C_REG_LDO5VOUT 0x2A | ||
54 | #define MAX8907C_REG_LDOCTL6 0x2C | ||
55 | #define MAX8907C_REG_LDOSEQCNT6 0x2D | ||
56 | #define MAX8907C_REG_LDO6VOUT 0x2E | ||
57 | #define MAX8907C_REG_LDOCTL7 0x30 | ||
58 | #define MAX8907C_REG_LDOSEQCNT7 0x31 | ||
59 | #define MAX8907C_REG_LDO7VOUT 0x32 | ||
60 | #define MAX8907C_REG_LDOCTL8 0x34 | ||
61 | #define MAX8907C_REG_LDOSEQCNT8 0x35 | ||
62 | #define MAX8907C_REG_LDO8VOUT 0x36 | ||
63 | #define MAX8907C_REG_LDOCTL9 0x38 | ||
64 | #define MAX8907C_REG_LDOSEQCNT9 0x39 | ||
65 | #define MAX8907C_REG_LDO9VOUT 0x3A | ||
66 | #define MAX8907C_REG_LDOCTL10 0x3C | ||
67 | #define MAX8907C_REG_LDOSEQCNT10 0x3D | ||
68 | #define MAX8907C_REG_LDO10VOUT 0x3E | ||
69 | #define MAX8907C_REG_LDOCTL11 0x40 | ||
70 | #define MAX8907C_REG_LDOSEQCNT11 0x41 | ||
71 | #define MAX8907C_REG_LDO11VOUT 0x42 | ||
72 | #define MAX8907C_REG_LDOCTL12 0x44 | ||
73 | #define MAX8907C_REG_LDOSEQCNT12 0x45 | ||
74 | #define MAX8907C_REG_LDO12VOUT 0x46 | ||
75 | #define MAX8907C_REG_LDOCTL13 0x48 | ||
76 | #define MAX8907C_REG_LDOSEQCNT13 0x49 | ||
77 | #define MAX8907C_REG_LDO13VOUT 0x4A | ||
78 | #define MAX8907C_REG_LDOCTL14 0x4C | ||
79 | #define MAX8907C_REG_LDOSEQCNT14 0x4D | ||
80 | #define MAX8907C_REG_LDO14VOUT 0x4E | ||
81 | #define MAX8907C_REG_LDOCTL15 0x50 | ||
82 | #define MAX8907C_REG_LDOSEQCNT15 0x51 | ||
83 | #define MAX8907C_REG_LDO15VOUT 0x52 | ||
84 | #define MAX8907C_REG_OUT5VEN 0x54 | ||
85 | #define MAX8907C_REG_OUT5VSEQ 0x55 | ||
86 | #define MAX8907C_REG_OUT33VEN 0x58 | ||
87 | #define MAX8907C_REG_OUT33VSEQ 0x59 | ||
88 | #define MAX8907C_REG_LDOCTL19 0x5C | ||
89 | #define MAX8907C_REG_LDOSEQCNT19 0x5D | ||
90 | #define MAX8907C_REG_LDO19VOUT 0x5E | ||
91 | #define MAX8907C_REG_LBCNFG 0x60 | ||
92 | #define MAX8907C_REG_SEQ1CNFG 0x64 | ||
93 | #define MAX8907C_REG_SEQ2CNFG 0x65 | ||
94 | #define MAX8907C_REG_SEQ3CNFG 0x66 | ||
95 | #define MAX8907C_REG_SEQ4CNFG 0x67 | ||
96 | #define MAX8907C_REG_SEQ5CNFG 0x68 | ||
97 | #define MAX8907C_REG_SEQ6CNFG 0x69 | ||
98 | #define MAX8907C_REG_SEQ7CNFG 0x6A | ||
99 | #define MAX8907C_REG_LDOCTL18 0x72 | ||
100 | #define MAX8907C_REG_LDOSEQCNT18 0x73 | ||
101 | #define MAX8907C_REG_LDO18VOUT 0x74 | ||
102 | #define MAX8907C_REG_BBAT_CNFG 0x78 | ||
103 | #define MAX8907C_REG_CHG_CNTL1 0x7C | ||
104 | #define MAX8907C_REG_CHG_CNTL2 0x7D | ||
105 | #define MAX8907C_REG_CHG_IRQ1 0x7E | ||
106 | #define MAX8907C_REG_CHG_IRQ2 0x7F | ||
107 | #define MAX8907C_REG_CHG_IRQ1_MASK 0x80 | ||
108 | #define MAX8907C_REG_CHG_IRQ2_MASK 0x81 | ||
109 | #define MAX8907C_REG_CHG_STAT 0x82 | ||
110 | #define MAX8907C_REG_WLED_MODE_CNTL 0x84 | ||
111 | #define MAX8907C_REG_ILED_CNTL 0x84 | ||
112 | #define MAX8907C_REG_II1RR 0x8E | ||
113 | #define MAX8907C_REG_II2RR 0x8F | ||
114 | #define MAX8907C_REG_LDOCTL20 0x9C | ||
115 | #define MAX8907C_REG_LDOSEQCNT20 0x9D | ||
116 | #define MAX8907C_REG_LDO20VOUT 0x9E | ||
117 | |||
118 | /* RTC register */ | ||
119 | #define MAX8907C_REG_RTC_SEC 0x00 | ||
120 | #define MAX8907C_REG_RTC_MIN 0x01 | ||
121 | #define MAX8907C_REG_RTC_HOURS 0x02 | ||
122 | #define MAX8907C_REG_RTC_WEEKDAY 0x03 | ||
123 | #define MAX8907C_REG_RTC_DATE 0x04 | ||
124 | #define MAX8907C_REG_RTC_MONTH 0x05 | ||
125 | #define MAX8907C_REG_RTC_YEAR1 0x06 | ||
126 | #define MAX8907C_REG_RTC_YEAR2 0x07 | ||
127 | #define MAX8907C_REG_ALARM0_SEC 0x08 | ||
128 | #define MAX8907C_REG_ALARM0_MIN 0x09 | ||
129 | #define MAX8907C_REG_ALARM0_HOURS 0x0A | ||
130 | #define MAX8907C_REG_ALARM0_WEEKDAY 0x0B | ||
131 | #define MAX8907C_REG_ALARM0_DATE 0x0C | ||
132 | #define MAX8907C_REG_ALARM0_MONTH 0x0D | ||
133 | #define MAX8907C_REG_ALARM0_YEAR1 0x0E | ||
134 | #define MAX8907C_REG_ALARM0_YEAR2 0x0F | ||
135 | #define MAX8907C_REG_ALARM1_SEC 0x10 | ||
136 | #define MAX8907C_REG_ALARM1_MIN 0x11 | ||
137 | #define MAX8907C_REG_ALARM1_HOURS 0x12 | ||
138 | #define MAX8907C_REG_ALARM1_WEEKDAY 0x13 | ||
139 | #define MAX8907C_REG_ALARM1_DATE 0x14 | ||
140 | #define MAX8907C_REG_ALARM1_MONTH 0x15 | ||
141 | #define MAX8907C_REG_ALARM1_YEAR1 0x16 | ||
142 | #define MAX8907C_REG_ALARM1_YEAR2 0x17 | ||
143 | #define MAX8907C_REG_ALARM0_CNTL 0x18 | ||
144 | #define MAX8907C_REG_ALARM1_CNTL 0x19 | ||
145 | #define MAX8907C_REG_RTC_STATUS 0x1A | ||
146 | #define MAX8907C_REG_RTC_CNTL 0x1B | ||
147 | #define MAX8907C_REG_RTC_IRQ 0x1C | ||
148 | #define MAX8907C_REG_RTC_IRQ_MASK 0x1D | ||
149 | #define MAX8907C_REG_MPL_CNTL 0x1E | ||
150 | |||
151 | /* ADC and Touch Screen Controller register map */ | ||
152 | |||
153 | #define MAX8907C_CTL 0 | ||
154 | #define MAX8907C_SEQCNT 1 | ||
155 | #define MAX8907C_VOUT 2 | ||
156 | |||
157 | /* mask bit fields */ | ||
158 | #define MAX8907C_MASK_LDO_SEQ 0x1C | ||
159 | #define MAX8907C_MASK_LDO_EN 0x01 | ||
160 | #define MAX8907C_MASK_VBBATTCV 0x03 | ||
161 | #define MAX8907C_MASK_OUT5V_VINEN 0x10 | ||
162 | #define MAX8907C_MASK_OUT5V_ENSRC 0x0E | ||
163 | #define MAX8907C_MASK_OUT5V_EN 0x01 | ||
164 | |||
165 | /* Power off bit in RESET_CNFG reg */ | ||
166 | #define MAX8907C_MASK_POWER_OFF 0x40 | ||
167 | |||
168 | #define MAX8907C_MASK_PWR_EN 0x80 | ||
169 | #define MAX8907C_MASK_CTL_SEQ 0x1C | ||
170 | |||
171 | #define MAX8907C_PWR_EN 0x80 | ||
172 | #define MAX8907C_CTL_SEQ 0x04 | ||
173 | |||
174 | #define MAX8907C_SD_SEQ1 0x02 | ||
175 | #define MAX8907C_SD_SEQ2 0x06 | ||
176 | |||
177 | #define MAX8907C_DELAY_CNT0 0x00 | ||
178 | |||
179 | #define MAX8907C_POWER_UP_DELAY_CNT1 0x10 | ||
180 | #define MAX8907C_POWER_UP_DELAY_CNT12 0xC0 | ||
181 | |||
182 | #define MAX8907C_POWER_DOWN_DELAY_CNT12 0x0C | ||
183 | |||
184 | #define RTC_I2C_ADDR 0x68 | ||
185 | |||
186 | /* | ||
187 | * MAX8907B revision requires s/w WAR to connect PWREN input to | ||
188 | * sequencer 2 because of the bug in the silicon. | ||
189 | */ | ||
190 | #define MAX8907B_II2RR_PWREN_WAR (0x12) | ||
191 | |||
192 | /* Defines common for all supplies PWREN sequencer selection */ | ||
193 | #define MAX8907B_SEQSEL_PWREN_LXX 1 /* SEQ2 (PWREN) */ | ||
194 | |||
195 | /* IRQ definitions */ | ||
196 | enum { | ||
197 | MAX8907C_IRQ_VCHG_DC_OVP, | ||
198 | MAX8907C_IRQ_VCHG_DC_F, | ||
199 | MAX8907C_IRQ_VCHG_DC_R, | ||
200 | MAX8907C_IRQ_VCHG_THM_OK_R, | ||
201 | MAX8907C_IRQ_VCHG_THM_OK_F, | ||
202 | MAX8907C_IRQ_VCHG_MBATTLOW_F, | ||
203 | MAX8907C_IRQ_VCHG_MBATTLOW_R, | ||
204 | MAX8907C_IRQ_VCHG_RST, | ||
205 | MAX8907C_IRQ_VCHG_DONE, | ||
206 | MAX8907C_IRQ_VCHG_TOPOFF, | ||
207 | MAX8907C_IRQ_VCHG_TMR_FAULT, | ||
208 | MAX8907C_IRQ_GPM_RSTIN, | ||
209 | MAX8907C_IRQ_GPM_MPL, | ||
210 | MAX8907C_IRQ_GPM_SW_3SEC, | ||
211 | MAX8907C_IRQ_GPM_EXTON_F, | ||
212 | MAX8907C_IRQ_GPM_EXTON_R, | ||
213 | MAX8907C_IRQ_GPM_SW_1SEC, | ||
214 | MAX8907C_IRQ_GPM_SW_F, | ||
215 | MAX8907C_IRQ_GPM_SW_R, | ||
216 | MAX8907C_IRQ_GPM_SYSCKEN_F, | ||
217 | MAX8907C_IRQ_GPM_SYSCKEN_R, | ||
218 | MAX8907C_IRQ_RTC_ALARM1, | ||
219 | MAX8907C_IRQ_RTC_ALARM0, | ||
220 | MAX8907C_NR_IRQS, | ||
221 | }; | ||
222 | |||
223 | struct max8907c { | ||
224 | struct device *dev; | ||
225 | struct mutex io_lock; | ||
226 | struct mutex irq_lock; | ||
227 | struct i2c_client *i2c_power; | ||
228 | struct i2c_client *i2c_rtc; | ||
229 | int irq_base; | ||
230 | int core_irq; | ||
231 | |||
232 | unsigned char cache_chg[2]; | ||
233 | unsigned char cache_on[2]; | ||
234 | unsigned char cache_rtc; | ||
235 | |||
236 | }; | ||
237 | |||
238 | struct max8907c_platform_data { | ||
239 | int num_subdevs; | ||
240 | struct platform_device **subdevs; | ||
241 | int irq_base; | ||
242 | int (*max8907c_setup)(void); | ||
243 | bool use_power_off; | ||
244 | }; | ||
245 | |||
246 | int max8907c_reg_read(struct i2c_client *i2c, u8 reg); | ||
247 | int max8907c_reg_bulk_read(struct i2c_client *i2c, u8 reg, u8 count, u8 *val); | ||
248 | int max8907c_reg_write(struct i2c_client *i2c, u8 reg, u8 val); | ||
249 | int max8907c_reg_bulk_write(struct i2c_client *i2c, u8 reg, u8 count, u8 *val); | ||
250 | int max8907c_set_bits(struct i2c_client *i2c, u8 reg, u8 mask, u8 val); | ||
251 | |||
252 | int max8907c_irq_init(struct max8907c *chip, int irq, int irq_base); | ||
253 | void max8907c_irq_free(struct max8907c *chip); | ||
254 | int max8907c_suspend(struct i2c_client *i2c, pm_message_t state); | ||
255 | int max8907c_resume(struct i2c_client *i2c); | ||
256 | void max8907c_deep_sleep(int enter); | ||
257 | int max8907c_pwr_en_config(void); | ||
258 | int max8907c_pwr_en_attach(void); | ||
259 | #endif | ||
diff --git a/include/linux/mfd/ricoh583.h b/include/linux/mfd/ricoh583.h new file mode 100644 index 00000000000..4e38cded0fa --- /dev/null +++ b/include/linux/mfd/ricoh583.h | |||
@@ -0,0 +1,164 @@ | |||
1 | /* include/linux/mfd/ricoh583.h | ||
2 | * | ||
3 | * Core driver interface to access RICOH583 power management chip. | ||
4 | * | ||
5 | * Copyright (C) 2011 NVIDIA Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_MFD_RICOH583_H | ||
24 | #define __LINUX_MFD_RICOH583_H | ||
25 | |||
26 | #include <linux/rtc.h> | ||
27 | /* RICOH583 IRQ definitions */ | ||
28 | enum { | ||
29 | RICOH583_IRQ_ONKEY, | ||
30 | RICOH583_IRQ_ACOK, | ||
31 | RICOH583_IRQ_LIDOPEN, | ||
32 | RICOH583_IRQ_PREOT, | ||
33 | RICOH583_IRQ_CLKSTP, | ||
34 | RICOH583_IRQ_ONKEY_OFF, | ||
35 | RICOH583_IRQ_WD, | ||
36 | RICOH583_IRQ_EN_PWRREQ1, | ||
37 | RICOH583_IRQ_EN_PWRREQ2, | ||
38 | RICOH583_IRQ_PRE_VINDET, | ||
39 | |||
40 | RICOH583_IRQ_DC0LIM, | ||
41 | RICOH583_IRQ_DC1LIM, | ||
42 | RICOH583_IRQ_DC2LIM, | ||
43 | RICOH583_IRQ_DC3LIM, | ||
44 | |||
45 | RICOH583_IRQ_CTC, | ||
46 | RICOH583_IRQ_YALE, | ||
47 | RICOH583_IRQ_DALE, | ||
48 | RICOH583_IRQ_WALE, | ||
49 | |||
50 | RICOH583_IRQ_AIN1L, | ||
51 | RICOH583_IRQ_AIN2L, | ||
52 | RICOH583_IRQ_AIN3L, | ||
53 | RICOH583_IRQ_VBATL, | ||
54 | RICOH583_IRQ_VIN3L, | ||
55 | RICOH583_IRQ_VIN8L, | ||
56 | RICOH583_IRQ_AIN1H, | ||
57 | RICOH583_IRQ_AIN2H, | ||
58 | RICOH583_IRQ_AIN3H, | ||
59 | RICOH583_IRQ_VBATH, | ||
60 | RICOH583_IRQ_VIN3H, | ||
61 | RICOH583_IRQ_VIN8H, | ||
62 | RICOH583_IRQ_ADCEND, | ||
63 | |||
64 | RICOH583_IRQ_GPIO0, | ||
65 | RICOH583_IRQ_GPIO1, | ||
66 | RICOH583_IRQ_GPIO2, | ||
67 | RICOH583_IRQ_GPIO3, | ||
68 | RICOH583_IRQ_GPIO4, | ||
69 | RICOH583_IRQ_GPIO5, | ||
70 | RICOH583_IRQ_GPIO6, | ||
71 | RICOH583_IRQ_GPIO7, | ||
72 | RICOH583_NR_IRQS, | ||
73 | }; | ||
74 | |||
75 | /* Ricoh583 gpio definitions */ | ||
76 | enum { | ||
77 | RICOH583_GPIO0, | ||
78 | RICOH583_GPIO1, | ||
79 | RICOH583_GPIO2, | ||
80 | RICOH583_GPIO3, | ||
81 | RICOH583_GPIO4, | ||
82 | RICOH583_GPIO5, | ||
83 | RICOH583_GPIO6, | ||
84 | RICOH583_GPIO7, | ||
85 | |||
86 | RICOH583_NR_GPIO, | ||
87 | }; | ||
88 | |||
89 | enum ricoh583_deepsleep_control_id { | ||
90 | RICOH583_DS_NONE, | ||
91 | RICOH583_DS_DC0, | ||
92 | RICOH583_DS_DC1, | ||
93 | RICOH583_DS_DC2, | ||
94 | RICOH583_DS_DC3, | ||
95 | RICOH583_DS_LDO0, | ||
96 | RICOH583_DS_LDO1, | ||
97 | RICOH583_DS_LDO2, | ||
98 | RICOH583_DS_LDO3, | ||
99 | RICOH583_DS_LDO4, | ||
100 | RICOH583_DS_LDO5, | ||
101 | RICOH583_DS_LDO6, | ||
102 | RICOH583_DS_LDO7, | ||
103 | RICOH583_DS_LDO8, | ||
104 | RICOH583_DS_LDO9, | ||
105 | RICOH583_DS_PSO0, | ||
106 | RICOH583_DS_PSO1, | ||
107 | RICOH583_DS_PSO2, | ||
108 | RICOH583_DS_PSO3, | ||
109 | RICOH583_DS_PSO4, | ||
110 | RICOH583_DS_PSO5, | ||
111 | RICOH583_DS_PSO6, | ||
112 | RICOH583_DS_PSO7, | ||
113 | }; | ||
114 | enum ricoh583_ext_pwrreq_control { | ||
115 | RICOH583_EXT_PWRREQ1_CONTROL = 0x1, | ||
116 | RICOH583_EXT_PWRREQ2_CONTROL = 0x2, | ||
117 | }; | ||
118 | |||
119 | struct ricoh583_subdev_info { | ||
120 | int id; | ||
121 | const char *name; | ||
122 | void *platform_data; | ||
123 | }; | ||
124 | |||
125 | struct ricoh583_rtc_platform_data { | ||
126 | int irq; | ||
127 | struct rtc_time time; | ||
128 | }; | ||
129 | |||
130 | struct ricoh583_gpio_init_data { | ||
131 | unsigned pulldn_en:1; /* Enable pull down */ | ||
132 | unsigned output_mode_en:1; /* Enable output mode during init */ | ||
133 | unsigned output_val:1; /* Output value if it is in output mode */ | ||
134 | unsigned init_apply:1; /* Apply init data on configuring gpios*/ | ||
135 | }; | ||
136 | |||
137 | struct ricoh583_platform_data { | ||
138 | int num_subdevs; | ||
139 | struct ricoh583_subdev_info *subdevs; | ||
140 | int gpio_base; | ||
141 | int irq_base; | ||
142 | |||
143 | struct ricoh583_gpio_init_data *gpio_init_data; | ||
144 | int num_gpioinit_data; | ||
145 | bool enable_shutdown_pin; | ||
146 | }; | ||
147 | |||
148 | extern int ricoh583_read(struct device *dev, uint8_t reg, uint8_t *val); | ||
149 | extern int ricoh583_bulk_reads(struct device *dev, u8 reg, u8 count, | ||
150 | uint8_t *val); | ||
151 | extern int ricoh583_write(struct device *dev, u8 reg, uint8_t val); | ||
152 | extern int ricoh583_bulk_writes(struct device *dev, u8 reg, u8 count, | ||
153 | uint8_t *val); | ||
154 | extern int ricoh583_set_bits(struct device *dev, u8 reg, uint8_t bit_mask); | ||
155 | extern int ricoh583_clr_bits(struct device *dev, u8 reg, uint8_t bit_mask); | ||
156 | extern int ricoh583_update(struct device *dev, u8 reg, uint8_t val, | ||
157 | uint8_t mask); | ||
158 | extern int ricoh583_ext_power_req_config(struct device *dev, | ||
159 | enum ricoh583_deepsleep_control_id control_id, | ||
160 | enum ricoh583_ext_pwrreq_control ext_pwr_req, | ||
161 | int deepsleep_slot_nr); | ||
162 | extern int ricoh583_power_off(void); | ||
163 | |||
164 | #endif | ||
diff --git a/include/linux/mfd/tps6591x.h b/include/linux/mfd/tps6591x.h new file mode 100644 index 00000000000..d0d829fc8ab --- /dev/null +++ b/include/linux/mfd/tps6591x.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * include/linux/mfd/tps6591x.c | ||
3 | * Core driver interface for TI TPS6591x PMIC family | ||
4 | * | ||
5 | * Copyright (C) 2011 NVIDIA Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_MFD_TPS6591X_H | ||
24 | #define __LINUX_MFD_TPS6591X_H | ||
25 | |||
26 | #include <linux/rtc.h> | ||
27 | |||
28 | enum { | ||
29 | TPS6591X_INT_PWRHOLD_F, | ||
30 | TPS6591X_INT_VMBHI, | ||
31 | TPS6591X_INT_PWRON, | ||
32 | TPS6591X_INT_PWRON_LP, | ||
33 | TPS6591X_INT_PWRHOLD_R, | ||
34 | TPS6591X_INT_HOTDIE, | ||
35 | TPS6591X_INT_RTC_ALARM, | ||
36 | TPS6591X_INT_RTC_PERIOD, | ||
37 | TPS6591X_INT_GPIO0, | ||
38 | TPS6591X_INT_GPIO1, | ||
39 | TPS6591X_INT_GPIO2, | ||
40 | TPS6591X_INT_GPIO3, | ||
41 | TPS6591X_INT_GPIO4, | ||
42 | TPS6591X_INT_GPIO5, | ||
43 | TPS6591X_INT_WTCHDG, | ||
44 | TPS6591X_INT_VMBCH2_H, | ||
45 | TPS6591X_INT_VMBCH2_L, | ||
46 | TPS6591X_INT_PWRDN, | ||
47 | |||
48 | /* Last entry */ | ||
49 | TPS6591X_INT_NR, | ||
50 | }; | ||
51 | |||
52 | /* Gpio definitions */ | ||
53 | enum { | ||
54 | TPS6591X_GPIO_GP0 = 0, | ||
55 | TPS6591X_GPIO_GP1 = 1, | ||
56 | TPS6591X_GPIO_GP2 = 2, | ||
57 | TPS6591X_GPIO_GP3 = 3, | ||
58 | TPS6591X_GPIO_GP4 = 4, | ||
59 | TPS6591X_GPIO_GP5 = 5, | ||
60 | TPS6591X_GPIO_GP6 = 6, | ||
61 | TPS6591X_GPIO_GP7 = 7, | ||
62 | TPS6591X_GPIO_GP8 = 8, | ||
63 | |||
64 | /* Last entry */ | ||
65 | TPS6591X_GPIO_NR, | ||
66 | }; | ||
67 | |||
68 | struct tps6591x_subdev_info { | ||
69 | int id; | ||
70 | const char *name; | ||
71 | void *platform_data; | ||
72 | }; | ||
73 | |||
74 | struct tps6591x_rtc_platform_data { | ||
75 | int irq; | ||
76 | struct rtc_time time; | ||
77 | }; | ||
78 | |||
79 | struct tps6591x_sleep_keepon_data { | ||
80 | /* set 1 to maintain the following on sleep mode */ | ||
81 | unsigned therm_keepon:1; /* themal monitoring */ | ||
82 | unsigned clkout32k_keepon:1; /* CLK32KOUT */ | ||
83 | unsigned vrtc_keepon:1; /* LD0 full load capability */ | ||
84 | unsigned i2chs_keepon:1; /* high speed internal clock */ | ||
85 | }; | ||
86 | |||
87 | struct tps6591x_gpio_init_data { | ||
88 | unsigned sleep_en:1; /* Enable sleep mode */ | ||
89 | unsigned pulldn_en:1; /* Enable pull down */ | ||
90 | unsigned output_mode_en:1; /* Enable output mode during init */ | ||
91 | unsigned output_val:1; /* Output value if it is in output mode */ | ||
92 | unsigned init_apply:1; /* Apply init data on configuring gpios*/ | ||
93 | }; | ||
94 | |||
95 | struct tps6591x_platform_data { | ||
96 | int gpio_base; | ||
97 | int irq_base; | ||
98 | |||
99 | int num_subdevs; | ||
100 | struct tps6591x_subdev_info *subdevs; | ||
101 | |||
102 | bool dev_slp_en; | ||
103 | struct tps6591x_sleep_keepon_data *slp_keepon; | ||
104 | |||
105 | struct tps6591x_gpio_init_data *gpio_init_data; | ||
106 | int num_gpioinit_data; | ||
107 | |||
108 | bool use_power_off; | ||
109 | }; | ||
110 | |||
111 | /* | ||
112 | * NOTE: the functions below are not intended for use outside | ||
113 | * of the TPS6591X sub-device drivers | ||
114 | */ | ||
115 | extern int tps6591x_write(struct device *dev, int reg, uint8_t val); | ||
116 | extern int tps6591x_writes(struct device *dev, int reg, int len, uint8_t *val); | ||
117 | extern int tps6591x_read(struct device *dev, int reg, uint8_t *val); | ||
118 | extern int tps6591x_reads(struct device *dev, int reg, int len, uint8_t *val); | ||
119 | extern int tps6591x_set_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
120 | extern int tps6591x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
121 | extern int tps6591x_update(struct device *dev, int reg, uint8_t val, | ||
122 | uint8_t mask); | ||
123 | |||
124 | #endif /*__LINUX_MFD_TPS6591X_H */ | ||
diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h new file mode 100644 index 00000000000..13fe09e0576 --- /dev/null +++ b/include/linux/minix_fs.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #ifndef _LINUX_MINIX_FS_H | ||
2 | #define _LINUX_MINIX_FS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/magic.h> | ||
6 | |||
7 | /* | ||
8 | * The minix filesystem constants/structures | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * Thanks to Kees J Bot for sending me the definitions of the new | ||
13 | * minix filesystem (aka V2) with bigger inodes and 32-bit block | ||
14 | * pointers. | ||
15 | */ | ||
16 | |||
17 | #define MINIX_ROOT_INO 1 | ||
18 | |||
19 | /* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */ | ||
20 | #define MINIX_LINK_MAX 250 | ||
21 | #define MINIX2_LINK_MAX 65530 | ||
22 | |||
23 | #define MINIX_I_MAP_SLOTS 8 | ||
24 | #define MINIX_Z_MAP_SLOTS 64 | ||
25 | #define MINIX_VALID_FS 0x0001 /* Clean fs. */ | ||
26 | #define MINIX_ERROR_FS 0x0002 /* fs has errors. */ | ||
27 | |||
28 | #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) | ||
29 | |||
30 | /* | ||
31 | * This is the original minix inode layout on disk. | ||
32 | * Note the 8-bit gid and atime and ctime. | ||
33 | */ | ||
34 | struct minix_inode { | ||
35 | __u16 i_mode; | ||
36 | __u16 i_uid; | ||
37 | __u32 i_size; | ||
38 | __u32 i_time; | ||
39 | __u8 i_gid; | ||
40 | __u8 i_nlinks; | ||
41 | __u16 i_zone[9]; | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * The new minix inode has all the time entries, as well as | ||
46 | * long block numbers and a third indirect block (7+1+1+1 | ||
47 | * instead of 7+1+1). Also, some previously 8-bit values are | ||
48 | * now 16-bit. The inode is now 64 bytes instead of 32. | ||
49 | */ | ||
50 | struct minix2_inode { | ||
51 | __u16 i_mode; | ||
52 | __u16 i_nlinks; | ||
53 | __u16 i_uid; | ||
54 | __u16 i_gid; | ||
55 | __u32 i_size; | ||
56 | __u32 i_atime; | ||
57 | __u32 i_mtime; | ||
58 | __u32 i_ctime; | ||
59 | __u32 i_zone[10]; | ||
60 | }; | ||
61 | |||
62 | /* | ||
63 | * minix super-block data on disk | ||
64 | */ | ||
65 | struct minix_super_block { | ||
66 | __u16 s_ninodes; | ||
67 | __u16 s_nzones; | ||
68 | __u16 s_imap_blocks; | ||
69 | __u16 s_zmap_blocks; | ||
70 | __u16 s_firstdatazone; | ||
71 | __u16 s_log_zone_size; | ||
72 | __u32 s_max_size; | ||
73 | __u16 s_magic; | ||
74 | __u16 s_state; | ||
75 | __u32 s_zones; | ||
76 | }; | ||
77 | |||
78 | /* | ||
79 | * V3 minix super-block data on disk | ||
80 | */ | ||
81 | struct minix3_super_block { | ||
82 | __u32 s_ninodes; | ||
83 | __u16 s_pad0; | ||
84 | __u16 s_imap_blocks; | ||
85 | __u16 s_zmap_blocks; | ||
86 | __u16 s_firstdatazone; | ||
87 | __u16 s_log_zone_size; | ||
88 | __u16 s_pad1; | ||
89 | __u32 s_max_size; | ||
90 | __u32 s_zones; | ||
91 | __u16 s_magic; | ||
92 | __u16 s_pad2; | ||
93 | __u16 s_blocksize; | ||
94 | __u8 s_disk_version; | ||
95 | }; | ||
96 | |||
97 | struct minix_dir_entry { | ||
98 | __u16 inode; | ||
99 | char name[0]; | ||
100 | }; | ||
101 | |||
102 | struct minix3_dir_entry { | ||
103 | __u32 inode; | ||
104 | char name[0]; | ||
105 | }; | ||
106 | #endif | ||
diff --git a/include/linux/mmc/Kbuild b/include/linux/mmc/Kbuild new file mode 100644 index 00000000000..1fb26448faa --- /dev/null +++ b/include/linux/mmc/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += ioctl.h | |||
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h new file mode 100644 index 00000000000..8fa5bc5f805 --- /dev/null +++ b/include/linux/mmc/ioctl.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef LINUX_MMC_IOCTL_H | ||
2 | #define LINUX_MMC_IOCTL_H | ||
3 | struct mmc_ioc_cmd { | ||
4 | /* Implies direction of data. true = write, false = read */ | ||
5 | int write_flag; | ||
6 | |||
7 | /* Application-specific command. true = precede with CMD55 */ | ||
8 | int is_acmd; | ||
9 | |||
10 | __u32 opcode; | ||
11 | __u32 arg; | ||
12 | __u32 response[4]; /* CMD response */ | ||
13 | unsigned int flags; | ||
14 | unsigned int blksz; | ||
15 | unsigned int blocks; | ||
16 | |||
17 | /* | ||
18 | * Sleep at least postsleep_min_us useconds, and at most | ||
19 | * postsleep_max_us useconds *after* issuing command. Needed for | ||
20 | * some read commands for which cards have no other way of indicating | ||
21 | * they're ready for the next command (i.e. there is no equivalent of | ||
22 | * a "busy" indicator for read operations). | ||
23 | */ | ||
24 | unsigned int postsleep_min_us; | ||
25 | unsigned int postsleep_max_us; | ||
26 | |||
27 | /* | ||
28 | * Override driver-computed timeouts. Note the difference in units! | ||
29 | */ | ||
30 | unsigned int data_timeout_ns; | ||
31 | unsigned int cmd_timeout_ms; | ||
32 | |||
33 | /* | ||
34 | * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to | ||
35 | * be 8-byte aligned. Make sure this struct is the same size when | ||
36 | * built for 32-bit. | ||
37 | */ | ||
38 | __u32 __pad; | ||
39 | |||
40 | /* DAT buffer */ | ||
41 | __u64 data_ptr; | ||
42 | }; | ||
43 | #define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr | ||
44 | |||
45 | #define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd) | ||
46 | |||
47 | /* | ||
48 | * Since this ioctl is only meant to enhance (and not replace) normal access | ||
49 | * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES | ||
50 | * is enforced per ioctl call. For larger data transfers, use the normal | ||
51 | * block device operations. | ||
52 | */ | ||
53 | #define MMC_IOC_MAX_BYTES (512L * 256) | ||
54 | #endif /* LINUX_MMC_IOCTL_H */ | ||
diff --git a/include/linux/mmtimer.h b/include/linux/mmtimer.h new file mode 100644 index 00000000000..884cabf1608 --- /dev/null +++ b/include/linux/mmtimer.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Intel Multimedia Timer device interface | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. | ||
9 | * | ||
10 | * This file should define an interface compatible with the IA-PC Multimedia | ||
11 | * Timers Draft Specification (rev. 0.97) from Intel. Note that some | ||
12 | * hardware may not be able to safely export its registers to userspace, | ||
13 | * so the ioctl interface should support all necessary functionality. | ||
14 | * | ||
15 | * 11/01/01 - jbarnes - initial revision | ||
16 | * 9/10/04 - Christoph Lameter - remove interrupt support | ||
17 | * 9/17/04 - jbarnes - remove test program, move some #defines to the driver | ||
18 | */ | ||
19 | |||
20 | #ifndef _LINUX_MMTIMER_H | ||
21 | #define _LINUX_MMTIMER_H | ||
22 | |||
23 | /* | ||
24 | * Breakdown of the ioctl's available. An 'optional' next to the command | ||
25 | * indicates that supporting this command is optional, while 'required' | ||
26 | * commands must be implemented if conformance is desired. | ||
27 | * | ||
28 | * MMTIMER_GETOFFSET - optional | ||
29 | * Should return the offset (relative to the start of the page where the | ||
30 | * registers are mapped) for the counter in question. | ||
31 | * | ||
32 | * MMTIMER_GETRES - required | ||
33 | * The resolution of the clock in femto (10^-15) seconds | ||
34 | * | ||
35 | * MMTIMER_GETFREQ - required | ||
36 | * Frequency of the clock in Hz | ||
37 | * | ||
38 | * MMTIMER_GETBITS - required | ||
39 | * Number of bits in the clock's counter | ||
40 | * | ||
41 | * MMTIMER_MMAPAVAIL - required | ||
42 | * Returns nonzero if the registers can be mmap'd into userspace, 0 otherwise | ||
43 | * | ||
44 | * MMTIMER_GETCOUNTER - required | ||
45 | * Gets the current value in the counter | ||
46 | */ | ||
47 | #define MMTIMER_IOCTL_BASE 'm' | ||
48 | |||
49 | #define MMTIMER_GETOFFSET _IO(MMTIMER_IOCTL_BASE, 0) | ||
50 | #define MMTIMER_GETRES _IOR(MMTIMER_IOCTL_BASE, 1, unsigned long) | ||
51 | #define MMTIMER_GETFREQ _IOR(MMTIMER_IOCTL_BASE, 2, unsigned long) | ||
52 | #define MMTIMER_GETBITS _IO(MMTIMER_IOCTL_BASE, 4) | ||
53 | #define MMTIMER_MMAPAVAIL _IO(MMTIMER_IOCTL_BASE, 6) | ||
54 | #define MMTIMER_GETCOUNTER _IOR(MMTIMER_IOCTL_BASE, 9, unsigned long) | ||
55 | |||
56 | #endif /* _LINUX_MMTIMER_H */ | ||
diff --git a/include/linux/mpu.h b/include/linux/mpu.h new file mode 100644 index 00000000000..1977b38b8c1 --- /dev/null +++ b/include/linux/mpu.h | |||
@@ -0,0 +1,367 @@ | |||
1 | /* | ||
2 | $License: | ||
3 | Copyright (C) 2011 InvenSense Corporation, All Rights Reserved. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | $ | ||
18 | */ | ||
19 | |||
20 | #ifndef __MPU_H_ | ||
21 | #define __MPU_H_ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | #include <linux/ioctl.h> | ||
25 | |||
26 | /* Number of axes on each sensor */ | ||
27 | #define GYRO_NUM_AXES (3) | ||
28 | #define ACCEL_NUM_AXES (3) | ||
29 | #define COMPASS_NUM_AXES (3) | ||
30 | |||
31 | struct mpu_read_write { | ||
32 | /* Memory address or register address depending on ioctl */ | ||
33 | __u16 address; | ||
34 | __u16 length; | ||
35 | __u8 *data; | ||
36 | }; | ||
37 | |||
38 | enum mpuirq_data_type { | ||
39 | MPUIRQ_DATA_TYPE_MPU_IRQ, | ||
40 | MPUIRQ_DATA_TYPE_SLAVE_IRQ, | ||
41 | MPUIRQ_DATA_TYPE_PM_EVENT, | ||
42 | MPUIRQ_DATA_TYPE_NUM_TYPES, | ||
43 | }; | ||
44 | |||
45 | /* User space PM event notification */ | ||
46 | #define MPU_PM_EVENT_SUSPEND_PREPARE (3) | ||
47 | #define MPU_PM_EVENT_POST_SUSPEND (4) | ||
48 | |||
49 | struct mpuirq_data { | ||
50 | __u32 interruptcount; | ||
51 | __u64 irqtime; | ||
52 | __u32 data_type; | ||
53 | __s32 data; | ||
54 | }; | ||
55 | |||
56 | enum ext_slave_config_key { | ||
57 | MPU_SLAVE_CONFIG_ODR_SUSPEND, | ||
58 | MPU_SLAVE_CONFIG_ODR_RESUME, | ||
59 | MPU_SLAVE_CONFIG_FSR_SUSPEND, | ||
60 | MPU_SLAVE_CONFIG_FSR_RESUME, | ||
61 | MPU_SLAVE_CONFIG_MOT_THS, | ||
62 | MPU_SLAVE_CONFIG_NMOT_THS, | ||
63 | MPU_SLAVE_CONFIG_MOT_DUR, | ||
64 | MPU_SLAVE_CONFIG_NMOT_DUR, | ||
65 | MPU_SLAVE_CONFIG_IRQ_SUSPEND, | ||
66 | MPU_SLAVE_CONFIG_IRQ_RESUME, | ||
67 | MPU_SLAVE_WRITE_REGISTERS, | ||
68 | MPU_SLAVE_READ_REGISTERS, | ||
69 | MPU_SLAVE_CONFIG_INTERNAL_REFERENCE, | ||
70 | /* AMI 306 specific config keys */ | ||
71 | MPU_SLAVE_PARAM, | ||
72 | MPU_SLAVE_WINDOW, | ||
73 | MPU_SLAVE_READWINPARAMS, | ||
74 | MPU_SLAVE_SEARCHOFFSET, | ||
75 | /* AKM specific config keys */ | ||
76 | MPU_SLAVE_READ_SCALE, | ||
77 | /* MPU3050 and MPU6050 Keys */ | ||
78 | MPU_SLAVE_INT_CONFIG, | ||
79 | MPU_SLAVE_EXT_SYNC, | ||
80 | MPU_SLAVE_FULL_SCALE, | ||
81 | MPU_SLAVE_LPF, | ||
82 | MPU_SLAVE_CLK_SRC, | ||
83 | MPU_SLAVE_DIVIDER, | ||
84 | MPU_SLAVE_DMP_ENABLE, | ||
85 | MPU_SLAVE_FIFO_ENABLE, | ||
86 | MPU_SLAVE_DMP_CFG1, | ||
87 | MPU_SLAVE_DMP_CFG2, | ||
88 | MPU_SLAVE_TC, | ||
89 | MPU_SLAVE_GYRO, | ||
90 | MPU_SLAVE_ADDR, | ||
91 | MPU_SLAVE_PRODUCT_REVISION, | ||
92 | MPU_SLAVE_SILICON_REVISION, | ||
93 | MPU_SLAVE_PRODUCT_ID, | ||
94 | MPU_SLAVE_GYRO_SENS_TRIM, | ||
95 | MPU_SLAVE_ACCEL_SENS_TRIM, | ||
96 | MPU_SLAVE_RAM, | ||
97 | /* -------------------------- */ | ||
98 | MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS | ||
99 | }; | ||
100 | |||
101 | /* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */ | ||
102 | enum ext_slave_config_irq_type { | ||
103 | MPU_SLAVE_IRQ_TYPE_NONE, | ||
104 | MPU_SLAVE_IRQ_TYPE_MOTION, | ||
105 | MPU_SLAVE_IRQ_TYPE_DATA_READY, | ||
106 | }; | ||
107 | |||
108 | /* Structure for the following IOCTS's | ||
109 | * MPU_CONFIG_GYRO | ||
110 | * MPU_CONFIG_ACCEL | ||
111 | * MPU_CONFIG_COMPASS | ||
112 | * MPU_CONFIG_PRESSURE | ||
113 | * MPU_GET_CONFIG_GYRO | ||
114 | * MPU_GET_CONFIG_ACCEL | ||
115 | * MPU_GET_CONFIG_COMPASS | ||
116 | * MPU_GET_CONFIG_PRESSURE | ||
117 | * | ||
118 | * @key one of enum ext_slave_config_key | ||
119 | * @len length of data pointed to by data | ||
120 | * @apply zero if communication with the chip is not necessary, false otherwise | ||
121 | * This flag can be used to select cached data or to refresh cashed data | ||
122 | * cache data to be pushed later or push immediately. If true and the | ||
123 | * slave is on the secondary bus the MPU will first enger bypass mode | ||
124 | * before calling the slaves .config or .get_config funcion | ||
125 | * @data pointer to the data to confgure or get | ||
126 | */ | ||
127 | struct ext_slave_config { | ||
128 | __u8 key; | ||
129 | __u16 len; | ||
130 | __u8 apply; | ||
131 | void *data; | ||
132 | }; | ||
133 | |||
134 | enum ext_slave_type { | ||
135 | EXT_SLAVE_TYPE_GYROSCOPE, | ||
136 | EXT_SLAVE_TYPE_ACCEL, | ||
137 | EXT_SLAVE_TYPE_COMPASS, | ||
138 | EXT_SLAVE_TYPE_PRESSURE, | ||
139 | /*EXT_SLAVE_TYPE_TEMPERATURE */ | ||
140 | |||
141 | EXT_SLAVE_NUM_TYPES | ||
142 | }; | ||
143 | |||
144 | enum ext_slave_id { | ||
145 | ID_INVALID = 0, | ||
146 | |||
147 | ACCEL_ID_LIS331, | ||
148 | ACCEL_ID_LSM303DLX, | ||
149 | ACCEL_ID_LIS3DH, | ||
150 | ACCEL_ID_KXSD9, | ||
151 | ACCEL_ID_KXTF9, | ||
152 | ACCEL_ID_BMA150, | ||
153 | ACCEL_ID_BMA222, | ||
154 | ACCEL_ID_BMA250, | ||
155 | ACCEL_ID_ADXL34X, | ||
156 | ACCEL_ID_MMA8450, | ||
157 | ACCEL_ID_MMA845X, | ||
158 | ACCEL_ID_MPU6050, | ||
159 | |||
160 | COMPASS_ID_AK8975, | ||
161 | COMPASS_ID_AK8963, | ||
162 | COMPASS_ID_AK8972, | ||
163 | COMPASS_ID_AMI30X, | ||
164 | COMPASS_ID_AMI306, | ||
165 | COMPASS_ID_YAS529, | ||
166 | COMPASS_ID_YAS530, | ||
167 | COMPASS_ID_HMC5883, | ||
168 | COMPASS_ID_LSM303DLH, | ||
169 | COMPASS_ID_LSM303DLM, | ||
170 | COMPASS_ID_MMC314X, | ||
171 | COMPASS_ID_HSCDTD002B, | ||
172 | COMPASS_ID_HSCDTD004A, | ||
173 | |||
174 | PRESSURE_ID_BMA085, | ||
175 | }; | ||
176 | |||
177 | enum ext_slave_endian { | ||
178 | EXT_SLAVE_BIG_ENDIAN, | ||
179 | EXT_SLAVE_LITTLE_ENDIAN, | ||
180 | EXT_SLAVE_FS8_BIG_ENDIAN, | ||
181 | EXT_SLAVE_FS16_BIG_ENDIAN, | ||
182 | }; | ||
183 | |||
184 | enum ext_slave_bus { | ||
185 | EXT_SLAVE_BUS_INVALID = -1, | ||
186 | EXT_SLAVE_BUS_PRIMARY = 0, | ||
187 | EXT_SLAVE_BUS_SECONDARY = 1 | ||
188 | }; | ||
189 | |||
190 | |||
191 | /** | ||
192 | * struct ext_slave_platform_data - Platform data for mpu3050 and mpu6050 | ||
193 | * slave devices | ||
194 | * | ||
195 | * @type: the type of slave device based on the enum ext_slave_type | ||
196 | * definitions. | ||
197 | * @irq: the irq number attached to the slave if any. | ||
198 | * @adapt_num: the I2C adapter number. | ||
199 | * @bus: the bus the slave is attached to: enum ext_slave_bus | ||
200 | * @address: the I2C slave address of the slave device. | ||
201 | * @orientation: the mounting matrix of the device relative to MPU. | ||
202 | * @irq_data: private data for the slave irq handler | ||
203 | * @private_data: additional data, user customizable. Not touched by the MPU | ||
204 | * driver. | ||
205 | * | ||
206 | * The orientation matricies are 3x3 rotation matricies | ||
207 | * that are applied to the data to rotate from the mounting orientation to the | ||
208 | * platform orientation. The values must be one of 0, 1, or -1 and each row and | ||
209 | * column should have exactly 1 non-zero value. | ||
210 | */ | ||
211 | struct ext_slave_platform_data { | ||
212 | __u8 type; | ||
213 | __u32 irq; | ||
214 | __u32 adapt_num; | ||
215 | __u32 bus; | ||
216 | __u8 address; | ||
217 | __s8 orientation[9]; | ||
218 | void *irq_data; | ||
219 | void *private_data; | ||
220 | }; | ||
221 | |||
222 | struct fix_pnt_range { | ||
223 | __s32 mantissa; | ||
224 | __s32 fraction; | ||
225 | }; | ||
226 | |||
227 | static inline long range_fixedpoint_to_long_mg(struct fix_pnt_range rng) | ||
228 | { | ||
229 | return (long)(rng.mantissa * 1000 + rng.fraction / 10); | ||
230 | } | ||
231 | |||
232 | struct ext_slave_read_trigger { | ||
233 | __u8 reg; | ||
234 | __u8 value; | ||
235 | }; | ||
236 | |||
237 | /** | ||
238 | * struct ext_slave_descr - Description of the slave device for programming. | ||
239 | * | ||
240 | * @suspend: function pointer to put the device in suspended state | ||
241 | * @resume: function pointer to put the device in running state | ||
242 | * @read: function that reads the device data | ||
243 | * @init: function used to preallocate memory used by the driver | ||
244 | * @exit: function used to free memory allocated for the driver | ||
245 | * @config: function used to configure the device | ||
246 | * @get_config:function used to get the device's configuration | ||
247 | * | ||
248 | * @name: text name of the device | ||
249 | * @type: device type. enum ext_slave_type | ||
250 | * @id: enum ext_slave_id | ||
251 | * @read_reg: starting register address to retrieve data. | ||
252 | * @read_len: length in bytes of the sensor data. Typically 6. | ||
253 | * @endian: byte order of the data. enum ext_slave_endian | ||
254 | * @range: full scale range of the slave ouput: struct fix_pnt_range | ||
255 | * @trigger: If reading data first requires writing a register this is the | ||
256 | * data to write. | ||
257 | * | ||
258 | * Defines the functions and information about the slave the mpu3050 and | ||
259 | * mpu6050 needs to use the slave device. | ||
260 | */ | ||
261 | struct ext_slave_descr { | ||
262 | int (*init) (void *mlsl_handle, | ||
263 | struct ext_slave_descr *slave, | ||
264 | struct ext_slave_platform_data *pdata); | ||
265 | int (*exit) (void *mlsl_handle, | ||
266 | struct ext_slave_descr *slave, | ||
267 | struct ext_slave_platform_data *pdata); | ||
268 | int (*suspend) (void *mlsl_handle, | ||
269 | struct ext_slave_descr *slave, | ||
270 | struct ext_slave_platform_data *pdata); | ||
271 | int (*resume) (void *mlsl_handle, | ||
272 | struct ext_slave_descr *slave, | ||
273 | struct ext_slave_platform_data *pdata); | ||
274 | int (*read) (void *mlsl_handle, | ||
275 | struct ext_slave_descr *slave, | ||
276 | struct ext_slave_platform_data *pdata, | ||
277 | __u8 *data); | ||
278 | int (*config) (void *mlsl_handle, | ||
279 | struct ext_slave_descr *slave, | ||
280 | struct ext_slave_platform_data *pdata, | ||
281 | struct ext_slave_config *config); | ||
282 | int (*get_config) (void *mlsl_handle, | ||
283 | struct ext_slave_descr *slave, | ||
284 | struct ext_slave_platform_data *pdata, | ||
285 | struct ext_slave_config *config); | ||
286 | |||
287 | char *name; | ||
288 | __u8 type; | ||
289 | __u8 id; | ||
290 | __u8 read_reg; | ||
291 | __u8 read_len; | ||
292 | __u8 endian; | ||
293 | struct fix_pnt_range range; | ||
294 | struct ext_slave_read_trigger *trigger; | ||
295 | }; | ||
296 | |||
297 | /** | ||
298 | * struct mpu_platform_data - Platform data for the mpu driver | ||
299 | * @int_config: Bits [7:3] of the int config register. | ||
300 | * @level_shifter: 0: VLogic, 1: VDD | ||
301 | * @orientation: Orientation matrix of the gyroscope | ||
302 | * | ||
303 | * Contains platform specific information on how to configure the MPU3050 to | ||
304 | * work on this platform. The orientation matricies are 3x3 rotation matricies | ||
305 | * that are applied to the data to rotate from the mounting orientation to the | ||
306 | * platform orientation. The values must be one of 0, 1, or -1 and each row and | ||
307 | * column should have exactly 1 non-zero value. | ||
308 | */ | ||
309 | struct mpu_platform_data { | ||
310 | __u8 int_config; | ||
311 | __u8 level_shifter; | ||
312 | __s8 orientation[GYRO_NUM_AXES * GYRO_NUM_AXES]; | ||
313 | }; | ||
314 | |||
315 | #define MPU_IOCTL (0x81) /* Magic number for MPU Iocts */ | ||
316 | /* IOCTL commands for /dev/mpu */ | ||
317 | |||
318 | /*-------------------------------------------------------------------------- | ||
319 | * Deprecated, debugging only | ||
320 | */ | ||
321 | #define MPU_SET_MPU_PLATFORM_DATA \ | ||
322 | _IOWR(MPU_IOCTL, 0x01, struct mpu_platform_data) | ||
323 | #define MPU_SET_EXT_SLAVE_PLATFORM_DATA \ | ||
324 | _IOWR(MPU_IOCTL, 0x01, struct ext_slave_platform_data) | ||
325 | /*--------------------------------------------------------------------------*/ | ||
326 | #define MPU_GET_EXT_SLAVE_PLATFORM_DATA \ | ||
327 | _IOWR(MPU_IOCTL, 0x02, struct ext_slave_platform_data) | ||
328 | #define MPU_GET_MPU_PLATFORM_DATA \ | ||
329 | _IOWR(MPU_IOCTL, 0x02, struct mpu_platform_data) | ||
330 | #define MPU_GET_EXT_SLAVE_DESCR \ | ||
331 | _IOWR(MPU_IOCTL, 0x02, struct ext_slave_descr) | ||
332 | |||
333 | #define MPU_READ _IOWR(MPU_IOCTL, 0x10, struct mpu_read_write) | ||
334 | #define MPU_WRITE _IOW(MPU_IOCTL, 0x10, struct mpu_read_write) | ||
335 | #define MPU_READ_MEM _IOWR(MPU_IOCTL, 0x11, struct mpu_read_write) | ||
336 | #define MPU_WRITE_MEM _IOW(MPU_IOCTL, 0x11, struct mpu_read_write) | ||
337 | #define MPU_READ_FIFO _IOWR(MPU_IOCTL, 0x12, struct mpu_read_write) | ||
338 | #define MPU_WRITE_FIFO _IOW(MPU_IOCTL, 0x12, struct mpu_read_write) | ||
339 | |||
340 | #define MPU_READ_COMPASS _IOR(MPU_IOCTL, 0x12, __u8) | ||
341 | #define MPU_READ_ACCEL _IOR(MPU_IOCTL, 0x13, __u8) | ||
342 | #define MPU_READ_PRESSURE _IOR(MPU_IOCTL, 0x14, __u8) | ||
343 | |||
344 | #define MPU_CONFIG_GYRO _IOW(MPU_IOCTL, 0x20, struct ext_slave_config) | ||
345 | #define MPU_CONFIG_ACCEL _IOW(MPU_IOCTL, 0x21, struct ext_slave_config) | ||
346 | #define MPU_CONFIG_COMPASS _IOW(MPU_IOCTL, 0x22, struct ext_slave_config) | ||
347 | #define MPU_CONFIG_PRESSURE _IOW(MPU_IOCTL, 0x23, struct ext_slave_config) | ||
348 | |||
349 | #define MPU_GET_CONFIG_GYRO _IOWR(MPU_IOCTL, 0x20, struct ext_slave_config) | ||
350 | #define MPU_GET_CONFIG_ACCEL _IOWR(MPU_IOCTL, 0x21, struct ext_slave_config) | ||
351 | #define MPU_GET_CONFIG_COMPASS _IOWR(MPU_IOCTL, 0x22, struct ext_slave_config) | ||
352 | #define MPU_GET_CONFIG_PRESSURE _IOWR(MPU_IOCTL, 0x23, struct ext_slave_config) | ||
353 | |||
354 | #define MPU_SUSPEND _IOW(MPU_IOCTL, 0x30, __u32) | ||
355 | #define MPU_RESUME _IOW(MPU_IOCTL, 0x31, __u32) | ||
356 | /* Userspace PM Event response */ | ||
357 | #define MPU_PM_EVENT_HANDLED _IO(MPU_IOCTL, 0x32) | ||
358 | |||
359 | #define MPU_GET_REQUESTED_SENSORS _IOR(MPU_IOCTL, 0x40, __u8) | ||
360 | #define MPU_SET_REQUESTED_SENSORS _IOW(MPU_IOCTL, 0x40, __u8) | ||
361 | #define MPU_GET_IGNORE_SYSTEM_SUSPEND _IOR(MPU_IOCTL, 0x41, __u8) | ||
362 | #define MPU_SET_IGNORE_SYSTEM_SUSPEND _IOW(MPU_IOCTL, 0x41, __u8) | ||
363 | #define MPU_GET_MLDL_STATUS _IOR(MPU_IOCTL, 0x42, __u8) | ||
364 | #define MPU_GET_I2C_SLAVES_ENABLED _IOR(MPU_IOCTL, 0x43, __u8) | ||
365 | |||
366 | |||
367 | #endif /* __MPU_H_ */ | ||
diff --git a/include/linux/mpu3050.h b/include/linux/mpu3050.h new file mode 100644 index 00000000000..a8dcd5a9473 --- /dev/null +++ b/include/linux/mpu3050.h | |||
@@ -0,0 +1,255 @@ | |||
1 | /* | ||
2 | $License: | ||
3 | Copyright (C) 2010 InvenSense Corporation, All Rights Reserved. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | $ | ||
18 | */ | ||
19 | |||
20 | #ifndef __MPU3050_H_ | ||
21 | #define __MPU3050_H_ | ||
22 | |||
23 | #ifdef __KERNEL__ | ||
24 | #include <linux/types.h> | ||
25 | #endif | ||
26 | |||
27 | #ifdef M_HW | ||
28 | #error MPU6000 build including MPU3050 header | ||
29 | #endif | ||
30 | |||
31 | #define MPU_NAME "mpu3050" | ||
32 | #define DEFAULT_MPU_SLAVEADDR 0x68 | ||
33 | |||
34 | /*==== MPU REGISTER SET ====*/ | ||
35 | enum mpu_register { | ||
36 | MPUREG_WHO_AM_I = 0, /* 00 0x00 */ | ||
37 | MPUREG_PRODUCT_ID, /* 01 0x01 */ | ||
38 | MPUREG_02_RSVD, /* 02 0x02 */ | ||
39 | MPUREG_03_RSVD, /* 03 0x03 */ | ||
40 | MPUREG_04_RSVD, /* 04 0x04 */ | ||
41 | MPUREG_XG_OFFS_TC, /* 05 0x05 */ | ||
42 | MPUREG_06_RSVD, /* 06 0x06 */ | ||
43 | MPUREG_07_RSVD, /* 07 0x07 */ | ||
44 | MPUREG_YG_OFFS_TC, /* 08 0x08 */ | ||
45 | MPUREG_09_RSVD, /* 09 0x09 */ | ||
46 | MPUREG_0A_RSVD, /* 10 0x0a */ | ||
47 | MPUREG_ZG_OFFS_TC, /* 11 0x0b */ | ||
48 | MPUREG_X_OFFS_USRH, /* 12 0x0c */ | ||
49 | MPUREG_X_OFFS_USRL, /* 13 0x0d */ | ||
50 | MPUREG_Y_OFFS_USRH, /* 14 0x0e */ | ||
51 | MPUREG_Y_OFFS_USRL, /* 15 0x0f */ | ||
52 | MPUREG_Z_OFFS_USRH, /* 16 0x10 */ | ||
53 | MPUREG_Z_OFFS_USRL, /* 17 0x11 */ | ||
54 | MPUREG_FIFO_EN1, /* 18 0x12 */ | ||
55 | MPUREG_FIFO_EN2, /* 19 0x13 */ | ||
56 | MPUREG_AUX_SLV_ADDR, /* 20 0x14 */ | ||
57 | MPUREG_SMPLRT_DIV, /* 21 0x15 */ | ||
58 | MPUREG_DLPF_FS_SYNC, /* 22 0x16 */ | ||
59 | MPUREG_INT_CFG, /* 23 0x17 */ | ||
60 | MPUREG_ACCEL_BURST_ADDR,/* 24 0x18 */ | ||
61 | MPUREG_19_RSVD, /* 25 0x19 */ | ||
62 | MPUREG_INT_STATUS, /* 26 0x1a */ | ||
63 | MPUREG_TEMP_OUT_H, /* 27 0x1b */ | ||
64 | MPUREG_TEMP_OUT_L, /* 28 0x1c */ | ||
65 | MPUREG_GYRO_XOUT_H, /* 29 0x1d */ | ||
66 | MPUREG_GYRO_XOUT_L, /* 30 0x1e */ | ||
67 | MPUREG_GYRO_YOUT_H, /* 31 0x1f */ | ||
68 | MPUREG_GYRO_YOUT_L, /* 32 0x20 */ | ||
69 | MPUREG_GYRO_ZOUT_H, /* 33 0x21 */ | ||
70 | MPUREG_GYRO_ZOUT_L, /* 34 0x22 */ | ||
71 | MPUREG_23_RSVD, /* 35 0x23 */ | ||
72 | MPUREG_24_RSVD, /* 36 0x24 */ | ||
73 | MPUREG_25_RSVD, /* 37 0x25 */ | ||
74 | MPUREG_26_RSVD, /* 38 0x26 */ | ||
75 | MPUREG_27_RSVD, /* 39 0x27 */ | ||
76 | MPUREG_28_RSVD, /* 40 0x28 */ | ||
77 | MPUREG_29_RSVD, /* 41 0x29 */ | ||
78 | MPUREG_2A_RSVD, /* 42 0x2a */ | ||
79 | MPUREG_2B_RSVD, /* 43 0x2b */ | ||
80 | MPUREG_2C_RSVD, /* 44 0x2c */ | ||
81 | MPUREG_2D_RSVD, /* 45 0x2d */ | ||
82 | MPUREG_2E_RSVD, /* 46 0x2e */ | ||
83 | MPUREG_2F_RSVD, /* 47 0x2f */ | ||
84 | MPUREG_30_RSVD, /* 48 0x30 */ | ||
85 | MPUREG_31_RSVD, /* 49 0x31 */ | ||
86 | MPUREG_32_RSVD, /* 50 0x32 */ | ||
87 | MPUREG_33_RSVD, /* 51 0x33 */ | ||
88 | MPUREG_34_RSVD, /* 52 0x34 */ | ||
89 | MPUREG_DMP_CFG_1, /* 53 0x35 */ | ||
90 | MPUREG_DMP_CFG_2, /* 54 0x36 */ | ||
91 | MPUREG_BANK_SEL, /* 55 0x37 */ | ||
92 | MPUREG_MEM_START_ADDR, /* 56 0x38 */ | ||
93 | MPUREG_MEM_R_W, /* 57 0x39 */ | ||
94 | MPUREG_FIFO_COUNTH, /* 58 0x3a */ | ||
95 | MPUREG_FIFO_COUNTL, /* 59 0x3b */ | ||
96 | MPUREG_FIFO_R_W, /* 60 0x3c */ | ||
97 | MPUREG_USER_CTRL, /* 61 0x3d */ | ||
98 | MPUREG_PWR_MGM, /* 62 0x3e */ | ||
99 | MPUREG_3F_RSVD, /* 63 0x3f */ | ||
100 | NUM_OF_MPU_REGISTERS /* 64 0x40 */ | ||
101 | }; | ||
102 | |||
103 | /*==== BITS FOR MPU ====*/ | ||
104 | |||
105 | /*---- MPU 'FIFO_EN1' register (12) ----*/ | ||
106 | #define BIT_TEMP_OUT 0x80 | ||
107 | #define BIT_GYRO_XOUT 0x40 | ||
108 | #define BIT_GYRO_YOUT 0x20 | ||
109 | #define BIT_GYRO_ZOUT 0x10 | ||
110 | #define BIT_ACCEL_XOUT 0x08 | ||
111 | #define BIT_ACCEL_YOUT 0x04 | ||
112 | #define BIT_ACCEL_ZOUT 0x02 | ||
113 | #define BIT_AUX_1OUT 0x01 | ||
114 | /*---- MPU 'FIFO_EN2' register (13) ----*/ | ||
115 | #define BIT_AUX_2OUT 0x02 | ||
116 | #define BIT_AUX_3OUT 0x01 | ||
117 | /*---- MPU 'DLPF_FS_SYNC' register (16) ----*/ | ||
118 | #define BITS_EXT_SYNC_NONE 0x00 | ||
119 | #define BITS_EXT_SYNC_TEMP 0x20 | ||
120 | #define BITS_EXT_SYNC_GYROX 0x40 | ||
121 | #define BITS_EXT_SYNC_GYROY 0x60 | ||
122 | #define BITS_EXT_SYNC_GYROZ 0x80 | ||
123 | #define BITS_EXT_SYNC_ACCELX 0xA0 | ||
124 | #define BITS_EXT_SYNC_ACCELY 0xC0 | ||
125 | #define BITS_EXT_SYNC_ACCELZ 0xE0 | ||
126 | #define BITS_EXT_SYNC_MASK 0xE0 | ||
127 | #define BITS_FS_250DPS 0x00 | ||
128 | #define BITS_FS_500DPS 0x08 | ||
129 | #define BITS_FS_1000DPS 0x10 | ||
130 | #define BITS_FS_2000DPS 0x18 | ||
131 | #define BITS_FS_MASK 0x18 | ||
132 | #define BITS_DLPF_CFG_256HZ_NOLPF2 0x00 | ||
133 | #define BITS_DLPF_CFG_188HZ 0x01 | ||
134 | #define BITS_DLPF_CFG_98HZ 0x02 | ||
135 | #define BITS_DLPF_CFG_42HZ 0x03 | ||
136 | #define BITS_DLPF_CFG_20HZ 0x04 | ||
137 | #define BITS_DLPF_CFG_10HZ 0x05 | ||
138 | #define BITS_DLPF_CFG_5HZ 0x06 | ||
139 | #define BITS_DLPF_CFG_2100HZ_NOLPF 0x07 | ||
140 | #define BITS_DLPF_CFG_MASK 0x07 | ||
141 | /*---- MPU 'INT_CFG' register (17) ----*/ | ||
142 | #define BIT_ACTL 0x80 | ||
143 | #define BIT_ACTL_LOW 0x80 | ||
144 | #define BIT_ACTL_HIGH 0x00 | ||
145 | #define BIT_OPEN 0x40 | ||
146 | #define BIT_OPEN_DRAIN 0x40 | ||
147 | #define BIT_PUSH_PULL 0x00 | ||
148 | #define BIT_LATCH_INT_EN 0x20 | ||
149 | #define BIT_LATCH_INT_EN 0x20 | ||
150 | #define BIT_INT_PULSE_WIDTH_50US 0x00 | ||
151 | #define BIT_INT_ANYRD_2CLEAR 0x10 | ||
152 | #define BIT_INT_STAT_READ_2CLEAR 0x00 | ||
153 | #define BIT_MPU_RDY_EN 0x04 | ||
154 | #define BIT_DMP_INT_EN 0x02 | ||
155 | #define BIT_RAW_RDY_EN 0x01 | ||
156 | /*---- MPU 'INT_STATUS' register (1A) ----*/ | ||
157 | #define BIT_INT_STATUS_FIFO_OVERLOW 0x80 | ||
158 | #define BIT_MPU_RDY 0x04 | ||
159 | #define BIT_DMP_INT 0x02 | ||
160 | #define BIT_RAW_RDY 0x01 | ||
161 | /*---- MPU 'BANK_SEL' register (37) ----*/ | ||
162 | #define BIT_PRFTCH_EN 0x20 | ||
163 | #define BIT_CFG_USER_BANK 0x10 | ||
164 | #define BITS_MEM_SEL 0x0f | ||
165 | /*---- MPU 'USER_CTRL' register (3D) ----*/ | ||
166 | #define BIT_DMP_EN 0x80 | ||
167 | #define BIT_FIFO_EN 0x40 | ||
168 | #define BIT_AUX_IF_EN 0x20 | ||
169 | #define BIT_AUX_RD_LENG 0x10 | ||
170 | #define BIT_AUX_IF_RST 0x08 | ||
171 | #define BIT_DMP_RST 0x04 | ||
172 | #define BIT_FIFO_RST 0x02 | ||
173 | #define BIT_GYRO_RST 0x01 | ||
174 | /*---- MPU 'PWR_MGM' register (3E) ----*/ | ||
175 | #define BIT_H_RESET 0x80 | ||
176 | #define BIT_SLEEP 0x40 | ||
177 | #define BIT_STBY_XG 0x20 | ||
178 | #define BIT_STBY_YG 0x10 | ||
179 | #define BIT_STBY_ZG 0x08 | ||
180 | #define BITS_CLKSEL 0x07 | ||
181 | |||
182 | /*---- MPU Silicon Revision ----*/ | ||
183 | #define MPU_SILICON_REV_A4 1 /* MPU A4 Device */ | ||
184 | #define MPU_SILICON_REV_B1 2 /* MPU B1 Device */ | ||
185 | #define MPU_SILICON_REV_B4 3 /* MPU B4 Device */ | ||
186 | #define MPU_SILICON_REV_B6 4 /* MPU B6 Device */ | ||
187 | |||
188 | /*---- MPU Memory ----*/ | ||
189 | #define MPU_MEM_BANK_SIZE (256) | ||
190 | #define FIFO_HW_SIZE (512) | ||
191 | |||
192 | enum MPU_MEMORY_BANKS { | ||
193 | MPU_MEM_RAM_BANK_0 = 0, | ||
194 | MPU_MEM_RAM_BANK_1, | ||
195 | MPU_MEM_RAM_BANK_2, | ||
196 | MPU_MEM_RAM_BANK_3, | ||
197 | MPU_MEM_NUM_RAM_BANKS, | ||
198 | MPU_MEM_OTP_BANK_0 = MPU_MEM_NUM_RAM_BANKS, | ||
199 | /* This one is always last */ | ||
200 | MPU_MEM_NUM_BANKS | ||
201 | }; | ||
202 | |||
203 | #define MPU_NUM_AXES (3) | ||
204 | |||
205 | /*---- structure containing control variables used by MLDL ----*/ | ||
206 | /*---- MPU clock source settings ----*/ | ||
207 | /*---- MPU filter selections ----*/ | ||
208 | enum mpu_filter { | ||
209 | MPU_FILTER_256HZ_NOLPF2 = 0, | ||
210 | MPU_FILTER_188HZ, | ||
211 | MPU_FILTER_98HZ, | ||
212 | MPU_FILTER_42HZ, | ||
213 | MPU_FILTER_20HZ, | ||
214 | MPU_FILTER_10HZ, | ||
215 | MPU_FILTER_5HZ, | ||
216 | MPU_FILTER_2100HZ_NOLPF, | ||
217 | NUM_MPU_FILTER | ||
218 | }; | ||
219 | |||
220 | enum mpu_fullscale { | ||
221 | MPU_FS_250DPS = 0, | ||
222 | MPU_FS_500DPS, | ||
223 | MPU_FS_1000DPS, | ||
224 | MPU_FS_2000DPS, | ||
225 | NUM_MPU_FS | ||
226 | }; | ||
227 | |||
228 | enum mpu_clock_sel { | ||
229 | MPU_CLK_SEL_INTERNAL = 0, | ||
230 | MPU_CLK_SEL_PLLGYROX, | ||
231 | MPU_CLK_SEL_PLLGYROY, | ||
232 | MPU_CLK_SEL_PLLGYROZ, | ||
233 | MPU_CLK_SEL_PLLEXT32K, | ||
234 | MPU_CLK_SEL_PLLEXT19M, | ||
235 | MPU_CLK_SEL_RESERVED, | ||
236 | MPU_CLK_SEL_STOP, | ||
237 | NUM_CLK_SEL | ||
238 | }; | ||
239 | |||
240 | enum mpu_ext_sync { | ||
241 | MPU_EXT_SYNC_NONE = 0, | ||
242 | MPU_EXT_SYNC_TEMP, | ||
243 | MPU_EXT_SYNC_GYROX, | ||
244 | MPU_EXT_SYNC_GYROY, | ||
245 | MPU_EXT_SYNC_GYROZ, | ||
246 | MPU_EXT_SYNC_ACCELX, | ||
247 | MPU_EXT_SYNC_ACCELY, | ||
248 | MPU_EXT_SYNC_ACCELZ, | ||
249 | NUM_MPU_EXT_SYNC | ||
250 | }; | ||
251 | |||
252 | #define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \ | ||
253 | ((ext_sync << 5) | (full_scale << 3) | lpf) | ||
254 | |||
255 | #endif /* __MPU3050_H_ */ | ||
diff --git a/include/linux/mpu6000.h b/include/linux/mpu6000.h new file mode 100644 index 00000000000..5a63c8f07b7 --- /dev/null +++ b/include/linux/mpu6000.h | |||
@@ -0,0 +1,406 @@ | |||
1 | /* | ||
2 | $License: | ||
3 | Copyright (C) 2010 InvenSense Corporation, All Rights Reserved. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | $ | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @defgroup | ||
22 | * @brief | ||
23 | * | ||
24 | * @{ | ||
25 | * @file mpu6000.h | ||
26 | * @brief | ||
27 | */ | ||
28 | |||
29 | #ifndef __MPU6000_H_ | ||
30 | #define __MPU6000_H_ | ||
31 | |||
32 | #define MPU_NAME "mpu6000" | ||
33 | #define DEFAULT_MPU_SLAVEADDR 0x68 | ||
34 | |||
35 | /*==== M_HW REGISTER SET ====*/ | ||
36 | enum { | ||
37 | MPUREG_XG_OFFS_TC = 0, /* 0x00 */ | ||
38 | MPUREG_YG_OFFS_TC, /* 0x00 */ | ||
39 | MPUREG_ZG_OFFS_TC, /* 0x00 */ | ||
40 | MPUREG_X_FINE_GAIN, /* 0x00 */ | ||
41 | MPUREG_Y_FINE_GAIN, /* 0x00 */ | ||
42 | MPUREG_Z_FINE_GAIN, /* 0x00 */ | ||
43 | MPUREG_XA_OFFS_H, /* 0x00 */ | ||
44 | MPUREG_XA_OFFS_L_TC, /* 0x00 */ | ||
45 | MPUREG_YA_OFFS_H, /* 0x00 */ | ||
46 | MPUREG_YA_OFFS_L_TC, /* 0x00 */ | ||
47 | MPUREG_ZA_OFFS_H, /* 0x00 */ | ||
48 | MPUREG_ZA_OFFS_L_TC, /* 0xB */ | ||
49 | MPUREG_0C_RSVD, /* 0x00 */ | ||
50 | MPUREG_0D_RSVD, /* 0x00 */ | ||
51 | MPUREG_0E_RSVD, /* 0x00 */ | ||
52 | MPUREG_0F_RSVD, /* 0x00 */ | ||
53 | MPUREG_10_RSVD, /* 0x00 */ | ||
54 | MPUREG_11_RSVD, /* 0x00 */ | ||
55 | MPUREG_12_RSVD, /* 0x00 */ | ||
56 | MPUREG_XG_OFFS_USRH, /* 0x00 */ | ||
57 | MPUREG_XG_OFFS_USRL, /* 0x00 */ | ||
58 | MPUREG_YG_OFFS_USRH, /* 0x00 */ | ||
59 | MPUREG_YG_OFFS_USRL, /* 0x00 */ | ||
60 | MPUREG_ZG_OFFS_USRH, /* 0x00 */ | ||
61 | MPUREG_ZG_OFFS_USRL, /* 0x00 */ | ||
62 | MPUREG_SMPLRT_DIV, /* 0x19 */ | ||
63 | MPUREG_CONFIG, /* 0x1A ==> DLPF_FS_SYNC */ | ||
64 | MPUREG_GYRO_CONFIG, /* 0x00 */ | ||
65 | MPUREG_ACCEL_CONFIG, /* 0x00 */ | ||
66 | MPUREG_ACCEL_FF_THR, /* 0x00 */ | ||
67 | MPUREG_ACCEL_FF_DUR, /* 0x00 */ | ||
68 | MPUREG_ACCEL_MOT_THR, /* 0x00 */ | ||
69 | MPUREG_ACCEL_MOT_DUR, /* 0x00 */ | ||
70 | MPUREG_ACCEL_ZRMOT_THR, /* 0x00 */ | ||
71 | MPUREG_ACCEL_ZRMOT_DUR, /* 0x00 */ | ||
72 | MPUREG_FIFO_EN, /* 0x23 */ | ||
73 | MPUREG_I2C_MST_CTRL, /* 0x00 */ | ||
74 | MPUREG_I2C_SLV0_ADDR, /* 0x25 */ | ||
75 | MPUREG_I2C_SLV0_REG, /* 0x00 */ | ||
76 | MPUREG_I2C_SLV0_CTRL, /* 0x00 */ | ||
77 | MPUREG_I2C_SLV1_ADDR, /* 0x28 */ | ||
78 | MPUREG_I2C_SLV1_REG_PASSWORD, /* 0x00 */ | ||
79 | MPUREG_I2C_SLV1_CTRL, /* 0x00 */ | ||
80 | MPUREG_I2C_SLV2_ADDR, /* 0x2B */ | ||
81 | MPUREG_I2C_SLV2_REG, /* 0x00 */ | ||
82 | MPUREG_I2C_SLV2_CTRL, /* 0x00 */ | ||
83 | MPUREG_I2C_SLV3_ADDR, /* 0x2E */ | ||
84 | MPUREG_I2C_SLV3_REG, /* 0x00 */ | ||
85 | MPUREG_I2C_SLV3_CTRL, /* 0x00 */ | ||
86 | MPUREG_I2C_SLV4_ADDR, /* 0x31 */ | ||
87 | MPUREG_I2C_SLV4_REG, /* 0x00 */ | ||
88 | MPUREG_I2C_SLV4_DO, /* 0x00 */ | ||
89 | MPUREG_I2C_SLV4_CTRL, /* 0x00 */ | ||
90 | MPUREG_I2C_SLV4_DI, /* 0x00 */ | ||
91 | MPUREG_I2C_MST_STATUS, /* 0x36 */ | ||
92 | MPUREG_INT_PIN_CFG, /* 0x37 ==> -* INT_CFG */ | ||
93 | MPUREG_INT_ENABLE, /* 0x38 ==> / */ | ||
94 | MPUREG_DMP_INT_STATUS, /* 0x39 */ | ||
95 | MPUREG_INT_STATUS, /* 0x3A */ | ||
96 | MPUREG_ACCEL_XOUT_H, /* 0x3B */ | ||
97 | MPUREG_ACCEL_XOUT_L, /* 0x00 */ | ||
98 | MPUREG_ACCEL_YOUT_H, /* 0x00 */ | ||
99 | MPUREG_ACCEL_YOUT_L, /* 0x00 */ | ||
100 | MPUREG_ACCEL_ZOUT_H, /* 0x00 */ | ||
101 | MPUREG_ACCEL_ZOUT_L, /* 0x00 */ | ||
102 | MPUREG_TEMP_OUT_H, /* 0x41 */ | ||
103 | MPUREG_TEMP_OUT_L, /* 0x00 */ | ||
104 | MPUREG_GYRO_XOUT_H, /* 0x43 */ | ||
105 | MPUREG_GYRO_XOUT_L, /* 0x00 */ | ||
106 | MPUREG_GYRO_YOUT_H, /* 0x00 */ | ||
107 | MPUREG_GYRO_YOUT_L, /* 0x00 */ | ||
108 | MPUREG_GYRO_ZOUT_H, /* 0x00 */ | ||
109 | MPUREG_GYRO_ZOUT_L, /* 0x00 */ | ||
110 | MPUREG_EXT_SLV_SENS_DATA_00, /* 0x49 */ | ||
111 | MPUREG_EXT_SLV_SENS_DATA_01, /* 0x00 */ | ||
112 | MPUREG_EXT_SLV_SENS_DATA_02, /* 0x00 */ | ||
113 | MPUREG_EXT_SLV_SENS_DATA_03, /* 0x00 */ | ||
114 | MPUREG_EXT_SLV_SENS_DATA_04, /* 0x00 */ | ||
115 | MPUREG_EXT_SLV_SENS_DATA_05, /* 0x00 */ | ||
116 | MPUREG_EXT_SLV_SENS_DATA_06, /* 0x4F */ | ||
117 | MPUREG_EXT_SLV_SENS_DATA_07, /* 0x00 */ | ||
118 | MPUREG_EXT_SLV_SENS_DATA_08, /* 0x00 */ | ||
119 | MPUREG_EXT_SLV_SENS_DATA_09, /* 0x00 */ | ||
120 | MPUREG_EXT_SLV_SENS_DATA_10, /* 0x00 */ | ||
121 | MPUREG_EXT_SLV_SENS_DATA_11, /* 0x00 */ | ||
122 | MPUREG_EXT_SLV_SENS_DATA_12, /* 0x55 */ | ||
123 | MPUREG_EXT_SLV_SENS_DATA_13, /* 0x00 */ | ||
124 | MPUREG_EXT_SLV_SENS_DATA_14, /* 0x00 */ | ||
125 | MPUREG_EXT_SLV_SENS_DATA_15, /* 0x00 */ | ||
126 | MPUREG_EXT_SLV_SENS_DATA_16, /* 0x00 */ | ||
127 | MPUREG_EXT_SLV_SENS_DATA_17, /* 0x00 */ | ||
128 | MPUREG_EXT_SLV_SENS_DATA_18, /* 0x5B */ | ||
129 | MPUREG_EXT_SLV_SENS_DATA_19, /* 0x00 */ | ||
130 | MPUREG_EXT_SLV_SENS_DATA_20, /* 0x00 */ | ||
131 | MPUREG_EXT_SLV_SENS_DATA_21, /* 0x00 */ | ||
132 | MPUREG_EXT_SLV_SENS_DATA_22, /* 0x00 */ | ||
133 | MPUREG_EXT_SLV_SENS_DATA_23, /* 0x00 */ | ||
134 | ACCEL_INTEL_STATUS, /* 0x61 */ | ||
135 | MPUREG_62_RSVD, /* 0x00 */ | ||
136 | MPUREG_63_RSVD, /* 0x00 */ | ||
137 | MPUREG_64_RSVD, /* 0x00 */ | ||
138 | MPUREG_65_RSVD, /* 0x00 */ | ||
139 | MPUREG_66_RSVD, /* 0x00 */ | ||
140 | MPUREG_67_RSVD, /* 0x00 */ | ||
141 | SIGNAL_PATH_RESET, /* 0x68 */ | ||
142 | ACCEL_INTEL_CTRL, /* 0x69 */ | ||
143 | MPUREG_USER_CTRL, /* 0x6A */ | ||
144 | MPUREG_PWR_MGMT_1, /* 0x6B */ | ||
145 | MPUREG_PWR_MGMT_2, /* 0x00 */ | ||
146 | MPUREG_BANK_SEL, /* 0x6D */ | ||
147 | MPUREG_MEM_START_ADDR, /* 0x6E */ | ||
148 | MPUREG_MEM_R_W, /* 0x6F */ | ||
149 | MPUREG_PRGM_STRT_ADDRH, /* 0x00 */ | ||
150 | MPUREG_PRGM_STRT_ADDRL, /* 0x00 */ | ||
151 | MPUREG_FIFO_COUNTH, /* 0x72 */ | ||
152 | MPUREG_FIFO_COUNTL, /* 0x00 */ | ||
153 | MPUREG_FIFO_R_W, /* 0x74 */ | ||
154 | MPUREG_WHOAMI, /* 0x75,117 */ | ||
155 | |||
156 | NUM_OF_MPU_REGISTERS /* = 0x76,118 */ | ||
157 | }; | ||
158 | |||
159 | /*==== M_HW MEMORY ====*/ | ||
160 | enum MPU_MEMORY_BANKS { | ||
161 | MEM_RAM_BANK_0 = 0, | ||
162 | MEM_RAM_BANK_1, | ||
163 | MEM_RAM_BANK_2, | ||
164 | MEM_RAM_BANK_3, | ||
165 | MEM_RAM_BANK_4, | ||
166 | MEM_RAM_BANK_5, | ||
167 | MEM_RAM_BANK_6, | ||
168 | MEM_RAM_BANK_7, | ||
169 | MEM_RAM_BANK_8, | ||
170 | MEM_RAM_BANK_9, | ||
171 | MEM_RAM_BANK_10, | ||
172 | MEM_RAM_BANK_11, | ||
173 | MPU_MEM_NUM_RAM_BANKS, | ||
174 | MPU_MEM_OTP_BANK_0 = 16 | ||
175 | }; | ||
176 | |||
177 | |||
178 | /*==== M_HW parameters ====*/ | ||
179 | |||
180 | #define NUM_REGS (NUM_OF_MPU_REGISTERS) | ||
181 | #define START_SENS_REGS (0x3B) | ||
182 | #define NUM_SENS_REGS (0x60-START_SENS_REGS+1) | ||
183 | |||
184 | /*---- MPU Memory ----*/ | ||
185 | #define NUM_BANKS (MPU_MEM_NUM_RAM_BANKS) | ||
186 | #define BANK_SIZE (256) | ||
187 | #define MEM_SIZE (NUM_BANKS*BANK_SIZE) | ||
188 | #define MPU_MEM_BANK_SIZE (BANK_SIZE) /*alternative name */ | ||
189 | |||
190 | #define FIFO_HW_SIZE (1024) | ||
191 | |||
192 | #define NUM_EXT_SLAVES (4) | ||
193 | |||
194 | |||
195 | /*==== BITS FOR M_HW ====*/ | ||
196 | |||
197 | /*---- M_HW 'FIFO_EN' register (23) ----*/ | ||
198 | #define BIT_TEMP_OUT 0x80 | ||
199 | #define BIT_GYRO_XOUT 0x40 | ||
200 | #define BIT_GYRO_YOUT 0x20 | ||
201 | #define BIT_GYRO_ZOUT 0x10 | ||
202 | #define BIT_ACCEL 0x08 | ||
203 | #define BIT_SLV_2 0x04 | ||
204 | #define BIT_SLV_1 0x02 | ||
205 | #define BIT_SLV_0 0x01 | ||
206 | /*---- M_HW 'CONFIG' register (1A) ----*/ | ||
207 | /*NONE 0xC0 */ | ||
208 | #define BITS_EXT_SYNC_SET 0x38 | ||
209 | #define BITS_DLPF_CFG 0x07 | ||
210 | /*---- M_HW 'GYRO_CONFIG' register (1B) ----*/ | ||
211 | /* voluntarily modified label from BITS_FS_SEL to | ||
212 | * BITS_GYRO_FS_SEL to avoid confusion with MPU | ||
213 | */ | ||
214 | #define BITS_GYRO_FS_SEL 0x18 | ||
215 | /*NONE 0x07 */ | ||
216 | /*---- M_HW 'ACCEL_CONFIG' register (1C) ----*/ | ||
217 | #define BITS_ACCEL_FS_SEL 0x18 | ||
218 | #define BITS_ACCEL_HPF 0x07 | ||
219 | /*---- M_HW 'I2C_MST_CTRL' register (24) ----*/ | ||
220 | #define BIT_MULT_MST_DIS 0x80 | ||
221 | #define BIT_WAIT_FOR_ES 0x40 | ||
222 | #define BIT_I2C_MST_VDDIO 0x20 | ||
223 | /*NONE 0x10 */ | ||
224 | #define BITS_I2C_MST_CLK 0x0F | ||
225 | /*---- M_HW 'I2C_SLV?_CTRL' register (27,2A,2D,30) ----*/ | ||
226 | #define BIT_SLV_ENABLE 0x80 | ||
227 | #define BIT_SLV_BYTE_SW 0x40 | ||
228 | /*NONE 0x20 */ | ||
229 | #define BIT_SLV_GRP 0x10 | ||
230 | #define BITS_SLV_LENG 0x0F | ||
231 | /*---- M_HW 'I2C_SLV4_ADDR' register (31) ----*/ | ||
232 | #define BIT_I2C_SLV4_RNW 0x80 | ||
233 | /*---- M_HW 'I2C_SLV4_CTRL' register (34) ----*/ | ||
234 | #define BIT_I2C_SLV4_EN 0x80 | ||
235 | #define BIT_SLV4_DONE_INT_EN 0x40 | ||
236 | /*NONE 0x3F */ | ||
237 | /*---- M_HW 'I2C_MST_STATUS' register (36) ----*/ | ||
238 | #define BIT_PASSTHROUGH 0x80 | ||
239 | #define BIT_I2C_SLV4_DONE 0x40 | ||
240 | #define BIT_I2C_LOST_ARB 0x20 | ||
241 | #define BIT_I2C_SLV4_NACK 0x10 | ||
242 | #define BIT_I2C_SLV3_NACK 0x08 | ||
243 | #define BIT_I2C_SLV2_NACK 0x04 | ||
244 | #define BIT_I2C_SLV1_NACK 0x02 | ||
245 | #define BIT_I2C_SLV0_NACK 0x01 | ||
246 | /*---- M_HW 'INT_PIN_CFG' register (37) ----*/ | ||
247 | #define BIT_ACTL 0x80 | ||
248 | #define BIT_ACTL_LOW 0x80 | ||
249 | #define BIT_ACTL_HIGH 0x00 | ||
250 | #define BIT_OPEN 0x40 | ||
251 | #define BIT_LATCH_INT_EN 0x20 | ||
252 | #define BIT_INT_ANYRD_2CLEAR 0x10 | ||
253 | #define BIT_ACTL_FSYNC 0x08 | ||
254 | #define BIT_FSYNC_INT_EN 0x04 | ||
255 | #define BIT_BYPASS_EN 0x02 | ||
256 | #define BIT_CLKOUT_EN 0x01 | ||
257 | /*---- M_HW 'INT_ENABLE' register (38) ----*/ | ||
258 | #define BIT_FF_EN 0x80 | ||
259 | #define BIT_MOT_EN 0x40 | ||
260 | #define BIT_ZMOT_EN 0x20 | ||
261 | #define BIT_FIFO_OVERFLOW_EN 0x10 | ||
262 | #define BIT_I2C_MST_INT_EN 0x08 | ||
263 | #define BIT_PLL_RDY_EN 0x04 | ||
264 | #define BIT_DMP_INT_EN 0x02 | ||
265 | #define BIT_RAW_RDY_EN 0x01 | ||
266 | /*---- M_HW 'DMP_INT_STATUS' register (39) ----*/ | ||
267 | /*NONE 0x80 */ | ||
268 | /*NONE 0x40 */ | ||
269 | #define BIT_DMP_INT_5 0x20 | ||
270 | #define BIT_DMP_INT_4 0x10 | ||
271 | #define BIT_DMP_INT_3 0x08 | ||
272 | #define BIT_DMP_INT_2 0x04 | ||
273 | #define BIT_DMP_INT_1 0x02 | ||
274 | #define BIT_DMP_INT_0 0x01 | ||
275 | /*---- M_HW 'INT_STATUS' register (3A) ----*/ | ||
276 | #define BIT_FF_INT 0x80 | ||
277 | #define BIT_MOT_INT 0x40 | ||
278 | #define BIT_ZMOT_INT 0x20 | ||
279 | #define BIT_FIFO_OVERFLOW_INT 0x10 | ||
280 | #define BIT_I2C_MST_INT 0x08 | ||
281 | #define BIT_PLL_RDY_INT 0x04 | ||
282 | #define BIT_DMP_INT 0x02 | ||
283 | #define BIT_RAW_DATA_RDY_INT 0x01 | ||
284 | /*---- M_HW 'BANK_SEL' register (6D) ----*/ | ||
285 | #define BIT_PRFTCH_EN 0x40 | ||
286 | #define BIT_CFG_USER_BANK 0x20 | ||
287 | #define BITS_MEM_SEL 0x1f | ||
288 | /*---- M_HW 'USER_CTRL' register (6A) ----*/ | ||
289 | #define BIT_DMP_EN 0x80 | ||
290 | #define BIT_FIFO_EN 0x40 | ||
291 | #define BIT_I2C_MST_EN 0x20 | ||
292 | #define BIT_I2C_IF_DIS 0x10 | ||
293 | #define BIT_DMP_RST 0x08 | ||
294 | #define BIT_FIFO_RST 0x04 | ||
295 | #define BIT_I2C_MST_RST 0x02 | ||
296 | #define BIT_SIG_COND_RST 0x01 | ||
297 | /*---- M_HW 'PWR_MGMT_1' register (6B) ----*/ | ||
298 | #define BIT_H_RESET 0x80 | ||
299 | #define BITS_PWRSEL 0x70 | ||
300 | #define BIT_WKUP_INT 0x08 | ||
301 | #define BITS_CLKSEL 0x07 | ||
302 | /*---- M_HW 'PWR_MGMT_2' register (6C) ----*/ | ||
303 | #define BITS_LPA_WAKE_CTRL 0xC0 | ||
304 | #define BIT_STBY_XA 0x20 | ||
305 | #define BIT_STBY_YA 0x10 | ||
306 | #define BIT_STBY_ZA 0x08 | ||
307 | #define BIT_STBY_XG 0x04 | ||
308 | #define BIT_STBY_YG 0x02 | ||
309 | #define BIT_STBY_ZG 0x01 | ||
310 | |||
311 | /* although it has 6, this refers to the gyros */ | ||
312 | #define MPU_NUM_AXES (3) | ||
313 | |||
314 | #define ACCEL_MOT_THR_LSB (32) /* mg */ | ||
315 | #define ACCEL_MOT_DUR_LSB (1) | ||
316 | #define ACCEL_ZRMOT_THR_LSB_CONVERSION(mg) ((mg *1000)/255) | ||
317 | #define ACCEL_ZRMOT_DUR_LSB (64) | ||
318 | |||
319 | /*----------------------------------------------------------------------------*/ | ||
320 | /*---- Alternative names to take care of conflicts with current mpu3050.h ----*/ | ||
321 | /*----------------------------------------------------------------------------*/ | ||
322 | |||
323 | /*-- registers --*/ | ||
324 | #define MPUREG_DLPF_FS_SYNC MPUREG_CONFIG /* 0x1A */ | ||
325 | |||
326 | #define MPUREG_PRODUCT_ID MPUREG_WHOAMI /* 0x75 HACK!*/ | ||
327 | #define MPUREG_PWR_MGM MPUREG_PWR_MGMT_1 /* 0x6B */ | ||
328 | #define MPUREG_FIFO_EN1 MPUREG_FIFO_EN /* 0x23 */ | ||
329 | #define MPUREG_DMP_CFG_1 MPUREG_PRGM_STRT_ADDRH /* 0x70 */ | ||
330 | #define MPUREG_DMP_CFG_2 MPUREG_PRGM_STRT_ADDRL /* 0x71 */ | ||
331 | #define MPUREG_INT_CFG MPUREG_INT_ENABLE /* 0x38 */ | ||
332 | #define MPUREG_X_OFFS_USRH MPUREG_XG_OFFS_USRH /* 0x13 */ | ||
333 | #define MPUREG_WHO_AM_I MPUREG_WHOAMI /* 0x75 */ | ||
334 | #define MPUREG_23_RSVD MPUREG_EXT_SLV_SENS_DATA_00 /* 0x49 */ | ||
335 | #define MPUREG_AUX_SLV_ADDR MPUREG_I2C_SLV0_ADDR /* 0x25 */ | ||
336 | #define MPUREG_ACCEL_BURST_ADDR MPUREG_I2C_SLV0_REG /* 0x26 */ | ||
337 | |||
338 | /*-- bits --*/ | ||
339 | /* 'USER_CTRL' register */ | ||
340 | #define BIT_AUX_IF_EN BIT_I2C_MST_EN | ||
341 | #define BIT_AUX_RD_LENG BIT_I2C_MST_EN | ||
342 | #define BIT_IME_IF_RST BIT_I2C_MST_RST | ||
343 | #define BIT_GYRO_RST BIT_SIG_COND_RST | ||
344 | /* 'INT_ENABLE' register */ | ||
345 | #define BIT_RAW_RDY BIT_RAW_DATA_RDY_INT | ||
346 | #define BIT_MPU_RDY_EN BIT_PLL_RDY_EN | ||
347 | /* 'INT_STATUS' register */ | ||
348 | #define BIT_INT_STATUS_FIFO_OVERLOW BIT_FIFO_OVERFLOW_INT | ||
349 | |||
350 | |||
351 | |||
352 | /*---- M_HW Silicon Revisions ----*/ | ||
353 | #define MPU_SILICON_REV_A1 1 /* M_HW A1 Device */ | ||
354 | #define MPU_SILICON_REV_B1 2 /* M_HW B1 Device */ | ||
355 | |||
356 | /*---- structure containing control variables used by MLDL ----*/ | ||
357 | /*---- MPU clock source settings ----*/ | ||
358 | /*---- MPU filter selections ----*/ | ||
359 | enum mpu_filter { | ||
360 | MPU_FILTER_256HZ_NOLPF2 = 0, | ||
361 | MPU_FILTER_188HZ, | ||
362 | MPU_FILTER_98HZ, | ||
363 | MPU_FILTER_42HZ, | ||
364 | MPU_FILTER_20HZ, | ||
365 | MPU_FILTER_10HZ, | ||
366 | MPU_FILTER_5HZ, | ||
367 | MPU_FILTER_2100HZ_NOLPF, | ||
368 | NUM_MPU_FILTER | ||
369 | }; | ||
370 | |||
371 | enum mpu_fullscale { | ||
372 | MPU_FS_250DPS = 0, | ||
373 | MPU_FS_500DPS, | ||
374 | MPU_FS_1000DPS, | ||
375 | MPU_FS_2000DPS, | ||
376 | NUM_MPU_FS | ||
377 | }; | ||
378 | |||
379 | enum mpu_clock_sel { | ||
380 | MPU_CLK_SEL_INTERNAL = 0, | ||
381 | MPU_CLK_SEL_PLLGYROX, | ||
382 | MPU_CLK_SEL_PLLGYROY, | ||
383 | MPU_CLK_SEL_PLLGYROZ, | ||
384 | MPU_CLK_SEL_PLLEXT32K, | ||
385 | MPU_CLK_SEL_PLLEXT19M, | ||
386 | MPU_CLK_SEL_RESERVED, | ||
387 | MPU_CLK_SEL_STOP, | ||
388 | NUM_CLK_SEL | ||
389 | }; | ||
390 | |||
391 | enum mpu_ext_sync { | ||
392 | MPU_EXT_SYNC_NONE = 0, | ||
393 | MPU_EXT_SYNC_TEMP, | ||
394 | MPU_EXT_SYNC_GYROX, | ||
395 | MPU_EXT_SYNC_GYROY, | ||
396 | MPU_EXT_SYNC_GYROZ, | ||
397 | MPU_EXT_SYNC_ACCELX, | ||
398 | MPU_EXT_SYNC_ACCELY, | ||
399 | MPU_EXT_SYNC_ACCELZ, | ||
400 | NUM_MPU_EXT_SYNC | ||
401 | }; | ||
402 | |||
403 | #define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \ | ||
404 | ((ext_sync << 5) | (full_scale << 3) | lpf) | ||
405 | |||
406 | #endif /* __IMU6000_H_ */ | ||
diff --git a/include/linux/mqueue.h b/include/linux/mqueue.h new file mode 100644 index 00000000000..8b5a79615fb --- /dev/null +++ b/include/linux/mqueue.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski | ||
2 | |||
3 | This program is free software; you can redistribute it and/or | ||
4 | modify it under the terms of the GNU Lesser General Public | ||
5 | License as published by the Free Software Foundation; either | ||
6 | version 2.1 of the License, or (at your option) any later version. | ||
7 | |||
8 | It is distributed in the hope that it will be useful, | ||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | Lesser General Public License for more details. | ||
12 | |||
13 | You should have received a copy of the GNU Lesser General Public | ||
14 | License along with this software; if not, write to the Free | ||
15 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
16 | 02111-1307 USA. */ | ||
17 | |||
18 | #ifndef _LINUX_MQUEUE_H | ||
19 | #define _LINUX_MQUEUE_H | ||
20 | |||
21 | #define MQ_PRIO_MAX 32768 | ||
22 | /* per-uid limit of kernel memory used by mqueue, in bytes */ | ||
23 | #define MQ_BYTES_MAX 819200 | ||
24 | |||
25 | struct mq_attr { | ||
26 | long mq_flags; /* message queue flags */ | ||
27 | long mq_maxmsg; /* maximum number of messages */ | ||
28 | long mq_msgsize; /* maximum message size */ | ||
29 | long mq_curmsgs; /* number of messages currently queued */ | ||
30 | long __reserved[4]; /* ignored for input, zeroed for output */ | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * SIGEV_THREAD implementation: | ||
35 | * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed | ||
36 | * to mq_notify, then | ||
37 | * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not | ||
38 | * necessary that the socket is bound. | ||
39 | * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN | ||
40 | * bytes long. | ||
41 | * If the notification is triggered, then the cookie is sent to the netlink | ||
42 | * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes: | ||
43 | * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was | ||
44 | * removed, either due to a close() on the message queue fd or due to a | ||
45 | * mq_notify() that removed the notification. | ||
46 | */ | ||
47 | #define NOTIFY_NONE 0 | ||
48 | #define NOTIFY_WOKENUP 1 | ||
49 | #define NOTIFY_REMOVED 2 | ||
50 | |||
51 | #define NOTIFY_COOKIE_LEN 32 | ||
52 | |||
53 | #endif | ||
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h new file mode 100644 index 00000000000..27ad40aed19 --- /dev/null +++ b/include/linux/mtd/pmc551.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * PMC551 PCI Mezzanine Ram Device | ||
3 | * | ||
4 | * Author: | ||
5 | * Mark Ferrell | ||
6 | * Copyright 1999,2000 Nortel Networks | ||
7 | * | ||
8 | * License: | ||
9 | * As part of this driver was derrived from the slram.c driver it falls | ||
10 | * under the same license, which is GNU General Public License v2 | ||
11 | */ | ||
12 | |||
13 | #ifndef __MTD_PMC551_H__ | ||
14 | #define __MTD_PMC551_H__ | ||
15 | |||
16 | #include <linux/mtd/mtd.h> | ||
17 | |||
18 | #define PMC551_VERSION \ | ||
19 | "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" | ||
20 | |||
21 | /* | ||
22 | * Our personal and private information | ||
23 | */ | ||
24 | struct mypriv { | ||
25 | struct pci_dev *dev; | ||
26 | u_char *start; | ||
27 | u32 base_map0; | ||
28 | u32 curr_map0; | ||
29 | u32 asize; | ||
30 | struct mtd_info *nextpmc551; | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * Function Prototypes | ||
35 | */ | ||
36 | static int pmc551_erase(struct mtd_info *, struct erase_info *); | ||
37 | static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); | ||
38 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | ||
39 | size_t *retlen, void **virt, resource_size_t *phys); | ||
40 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | ||
41 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | ||
42 | |||
43 | |||
44 | /* | ||
45 | * Define the PCI ID's if the kernel doesn't define them for us | ||
46 | */ | ||
47 | #ifndef PCI_VENDOR_ID_V3_SEMI | ||
48 | #define PCI_VENDOR_ID_V3_SEMI 0x11b0 | ||
49 | #endif | ||
50 | |||
51 | #ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC | ||
52 | #define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200 | ||
53 | #endif | ||
54 | |||
55 | |||
56 | #define PMC551_PCI_MEM_MAP0 0x50 | ||
57 | #define PMC551_PCI_MEM_MAP1 0x54 | ||
58 | #define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000 | ||
59 | #define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0 | ||
60 | #define PMC551_PCI_MEM_MAP_REG_EN 0x00000002 | ||
61 | #define PMC551_PCI_MEM_MAP_ENABLE 0x00000001 | ||
62 | |||
63 | #define PMC551_SDRAM_MA 0x60 | ||
64 | #define PMC551_SDRAM_CMD 0x62 | ||
65 | #define PMC551_DRAM_CFG 0x64 | ||
66 | #define PMC551_SYS_CTRL_REG 0x78 | ||
67 | |||
68 | #define PMC551_DRAM_BLK0 0x68 | ||
69 | #define PMC551_DRAM_BLK1 0x6c | ||
70 | #define PMC551_DRAM_BLK2 0x70 | ||
71 | #define PMC551_DRAM_BLK3 0x74 | ||
72 | #define PMC551_DRAM_BLK_GET_SIZE(x) (524288<<((x>>4)&0x0f)) | ||
73 | #define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12)) | ||
74 | #define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8)) | ||
75 | |||
76 | |||
77 | #endif /* __MTD_PMC551_H__ */ | ||
78 | |||
diff --git a/include/linux/mtio.h b/include/linux/mtio.h new file mode 100644 index 00000000000..8f825756c45 --- /dev/null +++ b/include/linux/mtio.h | |||
@@ -0,0 +1,207 @@ | |||
1 | /* | ||
2 | * linux/mtio.h header file for Linux. Written by H. Bergman | ||
3 | * | ||
4 | * Modified for special ioctls provided by zftape in September 1997 | ||
5 | * by C.-J. Heine. | ||
6 | */ | ||
7 | |||
8 | #ifndef _LINUX_MTIO_H | ||
9 | #define _LINUX_MTIO_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | #include <linux/ioctl.h> | ||
13 | |||
14 | /* | ||
15 | * Structures and definitions for mag tape io control commands | ||
16 | */ | ||
17 | |||
18 | /* structure for MTIOCTOP - mag tape op command */ | ||
19 | struct mtop { | ||
20 | short mt_op; /* operations defined below */ | ||
21 | int mt_count; /* how many of them */ | ||
22 | }; | ||
23 | |||
24 | /* Magnetic Tape operations [Not all operations supported by all drivers]: */ | ||
25 | #define MTRESET 0 /* +reset drive in case of problems */ | ||
26 | #define MTFSF 1 /* forward space over FileMark, | ||
27 | * position at first record of next file | ||
28 | */ | ||
29 | #define MTBSF 2 /* backward space FileMark (position before FM) */ | ||
30 | #define MTFSR 3 /* forward space record */ | ||
31 | #define MTBSR 4 /* backward space record */ | ||
32 | #define MTWEOF 5 /* write an end-of-file record (mark) */ | ||
33 | #define MTREW 6 /* rewind */ | ||
34 | #define MTOFFL 7 /* rewind and put the drive offline (eject?) */ | ||
35 | #define MTNOP 8 /* no op, set status only (read with MTIOCGET) */ | ||
36 | #define MTRETEN 9 /* retension tape */ | ||
37 | #define MTBSFM 10 /* +backward space FileMark, position at FM */ | ||
38 | #define MTFSFM 11 /* +forward space FileMark, position at FM */ | ||
39 | #define MTEOM 12 /* goto end of recorded media (for appending files). | ||
40 | * MTEOM positions after the last FM, ready for | ||
41 | * appending another file. | ||
42 | */ | ||
43 | #define MTERASE 13 /* erase tape -- be careful! */ | ||
44 | |||
45 | #define MTRAS1 14 /* run self test 1 (nondestructive) */ | ||
46 | #define MTRAS2 15 /* run self test 2 (destructive) */ | ||
47 | #define MTRAS3 16 /* reserved for self test 3 */ | ||
48 | |||
49 | #define MTSETBLK 20 /* set block length (SCSI) */ | ||
50 | #define MTSETDENSITY 21 /* set tape density (SCSI) */ | ||
51 | #define MTSEEK 22 /* seek to block (Tandberg, etc.) */ | ||
52 | #define MTTELL 23 /* tell block (Tandberg, etc.) */ | ||
53 | #define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */ | ||
54 | /* ordinary buffered operation with code 1 */ | ||
55 | #define MTFSS 25 /* space forward over setmarks */ | ||
56 | #define MTBSS 26 /* space backward over setmarks */ | ||
57 | #define MTWSM 27 /* write setmarks */ | ||
58 | |||
59 | #define MTLOCK 28 /* lock the drive door */ | ||
60 | #define MTUNLOCK 29 /* unlock the drive door */ | ||
61 | #define MTLOAD 30 /* execute the SCSI load command */ | ||
62 | #define MTUNLOAD 31 /* execute the SCSI unload command */ | ||
63 | #define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */ | ||
64 | #define MTSETPART 33 /* Change the active tape partition */ | ||
65 | #define MTMKPART 34 /* Format the tape with one or two partitions */ | ||
66 | #define MTWEOFI 35 /* write an end-of-file record (mark) in immediate mode */ | ||
67 | |||
68 | /* structure for MTIOCGET - mag tape get status command */ | ||
69 | |||
70 | struct mtget { | ||
71 | long mt_type; /* type of magtape device */ | ||
72 | long mt_resid; /* residual count: (not sure) | ||
73 | * number of bytes ignored, or | ||
74 | * number of files not skipped, or | ||
75 | * number of records not skipped. | ||
76 | */ | ||
77 | /* the following registers are device dependent */ | ||
78 | long mt_dsreg; /* status register */ | ||
79 | long mt_gstat; /* generic (device independent) status */ | ||
80 | long mt_erreg; /* error register */ | ||
81 | /* The next two fields are not always used */ | ||
82 | __kernel_daddr_t mt_fileno; /* number of current file on tape */ | ||
83 | __kernel_daddr_t mt_blkno; /* current block number */ | ||
84 | }; | ||
85 | |||
86 | |||
87 | |||
88 | /* | ||
89 | * Constants for mt_type. Not all of these are supported, | ||
90 | * and these are not all of the ones that are supported. | ||
91 | */ | ||
92 | #define MT_ISUNKNOWN 0x01 | ||
93 | #define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */ | ||
94 | #define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */ | ||
95 | #define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */ | ||
96 | #define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */ | ||
97 | #define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */ | ||
98 | #define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */ | ||
99 | #define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */ | ||
100 | #define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */ | ||
101 | #define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */ | ||
102 | #define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */ | ||
103 | #define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */ | ||
104 | #define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */ | ||
105 | #define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */ | ||
106 | #define MT_ISDDS1 0x51 /* DDS device without partitions */ | ||
107 | #define MT_ISDDS2 0x52 /* DDS device with partitions */ | ||
108 | #define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0) | ||
109 | and SCSI emulated (DI, DP, USB) */ | ||
110 | #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ | ||
111 | #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ | ||
112 | |||
113 | /* QIC-40/80/3010/3020 ftape supported drives. | ||
114 | * 20bit vendor ID + 0x800000 (see ftape-vendors.h) | ||
115 | */ | ||
116 | #define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ | ||
117 | #define MT_ISFTAPE_FLAG 0x800000 | ||
118 | |||
119 | |||
120 | /* structure for MTIOCPOS - mag tape get position command */ | ||
121 | |||
122 | struct mtpos { | ||
123 | long mt_blkno; /* current block number */ | ||
124 | }; | ||
125 | |||
126 | |||
127 | /* mag tape io control commands */ | ||
128 | #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ | ||
129 | #define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ | ||
130 | #define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */ | ||
131 | |||
132 | |||
133 | /* Generic Mag Tape (device independent) status macros for examining | ||
134 | * mt_gstat -- HP-UX compatible. | ||
135 | * There is room for more generic status bits here, but I don't | ||
136 | * know which of them are reserved. At least three or so should | ||
137 | * be added to make this really useful. | ||
138 | */ | ||
139 | #define GMT_EOF(x) ((x) & 0x80000000) | ||
140 | #define GMT_BOT(x) ((x) & 0x40000000) | ||
141 | #define GMT_EOT(x) ((x) & 0x20000000) | ||
142 | #define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ | ||
143 | #define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ | ||
144 | #define GMT_WR_PROT(x) ((x) & 0x04000000) | ||
145 | /* #define GMT_ ? ((x) & 0x02000000) */ | ||
146 | #define GMT_ONLINE(x) ((x) & 0x01000000) | ||
147 | #define GMT_D_6250(x) ((x) & 0x00800000) | ||
148 | #define GMT_D_1600(x) ((x) & 0x00400000) | ||
149 | #define GMT_D_800(x) ((x) & 0x00200000) | ||
150 | /* #define GMT_ ? ((x) & 0x00100000) */ | ||
151 | /* #define GMT_ ? ((x) & 0x00080000) */ | ||
152 | #define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */ | ||
153 | /* #define GMT_ ? ((x) & 0x00020000) */ | ||
154 | #define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */ | ||
155 | #define GMT_CLN(x) ((x) & 0x00008000) /* cleaning requested */ | ||
156 | /* 15 generic status bits unused */ | ||
157 | |||
158 | |||
159 | /* SCSI-tape specific definitions */ | ||
160 | /* Bitfield shifts in the status */ | ||
161 | #define MT_ST_BLKSIZE_SHIFT 0 | ||
162 | #define MT_ST_BLKSIZE_MASK 0xffffff | ||
163 | #define MT_ST_DENSITY_SHIFT 24 | ||
164 | #define MT_ST_DENSITY_MASK 0xff000000 | ||
165 | |||
166 | #define MT_ST_SOFTERR_SHIFT 0 | ||
167 | #define MT_ST_SOFTERR_MASK 0xffff | ||
168 | |||
169 | /* Bitfields for the MTSETDRVBUFFER ioctl */ | ||
170 | #define MT_ST_OPTIONS 0xf0000000 | ||
171 | #define MT_ST_BOOLEANS 0x10000000 | ||
172 | #define MT_ST_SETBOOLEANS 0x30000000 | ||
173 | #define MT_ST_CLEARBOOLEANS 0x40000000 | ||
174 | #define MT_ST_WRITE_THRESHOLD 0x20000000 | ||
175 | #define MT_ST_DEF_BLKSIZE 0x50000000 | ||
176 | #define MT_ST_DEF_OPTIONS 0x60000000 | ||
177 | #define MT_ST_TIMEOUTS 0x70000000 | ||
178 | #define MT_ST_SET_TIMEOUT (MT_ST_TIMEOUTS | 0x000000) | ||
179 | #define MT_ST_SET_LONG_TIMEOUT (MT_ST_TIMEOUTS | 0x100000) | ||
180 | #define MT_ST_SET_CLN 0x80000000 | ||
181 | |||
182 | #define MT_ST_BUFFER_WRITES 0x1 | ||
183 | #define MT_ST_ASYNC_WRITES 0x2 | ||
184 | #define MT_ST_READ_AHEAD 0x4 | ||
185 | #define MT_ST_DEBUGGING 0x8 | ||
186 | #define MT_ST_TWO_FM 0x10 | ||
187 | #define MT_ST_FAST_MTEOM 0x20 | ||
188 | #define MT_ST_AUTO_LOCK 0x40 | ||
189 | #define MT_ST_DEF_WRITES 0x80 | ||
190 | #define MT_ST_CAN_BSR 0x100 | ||
191 | #define MT_ST_NO_BLKLIMS 0x200 | ||
192 | #define MT_ST_CAN_PARTITIONS 0x400 | ||
193 | #define MT_ST_SCSI2LOGICAL 0x800 | ||
194 | #define MT_ST_SYSV 0x1000 | ||
195 | #define MT_ST_NOWAIT 0x2000 | ||
196 | #define MT_ST_SILI 0x4000 | ||
197 | |||
198 | /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ | ||
199 | #define MT_ST_CLEAR_DEFAULT 0xfffff | ||
200 | #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) | ||
201 | #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) | ||
202 | #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) | ||
203 | |||
204 | /* The offset for the arguments for the special HP changer load command. */ | ||
205 | #define MT_ST_HPLOADER_OFFSET 10000 | ||
206 | |||
207 | #endif /* _LINUX_MTIO_H */ | ||
diff --git a/include/linux/ncp.h b/include/linux/ncp.h new file mode 100644 index 00000000000..99f0adeeb3f --- /dev/null +++ b/include/linux/ncp.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * ncp.h | ||
3 | * | ||
4 | * Copyright (C) 1995 by Volker Lendecke | ||
5 | * Modified for sparc by J.F. Chadima | ||
6 | * Modified for __constant_ntoh by Frank A. Vorstenbosch | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef _LINUX_NCP_H | ||
11 | #define _LINUX_NCP_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | #define NCP_PTYPE (0x11) | ||
16 | #define NCP_PORT (0x0451) | ||
17 | |||
18 | #define NCP_ALLOC_SLOT_REQUEST (0x1111) | ||
19 | #define NCP_REQUEST (0x2222) | ||
20 | #define NCP_DEALLOC_SLOT_REQUEST (0x5555) | ||
21 | |||
22 | struct ncp_request_header { | ||
23 | __u16 type; | ||
24 | __u8 sequence; | ||
25 | __u8 conn_low; | ||
26 | __u8 task; | ||
27 | __u8 conn_high; | ||
28 | __u8 function; | ||
29 | __u8 data[0]; | ||
30 | } __attribute__((packed)); | ||
31 | |||
32 | #define NCP_REPLY (0x3333) | ||
33 | #define NCP_WATCHDOG (0x3E3E) | ||
34 | #define NCP_POSITIVE_ACK (0x9999) | ||
35 | |||
36 | struct ncp_reply_header { | ||
37 | __u16 type; | ||
38 | __u8 sequence; | ||
39 | __u8 conn_low; | ||
40 | __u8 task; | ||
41 | __u8 conn_high; | ||
42 | __u8 completion_code; | ||
43 | __u8 connection_state; | ||
44 | __u8 data[0]; | ||
45 | } __attribute__((packed)); | ||
46 | |||
47 | #define NCP_VOLNAME_LEN (16) | ||
48 | #define NCP_NUMBER_OF_VOLUMES (256) | ||
49 | struct ncp_volume_info { | ||
50 | __u32 total_blocks; | ||
51 | __u32 free_blocks; | ||
52 | __u32 purgeable_blocks; | ||
53 | __u32 not_yet_purgeable_blocks; | ||
54 | __u32 total_dir_entries; | ||
55 | __u32 available_dir_entries; | ||
56 | __u8 sectors_per_block; | ||
57 | char volume_name[NCP_VOLNAME_LEN + 1]; | ||
58 | }; | ||
59 | |||
60 | #define AR_READ (cpu_to_le16(1)) | ||
61 | #define AR_WRITE (cpu_to_le16(2)) | ||
62 | #define AR_EXCLUSIVE (cpu_to_le16(0x20)) | ||
63 | |||
64 | #define NCP_FILE_ID_LEN 6 | ||
65 | |||
66 | /* Defines for Name Spaces */ | ||
67 | #define NW_NS_DOS 0 | ||
68 | #define NW_NS_MAC 1 | ||
69 | #define NW_NS_NFS 2 | ||
70 | #define NW_NS_FTAM 3 | ||
71 | #define NW_NS_OS2 4 | ||
72 | |||
73 | /* Defines for ReturnInformationMask */ | ||
74 | #define RIM_NAME (cpu_to_le32(1)) | ||
75 | #define RIM_SPACE_ALLOCATED (cpu_to_le32(2)) | ||
76 | #define RIM_ATTRIBUTES (cpu_to_le32(4)) | ||
77 | #define RIM_DATA_SIZE (cpu_to_le32(8)) | ||
78 | #define RIM_TOTAL_SIZE (cpu_to_le32(0x10)) | ||
79 | #define RIM_EXT_ATTR_INFO (cpu_to_le32(0x20)) | ||
80 | #define RIM_ARCHIVE (cpu_to_le32(0x40)) | ||
81 | #define RIM_MODIFY (cpu_to_le32(0x80)) | ||
82 | #define RIM_CREATION (cpu_to_le32(0x100)) | ||
83 | #define RIM_OWNING_NAMESPACE (cpu_to_le32(0x200)) | ||
84 | #define RIM_DIRECTORY (cpu_to_le32(0x400)) | ||
85 | #define RIM_RIGHTS (cpu_to_le32(0x800)) | ||
86 | #define RIM_ALL (cpu_to_le32(0xFFF)) | ||
87 | #define RIM_COMPRESSED_INFO (cpu_to_le32(0x80000000)) | ||
88 | |||
89 | /* Defines for NSInfoBitMask */ | ||
90 | #define NSIBM_NFS_NAME 0x0001 | ||
91 | #define NSIBM_NFS_MODE 0x0002 | ||
92 | #define NSIBM_NFS_GID 0x0004 | ||
93 | #define NSIBM_NFS_NLINKS 0x0008 | ||
94 | #define NSIBM_NFS_RDEV 0x0010 | ||
95 | #define NSIBM_NFS_LINK 0x0020 | ||
96 | #define NSIBM_NFS_CREATED 0x0040 | ||
97 | #define NSIBM_NFS_UID 0x0080 | ||
98 | #define NSIBM_NFS_ACSFLAG 0x0100 | ||
99 | #define NSIBM_NFS_MYFLAG 0x0200 | ||
100 | |||
101 | /* open/create modes */ | ||
102 | #define OC_MODE_OPEN 0x01 | ||
103 | #define OC_MODE_TRUNCATE 0x02 | ||
104 | #define OC_MODE_REPLACE 0x02 | ||
105 | #define OC_MODE_CREATE 0x08 | ||
106 | |||
107 | /* open/create results */ | ||
108 | #define OC_ACTION_NONE 0x00 | ||
109 | #define OC_ACTION_OPEN 0x01 | ||
110 | #define OC_ACTION_CREATE 0x02 | ||
111 | #define OC_ACTION_TRUNCATE 0x04 | ||
112 | #define OC_ACTION_REPLACE 0x04 | ||
113 | |||
114 | /* access rights attributes */ | ||
115 | #ifndef AR_READ_ONLY | ||
116 | #define AR_READ_ONLY 0x0001 | ||
117 | #define AR_WRITE_ONLY 0x0002 | ||
118 | #define AR_DENY_READ 0x0004 | ||
119 | #define AR_DENY_WRITE 0x0008 | ||
120 | #define AR_COMPATIBILITY 0x0010 | ||
121 | #define AR_WRITE_THROUGH 0x0040 | ||
122 | #define AR_OPEN_COMPRESSED 0x0100 | ||
123 | #endif | ||
124 | |||
125 | struct nw_nfs_info { | ||
126 | __u32 mode; | ||
127 | __u32 rdev; | ||
128 | }; | ||
129 | |||
130 | struct nw_info_struct { | ||
131 | __u32 spaceAlloc; | ||
132 | __le32 attributes; | ||
133 | __u16 flags; | ||
134 | __le32 dataStreamSize; | ||
135 | __le32 totalStreamSize; | ||
136 | __u16 numberOfStreams; | ||
137 | __le16 creationTime; | ||
138 | __le16 creationDate; | ||
139 | __u32 creatorID; | ||
140 | __le16 modifyTime; | ||
141 | __le16 modifyDate; | ||
142 | __u32 modifierID; | ||
143 | __le16 lastAccessDate; | ||
144 | __u16 archiveTime; | ||
145 | __u16 archiveDate; | ||
146 | __u32 archiverID; | ||
147 | __u16 inheritedRightsMask; | ||
148 | __le32 dirEntNum; | ||
149 | __le32 DosDirNum; | ||
150 | __u32 volNumber; | ||
151 | __u32 EADataSize; | ||
152 | __u32 EAKeyCount; | ||
153 | __u32 EAKeySize; | ||
154 | __u32 NSCreator; | ||
155 | __u8 nameLen; | ||
156 | __u8 entryName[256]; | ||
157 | /* libncp may depend on there being nothing after entryName */ | ||
158 | #ifdef __KERNEL__ | ||
159 | struct nw_nfs_info nfs; | ||
160 | #endif | ||
161 | } __attribute__((packed)); | ||
162 | |||
163 | /* modify mask - use with MODIFY_DOS_INFO structure */ | ||
164 | #define DM_ATTRIBUTES (cpu_to_le32(0x02)) | ||
165 | #define DM_CREATE_DATE (cpu_to_le32(0x04)) | ||
166 | #define DM_CREATE_TIME (cpu_to_le32(0x08)) | ||
167 | #define DM_CREATOR_ID (cpu_to_le32(0x10)) | ||
168 | #define DM_ARCHIVE_DATE (cpu_to_le32(0x20)) | ||
169 | #define DM_ARCHIVE_TIME (cpu_to_le32(0x40)) | ||
170 | #define DM_ARCHIVER_ID (cpu_to_le32(0x80)) | ||
171 | #define DM_MODIFY_DATE (cpu_to_le32(0x0100)) | ||
172 | #define DM_MODIFY_TIME (cpu_to_le32(0x0200)) | ||
173 | #define DM_MODIFIER_ID (cpu_to_le32(0x0400)) | ||
174 | #define DM_LAST_ACCESS_DATE (cpu_to_le32(0x0800)) | ||
175 | #define DM_INHERITED_RIGHTS_MASK (cpu_to_le32(0x1000)) | ||
176 | #define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000)) | ||
177 | |||
178 | struct nw_modify_dos_info { | ||
179 | __le32 attributes; | ||
180 | __le16 creationDate; | ||
181 | __le16 creationTime; | ||
182 | __u32 creatorID; | ||
183 | __le16 modifyDate; | ||
184 | __le16 modifyTime; | ||
185 | __u32 modifierID; | ||
186 | __u16 archiveDate; | ||
187 | __u16 archiveTime; | ||
188 | __u32 archiverID; | ||
189 | __le16 lastAccessDate; | ||
190 | __u16 inheritanceGrantMask; | ||
191 | __u16 inheritanceRevokeMask; | ||
192 | __u32 maximumSpace; | ||
193 | } __attribute__((packed)); | ||
194 | |||
195 | struct nw_search_sequence { | ||
196 | __u8 volNumber; | ||
197 | __u32 dirBase; | ||
198 | __u32 sequence; | ||
199 | } __attribute__((packed)); | ||
200 | |||
201 | #endif /* _LINUX_NCP_H */ | ||
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h new file mode 100644 index 00000000000..e13eefef065 --- /dev/null +++ b/include/linux/ncp_fs.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * ncp_fs.h | ||
3 | * | ||
4 | * Copyright (C) 1995, 1996 by Volker Lendecke | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef _LINUX_NCP_FS_H | ||
9 | #define _LINUX_NCP_FS_H | ||
10 | |||
11 | #include <linux/fs.h> | ||
12 | #include <linux/in.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/magic.h> | ||
15 | |||
16 | #include <linux/ipx.h> | ||
17 | #include <linux/ncp_no.h> | ||
18 | |||
19 | /* | ||
20 | * ioctl commands | ||
21 | */ | ||
22 | |||
23 | struct ncp_ioctl_request { | ||
24 | unsigned int function; | ||
25 | unsigned int size; | ||
26 | char __user *data; | ||
27 | }; | ||
28 | |||
29 | struct ncp_fs_info { | ||
30 | int version; | ||
31 | struct sockaddr_ipx addr; | ||
32 | __kernel_uid_t mounted_uid; | ||
33 | int connection; /* Connection number the server assigned us */ | ||
34 | int buffer_size; /* The negotiated buffer size, to be | ||
35 | used for read/write requests! */ | ||
36 | |||
37 | int volume_number; | ||
38 | __le32 directory_id; | ||
39 | }; | ||
40 | |||
41 | struct ncp_fs_info_v2 { | ||
42 | int version; | ||
43 | unsigned long mounted_uid; | ||
44 | unsigned int connection; | ||
45 | unsigned int buffer_size; | ||
46 | |||
47 | unsigned int volume_number; | ||
48 | __le32 directory_id; | ||
49 | |||
50 | __u32 dummy1; | ||
51 | __u32 dummy2; | ||
52 | __u32 dummy3; | ||
53 | }; | ||
54 | |||
55 | struct ncp_sign_init | ||
56 | { | ||
57 | char sign_root[8]; | ||
58 | char sign_last[16]; | ||
59 | }; | ||
60 | |||
61 | struct ncp_lock_ioctl | ||
62 | { | ||
63 | #define NCP_LOCK_LOG 0 | ||
64 | #define NCP_LOCK_SH 1 | ||
65 | #define NCP_LOCK_EX 2 | ||
66 | #define NCP_LOCK_CLEAR 256 | ||
67 | int cmd; | ||
68 | int origin; | ||
69 | unsigned int offset; | ||
70 | unsigned int length; | ||
71 | #define NCP_LOCK_DEFAULT_TIMEOUT 18 | ||
72 | #define NCP_LOCK_MAX_TIMEOUT 180 | ||
73 | int timeout; | ||
74 | }; | ||
75 | |||
76 | struct ncp_setroot_ioctl | ||
77 | { | ||
78 | int volNumber; | ||
79 | int namespace; | ||
80 | __le32 dirEntNum; | ||
81 | }; | ||
82 | |||
83 | struct ncp_objectname_ioctl | ||
84 | { | ||
85 | #define NCP_AUTH_NONE 0x00 | ||
86 | #define NCP_AUTH_BIND 0x31 | ||
87 | #define NCP_AUTH_NDS 0x32 | ||
88 | int auth_type; | ||
89 | size_t object_name_len; | ||
90 | void __user * object_name; /* a userspace data, in most cases user name */ | ||
91 | }; | ||
92 | |||
93 | struct ncp_privatedata_ioctl | ||
94 | { | ||
95 | size_t len; | ||
96 | void __user * data; /* ~1000 for NDS */ | ||
97 | }; | ||
98 | |||
99 | /* NLS charsets by ioctl */ | ||
100 | #define NCP_IOCSNAME_LEN 20 | ||
101 | struct ncp_nls_ioctl | ||
102 | { | ||
103 | unsigned char codepage[NCP_IOCSNAME_LEN+1]; | ||
104 | unsigned char iocharset[NCP_IOCSNAME_LEN+1]; | ||
105 | }; | ||
106 | |||
107 | #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) | ||
108 | #define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_old_uid_t) | ||
109 | #define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long) | ||
110 | |||
111 | #define NCP_IOC_CONN_LOGGED_IN _IO('n', 3) | ||
112 | |||
113 | #define NCP_GET_FS_INFO_VERSION (1) | ||
114 | #define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info) | ||
115 | #define NCP_GET_FS_INFO_VERSION_V2 (2) | ||
116 | #define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2) | ||
117 | |||
118 | #define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init) | ||
119 | #define NCP_IOC_SIGN_WANTED _IOR('n', 6, int) | ||
120 | #define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int) | ||
121 | |||
122 | #define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl) | ||
123 | |||
124 | #define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl) | ||
125 | #define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl) | ||
126 | |||
127 | #define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl) | ||
128 | #define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl) | ||
129 | #define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl) | ||
130 | #define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl) | ||
131 | |||
132 | #define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl) | ||
133 | #define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl) | ||
134 | |||
135 | #define NCP_IOC_GETDENTRYTTL _IOW('n', 12, __u32) | ||
136 | #define NCP_IOC_SETDENTRYTTL _IOR('n', 12, __u32) | ||
137 | |||
138 | /* | ||
139 | * The packet size to allocate. One page should be enough. | ||
140 | */ | ||
141 | #define NCP_PACKET_SIZE 4070 | ||
142 | |||
143 | #define NCP_MAXPATHLEN 255 | ||
144 | #define NCP_MAXNAMELEN 14 | ||
145 | |||
146 | #endif /* _LINUX_NCP_FS_H */ | ||
diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h new file mode 100644 index 00000000000..dfcbea2d889 --- /dev/null +++ b/include/linux/ncp_mount.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * ncp_mount.h | ||
3 | * | ||
4 | * Copyright (C) 1995, 1996 by Volker Lendecke | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef _LINUX_NCP_MOUNT_H | ||
9 | #define _LINUX_NCP_MOUNT_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | #include <linux/ncp.h> | ||
13 | |||
14 | #define NCP_MOUNT_VERSION 3 /* Binary */ | ||
15 | |||
16 | /* Values for flags */ | ||
17 | #define NCP_MOUNT_SOFT 0x0001 | ||
18 | #define NCP_MOUNT_INTR 0x0002 | ||
19 | #define NCP_MOUNT_STRONG 0x0004 /* enable delete/rename of r/o files */ | ||
20 | #define NCP_MOUNT_NO_OS2 0x0008 /* do not use OS/2 (LONG) namespace */ | ||
21 | #define NCP_MOUNT_NO_NFS 0x0010 /* do not use NFS namespace */ | ||
22 | #define NCP_MOUNT_EXTRAS 0x0020 | ||
23 | #define NCP_MOUNT_SYMLINKS 0x0040 /* enable symlinks */ | ||
24 | #define NCP_MOUNT_NFS_EXTRAS 0x0080 /* Enable use of NFS NS meta-info */ | ||
25 | |||
26 | struct ncp_mount_data { | ||
27 | int version; | ||
28 | unsigned int ncp_fd; /* The socket to the ncp port */ | ||
29 | __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */ | ||
30 | __kernel_pid_t wdog_pid; /* Who cares for our watchdog packets? */ | ||
31 | |||
32 | unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; | ||
33 | unsigned int time_out; /* How long should I wait after | ||
34 | sending a NCP request? */ | ||
35 | unsigned int retry_count; /* And how often should I retry? */ | ||
36 | unsigned int flags; | ||
37 | |||
38 | __kernel_uid_t uid; | ||
39 | __kernel_gid_t gid; | ||
40 | __kernel_mode_t file_mode; | ||
41 | __kernel_mode_t dir_mode; | ||
42 | }; | ||
43 | |||
44 | #define NCP_MOUNT_VERSION_V4 (4) /* Binary or text */ | ||
45 | |||
46 | struct ncp_mount_data_v4 { | ||
47 | int version; | ||
48 | unsigned long flags; /* NCP_MOUNT_* flags */ | ||
49 | /* MIPS uses long __kernel_uid_t, but... */ | ||
50 | /* we neever pass -1, so it is safe */ | ||
51 | unsigned long mounted_uid; /* Who may umount() this filesystem? */ | ||
52 | /* MIPS uses long __kernel_pid_t */ | ||
53 | long wdog_pid; /* Who cares for our watchdog packets? */ | ||
54 | |||
55 | unsigned int ncp_fd; /* The socket to the ncp port */ | ||
56 | unsigned int time_out; /* How long should I wait after | ||
57 | sending a NCP request? */ | ||
58 | unsigned int retry_count; /* And how often should I retry? */ | ||
59 | |||
60 | /* MIPS uses long __kernel_uid_t... */ | ||
61 | /* we never pass -1, so it is safe */ | ||
62 | unsigned long uid; | ||
63 | unsigned long gid; | ||
64 | /* MIPS uses unsigned long __kernel_mode_t */ | ||
65 | unsigned long file_mode; | ||
66 | unsigned long dir_mode; | ||
67 | }; | ||
68 | |||
69 | #define NCP_MOUNT_VERSION_V5 (5) /* Text only */ | ||
70 | |||
71 | #endif | ||
diff --git a/include/linux/ncp_no.h b/include/linux/ncp_no.h new file mode 100644 index 00000000000..cddaa48fb18 --- /dev/null +++ b/include/linux/ncp_no.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _NCP_NO | ||
2 | #define _NCP_NO | ||
3 | |||
4 | /* these define the attribute byte as seen by NCP */ | ||
5 | #define aRONLY (__cpu_to_le32(1)) | ||
6 | #define aHIDDEN (__cpu_to_le32(2)) | ||
7 | #define aSYSTEM (__cpu_to_le32(4)) | ||
8 | #define aEXECUTE (__cpu_to_le32(8)) | ||
9 | #define aDIR (__cpu_to_le32(0x10)) | ||
10 | #define aARCH (__cpu_to_le32(0x20)) | ||
11 | #define aSHARED (__cpu_to_le32(0x80)) | ||
12 | #define aDONTSUBALLOCATE (__cpu_to_le32(1L<<11)) | ||
13 | #define aTRANSACTIONAL (__cpu_to_le32(1L<<12)) | ||
14 | #define aPURGE (__cpu_to_le32(1L<<16)) | ||
15 | #define aRENAMEINHIBIT (__cpu_to_le32(1L<<17)) | ||
16 | #define aDELETEINHIBIT (__cpu_to_le32(1L<<18)) | ||
17 | #define aDONTCOMPRESS (__cpu_to_le32(1L<<27)) | ||
18 | |||
19 | #endif /* _NCP_NO */ | ||
diff --git a/include/linux/nct1008.h b/include/linux/nct1008.h new file mode 100644 index 00000000000..0a517f1d6d8 --- /dev/null +++ b/include/linux/nct1008.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | * include/linux/nct1008.h | ||
3 | * | ||
4 | * NCT1008, temperature monitoring device from ON Semiconductors | ||
5 | * | ||
6 | * Copyright (c) 2010, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX_NCT1008_H | ||
24 | #define _LINUX_NCT1008_H | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | |||
28 | #include <mach/edp.h> | ||
29 | |||
30 | #define MAX_ZONES 16 | ||
31 | |||
32 | struct nct1008_data; | ||
33 | |||
34 | struct nct1008_platform_data { | ||
35 | bool supported_hwrev; | ||
36 | bool ext_range; | ||
37 | u8 conv_rate; | ||
38 | u8 offset; | ||
39 | u8 hysteresis; | ||
40 | s8 shutdown_ext_limit; | ||
41 | s8 shutdown_local_limit; | ||
42 | s8 throttling_ext_limit; | ||
43 | s8 thermal_zones[MAX_ZONES]; | ||
44 | u8 thermal_zones_sz; | ||
45 | void (*alarm_fn)(bool raised); | ||
46 | void (*probe_callback)(struct nct1008_data *); | ||
47 | }; | ||
48 | |||
49 | struct nct1008_data { | ||
50 | struct workqueue_struct *workqueue; | ||
51 | struct work_struct work; | ||
52 | struct i2c_client *client; | ||
53 | struct nct1008_platform_data plat_data; | ||
54 | struct mutex mutex; | ||
55 | struct dentry *dent; | ||
56 | u8 config; | ||
57 | s8 *limits; | ||
58 | u8 limits_sz; | ||
59 | void (*alarm_fn)(bool raised); | ||
60 | struct regulator *nct_reg; | ||
61 | long current_lo_limit; | ||
62 | long current_hi_limit; | ||
63 | int conv_period_ms; | ||
64 | |||
65 | void (*alert_func)(void *); | ||
66 | void *alert_data; | ||
67 | }; | ||
68 | |||
69 | #ifdef CONFIG_SENSORS_NCT1008 | ||
70 | int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp); | ||
71 | int nct1008_thermal_get_temp_low(struct nct1008_data *data, long *temp); | ||
72 | int nct1008_thermal_set_limits(struct nct1008_data *data, | ||
73 | long lo_limit_milli, | ||
74 | long hi_limit_milli); | ||
75 | int nct1008_thermal_set_alert(struct nct1008_data *data, | ||
76 | void (*alert_func)(void *), | ||
77 | void *alert_data); | ||
78 | int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data, | ||
79 | long shutdown_temp); | ||
80 | #else | ||
81 | static inline int nct1008_thermal_get_temp(struct nct1008_data *data, | ||
82 | long *temp) | ||
83 | { return -EINVAL; } | ||
84 | static inline int nct1008_thermal_get_temp_low(struct nct1008_data *data, | ||
85 | long *temp) | ||
86 | { return -EINVAL; } | ||
87 | static inline int nct1008_thermal_set_limits(struct nct1008_data *data, | ||
88 | long lo_limit_milli, | ||
89 | long hi_limit_milli) | ||
90 | { return -EINVAL; } | ||
91 | static inline int nct1008_thermal_set_alert(struct nct1008_data *data, | ||
92 | void (*alert_func)(void *), | ||
93 | void *alert_data) | ||
94 | { return -EINVAL; } | ||
95 | static inline int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data, | ||
96 | long shutdown_temp) | ||
97 | { return -EINVAL; } | ||
98 | #endif | ||
99 | |||
100 | #endif /* _LINUX_NCT1008_H */ | ||
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h new file mode 100644 index 00000000000..a7003b7a695 --- /dev/null +++ b/include/linux/neighbour.h | |||
@@ -0,0 +1,155 @@ | |||
1 | #ifndef __LINUX_NEIGHBOUR_H | ||
2 | #define __LINUX_NEIGHBOUR_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netlink.h> | ||
6 | |||
7 | struct ndmsg { | ||
8 | __u8 ndm_family; | ||
9 | __u8 ndm_pad1; | ||
10 | __u16 ndm_pad2; | ||
11 | __s32 ndm_ifindex; | ||
12 | __u16 ndm_state; | ||
13 | __u8 ndm_flags; | ||
14 | __u8 ndm_type; | ||
15 | }; | ||
16 | |||
17 | enum { | ||
18 | NDA_UNSPEC, | ||
19 | NDA_DST, | ||
20 | NDA_LLADDR, | ||
21 | NDA_CACHEINFO, | ||
22 | NDA_PROBES, | ||
23 | __NDA_MAX | ||
24 | }; | ||
25 | |||
26 | #define NDA_MAX (__NDA_MAX - 1) | ||
27 | |||
28 | /* | ||
29 | * Neighbor Cache Entry Flags | ||
30 | */ | ||
31 | |||
32 | #define NTF_USE 0x01 | ||
33 | #define NTF_PROXY 0x08 /* == ATF_PUBL */ | ||
34 | #define NTF_ROUTER 0x80 | ||
35 | |||
36 | /* | ||
37 | * Neighbor Cache Entry States. | ||
38 | */ | ||
39 | |||
40 | #define NUD_INCOMPLETE 0x01 | ||
41 | #define NUD_REACHABLE 0x02 | ||
42 | #define NUD_STALE 0x04 | ||
43 | #define NUD_DELAY 0x08 | ||
44 | #define NUD_PROBE 0x10 | ||
45 | #define NUD_FAILED 0x20 | ||
46 | |||
47 | /* Dummy states */ | ||
48 | #define NUD_NOARP 0x40 | ||
49 | #define NUD_PERMANENT 0x80 | ||
50 | #define NUD_NONE 0x00 | ||
51 | |||
52 | /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change | ||
53 | and make no address resolution or NUD. | ||
54 | NUD_PERMANENT is also cannot be deleted by garbage collectors. | ||
55 | */ | ||
56 | |||
57 | struct nda_cacheinfo { | ||
58 | __u32 ndm_confirmed; | ||
59 | __u32 ndm_used; | ||
60 | __u32 ndm_updated; | ||
61 | __u32 ndm_refcnt; | ||
62 | }; | ||
63 | |||
64 | /***************************************************************** | ||
65 | * Neighbour tables specific messages. | ||
66 | * | ||
67 | * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the | ||
68 | * NLM_F_DUMP flag set. Every neighbour table configuration is | ||
69 | * spread over multiple messages to avoid running into message | ||
70 | * size limits on systems with many interfaces. The first message | ||
71 | * in the sequence transports all not device specific data such as | ||
72 | * statistics, configuration, and the default parameter set. | ||
73 | * This message is followed by 0..n messages carrying device | ||
74 | * specific parameter sets. | ||
75 | * Although the ordering should be sufficient, NDTA_NAME can be | ||
76 | * used to identify sequences. The initial message can be identified | ||
77 | * by checking for NDTA_CONFIG. The device specific messages do | ||
78 | * not contain this TLV but have NDTPA_IFINDEX set to the | ||
79 | * corresponding interface index. | ||
80 | * | ||
81 | * To change neighbour table attributes, send RTM_SETNEIGHTBL | ||
82 | * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], | ||
83 | * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked | ||
84 | * otherwise. Device specific parameter sets can be changed by | ||
85 | * setting NDTPA_IFINDEX to the interface index of the corresponding | ||
86 | * device. | ||
87 | ****/ | ||
88 | |||
89 | struct ndt_stats { | ||
90 | __u64 ndts_allocs; | ||
91 | __u64 ndts_destroys; | ||
92 | __u64 ndts_hash_grows; | ||
93 | __u64 ndts_res_failed; | ||
94 | __u64 ndts_lookups; | ||
95 | __u64 ndts_hits; | ||
96 | __u64 ndts_rcv_probes_mcast; | ||
97 | __u64 ndts_rcv_probes_ucast; | ||
98 | __u64 ndts_periodic_gc_runs; | ||
99 | __u64 ndts_forced_gc_runs; | ||
100 | }; | ||
101 | |||
102 | enum { | ||
103 | NDTPA_UNSPEC, | ||
104 | NDTPA_IFINDEX, /* u32, unchangeable */ | ||
105 | NDTPA_REFCNT, /* u32, read-only */ | ||
106 | NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ | ||
107 | NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ | ||
108 | NDTPA_RETRANS_TIME, /* u64, msecs */ | ||
109 | NDTPA_GC_STALETIME, /* u64, msecs */ | ||
110 | NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ | ||
111 | NDTPA_QUEUE_LEN, /* u32 */ | ||
112 | NDTPA_APP_PROBES, /* u32 */ | ||
113 | NDTPA_UCAST_PROBES, /* u32 */ | ||
114 | NDTPA_MCAST_PROBES, /* u32 */ | ||
115 | NDTPA_ANYCAST_DELAY, /* u64, msecs */ | ||
116 | NDTPA_PROXY_DELAY, /* u64, msecs */ | ||
117 | NDTPA_PROXY_QLEN, /* u32 */ | ||
118 | NDTPA_LOCKTIME, /* u64, msecs */ | ||
119 | __NDTPA_MAX | ||
120 | }; | ||
121 | #define NDTPA_MAX (__NDTPA_MAX - 1) | ||
122 | |||
123 | struct ndtmsg { | ||
124 | __u8 ndtm_family; | ||
125 | __u8 ndtm_pad1; | ||
126 | __u16 ndtm_pad2; | ||
127 | }; | ||
128 | |||
129 | struct ndt_config { | ||
130 | __u16 ndtc_key_len; | ||
131 | __u16 ndtc_entry_size; | ||
132 | __u32 ndtc_entries; | ||
133 | __u32 ndtc_last_flush; /* delta to now in msecs */ | ||
134 | __u32 ndtc_last_rand; /* delta to now in msecs */ | ||
135 | __u32 ndtc_hash_rnd; | ||
136 | __u32 ndtc_hash_mask; | ||
137 | __u32 ndtc_hash_chain_gc; | ||
138 | __u32 ndtc_proxy_qlen; | ||
139 | }; | ||
140 | |||
141 | enum { | ||
142 | NDTA_UNSPEC, | ||
143 | NDTA_NAME, /* char *, unchangeable */ | ||
144 | NDTA_THRESH1, /* u32 */ | ||
145 | NDTA_THRESH2, /* u32 */ | ||
146 | NDTA_THRESH3, /* u32 */ | ||
147 | NDTA_CONFIG, /* struct ndt_config, read-only */ | ||
148 | NDTA_PARMS, /* nested TLV NDTPA_* */ | ||
149 | NDTA_STATS, /* struct ndt_stats, read-only */ | ||
150 | NDTA_GC_INTERVAL, /* u64, msecs */ | ||
151 | __NDTA_MAX | ||
152 | }; | ||
153 | #define NDTA_MAX (__NDTA_MAX - 1) | ||
154 | |||
155 | #endif | ||
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h new file mode 100644 index 00000000000..2a739462cae --- /dev/null +++ b/include/linux/net_dropmon.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef __NET_DROPMON_H | ||
2 | #define __NET_DROPMON_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netlink.h> | ||
6 | |||
7 | struct net_dm_drop_point { | ||
8 | __u8 pc[8]; | ||
9 | __u32 count; | ||
10 | }; | ||
11 | |||
12 | #define is_drop_point_hw(x) do {\ | ||
13 | int ____i, ____j;\ | ||
14 | for (____i = 0; ____i < 8; i ____i++)\ | ||
15 | ____j |= x[____i];\ | ||
16 | ____j;\ | ||
17 | } while (0) | ||
18 | |||
19 | #define NET_DM_CFG_VERSION 0 | ||
20 | #define NET_DM_CFG_ALERT_COUNT 1 | ||
21 | #define NET_DM_CFG_ALERT_DELAY 2 | ||
22 | #define NET_DM_CFG_MAX 3 | ||
23 | |||
24 | struct net_dm_config_entry { | ||
25 | __u32 type; | ||
26 | __u64 data __attribute__((aligned(8))); | ||
27 | }; | ||
28 | |||
29 | struct net_dm_config_msg { | ||
30 | __u32 entries; | ||
31 | struct net_dm_config_entry options[0]; | ||
32 | }; | ||
33 | |||
34 | struct net_dm_alert_msg { | ||
35 | __u32 entries; | ||
36 | struct net_dm_drop_point points[0]; | ||
37 | }; | ||
38 | |||
39 | struct net_dm_user_msg { | ||
40 | union { | ||
41 | struct net_dm_config_msg user; | ||
42 | struct net_dm_alert_msg alert; | ||
43 | } u; | ||
44 | }; | ||
45 | |||
46 | |||
47 | /* These are the netlink message types for this protocol */ | ||
48 | |||
49 | enum { | ||
50 | NET_DM_CMD_UNSPEC = 0, | ||
51 | NET_DM_CMD_ALERT, | ||
52 | NET_DM_CMD_CONFIG, | ||
53 | NET_DM_CMD_START, | ||
54 | NET_DM_CMD_STOP, | ||
55 | _NET_DM_CMD_MAX, | ||
56 | }; | ||
57 | |||
58 | #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1) | ||
59 | |||
60 | /* | ||
61 | * Our group identifiers | ||
62 | */ | ||
63 | #define NET_DM_GRP_ALERT 1 | ||
64 | #endif | ||
diff --git a/include/linux/net_tstamp.h b/include/linux/net_tstamp.h new file mode 100644 index 00000000000..a3b8546354a --- /dev/null +++ b/include/linux/net_tstamp.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Userspace API for hardware time stamping of network packets | ||
3 | * | ||
4 | * Copyright (C) 2008,2009 Intel Corporation | ||
5 | * Author: Patrick Ohly <patrick.ohly@intel.com> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef _NET_TIMESTAMPING_H | ||
10 | #define _NET_TIMESTAMPING_H | ||
11 | |||
12 | #include <linux/socket.h> /* for SO_TIMESTAMPING */ | ||
13 | |||
14 | /* SO_TIMESTAMPING gets an integer bit field comprised of these values */ | ||
15 | enum { | ||
16 | SOF_TIMESTAMPING_TX_HARDWARE = (1<<0), | ||
17 | SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1), | ||
18 | SOF_TIMESTAMPING_RX_HARDWARE = (1<<2), | ||
19 | SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3), | ||
20 | SOF_TIMESTAMPING_SOFTWARE = (1<<4), | ||
21 | SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5), | ||
22 | SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), | ||
23 | SOF_TIMESTAMPING_MASK = | ||
24 | (SOF_TIMESTAMPING_RAW_HARDWARE - 1) | | ||
25 | SOF_TIMESTAMPING_RAW_HARDWARE | ||
26 | }; | ||
27 | |||
28 | /** | ||
29 | * struct hwtstamp_config - %SIOCSHWTSTAMP parameter | ||
30 | * | ||
31 | * @flags: no flags defined right now, must be zero | ||
32 | * @tx_type: one of HWTSTAMP_TX_* | ||
33 | * @rx_type: one of one of HWTSTAMP_FILTER_* | ||
34 | * | ||
35 | * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to | ||
36 | * this structure. dev_ifsioc() in the kernel takes care of the | ||
37 | * translation between 32 bit userspace and 64 bit kernel. The | ||
38 | * structure is intentionally chosen so that it has the same layout on | ||
39 | * 32 and 64 bit systems, don't break this! | ||
40 | */ | ||
41 | struct hwtstamp_config { | ||
42 | int flags; | ||
43 | int tx_type; | ||
44 | int rx_filter; | ||
45 | }; | ||
46 | |||
47 | /* possible values for hwtstamp_config->tx_type */ | ||
48 | enum { | ||
49 | /* | ||
50 | * No outgoing packet will need hardware time stamping; | ||
51 | * should a packet arrive which asks for it, no hardware | ||
52 | * time stamping will be done. | ||
53 | */ | ||
54 | HWTSTAMP_TX_OFF, | ||
55 | |||
56 | /* | ||
57 | * Enables hardware time stamping for outgoing packets; | ||
58 | * the sender of the packet decides which are to be | ||
59 | * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE | ||
60 | * before sending the packet. | ||
61 | */ | ||
62 | HWTSTAMP_TX_ON, | ||
63 | }; | ||
64 | |||
65 | /* possible values for hwtstamp_config->rx_filter */ | ||
66 | enum { | ||
67 | /* time stamp no incoming packet at all */ | ||
68 | HWTSTAMP_FILTER_NONE, | ||
69 | |||
70 | /* time stamp any incoming packet */ | ||
71 | HWTSTAMP_FILTER_ALL, | ||
72 | |||
73 | /* return value: time stamp all packets requested plus some others */ | ||
74 | HWTSTAMP_FILTER_SOME, | ||
75 | |||
76 | /* PTP v1, UDP, any kind of event packet */ | ||
77 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, | ||
78 | /* PTP v1, UDP, Sync packet */ | ||
79 | HWTSTAMP_FILTER_PTP_V1_L4_SYNC, | ||
80 | /* PTP v1, UDP, Delay_req packet */ | ||
81 | HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ, | ||
82 | /* PTP v2, UDP, any kind of event packet */ | ||
83 | HWTSTAMP_FILTER_PTP_V2_L4_EVENT, | ||
84 | /* PTP v2, UDP, Sync packet */ | ||
85 | HWTSTAMP_FILTER_PTP_V2_L4_SYNC, | ||
86 | /* PTP v2, UDP, Delay_req packet */ | ||
87 | HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ, | ||
88 | |||
89 | /* 802.AS1, Ethernet, any kind of event packet */ | ||
90 | HWTSTAMP_FILTER_PTP_V2_L2_EVENT, | ||
91 | /* 802.AS1, Ethernet, Sync packet */ | ||
92 | HWTSTAMP_FILTER_PTP_V2_L2_SYNC, | ||
93 | /* 802.AS1, Ethernet, Delay_req packet */ | ||
94 | HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ, | ||
95 | |||
96 | /* PTP v2/802.AS1, any layer, any kind of event packet */ | ||
97 | HWTSTAMP_FILTER_PTP_V2_EVENT, | ||
98 | /* PTP v2/802.AS1, any layer, Sync packet */ | ||
99 | HWTSTAMP_FILTER_PTP_V2_SYNC, | ||
100 | /* PTP v2/802.AS1, any layer, Delay_req packet */ | ||
101 | HWTSTAMP_FILTER_PTP_V2_DELAY_REQ, | ||
102 | }; | ||
103 | |||
104 | #endif /* _NET_TIMESTAMPING_H */ | ||
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild new file mode 100644 index 00000000000..a1b410c76fc --- /dev/null +++ b/include/linux/netfilter/Kbuild | |||
@@ -0,0 +1,71 @@ | |||
1 | header-y += ipset/ | ||
2 | |||
3 | header-y += nf_conntrack_common.h | ||
4 | header-y += nf_conntrack_ftp.h | ||
5 | header-y += nf_conntrack_sctp.h | ||
6 | header-y += nf_conntrack_tcp.h | ||
7 | header-y += nf_conntrack_tuple_common.h | ||
8 | header-y += nfnetlink.h | ||
9 | header-y += nfnetlink_compat.h | ||
10 | header-y += nfnetlink_conntrack.h | ||
11 | header-y += nfnetlink_log.h | ||
12 | header-y += nfnetlink_queue.h | ||
13 | header-y += x_tables.h | ||
14 | header-y += xt_AUDIT.h | ||
15 | header-y += xt_CHECKSUM.h | ||
16 | header-y += xt_CLASSIFY.h | ||
17 | header-y += xt_CONNMARK.h | ||
18 | header-y += xt_CONNSECMARK.h | ||
19 | header-y += xt_CT.h | ||
20 | header-y += xt_DSCP.h | ||
21 | header-y += xt_IDLETIMER.h | ||
22 | header-y += xt_LED.h | ||
23 | header-y += xt_MARK.h | ||
24 | header-y += xt_NFLOG.h | ||
25 | header-y += xt_NFQUEUE.h | ||
26 | header-y += xt_RATEEST.h | ||
27 | header-y += xt_SECMARK.h | ||
28 | header-y += xt_TCPMSS.h | ||
29 | header-y += xt_TCPOPTSTRIP.h | ||
30 | header-y += xt_TEE.h | ||
31 | header-y += xt_TPROXY.h | ||
32 | header-y += xt_addrtype.h | ||
33 | header-y += xt_cluster.h | ||
34 | header-y += xt_comment.h | ||
35 | header-y += xt_connbytes.h | ||
36 | header-y += xt_connlimit.h | ||
37 | header-y += xt_connmark.h | ||
38 | header-y += xt_conntrack.h | ||
39 | header-y += xt_cpu.h | ||
40 | header-y += xt_dccp.h | ||
41 | header-y += xt_devgroup.h | ||
42 | header-y += xt_dscp.h | ||
43 | header-y += xt_esp.h | ||
44 | header-y += xt_hashlimit.h | ||
45 | header-y += xt_helper.h | ||
46 | header-y += xt_iprange.h | ||
47 | header-y += xt_ipvs.h | ||
48 | header-y += xt_length.h | ||
49 | header-y += xt_limit.h | ||
50 | header-y += xt_mac.h | ||
51 | header-y += xt_mark.h | ||
52 | header-y += xt_multiport.h | ||
53 | header-y += xt_osf.h | ||
54 | header-y += xt_owner.h | ||
55 | header-y += xt_physdev.h | ||
56 | header-y += xt_pkttype.h | ||
57 | header-y += xt_policy.h | ||
58 | header-y += xt_quota.h | ||
59 | header-y += xt_rateest.h | ||
60 | header-y += xt_realm.h | ||
61 | header-y += xt_recent.h | ||
62 | header-y += xt_set.h | ||
63 | header-y += xt_sctp.h | ||
64 | header-y += xt_socket.h | ||
65 | header-y += xt_state.h | ||
66 | header-y += xt_statistic.h | ||
67 | header-y += xt_string.h | ||
68 | header-y += xt_tcpmss.h | ||
69 | header-y += xt_tcpudp.h | ||
70 | header-y += xt_time.h | ||
71 | header-y += xt_u32.h | ||
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild new file mode 100644 index 00000000000..601fe71d34d --- /dev/null +++ b/include/linux/netfilter/ipset/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | header-y += ip_set.h | ||
2 | header-y += ip_set_bitmap.h | ||
3 | header-y += ip_set_hash.h | ||
4 | header-y += ip_set_list.h | ||
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h new file mode 100644 index 00000000000..ceeefe6681b --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_sctp.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _NF_CONNTRACK_SCTP_H | ||
2 | #define _NF_CONNTRACK_SCTP_H | ||
3 | /* SCTP tracking. */ | ||
4 | |||
5 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
6 | |||
7 | enum sctp_conntrack { | ||
8 | SCTP_CONNTRACK_NONE, | ||
9 | SCTP_CONNTRACK_CLOSED, | ||
10 | SCTP_CONNTRACK_COOKIE_WAIT, | ||
11 | SCTP_CONNTRACK_COOKIE_ECHOED, | ||
12 | SCTP_CONNTRACK_ESTABLISHED, | ||
13 | SCTP_CONNTRACK_SHUTDOWN_SENT, | ||
14 | SCTP_CONNTRACK_SHUTDOWN_RECD, | ||
15 | SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, | ||
16 | SCTP_CONNTRACK_MAX | ||
17 | }; | ||
18 | |||
19 | struct ip_ct_sctp { | ||
20 | enum sctp_conntrack state; | ||
21 | |||
22 | __be32 vtag[IP_CT_DIR_MAX]; | ||
23 | }; | ||
24 | |||
25 | #endif /* _NF_CONNTRACK_SCTP_H */ | ||
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h new file mode 100644 index 00000000000..2ea22b018a8 --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_tuple_common.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _NF_CONNTRACK_TUPLE_COMMON_H | ||
2 | #define _NF_CONNTRACK_TUPLE_COMMON_H | ||
3 | |||
4 | enum ip_conntrack_dir { | ||
5 | IP_CT_DIR_ORIGINAL, | ||
6 | IP_CT_DIR_REPLY, | ||
7 | IP_CT_DIR_MAX | ||
8 | }; | ||
9 | |||
10 | #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) | ||
11 | |||
12 | #endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h new file mode 100644 index 00000000000..ffb95036bbd --- /dev/null +++ b/include/linux/netfilter/nfnetlink_compat.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef _NFNETLINK_COMPAT_H | ||
2 | #define _NFNETLINK_COMPAT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #ifndef __KERNEL__ | ||
7 | /* Old nfnetlink macros for userspace */ | ||
8 | |||
9 | /* nfnetlink groups: Up to 32 maximum */ | ||
10 | #define NF_NETLINK_CONNTRACK_NEW 0x00000001 | ||
11 | #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 | ||
12 | #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 | ||
13 | #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 | ||
14 | #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 | ||
15 | #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 | ||
16 | |||
17 | /* Generic structure for encapsulation optional netfilter information. | ||
18 | * It is reminiscent of sockaddr, but with sa_family replaced | ||
19 | * with attribute type. | ||
20 | * ! This should someday be put somewhere generic as now rtnetlink and | ||
21 | * ! nfnetlink use the same attributes methods. - J. Schulist. | ||
22 | */ | ||
23 | |||
24 | struct nfattr { | ||
25 | __u16 nfa_len; | ||
26 | __u16 nfa_type; /* we use 15 bits for the type, and the highest | ||
27 | * bit to indicate whether the payload is nested */ | ||
28 | }; | ||
29 | |||
30 | /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from | ||
31 | * rtnetlink.h, it's time to put this in a generic file */ | ||
32 | |||
33 | #define NFNL_NFA_NEST 0x8000 | ||
34 | #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) | ||
35 | |||
36 | #define NFA_ALIGNTO 4 | ||
37 | #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) | ||
38 | #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ | ||
39 | && (nfa)->nfa_len <= (len)) | ||
40 | #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ | ||
41 | (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) | ||
42 | #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) | ||
43 | #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) | ||
44 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | ||
45 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | ||
46 | #define NFA_NEST(skb, type) \ | ||
47 | ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ | ||
48 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | ||
49 | __start; }) | ||
50 | #define NFA_NEST_END(skb, start) \ | ||
51 | ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ | ||
52 | (skb)->len; }) | ||
53 | #define NFA_NEST_CANCEL(skb, start) \ | ||
54 | ({ if (start) \ | ||
55 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ | ||
56 | -1; }) | ||
57 | |||
58 | #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ | ||
59 | + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) | ||
60 | #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) | ||
61 | |||
62 | #endif /* ! __KERNEL__ */ | ||
63 | #endif /* _NFNETLINK_COMPAT_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h new file mode 100644 index 00000000000..debf1aefd75 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -0,0 +1,193 @@ | |||
1 | #ifndef _IPCONNTRACK_NETLINK_H | ||
2 | #define _IPCONNTRACK_NETLINK_H | ||
3 | #include <linux/netfilter/nfnetlink.h> | ||
4 | |||
5 | enum cntl_msg_types { | ||
6 | IPCTNL_MSG_CT_NEW, | ||
7 | IPCTNL_MSG_CT_GET, | ||
8 | IPCTNL_MSG_CT_DELETE, | ||
9 | IPCTNL_MSG_CT_GET_CTRZERO, | ||
10 | |||
11 | IPCTNL_MSG_MAX | ||
12 | }; | ||
13 | |||
14 | enum ctnl_exp_msg_types { | ||
15 | IPCTNL_MSG_EXP_NEW, | ||
16 | IPCTNL_MSG_EXP_GET, | ||
17 | IPCTNL_MSG_EXP_DELETE, | ||
18 | |||
19 | IPCTNL_MSG_EXP_MAX | ||
20 | }; | ||
21 | |||
22 | |||
23 | enum ctattr_type { | ||
24 | CTA_UNSPEC, | ||
25 | CTA_TUPLE_ORIG, | ||
26 | CTA_TUPLE_REPLY, | ||
27 | CTA_STATUS, | ||
28 | CTA_PROTOINFO, | ||
29 | CTA_HELP, | ||
30 | CTA_NAT_SRC, | ||
31 | #define CTA_NAT CTA_NAT_SRC /* backwards compatibility */ | ||
32 | CTA_TIMEOUT, | ||
33 | CTA_MARK, | ||
34 | CTA_COUNTERS_ORIG, | ||
35 | CTA_COUNTERS_REPLY, | ||
36 | CTA_USE, | ||
37 | CTA_ID, | ||
38 | CTA_NAT_DST, | ||
39 | CTA_TUPLE_MASTER, | ||
40 | CTA_NAT_SEQ_ADJ_ORIG, | ||
41 | CTA_NAT_SEQ_ADJ_REPLY, | ||
42 | CTA_SECMARK, /* obsolete */ | ||
43 | CTA_ZONE, | ||
44 | CTA_SECCTX, | ||
45 | CTA_TIMESTAMP, | ||
46 | __CTA_MAX | ||
47 | }; | ||
48 | #define CTA_MAX (__CTA_MAX - 1) | ||
49 | |||
50 | enum ctattr_tuple { | ||
51 | CTA_TUPLE_UNSPEC, | ||
52 | CTA_TUPLE_IP, | ||
53 | CTA_TUPLE_PROTO, | ||
54 | __CTA_TUPLE_MAX | ||
55 | }; | ||
56 | #define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1) | ||
57 | |||
58 | enum ctattr_ip { | ||
59 | CTA_IP_UNSPEC, | ||
60 | CTA_IP_V4_SRC, | ||
61 | CTA_IP_V4_DST, | ||
62 | CTA_IP_V6_SRC, | ||
63 | CTA_IP_V6_DST, | ||
64 | __CTA_IP_MAX | ||
65 | }; | ||
66 | #define CTA_IP_MAX (__CTA_IP_MAX - 1) | ||
67 | |||
68 | enum ctattr_l4proto { | ||
69 | CTA_PROTO_UNSPEC, | ||
70 | CTA_PROTO_NUM, | ||
71 | CTA_PROTO_SRC_PORT, | ||
72 | CTA_PROTO_DST_PORT, | ||
73 | CTA_PROTO_ICMP_ID, | ||
74 | CTA_PROTO_ICMP_TYPE, | ||
75 | CTA_PROTO_ICMP_CODE, | ||
76 | CTA_PROTO_ICMPV6_ID, | ||
77 | CTA_PROTO_ICMPV6_TYPE, | ||
78 | CTA_PROTO_ICMPV6_CODE, | ||
79 | __CTA_PROTO_MAX | ||
80 | }; | ||
81 | #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) | ||
82 | |||
83 | enum ctattr_protoinfo { | ||
84 | CTA_PROTOINFO_UNSPEC, | ||
85 | CTA_PROTOINFO_TCP, | ||
86 | CTA_PROTOINFO_DCCP, | ||
87 | CTA_PROTOINFO_SCTP, | ||
88 | __CTA_PROTOINFO_MAX | ||
89 | }; | ||
90 | #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) | ||
91 | |||
92 | enum ctattr_protoinfo_tcp { | ||
93 | CTA_PROTOINFO_TCP_UNSPEC, | ||
94 | CTA_PROTOINFO_TCP_STATE, | ||
95 | CTA_PROTOINFO_TCP_WSCALE_ORIGINAL, | ||
96 | CTA_PROTOINFO_TCP_WSCALE_REPLY, | ||
97 | CTA_PROTOINFO_TCP_FLAGS_ORIGINAL, | ||
98 | CTA_PROTOINFO_TCP_FLAGS_REPLY, | ||
99 | __CTA_PROTOINFO_TCP_MAX | ||
100 | }; | ||
101 | #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) | ||
102 | |||
103 | enum ctattr_protoinfo_dccp { | ||
104 | CTA_PROTOINFO_DCCP_UNSPEC, | ||
105 | CTA_PROTOINFO_DCCP_STATE, | ||
106 | CTA_PROTOINFO_DCCP_ROLE, | ||
107 | CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ, | ||
108 | __CTA_PROTOINFO_DCCP_MAX, | ||
109 | }; | ||
110 | #define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) | ||
111 | |||
112 | enum ctattr_protoinfo_sctp { | ||
113 | CTA_PROTOINFO_SCTP_UNSPEC, | ||
114 | CTA_PROTOINFO_SCTP_STATE, | ||
115 | CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, | ||
116 | CTA_PROTOINFO_SCTP_VTAG_REPLY, | ||
117 | __CTA_PROTOINFO_SCTP_MAX | ||
118 | }; | ||
119 | #define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1) | ||
120 | |||
121 | enum ctattr_counters { | ||
122 | CTA_COUNTERS_UNSPEC, | ||
123 | CTA_COUNTERS_PACKETS, /* 64bit counters */ | ||
124 | CTA_COUNTERS_BYTES, /* 64bit counters */ | ||
125 | CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */ | ||
126 | CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */ | ||
127 | __CTA_COUNTERS_MAX | ||
128 | }; | ||
129 | #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) | ||
130 | |||
131 | enum ctattr_tstamp { | ||
132 | CTA_TIMESTAMP_UNSPEC, | ||
133 | CTA_TIMESTAMP_START, | ||
134 | CTA_TIMESTAMP_STOP, | ||
135 | __CTA_TIMESTAMP_MAX | ||
136 | }; | ||
137 | #define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1) | ||
138 | |||
139 | enum ctattr_nat { | ||
140 | CTA_NAT_UNSPEC, | ||
141 | CTA_NAT_MINIP, | ||
142 | CTA_NAT_MAXIP, | ||
143 | CTA_NAT_PROTO, | ||
144 | __CTA_NAT_MAX | ||
145 | }; | ||
146 | #define CTA_NAT_MAX (__CTA_NAT_MAX - 1) | ||
147 | |||
148 | enum ctattr_protonat { | ||
149 | CTA_PROTONAT_UNSPEC, | ||
150 | CTA_PROTONAT_PORT_MIN, | ||
151 | CTA_PROTONAT_PORT_MAX, | ||
152 | __CTA_PROTONAT_MAX | ||
153 | }; | ||
154 | #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) | ||
155 | |||
156 | enum ctattr_natseq { | ||
157 | CTA_NAT_SEQ_UNSPEC, | ||
158 | CTA_NAT_SEQ_CORRECTION_POS, | ||
159 | CTA_NAT_SEQ_OFFSET_BEFORE, | ||
160 | CTA_NAT_SEQ_OFFSET_AFTER, | ||
161 | __CTA_NAT_SEQ_MAX | ||
162 | }; | ||
163 | #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) | ||
164 | |||
165 | enum ctattr_expect { | ||
166 | CTA_EXPECT_UNSPEC, | ||
167 | CTA_EXPECT_MASTER, | ||
168 | CTA_EXPECT_TUPLE, | ||
169 | CTA_EXPECT_MASK, | ||
170 | CTA_EXPECT_TIMEOUT, | ||
171 | CTA_EXPECT_ID, | ||
172 | CTA_EXPECT_HELP_NAME, | ||
173 | CTA_EXPECT_ZONE, | ||
174 | CTA_EXPECT_FLAGS, | ||
175 | __CTA_EXPECT_MAX | ||
176 | }; | ||
177 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | ||
178 | |||
179 | enum ctattr_help { | ||
180 | CTA_HELP_UNSPEC, | ||
181 | CTA_HELP_NAME, | ||
182 | __CTA_HELP_MAX | ||
183 | }; | ||
184 | #define CTA_HELP_MAX (__CTA_HELP_MAX - 1) | ||
185 | |||
186 | enum ctattr_secctx { | ||
187 | CTA_SECCTX_UNSPEC, | ||
188 | CTA_SECCTX_NAME, | ||
189 | __CTA_SECCTX_MAX | ||
190 | }; | ||
191 | #define CTA_SECCTX_MAX (__CTA_SECCTX_MAX - 1) | ||
192 | |||
193 | #endif /* _IPCONNTRACK_NETLINK_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h new file mode 100644 index 00000000000..90c2c9575ba --- /dev/null +++ b/include/linux/netfilter/nfnetlink_log.h | |||
@@ -0,0 +1,97 @@ | |||
1 | #ifndef _NFNETLINK_LOG_H | ||
2 | #define _NFNETLINK_LOG_H | ||
3 | |||
4 | /* This file describes the netlink messages (i.e. 'protocol packets'), | ||
5 | * and not any kind of function definitions. It is shared between kernel and | ||
6 | * userspace. Don't put kernel specific stuff in here */ | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | #include <linux/netfilter/nfnetlink.h> | ||
10 | |||
11 | enum nfulnl_msg_types { | ||
12 | NFULNL_MSG_PACKET, /* packet from kernel to userspace */ | ||
13 | NFULNL_MSG_CONFIG, /* connect to a particular queue */ | ||
14 | |||
15 | NFULNL_MSG_MAX | ||
16 | }; | ||
17 | |||
18 | struct nfulnl_msg_packet_hdr { | ||
19 | __be16 hw_protocol; /* hw protocol (network order) */ | ||
20 | __u8 hook; /* netfilter hook */ | ||
21 | __u8 _pad; | ||
22 | }; | ||
23 | |||
24 | struct nfulnl_msg_packet_hw { | ||
25 | __be16 hw_addrlen; | ||
26 | __u16 _pad; | ||
27 | __u8 hw_addr[8]; | ||
28 | }; | ||
29 | |||
30 | struct nfulnl_msg_packet_timestamp { | ||
31 | __aligned_be64 sec; | ||
32 | __aligned_be64 usec; | ||
33 | }; | ||
34 | |||
35 | enum nfulnl_attr_type { | ||
36 | NFULA_UNSPEC, | ||
37 | NFULA_PACKET_HDR, | ||
38 | NFULA_MARK, /* __u32 nfmark */ | ||
39 | NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ | ||
40 | NFULA_IFINDEX_INDEV, /* __u32 ifindex */ | ||
41 | NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */ | ||
42 | NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ | ||
43 | NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ | ||
44 | NFULA_HWADDR, /* nfulnl_msg_packet_hw */ | ||
45 | NFULA_PAYLOAD, /* opaque data payload */ | ||
46 | NFULA_PREFIX, /* string prefix */ | ||
47 | NFULA_UID, /* user id of socket */ | ||
48 | NFULA_SEQ, /* instance-local sequence number */ | ||
49 | NFULA_SEQ_GLOBAL, /* global sequence number */ | ||
50 | NFULA_GID, /* group id of socket */ | ||
51 | NFULA_HWTYPE, /* hardware type */ | ||
52 | NFULA_HWHEADER, /* hardware header */ | ||
53 | NFULA_HWLEN, /* hardware header length */ | ||
54 | |||
55 | __NFULA_MAX | ||
56 | }; | ||
57 | #define NFULA_MAX (__NFULA_MAX - 1) | ||
58 | |||
59 | enum nfulnl_msg_config_cmds { | ||
60 | NFULNL_CFG_CMD_NONE, | ||
61 | NFULNL_CFG_CMD_BIND, | ||
62 | NFULNL_CFG_CMD_UNBIND, | ||
63 | NFULNL_CFG_CMD_PF_BIND, | ||
64 | NFULNL_CFG_CMD_PF_UNBIND, | ||
65 | }; | ||
66 | |||
67 | struct nfulnl_msg_config_cmd { | ||
68 | __u8 command; /* nfulnl_msg_config_cmds */ | ||
69 | } __attribute__ ((packed)); | ||
70 | |||
71 | struct nfulnl_msg_config_mode { | ||
72 | __be32 copy_range; | ||
73 | __u8 copy_mode; | ||
74 | __u8 _pad; | ||
75 | } __attribute__ ((packed)); | ||
76 | |||
77 | enum nfulnl_attr_config { | ||
78 | NFULA_CFG_UNSPEC, | ||
79 | NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ | ||
80 | NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ | ||
81 | NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */ | ||
82 | NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */ | ||
83 | NFULA_CFG_QTHRESH, /* __u32 */ | ||
84 | NFULA_CFG_FLAGS, /* __u16 */ | ||
85 | __NFULA_CFG_MAX | ||
86 | }; | ||
87 | #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) | ||
88 | |||
89 | #define NFULNL_COPY_NONE 0x00 | ||
90 | #define NFULNL_COPY_META 0x01 | ||
91 | #define NFULNL_COPY_PACKET 0x02 | ||
92 | /* 0xff is reserved, don't use it for new copy modes. */ | ||
93 | |||
94 | #define NFULNL_CFG_F_SEQ 0x0001 | ||
95 | #define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 | ||
96 | |||
97 | #endif /* _NFNETLINK_LOG_H */ | ||
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h new file mode 100644 index 00000000000..24b32e6c009 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_queue.h | |||
@@ -0,0 +1,91 @@ | |||
1 | #ifndef _NFNETLINK_QUEUE_H | ||
2 | #define _NFNETLINK_QUEUE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netfilter/nfnetlink.h> | ||
6 | |||
7 | enum nfqnl_msg_types { | ||
8 | NFQNL_MSG_PACKET, /* packet from kernel to userspace */ | ||
9 | NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ | ||
10 | NFQNL_MSG_CONFIG, /* connect to a particular queue */ | ||
11 | NFQNL_MSG_VERDICT_BATCH, /* batchv from userspace to kernel */ | ||
12 | |||
13 | NFQNL_MSG_MAX | ||
14 | }; | ||
15 | |||
16 | struct nfqnl_msg_packet_hdr { | ||
17 | __be32 packet_id; /* unique ID of packet in queue */ | ||
18 | __be16 hw_protocol; /* hw protocol (network order) */ | ||
19 | __u8 hook; /* netfilter hook */ | ||
20 | } __attribute__ ((packed)); | ||
21 | |||
22 | struct nfqnl_msg_packet_hw { | ||
23 | __be16 hw_addrlen; | ||
24 | __u16 _pad; | ||
25 | __u8 hw_addr[8]; | ||
26 | }; | ||
27 | |||
28 | struct nfqnl_msg_packet_timestamp { | ||
29 | __aligned_be64 sec; | ||
30 | __aligned_be64 usec; | ||
31 | }; | ||
32 | |||
33 | enum nfqnl_attr_type { | ||
34 | NFQA_UNSPEC, | ||
35 | NFQA_PACKET_HDR, | ||
36 | NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ | ||
37 | NFQA_MARK, /* __u32 nfmark */ | ||
38 | NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ | ||
39 | NFQA_IFINDEX_INDEV, /* __u32 ifindex */ | ||
40 | NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */ | ||
41 | NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ | ||
42 | NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ | ||
43 | NFQA_HWADDR, /* nfqnl_msg_packet_hw */ | ||
44 | NFQA_PAYLOAD, /* opaque data payload */ | ||
45 | |||
46 | __NFQA_MAX | ||
47 | }; | ||
48 | #define NFQA_MAX (__NFQA_MAX - 1) | ||
49 | |||
50 | struct nfqnl_msg_verdict_hdr { | ||
51 | __be32 verdict; | ||
52 | __be32 id; | ||
53 | }; | ||
54 | |||
55 | |||
56 | enum nfqnl_msg_config_cmds { | ||
57 | NFQNL_CFG_CMD_NONE, | ||
58 | NFQNL_CFG_CMD_BIND, | ||
59 | NFQNL_CFG_CMD_UNBIND, | ||
60 | NFQNL_CFG_CMD_PF_BIND, | ||
61 | NFQNL_CFG_CMD_PF_UNBIND, | ||
62 | }; | ||
63 | |||
64 | struct nfqnl_msg_config_cmd { | ||
65 | __u8 command; /* nfqnl_msg_config_cmds */ | ||
66 | __u8 _pad; | ||
67 | __be16 pf; /* AF_xxx for PF_[UN]BIND */ | ||
68 | }; | ||
69 | |||
70 | enum nfqnl_config_mode { | ||
71 | NFQNL_COPY_NONE, | ||
72 | NFQNL_COPY_META, | ||
73 | NFQNL_COPY_PACKET, | ||
74 | }; | ||
75 | |||
76 | struct nfqnl_msg_config_params { | ||
77 | __be32 copy_range; | ||
78 | __u8 copy_mode; /* enum nfqnl_config_mode */ | ||
79 | } __attribute__ ((packed)); | ||
80 | |||
81 | |||
82 | enum nfqnl_attr_config { | ||
83 | NFQA_CFG_UNSPEC, | ||
84 | NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ | ||
85 | NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ | ||
86 | NFQA_CFG_QUEUE_MAXLEN, /* __u32 */ | ||
87 | __NFQA_CFG_MAX | ||
88 | }; | ||
89 | #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) | ||
90 | |||
91 | #endif /* _NFNETLINK_QUEUE_H */ | ||
diff --git a/include/linux/netfilter/xt_AUDIT.h b/include/linux/netfilter/xt_AUDIT.h new file mode 100644 index 00000000000..38751d2ea52 --- /dev/null +++ b/include/linux/netfilter/xt_AUDIT.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Header file for iptables xt_AUDIT target | ||
3 | * | ||
4 | * (C) 2010-2011 Thomas Graf <tgraf@redhat.com> | ||
5 | * (C) 2010-2011 Red Hat, Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XT_AUDIT_TARGET_H | ||
13 | #define _XT_AUDIT_TARGET_H | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | enum { | ||
18 | XT_AUDIT_TYPE_ACCEPT = 0, | ||
19 | XT_AUDIT_TYPE_DROP, | ||
20 | XT_AUDIT_TYPE_REJECT, | ||
21 | __XT_AUDIT_TYPE_MAX, | ||
22 | }; | ||
23 | |||
24 | #define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1) | ||
25 | |||
26 | struct xt_audit_info { | ||
27 | __u8 type; /* XT_AUDIT_TYPE_* */ | ||
28 | }; | ||
29 | |||
30 | #endif /* _XT_AUDIT_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_CHECKSUM.h b/include/linux/netfilter/xt_CHECKSUM.h new file mode 100644 index 00000000000..9a2e4661654 --- /dev/null +++ b/include/linux/netfilter/xt_CHECKSUM.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* Header file for iptables ipt_CHECKSUM target | ||
2 | * | ||
3 | * (C) 2002 by Harald Welte <laforge@gnumonks.org> | ||
4 | * (C) 2010 Red Hat Inc | ||
5 | * Author: Michael S. Tsirkin <mst@redhat.com> | ||
6 | * | ||
7 | * This software is distributed under GNU GPL v2, 1991 | ||
8 | */ | ||
9 | #ifndef _XT_CHECKSUM_TARGET_H | ||
10 | #define _XT_CHECKSUM_TARGET_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | |||
14 | #define XT_CHECKSUM_OP_FILL 0x01 /* fill in checksum in IP header */ | ||
15 | |||
16 | struct xt_CHECKSUM_info { | ||
17 | __u8 operation; /* bitset of operations */ | ||
18 | }; | ||
19 | |||
20 | #endif /* _XT_CHECKSUM_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h new file mode 100644 index 00000000000..a813bf14dd6 --- /dev/null +++ b/include/linux/netfilter/xt_CLASSIFY.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _XT_CLASSIFY_H | ||
2 | #define _XT_CLASSIFY_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_classify_target_info { | ||
7 | __u32 priority; | ||
8 | }; | ||
9 | |||
10 | #endif /*_XT_CLASSIFY_H */ | ||
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h new file mode 100644 index 00000000000..2f2e48ec802 --- /dev/null +++ b/include/linux/netfilter/xt_CONNMARK.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _XT_CONNMARK_H_target | ||
2 | #define _XT_CONNMARK_H_target | ||
3 | |||
4 | #include <linux/netfilter/xt_connmark.h> | ||
5 | |||
6 | #endif /*_XT_CONNMARK_H_target*/ | ||
diff --git a/include/linux/netfilter/xt_CONNSECMARK.h b/include/linux/netfilter/xt_CONNSECMARK.h new file mode 100644 index 00000000000..b973ff80fa1 --- /dev/null +++ b/include/linux/netfilter/xt_CONNSECMARK.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _XT_CONNSECMARK_H_target | ||
2 | #define _XT_CONNSECMARK_H_target | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | CONNSECMARK_SAVE = 1, | ||
8 | CONNSECMARK_RESTORE, | ||
9 | }; | ||
10 | |||
11 | struct xt_connsecmark_target_info { | ||
12 | __u8 mode; | ||
13 | }; | ||
14 | |||
15 | #endif /*_XT_CONNSECMARK_H_target */ | ||
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h new file mode 100644 index 00000000000..b56e76811c0 --- /dev/null +++ b/include/linux/netfilter/xt_CT.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _XT_CT_H | ||
2 | #define _XT_CT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define XT_CT_NOTRACK 0x1 | ||
7 | |||
8 | struct xt_ct_target_info { | ||
9 | __u16 flags; | ||
10 | __u16 zone; | ||
11 | __u32 ct_events; | ||
12 | __u32 exp_events; | ||
13 | char helper[16]; | ||
14 | |||
15 | /* Used internally by the kernel */ | ||
16 | struct nf_conn *ct __attribute__((aligned(8))); | ||
17 | }; | ||
18 | |||
19 | #endif /* _XT_CT_H */ | ||
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h new file mode 100644 index 00000000000..648e0b3bed2 --- /dev/null +++ b/include/linux/netfilter/xt_DSCP.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* x_tables module for setting the IPv4/IPv6 DSCP field | ||
2 | * | ||
3 | * (C) 2002 Harald Welte <laforge@gnumonks.org> | ||
4 | * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com> | ||
5 | * This software is distributed under GNU GPL v2, 1991 | ||
6 | * | ||
7 | * See RFC2474 for a description of the DSCP field within the IP Header. | ||
8 | * | ||
9 | * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp | ||
10 | */ | ||
11 | #ifndef _XT_DSCP_TARGET_H | ||
12 | #define _XT_DSCP_TARGET_H | ||
13 | #include <linux/netfilter/xt_dscp.h> | ||
14 | #include <linux/types.h> | ||
15 | |||
16 | /* target info */ | ||
17 | struct xt_DSCP_info { | ||
18 | __u8 dscp; | ||
19 | }; | ||
20 | |||
21 | struct xt_tos_target_info { | ||
22 | __u8 tos_value; | ||
23 | __u8 tos_mask; | ||
24 | }; | ||
25 | |||
26 | #endif /* _XT_DSCP_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_IDLETIMER.h b/include/linux/netfilter/xt_IDLETIMER.h new file mode 100644 index 00000000000..208ae938733 --- /dev/null +++ b/include/linux/netfilter/xt_IDLETIMER.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * linux/include/linux/netfilter/xt_IDLETIMER.h | ||
3 | * | ||
4 | * Header file for Xtables timer target module. | ||
5 | * | ||
6 | * Copyright (C) 2004, 2010 Nokia Corporation | ||
7 | * Written by Timo Teras <ext-timo.teras@nokia.com> | ||
8 | * | ||
9 | * Converted to x_tables and forward-ported to 2.6.34 | ||
10 | * by Luciano Coelho <luciano.coelho@nokia.com> | ||
11 | * | ||
12 | * Contact: Luciano Coelho <luciano.coelho@nokia.com> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * version 2 as published by the Free Software Foundation. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but | ||
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
21 | * General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
26 | * 02110-1301 USA | ||
27 | */ | ||
28 | |||
29 | #ifndef _XT_IDLETIMER_H | ||
30 | #define _XT_IDLETIMER_H | ||
31 | |||
32 | #include <linux/types.h> | ||
33 | |||
34 | #define MAX_IDLETIMER_LABEL_SIZE 28 | ||
35 | |||
36 | struct idletimer_tg_info { | ||
37 | __u32 timeout; | ||
38 | |||
39 | char label[MAX_IDLETIMER_LABEL_SIZE]; | ||
40 | |||
41 | /* for kernel module internal use only */ | ||
42 | struct idletimer_tg *timer __attribute__((aligned(8))); | ||
43 | }; | ||
44 | |||
45 | #endif | ||
diff --git a/include/linux/netfilter/xt_LED.h b/include/linux/netfilter/xt_LED.h new file mode 100644 index 00000000000..f5509e7524d --- /dev/null +++ b/include/linux/netfilter/xt_LED.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _XT_LED_H | ||
2 | #define _XT_LED_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_led_info { | ||
7 | char id[27]; /* Unique ID for this trigger in the LED class */ | ||
8 | __u8 always_blink; /* Blink even if the LED is already on */ | ||
9 | __u32 delay; /* Delay until LED is switched off after trigger */ | ||
10 | |||
11 | /* Kernel data used in the module */ | ||
12 | void *internal_data __attribute__((aligned(8))); | ||
13 | }; | ||
14 | |||
15 | #endif /* _XT_LED_H */ | ||
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h new file mode 100644 index 00000000000..41c456deba2 --- /dev/null +++ b/include/linux/netfilter/xt_MARK.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _XT_MARK_H_target | ||
2 | #define _XT_MARK_H_target | ||
3 | |||
4 | #include <linux/netfilter/xt_mark.h> | ||
5 | |||
6 | #endif /*_XT_MARK_H_target */ | ||
diff --git a/include/linux/netfilter/xt_NFLOG.h b/include/linux/netfilter/xt_NFLOG.h new file mode 100644 index 00000000000..87b58311ce6 --- /dev/null +++ b/include/linux/netfilter/xt_NFLOG.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _XT_NFLOG_TARGET | ||
2 | #define _XT_NFLOG_TARGET | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define XT_NFLOG_DEFAULT_GROUP 0x1 | ||
7 | #define XT_NFLOG_DEFAULT_THRESHOLD 0 | ||
8 | |||
9 | #define XT_NFLOG_MASK 0x0 | ||
10 | |||
11 | struct xt_nflog_info { | ||
12 | __u32 len; | ||
13 | __u16 group; | ||
14 | __u16 threshold; | ||
15 | __u16 flags; | ||
16 | __u16 pad; | ||
17 | char prefix[64]; | ||
18 | }; | ||
19 | |||
20 | #endif /* _XT_NFLOG_TARGET */ | ||
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h new file mode 100644 index 00000000000..9eafdbbb401 --- /dev/null +++ b/include/linux/netfilter/xt_NFQUEUE.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* iptables module for using NFQUEUE mechanism | ||
2 | * | ||
3 | * (C) 2005 Harald Welte <laforge@netfilter.org> | ||
4 | * | ||
5 | * This software is distributed under GNU GPL v2, 1991 | ||
6 | * | ||
7 | */ | ||
8 | #ifndef _XT_NFQ_TARGET_H | ||
9 | #define _XT_NFQ_TARGET_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | /* target info */ | ||
14 | struct xt_NFQ_info { | ||
15 | __u16 queuenum; | ||
16 | }; | ||
17 | |||
18 | struct xt_NFQ_info_v1 { | ||
19 | __u16 queuenum; | ||
20 | __u16 queues_total; | ||
21 | }; | ||
22 | |||
23 | struct xt_NFQ_info_v2 { | ||
24 | __u16 queuenum; | ||
25 | __u16 queues_total; | ||
26 | __u16 bypass; | ||
27 | }; | ||
28 | |||
29 | #endif /* _XT_NFQ_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/linux/netfilter/xt_RATEEST.h new file mode 100644 index 00000000000..6605e20ad8c --- /dev/null +++ b/include/linux/netfilter/xt_RATEEST.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _XT_RATEEST_TARGET_H | ||
2 | #define _XT_RATEEST_TARGET_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_rateest_target_info { | ||
7 | char name[IFNAMSIZ]; | ||
8 | __s8 interval; | ||
9 | __u8 ewma_log; | ||
10 | |||
11 | /* Used internally by the kernel */ | ||
12 | struct xt_rateest *est __attribute__((aligned(8))); | ||
13 | }; | ||
14 | |||
15 | #endif /* _XT_RATEEST_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_SECMARK.h b/include/linux/netfilter/xt_SECMARK.h new file mode 100644 index 00000000000..989092bd627 --- /dev/null +++ b/include/linux/netfilter/xt_SECMARK.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _XT_SECMARK_H_target | ||
2 | #define _XT_SECMARK_H_target | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* | ||
7 | * This is intended for use by various security subsystems (but not | ||
8 | * at the same time). | ||
9 | * | ||
10 | * 'mode' refers to the specific security subsystem which the | ||
11 | * packets are being marked for. | ||
12 | */ | ||
13 | #define SECMARK_MODE_SEL 0x01 /* SELinux */ | ||
14 | #define SECMARK_SECCTX_MAX 256 | ||
15 | |||
16 | struct xt_secmark_target_info { | ||
17 | __u8 mode; | ||
18 | __u32 secid; | ||
19 | char secctx[SECMARK_SECCTX_MAX]; | ||
20 | }; | ||
21 | |||
22 | #endif /*_XT_SECMARK_H_target */ | ||
diff --git a/include/linux/netfilter/xt_TCPMSS.h b/include/linux/netfilter/xt_TCPMSS.h new file mode 100644 index 00000000000..9a6960afc13 --- /dev/null +++ b/include/linux/netfilter/xt_TCPMSS.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _XT_TCPMSS_H | ||
2 | #define _XT_TCPMSS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_tcpmss_info { | ||
7 | __u16 mss; | ||
8 | }; | ||
9 | |||
10 | #define XT_TCPMSS_CLAMP_PMTU 0xffff | ||
11 | |||
12 | #endif /* _XT_TCPMSS_H */ | ||
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h new file mode 100644 index 00000000000..7157318499c --- /dev/null +++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _XT_TCPOPTSTRIP_H | ||
2 | #define _XT_TCPOPTSTRIP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define tcpoptstrip_set_bit(bmap, idx) \ | ||
7 | (bmap[(idx) >> 5] |= 1U << (idx & 31)) | ||
8 | #define tcpoptstrip_test_bit(bmap, idx) \ | ||
9 | (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) | ||
10 | |||
11 | struct xt_tcpoptstrip_target_info { | ||
12 | __u32 strip_bmap[8]; | ||
13 | }; | ||
14 | |||
15 | #endif /* _XT_TCPOPTSTRIP_H */ | ||
diff --git a/include/linux/netfilter/xt_TEE.h b/include/linux/netfilter/xt_TEE.h new file mode 100644 index 00000000000..5c21d5c829a --- /dev/null +++ b/include/linux/netfilter/xt_TEE.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _XT_TEE_TARGET_H | ||
2 | #define _XT_TEE_TARGET_H | ||
3 | |||
4 | struct xt_tee_tginfo { | ||
5 | union nf_inet_addr gw; | ||
6 | char oif[16]; | ||
7 | |||
8 | /* used internally by the kernel */ | ||
9 | struct xt_tee_priv *priv __attribute__((aligned(8))); | ||
10 | }; | ||
11 | |||
12 | #endif /* _XT_TEE_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h new file mode 100644 index 00000000000..902043c2073 --- /dev/null +++ b/include/linux/netfilter/xt_TPROXY.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _XT_TPROXY_H | ||
2 | #define _XT_TPROXY_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* TPROXY target is capable of marking the packet to perform | ||
7 | * redirection. We can get rid of that whenever we get support for | ||
8 | * mutliple targets in the same rule. */ | ||
9 | struct xt_tproxy_target_info { | ||
10 | __u32 mark_mask; | ||
11 | __u32 mark_value; | ||
12 | __be32 laddr; | ||
13 | __be16 lport; | ||
14 | }; | ||
15 | |||
16 | struct xt_tproxy_target_info_v1 { | ||
17 | __u32 mark_mask; | ||
18 | __u32 mark_value; | ||
19 | union nf_inet_addr laddr; | ||
20 | __be16 lport; | ||
21 | }; | ||
22 | |||
23 | #endif /* _XT_TPROXY_H */ | ||
diff --git a/include/linux/netfilter/xt_addrtype.h b/include/linux/netfilter/xt_addrtype.h new file mode 100644 index 00000000000..b156baa9d55 --- /dev/null +++ b/include/linux/netfilter/xt_addrtype.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _XT_ADDRTYPE_H | ||
2 | #define _XT_ADDRTYPE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | XT_ADDRTYPE_INVERT_SOURCE = 0x0001, | ||
8 | XT_ADDRTYPE_INVERT_DEST = 0x0002, | ||
9 | XT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, | ||
10 | XT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, | ||
11 | }; | ||
12 | |||
13 | |||
14 | /* rtn_type enum values from rtnetlink.h, but shifted */ | ||
15 | enum { | ||
16 | XT_ADDRTYPE_UNSPEC = 1 << 0, | ||
17 | XT_ADDRTYPE_UNICAST = 1 << 1, /* 1 << RTN_UNICAST */ | ||
18 | XT_ADDRTYPE_LOCAL = 1 << 2, /* 1 << RTN_LOCAL, etc */ | ||
19 | XT_ADDRTYPE_BROADCAST = 1 << 3, | ||
20 | XT_ADDRTYPE_ANYCAST = 1 << 4, | ||
21 | XT_ADDRTYPE_MULTICAST = 1 << 5, | ||
22 | XT_ADDRTYPE_BLACKHOLE = 1 << 6, | ||
23 | XT_ADDRTYPE_UNREACHABLE = 1 << 7, | ||
24 | XT_ADDRTYPE_PROHIBIT = 1 << 8, | ||
25 | XT_ADDRTYPE_THROW = 1 << 9, | ||
26 | XT_ADDRTYPE_NAT = 1 << 10, | ||
27 | XT_ADDRTYPE_XRESOLVE = 1 << 11, | ||
28 | }; | ||
29 | |||
30 | struct xt_addrtype_info_v1 { | ||
31 | __u16 source; /* source-type mask */ | ||
32 | __u16 dest; /* dest-type mask */ | ||
33 | __u32 flags; | ||
34 | }; | ||
35 | |||
36 | /* revision 0 */ | ||
37 | struct xt_addrtype_info { | ||
38 | __u16 source; /* source-type mask */ | ||
39 | __u16 dest; /* dest-type mask */ | ||
40 | __u32 invert_source; | ||
41 | __u32 invert_dest; | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h new file mode 100644 index 00000000000..9b883c8fbf5 --- /dev/null +++ b/include/linux/netfilter/xt_cluster.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _XT_CLUSTER_MATCH_H | ||
2 | #define _XT_CLUSTER_MATCH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_cluster_flags { | ||
7 | XT_CLUSTER_F_INV = (1 << 0) | ||
8 | }; | ||
9 | |||
10 | struct xt_cluster_match_info { | ||
11 | __u32 total_nodes; | ||
12 | __u32 node_mask; | ||
13 | __u32 hash_seed; | ||
14 | __u32 flags; | ||
15 | }; | ||
16 | |||
17 | #define XT_CLUSTER_NODES_MAX 32 | ||
18 | |||
19 | #endif /* _XT_CLUSTER_MATCH_H */ | ||
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h new file mode 100644 index 00000000000..0ea5e79f5bd --- /dev/null +++ b/include/linux/netfilter/xt_comment.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _XT_COMMENT_H | ||
2 | #define _XT_COMMENT_H | ||
3 | |||
4 | #define XT_MAX_COMMENT_LEN 256 | ||
5 | |||
6 | struct xt_comment_info { | ||
7 | char comment[XT_MAX_COMMENT_LEN]; | ||
8 | }; | ||
9 | |||
10 | #endif /* XT_COMMENT_H */ | ||
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h new file mode 100644 index 00000000000..f1d6c15bd9e --- /dev/null +++ b/include/linux/netfilter/xt_connbytes.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _XT_CONNBYTES_H | ||
2 | #define _XT_CONNBYTES_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_connbytes_what { | ||
7 | XT_CONNBYTES_PKTS, | ||
8 | XT_CONNBYTES_BYTES, | ||
9 | XT_CONNBYTES_AVGPKT, | ||
10 | }; | ||
11 | |||
12 | enum xt_connbytes_direction { | ||
13 | XT_CONNBYTES_DIR_ORIGINAL, | ||
14 | XT_CONNBYTES_DIR_REPLY, | ||
15 | XT_CONNBYTES_DIR_BOTH, | ||
16 | }; | ||
17 | |||
18 | struct xt_connbytes_info { | ||
19 | struct { | ||
20 | __aligned_u64 from; /* count to be matched */ | ||
21 | __aligned_u64 to; /* count to be matched */ | ||
22 | } count; | ||
23 | __u8 what; /* ipt_connbytes_what */ | ||
24 | __u8 direction; /* ipt_connbytes_direction */ | ||
25 | }; | ||
26 | #endif | ||
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h new file mode 100644 index 00000000000..0ca66e97acb --- /dev/null +++ b/include/linux/netfilter/xt_connlimit.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _XT_CONNLIMIT_H | ||
2 | #define _XT_CONNLIMIT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_connlimit_data; | ||
7 | |||
8 | enum { | ||
9 | XT_CONNLIMIT_INVERT = 1 << 0, | ||
10 | XT_CONNLIMIT_DADDR = 1 << 1, | ||
11 | }; | ||
12 | |||
13 | struct xt_connlimit_info { | ||
14 | union { | ||
15 | union nf_inet_addr mask; | ||
16 | #ifndef __KERNEL__ | ||
17 | union { | ||
18 | __be32 v4_mask; | ||
19 | __be32 v6_mask[4]; | ||
20 | }; | ||
21 | #endif | ||
22 | }; | ||
23 | unsigned int limit; | ||
24 | union { | ||
25 | /* revision 0 */ | ||
26 | unsigned int inverse; | ||
27 | |||
28 | /* revision 1 */ | ||
29 | __u32 flags; | ||
30 | }; | ||
31 | |||
32 | /* Used internally by the kernel */ | ||
33 | struct xt_connlimit_data *data __attribute__((aligned(8))); | ||
34 | }; | ||
35 | |||
36 | #endif /* _XT_CONNLIMIT_H */ | ||
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h new file mode 100644 index 00000000000..efc17a8305f --- /dev/null +++ b/include/linux/netfilter/xt_connmark.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _XT_CONNMARK_H | ||
2 | #define _XT_CONNMARK_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> | ||
7 | * by Henrik Nordstrom <hno@marasystems.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | enum { | ||
16 | XT_CONNMARK_SET = 0, | ||
17 | XT_CONNMARK_SAVE, | ||
18 | XT_CONNMARK_RESTORE | ||
19 | }; | ||
20 | |||
21 | struct xt_connmark_tginfo1 { | ||
22 | __u32 ctmark, ctmask, nfmask; | ||
23 | __u8 mode; | ||
24 | }; | ||
25 | |||
26 | struct xt_connmark_mtinfo1 { | ||
27 | __u32 mark, mask; | ||
28 | __u8 invert; | ||
29 | }; | ||
30 | |||
31 | #endif /*_XT_CONNMARK_H*/ | ||
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h new file mode 100644 index 00000000000..74b904d8f99 --- /dev/null +++ b/include/linux/netfilter/xt_conntrack.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* Header file for kernel module to match connection tracking information. | ||
2 | * GPL (C) 2001 Marc Boucher (marc@mbsi.ca). | ||
3 | */ | ||
4 | |||
5 | #ifndef _XT_CONNTRACK_H | ||
6 | #define _XT_CONNTRACK_H | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
10 | |||
11 | #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) | ||
12 | #define XT_CONNTRACK_STATE_INVALID (1 << 0) | ||
13 | |||
14 | #define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) | ||
15 | #define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) | ||
16 | #define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) | ||
17 | |||
18 | /* flags, invflags: */ | ||
19 | enum { | ||
20 | XT_CONNTRACK_STATE = 1 << 0, | ||
21 | XT_CONNTRACK_PROTO = 1 << 1, | ||
22 | XT_CONNTRACK_ORIGSRC = 1 << 2, | ||
23 | XT_CONNTRACK_ORIGDST = 1 << 3, | ||
24 | XT_CONNTRACK_REPLSRC = 1 << 4, | ||
25 | XT_CONNTRACK_REPLDST = 1 << 5, | ||
26 | XT_CONNTRACK_STATUS = 1 << 6, | ||
27 | XT_CONNTRACK_EXPIRES = 1 << 7, | ||
28 | XT_CONNTRACK_ORIGSRC_PORT = 1 << 8, | ||
29 | XT_CONNTRACK_ORIGDST_PORT = 1 << 9, | ||
30 | XT_CONNTRACK_REPLSRC_PORT = 1 << 10, | ||
31 | XT_CONNTRACK_REPLDST_PORT = 1 << 11, | ||
32 | XT_CONNTRACK_DIRECTION = 1 << 12, | ||
33 | }; | ||
34 | |||
35 | struct xt_conntrack_mtinfo1 { | ||
36 | union nf_inet_addr origsrc_addr, origsrc_mask; | ||
37 | union nf_inet_addr origdst_addr, origdst_mask; | ||
38 | union nf_inet_addr replsrc_addr, replsrc_mask; | ||
39 | union nf_inet_addr repldst_addr, repldst_mask; | ||
40 | __u32 expires_min, expires_max; | ||
41 | __u16 l4proto; | ||
42 | __be16 origsrc_port, origdst_port; | ||
43 | __be16 replsrc_port, repldst_port; | ||
44 | __u16 match_flags, invert_flags; | ||
45 | __u8 state_mask, status_mask; | ||
46 | }; | ||
47 | |||
48 | struct xt_conntrack_mtinfo2 { | ||
49 | union nf_inet_addr origsrc_addr, origsrc_mask; | ||
50 | union nf_inet_addr origdst_addr, origdst_mask; | ||
51 | union nf_inet_addr replsrc_addr, replsrc_mask; | ||
52 | union nf_inet_addr repldst_addr, repldst_mask; | ||
53 | __u32 expires_min, expires_max; | ||
54 | __u16 l4proto; | ||
55 | __be16 origsrc_port, origdst_port; | ||
56 | __be16 replsrc_port, repldst_port; | ||
57 | __u16 match_flags, invert_flags; | ||
58 | __u16 state_mask, status_mask; | ||
59 | }; | ||
60 | |||
61 | struct xt_conntrack_mtinfo3 { | ||
62 | union nf_inet_addr origsrc_addr, origsrc_mask; | ||
63 | union nf_inet_addr origdst_addr, origdst_mask; | ||
64 | union nf_inet_addr replsrc_addr, replsrc_mask; | ||
65 | union nf_inet_addr repldst_addr, repldst_mask; | ||
66 | __u32 expires_min, expires_max; | ||
67 | __u16 l4proto; | ||
68 | __u16 origsrc_port, origdst_port; | ||
69 | __u16 replsrc_port, repldst_port; | ||
70 | __u16 match_flags, invert_flags; | ||
71 | __u16 state_mask, status_mask; | ||
72 | __u16 origsrc_port_high, origdst_port_high; | ||
73 | __u16 replsrc_port_high, repldst_port_high; | ||
74 | }; | ||
75 | |||
76 | #endif /*_XT_CONNTRACK_H*/ | ||
diff --git a/include/linux/netfilter/xt_cpu.h b/include/linux/netfilter/xt_cpu.h new file mode 100644 index 00000000000..93c7f11d8f4 --- /dev/null +++ b/include/linux/netfilter/xt_cpu.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _XT_CPU_H | ||
2 | #define _XT_CPU_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_cpu_info { | ||
7 | __u32 cpu; | ||
8 | __u32 invert; | ||
9 | }; | ||
10 | |||
11 | #endif /*_XT_CPU_H*/ | ||
diff --git a/include/linux/netfilter/xt_dccp.h b/include/linux/netfilter/xt_dccp.h new file mode 100644 index 00000000000..a579e1b6f04 --- /dev/null +++ b/include/linux/netfilter/xt_dccp.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _XT_DCCP_H_ | ||
2 | #define _XT_DCCP_H_ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define XT_DCCP_SRC_PORTS 0x01 | ||
7 | #define XT_DCCP_DEST_PORTS 0x02 | ||
8 | #define XT_DCCP_TYPE 0x04 | ||
9 | #define XT_DCCP_OPTION 0x08 | ||
10 | |||
11 | #define XT_DCCP_VALID_FLAGS 0x0f | ||
12 | |||
13 | struct xt_dccp_info { | ||
14 | __u16 dpts[2]; /* Min, Max */ | ||
15 | __u16 spts[2]; /* Min, Max */ | ||
16 | |||
17 | __u16 flags; | ||
18 | __u16 invflags; | ||
19 | |||
20 | __u16 typemask; | ||
21 | __u8 option; | ||
22 | }; | ||
23 | |||
24 | #endif /* _XT_DCCP_H_ */ | ||
25 | |||
diff --git a/include/linux/netfilter/xt_devgroup.h b/include/linux/netfilter/xt_devgroup.h new file mode 100644 index 00000000000..1babde0ec90 --- /dev/null +++ b/include/linux/netfilter/xt_devgroup.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _XT_DEVGROUP_H | ||
2 | #define _XT_DEVGROUP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_devgroup_flags { | ||
7 | XT_DEVGROUP_MATCH_SRC = 0x1, | ||
8 | XT_DEVGROUP_INVERT_SRC = 0x2, | ||
9 | XT_DEVGROUP_MATCH_DST = 0x4, | ||
10 | XT_DEVGROUP_INVERT_DST = 0x8, | ||
11 | }; | ||
12 | |||
13 | struct xt_devgroup_info { | ||
14 | __u32 flags; | ||
15 | __u32 src_group; | ||
16 | __u32 src_mask; | ||
17 | __u32 dst_group; | ||
18 | __u32 dst_mask; | ||
19 | }; | ||
20 | |||
21 | #endif /* _XT_DEVGROUP_H */ | ||
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h new file mode 100644 index 00000000000..15f8932ad5c --- /dev/null +++ b/include/linux/netfilter/xt_dscp.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* x_tables module for matching the IPv4/IPv6 DSCP field | ||
2 | * | ||
3 | * (C) 2002 Harald Welte <laforge@gnumonks.org> | ||
4 | * This software is distributed under GNU GPL v2, 1991 | ||
5 | * | ||
6 | * See RFC2474 for a description of the DSCP field within the IP Header. | ||
7 | * | ||
8 | * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp | ||
9 | */ | ||
10 | #ifndef _XT_DSCP_H | ||
11 | #define _XT_DSCP_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | #define XT_DSCP_MASK 0xfc /* 11111100 */ | ||
16 | #define XT_DSCP_SHIFT 2 | ||
17 | #define XT_DSCP_MAX 0x3f /* 00111111 */ | ||
18 | |||
19 | /* match info */ | ||
20 | struct xt_dscp_info { | ||
21 | __u8 dscp; | ||
22 | __u8 invert; | ||
23 | }; | ||
24 | |||
25 | struct xt_tos_match_info { | ||
26 | __u8 tos_mask; | ||
27 | __u8 tos_value; | ||
28 | __u8 invert; | ||
29 | }; | ||
30 | |||
31 | #endif /* _XT_DSCP_H */ | ||
diff --git a/include/linux/netfilter/xt_esp.h b/include/linux/netfilter/xt_esp.h new file mode 100644 index 00000000000..ee688240800 --- /dev/null +++ b/include/linux/netfilter/xt_esp.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _XT_ESP_H | ||
2 | #define _XT_ESP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_esp { | ||
7 | __u32 spis[2]; /* Security Parameter Index */ | ||
8 | __u8 invflags; /* Inverse flags */ | ||
9 | }; | ||
10 | |||
11 | /* Values for "invflags" field in struct xt_esp. */ | ||
12 | #define XT_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ | ||
13 | #define XT_ESP_INV_MASK 0x01 /* All possible flags. */ | ||
14 | |||
15 | #endif /*_XT_ESP_H*/ | ||
diff --git a/include/linux/netfilter/xt_helper.h b/include/linux/netfilter/xt_helper.h new file mode 100644 index 00000000000..6b42763f999 --- /dev/null +++ b/include/linux/netfilter/xt_helper.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _XT_HELPER_H | ||
2 | #define _XT_HELPER_H | ||
3 | |||
4 | struct xt_helper_info { | ||
5 | int invert; | ||
6 | char name[30]; | ||
7 | }; | ||
8 | #endif /* _XT_HELPER_H */ | ||
diff --git a/include/linux/netfilter/xt_iprange.h b/include/linux/netfilter/xt_iprange.h new file mode 100644 index 00000000000..c1f21a779a4 --- /dev/null +++ b/include/linux/netfilter/xt_iprange.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _LINUX_NETFILTER_XT_IPRANGE_H | ||
2 | #define _LINUX_NETFILTER_XT_IPRANGE_H 1 | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | IPRANGE_SRC = 1 << 0, /* match source IP address */ | ||
8 | IPRANGE_DST = 1 << 1, /* match destination IP address */ | ||
9 | IPRANGE_SRC_INV = 1 << 4, /* negate the condition */ | ||
10 | IPRANGE_DST_INV = 1 << 5, /* -"- */ | ||
11 | }; | ||
12 | |||
13 | struct xt_iprange_mtinfo { | ||
14 | union nf_inet_addr src_min, src_max; | ||
15 | union nf_inet_addr dst_min, dst_max; | ||
16 | __u8 flags; | ||
17 | }; | ||
18 | |||
19 | #endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ | ||
diff --git a/include/linux/netfilter/xt_ipvs.h b/include/linux/netfilter/xt_ipvs.h new file mode 100644 index 00000000000..eff34ac1880 --- /dev/null +++ b/include/linux/netfilter/xt_ipvs.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef _XT_IPVS_H | ||
2 | #define _XT_IPVS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */ | ||
8 | XT_IPVS_PROTO = 1 << 1, | ||
9 | XT_IPVS_VADDR = 1 << 2, | ||
10 | XT_IPVS_VPORT = 1 << 3, | ||
11 | XT_IPVS_DIR = 1 << 4, | ||
12 | XT_IPVS_METHOD = 1 << 5, | ||
13 | XT_IPVS_VPORTCTL = 1 << 6, | ||
14 | XT_IPVS_MASK = (1 << 7) - 1, | ||
15 | XT_IPVS_ONCE_MASK = XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY | ||
16 | }; | ||
17 | |||
18 | struct xt_ipvs_mtinfo { | ||
19 | union nf_inet_addr vaddr, vmask; | ||
20 | __be16 vport; | ||
21 | __u8 l4proto; | ||
22 | __u8 fwd_method; | ||
23 | __be16 vportctl; | ||
24 | |||
25 | __u8 invert; | ||
26 | __u8 bitmask; | ||
27 | }; | ||
28 | |||
29 | #endif /* _XT_IPVS_H */ | ||
diff --git a/include/linux/netfilter/xt_length.h b/include/linux/netfilter/xt_length.h new file mode 100644 index 00000000000..b82ed7c4b1e --- /dev/null +++ b/include/linux/netfilter/xt_length.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _XT_LENGTH_H | ||
2 | #define _XT_LENGTH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_length_info { | ||
7 | __u16 min, max; | ||
8 | __u8 invert; | ||
9 | }; | ||
10 | |||
11 | #endif /*_XT_LENGTH_H*/ | ||
diff --git a/include/linux/netfilter/xt_limit.h b/include/linux/netfilter/xt_limit.h new file mode 100644 index 00000000000..bb47fc4d2ad --- /dev/null +++ b/include/linux/netfilter/xt_limit.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _XT_RATE_H | ||
2 | #define _XT_RATE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* timings are in milliseconds. */ | ||
7 | #define XT_LIMIT_SCALE 10000 | ||
8 | |||
9 | struct xt_limit_priv; | ||
10 | |||
11 | /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 | ||
12 | seconds, or one every 59 hours. */ | ||
13 | struct xt_rateinfo { | ||
14 | __u32 avg; /* Average secs between packets * scale */ | ||
15 | __u32 burst; /* Period multiplier for upper limit. */ | ||
16 | |||
17 | /* Used internally by the kernel */ | ||
18 | unsigned long prev; /* moved to xt_limit_priv */ | ||
19 | __u32 credit; /* moved to xt_limit_priv */ | ||
20 | __u32 credit_cap, cost; | ||
21 | |||
22 | struct xt_limit_priv *master; | ||
23 | }; | ||
24 | #endif /*_XT_RATE_H*/ | ||
diff --git a/include/linux/netfilter/xt_mac.h b/include/linux/netfilter/xt_mac.h new file mode 100644 index 00000000000..b892cdc67e0 --- /dev/null +++ b/include/linux/netfilter/xt_mac.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _XT_MAC_H | ||
2 | #define _XT_MAC_H | ||
3 | |||
4 | struct xt_mac_info { | ||
5 | unsigned char srcaddr[ETH_ALEN]; | ||
6 | int invert; | ||
7 | }; | ||
8 | #endif /*_XT_MAC_H*/ | ||
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h new file mode 100644 index 00000000000..ecadc40d5cd --- /dev/null +++ b/include/linux/netfilter/xt_mark.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _XT_MARK_H | ||
2 | #define _XT_MARK_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_mark_tginfo2 { | ||
7 | __u32 mark, mask; | ||
8 | }; | ||
9 | |||
10 | struct xt_mark_mtinfo1 { | ||
11 | __u32 mark, mask; | ||
12 | __u8 invert; | ||
13 | }; | ||
14 | |||
15 | #endif /*_XT_MARK_H*/ | ||
diff --git a/include/linux/netfilter/xt_multiport.h b/include/linux/netfilter/xt_multiport.h new file mode 100644 index 00000000000..5b7e72dfffc --- /dev/null +++ b/include/linux/netfilter/xt_multiport.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef _XT_MULTIPORT_H | ||
2 | #define _XT_MULTIPORT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_multiport_flags { | ||
7 | XT_MULTIPORT_SOURCE, | ||
8 | XT_MULTIPORT_DESTINATION, | ||
9 | XT_MULTIPORT_EITHER | ||
10 | }; | ||
11 | |||
12 | #define XT_MULTI_PORTS 15 | ||
13 | |||
14 | /* Must fit inside union xt_matchinfo: 16 bytes */ | ||
15 | struct xt_multiport { | ||
16 | __u8 flags; /* Type of comparison */ | ||
17 | __u8 count; /* Number of ports */ | ||
18 | __u16 ports[XT_MULTI_PORTS]; /* Ports */ | ||
19 | }; | ||
20 | |||
21 | struct xt_multiport_v1 { | ||
22 | __u8 flags; /* Type of comparison */ | ||
23 | __u8 count; /* Number of ports */ | ||
24 | __u16 ports[XT_MULTI_PORTS]; /* Ports */ | ||
25 | __u8 pflags[XT_MULTI_PORTS]; /* Port flags */ | ||
26 | __u8 invert; /* Invert flag */ | ||
27 | }; | ||
28 | |||
29 | #endif /*_XT_MULTIPORT_H*/ | ||
diff --git a/include/linux/netfilter/xt_osf.h b/include/linux/netfilter/xt_osf.h new file mode 100644 index 00000000000..18afa495f97 --- /dev/null +++ b/include/linux/netfilter/xt_osf.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru> | ||
3 | * | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef _XT_OSF_H | ||
21 | #define _XT_OSF_H | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | #define MAXGENRELEN 32 | ||
26 | |||
27 | #define XT_OSF_GENRE (1<<0) | ||
28 | #define XT_OSF_TTL (1<<1) | ||
29 | #define XT_OSF_LOG (1<<2) | ||
30 | #define XT_OSF_INVERT (1<<3) | ||
31 | |||
32 | #define XT_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */ | ||
33 | #define XT_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */ | ||
34 | #define XT_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */ | ||
35 | |||
36 | #define XT_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */ | ||
37 | #define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */ | ||
38 | #define XT_OSF_TTL_NOCHECK 2 /* Do not compare ip and fingerprint TTL at all */ | ||
39 | |||
40 | struct xt_osf_info { | ||
41 | char genre[MAXGENRELEN]; | ||
42 | __u32 len; | ||
43 | __u32 flags; | ||
44 | __u32 loglevel; | ||
45 | __u32 ttl; | ||
46 | }; | ||
47 | |||
48 | /* | ||
49 | * Wildcard MSS (kind of). | ||
50 | * It is used to implement a state machine for the different wildcard values | ||
51 | * of the MSS and window sizes. | ||
52 | */ | ||
53 | struct xt_osf_wc { | ||
54 | __u32 wc; | ||
55 | __u32 val; | ||
56 | }; | ||
57 | |||
58 | /* | ||
59 | * This struct represents IANA options | ||
60 | * http://www.iana.org/assignments/tcp-parameters | ||
61 | */ | ||
62 | struct xt_osf_opt { | ||
63 | __u16 kind, length; | ||
64 | struct xt_osf_wc wc; | ||
65 | }; | ||
66 | |||
67 | struct xt_osf_user_finger { | ||
68 | struct xt_osf_wc wss; | ||
69 | |||
70 | __u8 ttl, df; | ||
71 | __u16 ss, mss; | ||
72 | __u16 opt_num; | ||
73 | |||
74 | char genre[MAXGENRELEN]; | ||
75 | char version[MAXGENRELEN]; | ||
76 | char subtype[MAXGENRELEN]; | ||
77 | |||
78 | /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */ | ||
79 | struct xt_osf_opt opt[MAX_IPOPTLEN]; | ||
80 | }; | ||
81 | |||
82 | struct xt_osf_nlmsg { | ||
83 | struct xt_osf_user_finger f; | ||
84 | struct iphdr ip; | ||
85 | struct tcphdr tcp; | ||
86 | }; | ||
87 | |||
88 | /* Defines for IANA option kinds */ | ||
89 | |||
90 | enum iana_options { | ||
91 | OSFOPT_EOL = 0, /* End of options */ | ||
92 | OSFOPT_NOP, /* NOP */ | ||
93 | OSFOPT_MSS, /* Maximum segment size */ | ||
94 | OSFOPT_WSO, /* Window scale option */ | ||
95 | OSFOPT_SACKP, /* SACK permitted */ | ||
96 | OSFOPT_SACK, /* SACK */ | ||
97 | OSFOPT_ECHO, | ||
98 | OSFOPT_ECHOREPLY, | ||
99 | OSFOPT_TS, /* Timestamp option */ | ||
100 | OSFOPT_POCP, /* Partial Order Connection Permitted */ | ||
101 | OSFOPT_POSP, /* Partial Order Service Profile */ | ||
102 | |||
103 | /* Others are not used in the current OSF */ | ||
104 | OSFOPT_EMPTY = 255, | ||
105 | }; | ||
106 | |||
107 | /* | ||
108 | * Initial window size option state machine: multiple of mss, mtu or | ||
109 | * plain numeric value. Can also be made as plain numeric value which | ||
110 | * is not a multiple of specified value. | ||
111 | */ | ||
112 | enum xt_osf_window_size_options { | ||
113 | OSF_WSS_PLAIN = 0, | ||
114 | OSF_WSS_MSS, | ||
115 | OSF_WSS_MTU, | ||
116 | OSF_WSS_MODULO, | ||
117 | OSF_WSS_MAX, | ||
118 | }; | ||
119 | |||
120 | /* | ||
121 | * Add/remove fingerprint from the kernel. | ||
122 | */ | ||
123 | enum xt_osf_msg_types { | ||
124 | OSF_MSG_ADD, | ||
125 | OSF_MSG_REMOVE, | ||
126 | OSF_MSG_MAX, | ||
127 | }; | ||
128 | |||
129 | enum xt_osf_attr_type { | ||
130 | OSF_ATTR_UNSPEC, | ||
131 | OSF_ATTR_FINGER, | ||
132 | OSF_ATTR_MAX, | ||
133 | }; | ||
134 | |||
135 | #endif /* _XT_OSF_H */ | ||
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h new file mode 100644 index 00000000000..2081761714b --- /dev/null +++ b/include/linux/netfilter/xt_owner.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _XT_OWNER_MATCH_H | ||
2 | #define _XT_OWNER_MATCH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | XT_OWNER_UID = 1 << 0, | ||
8 | XT_OWNER_GID = 1 << 1, | ||
9 | XT_OWNER_SOCKET = 1 << 2, | ||
10 | }; | ||
11 | |||
12 | struct xt_owner_match_info { | ||
13 | __u32 uid_min, uid_max; | ||
14 | __u32 gid_min, gid_max; | ||
15 | __u8 match, invert; | ||
16 | }; | ||
17 | |||
18 | #endif /* _XT_OWNER_MATCH_H */ | ||
diff --git a/include/linux/netfilter/xt_pkttype.h b/include/linux/netfilter/xt_pkttype.h new file mode 100644 index 00000000000..f265cf52fae --- /dev/null +++ b/include/linux/netfilter/xt_pkttype.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _XT_PKTTYPE_H | ||
2 | #define _XT_PKTTYPE_H | ||
3 | |||
4 | struct xt_pkttype_info { | ||
5 | int pkttype; | ||
6 | int invert; | ||
7 | }; | ||
8 | #endif /*_XT_PKTTYPE_H*/ | ||
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h new file mode 100644 index 00000000000..be8ead05c31 --- /dev/null +++ b/include/linux/netfilter/xt_policy.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef _XT_POLICY_H | ||
2 | #define _XT_POLICY_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define XT_POLICY_MAX_ELEM 4 | ||
7 | |||
8 | enum xt_policy_flags { | ||
9 | XT_POLICY_MATCH_IN = 0x1, | ||
10 | XT_POLICY_MATCH_OUT = 0x2, | ||
11 | XT_POLICY_MATCH_NONE = 0x4, | ||
12 | XT_POLICY_MATCH_STRICT = 0x8, | ||
13 | }; | ||
14 | |||
15 | enum xt_policy_modes { | ||
16 | XT_POLICY_MODE_TRANSPORT, | ||
17 | XT_POLICY_MODE_TUNNEL | ||
18 | }; | ||
19 | |||
20 | struct xt_policy_spec { | ||
21 | __u8 saddr:1, | ||
22 | daddr:1, | ||
23 | proto:1, | ||
24 | mode:1, | ||
25 | spi:1, | ||
26 | reqid:1; | ||
27 | }; | ||
28 | |||
29 | #ifndef __KERNEL__ | ||
30 | union xt_policy_addr { | ||
31 | struct in_addr a4; | ||
32 | struct in6_addr a6; | ||
33 | }; | ||
34 | #endif | ||
35 | |||
36 | struct xt_policy_elem { | ||
37 | union { | ||
38 | #ifdef __KERNEL__ | ||
39 | struct { | ||
40 | union nf_inet_addr saddr; | ||
41 | union nf_inet_addr smask; | ||
42 | union nf_inet_addr daddr; | ||
43 | union nf_inet_addr dmask; | ||
44 | }; | ||
45 | #else | ||
46 | struct { | ||
47 | union xt_policy_addr saddr; | ||
48 | union xt_policy_addr smask; | ||
49 | union xt_policy_addr daddr; | ||
50 | union xt_policy_addr dmask; | ||
51 | }; | ||
52 | #endif | ||
53 | }; | ||
54 | __be32 spi; | ||
55 | __u32 reqid; | ||
56 | __u8 proto; | ||
57 | __u8 mode; | ||
58 | |||
59 | struct xt_policy_spec match; | ||
60 | struct xt_policy_spec invert; | ||
61 | }; | ||
62 | |||
63 | struct xt_policy_info { | ||
64 | struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; | ||
65 | __u16 flags; | ||
66 | __u16 len; | ||
67 | }; | ||
68 | |||
69 | #endif /* _XT_POLICY_H */ | ||
diff --git a/include/linux/netfilter/xt_qtaguid.h b/include/linux/netfilter/xt_qtaguid.h new file mode 100644 index 00000000000..ca60fbdec2f --- /dev/null +++ b/include/linux/netfilter/xt_qtaguid.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _XT_QTAGUID_MATCH_H | ||
2 | #define _XT_QTAGUID_MATCH_H | ||
3 | |||
4 | /* For now we just replace the xt_owner. | ||
5 | * FIXME: make iptables aware of qtaguid. */ | ||
6 | #include <linux/netfilter/xt_owner.h> | ||
7 | |||
8 | #define XT_QTAGUID_UID XT_OWNER_UID | ||
9 | #define XT_QTAGUID_GID XT_OWNER_GID | ||
10 | #define XT_QTAGUID_SOCKET XT_OWNER_SOCKET | ||
11 | #define xt_qtaguid_match_info xt_owner_match_info | ||
12 | |||
13 | #endif /* _XT_QTAGUID_MATCH_H */ | ||
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h new file mode 100644 index 00000000000..9314723f39c --- /dev/null +++ b/include/linux/netfilter/xt_quota.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _XT_QUOTA_H | ||
2 | #define _XT_QUOTA_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_quota_flags { | ||
7 | XT_QUOTA_INVERT = 0x1, | ||
8 | }; | ||
9 | #define XT_QUOTA_MASK 0x1 | ||
10 | |||
11 | struct xt_quota_priv; | ||
12 | |||
13 | struct xt_quota_info { | ||
14 | __u32 flags; | ||
15 | __u32 pad; | ||
16 | __aligned_u64 quota; | ||
17 | |||
18 | /* Used internally by the kernel */ | ||
19 | struct xt_quota_priv *master; | ||
20 | }; | ||
21 | |||
22 | #endif /* _XT_QUOTA_H */ | ||
diff --git a/include/linux/netfilter/xt_quota2.h b/include/linux/netfilter/xt_quota2.h new file mode 100644 index 00000000000..eadc6903314 --- /dev/null +++ b/include/linux/netfilter/xt_quota2.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _XT_QUOTA_H | ||
2 | #define _XT_QUOTA_H | ||
3 | |||
4 | enum xt_quota_flags { | ||
5 | XT_QUOTA_INVERT = 1 << 0, | ||
6 | XT_QUOTA_GROW = 1 << 1, | ||
7 | XT_QUOTA_PACKET = 1 << 2, | ||
8 | XT_QUOTA_NO_CHANGE = 1 << 3, | ||
9 | XT_QUOTA_MASK = 0x0F, | ||
10 | }; | ||
11 | |||
12 | struct xt_quota_counter; | ||
13 | |||
14 | struct xt_quota_mtinfo2 { | ||
15 | char name[15]; | ||
16 | u_int8_t flags; | ||
17 | |||
18 | /* Comparison-invariant */ | ||
19 | aligned_u64 quota; | ||
20 | |||
21 | /* Used internally by the kernel */ | ||
22 | struct xt_quota_counter *master __attribute__((aligned(8))); | ||
23 | }; | ||
24 | |||
25 | #endif /* _XT_QUOTA_H */ | ||
diff --git a/include/linux/netfilter/xt_rateest.h b/include/linux/netfilter/xt_rateest.h new file mode 100644 index 00000000000..d40a6196842 --- /dev/null +++ b/include/linux/netfilter/xt_rateest.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _XT_RATEEST_MATCH_H | ||
2 | #define _XT_RATEEST_MATCH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_rateest_match_flags { | ||
7 | XT_RATEEST_MATCH_INVERT = 1<<0, | ||
8 | XT_RATEEST_MATCH_ABS = 1<<1, | ||
9 | XT_RATEEST_MATCH_REL = 1<<2, | ||
10 | XT_RATEEST_MATCH_DELTA = 1<<3, | ||
11 | XT_RATEEST_MATCH_BPS = 1<<4, | ||
12 | XT_RATEEST_MATCH_PPS = 1<<5, | ||
13 | }; | ||
14 | |||
15 | enum xt_rateest_match_mode { | ||
16 | XT_RATEEST_MATCH_NONE, | ||
17 | XT_RATEEST_MATCH_EQ, | ||
18 | XT_RATEEST_MATCH_LT, | ||
19 | XT_RATEEST_MATCH_GT, | ||
20 | }; | ||
21 | |||
22 | struct xt_rateest_match_info { | ||
23 | char name1[IFNAMSIZ]; | ||
24 | char name2[IFNAMSIZ]; | ||
25 | __u16 flags; | ||
26 | __u16 mode; | ||
27 | __u32 bps1; | ||
28 | __u32 pps1; | ||
29 | __u32 bps2; | ||
30 | __u32 pps2; | ||
31 | |||
32 | /* Used internally by the kernel */ | ||
33 | struct xt_rateest *est1 __attribute__((aligned(8))); | ||
34 | struct xt_rateest *est2 __attribute__((aligned(8))); | ||
35 | }; | ||
36 | |||
37 | #endif /* _XT_RATEEST_MATCH_H */ | ||
diff --git a/include/linux/netfilter/xt_realm.h b/include/linux/netfilter/xt_realm.h new file mode 100644 index 00000000000..d4a82ee56a0 --- /dev/null +++ b/include/linux/netfilter/xt_realm.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _XT_REALM_H | ||
2 | #define _XT_REALM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_realm_info { | ||
7 | __u32 id; | ||
8 | __u32 mask; | ||
9 | __u8 invert; | ||
10 | }; | ||
11 | |||
12 | #endif /* _XT_REALM_H */ | ||
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h new file mode 100644 index 00000000000..83318e01425 --- /dev/null +++ b/include/linux/netfilter/xt_recent.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef _LINUX_NETFILTER_XT_RECENT_H | ||
2 | #define _LINUX_NETFILTER_XT_RECENT_H 1 | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | XT_RECENT_CHECK = 1 << 0, | ||
8 | XT_RECENT_SET = 1 << 1, | ||
9 | XT_RECENT_UPDATE = 1 << 2, | ||
10 | XT_RECENT_REMOVE = 1 << 3, | ||
11 | XT_RECENT_TTL = 1 << 4, | ||
12 | XT_RECENT_REAP = 1 << 5, | ||
13 | |||
14 | XT_RECENT_SOURCE = 0, | ||
15 | XT_RECENT_DEST = 1, | ||
16 | |||
17 | XT_RECENT_NAME_LEN = 200, | ||
18 | }; | ||
19 | |||
20 | /* Only allowed with --rcheck and --update */ | ||
21 | #define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP) | ||
22 | |||
23 | #define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\ | ||
24 | XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP) | ||
25 | |||
26 | struct xt_recent_mtinfo { | ||
27 | __u32 seconds; | ||
28 | __u32 hit_count; | ||
29 | __u8 check_set; | ||
30 | __u8 invert; | ||
31 | char name[XT_RECENT_NAME_LEN]; | ||
32 | __u8 side; | ||
33 | }; | ||
34 | |||
35 | #endif /* _LINUX_NETFILTER_XT_RECENT_H */ | ||
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h new file mode 100644 index 00000000000..29287be696a --- /dev/null +++ b/include/linux/netfilter/xt_sctp.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef _XT_SCTP_H_ | ||
2 | #define _XT_SCTP_H_ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define XT_SCTP_SRC_PORTS 0x01 | ||
7 | #define XT_SCTP_DEST_PORTS 0x02 | ||
8 | #define XT_SCTP_CHUNK_TYPES 0x04 | ||
9 | |||
10 | #define XT_SCTP_VALID_FLAGS 0x07 | ||
11 | |||
12 | struct xt_sctp_flag_info { | ||
13 | __u8 chunktype; | ||
14 | __u8 flag; | ||
15 | __u8 flag_mask; | ||
16 | }; | ||
17 | |||
18 | #define XT_NUM_SCTP_FLAGS 4 | ||
19 | |||
20 | struct xt_sctp_info { | ||
21 | __u16 dpts[2]; /* Min, Max */ | ||
22 | __u16 spts[2]; /* Min, Max */ | ||
23 | |||
24 | __u32 chunkmap[256 / sizeof (__u32)]; /* Bit mask of chunks to be matched according to RFC 2960 */ | ||
25 | |||
26 | #define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ | ||
27 | #define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ | ||
28 | #define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ | ||
29 | |||
30 | __u32 chunk_match_type; | ||
31 | struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; | ||
32 | int flag_count; | ||
33 | |||
34 | __u32 flags; | ||
35 | __u32 invflags; | ||
36 | }; | ||
37 | |||
38 | #define bytes(type) (sizeof(type) * 8) | ||
39 | |||
40 | #define SCTP_CHUNKMAP_SET(chunkmap, type) \ | ||
41 | do { \ | ||
42 | (chunkmap)[type / bytes(__u32)] |= \ | ||
43 | 1 << (type % bytes(__u32)); \ | ||
44 | } while (0) | ||
45 | |||
46 | #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ | ||
47 | do { \ | ||
48 | (chunkmap)[type / bytes(__u32)] &= \ | ||
49 | ~(1 << (type % bytes(__u32))); \ | ||
50 | } while (0) | ||
51 | |||
52 | #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ | ||
53 | ({ \ | ||
54 | ((chunkmap)[type / bytes (__u32)] & \ | ||
55 | (1 << (type % bytes (__u32)))) ? 1: 0; \ | ||
56 | }) | ||
57 | |||
58 | #define SCTP_CHUNKMAP_RESET(chunkmap) \ | ||
59 | memset((chunkmap), 0, sizeof(chunkmap)) | ||
60 | |||
61 | #define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ | ||
62 | memset((chunkmap), ~0U, sizeof(chunkmap)) | ||
63 | |||
64 | #define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ | ||
65 | memcpy((destmap), (srcmap), sizeof(srcmap)) | ||
66 | |||
67 | #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ | ||
68 | __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) | ||
69 | static inline bool | ||
70 | __sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n) | ||
71 | { | ||
72 | unsigned int i; | ||
73 | for (i = 0; i < n; ++i) | ||
74 | if (chunkmap[i]) | ||
75 | return false; | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ | ||
80 | __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) | ||
81 | static inline bool | ||
82 | __sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n) | ||
83 | { | ||
84 | unsigned int i; | ||
85 | for (i = 0; i < n; ++i) | ||
86 | if (chunkmap[i] != ~0U) | ||
87 | return false; | ||
88 | return true; | ||
89 | } | ||
90 | |||
91 | #endif /* _XT_SCTP_H_ */ | ||
92 | |||
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h new file mode 100644 index 00000000000..c0405ac9287 --- /dev/null +++ b/include/linux/netfilter/xt_set.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef _XT_SET_H | ||
2 | #define _XT_SET_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netfilter/ipset/ip_set.h> | ||
6 | |||
7 | /* Revision 0 interface: backward compatible with netfilter/iptables */ | ||
8 | |||
9 | /* | ||
10 | * Option flags for kernel operations (xt_set_info_v0) | ||
11 | */ | ||
12 | #define IPSET_SRC 0x01 /* Source match/add */ | ||
13 | #define IPSET_DST 0x02 /* Destination match/add */ | ||
14 | #define IPSET_MATCH_INV 0x04 /* Inverse matching */ | ||
15 | |||
16 | struct xt_set_info_v0 { | ||
17 | ip_set_id_t index; | ||
18 | union { | ||
19 | __u32 flags[IPSET_DIM_MAX + 1]; | ||
20 | struct { | ||
21 | __u32 __flags[IPSET_DIM_MAX]; | ||
22 | __u8 dim; | ||
23 | __u8 flags; | ||
24 | } compat; | ||
25 | } u; | ||
26 | }; | ||
27 | |||
28 | /* match and target infos */ | ||
29 | struct xt_set_info_match_v0 { | ||
30 | struct xt_set_info_v0 match_set; | ||
31 | }; | ||
32 | |||
33 | struct xt_set_info_target_v0 { | ||
34 | struct xt_set_info_v0 add_set; | ||
35 | struct xt_set_info_v0 del_set; | ||
36 | }; | ||
37 | |||
38 | /* Revision 1 match and target */ | ||
39 | |||
40 | struct xt_set_info { | ||
41 | ip_set_id_t index; | ||
42 | __u8 dim; | ||
43 | __u8 flags; | ||
44 | }; | ||
45 | |||
46 | /* match and target infos */ | ||
47 | struct xt_set_info_match_v1 { | ||
48 | struct xt_set_info match_set; | ||
49 | }; | ||
50 | |||
51 | struct xt_set_info_target_v1 { | ||
52 | struct xt_set_info add_set; | ||
53 | struct xt_set_info del_set; | ||
54 | }; | ||
55 | |||
56 | /* Revision 2 target */ | ||
57 | |||
58 | struct xt_set_info_target_v2 { | ||
59 | struct xt_set_info add_set; | ||
60 | struct xt_set_info del_set; | ||
61 | u32 flags; | ||
62 | u32 timeout; | ||
63 | }; | ||
64 | |||
65 | #endif /*_XT_SET_H*/ | ||
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h new file mode 100644 index 00000000000..63594564831 --- /dev/null +++ b/include/linux/netfilter/xt_socket.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _XT_SOCKET_H | ||
2 | #define _XT_SOCKET_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | XT_SOCKET_TRANSPARENT = 1 << 0, | ||
8 | }; | ||
9 | |||
10 | struct xt_socket_mtinfo1 { | ||
11 | __u8 flags; | ||
12 | }; | ||
13 | |||
14 | void xt_socket_put_sk(struct sock *sk); | ||
15 | struct sock *xt_socket_get4_sk(const struct sk_buff *skb, | ||
16 | struct xt_action_param *par); | ||
17 | struct sock *xt_socket_get6_sk(const struct sk_buff *skb, | ||
18 | struct xt_action_param *par); | ||
19 | |||
20 | #endif /* _XT_SOCKET_H */ | ||
diff --git a/include/linux/netfilter/xt_state.h b/include/linux/netfilter/xt_state.h new file mode 100644 index 00000000000..7b32de88661 --- /dev/null +++ b/include/linux/netfilter/xt_state.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _XT_STATE_H | ||
2 | #define _XT_STATE_H | ||
3 | |||
4 | #define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) | ||
5 | #define XT_STATE_INVALID (1 << 0) | ||
6 | |||
7 | #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) | ||
8 | |||
9 | struct xt_state_info { | ||
10 | unsigned int statemask; | ||
11 | }; | ||
12 | #endif /*_XT_STATE_H*/ | ||
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h new file mode 100644 index 00000000000..4e983ef0c96 --- /dev/null +++ b/include/linux/netfilter/xt_statistic.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _XT_STATISTIC_H | ||
2 | #define _XT_STATISTIC_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_statistic_mode { | ||
7 | XT_STATISTIC_MODE_RANDOM, | ||
8 | XT_STATISTIC_MODE_NTH, | ||
9 | __XT_STATISTIC_MODE_MAX | ||
10 | }; | ||
11 | #define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1) | ||
12 | |||
13 | enum xt_statistic_flags { | ||
14 | XT_STATISTIC_INVERT = 0x1, | ||
15 | }; | ||
16 | #define XT_STATISTIC_MASK 0x1 | ||
17 | |||
18 | struct xt_statistic_priv; | ||
19 | |||
20 | struct xt_statistic_info { | ||
21 | __u16 mode; | ||
22 | __u16 flags; | ||
23 | union { | ||
24 | struct { | ||
25 | __u32 probability; | ||
26 | } random; | ||
27 | struct { | ||
28 | __u32 every; | ||
29 | __u32 packet; | ||
30 | __u32 count; /* unused */ | ||
31 | } nth; | ||
32 | } u; | ||
33 | struct xt_statistic_priv *master __attribute__((aligned(8))); | ||
34 | }; | ||
35 | |||
36 | #endif /* _XT_STATISTIC_H */ | ||
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h new file mode 100644 index 00000000000..235347c02ea --- /dev/null +++ b/include/linux/netfilter/xt_string.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef _XT_STRING_H | ||
2 | #define _XT_STRING_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define XT_STRING_MAX_PATTERN_SIZE 128 | ||
7 | #define XT_STRING_MAX_ALGO_NAME_SIZE 16 | ||
8 | |||
9 | enum { | ||
10 | XT_STRING_FLAG_INVERT = 0x01, | ||
11 | XT_STRING_FLAG_IGNORECASE = 0x02 | ||
12 | }; | ||
13 | |||
14 | struct xt_string_info { | ||
15 | __u16 from_offset; | ||
16 | __u16 to_offset; | ||
17 | char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; | ||
18 | char pattern[XT_STRING_MAX_PATTERN_SIZE]; | ||
19 | __u8 patlen; | ||
20 | union { | ||
21 | struct { | ||
22 | __u8 invert; | ||
23 | } v0; | ||
24 | |||
25 | struct { | ||
26 | __u8 flags; | ||
27 | } v1; | ||
28 | } u; | ||
29 | |||
30 | /* Used internally by the kernel */ | ||
31 | struct ts_config __attribute__((aligned(8))) *config; | ||
32 | }; | ||
33 | |||
34 | #endif /*_XT_STRING_H*/ | ||
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/linux/netfilter/xt_tcpmss.h new file mode 100644 index 00000000000..fbac56b9e66 --- /dev/null +++ b/include/linux/netfilter/xt_tcpmss.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _XT_TCPMSS_MATCH_H | ||
2 | #define _XT_TCPMSS_MATCH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_tcpmss_match_info { | ||
7 | __u16 mss_min, mss_max; | ||
8 | __u8 invert; | ||
9 | }; | ||
10 | |||
11 | #endif /*_XT_TCPMSS_MATCH_H*/ | ||
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h new file mode 100644 index 00000000000..38aa7b39902 --- /dev/null +++ b/include/linux/netfilter/xt_tcpudp.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _XT_TCPUDP_H | ||
2 | #define _XT_TCPUDP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* TCP matching stuff */ | ||
7 | struct xt_tcp { | ||
8 | __u16 spts[2]; /* Source port range. */ | ||
9 | __u16 dpts[2]; /* Destination port range. */ | ||
10 | __u8 option; /* TCP Option iff non-zero*/ | ||
11 | __u8 flg_mask; /* TCP flags mask byte */ | ||
12 | __u8 flg_cmp; /* TCP flags compare byte */ | ||
13 | __u8 invflags; /* Inverse flags */ | ||
14 | }; | ||
15 | |||
16 | /* Values for "inv" field in struct ipt_tcp. */ | ||
17 | #define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ | ||
18 | #define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ | ||
19 | #define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ | ||
20 | #define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ | ||
21 | #define XT_TCP_INV_MASK 0x0F /* All possible flags. */ | ||
22 | |||
23 | /* UDP matching stuff */ | ||
24 | struct xt_udp { | ||
25 | __u16 spts[2]; /* Source port range. */ | ||
26 | __u16 dpts[2]; /* Destination port range. */ | ||
27 | __u8 invflags; /* Inverse flags */ | ||
28 | }; | ||
29 | |||
30 | /* Values for "invflags" field in struct ipt_udp. */ | ||
31 | #define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ | ||
32 | #define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ | ||
33 | #define XT_UDP_INV_MASK 0x03 /* All possible flags. */ | ||
34 | |||
35 | |||
36 | #endif | ||
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h new file mode 100644 index 00000000000..7c37fac576c --- /dev/null +++ b/include/linux/netfilter/xt_time.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _XT_TIME_H | ||
2 | #define _XT_TIME_H 1 | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct xt_time_info { | ||
7 | __u32 date_start; | ||
8 | __u32 date_stop; | ||
9 | __u32 daytime_start; | ||
10 | __u32 daytime_stop; | ||
11 | __u32 monthdays_match; | ||
12 | __u8 weekdays_match; | ||
13 | __u8 flags; | ||
14 | }; | ||
15 | |||
16 | enum { | ||
17 | /* Match against local time (instead of UTC) */ | ||
18 | XT_TIME_LOCAL_TZ = 1 << 0, | ||
19 | |||
20 | /* Shortcuts */ | ||
21 | XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, | ||
22 | XT_TIME_ALL_WEEKDAYS = 0xFE, | ||
23 | XT_TIME_MIN_DAYTIME = 0, | ||
24 | XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, | ||
25 | }; | ||
26 | |||
27 | #endif /* _XT_TIME_H */ | ||
diff --git a/include/linux/netfilter/xt_u32.h b/include/linux/netfilter/xt_u32.h new file mode 100644 index 00000000000..04d1bfea03c --- /dev/null +++ b/include/linux/netfilter/xt_u32.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _XT_U32_H | ||
2 | #define _XT_U32_H 1 | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum xt_u32_ops { | ||
7 | XT_U32_AND, | ||
8 | XT_U32_LEFTSH, | ||
9 | XT_U32_RIGHTSH, | ||
10 | XT_U32_AT, | ||
11 | }; | ||
12 | |||
13 | struct xt_u32_location_element { | ||
14 | __u32 number; | ||
15 | __u8 nextop; | ||
16 | }; | ||
17 | |||
18 | struct xt_u32_value_element { | ||
19 | __u32 min; | ||
20 | __u32 max; | ||
21 | }; | ||
22 | |||
23 | /* | ||
24 | * Any way to allow for an arbitrary number of elements? | ||
25 | * For now, I settle with a limit of 10 each. | ||
26 | */ | ||
27 | #define XT_U32_MAXSIZE 10 | ||
28 | |||
29 | struct xt_u32_test { | ||
30 | struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; | ||
31 | struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; | ||
32 | __u8 nnums; | ||
33 | __u8 nvalues; | ||
34 | }; | ||
35 | |||
36 | struct xt_u32 { | ||
37 | struct xt_u32_test tests[XT_U32_MAXSIZE+1]; | ||
38 | __u8 ntests; | ||
39 | __u8 invert; | ||
40 | }; | ||
41 | |||
42 | #endif /* _XT_U32_H */ | ||
diff --git a/include/linux/netfilter_arp.h b/include/linux/netfilter_arp.h new file mode 100644 index 00000000000..92bc6ddcbf7 --- /dev/null +++ b/include/linux/netfilter_arp.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __LINUX_ARP_NETFILTER_H | ||
2 | #define __LINUX_ARP_NETFILTER_H | ||
3 | |||
4 | /* ARP-specific defines for netfilter. | ||
5 | * (C)2002 Rusty Russell IBM -- This code is GPL. | ||
6 | */ | ||
7 | |||
8 | #include <linux/netfilter.h> | ||
9 | |||
10 | /* There is no PF_ARP. */ | ||
11 | #define NF_ARP 0 | ||
12 | |||
13 | /* ARP Hooks */ | ||
14 | #define NF_ARP_IN 0 | ||
15 | #define NF_ARP_OUT 1 | ||
16 | #define NF_ARP_FORWARD 2 | ||
17 | #define NF_ARP_NUMHOOKS 3 | ||
18 | |||
19 | #endif /* __LINUX_ARP_NETFILTER_H */ | ||
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild new file mode 100644 index 00000000000..b27439c7103 --- /dev/null +++ b/include/linux/netfilter_arp/Kbuild | |||
@@ -0,0 +1,2 @@ | |||
1 | header-y += arp_tables.h | ||
2 | header-y += arpt_mangle.h | ||
diff --git a/include/linux/netfilter_arp/arpt_mangle.h b/include/linux/netfilter_arp/arpt_mangle.h new file mode 100644 index 00000000000..250f502902b --- /dev/null +++ b/include/linux/netfilter_arp/arpt_mangle.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _ARPT_MANGLE_H | ||
2 | #define _ARPT_MANGLE_H | ||
3 | #include <linux/netfilter_arp/arp_tables.h> | ||
4 | |||
5 | #define ARPT_MANGLE_ADDR_LEN_MAX sizeof(struct in_addr) | ||
6 | struct arpt_mangle | ||
7 | { | ||
8 | char src_devaddr[ARPT_DEV_ADDR_LEN_MAX]; | ||
9 | char tgt_devaddr[ARPT_DEV_ADDR_LEN_MAX]; | ||
10 | union { | ||
11 | struct in_addr src_ip; | ||
12 | } u_s; | ||
13 | union { | ||
14 | struct in_addr tgt_ip; | ||
15 | } u_t; | ||
16 | u_int8_t flags; | ||
17 | int target; | ||
18 | }; | ||
19 | |||
20 | #define ARPT_MANGLE_SDEV 0x01 | ||
21 | #define ARPT_MANGLE_TDEV 0x02 | ||
22 | #define ARPT_MANGLE_SIP 0x04 | ||
23 | #define ARPT_MANGLE_TIP 0x08 | ||
24 | #define ARPT_MANGLE_MASK 0x0f | ||
25 | |||
26 | #endif /* _ARPT_MANGLE_H */ | ||
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild new file mode 100644 index 00000000000..e48f1a3f5a4 --- /dev/null +++ b/include/linux/netfilter_bridge/Kbuild | |||
@@ -0,0 +1,18 @@ | |||
1 | header-y += ebt_802_3.h | ||
2 | header-y += ebt_among.h | ||
3 | header-y += ebt_arp.h | ||
4 | header-y += ebt_arpreply.h | ||
5 | header-y += ebt_ip.h | ||
6 | header-y += ebt_ip6.h | ||
7 | header-y += ebt_limit.h | ||
8 | header-y += ebt_log.h | ||
9 | header-y += ebt_mark_m.h | ||
10 | header-y += ebt_mark_t.h | ||
11 | header-y += ebt_nat.h | ||
12 | header-y += ebt_nflog.h | ||
13 | header-y += ebt_pkttype.h | ||
14 | header-y += ebt_redirect.h | ||
15 | header-y += ebt_stp.h | ||
16 | header-y += ebt_ulog.h | ||
17 | header-y += ebt_vlan.h | ||
18 | header-y += ebtables.h | ||
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h new file mode 100644 index 00000000000..bd4e3ad0b70 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_among.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_AMONG_H | ||
2 | #define __LINUX_BRIDGE_EBT_AMONG_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_AMONG_DST 0x01 | ||
7 | #define EBT_AMONG_SRC 0x02 | ||
8 | |||
9 | /* Grzegorz Borowiak <grzes@gnu.univ.gda.pl> 2003 | ||
10 | * | ||
11 | * Write-once-read-many hash table, used for checking if a given | ||
12 | * MAC address belongs to a set or not and possibly for checking | ||
13 | * if it is related with a given IPv4 address. | ||
14 | * | ||
15 | * The hash value of an address is its last byte. | ||
16 | * | ||
17 | * In real-world ethernet addresses, values of the last byte are | ||
18 | * evenly distributed and there is no need to consider other bytes. | ||
19 | * It would only slow the routines down. | ||
20 | * | ||
21 | * For MAC address comparison speedup reasons, we introduce a trick. | ||
22 | * MAC address is mapped onto an array of two 32-bit integers. | ||
23 | * This pair of integers is compared with MAC addresses in the | ||
24 | * hash table, which are stored also in form of pairs of integers | ||
25 | * (in `cmp' array). This is quick as it requires only two elementary | ||
26 | * number comparisons in worst case. Further, we take advantage of | ||
27 | * fact that entropy of 3 last bytes of address is larger than entropy | ||
28 | * of 3 first bytes. So first we compare 4 last bytes of addresses and | ||
29 | * if they are the same we compare 2 first. | ||
30 | * | ||
31 | * Yes, it is a memory overhead, but in 2003 AD, who cares? | ||
32 | */ | ||
33 | |||
34 | struct ebt_mac_wormhash_tuple { | ||
35 | __u32 cmp[2]; | ||
36 | __be32 ip; | ||
37 | }; | ||
38 | |||
39 | struct ebt_mac_wormhash { | ||
40 | int table[257]; | ||
41 | int poolsize; | ||
42 | struct ebt_mac_wormhash_tuple pool[0]; | ||
43 | }; | ||
44 | |||
45 | #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ | ||
46 | + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) | ||
47 | |||
48 | struct ebt_among_info { | ||
49 | int wh_dst_ofs; | ||
50 | int wh_src_ofs; | ||
51 | int bitmask; | ||
52 | }; | ||
53 | |||
54 | #define EBT_AMONG_DST_NEG 0x1 | ||
55 | #define EBT_AMONG_SRC_NEG 0x2 | ||
56 | |||
57 | #define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \ | ||
58 | (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) | ||
59 | #define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \ | ||
60 | (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) | ||
61 | |||
62 | #define EBT_AMONG_MATCH "among" | ||
63 | |||
64 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h new file mode 100644 index 00000000000..522f3e427f4 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_arp.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_ARP_H | ||
2 | #define __LINUX_BRIDGE_EBT_ARP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_ARP_OPCODE 0x01 | ||
7 | #define EBT_ARP_HTYPE 0x02 | ||
8 | #define EBT_ARP_PTYPE 0x04 | ||
9 | #define EBT_ARP_SRC_IP 0x08 | ||
10 | #define EBT_ARP_DST_IP 0x10 | ||
11 | #define EBT_ARP_SRC_MAC 0x20 | ||
12 | #define EBT_ARP_DST_MAC 0x40 | ||
13 | #define EBT_ARP_GRAT 0x80 | ||
14 | #define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ | ||
15 | EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \ | ||
16 | EBT_ARP_GRAT) | ||
17 | #define EBT_ARP_MATCH "arp" | ||
18 | |||
19 | struct ebt_arp_info | ||
20 | { | ||
21 | __be16 htype; | ||
22 | __be16 ptype; | ||
23 | __be16 opcode; | ||
24 | __be32 saddr; | ||
25 | __be32 smsk; | ||
26 | __be32 daddr; | ||
27 | __be32 dmsk; | ||
28 | unsigned char smaddr[ETH_ALEN]; | ||
29 | unsigned char smmsk[ETH_ALEN]; | ||
30 | unsigned char dmaddr[ETH_ALEN]; | ||
31 | unsigned char dmmsk[ETH_ALEN]; | ||
32 | __u8 bitmask; | ||
33 | __u8 invflags; | ||
34 | }; | ||
35 | |||
36 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_arpreply.h b/include/linux/netfilter_bridge/ebt_arpreply.h new file mode 100644 index 00000000000..7e77896e1fb --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_arpreply.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H | ||
2 | #define __LINUX_BRIDGE_EBT_ARPREPLY_H | ||
3 | |||
4 | struct ebt_arpreply_info { | ||
5 | unsigned char mac[ETH_ALEN]; | ||
6 | int target; | ||
7 | }; | ||
8 | #define EBT_ARPREPLY_TARGET "arpreply" | ||
9 | |||
10 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h new file mode 100644 index 00000000000..c4bbc41b0ea --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_ip.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * ebt_ip | ||
3 | * | ||
4 | * Authors: | ||
5 | * Bart De Schuymer <bart.de.schuymer@pandora.be> | ||
6 | * | ||
7 | * April, 2002 | ||
8 | * | ||
9 | * Changes: | ||
10 | * added ip-sport and ip-dport | ||
11 | * Innominate Security Technologies AG <mhopf@innominate.com> | ||
12 | * September, 2002 | ||
13 | */ | ||
14 | |||
15 | #ifndef __LINUX_BRIDGE_EBT_IP_H | ||
16 | #define __LINUX_BRIDGE_EBT_IP_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | #define EBT_IP_SOURCE 0x01 | ||
21 | #define EBT_IP_DEST 0x02 | ||
22 | #define EBT_IP_TOS 0x04 | ||
23 | #define EBT_IP_PROTO 0x08 | ||
24 | #define EBT_IP_SPORT 0x10 | ||
25 | #define EBT_IP_DPORT 0x20 | ||
26 | #define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ | ||
27 | EBT_IP_SPORT | EBT_IP_DPORT ) | ||
28 | #define EBT_IP_MATCH "ip" | ||
29 | |||
30 | /* the same values are used for the invflags */ | ||
31 | struct ebt_ip_info { | ||
32 | __be32 saddr; | ||
33 | __be32 daddr; | ||
34 | __be32 smsk; | ||
35 | __be32 dmsk; | ||
36 | __u8 tos; | ||
37 | __u8 protocol; | ||
38 | __u8 bitmask; | ||
39 | __u8 invflags; | ||
40 | __u16 sport[2]; | ||
41 | __u16 dport[2]; | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h new file mode 100644 index 00000000000..42b88968272 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_ip6.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * ebt_ip6 | ||
3 | * | ||
4 | * Authors: | ||
5 | * Kuo-Lang Tseng <kuo-lang.tseng@intel.com> | ||
6 | * Manohar Castelino <manohar.r.castelino@intel.com> | ||
7 | * | ||
8 | * Jan 11, 2008 | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_BRIDGE_EBT_IP6_H | ||
13 | #define __LINUX_BRIDGE_EBT_IP6_H | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | #define EBT_IP6_SOURCE 0x01 | ||
18 | #define EBT_IP6_DEST 0x02 | ||
19 | #define EBT_IP6_TCLASS 0x04 | ||
20 | #define EBT_IP6_PROTO 0x08 | ||
21 | #define EBT_IP6_SPORT 0x10 | ||
22 | #define EBT_IP6_DPORT 0x20 | ||
23 | #define EBT_IP6_ICMP6 0x40 | ||
24 | |||
25 | #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ | ||
26 | EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \ | ||
27 | EBT_IP6_ICMP6) | ||
28 | #define EBT_IP6_MATCH "ip6" | ||
29 | |||
30 | /* the same values are used for the invflags */ | ||
31 | struct ebt_ip6_info { | ||
32 | struct in6_addr saddr; | ||
33 | struct in6_addr daddr; | ||
34 | struct in6_addr smsk; | ||
35 | struct in6_addr dmsk; | ||
36 | __u8 tclass; | ||
37 | __u8 protocol; | ||
38 | __u8 bitmask; | ||
39 | __u8 invflags; | ||
40 | union { | ||
41 | __u16 sport[2]; | ||
42 | __u8 icmpv6_type[2]; | ||
43 | }; | ||
44 | union { | ||
45 | __u16 dport[2]; | ||
46 | __u8 icmpv6_code[2]; | ||
47 | }; | ||
48 | }; | ||
49 | |||
50 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h new file mode 100644 index 00000000000..66d80b30ba0 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_limit.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_LIMIT_H | ||
2 | #define __LINUX_BRIDGE_EBT_LIMIT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_LIMIT_MATCH "limit" | ||
7 | |||
8 | /* timings are in milliseconds. */ | ||
9 | #define EBT_LIMIT_SCALE 10000 | ||
10 | |||
11 | /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 | ||
12 | seconds, or one every 59 hours. */ | ||
13 | |||
14 | struct ebt_limit_info { | ||
15 | __u32 avg; /* Average secs between packets * scale */ | ||
16 | __u32 burst; /* Period multiplier for upper limit. */ | ||
17 | |||
18 | /* Used internally by the kernel */ | ||
19 | unsigned long prev; | ||
20 | __u32 credit; | ||
21 | __u32 credit_cap, cost; | ||
22 | }; | ||
23 | |||
24 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h new file mode 100644 index 00000000000..7e7f1d1fe49 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_log.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_LOG_H | ||
2 | #define __LINUX_BRIDGE_EBT_LOG_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ | ||
7 | #define EBT_LOG_ARP 0x02 | ||
8 | #define EBT_LOG_NFLOG 0x04 | ||
9 | #define EBT_LOG_IP6 0x08 | ||
10 | #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6) | ||
11 | #define EBT_LOG_PREFIX_SIZE 30 | ||
12 | #define EBT_LOG_WATCHER "log" | ||
13 | |||
14 | struct ebt_log_info { | ||
15 | __u8 loglevel; | ||
16 | __u8 prefix[EBT_LOG_PREFIX_SIZE]; | ||
17 | __u32 bitmask; | ||
18 | }; | ||
19 | |||
20 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h new file mode 100644 index 00000000000..410f9e5a71d --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_mark_m.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_MARK_M_H | ||
2 | #define __LINUX_BRIDGE_EBT_MARK_M_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_MARK_AND 0x01 | ||
7 | #define EBT_MARK_OR 0x02 | ||
8 | #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) | ||
9 | struct ebt_mark_m_info { | ||
10 | unsigned long mark, mask; | ||
11 | __u8 invert; | ||
12 | __u8 bitmask; | ||
13 | }; | ||
14 | #define EBT_MARK_MATCH "mark_m" | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_mark_t.h b/include/linux/netfilter_bridge/ebt_mark_t.h new file mode 100644 index 00000000000..7d5a268a431 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_mark_t.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_MARK_T_H | ||
2 | #define __LINUX_BRIDGE_EBT_MARK_T_H | ||
3 | |||
4 | /* The target member is reused for adding new actions, the | ||
5 | * value of the real target is -1 to -NUM_STANDARD_TARGETS. | ||
6 | * For backward compatibility, the 4 lsb (2 would be enough, | ||
7 | * but let's play it safe) are kept to designate this target. | ||
8 | * The remaining bits designate the action. By making the set | ||
9 | * action 0xfffffff0, the result will look ok for older | ||
10 | * versions. [September 2006] */ | ||
11 | #define MARK_SET_VALUE (0xfffffff0) | ||
12 | #define MARK_OR_VALUE (0xffffffe0) | ||
13 | #define MARK_AND_VALUE (0xffffffd0) | ||
14 | #define MARK_XOR_VALUE (0xffffffc0) | ||
15 | |||
16 | struct ebt_mark_t_info { | ||
17 | unsigned long mark; | ||
18 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ | ||
19 | int target; | ||
20 | }; | ||
21 | #define EBT_MARK_TARGET "mark" | ||
22 | |||
23 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_nat.h b/include/linux/netfilter_bridge/ebt_nat.h new file mode 100644 index 00000000000..5e74e3b03bd --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_nat.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_NAT_H | ||
2 | #define __LINUX_BRIDGE_EBT_NAT_H | ||
3 | |||
4 | #define NAT_ARP_BIT (0x00000010) | ||
5 | struct ebt_nat_info { | ||
6 | unsigned char mac[ETH_ALEN]; | ||
7 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ | ||
8 | int target; | ||
9 | }; | ||
10 | #define EBT_SNAT_TARGET "snat" | ||
11 | #define EBT_DNAT_TARGET "dnat" | ||
12 | |||
13 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h new file mode 100644 index 00000000000..df829fce912 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_nflog.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_NFLOG_H | ||
2 | #define __LINUX_BRIDGE_EBT_NFLOG_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_NFLOG_MASK 0x0 | ||
7 | |||
8 | #define EBT_NFLOG_PREFIX_SIZE 64 | ||
9 | #define EBT_NFLOG_WATCHER "nflog" | ||
10 | |||
11 | #define EBT_NFLOG_DEFAULT_GROUP 0x1 | ||
12 | #define EBT_NFLOG_DEFAULT_THRESHOLD 1 | ||
13 | |||
14 | struct ebt_nflog_info { | ||
15 | __u32 len; | ||
16 | __u16 group; | ||
17 | __u16 threshold; | ||
18 | __u16 flags; | ||
19 | __u16 pad; | ||
20 | char prefix[EBT_NFLOG_PREFIX_SIZE]; | ||
21 | }; | ||
22 | |||
23 | #endif /* __LINUX_BRIDGE_EBT_NFLOG_H */ | ||
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h new file mode 100644 index 00000000000..c241badcd03 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_pkttype.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H | ||
2 | #define __LINUX_BRIDGE_EBT_PKTTYPE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct ebt_pkttype_info { | ||
7 | __u8 pkt_type; | ||
8 | __u8 invert; | ||
9 | }; | ||
10 | #define EBT_PKTTYPE_MATCH "pkttype" | ||
11 | |||
12 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_redirect.h b/include/linux/netfilter_bridge/ebt_redirect.h new file mode 100644 index 00000000000..dd9622ce848 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_redirect.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H | ||
2 | #define __LINUX_BRIDGE_EBT_REDIRECT_H | ||
3 | |||
4 | struct ebt_redirect_info { | ||
5 | /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ | ||
6 | int target; | ||
7 | }; | ||
8 | #define EBT_REDIRECT_TARGET "redirect" | ||
9 | |||
10 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h new file mode 100644 index 00000000000..1025b9f5fb7 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_stp.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_STP_H | ||
2 | #define __LINUX_BRIDGE_EBT_STP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_STP_TYPE 0x0001 | ||
7 | |||
8 | #define EBT_STP_FLAGS 0x0002 | ||
9 | #define EBT_STP_ROOTPRIO 0x0004 | ||
10 | #define EBT_STP_ROOTADDR 0x0008 | ||
11 | #define EBT_STP_ROOTCOST 0x0010 | ||
12 | #define EBT_STP_SENDERPRIO 0x0020 | ||
13 | #define EBT_STP_SENDERADDR 0x0040 | ||
14 | #define EBT_STP_PORT 0x0080 | ||
15 | #define EBT_STP_MSGAGE 0x0100 | ||
16 | #define EBT_STP_MAXAGE 0x0200 | ||
17 | #define EBT_STP_HELLOTIME 0x0400 | ||
18 | #define EBT_STP_FWDD 0x0800 | ||
19 | |||
20 | #define EBT_STP_MASK 0x0fff | ||
21 | #define EBT_STP_CONFIG_MASK 0x0ffe | ||
22 | |||
23 | #define EBT_STP_MATCH "stp" | ||
24 | |||
25 | struct ebt_stp_config_info { | ||
26 | __u8 flags; | ||
27 | __u16 root_priol, root_priou; | ||
28 | char root_addr[6], root_addrmsk[6]; | ||
29 | __u32 root_costl, root_costu; | ||
30 | __u16 sender_priol, sender_priou; | ||
31 | char sender_addr[6], sender_addrmsk[6]; | ||
32 | __u16 portl, portu; | ||
33 | __u16 msg_agel, msg_ageu; | ||
34 | __u16 max_agel, max_ageu; | ||
35 | __u16 hello_timel, hello_timeu; | ||
36 | __u16 forward_delayl, forward_delayu; | ||
37 | }; | ||
38 | |||
39 | struct ebt_stp_info { | ||
40 | __u8 type; | ||
41 | struct ebt_stp_config_info config; | ||
42 | __u16 bitmask; | ||
43 | __u16 invflags; | ||
44 | }; | ||
45 | |||
46 | #endif | ||
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/linux/netfilter_bridge/ebt_ulog.h new file mode 100644 index 00000000000..89a6becb526 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_ulog.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _EBT_ULOG_H | ||
2 | #define _EBT_ULOG_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_ULOG_DEFAULT_NLGROUP 0 | ||
7 | #define EBT_ULOG_DEFAULT_QTHRESHOLD 1 | ||
8 | #define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ | ||
9 | #define EBT_ULOG_PREFIX_LEN 32 | ||
10 | #define EBT_ULOG_MAX_QLEN 50 | ||
11 | #define EBT_ULOG_WATCHER "ulog" | ||
12 | #define EBT_ULOG_VERSION 1 | ||
13 | |||
14 | struct ebt_ulog_info { | ||
15 | __u32 nlgroup; | ||
16 | unsigned int cprange; | ||
17 | unsigned int qthreshold; | ||
18 | char prefix[EBT_ULOG_PREFIX_LEN]; | ||
19 | }; | ||
20 | |||
21 | typedef struct ebt_ulog_packet_msg { | ||
22 | int version; | ||
23 | char indev[IFNAMSIZ]; | ||
24 | char outdev[IFNAMSIZ]; | ||
25 | char physindev[IFNAMSIZ]; | ||
26 | char physoutdev[IFNAMSIZ]; | ||
27 | char prefix[EBT_ULOG_PREFIX_LEN]; | ||
28 | struct timeval stamp; | ||
29 | unsigned long mark; | ||
30 | unsigned int hook; | ||
31 | size_t data_len; | ||
32 | /* The complete packet, including Ethernet header and perhaps | ||
33 | * the VLAN header is appended */ | ||
34 | unsigned char data[0] __attribute__ | ||
35 | ((aligned (__alignof__(struct ebt_ulog_info)))); | ||
36 | } ebt_ulog_packet_msg_t; | ||
37 | |||
38 | #endif /* _EBT_ULOG_H */ | ||
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h new file mode 100644 index 00000000000..967d1d5cf98 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_vlan.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef __LINUX_BRIDGE_EBT_VLAN_H | ||
2 | #define __LINUX_BRIDGE_EBT_VLAN_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define EBT_VLAN_ID 0x01 | ||
7 | #define EBT_VLAN_PRIO 0x02 | ||
8 | #define EBT_VLAN_ENCAP 0x04 | ||
9 | #define EBT_VLAN_MASK (EBT_VLAN_ID | EBT_VLAN_PRIO | EBT_VLAN_ENCAP) | ||
10 | #define EBT_VLAN_MATCH "vlan" | ||
11 | |||
12 | struct ebt_vlan_info { | ||
13 | __u16 id; /* VLAN ID {1-4095} */ | ||
14 | __u8 prio; /* VLAN User Priority {0-7} */ | ||
15 | __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ | ||
16 | __u8 bitmask; /* Args bitmask bit 1=1 - ID arg, | ||
17 | bit 2=1 User-Priority arg, bit 3=1 encap*/ | ||
18 | __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, | ||
19 | bit 2=1 - inversed Pirority arg */ | ||
20 | }; | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/netfilter_decnet.h b/include/linux/netfilter_decnet.h new file mode 100644 index 00000000000..6f425369ee2 --- /dev/null +++ b/include/linux/netfilter_decnet.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef __LINUX_DECNET_NETFILTER_H | ||
2 | #define __LINUX_DECNET_NETFILTER_H | ||
3 | |||
4 | /* DECnet-specific defines for netfilter. | ||
5 | * This file (C) Steve Whitehouse 1999 derived from the | ||
6 | * ipv4 netfilter header file which is | ||
7 | * (C)1998 Rusty Russell -- This code is GPL. | ||
8 | */ | ||
9 | |||
10 | #include <linux/netfilter.h> | ||
11 | |||
12 | /* only for userspace compatibility */ | ||
13 | #ifndef __KERNEL__ | ||
14 | /* IP Cache bits. */ | ||
15 | /* Src IP address. */ | ||
16 | #define NFC_DN_SRC 0x0001 | ||
17 | /* Dest IP address. */ | ||
18 | #define NFC_DN_DST 0x0002 | ||
19 | /* Input device. */ | ||
20 | #define NFC_DN_IF_IN 0x0004 | ||
21 | /* Output device. */ | ||
22 | #define NFC_DN_IF_OUT 0x0008 | ||
23 | #endif /* ! __KERNEL__ */ | ||
24 | |||
25 | /* DECnet Hooks */ | ||
26 | /* After promisc drops, checksum checks. */ | ||
27 | #define NF_DN_PRE_ROUTING 0 | ||
28 | /* If the packet is destined for this box. */ | ||
29 | #define NF_DN_LOCAL_IN 1 | ||
30 | /* If the packet is destined for another interface. */ | ||
31 | #define NF_DN_FORWARD 2 | ||
32 | /* Packets coming from a local process. */ | ||
33 | #define NF_DN_LOCAL_OUT 3 | ||
34 | /* Packets about to hit the wire. */ | ||
35 | #define NF_DN_POST_ROUTING 4 | ||
36 | /* Input Hello Packets */ | ||
37 | #define NF_DN_HELLO 5 | ||
38 | /* Input Routing Packets */ | ||
39 | #define NF_DN_ROUTE 6 | ||
40 | #define NF_DN_NUMHOOKS 7 | ||
41 | |||
42 | enum nf_dn_hook_priorities { | ||
43 | NF_DN_PRI_FIRST = INT_MIN, | ||
44 | NF_DN_PRI_CONNTRACK = -200, | ||
45 | NF_DN_PRI_MANGLE = -150, | ||
46 | NF_DN_PRI_NAT_DST = -100, | ||
47 | NF_DN_PRI_FILTER = 0, | ||
48 | NF_DN_PRI_NAT_SRC = 100, | ||
49 | NF_DN_PRI_DNRTMSG = 200, | ||
50 | NF_DN_PRI_LAST = INT_MAX, | ||
51 | }; | ||
52 | |||
53 | struct nf_dn_rtmsg { | ||
54 | int nfdn_ifindex; | ||
55 | }; | ||
56 | |||
57 | #define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) | ||
58 | |||
59 | #ifndef __KERNEL__ | ||
60 | /* backwards compatibility for userspace */ | ||
61 | #define DNRMG_L1_GROUP 0x01 | ||
62 | #define DNRMG_L2_GROUP 0x02 | ||
63 | #endif | ||
64 | |||
65 | enum { | ||
66 | DNRNG_NLGRP_NONE, | ||
67 | #define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE | ||
68 | DNRNG_NLGRP_L1, | ||
69 | #define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1 | ||
70 | DNRNG_NLGRP_L2, | ||
71 | #define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2 | ||
72 | __DNRNG_NLGRP_MAX | ||
73 | }; | ||
74 | #define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1) | ||
75 | |||
76 | #endif /*__LINUX_DECNET_NETFILTER_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild new file mode 100644 index 00000000000..f9930c87fff --- /dev/null +++ b/include/linux/netfilter_ipv4/Kbuild | |||
@@ -0,0 +1,14 @@ | |||
1 | header-y += ip_queue.h | ||
2 | header-y += ip_tables.h | ||
3 | header-y += ipt_CLUSTERIP.h | ||
4 | header-y += ipt_ECN.h | ||
5 | header-y += ipt_LOG.h | ||
6 | header-y += ipt_REJECT.h | ||
7 | header-y += ipt_SAME.h | ||
8 | header-y += ipt_TTL.h | ||
9 | header-y += ipt_ULOG.h | ||
10 | header-y += ipt_addrtype.h | ||
11 | header-y += ipt_ah.h | ||
12 | header-y += ipt_ecn.h | ||
13 | header-y += ipt_realm.h | ||
14 | header-y += ipt_ttl.h | ||
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h new file mode 100644 index 00000000000..a03507f465f --- /dev/null +++ b/include/linux/netfilter_ipv4/ip_queue.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * This is a module which is used for queueing IPv4 packets and | ||
3 | * communicating with userspace via netlink. | ||
4 | * | ||
5 | * (C) 2000 James Morris, this code is GPL. | ||
6 | */ | ||
7 | #ifndef _IP_QUEUE_H | ||
8 | #define _IP_QUEUE_H | ||
9 | |||
10 | #ifdef __KERNEL__ | ||
11 | #ifdef DEBUG_IPQ | ||
12 | #define QDEBUG(x...) printk(KERN_DEBUG ## x) | ||
13 | #else | ||
14 | #define QDEBUG(x...) | ||
15 | #endif /* DEBUG_IPQ */ | ||
16 | #else | ||
17 | #include <net/if.h> | ||
18 | #endif /* ! __KERNEL__ */ | ||
19 | |||
20 | /* Messages sent from kernel */ | ||
21 | typedef struct ipq_packet_msg { | ||
22 | unsigned long packet_id; /* ID of queued packet */ | ||
23 | unsigned long mark; /* Netfilter mark value */ | ||
24 | long timestamp_sec; /* Packet arrival time (seconds) */ | ||
25 | long timestamp_usec; /* Packet arrvial time (+useconds) */ | ||
26 | unsigned int hook; /* Netfilter hook we rode in on */ | ||
27 | char indev_name[IFNAMSIZ]; /* Name of incoming interface */ | ||
28 | char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ | ||
29 | __be16 hw_protocol; /* Hardware protocol (network order) */ | ||
30 | unsigned short hw_type; /* Hardware type */ | ||
31 | unsigned char hw_addrlen; /* Hardware address length */ | ||
32 | unsigned char hw_addr[8]; /* Hardware address */ | ||
33 | size_t data_len; /* Length of packet data */ | ||
34 | unsigned char payload[0]; /* Optional packet data */ | ||
35 | } ipq_packet_msg_t; | ||
36 | |||
37 | /* Messages sent from userspace */ | ||
38 | typedef struct ipq_mode_msg { | ||
39 | unsigned char value; /* Requested mode */ | ||
40 | size_t range; /* Optional range of packet requested */ | ||
41 | } ipq_mode_msg_t; | ||
42 | |||
43 | typedef struct ipq_verdict_msg { | ||
44 | unsigned int value; /* Verdict to hand to netfilter */ | ||
45 | unsigned long id; /* Packet ID for this verdict */ | ||
46 | size_t data_len; /* Length of replacement data */ | ||
47 | unsigned char payload[0]; /* Optional replacement packet */ | ||
48 | } ipq_verdict_msg_t; | ||
49 | |||
50 | typedef struct ipq_peer_msg { | ||
51 | union { | ||
52 | ipq_verdict_msg_t verdict; | ||
53 | ipq_mode_msg_t mode; | ||
54 | } msg; | ||
55 | } ipq_peer_msg_t; | ||
56 | |||
57 | /* Packet delivery modes */ | ||
58 | enum { | ||
59 | IPQ_COPY_NONE, /* Initial mode, packets are dropped */ | ||
60 | IPQ_COPY_META, /* Copy metadata */ | ||
61 | IPQ_COPY_PACKET /* Copy metadata + packet (range) */ | ||
62 | }; | ||
63 | #define IPQ_COPY_MAX IPQ_COPY_PACKET | ||
64 | |||
65 | /* Types of messages */ | ||
66 | #define IPQM_BASE 0x10 /* standard netlink messages below this */ | ||
67 | #define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ | ||
68 | #define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ | ||
69 | #define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ | ||
70 | #define IPQM_MAX (IPQM_BASE + 4) | ||
71 | |||
72 | #endif /*_IP_QUEUE_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h new file mode 100644 index 00000000000..c6a204c9704 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _IPT_CLUSTERIP_H_target | ||
2 | #define _IPT_CLUSTERIP_H_target | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum clusterip_hashmode { | ||
7 | CLUSTERIP_HASHMODE_SIP = 0, | ||
8 | CLUSTERIP_HASHMODE_SIP_SPT, | ||
9 | CLUSTERIP_HASHMODE_SIP_SPT_DPT, | ||
10 | }; | ||
11 | |||
12 | #define CLUSTERIP_HASHMODE_MAX CLUSTERIP_HASHMODE_SIP_SPT_DPT | ||
13 | |||
14 | #define CLUSTERIP_MAX_NODES 16 | ||
15 | |||
16 | #define CLUSTERIP_FLAG_NEW 0x00000001 | ||
17 | |||
18 | struct clusterip_config; | ||
19 | |||
20 | struct ipt_clusterip_tgt_info { | ||
21 | |||
22 | __u32 flags; | ||
23 | |||
24 | /* only relevant for new ones */ | ||
25 | __u8 clustermac[6]; | ||
26 | __u16 num_total_nodes; | ||
27 | __u16 num_local_nodes; | ||
28 | __u16 local_nodes[CLUSTERIP_MAX_NODES]; | ||
29 | __u32 hash_mode; | ||
30 | __u32 hash_initval; | ||
31 | |||
32 | /* Used internally by the kernel */ | ||
33 | struct clusterip_config *config; | ||
34 | }; | ||
35 | |||
36 | #endif /*_IPT_CLUSTERIP_H_target*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h new file mode 100644 index 00000000000..bb88d5315a4 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_ECN.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* Header file for iptables ipt_ECN target | ||
2 | * | ||
3 | * (C) 2002 by Harald Welte <laforge@gnumonks.org> | ||
4 | * | ||
5 | * This software is distributed under GNU GPL v2, 1991 | ||
6 | * | ||
7 | * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp | ||
8 | */ | ||
9 | #ifndef _IPT_ECN_TARGET_H | ||
10 | #define _IPT_ECN_TARGET_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/netfilter/xt_DSCP.h> | ||
14 | |||
15 | #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) | ||
16 | |||
17 | #define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */ | ||
18 | #define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */ | ||
19 | #define IPT_ECN_OP_SET_CWR 0x20 /* set CWR bit of TCP header */ | ||
20 | |||
21 | #define IPT_ECN_OP_MASK 0xce | ||
22 | |||
23 | struct ipt_ECN_info { | ||
24 | __u8 operation; /* bitset of operations */ | ||
25 | __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ | ||
26 | union { | ||
27 | struct { | ||
28 | __u8 ece:1, cwr:1; /* TCP ECT bits */ | ||
29 | } tcp; | ||
30 | } proto; | ||
31 | }; | ||
32 | |||
33 | #endif /* _IPT_ECN_TARGET_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h new file mode 100644 index 00000000000..dcdbadf9fd4 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_LOG.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _IPT_LOG_H | ||
2 | #define _IPT_LOG_H | ||
3 | |||
4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | ||
5 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
6 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
7 | #define IPT_LOG_IPOPT 0x04 /* Log IP options */ | ||
8 | #define IPT_LOG_UID 0x08 /* Log UID owning local socket */ | ||
9 | #define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ | ||
10 | #define IPT_LOG_MACDECODE 0x20 /* Decode MAC header */ | ||
11 | #define IPT_LOG_MASK 0x2f | ||
12 | |||
13 | struct ipt_log_info { | ||
14 | unsigned char level; | ||
15 | unsigned char logflags; | ||
16 | char prefix[30]; | ||
17 | }; | ||
18 | |||
19 | #endif /*_IPT_LOG_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_REJECT.h b/include/linux/netfilter_ipv4/ipt_REJECT.h new file mode 100644 index 00000000000..4293a1ad1b0 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_REJECT.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _IPT_REJECT_H | ||
2 | #define _IPT_REJECT_H | ||
3 | |||
4 | enum ipt_reject_with { | ||
5 | IPT_ICMP_NET_UNREACHABLE, | ||
6 | IPT_ICMP_HOST_UNREACHABLE, | ||
7 | IPT_ICMP_PROT_UNREACHABLE, | ||
8 | IPT_ICMP_PORT_UNREACHABLE, | ||
9 | IPT_ICMP_ECHOREPLY, | ||
10 | IPT_ICMP_NET_PROHIBITED, | ||
11 | IPT_ICMP_HOST_PROHIBITED, | ||
12 | IPT_TCP_RESET, | ||
13 | IPT_ICMP_ADMIN_PROHIBITED | ||
14 | }; | ||
15 | |||
16 | struct ipt_reject_info { | ||
17 | enum ipt_reject_with with; /* reject type */ | ||
18 | }; | ||
19 | |||
20 | #endif /*_IPT_REJECT_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h new file mode 100644 index 00000000000..5bca78267af --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_SAME.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _IPT_SAME_H | ||
2 | #define _IPT_SAME_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define IPT_SAME_MAX_RANGE 10 | ||
7 | |||
8 | #define IPT_SAME_NODST 0x01 | ||
9 | |||
10 | struct ipt_same_info { | ||
11 | unsigned char info; | ||
12 | __u32 rangesize; | ||
13 | __u32 ipnum; | ||
14 | __u32 *iparray; | ||
15 | |||
16 | /* hangs off end. */ | ||
17 | struct nf_nat_range range[IPT_SAME_MAX_RANGE]; | ||
18 | }; | ||
19 | |||
20 | #endif /*_IPT_SAME_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h new file mode 100644 index 00000000000..f6ac169d92f --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_TTL.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* TTL modification module for IP tables | ||
2 | * (C) 2000 by Harald Welte <laforge@netfilter.org> */ | ||
3 | |||
4 | #ifndef _IPT_TTL_H | ||
5 | #define _IPT_TTL_H | ||
6 | |||
7 | #include <linux/types.h> | ||
8 | |||
9 | enum { | ||
10 | IPT_TTL_SET = 0, | ||
11 | IPT_TTL_INC, | ||
12 | IPT_TTL_DEC | ||
13 | }; | ||
14 | |||
15 | #define IPT_TTL_MAXMODE IPT_TTL_DEC | ||
16 | |||
17 | struct ipt_TTL_info { | ||
18 | __u8 mode; | ||
19 | __u8 ttl; | ||
20 | }; | ||
21 | |||
22 | |||
23 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ipt_ULOG.h b/include/linux/netfilter_ipv4/ipt_ULOG.h new file mode 100644 index 00000000000..417aad280bc --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_ULOG.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* Header file for IP tables userspace logging, Version 1.8 | ||
2 | * | ||
3 | * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org> | ||
4 | * | ||
5 | * Distributed under the terms of GNU GPL */ | ||
6 | |||
7 | #ifndef _IPT_ULOG_H | ||
8 | #define _IPT_ULOG_H | ||
9 | |||
10 | #ifndef NETLINK_NFLOG | ||
11 | #define NETLINK_NFLOG 5 | ||
12 | #endif | ||
13 | |||
14 | #define ULOG_DEFAULT_NLGROUP 1 | ||
15 | #define ULOG_DEFAULT_QTHRESHOLD 1 | ||
16 | |||
17 | #define ULOG_MAC_LEN 80 | ||
18 | #define ULOG_PREFIX_LEN 32 | ||
19 | |||
20 | #define ULOG_MAX_QLEN 50 | ||
21 | /* Why 50? Well... there is a limit imposed by the slab cache 131000 | ||
22 | * bytes. So the multipart netlink-message has to be < 131000 bytes. | ||
23 | * Assuming a standard ethernet-mtu of 1500, we could define this up | ||
24 | * to 80... but even 50 seems to be big enough. */ | ||
25 | |||
26 | /* private data structure for each rule with a ULOG target */ | ||
27 | struct ipt_ulog_info { | ||
28 | unsigned int nl_group; | ||
29 | size_t copy_range; | ||
30 | size_t qthreshold; | ||
31 | char prefix[ULOG_PREFIX_LEN]; | ||
32 | }; | ||
33 | |||
34 | /* Format of the ULOG packets passed through netlink */ | ||
35 | typedef struct ulog_packet_msg { | ||
36 | unsigned long mark; | ||
37 | long timestamp_sec; | ||
38 | long timestamp_usec; | ||
39 | unsigned int hook; | ||
40 | char indev_name[IFNAMSIZ]; | ||
41 | char outdev_name[IFNAMSIZ]; | ||
42 | size_t data_len; | ||
43 | char prefix[ULOG_PREFIX_LEN]; | ||
44 | unsigned char mac_len; | ||
45 | unsigned char mac[ULOG_MAC_LEN]; | ||
46 | unsigned char payload[0]; | ||
47 | } ulog_packet_msg_t; | ||
48 | |||
49 | #endif /*_IPT_ULOG_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h new file mode 100644 index 00000000000..0da42237c8d --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_addrtype.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _IPT_ADDRTYPE_H | ||
2 | #define _IPT_ADDRTYPE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, | ||
8 | IPT_ADDRTYPE_INVERT_DEST = 0x0002, | ||
9 | IPT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, | ||
10 | IPT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, | ||
11 | }; | ||
12 | |||
13 | struct ipt_addrtype_info_v1 { | ||
14 | __u16 source; /* source-type mask */ | ||
15 | __u16 dest; /* dest-type mask */ | ||
16 | __u32 flags; | ||
17 | }; | ||
18 | |||
19 | /* revision 0 */ | ||
20 | struct ipt_addrtype_info { | ||
21 | __u16 source; /* source-type mask */ | ||
22 | __u16 dest; /* dest-type mask */ | ||
23 | __u32 invert_source; | ||
24 | __u32 invert_dest; | ||
25 | }; | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/linux/netfilter_ipv4/ipt_ah.h new file mode 100644 index 00000000000..4e02bb0119e --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_ah.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _IPT_AH_H | ||
2 | #define _IPT_AH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct ipt_ah { | ||
7 | __u32 spis[2]; /* Security Parameter Index */ | ||
8 | __u8 invflags; /* Inverse flags */ | ||
9 | }; | ||
10 | |||
11 | |||
12 | |||
13 | /* Values for "invflags" field in struct ipt_ah. */ | ||
14 | #define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */ | ||
15 | #define IPT_AH_INV_MASK 0x01 /* All possible flags. */ | ||
16 | |||
17 | #endif /*_IPT_AH_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h new file mode 100644 index 00000000000..eabf95fb7d3 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_ecn.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* iptables module for matching the ECN header in IPv4 and TCP header | ||
2 | * | ||
3 | * (C) 2002 Harald Welte <laforge@gnumonks.org> | ||
4 | * | ||
5 | * This software is distributed under GNU GPL v2, 1991 | ||
6 | * | ||
7 | * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp | ||
8 | */ | ||
9 | #ifndef _IPT_ECN_H | ||
10 | #define _IPT_ECN_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/netfilter/xt_dscp.h> | ||
14 | |||
15 | #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) | ||
16 | |||
17 | #define IPT_ECN_OP_MATCH_IP 0x01 | ||
18 | #define IPT_ECN_OP_MATCH_ECE 0x10 | ||
19 | #define IPT_ECN_OP_MATCH_CWR 0x20 | ||
20 | |||
21 | #define IPT_ECN_OP_MATCH_MASK 0xce | ||
22 | |||
23 | /* match info */ | ||
24 | struct ipt_ecn_info { | ||
25 | __u8 operation; | ||
26 | __u8 invert; | ||
27 | __u8 ip_ect; | ||
28 | union { | ||
29 | struct { | ||
30 | __u8 ect; | ||
31 | } tcp; | ||
32 | } proto; | ||
33 | }; | ||
34 | |||
35 | #endif /* _IPT_ECN_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h new file mode 100644 index 00000000000..b3996eaa018 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_realm.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _IPT_REALM_H | ||
2 | #define _IPT_REALM_H | ||
3 | |||
4 | #include <linux/netfilter/xt_realm.h> | ||
5 | #define ipt_realm_info xt_realm_info | ||
6 | |||
7 | #endif /* _IPT_REALM_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_ttl.h b/include/linux/netfilter_ipv4/ipt_ttl.h new file mode 100644 index 00000000000..37bee444248 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_ttl.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* IP tables module for matching the value of the TTL | ||
2 | * (C) 2000 by Harald Welte <laforge@gnumonks.org> */ | ||
3 | |||
4 | #ifndef _IPT_TTL_H | ||
5 | #define _IPT_TTL_H | ||
6 | |||
7 | #include <linux/types.h> | ||
8 | |||
9 | enum { | ||
10 | IPT_TTL_EQ = 0, /* equals */ | ||
11 | IPT_TTL_NE, /* not equals */ | ||
12 | IPT_TTL_LT, /* less than */ | ||
13 | IPT_TTL_GT, /* greater than */ | ||
14 | }; | ||
15 | |||
16 | |||
17 | struct ipt_ttl_info { | ||
18 | __u8 mode; | ||
19 | __u8 ttl; | ||
20 | }; | ||
21 | |||
22 | |||
23 | #endif | ||
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild new file mode 100644 index 00000000000..bd095bc075e --- /dev/null +++ b/include/linux/netfilter_ipv6/Kbuild | |||
@@ -0,0 +1,11 @@ | |||
1 | header-y += ip6_tables.h | ||
2 | header-y += ip6t_HL.h | ||
3 | header-y += ip6t_LOG.h | ||
4 | header-y += ip6t_REJECT.h | ||
5 | header-y += ip6t_ah.h | ||
6 | header-y += ip6t_frag.h | ||
7 | header-y += ip6t_hl.h | ||
8 | header-y += ip6t_ipv6header.h | ||
9 | header-y += ip6t_mh.h | ||
10 | header-y += ip6t_opts.h | ||
11 | header-y += ip6t_rt.h | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h new file mode 100644 index 00000000000..ebd8ead1bb6 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_HL.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* Hop Limit modification module for ip6tables | ||
2 | * Maciej Soltysiak <solt@dns.toxicfilms.tv> | ||
3 | * Based on HW's TTL module */ | ||
4 | |||
5 | #ifndef _IP6T_HL_H | ||
6 | #define _IP6T_HL_H | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
10 | enum { | ||
11 | IP6T_HL_SET = 0, | ||
12 | IP6T_HL_INC, | ||
13 | IP6T_HL_DEC | ||
14 | }; | ||
15 | |||
16 | #define IP6T_HL_MAXMODE IP6T_HL_DEC | ||
17 | |||
18 | struct ip6t_HL_info { | ||
19 | __u8 mode; | ||
20 | __u8 hop_limit; | ||
21 | }; | ||
22 | |||
23 | |||
24 | #endif | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h new file mode 100644 index 00000000000..9dd5579e02e --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_LOG.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _IP6T_LOG_H | ||
2 | #define _IP6T_LOG_H | ||
3 | |||
4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | ||
5 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
6 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
7 | #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ | ||
8 | #define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ | ||
9 | #define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */ | ||
10 | #define IP6T_LOG_MACDECODE 0x20 /* Decode MAC header */ | ||
11 | #define IP6T_LOG_MASK 0x2f | ||
12 | |||
13 | struct ip6t_log_info { | ||
14 | unsigned char level; | ||
15 | unsigned char logflags; | ||
16 | char prefix[30]; | ||
17 | }; | ||
18 | |||
19 | #endif /*_IPT_LOG_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h new file mode 100644 index 00000000000..205ed62e460 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _IP6T_REJECT_H | ||
2 | #define _IP6T_REJECT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum ip6t_reject_with { | ||
7 | IP6T_ICMP6_NO_ROUTE, | ||
8 | IP6T_ICMP6_ADM_PROHIBITED, | ||
9 | IP6T_ICMP6_NOT_NEIGHBOUR, | ||
10 | IP6T_ICMP6_ADDR_UNREACH, | ||
11 | IP6T_ICMP6_PORT_UNREACH, | ||
12 | IP6T_ICMP6_ECHOREPLY, | ||
13 | IP6T_TCP_RESET | ||
14 | }; | ||
15 | |||
16 | struct ip6t_reject_info { | ||
17 | __u32 with; /* reject type */ | ||
18 | }; | ||
19 | |||
20 | #endif /*_IP6T_REJECT_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h new file mode 100644 index 00000000000..5da2b65cb3a --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_ah.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _IP6T_AH_H | ||
2 | #define _IP6T_AH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct ip6t_ah { | ||
7 | __u32 spis[2]; /* Security Parameter Index */ | ||
8 | __u32 hdrlen; /* Header Length */ | ||
9 | __u8 hdrres; /* Test of the Reserved Filed */ | ||
10 | __u8 invflags; /* Inverse flags */ | ||
11 | }; | ||
12 | |||
13 | #define IP6T_AH_SPI 0x01 | ||
14 | #define IP6T_AH_LEN 0x02 | ||
15 | #define IP6T_AH_RES 0x04 | ||
16 | |||
17 | /* Values for "invflags" field in struct ip6t_ah. */ | ||
18 | #define IP6T_AH_INV_SPI 0x01 /* Invert the sense of spi. */ | ||
19 | #define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ | ||
20 | #define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ | ||
21 | |||
22 | #endif /*_IP6T_AH_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h new file mode 100644 index 00000000000..b47f61b9e08 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_frag.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _IP6T_FRAG_H | ||
2 | #define _IP6T_FRAG_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct ip6t_frag { | ||
7 | __u32 ids[2]; /* Security Parameter Index */ | ||
8 | __u32 hdrlen; /* Header Length */ | ||
9 | __u8 flags; /* */ | ||
10 | __u8 invflags; /* Inverse flags */ | ||
11 | }; | ||
12 | |||
13 | #define IP6T_FRAG_IDS 0x01 | ||
14 | #define IP6T_FRAG_LEN 0x02 | ||
15 | #define IP6T_FRAG_RES 0x04 | ||
16 | #define IP6T_FRAG_FST 0x08 | ||
17 | #define IP6T_FRAG_MF 0x10 | ||
18 | #define IP6T_FRAG_NMF 0x20 | ||
19 | |||
20 | /* Values for "invflags" field in struct ip6t_frag. */ | ||
21 | #define IP6T_FRAG_INV_IDS 0x01 /* Invert the sense of ids. */ | ||
22 | #define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ | ||
23 | #define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ | ||
24 | |||
25 | #endif /*_IP6T_FRAG_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_hl.h b/include/linux/netfilter_ipv6/ip6t_hl.h new file mode 100644 index 00000000000..6e76dbc6c19 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_hl.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* ip6tables module for matching the Hop Limit value | ||
2 | * Maciej Soltysiak <solt@dns.toxicfilms.tv> | ||
3 | * Based on HW's ttl module */ | ||
4 | |||
5 | #ifndef _IP6T_HL_H | ||
6 | #define _IP6T_HL_H | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
10 | enum { | ||
11 | IP6T_HL_EQ = 0, /* equals */ | ||
12 | IP6T_HL_NE, /* not equals */ | ||
13 | IP6T_HL_LT, /* less than */ | ||
14 | IP6T_HL_GT, /* greater than */ | ||
15 | }; | ||
16 | |||
17 | |||
18 | struct ip6t_hl_info { | ||
19 | __u8 mode; | ||
20 | __u8 hop_limit; | ||
21 | }; | ||
22 | |||
23 | |||
24 | #endif | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/linux/netfilter_ipv6/ip6t_ipv6header.h new file mode 100644 index 00000000000..efae3a20c21 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_ipv6header.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* ipv6header match - matches IPv6 packets based | ||
2 | on whether they contain certain headers */ | ||
3 | |||
4 | /* Original idea: Brad Chapman | ||
5 | * Rewritten by: Andras Kis-Szabo <kisza@sch.bme.hu> */ | ||
6 | |||
7 | |||
8 | #ifndef __IPV6HEADER_H | ||
9 | #define __IPV6HEADER_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | struct ip6t_ipv6header_info { | ||
14 | __u8 matchflags; | ||
15 | __u8 invflags; | ||
16 | __u8 modeflag; | ||
17 | }; | ||
18 | |||
19 | #define MASK_HOPOPTS 128 | ||
20 | #define MASK_DSTOPTS 64 | ||
21 | #define MASK_ROUTING 32 | ||
22 | #define MASK_FRAGMENT 16 | ||
23 | #define MASK_AH 8 | ||
24 | #define MASK_ESP 4 | ||
25 | #define MASK_NONE 2 | ||
26 | #define MASK_PROTO 1 | ||
27 | |||
28 | #endif /* __IPV6HEADER_H */ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h new file mode 100644 index 00000000000..a7729a5025c --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_mh.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _IP6T_MH_H | ||
2 | #define _IP6T_MH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* MH matching stuff */ | ||
7 | struct ip6t_mh { | ||
8 | __u8 types[2]; /* MH type range */ | ||
9 | __u8 invflags; /* Inverse flags */ | ||
10 | }; | ||
11 | |||
12 | /* Values for "invflags" field in struct ip6t_mh. */ | ||
13 | #define IP6T_MH_INV_TYPE 0x01 /* Invert the sense of type. */ | ||
14 | #define IP6T_MH_INV_MASK 0x01 /* All possible flags. */ | ||
15 | |||
16 | #endif /*_IP6T_MH_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h new file mode 100644 index 00000000000..17d419a811f --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_opts.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _IP6T_OPTS_H | ||
2 | #define _IP6T_OPTS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define IP6T_OPTS_OPTSNR 16 | ||
7 | |||
8 | struct ip6t_opts { | ||
9 | __u32 hdrlen; /* Header Length */ | ||
10 | __u8 flags; /* */ | ||
11 | __u8 invflags; /* Inverse flags */ | ||
12 | __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */ | ||
13 | __u8 optsnr; /* Nr of OPts */ | ||
14 | }; | ||
15 | |||
16 | #define IP6T_OPTS_LEN 0x01 | ||
17 | #define IP6T_OPTS_OPTS 0x02 | ||
18 | #define IP6T_OPTS_NSTRICT 0x04 | ||
19 | |||
20 | /* Values for "invflags" field in struct ip6t_rt. */ | ||
21 | #define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ | ||
22 | #define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ | ||
23 | |||
24 | #endif /*_IP6T_OPTS_H*/ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h new file mode 100644 index 00000000000..7605a5ff81c --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_rt.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _IP6T_RT_H | ||
2 | #define _IP6T_RT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | /*#include <linux/in6.h>*/ | ||
6 | |||
7 | #define IP6T_RT_HOPS 16 | ||
8 | |||
9 | struct ip6t_rt { | ||
10 | __u32 rt_type; /* Routing Type */ | ||
11 | __u32 segsleft[2]; /* Segments Left */ | ||
12 | __u32 hdrlen; /* Header Length */ | ||
13 | __u8 flags; /* */ | ||
14 | __u8 invflags; /* Inverse flags */ | ||
15 | struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ | ||
16 | __u8 addrnr; /* Nr of Addresses */ | ||
17 | }; | ||
18 | |||
19 | #define IP6T_RT_TYP 0x01 | ||
20 | #define IP6T_RT_SGS 0x02 | ||
21 | #define IP6T_RT_LEN 0x04 | ||
22 | #define IP6T_RT_RES 0x08 | ||
23 | #define IP6T_RT_FST_MASK 0x30 | ||
24 | #define IP6T_RT_FST 0x10 | ||
25 | #define IP6T_RT_FST_NSTRICT 0x20 | ||
26 | |||
27 | /* Values for "invflags" field in struct ip6t_rt. */ | ||
28 | #define IP6T_RT_INV_TYP 0x01 /* Invert the sense of type. */ | ||
29 | #define IP6T_RT_INV_SGS 0x02 /* Invert the sense of Segments. */ | ||
30 | #define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ | ||
31 | #define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ | ||
32 | |||
33 | #endif /*_IP6T_RT_H*/ | ||
diff --git a/include/linux/netrom.h b/include/linux/netrom.h new file mode 100644 index 00000000000..6939b32f66a --- /dev/null +++ b/include/linux/netrom.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * These are the public elements of the Linux kernel NET/ROM implementation. | ||
3 | * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the | ||
4 | * definition of the ax25_address structure. | ||
5 | */ | ||
6 | |||
7 | #ifndef NETROM_KERNEL_H | ||
8 | #define NETROM_KERNEL_H | ||
9 | |||
10 | #define NETROM_MTU 236 | ||
11 | |||
12 | #define NETROM_T1 1 | ||
13 | #define NETROM_T2 2 | ||
14 | #define NETROM_N2 3 | ||
15 | #define NETROM_T4 6 | ||
16 | #define NETROM_IDLE 7 | ||
17 | |||
18 | #define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) | ||
19 | |||
20 | struct nr_route_struct { | ||
21 | #define NETROM_NEIGH 0 | ||
22 | #define NETROM_NODE 1 | ||
23 | int type; | ||
24 | ax25_address callsign; | ||
25 | char device[16]; | ||
26 | unsigned int quality; | ||
27 | char mnemonic[7]; | ||
28 | ax25_address neighbour; | ||
29 | unsigned int obs_count; | ||
30 | unsigned int ndigis; | ||
31 | ax25_address digipeaters[AX25_MAX_DIGIS]; | ||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/nfc.h b/include/linux/nfc.h new file mode 100644 index 00000000000..330a4c5db58 --- /dev/null +++ b/include/linux/nfc.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Instituto Nokia de Tecnologia | ||
3 | * | ||
4 | * Authors: | ||
5 | * Lauro Ramos Venancio <lauro.venancio@openbossa.org> | ||
6 | * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the | ||
20 | * Free Software Foundation, Inc., | ||
21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __LINUX_NFC_H | ||
25 | #define __LINUX_NFC_H | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/socket.h> | ||
29 | |||
30 | #define NFC_GENL_NAME "nfc" | ||
31 | #define NFC_GENL_VERSION 1 | ||
32 | |||
33 | #define NFC_GENL_MCAST_EVENT_NAME "events" | ||
34 | |||
35 | /** | ||
36 | * enum nfc_commands - supported nfc commands | ||
37 | * | ||
38 | * @NFC_CMD_UNSPEC: unspecified command | ||
39 | * | ||
40 | * @NFC_CMD_GET_DEVICE: request information about a device (requires | ||
41 | * %NFC_ATTR_DEVICE_INDEX) or dump request to get a list of all nfc devices | ||
42 | * @NFC_CMD_START_POLL: start polling for targets using the given protocols | ||
43 | * (requires %NFC_ATTR_DEVICE_INDEX and %NFC_ATTR_PROTOCOLS) | ||
44 | * @NFC_CMD_STOP_POLL: stop polling for targets (requires | ||
45 | * %NFC_ATTR_DEVICE_INDEX) | ||
46 | * @NFC_CMD_GET_TARGET: dump all targets found by the previous poll (requires | ||
47 | * %NFC_ATTR_DEVICE_INDEX) | ||
48 | * @NFC_EVENT_TARGETS_FOUND: event emitted when a new target is found | ||
49 | * (it sends %NFC_ATTR_DEVICE_INDEX) | ||
50 | * @NFC_EVENT_DEVICE_ADDED: event emitted when a new device is registred | ||
51 | * (it sends %NFC_ATTR_DEVICE_NAME, %NFC_ATTR_DEVICE_INDEX and | ||
52 | * %NFC_ATTR_PROTOCOLS) | ||
53 | * @NFC_EVENT_DEVICE_REMOVED: event emitted when a device is removed | ||
54 | * (it sends %NFC_ATTR_DEVICE_INDEX) | ||
55 | */ | ||
56 | enum nfc_commands { | ||
57 | NFC_CMD_UNSPEC, | ||
58 | NFC_CMD_GET_DEVICE, | ||
59 | NFC_CMD_START_POLL, | ||
60 | NFC_CMD_STOP_POLL, | ||
61 | NFC_CMD_GET_TARGET, | ||
62 | NFC_EVENT_TARGETS_FOUND, | ||
63 | NFC_EVENT_DEVICE_ADDED, | ||
64 | NFC_EVENT_DEVICE_REMOVED, | ||
65 | /* private: internal use only */ | ||
66 | __NFC_CMD_AFTER_LAST | ||
67 | }; | ||
68 | #define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1) | ||
69 | |||
70 | /** | ||
71 | * enum nfc_attrs - supported nfc attributes | ||
72 | * | ||
73 | * @NFC_ATTR_UNSPEC: unspecified attribute | ||
74 | * | ||
75 | * @NFC_ATTR_DEVICE_INDEX: index of nfc device | ||
76 | * @NFC_ATTR_DEVICE_NAME: device name, max 8 chars | ||
77 | * @NFC_ATTR_PROTOCOLS: nfc protocols - bitwise or-ed combination from | ||
78 | * NFC_PROTO_*_MASK constants | ||
79 | * @NFC_ATTR_TARGET_INDEX: index of the nfc target | ||
80 | * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID | ||
81 | * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the | ||
82 | * target is not NFC-Forum compliant) | ||
83 | */ | ||
84 | enum nfc_attrs { | ||
85 | NFC_ATTR_UNSPEC, | ||
86 | NFC_ATTR_DEVICE_INDEX, | ||
87 | NFC_ATTR_DEVICE_NAME, | ||
88 | NFC_ATTR_PROTOCOLS, | ||
89 | NFC_ATTR_TARGET_INDEX, | ||
90 | NFC_ATTR_TARGET_SENS_RES, | ||
91 | NFC_ATTR_TARGET_SEL_RES, | ||
92 | /* private: internal use only */ | ||
93 | __NFC_ATTR_AFTER_LAST | ||
94 | }; | ||
95 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) | ||
96 | |||
97 | #define NFC_DEVICE_NAME_MAXSIZE 8 | ||
98 | |||
99 | /* NFC protocols */ | ||
100 | #define NFC_PROTO_JEWEL 1 | ||
101 | #define NFC_PROTO_MIFARE 2 | ||
102 | #define NFC_PROTO_FELICA 3 | ||
103 | #define NFC_PROTO_ISO14443 4 | ||
104 | #define NFC_PROTO_NFC_DEP 5 | ||
105 | |||
106 | #define NFC_PROTO_MAX 6 | ||
107 | |||
108 | /* NFC protocols masks used in bitsets */ | ||
109 | #define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) | ||
110 | #define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) | ||
111 | #define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA) | ||
112 | #define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) | ||
113 | #define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) | ||
114 | |||
115 | struct sockaddr_nfc { | ||
116 | sa_family_t sa_family; | ||
117 | __u32 dev_idx; | ||
118 | __u32 target_idx; | ||
119 | __u32 nfc_protocol; | ||
120 | }; | ||
121 | |||
122 | /* NFC socket protocols */ | ||
123 | #define NFC_SOCKPROTO_RAW 0 | ||
124 | #define NFC_SOCKPROTO_MAX 1 | ||
125 | |||
126 | #endif /*__LINUX_NFC_H */ | ||
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h new file mode 100644 index 00000000000..9285000dbb4 --- /dev/null +++ b/include/linux/nfc/pn544.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Trusted Logic S.A. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | |||
19 | #define PN544_MAGIC 0xE9 | ||
20 | |||
21 | /* | ||
22 | * PN544 power control via ioctl | ||
23 | * PN544_SET_PWR(0): power off | ||
24 | * PN544_SET_PWR(1): power on | ||
25 | * PN544_SET_PWR(2): reset and power on with firmware download enabled | ||
26 | */ | ||
27 | #define PN544_SET_PWR _IOW(PN544_MAGIC, 0x01, unsigned int) | ||
28 | |||
29 | struct pn544_i2c_platform_data { | ||
30 | unsigned int irq_gpio; | ||
31 | unsigned int ven_gpio; | ||
32 | unsigned int firm_gpio; | ||
33 | }; | ||
diff --git a/include/linux/nfs2.h b/include/linux/nfs2.h new file mode 100644 index 00000000000..fde24b30cc9 --- /dev/null +++ b/include/linux/nfs2.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * NFS protocol definitions | ||
3 | * | ||
4 | * This file contains constants for Version 2 of the protocol. | ||
5 | */ | ||
6 | #ifndef _LINUX_NFS2_H | ||
7 | #define _LINUX_NFS2_H | ||
8 | |||
9 | #define NFS2_PORT 2049 | ||
10 | #define NFS2_MAXDATA 8192 | ||
11 | #define NFS2_MAXPATHLEN 1024 | ||
12 | #define NFS2_MAXNAMLEN 255 | ||
13 | #define NFS2_MAXGROUPS 16 | ||
14 | #define NFS2_FHSIZE 32 | ||
15 | #define NFS2_COOKIESIZE 4 | ||
16 | #define NFS2_FIFO_DEV (-1) | ||
17 | #define NFS2MODE_FMT 0170000 | ||
18 | #define NFS2MODE_DIR 0040000 | ||
19 | #define NFS2MODE_CHR 0020000 | ||
20 | #define NFS2MODE_BLK 0060000 | ||
21 | #define NFS2MODE_REG 0100000 | ||
22 | #define NFS2MODE_LNK 0120000 | ||
23 | #define NFS2MODE_SOCK 0140000 | ||
24 | #define NFS2MODE_FIFO 0010000 | ||
25 | |||
26 | |||
27 | /* NFSv2 file types - beware, these are not the same in NFSv3 */ | ||
28 | enum nfs2_ftype { | ||
29 | NF2NON = 0, | ||
30 | NF2REG = 1, | ||
31 | NF2DIR = 2, | ||
32 | NF2BLK = 3, | ||
33 | NF2CHR = 4, | ||
34 | NF2LNK = 5, | ||
35 | NF2SOCK = 6, | ||
36 | NF2BAD = 7, | ||
37 | NF2FIFO = 8 | ||
38 | }; | ||
39 | |||
40 | struct nfs2_fh { | ||
41 | char data[NFS2_FHSIZE]; | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * Procedure numbers for NFSv2 | ||
46 | */ | ||
47 | #define NFS2_VERSION 2 | ||
48 | #define NFSPROC_NULL 0 | ||
49 | #define NFSPROC_GETATTR 1 | ||
50 | #define NFSPROC_SETATTR 2 | ||
51 | #define NFSPROC_ROOT 3 | ||
52 | #define NFSPROC_LOOKUP 4 | ||
53 | #define NFSPROC_READLINK 5 | ||
54 | #define NFSPROC_READ 6 | ||
55 | #define NFSPROC_WRITECACHE 7 | ||
56 | #define NFSPROC_WRITE 8 | ||
57 | #define NFSPROC_CREATE 9 | ||
58 | #define NFSPROC_REMOVE 10 | ||
59 | #define NFSPROC_RENAME 11 | ||
60 | #define NFSPROC_LINK 12 | ||
61 | #define NFSPROC_SYMLINK 13 | ||
62 | #define NFSPROC_MKDIR 14 | ||
63 | #define NFSPROC_RMDIR 15 | ||
64 | #define NFSPROC_READDIR 16 | ||
65 | #define NFSPROC_STATFS 17 | ||
66 | |||
67 | #endif /* _LINUX_NFS2_H */ | ||
diff --git a/include/linux/nfs4_mount.h b/include/linux/nfs4_mount.h new file mode 100644 index 00000000000..a0dcf665565 --- /dev/null +++ b/include/linux/nfs4_mount.h | |||
@@ -0,0 +1,71 @@ | |||
1 | #ifndef _LINUX_NFS4_MOUNT_H | ||
2 | #define _LINUX_NFS4_MOUNT_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/linux/nfs4_mount.h | ||
6 | * | ||
7 | * Copyright (C) 2002 Trond Myklebust | ||
8 | * | ||
9 | * structure passed from user-space to kernel-space during an nfsv4 mount | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * WARNING! Do not delete or change the order of these fields. If | ||
14 | * a new field is required then add it to the end. The version field | ||
15 | * tracks which fields are present. This will ensure some measure of | ||
16 | * mount-to-kernel version compatibility. Some of these aren't used yet | ||
17 | * but here they are anyway. | ||
18 | */ | ||
19 | #define NFS4_MOUNT_VERSION 1 | ||
20 | |||
21 | struct nfs_string { | ||
22 | unsigned int len; | ||
23 | const char __user * data; | ||
24 | }; | ||
25 | |||
26 | struct nfs4_mount_data { | ||
27 | int version; /* 1 */ | ||
28 | int flags; /* 1 */ | ||
29 | int rsize; /* 1 */ | ||
30 | int wsize; /* 1 */ | ||
31 | int timeo; /* 1 */ | ||
32 | int retrans; /* 1 */ | ||
33 | int acregmin; /* 1 */ | ||
34 | int acregmax; /* 1 */ | ||
35 | int acdirmin; /* 1 */ | ||
36 | int acdirmax; /* 1 */ | ||
37 | |||
38 | /* see the definition of 'struct clientaddr4' in RFC3010 */ | ||
39 | struct nfs_string client_addr; /* 1 */ | ||
40 | |||
41 | /* Mount path */ | ||
42 | struct nfs_string mnt_path; /* 1 */ | ||
43 | |||
44 | /* Server details */ | ||
45 | struct nfs_string hostname; /* 1 */ | ||
46 | /* Server IP address */ | ||
47 | unsigned int host_addrlen; /* 1 */ | ||
48 | struct sockaddr __user * host_addr; /* 1 */ | ||
49 | |||
50 | /* Transport protocol to use */ | ||
51 | int proto; /* 1 */ | ||
52 | |||
53 | /* Pseudo-flavours to use for authentication. See RFC2623 */ | ||
54 | int auth_flavourlen; /* 1 */ | ||
55 | int __user *auth_flavours; /* 1 */ | ||
56 | }; | ||
57 | |||
58 | /* bits in the flags field */ | ||
59 | /* Note: the fields that correspond to existing NFSv2/v3 mount options | ||
60 | * should mirror the values from include/linux/nfs_mount.h | ||
61 | */ | ||
62 | |||
63 | #define NFS4_MOUNT_SOFT 0x0001 /* 1 */ | ||
64 | #define NFS4_MOUNT_INTR 0x0002 /* 1 */ | ||
65 | #define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ | ||
66 | #define NFS4_MOUNT_NOAC 0x0020 /* 1 */ | ||
67 | #define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ | ||
68 | #define NFS4_MOUNT_UNSHARED 0x8000 /* 1 */ | ||
69 | #define NFS4_MOUNT_FLAGMASK 0x9033 | ||
70 | |||
71 | #endif | ||
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h new file mode 100644 index 00000000000..576bddd72e0 --- /dev/null +++ b/include/linux/nfs_mount.h | |||
@@ -0,0 +1,77 @@ | |||
1 | #ifndef _LINUX_NFS_MOUNT_H | ||
2 | #define _LINUX_NFS_MOUNT_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/linux/nfs_mount.h | ||
6 | * | ||
7 | * Copyright (C) 1992 Rick Sladkey | ||
8 | * | ||
9 | * structure passed from user-space to kernel-space during an nfs mount | ||
10 | */ | ||
11 | #include <linux/in.h> | ||
12 | #include <linux/nfs.h> | ||
13 | #include <linux/nfs2.h> | ||
14 | #include <linux/nfs3.h> | ||
15 | |||
16 | /* | ||
17 | * WARNING! Do not delete or change the order of these fields. If | ||
18 | * a new field is required then add it to the end. The version field | ||
19 | * tracks which fields are present. This will ensure some measure of | ||
20 | * mount-to-kernel version compatibility. Some of these aren't used yet | ||
21 | * but here they are anyway. | ||
22 | */ | ||
23 | #define NFS_MOUNT_VERSION 6 | ||
24 | #define NFS_MAX_CONTEXT_LEN 256 | ||
25 | |||
26 | struct nfs_mount_data { | ||
27 | int version; /* 1 */ | ||
28 | int fd; /* 1 */ | ||
29 | struct nfs2_fh old_root; /* 1 */ | ||
30 | int flags; /* 1 */ | ||
31 | int rsize; /* 1 */ | ||
32 | int wsize; /* 1 */ | ||
33 | int timeo; /* 1 */ | ||
34 | int retrans; /* 1 */ | ||
35 | int acregmin; /* 1 */ | ||
36 | int acregmax; /* 1 */ | ||
37 | int acdirmin; /* 1 */ | ||
38 | int acdirmax; /* 1 */ | ||
39 | struct sockaddr_in addr; /* 1 */ | ||
40 | char hostname[NFS_MAXNAMLEN + 1]; /* 1 */ | ||
41 | int namlen; /* 2 */ | ||
42 | unsigned int bsize; /* 3 */ | ||
43 | struct nfs3_fh root; /* 4 */ | ||
44 | int pseudoflavor; /* 5 */ | ||
45 | char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ | ||
46 | }; | ||
47 | |||
48 | /* bits in the flags field visible to user space */ | ||
49 | |||
50 | #define NFS_MOUNT_SOFT 0x0001 /* 1 */ | ||
51 | #define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */ | ||
52 | #define NFS_MOUNT_SECURE 0x0004 /* 1 */ | ||
53 | #define NFS_MOUNT_POSIX 0x0008 /* 1 */ | ||
54 | #define NFS_MOUNT_NOCTO 0x0010 /* 1 */ | ||
55 | #define NFS_MOUNT_NOAC 0x0020 /* 1 */ | ||
56 | #define NFS_MOUNT_TCP 0x0040 /* 2 */ | ||
57 | #define NFS_MOUNT_VER3 0x0080 /* 3 */ | ||
58 | #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ | ||
59 | #define NFS_MOUNT_NONLM 0x0200 /* 3 */ | ||
60 | #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ | ||
61 | #define NFS_MOUNT_NOACL 0x0800 /* 4 */ | ||
62 | #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ | ||
63 | #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ | ||
64 | #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ | ||
65 | #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ | ||
66 | #define NFS_MOUNT_FLAGMASK 0xFFFF | ||
67 | |||
68 | /* The following are for internal use only */ | ||
69 | #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 | ||
70 | #define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 | ||
71 | #define NFS_MOUNT_NORESVPORT 0x40000 | ||
72 | #define NFS_MOUNT_LEGACY_INTERFACE 0x80000 | ||
73 | |||
74 | #define NFS_MOUNT_LOCAL_FLOCK 0x100000 | ||
75 | #define NFS_MOUNT_LOCAL_FCNTL 0x200000 | ||
76 | |||
77 | #endif | ||
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild new file mode 100644 index 00000000000..55d1467de3c --- /dev/null +++ b/include/linux/nfsd/Kbuild | |||
@@ -0,0 +1,6 @@ | |||
1 | header-y += const.h | ||
2 | header-y += debug.h | ||
3 | header-y += export.h | ||
4 | header-y += nfsfh.h | ||
5 | header-y += stats.h | ||
6 | header-y += syscall.h | ||
diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h new file mode 100644 index 00000000000..323f8cfa060 --- /dev/null +++ b/include/linux/nfsd/const.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * include/linux/nfsd/const.h | ||
3 | * | ||
4 | * Various constants related to NFS. | ||
5 | * | ||
6 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_NFSD_CONST_H | ||
10 | #define _LINUX_NFSD_CONST_H | ||
11 | |||
12 | #include <linux/nfs.h> | ||
13 | #include <linux/nfs2.h> | ||
14 | #include <linux/nfs3.h> | ||
15 | #include <linux/nfs4.h> | ||
16 | |||
17 | /* | ||
18 | * Maximum protocol version supported by knfsd | ||
19 | */ | ||
20 | #define NFSSVC_MAXVERS 3 | ||
21 | |||
22 | /* | ||
23 | * Maximum blocksizes supported by daemon under various circumstances. | ||
24 | */ | ||
25 | #define NFSSVC_MAXBLKSIZE RPCSVC_MAXPAYLOAD | ||
26 | /* NFSv2 is limited by the protocol specification, see RFC 1094 */ | ||
27 | #define NFSSVC_MAXBLKSIZE_V2 (8*1024) | ||
28 | |||
29 | #ifdef __KERNEL__ | ||
30 | |||
31 | #include <linux/sunrpc/msg_prot.h> | ||
32 | |||
33 | /* | ||
34 | * Largest number of bytes we need to allocate for an NFS | ||
35 | * call or reply. Used to control buffer sizes. We use | ||
36 | * the length of v3 WRITE, READDIR and READDIR replies | ||
37 | * which are an RPC header, up to 26 XDR units of reply | ||
38 | * data, and some page data. | ||
39 | * | ||
40 | * Note that accuracy here doesn't matter too much as the | ||
41 | * size is rounded up to a page size when allocating space. | ||
42 | */ | ||
43 | #define NFSD_BUFSIZE ((RPC_MAX_HEADER_WITH_AUTH+26)*XDR_UNIT + NFSSVC_MAXBLKSIZE) | ||
44 | |||
45 | #ifdef CONFIG_NFSD_V4 | ||
46 | # define NFSSVC_XDRSIZE NFS4_SVC_XDRSIZE | ||
47 | #elif defined(CONFIG_NFSD_V3) | ||
48 | # define NFSSVC_XDRSIZE NFS3_SVC_XDRSIZE | ||
49 | #else | ||
50 | # define NFSSVC_XDRSIZE NFS2_SVC_XDRSIZE | ||
51 | #endif | ||
52 | |||
53 | #endif /* __KERNEL__ */ | ||
54 | |||
55 | #endif /* _LINUX_NFSD_CONST_H */ | ||
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h new file mode 100644 index 00000000000..812bc1e160d --- /dev/null +++ b/include/linux/nfsd/syscall.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * include/linux/nfsd/syscall.h | ||
3 | * | ||
4 | * This file holds all declarations for the knfsd syscall interface. | ||
5 | * | ||
6 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | ||
7 | */ | ||
8 | |||
9 | #ifndef NFSD_SYSCALL_H | ||
10 | #define NFSD_SYSCALL_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/nfsd/export.h> | ||
14 | |||
15 | /* | ||
16 | * Version of the syscall interface | ||
17 | */ | ||
18 | #define NFSCTL_VERSION 0x0201 | ||
19 | |||
20 | /* | ||
21 | * These are the commands understood by nfsctl(). | ||
22 | */ | ||
23 | #define NFSCTL_SVC 0 /* This is a server process. */ | ||
24 | #define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */ | ||
25 | #define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */ | ||
26 | #define NFSCTL_EXPORT 3 /* export a file system. */ | ||
27 | #define NFSCTL_UNEXPORT 4 /* unexport a file system. */ | ||
28 | /*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */ | ||
29 | /*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */ | ||
30 | #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ | ||
31 | #define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ | ||
32 | |||
33 | /* SVC */ | ||
34 | struct nfsctl_svc { | ||
35 | unsigned short svc_port; | ||
36 | int svc_nthreads; | ||
37 | }; | ||
38 | |||
39 | /* ADDCLIENT/DELCLIENT */ | ||
40 | struct nfsctl_client { | ||
41 | char cl_ident[NFSCLNT_IDMAX+1]; | ||
42 | int cl_naddr; | ||
43 | struct in_addr cl_addrlist[NFSCLNT_ADDRMAX]; | ||
44 | int cl_fhkeytype; | ||
45 | int cl_fhkeylen; | ||
46 | unsigned char cl_fhkey[NFSCLNT_KEYMAX]; | ||
47 | }; | ||
48 | |||
49 | /* EXPORT/UNEXPORT */ | ||
50 | struct nfsctl_export { | ||
51 | char ex_client[NFSCLNT_IDMAX+1]; | ||
52 | char ex_path[NFS_MAXPATHLEN+1]; | ||
53 | __kernel_old_dev_t ex_dev; | ||
54 | __kernel_ino_t ex_ino; | ||
55 | int ex_flags; | ||
56 | __kernel_uid_t ex_anon_uid; | ||
57 | __kernel_gid_t ex_anon_gid; | ||
58 | }; | ||
59 | |||
60 | /* GETFD */ | ||
61 | struct nfsctl_fdparm { | ||
62 | struct sockaddr gd_addr; | ||
63 | char gd_path[NFS_MAXPATHLEN+1]; | ||
64 | int gd_version; | ||
65 | }; | ||
66 | |||
67 | /* GETFS - GET Filehandle with Size */ | ||
68 | struct nfsctl_fsparm { | ||
69 | struct sockaddr gd_addr; | ||
70 | char gd_path[NFS_MAXPATHLEN+1]; | ||
71 | int gd_maxlen; | ||
72 | }; | ||
73 | |||
74 | /* | ||
75 | * This is the argument union. | ||
76 | */ | ||
77 | struct nfsctl_arg { | ||
78 | int ca_version; /* safeguard */ | ||
79 | union { | ||
80 | struct nfsctl_svc u_svc; | ||
81 | struct nfsctl_client u_client; | ||
82 | struct nfsctl_export u_export; | ||
83 | struct nfsctl_fdparm u_getfd; | ||
84 | struct nfsctl_fsparm u_getfs; | ||
85 | /* | ||
86 | * The following dummy member is needed to preserve binary compatibility | ||
87 | * on platforms where alignof(void*)>alignof(int). It's needed because | ||
88 | * this union used to contain a member (u_umap) which contained a | ||
89 | * pointer. | ||
90 | */ | ||
91 | void *u_ptr; | ||
92 | } u; | ||
93 | #define ca_svc u.u_svc | ||
94 | #define ca_client u.u_client | ||
95 | #define ca_export u.u_export | ||
96 | #define ca_getfd u.u_getfd | ||
97 | #define ca_getfs u.u_getfs | ||
98 | }; | ||
99 | |||
100 | union nfsctl_res { | ||
101 | __u8 cr_getfh[NFS_FHSIZE]; | ||
102 | struct knfsd_fh cr_getfs; | ||
103 | }; | ||
104 | |||
105 | #ifdef __KERNEL__ | ||
106 | /* | ||
107 | * Kernel syscall implementation. | ||
108 | */ | ||
109 | extern int exp_addclient(struct nfsctl_client *ncp); | ||
110 | extern int exp_delclient(struct nfsctl_client *ncp); | ||
111 | extern int exp_export(struct nfsctl_export *nxp); | ||
112 | extern int exp_unexport(struct nfsctl_export *nxp); | ||
113 | |||
114 | #endif /* __KERNEL__ */ | ||
115 | |||
116 | #endif /* NFSD_SYSCALL_H */ | ||
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h new file mode 100644 index 00000000000..8ad70dcac3f --- /dev/null +++ b/include/linux/nl80211.h | |||
@@ -0,0 +1,2433 @@ | |||
1 | #ifndef __LINUX_NL80211_H | ||
2 | #define __LINUX_NL80211_H | ||
3 | /* | ||
4 | * 802.11 netlink interface public header | ||
5 | * | ||
6 | * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> | ||
7 | * Copyright 2008 Michael Wu <flamingice@sourmilk.net> | ||
8 | * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> | ||
9 | * Copyright 2008 Michael Buesch <m@bues.ch> | ||
10 | * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> | ||
11 | * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> | ||
12 | * Copyright 2008 Colin McCabe <colin@cozybit.com> | ||
13 | * | ||
14 | * Permission to use, copy, modify, and/or distribute this software for any | ||
15 | * purpose with or without fee is hereby granted, provided that the above | ||
16 | * copyright notice and this permission notice appear in all copies. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
19 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
20 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
21 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
22 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
23 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
24 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | |||
30 | /** | ||
31 | * DOC: Station handling | ||
32 | * | ||
33 | * Stations are added per interface, but a special case exists with VLAN | ||
34 | * interfaces. When a station is bound to an AP interface, it may be moved | ||
35 | * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN). | ||
36 | * The station is still assumed to belong to the AP interface it was added | ||
37 | * to. | ||
38 | * | ||
39 | * TODO: need more info? | ||
40 | */ | ||
41 | |||
42 | /** | ||
43 | * DOC: Frame transmission/registration support | ||
44 | * | ||
45 | * Frame transmission and registration support exists to allow userspace | ||
46 | * management entities such as wpa_supplicant react to management frames | ||
47 | * that are not being handled by the kernel. This includes, for example, | ||
48 | * certain classes of action frames that cannot be handled in the kernel | ||
49 | * for various reasons. | ||
50 | * | ||
51 | * Frame registration is done on a per-interface basis and registrations | ||
52 | * cannot be removed other than by closing the socket. It is possible to | ||
53 | * specify a registration filter to register, for example, only for a | ||
54 | * certain type of action frame. In particular with action frames, those | ||
55 | * that userspace registers for will not be returned as unhandled by the | ||
56 | * driver, so that the registered application has to take responsibility | ||
57 | * for doing that. | ||
58 | * | ||
59 | * The type of frame that can be registered for is also dependent on the | ||
60 | * driver and interface type. The frame types are advertised in wiphy | ||
61 | * attributes so applications know what to expect. | ||
62 | * | ||
63 | * NOTE: When an interface changes type while registrations are active, | ||
64 | * these registrations are ignored until the interface type is | ||
65 | * changed again. This means that changing the interface type can | ||
66 | * lead to a situation that couldn't otherwise be produced, but | ||
67 | * any such registrations will be dormant in the sense that they | ||
68 | * will not be serviced, i.e. they will not receive any frames. | ||
69 | * | ||
70 | * Frame transmission allows userspace to send for example the required | ||
71 | * responses to action frames. It is subject to some sanity checking, | ||
72 | * but many frames can be transmitted. When a frame was transmitted, its | ||
73 | * status is indicated to the sending socket. | ||
74 | * | ||
75 | * For more technical details, see the corresponding command descriptions | ||
76 | * below. | ||
77 | */ | ||
78 | |||
79 | /** | ||
80 | * DOC: Virtual interface / concurrency capabilities | ||
81 | * | ||
82 | * Some devices are able to operate with virtual MACs, they can have | ||
83 | * more than one virtual interface. The capability handling for this | ||
84 | * is a bit complex though, as there may be a number of restrictions | ||
85 | * on the types of concurrency that are supported. | ||
86 | * | ||
87 | * To start with, each device supports the interface types listed in | ||
88 | * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the | ||
89 | * types there no concurrency is implied. | ||
90 | * | ||
91 | * Once concurrency is desired, more attributes must be observed: | ||
92 | * To start with, since some interface types are purely managed in | ||
93 | * software, like the AP-VLAN type in mac80211 for example, there's | ||
94 | * an additional list of these, they can be added at any time and | ||
95 | * are only restricted by some semantic restrictions (e.g. AP-VLAN | ||
96 | * cannot be added without a corresponding AP interface). This list | ||
97 | * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute. | ||
98 | * | ||
99 | * Further, the list of supported combinations is exported. This is | ||
100 | * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically, | ||
101 | * it exports a list of "groups", and at any point in time the | ||
102 | * interfaces that are currently active must fall into any one of | ||
103 | * the advertised groups. Within each group, there are restrictions | ||
104 | * on the number of interfaces of different types that are supported | ||
105 | * and also the number of different channels, along with potentially | ||
106 | * some other restrictions. See &enum nl80211_if_combination_attrs. | ||
107 | * | ||
108 | * All together, these attributes define the concurrency of virtual | ||
109 | * interfaces that a given device supports. | ||
110 | */ | ||
111 | |||
112 | /** | ||
113 | * enum nl80211_commands - supported nl80211 commands | ||
114 | * | ||
115 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors | ||
116 | * | ||
117 | * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request | ||
118 | * to get a list of all present wiphys. | ||
119 | * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or | ||
120 | * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, | ||
121 | * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, | ||
122 | * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, | ||
123 | * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, | ||
124 | * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. | ||
125 | * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL | ||
126 | * instead, the support here is for backward compatibility only. | ||
127 | * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request | ||
128 | * or rename notification. Has attributes %NL80211_ATTR_WIPHY and | ||
129 | * %NL80211_ATTR_WIPHY_NAME. | ||
130 | * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes | ||
131 | * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME. | ||
132 | * | ||
133 | * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration; | ||
134 | * either a dump request on a %NL80211_ATTR_WIPHY or a specific get | ||
135 | * on an %NL80211_ATTR_IFINDEX is supported. | ||
136 | * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires | ||
137 | * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE. | ||
138 | * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response | ||
139 | * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX, | ||
140 | * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also | ||
141 | * be sent from userspace to request creation of a new virtual interface, | ||
142 | * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and | ||
143 | * %NL80211_ATTR_IFNAME. | ||
144 | * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes | ||
145 | * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from | ||
146 | * userspace to request deletion of a virtual interface, then requires | ||
147 | * attribute %NL80211_ATTR_IFINDEX. | ||
148 | * | ||
149 | * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified | ||
150 | * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. | ||
151 | * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, | ||
152 | * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. | ||
153 | * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, | ||
154 | * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, | ||
155 | * and %NL80211_ATTR_KEY_SEQ attributes. | ||
156 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX | ||
157 | * or %NL80211_ATTR_MAC. | ||
158 | * | ||
159 | * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a | ||
160 | * %NL80222_CMD_NEW_BEACON message) | ||
161 | * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface | ||
162 | * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, | ||
163 | * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. | ||
164 | * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, | ||
165 | * parameters are like for %NL80211_CMD_SET_BEACON. | ||
166 | * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it | ||
167 | * | ||
168 | * @NL80211_CMD_GET_STATION: Get station attributes for station identified by | ||
169 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. | ||
170 | * @NL80211_CMD_SET_STATION: Set station attributes for station identified by | ||
171 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. | ||
172 | * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the | ||
173 | * the interface identified by %NL80211_ATTR_IFINDEX. | ||
174 | * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC | ||
175 | * or, if no MAC address given, all stations, on the interface identified | ||
176 | * by %NL80211_ATTR_IFINDEX. | ||
177 | * | ||
178 | * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to | ||
179 | * destination %NL80211_ATTR_MAC on the interface identified by | ||
180 | * %NL80211_ATTR_IFINDEX. | ||
181 | * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to | ||
182 | * destination %NL80211_ATTR_MAC on the interface identified by | ||
183 | * %NL80211_ATTR_IFINDEX. | ||
184 | * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by | ||
185 | * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP. | ||
186 | * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by | ||
187 | * %NL80211_ATTR_MAC. | ||
188 | * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the | ||
189 | * the interface identified by %NL80211_ATTR_IFINDEX. | ||
190 | * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC | ||
191 | * or, if no MAC address given, all mesh paths, on the interface identified | ||
192 | * by %NL80211_ATTR_IFINDEX. | ||
193 | * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by | ||
194 | * %NL80211_ATTR_IFINDEX. | ||
195 | * | ||
196 | * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set | ||
197 | * regulatory domain. | ||
198 | * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command | ||
199 | * after being queried by the kernel. CRDA replies by sending a regulatory | ||
200 | * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our | ||
201 | * current alpha2 if it found a match. It also provides | ||
202 | * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each | ||
203 | * regulatory rule is a nested set of attributes given by | ||
204 | * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and | ||
205 | * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by | ||
206 | * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and | ||
207 | * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. | ||
208 | * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain | ||
209 | * to the specified ISO/IEC 3166-1 alpha2 country code. The core will | ||
210 | * store this as a valid request and then query userspace for it. | ||
211 | * | ||
212 | * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the | ||
213 | * interface identified by %NL80211_ATTR_IFINDEX | ||
214 | * | ||
215 | * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the | ||
216 | * interface identified by %NL80211_ATTR_IFINDEX | ||
217 | * | ||
218 | * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The | ||
219 | * interface is identified with %NL80211_ATTR_IFINDEX and the management | ||
220 | * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be | ||
221 | * added to the end of the specified management frame is specified with | ||
222 | * %NL80211_ATTR_IE. If the command succeeds, the requested data will be | ||
223 | * added to all specified management frames generated by | ||
224 | * kernel/firmware/driver. | ||
225 | * Note: This command has been removed and it is only reserved at this | ||
226 | * point to avoid re-using existing command number. The functionality this | ||
227 | * command was planned for has been provided with cleaner design with the | ||
228 | * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN, | ||
229 | * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, | ||
230 | * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE. | ||
231 | * | ||
232 | * @NL80211_CMD_GET_SCAN: get scan results | ||
233 | * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters | ||
234 | * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to | ||
235 | * NL80211_CMD_GET_SCAN and on the "scan" multicast group) | ||
236 | * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, | ||
237 | * partial scan results may be available | ||
238 | * | ||
239 | * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain | ||
240 | * intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL. | ||
241 | * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) | ||
242 | * are passed, they are used in the probe requests. For | ||
243 | * broadcast, a broadcast SSID must be passed (ie. an empty | ||
244 | * string). If no SSID is passed, no probe requests are sent and | ||
245 | * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES, | ||
246 | * if passed, define which channels should be scanned; if not | ||
247 | * passed, all channels allowed for the current regulatory domain | ||
248 | * are used. Extra IEs can also be passed from the userspace by | ||
249 | * using the %NL80211_ATTR_IE attribute. | ||
250 | * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT | ||
251 | * if scheduled scan is not running. | ||
252 | * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan | ||
253 | * results available. | ||
254 | * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has | ||
255 | * stopped. The driver may issue this event at any time during a | ||
256 | * scheduled scan. One reason for stopping the scan is if the hardware | ||
257 | * does not support starting an association or a normal scan while running | ||
258 | * a scheduled scan. This event is also sent when the | ||
259 | * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface | ||
260 | * is brought down while a scheduled scan was running. | ||
261 | * | ||
262 | * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation | ||
263 | * or noise level | ||
264 | * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to | ||
265 | * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) | ||
266 | * | ||
267 | * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain | ||
268 | * has been changed and provides details of the request information | ||
269 | * that caused the change such as who initiated the regulatory request | ||
270 | * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx | ||
271 | * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if | ||
272 | * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or | ||
273 | * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain | ||
274 | * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is | ||
275 | * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on | ||
276 | * to (%NL80211_ATTR_REG_ALPHA2). | ||
277 | * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon | ||
278 | * has been found while world roaming thus enabling active scan or | ||
279 | * any mode of operation that initiates TX (beacons) on a channel | ||
280 | * where we would not have been able to do either before. As an example | ||
281 | * if you are world roaming (regulatory domain set to world or if your | ||
282 | * driver is using a custom world roaming regulatory domain) and while | ||
283 | * doing a passive scan on the 5 GHz band you find an AP there (if not | ||
284 | * on a DFS channel) you will now be able to actively scan for that AP | ||
285 | * or use AP mode on your card on that same channel. Note that this will | ||
286 | * never be used for channels 1-11 on the 2 GHz band as they are always | ||
287 | * enabled world wide. This beacon hint is only sent if your device had | ||
288 | * either disabled active scanning or beaconing on a channel. We send to | ||
289 | * userspace the wiphy on which we removed a restriction from | ||
290 | * (%NL80211_ATTR_WIPHY) and the channel on which this occurred | ||
291 | * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER) | ||
292 | * the beacon hint was processed. | ||
293 | * | ||
294 | * @NL80211_CMD_AUTHENTICATE: authentication request and notification. | ||
295 | * This command is used both as a command (request to authenticate) and | ||
296 | * as an event on the "mlme" multicast group indicating completion of the | ||
297 | * authentication process. | ||
298 | * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the | ||
299 | * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and | ||
300 | * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify | ||
301 | * the SSID (mainly for association, but is included in authentication | ||
302 | * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used | ||
303 | * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE | ||
304 | * is used to specify the authentication type. %NL80211_ATTR_IE is used to | ||
305 | * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs) | ||
306 | * to be added to the frame. | ||
307 | * When used as an event, this reports reception of an Authentication | ||
308 | * frame in station and IBSS modes when the local MLME processed the | ||
309 | * frame, i.e., it was for the local STA and was received in correct | ||
310 | * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the | ||
311 | * MLME SAP interface (kernel providing MLME, userspace SME). The | ||
312 | * included %NL80211_ATTR_FRAME attribute contains the management frame | ||
313 | * (including both the header and frame body, but not FCS). This event is | ||
314 | * also used to indicate if the authentication attempt timed out. In that | ||
315 | * case the %NL80211_ATTR_FRAME attribute is replaced with a | ||
316 | * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which | ||
317 | * pending authentication timed out). | ||
318 | * @NL80211_CMD_ASSOCIATE: association request and notification; like | ||
319 | * NL80211_CMD_AUTHENTICATE but for Association and Reassociation | ||
320 | * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, | ||
321 | * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). | ||
322 | * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like | ||
323 | * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to | ||
324 | * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication | ||
325 | * primitives). | ||
326 | * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like | ||
327 | * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to | ||
328 | * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). | ||
329 | * | ||
330 | * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael | ||
331 | * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the | ||
332 | * event includes %NL80211_ATTR_MAC to describe the source MAC address of | ||
333 | * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key | ||
334 | * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and | ||
335 | * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this | ||
336 | * event matches with MLME-MICHAELMICFAILURE.indication() primitive | ||
337 | * | ||
338 | * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a | ||
339 | * FREQ attribute (for the initial frequency if no peer can be found) | ||
340 | * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those | ||
341 | * should be fixed rather than automatically determined. Can only be | ||
342 | * executed on a network interface that is UP, and fixed BSSID/FREQ | ||
343 | * may be rejected. Another optional parameter is the beacon interval, | ||
344 | * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not | ||
345 | * given defaults to 100 TU (102.4ms). | ||
346 | * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is | ||
347 | * determined by the network interface. | ||
348 | * | ||
349 | * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute | ||
350 | * to identify the device, and the TESTDATA blob attribute to pass through | ||
351 | * to the driver. | ||
352 | * | ||
353 | * @NL80211_CMD_CONNECT: connection request and notification; this command | ||
354 | * requests to connect to a specified network but without separating | ||
355 | * auth and assoc steps. For this, you need to specify the SSID in a | ||
356 | * %NL80211_ATTR_SSID attribute, and can optionally specify the association | ||
357 | * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, | ||
358 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, | ||
359 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and | ||
360 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. | ||
361 | * It is also sent as an event, with the BSSID and response IEs when the | ||
362 | * connection is established or failed to be established. This can be | ||
363 | * determined by the STATUS_CODE attribute. | ||
364 | * @NL80211_CMD_ROAM: request that the card roam (currently not implemented), | ||
365 | * sent as an event when the card/driver roamed by itself. | ||
366 | * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify | ||
367 | * userspace that a connection was dropped by the AP or due to other | ||
368 | * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and | ||
369 | * %NL80211_ATTR_REASON_CODE attributes are used. | ||
370 | * | ||
371 | * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices | ||
372 | * associated with this wiphy must be down and will follow. | ||
373 | * | ||
374 | * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified | ||
375 | * channel for the specified amount of time. This can be used to do | ||
376 | * off-channel operations like transmit a Public Action frame and wait for | ||
377 | * a response while being associated to an AP on another channel. | ||
378 | * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus | ||
379 | * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the | ||
380 | * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be | ||
381 | * optionally used to specify additional channel parameters. | ||
382 | * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds | ||
383 | * to remain on the channel. This command is also used as an event to | ||
384 | * notify when the requested duration starts (it may take a while for the | ||
385 | * driver to schedule this time due to other concurrent needs for the | ||
386 | * radio). | ||
387 | * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE) | ||
388 | * that will be included with any events pertaining to this request; | ||
389 | * the cookie is also used to cancel the request. | ||
390 | * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a | ||
391 | * pending remain-on-channel duration if the desired operation has been | ||
392 | * completed prior to expiration of the originally requested duration. | ||
393 | * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the | ||
394 | * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to | ||
395 | * uniquely identify the request. | ||
396 | * This command is also used as an event to notify when a requested | ||
397 | * remain-on-channel duration has expired. | ||
398 | * | ||
399 | * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX | ||
400 | * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface | ||
401 | * and @NL80211_ATTR_TX_RATES the set of allowed rates. | ||
402 | * | ||
403 | * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames | ||
404 | * (via @NL80211_CMD_FRAME) for processing in userspace. This command | ||
405 | * requires an interface index, a frame type attribute (optional for | ||
406 | * backward compatibility reasons, if not given assumes action frames) | ||
407 | * and a match attribute containing the first few bytes of the frame | ||
408 | * that should match, e.g. a single byte for only a category match or | ||
409 | * four bytes for vendor frames including the OUI. The registration | ||
410 | * cannot be dropped, but is removed automatically when the netlink | ||
411 | * socket is closed. Multiple registrations can be made. | ||
412 | * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for | ||
413 | * backward compatibility | ||
414 | * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This | ||
415 | * command is used both as a request to transmit a management frame and | ||
416 | * as an event indicating reception of a frame that was not processed in | ||
417 | * kernel code, but is for us (i.e., which may need to be processed in a | ||
418 | * user space application). %NL80211_ATTR_FRAME is used to specify the | ||
419 | * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and | ||
420 | * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on | ||
421 | * which channel the frame is to be transmitted or was received. If this | ||
422 | * channel is not the current channel (remain-on-channel or the | ||
423 | * operational channel) the device will switch to the given channel and | ||
424 | * transmit the frame, optionally waiting for a response for the time | ||
425 | * specified using %NL80211_ATTR_DURATION. When called, this operation | ||
426 | * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the | ||
427 | * TX status event pertaining to the TX request. | ||
428 | * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this | ||
429 | * command may be used with the corresponding cookie to cancel the wait | ||
430 | * time if it is known that it is no longer necessary. | ||
431 | * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. | ||
432 | * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame | ||
433 | * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies | ||
434 | * the TX command and %NL80211_ATTR_FRAME includes the contents of the | ||
435 | * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged | ||
436 | * the frame. | ||
437 | * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for | ||
438 | * backward compatibility. | ||
439 | * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command | ||
440 | * is used to configure connection quality monitoring notification trigger | ||
441 | * levels. | ||
442 | * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This | ||
443 | * command is used as an event to indicate the that a trigger level was | ||
444 | * reached. | ||
445 | * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ | ||
446 | * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed | ||
447 | * by %NL80211_ATTR_IFINDEX) shall operate on. | ||
448 | * In case multiple channels are supported by the device, the mechanism | ||
449 | * with which it switches channels is implementation-defined. | ||
450 | * When a monitor interface is given, it can only switch channel while | ||
451 | * no other interfaces are operating to avoid disturbing the operation | ||
452 | * of any other interfaces, and other interfaces will again take | ||
453 | * precedence when they are used. | ||
454 | * | ||
455 | * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. | ||
456 | * | ||
457 | * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial | ||
458 | * mesh config parameters may be given. | ||
459 | * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the | ||
460 | * network is determined by the network interface. | ||
461 | * | ||
462 | * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame | ||
463 | * notification. This event is used to indicate that an unprotected | ||
464 | * deauthentication frame was dropped when MFP is in use. | ||
465 | * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame | ||
466 | * notification. This event is used to indicate that an unprotected | ||
467 | * disassociation frame was dropped when MFP is in use. | ||
468 | * | ||
469 | * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a | ||
470 | * beacon or probe response from a compatible mesh peer. This is only | ||
471 | * sent while no station information (sta_info) exists for the new peer | ||
472 | * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set. On | ||
473 | * reception of this notification, userspace may decide to create a new | ||
474 | * station (@NL80211_CMD_NEW_STATION). To stop this notification from | ||
475 | * reoccurring, the userspace authentication daemon may want to create the | ||
476 | * new station with the AUTHENTICATED flag unset and maybe change it later | ||
477 | * depending on the authentication result. | ||
478 | * | ||
479 | * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings. | ||
480 | * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings. | ||
481 | * Since wireless is more complex than wired ethernet, it supports | ||
482 | * various triggers. These triggers can be configured through this | ||
483 | * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For | ||
484 | * more background information, see | ||
485 | * http://wireless.kernel.org/en/users/Documentation/WoWLAN. | ||
486 | * | ||
487 | * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver | ||
488 | * the necessary information for supporting GTK rekey offload. This | ||
489 | * feature is typically used during WoWLAN. The configuration data | ||
490 | * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and | ||
491 | * contains the data in sub-attributes). After rekeying happened, | ||
492 | * this command may also be sent by the driver as an MLME event to | ||
493 | * inform userspace of the new replay counter. | ||
494 | * | ||
495 | * @NL80211_CMD_MAX: highest used command number | ||
496 | * @__NL80211_CMD_AFTER_LAST: internal use | ||
497 | */ | ||
498 | enum nl80211_commands { | ||
499 | /* don't change the order or add anything between, this is ABI! */ | ||
500 | NL80211_CMD_UNSPEC, | ||
501 | |||
502 | NL80211_CMD_GET_WIPHY, /* can dump */ | ||
503 | NL80211_CMD_SET_WIPHY, | ||
504 | NL80211_CMD_NEW_WIPHY, | ||
505 | NL80211_CMD_DEL_WIPHY, | ||
506 | |||
507 | NL80211_CMD_GET_INTERFACE, /* can dump */ | ||
508 | NL80211_CMD_SET_INTERFACE, | ||
509 | NL80211_CMD_NEW_INTERFACE, | ||
510 | NL80211_CMD_DEL_INTERFACE, | ||
511 | |||
512 | NL80211_CMD_GET_KEY, | ||
513 | NL80211_CMD_SET_KEY, | ||
514 | NL80211_CMD_NEW_KEY, | ||
515 | NL80211_CMD_DEL_KEY, | ||
516 | |||
517 | NL80211_CMD_GET_BEACON, | ||
518 | NL80211_CMD_SET_BEACON, | ||
519 | NL80211_CMD_NEW_BEACON, | ||
520 | NL80211_CMD_DEL_BEACON, | ||
521 | |||
522 | NL80211_CMD_GET_STATION, | ||
523 | NL80211_CMD_SET_STATION, | ||
524 | NL80211_CMD_NEW_STATION, | ||
525 | NL80211_CMD_DEL_STATION, | ||
526 | |||
527 | NL80211_CMD_GET_MPATH, | ||
528 | NL80211_CMD_SET_MPATH, | ||
529 | NL80211_CMD_NEW_MPATH, | ||
530 | NL80211_CMD_DEL_MPATH, | ||
531 | |||
532 | NL80211_CMD_SET_BSS, | ||
533 | |||
534 | NL80211_CMD_SET_REG, | ||
535 | NL80211_CMD_REQ_SET_REG, | ||
536 | |||
537 | NL80211_CMD_GET_MESH_CONFIG, | ||
538 | NL80211_CMD_SET_MESH_CONFIG, | ||
539 | |||
540 | NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */, | ||
541 | |||
542 | NL80211_CMD_GET_REG, | ||
543 | |||
544 | NL80211_CMD_GET_SCAN, | ||
545 | NL80211_CMD_TRIGGER_SCAN, | ||
546 | NL80211_CMD_NEW_SCAN_RESULTS, | ||
547 | NL80211_CMD_SCAN_ABORTED, | ||
548 | |||
549 | NL80211_CMD_REG_CHANGE, | ||
550 | |||
551 | NL80211_CMD_AUTHENTICATE, | ||
552 | NL80211_CMD_ASSOCIATE, | ||
553 | NL80211_CMD_DEAUTHENTICATE, | ||
554 | NL80211_CMD_DISASSOCIATE, | ||
555 | |||
556 | NL80211_CMD_MICHAEL_MIC_FAILURE, | ||
557 | |||
558 | NL80211_CMD_REG_BEACON_HINT, | ||
559 | |||
560 | NL80211_CMD_JOIN_IBSS, | ||
561 | NL80211_CMD_LEAVE_IBSS, | ||
562 | |||
563 | NL80211_CMD_TESTMODE, | ||
564 | |||
565 | NL80211_CMD_CONNECT, | ||
566 | NL80211_CMD_ROAM, | ||
567 | NL80211_CMD_DISCONNECT, | ||
568 | |||
569 | NL80211_CMD_SET_WIPHY_NETNS, | ||
570 | |||
571 | NL80211_CMD_GET_SURVEY, | ||
572 | NL80211_CMD_NEW_SURVEY_RESULTS, | ||
573 | |||
574 | NL80211_CMD_SET_PMKSA, | ||
575 | NL80211_CMD_DEL_PMKSA, | ||
576 | NL80211_CMD_FLUSH_PMKSA, | ||
577 | |||
578 | NL80211_CMD_REMAIN_ON_CHANNEL, | ||
579 | NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, | ||
580 | |||
581 | NL80211_CMD_SET_TX_BITRATE_MASK, | ||
582 | |||
583 | NL80211_CMD_REGISTER_FRAME, | ||
584 | NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME, | ||
585 | NL80211_CMD_FRAME, | ||
586 | NL80211_CMD_ACTION = NL80211_CMD_FRAME, | ||
587 | NL80211_CMD_FRAME_TX_STATUS, | ||
588 | NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS, | ||
589 | |||
590 | NL80211_CMD_SET_POWER_SAVE, | ||
591 | NL80211_CMD_GET_POWER_SAVE, | ||
592 | |||
593 | NL80211_CMD_SET_CQM, | ||
594 | NL80211_CMD_NOTIFY_CQM, | ||
595 | |||
596 | NL80211_CMD_SET_CHANNEL, | ||
597 | NL80211_CMD_SET_WDS_PEER, | ||
598 | |||
599 | NL80211_CMD_FRAME_WAIT_CANCEL, | ||
600 | |||
601 | NL80211_CMD_JOIN_MESH, | ||
602 | NL80211_CMD_LEAVE_MESH, | ||
603 | |||
604 | NL80211_CMD_UNPROT_DEAUTHENTICATE, | ||
605 | NL80211_CMD_UNPROT_DISASSOCIATE, | ||
606 | |||
607 | NL80211_CMD_NEW_PEER_CANDIDATE, | ||
608 | |||
609 | NL80211_CMD_GET_WOWLAN, | ||
610 | NL80211_CMD_SET_WOWLAN, | ||
611 | |||
612 | NL80211_CMD_START_SCHED_SCAN, | ||
613 | NL80211_CMD_STOP_SCHED_SCAN, | ||
614 | NL80211_CMD_SCHED_SCAN_RESULTS, | ||
615 | NL80211_CMD_SCHED_SCAN_STOPPED, | ||
616 | |||
617 | NL80211_CMD_SET_REKEY_OFFLOAD, | ||
618 | |||
619 | /* add new commands above here */ | ||
620 | |||
621 | /* used to define NL80211_CMD_MAX below */ | ||
622 | __NL80211_CMD_AFTER_LAST, | ||
623 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 | ||
624 | }; | ||
625 | |||
626 | /* | ||
627 | * Allow user space programs to use #ifdef on new commands by defining them | ||
628 | * here | ||
629 | */ | ||
630 | #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS | ||
631 | #define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE | ||
632 | #define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE | ||
633 | #define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE | ||
634 | #define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE | ||
635 | #define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE | ||
636 | #define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE | ||
637 | #define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT | ||
638 | |||
639 | /* source-level API compatibility */ | ||
640 | #define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG | ||
641 | #define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG | ||
642 | #define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE | ||
643 | |||
644 | /** | ||
645 | * enum nl80211_attrs - nl80211 netlink attributes | ||
646 | * | ||
647 | * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors | ||
648 | * | ||
649 | * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. | ||
650 | * /sys/class/ieee80211/<phyname>/index | ||
651 | * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) | ||
652 | * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters | ||
653 | * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz | ||
654 | * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ | ||
655 | * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included): | ||
656 | * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including | ||
657 | * this attribute) | ||
658 | * NL80211_CHAN_HT20 = HT20 only | ||
659 | * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel | ||
660 | * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel | ||
661 | * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is | ||
662 | * less than or equal to the RTS threshold; allowed range: 1..255; | ||
663 | * dot11ShortRetryLimit; u8 | ||
664 | * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is | ||
665 | * greater than the RTS threshold; allowed range: 1..255; | ||
666 | * dot11ShortLongLimit; u8 | ||
667 | * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum | ||
668 | * length in octets for frames; allowed range: 256..8000, disable | ||
669 | * fragmentation with (u32)-1; dot11FragmentationThreshold; u32 | ||
670 | * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length | ||
671 | * larger than or equal to this use RTS/CTS handshake); allowed range: | ||
672 | * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 | ||
673 | * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11 | ||
674 | * section 7.3.2.9; dot11CoverageClass; u8 | ||
675 | * | ||
676 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on | ||
677 | * @NL80211_ATTR_IFNAME: network interface name | ||
678 | * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype | ||
679 | * | ||
680 | * @NL80211_ATTR_MAC: MAC address (various uses) | ||
681 | * | ||
682 | * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of | ||
683 | * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC | ||
684 | * keys | ||
685 | * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) | ||
686 | * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 | ||
687 | * section 7.3.2.25.1, e.g. 0x000FAC04) | ||
688 | * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and | ||
689 | * CCMP keys, each six bytes in little endian | ||
690 | * | ||
691 | * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU | ||
692 | * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing | ||
693 | * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE | ||
694 | * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE | ||
695 | * | ||
696 | * @NL80211_ATTR_STA_AID: Association ID for the station (u16) | ||
697 | * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of | ||
698 | * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2) | ||
699 | * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by | ||
700 | * IEEE 802.11 7.3.1.6 (u16). | ||
701 | * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported | ||
702 | * rates as defined by IEEE 802.11 7.3.2.2 but without the length | ||
703 | * restriction (at most %NL80211_MAX_SUPP_RATES). | ||
704 | * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station | ||
705 | * to, or the AP interface the station was originally added to to. | ||
706 | * @NL80211_ATTR_STA_INFO: information about a station, part of station info | ||
707 | * given for %NL80211_CMD_GET_STATION, nested attribute containing | ||
708 | * info as possible, see &enum nl80211_sta_info. | ||
709 | * | ||
710 | * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, | ||
711 | * consisting of a nested array. | ||
712 | * | ||
713 | * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). | ||
714 | * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. | ||
715 | * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. | ||
716 | * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path | ||
717 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at | ||
718 | * &enum nl80211_mpath_info. | ||
719 | * | ||
720 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of | ||
721 | * &enum nl80211_mntr_flags. | ||
722 | * | ||
723 | * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the | ||
724 | * current regulatory domain should be set to or is already set to. | ||
725 | * For example, 'CR', for Costa Rica. This attribute is used by the kernel | ||
726 | * to query the CRDA to retrieve one regulatory domain. This attribute can | ||
727 | * also be used by userspace to query the kernel for the currently set | ||
728 | * regulatory domain. We chose an alpha2 as that is also used by the | ||
729 | * IEEE-802.11d country information element to identify a country. | ||
730 | * Users can also simply ask the wireless core to set regulatory domain | ||
731 | * to a specific alpha2. | ||
732 | * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory | ||
733 | * rules. | ||
734 | * | ||
735 | * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) | ||
736 | * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled | ||
737 | * (u8, 0 or 1) | ||
738 | * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled | ||
739 | * (u8, 0 or 1) | ||
740 | * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic | ||
741 | * rates in format defined by IEEE 802.11 7.3.2.2 but without the length | ||
742 | * restriction (at most %NL80211_MAX_SUPP_RATES). | ||
743 | * | ||
744 | * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from | ||
745 | * association request when used with NL80211_CMD_NEW_STATION) | ||
746 | * | ||
747 | * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all | ||
748 | * supported interface types, each a flag attribute with the number | ||
749 | * of the interface mode. | ||
750 | * | ||
751 | * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for | ||
752 | * %NL80211_CMD_SET_MGMT_EXTRA_IE. | ||
753 | * | ||
754 | * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with | ||
755 | * %NL80211_CMD_SET_MGMT_EXTRA_IE). | ||
756 | * | ||
757 | * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with | ||
758 | * a single scan request, a wiphy attribute. | ||
759 | * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can | ||
760 | * scan with a single scheduled scan request, a wiphy attribute. | ||
761 | * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements | ||
762 | * that can be added to a scan request | ||
763 | * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information | ||
764 | * elements that can be added to a scheduled scan request | ||
765 | * | ||
766 | * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) | ||
767 | * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive | ||
768 | * scanning and include a zero-length SSID (wildcard) for wildcard scan | ||
769 | * @NL80211_ATTR_BSS: scan result BSS | ||
770 | * | ||
771 | * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain | ||
772 | * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_* | ||
773 | * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently | ||
774 | * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*) | ||
775 | * | ||
776 | * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies | ||
777 | * an array of command numbers (i.e. a mapping index to command number) | ||
778 | * that the driver for the given wiphy supports. | ||
779 | * | ||
780 | * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header | ||
781 | * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and | ||
782 | * NL80211_CMD_ASSOCIATE events | ||
783 | * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets) | ||
784 | * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type, | ||
785 | * represented as a u32 | ||
786 | * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and | ||
787 | * %NL80211_CMD_DISASSOCIATE, u16 | ||
788 | * | ||
789 | * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as | ||
790 | * a u32 | ||
791 | * | ||
792 | * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change | ||
793 | * due to considerations from a beacon hint. This attribute reflects | ||
794 | * the state of the channel _before_ the beacon hint processing. This | ||
795 | * attributes consists of a nested attribute containing | ||
796 | * NL80211_FREQUENCY_ATTR_* | ||
797 | * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change | ||
798 | * due to considerations from a beacon hint. This attribute reflects | ||
799 | * the state of the channel _after_ the beacon hint processing. This | ||
800 | * attributes consists of a nested attribute containing | ||
801 | * NL80211_FREQUENCY_ATTR_* | ||
802 | * | ||
803 | * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported | ||
804 | * cipher suites | ||
805 | * | ||
806 | * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look | ||
807 | * for other networks on different channels | ||
808 | * | ||
809 | * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this | ||
810 | * is used, e.g., with %NL80211_CMD_AUTHENTICATE event | ||
811 | * | ||
812 | * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is | ||
813 | * used for the association (&enum nl80211_mfp, represented as a u32); | ||
814 | * this attribute can be used | ||
815 | * with %NL80211_CMD_ASSOCIATE request | ||
816 | * | ||
817 | * @NL80211_ATTR_STA_FLAGS2: Attribute containing a | ||
818 | * &struct nl80211_sta_flag_update. | ||
819 | * | ||
820 | * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls | ||
821 | * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in | ||
822 | * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE | ||
823 | * request, the driver will assume that the port is unauthorized until | ||
824 | * authorized by user space. Otherwise, port is marked authorized by | ||
825 | * default in station mode. | ||
826 | * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the | ||
827 | * ethertype that will be used for key negotiation. It can be | ||
828 | * specified with the associate and connect commands. If it is not | ||
829 | * specified, the value defaults to 0x888E (PAE, 802.1X). This | ||
830 | * attribute is also used as a flag in the wiphy information to | ||
831 | * indicate that protocols other than PAE are supported. | ||
832 | * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with | ||
833 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom | ||
834 | * ethertype frames used for key negotiation must not be encrypted. | ||
835 | * | ||
836 | * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. | ||
837 | * We recommend using nested, driver-specific attributes within this. | ||
838 | * | ||
839 | * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT | ||
840 | * event was due to the AP disconnecting the station, and not due to | ||
841 | * a local disconnect request. | ||
842 | * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT | ||
843 | * event (u16) | ||
844 | * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating | ||
845 | * that protected APs should be used. | ||
846 | * | ||
847 | * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to | ||
848 | * indicate which unicast key ciphers will be used with the connection | ||
849 | * (an array of u32). | ||
850 | * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate | ||
851 | * which group key cipher will be used with the connection (a u32). | ||
852 | * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate | ||
853 | * which WPA version(s) the AP we want to associate with is using | ||
854 | * (a u32 with flags from &enum nl80211_wpa_versions). | ||
855 | * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate | ||
856 | * which key management algorithm(s) to use (an array of u32). | ||
857 | * | ||
858 | * @NL80211_ATTR_REQ_IE: (Re)association request information elements as | ||
859 | * sent out by the card, for ROAM and successful CONNECT events. | ||
860 | * @NL80211_ATTR_RESP_IE: (Re)association response information elements as | ||
861 | * sent by peer, for ROAM and successful CONNECT events. | ||
862 | * | ||
863 | * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE | ||
864 | * commands to specify using a reassociate frame | ||
865 | * | ||
866 | * @NL80211_ATTR_KEY: key information in a nested attribute with | ||
867 | * %NL80211_KEY_* sub-attributes | ||
868 | * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect() | ||
869 | * and join_ibss(), key information is in a nested attribute each | ||
870 | * with %NL80211_KEY_* sub-attributes | ||
871 | * | ||
872 | * @NL80211_ATTR_PID: Process ID of a network namespace. | ||
873 | * | ||
874 | * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for | ||
875 | * dumps. This number increases whenever the object list being | ||
876 | * dumped changes, and as such userspace can verify that it has | ||
877 | * obtained a complete and consistent snapshot by verifying that | ||
878 | * all dump messages contain the same generation number. If it | ||
879 | * changed then the list changed and the dump should be repeated | ||
880 | * completely from scratch. | ||
881 | * | ||
882 | * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface | ||
883 | * | ||
884 | * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of | ||
885 | * the survey response for %NL80211_CMD_GET_SURVEY, nested attribute | ||
886 | * containing info as possible, see &enum survey_info. | ||
887 | * | ||
888 | * @NL80211_ATTR_PMKID: PMK material for PMKSA caching. | ||
889 | * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can | ||
890 | * cache, a wiphy attribute. | ||
891 | * | ||
892 | * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32. | ||
893 | * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that | ||
894 | * specifies the maximum duration that can be requested with the | ||
895 | * remain-on-channel operation, in milliseconds, u32. | ||
896 | * | ||
897 | * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects. | ||
898 | * | ||
899 | * @NL80211_ATTR_TX_RATES: Nested set of attributes | ||
900 | * (enum nl80211_tx_rate_attributes) describing TX rates per band. The | ||
901 | * enum nl80211_band value is used as the index (nla_type() of the nested | ||
902 | * data. If a band is not included, it will be configured to allow all | ||
903 | * rates based on negotiated supported rates information. This attribute | ||
904 | * is used with %NL80211_CMD_SET_TX_BITRATE_MASK. | ||
905 | * | ||
906 | * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain | ||
907 | * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. | ||
908 | * @NL80211_ATTR_FRAME_TYPE: A u16 indicating the frame type/subtype for the | ||
909 | * @NL80211_CMD_REGISTER_FRAME command. | ||
910 | * @NL80211_ATTR_TX_FRAME_TYPES: wiphy capability attribute, which is a | ||
911 | * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing | ||
912 | * information about which frame types can be transmitted with | ||
913 | * %NL80211_CMD_FRAME. | ||
914 | * @NL80211_ATTR_RX_FRAME_TYPES: wiphy capability attribute, which is a | ||
915 | * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing | ||
916 | * information about which frame types can be registered for RX. | ||
917 | * | ||
918 | * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was | ||
919 | * acknowledged by the recipient. | ||
920 | * | ||
921 | * @NL80211_ATTR_CQM: connection quality monitor configuration in a | ||
922 | * nested attribute with %NL80211_ATTR_CQM_* sub-attributes. | ||
923 | * | ||
924 | * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command | ||
925 | * is requesting a local authentication/association state change without | ||
926 | * invoking actual management frame exchange. This can be used with | ||
927 | * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE, | ||
928 | * NL80211_CMD_DISASSOCIATE. | ||
929 | * | ||
930 | * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations | ||
931 | * connected to this BSS. | ||
932 | * | ||
933 | * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See | ||
934 | * &enum nl80211_tx_power_setting for possible values. | ||
935 | * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units. | ||
936 | * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING | ||
937 | * for non-automatic settings. | ||
938 | * | ||
939 | * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly | ||
940 | * means support for per-station GTKs. | ||
941 | * | ||
942 | * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting. | ||
943 | * This can be used to mask out antennas which are not attached or should | ||
944 | * not be used for transmitting. If an antenna is not selected in this | ||
945 | * bitmap the hardware is not allowed to transmit on this antenna. | ||
946 | * | ||
947 | * Each bit represents one antenna, starting with antenna 1 at the first | ||
948 | * bit. Depending on which antennas are selected in the bitmap, 802.11n | ||
949 | * drivers can derive which chainmasks to use (if all antennas belonging to | ||
950 | * a particular chain are disabled this chain should be disabled) and if | ||
951 | * a chain has diversity antennas wether diversity should be used or not. | ||
952 | * HT capabilities (STBC, TX Beamforming, Antenna selection) can be | ||
953 | * derived from the available chains after applying the antenna mask. | ||
954 | * Non-802.11n drivers can derive wether to use diversity or not. | ||
955 | * Drivers may reject configurations or RX/TX mask combinations they cannot | ||
956 | * support by returning -EINVAL. | ||
957 | * | ||
958 | * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving. | ||
959 | * This can be used to mask out antennas which are not attached or should | ||
960 | * not be used for receiving. If an antenna is not selected in this bitmap | ||
961 | * the hardware should not be configured to receive on this antenna. | ||
962 | * For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX. | ||
963 | * | ||
964 | * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available | ||
965 | * for configuration as TX antennas via the above parameters. | ||
966 | * | ||
967 | * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available | ||
968 | * for configuration as RX antennas via the above parameters. | ||
969 | * | ||
970 | * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS | ||
971 | * | ||
972 | * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be | ||
973 | * transmitted on another channel when the channel given doesn't match | ||
974 | * the current channel. If the current channel doesn't match and this | ||
975 | * flag isn't set, the frame will be rejected. This is also used as an | ||
976 | * nl80211 capability flag. | ||
977 | * | ||
978 | * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16) | ||
979 | * | ||
980 | * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags | ||
981 | * attributes, specifying what a key should be set as default as. | ||
982 | * See &enum nl80211_key_default_types. | ||
983 | * | ||
984 | * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be | ||
985 | * changed once the mesh is active. | ||
986 | * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute | ||
987 | * containing attributes from &enum nl80211_meshconf_params. | ||
988 | * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver | ||
989 | * allows auth frames in a mesh to be passed to userspace for processing via | ||
990 | * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. | ||
991 | * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as | ||
992 | * defined in &enum nl80211_plink_state. Used when userspace is | ||
993 | * driving the peer link management state machine. | ||
994 | * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. | ||
995 | * | ||
996 | * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy | ||
997 | * capabilities, the supported WoWLAN triggers | ||
998 | * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to | ||
999 | * indicate which WoW triggers should be enabled. This is also | ||
1000 | * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN | ||
1001 | * triggers. | ||
1002 | |||
1003 | * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan | ||
1004 | * cycles, in msecs. | ||
1005 | * | ||
1006 | * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported | ||
1007 | * interface combinations. In each nested item, it contains attributes | ||
1008 | * defined in &enum nl80211_if_combination_attrs. | ||
1009 | * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like | ||
1010 | * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that | ||
1011 | * are managed in software: interfaces of these types aren't subject to | ||
1012 | * any restrictions in their number or combinations. | ||
1013 | * | ||
1014 | * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information | ||
1015 | * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. | ||
1016 | * | ||
1017 | * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, | ||
1018 | * nested array attribute containing an entry for each band, with the entry | ||
1019 | * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but | ||
1020 | * without the length restriction (at most %NL80211_MAX_SUPP_RATES). | ||
1021 | * | ||
1022 | * @NL80211_ATTR_MAX: highest attribute number currently defined | ||
1023 | * @__NL80211_ATTR_AFTER_LAST: internal use | ||
1024 | */ | ||
1025 | enum nl80211_attrs { | ||
1026 | /* don't change the order or add anything between, this is ABI! */ | ||
1027 | NL80211_ATTR_UNSPEC, | ||
1028 | |||
1029 | NL80211_ATTR_WIPHY, | ||
1030 | NL80211_ATTR_WIPHY_NAME, | ||
1031 | |||
1032 | NL80211_ATTR_IFINDEX, | ||
1033 | NL80211_ATTR_IFNAME, | ||
1034 | NL80211_ATTR_IFTYPE, | ||
1035 | |||
1036 | NL80211_ATTR_MAC, | ||
1037 | |||
1038 | NL80211_ATTR_KEY_DATA, | ||
1039 | NL80211_ATTR_KEY_IDX, | ||
1040 | NL80211_ATTR_KEY_CIPHER, | ||
1041 | NL80211_ATTR_KEY_SEQ, | ||
1042 | NL80211_ATTR_KEY_DEFAULT, | ||
1043 | |||
1044 | NL80211_ATTR_BEACON_INTERVAL, | ||
1045 | NL80211_ATTR_DTIM_PERIOD, | ||
1046 | NL80211_ATTR_BEACON_HEAD, | ||
1047 | NL80211_ATTR_BEACON_TAIL, | ||
1048 | |||
1049 | NL80211_ATTR_STA_AID, | ||
1050 | NL80211_ATTR_STA_FLAGS, | ||
1051 | NL80211_ATTR_STA_LISTEN_INTERVAL, | ||
1052 | NL80211_ATTR_STA_SUPPORTED_RATES, | ||
1053 | NL80211_ATTR_STA_VLAN, | ||
1054 | NL80211_ATTR_STA_INFO, | ||
1055 | |||
1056 | NL80211_ATTR_WIPHY_BANDS, | ||
1057 | |||
1058 | NL80211_ATTR_MNTR_FLAGS, | ||
1059 | |||
1060 | NL80211_ATTR_MESH_ID, | ||
1061 | NL80211_ATTR_STA_PLINK_ACTION, | ||
1062 | NL80211_ATTR_MPATH_NEXT_HOP, | ||
1063 | NL80211_ATTR_MPATH_INFO, | ||
1064 | |||
1065 | NL80211_ATTR_BSS_CTS_PROT, | ||
1066 | NL80211_ATTR_BSS_SHORT_PREAMBLE, | ||
1067 | NL80211_ATTR_BSS_SHORT_SLOT_TIME, | ||
1068 | |||
1069 | NL80211_ATTR_HT_CAPABILITY, | ||
1070 | |||
1071 | NL80211_ATTR_SUPPORTED_IFTYPES, | ||
1072 | |||
1073 | NL80211_ATTR_REG_ALPHA2, | ||
1074 | NL80211_ATTR_REG_RULES, | ||
1075 | |||
1076 | NL80211_ATTR_MESH_CONFIG, | ||
1077 | |||
1078 | NL80211_ATTR_BSS_BASIC_RATES, | ||
1079 | |||
1080 | NL80211_ATTR_WIPHY_TXQ_PARAMS, | ||
1081 | NL80211_ATTR_WIPHY_FREQ, | ||
1082 | NL80211_ATTR_WIPHY_CHANNEL_TYPE, | ||
1083 | |||
1084 | NL80211_ATTR_KEY_DEFAULT_MGMT, | ||
1085 | |||
1086 | NL80211_ATTR_MGMT_SUBTYPE, | ||
1087 | NL80211_ATTR_IE, | ||
1088 | |||
1089 | NL80211_ATTR_MAX_NUM_SCAN_SSIDS, | ||
1090 | |||
1091 | NL80211_ATTR_SCAN_FREQUENCIES, | ||
1092 | NL80211_ATTR_SCAN_SSIDS, | ||
1093 | NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */ | ||
1094 | NL80211_ATTR_BSS, | ||
1095 | |||
1096 | NL80211_ATTR_REG_INITIATOR, | ||
1097 | NL80211_ATTR_REG_TYPE, | ||
1098 | |||
1099 | NL80211_ATTR_SUPPORTED_COMMANDS, | ||
1100 | |||
1101 | NL80211_ATTR_FRAME, | ||
1102 | NL80211_ATTR_SSID, | ||
1103 | NL80211_ATTR_AUTH_TYPE, | ||
1104 | NL80211_ATTR_REASON_CODE, | ||
1105 | |||
1106 | NL80211_ATTR_KEY_TYPE, | ||
1107 | |||
1108 | NL80211_ATTR_MAX_SCAN_IE_LEN, | ||
1109 | NL80211_ATTR_CIPHER_SUITES, | ||
1110 | |||
1111 | NL80211_ATTR_FREQ_BEFORE, | ||
1112 | NL80211_ATTR_FREQ_AFTER, | ||
1113 | |||
1114 | NL80211_ATTR_FREQ_FIXED, | ||
1115 | |||
1116 | |||
1117 | NL80211_ATTR_WIPHY_RETRY_SHORT, | ||
1118 | NL80211_ATTR_WIPHY_RETRY_LONG, | ||
1119 | NL80211_ATTR_WIPHY_FRAG_THRESHOLD, | ||
1120 | NL80211_ATTR_WIPHY_RTS_THRESHOLD, | ||
1121 | |||
1122 | NL80211_ATTR_TIMED_OUT, | ||
1123 | |||
1124 | NL80211_ATTR_USE_MFP, | ||
1125 | |||
1126 | NL80211_ATTR_STA_FLAGS2, | ||
1127 | |||
1128 | NL80211_ATTR_CONTROL_PORT, | ||
1129 | |||
1130 | NL80211_ATTR_TESTDATA, | ||
1131 | |||
1132 | NL80211_ATTR_PRIVACY, | ||
1133 | |||
1134 | NL80211_ATTR_DISCONNECTED_BY_AP, | ||
1135 | NL80211_ATTR_STATUS_CODE, | ||
1136 | |||
1137 | NL80211_ATTR_CIPHER_SUITES_PAIRWISE, | ||
1138 | NL80211_ATTR_CIPHER_SUITE_GROUP, | ||
1139 | NL80211_ATTR_WPA_VERSIONS, | ||
1140 | NL80211_ATTR_AKM_SUITES, | ||
1141 | |||
1142 | NL80211_ATTR_REQ_IE, | ||
1143 | NL80211_ATTR_RESP_IE, | ||
1144 | |||
1145 | NL80211_ATTR_PREV_BSSID, | ||
1146 | |||
1147 | NL80211_ATTR_KEY, | ||
1148 | NL80211_ATTR_KEYS, | ||
1149 | |||
1150 | NL80211_ATTR_PID, | ||
1151 | |||
1152 | NL80211_ATTR_4ADDR, | ||
1153 | |||
1154 | NL80211_ATTR_SURVEY_INFO, | ||
1155 | |||
1156 | NL80211_ATTR_PMKID, | ||
1157 | NL80211_ATTR_MAX_NUM_PMKIDS, | ||
1158 | |||
1159 | NL80211_ATTR_DURATION, | ||
1160 | |||
1161 | NL80211_ATTR_COOKIE, | ||
1162 | |||
1163 | NL80211_ATTR_WIPHY_COVERAGE_CLASS, | ||
1164 | |||
1165 | NL80211_ATTR_TX_RATES, | ||
1166 | |||
1167 | NL80211_ATTR_FRAME_MATCH, | ||
1168 | |||
1169 | NL80211_ATTR_ACK, | ||
1170 | |||
1171 | NL80211_ATTR_PS_STATE, | ||
1172 | |||
1173 | NL80211_ATTR_CQM, | ||
1174 | |||
1175 | NL80211_ATTR_LOCAL_STATE_CHANGE, | ||
1176 | |||
1177 | NL80211_ATTR_AP_ISOLATE, | ||
1178 | |||
1179 | NL80211_ATTR_WIPHY_TX_POWER_SETTING, | ||
1180 | NL80211_ATTR_WIPHY_TX_POWER_LEVEL, | ||
1181 | |||
1182 | NL80211_ATTR_TX_FRAME_TYPES, | ||
1183 | NL80211_ATTR_RX_FRAME_TYPES, | ||
1184 | NL80211_ATTR_FRAME_TYPE, | ||
1185 | |||
1186 | NL80211_ATTR_CONTROL_PORT_ETHERTYPE, | ||
1187 | NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, | ||
1188 | |||
1189 | NL80211_ATTR_SUPPORT_IBSS_RSN, | ||
1190 | |||
1191 | NL80211_ATTR_WIPHY_ANTENNA_TX, | ||
1192 | NL80211_ATTR_WIPHY_ANTENNA_RX, | ||
1193 | |||
1194 | NL80211_ATTR_MCAST_RATE, | ||
1195 | |||
1196 | NL80211_ATTR_OFFCHANNEL_TX_OK, | ||
1197 | |||
1198 | NL80211_ATTR_BSS_HT_OPMODE, | ||
1199 | |||
1200 | NL80211_ATTR_KEY_DEFAULT_TYPES, | ||
1201 | |||
1202 | NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, | ||
1203 | |||
1204 | NL80211_ATTR_MESH_SETUP, | ||
1205 | |||
1206 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, | ||
1207 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, | ||
1208 | |||
1209 | NL80211_ATTR_SUPPORT_MESH_AUTH, | ||
1210 | NL80211_ATTR_STA_PLINK_STATE, | ||
1211 | |||
1212 | NL80211_ATTR_WOWLAN_TRIGGERS, | ||
1213 | NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, | ||
1214 | |||
1215 | NL80211_ATTR_SCHED_SCAN_INTERVAL, | ||
1216 | |||
1217 | NL80211_ATTR_INTERFACE_COMBINATIONS, | ||
1218 | NL80211_ATTR_SOFTWARE_IFTYPES, | ||
1219 | |||
1220 | NL80211_ATTR_REKEY_DATA, | ||
1221 | |||
1222 | NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, | ||
1223 | NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, | ||
1224 | |||
1225 | NL80211_ATTR_SCAN_SUPP_RATES, | ||
1226 | |||
1227 | /* add attributes here, update the policy in nl80211.c */ | ||
1228 | |||
1229 | __NL80211_ATTR_AFTER_LAST, | ||
1230 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | ||
1231 | }; | ||
1232 | |||
1233 | /* source-level API compatibility */ | ||
1234 | #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION | ||
1235 | #define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG | ||
1236 | |||
1237 | /* | ||
1238 | * Allow user space programs to use #ifdef on new attributes by defining them | ||
1239 | * here | ||
1240 | */ | ||
1241 | #define NL80211_CMD_CONNECT NL80211_CMD_CONNECT | ||
1242 | #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY | ||
1243 | #define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES | ||
1244 | #define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS | ||
1245 | #define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ | ||
1246 | #define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE | ||
1247 | #define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE | ||
1248 | #define NL80211_ATTR_IE NL80211_ATTR_IE | ||
1249 | #define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR | ||
1250 | #define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE | ||
1251 | #define NL80211_ATTR_FRAME NL80211_ATTR_FRAME | ||
1252 | #define NL80211_ATTR_SSID NL80211_ATTR_SSID | ||
1253 | #define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE | ||
1254 | #define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE | ||
1255 | #define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE | ||
1256 | #define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP | ||
1257 | #define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS | ||
1258 | #define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES | ||
1259 | #define NL80211_ATTR_KEY NL80211_ATTR_KEY | ||
1260 | #define NL80211_ATTR_KEYS NL80211_ATTR_KEYS | ||
1261 | |||
1262 | #define NL80211_MAX_SUPP_RATES 32 | ||
1263 | #define NL80211_MAX_SUPP_REG_RULES 32 | ||
1264 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | ||
1265 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | ||
1266 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 | ||
1267 | #define NL80211_HT_CAPABILITY_LEN 26 | ||
1268 | |||
1269 | #define NL80211_MAX_NR_CIPHER_SUITES 5 | ||
1270 | #define NL80211_MAX_NR_AKM_SUITES 2 | ||
1271 | |||
1272 | /** | ||
1273 | * enum nl80211_iftype - (virtual) interface types | ||
1274 | * | ||
1275 | * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides | ||
1276 | * @NL80211_IFTYPE_ADHOC: independent BSS member | ||
1277 | * @NL80211_IFTYPE_STATION: managed BSS member | ||
1278 | * @NL80211_IFTYPE_AP: access point | ||
1279 | * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces | ||
1280 | * are a bit special in that they must always be tied to a pre-existing | ||
1281 | * AP type interface. | ||
1282 | * @NL80211_IFTYPE_WDS: wireless distribution interface | ||
1283 | * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames | ||
1284 | * @NL80211_IFTYPE_MESH_POINT: mesh point | ||
1285 | * @NL80211_IFTYPE_P2P_CLIENT: P2P client | ||
1286 | * @NL80211_IFTYPE_P2P_GO: P2P group owner | ||
1287 | * @NL80211_IFTYPE_MAX: highest interface type number currently defined | ||
1288 | * @NUM_NL80211_IFTYPES: number of defined interface types | ||
1289 | * | ||
1290 | * These values are used with the %NL80211_ATTR_IFTYPE | ||
1291 | * to set the type of an interface. | ||
1292 | * | ||
1293 | */ | ||
1294 | enum nl80211_iftype { | ||
1295 | NL80211_IFTYPE_UNSPECIFIED, | ||
1296 | NL80211_IFTYPE_ADHOC, | ||
1297 | NL80211_IFTYPE_STATION, | ||
1298 | NL80211_IFTYPE_AP, | ||
1299 | NL80211_IFTYPE_AP_VLAN, | ||
1300 | NL80211_IFTYPE_WDS, | ||
1301 | NL80211_IFTYPE_MONITOR, | ||
1302 | NL80211_IFTYPE_MESH_POINT, | ||
1303 | NL80211_IFTYPE_P2P_CLIENT, | ||
1304 | NL80211_IFTYPE_P2P_GO, | ||
1305 | |||
1306 | /* keep last */ | ||
1307 | NUM_NL80211_IFTYPES, | ||
1308 | NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 | ||
1309 | }; | ||
1310 | |||
1311 | /** | ||
1312 | * enum nl80211_sta_flags - station flags | ||
1313 | * | ||
1314 | * Station flags. When a station is added to an AP interface, it is | ||
1315 | * assumed to be already associated (and hence authenticated.) | ||
1316 | * | ||
1317 | * @__NL80211_STA_FLAG_INVALID: attribute number 0 is reserved | ||
1318 | * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X) | ||
1319 | * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames | ||
1320 | * with short barker preamble | ||
1321 | * @NL80211_STA_FLAG_WME: station is WME/QoS capable | ||
1322 | * @NL80211_STA_FLAG_MFP: station uses management frame protection | ||
1323 | * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated | ||
1324 | * @NL80211_STA_FLAG_MAX: highest station flag number currently defined | ||
1325 | * @__NL80211_STA_FLAG_AFTER_LAST: internal use | ||
1326 | */ | ||
1327 | enum nl80211_sta_flags { | ||
1328 | __NL80211_STA_FLAG_INVALID, | ||
1329 | NL80211_STA_FLAG_AUTHORIZED, | ||
1330 | NL80211_STA_FLAG_SHORT_PREAMBLE, | ||
1331 | NL80211_STA_FLAG_WME, | ||
1332 | NL80211_STA_FLAG_MFP, | ||
1333 | NL80211_STA_FLAG_AUTHENTICATED, | ||
1334 | |||
1335 | /* keep last */ | ||
1336 | __NL80211_STA_FLAG_AFTER_LAST, | ||
1337 | NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 | ||
1338 | }; | ||
1339 | |||
1340 | /** | ||
1341 | * struct nl80211_sta_flag_update - station flags mask/set | ||
1342 | * @mask: mask of station flags to set | ||
1343 | * @set: which values to set them to | ||
1344 | * | ||
1345 | * Both mask and set contain bits as per &enum nl80211_sta_flags. | ||
1346 | */ | ||
1347 | struct nl80211_sta_flag_update { | ||
1348 | __u32 mask; | ||
1349 | __u32 set; | ||
1350 | } __attribute__((packed)); | ||
1351 | |||
1352 | /** | ||
1353 | * enum nl80211_rate_info - bitrate information | ||
1354 | * | ||
1355 | * These attribute types are used with %NL80211_STA_INFO_TXRATE | ||
1356 | * when getting information about the bitrate of a station. | ||
1357 | * | ||
1358 | * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved | ||
1359 | * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s) | ||
1360 | * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8) | ||
1361 | * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate | ||
1362 | * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval | ||
1363 | * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined | ||
1364 | * @__NL80211_RATE_INFO_AFTER_LAST: internal use | ||
1365 | */ | ||
1366 | enum nl80211_rate_info { | ||
1367 | __NL80211_RATE_INFO_INVALID, | ||
1368 | NL80211_RATE_INFO_BITRATE, | ||
1369 | NL80211_RATE_INFO_MCS, | ||
1370 | NL80211_RATE_INFO_40_MHZ_WIDTH, | ||
1371 | NL80211_RATE_INFO_SHORT_GI, | ||
1372 | |||
1373 | /* keep last */ | ||
1374 | __NL80211_RATE_INFO_AFTER_LAST, | ||
1375 | NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1 | ||
1376 | }; | ||
1377 | |||
1378 | /** | ||
1379 | * enum nl80211_sta_bss_param - BSS information collected by STA | ||
1380 | * | ||
1381 | * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM | ||
1382 | * when getting information about the bitrate of a station. | ||
1383 | * | ||
1384 | * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved | ||
1385 | * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag) | ||
1386 | * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled | ||
1387 | * (flag) | ||
1388 | * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled | ||
1389 | * (flag) | ||
1390 | * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8) | ||
1391 | * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16) | ||
1392 | * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined | ||
1393 | * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use | ||
1394 | */ | ||
1395 | enum nl80211_sta_bss_param { | ||
1396 | __NL80211_STA_BSS_PARAM_INVALID, | ||
1397 | NL80211_STA_BSS_PARAM_CTS_PROT, | ||
1398 | NL80211_STA_BSS_PARAM_SHORT_PREAMBLE, | ||
1399 | NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME, | ||
1400 | NL80211_STA_BSS_PARAM_DTIM_PERIOD, | ||
1401 | NL80211_STA_BSS_PARAM_BEACON_INTERVAL, | ||
1402 | |||
1403 | /* keep last */ | ||
1404 | __NL80211_STA_BSS_PARAM_AFTER_LAST, | ||
1405 | NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1 | ||
1406 | }; | ||
1407 | |||
1408 | /** | ||
1409 | * enum nl80211_sta_info - station information | ||
1410 | * | ||
1411 | * These attribute types are used with %NL80211_ATTR_STA_INFO | ||
1412 | * when getting information about a station. | ||
1413 | * | ||
1414 | * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved | ||
1415 | * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) | ||
1416 | * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) | ||
1417 | * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) | ||
1418 | * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) | ||
1419 | * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute | ||
1420 | * containing info as possible, see &enum nl80211_rate_info | ||
1421 | * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) | ||
1422 | * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this | ||
1423 | * station) | ||
1424 | * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) | ||
1425 | * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) | ||
1426 | * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) | ||
1427 | * @NL80211_STA_INFO_LLID: the station's mesh LLID | ||
1428 | * @NL80211_STA_INFO_PLID: the station's mesh PLID | ||
1429 | * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station | ||
1430 | * (see %enum nl80211_plink_state) | ||
1431 | * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested | ||
1432 | * attribute, like NL80211_STA_INFO_TX_BITRATE. | ||
1433 | * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute | ||
1434 | * containing info as possible, see &enum nl80211_sta_bss_param | ||
1435 | * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected | ||
1436 | * @__NL80211_STA_INFO_AFTER_LAST: internal | ||
1437 | * @NL80211_STA_INFO_MAX: highest possible station info attribute | ||
1438 | */ | ||
1439 | enum nl80211_sta_info { | ||
1440 | __NL80211_STA_INFO_INVALID, | ||
1441 | NL80211_STA_INFO_INACTIVE_TIME, | ||
1442 | NL80211_STA_INFO_RX_BYTES, | ||
1443 | NL80211_STA_INFO_TX_BYTES, | ||
1444 | NL80211_STA_INFO_LLID, | ||
1445 | NL80211_STA_INFO_PLID, | ||
1446 | NL80211_STA_INFO_PLINK_STATE, | ||
1447 | NL80211_STA_INFO_SIGNAL, | ||
1448 | NL80211_STA_INFO_TX_BITRATE, | ||
1449 | NL80211_STA_INFO_RX_PACKETS, | ||
1450 | NL80211_STA_INFO_TX_PACKETS, | ||
1451 | NL80211_STA_INFO_TX_RETRIES, | ||
1452 | NL80211_STA_INFO_TX_FAILED, | ||
1453 | NL80211_STA_INFO_SIGNAL_AVG, | ||
1454 | NL80211_STA_INFO_RX_BITRATE, | ||
1455 | NL80211_STA_INFO_BSS_PARAM, | ||
1456 | NL80211_STA_INFO_CONNECTED_TIME, | ||
1457 | |||
1458 | /* keep last */ | ||
1459 | __NL80211_STA_INFO_AFTER_LAST, | ||
1460 | NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 | ||
1461 | }; | ||
1462 | |||
1463 | /** | ||
1464 | * enum nl80211_mpath_flags - nl80211 mesh path flags | ||
1465 | * | ||
1466 | * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active | ||
1467 | * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running | ||
1468 | * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN | ||
1469 | * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set | ||
1470 | * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded | ||
1471 | */ | ||
1472 | enum nl80211_mpath_flags { | ||
1473 | NL80211_MPATH_FLAG_ACTIVE = 1<<0, | ||
1474 | NL80211_MPATH_FLAG_RESOLVING = 1<<1, | ||
1475 | NL80211_MPATH_FLAG_SN_VALID = 1<<2, | ||
1476 | NL80211_MPATH_FLAG_FIXED = 1<<3, | ||
1477 | NL80211_MPATH_FLAG_RESOLVED = 1<<4, | ||
1478 | }; | ||
1479 | |||
1480 | /** | ||
1481 | * enum nl80211_mpath_info - mesh path information | ||
1482 | * | ||
1483 | * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting | ||
1484 | * information about a mesh path. | ||
1485 | * | ||
1486 | * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved | ||
1487 | * @NL80211_MPATH_INFO_FRAME_QLEN: number of queued frames for this destination | ||
1488 | * @NL80211_MPATH_INFO_SN: destination sequence number | ||
1489 | * @NL80211_MPATH_INFO_METRIC: metric (cost) of this mesh path | ||
1490 | * @NL80211_MPATH_INFO_EXPTIME: expiration time for the path, in msec from now | ||
1491 | * @NL80211_MPATH_INFO_FLAGS: mesh path flags, enumerated in | ||
1492 | * &enum nl80211_mpath_flags; | ||
1493 | * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec | ||
1494 | * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries | ||
1495 | * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number | ||
1496 | * currently defind | ||
1497 | * @__NL80211_MPATH_INFO_AFTER_LAST: internal use | ||
1498 | */ | ||
1499 | enum nl80211_mpath_info { | ||
1500 | __NL80211_MPATH_INFO_INVALID, | ||
1501 | NL80211_MPATH_INFO_FRAME_QLEN, | ||
1502 | NL80211_MPATH_INFO_SN, | ||
1503 | NL80211_MPATH_INFO_METRIC, | ||
1504 | NL80211_MPATH_INFO_EXPTIME, | ||
1505 | NL80211_MPATH_INFO_FLAGS, | ||
1506 | NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, | ||
1507 | NL80211_MPATH_INFO_DISCOVERY_RETRIES, | ||
1508 | |||
1509 | /* keep last */ | ||
1510 | __NL80211_MPATH_INFO_AFTER_LAST, | ||
1511 | NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 | ||
1512 | }; | ||
1513 | |||
1514 | /** | ||
1515 | * enum nl80211_band_attr - band attributes | ||
1516 | * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved | ||
1517 | * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band, | ||
1518 | * an array of nested frequency attributes | ||
1519 | * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, | ||
1520 | * an array of nested bitrate attributes | ||
1521 | * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as | ||
1522 | * defined in 802.11n | ||
1523 | * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE | ||
1524 | * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n | ||
1525 | * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n | ||
1526 | * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined | ||
1527 | * @__NL80211_BAND_ATTR_AFTER_LAST: internal use | ||
1528 | */ | ||
1529 | enum nl80211_band_attr { | ||
1530 | __NL80211_BAND_ATTR_INVALID, | ||
1531 | NL80211_BAND_ATTR_FREQS, | ||
1532 | NL80211_BAND_ATTR_RATES, | ||
1533 | |||
1534 | NL80211_BAND_ATTR_HT_MCS_SET, | ||
1535 | NL80211_BAND_ATTR_HT_CAPA, | ||
1536 | NL80211_BAND_ATTR_HT_AMPDU_FACTOR, | ||
1537 | NL80211_BAND_ATTR_HT_AMPDU_DENSITY, | ||
1538 | |||
1539 | /* keep last */ | ||
1540 | __NL80211_BAND_ATTR_AFTER_LAST, | ||
1541 | NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 | ||
1542 | }; | ||
1543 | |||
1544 | #define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA | ||
1545 | |||
1546 | /** | ||
1547 | * enum nl80211_frequency_attr - frequency attributes | ||
1548 | * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved | ||
1549 | * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz | ||
1550 | * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current | ||
1551 | * regulatory domain. | ||
1552 | * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is | ||
1553 | * permitted on this channel in current regulatory domain. | ||
1554 | * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted | ||
1555 | * on this channel in current regulatory domain. | ||
1556 | * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory | ||
1557 | * on this channel in current regulatory domain. | ||
1558 | * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm | ||
1559 | * (100 * dBm). | ||
1560 | * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number | ||
1561 | * currently defined | ||
1562 | * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use | ||
1563 | */ | ||
1564 | enum nl80211_frequency_attr { | ||
1565 | __NL80211_FREQUENCY_ATTR_INVALID, | ||
1566 | NL80211_FREQUENCY_ATTR_FREQ, | ||
1567 | NL80211_FREQUENCY_ATTR_DISABLED, | ||
1568 | NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, | ||
1569 | NL80211_FREQUENCY_ATTR_NO_IBSS, | ||
1570 | NL80211_FREQUENCY_ATTR_RADAR, | ||
1571 | NL80211_FREQUENCY_ATTR_MAX_TX_POWER, | ||
1572 | |||
1573 | /* keep last */ | ||
1574 | __NL80211_FREQUENCY_ATTR_AFTER_LAST, | ||
1575 | NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 | ||
1576 | }; | ||
1577 | |||
1578 | #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER | ||
1579 | |||
1580 | /** | ||
1581 | * enum nl80211_bitrate_attr - bitrate attributes | ||
1582 | * @__NL80211_BITRATE_ATTR_INVALID: attribute number 0 is reserved | ||
1583 | * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps | ||
1584 | * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported | ||
1585 | * in 2.4 GHz band. | ||
1586 | * @NL80211_BITRATE_ATTR_MAX: highest bitrate attribute number | ||
1587 | * currently defined | ||
1588 | * @__NL80211_BITRATE_ATTR_AFTER_LAST: internal use | ||
1589 | */ | ||
1590 | enum nl80211_bitrate_attr { | ||
1591 | __NL80211_BITRATE_ATTR_INVALID, | ||
1592 | NL80211_BITRATE_ATTR_RATE, | ||
1593 | NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, | ||
1594 | |||
1595 | /* keep last */ | ||
1596 | __NL80211_BITRATE_ATTR_AFTER_LAST, | ||
1597 | NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 | ||
1598 | }; | ||
1599 | |||
1600 | /** | ||
1601 | * enum nl80211_initiator - Indicates the initiator of a reg domain request | ||
1602 | * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world | ||
1603 | * regulatory domain. | ||
1604 | * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the | ||
1605 | * regulatory domain. | ||
1606 | * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the | ||
1607 | * wireless core it thinks its knows the regulatory domain we should be in. | ||
1608 | * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an | ||
1609 | * 802.11 country information element with regulatory information it | ||
1610 | * thinks we should consider. cfg80211 only processes the country | ||
1611 | * code from the IE, and relies on the regulatory domain information | ||
1612 | * structure passed by userspace (CRDA) from our wireless-regdb. | ||
1613 | * If a channel is enabled but the country code indicates it should | ||
1614 | * be disabled we disable the channel and re-enable it upon disassociation. | ||
1615 | */ | ||
1616 | enum nl80211_reg_initiator { | ||
1617 | NL80211_REGDOM_SET_BY_CORE, | ||
1618 | NL80211_REGDOM_SET_BY_USER, | ||
1619 | NL80211_REGDOM_SET_BY_DRIVER, | ||
1620 | NL80211_REGDOM_SET_BY_COUNTRY_IE, | ||
1621 | }; | ||
1622 | |||
1623 | /** | ||
1624 | * enum nl80211_reg_type - specifies the type of regulatory domain | ||
1625 | * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains | ||
1626 | * to a specific country. When this is set you can count on the | ||
1627 | * ISO / IEC 3166 alpha2 country code being valid. | ||
1628 | * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory | ||
1629 | * domain. | ||
1630 | * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom | ||
1631 | * driver specific world regulatory domain. These do not apply system-wide | ||
1632 | * and are only applicable to the individual devices which have requested | ||
1633 | * them to be applied. | ||
1634 | * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product | ||
1635 | * of an intersection between two regulatory domains -- the previously | ||
1636 | * set regulatory domain on the system and the last accepted regulatory | ||
1637 | * domain request to be processed. | ||
1638 | */ | ||
1639 | enum nl80211_reg_type { | ||
1640 | NL80211_REGDOM_TYPE_COUNTRY, | ||
1641 | NL80211_REGDOM_TYPE_WORLD, | ||
1642 | NL80211_REGDOM_TYPE_CUSTOM_WORLD, | ||
1643 | NL80211_REGDOM_TYPE_INTERSECTION, | ||
1644 | }; | ||
1645 | |||
1646 | /** | ||
1647 | * enum nl80211_reg_rule_attr - regulatory rule attributes | ||
1648 | * @__NL80211_REG_RULE_ATTR_INVALID: attribute number 0 is reserved | ||
1649 | * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional | ||
1650 | * considerations for a given frequency range. These are the | ||
1651 | * &enum nl80211_reg_rule_flags. | ||
1652 | * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory | ||
1653 | * rule in KHz. This is not a center of frequency but an actual regulatory | ||
1654 | * band edge. | ||
1655 | * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule | ||
1656 | * in KHz. This is not a center a frequency but an actual regulatory | ||
1657 | * band edge. | ||
1658 | * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this | ||
1659 | * frequency range, in KHz. | ||
1660 | * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain | ||
1661 | * for a given frequency range. The value is in mBi (100 * dBi). | ||
1662 | * If you don't have one then don't send this. | ||
1663 | * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for | ||
1664 | * a given frequency range. The value is in mBm (100 * dBm). | ||
1665 | * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number | ||
1666 | * currently defined | ||
1667 | * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use | ||
1668 | */ | ||
1669 | enum nl80211_reg_rule_attr { | ||
1670 | __NL80211_REG_RULE_ATTR_INVALID, | ||
1671 | NL80211_ATTR_REG_RULE_FLAGS, | ||
1672 | |||
1673 | NL80211_ATTR_FREQ_RANGE_START, | ||
1674 | NL80211_ATTR_FREQ_RANGE_END, | ||
1675 | NL80211_ATTR_FREQ_RANGE_MAX_BW, | ||
1676 | |||
1677 | NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, | ||
1678 | NL80211_ATTR_POWER_RULE_MAX_EIRP, | ||
1679 | |||
1680 | /* keep last */ | ||
1681 | __NL80211_REG_RULE_ATTR_AFTER_LAST, | ||
1682 | NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 | ||
1683 | }; | ||
1684 | |||
1685 | /** | ||
1686 | * enum nl80211_reg_rule_flags - regulatory rule flags | ||
1687 | * | ||
1688 | * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed | ||
1689 | * @NL80211_RRF_NO_CCK: CCK modulation not allowed | ||
1690 | * @NL80211_RRF_NO_INDOOR: indoor operation not allowed | ||
1691 | * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed | ||
1692 | * @NL80211_RRF_DFS: DFS support is required to be used | ||
1693 | * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links | ||
1694 | * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links | ||
1695 | * @NL80211_RRF_PASSIVE_SCAN: passive scan is required | ||
1696 | * @NL80211_RRF_NO_IBSS: no IBSS is allowed | ||
1697 | */ | ||
1698 | enum nl80211_reg_rule_flags { | ||
1699 | NL80211_RRF_NO_OFDM = 1<<0, | ||
1700 | NL80211_RRF_NO_CCK = 1<<1, | ||
1701 | NL80211_RRF_NO_INDOOR = 1<<2, | ||
1702 | NL80211_RRF_NO_OUTDOOR = 1<<3, | ||
1703 | NL80211_RRF_DFS = 1<<4, | ||
1704 | NL80211_RRF_PTP_ONLY = 1<<5, | ||
1705 | NL80211_RRF_PTMP_ONLY = 1<<6, | ||
1706 | NL80211_RRF_PASSIVE_SCAN = 1<<7, | ||
1707 | NL80211_RRF_NO_IBSS = 1<<8, | ||
1708 | }; | ||
1709 | |||
1710 | /** | ||
1711 | * enum nl80211_survey_info - survey information | ||
1712 | * | ||
1713 | * These attribute types are used with %NL80211_ATTR_SURVEY_INFO | ||
1714 | * when getting information about a survey. | ||
1715 | * | ||
1716 | * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved | ||
1717 | * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel | ||
1718 | * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) | ||
1719 | * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used | ||
1720 | * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio | ||
1721 | * spent on this channel | ||
1722 | * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary | ||
1723 | * channel was sensed busy (either due to activity or energy detect) | ||
1724 | * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension | ||
1725 | * channel was sensed busy | ||
1726 | * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent | ||
1727 | * receiving data | ||
1728 | * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent | ||
1729 | * transmitting data | ||
1730 | * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number | ||
1731 | * currently defined | ||
1732 | * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use | ||
1733 | */ | ||
1734 | enum nl80211_survey_info { | ||
1735 | __NL80211_SURVEY_INFO_INVALID, | ||
1736 | NL80211_SURVEY_INFO_FREQUENCY, | ||
1737 | NL80211_SURVEY_INFO_NOISE, | ||
1738 | NL80211_SURVEY_INFO_IN_USE, | ||
1739 | NL80211_SURVEY_INFO_CHANNEL_TIME, | ||
1740 | NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, | ||
1741 | NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, | ||
1742 | NL80211_SURVEY_INFO_CHANNEL_TIME_RX, | ||
1743 | NL80211_SURVEY_INFO_CHANNEL_TIME_TX, | ||
1744 | |||
1745 | /* keep last */ | ||
1746 | __NL80211_SURVEY_INFO_AFTER_LAST, | ||
1747 | NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 | ||
1748 | }; | ||
1749 | |||
1750 | /** | ||
1751 | * enum nl80211_mntr_flags - monitor configuration flags | ||
1752 | * | ||
1753 | * Monitor configuration flags. | ||
1754 | * | ||
1755 | * @__NL80211_MNTR_FLAG_INVALID: reserved | ||
1756 | * | ||
1757 | * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS | ||
1758 | * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP | ||
1759 | * @NL80211_MNTR_FLAG_CONTROL: pass control frames | ||
1760 | * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering | ||
1761 | * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. | ||
1762 | * overrides all other flags. | ||
1763 | * | ||
1764 | * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use | ||
1765 | * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag | ||
1766 | */ | ||
1767 | enum nl80211_mntr_flags { | ||
1768 | __NL80211_MNTR_FLAG_INVALID, | ||
1769 | NL80211_MNTR_FLAG_FCSFAIL, | ||
1770 | NL80211_MNTR_FLAG_PLCPFAIL, | ||
1771 | NL80211_MNTR_FLAG_CONTROL, | ||
1772 | NL80211_MNTR_FLAG_OTHER_BSS, | ||
1773 | NL80211_MNTR_FLAG_COOK_FRAMES, | ||
1774 | |||
1775 | /* keep last */ | ||
1776 | __NL80211_MNTR_FLAG_AFTER_LAST, | ||
1777 | NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 | ||
1778 | }; | ||
1779 | |||
1780 | /** | ||
1781 | * enum nl80211_meshconf_params - mesh configuration parameters | ||
1782 | * | ||
1783 | * Mesh configuration parameters. These can be changed while the mesh is | ||
1784 | * active. | ||
1785 | * | ||
1786 | * @__NL80211_MESHCONF_INVALID: internal use | ||
1787 | * | ||
1788 | * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in | ||
1789 | * millisecond units, used by the Peer Link Open message | ||
1790 | * | ||
1791 | * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in | ||
1792 | * millisecond units, used by the peer link management to close a peer link | ||
1793 | * | ||
1794 | * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in | ||
1795 | * millisecond units | ||
1796 | * | ||
1797 | * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed | ||
1798 | * on this mesh interface | ||
1799 | * | ||
1800 | * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link | ||
1801 | * open retries that can be sent to establish a new peer link instance in a | ||
1802 | * mesh | ||
1803 | * | ||
1804 | * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh | ||
1805 | * point. | ||
1806 | * | ||
1807 | * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically | ||
1808 | * open peer links when we detect compatible mesh peers. | ||
1809 | * | ||
1810 | * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames | ||
1811 | * containing a PREQ that an MP can send to a particular destination (path | ||
1812 | * target) | ||
1813 | * | ||
1814 | * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths | ||
1815 | * (in milliseconds) | ||
1816 | * | ||
1817 | * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait | ||
1818 | * until giving up on a path discovery (in milliseconds) | ||
1819 | * | ||
1820 | * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh | ||
1821 | * points receiving a PREQ shall consider the forwarding information from the | ||
1822 | * root to be valid. (TU = time unit) | ||
1823 | * | ||
1824 | * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in | ||
1825 | * TUs) during which an MP can send only one action frame containing a PREQ | ||
1826 | * reference element | ||
1827 | * | ||
1828 | * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) | ||
1829 | * that it takes for an HWMP information element to propagate across the mesh | ||
1830 | * | ||
1831 | * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not | ||
1832 | * | ||
1833 | * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a | ||
1834 | * source mesh point for path selection elements. | ||
1835 | * | ||
1836 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | ||
1837 | * | ||
1838 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | ||
1839 | */ | ||
1840 | enum nl80211_meshconf_params { | ||
1841 | __NL80211_MESHCONF_INVALID, | ||
1842 | NL80211_MESHCONF_RETRY_TIMEOUT, | ||
1843 | NL80211_MESHCONF_CONFIRM_TIMEOUT, | ||
1844 | NL80211_MESHCONF_HOLDING_TIMEOUT, | ||
1845 | NL80211_MESHCONF_MAX_PEER_LINKS, | ||
1846 | NL80211_MESHCONF_MAX_RETRIES, | ||
1847 | NL80211_MESHCONF_TTL, | ||
1848 | NL80211_MESHCONF_AUTO_OPEN_PLINKS, | ||
1849 | NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, | ||
1850 | NL80211_MESHCONF_PATH_REFRESH_TIME, | ||
1851 | NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, | ||
1852 | NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, | ||
1853 | NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, | ||
1854 | NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, | ||
1855 | NL80211_MESHCONF_HWMP_ROOTMODE, | ||
1856 | NL80211_MESHCONF_ELEMENT_TTL, | ||
1857 | |||
1858 | /* keep last */ | ||
1859 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | ||
1860 | NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1 | ||
1861 | }; | ||
1862 | |||
1863 | /** | ||
1864 | * enum nl80211_mesh_setup_params - mesh setup parameters | ||
1865 | * | ||
1866 | * Mesh setup parameters. These are used to start/join a mesh and cannot be | ||
1867 | * changed while the mesh is active. | ||
1868 | * | ||
1869 | * @__NL80211_MESH_SETUP_INVALID: Internal use | ||
1870 | * | ||
1871 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a | ||
1872 | * vendor specific path selection algorithm or disable it to use the default | ||
1873 | * HWMP. | ||
1874 | * | ||
1875 | * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a | ||
1876 | * vendor specific path metric or disable it to use the default Airtime | ||
1877 | * metric. | ||
1878 | * | ||
1879 | * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a | ||
1880 | * robust security network ie, or a vendor specific information element that | ||
1881 | * vendors will use to identify the path selection methods and metrics in use. | ||
1882 | * | ||
1883 | * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication | ||
1884 | * daemon will be authenticating mesh candidates. | ||
1885 | * | ||
1886 | * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication | ||
1887 | * daemon will be securing peer link frames. AMPE is a secured version of Mesh | ||
1888 | * Peering Management (MPM) and is implemented with the assistance of a | ||
1889 | * userspace daemon. When this flag is set, the kernel will send peer | ||
1890 | * management frames to a userspace daemon that will implement AMPE | ||
1891 | * functionality (security capabilities selection, key confirmation, and key | ||
1892 | * management). When the flag is unset (default), the kernel can autonomously | ||
1893 | * complete (unsecured) mesh peering without the need of a userspace daemon. | ||
1894 | * | ||
1895 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number | ||
1896 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use | ||
1897 | */ | ||
1898 | enum nl80211_mesh_setup_params { | ||
1899 | __NL80211_MESH_SETUP_INVALID, | ||
1900 | NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, | ||
1901 | NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, | ||
1902 | NL80211_MESH_SETUP_IE, | ||
1903 | NL80211_MESH_SETUP_USERSPACE_AUTH, | ||
1904 | NL80211_MESH_SETUP_USERSPACE_AMPE, | ||
1905 | |||
1906 | /* keep last */ | ||
1907 | __NL80211_MESH_SETUP_ATTR_AFTER_LAST, | ||
1908 | NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1 | ||
1909 | }; | ||
1910 | |||
1911 | /** | ||
1912 | * enum nl80211_txq_attr - TX queue parameter attributes | ||
1913 | * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved | ||
1914 | * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) | ||
1915 | * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning | ||
1916 | * disabled | ||
1917 | * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form | ||
1918 | * 2^n-1 in the range 1..32767] | ||
1919 | * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form | ||
1920 | * 2^n-1 in the range 1..32767] | ||
1921 | * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255] | ||
1922 | * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal | ||
1923 | * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number | ||
1924 | */ | ||
1925 | enum nl80211_txq_attr { | ||
1926 | __NL80211_TXQ_ATTR_INVALID, | ||
1927 | NL80211_TXQ_ATTR_QUEUE, | ||
1928 | NL80211_TXQ_ATTR_TXOP, | ||
1929 | NL80211_TXQ_ATTR_CWMIN, | ||
1930 | NL80211_TXQ_ATTR_CWMAX, | ||
1931 | NL80211_TXQ_ATTR_AIFS, | ||
1932 | |||
1933 | /* keep last */ | ||
1934 | __NL80211_TXQ_ATTR_AFTER_LAST, | ||
1935 | NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 | ||
1936 | }; | ||
1937 | |||
1938 | enum nl80211_txq_q { | ||
1939 | NL80211_TXQ_Q_VO, | ||
1940 | NL80211_TXQ_Q_VI, | ||
1941 | NL80211_TXQ_Q_BE, | ||
1942 | NL80211_TXQ_Q_BK | ||
1943 | }; | ||
1944 | |||
1945 | enum nl80211_channel_type { | ||
1946 | NL80211_CHAN_NO_HT, | ||
1947 | NL80211_CHAN_HT20, | ||
1948 | NL80211_CHAN_HT40MINUS, | ||
1949 | NL80211_CHAN_HT40PLUS | ||
1950 | }; | ||
1951 | |||
1952 | /** | ||
1953 | * enum nl80211_bss - netlink attributes for a BSS | ||
1954 | * | ||
1955 | * @__NL80211_BSS_INVALID: invalid | ||
1956 | * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets) | ||
1957 | * @NL80211_BSS_FREQUENCY: frequency in MHz (u32) | ||
1958 | * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64) | ||
1959 | * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) | ||
1960 | * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) | ||
1961 | * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the | ||
1962 | * raw information elements from the probe response/beacon (bin); | ||
1963 | * if the %NL80211_BSS_BEACON_IES attribute is present, the IEs here are | ||
1964 | * from a Probe Response frame; otherwise they are from a Beacon frame. | ||
1965 | * However, if the driver does not indicate the source of the IEs, these | ||
1966 | * IEs may be from either frame subtype. | ||
1967 | * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon | ||
1968 | * in mBm (100 * dBm) (s32) | ||
1969 | * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon | ||
1970 | * in unspecified units, scaled to 0..100 (u8) | ||
1971 | * @NL80211_BSS_STATUS: status, if this BSS is "used" | ||
1972 | * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms | ||
1973 | * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information | ||
1974 | * elements from a Beacon frame (bin); not present if no Beacon frame has | ||
1975 | * yet been received | ||
1976 | * @__NL80211_BSS_AFTER_LAST: internal | ||
1977 | * @NL80211_BSS_MAX: highest BSS attribute | ||
1978 | */ | ||
1979 | enum nl80211_bss { | ||
1980 | __NL80211_BSS_INVALID, | ||
1981 | NL80211_BSS_BSSID, | ||
1982 | NL80211_BSS_FREQUENCY, | ||
1983 | NL80211_BSS_TSF, | ||
1984 | NL80211_BSS_BEACON_INTERVAL, | ||
1985 | NL80211_BSS_CAPABILITY, | ||
1986 | NL80211_BSS_INFORMATION_ELEMENTS, | ||
1987 | NL80211_BSS_SIGNAL_MBM, | ||
1988 | NL80211_BSS_SIGNAL_UNSPEC, | ||
1989 | NL80211_BSS_STATUS, | ||
1990 | NL80211_BSS_SEEN_MS_AGO, | ||
1991 | NL80211_BSS_BEACON_IES, | ||
1992 | |||
1993 | /* keep last */ | ||
1994 | __NL80211_BSS_AFTER_LAST, | ||
1995 | NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 | ||
1996 | }; | ||
1997 | |||
1998 | /** | ||
1999 | * enum nl80211_bss_status - BSS "status" | ||
2000 | * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS. | ||
2001 | * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS. | ||
2002 | * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS. | ||
2003 | * | ||
2004 | * The BSS status is a BSS attribute in scan dumps, which | ||
2005 | * indicates the status the interface has wrt. this BSS. | ||
2006 | */ | ||
2007 | enum nl80211_bss_status { | ||
2008 | NL80211_BSS_STATUS_AUTHENTICATED, | ||
2009 | NL80211_BSS_STATUS_ASSOCIATED, | ||
2010 | NL80211_BSS_STATUS_IBSS_JOINED, | ||
2011 | }; | ||
2012 | |||
2013 | /** | ||
2014 | * enum nl80211_auth_type - AuthenticationType | ||
2015 | * | ||
2016 | * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication | ||
2017 | * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) | ||
2018 | * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) | ||
2019 | * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) | ||
2020 | * @__NL80211_AUTHTYPE_NUM: internal | ||
2021 | * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm | ||
2022 | * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by | ||
2023 | * trying multiple times); this is invalid in netlink -- leave out | ||
2024 | * the attribute for this on CONNECT commands. | ||
2025 | */ | ||
2026 | enum nl80211_auth_type { | ||
2027 | NL80211_AUTHTYPE_OPEN_SYSTEM, | ||
2028 | NL80211_AUTHTYPE_SHARED_KEY, | ||
2029 | NL80211_AUTHTYPE_FT, | ||
2030 | NL80211_AUTHTYPE_NETWORK_EAP, | ||
2031 | |||
2032 | /* keep last */ | ||
2033 | __NL80211_AUTHTYPE_NUM, | ||
2034 | NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1, | ||
2035 | NL80211_AUTHTYPE_AUTOMATIC | ||
2036 | }; | ||
2037 | |||
2038 | /** | ||
2039 | * enum nl80211_key_type - Key Type | ||
2040 | * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key | ||
2041 | * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key | ||
2042 | * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS) | ||
2043 | * @NUM_NL80211_KEYTYPES: number of defined key types | ||
2044 | */ | ||
2045 | enum nl80211_key_type { | ||
2046 | NL80211_KEYTYPE_GROUP, | ||
2047 | NL80211_KEYTYPE_PAIRWISE, | ||
2048 | NL80211_KEYTYPE_PEERKEY, | ||
2049 | |||
2050 | NUM_NL80211_KEYTYPES | ||
2051 | }; | ||
2052 | |||
2053 | /** | ||
2054 | * enum nl80211_mfp - Management frame protection state | ||
2055 | * @NL80211_MFP_NO: Management frame protection not used | ||
2056 | * @NL80211_MFP_REQUIRED: Management frame protection required | ||
2057 | */ | ||
2058 | enum nl80211_mfp { | ||
2059 | NL80211_MFP_NO, | ||
2060 | NL80211_MFP_REQUIRED, | ||
2061 | }; | ||
2062 | |||
2063 | enum nl80211_wpa_versions { | ||
2064 | NL80211_WPA_VERSION_1 = 1 << 0, | ||
2065 | NL80211_WPA_VERSION_2 = 1 << 1, | ||
2066 | }; | ||
2067 | |||
2068 | /** | ||
2069 | * enum nl80211_key_default_types - key default types | ||
2070 | * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid | ||
2071 | * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default | ||
2072 | * unicast key | ||
2073 | * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default | ||
2074 | * multicast key | ||
2075 | * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types | ||
2076 | */ | ||
2077 | enum nl80211_key_default_types { | ||
2078 | __NL80211_KEY_DEFAULT_TYPE_INVALID, | ||
2079 | NL80211_KEY_DEFAULT_TYPE_UNICAST, | ||
2080 | NL80211_KEY_DEFAULT_TYPE_MULTICAST, | ||
2081 | |||
2082 | NUM_NL80211_KEY_DEFAULT_TYPES | ||
2083 | }; | ||
2084 | |||
2085 | /** | ||
2086 | * enum nl80211_key_attributes - key attributes | ||
2087 | * @__NL80211_KEY_INVALID: invalid | ||
2088 | * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of | ||
2089 | * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC | ||
2090 | * keys | ||
2091 | * @NL80211_KEY_IDX: key ID (u8, 0-3) | ||
2092 | * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 | ||
2093 | * section 7.3.2.25.1, e.g. 0x000FAC04) | ||
2094 | * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and | ||
2095 | * CCMP keys, each six bytes in little endian | ||
2096 | * @NL80211_KEY_DEFAULT: flag indicating default key | ||
2097 | * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key | ||
2098 | * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not | ||
2099 | * specified the default depends on whether a MAC address was | ||
2100 | * given with the command using the key or not (u32) | ||
2101 | * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags | ||
2102 | * attributes, specifying what a key should be set as default as. | ||
2103 | * See &enum nl80211_key_default_types. | ||
2104 | * @__NL80211_KEY_AFTER_LAST: internal | ||
2105 | * @NL80211_KEY_MAX: highest key attribute | ||
2106 | */ | ||
2107 | enum nl80211_key_attributes { | ||
2108 | __NL80211_KEY_INVALID, | ||
2109 | NL80211_KEY_DATA, | ||
2110 | NL80211_KEY_IDX, | ||
2111 | NL80211_KEY_CIPHER, | ||
2112 | NL80211_KEY_SEQ, | ||
2113 | NL80211_KEY_DEFAULT, | ||
2114 | NL80211_KEY_DEFAULT_MGMT, | ||
2115 | NL80211_KEY_TYPE, | ||
2116 | NL80211_KEY_DEFAULT_TYPES, | ||
2117 | |||
2118 | /* keep last */ | ||
2119 | __NL80211_KEY_AFTER_LAST, | ||
2120 | NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 | ||
2121 | }; | ||
2122 | |||
2123 | /** | ||
2124 | * enum nl80211_tx_rate_attributes - TX rate set attributes | ||
2125 | * @__NL80211_TXRATE_INVALID: invalid | ||
2126 | * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection | ||
2127 | * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with | ||
2128 | * 1 = 500 kbps) but without the IE length restriction (at most | ||
2129 | * %NL80211_MAX_SUPP_RATES in a single array). | ||
2130 | * @__NL80211_TXRATE_AFTER_LAST: internal | ||
2131 | * @NL80211_TXRATE_MAX: highest TX rate attribute | ||
2132 | */ | ||
2133 | enum nl80211_tx_rate_attributes { | ||
2134 | __NL80211_TXRATE_INVALID, | ||
2135 | NL80211_TXRATE_LEGACY, | ||
2136 | |||
2137 | /* keep last */ | ||
2138 | __NL80211_TXRATE_AFTER_LAST, | ||
2139 | NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1 | ||
2140 | }; | ||
2141 | |||
2142 | /** | ||
2143 | * enum nl80211_band - Frequency band | ||
2144 | * @NL80211_BAND_2GHZ: 2.4 GHz ISM band | ||
2145 | * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) | ||
2146 | */ | ||
2147 | enum nl80211_band { | ||
2148 | NL80211_BAND_2GHZ, | ||
2149 | NL80211_BAND_5GHZ, | ||
2150 | }; | ||
2151 | |||
2152 | enum nl80211_ps_state { | ||
2153 | NL80211_PS_DISABLED, | ||
2154 | NL80211_PS_ENABLED, | ||
2155 | }; | ||
2156 | |||
2157 | /** | ||
2158 | * enum nl80211_attr_cqm - connection quality monitor attributes | ||
2159 | * @__NL80211_ATTR_CQM_INVALID: invalid | ||
2160 | * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies | ||
2161 | * the threshold for the RSSI level at which an event will be sent. Zero | ||
2162 | * to disable. | ||
2163 | * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies | ||
2164 | * the minimum amount the RSSI level must change after an event before a | ||
2165 | * new event may be issued (to reduce effects of RSSI oscillation). | ||
2166 | * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event | ||
2167 | * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many | ||
2168 | * consecutive packets were not acknowledged by the peer | ||
2169 | * @__NL80211_ATTR_CQM_AFTER_LAST: internal | ||
2170 | * @NL80211_ATTR_CQM_MAX: highest key attribute | ||
2171 | */ | ||
2172 | enum nl80211_attr_cqm { | ||
2173 | __NL80211_ATTR_CQM_INVALID, | ||
2174 | NL80211_ATTR_CQM_RSSI_THOLD, | ||
2175 | NL80211_ATTR_CQM_RSSI_HYST, | ||
2176 | NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, | ||
2177 | NL80211_ATTR_CQM_PKT_LOSS_EVENT, | ||
2178 | |||
2179 | /* keep last */ | ||
2180 | __NL80211_ATTR_CQM_AFTER_LAST, | ||
2181 | NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1 | ||
2182 | }; | ||
2183 | |||
2184 | /** | ||
2185 | * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event | ||
2186 | * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW: The RSSI level is lower than the | ||
2187 | * configured threshold | ||
2188 | * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the | ||
2189 | * configured threshold | ||
2190 | */ | ||
2191 | enum nl80211_cqm_rssi_threshold_event { | ||
2192 | NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, | ||
2193 | NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, | ||
2194 | }; | ||
2195 | |||
2196 | |||
2197 | /** | ||
2198 | * enum nl80211_tx_power_setting - TX power adjustment | ||
2199 | * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power | ||
2200 | * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter | ||
2201 | * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter | ||
2202 | */ | ||
2203 | enum nl80211_tx_power_setting { | ||
2204 | NL80211_TX_POWER_AUTOMATIC, | ||
2205 | NL80211_TX_POWER_LIMITED, | ||
2206 | NL80211_TX_POWER_FIXED, | ||
2207 | }; | ||
2208 | |||
2209 | /** | ||
2210 | * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute | ||
2211 | * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute | ||
2212 | * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has | ||
2213 | * a zero bit are ignored | ||
2214 | * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have | ||
2215 | * a bit for each byte in the pattern. The lowest-order bit corresponds | ||
2216 | * to the first byte of the pattern, but the bytes of the pattern are | ||
2217 | * in a little-endian-like format, i.e. the 9th byte of the pattern | ||
2218 | * corresponds to the lowest-order bit in the second byte of the mask. | ||
2219 | * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where | ||
2220 | * xx indicates "don't care") would be represented by a pattern of | ||
2221 | * twelve zero bytes, and a mask of "0xed,0x07". | ||
2222 | * Note that the pattern matching is done as though frames were not | ||
2223 | * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked | ||
2224 | * first (including SNAP header unpacking) and then matched. | ||
2225 | * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes | ||
2226 | * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number | ||
2227 | */ | ||
2228 | enum nl80211_wowlan_packet_pattern_attr { | ||
2229 | __NL80211_WOWLAN_PKTPAT_INVALID, | ||
2230 | NL80211_WOWLAN_PKTPAT_MASK, | ||
2231 | NL80211_WOWLAN_PKTPAT_PATTERN, | ||
2232 | |||
2233 | NUM_NL80211_WOWLAN_PKTPAT, | ||
2234 | MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1, | ||
2235 | }; | ||
2236 | |||
2237 | /** | ||
2238 | * struct nl80211_wowlan_pattern_support - pattern support information | ||
2239 | * @max_patterns: maximum number of patterns supported | ||
2240 | * @min_pattern_len: minimum length of each pattern | ||
2241 | * @max_pattern_len: maximum length of each pattern | ||
2242 | * | ||
2243 | * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when | ||
2244 | * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the | ||
2245 | * capability information given by the kernel to userspace. | ||
2246 | */ | ||
2247 | struct nl80211_wowlan_pattern_support { | ||
2248 | __u32 max_patterns; | ||
2249 | __u32 min_pattern_len; | ||
2250 | __u32 max_pattern_len; | ||
2251 | } __attribute__((packed)); | ||
2252 | |||
2253 | /** | ||
2254 | * enum nl80211_wowlan_triggers - WoWLAN trigger definitions | ||
2255 | * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes | ||
2256 | * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put | ||
2257 | * the chip into a special state -- works best with chips that have | ||
2258 | * support for low-power operation already (flag) | ||
2259 | * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect | ||
2260 | * is detected is implementation-specific (flag) | ||
2261 | * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed | ||
2262 | * by 16 repetitions of MAC addr, anywhere in payload) (flag) | ||
2263 | * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns | ||
2264 | * which are passed in an array of nested attributes, each nested attribute | ||
2265 | * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern. | ||
2266 | * Each pattern defines a wakeup packet. The matching is done on the MSDU, | ||
2267 | * i.e. as though the packet was an 802.3 packet, so the pattern matching | ||
2268 | * is done after the packet is converted to the MSDU. | ||
2269 | * | ||
2270 | * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute | ||
2271 | * carrying a &struct nl80211_wowlan_pattern_support. | ||
2272 | * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be | ||
2273 | * used when setting, used only to indicate that GTK rekeying is supported | ||
2274 | * by the device (flag) | ||
2275 | * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if | ||
2276 | * done by the device) (flag) | ||
2277 | * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request | ||
2278 | * packet (flag) | ||
2279 | * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) | ||
2280 | * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released | ||
2281 | * (on devices that have rfkill in the device) (flag) | ||
2282 | * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers | ||
2283 | * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number | ||
2284 | */ | ||
2285 | enum nl80211_wowlan_triggers { | ||
2286 | __NL80211_WOWLAN_TRIG_INVALID, | ||
2287 | NL80211_WOWLAN_TRIG_ANY, | ||
2288 | NL80211_WOWLAN_TRIG_DISCONNECT, | ||
2289 | NL80211_WOWLAN_TRIG_MAGIC_PKT, | ||
2290 | NL80211_WOWLAN_TRIG_PKT_PATTERN, | ||
2291 | NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED, | ||
2292 | NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE, | ||
2293 | NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, | ||
2294 | NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, | ||
2295 | NL80211_WOWLAN_TRIG_RFKILL_RELEASE, | ||
2296 | |||
2297 | /* keep last */ | ||
2298 | NUM_NL80211_WOWLAN_TRIG, | ||
2299 | MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 | ||
2300 | }; | ||
2301 | |||
2302 | /** | ||
2303 | * enum nl80211_iface_limit_attrs - limit attributes | ||
2304 | * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) | ||
2305 | * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that | ||
2306 | * can be chosen from this set of interface types (u32) | ||
2307 | * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a | ||
2308 | * flag attribute for each interface type in this set | ||
2309 | * @NUM_NL80211_IFACE_LIMIT: number of attributes | ||
2310 | * @MAX_NL80211_IFACE_LIMIT: highest attribute number | ||
2311 | */ | ||
2312 | enum nl80211_iface_limit_attrs { | ||
2313 | NL80211_IFACE_LIMIT_UNSPEC, | ||
2314 | NL80211_IFACE_LIMIT_MAX, | ||
2315 | NL80211_IFACE_LIMIT_TYPES, | ||
2316 | |||
2317 | /* keep last */ | ||
2318 | NUM_NL80211_IFACE_LIMIT, | ||
2319 | MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1 | ||
2320 | }; | ||
2321 | |||
2322 | /** | ||
2323 | * enum nl80211_if_combination_attrs -- interface combination attributes | ||
2324 | * | ||
2325 | * @NL80211_IFACE_COMB_UNSPEC: (reserved) | ||
2326 | * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits | ||
2327 | * for given interface types, see &enum nl80211_iface_limit_attrs. | ||
2328 | * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of | ||
2329 | * interfaces that can be created in this group. This number doesn't | ||
2330 | * apply to interfaces purely managed in software, which are listed | ||
2331 | * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE. | ||
2332 | * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that | ||
2333 | * beacon intervals within this group must be all the same even for | ||
2334 | * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt | ||
2335 | * the infrastructure network's beacon interval. | ||
2336 | * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many | ||
2337 | * different channels may be used within this group. | ||
2338 | * @NUM_NL80211_IFACE_COMB: number of attributes | ||
2339 | * @MAX_NL80211_IFACE_COMB: highest attribute number | ||
2340 | * | ||
2341 | * Examples: | ||
2342 | * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2 | ||
2343 | * => allows an AP and a STA that must match BIs | ||
2344 | * | ||
2345 | * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8 | ||
2346 | * => allows 8 of AP/GO | ||
2347 | * | ||
2348 | * numbers = [ #{STA} <= 2 ], channels = 2, max = 2 | ||
2349 | * => allows two STAs on different channels | ||
2350 | * | ||
2351 | * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4 | ||
2352 | * => allows a STA plus three P2P interfaces | ||
2353 | * | ||
2354 | * The list of these four possiblities could completely be contained | ||
2355 | * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate | ||
2356 | * that any of these groups must match. | ||
2357 | * | ||
2358 | * "Combinations" of just a single interface will not be listed here, | ||
2359 | * a single interface of any valid interface type is assumed to always | ||
2360 | * be possible by itself. This means that implicitly, for each valid | ||
2361 | * interface type, the following group always exists: | ||
2362 | * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1 | ||
2363 | */ | ||
2364 | enum nl80211_if_combination_attrs { | ||
2365 | NL80211_IFACE_COMB_UNSPEC, | ||
2366 | NL80211_IFACE_COMB_LIMITS, | ||
2367 | NL80211_IFACE_COMB_MAXNUM, | ||
2368 | NL80211_IFACE_COMB_STA_AP_BI_MATCH, | ||
2369 | NL80211_IFACE_COMB_NUM_CHANNELS, | ||
2370 | |||
2371 | /* keep last */ | ||
2372 | NUM_NL80211_IFACE_COMB, | ||
2373 | MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1 | ||
2374 | }; | ||
2375 | |||
2376 | |||
2377 | /** | ||
2378 | * enum nl80211_plink_state - state of a mesh peer link finite state machine | ||
2379 | * | ||
2380 | * @NL80211_PLINK_LISTEN: initial state, considered the implicit | ||
2381 | * state of non existant mesh peer links | ||
2382 | * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to | ||
2383 | * this mesh peer | ||
2384 | * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received | ||
2385 | * from this mesh peer | ||
2386 | * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been | ||
2387 | * received from this mesh peer | ||
2388 | * @NL80211_PLINK_ESTAB: mesh peer link is established | ||
2389 | * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled | ||
2390 | * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh | ||
2391 | * plink are discarded | ||
2392 | * @NUM_NL80211_PLINK_STATES: number of peer link states | ||
2393 | * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states | ||
2394 | */ | ||
2395 | enum nl80211_plink_state { | ||
2396 | NL80211_PLINK_LISTEN, | ||
2397 | NL80211_PLINK_OPN_SNT, | ||
2398 | NL80211_PLINK_OPN_RCVD, | ||
2399 | NL80211_PLINK_CNF_RCVD, | ||
2400 | NL80211_PLINK_ESTAB, | ||
2401 | NL80211_PLINK_HOLDING, | ||
2402 | NL80211_PLINK_BLOCKED, | ||
2403 | |||
2404 | /* keep last */ | ||
2405 | NUM_NL80211_PLINK_STATES, | ||
2406 | MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 | ||
2407 | }; | ||
2408 | |||
2409 | #define NL80211_KCK_LEN 16 | ||
2410 | #define NL80211_KEK_LEN 16 | ||
2411 | #define NL80211_REPLAY_CTR_LEN 8 | ||
2412 | |||
2413 | /** | ||
2414 | * enum nl80211_rekey_data - attributes for GTK rekey offload | ||
2415 | * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes | ||
2416 | * @NL80211_REKEY_DATA_KEK: key encryption key (binary) | ||
2417 | * @NL80211_REKEY_DATA_KCK: key confirmation key (binary) | ||
2418 | * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary) | ||
2419 | * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal) | ||
2420 | * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal) | ||
2421 | */ | ||
2422 | enum nl80211_rekey_data { | ||
2423 | __NL80211_REKEY_DATA_INVALID, | ||
2424 | NL80211_REKEY_DATA_KEK, | ||
2425 | NL80211_REKEY_DATA_KCK, | ||
2426 | NL80211_REKEY_DATA_REPLAY_CTR, | ||
2427 | |||
2428 | /* keep last */ | ||
2429 | NUM_NL80211_REKEY_DATA, | ||
2430 | MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 | ||
2431 | }; | ||
2432 | |||
2433 | #endif /* __LINUX_NL80211_H */ | ||
diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h new file mode 100644 index 00000000000..da5e1e6862c --- /dev/null +++ b/include/linux/nvhost.h | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * include/linux/nvhost.h | ||
3 | * | ||
4 | * Tegra graphics host driver | ||
5 | * | ||
6 | * Copyright (c) 2009-2012, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_NVHOST_H | ||
24 | #define __LINUX_NVHOST_H | ||
25 | |||
26 | #include <linux/device.h> | ||
27 | #include <linux/types.h> | ||
28 | |||
29 | struct nvhost_master; | ||
30 | |||
31 | #define NVHOST_MODULE_MAX_CLOCKS 3 | ||
32 | #define NVHOST_MODULE_MAX_POWERGATE_IDS 2 | ||
33 | #define NVHOST_MODULE_NO_POWERGATE_IDS .powergate_ids = {-1, -1} | ||
34 | #define NVHOST_DEFAULT_CLOCKGATE_DELAY .clockgate_delay = 25 | ||
35 | |||
36 | struct nvhost_clock { | ||
37 | char *name; | ||
38 | long default_rate; | ||
39 | }; | ||
40 | |||
41 | enum nvhost_device_powerstate_t { | ||
42 | NVHOST_POWER_STATE_DEINIT, | ||
43 | NVHOST_POWER_STATE_RUNNING, | ||
44 | NVHOST_POWER_STATE_CLOCKGATED, | ||
45 | NVHOST_POWER_STATE_POWERGATED | ||
46 | }; | ||
47 | |||
48 | struct nvhost_device { | ||
49 | const char *name; /* Device name */ | ||
50 | struct device dev; /* Linux device struct */ | ||
51 | int id; /* Separates clients of same hw */ | ||
52 | int index; /* Hardware channel number */ | ||
53 | u32 num_resources; /* Number of resources following */ | ||
54 | struct resource *resource; /* Resources (IOMEM in particular) */ | ||
55 | struct resource *reg_mem; | ||
56 | void __iomem *aperture; /* Iomem mapped to kernel */ | ||
57 | |||
58 | u32 syncpts; /* Bitfield of sync points used */ | ||
59 | u32 waitbases; /* Bit field of wait bases */ | ||
60 | u32 modulemutexes; /* Bit field of module mutexes */ | ||
61 | u32 moduleid; /* Module id for user space API */ | ||
62 | |||
63 | u32 class; /* Device class */ | ||
64 | bool exclusive; /* True if only one user at a time */ | ||
65 | bool keepalive; /* Do not power gate when opened */ | ||
66 | bool waitbasesync; /* Force sync of wait bases */ | ||
67 | |||
68 | int powergate_ids[NVHOST_MODULE_MAX_POWERGATE_IDS]; | ||
69 | bool can_powergate; /* True if module can be power gated */ | ||
70 | int clockgate_delay;/* Delay before clock gated */ | ||
71 | int powergate_delay;/* Delay before power gated */ | ||
72 | struct nvhost_clock clocks[NVHOST_MODULE_MAX_CLOCKS];/* Clock names */ | ||
73 | |||
74 | struct delayed_work powerstate_down;/* Power state management */ | ||
75 | int num_clks; /* Number of clocks opened for dev */ | ||
76 | struct clk *clk[NVHOST_MODULE_MAX_CLOCKS]; | ||
77 | struct mutex lock; /* Power management lock */ | ||
78 | int powerstate; /* Current power state */ | ||
79 | int refcount; /* Number of tasks active */ | ||
80 | wait_queue_head_t idle_wq; /* Work queue for idle */ | ||
81 | struct list_head client_list; /* List of clients and rate requests */ | ||
82 | |||
83 | struct nvhost_channel *channel; /* Channel assigned for the module */ | ||
84 | |||
85 | /* Allocates a context handler for the device */ | ||
86 | struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt, | ||
87 | u32 waitbase, struct nvhost_channel *ch); | ||
88 | /* Preparing for power off. Used for context save. */ | ||
89 | int (*prepare_poweroff)(struct nvhost_device *dev); | ||
90 | /* Finalize power on. Can be used for context restore. */ | ||
91 | void (*finalize_poweron)(struct nvhost_device *dev); | ||
92 | /* Device is busy. */ | ||
93 | void (*busy)(struct nvhost_device *); | ||
94 | /* Device is idle. */ | ||
95 | void (*idle)(struct nvhost_device *); | ||
96 | /* Device is going to be suspended */ | ||
97 | void (*suspend)(struct nvhost_device *); | ||
98 | /* Device is initialized */ | ||
99 | void (*init)(struct nvhost_device *dev); | ||
100 | /* Device is de-initialized. */ | ||
101 | void (*deinit)(struct nvhost_device *dev); | ||
102 | }; | ||
103 | |||
104 | /* Register device to nvhost bus */ | ||
105 | extern int nvhost_device_register(struct nvhost_device *); | ||
106 | |||
107 | /* Deregister device from nvhost bus */ | ||
108 | extern void nvhost_device_unregister(struct nvhost_device *); | ||
109 | |||
110 | extern struct bus_type nvhost_bus_type; | ||
111 | |||
112 | struct nvhost_driver { | ||
113 | int (*probe)(struct nvhost_device *); | ||
114 | int (*remove)(struct nvhost_device *); | ||
115 | void (*shutdown)(struct nvhost_device *); | ||
116 | int (*suspend)(struct nvhost_device *, pm_message_t state); | ||
117 | int (*resume)(struct nvhost_device *); | ||
118 | struct device_driver driver; | ||
119 | }; | ||
120 | |||
121 | extern int nvhost_driver_register(struct nvhost_driver *); | ||
122 | extern void nvhost_driver_unregister(struct nvhost_driver *); | ||
123 | extern struct resource *nvhost_get_resource(struct nvhost_device *, | ||
124 | unsigned int, unsigned int); | ||
125 | extern int nvhost_get_irq(struct nvhost_device *, unsigned int); | ||
126 | extern struct resource *nvhost_get_resource_byname(struct nvhost_device *, | ||
127 | unsigned int, const char *); | ||
128 | extern int nvhost_get_irq_byname(struct nvhost_device *, const char *); | ||
129 | |||
130 | #define to_nvhost_device(x) container_of((x), struct nvhost_device, dev) | ||
131 | #define to_nvhost_driver(drv) (container_of((drv), struct nvhost_driver, \ | ||
132 | driver)) | ||
133 | |||
134 | #define nvhost_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) | ||
135 | #define nvhost_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data)) | ||
136 | static inline struct nvhost_master *nvhost_get_host(struct nvhost_device *_dev) | ||
137 | { | ||
138 | return (_dev->dev.parent) ? \ | ||
139 | ((struct nvhost_master *) dev_get_drvdata(_dev->dev.parent)) : \ | ||
140 | ((struct nvhost_master *) dev_get_drvdata(&(_dev->dev))); | ||
141 | } | ||
142 | |||
143 | int nvhost_bus_add_host(struct nvhost_master *host); | ||
144 | |||
145 | #endif | ||
diff --git a/include/linux/nvhost_ioctl.h b/include/linux/nvhost_ioctl.h new file mode 100644 index 00000000000..3f6eabf522f --- /dev/null +++ b/include/linux/nvhost_ioctl.h | |||
@@ -0,0 +1,213 @@ | |||
1 | /* | ||
2 | * include/linux/nvhost_ioctl.h | ||
3 | * | ||
4 | * Tegra graphics host driver | ||
5 | * | ||
6 | * Copyright (c) 2009-2012, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_NVHOST_IOCTL_H | ||
24 | #define __LINUX_NVHOST_IOCTL_H | ||
25 | |||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/types.h> | ||
28 | |||
29 | #if !defined(__KERNEL__) | ||
30 | #define __user | ||
31 | #endif | ||
32 | |||
33 | #define NVHOST_INVALID_SYNCPOINT 0xFFFFFFFF | ||
34 | #define NVHOST_NO_TIMEOUT (-1) | ||
35 | #define NVHOST_NO_CONTEXT 0x0 | ||
36 | #define NVHOST_IOCTL_MAGIC 'H' | ||
37 | #define NVHOST_PRIORITY_LOW 50 | ||
38 | #define NVHOST_PRIORITY_MEDIUM 100 | ||
39 | #define NVHOST_PRIORITY_HIGH 150 | ||
40 | |||
41 | /* version 0 header (used with write() submit interface) */ | ||
42 | struct nvhost_submit_hdr { | ||
43 | __u32 syncpt_id; | ||
44 | __u32 syncpt_incrs; | ||
45 | __u32 num_cmdbufs; | ||
46 | __u32 num_relocs; | ||
47 | }; | ||
48 | |||
49 | #define NVHOST_SUBMIT_VERSION_V0 0x0 | ||
50 | #define NVHOST_SUBMIT_VERSION_V1 0x1 | ||
51 | #define NVHOST_SUBMIT_VERSION_V2 0x2 | ||
52 | #define NVHOST_SUBMIT_VERSION_MAX_SUPPORTED NVHOST_SUBMIT_VERSION_V2 | ||
53 | |||
54 | /* version 1 header (used with ioctl() submit interface) */ | ||
55 | struct nvhost_submit_hdr_ext { | ||
56 | __u32 syncpt_id; /* version 0 fields */ | ||
57 | __u32 syncpt_incrs; | ||
58 | __u32 num_cmdbufs; | ||
59 | __u32 num_relocs; | ||
60 | __u32 submit_version; /* version 1 fields */ | ||
61 | __u32 num_waitchks; | ||
62 | __u32 waitchk_mask; | ||
63 | __u32 pad[5]; /* future expansion */ | ||
64 | }; | ||
65 | |||
66 | struct nvhost_cmdbuf { | ||
67 | __u32 mem; | ||
68 | __u32 offset; | ||
69 | __u32 words; | ||
70 | }; | ||
71 | |||
72 | struct nvhost_reloc { | ||
73 | __u32 cmdbuf_mem; | ||
74 | __u32 cmdbuf_offset; | ||
75 | __u32 target; | ||
76 | __u32 target_offset; | ||
77 | }; | ||
78 | |||
79 | struct nvhost_reloc_shift { | ||
80 | __u32 shift; | ||
81 | }; | ||
82 | |||
83 | struct nvhost_waitchk { | ||
84 | __u32 mem; | ||
85 | __u32 offset; | ||
86 | __u32 syncpt_id; | ||
87 | __u32 thresh; | ||
88 | }; | ||
89 | |||
90 | struct nvhost_get_param_args { | ||
91 | __u32 value; | ||
92 | }; | ||
93 | |||
94 | struct nvhost_set_nvmap_fd_args { | ||
95 | __u32 fd; | ||
96 | }; | ||
97 | |||
98 | struct nvhost_read_3d_reg_args { | ||
99 | __u32 offset; | ||
100 | __u32 value; | ||
101 | }; | ||
102 | |||
103 | struct nvhost_clk_rate_args { | ||
104 | __u64 rate; | ||
105 | }; | ||
106 | |||
107 | struct nvhost_set_timeout_args { | ||
108 | __u32 timeout; | ||
109 | }; | ||
110 | |||
111 | struct nvhost_set_priority_args { | ||
112 | __u32 priority; | ||
113 | }; | ||
114 | |||
115 | #define NVHOST_IOCTL_CHANNEL_FLUSH \ | ||
116 | _IOR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_get_param_args) | ||
117 | #define NVHOST_IOCTL_CHANNEL_GET_SYNCPOINTS \ | ||
118 | _IOR(NVHOST_IOCTL_MAGIC, 2, struct nvhost_get_param_args) | ||
119 | #define NVHOST_IOCTL_CHANNEL_GET_WAITBASES \ | ||
120 | _IOR(NVHOST_IOCTL_MAGIC, 3, struct nvhost_get_param_args) | ||
121 | #define NVHOST_IOCTL_CHANNEL_GET_MODMUTEXES \ | ||
122 | _IOR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_get_param_args) | ||
123 | #define NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD \ | ||
124 | _IOW(NVHOST_IOCTL_MAGIC, 5, struct nvhost_set_nvmap_fd_args) | ||
125 | #define NVHOST_IOCTL_CHANNEL_NULL_KICKOFF \ | ||
126 | _IOR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_get_param_args) | ||
127 | #define NVHOST_IOCTL_CHANNEL_SUBMIT_EXT \ | ||
128 | _IOW(NVHOST_IOCTL_MAGIC, 7, struct nvhost_submit_hdr_ext) | ||
129 | #define NVHOST_IOCTL_CHANNEL_READ_3D_REG \ | ||
130 | _IOWR(NVHOST_IOCTL_MAGIC, 8, struct nvhost_read_3d_reg_args) | ||
131 | #define NVHOST_IOCTL_CHANNEL_GET_CLK_RATE \ | ||
132 | _IOR(NVHOST_IOCTL_MAGIC, 9, struct nvhost_clk_rate_args) | ||
133 | #define NVHOST_IOCTL_CHANNEL_SET_CLK_RATE \ | ||
134 | _IOW(NVHOST_IOCTL_MAGIC, 10, struct nvhost_clk_rate_args) | ||
135 | #define NVHOST_IOCTL_CHANNEL_SET_TIMEOUT \ | ||
136 | _IOW(NVHOST_IOCTL_MAGIC, 11, struct nvhost_set_timeout_args) | ||
137 | #define NVHOST_IOCTL_CHANNEL_GET_TIMEDOUT \ | ||
138 | _IOR(NVHOST_IOCTL_MAGIC, 12, struct nvhost_get_param_args) | ||
139 | #define NVHOST_IOCTL_CHANNEL_SET_PRIORITY \ | ||
140 | _IOW(NVHOST_IOCTL_MAGIC, 13, struct nvhost_set_priority_args) | ||
141 | #define NVHOST_IOCTL_CHANNEL_LAST \ | ||
142 | _IOC_NR(NVHOST_IOCTL_CHANNEL_SET_PRIORITY) | ||
143 | #define NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvhost_submit_hdr_ext) | ||
144 | |||
145 | struct nvhost_ctrl_syncpt_read_args { | ||
146 | __u32 id; | ||
147 | __u32 value; | ||
148 | }; | ||
149 | |||
150 | struct nvhost_ctrl_syncpt_incr_args { | ||
151 | __u32 id; | ||
152 | }; | ||
153 | |||
154 | struct nvhost_ctrl_syncpt_wait_args { | ||
155 | __u32 id; | ||
156 | __u32 thresh; | ||
157 | __s32 timeout; | ||
158 | }; | ||
159 | |||
160 | struct nvhost_ctrl_syncpt_waitex_args { | ||
161 | __u32 id; | ||
162 | __u32 thresh; | ||
163 | __s32 timeout; | ||
164 | __u32 value; | ||
165 | }; | ||
166 | |||
167 | struct nvhost_ctrl_module_mutex_args { | ||
168 | __u32 id; | ||
169 | __u32 lock; | ||
170 | }; | ||
171 | |||
172 | enum nvhost_module_id { | ||
173 | NVHOST_MODULE_NONE = -1, | ||
174 | NVHOST_MODULE_DISPLAY_A = 0, | ||
175 | NVHOST_MODULE_DISPLAY_B, | ||
176 | NVHOST_MODULE_VI, | ||
177 | NVHOST_MODULE_ISP, | ||
178 | NVHOST_MODULE_MPE, | ||
179 | }; | ||
180 | |||
181 | struct nvhost_ctrl_module_regrdwr_args { | ||
182 | __u32 id; | ||
183 | __u32 num_offsets; | ||
184 | __u32 block_size; | ||
185 | __u32 *offsets; | ||
186 | __u32 *values; | ||
187 | __u32 write; | ||
188 | }; | ||
189 | |||
190 | #define NVHOST_IOCTL_CTRL_SYNCPT_READ \ | ||
191 | _IOWR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_ctrl_syncpt_read_args) | ||
192 | #define NVHOST_IOCTL_CTRL_SYNCPT_INCR \ | ||
193 | _IOW(NVHOST_IOCTL_MAGIC, 2, struct nvhost_ctrl_syncpt_incr_args) | ||
194 | #define NVHOST_IOCTL_CTRL_SYNCPT_WAIT \ | ||
195 | _IOW(NVHOST_IOCTL_MAGIC, 3, struct nvhost_ctrl_syncpt_wait_args) | ||
196 | |||
197 | #define NVHOST_IOCTL_CTRL_MODULE_MUTEX \ | ||
198 | _IOWR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_ctrl_module_mutex_args) | ||
199 | #define NVHOST_IOCTL_CTRL_MODULE_REGRDWR \ | ||
200 | _IOWR(NVHOST_IOCTL_MAGIC, 5, struct nvhost_ctrl_module_regrdwr_args) | ||
201 | |||
202 | #define NVHOST_IOCTL_CTRL_SYNCPT_WAITEX \ | ||
203 | _IOWR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_ctrl_syncpt_waitex_args) | ||
204 | |||
205 | #define NVHOST_IOCTL_CTRL_GET_VERSION \ | ||
206 | _IOR(NVHOST_IOCTL_MAGIC, 7, struct nvhost_get_param_args) | ||
207 | |||
208 | #define NVHOST_IOCTL_CTRL_LAST \ | ||
209 | _IOC_NR(NVHOST_IOCTL_CTRL_GET_VERSION) | ||
210 | #define NVHOST_IOCTL_CTRL_MAX_ARG_SIZE \ | ||
211 | sizeof(struct nvhost_ctrl_module_regrdwr_args) | ||
212 | |||
213 | #endif | ||
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h new file mode 100644 index 00000000000..9e3e70f78ae --- /dev/null +++ b/include/linux/of_spi.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * OpenFirmware SPI support routines | ||
3 | * Copyright (C) 2008 Secret Lab Technologies Ltd. | ||
4 | * | ||
5 | * Support routines for deriving SPI device attachments from the device | ||
6 | * tree. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_OF_SPI_H | ||
10 | #define __LINUX_OF_SPI_H | ||
11 | |||
12 | #include <linux/spi/spi.h> | ||
13 | |||
14 | #if defined(CONFIG_OF_SPI) || defined(CONFIG_OF_SPI_MODULE) | ||
15 | extern void of_register_spi_devices(struct spi_master *master); | ||
16 | #else | ||
17 | static inline void of_register_spi_devices(struct spi_master *master) | ||
18 | { | ||
19 | return; | ||
20 | } | ||
21 | #endif /* CONFIG_OF_SPI */ | ||
22 | |||
23 | #endif /* __LINUX_OF_SPI */ | ||
diff --git a/include/linux/omap3isp.h b/include/linux/omap3isp.h new file mode 100644 index 00000000000..b6111f8cd49 --- /dev/null +++ b/include/linux/omap3isp.h | |||
@@ -0,0 +1,646 @@ | |||
1 | /* | ||
2 | * omap3isp.h | ||
3 | * | ||
4 | * TI OMAP3 ISP - User-space API | ||
5 | * | ||
6 | * Copyright (C) 2010 Nokia Corporation | ||
7 | * Copyright (C) 2009 Texas Instruments, Inc. | ||
8 | * | ||
9 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
10 | * Sakari Ailus <sakari.ailus@iki.fi> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
24 | * 02110-1301 USA | ||
25 | */ | ||
26 | |||
27 | #ifndef OMAP3_ISP_USER_H | ||
28 | #define OMAP3_ISP_USER_H | ||
29 | |||
30 | #include <linux/types.h> | ||
31 | |||
32 | /* | ||
33 | * Private IOCTLs | ||
34 | * | ||
35 | * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration | ||
36 | * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration | ||
37 | * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration | ||
38 | * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration | ||
39 | * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration | ||
40 | * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data | ||
41 | * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module | ||
42 | */ | ||
43 | |||
44 | #define VIDIOC_OMAP3ISP_CCDC_CFG \ | ||
45 | _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config) | ||
46 | #define VIDIOC_OMAP3ISP_PRV_CFG \ | ||
47 | _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config) | ||
48 | #define VIDIOC_OMAP3ISP_AEWB_CFG \ | ||
49 | _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config) | ||
50 | #define VIDIOC_OMAP3ISP_HIST_CFG \ | ||
51 | _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config) | ||
52 | #define VIDIOC_OMAP3ISP_AF_CFG \ | ||
53 | _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config) | ||
54 | #define VIDIOC_OMAP3ISP_STAT_REQ \ | ||
55 | _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data) | ||
56 | #define VIDIOC_OMAP3ISP_STAT_EN \ | ||
57 | _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long) | ||
58 | |||
59 | /* | ||
60 | * Events | ||
61 | * | ||
62 | * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready | ||
63 | * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready | ||
64 | * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready | ||
65 | * V4L2_EVENT_OMAP3ISP_HS_VS: Horizontal/vertical synchronization detected | ||
66 | */ | ||
67 | |||
68 | #define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100) | ||
69 | #define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1) | ||
70 | #define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2) | ||
71 | #define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3) | ||
72 | #define V4L2_EVENT_OMAP3ISP_HS_VS (V4L2_EVENT_OMAP3ISP_CLASS | 0x4) | ||
73 | |||
74 | struct omap3isp_stat_event_status { | ||
75 | __u32 frame_number; | ||
76 | __u16 config_counter; | ||
77 | __u8 buf_err; | ||
78 | }; | ||
79 | |||
80 | /* AE/AWB related structures and flags*/ | ||
81 | |||
82 | /* H3A Range Constants */ | ||
83 | #define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023 | ||
84 | #define OMAP3ISP_AEWB_MIN_WIN_H 2 | ||
85 | #define OMAP3ISP_AEWB_MAX_WIN_H 256 | ||
86 | #define OMAP3ISP_AEWB_MIN_WIN_W 6 | ||
87 | #define OMAP3ISP_AEWB_MAX_WIN_W 256 | ||
88 | #define OMAP3ISP_AEWB_MIN_WINVC 1 | ||
89 | #define OMAP3ISP_AEWB_MIN_WINHC 1 | ||
90 | #define OMAP3ISP_AEWB_MAX_WINVC 128 | ||
91 | #define OMAP3ISP_AEWB_MAX_WINHC 36 | ||
92 | #define OMAP3ISP_AEWB_MAX_WINSTART 4095 | ||
93 | #define OMAP3ISP_AEWB_MIN_SUB_INC 2 | ||
94 | #define OMAP3ISP_AEWB_MAX_SUB_INC 32 | ||
95 | #define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600 | ||
96 | |||
97 | #define OMAP3ISP_AF_IIRSH_MIN 0 | ||
98 | #define OMAP3ISP_AF_IIRSH_MAX 4095 | ||
99 | #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1 | ||
100 | #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36 | ||
101 | #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1 | ||
102 | #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128 | ||
103 | #define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2 | ||
104 | #define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32 | ||
105 | #define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2 | ||
106 | #define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256 | ||
107 | #define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16 | ||
108 | #define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256 | ||
109 | #define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1 | ||
110 | #define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095 | ||
111 | #define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0 | ||
112 | #define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095 | ||
113 | #define OMAP3ISP_AF_THRESHOLD_MAX 255 | ||
114 | #define OMAP3ISP_AF_COEF_MAX 4095 | ||
115 | #define OMAP3ISP_AF_PAXEL_SIZE 48 | ||
116 | #define OMAP3ISP_AF_MAX_BUF_SIZE 221184 | ||
117 | |||
118 | /** | ||
119 | * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values | ||
120 | * saturation_limit: Saturation limit. | ||
121 | * @win_height: Window Height. Range 2 - 256, even values only. | ||
122 | * @win_width: Window Width. Range 6 - 256, even values only. | ||
123 | * @ver_win_count: Vertical Window Count. Range 1 - 128. | ||
124 | * @hor_win_count: Horizontal Window Count. Range 1 - 36. | ||
125 | * @ver_win_start: Vertical Window Start. Range 0 - 4095. | ||
126 | * @hor_win_start: Horizontal Window Start. Range 0 - 4095. | ||
127 | * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095. | ||
128 | * @blk_win_height: Black Window Height. Range 2 - 256, even values only. | ||
129 | * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even | ||
130 | * values only. | ||
131 | * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even | ||
132 | * values only. | ||
133 | * @alaw_enable: AEW ALAW EN flag. | ||
134 | */ | ||
135 | struct omap3isp_h3a_aewb_config { | ||
136 | /* | ||
137 | * Common fields. | ||
138 | * They should be the first ones and must be in the same order as in | ||
139 | * ispstat_generic_config struct. | ||
140 | */ | ||
141 | __u32 buf_size; | ||
142 | __u16 config_counter; | ||
143 | |||
144 | /* Private fields */ | ||
145 | __u16 saturation_limit; | ||
146 | __u16 win_height; | ||
147 | __u16 win_width; | ||
148 | __u16 ver_win_count; | ||
149 | __u16 hor_win_count; | ||
150 | __u16 ver_win_start; | ||
151 | __u16 hor_win_start; | ||
152 | __u16 blk_ver_win_start; | ||
153 | __u16 blk_win_height; | ||
154 | __u16 subsample_ver_inc; | ||
155 | __u16 subsample_hor_inc; | ||
156 | __u8 alaw_enable; | ||
157 | }; | ||
158 | |||
159 | /** | ||
160 | * struct omap3isp_stat_data - Statistic data sent to or received from user | ||
161 | * @ts: Timestamp of returned framestats. | ||
162 | * @buf: Pointer to pass to user. | ||
163 | * @frame_number: Frame number of requested stats. | ||
164 | * @cur_frame: Current frame number being processed. | ||
165 | * @config_counter: Number of the configuration associated with the data. | ||
166 | */ | ||
167 | struct omap3isp_stat_data { | ||
168 | struct timeval ts; | ||
169 | void __user *buf; | ||
170 | __u32 buf_size; | ||
171 | __u16 frame_number; | ||
172 | __u16 cur_frame; | ||
173 | __u16 config_counter; | ||
174 | }; | ||
175 | |||
176 | |||
177 | /* Histogram related structs */ | ||
178 | |||
179 | /* Flags for number of bins */ | ||
180 | #define OMAP3ISP_HIST_BINS_32 0 | ||
181 | #define OMAP3ISP_HIST_BINS_64 1 | ||
182 | #define OMAP3ISP_HIST_BINS_128 2 | ||
183 | #define OMAP3ISP_HIST_BINS_256 3 | ||
184 | |||
185 | /* Number of bins * 4 colors * 4-bytes word */ | ||
186 | #define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4) | ||
187 | |||
188 | #define OMAP3ISP_HIST_MEM_SIZE 1024 | ||
189 | #define OMAP3ISP_HIST_MIN_REGIONS 1 | ||
190 | #define OMAP3ISP_HIST_MAX_REGIONS 4 | ||
191 | #define OMAP3ISP_HIST_MAX_WB_GAIN 255 | ||
192 | #define OMAP3ISP_HIST_MIN_WB_GAIN 0 | ||
193 | #define OMAP3ISP_HIST_MAX_BIT_WIDTH 14 | ||
194 | #define OMAP3ISP_HIST_MIN_BIT_WIDTH 8 | ||
195 | #define OMAP3ISP_HIST_MAX_WG 4 | ||
196 | #define OMAP3ISP_HIST_MAX_BUF_SIZE 4096 | ||
197 | |||
198 | /* Source */ | ||
199 | #define OMAP3ISP_HIST_SOURCE_CCDC 0 | ||
200 | #define OMAP3ISP_HIST_SOURCE_MEM 1 | ||
201 | |||
202 | /* CFA pattern */ | ||
203 | #define OMAP3ISP_HIST_CFA_BAYER 0 | ||
204 | #define OMAP3ISP_HIST_CFA_FOVEONX3 1 | ||
205 | |||
206 | struct omap3isp_hist_region { | ||
207 | __u16 h_start; | ||
208 | __u16 h_end; | ||
209 | __u16 v_start; | ||
210 | __u16 v_end; | ||
211 | }; | ||
212 | |||
213 | struct omap3isp_hist_config { | ||
214 | /* | ||
215 | * Common fields. | ||
216 | * They should be the first ones and must be in the same order as in | ||
217 | * ispstat_generic_config struct. | ||
218 | */ | ||
219 | __u32 buf_size; | ||
220 | __u16 config_counter; | ||
221 | |||
222 | __u8 num_acc_frames; /* Num of image frames to be processed and | ||
223 | accumulated for each histogram frame */ | ||
224 | __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */ | ||
225 | __u8 cfa; /* BAYER or FOVEON X3 */ | ||
226 | __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */ | ||
227 | __u8 num_regions; /* number of regions to be configured */ | ||
228 | struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS]; | ||
229 | }; | ||
230 | |||
231 | /* Auto Focus related structs */ | ||
232 | |||
233 | #define OMAP3ISP_AF_NUM_COEF 11 | ||
234 | |||
235 | enum omap3isp_h3a_af_fvmode { | ||
236 | OMAP3ISP_AF_MODE_SUMMED = 0, | ||
237 | OMAP3ISP_AF_MODE_PEAK = 1 | ||
238 | }; | ||
239 | |||
240 | /* Red, Green, and blue pixel location in the AF windows */ | ||
241 | enum omap3isp_h3a_af_rgbpos { | ||
242 | OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */ | ||
243 | OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */ | ||
244 | OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */ | ||
245 | OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */ | ||
246 | OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */ | ||
247 | OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */ | ||
248 | }; | ||
249 | |||
250 | /* Contains the information regarding the Horizontal Median Filter */ | ||
251 | struct omap3isp_h3a_af_hmf { | ||
252 | __u8 enable; /* Status of Horizontal Median Filter */ | ||
253 | __u8 threshold; /* Threshold Value for Horizontal Median Filter */ | ||
254 | }; | ||
255 | |||
256 | /* Contains the information regarding the IIR Filters */ | ||
257 | struct omap3isp_h3a_af_iir { | ||
258 | __u16 h_start; /* IIR horizontal start */ | ||
259 | __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */ | ||
260 | __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */ | ||
261 | }; | ||
262 | |||
263 | /* Contains the information regarding the Paxels Structure in AF Engine */ | ||
264 | struct omap3isp_h3a_af_paxel { | ||
265 | __u16 h_start; /* Horizontal Start Position */ | ||
266 | __u16 v_start; /* Vertical Start Position */ | ||
267 | __u8 width; /* Width of the Paxel */ | ||
268 | __u8 height; /* Height of the Paxel */ | ||
269 | __u8 h_cnt; /* Horizontal Count */ | ||
270 | __u8 v_cnt; /* vertical Count */ | ||
271 | __u8 line_inc; /* Line Increment */ | ||
272 | }; | ||
273 | |||
274 | /* Contains the parameters required for hardware set up of AF Engine */ | ||
275 | struct omap3isp_h3a_af_config { | ||
276 | /* | ||
277 | * Common fields. | ||
278 | * They should be the first ones and must be in the same order as in | ||
279 | * ispstat_generic_config struct. | ||
280 | */ | ||
281 | __u32 buf_size; | ||
282 | __u16 config_counter; | ||
283 | |||
284 | struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */ | ||
285 | struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */ | ||
286 | struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */ | ||
287 | enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */ | ||
288 | enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */ | ||
289 | __u8 alaw_enable; /* AF ALAW status */ | ||
290 | }; | ||
291 | |||
292 | /* ISP CCDC structs */ | ||
293 | |||
294 | /* Abstraction layer CCDC configurations */ | ||
295 | #define OMAP3ISP_CCDC_ALAW (1 << 0) | ||
296 | #define OMAP3ISP_CCDC_LPF (1 << 1) | ||
297 | #define OMAP3ISP_CCDC_BLCLAMP (1 << 2) | ||
298 | #define OMAP3ISP_CCDC_BCOMP (1 << 3) | ||
299 | #define OMAP3ISP_CCDC_FPC (1 << 4) | ||
300 | #define OMAP3ISP_CCDC_CULL (1 << 5) | ||
301 | #define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7) | ||
302 | #define OMAP3ISP_CCDC_TBL_LSC (1 << 8) | ||
303 | |||
304 | #define OMAP3ISP_RGB_MAX 3 | ||
305 | |||
306 | /* Enumeration constants for Alaw input width */ | ||
307 | enum omap3isp_alaw_ipwidth { | ||
308 | OMAP3ISP_ALAW_BIT12_3 = 0x3, | ||
309 | OMAP3ISP_ALAW_BIT11_2 = 0x4, | ||
310 | OMAP3ISP_ALAW_BIT10_1 = 0x5, | ||
311 | OMAP3ISP_ALAW_BIT9_0 = 0x6 | ||
312 | }; | ||
313 | |||
314 | /** | ||
315 | * struct omap3isp_ccdc_lsc_config - LSC configuration | ||
316 | * @offset: Table Offset of the gain table. | ||
317 | * @gain_mode_n: Vertical dimension of a paxel in LSC configuration. | ||
318 | * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration. | ||
319 | * @gain_format: Gain table format. | ||
320 | * @fmtsph: Start pixel horizontal from start of the HS sync pulse. | ||
321 | * @fmtlnh: Number of pixels in horizontal direction to use for the data | ||
322 | * reformatter. | ||
323 | * @fmtslv: Start line from start of VS sync pulse for the data reformatter. | ||
324 | * @fmtlnv: Number of lines in vertical direction for the data reformatter. | ||
325 | * @initial_x: X position, in pixels, of the first active pixel in reference | ||
326 | * to the first active paxel. Must be an even number. | ||
327 | * @initial_y: Y position, in pixels, of the first active pixel in reference | ||
328 | * to the first active paxel. Must be an even number. | ||
329 | * @size: Size of LSC gain table. Filled when loaded from userspace. | ||
330 | */ | ||
331 | struct omap3isp_ccdc_lsc_config { | ||
332 | __u16 offset; | ||
333 | __u8 gain_mode_n; | ||
334 | __u8 gain_mode_m; | ||
335 | __u8 gain_format; | ||
336 | __u16 fmtsph; | ||
337 | __u16 fmtlnh; | ||
338 | __u16 fmtslv; | ||
339 | __u16 fmtlnv; | ||
340 | __u8 initial_x; | ||
341 | __u8 initial_y; | ||
342 | __u32 size; | ||
343 | }; | ||
344 | |||
345 | /** | ||
346 | * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract | ||
347 | * @obgain: Optical black average gain. | ||
348 | * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample. | ||
349 | * @oblines: Optical Black Sample lines. | ||
350 | * @oblen: Optical Black Sample Length. | ||
351 | * @dcsubval: Digital Black Clamp subtract value. | ||
352 | */ | ||
353 | struct omap3isp_ccdc_bclamp { | ||
354 | __u8 obgain; | ||
355 | __u8 obstpixel; | ||
356 | __u8 oblines; | ||
357 | __u8 oblen; | ||
358 | __u16 dcsubval; | ||
359 | }; | ||
360 | |||
361 | /** | ||
362 | * struct omap3isp_ccdc_fpc - Faulty Pixels Correction | ||
363 | * @fpnum: Number of faulty pixels to be corrected in the frame. | ||
364 | * @fpcaddr: Memory address of the FPC Table | ||
365 | */ | ||
366 | struct omap3isp_ccdc_fpc { | ||
367 | __u16 fpnum; | ||
368 | __u32 fpcaddr; | ||
369 | }; | ||
370 | |||
371 | /** | ||
372 | * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters | ||
373 | * @b_mg: B/Mg pixels. 2's complement. -128 to +127. | ||
374 | * @gb_g: Gb/G pixels. 2's complement. -128 to +127. | ||
375 | * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127. | ||
376 | * @r_ye: R/Ye pixels. 2's complement. -128 to +127. | ||
377 | */ | ||
378 | struct omap3isp_ccdc_blcomp { | ||
379 | __u8 b_mg; | ||
380 | __u8 gb_g; | ||
381 | __u8 gr_cy; | ||
382 | __u8 r_ye; | ||
383 | }; | ||
384 | |||
385 | /** | ||
386 | * omap3isp_ccdc_culling - Culling parameters | ||
387 | * @v_pattern: Vertical culling pattern. | ||
388 | * @h_odd: Horizontal Culling pattern for odd lines. | ||
389 | * @h_even: Horizontal Culling pattern for even lines. | ||
390 | */ | ||
391 | struct omap3isp_ccdc_culling { | ||
392 | __u8 v_pattern; | ||
393 | __u16 h_odd; | ||
394 | __u16 h_even; | ||
395 | }; | ||
396 | |||
397 | /** | ||
398 | * omap3isp_ccdc_update_config - CCDC configuration | ||
399 | * @update: Specifies which CCDC registers should be updated. | ||
400 | * @flag: Specifies which CCDC functions should be enabled. | ||
401 | * @alawip: Enable/Disable A-Law compression. | ||
402 | * @bclamp: Black clamp control register. | ||
403 | * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement. | ||
404 | * @fpc: Number of faulty pixels corrected in the frame, address of FPC table. | ||
405 | * @cull: Cull control register. | ||
406 | * @lsc: Pointer to LSC gain table. | ||
407 | */ | ||
408 | struct omap3isp_ccdc_update_config { | ||
409 | __u16 update; | ||
410 | __u16 flag; | ||
411 | enum omap3isp_alaw_ipwidth alawip; | ||
412 | struct omap3isp_ccdc_bclamp __user *bclamp; | ||
413 | struct omap3isp_ccdc_blcomp __user *blcomp; | ||
414 | struct omap3isp_ccdc_fpc __user *fpc; | ||
415 | struct omap3isp_ccdc_lsc_config __user *lsc_cfg; | ||
416 | struct omap3isp_ccdc_culling __user *cull; | ||
417 | __u8 __user *lsc; | ||
418 | }; | ||
419 | |||
420 | /* Preview configurations */ | ||
421 | #define OMAP3ISP_PREV_LUMAENH (1 << 0) | ||
422 | #define OMAP3ISP_PREV_INVALAW (1 << 1) | ||
423 | #define OMAP3ISP_PREV_HRZ_MED (1 << 2) | ||
424 | #define OMAP3ISP_PREV_CFA (1 << 3) | ||
425 | #define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4) | ||
426 | #define OMAP3ISP_PREV_WB (1 << 5) | ||
427 | #define OMAP3ISP_PREV_BLKADJ (1 << 6) | ||
428 | #define OMAP3ISP_PREV_RGB2RGB (1 << 7) | ||
429 | #define OMAP3ISP_PREV_COLOR_CONV (1 << 8) | ||
430 | #define OMAP3ISP_PREV_YC_LIMIT (1 << 9) | ||
431 | #define OMAP3ISP_PREV_DEFECT_COR (1 << 10) | ||
432 | #define OMAP3ISP_PREV_GAMMABYPASS (1 << 11) | ||
433 | #define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12) | ||
434 | #define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13) | ||
435 | #define OMAP3ISP_PREV_LENS_SHADING (1 << 14) | ||
436 | #define OMAP3ISP_PREV_NF (1 << 15) | ||
437 | #define OMAP3ISP_PREV_GAMMA (1 << 16) | ||
438 | |||
439 | #define OMAP3ISP_PREV_NF_TBL_SIZE 64 | ||
440 | #define OMAP3ISP_PREV_CFA_TBL_SIZE 576 | ||
441 | #define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024 | ||
442 | #define OMAP3ISP_PREV_YENH_TBL_SIZE 128 | ||
443 | |||
444 | #define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4 | ||
445 | |||
446 | /** | ||
447 | * struct omap3isp_prev_hmed - Horizontal Median Filter | ||
448 | * @odddist: Distance between consecutive pixels of same color in the odd line. | ||
449 | * @evendist: Distance between consecutive pixels of same color in the even | ||
450 | * line. | ||
451 | * @thres: Horizontal median filter threshold. | ||
452 | */ | ||
453 | struct omap3isp_prev_hmed { | ||
454 | __u8 odddist; | ||
455 | __u8 evendist; | ||
456 | __u8 thres; | ||
457 | }; | ||
458 | |||
459 | /* | ||
460 | * Enumeration for CFA Formats supported by preview | ||
461 | */ | ||
462 | enum omap3isp_cfa_fmt { | ||
463 | OMAP3ISP_CFAFMT_BAYER, | ||
464 | OMAP3ISP_CFAFMT_SONYVGA, | ||
465 | OMAP3ISP_CFAFMT_RGBFOVEON, | ||
466 | OMAP3ISP_CFAFMT_DNSPL, | ||
467 | OMAP3ISP_CFAFMT_HONEYCOMB, | ||
468 | OMAP3ISP_CFAFMT_RRGGBBFOVEON | ||
469 | }; | ||
470 | |||
471 | /** | ||
472 | * struct omap3isp_prev_cfa - CFA Interpolation | ||
473 | * @format: CFA Format Enum value supported by preview. | ||
474 | * @gradthrs_vert: CFA Gradient Threshold - Vertical. | ||
475 | * @gradthrs_horz: CFA Gradient Threshold - Horizontal. | ||
476 | * @table: Pointer to the CFA table. | ||
477 | */ | ||
478 | struct omap3isp_prev_cfa { | ||
479 | enum omap3isp_cfa_fmt format; | ||
480 | __u8 gradthrs_vert; | ||
481 | __u8 gradthrs_horz; | ||
482 | __u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE]; | ||
483 | }; | ||
484 | |||
485 | /** | ||
486 | * struct omap3isp_prev_csup - Chrominance Suppression | ||
487 | * @gain: Gain. | ||
488 | * @thres: Threshold. | ||
489 | * @hypf_en: Flag to enable/disable the High Pass Filter. | ||
490 | */ | ||
491 | struct omap3isp_prev_csup { | ||
492 | __u8 gain; | ||
493 | __u8 thres; | ||
494 | __u8 hypf_en; | ||
495 | }; | ||
496 | |||
497 | /** | ||
498 | * struct omap3isp_prev_wbal - White Balance | ||
499 | * @dgain: Digital gain (U10Q8). | ||
500 | * @coef3: White balance gain - COEF 3 (U8Q5). | ||
501 | * @coef2: White balance gain - COEF 2 (U8Q5). | ||
502 | * @coef1: White balance gain - COEF 1 (U8Q5). | ||
503 | * @coef0: White balance gain - COEF 0 (U8Q5). | ||
504 | */ | ||
505 | struct omap3isp_prev_wbal { | ||
506 | __u16 dgain; | ||
507 | __u8 coef3; | ||
508 | __u8 coef2; | ||
509 | __u8 coef1; | ||
510 | __u8 coef0; | ||
511 | }; | ||
512 | |||
513 | /** | ||
514 | * struct omap3isp_prev_blkadj - Black Level Adjustment | ||
515 | * @red: Black level offset adjustment for Red in 2's complement format | ||
516 | * @green: Black level offset adjustment for Green in 2's complement format | ||
517 | * @blue: Black level offset adjustment for Blue in 2's complement format | ||
518 | */ | ||
519 | struct omap3isp_prev_blkadj { | ||
520 | /*Black level offset adjustment for Red in 2's complement format */ | ||
521 | __u8 red; | ||
522 | /*Black level offset adjustment for Green in 2's complement format */ | ||
523 | __u8 green; | ||
524 | /* Black level offset adjustment for Blue in 2's complement format */ | ||
525 | __u8 blue; | ||
526 | }; | ||
527 | |||
528 | /** | ||
529 | * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending | ||
530 | * @matrix: Blending values(S12Q8 format) | ||
531 | * [RR] [GR] [BR] | ||
532 | * [RG] [GG] [BG] | ||
533 | * [RB] [GB] [BB] | ||
534 | * @offset: Blending offset value for R,G,B in 2's complement integer format. | ||
535 | */ | ||
536 | struct omap3isp_prev_rgbtorgb { | ||
537 | __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX]; | ||
538 | __u16 offset[OMAP3ISP_RGB_MAX]; | ||
539 | }; | ||
540 | |||
541 | /** | ||
542 | * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr | ||
543 | * @matrix: Color space conversion coefficients(S10Q8) | ||
544 | * [CSCRY] [CSCGY] [CSCBY] | ||
545 | * [CSCRCB] [CSCGCB] [CSCBCB] | ||
546 | * [CSCRCR] [CSCGCR] [CSCBCR] | ||
547 | * @offset: CSC offset values for Y offset, CB offset and CR offset respectively | ||
548 | */ | ||
549 | struct omap3isp_prev_csc { | ||
550 | __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX]; | ||
551 | __s16 offset[OMAP3ISP_RGB_MAX]; | ||
552 | }; | ||
553 | |||
554 | /** | ||
555 | * struct omap3isp_prev_yclimit - Y, C Value Limit | ||
556 | * @minC: Minimum C value | ||
557 | * @maxC: Maximum C value | ||
558 | * @minY: Minimum Y value | ||
559 | * @maxY: Maximum Y value | ||
560 | */ | ||
561 | struct omap3isp_prev_yclimit { | ||
562 | __u8 minC; | ||
563 | __u8 maxC; | ||
564 | __u8 minY; | ||
565 | __u8 maxY; | ||
566 | }; | ||
567 | |||
568 | /** | ||
569 | * struct omap3isp_prev_dcor - Defect correction | ||
570 | * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF | ||
571 | * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct | ||
572 | */ | ||
573 | struct omap3isp_prev_dcor { | ||
574 | __u8 couplet_mode_en; | ||
575 | __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS]; | ||
576 | }; | ||
577 | |||
578 | /** | ||
579 | * struct omap3isp_prev_nf - Noise Filter | ||
580 | * @spread: Spread value to be used in Noise Filter | ||
581 | * @table: Pointer to the Noise Filter table | ||
582 | */ | ||
583 | struct omap3isp_prev_nf { | ||
584 | __u8 spread; | ||
585 | __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE]; | ||
586 | }; | ||
587 | |||
588 | /** | ||
589 | * struct omap3isp_prev_gtables - Gamma correction tables | ||
590 | * @red: Array for red gamma table. | ||
591 | * @green: Array for green gamma table. | ||
592 | * @blue: Array for blue gamma table. | ||
593 | */ | ||
594 | struct omap3isp_prev_gtables { | ||
595 | __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; | ||
596 | __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; | ||
597 | __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; | ||
598 | }; | ||
599 | |||
600 | /** | ||
601 | * struct omap3isp_prev_luma - Luma enhancement | ||
602 | * @table: Array for luma enhancement table. | ||
603 | */ | ||
604 | struct omap3isp_prev_luma { | ||
605 | __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE]; | ||
606 | }; | ||
607 | |||
608 | /** | ||
609 | * struct omap3isp_prev_update_config - Preview engine configuration (user) | ||
610 | * @update: Specifies which ISP Preview registers should be updated. | ||
611 | * @flag: Specifies which ISP Preview functions should be enabled. | ||
612 | * @shading_shift: 3bit value of shift used in shading compensation. | ||
613 | * @luma: Pointer to luma enhancement structure. | ||
614 | * @hmed: Pointer to structure containing the odd and even distance. | ||
615 | * between the pixels in the image along with the filter threshold. | ||
616 | * @cfa: Pointer to structure containing the CFA interpolation table, CFA. | ||
617 | * format in the image, vertical and horizontal gradient threshold. | ||
618 | * @csup: Pointer to Structure for Chrominance Suppression coefficients. | ||
619 | * @wbal: Pointer to structure for White Balance. | ||
620 | * @blkadj: Pointer to structure for Black Adjustment. | ||
621 | * @rgb2rgb: Pointer to structure for RGB to RGB Blending. | ||
622 | * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr. | ||
623 | * @yclimit: Pointer to structure for Y, C Value Limit. | ||
624 | * @dcor: Pointer to structure for defect correction. | ||
625 | * @nf: Pointer to structure for Noise Filter | ||
626 | * @gamma: Pointer to gamma structure. | ||
627 | */ | ||
628 | struct omap3isp_prev_update_config { | ||
629 | __u32 update; | ||
630 | __u32 flag; | ||
631 | __u32 shading_shift; | ||
632 | struct omap3isp_prev_luma __user *luma; | ||
633 | struct omap3isp_prev_hmed __user *hmed; | ||
634 | struct omap3isp_prev_cfa __user *cfa; | ||
635 | struct omap3isp_prev_csup __user *csup; | ||
636 | struct omap3isp_prev_wbal __user *wbal; | ||
637 | struct omap3isp_prev_blkadj __user *blkadj; | ||
638 | struct omap3isp_prev_rgbtorgb __user *rgb2rgb; | ||
639 | struct omap3isp_prev_csc __user *csc; | ||
640 | struct omap3isp_prev_yclimit __user *yclimit; | ||
641 | struct omap3isp_prev_dcor __user *dcor; | ||
642 | struct omap3isp_prev_nf __user *nf; | ||
643 | struct omap3isp_prev_gtables __user *gamma; | ||
644 | }; | ||
645 | |||
646 | #endif /* OMAP3_ISP_USER_H */ | ||
diff --git a/include/linux/param.h b/include/linux/param.h new file mode 100644 index 00000000000..092e92f67b5 --- /dev/null +++ b/include/linux/param.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _LINUX_PARAM_H | ||
2 | #define _LINUX_PARAM_H | ||
3 | |||
4 | #include <asm/param.h> | ||
5 | |||
6 | #endif | ||
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h new file mode 100644 index 00000000000..dad7d9a4abc --- /dev/null +++ b/include/linux/pci_regs.h | |||
@@ -0,0 +1,715 @@ | |||
1 | /* | ||
2 | * pci_regs.h | ||
3 | * | ||
4 | * PCI standard defines | ||
5 | * Copyright 1994, Drew Eckhardt | ||
6 | * Copyright 1997--1999 Martin Mares <mj@ucw.cz> | ||
7 | * | ||
8 | * For more information, please consult the following manuals (look at | ||
9 | * http://www.pcisig.com/ for how to get them): | ||
10 | * | ||
11 | * PCI BIOS Specification | ||
12 | * PCI Local Bus Specification | ||
13 | * PCI to PCI Bridge Specification | ||
14 | * PCI System Design Guide | ||
15 | * | ||
16 | * For hypertransport information, please consult the following manuals | ||
17 | * from http://www.hypertransport.org | ||
18 | * | ||
19 | * The Hypertransport I/O Link Specification | ||
20 | */ | ||
21 | |||
22 | #ifndef LINUX_PCI_REGS_H | ||
23 | #define LINUX_PCI_REGS_H | ||
24 | |||
25 | /* | ||
26 | * Under PCI, each device has 256 bytes of configuration address space, | ||
27 | * of which the first 64 bytes are standardized as follows: | ||
28 | */ | ||
29 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ | ||
30 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ | ||
31 | #define PCI_COMMAND 0x04 /* 16 bits */ | ||
32 | #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ | ||
33 | #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ | ||
34 | #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ | ||
35 | #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ | ||
36 | #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ | ||
37 | #define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ | ||
38 | #define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ | ||
39 | #define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ | ||
40 | #define PCI_COMMAND_SERR 0x100 /* Enable SERR */ | ||
41 | #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ | ||
42 | #define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ | ||
43 | |||
44 | #define PCI_STATUS 0x06 /* 16 bits */ | ||
45 | #define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */ | ||
46 | #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ | ||
47 | #define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ | ||
48 | #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ | ||
49 | #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ | ||
50 | #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ | ||
51 | #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ | ||
52 | #define PCI_STATUS_DEVSEL_FAST 0x000 | ||
53 | #define PCI_STATUS_DEVSEL_MEDIUM 0x200 | ||
54 | #define PCI_STATUS_DEVSEL_SLOW 0x400 | ||
55 | #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ | ||
56 | #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ | ||
57 | #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ | ||
58 | #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ | ||
59 | #define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ | ||
60 | |||
61 | #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ | ||
62 | #define PCI_REVISION_ID 0x08 /* Revision ID */ | ||
63 | #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ | ||
64 | #define PCI_CLASS_DEVICE 0x0a /* Device class */ | ||
65 | |||
66 | #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ | ||
67 | #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ | ||
68 | #define PCI_HEADER_TYPE 0x0e /* 8 bits */ | ||
69 | #define PCI_HEADER_TYPE_NORMAL 0 | ||
70 | #define PCI_HEADER_TYPE_BRIDGE 1 | ||
71 | #define PCI_HEADER_TYPE_CARDBUS 2 | ||
72 | |||
73 | #define PCI_BIST 0x0f /* 8 bits */ | ||
74 | #define PCI_BIST_CODE_MASK 0x0f /* Return result */ | ||
75 | #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ | ||
76 | #define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ | ||
77 | |||
78 | /* | ||
79 | * Base addresses specify locations in memory or I/O space. | ||
80 | * Decoded size can be determined by writing a value of | ||
81 | * 0xffffffff to the register, and reading it back. Only | ||
82 | * 1 bits are decoded. | ||
83 | */ | ||
84 | #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ | ||
85 | #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ | ||
86 | #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ | ||
87 | #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ | ||
88 | #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ | ||
89 | #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ | ||
90 | #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ | ||
91 | #define PCI_BASE_ADDRESS_SPACE_IO 0x01 | ||
92 | #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 | ||
93 | #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 | ||
94 | #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ | ||
95 | #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ | ||
96 | #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ | ||
97 | #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ | ||
98 | #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) | ||
99 | #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) | ||
100 | /* bit 1 is reserved if address_space = 1 */ | ||
101 | |||
102 | /* Header type 0 (normal devices) */ | ||
103 | #define PCI_CARDBUS_CIS 0x28 | ||
104 | #define PCI_SUBSYSTEM_VENDOR_ID 0x2c | ||
105 | #define PCI_SUBSYSTEM_ID 0x2e | ||
106 | #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ | ||
107 | #define PCI_ROM_ADDRESS_ENABLE 0x01 | ||
108 | #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) | ||
109 | |||
110 | #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ | ||
111 | |||
112 | /* 0x35-0x3b are reserved */ | ||
113 | #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ | ||
114 | #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ | ||
115 | #define PCI_MIN_GNT 0x3e /* 8 bits */ | ||
116 | #define PCI_MAX_LAT 0x3f /* 8 bits */ | ||
117 | |||
118 | /* Header type 1 (PCI-to-PCI bridges) */ | ||
119 | #define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ | ||
120 | #define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ | ||
121 | #define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ | ||
122 | #define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ | ||
123 | #define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ | ||
124 | #define PCI_IO_LIMIT 0x1d | ||
125 | #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ | ||
126 | #define PCI_IO_RANGE_TYPE_16 0x00 | ||
127 | #define PCI_IO_RANGE_TYPE_32 0x01 | ||
128 | #define PCI_IO_RANGE_MASK (~0x0fUL) | ||
129 | #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ | ||
130 | #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ | ||
131 | #define PCI_MEMORY_LIMIT 0x22 | ||
132 | #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL | ||
133 | #define PCI_MEMORY_RANGE_MASK (~0x0fUL) | ||
134 | #define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ | ||
135 | #define PCI_PREF_MEMORY_LIMIT 0x26 | ||
136 | #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL | ||
137 | #define PCI_PREF_RANGE_TYPE_32 0x00 | ||
138 | #define PCI_PREF_RANGE_TYPE_64 0x01 | ||
139 | #define PCI_PREF_RANGE_MASK (~0x0fUL) | ||
140 | #define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ | ||
141 | #define PCI_PREF_LIMIT_UPPER32 0x2c | ||
142 | #define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ | ||
143 | #define PCI_IO_LIMIT_UPPER16 0x32 | ||
144 | /* 0x34 same as for htype 0 */ | ||
145 | /* 0x35-0x3b is reserved */ | ||
146 | #define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ | ||
147 | /* 0x3c-0x3d are same as for htype 0 */ | ||
148 | #define PCI_BRIDGE_CONTROL 0x3e | ||
149 | #define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ | ||
150 | #define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ | ||
151 | #define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */ | ||
152 | #define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ | ||
153 | #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ | ||
154 | #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ | ||
155 | #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ | ||
156 | |||
157 | /* Header type 2 (CardBus bridges) */ | ||
158 | #define PCI_CB_CAPABILITY_LIST 0x14 | ||
159 | /* 0x15 reserved */ | ||
160 | #define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ | ||
161 | #define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ | ||
162 | #define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ | ||
163 | #define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ | ||
164 | #define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ | ||
165 | #define PCI_CB_MEMORY_BASE_0 0x1c | ||
166 | #define PCI_CB_MEMORY_LIMIT_0 0x20 | ||
167 | #define PCI_CB_MEMORY_BASE_1 0x24 | ||
168 | #define PCI_CB_MEMORY_LIMIT_1 0x28 | ||
169 | #define PCI_CB_IO_BASE_0 0x2c | ||
170 | #define PCI_CB_IO_BASE_0_HI 0x2e | ||
171 | #define PCI_CB_IO_LIMIT_0 0x30 | ||
172 | #define PCI_CB_IO_LIMIT_0_HI 0x32 | ||
173 | #define PCI_CB_IO_BASE_1 0x34 | ||
174 | #define PCI_CB_IO_BASE_1_HI 0x36 | ||
175 | #define PCI_CB_IO_LIMIT_1 0x38 | ||
176 | #define PCI_CB_IO_LIMIT_1_HI 0x3a | ||
177 | #define PCI_CB_IO_RANGE_MASK (~0x03UL) | ||
178 | /* 0x3c-0x3d are same as for htype 0 */ | ||
179 | #define PCI_CB_BRIDGE_CONTROL 0x3e | ||
180 | #define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ | ||
181 | #define PCI_CB_BRIDGE_CTL_SERR 0x02 | ||
182 | #define PCI_CB_BRIDGE_CTL_ISA 0x04 | ||
183 | #define PCI_CB_BRIDGE_CTL_VGA 0x08 | ||
184 | #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 | ||
185 | #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ | ||
186 | #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ | ||
187 | #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ | ||
188 | #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 | ||
189 | #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 | ||
190 | #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 | ||
191 | #define PCI_CB_SUBSYSTEM_ID 0x42 | ||
192 | #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ | ||
193 | /* 0x48-0x7f reserved */ | ||
194 | |||
195 | /* Capability lists */ | ||
196 | |||
197 | #define PCI_CAP_LIST_ID 0 /* Capability ID */ | ||
198 | #define PCI_CAP_ID_PM 0x01 /* Power Management */ | ||
199 | #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ | ||
200 | #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ | ||
201 | #define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ | ||
202 | #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ | ||
203 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ | ||
204 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ | ||
205 | #define PCI_CAP_ID_HT 0x08 /* HyperTransport */ | ||
206 | #define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ | ||
207 | #define PCI_CAP_ID_DBG 0x0A /* Debug port */ | ||
208 | #define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ | ||
209 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | ||
210 | #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ | ||
211 | #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ | ||
212 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | ||
213 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ | ||
214 | #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ | ||
215 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ | ||
216 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ | ||
217 | #define PCI_CAP_SIZEOF 4 | ||
218 | |||
219 | /* Power Management Registers */ | ||
220 | |||
221 | #define PCI_PM_PMC 2 /* PM Capabilities Register */ | ||
222 | #define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ | ||
223 | #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ | ||
224 | #define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ | ||
225 | #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ | ||
226 | #define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxiliary power support mask */ | ||
227 | #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ | ||
228 | #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ | ||
229 | #define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ | ||
230 | #define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ | ||
231 | #define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ | ||
232 | #define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ | ||
233 | #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ | ||
234 | #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ | ||
235 | #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ | ||
236 | #define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ | ||
237 | #define PCI_PM_CTRL 4 /* PM control and status register */ | ||
238 | #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ | ||
239 | #define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */ | ||
240 | #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ | ||
241 | #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ | ||
242 | #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ | ||
243 | #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ | ||
244 | #define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ | ||
245 | #define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ | ||
246 | #define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ | ||
247 | #define PCI_PM_DATA_REGISTER 7 /* (??) */ | ||
248 | #define PCI_PM_SIZEOF 8 | ||
249 | |||
250 | /* AGP registers */ | ||
251 | |||
252 | #define PCI_AGP_VERSION 2 /* BCD version number */ | ||
253 | #define PCI_AGP_RFU 3 /* Rest of capability flags */ | ||
254 | #define PCI_AGP_STATUS 4 /* Status register */ | ||
255 | #define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ | ||
256 | #define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ | ||
257 | #define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ | ||
258 | #define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ | ||
259 | #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ | ||
260 | #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ | ||
261 | #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ | ||
262 | #define PCI_AGP_COMMAND 8 /* Control register */ | ||
263 | #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ | ||
264 | #define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ | ||
265 | #define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ | ||
266 | #define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ | ||
267 | #define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ | ||
268 | #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ | ||
269 | #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ | ||
270 | #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ | ||
271 | #define PCI_AGP_SIZEOF 12 | ||
272 | |||
273 | /* Vital Product Data */ | ||
274 | |||
275 | #define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ | ||
276 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ | ||
277 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ | ||
278 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ | ||
279 | |||
280 | /* Slot Identification */ | ||
281 | |||
282 | #define PCI_SID_ESR 2 /* Expansion Slot Register */ | ||
283 | #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ | ||
284 | #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ | ||
285 | #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ | ||
286 | |||
287 | /* Message Signalled Interrupts registers */ | ||
288 | |||
289 | #define PCI_MSI_FLAGS 2 /* Various flags */ | ||
290 | #define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ | ||
291 | #define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ | ||
292 | #define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ | ||
293 | #define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ | ||
294 | #define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ | ||
295 | #define PCI_MSI_RFU 3 /* Rest of capability flags */ | ||
296 | #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ | ||
297 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ | ||
298 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ | ||
299 | #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ | ||
300 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ | ||
301 | #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ | ||
302 | |||
303 | /* MSI-X registers */ | ||
304 | #define PCI_MSIX_FLAGS 2 | ||
305 | #define PCI_MSIX_FLAGS_QSIZE 0x7FF | ||
306 | #define PCI_MSIX_FLAGS_ENABLE (1 << 15) | ||
307 | #define PCI_MSIX_FLAGS_MASKALL (1 << 14) | ||
308 | #define PCI_MSIX_TABLE 4 | ||
309 | #define PCI_MSIX_PBA 8 | ||
310 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | ||
311 | |||
312 | /* MSI-X entry's format */ | ||
313 | #define PCI_MSIX_ENTRY_SIZE 16 | ||
314 | #define PCI_MSIX_ENTRY_LOWER_ADDR 0 | ||
315 | #define PCI_MSIX_ENTRY_UPPER_ADDR 4 | ||
316 | #define PCI_MSIX_ENTRY_DATA 8 | ||
317 | #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 | ||
318 | #define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 | ||
319 | |||
320 | /* CompactPCI Hotswap Register */ | ||
321 | |||
322 | #define PCI_CHSWP_CSR 2 /* Control and Status Register */ | ||
323 | #define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ | ||
324 | #define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ | ||
325 | #define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ | ||
326 | #define PCI_CHSWP_LOO 0x08 /* LED On / Off */ | ||
327 | #define PCI_CHSWP_PI 0x30 /* Programming Interface */ | ||
328 | #define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ | ||
329 | #define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ | ||
330 | |||
331 | /* PCI Advanced Feature registers */ | ||
332 | |||
333 | #define PCI_AF_LENGTH 2 | ||
334 | #define PCI_AF_CAP 3 | ||
335 | #define PCI_AF_CAP_TP 0x01 | ||
336 | #define PCI_AF_CAP_FLR 0x02 | ||
337 | #define PCI_AF_CTRL 4 | ||
338 | #define PCI_AF_CTRL_FLR 0x01 | ||
339 | #define PCI_AF_STATUS 5 | ||
340 | #define PCI_AF_STATUS_TP 0x01 | ||
341 | |||
342 | /* PCI-X registers */ | ||
343 | |||
344 | #define PCI_X_CMD 2 /* Modes & Features */ | ||
345 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ | ||
346 | #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ | ||
347 | #define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ | ||
348 | #define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ | ||
349 | #define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ | ||
350 | #define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ | ||
351 | #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ | ||
352 | /* Max # of outstanding split transactions */ | ||
353 | #define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ | ||
354 | #define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ | ||
355 | #define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ | ||
356 | #define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ | ||
357 | #define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ | ||
358 | #define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ | ||
359 | #define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ | ||
360 | #define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ | ||
361 | #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ | ||
362 | #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ | ||
363 | #define PCI_X_STATUS 4 /* PCI-X capabilities */ | ||
364 | #define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ | ||
365 | #define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ | ||
366 | #define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ | ||
367 | #define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ | ||
368 | #define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ | ||
369 | #define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ | ||
370 | #define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ | ||
371 | #define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ | ||
372 | #define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ | ||
373 | #define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ | ||
374 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ | ||
375 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | ||
376 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | ||
377 | |||
378 | /* PCI Bridge Subsystem ID registers */ | ||
379 | |||
380 | #define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ | ||
381 | #define PCI_SSVID_DEVICE_ID 6 /* PCI-Bridge subsystem device id register */ | ||
382 | |||
383 | /* PCI Express capability registers */ | ||
384 | |||
385 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ | ||
386 | #define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ | ||
387 | #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ | ||
388 | #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ | ||
389 | #define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ | ||
390 | #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ | ||
391 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ | ||
392 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ | ||
393 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ | ||
394 | #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ | ||
395 | #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ | ||
396 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ | ||
397 | #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ | ||
398 | #define PCI_EXP_DEVCAP 4 /* Device capabilities */ | ||
399 | #define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ | ||
400 | #define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ | ||
401 | #define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ | ||
402 | #define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ | ||
403 | #define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ | ||
404 | #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ | ||
405 | #define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ | ||
406 | #define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ | ||
407 | #define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ | ||
408 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ | ||
409 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ | ||
410 | #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */ | ||
411 | #define PCI_EXP_DEVCTL 8 /* Device Control */ | ||
412 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ | ||
413 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ | ||
414 | #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ | ||
415 | #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ | ||
416 | #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ | ||
417 | #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ | ||
418 | #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ | ||
419 | #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ | ||
420 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ | ||
421 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ | ||
422 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ | ||
423 | #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ | ||
424 | #define PCI_EXP_DEVSTA 10 /* Device Status */ | ||
425 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ | ||
426 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ | ||
427 | #define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ | ||
428 | #define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ | ||
429 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ | ||
430 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | ||
431 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | ||
432 | #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ | ||
433 | #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ | ||
434 | #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ | ||
435 | #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ | ||
436 | #define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */ | ||
437 | #define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */ | ||
438 | #define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Surprise Down Error Reporting Capable */ | ||
439 | #define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */ | ||
440 | #define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */ | ||
441 | #define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */ | ||
442 | #define PCI_EXP_LNKCTL 16 /* Link Control */ | ||
443 | #define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */ | ||
444 | #define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ | ||
445 | #define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */ | ||
446 | #define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */ | ||
447 | #define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */ | ||
448 | #define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */ | ||
449 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ | ||
450 | #define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */ | ||
451 | #define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */ | ||
452 | #define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ | ||
453 | #define PCI_EXP_LNKSTA 18 /* Link Status */ | ||
454 | #define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ | ||
455 | #define PCI_EXP_LNKSTA_CLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */ | ||
456 | #define PCI_EXP_LNKSTA_CLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */ | ||
457 | #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ | ||
458 | #define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */ | ||
459 | #define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ | ||
460 | #define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ | ||
461 | #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ | ||
462 | #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ | ||
463 | #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ | ||
464 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | ||
465 | #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ | ||
466 | #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ | ||
467 | #define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */ | ||
468 | #define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */ | ||
469 | #define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */ | ||
470 | #define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */ | ||
471 | #define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */ | ||
472 | #define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */ | ||
473 | #define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */ | ||
474 | #define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */ | ||
475 | #define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */ | ||
476 | #define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ | ||
477 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ | ||
478 | #define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */ | ||
479 | #define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */ | ||
480 | #define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */ | ||
481 | #define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */ | ||
482 | #define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */ | ||
483 | #define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ | ||
484 | #define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */ | ||
485 | #define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */ | ||
486 | #define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */ | ||
487 | #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */ | ||
488 | #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */ | ||
489 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ | ||
490 | #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */ | ||
491 | #define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */ | ||
492 | #define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */ | ||
493 | #define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */ | ||
494 | #define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */ | ||
495 | #define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */ | ||
496 | #define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */ | ||
497 | #define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */ | ||
498 | #define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */ | ||
499 | #define PCI_EXP_RTCTL 28 /* Root Control */ | ||
500 | #define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ | ||
501 | #define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ | ||
502 | #define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ | ||
503 | #define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ | ||
504 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ | ||
505 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ | ||
506 | #define PCI_EXP_RTSTA 32 /* Root Status */ | ||
507 | #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ | ||
508 | #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ | ||
509 | #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ | ||
510 | #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ | ||
511 | #define PCI_EXP_DEVCAP2_LTR 0x800 /* Latency tolerance reporting */ | ||
512 | #define PCI_EXP_OBFF_MASK 0xc0000 /* OBFF support mechanism */ | ||
513 | #define PCI_EXP_OBFF_MSG 0x40000 /* New message signaling */ | ||
514 | #define PCI_EXP_OBFF_WAKE 0x80000 /* Re-use WAKE# for OBFF */ | ||
515 | #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ | ||
516 | #define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ | ||
517 | #define PCI_EXP_IDO_REQ_EN 0x100 /* ID-based ordering request enable */ | ||
518 | #define PCI_EXP_IDO_CMP_EN 0x200 /* ID-based ordering completion enable */ | ||
519 | #define PCI_EXP_LTR_EN 0x400 /* Latency tolerance reporting */ | ||
520 | #define PCI_EXP_OBFF_MSGA_EN 0x2000 /* OBFF enable with Message type A */ | ||
521 | #define PCI_EXP_OBFF_MSGB_EN 0x4000 /* OBFF enable with Message type B */ | ||
522 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ | ||
523 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ | ||
524 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ | ||
525 | |||
526 | /* Extended Capabilities (PCI-X 2.0 and Express) */ | ||
527 | #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) | ||
528 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) | ||
529 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) | ||
530 | |||
531 | #define PCI_EXT_CAP_ID_ERR 1 | ||
532 | #define PCI_EXT_CAP_ID_VC 2 | ||
533 | #define PCI_EXT_CAP_ID_DSN 3 | ||
534 | #define PCI_EXT_CAP_ID_PWR 4 | ||
535 | #define PCI_EXT_CAP_ID_VNDR 11 | ||
536 | #define PCI_EXT_CAP_ID_ACS 13 | ||
537 | #define PCI_EXT_CAP_ID_ARI 14 | ||
538 | #define PCI_EXT_CAP_ID_ATS 15 | ||
539 | #define PCI_EXT_CAP_ID_SRIOV 16 | ||
540 | #define PCI_EXT_CAP_ID_LTR 24 | ||
541 | |||
542 | /* Advanced Error Reporting */ | ||
543 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | ||
544 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ | ||
545 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ | ||
546 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ | ||
547 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ | ||
548 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ | ||
549 | #define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ | ||
550 | #define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ | ||
551 | #define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ | ||
552 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ | ||
553 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ | ||
554 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ | ||
555 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ | ||
556 | /* Same bits as above */ | ||
557 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ | ||
558 | /* Same bits as above */ | ||
559 | #define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ | ||
560 | #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ | ||
561 | #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ | ||
562 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ | ||
563 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ | ||
564 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ | ||
565 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ | ||
566 | /* Same bits as above */ | ||
567 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ | ||
568 | #define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ | ||
569 | #define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ | ||
570 | #define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ | ||
571 | #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ | ||
572 | #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ | ||
573 | #define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ | ||
574 | #define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ | ||
575 | /* Correctable Err Reporting Enable */ | ||
576 | #define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 | ||
577 | /* Non-fatal Err Reporting Enable */ | ||
578 | #define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 | ||
579 | /* Fatal Err Reporting Enable */ | ||
580 | #define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 | ||
581 | #define PCI_ERR_ROOT_STATUS 48 | ||
582 | #define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ | ||
583 | /* Multi ERR_COR Received */ | ||
584 | #define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 | ||
585 | /* ERR_FATAL/NONFATAL Recevied */ | ||
586 | #define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 | ||
587 | /* Multi ERR_FATAL/NONFATAL Recevied */ | ||
588 | #define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 | ||
589 | #define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ | ||
590 | #define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ | ||
591 | #define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ | ||
592 | #define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */ | ||
593 | |||
594 | /* Virtual Channel */ | ||
595 | #define PCI_VC_PORT_REG1 4 | ||
596 | #define PCI_VC_PORT_REG2 8 | ||
597 | #define PCI_VC_PORT_CTRL 12 | ||
598 | #define PCI_VC_PORT_STATUS 14 | ||
599 | #define PCI_VC_RES_CAP 16 | ||
600 | #define PCI_VC_RES_CTRL 20 | ||
601 | #define PCI_VC_RES_STATUS 26 | ||
602 | |||
603 | /* Power Budgeting */ | ||
604 | #define PCI_PWR_DSR 4 /* Data Select Register */ | ||
605 | #define PCI_PWR_DATA 8 /* Data Register */ | ||
606 | #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ | ||
607 | #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ | ||
608 | #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ | ||
609 | #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ | ||
610 | #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ | ||
611 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ | ||
612 | #define PCI_PWR_CAP 12 /* Capability */ | ||
613 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ | ||
614 | |||
615 | /* | ||
616 | * Hypertransport sub capability types | ||
617 | * | ||
618 | * Unfortunately there are both 3 bit and 5 bit capability types defined | ||
619 | * in the HT spec, catering for that is a little messy. You probably don't | ||
620 | * want to use these directly, just use pci_find_ht_capability() and it | ||
621 | * will do the right thing for you. | ||
622 | */ | ||
623 | #define HT_3BIT_CAP_MASK 0xE0 | ||
624 | #define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ | ||
625 | #define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ | ||
626 | |||
627 | #define HT_5BIT_CAP_MASK 0xF8 | ||
628 | #define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ | ||
629 | #define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ | ||
630 | #define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ | ||
631 | #define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ | ||
632 | #define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ | ||
633 | #define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ | ||
634 | #define HT_MSI_FLAGS 0x02 /* Offset to flags */ | ||
635 | #define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */ | ||
636 | #define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */ | ||
637 | #define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */ | ||
638 | #define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */ | ||
639 | #define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */ | ||
640 | #define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */ | ||
641 | #define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ | ||
642 | #define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ | ||
643 | #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ | ||
644 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ | ||
645 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ | ||
646 | |||
647 | /* Alternative Routing-ID Interpretation */ | ||
648 | #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ | ||
649 | #define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ | ||
650 | #define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ | ||
651 | #define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ | ||
652 | #define PCI_ARI_CTRL 0x06 /* ARI Control Register */ | ||
653 | #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ | ||
654 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ | ||
655 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ | ||
656 | |||
657 | /* Address Translation Service */ | ||
658 | #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ | ||
659 | #define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */ | ||
660 | #define PCI_ATS_MAX_QDEP 32 /* Max Invalidate Queue Depth */ | ||
661 | #define PCI_ATS_CTRL 0x06 /* ATS Control Register */ | ||
662 | #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ | ||
663 | #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ | ||
664 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ | ||
665 | |||
666 | /* Single Root I/O Virtualization */ | ||
667 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ | ||
668 | #define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */ | ||
669 | #define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */ | ||
670 | #define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */ | ||
671 | #define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */ | ||
672 | #define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */ | ||
673 | #define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */ | ||
674 | #define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */ | ||
675 | #define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */ | ||
676 | #define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */ | ||
677 | #define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */ | ||
678 | #define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */ | ||
679 | #define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */ | ||
680 | #define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */ | ||
681 | #define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */ | ||
682 | #define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */ | ||
683 | #define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */ | ||
684 | #define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */ | ||
685 | #define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */ | ||
686 | #define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */ | ||
687 | #define PCI_SRIOV_BAR 0x24 /* VF BAR0 */ | ||
688 | #define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */ | ||
689 | #define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/ | ||
690 | #define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */ | ||
691 | #define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */ | ||
692 | #define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */ | ||
693 | #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ | ||
694 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ | ||
695 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ | ||
696 | |||
697 | #define PCI_LTR_MAX_SNOOP_LAT 0x4 | ||
698 | #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 | ||
699 | #define PCI_LTR_VALUE_MASK 0x000003ff | ||
700 | #define PCI_LTR_SCALE_MASK 0x00001c00 | ||
701 | #define PCI_LTR_SCALE_SHIFT 10 | ||
702 | |||
703 | /* Access Control Service */ | ||
704 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ | ||
705 | #define PCI_ACS_SV 0x01 /* Source Validation */ | ||
706 | #define PCI_ACS_TB 0x02 /* Translation Blocking */ | ||
707 | #define PCI_ACS_RR 0x04 /* P2P Request Redirect */ | ||
708 | #define PCI_ACS_CR 0x08 /* P2P Completion Redirect */ | ||
709 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ | ||
710 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ | ||
711 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ | ||
712 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ | ||
713 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ | ||
714 | |||
715 | #endif /* LINUX_PCI_REGS_H */ | ||
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h new file mode 100644 index 00000000000..0b80c806631 --- /dev/null +++ b/include/linux/pfkeyv2.h | |||
@@ -0,0 +1,370 @@ | |||
1 | /* PF_KEY user interface, this is defined by rfc2367 so | ||
2 | * do not make arbitrary modifications or else this header | ||
3 | * file will not be compliant. | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_PFKEY2_H | ||
7 | #define _LINUX_PFKEY2_H | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | |||
11 | #define PF_KEY_V2 2 | ||
12 | #define PFKEYV2_REVISION 199806L | ||
13 | |||
14 | struct sadb_msg { | ||
15 | __u8 sadb_msg_version; | ||
16 | __u8 sadb_msg_type; | ||
17 | __u8 sadb_msg_errno; | ||
18 | __u8 sadb_msg_satype; | ||
19 | __u16 sadb_msg_len; | ||
20 | __u16 sadb_msg_reserved; | ||
21 | __u32 sadb_msg_seq; | ||
22 | __u32 sadb_msg_pid; | ||
23 | } __attribute__((packed)); | ||
24 | /* sizeof(struct sadb_msg) == 16 */ | ||
25 | |||
26 | struct sadb_ext { | ||
27 | __u16 sadb_ext_len; | ||
28 | __u16 sadb_ext_type; | ||
29 | } __attribute__((packed)); | ||
30 | /* sizeof(struct sadb_ext) == 4 */ | ||
31 | |||
32 | struct sadb_sa { | ||
33 | __u16 sadb_sa_len; | ||
34 | __u16 sadb_sa_exttype; | ||
35 | __be32 sadb_sa_spi; | ||
36 | __u8 sadb_sa_replay; | ||
37 | __u8 sadb_sa_state; | ||
38 | __u8 sadb_sa_auth; | ||
39 | __u8 sadb_sa_encrypt; | ||
40 | __u32 sadb_sa_flags; | ||
41 | } __attribute__((packed)); | ||
42 | /* sizeof(struct sadb_sa) == 16 */ | ||
43 | |||
44 | struct sadb_lifetime { | ||
45 | __u16 sadb_lifetime_len; | ||
46 | __u16 sadb_lifetime_exttype; | ||
47 | __u32 sadb_lifetime_allocations; | ||
48 | __u64 sadb_lifetime_bytes; | ||
49 | __u64 sadb_lifetime_addtime; | ||
50 | __u64 sadb_lifetime_usetime; | ||
51 | } __attribute__((packed)); | ||
52 | /* sizeof(struct sadb_lifetime) == 32 */ | ||
53 | |||
54 | struct sadb_address { | ||
55 | __u16 sadb_address_len; | ||
56 | __u16 sadb_address_exttype; | ||
57 | __u8 sadb_address_proto; | ||
58 | __u8 sadb_address_prefixlen; | ||
59 | __u16 sadb_address_reserved; | ||
60 | } __attribute__((packed)); | ||
61 | /* sizeof(struct sadb_address) == 8 */ | ||
62 | |||
63 | struct sadb_key { | ||
64 | __u16 sadb_key_len; | ||
65 | __u16 sadb_key_exttype; | ||
66 | __u16 sadb_key_bits; | ||
67 | __u16 sadb_key_reserved; | ||
68 | } __attribute__((packed)); | ||
69 | /* sizeof(struct sadb_key) == 8 */ | ||
70 | |||
71 | struct sadb_ident { | ||
72 | __u16 sadb_ident_len; | ||
73 | __u16 sadb_ident_exttype; | ||
74 | __u16 sadb_ident_type; | ||
75 | __u16 sadb_ident_reserved; | ||
76 | __u64 sadb_ident_id; | ||
77 | } __attribute__((packed)); | ||
78 | /* sizeof(struct sadb_ident) == 16 */ | ||
79 | |||
80 | struct sadb_sens { | ||
81 | __u16 sadb_sens_len; | ||
82 | __u16 sadb_sens_exttype; | ||
83 | __u32 sadb_sens_dpd; | ||
84 | __u8 sadb_sens_sens_level; | ||
85 | __u8 sadb_sens_sens_len; | ||
86 | __u8 sadb_sens_integ_level; | ||
87 | __u8 sadb_sens_integ_len; | ||
88 | __u32 sadb_sens_reserved; | ||
89 | } __attribute__((packed)); | ||
90 | /* sizeof(struct sadb_sens) == 16 */ | ||
91 | |||
92 | /* followed by: | ||
93 | __u64 sadb_sens_bitmap[sens_len]; | ||
94 | __u64 sadb_integ_bitmap[integ_len]; */ | ||
95 | |||
96 | struct sadb_prop { | ||
97 | __u16 sadb_prop_len; | ||
98 | __u16 sadb_prop_exttype; | ||
99 | __u8 sadb_prop_replay; | ||
100 | __u8 sadb_prop_reserved[3]; | ||
101 | } __attribute__((packed)); | ||
102 | /* sizeof(struct sadb_prop) == 8 */ | ||
103 | |||
104 | /* followed by: | ||
105 | struct sadb_comb sadb_combs[(sadb_prop_len + | ||
106 | sizeof(__u64) - sizeof(struct sadb_prop)) / | ||
107 | sizeof(struct sadb_comb)]; */ | ||
108 | |||
109 | struct sadb_comb { | ||
110 | __u8 sadb_comb_auth; | ||
111 | __u8 sadb_comb_encrypt; | ||
112 | __u16 sadb_comb_flags; | ||
113 | __u16 sadb_comb_auth_minbits; | ||
114 | __u16 sadb_comb_auth_maxbits; | ||
115 | __u16 sadb_comb_encrypt_minbits; | ||
116 | __u16 sadb_comb_encrypt_maxbits; | ||
117 | __u32 sadb_comb_reserved; | ||
118 | __u32 sadb_comb_soft_allocations; | ||
119 | __u32 sadb_comb_hard_allocations; | ||
120 | __u64 sadb_comb_soft_bytes; | ||
121 | __u64 sadb_comb_hard_bytes; | ||
122 | __u64 sadb_comb_soft_addtime; | ||
123 | __u64 sadb_comb_hard_addtime; | ||
124 | __u64 sadb_comb_soft_usetime; | ||
125 | __u64 sadb_comb_hard_usetime; | ||
126 | } __attribute__((packed)); | ||
127 | /* sizeof(struct sadb_comb) == 72 */ | ||
128 | |||
129 | struct sadb_supported { | ||
130 | __u16 sadb_supported_len; | ||
131 | __u16 sadb_supported_exttype; | ||
132 | __u32 sadb_supported_reserved; | ||
133 | } __attribute__((packed)); | ||
134 | /* sizeof(struct sadb_supported) == 8 */ | ||
135 | |||
136 | /* followed by: | ||
137 | struct sadb_alg sadb_algs[(sadb_supported_len + | ||
138 | sizeof(__u64) - sizeof(struct sadb_supported)) / | ||
139 | sizeof(struct sadb_alg)]; */ | ||
140 | |||
141 | struct sadb_alg { | ||
142 | __u8 sadb_alg_id; | ||
143 | __u8 sadb_alg_ivlen; | ||
144 | __u16 sadb_alg_minbits; | ||
145 | __u16 sadb_alg_maxbits; | ||
146 | __u16 sadb_alg_reserved; | ||
147 | } __attribute__((packed)); | ||
148 | /* sizeof(struct sadb_alg) == 8 */ | ||
149 | |||
150 | struct sadb_spirange { | ||
151 | __u16 sadb_spirange_len; | ||
152 | __u16 sadb_spirange_exttype; | ||
153 | __u32 sadb_spirange_min; | ||
154 | __u32 sadb_spirange_max; | ||
155 | __u32 sadb_spirange_reserved; | ||
156 | } __attribute__((packed)); | ||
157 | /* sizeof(struct sadb_spirange) == 16 */ | ||
158 | |||
159 | struct sadb_x_kmprivate { | ||
160 | __u16 sadb_x_kmprivate_len; | ||
161 | __u16 sadb_x_kmprivate_exttype; | ||
162 | __u32 sadb_x_kmprivate_reserved; | ||
163 | } __attribute__((packed)); | ||
164 | /* sizeof(struct sadb_x_kmprivate) == 8 */ | ||
165 | |||
166 | struct sadb_x_sa2 { | ||
167 | __u16 sadb_x_sa2_len; | ||
168 | __u16 sadb_x_sa2_exttype; | ||
169 | __u8 sadb_x_sa2_mode; | ||
170 | __u8 sadb_x_sa2_reserved1; | ||
171 | __u16 sadb_x_sa2_reserved2; | ||
172 | __u32 sadb_x_sa2_sequence; | ||
173 | __u32 sadb_x_sa2_reqid; | ||
174 | } __attribute__((packed)); | ||
175 | /* sizeof(struct sadb_x_sa2) == 16 */ | ||
176 | |||
177 | struct sadb_x_policy { | ||
178 | __u16 sadb_x_policy_len; | ||
179 | __u16 sadb_x_policy_exttype; | ||
180 | __u16 sadb_x_policy_type; | ||
181 | __u8 sadb_x_policy_dir; | ||
182 | __u8 sadb_x_policy_reserved; | ||
183 | __u32 sadb_x_policy_id; | ||
184 | __u32 sadb_x_policy_priority; | ||
185 | } __attribute__((packed)); | ||
186 | /* sizeof(struct sadb_x_policy) == 16 */ | ||
187 | |||
188 | struct sadb_x_ipsecrequest { | ||
189 | __u16 sadb_x_ipsecrequest_len; | ||
190 | __u16 sadb_x_ipsecrequest_proto; | ||
191 | __u8 sadb_x_ipsecrequest_mode; | ||
192 | __u8 sadb_x_ipsecrequest_level; | ||
193 | __u16 sadb_x_ipsecrequest_reserved1; | ||
194 | __u32 sadb_x_ipsecrequest_reqid; | ||
195 | __u32 sadb_x_ipsecrequest_reserved2; | ||
196 | } __attribute__((packed)); | ||
197 | /* sizeof(struct sadb_x_ipsecrequest) == 16 */ | ||
198 | |||
199 | /* This defines the TYPE of Nat Traversal in use. Currently only one | ||
200 | * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 | ||
201 | */ | ||
202 | struct sadb_x_nat_t_type { | ||
203 | __u16 sadb_x_nat_t_type_len; | ||
204 | __u16 sadb_x_nat_t_type_exttype; | ||
205 | __u8 sadb_x_nat_t_type_type; | ||
206 | __u8 sadb_x_nat_t_type_reserved[3]; | ||
207 | } __attribute__((packed)); | ||
208 | /* sizeof(struct sadb_x_nat_t_type) == 8 */ | ||
209 | |||
210 | /* Pass a NAT Traversal port (Source or Dest port) */ | ||
211 | struct sadb_x_nat_t_port { | ||
212 | __u16 sadb_x_nat_t_port_len; | ||
213 | __u16 sadb_x_nat_t_port_exttype; | ||
214 | __be16 sadb_x_nat_t_port_port; | ||
215 | __u16 sadb_x_nat_t_port_reserved; | ||
216 | } __attribute__((packed)); | ||
217 | /* sizeof(struct sadb_x_nat_t_port) == 8 */ | ||
218 | |||
219 | /* Generic LSM security context */ | ||
220 | struct sadb_x_sec_ctx { | ||
221 | __u16 sadb_x_sec_len; | ||
222 | __u16 sadb_x_sec_exttype; | ||
223 | __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ | ||
224 | __u8 sadb_x_ctx_doi; | ||
225 | __u16 sadb_x_ctx_len; | ||
226 | } __attribute__((packed)); | ||
227 | /* sizeof(struct sadb_sec_ctx) = 8 */ | ||
228 | |||
229 | /* Used by MIGRATE to pass addresses IKE will use to perform | ||
230 | * negotiation with the peer */ | ||
231 | struct sadb_x_kmaddress { | ||
232 | __u16 sadb_x_kmaddress_len; | ||
233 | __u16 sadb_x_kmaddress_exttype; | ||
234 | __u32 sadb_x_kmaddress_reserved; | ||
235 | } __attribute__((packed)); | ||
236 | /* sizeof(struct sadb_x_kmaddress) == 8 */ | ||
237 | |||
238 | /* Message types */ | ||
239 | #define SADB_RESERVED 0 | ||
240 | #define SADB_GETSPI 1 | ||
241 | #define SADB_UPDATE 2 | ||
242 | #define SADB_ADD 3 | ||
243 | #define SADB_DELETE 4 | ||
244 | #define SADB_GET 5 | ||
245 | #define SADB_ACQUIRE 6 | ||
246 | #define SADB_REGISTER 7 | ||
247 | #define SADB_EXPIRE 8 | ||
248 | #define SADB_FLUSH 9 | ||
249 | #define SADB_DUMP 10 | ||
250 | #define SADB_X_PROMISC 11 | ||
251 | #define SADB_X_PCHANGE 12 | ||
252 | #define SADB_X_SPDUPDATE 13 | ||
253 | #define SADB_X_SPDADD 14 | ||
254 | #define SADB_X_SPDDELETE 15 | ||
255 | #define SADB_X_SPDGET 16 | ||
256 | #define SADB_X_SPDACQUIRE 17 | ||
257 | #define SADB_X_SPDDUMP 18 | ||
258 | #define SADB_X_SPDFLUSH 19 | ||
259 | #define SADB_X_SPDSETIDX 20 | ||
260 | #define SADB_X_SPDEXPIRE 21 | ||
261 | #define SADB_X_SPDDELETE2 22 | ||
262 | #define SADB_X_NAT_T_NEW_MAPPING 23 | ||
263 | #define SADB_X_MIGRATE 24 | ||
264 | #define SADB_MAX 24 | ||
265 | |||
266 | /* Security Association flags */ | ||
267 | #define SADB_SAFLAGS_PFS 1 | ||
268 | #define SADB_SAFLAGS_NOPMTUDISC 0x20000000 | ||
269 | #define SADB_SAFLAGS_DECAP_DSCP 0x40000000 | ||
270 | #define SADB_SAFLAGS_NOECN 0x80000000 | ||
271 | |||
272 | /* Security Association states */ | ||
273 | #define SADB_SASTATE_LARVAL 0 | ||
274 | #define SADB_SASTATE_MATURE 1 | ||
275 | #define SADB_SASTATE_DYING 2 | ||
276 | #define SADB_SASTATE_DEAD 3 | ||
277 | #define SADB_SASTATE_MAX 3 | ||
278 | |||
279 | /* Security Association types */ | ||
280 | #define SADB_SATYPE_UNSPEC 0 | ||
281 | #define SADB_SATYPE_AH 2 | ||
282 | #define SADB_SATYPE_ESP 3 | ||
283 | #define SADB_SATYPE_RSVP 5 | ||
284 | #define SADB_SATYPE_OSPFV2 6 | ||
285 | #define SADB_SATYPE_RIPV2 7 | ||
286 | #define SADB_SATYPE_MIP 8 | ||
287 | #define SADB_X_SATYPE_IPCOMP 9 | ||
288 | #define SADB_SATYPE_MAX 9 | ||
289 | |||
290 | /* Authentication algorithms */ | ||
291 | #define SADB_AALG_NONE 0 | ||
292 | #define SADB_AALG_MD5HMAC 2 | ||
293 | #define SADB_AALG_SHA1HMAC 3 | ||
294 | #define SADB_X_AALG_SHA2_256HMAC 5 | ||
295 | #define SADB_X_AALG_SHA2_384HMAC 6 | ||
296 | #define SADB_X_AALG_SHA2_512HMAC 7 | ||
297 | #define SADB_X_AALG_RIPEMD160HMAC 8 | ||
298 | #define SADB_X_AALG_AES_XCBC_MAC 9 | ||
299 | #define SADB_X_AALG_NULL 251 /* kame */ | ||
300 | #define SADB_AALG_MAX 251 | ||
301 | |||
302 | /* Encryption algorithms */ | ||
303 | #define SADB_EALG_NONE 0 | ||
304 | #define SADB_EALG_DESCBC 2 | ||
305 | #define SADB_EALG_3DESCBC 3 | ||
306 | #define SADB_X_EALG_CASTCBC 6 | ||
307 | #define SADB_X_EALG_BLOWFISHCBC 7 | ||
308 | #define SADB_EALG_NULL 11 | ||
309 | #define SADB_X_EALG_AESCBC 12 | ||
310 | #define SADB_X_EALG_AESCTR 13 | ||
311 | #define SADB_X_EALG_AES_CCM_ICV8 14 | ||
312 | #define SADB_X_EALG_AES_CCM_ICV12 15 | ||
313 | #define SADB_X_EALG_AES_CCM_ICV16 16 | ||
314 | #define SADB_X_EALG_AES_GCM_ICV8 18 | ||
315 | #define SADB_X_EALG_AES_GCM_ICV12 19 | ||
316 | #define SADB_X_EALG_AES_GCM_ICV16 20 | ||
317 | #define SADB_X_EALG_CAMELLIACBC 22 | ||
318 | #define SADB_X_EALG_NULL_AES_GMAC 23 | ||
319 | #define SADB_EALG_MAX 253 /* last EALG */ | ||
320 | /* private allocations should use 249-255 (RFC2407) */ | ||
321 | #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ | ||
322 | #define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ | ||
323 | |||
324 | /* Compression algorithms */ | ||
325 | #define SADB_X_CALG_NONE 0 | ||
326 | #define SADB_X_CALG_OUI 1 | ||
327 | #define SADB_X_CALG_DEFLATE 2 | ||
328 | #define SADB_X_CALG_LZS 3 | ||
329 | #define SADB_X_CALG_LZJH 4 | ||
330 | #define SADB_X_CALG_MAX 4 | ||
331 | |||
332 | /* Extension Header values */ | ||
333 | #define SADB_EXT_RESERVED 0 | ||
334 | #define SADB_EXT_SA 1 | ||
335 | #define SADB_EXT_LIFETIME_CURRENT 2 | ||
336 | #define SADB_EXT_LIFETIME_HARD 3 | ||
337 | #define SADB_EXT_LIFETIME_SOFT 4 | ||
338 | #define SADB_EXT_ADDRESS_SRC 5 | ||
339 | #define SADB_EXT_ADDRESS_DST 6 | ||
340 | #define SADB_EXT_ADDRESS_PROXY 7 | ||
341 | #define SADB_EXT_KEY_AUTH 8 | ||
342 | #define SADB_EXT_KEY_ENCRYPT 9 | ||
343 | #define SADB_EXT_IDENTITY_SRC 10 | ||
344 | #define SADB_EXT_IDENTITY_DST 11 | ||
345 | #define SADB_EXT_SENSITIVITY 12 | ||
346 | #define SADB_EXT_PROPOSAL 13 | ||
347 | #define SADB_EXT_SUPPORTED_AUTH 14 | ||
348 | #define SADB_EXT_SUPPORTED_ENCRYPT 15 | ||
349 | #define SADB_EXT_SPIRANGE 16 | ||
350 | #define SADB_X_EXT_KMPRIVATE 17 | ||
351 | #define SADB_X_EXT_POLICY 18 | ||
352 | #define SADB_X_EXT_SA2 19 | ||
353 | /* The next four entries are for setting up NAT Traversal */ | ||
354 | #define SADB_X_EXT_NAT_T_TYPE 20 | ||
355 | #define SADB_X_EXT_NAT_T_SPORT 21 | ||
356 | #define SADB_X_EXT_NAT_T_DPORT 22 | ||
357 | #define SADB_X_EXT_NAT_T_OA 23 | ||
358 | #define SADB_X_EXT_SEC_CTX 24 | ||
359 | /* Used with MIGRATE to pass @ to IKE for negotiation */ | ||
360 | #define SADB_X_EXT_KMADDRESS 25 | ||
361 | #define SADB_EXT_MAX 25 | ||
362 | |||
363 | /* Identity Extension values */ | ||
364 | #define SADB_IDENTTYPE_RESERVED 0 | ||
365 | #define SADB_IDENTTYPE_PREFIX 1 | ||
366 | #define SADB_IDENTTYPE_FQDN 2 | ||
367 | #define SADB_IDENTTYPE_USERFQDN 3 | ||
368 | #define SADB_IDENTTYPE_MAX 3 | ||
369 | |||
370 | #endif /* !(_LINUX_PFKEY2_H) */ | ||
diff --git a/include/linux/pg.h b/include/linux/pg.h new file mode 100644 index 00000000000..db994bb0c79 --- /dev/null +++ b/include/linux/pg.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* pg.h (c) 1998 Grant R. Guenther <grant@torque.net> | ||
2 | Under the terms of the GNU General Public License | ||
3 | |||
4 | |||
5 | pg.h defines the user interface to the generic ATAPI packet | ||
6 | command driver for parallel port ATAPI devices (pg). The | ||
7 | driver is loosely modelled after the generic SCSI driver, sg, | ||
8 | although the actual interface is different. | ||
9 | |||
10 | The pg driver provides a simple character device interface for | ||
11 | sending ATAPI commands to a device. With the exception of the | ||
12 | ATAPI reset operation, all operations are performed by a pair | ||
13 | of read and write operations to the appropriate /dev/pgN device. | ||
14 | A write operation delivers a command and any outbound data in | ||
15 | a single buffer. Normally, the write will succeed unless the | ||
16 | device is offline or malfunctioning, or there is already another | ||
17 | command pending. If the write succeeds, it should be followed | ||
18 | immediately by a read operation, to obtain any returned data and | ||
19 | status information. A read will fail if there is no operation | ||
20 | in progress. | ||
21 | |||
22 | As a special case, the device can be reset with a write operation, | ||
23 | and in this case, no following read is expected, or permitted. | ||
24 | |||
25 | There are no ioctl() operations. Any single operation | ||
26 | may transfer at most PG_MAX_DATA bytes. Note that the driver must | ||
27 | copy the data through an internal buffer. In keeping with all | ||
28 | current ATAPI devices, command packets are assumed to be exactly | ||
29 | 12 bytes in length. | ||
30 | |||
31 | To permit future changes to this interface, the headers in the | ||
32 | read and write buffers contain a single character "magic" flag. | ||
33 | Currently this flag must be the character "P". | ||
34 | |||
35 | */ | ||
36 | |||
37 | #define PG_MAGIC 'P' | ||
38 | #define PG_RESET 'Z' | ||
39 | #define PG_COMMAND 'C' | ||
40 | |||
41 | #define PG_MAX_DATA 32768 | ||
42 | |||
43 | struct pg_write_hdr { | ||
44 | |||
45 | char magic; /* == PG_MAGIC */ | ||
46 | char func; /* PG_RESET or PG_COMMAND */ | ||
47 | int dlen; /* number of bytes expected to transfer */ | ||
48 | int timeout; /* number of seconds before timeout */ | ||
49 | char packet[12]; /* packet command */ | ||
50 | |||
51 | }; | ||
52 | |||
53 | struct pg_read_hdr { | ||
54 | |||
55 | char magic; /* == PG_MAGIC */ | ||
56 | char scsi; /* "scsi" status == sense key */ | ||
57 | int dlen; /* size of device transfer request */ | ||
58 | int duration; /* time in seconds command took */ | ||
59 | char pad[12]; /* not used */ | ||
60 | |||
61 | }; | ||
62 | |||
63 | /* end of pg.h */ | ||
diff --git a/include/linux/phantom.h b/include/linux/phantom.h new file mode 100644 index 00000000000..94dd6645c60 --- /dev/null +++ b/include/linux/phantom.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __PHANTOM_H | ||
11 | #define __PHANTOM_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | /* PHN_(G/S)ET_REG param */ | ||
16 | struct phm_reg { | ||
17 | __u32 reg; | ||
18 | __u32 value; | ||
19 | }; | ||
20 | |||
21 | /* PHN_(G/S)ET_REGS param */ | ||
22 | struct phm_regs { | ||
23 | __u32 count; | ||
24 | __u32 mask; | ||
25 | __u32 values[8]; | ||
26 | }; | ||
27 | |||
28 | #define PH_IOC_MAGIC 'p' | ||
29 | #define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) | ||
30 | #define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *) | ||
31 | #define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) | ||
32 | #define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *) | ||
33 | /* this ioctl tells the driver, that the caller is not OpenHaptics and might | ||
34 | * use improved registers update (no more phantom switchoffs when using | ||
35 | * libphantom) */ | ||
36 | #define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4) | ||
37 | #define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg) | ||
38 | #define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg) | ||
39 | #define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs) | ||
40 | #define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs) | ||
41 | |||
42 | #define PHN_CONTROL 0x6 /* control byte in iaddr space */ | ||
43 | #define PHN_CTL_AMP 0x1 /* switch after torques change */ | ||
44 | #define PHN_CTL_BUT 0x2 /* is button switched */ | ||
45 | #define PHN_CTL_IRQ 0x10 /* is irq enabled */ | ||
46 | |||
47 | #define PHN_ZERO_FORCE 2048 /* zero torque on motor */ | ||
48 | |||
49 | #endif | ||
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h new file mode 100644 index 00000000000..defbde203d0 --- /dev/null +++ b/include/linux/pkt_cls.h | |||
@@ -0,0 +1,467 @@ | |||
1 | #ifndef __LINUX_PKT_CLS_H | ||
2 | #define __LINUX_PKT_CLS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_sched.h> | ||
6 | |||
7 | /* I think i could have done better macros ; for now this is stolen from | ||
8 | * some arch/mips code - jhs | ||
9 | */ | ||
10 | #define _TC_MAKE32(x) ((x)) | ||
11 | |||
12 | #define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) | ||
13 | #define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n)) | ||
14 | #define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n)) | ||
15 | #define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n)) | ||
16 | |||
17 | /* verdict bit breakdown | ||
18 | * | ||
19 | bit 0: when set -> this packet has been munged already | ||
20 | |||
21 | bit 1: when set -> It is ok to munge this packet | ||
22 | |||
23 | bit 2,3,4,5: Reclassify counter - sort of reverse TTL - if exceeded | ||
24 | assume loop | ||
25 | |||
26 | bit 6,7: Where this packet was last seen | ||
27 | 0: Above the transmit example at the socket level | ||
28 | 1: on the Ingress | ||
29 | 2: on the Egress | ||
30 | |||
31 | bit 8: when set --> Request not to classify on ingress. | ||
32 | |||
33 | bits 9,10,11: redirect counter - redirect TTL. Loop avoidance | ||
34 | |||
35 | * | ||
36 | * */ | ||
37 | |||
38 | #define TC_MUNGED _TC_MAKEMASK1(0) | ||
39 | #define SET_TC_MUNGED(v) ( TC_MUNGED | (v & ~TC_MUNGED)) | ||
40 | #define CLR_TC_MUNGED(v) ( v & ~TC_MUNGED) | ||
41 | |||
42 | #define TC_OK2MUNGE _TC_MAKEMASK1(1) | ||
43 | #define SET_TC_OK2MUNGE(v) ( TC_OK2MUNGE | (v & ~TC_OK2MUNGE)) | ||
44 | #define CLR_TC_OK2MUNGE(v) ( v & ~TC_OK2MUNGE) | ||
45 | |||
46 | #define S_TC_VERD _TC_MAKE32(2) | ||
47 | #define M_TC_VERD _TC_MAKEMASK(4,S_TC_VERD) | ||
48 | #define G_TC_VERD(x) _TC_GETVALUE(x,S_TC_VERD,M_TC_VERD) | ||
49 | #define V_TC_VERD(x) _TC_MAKEVALUE(x,S_TC_VERD) | ||
50 | #define SET_TC_VERD(v,n) ((V_TC_VERD(n)) | (v & ~M_TC_VERD)) | ||
51 | |||
52 | #define S_TC_FROM _TC_MAKE32(6) | ||
53 | #define M_TC_FROM _TC_MAKEMASK(2,S_TC_FROM) | ||
54 | #define G_TC_FROM(x) _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM) | ||
55 | #define V_TC_FROM(x) _TC_MAKEVALUE(x,S_TC_FROM) | ||
56 | #define SET_TC_FROM(v,n) ((V_TC_FROM(n)) | (v & ~M_TC_FROM)) | ||
57 | #define AT_STACK 0x0 | ||
58 | #define AT_INGRESS 0x1 | ||
59 | #define AT_EGRESS 0x2 | ||
60 | |||
61 | #define TC_NCLS _TC_MAKEMASK1(8) | ||
62 | #define SET_TC_NCLS(v) ( TC_NCLS | (v & ~TC_NCLS)) | ||
63 | #define CLR_TC_NCLS(v) ( v & ~TC_NCLS) | ||
64 | |||
65 | #define S_TC_RTTL _TC_MAKE32(9) | ||
66 | #define M_TC_RTTL _TC_MAKEMASK(3,S_TC_RTTL) | ||
67 | #define G_TC_RTTL(x) _TC_GETVALUE(x,S_TC_RTTL,M_TC_RTTL) | ||
68 | #define V_TC_RTTL(x) _TC_MAKEVALUE(x,S_TC_RTTL) | ||
69 | #define SET_TC_RTTL(v,n) ((V_TC_RTTL(n)) | (v & ~M_TC_RTTL)) | ||
70 | |||
71 | #define S_TC_AT _TC_MAKE32(12) | ||
72 | #define M_TC_AT _TC_MAKEMASK(2,S_TC_AT) | ||
73 | #define G_TC_AT(x) _TC_GETVALUE(x,S_TC_AT,M_TC_AT) | ||
74 | #define V_TC_AT(x) _TC_MAKEVALUE(x,S_TC_AT) | ||
75 | #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) | ||
76 | |||
77 | /* Action attributes */ | ||
78 | enum { | ||
79 | TCA_ACT_UNSPEC, | ||
80 | TCA_ACT_KIND, | ||
81 | TCA_ACT_OPTIONS, | ||
82 | TCA_ACT_INDEX, | ||
83 | TCA_ACT_STATS, | ||
84 | __TCA_ACT_MAX | ||
85 | }; | ||
86 | |||
87 | #define TCA_ACT_MAX __TCA_ACT_MAX | ||
88 | #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) | ||
89 | #define TCA_ACT_MAX_PRIO 32 | ||
90 | #define TCA_ACT_BIND 1 | ||
91 | #define TCA_ACT_NOBIND 0 | ||
92 | #define TCA_ACT_UNBIND 1 | ||
93 | #define TCA_ACT_NOUNBIND 0 | ||
94 | #define TCA_ACT_REPLACE 1 | ||
95 | #define TCA_ACT_NOREPLACE 0 | ||
96 | #define MAX_REC_LOOP 4 | ||
97 | #define MAX_RED_LOOP 4 | ||
98 | |||
99 | #define TC_ACT_UNSPEC (-1) | ||
100 | #define TC_ACT_OK 0 | ||
101 | #define TC_ACT_RECLASSIFY 1 | ||
102 | #define TC_ACT_SHOT 2 | ||
103 | #define TC_ACT_PIPE 3 | ||
104 | #define TC_ACT_STOLEN 4 | ||
105 | #define TC_ACT_QUEUED 5 | ||
106 | #define TC_ACT_REPEAT 6 | ||
107 | #define TC_ACT_JUMP 0x10000000 | ||
108 | |||
109 | /* Action type identifiers*/ | ||
110 | enum { | ||
111 | TCA_ID_UNSPEC=0, | ||
112 | TCA_ID_POLICE=1, | ||
113 | /* other actions go here */ | ||
114 | __TCA_ID_MAX=255 | ||
115 | }; | ||
116 | |||
117 | #define TCA_ID_MAX __TCA_ID_MAX | ||
118 | |||
119 | struct tc_police { | ||
120 | __u32 index; | ||
121 | int action; | ||
122 | #define TC_POLICE_UNSPEC TC_ACT_UNSPEC | ||
123 | #define TC_POLICE_OK TC_ACT_OK | ||
124 | #define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY | ||
125 | #define TC_POLICE_SHOT TC_ACT_SHOT | ||
126 | #define TC_POLICE_PIPE TC_ACT_PIPE | ||
127 | |||
128 | __u32 limit; | ||
129 | __u32 burst; | ||
130 | __u32 mtu; | ||
131 | struct tc_ratespec rate; | ||
132 | struct tc_ratespec peakrate; | ||
133 | int refcnt; | ||
134 | int bindcnt; | ||
135 | __u32 capab; | ||
136 | }; | ||
137 | |||
138 | struct tcf_t { | ||
139 | __u64 install; | ||
140 | __u64 lastuse; | ||
141 | __u64 expires; | ||
142 | }; | ||
143 | |||
144 | struct tc_cnt { | ||
145 | int refcnt; | ||
146 | int bindcnt; | ||
147 | }; | ||
148 | |||
149 | #define tc_gen \ | ||
150 | __u32 index; \ | ||
151 | __u32 capab; \ | ||
152 | int action; \ | ||
153 | int refcnt; \ | ||
154 | int bindcnt | ||
155 | |||
156 | enum { | ||
157 | TCA_POLICE_UNSPEC, | ||
158 | TCA_POLICE_TBF, | ||
159 | TCA_POLICE_RATE, | ||
160 | TCA_POLICE_PEAKRATE, | ||
161 | TCA_POLICE_AVRATE, | ||
162 | TCA_POLICE_RESULT, | ||
163 | __TCA_POLICE_MAX | ||
164 | #define TCA_POLICE_RESULT TCA_POLICE_RESULT | ||
165 | }; | ||
166 | |||
167 | #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) | ||
168 | |||
169 | /* U32 filters */ | ||
170 | |||
171 | #define TC_U32_HTID(h) ((h)&0xFFF00000) | ||
172 | #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) | ||
173 | #define TC_U32_HASH(h) (((h)>>12)&0xFF) | ||
174 | #define TC_U32_NODE(h) ((h)&0xFFF) | ||
175 | #define TC_U32_KEY(h) ((h)&0xFFFFF) | ||
176 | #define TC_U32_UNSPEC 0 | ||
177 | #define TC_U32_ROOT (0xFFF00000) | ||
178 | |||
179 | enum { | ||
180 | TCA_U32_UNSPEC, | ||
181 | TCA_U32_CLASSID, | ||
182 | TCA_U32_HASH, | ||
183 | TCA_U32_LINK, | ||
184 | TCA_U32_DIVISOR, | ||
185 | TCA_U32_SEL, | ||
186 | TCA_U32_POLICE, | ||
187 | TCA_U32_ACT, | ||
188 | TCA_U32_INDEV, | ||
189 | TCA_U32_PCNT, | ||
190 | TCA_U32_MARK, | ||
191 | __TCA_U32_MAX | ||
192 | }; | ||
193 | |||
194 | #define TCA_U32_MAX (__TCA_U32_MAX - 1) | ||
195 | |||
196 | struct tc_u32_key { | ||
197 | __be32 mask; | ||
198 | __be32 val; | ||
199 | int off; | ||
200 | int offmask; | ||
201 | }; | ||
202 | |||
203 | struct tc_u32_sel { | ||
204 | unsigned char flags; | ||
205 | unsigned char offshift; | ||
206 | unsigned char nkeys; | ||
207 | |||
208 | __be16 offmask; | ||
209 | __u16 off; | ||
210 | short offoff; | ||
211 | |||
212 | short hoff; | ||
213 | __be32 hmask; | ||
214 | struct tc_u32_key keys[0]; | ||
215 | }; | ||
216 | |||
217 | struct tc_u32_mark { | ||
218 | __u32 val; | ||
219 | __u32 mask; | ||
220 | __u32 success; | ||
221 | }; | ||
222 | |||
223 | struct tc_u32_pcnt { | ||
224 | __u64 rcnt; | ||
225 | __u64 rhit; | ||
226 | __u64 kcnts[0]; | ||
227 | }; | ||
228 | |||
229 | /* Flags */ | ||
230 | |||
231 | #define TC_U32_TERMINAL 1 | ||
232 | #define TC_U32_OFFSET 2 | ||
233 | #define TC_U32_VAROFFSET 4 | ||
234 | #define TC_U32_EAT 8 | ||
235 | |||
236 | #define TC_U32_MAXDEPTH 8 | ||
237 | |||
238 | |||
239 | /* RSVP filter */ | ||
240 | |||
241 | enum { | ||
242 | TCA_RSVP_UNSPEC, | ||
243 | TCA_RSVP_CLASSID, | ||
244 | TCA_RSVP_DST, | ||
245 | TCA_RSVP_SRC, | ||
246 | TCA_RSVP_PINFO, | ||
247 | TCA_RSVP_POLICE, | ||
248 | TCA_RSVP_ACT, | ||
249 | __TCA_RSVP_MAX | ||
250 | }; | ||
251 | |||
252 | #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) | ||
253 | |||
254 | struct tc_rsvp_gpi { | ||
255 | __u32 key; | ||
256 | __u32 mask; | ||
257 | int offset; | ||
258 | }; | ||
259 | |||
260 | struct tc_rsvp_pinfo { | ||
261 | struct tc_rsvp_gpi dpi; | ||
262 | struct tc_rsvp_gpi spi; | ||
263 | __u8 protocol; | ||
264 | __u8 tunnelid; | ||
265 | __u8 tunnelhdr; | ||
266 | __u8 pad; | ||
267 | }; | ||
268 | |||
269 | /* ROUTE filter */ | ||
270 | |||
271 | enum { | ||
272 | TCA_ROUTE4_UNSPEC, | ||
273 | TCA_ROUTE4_CLASSID, | ||
274 | TCA_ROUTE4_TO, | ||
275 | TCA_ROUTE4_FROM, | ||
276 | TCA_ROUTE4_IIF, | ||
277 | TCA_ROUTE4_POLICE, | ||
278 | TCA_ROUTE4_ACT, | ||
279 | __TCA_ROUTE4_MAX | ||
280 | }; | ||
281 | |||
282 | #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) | ||
283 | |||
284 | |||
285 | /* FW filter */ | ||
286 | |||
287 | enum { | ||
288 | TCA_FW_UNSPEC, | ||
289 | TCA_FW_CLASSID, | ||
290 | TCA_FW_POLICE, | ||
291 | TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ | ||
292 | TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ | ||
293 | TCA_FW_MASK, | ||
294 | __TCA_FW_MAX | ||
295 | }; | ||
296 | |||
297 | #define TCA_FW_MAX (__TCA_FW_MAX - 1) | ||
298 | |||
299 | /* TC index filter */ | ||
300 | |||
301 | enum { | ||
302 | TCA_TCINDEX_UNSPEC, | ||
303 | TCA_TCINDEX_HASH, | ||
304 | TCA_TCINDEX_MASK, | ||
305 | TCA_TCINDEX_SHIFT, | ||
306 | TCA_TCINDEX_FALL_THROUGH, | ||
307 | TCA_TCINDEX_CLASSID, | ||
308 | TCA_TCINDEX_POLICE, | ||
309 | TCA_TCINDEX_ACT, | ||
310 | __TCA_TCINDEX_MAX | ||
311 | }; | ||
312 | |||
313 | #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) | ||
314 | |||
315 | /* Flow filter */ | ||
316 | |||
317 | enum { | ||
318 | FLOW_KEY_SRC, | ||
319 | FLOW_KEY_DST, | ||
320 | FLOW_KEY_PROTO, | ||
321 | FLOW_KEY_PROTO_SRC, | ||
322 | FLOW_KEY_PROTO_DST, | ||
323 | FLOW_KEY_IIF, | ||
324 | FLOW_KEY_PRIORITY, | ||
325 | FLOW_KEY_MARK, | ||
326 | FLOW_KEY_NFCT, | ||
327 | FLOW_KEY_NFCT_SRC, | ||
328 | FLOW_KEY_NFCT_DST, | ||
329 | FLOW_KEY_NFCT_PROTO_SRC, | ||
330 | FLOW_KEY_NFCT_PROTO_DST, | ||
331 | FLOW_KEY_RTCLASSID, | ||
332 | FLOW_KEY_SKUID, | ||
333 | FLOW_KEY_SKGID, | ||
334 | FLOW_KEY_VLAN_TAG, | ||
335 | FLOW_KEY_RXHASH, | ||
336 | __FLOW_KEY_MAX, | ||
337 | }; | ||
338 | |||
339 | #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) | ||
340 | |||
341 | enum { | ||
342 | FLOW_MODE_MAP, | ||
343 | FLOW_MODE_HASH, | ||
344 | }; | ||
345 | |||
346 | enum { | ||
347 | TCA_FLOW_UNSPEC, | ||
348 | TCA_FLOW_KEYS, | ||
349 | TCA_FLOW_MODE, | ||
350 | TCA_FLOW_BASECLASS, | ||
351 | TCA_FLOW_RSHIFT, | ||
352 | TCA_FLOW_ADDEND, | ||
353 | TCA_FLOW_MASK, | ||
354 | TCA_FLOW_XOR, | ||
355 | TCA_FLOW_DIVISOR, | ||
356 | TCA_FLOW_ACT, | ||
357 | TCA_FLOW_POLICE, | ||
358 | TCA_FLOW_EMATCHES, | ||
359 | TCA_FLOW_PERTURB, | ||
360 | __TCA_FLOW_MAX | ||
361 | }; | ||
362 | |||
363 | #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) | ||
364 | |||
365 | /* Basic filter */ | ||
366 | |||
367 | enum { | ||
368 | TCA_BASIC_UNSPEC, | ||
369 | TCA_BASIC_CLASSID, | ||
370 | TCA_BASIC_EMATCHES, | ||
371 | TCA_BASIC_ACT, | ||
372 | TCA_BASIC_POLICE, | ||
373 | __TCA_BASIC_MAX | ||
374 | }; | ||
375 | |||
376 | #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) | ||
377 | |||
378 | |||
379 | /* Cgroup classifier */ | ||
380 | |||
381 | enum { | ||
382 | TCA_CGROUP_UNSPEC, | ||
383 | TCA_CGROUP_ACT, | ||
384 | TCA_CGROUP_POLICE, | ||
385 | TCA_CGROUP_EMATCHES, | ||
386 | __TCA_CGROUP_MAX, | ||
387 | }; | ||
388 | |||
389 | #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) | ||
390 | |||
391 | /* Extended Matches */ | ||
392 | |||
393 | struct tcf_ematch_tree_hdr { | ||
394 | __u16 nmatches; | ||
395 | __u16 progid; | ||
396 | }; | ||
397 | |||
398 | enum { | ||
399 | TCA_EMATCH_TREE_UNSPEC, | ||
400 | TCA_EMATCH_TREE_HDR, | ||
401 | TCA_EMATCH_TREE_LIST, | ||
402 | __TCA_EMATCH_TREE_MAX | ||
403 | }; | ||
404 | #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) | ||
405 | |||
406 | struct tcf_ematch_hdr { | ||
407 | __u16 matchid; | ||
408 | __u16 kind; | ||
409 | __u16 flags; | ||
410 | __u16 pad; /* currently unused */ | ||
411 | }; | ||
412 | |||
413 | /* 0 1 | ||
414 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 | ||
415 | * +-----------------------+-+-+---+ | ||
416 | * | Unused |S|I| R | | ||
417 | * +-----------------------+-+-+---+ | ||
418 | * | ||
419 | * R(2) ::= relation to next ematch | ||
420 | * where: 0 0 END (last ematch) | ||
421 | * 0 1 AND | ||
422 | * 1 0 OR | ||
423 | * 1 1 Unused (invalid) | ||
424 | * I(1) ::= invert result | ||
425 | * S(1) ::= simple payload | ||
426 | */ | ||
427 | #define TCF_EM_REL_END 0 | ||
428 | #define TCF_EM_REL_AND (1<<0) | ||
429 | #define TCF_EM_REL_OR (1<<1) | ||
430 | #define TCF_EM_INVERT (1<<2) | ||
431 | #define TCF_EM_SIMPLE (1<<3) | ||
432 | |||
433 | #define TCF_EM_REL_MASK 3 | ||
434 | #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) | ||
435 | |||
436 | enum { | ||
437 | TCF_LAYER_LINK, | ||
438 | TCF_LAYER_NETWORK, | ||
439 | TCF_LAYER_TRANSPORT, | ||
440 | __TCF_LAYER_MAX | ||
441 | }; | ||
442 | #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) | ||
443 | |||
444 | /* Ematch type assignments | ||
445 | * 1..32767 Reserved for ematches inside kernel tree | ||
446 | * 32768..65535 Free to use, not reliable | ||
447 | */ | ||
448 | #define TCF_EM_CONTAINER 0 | ||
449 | #define TCF_EM_CMP 1 | ||
450 | #define TCF_EM_NBYTE 2 | ||
451 | #define TCF_EM_U32 3 | ||
452 | #define TCF_EM_META 4 | ||
453 | #define TCF_EM_TEXT 5 | ||
454 | #define TCF_EM_VLAN 6 | ||
455 | #define TCF_EM_MAX 6 | ||
456 | |||
457 | enum { | ||
458 | TCF_EM_PROG_TC | ||
459 | }; | ||
460 | |||
461 | enum { | ||
462 | TCF_EM_OPND_EQ, | ||
463 | TCF_EM_OPND_GT, | ||
464 | TCF_EM_OPND_LT | ||
465 | }; | ||
466 | |||
467 | #endif | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h new file mode 100644 index 00000000000..c5336705921 --- /dev/null +++ b/include/linux/pkt_sched.h | |||
@@ -0,0 +1,606 @@ | |||
1 | #ifndef __LINUX_PKT_SCHED_H | ||
2 | #define __LINUX_PKT_SCHED_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Logical priority bands not depending on specific packet scheduler. | ||
7 | Every scheduler will map them to real traffic classes, if it has | ||
8 | no more precise mechanism to classify packets. | ||
9 | |||
10 | These numbers have no special meaning, though their coincidence | ||
11 | with obsolete IPv6 values is not occasional :-). New IPv6 drafts | ||
12 | preferred full anarchy inspired by diffserv group. | ||
13 | |||
14 | Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy | ||
15 | class, actually, as rule it will be handled with more care than | ||
16 | filler or even bulk. | ||
17 | */ | ||
18 | |||
19 | #define TC_PRIO_BESTEFFORT 0 | ||
20 | #define TC_PRIO_FILLER 1 | ||
21 | #define TC_PRIO_BULK 2 | ||
22 | #define TC_PRIO_INTERACTIVE_BULK 4 | ||
23 | #define TC_PRIO_INTERACTIVE 6 | ||
24 | #define TC_PRIO_CONTROL 7 | ||
25 | |||
26 | #define TC_PRIO_MAX 15 | ||
27 | |||
28 | /* Generic queue statistics, available for all the elements. | ||
29 | Particular schedulers may have also their private records. | ||
30 | */ | ||
31 | |||
32 | struct tc_stats { | ||
33 | __u64 bytes; /* NUmber of enqueues bytes */ | ||
34 | __u32 packets; /* Number of enqueued packets */ | ||
35 | __u32 drops; /* Packets dropped because of lack of resources */ | ||
36 | __u32 overlimits; /* Number of throttle events when this | ||
37 | * flow goes out of allocated bandwidth */ | ||
38 | __u32 bps; /* Current flow byte rate */ | ||
39 | __u32 pps; /* Current flow packet rate */ | ||
40 | __u32 qlen; | ||
41 | __u32 backlog; | ||
42 | }; | ||
43 | |||
44 | struct tc_estimator { | ||
45 | signed char interval; | ||
46 | unsigned char ewma_log; | ||
47 | }; | ||
48 | |||
49 | /* "Handles" | ||
50 | --------- | ||
51 | |||
52 | All the traffic control objects have 32bit identifiers, or "handles". | ||
53 | |||
54 | They can be considered as opaque numbers from user API viewpoint, | ||
55 | but actually they always consist of two fields: major and | ||
56 | minor numbers, which are interpreted by kernel specially, | ||
57 | that may be used by applications, though not recommended. | ||
58 | |||
59 | F.e. qdisc handles always have minor number equal to zero, | ||
60 | classes (or flows) have major equal to parent qdisc major, and | ||
61 | minor uniquely identifying class inside qdisc. | ||
62 | |||
63 | Macros to manipulate handles: | ||
64 | */ | ||
65 | |||
66 | #define TC_H_MAJ_MASK (0xFFFF0000U) | ||
67 | #define TC_H_MIN_MASK (0x0000FFFFU) | ||
68 | #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) | ||
69 | #define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) | ||
70 | #define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) | ||
71 | |||
72 | #define TC_H_UNSPEC (0U) | ||
73 | #define TC_H_ROOT (0xFFFFFFFFU) | ||
74 | #define TC_H_INGRESS (0xFFFFFFF1U) | ||
75 | |||
76 | struct tc_ratespec { | ||
77 | unsigned char cell_log; | ||
78 | unsigned char __reserved; | ||
79 | unsigned short overhead; | ||
80 | short cell_align; | ||
81 | unsigned short mpu; | ||
82 | __u32 rate; | ||
83 | }; | ||
84 | |||
85 | #define TC_RTAB_SIZE 1024 | ||
86 | |||
87 | struct tc_sizespec { | ||
88 | unsigned char cell_log; | ||
89 | unsigned char size_log; | ||
90 | short cell_align; | ||
91 | int overhead; | ||
92 | unsigned int linklayer; | ||
93 | unsigned int mpu; | ||
94 | unsigned int mtu; | ||
95 | unsigned int tsize; | ||
96 | }; | ||
97 | |||
98 | enum { | ||
99 | TCA_STAB_UNSPEC, | ||
100 | TCA_STAB_BASE, | ||
101 | TCA_STAB_DATA, | ||
102 | __TCA_STAB_MAX | ||
103 | }; | ||
104 | |||
105 | #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) | ||
106 | |||
107 | /* FIFO section */ | ||
108 | |||
109 | struct tc_fifo_qopt { | ||
110 | __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ | ||
111 | }; | ||
112 | |||
113 | /* PRIO section */ | ||
114 | |||
115 | #define TCQ_PRIO_BANDS 16 | ||
116 | #define TCQ_MIN_PRIO_BANDS 2 | ||
117 | |||
118 | struct tc_prio_qopt { | ||
119 | int bands; /* Number of bands */ | ||
120 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ | ||
121 | }; | ||
122 | |||
123 | /* MULTIQ section */ | ||
124 | |||
125 | struct tc_multiq_qopt { | ||
126 | __u16 bands; /* Number of bands */ | ||
127 | __u16 max_bands; /* Maximum number of queues */ | ||
128 | }; | ||
129 | |||
130 | /* TBF section */ | ||
131 | |||
132 | struct tc_tbf_qopt { | ||
133 | struct tc_ratespec rate; | ||
134 | struct tc_ratespec peakrate; | ||
135 | __u32 limit; | ||
136 | __u32 buffer; | ||
137 | __u32 mtu; | ||
138 | }; | ||
139 | |||
140 | enum { | ||
141 | TCA_TBF_UNSPEC, | ||
142 | TCA_TBF_PARMS, | ||
143 | TCA_TBF_RTAB, | ||
144 | TCA_TBF_PTAB, | ||
145 | __TCA_TBF_MAX, | ||
146 | }; | ||
147 | |||
148 | #define TCA_TBF_MAX (__TCA_TBF_MAX - 1) | ||
149 | |||
150 | |||
151 | /* TEQL section */ | ||
152 | |||
153 | /* TEQL does not require any parameters */ | ||
154 | |||
155 | /* SFQ section */ | ||
156 | |||
157 | struct tc_sfq_qopt { | ||
158 | unsigned quantum; /* Bytes per round allocated to flow */ | ||
159 | int perturb_period; /* Period of hash perturbation */ | ||
160 | __u32 limit; /* Maximal packets in queue */ | ||
161 | unsigned divisor; /* Hash divisor */ | ||
162 | unsigned flows; /* Maximal number of flows */ | ||
163 | }; | ||
164 | |||
165 | struct tc_sfq_xstats { | ||
166 | __s32 allot; | ||
167 | }; | ||
168 | |||
169 | /* | ||
170 | * NOTE: limit, divisor and flows are hardwired to code at the moment. | ||
171 | * | ||
172 | * limit=flows=128, divisor=1024; | ||
173 | * | ||
174 | * The only reason for this is efficiency, it is possible | ||
175 | * to change these parameters in compile time. | ||
176 | */ | ||
177 | |||
178 | /* RED section */ | ||
179 | |||
180 | enum { | ||
181 | TCA_RED_UNSPEC, | ||
182 | TCA_RED_PARMS, | ||
183 | TCA_RED_STAB, | ||
184 | __TCA_RED_MAX, | ||
185 | }; | ||
186 | |||
187 | #define TCA_RED_MAX (__TCA_RED_MAX - 1) | ||
188 | |||
189 | struct tc_red_qopt { | ||
190 | __u32 limit; /* HARD maximal queue length (bytes) */ | ||
191 | __u32 qth_min; /* Min average length threshold (bytes) */ | ||
192 | __u32 qth_max; /* Max average length threshold (bytes) */ | ||
193 | unsigned char Wlog; /* log(W) */ | ||
194 | unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | ||
195 | unsigned char Scell_log; /* cell size for idle damping */ | ||
196 | unsigned char flags; | ||
197 | #define TC_RED_ECN 1 | ||
198 | #define TC_RED_HARDDROP 2 | ||
199 | }; | ||
200 | |||
201 | struct tc_red_xstats { | ||
202 | __u32 early; /* Early drops */ | ||
203 | __u32 pdrop; /* Drops due to queue limits */ | ||
204 | __u32 other; /* Drops due to drop() calls */ | ||
205 | __u32 marked; /* Marked packets */ | ||
206 | }; | ||
207 | |||
208 | /* GRED section */ | ||
209 | |||
210 | #define MAX_DPs 16 | ||
211 | |||
212 | enum { | ||
213 | TCA_GRED_UNSPEC, | ||
214 | TCA_GRED_PARMS, | ||
215 | TCA_GRED_STAB, | ||
216 | TCA_GRED_DPS, | ||
217 | __TCA_GRED_MAX, | ||
218 | }; | ||
219 | |||
220 | #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) | ||
221 | |||
222 | struct tc_gred_qopt { | ||
223 | __u32 limit; /* HARD maximal queue length (bytes) */ | ||
224 | __u32 qth_min; /* Min average length threshold (bytes) */ | ||
225 | __u32 qth_max; /* Max average length threshold (bytes) */ | ||
226 | __u32 DP; /* up to 2^32 DPs */ | ||
227 | __u32 backlog; | ||
228 | __u32 qave; | ||
229 | __u32 forced; | ||
230 | __u32 early; | ||
231 | __u32 other; | ||
232 | __u32 pdrop; | ||
233 | __u8 Wlog; /* log(W) */ | ||
234 | __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ | ||
235 | __u8 Scell_log; /* cell size for idle damping */ | ||
236 | __u8 prio; /* prio of this VQ */ | ||
237 | __u32 packets; | ||
238 | __u32 bytesin; | ||
239 | }; | ||
240 | |||
241 | /* gred setup */ | ||
242 | struct tc_gred_sopt { | ||
243 | __u32 DPs; | ||
244 | __u32 def_DP; | ||
245 | __u8 grio; | ||
246 | __u8 flags; | ||
247 | __u16 pad1; | ||
248 | }; | ||
249 | |||
250 | /* CHOKe section */ | ||
251 | |||
252 | enum { | ||
253 | TCA_CHOKE_UNSPEC, | ||
254 | TCA_CHOKE_PARMS, | ||
255 | TCA_CHOKE_STAB, | ||
256 | __TCA_CHOKE_MAX, | ||
257 | }; | ||
258 | |||
259 | #define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) | ||
260 | |||
261 | struct tc_choke_qopt { | ||
262 | __u32 limit; /* Hard queue length (packets) */ | ||
263 | __u32 qth_min; /* Min average threshold (packets) */ | ||
264 | __u32 qth_max; /* Max average threshold (packets) */ | ||
265 | unsigned char Wlog; /* log(W) */ | ||
266 | unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | ||
267 | unsigned char Scell_log; /* cell size for idle damping */ | ||
268 | unsigned char flags; /* see RED flags */ | ||
269 | }; | ||
270 | |||
271 | struct tc_choke_xstats { | ||
272 | __u32 early; /* Early drops */ | ||
273 | __u32 pdrop; /* Drops due to queue limits */ | ||
274 | __u32 other; /* Drops due to drop() calls */ | ||
275 | __u32 marked; /* Marked packets */ | ||
276 | __u32 matched; /* Drops due to flow match */ | ||
277 | }; | ||
278 | |||
279 | /* HTB section */ | ||
280 | #define TC_HTB_NUMPRIO 8 | ||
281 | #define TC_HTB_MAXDEPTH 8 | ||
282 | #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ | ||
283 | |||
284 | struct tc_htb_opt { | ||
285 | struct tc_ratespec rate; | ||
286 | struct tc_ratespec ceil; | ||
287 | __u32 buffer; | ||
288 | __u32 cbuffer; | ||
289 | __u32 quantum; | ||
290 | __u32 level; /* out only */ | ||
291 | __u32 prio; | ||
292 | }; | ||
293 | struct tc_htb_glob { | ||
294 | __u32 version; /* to match HTB/TC */ | ||
295 | __u32 rate2quantum; /* bps->quantum divisor */ | ||
296 | __u32 defcls; /* default class number */ | ||
297 | __u32 debug; /* debug flags */ | ||
298 | |||
299 | /* stats */ | ||
300 | __u32 direct_pkts; /* count of non shapped packets */ | ||
301 | }; | ||
302 | enum { | ||
303 | TCA_HTB_UNSPEC, | ||
304 | TCA_HTB_PARMS, | ||
305 | TCA_HTB_INIT, | ||
306 | TCA_HTB_CTAB, | ||
307 | TCA_HTB_RTAB, | ||
308 | __TCA_HTB_MAX, | ||
309 | }; | ||
310 | |||
311 | #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) | ||
312 | |||
313 | struct tc_htb_xstats { | ||
314 | __u32 lends; | ||
315 | __u32 borrows; | ||
316 | __u32 giants; /* too big packets (rate will not be accurate) */ | ||
317 | __u32 tokens; | ||
318 | __u32 ctokens; | ||
319 | }; | ||
320 | |||
321 | /* HFSC section */ | ||
322 | |||
323 | struct tc_hfsc_qopt { | ||
324 | __u16 defcls; /* default class */ | ||
325 | }; | ||
326 | |||
327 | struct tc_service_curve { | ||
328 | __u32 m1; /* slope of the first segment in bps */ | ||
329 | __u32 d; /* x-projection of the first segment in us */ | ||
330 | __u32 m2; /* slope of the second segment in bps */ | ||
331 | }; | ||
332 | |||
333 | struct tc_hfsc_stats { | ||
334 | __u64 work; /* total work done */ | ||
335 | __u64 rtwork; /* work done by real-time criteria */ | ||
336 | __u32 period; /* current period */ | ||
337 | __u32 level; /* class level in hierarchy */ | ||
338 | }; | ||
339 | |||
340 | enum { | ||
341 | TCA_HFSC_UNSPEC, | ||
342 | TCA_HFSC_RSC, | ||
343 | TCA_HFSC_FSC, | ||
344 | TCA_HFSC_USC, | ||
345 | __TCA_HFSC_MAX, | ||
346 | }; | ||
347 | |||
348 | #define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) | ||
349 | |||
350 | |||
351 | /* CBQ section */ | ||
352 | |||
353 | #define TC_CBQ_MAXPRIO 8 | ||
354 | #define TC_CBQ_MAXLEVEL 8 | ||
355 | #define TC_CBQ_DEF_EWMA 5 | ||
356 | |||
357 | struct tc_cbq_lssopt { | ||
358 | unsigned char change; | ||
359 | unsigned char flags; | ||
360 | #define TCF_CBQ_LSS_BOUNDED 1 | ||
361 | #define TCF_CBQ_LSS_ISOLATED 2 | ||
362 | unsigned char ewma_log; | ||
363 | unsigned char level; | ||
364 | #define TCF_CBQ_LSS_FLAGS 1 | ||
365 | #define TCF_CBQ_LSS_EWMA 2 | ||
366 | #define TCF_CBQ_LSS_MAXIDLE 4 | ||
367 | #define TCF_CBQ_LSS_MINIDLE 8 | ||
368 | #define TCF_CBQ_LSS_OFFTIME 0x10 | ||
369 | #define TCF_CBQ_LSS_AVPKT 0x20 | ||
370 | __u32 maxidle; | ||
371 | __u32 minidle; | ||
372 | __u32 offtime; | ||
373 | __u32 avpkt; | ||
374 | }; | ||
375 | |||
376 | struct tc_cbq_wrropt { | ||
377 | unsigned char flags; | ||
378 | unsigned char priority; | ||
379 | unsigned char cpriority; | ||
380 | unsigned char __reserved; | ||
381 | __u32 allot; | ||
382 | __u32 weight; | ||
383 | }; | ||
384 | |||
385 | struct tc_cbq_ovl { | ||
386 | unsigned char strategy; | ||
387 | #define TC_CBQ_OVL_CLASSIC 0 | ||
388 | #define TC_CBQ_OVL_DELAY 1 | ||
389 | #define TC_CBQ_OVL_LOWPRIO 2 | ||
390 | #define TC_CBQ_OVL_DROP 3 | ||
391 | #define TC_CBQ_OVL_RCLASSIC 4 | ||
392 | unsigned char priority2; | ||
393 | __u16 pad; | ||
394 | __u32 penalty; | ||
395 | }; | ||
396 | |||
397 | struct tc_cbq_police { | ||
398 | unsigned char police; | ||
399 | unsigned char __res1; | ||
400 | unsigned short __res2; | ||
401 | }; | ||
402 | |||
403 | struct tc_cbq_fopt { | ||
404 | __u32 split; | ||
405 | __u32 defmap; | ||
406 | __u32 defchange; | ||
407 | }; | ||
408 | |||
409 | struct tc_cbq_xstats { | ||
410 | __u32 borrows; | ||
411 | __u32 overactions; | ||
412 | __s32 avgidle; | ||
413 | __s32 undertime; | ||
414 | }; | ||
415 | |||
416 | enum { | ||
417 | TCA_CBQ_UNSPEC, | ||
418 | TCA_CBQ_LSSOPT, | ||
419 | TCA_CBQ_WRROPT, | ||
420 | TCA_CBQ_FOPT, | ||
421 | TCA_CBQ_OVL_STRATEGY, | ||
422 | TCA_CBQ_RATE, | ||
423 | TCA_CBQ_RTAB, | ||
424 | TCA_CBQ_POLICE, | ||
425 | __TCA_CBQ_MAX, | ||
426 | }; | ||
427 | |||
428 | #define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) | ||
429 | |||
430 | /* dsmark section */ | ||
431 | |||
432 | enum { | ||
433 | TCA_DSMARK_UNSPEC, | ||
434 | TCA_DSMARK_INDICES, | ||
435 | TCA_DSMARK_DEFAULT_INDEX, | ||
436 | TCA_DSMARK_SET_TC_INDEX, | ||
437 | TCA_DSMARK_MASK, | ||
438 | TCA_DSMARK_VALUE, | ||
439 | __TCA_DSMARK_MAX, | ||
440 | }; | ||
441 | |||
442 | #define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) | ||
443 | |||
444 | /* ATM section */ | ||
445 | |||
446 | enum { | ||
447 | TCA_ATM_UNSPEC, | ||
448 | TCA_ATM_FD, /* file/socket descriptor */ | ||
449 | TCA_ATM_PTR, /* pointer to descriptor - later */ | ||
450 | TCA_ATM_HDR, /* LL header */ | ||
451 | TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ | ||
452 | TCA_ATM_ADDR, /* PVC address (for output only) */ | ||
453 | TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ | ||
454 | __TCA_ATM_MAX, | ||
455 | }; | ||
456 | |||
457 | #define TCA_ATM_MAX (__TCA_ATM_MAX - 1) | ||
458 | |||
459 | /* Network emulator */ | ||
460 | |||
461 | enum { | ||
462 | TCA_NETEM_UNSPEC, | ||
463 | TCA_NETEM_CORR, | ||
464 | TCA_NETEM_DELAY_DIST, | ||
465 | TCA_NETEM_REORDER, | ||
466 | TCA_NETEM_CORRUPT, | ||
467 | TCA_NETEM_LOSS, | ||
468 | __TCA_NETEM_MAX, | ||
469 | }; | ||
470 | |||
471 | #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) | ||
472 | |||
473 | struct tc_netem_qopt { | ||
474 | __u32 latency; /* added delay (us) */ | ||
475 | __u32 limit; /* fifo limit (packets) */ | ||
476 | __u32 loss; /* random packet loss (0=none ~0=100%) */ | ||
477 | __u32 gap; /* re-ordering gap (0 for none) */ | ||
478 | __u32 duplicate; /* random packet dup (0=none ~0=100%) */ | ||
479 | __u32 jitter; /* random jitter in latency (us) */ | ||
480 | }; | ||
481 | |||
482 | struct tc_netem_corr { | ||
483 | __u32 delay_corr; /* delay correlation */ | ||
484 | __u32 loss_corr; /* packet loss correlation */ | ||
485 | __u32 dup_corr; /* duplicate correlation */ | ||
486 | }; | ||
487 | |||
488 | struct tc_netem_reorder { | ||
489 | __u32 probability; | ||
490 | __u32 correlation; | ||
491 | }; | ||
492 | |||
493 | struct tc_netem_corrupt { | ||
494 | __u32 probability; | ||
495 | __u32 correlation; | ||
496 | }; | ||
497 | |||
498 | enum { | ||
499 | NETEM_LOSS_UNSPEC, | ||
500 | NETEM_LOSS_GI, /* General Intuitive - 4 state model */ | ||
501 | NETEM_LOSS_GE, /* Gilbert Elliot models */ | ||
502 | __NETEM_LOSS_MAX | ||
503 | }; | ||
504 | #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) | ||
505 | |||
506 | /* State transition probablities for 4 state model */ | ||
507 | struct tc_netem_gimodel { | ||
508 | __u32 p13; | ||
509 | __u32 p31; | ||
510 | __u32 p32; | ||
511 | __u32 p14; | ||
512 | __u32 p23; | ||
513 | }; | ||
514 | |||
515 | /* Gilbert-Elliot models */ | ||
516 | struct tc_netem_gemodel { | ||
517 | __u32 p; | ||
518 | __u32 r; | ||
519 | __u32 h; | ||
520 | __u32 k1; | ||
521 | }; | ||
522 | |||
523 | #define NETEM_DIST_SCALE 8192 | ||
524 | #define NETEM_DIST_MAX 16384 | ||
525 | |||
526 | /* DRR */ | ||
527 | |||
528 | enum { | ||
529 | TCA_DRR_UNSPEC, | ||
530 | TCA_DRR_QUANTUM, | ||
531 | __TCA_DRR_MAX | ||
532 | }; | ||
533 | |||
534 | #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) | ||
535 | |||
536 | struct tc_drr_stats { | ||
537 | __u32 deficit; | ||
538 | }; | ||
539 | |||
540 | /* MQPRIO */ | ||
541 | #define TC_QOPT_BITMASK 15 | ||
542 | #define TC_QOPT_MAX_QUEUE 16 | ||
543 | |||
544 | struct tc_mqprio_qopt { | ||
545 | __u8 num_tc; | ||
546 | __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; | ||
547 | __u8 hw; | ||
548 | __u16 count[TC_QOPT_MAX_QUEUE]; | ||
549 | __u16 offset[TC_QOPT_MAX_QUEUE]; | ||
550 | }; | ||
551 | |||
552 | /* SFB */ | ||
553 | |||
554 | enum { | ||
555 | TCA_SFB_UNSPEC, | ||
556 | TCA_SFB_PARMS, | ||
557 | __TCA_SFB_MAX, | ||
558 | }; | ||
559 | |||
560 | #define TCA_SFB_MAX (__TCA_SFB_MAX - 1) | ||
561 | |||
562 | /* | ||
563 | * Note: increment, decrement are Q0.16 fixed-point values. | ||
564 | */ | ||
565 | struct tc_sfb_qopt { | ||
566 | __u32 rehash_interval; /* delay between hash move, in ms */ | ||
567 | __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ | ||
568 | __u32 max; /* max len of qlen_min */ | ||
569 | __u32 bin_size; /* maximum queue length per bin */ | ||
570 | __u32 increment; /* probability increment, (d1 in Blue) */ | ||
571 | __u32 decrement; /* probability decrement, (d2 in Blue) */ | ||
572 | __u32 limit; /* max SFB queue length */ | ||
573 | __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ | ||
574 | __u32 penalty_burst; | ||
575 | }; | ||
576 | |||
577 | struct tc_sfb_xstats { | ||
578 | __u32 earlydrop; | ||
579 | __u32 penaltydrop; | ||
580 | __u32 bucketdrop; | ||
581 | __u32 queuedrop; | ||
582 | __u32 childdrop; /* drops in child qdisc */ | ||
583 | __u32 marked; | ||
584 | __u32 maxqlen; | ||
585 | __u32 maxprob; | ||
586 | __u32 avgprob; | ||
587 | }; | ||
588 | |||
589 | #define SFB_MAX_PROB 0xFFFF | ||
590 | |||
591 | /* QFQ */ | ||
592 | enum { | ||
593 | TCA_QFQ_UNSPEC, | ||
594 | TCA_QFQ_WEIGHT, | ||
595 | TCA_QFQ_LMAX, | ||
596 | __TCA_QFQ_MAX | ||
597 | }; | ||
598 | |||
599 | #define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) | ||
600 | |||
601 | struct tc_qfq_stats { | ||
602 | __u32 weight; | ||
603 | __u32 lmax; | ||
604 | }; | ||
605 | |||
606 | #endif | ||
diff --git a/include/linux/platform_data/ina230.h b/include/linux/platform_data/ina230.h new file mode 100644 index 00000000000..fb1ac28ff62 --- /dev/null +++ b/include/linux/platform_data/ina230.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * include/linux/platform_data/ina230.h | ||
3 | * | ||
4 | * Copyright (c) 2011, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _INA230_H | ||
21 | #define _INA230_H | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | struct ina230_platform_data { | ||
26 | const char *rail_name; | ||
27 | s32 current_threshold; | ||
28 | s32 resistor; | ||
29 | s32 min_cores_online; | ||
30 | }; | ||
31 | |||
32 | #endif /* _INA230_H */ | ||
diff --git a/include/linux/platform_data/ram_console.h b/include/linux/platform_data/ram_console.h new file mode 100644 index 00000000000..9f1125c1106 --- /dev/null +++ b/include/linux/platform_data/ram_console.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Google, Inc. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ | ||
16 | #define _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ | ||
17 | |||
18 | struct ram_console_platform_data { | ||
19 | const char *bootinfo; | ||
20 | }; | ||
21 | |||
22 | #endif /* _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ */ | ||
diff --git a/include/linux/platform_data/tegra_bpc_mgmt.h b/include/linux/platform_data/tegra_bpc_mgmt.h new file mode 100644 index 00000000000..bdd4862d63a --- /dev/null +++ b/include/linux/platform_data/tegra_bpc_mgmt.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010-2011 NVIDIA Corporation | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __TEGRA_BPC_MGMT_H | ||
16 | #define __TEGRA_BPC_MGMT_H | ||
17 | #include <linux/cpumask.h> | ||
18 | |||
19 | struct tegra_bpc_mgmt_platform_data { | ||
20 | int gpio_trigger; | ||
21 | struct cpumask affinity_mask; | ||
22 | int bpc_mgmt_timeout; | ||
23 | }; | ||
24 | |||
25 | #endif /*__TEGRA_BPC_MGMT_H*/ | ||
diff --git a/include/linux/platform_data/tegra_nor.h b/include/linux/platform_data/tegra_nor.h new file mode 100644 index 00000000000..cd8faff2f1c --- /dev/null +++ b/include/linux/platform_data/tegra_nor.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/linux/platform_data/tegra_nor.h | ||
3 | * | ||
4 | * Copyright (C) 2010 - 2011 NVIDIA Corporation. | ||
5 | * | ||
6 | * Author: | ||
7 | * Raghavendra V K <rvk@nvidia.com> | ||
8 | * | ||
9 | * This software is licensed under the terms of the GNU General Public | ||
10 | * License version 2, as published by the Free Software Foundation, and | ||
11 | * may be copied, distributed, and modified under those terms. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef __MACH_TEGRA_NOR_PDATA_H | ||
21 | #define __MACH_TEGRA_NOR_PDATA_H | ||
22 | |||
23 | #include <asm/mach/flash.h> | ||
24 | |||
25 | struct tegra_nor_chip_parms { | ||
26 | struct { | ||
27 | uint32_t timing0; | ||
28 | uint32_t timing1; | ||
29 | } timing_default, timing_read; | ||
30 | }; | ||
31 | |||
32 | struct tegra_nor_platform_data { | ||
33 | struct tegra_nor_chip_parms chip_parms; | ||
34 | struct flash_platform_data flash; | ||
35 | }; | ||
36 | |||
37 | #endif /* __MACH_TEGRA_NOR_PDATA_H */ | ||
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h new file mode 100644 index 00000000000..5a536cbb25b --- /dev/null +++ b/include/linux/pm_qos_params.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _LINUX_PM_QOS_PARAMS_H | ||
2 | #define _LINUX_PM_QOS_PARAMS_H | ||
3 | /* interface for the pm_qos_power infrastructure of the linux kernel. | ||
4 | * | ||
5 | * Mark Gross <mgross@linux.intel.com> | ||
6 | */ | ||
7 | #include <linux/plist.h> | ||
8 | #include <linux/notifier.h> | ||
9 | #include <linux/miscdevice.h> | ||
10 | |||
11 | enum { | ||
12 | PM_QOS_RESERVED = 0, | ||
13 | PM_QOS_CPU_DMA_LATENCY, | ||
14 | PM_QOS_NETWORK_LATENCY, | ||
15 | PM_QOS_NETWORK_THROUGHPUT, | ||
16 | PM_QOS_MIN_ONLINE_CPUS, | ||
17 | PM_QOS_MAX_ONLINE_CPUS, | ||
18 | PM_QOS_CPU_FREQ_MIN, | ||
19 | PM_QOS_CPU_FREQ_MAX, | ||
20 | |||
21 | /* insert new class ID */ | ||
22 | |||
23 | PM_QOS_NUM_CLASSES, | ||
24 | }; | ||
25 | |||
26 | #define PM_QOS_DEFAULT_VALUE -1 | ||
27 | |||
28 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | ||
29 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | ||
30 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 | ||
31 | #define PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE 1 | ||
32 | #define PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE LONG_MAX | ||
33 | #define PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE 0 | ||
34 | #define PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE LONG_MAX | ||
35 | |||
36 | struct pm_qos_request_list { | ||
37 | struct plist_node list; | ||
38 | int pm_qos_class; | ||
39 | }; | ||
40 | |||
41 | void pm_qos_add_request(struct pm_qos_request_list *l, int pm_qos_class, s32 value); | ||
42 | void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req, | ||
43 | s32 new_value); | ||
44 | void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req); | ||
45 | |||
46 | int pm_qos_request(int pm_qos_class); | ||
47 | int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); | ||
48 | int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); | ||
49 | int pm_qos_request_active(struct pm_qos_request_list *req); | ||
50 | |||
51 | #endif | ||
diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h new file mode 100644 index 00000000000..f04c98cf44f --- /dev/null +++ b/include/linux/posix_types.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _LINUX_POSIX_TYPES_H | ||
2 | #define _LINUX_POSIX_TYPES_H | ||
3 | |||
4 | #include <linux/stddef.h> | ||
5 | |||
6 | /* | ||
7 | * This allows for 1024 file descriptors: if NR_OPEN is ever grown | ||
8 | * beyond that you'll have to change this too. But 1024 fd's seem to be | ||
9 | * enough even for such "real" unices like OSF/1, so hopefully this is | ||
10 | * one limit that doesn't have to be changed [again]. | ||
11 | * | ||
12 | * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in | ||
13 | * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical | ||
14 | * place for them. Solved by having dummy defines in <sys/time.h>. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * Those macros may have been defined in <gnu/types.h>. But we always | ||
19 | * use the ones here. | ||
20 | */ | ||
21 | #undef __NFDBITS | ||
22 | #define __NFDBITS (8 * sizeof(unsigned long)) | ||
23 | |||
24 | #undef __FD_SETSIZE | ||
25 | #define __FD_SETSIZE 1024 | ||
26 | |||
27 | #undef __FDSET_LONGS | ||
28 | #define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) | ||
29 | |||
30 | #undef __FDELT | ||
31 | #define __FDELT(d) ((d) / __NFDBITS) | ||
32 | |||
33 | #undef __FDMASK | ||
34 | #define __FDMASK(d) (1UL << ((d) % __NFDBITS)) | ||
35 | |||
36 | typedef struct { | ||
37 | unsigned long fds_bits [__FDSET_LONGS]; | ||
38 | } __kernel_fd_set; | ||
39 | |||
40 | /* Type of a signal handler. */ | ||
41 | typedef void (*__kernel_sighandler_t)(int); | ||
42 | |||
43 | /* Type of a SYSV IPC key. */ | ||
44 | typedef int __kernel_key_t; | ||
45 | typedef int __kernel_mqd_t; | ||
46 | |||
47 | #include <asm/posix_types.h> | ||
48 | |||
49 | #endif /* _LINUX_POSIX_TYPES_H */ | ||
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/bq20z75.h new file mode 100644 index 00000000000..1398eb004e8 --- /dev/null +++ b/include/linux/power/bq20z75.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Gas Gauge driver for TI's BQ20Z75 | ||
3 | * | ||
4 | * Copyright (c) 2010, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_POWER_BQ20Z75_H_ | ||
22 | #define __LINUX_POWER_BQ20Z75_H_ | ||
23 | |||
24 | #include <linux/power_supply.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | /** | ||
28 | * struct bq20z75_platform_data - platform data for bq20z75 devices | ||
29 | * @battery_detect: GPIO which is used to detect battery presence | ||
30 | * @battery_detect_present: gpio state when battery is present (0 / 1) | ||
31 | * @i2c_retry_count: # of times to retry on i2c IO failure | ||
32 | * @poll_retry_count: # of times to retry looking for new status after | ||
33 | * external change notification | ||
34 | */ | ||
35 | struct bq20z75_platform_data { | ||
36 | int battery_detect; | ||
37 | int battery_detect_present; | ||
38 | int i2c_retry_count; | ||
39 | int poll_retry_count; | ||
40 | }; | ||
41 | |||
42 | #endif | ||
diff --git a/include/linux/power/max8907c-charger.h b/include/linux/power/max8907c-charger.h new file mode 100644 index 00000000000..2cebad768b0 --- /dev/null +++ b/include/linux/power/max8907c-charger.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* linux/power/max8907c-charger.h | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License version 2 as | ||
5 | * published by the Free Software Foundation. | ||
6 | */ | ||
7 | |||
8 | #ifndef __LINUX_MAX8907C_CHARGER_H | ||
9 | #define __LINUX_MAX8907C_CHARGER_H | ||
10 | |||
11 | /* interrupt */ | ||
12 | #define MAX8907C_VCHG_OVP (1 << 0) | ||
13 | #define MAX8907C_VCHG_F (1 << 1) | ||
14 | #define MAX8907C_VCHG_R (1 << 2) | ||
15 | #define MAX8907C_THM_OK_R (1 << 8) | ||
16 | #define MAX8907C_THM_OK_F (1 << 9) | ||
17 | #define MAX8907C_MBATTLOW_F (1 << 10) | ||
18 | #define MAX8907C_MBATTLOW_R (1 << 11) | ||
19 | #define MAX8907C_CHG_RST (1 << 12) | ||
20 | #define MAX8907C_CHG_DONE (1 << 13) | ||
21 | #define MAX8907C_CHG_TOPOFF (1 << 14) | ||
22 | #define MAX8907C_CHK_TMR_FAULT (1 << 15) | ||
23 | |||
24 | enum max8907c_charger_topoff_threshold { | ||
25 | MAX8907C_TOPOFF_5PERCENT = 0x00, | ||
26 | MAX8907C_TOPOFF_10PERCENT = 0x01, | ||
27 | MAX8907C_TOPOFF_15PERCENT = 0x02, | ||
28 | MAX8907C_TOPOFF_20PERCENT = 0x03, | ||
29 | }; | ||
30 | |||
31 | enum max8907c_charger_restart_hysteresis { | ||
32 | MAX8907C_RESTART_100MV = 0x00, | ||
33 | MAX8907C_RESTART_150MV = 0x01, | ||
34 | MAX8907C_RESTART_200MV = 0x02, | ||
35 | MAX8907C_RESTART_FLOAT = 0x03, | ||
36 | }; | ||
37 | |||
38 | enum max8907c_fast_charging_current { | ||
39 | MAX8907C_FASTCHARGE_90MA = 0x00, | ||
40 | MAX8907C_FASTCHARGE_300MA = 0x01, | ||
41 | MAX8907C_FASTCHARGE_460MA = 0x02, | ||
42 | MAX8907C_FASTCHARGE_600MA = 0x03, | ||
43 | MAX8907C_FASTCHARGE_700MA = 0x04, | ||
44 | MAX8907C_FASTCHARGE_800MA = 0x05, | ||
45 | MAX8907C_FASTCHARGE_900MA = 0x06, | ||
46 | MAX8907C_FASTCHARGE_1000MA = 0x07, | ||
47 | }; | ||
48 | |||
49 | enum max8907c_fast_charger_time { | ||
50 | MAX8907C_FCHARGE_TM_8H = 0x00, | ||
51 | MAX8907C_FCHARGE_TM_12H = 0x01, | ||
52 | MAX8907C_FCHARGE_TM_16H = 0x02, | ||
53 | MAX8907C_FCHARGE_TM_OFF = 0x03, | ||
54 | }; | ||
55 | |||
56 | struct max8907c_charger_pdata { | ||
57 | int irq; | ||
58 | enum max8907c_charger_topoff_threshold topoff_threshold; | ||
59 | enum max8907c_charger_restart_hysteresis restart_hysteresis; | ||
60 | enum max8907c_charger_restart_hysteresis fast_charging_current; | ||
61 | enum max8907c_fast_charger_time fast_charger_time; | ||
62 | }; | ||
63 | |||
64 | #endif | ||
diff --git a/include/linux/ppdev.h b/include/linux/ppdev.h new file mode 100644 index 00000000000..dc18c5d23eb --- /dev/null +++ b/include/linux/ppdev.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ppdev.h | ||
3 | * | ||
4 | * User-space parallel port device driver (header file). | ||
5 | * | ||
6 | * Copyright (C) 1998-9 Tim Waugh <tim@cyberelk.demon.co.uk> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * Added PPGETTIME/PPSETTIME, Fred Barnes, 1999 | ||
14 | * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 | ||
15 | */ | ||
16 | |||
17 | #define PP_IOCTL 'p' | ||
18 | |||
19 | /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ | ||
20 | #define PPSETMODE _IOW(PP_IOCTL, 0x80, int) | ||
21 | |||
22 | /* Read status */ | ||
23 | #define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) | ||
24 | #define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) | ||
25 | |||
26 | /* Read/write control */ | ||
27 | #define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) | ||
28 | #define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) | ||
29 | |||
30 | struct ppdev_frob_struct { | ||
31 | unsigned char mask; | ||
32 | unsigned char val; | ||
33 | }; | ||
34 | #define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) | ||
35 | |||
36 | /* Read/write data */ | ||
37 | #define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) | ||
38 | #define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) | ||
39 | |||
40 | /* Read/write econtrol (not used) */ | ||
41 | #define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) | ||
42 | #define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) | ||
43 | |||
44 | /* Read/write FIFO (not used) */ | ||
45 | #define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) | ||
46 | #define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) | ||
47 | |||
48 | /* Claim the port to start using it */ | ||
49 | #define PPCLAIM _IO(PP_IOCTL, 0x8b) | ||
50 | |||
51 | /* Release the port when you aren't using it */ | ||
52 | #define PPRELEASE _IO(PP_IOCTL, 0x8c) | ||
53 | |||
54 | /* Yield the port (release it if another driver is waiting, | ||
55 | * then reclaim) */ | ||
56 | #define PPYIELD _IO(PP_IOCTL, 0x8d) | ||
57 | |||
58 | /* Register device exclusively (must be before PPCLAIM). */ | ||
59 | #define PPEXCL _IO(PP_IOCTL, 0x8f) | ||
60 | |||
61 | /* Data line direction: non-zero for input mode. */ | ||
62 | #define PPDATADIR _IOW(PP_IOCTL, 0x90, int) | ||
63 | |||
64 | /* Negotiate a particular IEEE 1284 mode. */ | ||
65 | #define PPNEGOT _IOW(PP_IOCTL, 0x91, int) | ||
66 | |||
67 | /* Set control lines when an interrupt occurs. */ | ||
68 | #define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) | ||
69 | |||
70 | /* Clear (and return) interrupt count. */ | ||
71 | #define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) | ||
72 | |||
73 | /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ | ||
74 | #define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) | ||
75 | |||
76 | /* Set and get port timeout (struct timeval's) */ | ||
77 | #define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) | ||
78 | #define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) | ||
79 | |||
80 | /* Get available modes (what the hardware can do) */ | ||
81 | #define PPGETMODES _IOR(PP_IOCTL, 0x97, unsigned int) | ||
82 | |||
83 | /* Get the current mode and phaze */ | ||
84 | #define PPGETMODE _IOR(PP_IOCTL, 0x98, int) | ||
85 | #define PPGETPHASE _IOR(PP_IOCTL, 0x99, int) | ||
86 | |||
87 | /* get/set flags */ | ||
88 | #define PPGETFLAGS _IOR(PP_IOCTL, 0x9a, int) | ||
89 | #define PPSETFLAGS _IOW(PP_IOCTL, 0x9b, int) | ||
90 | |||
91 | /* flags visible to the world */ | ||
92 | #define PP_FASTWRITE (1<<2) | ||
93 | #define PP_FASTREAD (1<<3) | ||
94 | #define PP_W91284PIC (1<<4) | ||
95 | |||
96 | /* only masks user-visible flags */ | ||
97 | #define PP_FLAGMASK (PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC) | ||
98 | |||
99 | |||
diff --git a/include/linux/pps.h b/include/linux/pps.h new file mode 100644 index 00000000000..a9bb1d93451 --- /dev/null +++ b/include/linux/pps.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * PPS API header | ||
3 | * | ||
4 | * Copyright (C) 2005-2009 Rodolfo Giometti <giometti@linux.it> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | |||
22 | #ifndef _PPS_H_ | ||
23 | #define _PPS_H_ | ||
24 | |||
25 | #include <linux/types.h> | ||
26 | |||
27 | #define PPS_VERSION "5.3.6" | ||
28 | #define PPS_MAX_SOURCES 16 /* should be enough... */ | ||
29 | |||
30 | /* Implementation note: the logical states ``assert'' and ``clear'' | ||
31 | * are implemented in terms of the chip register, i.e. ``assert'' | ||
32 | * means the bit is set. */ | ||
33 | |||
34 | /* | ||
35 | * 3.2 New data structures | ||
36 | */ | ||
37 | |||
38 | #define PPS_API_VERS_1 1 | ||
39 | #define PPS_API_VERS PPS_API_VERS_1 /* we use API version 1 */ | ||
40 | #define PPS_MAX_NAME_LEN 32 | ||
41 | |||
42 | /* 32-bit vs. 64-bit compatibility. | ||
43 | * | ||
44 | * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other | ||
45 | * architectures it's 8 bytes. On i386, there will be no padding between the | ||
46 | * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct | ||
47 | * pps_kparams. But on most platforms there will be padding to ensure correct | ||
48 | * alignment. | ||
49 | * | ||
50 | * The simple fix is probably to add an explicit padding. | ||
51 | * [David Woodhouse] | ||
52 | */ | ||
53 | struct pps_ktime { | ||
54 | __s64 sec; | ||
55 | __s32 nsec; | ||
56 | __u32 flags; | ||
57 | }; | ||
58 | #define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */ | ||
59 | |||
60 | struct pps_kinfo { | ||
61 | __u32 assert_sequence; /* seq. num. of assert event */ | ||
62 | __u32 clear_sequence; /* seq. num. of clear event */ | ||
63 | struct pps_ktime assert_tu; /* time of assert event */ | ||
64 | struct pps_ktime clear_tu; /* time of clear event */ | ||
65 | int current_mode; /* current mode bits */ | ||
66 | }; | ||
67 | |||
68 | struct pps_kparams { | ||
69 | int api_version; /* API version # */ | ||
70 | int mode; /* mode bits */ | ||
71 | struct pps_ktime assert_off_tu; /* offset compensation for assert */ | ||
72 | struct pps_ktime clear_off_tu; /* offset compensation for clear */ | ||
73 | }; | ||
74 | |||
75 | /* | ||
76 | * 3.3 Mode bit definitions | ||
77 | */ | ||
78 | |||
79 | /* Device/implementation parameters */ | ||
80 | #define PPS_CAPTUREASSERT 0x01 /* capture assert events */ | ||
81 | #define PPS_CAPTURECLEAR 0x02 /* capture clear events */ | ||
82 | #define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */ | ||
83 | |||
84 | #define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */ | ||
85 | #define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */ | ||
86 | |||
87 | #define PPS_CANWAIT 0x100 /* can we wait for an event? */ | ||
88 | #define PPS_CANPOLL 0x200 /* bit reserved for future use */ | ||
89 | |||
90 | /* Kernel actions */ | ||
91 | #define PPS_ECHOASSERT 0x40 /* feed back assert event to output */ | ||
92 | #define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */ | ||
93 | |||
94 | /* Timestamp formats */ | ||
95 | #define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */ | ||
96 | #define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */ | ||
97 | |||
98 | /* | ||
99 | * 3.4.4 New functions: disciplining the kernel timebase | ||
100 | */ | ||
101 | |||
102 | /* Kernel consumers */ | ||
103 | #define PPS_KC_HARDPPS 0 /* hardpps() (or equivalent) */ | ||
104 | #define PPS_KC_HARDPPS_PLL 1 /* hardpps() constrained to | ||
105 | use a phase-locked loop */ | ||
106 | #define PPS_KC_HARDPPS_FLL 2 /* hardpps() constrained to | ||
107 | use a frequency-locked loop */ | ||
108 | /* | ||
109 | * Here begins the implementation-specific part! | ||
110 | */ | ||
111 | |||
112 | struct pps_fdata { | ||
113 | struct pps_kinfo info; | ||
114 | struct pps_ktime timeout; | ||
115 | }; | ||
116 | |||
117 | struct pps_bind_args { | ||
118 | int tsformat; /* format of time stamps */ | ||
119 | int edge; /* selected event type */ | ||
120 | int consumer; /* selected kernel consumer */ | ||
121 | }; | ||
122 | |||
123 | #include <linux/ioctl.h> | ||
124 | |||
125 | #define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *) | ||
126 | #define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *) | ||
127 | #define PPS_GETCAP _IOR('p', 0xa3, int *) | ||
128 | #define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *) | ||
129 | #define PPS_KC_BIND _IOW('p', 0xa5, struct pps_bind_args *) | ||
130 | |||
131 | #endif /* _PPS_H_ */ | ||
diff --git a/include/linux/prctl.h b/include/linux/prctl.h new file mode 100644 index 00000000000..a3baeb2c216 --- /dev/null +++ b/include/linux/prctl.h | |||
@@ -0,0 +1,105 @@ | |||
1 | #ifndef _LINUX_PRCTL_H | ||
2 | #define _LINUX_PRCTL_H | ||
3 | |||
4 | /* Values to pass as first argument to prctl() */ | ||
5 | |||
6 | #define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ | ||
7 | #define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ | ||
8 | |||
9 | /* Get/set current->mm->dumpable */ | ||
10 | #define PR_GET_DUMPABLE 3 | ||
11 | #define PR_SET_DUMPABLE 4 | ||
12 | |||
13 | /* Get/set unaligned access control bits (if meaningful) */ | ||
14 | #define PR_GET_UNALIGN 5 | ||
15 | #define PR_SET_UNALIGN 6 | ||
16 | # define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ | ||
17 | # define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ | ||
18 | |||
19 | /* Get/set whether or not to drop capabilities on setuid() away from | ||
20 | * uid 0 (as per security/commoncap.c) */ | ||
21 | #define PR_GET_KEEPCAPS 7 | ||
22 | #define PR_SET_KEEPCAPS 8 | ||
23 | |||
24 | /* Get/set floating-point emulation control bits (if meaningful) */ | ||
25 | #define PR_GET_FPEMU 9 | ||
26 | #define PR_SET_FPEMU 10 | ||
27 | # define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */ | ||
28 | # define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */ | ||
29 | |||
30 | /* Get/set floating-point exception mode (if meaningful) */ | ||
31 | #define PR_GET_FPEXC 11 | ||
32 | #define PR_SET_FPEXC 12 | ||
33 | # define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ | ||
34 | # define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ | ||
35 | # define PR_FP_EXC_OVF 0x020000 /* floating point overflow */ | ||
36 | # define PR_FP_EXC_UND 0x040000 /* floating point underflow */ | ||
37 | # define PR_FP_EXC_RES 0x080000 /* floating point inexact result */ | ||
38 | # define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ | ||
39 | # define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ | ||
40 | # define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ | ||
41 | # define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ | ||
42 | # define PR_FP_EXC_PRECISE 3 /* precise exception mode */ | ||
43 | |||
44 | /* Get/set whether we use statistical process timing or accurate timestamp | ||
45 | * based process timing */ | ||
46 | #define PR_GET_TIMING 13 | ||
47 | #define PR_SET_TIMING 14 | ||
48 | # define PR_TIMING_STATISTICAL 0 /* Normal, traditional, | ||
49 | statistical process timing */ | ||
50 | # define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based | ||
51 | process timing */ | ||
52 | |||
53 | #define PR_SET_NAME 15 /* Set process name */ | ||
54 | #define PR_GET_NAME 16 /* Get process name */ | ||
55 | |||
56 | /* Get/set process endian */ | ||
57 | #define PR_GET_ENDIAN 19 | ||
58 | #define PR_SET_ENDIAN 20 | ||
59 | # define PR_ENDIAN_BIG 0 | ||
60 | # define PR_ENDIAN_LITTLE 1 /* True little endian mode */ | ||
61 | # define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ | ||
62 | |||
63 | /* Get/set process seccomp mode */ | ||
64 | #define PR_GET_SECCOMP 21 | ||
65 | #define PR_SET_SECCOMP 22 | ||
66 | |||
67 | /* Get/set the capability bounding set (as per security/commoncap.c) */ | ||
68 | #define PR_CAPBSET_READ 23 | ||
69 | #define PR_CAPBSET_DROP 24 | ||
70 | |||
71 | /* Get/set the process' ability to use the timestamp counter instruction */ | ||
72 | #define PR_GET_TSC 25 | ||
73 | #define PR_SET_TSC 26 | ||
74 | # define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ | ||
75 | # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ | ||
76 | |||
77 | /* Get/set securebits (as per security/commoncap.c) */ | ||
78 | #define PR_GET_SECUREBITS 27 | ||
79 | #define PR_SET_SECUREBITS 28 | ||
80 | |||
81 | /* | ||
82 | * Get/set the timerslack as used by poll/select/nanosleep | ||
83 | * A value of 0 means "use default" | ||
84 | */ | ||
85 | #define PR_SET_TIMERSLACK 29 | ||
86 | #define PR_GET_TIMERSLACK 30 | ||
87 | |||
88 | #define PR_TASK_PERF_EVENTS_DISABLE 31 | ||
89 | #define PR_TASK_PERF_EVENTS_ENABLE 32 | ||
90 | |||
91 | /* | ||
92 | * Set early/late kill mode for hwpoison memory corruption. | ||
93 | * This influences when the process gets killed on a memory corruption. | ||
94 | */ | ||
95 | #define PR_MCE_KILL 33 | ||
96 | # define PR_MCE_KILL_CLEAR 0 | ||
97 | # define PR_MCE_KILL_SET 1 | ||
98 | |||
99 | # define PR_MCE_KILL_LATE 0 | ||
100 | # define PR_MCE_KILL_EARLY 1 | ||
101 | # define PR_MCE_KILL_DEFAULT 2 | ||
102 | |||
103 | #define PR_MCE_KILL_GET 34 | ||
104 | |||
105 | #endif /* _LINUX_PRCTL_H */ | ||
diff --git a/include/linux/prio_tree.h b/include/linux/prio_tree.h new file mode 100644 index 00000000000..db04abb557e --- /dev/null +++ b/include/linux/prio_tree.h | |||
@@ -0,0 +1,120 @@ | |||
1 | #ifndef _LINUX_PRIO_TREE_H | ||
2 | #define _LINUX_PRIO_TREE_H | ||
3 | |||
4 | /* | ||
5 | * K&R 2nd ed. A8.3 somewhat obliquely hints that initial sequences of struct | ||
6 | * fields with identical types should end up at the same location. We'll use | ||
7 | * this until we can scrap struct raw_prio_tree_node. | ||
8 | * | ||
9 | * Note: all this could be done more elegantly by using unnamed union/struct | ||
10 | * fields. However, gcc 2.95.3 and apparently also gcc 3.0.4 don't support this | ||
11 | * language extension. | ||
12 | */ | ||
13 | |||
14 | struct raw_prio_tree_node { | ||
15 | struct prio_tree_node *left; | ||
16 | struct prio_tree_node *right; | ||
17 | struct prio_tree_node *parent; | ||
18 | }; | ||
19 | |||
20 | struct prio_tree_node { | ||
21 | struct prio_tree_node *left; | ||
22 | struct prio_tree_node *right; | ||
23 | struct prio_tree_node *parent; | ||
24 | unsigned long start; | ||
25 | unsigned long last; /* last location _in_ interval */ | ||
26 | }; | ||
27 | |||
28 | struct prio_tree_root { | ||
29 | struct prio_tree_node *prio_tree_node; | ||
30 | unsigned short index_bits; | ||
31 | unsigned short raw; | ||
32 | /* | ||
33 | * 0: nodes are of type struct prio_tree_node | ||
34 | * 1: nodes are of type raw_prio_tree_node | ||
35 | */ | ||
36 | }; | ||
37 | |||
38 | struct prio_tree_iter { | ||
39 | struct prio_tree_node *cur; | ||
40 | unsigned long mask; | ||
41 | unsigned long value; | ||
42 | int size_level; | ||
43 | |||
44 | struct prio_tree_root *root; | ||
45 | pgoff_t r_index; | ||
46 | pgoff_t h_index; | ||
47 | }; | ||
48 | |||
49 | static inline void prio_tree_iter_init(struct prio_tree_iter *iter, | ||
50 | struct prio_tree_root *root, pgoff_t r_index, pgoff_t h_index) | ||
51 | { | ||
52 | iter->root = root; | ||
53 | iter->r_index = r_index; | ||
54 | iter->h_index = h_index; | ||
55 | iter->cur = NULL; | ||
56 | } | ||
57 | |||
58 | #define __INIT_PRIO_TREE_ROOT(ptr, _raw) \ | ||
59 | do { \ | ||
60 | (ptr)->prio_tree_node = NULL; \ | ||
61 | (ptr)->index_bits = 1; \ | ||
62 | (ptr)->raw = (_raw); \ | ||
63 | } while (0) | ||
64 | |||
65 | #define INIT_PRIO_TREE_ROOT(ptr) __INIT_PRIO_TREE_ROOT(ptr, 0) | ||
66 | #define INIT_RAW_PRIO_TREE_ROOT(ptr) __INIT_PRIO_TREE_ROOT(ptr, 1) | ||
67 | |||
68 | #define INIT_PRIO_TREE_NODE(ptr) \ | ||
69 | do { \ | ||
70 | (ptr)->left = (ptr)->right = (ptr)->parent = (ptr); \ | ||
71 | } while (0) | ||
72 | |||
73 | #define INIT_PRIO_TREE_ITER(ptr) \ | ||
74 | do { \ | ||
75 | (ptr)->cur = NULL; \ | ||
76 | (ptr)->mask = 0UL; \ | ||
77 | (ptr)->value = 0UL; \ | ||
78 | (ptr)->size_level = 0; \ | ||
79 | } while (0) | ||
80 | |||
81 | #define prio_tree_entry(ptr, type, member) \ | ||
82 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) | ||
83 | |||
84 | static inline int prio_tree_empty(const struct prio_tree_root *root) | ||
85 | { | ||
86 | return root->prio_tree_node == NULL; | ||
87 | } | ||
88 | |||
89 | static inline int prio_tree_root(const struct prio_tree_node *node) | ||
90 | { | ||
91 | return node->parent == node; | ||
92 | } | ||
93 | |||
94 | static inline int prio_tree_left_empty(const struct prio_tree_node *node) | ||
95 | { | ||
96 | return node->left == node; | ||
97 | } | ||
98 | |||
99 | static inline int prio_tree_right_empty(const struct prio_tree_node *node) | ||
100 | { | ||
101 | return node->right == node; | ||
102 | } | ||
103 | |||
104 | |||
105 | struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root, | ||
106 | struct prio_tree_node *old, struct prio_tree_node *node); | ||
107 | struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root, | ||
108 | struct prio_tree_node *node); | ||
109 | void prio_tree_remove(struct prio_tree_root *root, struct prio_tree_node *node); | ||
110 | struct prio_tree_node *prio_tree_next(struct prio_tree_iter *iter); | ||
111 | |||
112 | #define raw_prio_tree_replace(root, old, node) \ | ||
113 | prio_tree_replace(root, (struct prio_tree_node *) (old), \ | ||
114 | (struct prio_tree_node *) (node)) | ||
115 | #define raw_prio_tree_insert(root, node) \ | ||
116 | prio_tree_insert(root, (struct prio_tree_node *) (node)) | ||
117 | #define raw_prio_tree_remove(root, node) \ | ||
118 | prio_tree_remove(root, (struct prio_tree_node *) (node)) | ||
119 | |||
120 | #endif /* _LINUX_PRIO_TREE_H */ | ||
diff --git a/include/linux/ptp_clock.h b/include/linux/ptp_clock.h new file mode 100644 index 00000000000..94e981f810a --- /dev/null +++ b/include/linux/ptp_clock.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * PTP 1588 clock support - user space interface | ||
3 | * | ||
4 | * Copyright (C) 2010 OMICRON electronics GmbH | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _PTP_CLOCK_H_ | ||
22 | #define _PTP_CLOCK_H_ | ||
23 | |||
24 | #include <linux/ioctl.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | /* PTP_xxx bits, for the flags field within the request structures. */ | ||
28 | #define PTP_ENABLE_FEATURE (1<<0) | ||
29 | #define PTP_RISING_EDGE (1<<1) | ||
30 | #define PTP_FALLING_EDGE (1<<2) | ||
31 | |||
32 | /* | ||
33 | * struct ptp_clock_time - represents a time value | ||
34 | * | ||
35 | * The sign of the seconds field applies to the whole value. The | ||
36 | * nanoseconds field is always unsigned. The reserved field is | ||
37 | * included for sub-nanosecond resolution, should the demand for | ||
38 | * this ever appear. | ||
39 | * | ||
40 | */ | ||
41 | struct ptp_clock_time { | ||
42 | __s64 sec; /* seconds */ | ||
43 | __u32 nsec; /* nanoseconds */ | ||
44 | __u32 reserved; | ||
45 | }; | ||
46 | |||
47 | struct ptp_clock_caps { | ||
48 | int max_adj; /* Maximum frequency adjustment in parts per billon. */ | ||
49 | int n_alarm; /* Number of programmable alarms. */ | ||
50 | int n_ext_ts; /* Number of external time stamp channels. */ | ||
51 | int n_per_out; /* Number of programmable periodic signals. */ | ||
52 | int pps; /* Whether the clock supports a PPS callback. */ | ||
53 | int rsv[15]; /* Reserved for future use. */ | ||
54 | }; | ||
55 | |||
56 | struct ptp_extts_request { | ||
57 | unsigned int index; /* Which channel to configure. */ | ||
58 | unsigned int flags; /* Bit field for PTP_xxx flags. */ | ||
59 | unsigned int rsv[2]; /* Reserved for future use. */ | ||
60 | }; | ||
61 | |||
62 | struct ptp_perout_request { | ||
63 | struct ptp_clock_time start; /* Absolute start time. */ | ||
64 | struct ptp_clock_time period; /* Desired period, zero means disable. */ | ||
65 | unsigned int index; /* Which channel to configure. */ | ||
66 | unsigned int flags; /* Reserved for future use. */ | ||
67 | unsigned int rsv[4]; /* Reserved for future use. */ | ||
68 | }; | ||
69 | |||
70 | #define PTP_CLK_MAGIC '=' | ||
71 | |||
72 | #define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) | ||
73 | #define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) | ||
74 | #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) | ||
75 | #define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) | ||
76 | |||
77 | struct ptp_extts_event { | ||
78 | struct ptp_clock_time t; /* Time event occured. */ | ||
79 | unsigned int index; /* Which channel produced the event. */ | ||
80 | unsigned int flags; /* Reserved for future use. */ | ||
81 | unsigned int rsv[2]; /* Reserved for future use. */ | ||
82 | }; | ||
83 | |||
84 | #endif | ||
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h new file mode 100644 index 00000000000..8b9aee1a9ce --- /dev/null +++ b/include/linux/qnx4_fs.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Name : qnx4_fs.h | ||
3 | * Author : Richard Frowijn | ||
4 | * Function : qnx4 global filesystem definitions | ||
5 | * History : 23-03-1998 created | ||
6 | */ | ||
7 | #ifndef _LINUX_QNX4_FS_H | ||
8 | #define _LINUX_QNX4_FS_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/qnxtypes.h> | ||
12 | #include <linux/magic.h> | ||
13 | |||
14 | #define QNX4_ROOT_INO 1 | ||
15 | |||
16 | #define QNX4_MAX_XTNTS_PER_XBLK 60 | ||
17 | /* for di_status */ | ||
18 | #define QNX4_FILE_USED 0x01 | ||
19 | #define QNX4_FILE_MODIFIED 0x02 | ||
20 | #define QNX4_FILE_BUSY 0x04 | ||
21 | #define QNX4_FILE_LINK 0x08 | ||
22 | #define QNX4_FILE_INODE 0x10 | ||
23 | #define QNX4_FILE_FSYSCLEAN 0x20 | ||
24 | |||
25 | #define QNX4_I_MAP_SLOTS 8 | ||
26 | #define QNX4_Z_MAP_SLOTS 64 | ||
27 | #define QNX4_VALID_FS 0x0001 /* Clean fs. */ | ||
28 | #define QNX4_ERROR_FS 0x0002 /* fs has errors. */ | ||
29 | #define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ | ||
30 | #define QNX4_BLOCK_SIZE_BITS 9 /* blocksize shift */ | ||
31 | #define QNX4_DIR_ENTRY_SIZE 0x040 /* dir entry size of 64 bytes */ | ||
32 | #define QNX4_DIR_ENTRY_SIZE_BITS 6 /* dir entry size shift */ | ||
33 | #define QNX4_XBLK_ENTRY_SIZE 0x200 /* xblk entry size */ | ||
34 | #define QNX4_INODES_PER_BLOCK 0x08 /* 512 / 64 */ | ||
35 | |||
36 | /* for filenames */ | ||
37 | #define QNX4_SHORT_NAME_MAX 16 | ||
38 | #define QNX4_NAME_MAX 48 | ||
39 | |||
40 | /* | ||
41 | * This is the original qnx4 inode layout on disk. | ||
42 | */ | ||
43 | struct qnx4_inode_entry { | ||
44 | char di_fname[QNX4_SHORT_NAME_MAX]; | ||
45 | qnx4_off_t di_size; | ||
46 | qnx4_xtnt_t di_first_xtnt; | ||
47 | __le32 di_xblk; | ||
48 | __le32 di_ftime; | ||
49 | __le32 di_mtime; | ||
50 | __le32 di_atime; | ||
51 | __le32 di_ctime; | ||
52 | qnx4_nxtnt_t di_num_xtnts; | ||
53 | qnx4_mode_t di_mode; | ||
54 | qnx4_muid_t di_uid; | ||
55 | qnx4_mgid_t di_gid; | ||
56 | qnx4_nlink_t di_nlink; | ||
57 | __u8 di_zero[4]; | ||
58 | qnx4_ftype_t di_type; | ||
59 | __u8 di_status; | ||
60 | }; | ||
61 | |||
62 | struct qnx4_link_info { | ||
63 | char dl_fname[QNX4_NAME_MAX]; | ||
64 | __le32 dl_inode_blk; | ||
65 | __u8 dl_inode_ndx; | ||
66 | __u8 dl_spare[10]; | ||
67 | __u8 dl_status; | ||
68 | }; | ||
69 | |||
70 | struct qnx4_xblk { | ||
71 | __le32 xblk_next_xblk; | ||
72 | __le32 xblk_prev_xblk; | ||
73 | __u8 xblk_num_xtnts; | ||
74 | __u8 xblk_spare[3]; | ||
75 | __le32 xblk_num_blocks; | ||
76 | qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; | ||
77 | char xblk_signature[8]; | ||
78 | qnx4_xtnt_t xblk_first_xtnt; | ||
79 | }; | ||
80 | |||
81 | struct qnx4_super_block { | ||
82 | struct qnx4_inode_entry RootDir; | ||
83 | struct qnx4_inode_entry Inode; | ||
84 | struct qnx4_inode_entry Boot; | ||
85 | struct qnx4_inode_entry AltBoot; | ||
86 | }; | ||
87 | |||
88 | #endif | ||
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h new file mode 100644 index 00000000000..bebbe5cc4fb --- /dev/null +++ b/include/linux/qnxtypes.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Name : qnxtypes.h | ||
3 | * Author : Richard Frowijn | ||
4 | * Function : standard qnx types | ||
5 | * History : 22-03-1998 created | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef _QNX4TYPES_H | ||
10 | #define _QNX4TYPES_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | |||
14 | typedef __le16 qnx4_nxtnt_t; | ||
15 | typedef __u8 qnx4_ftype_t; | ||
16 | |||
17 | typedef struct { | ||
18 | __le32 xtnt_blk; | ||
19 | __le32 xtnt_size; | ||
20 | } qnx4_xtnt_t; | ||
21 | |||
22 | typedef __le16 qnx4_mode_t; | ||
23 | typedef __le16 qnx4_muid_t; | ||
24 | typedef __le16 qnx4_mgid_t; | ||
25 | typedef __le32 qnx4_off_t; | ||
26 | typedef __le16 qnx4_nlink_t; | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/radeonfb.h b/include/linux/radeonfb.h new file mode 100644 index 00000000000..8c4bbdecc44 --- /dev/null +++ b/include/linux/radeonfb.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __LINUX_RADEONFB_H__ | ||
2 | #define __LINUX_RADEONFB_H__ | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | #define ATY_RADEON_LCD_ON 0x00000001 | ||
8 | #define ATY_RADEON_CRT_ON 0x00000002 | ||
9 | |||
10 | |||
11 | #define FBIO_RADEON_GET_MIRROR _IOR('@', 3, size_t) | ||
12 | #define FBIO_RADEON_SET_MIRROR _IOW('@', 4, size_t) | ||
13 | |||
14 | #endif | ||
15 | |||
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild new file mode 100644 index 00000000000..2415a64c5e5 --- /dev/null +++ b/include/linux/raid/Kbuild | |||
@@ -0,0 +1,2 @@ | |||
1 | header-y += md_p.h | ||
2 | header-y += md_u.h | ||
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h new file mode 100644 index 00000000000..9e65d9e2066 --- /dev/null +++ b/include/linux/raid/md_p.h | |||
@@ -0,0 +1,283 @@ | |||
1 | /* | ||
2 | md_p.h : physical layout of Linux RAID devices | ||
3 | Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2, or (at your option) | ||
8 | any later version. | ||
9 | |||
10 | You should have received a copy of the GNU General Public License | ||
11 | (for example /usr/src/linux/COPYING); if not, write to the Free | ||
12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
13 | */ | ||
14 | |||
15 | #ifndef _MD_P_H | ||
16 | #define _MD_P_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | /* | ||
21 | * RAID superblock. | ||
22 | * | ||
23 | * The RAID superblock maintains some statistics on each RAID configuration. | ||
24 | * Each real device in the RAID set contains it near the end of the device. | ||
25 | * Some of the ideas are copied from the ext2fs implementation. | ||
26 | * | ||
27 | * We currently use 4096 bytes as follows: | ||
28 | * | ||
29 | * word offset function | ||
30 | * | ||
31 | * 0 - 31 Constant generic RAID device information. | ||
32 | * 32 - 63 Generic state information. | ||
33 | * 64 - 127 Personality specific information. | ||
34 | * 128 - 511 12 32-words descriptors of the disks in the raid set. | ||
35 | * 512 - 911 Reserved. | ||
36 | * 912 - 1023 Disk specific descriptor. | ||
37 | */ | ||
38 | |||
39 | /* | ||
40 | * If x is the real device size in bytes, we return an apparent size of: | ||
41 | * | ||
42 | * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES | ||
43 | * | ||
44 | * and place the 4kB superblock at offset y. | ||
45 | */ | ||
46 | #define MD_RESERVED_BYTES (64 * 1024) | ||
47 | #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) | ||
48 | |||
49 | #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) | ||
50 | |||
51 | #define MD_SB_BYTES 4096 | ||
52 | #define MD_SB_WORDS (MD_SB_BYTES / 4) | ||
53 | #define MD_SB_SECTORS (MD_SB_BYTES / 512) | ||
54 | |||
55 | /* | ||
56 | * The following are counted in 32-bit words | ||
57 | */ | ||
58 | #define MD_SB_GENERIC_OFFSET 0 | ||
59 | #define MD_SB_PERSONALITY_OFFSET 64 | ||
60 | #define MD_SB_DISKS_OFFSET 128 | ||
61 | #define MD_SB_DESCRIPTOR_OFFSET 992 | ||
62 | |||
63 | #define MD_SB_GENERIC_CONSTANT_WORDS 32 | ||
64 | #define MD_SB_GENERIC_STATE_WORDS 32 | ||
65 | #define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS) | ||
66 | #define MD_SB_PERSONALITY_WORDS 64 | ||
67 | #define MD_SB_DESCRIPTOR_WORDS 32 | ||
68 | #define MD_SB_DISKS 27 | ||
69 | #define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS) | ||
70 | #define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS) | ||
71 | #define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS) | ||
72 | |||
73 | /* | ||
74 | * Device "operational" state bits | ||
75 | */ | ||
76 | #define MD_DISK_FAULTY 0 /* disk is faulty / operational */ | ||
77 | #define MD_DISK_ACTIVE 1 /* disk is running or spare disk */ | ||
78 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ | ||
79 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ | ||
80 | |||
81 | #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. | ||
82 | * read requests will only be sent here in | ||
83 | * dire need | ||
84 | */ | ||
85 | |||
86 | typedef struct mdp_device_descriptor_s { | ||
87 | __u32 number; /* 0 Device number in the entire set */ | ||
88 | __u32 major; /* 1 Device major number */ | ||
89 | __u32 minor; /* 2 Device minor number */ | ||
90 | __u32 raid_disk; /* 3 The role of the device in the raid set */ | ||
91 | __u32 state; /* 4 Operational state */ | ||
92 | __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5]; | ||
93 | } mdp_disk_t; | ||
94 | |||
95 | #define MD_SB_MAGIC 0xa92b4efc | ||
96 | |||
97 | /* | ||
98 | * Superblock state bits | ||
99 | */ | ||
100 | #define MD_SB_CLEAN 0 | ||
101 | #define MD_SB_ERRORS 1 | ||
102 | |||
103 | #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ | ||
104 | |||
105 | /* | ||
106 | * Notes: | ||
107 | * - if an array is being reshaped (restriped) in order to change the | ||
108 | * the number of active devices in the array, 'raid_disks' will be | ||
109 | * the larger of the old and new numbers. 'delta_disks' will | ||
110 | * be the "new - old". So if +ve, raid_disks is the new value, and | ||
111 | * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the | ||
112 | * old value and "raid_disks+delta_disks" is the new (smaller) value. | ||
113 | */ | ||
114 | |||
115 | |||
116 | typedef struct mdp_superblock_s { | ||
117 | /* | ||
118 | * Constant generic information | ||
119 | */ | ||
120 | __u32 md_magic; /* 0 MD identifier */ | ||
121 | __u32 major_version; /* 1 major version to which the set conforms */ | ||
122 | __u32 minor_version; /* 2 minor version ... */ | ||
123 | __u32 patch_version; /* 3 patchlevel version ... */ | ||
124 | __u32 gvalid_words; /* 4 Number of used words in this section */ | ||
125 | __u32 set_uuid0; /* 5 Raid set identifier */ | ||
126 | __u32 ctime; /* 6 Creation time */ | ||
127 | __u32 level; /* 7 Raid personality */ | ||
128 | __u32 size; /* 8 Apparent size of each individual disk */ | ||
129 | __u32 nr_disks; /* 9 total disks in the raid set */ | ||
130 | __u32 raid_disks; /* 10 disks in a fully functional raid set */ | ||
131 | __u32 md_minor; /* 11 preferred MD minor device number */ | ||
132 | __u32 not_persistent; /* 12 does it have a persistent superblock */ | ||
133 | __u32 set_uuid1; /* 13 Raid set identifier #2 */ | ||
134 | __u32 set_uuid2; /* 14 Raid set identifier #3 */ | ||
135 | __u32 set_uuid3; /* 15 Raid set identifier #4 */ | ||
136 | __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16]; | ||
137 | |||
138 | /* | ||
139 | * Generic state information | ||
140 | */ | ||
141 | __u32 utime; /* 0 Superblock update time */ | ||
142 | __u32 state; /* 1 State bits (clean, ...) */ | ||
143 | __u32 active_disks; /* 2 Number of currently active disks */ | ||
144 | __u32 working_disks; /* 3 Number of working disks */ | ||
145 | __u32 failed_disks; /* 4 Number of failed disks */ | ||
146 | __u32 spare_disks; /* 5 Number of spare disks */ | ||
147 | __u32 sb_csum; /* 6 checksum of the whole superblock */ | ||
148 | #ifdef __BIG_ENDIAN | ||
149 | __u32 events_hi; /* 7 high-order of superblock update count */ | ||
150 | __u32 events_lo; /* 8 low-order of superblock update count */ | ||
151 | __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ | ||
152 | __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ | ||
153 | #else | ||
154 | __u32 events_lo; /* 7 low-order of superblock update count */ | ||
155 | __u32 events_hi; /* 8 high-order of superblock update count */ | ||
156 | __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ | ||
157 | __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ | ||
158 | #endif | ||
159 | __u32 recovery_cp; /* 11 recovery checkpoint sector count */ | ||
160 | /* There are only valid for minor_version > 90 */ | ||
161 | __u64 reshape_position; /* 12,13 next address in array-space for reshape */ | ||
162 | __u32 new_level; /* 14 new level we are reshaping to */ | ||
163 | __u32 delta_disks; /* 15 change in number of raid_disks */ | ||
164 | __u32 new_layout; /* 16 new layout */ | ||
165 | __u32 new_chunk; /* 17 new chunk size (bytes) */ | ||
166 | __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; | ||
167 | |||
168 | /* | ||
169 | * Personality information | ||
170 | */ | ||
171 | __u32 layout; /* 0 the array's physical layout */ | ||
172 | __u32 chunk_size; /* 1 chunk size in bytes */ | ||
173 | __u32 root_pv; /* 2 LV root PV */ | ||
174 | __u32 root_block; /* 3 LV root block */ | ||
175 | __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4]; | ||
176 | |||
177 | /* | ||
178 | * Disks information | ||
179 | */ | ||
180 | mdp_disk_t disks[MD_SB_DISKS]; | ||
181 | |||
182 | /* | ||
183 | * Reserved | ||
184 | */ | ||
185 | __u32 reserved[MD_SB_RESERVED_WORDS]; | ||
186 | |||
187 | /* | ||
188 | * Active descriptor | ||
189 | */ | ||
190 | mdp_disk_t this_disk; | ||
191 | |||
192 | } mdp_super_t; | ||
193 | |||
194 | static inline __u64 md_event(mdp_super_t *sb) { | ||
195 | __u64 ev = sb->events_hi; | ||
196 | return (ev<<32)| sb->events_lo; | ||
197 | } | ||
198 | |||
199 | #define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1) | ||
200 | |||
201 | /* | ||
202 | * The version-1 superblock : | ||
203 | * All numeric fields are little-endian. | ||
204 | * | ||
205 | * total size: 256 bytes plus 2 per device. | ||
206 | * 1K allows 384 devices. | ||
207 | */ | ||
208 | struct mdp_superblock_1 { | ||
209 | /* constant array information - 128 bytes */ | ||
210 | __le32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ | ||
211 | __le32 major_version; /* 1 */ | ||
212 | __le32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ | ||
213 | __le32 pad0; /* always set to 0 when writing */ | ||
214 | |||
215 | __u8 set_uuid[16]; /* user-space generated. */ | ||
216 | char set_name[32]; /* set and interpreted by user-space */ | ||
217 | |||
218 | __le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ | ||
219 | __le32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ | ||
220 | __le32 layout; /* only for raid5 and raid10 currently */ | ||
221 | __le64 size; /* used size of component devices, in 512byte sectors */ | ||
222 | |||
223 | __le32 chunksize; /* in 512byte sectors */ | ||
224 | __le32 raid_disks; | ||
225 | __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts | ||
226 | * NOTE: signed, so bitmap can be before superblock | ||
227 | * only meaningful of feature_map[0] is set. | ||
228 | */ | ||
229 | |||
230 | /* These are only valid with feature bit '4' */ | ||
231 | __le32 new_level; /* new level we are reshaping to */ | ||
232 | __le64 reshape_position; /* next address in array-space for reshape */ | ||
233 | __le32 delta_disks; /* change in number of raid_disks */ | ||
234 | __le32 new_layout; /* new layout */ | ||
235 | __le32 new_chunk; /* new chunk size (512byte sectors) */ | ||
236 | __u8 pad1[128-124]; /* set to 0 when written */ | ||
237 | |||
238 | /* constant this-device information - 64 bytes */ | ||
239 | __le64 data_offset; /* sector start of data, often 0 */ | ||
240 | __le64 data_size; /* sectors in this device that can be used for data */ | ||
241 | __le64 super_offset; /* sector start of this superblock */ | ||
242 | __le64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ | ||
243 | __le32 dev_number; /* permanent identifier of this device - not role in raid */ | ||
244 | __le32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ | ||
245 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ | ||
246 | __u8 devflags; /* per-device flags. Only one defined...*/ | ||
247 | #define WriteMostly1 1 /* mask for writemostly flag in above */ | ||
248 | /* Bad block log. If there are any bad blocks the feature flag is set. | ||
249 | * If offset and size are non-zero, that space is reserved and available | ||
250 | */ | ||
251 | __u8 bblog_shift; /* shift from sectors to block size */ | ||
252 | __le16 bblog_size; /* number of sectors reserved for list */ | ||
253 | __le32 bblog_offset; /* sector offset from superblock to bblog, | ||
254 | * signed - not unsigned */ | ||
255 | |||
256 | /* array state information - 64 bytes */ | ||
257 | __le64 utime; /* 40 bits second, 24 bits microseconds */ | ||
258 | __le64 events; /* incremented when superblock updated */ | ||
259 | __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ | ||
260 | __le32 sb_csum; /* checksum up to devs[max_dev] */ | ||
261 | __le32 max_dev; /* size of devs[] array to consider */ | ||
262 | __u8 pad3[64-32]; /* set to 0 when writing */ | ||
263 | |||
264 | /* device state information. Indexed by dev_number. | ||
265 | * 2 bytes per device | ||
266 | * Note there are no per-device state flags. State information is rolled | ||
267 | * into the 'roles' value. If a device is spare or faulty, then it doesn't | ||
268 | * have a meaningful role. | ||
269 | */ | ||
270 | __le16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ | ||
271 | }; | ||
272 | |||
273 | /* feature_map bits */ | ||
274 | #define MD_FEATURE_BITMAP_OFFSET 1 | ||
275 | #define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and | ||
276 | * must be honoured | ||
277 | */ | ||
278 | #define MD_FEATURE_RESHAPE_ACTIVE 4 | ||
279 | #define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ | ||
280 | |||
281 | #define MD_FEATURE_ALL (1|2|4|8) | ||
282 | |||
283 | #endif | ||
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h new file mode 100644 index 00000000000..484fef81cd3 --- /dev/null +++ b/include/linux/ramoops.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef __RAMOOPS_H | ||
2 | #define __RAMOOPS_H | ||
3 | |||
4 | /* | ||
5 | * Ramoops platform data | ||
6 | * @mem_size memory size for ramoops | ||
7 | * @mem_address physical memory address to contain ramoops | ||
8 | */ | ||
9 | |||
10 | struct ramoops_platform_data { | ||
11 | unsigned long mem_size; | ||
12 | unsigned long mem_address; | ||
13 | unsigned long record_size; | ||
14 | int dump_oops; | ||
15 | }; | ||
16 | |||
17 | #endif | ||
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h new file mode 100644 index 00000000000..5c611818936 --- /dev/null +++ b/include/linux/rar_register.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of version 2 of the GNU General | ||
6 | * Public License as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be | ||
9 | * useful, but WITHOUT ANY WARRANTY; without even the implied | ||
10 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
11 | * PURPOSE. See the GNU General Public License for more details. | ||
12 | * You should have received a copy of the GNU General Public | ||
13 | * License along with this program; if not, write to the Free | ||
14 | * Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
15 | * Boston, MA 02111-1307, USA. | ||
16 | * The full GNU General Public License is included in this | ||
17 | * distribution in the file called COPYING. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #ifndef _RAR_REGISTER_H | ||
22 | #define _RAR_REGISTER_H | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | |||
26 | /* following are used both in drivers as well as user space apps */ | ||
27 | |||
28 | #define RAR_TYPE_VIDEO 0 | ||
29 | #define RAR_TYPE_AUDIO 1 | ||
30 | #define RAR_TYPE_IMAGE 2 | ||
31 | #define RAR_TYPE_DATA 3 | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | struct rar_device; | ||
36 | |||
37 | #if defined(CONFIG_RAR_REGISTER) | ||
38 | int register_rar(int num, | ||
39 | int (*callback)(unsigned long data), unsigned long data); | ||
40 | void unregister_rar(int num); | ||
41 | int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end); | ||
42 | int rar_lock(int rar_index); | ||
43 | #else | ||
44 | extern void unregister_rar(int num) { } | ||
45 | extern int rar_lock(int rar_index) { return -EIO; } | ||
46 | |||
47 | extern inline int register_rar(int num, | ||
48 | int (*callback)(unsigned long data), unsigned long data) | ||
49 | { | ||
50 | return -ENODEV; | ||
51 | } | ||
52 | |||
53 | extern int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end) | ||
54 | { | ||
55 | return -ENODEV; | ||
56 | } | ||
57 | #endif /* RAR_REGISTER */ | ||
58 | |||
59 | #endif /* __KERNEL__ */ | ||
60 | #endif /* _RAR_REGISTER_H */ | ||
diff --git a/include/linux/raw.h b/include/linux/raw.h new file mode 100644 index 00000000000..62d543e7060 --- /dev/null +++ b/include/linux/raw.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef __LINUX_RAW_H | ||
2 | #define __LINUX_RAW_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define RAW_SETBIND _IO( 0xac, 0 ) | ||
7 | #define RAW_GETBIND _IO( 0xac, 1 ) | ||
8 | |||
9 | struct raw_config_request | ||
10 | { | ||
11 | int raw_minor; | ||
12 | __u64 block_major; | ||
13 | __u64 block_minor; | ||
14 | }; | ||
15 | |||
16 | #define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS | ||
17 | |||
18 | #endif /* __LINUX_RAW_H */ | ||
diff --git a/include/linux/rds.h b/include/linux/rds.h new file mode 100644 index 00000000000..91950950aa5 --- /dev/null +++ b/include/linux/rds.h | |||
@@ -0,0 +1,285 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008 Oracle. All rights reserved. | ||
3 | * | ||
4 | * This software is available to you under a choice of one of two | ||
5 | * licenses. You may choose to be licensed under the terms of the GNU | ||
6 | * General Public License (GPL) Version 2, available from the file | ||
7 | * COPYING in the main directory of this source tree, or the | ||
8 | * OpenIB.org BSD license below: | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or | ||
11 | * without modification, are permitted provided that the following | ||
12 | * conditions are met: | ||
13 | * | ||
14 | * - Redistributions of source code must retain the above | ||
15 | * copyright notice, this list of conditions and the following | ||
16 | * disclaimer. | ||
17 | * | ||
18 | * - Redistributions in binary form must reproduce the above | ||
19 | * copyright notice, this list of conditions and the following | ||
20 | * disclaimer in the documentation and/or other materials | ||
21 | * provided with the distribution. | ||
22 | * | ||
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
30 | * SOFTWARE. | ||
31 | * | ||
32 | */ | ||
33 | |||
34 | #ifndef _LINUX_RDS_H | ||
35 | #define _LINUX_RDS_H | ||
36 | |||
37 | #include <linux/types.h> | ||
38 | |||
39 | #define RDS_IB_ABI_VERSION 0x301 | ||
40 | |||
41 | /* | ||
42 | * setsockopt/getsockopt for SOL_RDS | ||
43 | */ | ||
44 | #define RDS_CANCEL_SENT_TO 1 | ||
45 | #define RDS_GET_MR 2 | ||
46 | #define RDS_FREE_MR 3 | ||
47 | /* deprecated: RDS_BARRIER 4 */ | ||
48 | #define RDS_RECVERR 5 | ||
49 | #define RDS_CONG_MONITOR 6 | ||
50 | #define RDS_GET_MR_FOR_DEST 7 | ||
51 | |||
52 | /* | ||
53 | * Control message types for SOL_RDS. | ||
54 | * | ||
55 | * CMSG_RDMA_ARGS (sendmsg) | ||
56 | * Request a RDMA transfer to/from the specified | ||
57 | * memory ranges. | ||
58 | * The cmsg_data is a struct rds_rdma_args. | ||
59 | * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg) | ||
60 | * Kernel informs application about intended | ||
61 | * source/destination of a RDMA transfer | ||
62 | * RDS_CMSG_RDMA_MAP (sendmsg) | ||
63 | * Application asks kernel to map the given | ||
64 | * memory range into a IB MR, and send the | ||
65 | * R_Key along in an RDS extension header. | ||
66 | * The cmsg_data is a struct rds_get_mr_args, | ||
67 | * the same as for the GET_MR setsockopt. | ||
68 | * RDS_CMSG_RDMA_STATUS (recvmsg) | ||
69 | * Returns the status of a completed RDMA operation. | ||
70 | */ | ||
71 | #define RDS_CMSG_RDMA_ARGS 1 | ||
72 | #define RDS_CMSG_RDMA_DEST 2 | ||
73 | #define RDS_CMSG_RDMA_MAP 3 | ||
74 | #define RDS_CMSG_RDMA_STATUS 4 | ||
75 | #define RDS_CMSG_CONG_UPDATE 5 | ||
76 | #define RDS_CMSG_ATOMIC_FADD 6 | ||
77 | #define RDS_CMSG_ATOMIC_CSWP 7 | ||
78 | #define RDS_CMSG_MASKED_ATOMIC_FADD 8 | ||
79 | #define RDS_CMSG_MASKED_ATOMIC_CSWP 9 | ||
80 | |||
81 | #define RDS_INFO_FIRST 10000 | ||
82 | #define RDS_INFO_COUNTERS 10000 | ||
83 | #define RDS_INFO_CONNECTIONS 10001 | ||
84 | /* 10002 aka RDS_INFO_FLOWS is deprecated */ | ||
85 | #define RDS_INFO_SEND_MESSAGES 10003 | ||
86 | #define RDS_INFO_RETRANS_MESSAGES 10004 | ||
87 | #define RDS_INFO_RECV_MESSAGES 10005 | ||
88 | #define RDS_INFO_SOCKETS 10006 | ||
89 | #define RDS_INFO_TCP_SOCKETS 10007 | ||
90 | #define RDS_INFO_IB_CONNECTIONS 10008 | ||
91 | #define RDS_INFO_CONNECTION_STATS 10009 | ||
92 | #define RDS_INFO_IWARP_CONNECTIONS 10010 | ||
93 | #define RDS_INFO_LAST 10010 | ||
94 | |||
95 | struct rds_info_counter { | ||
96 | uint8_t name[32]; | ||
97 | uint64_t value; | ||
98 | } __attribute__((packed)); | ||
99 | |||
100 | #define RDS_INFO_CONNECTION_FLAG_SENDING 0x01 | ||
101 | #define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02 | ||
102 | #define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04 | ||
103 | |||
104 | #define TRANSNAMSIZ 16 | ||
105 | |||
106 | struct rds_info_connection { | ||
107 | uint64_t next_tx_seq; | ||
108 | uint64_t next_rx_seq; | ||
109 | __be32 laddr; | ||
110 | __be32 faddr; | ||
111 | uint8_t transport[TRANSNAMSIZ]; /* null term ascii */ | ||
112 | uint8_t flags; | ||
113 | } __attribute__((packed)); | ||
114 | |||
115 | #define RDS_INFO_MESSAGE_FLAG_ACK 0x01 | ||
116 | #define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02 | ||
117 | |||
118 | struct rds_info_message { | ||
119 | uint64_t seq; | ||
120 | uint32_t len; | ||
121 | __be32 laddr; | ||
122 | __be32 faddr; | ||
123 | __be16 lport; | ||
124 | __be16 fport; | ||
125 | uint8_t flags; | ||
126 | } __attribute__((packed)); | ||
127 | |||
128 | struct rds_info_socket { | ||
129 | uint32_t sndbuf; | ||
130 | __be32 bound_addr; | ||
131 | __be32 connected_addr; | ||
132 | __be16 bound_port; | ||
133 | __be16 connected_port; | ||
134 | uint32_t rcvbuf; | ||
135 | uint64_t inum; | ||
136 | } __attribute__((packed)); | ||
137 | |||
138 | struct rds_info_tcp_socket { | ||
139 | __be32 local_addr; | ||
140 | __be16 local_port; | ||
141 | __be32 peer_addr; | ||
142 | __be16 peer_port; | ||
143 | uint64_t hdr_rem; | ||
144 | uint64_t data_rem; | ||
145 | uint32_t last_sent_nxt; | ||
146 | uint32_t last_expected_una; | ||
147 | uint32_t last_seen_una; | ||
148 | } __attribute__((packed)); | ||
149 | |||
150 | #define RDS_IB_GID_LEN 16 | ||
151 | struct rds_info_rdma_connection { | ||
152 | __be32 src_addr; | ||
153 | __be32 dst_addr; | ||
154 | uint8_t src_gid[RDS_IB_GID_LEN]; | ||
155 | uint8_t dst_gid[RDS_IB_GID_LEN]; | ||
156 | |||
157 | uint32_t max_send_wr; | ||
158 | uint32_t max_recv_wr; | ||
159 | uint32_t max_send_sge; | ||
160 | uint32_t rdma_mr_max; | ||
161 | uint32_t rdma_mr_size; | ||
162 | }; | ||
163 | |||
164 | /* | ||
165 | * Congestion monitoring. | ||
166 | * Congestion control in RDS happens at the host connection | ||
167 | * level by exchanging a bitmap marking congested ports. | ||
168 | * By default, a process sleeping in poll() is always woken | ||
169 | * up when the congestion map is updated. | ||
170 | * With explicit monitoring, an application can have more | ||
171 | * fine-grained control. | ||
172 | * The application installs a 64bit mask value in the socket, | ||
173 | * where each bit corresponds to a group of ports. | ||
174 | * When a congestion update arrives, RDS checks the set of | ||
175 | * ports that are now uncongested against the list bit mask | ||
176 | * installed in the socket, and if they overlap, we queue a | ||
177 | * cong_notification on the socket. | ||
178 | * | ||
179 | * To install the congestion monitor bitmask, use RDS_CONG_MONITOR | ||
180 | * with the 64bit mask. | ||
181 | * Congestion updates are received via RDS_CMSG_CONG_UPDATE | ||
182 | * control messages. | ||
183 | * | ||
184 | * The correspondence between bits and ports is | ||
185 | * 1 << (portnum % 64) | ||
186 | */ | ||
187 | #define RDS_CONG_MONITOR_SIZE 64 | ||
188 | #define RDS_CONG_MONITOR_BIT(port) (((unsigned int) port) % RDS_CONG_MONITOR_SIZE) | ||
189 | #define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port)) | ||
190 | |||
191 | /* | ||
192 | * RDMA related types | ||
193 | */ | ||
194 | |||
195 | /* | ||
196 | * This encapsulates a remote memory location. | ||
197 | * In the current implementation, it contains the R_Key | ||
198 | * of the remote memory region, and the offset into it | ||
199 | * (so that the application does not have to worry about | ||
200 | * alignment). | ||
201 | */ | ||
202 | typedef uint64_t rds_rdma_cookie_t; | ||
203 | |||
204 | struct rds_iovec { | ||
205 | uint64_t addr; | ||
206 | uint64_t bytes; | ||
207 | }; | ||
208 | |||
209 | struct rds_get_mr_args { | ||
210 | struct rds_iovec vec; | ||
211 | uint64_t cookie_addr; | ||
212 | uint64_t flags; | ||
213 | }; | ||
214 | |||
215 | struct rds_get_mr_for_dest_args { | ||
216 | struct sockaddr_storage dest_addr; | ||
217 | struct rds_iovec vec; | ||
218 | uint64_t cookie_addr; | ||
219 | uint64_t flags; | ||
220 | }; | ||
221 | |||
222 | struct rds_free_mr_args { | ||
223 | rds_rdma_cookie_t cookie; | ||
224 | uint64_t flags; | ||
225 | }; | ||
226 | |||
227 | struct rds_rdma_args { | ||
228 | rds_rdma_cookie_t cookie; | ||
229 | struct rds_iovec remote_vec; | ||
230 | uint64_t local_vec_addr; | ||
231 | uint64_t nr_local; | ||
232 | uint64_t flags; | ||
233 | uint64_t user_token; | ||
234 | }; | ||
235 | |||
236 | struct rds_atomic_args { | ||
237 | rds_rdma_cookie_t cookie; | ||
238 | uint64_t local_addr; | ||
239 | uint64_t remote_addr; | ||
240 | union { | ||
241 | struct { | ||
242 | uint64_t compare; | ||
243 | uint64_t swap; | ||
244 | } cswp; | ||
245 | struct { | ||
246 | uint64_t add; | ||
247 | } fadd; | ||
248 | struct { | ||
249 | uint64_t compare; | ||
250 | uint64_t swap; | ||
251 | uint64_t compare_mask; | ||
252 | uint64_t swap_mask; | ||
253 | } m_cswp; | ||
254 | struct { | ||
255 | uint64_t add; | ||
256 | uint64_t nocarry_mask; | ||
257 | } m_fadd; | ||
258 | }; | ||
259 | uint64_t flags; | ||
260 | uint64_t user_token; | ||
261 | }; | ||
262 | |||
263 | struct rds_rdma_notify { | ||
264 | uint64_t user_token; | ||
265 | int32_t status; | ||
266 | }; | ||
267 | |||
268 | #define RDS_RDMA_SUCCESS 0 | ||
269 | #define RDS_RDMA_REMOTE_ERROR 1 | ||
270 | #define RDS_RDMA_CANCELED 2 | ||
271 | #define RDS_RDMA_DROPPED 3 | ||
272 | #define RDS_RDMA_OTHER_ERROR 4 | ||
273 | |||
274 | /* | ||
275 | * Common set of flags for all RDMA related structs | ||
276 | */ | ||
277 | #define RDS_RDMA_READWRITE 0x0001 | ||
278 | #define RDS_RDMA_FENCE 0x0002 /* use FENCE for immediate send */ | ||
279 | #define RDS_RDMA_INVALIDATE 0x0004 /* invalidate R_Key after freeing MR */ | ||
280 | #define RDS_RDMA_USE_ONCE 0x0008 /* free MR after use */ | ||
281 | #define RDS_RDMA_DONTWAIT 0x0010 /* Don't wait in SET_BARRIER */ | ||
282 | #define RDS_RDMA_NOTIFY_ME 0x0020 /* Notify when operation completes */ | ||
283 | #define RDS_RDMA_SILENT 0x0040 /* Do not interrupt remote */ | ||
284 | |||
285 | #endif /* IB_RDS_H */ | ||
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h new file mode 100644 index 00000000000..a6d014005d4 --- /dev/null +++ b/include/linux/regulator/bq24022.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | struct regulator_init_data; | ||
14 | |||
15 | /** | ||
16 | * bq24022_mach_info - platform data for bq24022 | ||
17 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | ||
18 | * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA | ||
19 | */ | ||
20 | struct bq24022_mach_info { | ||
21 | int gpio_nce; | ||
22 | int gpio_iset2; | ||
23 | struct regulator_init_data *init_data; | ||
24 | }; | ||
diff --git a/include/linux/regulator/fan53555-regulator.h b/include/linux/regulator/fan53555-regulator.h new file mode 100644 index 00000000000..e2ed83bab4e --- /dev/null +++ b/include/linux/regulator/fan53555-regulator.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * include/linux/regulator/fan53555.h | ||
3 | * | ||
4 | * Interface for regulator driver for FairChild fan53555 Processor power supply | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __REGULATOR_FAN53555_H | ||
25 | #define __REGULATOR_FAN53555_H | ||
26 | |||
27 | #include <linux/regulator/machine.h> | ||
28 | |||
29 | /* | ||
30 | * struct fan53555_regulator_platform_data - fan53555 regulator platform data. | ||
31 | * When VSEL pin is low, VOUT is set by the VSEL0 register. | ||
32 | * When VSEL pin is high, VOUT is set by the VSEL1 register | ||
33 | * | ||
34 | * @reg_init_data: The regulator init data. | ||
35 | * @vsel_id: Select the voltage id register. | ||
36 | * @vsel0_buck_en: Software Buck enable when EN=high & VSEL=low | ||
37 | * @vsel0_mode: Force PWM mode(1) or Allow auto-PFM mode(0) during light load | ||
38 | * @init_vsel0_min_uV: initial micro volts when EN=high & VSEL=low | ||
39 | * @init_vsel0_max_uV: initial micro volts when EN=high & VSEL=low | ||
40 | * @vsel1_buck_en: Software Buck enable when EN=high & VSEL=high | ||
41 | * @vsel1_mode: Force PWM mode(1) or Allow auto-PFM mode(0) during light load | ||
42 | * @init_vsel1_min_uV: initial micro volts when EN=high & VSEL=high | ||
43 | * @init_vsel1_max_uV: initial micro volts when EN=high & VSEL=high | ||
44 | * @output_discharge: when the regulator is disabled, VOUT discharges | ||
45 | * @slew_rate: slew rate of trasitioning from a low to high voltage | ||
46 | */ | ||
47 | |||
48 | struct fan53555_regulator_platform_data { | ||
49 | struct regulator_init_data reg_init_data; | ||
50 | int vsel_id; | ||
51 | unsigned vsel0_buck_en:1; | ||
52 | unsigned vsel0_mode:1; | ||
53 | int init_vsel0_min_uV; | ||
54 | int init_vsel0_max_uV; | ||
55 | unsigned vsel1_buck_en:1; | ||
56 | unsigned vsel1_mode:1; | ||
57 | int init_vsel1_min_uV; | ||
58 | int init_vsel1_max_uV; | ||
59 | unsigned output_discharge:1; | ||
60 | unsigned slew_rate:3; | ||
61 | }; | ||
62 | |||
63 | #endif /* __REGULATOR_FAN53555_H */ | ||
diff --git a/include/linux/regulator/gpio-switch-regulator.h b/include/linux/regulator/gpio-switch-regulator.h new file mode 100644 index 00000000000..68776b93ef0 --- /dev/null +++ b/include/linux/regulator/gpio-switch-regulator.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011, NVIDIA Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef _GPIO_SWITCH_REGULATOR_H | ||
20 | #define _GPIO_SWITCH_REGULATOR_H | ||
21 | |||
22 | #include <linux/regulator/machine.h> | ||
23 | |||
24 | /* | ||
25 | * struct gpio_switch_regulator_subdev_data - Gpio switch regulator subdevice | ||
26 | * data. | ||
27 | * | ||
28 | * Subdevice data to register a gpio regulator switch device driver. | ||
29 | * | ||
30 | * @regulator_name: The name of regulator. | ||
31 | * @input_supply: Input supply name. | ||
32 | * @id: The id of the switch. | ||
33 | * @gpio_nr: Gpio nr which controls this switch. | ||
34 | * @active_low: true if making gpio low makes voltage output enable. | ||
35 | * @init_state: 1 if init_state should be active. | ||
36 | * @voltages: Possible voltages to set at output. The values are in millivolt. | ||
37 | * @n_voltages: Number of voltages. | ||
38 | * @num_consumer_supplies: Number of cosumer supplies. | ||
39 | * @consumer_supplies: List of consumer spllies. | ||
40 | */ | ||
41 | struct gpio_switch_regulator_subdev_data { | ||
42 | const char *regulator_name; | ||
43 | const char *input_supply; | ||
44 | int id; | ||
45 | int gpio_nr; | ||
46 | int active_low; | ||
47 | int pin_group; | ||
48 | int init_state; | ||
49 | int *voltages; | ||
50 | unsigned n_voltages; | ||
51 | struct regulator_consumer_supply *consumer_supplies; | ||
52 | int num_consumer_supplies; | ||
53 | struct regulation_constraints constraints; | ||
54 | int (*enable_rail)(struct gpio_switch_regulator_subdev_data *pdata); | ||
55 | int (*disable_rail)(struct gpio_switch_regulator_subdev_data *pdata); | ||
56 | |||
57 | }; | ||
58 | |||
59 | /** | ||
60 | * gpio_switch_regulator_platform_data - platform data for gpio_switch_regulator | ||
61 | * @num_subdevs: number of regulators used | ||
62 | * @subdevs: pointer to regulators used | ||
63 | */ | ||
64 | struct gpio_switch_regulator_platform_data { | ||
65 | int num_subdevs; | ||
66 | struct gpio_switch_regulator_subdev_data **subdevs; | ||
67 | }; | ||
68 | |||
69 | #endif | ||
diff --git a/include/linux/regulator/max77663-regulator.h b/include/linux/regulator/max77663-regulator.h new file mode 100644 index 00000000000..d8ab389c425 --- /dev/null +++ b/include/linux/regulator/max77663-regulator.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * include/linux/regulator/max77663-regulator.h | ||
3 | * Maxim LDO and Buck regulators driver | ||
4 | * | ||
5 | * Copyright 2011-2012 Maxim Integrated Products, Inc. | ||
6 | * Copyright (C) 2011-2012 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License as | ||
10 | * published by the Free Software Foundation; either version 2 of the | ||
11 | * License, or (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __LINUX_REGULATOR_MAX77663_REGULATOR_H__ | ||
16 | #define __LINUX_REGULATOR_MAX77663_REGULATOR_H__ | ||
17 | |||
18 | #include <linux/regulator/machine.h> | ||
19 | |||
20 | #define max77663_rails(_name) "max77663_"#_name | ||
21 | |||
22 | enum max77663_regulator_id { | ||
23 | MAX77663_REGULATOR_ID_SD0, | ||
24 | MAX77663_REGULATOR_ID_DVSSD0, | ||
25 | MAX77663_REGULATOR_ID_SD1, | ||
26 | MAX77663_REGULATOR_ID_DVSSD1, | ||
27 | MAX77663_REGULATOR_ID_SD2, | ||
28 | MAX77663_REGULATOR_ID_SD3, | ||
29 | MAX77663_REGULATOR_ID_SD4, | ||
30 | MAX77663_REGULATOR_ID_LDO0, | ||
31 | MAX77663_REGULATOR_ID_LDO1, | ||
32 | MAX77663_REGULATOR_ID_LDO2, | ||
33 | MAX77663_REGULATOR_ID_LDO3, | ||
34 | MAX77663_REGULATOR_ID_LDO4, | ||
35 | MAX77663_REGULATOR_ID_LDO5, | ||
36 | MAX77663_REGULATOR_ID_LDO6, | ||
37 | MAX77663_REGULATOR_ID_LDO7, | ||
38 | MAX77663_REGULATOR_ID_LDO8, | ||
39 | MAX77663_REGULATOR_ID_NR, | ||
40 | }; | ||
41 | |||
42 | /* FPS Power Up/Down Period */ | ||
43 | enum max77663_regulator_fps_power_period { | ||
44 | FPS_POWER_PERIOD_0, | ||
45 | FPS_POWER_PERIOD_1, | ||
46 | FPS_POWER_PERIOD_2, | ||
47 | FPS_POWER_PERIOD_3, | ||
48 | FPS_POWER_PERIOD_4, | ||
49 | FPS_POWER_PERIOD_5, | ||
50 | FPS_POWER_PERIOD_6, | ||
51 | FPS_POWER_PERIOD_7, | ||
52 | FPS_POWER_PERIOD_DEF = -1, | ||
53 | }; | ||
54 | |||
55 | /* FPS Time Period */ | ||
56 | enum max77663_regulator_fps_time_period { | ||
57 | FPS_TIME_PERIOD_20US, | ||
58 | FPS_TIME_PERIOD_40US, | ||
59 | FPS_TIME_PERIOD_80US, | ||
60 | FPS_TIME_PERIOD_160US, | ||
61 | FPS_TIME_PERIOD_320US, | ||
62 | FPS_TIME_PERIOD_640US, | ||
63 | FPS_TIME_PERIOD_1280US, | ||
64 | FPS_TIME_PERIOD_2560US, | ||
65 | FPS_TIME_PERIOD_DEF = -1, | ||
66 | }; | ||
67 | |||
68 | /* FPS Enable Source */ | ||
69 | enum max77663_regulator_fps_en_src { | ||
70 | FPS_EN_SRC_EN0, | ||
71 | FPS_EN_SRC_EN1, | ||
72 | FPS_EN_SRC_SW, | ||
73 | FPS_EN_SRC_RSVD, | ||
74 | }; | ||
75 | |||
76 | /* FPS Source */ | ||
77 | enum max77663_regulator_fps_src { | ||
78 | FPS_SRC_0, | ||
79 | FPS_SRC_1, | ||
80 | FPS_SRC_2, | ||
81 | FPS_SRC_NONE, | ||
82 | FPS_SRC_DEF = -1, | ||
83 | }; | ||
84 | |||
85 | /* | ||
86 | * Flags | ||
87 | */ | ||
88 | /* SD0 is controlled by EN2 */ | ||
89 | #define EN2_CTRL_SD0 0x01 | ||
90 | |||
91 | /* SD Slew Rate */ | ||
92 | #define SD_SLEW_RATE_SLOWEST 0x02 /* 13.75mV/us */ | ||
93 | #define SD_SLEW_RATE_SLOW 0x04 /* 27.50mV/us */ | ||
94 | #define SD_SLEW_RATE_FAST 0x08 /* 55.00mV/us */ | ||
95 | #define SD_SLEW_RATE_FASTEST 0x10 /* 100.00mV/us */ | ||
96 | #define SD_SLEW_RATE_MASK 0x1E | ||
97 | |||
98 | /* SD Forced PWM Mode */ | ||
99 | #define SD_FORCED_PWM_MODE 0x20 | ||
100 | |||
101 | /* SD Failling Slew Rate Active-Discharge Mode */ | ||
102 | #define SD_FSRADE_DISABLE 0x40 | ||
103 | |||
104 | /* Group Low-Power Mode */ | ||
105 | #define GLPM_ENABLE 0x80 | ||
106 | |||
107 | /* Tracking for LDO4 */ | ||
108 | #define LDO4_EN_TRACKING 0x100 | ||
109 | |||
110 | struct max77663_regulator_fps_cfg { | ||
111 | enum max77663_regulator_fps_src src; | ||
112 | enum max77663_regulator_fps_en_src en_src; | ||
113 | enum max77663_regulator_fps_time_period time_period; | ||
114 | }; | ||
115 | |||
116 | struct max77663_regulator_platform_data { | ||
117 | struct regulator_init_data init_data; | ||
118 | bool init_apply; | ||
119 | bool init_enable; | ||
120 | int init_uV; | ||
121 | enum max77663_regulator_fps_src fps_src; | ||
122 | enum max77663_regulator_fps_power_period fps_pu_period; | ||
123 | enum max77663_regulator_fps_power_period fps_pd_period; | ||
124 | |||
125 | int num_fps_cfgs; | ||
126 | struct max77663_regulator_fps_cfg *fps_cfgs; | ||
127 | |||
128 | unsigned int flags; | ||
129 | }; | ||
130 | |||
131 | #endif /* __LINUX_REGULATOR_MAX77663_REGULATOR_H__ */ | ||
diff --git a/include/linux/regulator/max8907c-regulator.h b/include/linux/regulator/max8907c-regulator.h new file mode 100644 index 00000000000..ddc5f0a6033 --- /dev/null +++ b/include/linux/regulator/max8907c-regulator.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* linux/regulator/max8907c-regulator.h | ||
2 | * | ||
3 | * Functions to access MAX8907C power management chip. | ||
4 | * | ||
5 | * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_REGULATOR_MAX8907C_H | ||
13 | #define __LINUX_REGULATOR_MAX8907C_H | ||
14 | |||
15 | /* IDs */ | ||
16 | #define MAX8907C_SD1 0 | ||
17 | #define MAX8907C_SD2 1 | ||
18 | #define MAX8907C_SD3 2 | ||
19 | #define MAX8907C_LDO1 3 | ||
20 | #define MAX8907C_LDO2 4 | ||
21 | #define MAX8907C_LDO3 5 | ||
22 | #define MAX8907C_LDO4 6 | ||
23 | #define MAX8907C_LDO5 7 | ||
24 | #define MAX8907C_LDO6 8 | ||
25 | #define MAX8907C_LDO7 9 | ||
26 | #define MAX8907C_LDO8 10 | ||
27 | #define MAX8907C_LDO9 11 | ||
28 | #define MAX8907C_LDO10 12 | ||
29 | #define MAX8907C_LDO11 13 | ||
30 | #define MAX8907C_LDO12 14 | ||
31 | #define MAX8907C_LDO13 15 | ||
32 | #define MAX8907C_LDO14 16 | ||
33 | #define MAX8907C_LDO15 17 | ||
34 | #define MAX8907C_LDO16 18 | ||
35 | #define MAX8907C_LDO17 19 | ||
36 | #define MAX8907C_LDO18 20 | ||
37 | #define MAX8907C_LDO19 21 | ||
38 | #define MAX8907C_LDO20 22 | ||
39 | #define MAX8907C_OUT5V 23 | ||
40 | #define MAX8907C_OUT33V 24 | ||
41 | #define MAX8907C_BBAT 25 | ||
42 | #define MAX8907C_SDBY 26 | ||
43 | #define MAX8907C_VRTC 27 | ||
44 | #define MAX8907C_WLED 27 | ||
45 | |||
46 | #endif | ||
diff --git a/include/linux/regulator/ricoh583-regulator.h b/include/linux/regulator/ricoh583-regulator.h new file mode 100644 index 00000000000..39fdb9e56e0 --- /dev/null +++ b/include/linux/regulator/ricoh583-regulator.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * linux/regulator/ricoh583-regulator.h | ||
3 | * | ||
4 | * Interface for regulator driver for RICOH583 power management chip. | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * Copyright (C) 2011 RICOH COMPANY,LTD | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
18 | * more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License along | ||
21 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef __LINUX_REGULATOR_RICOH583_H | ||
27 | #define __LINUX_REGULATOR_RICOH583_H | ||
28 | |||
29 | #include <linux/regulator/machine.h> | ||
30 | |||
31 | |||
32 | #define ricoh583_rails(_name) "RICOH583_"#_name | ||
33 | |||
34 | /* RICHOH Regulator IDs */ | ||
35 | enum regulator_id { | ||
36 | RICOH583_ID_DC0, | ||
37 | RICOH583_ID_DC1, | ||
38 | RICOH583_ID_DC2, | ||
39 | RICOH583_ID_DC3, | ||
40 | RICOH583_ID_LDO0, | ||
41 | RICOH583_ID_LDO1, | ||
42 | RICOH583_ID_LDO2, | ||
43 | RICOH583_ID_LDO3, | ||
44 | RICOH583_ID_LDO4, | ||
45 | RICOH583_ID_LDO5, | ||
46 | RICOH583_ID_LDO6, | ||
47 | RICOH583_ID_LDO7, | ||
48 | RICOH583_ID_LDO8, | ||
49 | RICOH583_ID_LDO9, | ||
50 | }; | ||
51 | |||
52 | struct ricoh583_regulator_platform_data { | ||
53 | struct regulator_init_data regulator; | ||
54 | int init_uV; | ||
55 | unsigned init_enable:1; | ||
56 | unsigned init_apply:1; | ||
57 | int deepsleep_uV; | ||
58 | int deepsleep_slots; | ||
59 | unsigned long ext_pwr_req; | ||
60 | unsigned long flags; | ||
61 | }; | ||
62 | |||
63 | #endif | ||
diff --git a/include/linux/regulator/tps6236x-regulator.h b/include/linux/regulator/tps6236x-regulator.h new file mode 100644 index 00000000000..7e8a3752966 --- /dev/null +++ b/include/linux/regulator/tps6236x-regulator.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * include/linux/regulator/tps6236x.h | ||
3 | * | ||
4 | * Interface for regulator driver for TI TPS6236x Processor core supply | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __REGULATOR_TPS6236X_H | ||
25 | #define __REGULATOR_TPS6236X_H | ||
26 | |||
27 | #include <linux/regulator/machine.h> | ||
28 | |||
29 | /* | ||
30 | * struct tps6236x_regulator_platform_data - tps6236x regulator platform data. | ||
31 | * | ||
32 | * @reg_init_data: The regulator init data. | ||
33 | * @internal_pd_enable: internal pull down enable or not. | ||
34 | * @vsel: Select the voltage id register. | ||
35 | * @init_uV: initial micro volts which need to be set. | ||
36 | * @init_enable: Enable or do not enable the rails during initialization. | ||
37 | * @init_apply: Init parameter applied or not. | ||
38 | * @is_force_pwm: Enable force pwm or not. If not then PFM mode configuration | ||
39 | * will be used. | ||
40 | * @enable_discharge: Enable discharge the output capacitor via a typ. 300Ohm | ||
41 | * path | ||
42 | */ | ||
43 | |||
44 | struct tps6236x_regulator_platform_data { | ||
45 | struct regulator_init_data reg_init_data; | ||
46 | int internal_pd_enable; | ||
47 | int vsel; | ||
48 | int init_uV; | ||
49 | unsigned init_apply:1; | ||
50 | bool is_force_pwm; | ||
51 | bool enable_discharge; | ||
52 | }; | ||
53 | |||
54 | #endif /* __REGULATOR_TPS6236X_H */ | ||
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h new file mode 100644 index 00000000000..341d53ec994 --- /dev/null +++ b/include/linux/regulator/tps65090-regulator.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * include/linux/regulator/tps65090-regulator.h | ||
3 | * | ||
4 | * Interface for regulator driver for TI TPS65090 PMIC family | ||
5 | * | ||
6 | * Copyright (C) 2012 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __REGULATOR_TPS65090_H | ||
25 | #define __REGULATOR_TPS65090_H | ||
26 | |||
27 | #include <linux/regulator/machine.h> | ||
28 | |||
29 | #define tps65090_rails(_name) "tps65090_"#_name | ||
30 | |||
31 | enum { | ||
32 | TPS65090_ID_DCDC1, | ||
33 | TPS65090_ID_DCDC2, | ||
34 | TPS65090_ID_DCDC3, | ||
35 | TPS65090_ID_FET1, | ||
36 | TPS65090_ID_FET2, | ||
37 | TPS65090_ID_FET3, | ||
38 | TPS65090_ID_FET4, | ||
39 | TPS65090_ID_FET5, | ||
40 | TPS65090_ID_FET6, | ||
41 | TPS65090_ID_FET7, | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * struct tps65090_regulator_platform_data | ||
46 | * | ||
47 | * @regulator: The regulator init data. | ||
48 | * @init_uV: initial micro volts which need to be set. | ||
49 | * @init_enable: Enable or do not enable the rails during initialization. | ||
50 | * @init_apply: Init parameter applied or not. | ||
51 | * @slew_rate_uV_per_us: Slew rate microvolt per microsec. | ||
52 | */ | ||
53 | |||
54 | struct tps65090_regulator_platform_data { | ||
55 | struct regulator_init_data regulator; | ||
56 | int slew_rate_uV_per_us; | ||
57 | unsigned int flags; | ||
58 | }; | ||
59 | |||
60 | #endif /* __REGULATOR_TPS65090_H */ | ||
diff --git a/include/linux/regulator/tps6591x-regulator.h b/include/linux/regulator/tps6591x-regulator.h new file mode 100644 index 00000000000..7f7f647906d --- /dev/null +++ b/include/linux/regulator/tps6591x-regulator.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * include/linux/regulator/tps6591x-regulator.h | ||
3 | * | ||
4 | * Interface for regulator driver for TI TPS6591x PMIC family | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __REGULATOR_TPS6591X_H | ||
25 | #define __REGULATOR_TPS6591X_H | ||
26 | |||
27 | #include <linux/regulator/machine.h> | ||
28 | |||
29 | #define tps6591x_rails(_name) "tps6591x_"#_name | ||
30 | |||
31 | enum { | ||
32 | TPS6591X_ID_VIO, | ||
33 | TPS6591X_ID_VDD_1, | ||
34 | TPS6591X_ID_VDD_2, | ||
35 | TPS6591X_ID_VDDCTRL, | ||
36 | TPS6591X_ID_LDO_1, | ||
37 | TPS6591X_ID_LDO_2, | ||
38 | TPS6591X_ID_LDO_3, | ||
39 | TPS6591X_ID_LDO_4, | ||
40 | TPS6591X_ID_LDO_5, | ||
41 | TPS6591X_ID_LDO_6, | ||
42 | TPS6591X_ID_LDO_7, | ||
43 | TPS6591X_ID_LDO_8, | ||
44 | }; | ||
45 | |||
46 | enum tps6591x_ext_control { | ||
47 | EXT_CTRL_NONE = 0x0, | ||
48 | EXT_CTRL_EN1, | ||
49 | EXT_CTRL_EN2, | ||
50 | EXT_CTRL_SLEEP_OFF, | ||
51 | }; | ||
52 | |||
53 | enum tps6591x_config_flags { | ||
54 | LDO_LOW_POWER_ON_SUSPEND = 0x1, | ||
55 | }; | ||
56 | |||
57 | /* | ||
58 | * struct tps6591x_regulator_platform_data - tps6591x regulator platform data. | ||
59 | * | ||
60 | * @regulator: The regulator init data. | ||
61 | * @init_uV: initial micro volts which need to be set. | ||
62 | * @init_enable: Enable or do not enable the rails during initialization. | ||
63 | * @init_apply: Init parameter applied or not. | ||
64 | * @slew_rate_uV_per_us: Slew rate microvolt per microsec. | ||
65 | */ | ||
66 | |||
67 | struct tps6591x_regulator_platform_data { | ||
68 | struct regulator_init_data regulator; | ||
69 | int init_uV; | ||
70 | unsigned init_enable:1; | ||
71 | unsigned init_apply:1; | ||
72 | enum tps6591x_ext_control ectrl; | ||
73 | int slew_rate_uV_per_us; | ||
74 | unsigned int flags; | ||
75 | }; | ||
76 | |||
77 | #endif /* __REGULATOR_TPS6591X_H */ | ||
diff --git a/include/linux/regulator/tps80031-regulator.h b/include/linux/regulator/tps80031-regulator.h new file mode 100644 index 00000000000..1670d147fc3 --- /dev/null +++ b/include/linux/regulator/tps80031-regulator.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * include/linux/regulator/tps80031-regulator.h | ||
3 | * | ||
4 | * Interface for regulator driver for TI TPS80031 | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __REGULATOR_TPS80031_H | ||
25 | #define __REGULATOR_TPS80031_H | ||
26 | |||
27 | #include <linux/regulator/machine.h> | ||
28 | |||
29 | #define tps80031_rails(_name) "tps80031_"#_name | ||
30 | |||
31 | enum { | ||
32 | TPS80031_ID_VIO, | ||
33 | TPS80031_ID_SMPS1, | ||
34 | TPS80031_ID_SMPS2, | ||
35 | TPS80031_ID_SMPS3, | ||
36 | TPS80031_ID_SMPS4, | ||
37 | TPS80031_ID_VANA, | ||
38 | TPS80031_ID_LDO1, | ||
39 | TPS80031_ID_LDO2, | ||
40 | TPS80031_ID_LDO3, | ||
41 | TPS80031_ID_LDO4, | ||
42 | TPS80031_ID_LDO5, | ||
43 | TPS80031_ID_LDO6, | ||
44 | TPS80031_ID_LDO7, | ||
45 | TPS80031_ID_LDOLN, | ||
46 | TPS80031_ID_LDOUSB, | ||
47 | TPS80031_ID_VBUS, | ||
48 | TPS80031_ID_CHARGER, | ||
49 | }; | ||
50 | |||
51 | |||
52 | enum { | ||
53 | /* USBLDO input selection */ | ||
54 | USBLDO_INPUT_VSYS = 0x00000001, | ||
55 | USBLDO_INPUT_PMID = 0x00000002, | ||
56 | |||
57 | /* LDO3 output mode */ | ||
58 | LDO3_OUTPUT_VIB = 0x00000004, | ||
59 | |||
60 | /* VBUS configuration */ | ||
61 | VBUS_DISCHRG_EN_PDN = 0x00000004, | ||
62 | VBUS_SW_ONLY = 0x00000008, | ||
63 | VBUS_SW_N_ID = 0x00000010, | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | * struct tps80031_regulator_platform_data - tps80031 regulator platform data. | ||
68 | * | ||
69 | * @regulator: The regulator init data. | ||
70 | * @init_uV: initial micro volts which need to be set. | ||
71 | * @init_enable: Enable or do not enable the rails during initialization. | ||
72 | * @init_apply: Init parameter applied or not. | ||
73 | * @ext_ctrl_flag: External control flag for sleep/power request control. | ||
74 | * @flags: Configuration flag to configure the rails. It should be ORed of | ||
75 | * above enums. | ||
76 | * @delay_us: Delay in microsecond after setting the desired voltage. | ||
77 | */ | ||
78 | |||
79 | struct tps80031_regulator_platform_data { | ||
80 | struct regulator_init_data regulator; | ||
81 | int init_uV; | ||
82 | unsigned init_enable:1; | ||
83 | unsigned init_apply:1; | ||
84 | unsigned int ext_ctrl_flag; | ||
85 | unsigned int flags; | ||
86 | int delay_us; | ||
87 | }; | ||
88 | |||
89 | #endif /* __REGULATOR_TPS80031_H */ | ||
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h new file mode 100644 index 00000000000..f096b80e73d --- /dev/null +++ b/include/linux/reiserfs_acl.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/posix_acl.h> | ||
3 | |||
4 | #define REISERFS_ACL_VERSION 0x0001 | ||
5 | |||
6 | typedef struct { | ||
7 | __le16 e_tag; | ||
8 | __le16 e_perm; | ||
9 | __le32 e_id; | ||
10 | } reiserfs_acl_entry; | ||
11 | |||
12 | typedef struct { | ||
13 | __le16 e_tag; | ||
14 | __le16 e_perm; | ||
15 | } reiserfs_acl_entry_short; | ||
16 | |||
17 | typedef struct { | ||
18 | __le32 a_version; | ||
19 | } reiserfs_acl_header; | ||
20 | |||
21 | static inline size_t reiserfs_acl_size(int count) | ||
22 | { | ||
23 | if (count <= 4) { | ||
24 | return sizeof(reiserfs_acl_header) + | ||
25 | count * sizeof(reiserfs_acl_entry_short); | ||
26 | } else { | ||
27 | return sizeof(reiserfs_acl_header) + | ||
28 | 4 * sizeof(reiserfs_acl_entry_short) + | ||
29 | (count - 4) * sizeof(reiserfs_acl_entry); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | static inline int reiserfs_acl_count(size_t size) | ||
34 | { | ||
35 | ssize_t s; | ||
36 | size -= sizeof(reiserfs_acl_header); | ||
37 | s = size - 4 * sizeof(reiserfs_acl_entry_short); | ||
38 | if (s < 0) { | ||
39 | if (size % sizeof(reiserfs_acl_entry_short)) | ||
40 | return -1; | ||
41 | return size / sizeof(reiserfs_acl_entry_short); | ||
42 | } else { | ||
43 | if (s % sizeof(reiserfs_acl_entry)) | ||
44 | return -1; | ||
45 | return s / sizeof(reiserfs_acl_entry) + 4; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | ||
50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); | ||
51 | int reiserfs_acl_chmod(struct inode *inode); | ||
52 | int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | ||
53 | struct inode *dir, struct dentry *dentry, | ||
54 | struct inode *inode); | ||
55 | int reiserfs_cache_default_acl(struct inode *dir); | ||
56 | extern const struct xattr_handler reiserfs_posix_acl_default_handler; | ||
57 | extern const struct xattr_handler reiserfs_posix_acl_access_handler; | ||
58 | |||
59 | #else | ||
60 | |||
61 | #define reiserfs_cache_default_acl(inode) 0 | ||
62 | #define reiserfs_get_acl NULL | ||
63 | |||
64 | static inline int reiserfs_acl_chmod(struct inode *inode) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static inline int | ||
70 | reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | ||
71 | const struct inode *dir, struct dentry *dentry, | ||
72 | struct inode *inode) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h new file mode 100644 index 00000000000..96d465f8d3e --- /dev/null +++ b/include/linux/reiserfs_fs.h | |||
@@ -0,0 +1,2359 @@ | |||
1 | /* | ||
2 | * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details | ||
3 | */ | ||
4 | |||
5 | /* this file has an amazingly stupid | ||
6 | name, yura please fix it to be | ||
7 | reiserfs.h, and merge all the rest | ||
8 | of our .h files that are in this | ||
9 | directory into it. */ | ||
10 | |||
11 | #ifndef _LINUX_REISER_FS_H | ||
12 | #define _LINUX_REISER_FS_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/magic.h> | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/sched.h> | ||
21 | #include <linux/workqueue.h> | ||
22 | #include <asm/unaligned.h> | ||
23 | #include <linux/bitops.h> | ||
24 | #include <linux/proc_fs.h> | ||
25 | #include <linux/buffer_head.h> | ||
26 | #include <linux/reiserfs_fs_i.h> | ||
27 | #include <linux/reiserfs_fs_sb.h> | ||
28 | #endif | ||
29 | |||
30 | /* | ||
31 | * include/linux/reiser_fs.h | ||
32 | * | ||
33 | * Reiser File System constants and structures | ||
34 | * | ||
35 | */ | ||
36 | |||
37 | /* ioctl's command */ | ||
38 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) | ||
39 | /* define following flags to be the same as in ext2, so that chattr(1), | ||
40 | lsattr(1) will work with us. */ | ||
41 | #define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
42 | #define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
43 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION | ||
44 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION | ||
45 | |||
46 | #ifdef __KERNEL__ | ||
47 | /* the 32 bit compat definitions with int argument */ | ||
48 | #define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int) | ||
49 | #define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
50 | #define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
51 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | ||
52 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | ||
53 | |||
54 | /* | ||
55 | * Locking primitives. The write lock is a per superblock | ||
56 | * special mutex that has properties close to the Big Kernel Lock | ||
57 | * which was used in the previous locking scheme. | ||
58 | */ | ||
59 | void reiserfs_write_lock(struct super_block *s); | ||
60 | void reiserfs_write_unlock(struct super_block *s); | ||
61 | int reiserfs_write_lock_once(struct super_block *s); | ||
62 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | ||
63 | |||
64 | #ifdef CONFIG_REISERFS_CHECK | ||
65 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
66 | #else | ||
67 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
68 | #endif | ||
69 | |||
70 | /* | ||
71 | * Several mutexes depend on the write lock. | ||
72 | * However sometimes we want to relax the write lock while we hold | ||
73 | * these mutexes, according to the release/reacquire on schedule() | ||
74 | * properties of the Bkl that were used. | ||
75 | * Reiserfs performances and locking were based on this scheme. | ||
76 | * Now that the write lock is a mutex and not the bkl anymore, doing so | ||
77 | * may result in a deadlock: | ||
78 | * | ||
79 | * A acquire write_lock | ||
80 | * A acquire j_commit_mutex | ||
81 | * A release write_lock and wait for something | ||
82 | * B acquire write_lock | ||
83 | * B can't acquire j_commit_mutex and sleep | ||
84 | * A can't acquire write lock anymore | ||
85 | * deadlock | ||
86 | * | ||
87 | * What we do here is avoiding such deadlock by playing the same game | ||
88 | * than the Bkl: if we can't acquire a mutex that depends on the write lock, | ||
89 | * we release the write lock, wait a bit and then retry. | ||
90 | * | ||
91 | * The mutexes concerned by this hack are: | ||
92 | * - The commit mutex of a journal list | ||
93 | * - The flush mutex | ||
94 | * - The journal lock | ||
95 | * - The inode mutex | ||
96 | */ | ||
97 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | ||
98 | struct super_block *s) | ||
99 | { | ||
100 | reiserfs_lock_check_recursive(s); | ||
101 | reiserfs_write_unlock(s); | ||
102 | mutex_lock(m); | ||
103 | reiserfs_write_lock(s); | ||
104 | } | ||
105 | |||
106 | static inline void | ||
107 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
108 | struct super_block *s) | ||
109 | { | ||
110 | reiserfs_lock_check_recursive(s); | ||
111 | reiserfs_write_unlock(s); | ||
112 | mutex_lock_nested(m, subclass); | ||
113 | reiserfs_write_lock(s); | ||
114 | } | ||
115 | |||
116 | static inline void | ||
117 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
118 | { | ||
119 | reiserfs_lock_check_recursive(s); | ||
120 | reiserfs_write_unlock(s); | ||
121 | down_read(sem); | ||
122 | reiserfs_write_lock(s); | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * When we schedule, we usually want to also release the write lock, | ||
127 | * according to the previous bkl based locking scheme of reiserfs. | ||
128 | */ | ||
129 | static inline void reiserfs_cond_resched(struct super_block *s) | ||
130 | { | ||
131 | if (need_resched()) { | ||
132 | reiserfs_write_unlock(s); | ||
133 | schedule(); | ||
134 | reiserfs_write_lock(s); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | struct fid; | ||
139 | |||
140 | /* in reading the #defines, it may help to understand that they employ | ||
141 | the following abbreviations: | ||
142 | |||
143 | B = Buffer | ||
144 | I = Item header | ||
145 | H = Height within the tree (should be changed to LEV) | ||
146 | N = Number of the item in the node | ||
147 | STAT = stat data | ||
148 | DEH = Directory Entry Header | ||
149 | EC = Entry Count | ||
150 | E = Entry number | ||
151 | UL = Unsigned Long | ||
152 | BLKH = BLocK Header | ||
153 | UNFM = UNForMatted node | ||
154 | DC = Disk Child | ||
155 | P = Path | ||
156 | |||
157 | These #defines are named by concatenating these abbreviations, | ||
158 | where first comes the arguments, and last comes the return value, | ||
159 | of the macro. | ||
160 | |||
161 | */ | ||
162 | |||
163 | #define USE_INODE_GENERATION_COUNTER | ||
164 | |||
165 | #define REISERFS_PREALLOCATE | ||
166 | #define DISPLACE_NEW_PACKING_LOCALITIES | ||
167 | #define PREALLOCATION_SIZE 9 | ||
168 | |||
169 | /* n must be power of 2 */ | ||
170 | #define _ROUND_UP(x,n) (((x)+(n)-1u) & ~((n)-1u)) | ||
171 | |||
172 | // to be ok for alpha and others we have to align structures to 8 byte | ||
173 | // boundary. | ||
174 | // FIXME: do not change 4 by anything else: there is code which relies on that | ||
175 | #define ROUND_UP(x) _ROUND_UP(x,8LL) | ||
176 | |||
177 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug | ||
178 | ** messages. | ||
179 | */ | ||
180 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ | ||
181 | |||
182 | void __reiserfs_warning(struct super_block *s, const char *id, | ||
183 | const char *func, const char *fmt, ...); | ||
184 | #define reiserfs_warning(s, id, fmt, args...) \ | ||
185 | __reiserfs_warning(s, id, __func__, fmt, ##args) | ||
186 | /* assertions handling */ | ||
187 | |||
188 | /** always check a condition and panic if it's false. */ | ||
189 | #define __RASSERT(cond, scond, format, args...) \ | ||
190 | do { \ | ||
191 | if (!(cond)) \ | ||
192 | reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \ | ||
193 | __FILE__ ":%i:%s: " format "\n", \ | ||
194 | in_interrupt() ? -1 : task_pid_nr(current), \ | ||
195 | __LINE__, __func__ , ##args); \ | ||
196 | } while (0) | ||
197 | |||
198 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) | ||
199 | |||
200 | #if defined( CONFIG_REISERFS_CHECK ) | ||
201 | #define RFALSE(cond, format, args...) __RASSERT(!(cond), "!(" #cond ")", format, ##args) | ||
202 | #else | ||
203 | #define RFALSE( cond, format, args... ) do {;} while( 0 ) | ||
204 | #endif | ||
205 | |||
206 | #define CONSTF __attribute_const__ | ||
207 | /* | ||
208 | * Disk Data Structures | ||
209 | */ | ||
210 | |||
211 | /***************************************************************************/ | ||
212 | /* SUPER BLOCK */ | ||
213 | /***************************************************************************/ | ||
214 | |||
215 | /* | ||
216 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs | ||
217 | * the version in RAM is part of a larger structure containing fields never written to disk. | ||
218 | */ | ||
219 | #define UNSET_HASH 0 // read_super will guess about, what hash names | ||
220 | // in directories were sorted with | ||
221 | #define TEA_HASH 1 | ||
222 | #define YURA_HASH 2 | ||
223 | #define R5_HASH 3 | ||
224 | #define DEFAULT_HASH R5_HASH | ||
225 | |||
226 | struct journal_params { | ||
227 | __le32 jp_journal_1st_block; /* where does journal start from on its | ||
228 | * device */ | ||
229 | __le32 jp_journal_dev; /* journal device st_rdev */ | ||
230 | __le32 jp_journal_size; /* size of the journal */ | ||
231 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ | ||
232 | __le32 jp_journal_magic; /* random value made on fs creation (this | ||
233 | * was sb_journal_block_count) */ | ||
234 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a | ||
235 | * trans */ | ||
236 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async | ||
237 | * commit be */ | ||
238 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction | ||
239 | * be */ | ||
240 | }; | ||
241 | |||
242 | /* this is the super from 3.5.X, where X >= 10 */ | ||
243 | struct reiserfs_super_block_v1 { | ||
244 | __le32 s_block_count; /* blocks count */ | ||
245 | __le32 s_free_blocks; /* free blocks count */ | ||
246 | __le32 s_root_block; /* root block number */ | ||
247 | struct journal_params s_journal; | ||
248 | __le16 s_blocksize; /* block size */ | ||
249 | __le16 s_oid_maxsize; /* max size of object id array, see | ||
250 | * get_objectid() commentary */ | ||
251 | __le16 s_oid_cursize; /* current size of object id array */ | ||
252 | __le16 s_umount_state; /* this is set to 1 when filesystem was | ||
253 | * umounted, to 2 - when not */ | ||
254 | char s_magic[10]; /* reiserfs magic string indicates that | ||
255 | * file system is reiserfs: | ||
256 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ | ||
257 | __le16 s_fs_state; /* it is set to used by fsck to mark which | ||
258 | * phase of rebuilding is done */ | ||
259 | __le32 s_hash_function_code; /* indicate, what hash function is being use | ||
260 | * to sort names in a directory*/ | ||
261 | __le16 s_tree_height; /* height of disk tree */ | ||
262 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address | ||
263 | * each block of file system */ | ||
264 | __le16 s_version; /* this field is only reliable on filesystem | ||
265 | * with non-standard journal */ | ||
266 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main | ||
267 | * device, we need to keep after | ||
268 | * making fs with non-standard journal */ | ||
269 | } __attribute__ ((__packed__)); | ||
270 | |||
271 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) | ||
272 | |||
273 | /* this is the on disk super block */ | ||
274 | struct reiserfs_super_block { | ||
275 | struct reiserfs_super_block_v1 s_v1; | ||
276 | __le32 s_inode_generation; | ||
277 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ | ||
278 | unsigned char s_uuid[16]; /* filesystem unique identifier */ | ||
279 | unsigned char s_label[16]; /* filesystem volume label */ | ||
280 | __le16 s_mnt_count; /* Count of mounts since last fsck */ | ||
281 | __le16 s_max_mnt_count; /* Maximum mounts before check */ | ||
282 | __le32 s_lastcheck; /* Timestamp of last fsck */ | ||
283 | __le32 s_check_interval; /* Interval between checks */ | ||
284 | char s_unused[76]; /* zero filled by mkreiserfs and | ||
285 | * reiserfs_convert_objectid_map_v1() | ||
286 | * so any additions must be updated | ||
287 | * there as well. */ | ||
288 | } __attribute__ ((__packed__)); | ||
289 | |||
290 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) | ||
291 | |||
292 | #define REISERFS_VERSION_1 0 | ||
293 | #define REISERFS_VERSION_2 2 | ||
294 | |||
295 | // on-disk super block fields converted to cpu form | ||
296 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) | ||
297 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) | ||
298 | #define SB_BLOCKSIZE(s) \ | ||
299 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_blocksize)) | ||
300 | #define SB_BLOCK_COUNT(s) \ | ||
301 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_block_count)) | ||
302 | #define SB_FREE_BLOCKS(s) \ | ||
303 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks)) | ||
304 | #define SB_REISERFS_MAGIC(s) \ | ||
305 | (SB_V1_DISK_SUPER_BLOCK(s)->s_magic) | ||
306 | #define SB_ROOT_BLOCK(s) \ | ||
307 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_root_block)) | ||
308 | #define SB_TREE_HEIGHT(s) \ | ||
309 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height)) | ||
310 | #define SB_REISERFS_STATE(s) \ | ||
311 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state)) | ||
312 | #define SB_VERSION(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_version)) | ||
313 | #define SB_BMAP_NR(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr)) | ||
314 | |||
315 | #define PUT_SB_BLOCK_COUNT(s, val) \ | ||
316 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_block_count = cpu_to_le32(val); } while (0) | ||
317 | #define PUT_SB_FREE_BLOCKS(s, val) \ | ||
318 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks = cpu_to_le32(val); } while (0) | ||
319 | #define PUT_SB_ROOT_BLOCK(s, val) \ | ||
320 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_root_block = cpu_to_le32(val); } while (0) | ||
321 | #define PUT_SB_TREE_HEIGHT(s, val) \ | ||
322 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) | ||
323 | #define PUT_SB_REISERFS_STATE(s, val) \ | ||
324 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) | ||
325 | #define PUT_SB_VERSION(s, val) \ | ||
326 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) | ||
327 | #define PUT_SB_BMAP_NR(s, val) \ | ||
328 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) | ||
329 | |||
330 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) | ||
331 | #define SB_ONDISK_JOURNAL_SIZE(s) \ | ||
332 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) | ||
333 | #define SB_ONDISK_JOURNAL_1st_BLOCK(s) \ | ||
334 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_1st_block)) | ||
335 | #define SB_ONDISK_JOURNAL_DEVICE(s) \ | ||
336 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev)) | ||
337 | #define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \ | ||
338 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal)) | ||
339 | |||
340 | #define is_block_in_log_or_reserved_area(s, block) \ | ||
341 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ | ||
342 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ | ||
343 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ | ||
344 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) | ||
345 | |||
346 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); | ||
347 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); | ||
348 | int is_reiserfs_jr(struct reiserfs_super_block *rs); | ||
349 | |||
350 | /* ReiserFS leaves the first 64k unused, so that partition labels have | ||
351 | enough space. If someone wants to write a fancy bootloader that | ||
352 | needs more than 64k, let us know, and this will be increased in size. | ||
353 | This number must be larger than than the largest block size on any | ||
354 | platform, or code will break. -Hans */ | ||
355 | #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) | ||
356 | #define REISERFS_FIRST_BLOCK unused_define | ||
357 | #define REISERFS_JOURNAL_OFFSET_IN_BYTES REISERFS_DISK_OFFSET_IN_BYTES | ||
358 | |||
359 | /* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ | ||
360 | #define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) | ||
361 | |||
362 | /* reiserfs internal error code (used by search_by_key and fix_nodes)) */ | ||
363 | #define CARRY_ON 0 | ||
364 | #define REPEAT_SEARCH -1 | ||
365 | #define IO_ERROR -2 | ||
366 | #define NO_DISK_SPACE -3 | ||
367 | #define NO_BALANCING_NEEDED (-4) | ||
368 | #define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5) | ||
369 | #define QUOTA_EXCEEDED -6 | ||
370 | |||
371 | typedef __u32 b_blocknr_t; | ||
372 | typedef __le32 unp_t; | ||
373 | |||
374 | struct unfm_nodeinfo { | ||
375 | unp_t unfm_nodenum; | ||
376 | unsigned short unfm_freespace; | ||
377 | }; | ||
378 | |||
379 | /* there are two formats of keys: 3.5 and 3.6 | ||
380 | */ | ||
381 | #define KEY_FORMAT_3_5 0 | ||
382 | #define KEY_FORMAT_3_6 1 | ||
383 | |||
384 | /* there are two stat datas */ | ||
385 | #define STAT_DATA_V1 0 | ||
386 | #define STAT_DATA_V2 1 | ||
387 | |||
388 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) | ||
389 | { | ||
390 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); | ||
391 | } | ||
392 | |||
393 | static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | ||
394 | { | ||
395 | return sb->s_fs_info; | ||
396 | } | ||
397 | |||
398 | /* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16 | ||
399 | * which overflows on large file systems. */ | ||
400 | static inline __u32 reiserfs_bmap_count(struct super_block *sb) | ||
401 | { | ||
402 | return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1; | ||
403 | } | ||
404 | |||
405 | static inline int bmap_would_wrap(unsigned bmap_nr) | ||
406 | { | ||
407 | return bmap_nr > ((1LL << 16) - 1); | ||
408 | } | ||
409 | |||
410 | /** this says about version of key of all items (but stat data) the | ||
411 | object consists of */ | ||
412 | #define get_inode_item_key_version( inode ) \ | ||
413 | ((REISERFS_I(inode)->i_flags & i_item_key_version_mask) ? KEY_FORMAT_3_6 : KEY_FORMAT_3_5) | ||
414 | |||
415 | #define set_inode_item_key_version( inode, version ) \ | ||
416 | ({ if((version)==KEY_FORMAT_3_6) \ | ||
417 | REISERFS_I(inode)->i_flags |= i_item_key_version_mask; \ | ||
418 | else \ | ||
419 | REISERFS_I(inode)->i_flags &= ~i_item_key_version_mask; }) | ||
420 | |||
421 | #define get_inode_sd_version(inode) \ | ||
422 | ((REISERFS_I(inode)->i_flags & i_stat_data_version_mask) ? STAT_DATA_V2 : STAT_DATA_V1) | ||
423 | |||
424 | #define set_inode_sd_version(inode, version) \ | ||
425 | ({ if((version)==STAT_DATA_V2) \ | ||
426 | REISERFS_I(inode)->i_flags |= i_stat_data_version_mask; \ | ||
427 | else \ | ||
428 | REISERFS_I(inode)->i_flags &= ~i_stat_data_version_mask; }) | ||
429 | |||
430 | /* This is an aggressive tail suppression policy, I am hoping it | ||
431 | improves our benchmarks. The principle behind it is that percentage | ||
432 | space saving is what matters, not absolute space saving. This is | ||
433 | non-intuitive, but it helps to understand it if you consider that the | ||
434 | cost to access 4 blocks is not much more than the cost to access 1 | ||
435 | block, if you have to do a seek and rotate. A tail risks a | ||
436 | non-linear disk access that is significant as a percentage of total | ||
437 | time cost for a 4 block file and saves an amount of space that is | ||
438 | less significant as a percentage of space, or so goes the hypothesis. | ||
439 | -Hans */ | ||
440 | #define STORE_TAIL_IN_UNFM_S1(n_file_size,n_tail_size,n_block_size) \ | ||
441 | (\ | ||
442 | (!(n_tail_size)) || \ | ||
443 | (((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \ | ||
444 | ( (n_file_size) >= (n_block_size) * 4 ) || \ | ||
445 | ( ( (n_file_size) >= (n_block_size) * 3 ) && \ | ||
446 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \ | ||
447 | ( ( (n_file_size) >= (n_block_size) * 2 ) && \ | ||
448 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \ | ||
449 | ( ( (n_file_size) >= (n_block_size) ) && \ | ||
450 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \ | ||
451 | ) | ||
452 | |||
453 | /* Another strategy for tails, this one means only create a tail if all the | ||
454 | file would fit into one DIRECT item. | ||
455 | Primary intention for this one is to increase performance by decreasing | ||
456 | seeking. | ||
457 | */ | ||
458 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ | ||
459 | (\ | ||
460 | (!(n_tail_size)) || \ | ||
461 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ | ||
462 | ) | ||
463 | |||
464 | /* | ||
465 | * values for s_umount_state field | ||
466 | */ | ||
467 | #define REISERFS_VALID_FS 1 | ||
468 | #define REISERFS_ERROR_FS 2 | ||
469 | |||
470 | // | ||
471 | // there are 5 item types currently | ||
472 | // | ||
473 | #define TYPE_STAT_DATA 0 | ||
474 | #define TYPE_INDIRECT 1 | ||
475 | #define TYPE_DIRECT 2 | ||
476 | #define TYPE_DIRENTRY 3 | ||
477 | #define TYPE_MAXTYPE 3 | ||
478 | #define TYPE_ANY 15 // FIXME: comment is required | ||
479 | |||
480 | /***************************************************************************/ | ||
481 | /* KEY & ITEM HEAD */ | ||
482 | /***************************************************************************/ | ||
483 | |||
484 | // | ||
485 | // directories use this key as well as old files | ||
486 | // | ||
487 | struct offset_v1 { | ||
488 | __le32 k_offset; | ||
489 | __le32 k_uniqueness; | ||
490 | } __attribute__ ((__packed__)); | ||
491 | |||
492 | struct offset_v2 { | ||
493 | __le64 v; | ||
494 | } __attribute__ ((__packed__)); | ||
495 | |||
496 | static inline __u16 offset_v2_k_type(const struct offset_v2 *v2) | ||
497 | { | ||
498 | __u8 type = le64_to_cpu(v2->v) >> 60; | ||
499 | return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY; | ||
500 | } | ||
501 | |||
502 | static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type) | ||
503 | { | ||
504 | v2->v = | ||
505 | (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60); | ||
506 | } | ||
507 | |||
508 | static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2) | ||
509 | { | ||
510 | return le64_to_cpu(v2->v) & (~0ULL >> 4); | ||
511 | } | ||
512 | |||
513 | static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset) | ||
514 | { | ||
515 | offset &= (~0ULL >> 4); | ||
516 | v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); | ||
517 | } | ||
518 | |||
519 | /* Key of an item determines its location in the S+tree, and | ||
520 | is composed of 4 components */ | ||
521 | struct reiserfs_key { | ||
522 | __le32 k_dir_id; /* packing locality: by default parent | ||
523 | directory object id */ | ||
524 | __le32 k_objectid; /* object identifier */ | ||
525 | union { | ||
526 | struct offset_v1 k_offset_v1; | ||
527 | struct offset_v2 k_offset_v2; | ||
528 | } __attribute__ ((__packed__)) u; | ||
529 | } __attribute__ ((__packed__)); | ||
530 | |||
531 | struct in_core_key { | ||
532 | __u32 k_dir_id; /* packing locality: by default parent | ||
533 | directory object id */ | ||
534 | __u32 k_objectid; /* object identifier */ | ||
535 | __u64 k_offset; | ||
536 | __u8 k_type; | ||
537 | }; | ||
538 | |||
539 | struct cpu_key { | ||
540 | struct in_core_key on_disk_key; | ||
541 | int version; | ||
542 | int key_length; /* 3 in all cases but direct2indirect and | ||
543 | indirect2direct conversion */ | ||
544 | }; | ||
545 | |||
546 | /* Our function for comparing keys can compare keys of different | ||
547 | lengths. It takes as a parameter the length of the keys it is to | ||
548 | compare. These defines are used in determining what is to be passed | ||
549 | to it as that parameter. */ | ||
550 | #define REISERFS_FULL_KEY_LEN 4 | ||
551 | #define REISERFS_SHORT_KEY_LEN 2 | ||
552 | |||
553 | /* The result of the key compare */ | ||
554 | #define FIRST_GREATER 1 | ||
555 | #define SECOND_GREATER -1 | ||
556 | #define KEYS_IDENTICAL 0 | ||
557 | #define KEY_FOUND 1 | ||
558 | #define KEY_NOT_FOUND 0 | ||
559 | |||
560 | #define KEY_SIZE (sizeof(struct reiserfs_key)) | ||
561 | #define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32)) | ||
562 | |||
563 | /* return values for search_by_key and clones */ | ||
564 | #define ITEM_FOUND 1 | ||
565 | #define ITEM_NOT_FOUND 0 | ||
566 | #define ENTRY_FOUND 1 | ||
567 | #define ENTRY_NOT_FOUND 0 | ||
568 | #define DIRECTORY_NOT_FOUND -1 | ||
569 | #define REGULAR_FILE_FOUND -2 | ||
570 | #define DIRECTORY_FOUND -3 | ||
571 | #define BYTE_FOUND 1 | ||
572 | #define BYTE_NOT_FOUND 0 | ||
573 | #define FILE_NOT_FOUND -1 | ||
574 | |||
575 | #define POSITION_FOUND 1 | ||
576 | #define POSITION_NOT_FOUND 0 | ||
577 | |||
578 | // return values for reiserfs_find_entry and search_by_entry_key | ||
579 | #define NAME_FOUND 1 | ||
580 | #define NAME_NOT_FOUND 0 | ||
581 | #define GOTO_PREVIOUS_ITEM 2 | ||
582 | #define NAME_FOUND_INVISIBLE 3 | ||
583 | |||
584 | /* Everything in the filesystem is stored as a set of items. The | ||
585 | item head contains the key of the item, its free space (for | ||
586 | indirect items) and specifies the location of the item itself | ||
587 | within the block. */ | ||
588 | |||
589 | struct item_head { | ||
590 | /* Everything in the tree is found by searching for it based on | ||
591 | * its key.*/ | ||
592 | struct reiserfs_key ih_key; | ||
593 | union { | ||
594 | /* The free space in the last unformatted node of an | ||
595 | indirect item if this is an indirect item. This | ||
596 | equals 0xFFFF iff this is a direct item or stat data | ||
597 | item. Note that the key, not this field, is used to | ||
598 | determine the item type, and thus which field this | ||
599 | union contains. */ | ||
600 | __le16 ih_free_space_reserved; | ||
601 | /* Iff this is a directory item, this field equals the | ||
602 | number of directory entries in the directory item. */ | ||
603 | __le16 ih_entry_count; | ||
604 | } __attribute__ ((__packed__)) u; | ||
605 | __le16 ih_item_len; /* total size of the item body */ | ||
606 | __le16 ih_item_location; /* an offset to the item body | ||
607 | * within the block */ | ||
608 | __le16 ih_version; /* 0 for all old items, 2 for new | ||
609 | ones. Highest bit is set by fsck | ||
610 | temporary, cleaned after all | ||
611 | done */ | ||
612 | } __attribute__ ((__packed__)); | ||
613 | /* size of item header */ | ||
614 | #define IH_SIZE (sizeof(struct item_head)) | ||
615 | |||
616 | #define ih_free_space(ih) le16_to_cpu((ih)->u.ih_free_space_reserved) | ||
617 | #define ih_version(ih) le16_to_cpu((ih)->ih_version) | ||
618 | #define ih_entry_count(ih) le16_to_cpu((ih)->u.ih_entry_count) | ||
619 | #define ih_location(ih) le16_to_cpu((ih)->ih_item_location) | ||
620 | #define ih_item_len(ih) le16_to_cpu((ih)->ih_item_len) | ||
621 | |||
622 | #define put_ih_free_space(ih, val) do { (ih)->u.ih_free_space_reserved = cpu_to_le16(val); } while(0) | ||
623 | #define put_ih_version(ih, val) do { (ih)->ih_version = cpu_to_le16(val); } while (0) | ||
624 | #define put_ih_entry_count(ih, val) do { (ih)->u.ih_entry_count = cpu_to_le16(val); } while (0) | ||
625 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) | ||
626 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) | ||
627 | |||
628 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) | ||
629 | |||
630 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) | ||
631 | #define set_ih_free_space(ih,val) put_ih_free_space((ih), ((ih_version(ih) == KEY_FORMAT_3_6) ? 0 : (val))) | ||
632 | |||
633 | /* these operate on indirect items, where you've got an array of ints | ||
634 | ** at a possibly unaligned location. These are a noop on ia32 | ||
635 | ** | ||
636 | ** p is the array of __u32, i is the index into the array, v is the value | ||
637 | ** to store there. | ||
638 | */ | ||
639 | #define get_block_num(p, i) get_unaligned_le32((p) + (i)) | ||
640 | #define put_block_num(p, i, v) put_unaligned_le32((v), (p) + (i)) | ||
641 | |||
642 | // | ||
643 | // in old version uniqueness field shows key type | ||
644 | // | ||
645 | #define V1_SD_UNIQUENESS 0 | ||
646 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe | ||
647 | #define V1_DIRECT_UNIQUENESS 0xffffffff | ||
648 | #define V1_DIRENTRY_UNIQUENESS 500 | ||
649 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required | ||
650 | |||
651 | // | ||
652 | // here are conversion routines | ||
653 | // | ||
654 | static inline int uniqueness2type(__u32 uniqueness) CONSTF; | ||
655 | static inline int uniqueness2type(__u32 uniqueness) | ||
656 | { | ||
657 | switch ((int)uniqueness) { | ||
658 | case V1_SD_UNIQUENESS: | ||
659 | return TYPE_STAT_DATA; | ||
660 | case V1_INDIRECT_UNIQUENESS: | ||
661 | return TYPE_INDIRECT; | ||
662 | case V1_DIRECT_UNIQUENESS: | ||
663 | return TYPE_DIRECT; | ||
664 | case V1_DIRENTRY_UNIQUENESS: | ||
665 | return TYPE_DIRENTRY; | ||
666 | case V1_ANY_UNIQUENESS: | ||
667 | default: | ||
668 | return TYPE_ANY; | ||
669 | } | ||
670 | } | ||
671 | |||
672 | static inline __u32 type2uniqueness(int type) CONSTF; | ||
673 | static inline __u32 type2uniqueness(int type) | ||
674 | { | ||
675 | switch (type) { | ||
676 | case TYPE_STAT_DATA: | ||
677 | return V1_SD_UNIQUENESS; | ||
678 | case TYPE_INDIRECT: | ||
679 | return V1_INDIRECT_UNIQUENESS; | ||
680 | case TYPE_DIRECT: | ||
681 | return V1_DIRECT_UNIQUENESS; | ||
682 | case TYPE_DIRENTRY: | ||
683 | return V1_DIRENTRY_UNIQUENESS; | ||
684 | case TYPE_ANY: | ||
685 | default: | ||
686 | return V1_ANY_UNIQUENESS; | ||
687 | } | ||
688 | } | ||
689 | |||
690 | // | ||
691 | // key is pointer to on disk key which is stored in le, result is cpu, | ||
692 | // there is no way to get version of object from key, so, provide | ||
693 | // version to these defines | ||
694 | // | ||
695 | static inline loff_t le_key_k_offset(int version, | ||
696 | const struct reiserfs_key *key) | ||
697 | { | ||
698 | return (version == KEY_FORMAT_3_5) ? | ||
699 | le32_to_cpu(key->u.k_offset_v1.k_offset) : | ||
700 | offset_v2_k_offset(&(key->u.k_offset_v2)); | ||
701 | } | ||
702 | |||
703 | static inline loff_t le_ih_k_offset(const struct item_head *ih) | ||
704 | { | ||
705 | return le_key_k_offset(ih_version(ih), &(ih->ih_key)); | ||
706 | } | ||
707 | |||
708 | static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key) | ||
709 | { | ||
710 | return (version == KEY_FORMAT_3_5) ? | ||
711 | uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) : | ||
712 | offset_v2_k_type(&(key->u.k_offset_v2)); | ||
713 | } | ||
714 | |||
715 | static inline loff_t le_ih_k_type(const struct item_head *ih) | ||
716 | { | ||
717 | return le_key_k_type(ih_version(ih), &(ih->ih_key)); | ||
718 | } | ||
719 | |||
720 | static inline void set_le_key_k_offset(int version, struct reiserfs_key *key, | ||
721 | loff_t offset) | ||
722 | { | ||
723 | (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */ | ||
724 | (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset)); | ||
725 | } | ||
726 | |||
727 | static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset) | ||
728 | { | ||
729 | set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset); | ||
730 | } | ||
731 | |||
732 | static inline void set_le_key_k_type(int version, struct reiserfs_key *key, | ||
733 | int type) | ||
734 | { | ||
735 | (version == KEY_FORMAT_3_5) ? | ||
736 | (void)(key->u.k_offset_v1.k_uniqueness = | ||
737 | cpu_to_le32(type2uniqueness(type))) | ||
738 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); | ||
739 | } | ||
740 | |||
741 | static inline void set_le_ih_k_type(struct item_head *ih, int type) | ||
742 | { | ||
743 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); | ||
744 | } | ||
745 | |||
746 | static inline int is_direntry_le_key(int version, struct reiserfs_key *key) | ||
747 | { | ||
748 | return le_key_k_type(version, key) == TYPE_DIRENTRY; | ||
749 | } | ||
750 | |||
751 | static inline int is_direct_le_key(int version, struct reiserfs_key *key) | ||
752 | { | ||
753 | return le_key_k_type(version, key) == TYPE_DIRECT; | ||
754 | } | ||
755 | |||
756 | static inline int is_indirect_le_key(int version, struct reiserfs_key *key) | ||
757 | { | ||
758 | return le_key_k_type(version, key) == TYPE_INDIRECT; | ||
759 | } | ||
760 | |||
761 | static inline int is_statdata_le_key(int version, struct reiserfs_key *key) | ||
762 | { | ||
763 | return le_key_k_type(version, key) == TYPE_STAT_DATA; | ||
764 | } | ||
765 | |||
766 | // | ||
767 | // item header has version. | ||
768 | // | ||
769 | static inline int is_direntry_le_ih(struct item_head *ih) | ||
770 | { | ||
771 | return is_direntry_le_key(ih_version(ih), &ih->ih_key); | ||
772 | } | ||
773 | |||
774 | static inline int is_direct_le_ih(struct item_head *ih) | ||
775 | { | ||
776 | return is_direct_le_key(ih_version(ih), &ih->ih_key); | ||
777 | } | ||
778 | |||
779 | static inline int is_indirect_le_ih(struct item_head *ih) | ||
780 | { | ||
781 | return is_indirect_le_key(ih_version(ih), &ih->ih_key); | ||
782 | } | ||
783 | |||
784 | static inline int is_statdata_le_ih(struct item_head *ih) | ||
785 | { | ||
786 | return is_statdata_le_key(ih_version(ih), &ih->ih_key); | ||
787 | } | ||
788 | |||
789 | // | ||
790 | // key is pointer to cpu key, result is cpu | ||
791 | // | ||
792 | static inline loff_t cpu_key_k_offset(const struct cpu_key *key) | ||
793 | { | ||
794 | return key->on_disk_key.k_offset; | ||
795 | } | ||
796 | |||
797 | static inline loff_t cpu_key_k_type(const struct cpu_key *key) | ||
798 | { | ||
799 | return key->on_disk_key.k_type; | ||
800 | } | ||
801 | |||
802 | static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset) | ||
803 | { | ||
804 | key->on_disk_key.k_offset = offset; | ||
805 | } | ||
806 | |||
807 | static inline void set_cpu_key_k_type(struct cpu_key *key, int type) | ||
808 | { | ||
809 | key->on_disk_key.k_type = type; | ||
810 | } | ||
811 | |||
812 | static inline void cpu_key_k_offset_dec(struct cpu_key *key) | ||
813 | { | ||
814 | key->on_disk_key.k_offset--; | ||
815 | } | ||
816 | |||
817 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) | ||
818 | #define is_direct_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRECT) | ||
819 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) | ||
820 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) | ||
821 | |||
822 | /* are these used ? */ | ||
823 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) | ||
824 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) | ||
825 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) | ||
826 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) | ||
827 | |||
828 | #define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \ | ||
829 | (!COMP_SHORT_KEYS(ih, key) && \ | ||
830 | I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize)) | ||
831 | |||
832 | /* maximal length of item */ | ||
833 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) | ||
834 | #define MIN_ITEM_LEN 1 | ||
835 | |||
836 | /* object identifier for root dir */ | ||
837 | #define REISERFS_ROOT_OBJECTID 2 | ||
838 | #define REISERFS_ROOT_PARENT_OBJECTID 1 | ||
839 | |||
840 | extern struct reiserfs_key root_key; | ||
841 | |||
842 | /* | ||
843 | * Picture represents a leaf of the S+tree | ||
844 | * ______________________________________________________ | ||
845 | * | | Array of | | | | ||
846 | * |Block | Object-Item | F r e e | Objects- | | ||
847 | * | head | Headers | S p a c e | Items | | ||
848 | * |______|_______________|___________________|___________| | ||
849 | */ | ||
850 | |||
851 | /* Header of a disk block. More precisely, header of a formatted leaf | ||
852 | or internal node, and not the header of an unformatted node. */ | ||
853 | struct block_head { | ||
854 | __le16 blk_level; /* Level of a block in the tree. */ | ||
855 | __le16 blk_nr_item; /* Number of keys/items in a block. */ | ||
856 | __le16 blk_free_space; /* Block free space in bytes. */ | ||
857 | __le16 blk_reserved; | ||
858 | /* dump this in v4/planA */ | ||
859 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ | ||
860 | }; | ||
861 | |||
862 | #define BLKH_SIZE (sizeof(struct block_head)) | ||
863 | #define blkh_level(p_blkh) (le16_to_cpu((p_blkh)->blk_level)) | ||
864 | #define blkh_nr_item(p_blkh) (le16_to_cpu((p_blkh)->blk_nr_item)) | ||
865 | #define blkh_free_space(p_blkh) (le16_to_cpu((p_blkh)->blk_free_space)) | ||
866 | #define blkh_reserved(p_blkh) (le16_to_cpu((p_blkh)->blk_reserved)) | ||
867 | #define set_blkh_level(p_blkh,val) ((p_blkh)->blk_level = cpu_to_le16(val)) | ||
868 | #define set_blkh_nr_item(p_blkh,val) ((p_blkh)->blk_nr_item = cpu_to_le16(val)) | ||
869 | #define set_blkh_free_space(p_blkh,val) ((p_blkh)->blk_free_space = cpu_to_le16(val)) | ||
870 | #define set_blkh_reserved(p_blkh,val) ((p_blkh)->blk_reserved = cpu_to_le16(val)) | ||
871 | #define blkh_right_delim_key(p_blkh) ((p_blkh)->blk_right_delim_key) | ||
872 | #define set_blkh_right_delim_key(p_blkh,val) ((p_blkh)->blk_right_delim_key = val) | ||
873 | |||
874 | /* | ||
875 | * values for blk_level field of the struct block_head | ||
876 | */ | ||
877 | |||
878 | #define FREE_LEVEL 0 /* when node gets removed from the tree its | ||
879 | blk_level is set to FREE_LEVEL. It is then | ||
880 | used to see whether the node is still in the | ||
881 | tree */ | ||
882 | |||
883 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ | ||
884 | |||
885 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ | ||
886 | #define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data)) | ||
887 | /* Number of items that are in buffer. */ | ||
888 | #define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh))) | ||
889 | #define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh))) | ||
890 | #define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh))) | ||
891 | |||
892 | #define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0) | ||
893 | #define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0) | ||
894 | #define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0) | ||
895 | |||
896 | /* Get right delimiting key. -- little endian */ | ||
897 | #define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh)))) | ||
898 | |||
899 | /* Does the buffer contain a disk leaf. */ | ||
900 | #define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL) | ||
901 | |||
902 | /* Does the buffer contain a disk internal node */ | ||
903 | #define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \ | ||
904 | && B_LEVEL(bh) <= MAX_HEIGHT) | ||
905 | |||
906 | /***************************************************************************/ | ||
907 | /* STAT DATA */ | ||
908 | /***************************************************************************/ | ||
909 | |||
910 | // | ||
911 | // old stat data is 32 bytes long. We are going to distinguish new one by | ||
912 | // different size | ||
913 | // | ||
914 | struct stat_data_v1 { | ||
915 | __le16 sd_mode; /* file type, permissions */ | ||
916 | __le16 sd_nlink; /* number of hard links */ | ||
917 | __le16 sd_uid; /* owner */ | ||
918 | __le16 sd_gid; /* group */ | ||
919 | __le32 sd_size; /* file size */ | ||
920 | __le32 sd_atime; /* time of last access */ | ||
921 | __le32 sd_mtime; /* time file was last modified */ | ||
922 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | ||
923 | union { | ||
924 | __le32 sd_rdev; | ||
925 | __le32 sd_blocks; /* number of blocks file uses */ | ||
926 | } __attribute__ ((__packed__)) u; | ||
927 | __le32 sd_first_direct_byte; /* first byte of file which is stored | ||
928 | in a direct item: except that if it | ||
929 | equals 1 it is a symlink and if it | ||
930 | equals ~(__u32)0 there is no | ||
931 | direct item. The existence of this | ||
932 | field really grates on me. Let's | ||
933 | replace it with a macro based on | ||
934 | sd_size and our tail suppression | ||
935 | policy. Someday. -Hans */ | ||
936 | } __attribute__ ((__packed__)); | ||
937 | |||
938 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) | ||
939 | #define stat_data_v1(ih) (ih_version (ih) == KEY_FORMAT_3_5) | ||
940 | #define sd_v1_mode(sdp) (le16_to_cpu((sdp)->sd_mode)) | ||
941 | #define set_sd_v1_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v)) | ||
942 | #define sd_v1_nlink(sdp) (le16_to_cpu((sdp)->sd_nlink)) | ||
943 | #define set_sd_v1_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le16(v)) | ||
944 | #define sd_v1_uid(sdp) (le16_to_cpu((sdp)->sd_uid)) | ||
945 | #define set_sd_v1_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le16(v)) | ||
946 | #define sd_v1_gid(sdp) (le16_to_cpu((sdp)->sd_gid)) | ||
947 | #define set_sd_v1_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le16(v)) | ||
948 | #define sd_v1_size(sdp) (le32_to_cpu((sdp)->sd_size)) | ||
949 | #define set_sd_v1_size(sdp,v) ((sdp)->sd_size = cpu_to_le32(v)) | ||
950 | #define sd_v1_atime(sdp) (le32_to_cpu((sdp)->sd_atime)) | ||
951 | #define set_sd_v1_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v)) | ||
952 | #define sd_v1_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime)) | ||
953 | #define set_sd_v1_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v)) | ||
954 | #define sd_v1_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime)) | ||
955 | #define set_sd_v1_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v)) | ||
956 | #define sd_v1_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev)) | ||
957 | #define set_sd_v1_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) | ||
958 | #define sd_v1_blocks(sdp) (le32_to_cpu((sdp)->u.sd_blocks)) | ||
959 | #define set_sd_v1_blocks(sdp,v) ((sdp)->u.sd_blocks = cpu_to_le32(v)) | ||
960 | #define sd_v1_first_direct_byte(sdp) \ | ||
961 | (le32_to_cpu((sdp)->sd_first_direct_byte)) | ||
962 | #define set_sd_v1_first_direct_byte(sdp,v) \ | ||
963 | ((sdp)->sd_first_direct_byte = cpu_to_le32(v)) | ||
964 | |||
965 | /* inode flags stored in sd_attrs (nee sd_reserved) */ | ||
966 | |||
967 | /* we want common flags to have the same values as in ext2, | ||
968 | so chattr(1) will work without problems */ | ||
969 | #define REISERFS_IMMUTABLE_FL FS_IMMUTABLE_FL | ||
970 | #define REISERFS_APPEND_FL FS_APPEND_FL | ||
971 | #define REISERFS_SYNC_FL FS_SYNC_FL | ||
972 | #define REISERFS_NOATIME_FL FS_NOATIME_FL | ||
973 | #define REISERFS_NODUMP_FL FS_NODUMP_FL | ||
974 | #define REISERFS_SECRM_FL FS_SECRM_FL | ||
975 | #define REISERFS_UNRM_FL FS_UNRM_FL | ||
976 | #define REISERFS_COMPR_FL FS_COMPR_FL | ||
977 | #define REISERFS_NOTAIL_FL FS_NOTAIL_FL | ||
978 | |||
979 | /* persistent flags that file inherits from the parent directory */ | ||
980 | #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \ | ||
981 | REISERFS_SYNC_FL | \ | ||
982 | REISERFS_NOATIME_FL | \ | ||
983 | REISERFS_NODUMP_FL | \ | ||
984 | REISERFS_SECRM_FL | \ | ||
985 | REISERFS_COMPR_FL | \ | ||
986 | REISERFS_NOTAIL_FL ) | ||
987 | |||
988 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the | ||
989 | address blocks) */ | ||
990 | struct stat_data { | ||
991 | __le16 sd_mode; /* file type, permissions */ | ||
992 | __le16 sd_attrs; /* persistent inode flags */ | ||
993 | __le32 sd_nlink; /* number of hard links */ | ||
994 | __le64 sd_size; /* file size */ | ||
995 | __le32 sd_uid; /* owner */ | ||
996 | __le32 sd_gid; /* group */ | ||
997 | __le32 sd_atime; /* time of last access */ | ||
998 | __le32 sd_mtime; /* time file was last modified */ | ||
999 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | ||
1000 | __le32 sd_blocks; | ||
1001 | union { | ||
1002 | __le32 sd_rdev; | ||
1003 | __le32 sd_generation; | ||
1004 | //__le32 sd_first_direct_byte; | ||
1005 | /* first byte of file which is stored in a | ||
1006 | direct item: except that if it equals 1 | ||
1007 | it is a symlink and if it equals | ||
1008 | ~(__u32)0 there is no direct item. The | ||
1009 | existence of this field really grates | ||
1010 | on me. Let's replace it with a macro | ||
1011 | based on sd_size and our tail | ||
1012 | suppression policy? */ | ||
1013 | } __attribute__ ((__packed__)) u; | ||
1014 | } __attribute__ ((__packed__)); | ||
1015 | // | ||
1016 | // this is 44 bytes long | ||
1017 | // | ||
1018 | #define SD_SIZE (sizeof(struct stat_data)) | ||
1019 | #define SD_V2_SIZE SD_SIZE | ||
1020 | #define stat_data_v2(ih) (ih_version (ih) == KEY_FORMAT_3_6) | ||
1021 | #define sd_v2_mode(sdp) (le16_to_cpu((sdp)->sd_mode)) | ||
1022 | #define set_sd_v2_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v)) | ||
1023 | /* sd_reserved */ | ||
1024 | /* set_sd_reserved */ | ||
1025 | #define sd_v2_nlink(sdp) (le32_to_cpu((sdp)->sd_nlink)) | ||
1026 | #define set_sd_v2_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le32(v)) | ||
1027 | #define sd_v2_size(sdp) (le64_to_cpu((sdp)->sd_size)) | ||
1028 | #define set_sd_v2_size(sdp,v) ((sdp)->sd_size = cpu_to_le64(v)) | ||
1029 | #define sd_v2_uid(sdp) (le32_to_cpu((sdp)->sd_uid)) | ||
1030 | #define set_sd_v2_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le32(v)) | ||
1031 | #define sd_v2_gid(sdp) (le32_to_cpu((sdp)->sd_gid)) | ||
1032 | #define set_sd_v2_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le32(v)) | ||
1033 | #define sd_v2_atime(sdp) (le32_to_cpu((sdp)->sd_atime)) | ||
1034 | #define set_sd_v2_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v)) | ||
1035 | #define sd_v2_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime)) | ||
1036 | #define set_sd_v2_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v)) | ||
1037 | #define sd_v2_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime)) | ||
1038 | #define set_sd_v2_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v)) | ||
1039 | #define sd_v2_blocks(sdp) (le32_to_cpu((sdp)->sd_blocks)) | ||
1040 | #define set_sd_v2_blocks(sdp,v) ((sdp)->sd_blocks = cpu_to_le32(v)) | ||
1041 | #define sd_v2_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev)) | ||
1042 | #define set_sd_v2_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) | ||
1043 | #define sd_v2_generation(sdp) (le32_to_cpu((sdp)->u.sd_generation)) | ||
1044 | #define set_sd_v2_generation(sdp,v) ((sdp)->u.sd_generation = cpu_to_le32(v)) | ||
1045 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) | ||
1046 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) | ||
1047 | |||
1048 | /***************************************************************************/ | ||
1049 | /* DIRECTORY STRUCTURE */ | ||
1050 | /***************************************************************************/ | ||
1051 | /* | ||
1052 | Picture represents the structure of directory items | ||
1053 | ________________________________________________ | ||
1054 | | Array of | | | | | | | ||
1055 | | directory |N-1| N-2 | .... | 1st |0th| | ||
1056 | | entry headers | | | | | | | ||
1057 | |_______________|___|_____|________|_______|___| | ||
1058 | <---- directory entries ------> | ||
1059 | |||
1060 | First directory item has k_offset component 1. We store "." and ".." | ||
1061 | in one item, always, we never split "." and ".." into differing | ||
1062 | items. This makes, among other things, the code for removing | ||
1063 | directories simpler. */ | ||
1064 | #define SD_OFFSET 0 | ||
1065 | #define SD_UNIQUENESS 0 | ||
1066 | #define DOT_OFFSET 1 | ||
1067 | #define DOT_DOT_OFFSET 2 | ||
1068 | #define DIRENTRY_UNIQUENESS 500 | ||
1069 | |||
1070 | /* */ | ||
1071 | #define FIRST_ITEM_OFFSET 1 | ||
1072 | |||
1073 | /* | ||
1074 | Q: How to get key of object pointed to by entry from entry? | ||
1075 | |||
1076 | A: Each directory entry has its header. This header has deh_dir_id and deh_objectid fields, those are key | ||
1077 | of object, entry points to */ | ||
1078 | |||
1079 | /* NOT IMPLEMENTED: | ||
1080 | Directory will someday contain stat data of object */ | ||
1081 | |||
1082 | struct reiserfs_de_head { | ||
1083 | __le32 deh_offset; /* third component of the directory entry key */ | ||
1084 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced | ||
1085 | by directory entry */ | ||
1086 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ | ||
1087 | __le16 deh_location; /* offset of name in the whole item */ | ||
1088 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether | ||
1089 | entry is hidden (unlinked) */ | ||
1090 | } __attribute__ ((__packed__)); | ||
1091 | #define DEH_SIZE sizeof(struct reiserfs_de_head) | ||
1092 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) | ||
1093 | #define deh_dir_id(p_deh) (le32_to_cpu((p_deh)->deh_dir_id)) | ||
1094 | #define deh_objectid(p_deh) (le32_to_cpu((p_deh)->deh_objectid)) | ||
1095 | #define deh_location(p_deh) (le16_to_cpu((p_deh)->deh_location)) | ||
1096 | #define deh_state(p_deh) (le16_to_cpu((p_deh)->deh_state)) | ||
1097 | |||
1098 | #define put_deh_offset(p_deh,v) ((p_deh)->deh_offset = cpu_to_le32((v))) | ||
1099 | #define put_deh_dir_id(p_deh,v) ((p_deh)->deh_dir_id = cpu_to_le32((v))) | ||
1100 | #define put_deh_objectid(p_deh,v) ((p_deh)->deh_objectid = cpu_to_le32((v))) | ||
1101 | #define put_deh_location(p_deh,v) ((p_deh)->deh_location = cpu_to_le16((v))) | ||
1102 | #define put_deh_state(p_deh,v) ((p_deh)->deh_state = cpu_to_le16((v))) | ||
1103 | |||
1104 | /* empty directory contains two entries "." and ".." and their headers */ | ||
1105 | #define EMPTY_DIR_SIZE \ | ||
1106 | (DEH_SIZE * 2 + ROUND_UP (strlen (".")) + ROUND_UP (strlen (".."))) | ||
1107 | |||
1108 | /* old format directories have this size when empty */ | ||
1109 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) | ||
1110 | |||
1111 | #define DEH_Statdata 0 /* not used now */ | ||
1112 | #define DEH_Visible 2 | ||
1113 | |||
1114 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ | ||
1115 | #if BITS_PER_LONG == 64 || defined(__s390__) || defined(__hppa__) | ||
1116 | # define ADDR_UNALIGNED_BITS (3) | ||
1117 | #endif | ||
1118 | |||
1119 | /* These are only used to manipulate deh_state. | ||
1120 | * Because of this, we'll use the ext2_ bit routines, | ||
1121 | * since they are little endian */ | ||
1122 | #ifdef ADDR_UNALIGNED_BITS | ||
1123 | |||
1124 | # define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1))) | ||
1125 | # define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3) | ||
1126 | |||
1127 | # define set_bit_unaligned(nr, addr) \ | ||
1128 | __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
1129 | # define clear_bit_unaligned(nr, addr) \ | ||
1130 | __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
1131 | # define test_bit_unaligned(nr, addr) \ | ||
1132 | test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
1133 | |||
1134 | #else | ||
1135 | |||
1136 | # define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr) | ||
1137 | # define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr) | ||
1138 | # define test_bit_unaligned(nr, addr) test_bit_le(nr, addr) | ||
1139 | |||
1140 | #endif | ||
1141 | |||
1142 | #define mark_de_with_sd(deh) set_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
1143 | #define mark_de_without_sd(deh) clear_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
1144 | #define mark_de_visible(deh) set_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1145 | #define mark_de_hidden(deh) clear_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1146 | |||
1147 | #define de_with_sd(deh) test_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
1148 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1149 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
1150 | |||
1151 | extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, | ||
1152 | __le32 par_dirid, __le32 par_objid); | ||
1153 | extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, | ||
1154 | __le32 par_dirid, __le32 par_objid); | ||
1155 | |||
1156 | /* array of the entry headers */ | ||
1157 | /* get item body */ | ||
1158 | #define B_I_PITEM(bh,ih) ( (bh)->b_data + ih_location(ih) ) | ||
1159 | #define B_I_DEH(bh,ih) ((struct reiserfs_de_head *)(B_I_PITEM(bh,ih))) | ||
1160 | |||
1161 | /* length of the directory entry in directory item. This define | ||
1162 | calculates length of i-th directory entry using directory entry | ||
1163 | locations from dir entry head. When it calculates length of 0-th | ||
1164 | directory entry, it uses length of whole item in place of entry | ||
1165 | location of the non-existent following entry in the calculation. | ||
1166 | See picture above.*/ | ||
1167 | /* | ||
1168 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ | ||
1169 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) | ||
1170 | */ | ||
1171 | static inline int entry_length(const struct buffer_head *bh, | ||
1172 | const struct item_head *ih, int pos_in_item) | ||
1173 | { | ||
1174 | struct reiserfs_de_head *deh; | ||
1175 | |||
1176 | deh = B_I_DEH(bh, ih) + pos_in_item; | ||
1177 | if (pos_in_item) | ||
1178 | return deh_location(deh - 1) - deh_location(deh); | ||
1179 | |||
1180 | return ih_item_len(ih) - deh_location(deh); | ||
1181 | } | ||
1182 | |||
1183 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ | ||
1184 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) | ||
1185 | |||
1186 | /* name by bh, ih and entry_num */ | ||
1187 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) | ||
1188 | |||
1189 | // two entries per block (at least) | ||
1190 | #define REISERFS_MAX_NAME(block_size) 255 | ||
1191 | |||
1192 | /* this structure is used for operations on directory entries. It is | ||
1193 | not a disk structure. */ | ||
1194 | /* When reiserfs_find_entry or search_by_entry_key find directory | ||
1195 | entry, they return filled reiserfs_dir_entry structure */ | ||
1196 | struct reiserfs_dir_entry { | ||
1197 | struct buffer_head *de_bh; | ||
1198 | int de_item_num; | ||
1199 | struct item_head *de_ih; | ||
1200 | int de_entry_num; | ||
1201 | struct reiserfs_de_head *de_deh; | ||
1202 | int de_entrylen; | ||
1203 | int de_namelen; | ||
1204 | char *de_name; | ||
1205 | unsigned long *de_gen_number_bit_string; | ||
1206 | |||
1207 | __u32 de_dir_id; | ||
1208 | __u32 de_objectid; | ||
1209 | |||
1210 | struct cpu_key de_entry_key; | ||
1211 | }; | ||
1212 | |||
1213 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ | ||
1214 | |||
1215 | /* pointer to file name, stored in entry */ | ||
1216 | #define B_I_DEH_ENTRY_FILE_NAME(bh,ih,deh) (B_I_PITEM (bh, ih) + deh_location(deh)) | ||
1217 | |||
1218 | /* length of name */ | ||
1219 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ | ||
1220 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) | ||
1221 | |||
1222 | /* hash value occupies bits from 7 up to 30 */ | ||
1223 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) | ||
1224 | /* generation number occupies 7 bits starting from 0 up to 6 */ | ||
1225 | #define GET_GENERATION_NUMBER(offset) ((offset) & 0x7fLL) | ||
1226 | #define MAX_GENERATION_NUMBER 127 | ||
1227 | |||
1228 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) | ||
1229 | |||
1230 | /* | ||
1231 | * Picture represents an internal node of the reiserfs tree | ||
1232 | * ______________________________________________________ | ||
1233 | * | | Array of | Array of | Free | | ||
1234 | * |block | keys | pointers | space | | ||
1235 | * | head | N | N+1 | | | ||
1236 | * |______|_______________|___________________|___________| | ||
1237 | */ | ||
1238 | |||
1239 | /***************************************************************************/ | ||
1240 | /* DISK CHILD */ | ||
1241 | /***************************************************************************/ | ||
1242 | /* Disk child pointer: The pointer from an internal node of the tree | ||
1243 | to a node that is on disk. */ | ||
1244 | struct disk_child { | ||
1245 | __le32 dc_block_number; /* Disk child's block number. */ | ||
1246 | __le16 dc_size; /* Disk child's used space. */ | ||
1247 | __le16 dc_reserved; | ||
1248 | }; | ||
1249 | |||
1250 | #define DC_SIZE (sizeof(struct disk_child)) | ||
1251 | #define dc_block_number(dc_p) (le32_to_cpu((dc_p)->dc_block_number)) | ||
1252 | #define dc_size(dc_p) (le16_to_cpu((dc_p)->dc_size)) | ||
1253 | #define put_dc_block_number(dc_p, val) do { (dc_p)->dc_block_number = cpu_to_le32(val); } while(0) | ||
1254 | #define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) | ||
1255 | |||
1256 | /* Get disk child by buffer header and position in the tree node. */ | ||
1257 | #define B_N_CHILD(bh, n_pos) ((struct disk_child *)\ | ||
1258 | ((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos))) | ||
1259 | |||
1260 | /* Get disk child number by buffer header and position in the tree node. */ | ||
1261 | #define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos))) | ||
1262 | #define PUT_B_N_CHILD_NUM(bh, n_pos, val) \ | ||
1263 | (put_dc_block_number(B_N_CHILD(bh, n_pos), val)) | ||
1264 | |||
1265 | /* maximal value of field child_size in structure disk_child */ | ||
1266 | /* child size is the combined size of all items and their headers */ | ||
1267 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) | ||
1268 | |||
1269 | /* amount of used space in buffer (not including block head) */ | ||
1270 | #define B_CHILD_SIZE(cur) (MAX_CHILD_SIZE(cur)-(B_FREE_SPACE(cur))) | ||
1271 | |||
1272 | /* max and min number of keys in internal node */ | ||
1273 | #define MAX_NR_KEY(bh) ( (MAX_CHILD_SIZE(bh)-DC_SIZE)/(KEY_SIZE+DC_SIZE) ) | ||
1274 | #define MIN_NR_KEY(bh) (MAX_NR_KEY(bh)/2) | ||
1275 | |||
1276 | /***************************************************************************/ | ||
1277 | /* PATH STRUCTURES AND DEFINES */ | ||
1278 | /***************************************************************************/ | ||
1279 | |||
1280 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the | ||
1281 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it | ||
1282 | does not find them in the cache it reads them from disk. For each node search_by_key finds using | ||
1283 | reiserfs_bread it then uses bin_search to look through that node. bin_search will find the | ||
1284 | position of the block_number of the next node if it is looking through an internal node. If it | ||
1285 | is looking through a leaf node bin_search will find the position of the item which has key either | ||
1286 | equal to given key, or which is the maximal key less than the given key. */ | ||
1287 | |||
1288 | struct path_element { | ||
1289 | struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */ | ||
1290 | int pe_position; /* Position in the tree node which is placed in the */ | ||
1291 | /* buffer above. */ | ||
1292 | }; | ||
1293 | |||
1294 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ | ||
1295 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ | ||
1296 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ | ||
1297 | |||
1298 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
1299 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
1300 | |||
1301 | /* We need to keep track of who the ancestors of nodes are. When we | ||
1302 | perform a search we record which nodes were visited while | ||
1303 | descending the tree looking for the node we searched for. This list | ||
1304 | of nodes is called the path. This information is used while | ||
1305 | performing balancing. Note that this path information may become | ||
1306 | invalid, and this means we must check it when using it to see if it | ||
1307 | is still valid. You'll need to read search_by_key and the comments | ||
1308 | in it, especially about decrement_counters_in_path(), to understand | ||
1309 | this structure. | ||
1310 | |||
1311 | Paths make the code so much harder to work with and debug.... An | ||
1312 | enormous number of bugs are due to them, and trying to write or modify | ||
1313 | code that uses them just makes my head hurt. They are based on an | ||
1314 | excessive effort to avoid disturbing the precious VFS code.:-( The | ||
1315 | gods only know how we are going to SMP the code that uses them. | ||
1316 | znodes are the way! */ | ||
1317 | |||
1318 | #define PATH_READA 0x1 /* do read ahead */ | ||
1319 | #define PATH_READA_BACK 0x2 /* read backwards */ | ||
1320 | |||
1321 | struct treepath { | ||
1322 | int path_length; /* Length of the array above. */ | ||
1323 | int reada; | ||
1324 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ | ||
1325 | int pos_in_item; | ||
1326 | }; | ||
1327 | |||
1328 | #define pos_in_item(path) ((path)->pos_in_item) | ||
1329 | |||
1330 | #define INITIALIZE_PATH(var) \ | ||
1331 | struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | ||
1332 | |||
1333 | /* Get path element by path and path position. */ | ||
1334 | #define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset)) | ||
1335 | |||
1336 | /* Get buffer header at the path by path and path position. */ | ||
1337 | #define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer) | ||
1338 | |||
1339 | /* Get position in the element at the path by path and path position. */ | ||
1340 | #define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position) | ||
1341 | |||
1342 | #define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length)) | ||
1343 | /* you know, to the person who didn't | ||
1344 | write this the macro name does not | ||
1345 | at first suggest what it does. | ||
1346 | Maybe POSITION_FROM_PATH_END? Or | ||
1347 | maybe we should just focus on | ||
1348 | dumping paths... -Hans */ | ||
1349 | #define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length)) | ||
1350 | |||
1351 | #define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path)) | ||
1352 | |||
1353 | /* in do_balance leaf has h == 0 in contrast with path structure, | ||
1354 | where root has level == 0. That is why we need these defines */ | ||
1355 | #define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */ | ||
1356 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ | ||
1357 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) | ||
1358 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ | ||
1359 | |||
1360 | #define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h)) | ||
1361 | |||
1362 | #define get_last_bh(path) PATH_PLAST_BUFFER(path) | ||
1363 | #define get_ih(path) PATH_PITEM_HEAD(path) | ||
1364 | #define get_item_pos(path) PATH_LAST_POSITION(path) | ||
1365 | #define get_item(path) ((void *)B_N_PITEM(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION (path))) | ||
1366 | #define item_moved(ih,path) comp_items(ih, path) | ||
1367 | #define path_changed(ih,path) comp_items (ih, path) | ||
1368 | |||
1369 | /***************************************************************************/ | ||
1370 | /* MISC */ | ||
1371 | /***************************************************************************/ | ||
1372 | |||
1373 | /* Size of pointer to the unformatted node. */ | ||
1374 | #define UNFM_P_SIZE (sizeof(unp_t)) | ||
1375 | #define UNFM_P_SHIFT 2 | ||
1376 | |||
1377 | // in in-core inode key is stored on le form | ||
1378 | #define INODE_PKEY(inode) ((struct reiserfs_key *)(REISERFS_I(inode)->i_key)) | ||
1379 | |||
1380 | #define MAX_UL_INT 0xffffffff | ||
1381 | #define MAX_INT 0x7ffffff | ||
1382 | #define MAX_US_INT 0xffff | ||
1383 | |||
1384 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset | ||
1385 | #define U32_MAX (~(__u32)0) | ||
1386 | |||
1387 | static inline loff_t max_reiserfs_offset(struct inode *inode) | ||
1388 | { | ||
1389 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) | ||
1390 | return (loff_t) U32_MAX; | ||
1391 | |||
1392 | return (loff_t) ((~(__u64) 0) >> 4); | ||
1393 | } | ||
1394 | |||
1395 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ | ||
1396 | #define MAX_KEY_OBJECTID MAX_UL_INT | ||
1397 | |||
1398 | #define MAX_B_NUM MAX_UL_INT | ||
1399 | #define MAX_FC_NUM MAX_US_INT | ||
1400 | |||
1401 | /* the purpose is to detect overflow of an unsigned short */ | ||
1402 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) | ||
1403 | |||
1404 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ | ||
1405 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ | ||
1406 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ | ||
1407 | |||
1408 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) | ||
1409 | #define get_generation(s) atomic_read (&fs_generation(s)) | ||
1410 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) | ||
1411 | #define __fs_changed(gen,s) (gen != get_generation (s)) | ||
1412 | #define fs_changed(gen,s) \ | ||
1413 | ({ \ | ||
1414 | reiserfs_cond_resched(s); \ | ||
1415 | __fs_changed(gen, s); \ | ||
1416 | }) | ||
1417 | |||
1418 | /***************************************************************************/ | ||
1419 | /* FIXATE NODES */ | ||
1420 | /***************************************************************************/ | ||
1421 | |||
1422 | #define VI_TYPE_LEFT_MERGEABLE 1 | ||
1423 | #define VI_TYPE_RIGHT_MERGEABLE 2 | ||
1424 | |||
1425 | /* To make any changes in the tree we always first find node, that | ||
1426 | contains item to be changed/deleted or place to insert a new | ||
1427 | item. We call this node S. To do balancing we need to decide what | ||
1428 | we will shift to left/right neighbor, or to a new node, where new | ||
1429 | item will be etc. To make this analysis simpler we build virtual | ||
1430 | node. Virtual node is an array of items, that will replace items of | ||
1431 | node S. (For instance if we are going to delete an item, virtual | ||
1432 | node does not contain it). Virtual node keeps information about | ||
1433 | item sizes and types, mergeability of first and last items, sizes | ||
1434 | of all entries in directory item. We use this array of items when | ||
1435 | calculating what we can shift to neighbors and how many nodes we | ||
1436 | have to have if we do not any shiftings, if we shift to left/right | ||
1437 | neighbor or to both. */ | ||
1438 | struct virtual_item { | ||
1439 | int vi_index; // index in the array of item operations | ||
1440 | unsigned short vi_type; // left/right mergeability | ||
1441 | unsigned short vi_item_len; /* length of item that it will have after balancing */ | ||
1442 | struct item_head *vi_ih; | ||
1443 | const char *vi_item; // body of item (old or new) | ||
1444 | const void *vi_new_data; // 0 always but paste mode | ||
1445 | void *vi_uarea; // item specific area | ||
1446 | }; | ||
1447 | |||
1448 | struct virtual_node { | ||
1449 | char *vn_free_ptr; /* this is a pointer to the free space in the buffer */ | ||
1450 | unsigned short vn_nr_item; /* number of items in virtual node */ | ||
1451 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ | ||
1452 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ | ||
1453 | short vn_affected_item_num; | ||
1454 | short vn_pos_in_item; | ||
1455 | struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */ | ||
1456 | const void *vn_data; | ||
1457 | struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */ | ||
1458 | }; | ||
1459 | |||
1460 | /* used by directory items when creating virtual nodes */ | ||
1461 | struct direntry_uarea { | ||
1462 | int flags; | ||
1463 | __u16 entry_count; | ||
1464 | __u16 entry_sizes[1]; | ||
1465 | } __attribute__ ((__packed__)); | ||
1466 | |||
1467 | /***************************************************************************/ | ||
1468 | /* TREE BALANCE */ | ||
1469 | /***************************************************************************/ | ||
1470 | |||
1471 | /* This temporary structure is used in tree balance algorithms, and | ||
1472 | constructed as we go to the extent that its various parts are | ||
1473 | needed. It contains arrays of nodes that can potentially be | ||
1474 | involved in the balancing of node S, and parameters that define how | ||
1475 | each of the nodes must be balanced. Note that in these algorithms | ||
1476 | for balancing the worst case is to need to balance the current node | ||
1477 | S and the left and right neighbors and all of their parents plus | ||
1478 | create a new node. We implement S1 balancing for the leaf nodes | ||
1479 | and S0 balancing for the internal nodes (S1 and S0 are defined in | ||
1480 | our papers.)*/ | ||
1481 | |||
1482 | #define MAX_FREE_BLOCK 7 /* size of the array of buffers to free at end of do_balance */ | ||
1483 | |||
1484 | /* maximum number of FEB blocknrs on a single level */ | ||
1485 | #define MAX_AMOUNT_NEEDED 2 | ||
1486 | |||
1487 | /* someday somebody will prefix every field in this struct with tb_ */ | ||
1488 | struct tree_balance { | ||
1489 | int tb_mode; | ||
1490 | int need_balance_dirty; | ||
1491 | struct super_block *tb_sb; | ||
1492 | struct reiserfs_transaction_handle *transaction_handle; | ||
1493 | struct treepath *tb_path; | ||
1494 | struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ | ||
1495 | struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */ | ||
1496 | struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ | ||
1497 | struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ | ||
1498 | struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ | ||
1499 | struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ | ||
1500 | |||
1501 | struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | ||
1502 | cur_blknum. */ | ||
1503 | struct buffer_head *used[MAX_FEB_SIZE]; | ||
1504 | struct buffer_head *thrown[MAX_FEB_SIZE]; | ||
1505 | int lnum[MAX_HEIGHT]; /* array of number of items which must be | ||
1506 | shifted to the left in order to balance the | ||
1507 | current node; for leaves includes item that | ||
1508 | will be partially shifted; for internal | ||
1509 | nodes, it is the number of child pointers | ||
1510 | rather than items. It includes the new item | ||
1511 | being created. The code sometimes subtracts | ||
1512 | one to get the number of wholly shifted | ||
1513 | items for other purposes. */ | ||
1514 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ | ||
1515 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and | ||
1516 | S[h] to its item number within the node CFL[h] */ | ||
1517 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ | ||
1518 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from | ||
1519 | S[h]. A negative value means removing. */ | ||
1520 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after | ||
1521 | balancing on the level h of the tree. If 0 then S is | ||
1522 | being deleted, if 1 then S is remaining and no new nodes | ||
1523 | are being created, if 2 or 3 then 1 or 2 new nodes is | ||
1524 | being created */ | ||
1525 | |||
1526 | /* fields that are used only for balancing leaves of the tree */ | ||
1527 | int cur_blknum; /* number of empty blocks having been already allocated */ | ||
1528 | int s0num; /* number of items that fall into left most node when S[0] splits */ | ||
1529 | int s1num; /* number of items that fall into first new node when S[0] splits */ | ||
1530 | int s2num; /* number of items that fall into second new node when S[0] splits */ | ||
1531 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ | ||
1532 | /* most liquid item that cannot be shifted from S[0] entirely */ | ||
1533 | /* if -1 then nothing will be partially shifted */ | ||
1534 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ | ||
1535 | /* most liquid item that cannot be shifted from S[0] entirely */ | ||
1536 | /* if -1 then nothing will be partially shifted */ | ||
1537 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ | ||
1538 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ | ||
1539 | int s2bytes; | ||
1540 | struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ | ||
1541 | char *vn_buf; /* kmalloced memory. Used to create | ||
1542 | virtual node and keep map of | ||
1543 | dirtied bitmap blocks */ | ||
1544 | int vn_buf_size; /* size of the vn_buf */ | ||
1545 | struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */ | ||
1546 | |||
1547 | int fs_gen; /* saved value of `reiserfs_generation' counter | ||
1548 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ | ||
1549 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | ||
1550 | struct in_core_key key; /* key pointer, to pass to block allocator or | ||
1551 | another low-level subsystem */ | ||
1552 | #endif | ||
1553 | }; | ||
1554 | |||
1555 | /* These are modes of balancing */ | ||
1556 | |||
1557 | /* When inserting an item. */ | ||
1558 | #define M_INSERT 'i' | ||
1559 | /* When inserting into (directories only) or appending onto an already | ||
1560 | existent item. */ | ||
1561 | #define M_PASTE 'p' | ||
1562 | /* When deleting an item. */ | ||
1563 | #define M_DELETE 'd' | ||
1564 | /* When truncating an item or removing an entry from a (directory) item. */ | ||
1565 | #define M_CUT 'c' | ||
1566 | |||
1567 | /* used when balancing on leaf level skipped (in reiserfsck) */ | ||
1568 | #define M_INTERNAL 'n' | ||
1569 | |||
1570 | /* When further balancing is not needed, then do_balance does not need | ||
1571 | to be called. */ | ||
1572 | #define M_SKIP_BALANCING 's' | ||
1573 | #define M_CONVERT 'v' | ||
1574 | |||
1575 | /* modes of leaf_move_items */ | ||
1576 | #define LEAF_FROM_S_TO_L 0 | ||
1577 | #define LEAF_FROM_S_TO_R 1 | ||
1578 | #define LEAF_FROM_R_TO_L 2 | ||
1579 | #define LEAF_FROM_L_TO_R 3 | ||
1580 | #define LEAF_FROM_S_TO_SNEW 4 | ||
1581 | |||
1582 | #define FIRST_TO_LAST 0 | ||
1583 | #define LAST_TO_FIRST 1 | ||
1584 | |||
1585 | /* used in do_balance for passing parent of node information that has | ||
1586 | been gotten from tb struct */ | ||
1587 | struct buffer_info { | ||
1588 | struct tree_balance *tb; | ||
1589 | struct buffer_head *bi_bh; | ||
1590 | struct buffer_head *bi_parent; | ||
1591 | int bi_position; | ||
1592 | }; | ||
1593 | |||
1594 | static inline struct super_block *sb_from_tb(struct tree_balance *tb) | ||
1595 | { | ||
1596 | return tb ? tb->tb_sb : NULL; | ||
1597 | } | ||
1598 | |||
1599 | static inline struct super_block *sb_from_bi(struct buffer_info *bi) | ||
1600 | { | ||
1601 | return bi ? sb_from_tb(bi->tb) : NULL; | ||
1602 | } | ||
1603 | |||
1604 | /* there are 4 types of items: stat data, directory item, indirect, direct. | ||
1605 | +-------------------+------------+--------------+------------+ | ||
1606 | | | k_offset | k_uniqueness | mergeable? | | ||
1607 | +-------------------+------------+--------------+------------+ | ||
1608 | | stat data | 0 | 0 | no | | ||
1609 | +-------------------+------------+--------------+------------+ | ||
1610 | | 1st directory item| DOT_OFFSET |DIRENTRY_UNIQUENESS| no | | ||
1611 | | non 1st directory | hash value | | yes | | ||
1612 | | item | | | | | ||
1613 | +-------------------+------------+--------------+------------+ | ||
1614 | | indirect item | offset + 1 |TYPE_INDIRECT | if this is not the first indirect item of the object | ||
1615 | +-------------------+------------+--------------+------------+ | ||
1616 | | direct item | offset + 1 |TYPE_DIRECT | if not this is not the first direct item of the object | ||
1617 | +-------------------+------------+--------------+------------+ | ||
1618 | */ | ||
1619 | |||
1620 | struct item_operations { | ||
1621 | int (*bytes_number) (struct item_head * ih, int block_size); | ||
1622 | void (*decrement_key) (struct cpu_key *); | ||
1623 | int (*is_left_mergeable) (struct reiserfs_key * ih, | ||
1624 | unsigned long bsize); | ||
1625 | void (*print_item) (struct item_head *, char *item); | ||
1626 | void (*check_item) (struct item_head *, char *item); | ||
1627 | |||
1628 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, | ||
1629 | int is_affected, int insert_size); | ||
1630 | int (*check_left) (struct virtual_item * vi, int free, | ||
1631 | int start_skip, int end_skip); | ||
1632 | int (*check_right) (struct virtual_item * vi, int free); | ||
1633 | int (*part_size) (struct virtual_item * vi, int from, int to); | ||
1634 | int (*unit_num) (struct virtual_item * vi); | ||
1635 | void (*print_vi) (struct virtual_item * vi); | ||
1636 | }; | ||
1637 | |||
1638 | extern struct item_operations *item_ops[TYPE_ANY + 1]; | ||
1639 | |||
1640 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) | ||
1641 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) | ||
1642 | #define op_print_item(ih,item) item_ops[le_ih_k_type (ih)]->print_item (ih, item) | ||
1643 | #define op_check_item(ih,item) item_ops[le_ih_k_type (ih)]->check_item (ih, item) | ||
1644 | #define op_create_vi(vn,vi,is_affected,insert_size) item_ops[le_ih_k_type ((vi)->vi_ih)]->create_vi (vn,vi,is_affected,insert_size) | ||
1645 | #define op_check_left(vi,free,start_skip,end_skip) item_ops[(vi)->vi_index]->check_left (vi, free, start_skip, end_skip) | ||
1646 | #define op_check_right(vi,free) item_ops[(vi)->vi_index]->check_right (vi, free) | ||
1647 | #define op_part_size(vi,from,to) item_ops[(vi)->vi_index]->part_size (vi, from, to) | ||
1648 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) | ||
1649 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) | ||
1650 | |||
1651 | #define COMP_SHORT_KEYS comp_short_keys | ||
1652 | |||
1653 | /* number of blocks pointed to by the indirect item */ | ||
1654 | #define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE) | ||
1655 | |||
1656 | /* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ | ||
1657 | #define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) | ||
1658 | |||
1659 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ | ||
1660 | |||
1661 | /* get the item header */ | ||
1662 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | ||
1663 | |||
1664 | /* get key */ | ||
1665 | #define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | ||
1666 | |||
1667 | /* get the key */ | ||
1668 | #define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) ) | ||
1669 | |||
1670 | /* get item body */ | ||
1671 | #define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num)))) | ||
1672 | |||
1673 | /* get the stat data by the buffer header and the item order */ | ||
1674 | #define B_N_STAT_DATA(bh,nr) \ | ||
1675 | ( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) ) | ||
1676 | |||
1677 | /* following defines use reiserfs buffer header and item header */ | ||
1678 | |||
1679 | /* get stat-data */ | ||
1680 | #define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )((bh)->b_data + ih_location(ih)) ) | ||
1681 | |||
1682 | // this is 3976 for size==4096 | ||
1683 | #define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE) | ||
1684 | |||
1685 | /* indirect items consist of entries which contain blocknrs, pos | ||
1686 | indicates which entry, and B_I_POS_UNFM_POINTER resolves to the | ||
1687 | blocknr contained by the entry pos points to */ | ||
1688 | #define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos))) | ||
1689 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) | ||
1690 | |||
1691 | struct reiserfs_iget_args { | ||
1692 | __u32 objectid; | ||
1693 | __u32 dirid; | ||
1694 | }; | ||
1695 | |||
1696 | /***************************************************************************/ | ||
1697 | /* FUNCTION DECLARATIONS */ | ||
1698 | /***************************************************************************/ | ||
1699 | |||
1700 | #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12) | ||
1701 | |||
1702 | #define journal_trans_half(blocksize) \ | ||
1703 | ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32)) | ||
1704 | |||
1705 | /* journal.c see journal.c for all the comments here */ | ||
1706 | |||
1707 | /* first block written in a commit. */ | ||
1708 | struct reiserfs_journal_desc { | ||
1709 | __le32 j_trans_id; /* id of commit */ | ||
1710 | __le32 j_len; /* length of commit. len +1 is the commit block */ | ||
1711 | __le32 j_mount_id; /* mount id of this trans */ | ||
1712 | __le32 j_realblock[1]; /* real locations for each block */ | ||
1713 | }; | ||
1714 | |||
1715 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) | ||
1716 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) | ||
1717 | #define get_desc_mount_id(d) le32_to_cpu((d)->j_mount_id) | ||
1718 | |||
1719 | #define set_desc_trans_id(d,val) do { (d)->j_trans_id = cpu_to_le32 (val); } while (0) | ||
1720 | #define set_desc_trans_len(d,val) do { (d)->j_len = cpu_to_le32 (val); } while (0) | ||
1721 | #define set_desc_mount_id(d,val) do { (d)->j_mount_id = cpu_to_le32 (val); } while (0) | ||
1722 | |||
1723 | /* last block written in a commit */ | ||
1724 | struct reiserfs_journal_commit { | ||
1725 | __le32 j_trans_id; /* must match j_trans_id from the desc block */ | ||
1726 | __le32 j_len; /* ditto */ | ||
1727 | __le32 j_realblock[1]; /* real locations for each block */ | ||
1728 | }; | ||
1729 | |||
1730 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) | ||
1731 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) | ||
1732 | #define get_commit_mount_id(c) le32_to_cpu((c)->j_mount_id) | ||
1733 | |||
1734 | #define set_commit_trans_id(c,val) do { (c)->j_trans_id = cpu_to_le32 (val); } while (0) | ||
1735 | #define set_commit_trans_len(c,val) do { (c)->j_len = cpu_to_le32 (val); } while (0) | ||
1736 | |||
1737 | /* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the | ||
1738 | ** last fully flushed transaction. fully flushed means all the log blocks and all the real blocks are on disk, | ||
1739 | ** and this transaction does not need to be replayed. | ||
1740 | */ | ||
1741 | struct reiserfs_journal_header { | ||
1742 | __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */ | ||
1743 | __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ | ||
1744 | __le32 j_mount_id; | ||
1745 | /* 12 */ struct journal_params jh_journal; | ||
1746 | }; | ||
1747 | |||
1748 | /* biggest tunable defines are right here */ | ||
1749 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ | ||
1750 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ | ||
1751 | #define JOURNAL_TRANS_MIN_DEFAULT 256 | ||
1752 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ | ||
1753 | #define JOURNAL_MIN_RATIO 2 | ||
1754 | #define JOURNAL_MAX_COMMIT_AGE 30 | ||
1755 | #define JOURNAL_MAX_TRANS_AGE 30 | ||
1756 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | ||
1757 | #define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \ | ||
1758 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \ | ||
1759 | REISERFS_QUOTA_TRANS_BLOCKS(sb))) | ||
1760 | |||
1761 | #ifdef CONFIG_QUOTA | ||
1762 | /* We need to update data and inode (atime) */ | ||
1763 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) | ||
1764 | /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | ||
1765 | #define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ | ||
1766 | (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) | ||
1767 | /* same as with INIT */ | ||
1768 | #define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ | ||
1769 | (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) | ||
1770 | #else | ||
1771 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 | ||
1772 | #define REISERFS_QUOTA_INIT_BLOCKS(s) 0 | ||
1773 | #define REISERFS_QUOTA_DEL_BLOCKS(s) 0 | ||
1774 | #endif | ||
1775 | |||
1776 | /* both of these can be as low as 1, or as high as you want. The min is the | ||
1777 | ** number of 4k bitmap nodes preallocated on mount. New nodes are allocated | ||
1778 | ** as needed, and released when transactions are committed. On release, if | ||
1779 | ** the current number of nodes is > max, the node is freed, otherwise, | ||
1780 | ** it is put on a free list for faster use later. | ||
1781 | */ | ||
1782 | #define REISERFS_MIN_BITMAP_NODES 10 | ||
1783 | #define REISERFS_MAX_BITMAP_NODES 100 | ||
1784 | |||
1785 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ | ||
1786 | #define JBH_HASH_MASK 8191 | ||
1787 | |||
1788 | #define _jhashfn(sb,block) \ | ||
1789 | (((unsigned long)sb>>L1_CACHE_SHIFT) ^ \ | ||
1790 | (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12)))) | ||
1791 | #define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK]) | ||
1792 | |||
1793 | // We need these to make journal.c code more readable | ||
1794 | #define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
1795 | #define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
1796 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
1797 | |||
1798 | enum reiserfs_bh_state_bits { | ||
1799 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ | ||
1800 | BH_JDirty_wait, | ||
1801 | BH_JNew, /* disk block was taken off free list before | ||
1802 | * being in a finished transaction, or | ||
1803 | * written to disk. Can be reused immed. */ | ||
1804 | BH_JPrepared, | ||
1805 | BH_JRestore_dirty, | ||
1806 | BH_JTest, // debugging only will go away | ||
1807 | }; | ||
1808 | |||
1809 | BUFFER_FNS(JDirty, journaled); | ||
1810 | TAS_BUFFER_FNS(JDirty, journaled); | ||
1811 | BUFFER_FNS(JDirty_wait, journal_dirty); | ||
1812 | TAS_BUFFER_FNS(JDirty_wait, journal_dirty); | ||
1813 | BUFFER_FNS(JNew, journal_new); | ||
1814 | TAS_BUFFER_FNS(JNew, journal_new); | ||
1815 | BUFFER_FNS(JPrepared, journal_prepared); | ||
1816 | TAS_BUFFER_FNS(JPrepared, journal_prepared); | ||
1817 | BUFFER_FNS(JRestore_dirty, journal_restore_dirty); | ||
1818 | TAS_BUFFER_FNS(JRestore_dirty, journal_restore_dirty); | ||
1819 | BUFFER_FNS(JTest, journal_test); | ||
1820 | TAS_BUFFER_FNS(JTest, journal_test); | ||
1821 | |||
1822 | /* | ||
1823 | ** transaction handle which is passed around for all journal calls | ||
1824 | */ | ||
1825 | struct reiserfs_transaction_handle { | ||
1826 | struct super_block *t_super; /* super for this FS when journal_begin was | ||
1827 | called. saves calls to reiserfs_get_super | ||
1828 | also used by nested transactions to make | ||
1829 | sure they are nesting on the right FS | ||
1830 | _must_ be first in the handle | ||
1831 | */ | ||
1832 | int t_refcount; | ||
1833 | int t_blocks_logged; /* number of blocks this writer has logged */ | ||
1834 | int t_blocks_allocated; /* number of blocks this writer allocated */ | ||
1835 | unsigned int t_trans_id; /* sanity check, equals the current trans id */ | ||
1836 | void *t_handle_save; /* save existing current->journal_info */ | ||
1837 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block | ||
1838 | should be displaced from others */ | ||
1839 | struct list_head t_list; | ||
1840 | }; | ||
1841 | |||
1842 | /* used to keep track of ordered and tail writes, attached to the buffer | ||
1843 | * head through b_journal_head. | ||
1844 | */ | ||
1845 | struct reiserfs_jh { | ||
1846 | struct reiserfs_journal_list *jl; | ||
1847 | struct buffer_head *bh; | ||
1848 | struct list_head list; | ||
1849 | }; | ||
1850 | |||
1851 | void reiserfs_free_jh(struct buffer_head *bh); | ||
1852 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); | ||
1853 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); | ||
1854 | int journal_mark_dirty(struct reiserfs_transaction_handle *, | ||
1855 | struct super_block *, struct buffer_head *bh); | ||
1856 | |||
1857 | static inline int reiserfs_file_data_log(struct inode *inode) | ||
1858 | { | ||
1859 | if (reiserfs_data_log(inode->i_sb) || | ||
1860 | (REISERFS_I(inode)->i_flags & i_data_log)) | ||
1861 | return 1; | ||
1862 | return 0; | ||
1863 | } | ||
1864 | |||
1865 | static inline int reiserfs_transaction_running(struct super_block *s) | ||
1866 | { | ||
1867 | struct reiserfs_transaction_handle *th = current->journal_info; | ||
1868 | if (th && th->t_super == s) | ||
1869 | return 1; | ||
1870 | if (th && th->t_super == NULL) | ||
1871 | BUG(); | ||
1872 | return 0; | ||
1873 | } | ||
1874 | |||
1875 | static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th) | ||
1876 | { | ||
1877 | return th->t_blocks_allocated - th->t_blocks_logged; | ||
1878 | } | ||
1879 | |||
1880 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | ||
1881 | super_block | ||
1882 | *, | ||
1883 | int count); | ||
1884 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); | ||
1885 | int reiserfs_commit_page(struct inode *inode, struct page *page, | ||
1886 | unsigned from, unsigned to); | ||
1887 | int reiserfs_flush_old_commits(struct super_block *); | ||
1888 | int reiserfs_commit_for_inode(struct inode *); | ||
1889 | int reiserfs_inode_needs_commit(struct inode *); | ||
1890 | void reiserfs_update_inode_transaction(struct inode *); | ||
1891 | void reiserfs_wait_on_write_block(struct super_block *s); | ||
1892 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th); | ||
1893 | void reiserfs_allow_writes(struct super_block *s); | ||
1894 | void reiserfs_check_lock_depth(struct super_block *s, char *caller); | ||
1895 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, | ||
1896 | int wait); | ||
1897 | void reiserfs_restore_prepared_buffer(struct super_block *, | ||
1898 | struct buffer_head *bh); | ||
1899 | int journal_init(struct super_block *, const char *j_dev_name, int old_format, | ||
1900 | unsigned int); | ||
1901 | int journal_release(struct reiserfs_transaction_handle *, struct super_block *); | ||
1902 | int journal_release_error(struct reiserfs_transaction_handle *, | ||
1903 | struct super_block *); | ||
1904 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, | ||
1905 | unsigned long); | ||
1906 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, | ||
1907 | unsigned long); | ||
1908 | int journal_mark_freed(struct reiserfs_transaction_handle *, | ||
1909 | struct super_block *, b_blocknr_t blocknr); | ||
1910 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); | ||
1911 | int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr, | ||
1912 | int bit_nr, int searchall, b_blocknr_t *next); | ||
1913 | int journal_begin(struct reiserfs_transaction_handle *, | ||
1914 | struct super_block *sb, unsigned long); | ||
1915 | int journal_join_abort(struct reiserfs_transaction_handle *, | ||
1916 | struct super_block *sb, unsigned long); | ||
1917 | void reiserfs_abort_journal(struct super_block *sb, int errno); | ||
1918 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); | ||
1919 | int reiserfs_allocate_list_bitmaps(struct super_block *s, | ||
1920 | struct reiserfs_list_bitmap *, unsigned int); | ||
1921 | |||
1922 | void add_save_link(struct reiserfs_transaction_handle *th, | ||
1923 | struct inode *inode, int truncate); | ||
1924 | int remove_save_link(struct inode *inode, int truncate); | ||
1925 | |||
1926 | /* objectid.c */ | ||
1927 | __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th); | ||
1928 | void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, | ||
1929 | __u32 objectid_to_release); | ||
1930 | int reiserfs_convert_objectid_map_v1(struct super_block *); | ||
1931 | |||
1932 | /* stree.c */ | ||
1933 | int B_IS_IN_TREE(const struct buffer_head *); | ||
1934 | extern void copy_item_head(struct item_head *to, | ||
1935 | const struct item_head *from); | ||
1936 | |||
1937 | // first key is in cpu form, second - le | ||
1938 | extern int comp_short_keys(const struct reiserfs_key *le_key, | ||
1939 | const struct cpu_key *cpu_key); | ||
1940 | extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from); | ||
1941 | |||
1942 | // both are in le form | ||
1943 | extern int comp_le_keys(const struct reiserfs_key *, | ||
1944 | const struct reiserfs_key *); | ||
1945 | extern int comp_short_le_keys(const struct reiserfs_key *, | ||
1946 | const struct reiserfs_key *); | ||
1947 | |||
1948 | // | ||
1949 | // get key version from on disk key - kludge | ||
1950 | // | ||
1951 | static inline int le_key_version(const struct reiserfs_key *key) | ||
1952 | { | ||
1953 | int type; | ||
1954 | |||
1955 | type = offset_v2_k_type(&(key->u.k_offset_v2)); | ||
1956 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT | ||
1957 | && type != TYPE_DIRENTRY) | ||
1958 | return KEY_FORMAT_3_5; | ||
1959 | |||
1960 | return KEY_FORMAT_3_6; | ||
1961 | |||
1962 | } | ||
1963 | |||
1964 | static inline void copy_key(struct reiserfs_key *to, | ||
1965 | const struct reiserfs_key *from) | ||
1966 | { | ||
1967 | memcpy(to, from, KEY_SIZE); | ||
1968 | } | ||
1969 | |||
1970 | int comp_items(const struct item_head *stored_ih, const struct treepath *path); | ||
1971 | const struct reiserfs_key *get_rkey(const struct treepath *chk_path, | ||
1972 | const struct super_block *sb); | ||
1973 | int search_by_key(struct super_block *, const struct cpu_key *, | ||
1974 | struct treepath *, int); | ||
1975 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) | ||
1976 | int search_for_position_by_key(struct super_block *sb, | ||
1977 | const struct cpu_key *cpu_key, | ||
1978 | struct treepath *search_path); | ||
1979 | extern void decrement_bcount(struct buffer_head *bh); | ||
1980 | void decrement_counters_in_path(struct treepath *search_path); | ||
1981 | void pathrelse(struct treepath *search_path); | ||
1982 | int reiserfs_check_path(struct treepath *p); | ||
1983 | void pathrelse_and_restore(struct super_block *s, struct treepath *search_path); | ||
1984 | |||
1985 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, | ||
1986 | struct treepath *path, | ||
1987 | const struct cpu_key *key, | ||
1988 | struct item_head *ih, | ||
1989 | struct inode *inode, const char *body); | ||
1990 | |||
1991 | int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, | ||
1992 | struct treepath *path, | ||
1993 | const struct cpu_key *key, | ||
1994 | struct inode *inode, | ||
1995 | const char *body, int paste_size); | ||
1996 | |||
1997 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | ||
1998 | struct treepath *path, | ||
1999 | struct cpu_key *key, | ||
2000 | struct inode *inode, | ||
2001 | struct page *page, loff_t new_file_size); | ||
2002 | |||
2003 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | ||
2004 | struct treepath *path, | ||
2005 | const struct cpu_key *key, | ||
2006 | struct inode *inode, struct buffer_head *un_bh); | ||
2007 | |||
2008 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | ||
2009 | struct inode *inode, struct reiserfs_key *key); | ||
2010 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | ||
2011 | struct inode *inode); | ||
2012 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | ||
2013 | struct inode *inode, struct page *, | ||
2014 | int update_timestamps); | ||
2015 | |||
2016 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | ||
2017 | #define file_size(inode) ((inode)->i_size) | ||
2018 | #define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1)) | ||
2019 | |||
2020 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ | ||
2021 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) | ||
2022 | |||
2023 | void padd_item(char *item, int total_length, int length); | ||
2024 | |||
2025 | /* inode.c */ | ||
2026 | /* args for the create parameter of reiserfs_get_block */ | ||
2027 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ | ||
2028 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ | ||
2029 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ | ||
2030 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ | ||
2031 | #define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */ | ||
2032 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ | ||
2033 | |||
2034 | void reiserfs_read_locked_inode(struct inode *inode, | ||
2035 | struct reiserfs_iget_args *args); | ||
2036 | int reiserfs_find_actor(struct inode *inode, void *p); | ||
2037 | int reiserfs_init_locked_inode(struct inode *inode, void *p); | ||
2038 | void reiserfs_evict_inode(struct inode *inode); | ||
2039 | int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); | ||
2040 | int reiserfs_get_block(struct inode *inode, sector_t block, | ||
2041 | struct buffer_head *bh_result, int create); | ||
2042 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
2043 | int fh_len, int fh_type); | ||
2044 | struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
2045 | int fh_len, int fh_type); | ||
2046 | int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, | ||
2047 | int connectable); | ||
2048 | |||
2049 | int reiserfs_truncate_file(struct inode *, int update_timestamps); | ||
2050 | void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset, | ||
2051 | int type, int key_length); | ||
2052 | void make_le_item_head(struct item_head *ih, const struct cpu_key *key, | ||
2053 | int version, | ||
2054 | loff_t offset, int type, int length, int entry_count); | ||
2055 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); | ||
2056 | |||
2057 | struct reiserfs_security_handle; | ||
2058 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | ||
2059 | struct inode *dir, int mode, | ||
2060 | const char *symname, loff_t i_size, | ||
2061 | struct dentry *dentry, struct inode *inode, | ||
2062 | struct reiserfs_security_handle *security); | ||
2063 | |||
2064 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | ||
2065 | struct inode *inode, loff_t size); | ||
2066 | |||
2067 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, | ||
2068 | struct inode *inode) | ||
2069 | { | ||
2070 | reiserfs_update_sd_size(th, inode, inode->i_size); | ||
2071 | } | ||
2072 | |||
2073 | void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); | ||
2074 | void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); | ||
2075 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); | ||
2076 | |||
2077 | int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len); | ||
2078 | |||
2079 | /* namei.c */ | ||
2080 | void set_de_name_and_namelen(struct reiserfs_dir_entry *de); | ||
2081 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, | ||
2082 | struct treepath *path, struct reiserfs_dir_entry *de); | ||
2083 | struct dentry *reiserfs_get_parent(struct dentry *); | ||
2084 | |||
2085 | #ifdef CONFIG_REISERFS_PROC_INFO | ||
2086 | int reiserfs_proc_info_init(struct super_block *sb); | ||
2087 | int reiserfs_proc_info_done(struct super_block *sb); | ||
2088 | int reiserfs_proc_info_global_init(void); | ||
2089 | int reiserfs_proc_info_global_done(void); | ||
2090 | |||
2091 | #define PROC_EXP( e ) e | ||
2092 | |||
2093 | #define __PINFO( sb ) REISERFS_SB(sb) -> s_proc_info_data | ||
2094 | #define PROC_INFO_MAX( sb, field, value ) \ | ||
2095 | __PINFO( sb ).field = \ | ||
2096 | max( REISERFS_SB( sb ) -> s_proc_info_data.field, value ) | ||
2097 | #define PROC_INFO_INC( sb, field ) ( ++ ( __PINFO( sb ).field ) ) | ||
2098 | #define PROC_INFO_ADD( sb, field, val ) ( __PINFO( sb ).field += ( val ) ) | ||
2099 | #define PROC_INFO_BH_STAT( sb, bh, level ) \ | ||
2100 | PROC_INFO_INC( sb, sbk_read_at[ ( level ) ] ); \ | ||
2101 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ | ||
2102 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) | ||
2103 | #else | ||
2104 | static inline int reiserfs_proc_info_init(struct super_block *sb) | ||
2105 | { | ||
2106 | return 0; | ||
2107 | } | ||
2108 | |||
2109 | static inline int reiserfs_proc_info_done(struct super_block *sb) | ||
2110 | { | ||
2111 | return 0; | ||
2112 | } | ||
2113 | |||
2114 | static inline int reiserfs_proc_info_global_init(void) | ||
2115 | { | ||
2116 | return 0; | ||
2117 | } | ||
2118 | |||
2119 | static inline int reiserfs_proc_info_global_done(void) | ||
2120 | { | ||
2121 | return 0; | ||
2122 | } | ||
2123 | |||
2124 | #define PROC_EXP( e ) | ||
2125 | #define VOID_V ( ( void ) 0 ) | ||
2126 | #define PROC_INFO_MAX( sb, field, value ) VOID_V | ||
2127 | #define PROC_INFO_INC( sb, field ) VOID_V | ||
2128 | #define PROC_INFO_ADD( sb, field, val ) VOID_V | ||
2129 | #define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V | ||
2130 | #endif | ||
2131 | |||
2132 | /* dir.c */ | ||
2133 | extern const struct inode_operations reiserfs_dir_inode_operations; | ||
2134 | extern const struct inode_operations reiserfs_symlink_inode_operations; | ||
2135 | extern const struct inode_operations reiserfs_special_inode_operations; | ||
2136 | extern const struct file_operations reiserfs_dir_operations; | ||
2137 | int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *); | ||
2138 | |||
2139 | /* tail_conversion.c */ | ||
2140 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, | ||
2141 | struct treepath *, struct buffer_head *, loff_t); | ||
2142 | int indirect2direct(struct reiserfs_transaction_handle *, struct inode *, | ||
2143 | struct page *, struct treepath *, const struct cpu_key *, | ||
2144 | loff_t, char *); | ||
2145 | void reiserfs_unmap_buffer(struct buffer_head *); | ||
2146 | |||
2147 | /* file.c */ | ||
2148 | extern const struct inode_operations reiserfs_file_inode_operations; | ||
2149 | extern const struct file_operations reiserfs_file_operations; | ||
2150 | extern const struct address_space_operations reiserfs_address_space_operations; | ||
2151 | |||
2152 | /* fix_nodes.c */ | ||
2153 | |||
2154 | int fix_nodes(int n_op_mode, struct tree_balance *tb, | ||
2155 | struct item_head *ins_ih, const void *); | ||
2156 | void unfix_nodes(struct tree_balance *); | ||
2157 | |||
2158 | /* prints.c */ | ||
2159 | void __reiserfs_panic(struct super_block *s, const char *id, | ||
2160 | const char *function, const char *fmt, ...) | ||
2161 | __attribute__ ((noreturn)); | ||
2162 | #define reiserfs_panic(s, id, fmt, args...) \ | ||
2163 | __reiserfs_panic(s, id, __func__, fmt, ##args) | ||
2164 | void __reiserfs_error(struct super_block *s, const char *id, | ||
2165 | const char *function, const char *fmt, ...); | ||
2166 | #define reiserfs_error(s, id, fmt, args...) \ | ||
2167 | __reiserfs_error(s, id, __func__, fmt, ##args) | ||
2168 | void reiserfs_info(struct super_block *s, const char *fmt, ...); | ||
2169 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); | ||
2170 | void print_indirect_item(struct buffer_head *bh, int item_num); | ||
2171 | void store_print_tb(struct tree_balance *tb); | ||
2172 | void print_cur_tb(char *mes); | ||
2173 | void print_de(struct reiserfs_dir_entry *de); | ||
2174 | void print_bi(struct buffer_info *bi, char *mes); | ||
2175 | #define PRINT_LEAF_ITEMS 1 /* print all items */ | ||
2176 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ | ||
2177 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ | ||
2178 | void print_block(struct buffer_head *bh, ...); | ||
2179 | void print_bmap(struct super_block *s, int silent); | ||
2180 | void print_bmap_block(int i, char *data, int size, int silent); | ||
2181 | /*void print_super_block (struct super_block * s, char * mes);*/ | ||
2182 | void print_objectid_map(struct super_block *s); | ||
2183 | void print_block_head(struct buffer_head *bh, char *mes); | ||
2184 | void check_leaf(struct buffer_head *bh); | ||
2185 | void check_internal(struct buffer_head *bh); | ||
2186 | void print_statistics(struct super_block *s); | ||
2187 | char *reiserfs_hashname(int code); | ||
2188 | |||
2189 | /* lbalance.c */ | ||
2190 | int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, | ||
2191 | int mov_bytes, struct buffer_head *Snew); | ||
2192 | int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes); | ||
2193 | int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes); | ||
2194 | void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first, | ||
2195 | int del_num, int del_bytes); | ||
2196 | void leaf_insert_into_buf(struct buffer_info *bi, int before, | ||
2197 | struct item_head *inserted_item_ih, | ||
2198 | const char *inserted_item_body, int zeros_number); | ||
2199 | void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num, | ||
2200 | int pos_in_item, int paste_size, const char *body, | ||
2201 | int zeros_number); | ||
2202 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, | ||
2203 | int pos_in_item, int cut_size); | ||
2204 | void leaf_paste_entries(struct buffer_info *bi, int item_num, int before, | ||
2205 | int new_entry_count, struct reiserfs_de_head *new_dehs, | ||
2206 | const char *records, int paste_size); | ||
2207 | /* ibalance.c */ | ||
2208 | int balance_internal(struct tree_balance *, int, int, struct item_head *, | ||
2209 | struct buffer_head **); | ||
2210 | |||
2211 | /* do_balance.c */ | ||
2212 | void do_balance_mark_leaf_dirty(struct tree_balance *tb, | ||
2213 | struct buffer_head *bh, int flag); | ||
2214 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty | ||
2215 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty | ||
2216 | |||
2217 | void do_balance(struct tree_balance *tb, struct item_head *ih, | ||
2218 | const char *body, int flag); | ||
2219 | void reiserfs_invalidate_buffer(struct tree_balance *tb, | ||
2220 | struct buffer_head *bh); | ||
2221 | |||
2222 | int get_left_neighbor_position(struct tree_balance *tb, int h); | ||
2223 | int get_right_neighbor_position(struct tree_balance *tb, int h); | ||
2224 | void replace_key(struct tree_balance *tb, struct buffer_head *, int, | ||
2225 | struct buffer_head *, int); | ||
2226 | void make_empty_node(struct buffer_info *); | ||
2227 | struct buffer_head *get_FEB(struct tree_balance *); | ||
2228 | |||
2229 | /* bitmap.c */ | ||
2230 | |||
2231 | /* structure contains hints for block allocator, and it is a container for | ||
2232 | * arguments, such as node, search path, transaction_handle, etc. */ | ||
2233 | struct __reiserfs_blocknr_hint { | ||
2234 | struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */ | ||
2235 | sector_t block; /* file offset, in blocks */ | ||
2236 | struct in_core_key key; | ||
2237 | struct treepath *path; /* search path, used by allocator to deternine search_start by | ||
2238 | * various ways */ | ||
2239 | struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and | ||
2240 | * bitmap blocks changes */ | ||
2241 | b_blocknr_t beg, end; | ||
2242 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) | ||
2243 | * between different block allocator procedures | ||
2244 | * (determine_search_start() and others) */ | ||
2245 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed | ||
2246 | * function that do actual allocation */ | ||
2247 | |||
2248 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for | ||
2249 | * formatted/unformatted blocks with/without preallocation */ | ||
2250 | unsigned preallocate:1; | ||
2251 | }; | ||
2252 | |||
2253 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; | ||
2254 | |||
2255 | int reiserfs_parse_alloc_options(struct super_block *, char *); | ||
2256 | void reiserfs_init_alloc_options(struct super_block *s); | ||
2257 | |||
2258 | /* | ||
2259 | * given a directory, this will tell you what packing locality | ||
2260 | * to use for a new object underneat it. The locality is returned | ||
2261 | * in disk byte order (le). | ||
2262 | */ | ||
2263 | __le32 reiserfs_choose_packing(struct inode *dir); | ||
2264 | |||
2265 | int reiserfs_init_bitmap_cache(struct super_block *sb); | ||
2266 | void reiserfs_free_bitmap_cache(struct super_block *sb); | ||
2267 | void reiserfs_cache_bitmap_metadata(struct super_block *sb, struct buffer_head *bh, struct reiserfs_bitmap_info *info); | ||
2268 | struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, unsigned int bitmap); | ||
2269 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value); | ||
2270 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, | ||
2271 | b_blocknr_t, int for_unformatted); | ||
2272 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, | ||
2273 | int); | ||
2274 | static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | ||
2275 | b_blocknr_t * new_blocknrs, | ||
2276 | int amount_needed) | ||
2277 | { | ||
2278 | reiserfs_blocknr_hint_t hint = { | ||
2279 | .th = tb->transaction_handle, | ||
2280 | .path = tb->tb_path, | ||
2281 | .inode = NULL, | ||
2282 | .key = tb->key, | ||
2283 | .block = 0, | ||
2284 | .formatted_node = 1 | ||
2285 | }; | ||
2286 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, | ||
2287 | 0); | ||
2288 | } | ||
2289 | |||
2290 | static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | ||
2291 | *th, struct inode *inode, | ||
2292 | b_blocknr_t * new_blocknrs, | ||
2293 | struct treepath *path, | ||
2294 | sector_t block) | ||
2295 | { | ||
2296 | reiserfs_blocknr_hint_t hint = { | ||
2297 | .th = th, | ||
2298 | .path = path, | ||
2299 | .inode = inode, | ||
2300 | .block = block, | ||
2301 | .formatted_node = 0, | ||
2302 | .preallocate = 0 | ||
2303 | }; | ||
2304 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | ||
2305 | } | ||
2306 | |||
2307 | #ifdef REISERFS_PREALLOCATE | ||
2308 | static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle | ||
2309 | *th, struct inode *inode, | ||
2310 | b_blocknr_t * new_blocknrs, | ||
2311 | struct treepath *path, | ||
2312 | sector_t block) | ||
2313 | { | ||
2314 | reiserfs_blocknr_hint_t hint = { | ||
2315 | .th = th, | ||
2316 | .path = path, | ||
2317 | .inode = inode, | ||
2318 | .block = block, | ||
2319 | .formatted_node = 0, | ||
2320 | .preallocate = 1 | ||
2321 | }; | ||
2322 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | ||
2323 | } | ||
2324 | |||
2325 | void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th, | ||
2326 | struct inode *inode); | ||
2327 | void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th); | ||
2328 | #endif | ||
2329 | |||
2330 | /* hashes.c */ | ||
2331 | __u32 keyed_hash(const signed char *msg, int len); | ||
2332 | __u32 yura_hash(const signed char *msg, int len); | ||
2333 | __u32 r5_hash(const signed char *msg, int len); | ||
2334 | |||
2335 | #define reiserfs_set_le_bit __set_bit_le | ||
2336 | #define reiserfs_test_and_set_le_bit __test_and_set_bit_le | ||
2337 | #define reiserfs_clear_le_bit __clear_bit_le | ||
2338 | #define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le | ||
2339 | #define reiserfs_test_le_bit test_bit_le | ||
2340 | #define reiserfs_find_next_zero_le_bit find_next_zero_bit_le | ||
2341 | |||
2342 | /* sometimes reiserfs_truncate may require to allocate few new blocks | ||
2343 | to perform indirect2direct conversion. People probably used to | ||
2344 | think, that truncate should work without problems on a filesystem | ||
2345 | without free disk space. They may complain that they can not | ||
2346 | truncate due to lack of free disk space. This spare space allows us | ||
2347 | to not worry about it. 500 is probably too much, but it should be | ||
2348 | absolutely safe */ | ||
2349 | #define SPARE_SPACE 500 | ||
2350 | |||
2351 | /* prototypes from ioctl.c */ | ||
2352 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | ||
2353 | long reiserfs_compat_ioctl(struct file *filp, | ||
2354 | unsigned int cmd, unsigned long arg); | ||
2355 | int reiserfs_unpack(struct inode *inode, struct file *filp); | ||
2356 | |||
2357 | #endif /* __KERNEL__ */ | ||
2358 | |||
2359 | #endif /* _LINUX_REISER_FS_H */ | ||
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h new file mode 100644 index 00000000000..97959bdfe21 --- /dev/null +++ b/include/linux/reiserfs_fs_i.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef _REISER_FS_I | ||
2 | #define _REISER_FS_I | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | |||
6 | struct reiserfs_journal_list; | ||
7 | |||
8 | /** bitmasks for i_flags field in reiserfs-specific part of inode */ | ||
9 | typedef enum { | ||
10 | /** this says what format of key do all items (but stat data) of | ||
11 | an object have. If this is set, that format is 3.6 otherwise | ||
12 | - 3.5 */ | ||
13 | i_item_key_version_mask = 0x0001, | ||
14 | /** If this is unset, object has 3.5 stat data, otherwise, it has | ||
15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ | ||
16 | i_stat_data_version_mask = 0x0002, | ||
17 | /** file might need tail packing on close */ | ||
18 | i_pack_on_close_mask = 0x0004, | ||
19 | /** don't pack tail of file */ | ||
20 | i_nopack_mask = 0x0008, | ||
21 | /** If those is set, "safe link" was created for this file during | ||
22 | truncate or unlink. Safe link is used to avoid leakage of disk | ||
23 | space on crash with some files open, but unlinked. */ | ||
24 | i_link_saved_unlink_mask = 0x0010, | ||
25 | i_link_saved_truncate_mask = 0x0020, | ||
26 | i_has_xattr_dir = 0x0040, | ||
27 | i_data_log = 0x0080, | ||
28 | } reiserfs_inode_flags; | ||
29 | |||
30 | struct reiserfs_inode_info { | ||
31 | __u32 i_key[4]; /* key is still 4 32 bit integers */ | ||
32 | /** transient inode flags that are never stored on disk. Bitmasks | ||
33 | for this field are defined above. */ | ||
34 | __u32 i_flags; | ||
35 | |||
36 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. | ||
37 | |||
38 | /* copy of persistent inode flags read from sd_attrs. */ | ||
39 | __u32 i_attrs; | ||
40 | |||
41 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ | ||
42 | int i_prealloc_count; /* length of that sequence */ | ||
43 | struct list_head i_prealloc_list; /* per-transaction list of inodes which | ||
44 | * have preallocated blocks */ | ||
45 | |||
46 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks | ||
47 | * for the contents of this directory should be | ||
48 | * displaced */ | ||
49 | |||
50 | /* we use these for fsync or O_SYNC to decide which transaction | ||
51 | ** needs to be committed in order for this inode to be properly | ||
52 | ** flushed */ | ||
53 | unsigned int i_trans_id; | ||
54 | struct reiserfs_journal_list *i_jl; | ||
55 | atomic_t openers; | ||
56 | struct mutex tailpack; | ||
57 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
58 | struct rw_semaphore i_xattr_sem; | ||
59 | #endif | ||
60 | struct inode vfs_inode; | ||
61 | }; | ||
62 | |||
63 | #endif | ||
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h new file mode 100644 index 00000000000..52c83b6a758 --- /dev/null +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -0,0 +1,552 @@ | |||
1 | /* Copyright 1996-2000 Hans Reiser, see reiserfs/README for licensing | ||
2 | * and copyright details */ | ||
3 | |||
4 | #ifndef _LINUX_REISER_FS_SB | ||
5 | #define _LINUX_REISER_FS_SB | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | #include <linux/workqueue.h> | ||
9 | #include <linux/rwsem.h> | ||
10 | #include <linux/mutex.h> | ||
11 | #include <linux/sched.h> | ||
12 | #endif | ||
13 | |||
14 | typedef enum { | ||
15 | reiserfs_attrs_cleared = 0x00000001, | ||
16 | } reiserfs_super_block_flags; | ||
17 | |||
18 | /* struct reiserfs_super_block accessors/mutators | ||
19 | * since this is a disk structure, it will always be in | ||
20 | * little endian format. */ | ||
21 | #define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) | ||
22 | #define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) | ||
23 | #define sb_free_blocks(sbp) (le32_to_cpu((sbp)->s_v1.s_free_blocks)) | ||
24 | #define set_sb_free_blocks(sbp,v) ((sbp)->s_v1.s_free_blocks = cpu_to_le32(v)) | ||
25 | #define sb_root_block(sbp) (le32_to_cpu((sbp)->s_v1.s_root_block)) | ||
26 | #define set_sb_root_block(sbp,v) ((sbp)->s_v1.s_root_block = cpu_to_le32(v)) | ||
27 | |||
28 | #define sb_jp_journal_1st_block(sbp) \ | ||
29 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_1st_block)) | ||
30 | #define set_sb_jp_journal_1st_block(sbp,v) \ | ||
31 | ((sbp)->s_v1.s_journal.jp_journal_1st_block = cpu_to_le32(v)) | ||
32 | #define sb_jp_journal_dev(sbp) \ | ||
33 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_dev)) | ||
34 | #define set_sb_jp_journal_dev(sbp,v) \ | ||
35 | ((sbp)->s_v1.s_journal.jp_journal_dev = cpu_to_le32(v)) | ||
36 | #define sb_jp_journal_size(sbp) \ | ||
37 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_size)) | ||
38 | #define set_sb_jp_journal_size(sbp,v) \ | ||
39 | ((sbp)->s_v1.s_journal.jp_journal_size = cpu_to_le32(v)) | ||
40 | #define sb_jp_journal_trans_max(sbp) \ | ||
41 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_trans_max)) | ||
42 | #define set_sb_jp_journal_trans_max(sbp,v) \ | ||
43 | ((sbp)->s_v1.s_journal.jp_journal_trans_max = cpu_to_le32(v)) | ||
44 | #define sb_jp_journal_magic(sbp) \ | ||
45 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_magic)) | ||
46 | #define set_sb_jp_journal_magic(sbp,v) \ | ||
47 | ((sbp)->s_v1.s_journal.jp_journal_magic = cpu_to_le32(v)) | ||
48 | #define sb_jp_journal_max_batch(sbp) \ | ||
49 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_batch)) | ||
50 | #define set_sb_jp_journal_max_batch(sbp,v) \ | ||
51 | ((sbp)->s_v1.s_journal.jp_journal_max_batch = cpu_to_le32(v)) | ||
52 | #define sb_jp_jourmal_max_commit_age(sbp) \ | ||
53 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_commit_age)) | ||
54 | #define set_sb_jp_journal_max_commit_age(sbp,v) \ | ||
55 | ((sbp)->s_v1.s_journal.jp_journal_max_commit_age = cpu_to_le32(v)) | ||
56 | |||
57 | #define sb_blocksize(sbp) (le16_to_cpu((sbp)->s_v1.s_blocksize)) | ||
58 | #define set_sb_blocksize(sbp,v) ((sbp)->s_v1.s_blocksize = cpu_to_le16(v)) | ||
59 | #define sb_oid_maxsize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_maxsize)) | ||
60 | #define set_sb_oid_maxsize(sbp,v) ((sbp)->s_v1.s_oid_maxsize = cpu_to_le16(v)) | ||
61 | #define sb_oid_cursize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_cursize)) | ||
62 | #define set_sb_oid_cursize(sbp,v) ((sbp)->s_v1.s_oid_cursize = cpu_to_le16(v)) | ||
63 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) | ||
64 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) | ||
65 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) | ||
66 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) | ||
67 | #define sb_hash_function_code(sbp) \ | ||
68 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) | ||
69 | #define set_sb_hash_function_code(sbp,v) \ | ||
70 | ((sbp)->s_v1.s_hash_function_code = cpu_to_le32(v)) | ||
71 | #define sb_tree_height(sbp) (le16_to_cpu((sbp)->s_v1.s_tree_height)) | ||
72 | #define set_sb_tree_height(sbp,v) ((sbp)->s_v1.s_tree_height = cpu_to_le16(v)) | ||
73 | #define sb_bmap_nr(sbp) (le16_to_cpu((sbp)->s_v1.s_bmap_nr)) | ||
74 | #define set_sb_bmap_nr(sbp,v) ((sbp)->s_v1.s_bmap_nr = cpu_to_le16(v)) | ||
75 | #define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) | ||
76 | #define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) | ||
77 | |||
78 | #define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count)) | ||
79 | #define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v)) | ||
80 | |||
81 | #define sb_reserved_for_journal(sbp) \ | ||
82 | (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) | ||
83 | #define set_sb_reserved_for_journal(sbp,v) \ | ||
84 | ((sbp)->s_v1.s_reserved_for_journal = cpu_to_le16(v)) | ||
85 | |||
86 | /* LOGGING -- */ | ||
87 | |||
88 | /* These all interelate for performance. | ||
89 | ** | ||
90 | ** If the journal block count is smaller than n transactions, you lose speed. | ||
91 | ** I don't know what n is yet, I'm guessing 8-16. | ||
92 | ** | ||
93 | ** typical transaction size depends on the application, how often fsync is | ||
94 | ** called, and how many metadata blocks you dirty in a 30 second period. | ||
95 | ** The more small files (<16k) you use, the larger your transactions will | ||
96 | ** be. | ||
97 | ** | ||
98 | ** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal | ||
99 | ** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough | ||
100 | ** to prevent wrapping before dirty meta blocks get to disk. | ||
101 | ** | ||
102 | ** If the batch max is smaller than the transaction max, you'll waste space at the end of the journal | ||
103 | ** because journal_end sets the next transaction to start at 0 if the next transaction has any chance of wrapping. | ||
104 | ** | ||
105 | ** The large the batch max age, the better the speed, and the more meta data changes you'll lose after a crash. | ||
106 | ** | ||
107 | */ | ||
108 | |||
109 | /* don't mess with these for a while */ | ||
110 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ | ||
111 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ | ||
112 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ | ||
113 | #define JOURNAL_HASH_SIZE 8192 | ||
114 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ | ||
115 | |||
116 | /* One of these for every block in every transaction | ||
117 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a | ||
118 | ** hash of all the in memory transactions. | ||
119 | ** next and prev are used by the current transaction (journal_hash). | ||
120 | ** hnext and hprev are used by journal_list_hash. If a block is in more than one transaction, the journal_list_hash | ||
121 | ** links it in multiple times. This allows flush_journal_list to remove just the cnode belonging | ||
122 | ** to a given transaction. | ||
123 | */ | ||
124 | struct reiserfs_journal_cnode { | ||
125 | struct buffer_head *bh; /* real buffer head */ | ||
126 | struct super_block *sb; /* dev of real buffer head */ | ||
127 | __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */ | ||
128 | unsigned long state; | ||
129 | struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */ | ||
130 | struct reiserfs_journal_cnode *next; /* next in transaction list */ | ||
131 | struct reiserfs_journal_cnode *prev; /* prev in transaction list */ | ||
132 | struct reiserfs_journal_cnode *hprev; /* prev in hash list */ | ||
133 | struct reiserfs_journal_cnode *hnext; /* next in hash list */ | ||
134 | }; | ||
135 | |||
136 | struct reiserfs_bitmap_node { | ||
137 | int id; | ||
138 | char *data; | ||
139 | struct list_head list; | ||
140 | }; | ||
141 | |||
142 | struct reiserfs_list_bitmap { | ||
143 | struct reiserfs_journal_list *journal_list; | ||
144 | struct reiserfs_bitmap_node **bitmaps; | ||
145 | }; | ||
146 | |||
147 | /* | ||
148 | ** one of these for each transaction. The most important part here is the j_realblock. | ||
149 | ** this list of cnodes is used to hash all the blocks in all the commits, to mark all the | ||
150 | ** real buffer heads dirty once all the commits hit the disk, | ||
151 | ** and to make sure every real block in a transaction is on disk before allowing the log area | ||
152 | ** to be overwritten */ | ||
153 | struct reiserfs_journal_list { | ||
154 | unsigned long j_start; | ||
155 | unsigned long j_state; | ||
156 | unsigned long j_len; | ||
157 | atomic_t j_nonzerolen; | ||
158 | atomic_t j_commit_left; | ||
159 | atomic_t j_older_commits_done; /* all commits older than this on disk */ | ||
160 | struct mutex j_commit_mutex; | ||
161 | unsigned int j_trans_id; | ||
162 | time_t j_timestamp; | ||
163 | struct reiserfs_list_bitmap *j_list_bitmap; | ||
164 | struct buffer_head *j_commit_bh; /* commit buffer head */ | ||
165 | struct reiserfs_journal_cnode *j_realblock; | ||
166 | struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */ | ||
167 | /* time ordered list of all active transactions */ | ||
168 | struct list_head j_list; | ||
169 | |||
170 | /* time ordered list of all transactions we haven't tried to flush yet */ | ||
171 | struct list_head j_working_list; | ||
172 | |||
173 | /* list of tail conversion targets in need of flush before commit */ | ||
174 | struct list_head j_tail_bh_list; | ||
175 | /* list of data=ordered buffers in need of flush before commit */ | ||
176 | struct list_head j_bh_list; | ||
177 | int j_refcount; | ||
178 | }; | ||
179 | |||
180 | struct reiserfs_journal { | ||
181 | struct buffer_head **j_ap_blocks; /* journal blocks on disk */ | ||
182 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ | ||
183 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ | ||
184 | |||
185 | struct block_device *j_dev_bd; | ||
186 | fmode_t j_dev_mode; | ||
187 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | ||
188 | |||
189 | unsigned long j_state; | ||
190 | unsigned int j_trans_id; | ||
191 | unsigned long j_mount_id; | ||
192 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ | ||
193 | unsigned long j_len; /* length of current waiting commit */ | ||
194 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ | ||
195 | atomic_t j_wcount; /* count of writers for current commit */ | ||
196 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ | ||
197 | unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ | ||
198 | unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */ | ||
199 | struct buffer_head *j_header_bh; | ||
200 | |||
201 | time_t j_trans_start_time; /* time this transaction started */ | ||
202 | struct mutex j_mutex; | ||
203 | struct mutex j_flush_mutex; | ||
204 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ | ||
205 | atomic_t j_jlock; /* lock for j_join_wait */ | ||
206 | int j_list_bitmap_index; /* number of next list bitmap to use */ | ||
207 | int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */ | ||
208 | int j_next_full_flush; /* next journal_end will flush all journal list */ | ||
209 | int j_next_async_flush; /* next journal_end will flush all async commits */ | ||
210 | |||
211 | int j_cnode_used; /* number of cnodes on the used list */ | ||
212 | int j_cnode_free; /* number of cnodes on the free list */ | ||
213 | |||
214 | unsigned int j_trans_max; /* max number of blocks in a transaction. */ | ||
215 | unsigned int j_max_batch; /* max number of blocks to batch into a trans */ | ||
216 | unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */ | ||
217 | unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */ | ||
218 | unsigned int j_default_max_commit_age; /* the default for the max commit age */ | ||
219 | |||
220 | struct reiserfs_journal_cnode *j_cnode_free_list; | ||
221 | struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */ | ||
222 | |||
223 | struct reiserfs_journal_list *j_current_jl; | ||
224 | int j_free_bitmap_nodes; | ||
225 | int j_used_bitmap_nodes; | ||
226 | |||
227 | int j_num_lists; /* total number of active transactions */ | ||
228 | int j_num_work_lists; /* number that need attention from kreiserfsd */ | ||
229 | |||
230 | /* debugging to make sure things are flushed in order */ | ||
231 | unsigned int j_last_flush_id; | ||
232 | |||
233 | /* debugging to make sure things are committed in order */ | ||
234 | unsigned int j_last_commit_id; | ||
235 | |||
236 | struct list_head j_bitmap_nodes; | ||
237 | struct list_head j_dirty_buffers; | ||
238 | spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */ | ||
239 | |||
240 | /* list of all active transactions */ | ||
241 | struct list_head j_journal_list; | ||
242 | /* lists that haven't been touched by writeback attempts */ | ||
243 | struct list_head j_working_list; | ||
244 | |||
245 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ | ||
246 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ | ||
247 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all | ||
248 | the transactions */ | ||
249 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ | ||
250 | int j_persistent_trans; | ||
251 | unsigned long j_max_trans_size; | ||
252 | unsigned long j_max_batch_size; | ||
253 | |||
254 | int j_errno; | ||
255 | |||
256 | /* when flushing ordered buffers, throttle new ordered writers */ | ||
257 | struct delayed_work j_work; | ||
258 | struct super_block *j_work_sb; | ||
259 | atomic_t j_async_throttle; | ||
260 | }; | ||
261 | |||
262 | enum journal_state_bits { | ||
263 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ | ||
264 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ | ||
265 | J_ABORTED, /* set when log is aborted */ | ||
266 | }; | ||
267 | |||
268 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | ||
269 | |||
270 | typedef __u32(*hashf_t) (const signed char *, int); | ||
271 | |||
272 | struct reiserfs_bitmap_info { | ||
273 | __u32 free_count; | ||
274 | }; | ||
275 | |||
276 | struct proc_dir_entry; | ||
277 | |||
278 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | ||
279 | typedef unsigned long int stat_cnt_t; | ||
280 | typedef struct reiserfs_proc_info_data { | ||
281 | spinlock_t lock; | ||
282 | int exiting; | ||
283 | int max_hash_collisions; | ||
284 | |||
285 | stat_cnt_t breads; | ||
286 | stat_cnt_t bread_miss; | ||
287 | stat_cnt_t search_by_key; | ||
288 | stat_cnt_t search_by_key_fs_changed; | ||
289 | stat_cnt_t search_by_key_restarted; | ||
290 | |||
291 | stat_cnt_t insert_item_restarted; | ||
292 | stat_cnt_t paste_into_item_restarted; | ||
293 | stat_cnt_t cut_from_item_restarted; | ||
294 | stat_cnt_t delete_solid_item_restarted; | ||
295 | stat_cnt_t delete_item_restarted; | ||
296 | |||
297 | stat_cnt_t leaked_oid; | ||
298 | stat_cnt_t leaves_removable; | ||
299 | |||
300 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | ||
301 | stat_cnt_t balance_at[5]; /* XXX */ | ||
302 | /* sbk == search_by_key */ | ||
303 | stat_cnt_t sbk_read_at[5]; /* XXX */ | ||
304 | stat_cnt_t sbk_fs_changed[5]; | ||
305 | stat_cnt_t sbk_restarted[5]; | ||
306 | stat_cnt_t items_at[5]; /* XXX */ | ||
307 | stat_cnt_t free_at[5]; /* XXX */ | ||
308 | stat_cnt_t can_node_be_removed[5]; /* XXX */ | ||
309 | long int lnum[5]; /* XXX */ | ||
310 | long int rnum[5]; /* XXX */ | ||
311 | long int lbytes[5]; /* XXX */ | ||
312 | long int rbytes[5]; /* XXX */ | ||
313 | stat_cnt_t get_neighbors[5]; | ||
314 | stat_cnt_t get_neighbors_restart[5]; | ||
315 | stat_cnt_t need_l_neighbor[5]; | ||
316 | stat_cnt_t need_r_neighbor[5]; | ||
317 | |||
318 | stat_cnt_t free_block; | ||
319 | struct __scan_bitmap_stats { | ||
320 | stat_cnt_t call; | ||
321 | stat_cnt_t wait; | ||
322 | stat_cnt_t bmap; | ||
323 | stat_cnt_t retry; | ||
324 | stat_cnt_t in_journal_hint; | ||
325 | stat_cnt_t in_journal_nohint; | ||
326 | stat_cnt_t stolen; | ||
327 | } scan_bitmap; | ||
328 | struct __journal_stats { | ||
329 | stat_cnt_t in_journal; | ||
330 | stat_cnt_t in_journal_bitmap; | ||
331 | stat_cnt_t in_journal_reusable; | ||
332 | stat_cnt_t lock_journal; | ||
333 | stat_cnt_t lock_journal_wait; | ||
334 | stat_cnt_t journal_being; | ||
335 | stat_cnt_t journal_relock_writers; | ||
336 | stat_cnt_t journal_relock_wcount; | ||
337 | stat_cnt_t mark_dirty; | ||
338 | stat_cnt_t mark_dirty_already; | ||
339 | stat_cnt_t mark_dirty_notjournal; | ||
340 | stat_cnt_t restore_prepared; | ||
341 | stat_cnt_t prepare; | ||
342 | stat_cnt_t prepare_retry; | ||
343 | } journal; | ||
344 | } reiserfs_proc_info_data_t; | ||
345 | #else | ||
346 | typedef struct reiserfs_proc_info_data { | ||
347 | } reiserfs_proc_info_data_t; | ||
348 | #endif | ||
349 | |||
350 | /* reiserfs union of in-core super block data */ | ||
351 | struct reiserfs_sb_info { | ||
352 | struct buffer_head *s_sbh; /* Buffer containing the super block */ | ||
353 | /* both the comment and the choice of | ||
354 | name are unclear for s_rs -Hans */ | ||
355 | struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */ | ||
356 | struct reiserfs_bitmap_info *s_ap_bitmap; | ||
357 | struct reiserfs_journal *s_journal; /* pointer to journal information */ | ||
358 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | ||
359 | |||
360 | /* Serialize writers access, replace the old bkl */ | ||
361 | struct mutex lock; | ||
362 | /* Owner of the lock (can be recursive) */ | ||
363 | struct task_struct *lock_owner; | ||
364 | /* Depth of the lock, start from -1 like the bkl */ | ||
365 | int lock_depth; | ||
366 | |||
367 | /* Comment? -Hans */ | ||
368 | void (*end_io_handler) (struct buffer_head *, int); | ||
369 | hashf_t s_hash_function; /* pointer to function which is used | ||
370 | to sort names in directory. Set on | ||
371 | mount */ | ||
372 | unsigned long s_mount_opt; /* reiserfs's mount options are set | ||
373 | here (currently - NOTAIL, NOLOG, | ||
374 | REPLAYONLY) */ | ||
375 | |||
376 | struct { /* This is a structure that describes block allocator options */ | ||
377 | unsigned long bits; /* Bitfield for enable/disable kind of options */ | ||
378 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ | ||
379 | int border; /* percentage of disk, border takes */ | ||
380 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ | ||
381 | int preallocsize; /* Number of blocks we try to prealloc when file | ||
382 | reaches preallocmin size (in blocks) or | ||
383 | prealloc_list is empty. */ | ||
384 | } s_alloc_options; | ||
385 | |||
386 | /* Comment? -Hans */ | ||
387 | wait_queue_head_t s_wait; | ||
388 | /* To be obsoleted soon by per buffer seals.. -Hans */ | ||
389 | atomic_t s_generation_counter; // increased by one every time the | ||
390 | // tree gets re-balanced | ||
391 | unsigned long s_properties; /* File system properties. Currently holds | ||
392 | on-disk FS format */ | ||
393 | |||
394 | /* session statistics */ | ||
395 | int s_disk_reads; | ||
396 | int s_disk_writes; | ||
397 | int s_fix_nodes; | ||
398 | int s_do_balance; | ||
399 | int s_unneeded_left_neighbor; | ||
400 | int s_good_search_by_key_reada; | ||
401 | int s_bmaps; | ||
402 | int s_bmaps_without_search; | ||
403 | int s_direct2indirect; | ||
404 | int s_indirect2direct; | ||
405 | /* set up when it's ok for reiserfs_read_inode2() to read from | ||
406 | disk inode with nlink==0. Currently this is only used during | ||
407 | finish_unfinished() processing at mount time */ | ||
408 | int s_is_unlinked_ok; | ||
409 | reiserfs_proc_info_data_t s_proc_info_data; | ||
410 | struct proc_dir_entry *procdir; | ||
411 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | ||
412 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | ||
413 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | ||
414 | struct dentry *xattr_root; /* root of /.reiserfs_priv/xattrs */ | ||
415 | int j_errno; | ||
416 | #ifdef CONFIG_QUOTA | ||
417 | char *s_qf_names[MAXQUOTAS]; | ||
418 | int s_jquota_fmt; | ||
419 | #endif | ||
420 | #ifdef CONFIG_REISERFS_CHECK | ||
421 | |||
422 | struct tree_balance *cur_tb; /* | ||
423 | * Detects whether more than one | ||
424 | * copy of tb exists per superblock | ||
425 | * as a means of checking whether | ||
426 | * do_balance is executing concurrently | ||
427 | * against another tree reader/writer | ||
428 | * on a same mount point. | ||
429 | */ | ||
430 | #endif | ||
431 | }; | ||
432 | |||
433 | /* Definitions of reiserfs on-disk properties: */ | ||
434 | #define REISERFS_3_5 0 | ||
435 | #define REISERFS_3_6 1 | ||
436 | #define REISERFS_OLD_FORMAT 2 | ||
437 | |||
438 | enum reiserfs_mount_options { | ||
439 | /* Mount options */ | ||
440 | REISERFS_LARGETAIL, /* large tails will be created in a session */ | ||
441 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ | ||
442 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ | ||
443 | REISERFS_CONVERT, /* -o conv: causes conversion of old | ||
444 | format super block to the new | ||
445 | format. If not specified - old | ||
446 | partition will be dealt with in a | ||
447 | manner of 3.5.x */ | ||
448 | |||
449 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting | ||
450 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option | ||
451 | ** is not required. If the normal autodection code can't determine which | ||
452 | ** hash to use (because both hashes had the same value for a file) | ||
453 | ** use this option to force a specific hash. It won't allow you to override | ||
454 | ** the existing hash on the FS, so if you have a tea hash disk, and mount | ||
455 | ** with -o hash=rupasov, the mount will fail. | ||
456 | */ | ||
457 | FORCE_TEA_HASH, /* try to force tea hash on mount */ | ||
458 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ | ||
459 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ | ||
460 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ | ||
461 | |||
462 | REISERFS_DATA_LOG, | ||
463 | REISERFS_DATA_ORDERED, | ||
464 | REISERFS_DATA_WRITEBACK, | ||
465 | |||
466 | /* used for testing experimental features, makes benchmarking new | ||
467 | features with and without more convenient, should never be used by | ||
468 | users in any code shipped to users (ideally) */ | ||
469 | |||
470 | REISERFS_NO_BORDER, | ||
471 | REISERFS_NO_UNHASHED_RELOCATION, | ||
472 | REISERFS_HASHED_RELOCATION, | ||
473 | REISERFS_ATTRS, | ||
474 | REISERFS_XATTRS_USER, | ||
475 | REISERFS_POSIXACL, | ||
476 | REISERFS_EXPOSE_PRIVROOT, | ||
477 | REISERFS_BARRIER_NONE, | ||
478 | REISERFS_BARRIER_FLUSH, | ||
479 | |||
480 | /* Actions on error */ | ||
481 | REISERFS_ERROR_PANIC, | ||
482 | REISERFS_ERROR_RO, | ||
483 | REISERFS_ERROR_CONTINUE, | ||
484 | |||
485 | REISERFS_QUOTA, /* Some quota option specified */ | ||
486 | |||
487 | REISERFS_TEST1, | ||
488 | REISERFS_TEST2, | ||
489 | REISERFS_TEST3, | ||
490 | REISERFS_TEST4, | ||
491 | REISERFS_UNSUPPORTED_OPT, | ||
492 | }; | ||
493 | |||
494 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) | ||
495 | #define reiserfs_rupasov_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_RUPASOV_HASH)) | ||
496 | #define reiserfs_tea_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_TEA_HASH)) | ||
497 | #define reiserfs_hash_detect(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_HASH_DETECT)) | ||
498 | #define reiserfs_no_border(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_BORDER)) | ||
499 | #define reiserfs_no_unhashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION)) | ||
500 | #define reiserfs_hashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_HASHED_RELOCATION)) | ||
501 | #define reiserfs_test4(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TEST4)) | ||
502 | |||
503 | #define have_large_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_LARGETAIL)) | ||
504 | #define have_small_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_SMALLTAIL)) | ||
505 | #define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY)) | ||
506 | #define reiserfs_attrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ATTRS)) | ||
507 | #define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5)) | ||
508 | #define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT)) | ||
509 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) | ||
510 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) | ||
511 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) | ||
512 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) | ||
513 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) | ||
514 | #define reiserfs_expose_privroot(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT)) | ||
515 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) | ||
516 | #define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE)) | ||
517 | #define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH)) | ||
518 | |||
519 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) | ||
520 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) | ||
521 | |||
522 | void reiserfs_file_buffer(struct buffer_head *bh, int list); | ||
523 | extern struct file_system_type reiserfs_fs_type; | ||
524 | int reiserfs_resize(struct super_block *, unsigned long); | ||
525 | |||
526 | #define CARRY_ON 0 | ||
527 | #define SCHEDULE_OCCURRED 1 | ||
528 | |||
529 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) | ||
530 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) | ||
531 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) | ||
532 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) | ||
533 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) | ||
534 | |||
535 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) | ||
536 | |||
537 | /* A safe version of the "bdevname", which returns the "s_id" field of | ||
538 | * a superblock or else "Null superblock" if the super block is NULL. | ||
539 | */ | ||
540 | static inline char *reiserfs_bdevname(struct super_block *s) | ||
541 | { | ||
542 | return (s == NULL) ? "Null superblock" : s->s_id; | ||
543 | } | ||
544 | |||
545 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) | ||
546 | static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal | ||
547 | *journal) | ||
548 | { | ||
549 | return test_bit(J_ABORTED, &journal->j_state); | ||
550 | } | ||
551 | |||
552 | #endif /* _LINUX_REISER_FS_SB */ | ||
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h new file mode 100644 index 00000000000..c2b71473266 --- /dev/null +++ b/include/linux/reiserfs_xattr.h | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | File: linux/reiserfs_xattr.h | ||
3 | */ | ||
4 | |||
5 | #ifndef _LINUX_REISERFS_XATTR_H | ||
6 | #define _LINUX_REISERFS_XATTR_H | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
10 | /* Magic value in header */ | ||
11 | #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ | ||
12 | |||
13 | struct reiserfs_xattr_header { | ||
14 | __le32 h_magic; /* magic number for identification */ | ||
15 | __le32 h_hash; /* hash of the value */ | ||
16 | }; | ||
17 | |||
18 | struct reiserfs_security_handle { | ||
19 | char *name; | ||
20 | void *value; | ||
21 | size_t length; | ||
22 | }; | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #include <linux/init.h> | ||
27 | #include <linux/list.h> | ||
28 | #include <linux/rwsem.h> | ||
29 | #include <linux/reiserfs_fs_i.h> | ||
30 | #include <linux/reiserfs_fs.h> | ||
31 | |||
32 | struct inode; | ||
33 | struct dentry; | ||
34 | struct iattr; | ||
35 | struct super_block; | ||
36 | struct nameidata; | ||
37 | |||
38 | int reiserfs_xattr_register_handlers(void) __init; | ||
39 | void reiserfs_xattr_unregister_handlers(void); | ||
40 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | ||
41 | int reiserfs_lookup_privroot(struct super_block *sb); | ||
42 | int reiserfs_delete_xattrs(struct inode *inode); | ||
43 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | ||
44 | int reiserfs_permission(struct inode *inode, int mask); | ||
45 | |||
46 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
47 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | ||
48 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, | ||
49 | void *buffer, size_t size); | ||
50 | int reiserfs_setxattr(struct dentry *dentry, const char *name, | ||
51 | const void *value, size_t size, int flags); | ||
52 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | ||
53 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | ||
54 | |||
55 | int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); | ||
56 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | ||
57 | int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *, | ||
58 | struct inode *, const char *, const void *, | ||
59 | size_t, int); | ||
60 | |||
61 | extern const struct xattr_handler reiserfs_xattr_user_handler; | ||
62 | extern const struct xattr_handler reiserfs_xattr_trusted_handler; | ||
63 | extern const struct xattr_handler reiserfs_xattr_security_handler; | ||
64 | #ifdef CONFIG_REISERFS_FS_SECURITY | ||
65 | int reiserfs_security_init(struct inode *dir, struct inode *inode, | ||
66 | const struct qstr *qstr, | ||
67 | struct reiserfs_security_handle *sec); | ||
68 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
69 | struct inode *inode, | ||
70 | struct reiserfs_security_handle *sec); | ||
71 | void reiserfs_security_free(struct reiserfs_security_handle *sec); | ||
72 | #endif | ||
73 | |||
74 | static inline int reiserfs_xattrs_initialized(struct super_block *sb) | ||
75 | { | ||
76 | return REISERFS_SB(sb)->priv_root != NULL; | ||
77 | } | ||
78 | |||
79 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) | ||
80 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) | ||
81 | { | ||
82 | loff_t ret = 0; | ||
83 | if (reiserfs_file_data_log(inode)) { | ||
84 | ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize); | ||
85 | ret >>= inode->i_sb->s_blocksize_bits; | ||
86 | } | ||
87 | return ret; | ||
88 | } | ||
89 | |||
90 | /* We may have to create up to 3 objects: xattr root, xattr dir, xattr file. | ||
91 | * Let's try to be smart about it. | ||
92 | * xattr root: We cache it. If it's not cached, we may need to create it. | ||
93 | * xattr dir: If anything has been loaded for this inode, we can set a flag | ||
94 | * saying so. | ||
95 | * xattr file: Since we don't cache xattrs, we can't tell. We always include | ||
96 | * blocks for it. | ||
97 | * | ||
98 | * However, since root and dir can be created between calls - YOU MUST SAVE | ||
99 | * THIS VALUE. | ||
100 | */ | ||
101 | static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | ||
102 | { | ||
103 | size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
104 | |||
105 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | ||
106 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
107 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) | ||
108 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
109 | } | ||
110 | |||
111 | return nblocks; | ||
112 | } | ||
113 | |||
114 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
115 | { | ||
116 | init_rwsem(&REISERFS_I(inode)->i_xattr_sem); | ||
117 | } | ||
118 | |||
119 | #else | ||
120 | |||
121 | #define reiserfs_getxattr NULL | ||
122 | #define reiserfs_setxattr NULL | ||
123 | #define reiserfs_listxattr NULL | ||
124 | #define reiserfs_removexattr NULL | ||
125 | |||
126 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
127 | { | ||
128 | } | ||
129 | #endif /* CONFIG_REISERFS_FS_XATTR */ | ||
130 | |||
131 | #ifndef CONFIG_REISERFS_FS_SECURITY | ||
132 | static inline int reiserfs_security_init(struct inode *dir, | ||
133 | struct inode *inode, | ||
134 | const struct qstr *qstr, | ||
135 | struct reiserfs_security_handle *sec) | ||
136 | { | ||
137 | return 0; | ||
138 | } | ||
139 | static inline int | ||
140 | reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
141 | struct inode *inode, | ||
142 | struct reiserfs_security_handle *sec) | ||
143 | { | ||
144 | return 0; | ||
145 | } | ||
146 | static inline void reiserfs_security_free(struct reiserfs_security_handle *sec) | ||
147 | {} | ||
148 | #endif | ||
149 | |||
150 | #endif /* __KERNEL__ */ | ||
151 | |||
152 | #endif /* _LINUX_REISERFS_XATTR_H */ | ||
diff --git a/include/linux/rmi.h b/include/linux/rmi.h new file mode 100644 index 00000000000..84e121d936a --- /dev/null +++ b/include/linux/rmi.h | |||
@@ -0,0 +1,656 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Synaptics Incorporated | ||
3 | * Copyright (c) 2011 Unixphere | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | #ifndef _RMI_H | ||
20 | #define _RMI_H | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/lockdep.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/types.h> | ||
25 | #include <linux/device.h> | ||
26 | #include <linux/cdev.h> | ||
27 | #include <linux/mutex.h> | ||
28 | #include <linux/stat.h> | ||
29 | #include <linux/wait.h> | ||
30 | #include <linux/list.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | |||
33 | #ifdef CONFIG_HAS_EARLYSUSPEND | ||
34 | #include <linux/earlysuspend.h> | ||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_TOUCHSCREEN_SYN_RMI4_SPI | ||
38 | |||
39 | #define CONFIG_RMI4_BUS | ||
40 | #define CONFIG_RMI4_SPI | ||
41 | #define CONFIG_RMI4_GENERIC | ||
42 | #define CONFIG_RMI4_F09 | ||
43 | #define CONFIG_RMI4_F11 | ||
44 | #define CONFIG_RMI4_F19 | ||
45 | #define CONFIG_RMI4_F34 | ||
46 | #define CONFIG_RMI4_F54 | ||
47 | #define CONFIG_RMI4_DEV | ||
48 | |||
49 | #endif | ||
50 | |||
51 | // #define SYNAPTICS_SENSOR_POLL 1 | ||
52 | |||
53 | /* Permissions for sysfs attributes. Since the permissions policy will change | ||
54 | * on a global basis in the future, rather than edit all sysfs attrs everywhere | ||
55 | * in the driver (and risk screwing that up in the process), we use this handy | ||
56 | * set of #defines. That way when we change the policy for sysfs permissions, | ||
57 | * we only need to change them here. | ||
58 | */ | ||
59 | #define RMI_RO_ATTR S_IRUGO | ||
60 | #define RMI_RW_ATTR (S_IRUGO | S_IWUGO) | ||
61 | #define RMI_WO_ATTR S_IWUGO | ||
62 | |||
63 | #define PDT_START_SCAN_LOCATION 0x00e9 | ||
64 | |||
65 | enum rmi_irq_polarity { | ||
66 | RMI_IRQ_ACTIVE_LOW = 0, | ||
67 | RMI_IRQ_ACTIVE_HIGH = 1 | ||
68 | }; | ||
69 | |||
70 | /** | ||
71 | * struct rmi_f11_axis_alignmen - target axis alignment | ||
72 | * @swap_axes: set to TRUE if desired to swap x- and y-axis | ||
73 | * @flip_x: set to TRUE if desired to flip direction on x-axis | ||
74 | * @flip_y: set to TRUE if desired to flip direction on y-axis | ||
75 | */ | ||
76 | struct rmi_f11_2d_axis_alignment { | ||
77 | bool swap_axes; | ||
78 | bool flip_x; | ||
79 | bool flip_y; | ||
80 | int clip_X_low; | ||
81 | int clip_Y_low; | ||
82 | int clip_X_high; | ||
83 | int clip_Y_high; | ||
84 | int offset_X; | ||
85 | int offset_Y; | ||
86 | int rel_report_enabled; | ||
87 | }; | ||
88 | |||
89 | /** | ||
90 | * RMI F11 - function control register parameters | ||
91 | * Each register that has a specific bit-field setup has an accompanied | ||
92 | * register definition so that the setting can be chosen as a one-word | ||
93 | * register setting or per-bit setting. | ||
94 | */ | ||
95 | union rmi_f11_2d_ctrl0 { | ||
96 | struct { | ||
97 | u8 reporting_mode:3; | ||
98 | u8 abs_pos_filt:1; | ||
99 | u8 rel_pos_filt:1; | ||
100 | u8 rel_ballistics:1; | ||
101 | u8 dribble:1; | ||
102 | u8 report_beyond_clip:1; | ||
103 | }; | ||
104 | u8 reg; | ||
105 | }; | ||
106 | |||
107 | union rmi_f11_2d_ctrl1 { | ||
108 | struct { | ||
109 | u8 palm_detect_thres:4; | ||
110 | u8 motion_sensitivity:2; | ||
111 | u8 man_track_en:1; | ||
112 | u8 man_tracked_finger:1; | ||
113 | }; | ||
114 | u8 reg; | ||
115 | }; | ||
116 | |||
117 | union rmi_f11_2d_ctrl2__3 { | ||
118 | struct { | ||
119 | u8 delta_x_threshold:8; | ||
120 | u8 delta_y_threshold:8; | ||
121 | }; | ||
122 | u8 regs[2]; | ||
123 | }; | ||
124 | |||
125 | union rmi_f11_2d_ctrl4 { | ||
126 | struct { | ||
127 | u8 velocity:8; | ||
128 | }; | ||
129 | u8 reg; | ||
130 | }; | ||
131 | |||
132 | union rmi_f11_2d_ctrl5 { | ||
133 | struct { | ||
134 | u8 acceleration:8; | ||
135 | }; | ||
136 | u8 reg; | ||
137 | }; | ||
138 | |||
139 | union rmi_f11_2d_ctrl6__7 { | ||
140 | struct { | ||
141 | u16 sensor_max_x_pos:12; | ||
142 | }; | ||
143 | u8 regs[2]; | ||
144 | }; | ||
145 | |||
146 | union rmi_f11_2d_ctrl8__9 { | ||
147 | struct { | ||
148 | u16 sensor_max_y_pos:12; | ||
149 | }; | ||
150 | u8 regs[2]; | ||
151 | }; | ||
152 | |||
153 | union rmi_f11_2d_ctrl10 { | ||
154 | struct { | ||
155 | u8 single_tap_int_enable:1; | ||
156 | u8 tap_n_hold_int_enable:1; | ||
157 | u8 double_tap_int_enable:1; | ||
158 | u8 early_tap_int_enable:1; | ||
159 | u8 flick_int_enable:1; | ||
160 | u8 press_int_enable:1; | ||
161 | u8 pinch_int_enable:1; | ||
162 | }; | ||
163 | u8 reg; | ||
164 | }; | ||
165 | |||
166 | union rmi_f11_2d_ctrl11 { | ||
167 | struct { | ||
168 | u8 palm_detect_int_enable:1; | ||
169 | u8 rotate_int_enable:1; | ||
170 | u8 touch_shape_int_enable:1; | ||
171 | u8 scroll_zone_int_enable:1; | ||
172 | u8 multi_finger_scroll_int_enable:1; | ||
173 | }; | ||
174 | u8 reg; | ||
175 | }; | ||
176 | |||
177 | union rmi_f11_2d_ctrl12 { | ||
178 | struct { | ||
179 | u8 sensor_map:7; | ||
180 | u8 xy_sel:1; | ||
181 | }; | ||
182 | u8 reg; | ||
183 | }; | ||
184 | |||
185 | union rmi_f11_2d_ctrl14 { | ||
186 | struct { | ||
187 | u8 sens_adjustment:5; | ||
188 | u8 hyst_adjustment:3; | ||
189 | }; | ||
190 | u8 reg; | ||
191 | }; | ||
192 | |||
193 | /* The configuation is controlled as per register which means that if a register | ||
194 | * is allocated for ctrl configuration one must make sure that all the bits are | ||
195 | * set accordingly for that particular register. | ||
196 | */ | ||
197 | struct rmi_f11_2d_ctrl { | ||
198 | union rmi_f11_2d_ctrl0 *ctrl0; | ||
199 | union rmi_f11_2d_ctrl1 *ctrl1; | ||
200 | union rmi_f11_2d_ctrl2__3 *ctrl2__3; | ||
201 | union rmi_f11_2d_ctrl4 *ctrl4; | ||
202 | union rmi_f11_2d_ctrl5 *ctrl5; | ||
203 | union rmi_f11_2d_ctrl6__7 *ctrl6__7; | ||
204 | union rmi_f11_2d_ctrl8__9 *ctrl8__9; | ||
205 | union rmi_f11_2d_ctrl10 *ctrl10; | ||
206 | union rmi_f11_2d_ctrl11 *ctrl11; | ||
207 | union rmi_f11_2d_ctrl12 *ctrl12; | ||
208 | u8 ctrl12_size; | ||
209 | union rmi_f11_2d_ctrl14 *ctrl14; | ||
210 | u8 *ctrl15; | ||
211 | u8 *ctrl16; | ||
212 | u8 *ctrl17; | ||
213 | u8 *ctrl18; | ||
214 | u8 *ctrl19; | ||
215 | }; | ||
216 | |||
217 | struct rmi_f19_button_map { | ||
218 | unsigned char nbuttons; | ||
219 | unsigned char *map; | ||
220 | }; | ||
221 | |||
222 | struct rmi_device_platform_data_spi { | ||
223 | int block_delay_us; | ||
224 | int split_read_block_delay_us; | ||
225 | int read_delay_us; | ||
226 | int write_delay_us; | ||
227 | int split_read_byte_delay_us; | ||
228 | int pre_delay_us; | ||
229 | int post_delay_us; | ||
230 | |||
231 | void *cs_assert_data; | ||
232 | int (*cs_assert) (const void *cs_assert_data, const bool assert); | ||
233 | }; | ||
234 | |||
235 | struct rmi_device_platform_data { | ||
236 | char *driver_name; | ||
237 | |||
238 | int irq; | ||
239 | enum rmi_irq_polarity irq_polarity; | ||
240 | int (*gpio_config)(void *gpio_data, bool configure); | ||
241 | |||
242 | struct rmi_device_platform_data_spi spi_data; | ||
243 | |||
244 | /* function handler pdata */ | ||
245 | struct rmi_f11_2d_ctrl *f11_ctrl; | ||
246 | struct rmi_f11_2d_axis_alignment axis_align; | ||
247 | struct rmi_f19_button_map *button_map; | ||
248 | |||
249 | #ifdef CONFIG_PM | ||
250 | void *pm_data; | ||
251 | int (*pre_suspend) (const void *pm_data); | ||
252 | int (*post_resume) (const void *pm_data); | ||
253 | #endif | ||
254 | }; | ||
255 | |||
256 | /** | ||
257 | * struct rmi_function_descriptor - RMI function base addresses | ||
258 | * @query_base_addr: The RMI Query base address | ||
259 | * @command_base_addr: The RMI Command base address | ||
260 | * @control_base_addr: The RMI Control base address | ||
261 | * @data_base_addr: The RMI Data base address | ||
262 | * @interrupt_source_count: The number of irqs this RMI function needs | ||
263 | * @function_number: The RMI function number | ||
264 | * | ||
265 | * This struct is used when iterating the Page Description Table. The addresses | ||
266 | * are 16-bit values to include the current page address. | ||
267 | * | ||
268 | */ | ||
269 | struct rmi_function_descriptor { | ||
270 | u16 query_base_addr; | ||
271 | u16 command_base_addr; | ||
272 | u16 control_base_addr; | ||
273 | u16 data_base_addr; | ||
274 | u8 interrupt_source_count; | ||
275 | u8 function_number; | ||
276 | u8 function_version; | ||
277 | }; | ||
278 | |||
279 | struct rmi_function_container; | ||
280 | struct rmi_device; | ||
281 | |||
282 | /** | ||
283 | * struct rmi_function_handler - an RMI function handler | ||
284 | * @func: The RMI function number | ||
285 | * @init: Callback for RMI function init | ||
286 | * @attention: Callback for RMI function attention | ||
287 | * @suspend: Callback for function suspend, returns 0 for success. | ||
288 | * @resume: Callback for RMI function resume, returns 0 for success. | ||
289 | * @remove: Callback for RMI function removal | ||
290 | * | ||
291 | * This struct describes the interface of an RMI function. These are | ||
292 | * registered to the bus using the rmi_register_function_driver() call. | ||
293 | * | ||
294 | */ | ||
295 | struct rmi_function_handler { | ||
296 | int func; | ||
297 | int (*init)(struct rmi_function_container *fc); | ||
298 | int (*attention)(struct rmi_function_container *fc, u8 *irq_bits); | ||
299 | #ifdef CONFIG_PM | ||
300 | int (*suspend)(struct rmi_function_container *fc); | ||
301 | int (*resume)(struct rmi_function_container *fc); | ||
302 | #endif | ||
303 | void (*remove)(struct rmi_function_container *fc); | ||
304 | }; | ||
305 | |||
306 | /** | ||
307 | * struct rmi_function_device - represent an RMI function device | ||
308 | * @dev: The device created | ||
309 | * | ||
310 | * The RMI function device implements the "psuedo" device that represents | ||
311 | * an RMI4 function like function 0x11, function 0x34, etc. and is really | ||
312 | * a placeholder to be able to create sysfs attributes for each function | ||
313 | * in order to facilitate communication between user code and RMI4 functions. | ||
314 | * | ||
315 | */ | ||
316 | struct rmi_function_device { | ||
317 | struct device dev; | ||
318 | }; | ||
319 | |||
320 | /** | ||
321 | * struct rmi_function_container - an element in a function handler list | ||
322 | * @list: The list | ||
323 | * @fd: The function descriptor of the RMI function | ||
324 | * @rmi_dev: Pointer to the RMI device associated with this function container | ||
325 | * @fh: The callbacks connected to this function | ||
326 | * @num_of_irqs: The number of irqs needed by this function | ||
327 | * @irq_pos: The position in the irq bitfield this function holds | ||
328 | * @data: Private data pointer | ||
329 | * | ||
330 | */ | ||
331 | struct rmi_function_container { | ||
332 | struct list_head list; | ||
333 | |||
334 | struct rmi_function_descriptor fd; | ||
335 | struct rmi_device *rmi_dev; | ||
336 | struct rmi_function_handler *fh; | ||
337 | struct device dev; | ||
338 | |||
339 | int num_of_irqs; | ||
340 | int irq_pos; | ||
341 | u8 *irq_mask; | ||
342 | |||
343 | void *data; | ||
344 | }; | ||
345 | #define to_rmi_function_container(d) \ | ||
346 | container_of(d, struct rmi_function_container, dev); | ||
347 | #define to_rmi_function_device(d) \ | ||
348 | container_of(d, struct rmi_function_device, dev); | ||
349 | |||
350 | |||
351 | #ifdef CONFIG_RMI4_DEV | ||
352 | |||
353 | #define RMI_CHAR_DEV_TMPBUF_SZ 128 | ||
354 | #define RMI_REG_ADDR_PAGE_SELECT 0xFF | ||
355 | |||
356 | struct rmi_char_dev { | ||
357 | /* mutex for file operation*/ | ||
358 | struct mutex mutex_file_op; | ||
359 | /* main char dev structure */ | ||
360 | struct cdev main_dev; | ||
361 | |||
362 | /* register address for RMI protocol */ | ||
363 | /* filp->f_pos */ | ||
364 | |||
365 | /* pointer to the corresponding phys device info for this sensor */ | ||
366 | /* The phys device has the pointers to read, write, etc. */ | ||
367 | struct rmi_phys_device *phys; | ||
368 | /* reference count */ | ||
369 | int ref_count; | ||
370 | }; | ||
371 | |||
372 | int rmi_char_dev_register(struct rmi_phys_device *phys); | ||
373 | void rmi_char_dev_unregister(struct rmi_phys_device *phys); | ||
374 | |||
375 | #endif /*CONFIG_RMI4_DEV*/ | ||
376 | |||
377 | |||
378 | |||
379 | /** | ||
380 | * struct rmi_driver - represents an RMI driver | ||
381 | * @driver: Device driver model driver | ||
382 | * @probe: Callback for device probe | ||
383 | * @remove: Callback for device removal | ||
384 | * @shutdown: Callback for device shutdown | ||
385 | * @irq_handler: Callback for handling irqs | ||
386 | * @fh_add: Callback for function handler add | ||
387 | * @fh_remove: Callback for function handler remove | ||
388 | * @get_func_irq_mask: Callback for calculating interrupt mask | ||
389 | * @store_irq_mask: Callback for storing and replacing interrupt mask | ||
390 | * @restore_irq_mask: Callback for restoring previously stored interrupt mask | ||
391 | * @data: Private data pointer | ||
392 | * | ||
393 | * The RMI driver implements a driver on the RMI bus. | ||
394 | * | ||
395 | */ | ||
396 | struct rmi_driver { | ||
397 | struct device_driver driver; | ||
398 | |||
399 | int (*probe)(struct rmi_device *rmi_dev); | ||
400 | int (*remove)(struct rmi_device *rmi_dev); | ||
401 | void (*shutdown)(struct rmi_device *rmi_dev); | ||
402 | int (*irq_handler)(struct rmi_device *rmi_dev, int irq); | ||
403 | void (*fh_add)(struct rmi_device *rmi_dev, | ||
404 | struct rmi_function_handler *fh); | ||
405 | void (*fh_remove)(struct rmi_device *rmi_dev, | ||
406 | struct rmi_function_handler *fh); | ||
407 | u8* (*get_func_irq_mask)(struct rmi_device *rmi_dev, | ||
408 | struct rmi_function_container *fc); | ||
409 | int (*store_irq_mask)(struct rmi_device *rmi_dev, u8* new_interupts); | ||
410 | int (*restore_irq_mask)(struct rmi_device *rmi_dev); | ||
411 | void *data; | ||
412 | }; | ||
413 | #define to_rmi_driver(d) \ | ||
414 | container_of(d, struct rmi_driver, driver); | ||
415 | |||
416 | /** struct rmi_phys_info - diagnostic information about the RMI physical | ||
417 | * device, used in the phys sysfs file. | ||
418 | * @proto String indicating the protocol being used. | ||
419 | * @tx_count Number of transmit operations. | ||
420 | * @tx_bytes Number of bytes transmitted. | ||
421 | * @tx_errs Number of errors encountered during transmit operations. | ||
422 | * @rx_count Number of receive operations. | ||
423 | * @rx_bytes Number of bytes received. | ||
424 | * @rx_errs Number of errors encountered during receive operations. | ||
425 | * @att_count Number of times ATTN assertions have been handled. | ||
426 | */ | ||
427 | struct rmi_phys_info { | ||
428 | char *proto; | ||
429 | long tx_count; | ||
430 | long tx_bytes; | ||
431 | long tx_errs; | ||
432 | long rx_count; | ||
433 | long rx_bytes; | ||
434 | long rx_errs; | ||
435 | long attn_count; | ||
436 | }; | ||
437 | |||
438 | /** | ||
439 | * struct rmi_phys_device - represent an RMI physical device | ||
440 | * @dev: Pointer to the communication device, e.g. i2c or spi | ||
441 | * @rmi_dev: Pointer to the RMI device | ||
442 | * @write: Callback for write | ||
443 | * @write_block: Callback for writing a block of data | ||
444 | * @read: Callback for read | ||
445 | * @read_block: Callback for reading a block of data | ||
446 | * @data: Private data pointer | ||
447 | * | ||
448 | * The RMI physical device implements the glue between different communication | ||
449 | * buses such as I2C and SPI. | ||
450 | * | ||
451 | */ | ||
452 | struct rmi_phys_device { | ||
453 | struct device *dev; | ||
454 | struct rmi_device *rmi_dev; | ||
455 | |||
456 | int (*write)(struct rmi_phys_device *phys, u16 addr, u8 data); | ||
457 | int (*write_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf, | ||
458 | int len); | ||
459 | int (*read)(struct rmi_phys_device *phys, u16 addr, u8 *buf); | ||
460 | int (*read_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf, | ||
461 | int len); | ||
462 | |||
463 | int (*enable_device) (struct rmi_phys_device *phys); | ||
464 | void (*disable_device) (struct rmi_phys_device *phys); | ||
465 | |||
466 | void *data; | ||
467 | |||
468 | struct rmi_phys_info info; | ||
469 | |||
470 | #ifdef CONFIG_RMI4_DEV | ||
471 | /* pointer to attention char device and char device */ | ||
472 | struct rmi_char_dev *char_dev; | ||
473 | struct class *rmi_char_device_class; | ||
474 | #endif /*CONFIG_RMI4_DEV*/ | ||
475 | }; | ||
476 | |||
477 | /** | ||
478 | * struct rmi_device - represents an RMI device | ||
479 | * @dev: The device created for the RMI bus | ||
480 | * @driver: Pointer to associated driver | ||
481 | * @phys: Pointer to the physical interface | ||
482 | * @early_suspend_handler: Pointers to early_suspend and late_resume, if | ||
483 | * configured. | ||
484 | * | ||
485 | * This structs represent an RMI device. | ||
486 | * | ||
487 | */ | ||
488 | struct rmi_device { | ||
489 | struct device dev; | ||
490 | |||
491 | struct rmi_driver *driver; | ||
492 | struct rmi_phys_device *phys; | ||
493 | |||
494 | #ifdef CONFIG_HAS_EARLYSUSPEND | ||
495 | struct early_suspend early_suspend_handler; | ||
496 | #endif | ||
497 | }; | ||
498 | #define to_rmi_device(d) container_of(d, struct rmi_device, dev); | ||
499 | #define to_rmi_platform_data(d) ((d)->phys->dev->platform_data); | ||
500 | |||
501 | static inline void rmi_set_driverdata(struct rmi_device *d, void *data) | ||
502 | { | ||
503 | dev_set_drvdata(&d->dev, data); | ||
504 | } | ||
505 | |||
506 | static inline void *rmi_get_driverdata(struct rmi_device *d) | ||
507 | { | ||
508 | return dev_get_drvdata(&d->dev); | ||
509 | } | ||
510 | |||
511 | /** | ||
512 | * rmi_read - RMI read byte | ||
513 | * @d: Pointer to an RMI device | ||
514 | * @addr: The address to read from | ||
515 | * @buf: The read buffer | ||
516 | * | ||
517 | * Reads a byte of data using the underlaying physical protocol in to buf. It | ||
518 | * returns zero or a negative error code. | ||
519 | */ | ||
520 | static inline int rmi_read(struct rmi_device *d, u16 addr, u8 *buf) | ||
521 | { | ||
522 | return d->phys->read(d->phys, addr, buf); | ||
523 | } | ||
524 | |||
525 | /** | ||
526 | * rmi_read_block - RMI read block | ||
527 | * @d: Pointer to an RMI device | ||
528 | * @addr: The start address to read from | ||
529 | * @buf: The read buffer | ||
530 | * @len: Length of the read buffer | ||
531 | * | ||
532 | * Reads a block of byte data using the underlaying physical protocol in to buf. | ||
533 | * It returns the amount of bytes read or a negative error code. | ||
534 | */ | ||
535 | static inline int rmi_read_block(struct rmi_device *d, u16 addr, u8 *buf, | ||
536 | int len) | ||
537 | { | ||
538 | return d->phys->read_block(d->phys, addr, buf, len); | ||
539 | } | ||
540 | |||
541 | /** | ||
542 | * rmi_write - RMI write byte | ||
543 | * @d: Pointer to an RMI device | ||
544 | * @addr: The address to write to | ||
545 | * @data: The data to write | ||
546 | * | ||
547 | * Writes a byte from buf using the underlaying physical protocol. It | ||
548 | * returns zero or a negative error code. | ||
549 | */ | ||
550 | static inline int rmi_write(struct rmi_device *d, u16 addr, u8 data) | ||
551 | { | ||
552 | return d->phys->write(d->phys, addr, data); | ||
553 | } | ||
554 | |||
555 | /** | ||
556 | * rmi_write_block - RMI write block | ||
557 | * @d: Pointer to an RMI device | ||
558 | * @addr: The start address to write to | ||
559 | * @buf: The write buffer | ||
560 | * @len: Length of the write buffer | ||
561 | * | ||
562 | * Writes a block of byte data from buf using the underlaying physical protocol. | ||
563 | * It returns the amount of bytes written or a negative error code. | ||
564 | */ | ||
565 | static inline int rmi_write_block(struct rmi_device *d, u16 addr, u8 *buf, | ||
566 | int len) | ||
567 | { | ||
568 | return d->phys->write_block(d->phys, addr, buf, len); | ||
569 | } | ||
570 | |||
571 | /** | ||
572 | * rmi_register_driver - register rmi driver | ||
573 | * @driver: the driver to register | ||
574 | * | ||
575 | * This function registers an RMI driver to the RMI bus. | ||
576 | */ | ||
577 | int rmi_register_driver(struct rmi_driver *driver); | ||
578 | |||
579 | /** | ||
580 | * rmi_unregister_driver - unregister rmi driver | ||
581 | * @driver: the driver to unregister | ||
582 | * | ||
583 | * This function unregisters an RMI driver to the RMI bus. | ||
584 | */ | ||
585 | void rmi_unregister_driver(struct rmi_driver *driver); | ||
586 | |||
587 | /** | ||
588 | * rmi_register_phys_device - register a physical device connection | ||
589 | * @phys: the physical driver to register | ||
590 | * | ||
591 | * This function registers a physical driver to the RMI bus. These drivers | ||
592 | * provide a communication layer for the drivers connected to the bus, e.g. | ||
593 | * I2C, SPI and so on. | ||
594 | */ | ||
595 | int rmi_register_phys_device(struct rmi_phys_device *phys); | ||
596 | |||
597 | /** | ||
598 | * rmi_unregister_phys_device - unregister a physical device connection | ||
599 | * @phys: the physical driver to unregister | ||
600 | * | ||
601 | * This function unregisters a physical driver from the RMI bus. | ||
602 | */ | ||
603 | void rmi_unregister_phys_device(struct rmi_phys_device *phys); | ||
604 | |||
605 | /** | ||
606 | * rmi_register_function_driver - register an RMI function driver | ||
607 | * @fh: the function handler to register | ||
608 | * | ||
609 | * This function registers support for a new RMI function to the bus. All | ||
610 | * drivers on the bus will be notified of the presence of the new function | ||
611 | * driver. | ||
612 | */ | ||
613 | int rmi_register_function_driver(struct rmi_function_handler *fh); | ||
614 | |||
615 | /** | ||
616 | * rmi_unregister_function_driver - unregister an RMI function driver | ||
617 | * @fh: the function handler to unregister | ||
618 | * | ||
619 | * This function unregisters a RMI function from the RMI bus. All drivers on | ||
620 | * the bus will be notified of the removal of a function driver. | ||
621 | */ | ||
622 | void rmi_unregister_function_driver(struct rmi_function_handler *fh); | ||
623 | |||
624 | /** | ||
625 | * rmi_get_function_handler - get a pointer to specified RMI function | ||
626 | * @id: the RMI function id | ||
627 | * | ||
628 | * This function gets the specified RMI function handler from the list of | ||
629 | * supported functions. | ||
630 | */ | ||
631 | struct rmi_function_handler *rmi_get_function_handler(int id); | ||
632 | |||
633 | /* Utility routine to handle writes to read-only attributes. Hopefully | ||
634 | * this will never happen, but if the user does something stupid, we | ||
635 | * don't want to accept it quietly. | ||
636 | */ | ||
637 | ssize_t rmi_store_error(struct device *dev, | ||
638 | struct device_attribute *attr, | ||
639 | const char *buf, size_t count); | ||
640 | |||
641 | /* Utility routine to handle reads to write-only attributes. Hopefully | ||
642 | * this will never happen, but if the user does something stupid, we | ||
643 | * don't want to accept it quietly. | ||
644 | */ | ||
645 | ssize_t rmi_show_error(struct device *dev, | ||
646 | struct device_attribute *attr, | ||
647 | char *buf); | ||
648 | |||
649 | /* utility function for bit access of u8*'s */ | ||
650 | void u8_set_bit(u8 *target, int pos); | ||
651 | void u8_clear_bit(u8 *target, int pos); | ||
652 | bool u8_is_set(u8 *target, int pos); | ||
653 | bool u8_is_any_set(u8 *target, int size); | ||
654 | void u8_or(u8 *dest, u8* target1, u8* target2, int size); | ||
655 | void u8_and(u8 *dest, u8* target1, u8* target2, int size); | ||
656 | #endif | ||
diff --git a/include/linux/romfs_fs.h b/include/linux/romfs_fs.h new file mode 100644 index 00000000000..5f57f93b284 --- /dev/null +++ b/include/linux/romfs_fs.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef __LINUX_ROMFS_FS_H | ||
2 | #define __LINUX_ROMFS_FS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/fs.h> | ||
6 | |||
7 | /* The basic structures of the romfs filesystem */ | ||
8 | |||
9 | #define ROMBSIZE BLOCK_SIZE | ||
10 | #define ROMBSBITS BLOCK_SIZE_BITS | ||
11 | #define ROMBMASK (ROMBSIZE-1) | ||
12 | #define ROMFS_MAGIC 0x7275 | ||
13 | |||
14 | #define ROMFS_MAXFN 128 | ||
15 | |||
16 | #define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) | ||
17 | #define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) | ||
18 | #define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d))) | ||
19 | #define ROMSB_WORD0 __mk4('-','r','o','m') | ||
20 | #define ROMSB_WORD1 __mk4('1','f','s','-') | ||
21 | |||
22 | /* On-disk "super block" */ | ||
23 | |||
24 | struct romfs_super_block { | ||
25 | __be32 word0; | ||
26 | __be32 word1; | ||
27 | __be32 size; | ||
28 | __be32 checksum; | ||
29 | char name[0]; /* volume name */ | ||
30 | }; | ||
31 | |||
32 | /* On disk inode */ | ||
33 | |||
34 | struct romfs_inode { | ||
35 | __be32 next; /* low 4 bits see ROMFH_ */ | ||
36 | __be32 spec; | ||
37 | __be32 size; | ||
38 | __be32 checksum; | ||
39 | char name[0]; | ||
40 | }; | ||
41 | |||
42 | #define ROMFH_TYPE 7 | ||
43 | #define ROMFH_HRD 0 | ||
44 | #define ROMFH_DIR 1 | ||
45 | #define ROMFH_REG 2 | ||
46 | #define ROMFH_SYM 3 | ||
47 | #define ROMFH_BLK 4 | ||
48 | #define ROMFH_CHR 5 | ||
49 | #define ROMFH_SCK 6 | ||
50 | #define ROMFH_FIF 7 | ||
51 | #define ROMFH_EXEC 8 | ||
52 | |||
53 | /* Alignment */ | ||
54 | |||
55 | #define ROMFH_SIZE 16 | ||
56 | #define ROMFH_PAD (ROMFH_SIZE-1) | ||
57 | #define ROMFH_MASK (~ROMFH_PAD) | ||
58 | |||
59 | #endif | ||
diff --git a/include/linux/rose.h b/include/linux/rose.h new file mode 100644 index 00000000000..c7b4b184c82 --- /dev/null +++ b/include/linux/rose.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * These are the public elements of the Linux kernel Rose implementation. | ||
3 | * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the | ||
4 | * definition of the ax25_address structure. | ||
5 | */ | ||
6 | |||
7 | #ifndef ROSE_KERNEL_H | ||
8 | #define ROSE_KERNEL_H | ||
9 | |||
10 | #define ROSE_MTU 251 | ||
11 | |||
12 | #define ROSE_MAX_DIGIS 6 | ||
13 | |||
14 | #define ROSE_DEFER 1 | ||
15 | #define ROSE_T1 2 | ||
16 | #define ROSE_T2 3 | ||
17 | #define ROSE_T3 4 | ||
18 | #define ROSE_IDLE 5 | ||
19 | #define ROSE_QBITINCL 6 | ||
20 | #define ROSE_HOLDBACK 7 | ||
21 | |||
22 | #define SIOCRSGCAUSE (SIOCPROTOPRIVATE+0) | ||
23 | #define SIOCRSSCAUSE (SIOCPROTOPRIVATE+1) | ||
24 | #define SIOCRSL2CALL (SIOCPROTOPRIVATE+2) | ||
25 | #define SIOCRSSL2CALL (SIOCPROTOPRIVATE+2) | ||
26 | #define SIOCRSACCEPT (SIOCPROTOPRIVATE+3) | ||
27 | #define SIOCRSCLRRT (SIOCPROTOPRIVATE+4) | ||
28 | #define SIOCRSGL2CALL (SIOCPROTOPRIVATE+5) | ||
29 | #define SIOCRSGFACILITIES (SIOCPROTOPRIVATE+6) | ||
30 | |||
31 | #define ROSE_DTE_ORIGINATED 0x00 | ||
32 | #define ROSE_NUMBER_BUSY 0x01 | ||
33 | #define ROSE_INVALID_FACILITY 0x03 | ||
34 | #define ROSE_NETWORK_CONGESTION 0x05 | ||
35 | #define ROSE_OUT_OF_ORDER 0x09 | ||
36 | #define ROSE_ACCESS_BARRED 0x0B | ||
37 | #define ROSE_NOT_OBTAINABLE 0x0D | ||
38 | #define ROSE_REMOTE_PROCEDURE 0x11 | ||
39 | #define ROSE_LOCAL_PROCEDURE 0x13 | ||
40 | #define ROSE_SHIP_ABSENT 0x39 | ||
41 | |||
42 | typedef struct { | ||
43 | char rose_addr[5]; | ||
44 | } rose_address; | ||
45 | |||
46 | struct sockaddr_rose { | ||
47 | sa_family_t srose_family; | ||
48 | rose_address srose_addr; | ||
49 | ax25_address srose_call; | ||
50 | int srose_ndigis; | ||
51 | ax25_address srose_digi; | ||
52 | }; | ||
53 | |||
54 | struct full_sockaddr_rose { | ||
55 | sa_family_t srose_family; | ||
56 | rose_address srose_addr; | ||
57 | ax25_address srose_call; | ||
58 | unsigned int srose_ndigis; | ||
59 | ax25_address srose_digis[ROSE_MAX_DIGIS]; | ||
60 | }; | ||
61 | |||
62 | struct rose_route_struct { | ||
63 | rose_address address; | ||
64 | unsigned short mask; | ||
65 | ax25_address neighbour; | ||
66 | char device[16]; | ||
67 | unsigned char ndigis; | ||
68 | ax25_address digipeaters[AX25_MAX_DIGIS]; | ||
69 | }; | ||
70 | |||
71 | struct rose_cause_struct { | ||
72 | unsigned char cause; | ||
73 | unsigned char diagnostic; | ||
74 | }; | ||
75 | |||
76 | struct rose_facilities_struct { | ||
77 | rose_address source_addr, dest_addr; | ||
78 | ax25_address source_call, dest_call; | ||
79 | unsigned char source_ndigis, dest_ndigis; | ||
80 | ax25_address source_digis[ROSE_MAX_DIGIS]; | ||
81 | ax25_address dest_digis[ROSE_MAX_DIGIS]; | ||
82 | unsigned int rand; | ||
83 | rose_address fail_addr; | ||
84 | ax25_address fail_call; | ||
85 | }; | ||
86 | |||
87 | #endif | ||
diff --git a/include/linux/route.h b/include/linux/route.h new file mode 100644 index 00000000000..6600708311c --- /dev/null +++ b/include/linux/route.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Global definitions for the IP router interface. | ||
7 | * | ||
8 | * Version: @(#)route.h 1.0.3 05/27/93 | ||
9 | * | ||
10 | * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 | ||
11 | * for the purposes of compatibility only. | ||
12 | * | ||
13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
14 | * | ||
15 | * Changes: | ||
16 | * Mike McLagan : Routing by source | ||
17 | * | ||
18 | * This program is free software; you can redistribute it and/or | ||
19 | * modify it under the terms of the GNU General Public License | ||
20 | * as published by the Free Software Foundation; either version | ||
21 | * 2 of the License, or (at your option) any later version. | ||
22 | */ | ||
23 | #ifndef _LINUX_ROUTE_H | ||
24 | #define _LINUX_ROUTE_H | ||
25 | |||
26 | #include <linux/if.h> | ||
27 | #include <linux/compiler.h> | ||
28 | |||
29 | /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ | ||
30 | struct rtentry { | ||
31 | unsigned long rt_pad1; | ||
32 | struct sockaddr rt_dst; /* target address */ | ||
33 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ | ||
34 | struct sockaddr rt_genmask; /* target network mask (IP) */ | ||
35 | unsigned short rt_flags; | ||
36 | short rt_pad2; | ||
37 | unsigned long rt_pad3; | ||
38 | void *rt_pad4; | ||
39 | short rt_metric; /* +1 for binary compatibility! */ | ||
40 | char __user *rt_dev; /* forcing the device at add */ | ||
41 | unsigned long rt_mtu; /* per route MTU/Window */ | ||
42 | #ifndef __KERNEL__ | ||
43 | #define rt_mss rt_mtu /* Compatibility :-( */ | ||
44 | #endif | ||
45 | unsigned long rt_window; /* Window clamping */ | ||
46 | unsigned short rt_irtt; /* Initial RTT */ | ||
47 | }; | ||
48 | |||
49 | |||
50 | #define RTF_UP 0x0001 /* route usable */ | ||
51 | #define RTF_GATEWAY 0x0002 /* destination is a gateway */ | ||
52 | #define RTF_HOST 0x0004 /* host entry (net otherwise) */ | ||
53 | #define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ | ||
54 | #define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ | ||
55 | #define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */ | ||
56 | #define RTF_MTU 0x0040 /* specific MTU for this route */ | ||
57 | #define RTF_MSS RTF_MTU /* Compatibility :-( */ | ||
58 | #define RTF_WINDOW 0x0080 /* per route window clamping */ | ||
59 | #define RTF_IRTT 0x0100 /* Initial round trip time */ | ||
60 | #define RTF_REJECT 0x0200 /* Reject route */ | ||
61 | |||
62 | /* | ||
63 | * <linux/ipv6_route.h> uses RTF values >= 64k | ||
64 | */ | ||
65 | |||
66 | |||
67 | |||
68 | #endif /* _LINUX_ROUTE_H */ | ||
69 | |||
diff --git a/include/linux/sc26198.h b/include/linux/sc26198.h new file mode 100644 index 00000000000..7ca35abad38 --- /dev/null +++ b/include/linux/sc26198.h | |||
@@ -0,0 +1,533 @@ | |||
1 | /*****************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * sc26198.h -- SC26198 UART hardware info. | ||
5 | * | ||
6 | * Copyright (C) 1995-1998 Stallion Technologies | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | /*****************************************************************************/ | ||
24 | #ifndef _SC26198_H | ||
25 | #define _SC26198_H | ||
26 | /*****************************************************************************/ | ||
27 | |||
28 | /* | ||
29 | * Define the number of async ports per sc26198 uart device. | ||
30 | */ | ||
31 | #define SC26198_PORTS 8 | ||
32 | |||
33 | /* | ||
34 | * Baud rate timing clocks. All derived from a master 14.7456 MHz clock. | ||
35 | */ | ||
36 | #define SC26198_MASTERCLOCK 14745600L | ||
37 | #define SC26198_DCLK (SC26198_MASTERCLOCK) | ||
38 | #define SC26198_CCLK (SC26198_MASTERCLOCK / 2) | ||
39 | #define SC26198_BCLK (SC26198_MASTERCLOCK / 4) | ||
40 | |||
41 | /* | ||
42 | * Define internal FIFO sizes for the 26198 ports. | ||
43 | */ | ||
44 | #define SC26198_TXFIFOSIZE 16 | ||
45 | #define SC26198_RXFIFOSIZE 16 | ||
46 | |||
47 | /*****************************************************************************/ | ||
48 | |||
49 | /* | ||
50 | * Global register definitions. These registers are global to each 26198 | ||
51 | * device, not specific ports on it. | ||
52 | */ | ||
53 | #define TSTR 0x0d | ||
54 | #define GCCR 0x0f | ||
55 | #define ICR 0x1b | ||
56 | #define WDTRCR 0x1d | ||
57 | #define IVR 0x1f | ||
58 | #define BRGTRUA 0x84 | ||
59 | #define GPOSR 0x87 | ||
60 | #define GPOC 0x8b | ||
61 | #define UCIR 0x8c | ||
62 | #define CIR 0x8c | ||
63 | #define BRGTRUB 0x8d | ||
64 | #define GRXFIFO 0x8e | ||
65 | #define GTXFIFO 0x8e | ||
66 | #define GCCR2 0x8f | ||
67 | #define BRGTRLA 0x94 | ||
68 | #define GPOR 0x97 | ||
69 | #define GPOD 0x9b | ||
70 | #define BRGTCR 0x9c | ||
71 | #define GICR 0x9c | ||
72 | #define BRGTRLB 0x9d | ||
73 | #define GIBCR 0x9d | ||
74 | #define GITR 0x9f | ||
75 | |||
76 | /* | ||
77 | * Per port channel registers. These are the register offsets within | ||
78 | * the port address space, so need to have the port address (0 to 7) | ||
79 | * inserted in bit positions 4:6. | ||
80 | */ | ||
81 | #define MR0 0x00 | ||
82 | #define MR1 0x01 | ||
83 | #define IOPCR 0x02 | ||
84 | #define BCRBRK 0x03 | ||
85 | #define BCRCOS 0x04 | ||
86 | #define BCRX 0x06 | ||
87 | #define BCRA 0x07 | ||
88 | #define XONCR 0x08 | ||
89 | #define XOFFCR 0x09 | ||
90 | #define ARCR 0x0a | ||
91 | #define RXCSR 0x0c | ||
92 | #define TXCSR 0x0e | ||
93 | #define MR2 0x80 | ||
94 | #define SR 0x81 | ||
95 | #define SCCR 0x81 | ||
96 | #define ISR 0x82 | ||
97 | #define IMR 0x82 | ||
98 | #define TXFIFO 0x83 | ||
99 | #define RXFIFO 0x83 | ||
100 | #define IPR 0x84 | ||
101 | #define IOPIOR 0x85 | ||
102 | #define XISR 0x86 | ||
103 | |||
104 | /* | ||
105 | * For any given port calculate the address to use to access a specified | ||
106 | * register. This is only used for unusual access, mostly this is done | ||
107 | * through the assembler access routines. | ||
108 | */ | ||
109 | #define SC26198_PORTREG(port,reg) ((((port) & 0x07) << 4) | (reg)) | ||
110 | |||
111 | /*****************************************************************************/ | ||
112 | |||
113 | /* | ||
114 | * Global configuration control register bit definitions. | ||
115 | */ | ||
116 | #define GCCR_NOACK 0x00 | ||
117 | #define GCCR_IVRACK 0x02 | ||
118 | #define GCCR_IVRCHANACK 0x04 | ||
119 | #define GCCR_IVRTYPCHANACK 0x06 | ||
120 | #define GCCR_ASYNCCYCLE 0x00 | ||
121 | #define GCCR_SYNCCYCLE 0x40 | ||
122 | |||
123 | /*****************************************************************************/ | ||
124 | |||
125 | /* | ||
126 | * Mode register 0 bit definitions. | ||
127 | */ | ||
128 | #define MR0_ADDRNONE 0x00 | ||
129 | #define MR0_AUTOWAKE 0x01 | ||
130 | #define MR0_AUTODOZE 0x02 | ||
131 | #define MR0_AUTOWAKEDOZE 0x03 | ||
132 | #define MR0_SWFNONE 0x00 | ||
133 | #define MR0_SWFTX 0x04 | ||
134 | #define MR0_SWFRX 0x08 | ||
135 | #define MR0_SWFRXTX 0x0c | ||
136 | #define MR0_TXMASK 0x30 | ||
137 | #define MR0_TXEMPTY 0x00 | ||
138 | #define MR0_TXHIGH 0x10 | ||
139 | #define MR0_TXHALF 0x20 | ||
140 | #define MR0_TXRDY 0x00 | ||
141 | #define MR0_ADDRNT 0x00 | ||
142 | #define MR0_ADDRT 0x40 | ||
143 | #define MR0_SWFNT 0x00 | ||
144 | #define MR0_SWFT 0x80 | ||
145 | |||
146 | /* | ||
147 | * Mode register 1 bit definitions. | ||
148 | */ | ||
149 | #define MR1_CS5 0x00 | ||
150 | #define MR1_CS6 0x01 | ||
151 | #define MR1_CS7 0x02 | ||
152 | #define MR1_CS8 0x03 | ||
153 | #define MR1_PAREVEN 0x00 | ||
154 | #define MR1_PARODD 0x04 | ||
155 | #define MR1_PARENB 0x00 | ||
156 | #define MR1_PARFORCE 0x08 | ||
157 | #define MR1_PARNONE 0x10 | ||
158 | #define MR1_PARSPECIAL 0x18 | ||
159 | #define MR1_ERRCHAR 0x00 | ||
160 | #define MR1_ERRBLOCK 0x20 | ||
161 | #define MR1_ISRUNMASKED 0x00 | ||
162 | #define MR1_ISRMASKED 0x40 | ||
163 | #define MR1_AUTORTS 0x80 | ||
164 | |||
165 | /* | ||
166 | * Mode register 2 bit definitions. | ||
167 | */ | ||
168 | #define MR2_STOP1 0x00 | ||
169 | #define MR2_STOP15 0x01 | ||
170 | #define MR2_STOP2 0x02 | ||
171 | #define MR2_STOP916 0x03 | ||
172 | #define MR2_RXFIFORDY 0x00 | ||
173 | #define MR2_RXFIFOHALF 0x04 | ||
174 | #define MR2_RXFIFOHIGH 0x08 | ||
175 | #define MR2_RXFIFOFULL 0x0c | ||
176 | #define MR2_AUTOCTS 0x10 | ||
177 | #define MR2_TXRTS 0x20 | ||
178 | #define MR2_MODENORM 0x00 | ||
179 | #define MR2_MODEAUTOECHO 0x40 | ||
180 | #define MR2_MODELOOP 0x80 | ||
181 | #define MR2_MODEREMECHO 0xc0 | ||
182 | |||
183 | /*****************************************************************************/ | ||
184 | |||
185 | /* | ||
186 | * Baud Rate Generator (BRG) selector values. | ||
187 | */ | ||
188 | #define BRG_50 0x00 | ||
189 | #define BRG_75 0x01 | ||
190 | #define BRG_150 0x02 | ||
191 | #define BRG_200 0x03 | ||
192 | #define BRG_300 0x04 | ||
193 | #define BRG_450 0x05 | ||
194 | #define BRG_600 0x06 | ||
195 | #define BRG_900 0x07 | ||
196 | #define BRG_1200 0x08 | ||
197 | #define BRG_1800 0x09 | ||
198 | #define BRG_2400 0x0a | ||
199 | #define BRG_3600 0x0b | ||
200 | #define BRG_4800 0x0c | ||
201 | #define BRG_7200 0x0d | ||
202 | #define BRG_9600 0x0e | ||
203 | #define BRG_14400 0x0f | ||
204 | #define BRG_19200 0x10 | ||
205 | #define BRG_28200 0x11 | ||
206 | #define BRG_38400 0x12 | ||
207 | #define BRG_57600 0x13 | ||
208 | #define BRG_115200 0x14 | ||
209 | #define BRG_230400 0x15 | ||
210 | #define BRG_GIN0 0x16 | ||
211 | #define BRG_GIN1 0x17 | ||
212 | #define BRG_CT0 0x18 | ||
213 | #define BRG_CT1 0x19 | ||
214 | #define BRG_RX2TX316 0x1b | ||
215 | #define BRG_RX2TX31 0x1c | ||
216 | |||
217 | #define SC26198_MAXBAUD 921600 | ||
218 | |||
219 | /*****************************************************************************/ | ||
220 | |||
221 | /* | ||
222 | * Command register command definitions. | ||
223 | */ | ||
224 | #define CR_NULL 0x04 | ||
225 | #define CR_ADDRNORMAL 0x0c | ||
226 | #define CR_RXRESET 0x14 | ||
227 | #define CR_TXRESET 0x1c | ||
228 | #define CR_CLEARRXERR 0x24 | ||
229 | #define CR_BREAKRESET 0x2c | ||
230 | #define CR_TXSTARTBREAK 0x34 | ||
231 | #define CR_TXSTOPBREAK 0x3c | ||
232 | #define CR_RTSON 0x44 | ||
233 | #define CR_RTSOFF 0x4c | ||
234 | #define CR_ADDRINIT 0x5c | ||
235 | #define CR_RXERRBLOCK 0x6c | ||
236 | #define CR_TXSENDXON 0x84 | ||
237 | #define CR_TXSENDXOFF 0x8c | ||
238 | #define CR_GANGXONSET 0x94 | ||
239 | #define CR_GANGXOFFSET 0x9c | ||
240 | #define CR_GANGXONINIT 0xa4 | ||
241 | #define CR_GANGXOFFINIT 0xac | ||
242 | #define CR_HOSTXON 0xb4 | ||
243 | #define CR_HOSTXOFF 0xbc | ||
244 | #define CR_CANCELXOFF 0xc4 | ||
245 | #define CR_ADDRRESET 0xdc | ||
246 | #define CR_RESETALLPORTS 0xf4 | ||
247 | #define CR_RESETALL 0xfc | ||
248 | |||
249 | #define CR_RXENABLE 0x01 | ||
250 | #define CR_TXENABLE 0x02 | ||
251 | |||
252 | /*****************************************************************************/ | ||
253 | |||
254 | /* | ||
255 | * Channel status register. | ||
256 | */ | ||
257 | #define SR_RXRDY 0x01 | ||
258 | #define SR_RXFULL 0x02 | ||
259 | #define SR_TXRDY 0x04 | ||
260 | #define SR_TXEMPTY 0x08 | ||
261 | #define SR_RXOVERRUN 0x10 | ||
262 | #define SR_RXPARITY 0x20 | ||
263 | #define SR_RXFRAMING 0x40 | ||
264 | #define SR_RXBREAK 0x80 | ||
265 | |||
266 | #define SR_RXERRS (SR_RXPARITY | SR_RXFRAMING | SR_RXOVERRUN) | ||
267 | |||
268 | /*****************************************************************************/ | ||
269 | |||
270 | /* | ||
271 | * Interrupt status register and interrupt mask register bit definitions. | ||
272 | */ | ||
273 | #define IR_TXRDY 0x01 | ||
274 | #define IR_RXRDY 0x02 | ||
275 | #define IR_RXBREAK 0x04 | ||
276 | #define IR_XONXOFF 0x10 | ||
277 | #define IR_ADDRRECOG 0x20 | ||
278 | #define IR_RXWATCHDOG 0x40 | ||
279 | #define IR_IOPORT 0x80 | ||
280 | |||
281 | /*****************************************************************************/ | ||
282 | |||
283 | /* | ||
284 | * Interrupt vector register field definitions. | ||
285 | */ | ||
286 | #define IVR_CHANMASK 0x07 | ||
287 | #define IVR_TYPEMASK 0x18 | ||
288 | #define IVR_CONSTMASK 0xc0 | ||
289 | |||
290 | #define IVR_RXDATA 0x10 | ||
291 | #define IVR_RXBADDATA 0x18 | ||
292 | #define IVR_TXDATA 0x08 | ||
293 | #define IVR_OTHER 0x00 | ||
294 | |||
295 | /*****************************************************************************/ | ||
296 | |||
297 | /* | ||
298 | * BRG timer control register bit definitions. | ||
299 | */ | ||
300 | #define BRGCTCR_DISABCLK0 0x00 | ||
301 | #define BRGCTCR_ENABCLK0 0x08 | ||
302 | #define BRGCTCR_DISABCLK1 0x00 | ||
303 | #define BRGCTCR_ENABCLK1 0x80 | ||
304 | |||
305 | #define BRGCTCR_0SCLK16 0x00 | ||
306 | #define BRGCTCR_0SCLK32 0x01 | ||
307 | #define BRGCTCR_0SCLK64 0x02 | ||
308 | #define BRGCTCR_0SCLK128 0x03 | ||
309 | #define BRGCTCR_0X1 0x04 | ||
310 | #define BRGCTCR_0X12 0x05 | ||
311 | #define BRGCTCR_0IO1A 0x06 | ||
312 | #define BRGCTCR_0GIN0 0x07 | ||
313 | |||
314 | #define BRGCTCR_1SCLK16 0x00 | ||
315 | #define BRGCTCR_1SCLK32 0x10 | ||
316 | #define BRGCTCR_1SCLK64 0x20 | ||
317 | #define BRGCTCR_1SCLK128 0x30 | ||
318 | #define BRGCTCR_1X1 0x40 | ||
319 | #define BRGCTCR_1X12 0x50 | ||
320 | #define BRGCTCR_1IO1B 0x60 | ||
321 | #define BRGCTCR_1GIN1 0x70 | ||
322 | |||
323 | /*****************************************************************************/ | ||
324 | |||
325 | /* | ||
326 | * Watch dog timer enable register. | ||
327 | */ | ||
328 | #define WDTRCR_ENABALL 0xff | ||
329 | |||
330 | /*****************************************************************************/ | ||
331 | |||
332 | /* | ||
333 | * XON/XOFF interrupt status register. | ||
334 | */ | ||
335 | #define XISR_TXCHARMASK 0x03 | ||
336 | #define XISR_TXCHARNORMAL 0x00 | ||
337 | #define XISR_TXWAIT 0x01 | ||
338 | #define XISR_TXXOFFPEND 0x02 | ||
339 | #define XISR_TXXONPEND 0x03 | ||
340 | |||
341 | #define XISR_TXFLOWMASK 0x0c | ||
342 | #define XISR_TXNORMAL 0x00 | ||
343 | #define XISR_TXSTOPPEND 0x04 | ||
344 | #define XISR_TXSTARTED 0x08 | ||
345 | #define XISR_TXSTOPPED 0x0c | ||
346 | |||
347 | #define XISR_RXFLOWMASK 0x30 | ||
348 | #define XISR_RXFLOWNONE 0x00 | ||
349 | #define XISR_RXXONSENT 0x10 | ||
350 | #define XISR_RXXOFFSENT 0x20 | ||
351 | |||
352 | #define XISR_RXXONGOT 0x40 | ||
353 | #define XISR_RXXOFFGOT 0x80 | ||
354 | |||
355 | /*****************************************************************************/ | ||
356 | |||
357 | /* | ||
358 | * Current interrupt register. | ||
359 | */ | ||
360 | #define CIR_TYPEMASK 0xc0 | ||
361 | #define CIR_TYPEOTHER 0x00 | ||
362 | #define CIR_TYPETX 0x40 | ||
363 | #define CIR_TYPERXGOOD 0x80 | ||
364 | #define CIR_TYPERXBAD 0xc0 | ||
365 | |||
366 | #define CIR_RXDATA 0x80 | ||
367 | #define CIR_RXBADDATA 0x40 | ||
368 | #define CIR_TXDATA 0x40 | ||
369 | |||
370 | #define CIR_CHANMASK 0x07 | ||
371 | #define CIR_CNTMASK 0x38 | ||
372 | |||
373 | #define CIR_SUBTYPEMASK 0x38 | ||
374 | #define CIR_SUBNONE 0x00 | ||
375 | #define CIR_SUBCOS 0x08 | ||
376 | #define CIR_SUBADDR 0x10 | ||
377 | #define CIR_SUBXONXOFF 0x18 | ||
378 | #define CIR_SUBBREAK 0x28 | ||
379 | |||
380 | /*****************************************************************************/ | ||
381 | |||
382 | /* | ||
383 | * Global interrupting channel register. | ||
384 | */ | ||
385 | #define GICR_CHANMASK 0x07 | ||
386 | |||
387 | /*****************************************************************************/ | ||
388 | |||
389 | /* | ||
390 | * Global interrupting byte count register. | ||
391 | */ | ||
392 | #define GICR_COUNTMASK 0x0f | ||
393 | |||
394 | /*****************************************************************************/ | ||
395 | |||
396 | /* | ||
397 | * Global interrupting type register. | ||
398 | */ | ||
399 | #define GITR_RXMASK 0xc0 | ||
400 | #define GITR_RXNONE 0x00 | ||
401 | #define GITR_RXBADDATA 0x80 | ||
402 | #define GITR_RXGOODDATA 0xc0 | ||
403 | #define GITR_TXDATA 0x20 | ||
404 | |||
405 | #define GITR_SUBTYPEMASK 0x07 | ||
406 | #define GITR_SUBNONE 0x00 | ||
407 | #define GITR_SUBCOS 0x01 | ||
408 | #define GITR_SUBADDR 0x02 | ||
409 | #define GITR_SUBXONXOFF 0x03 | ||
410 | #define GITR_SUBBREAK 0x05 | ||
411 | |||
412 | /*****************************************************************************/ | ||
413 | |||
414 | /* | ||
415 | * Input port change register. | ||
416 | */ | ||
417 | #define IPR_CTS 0x01 | ||
418 | #define IPR_DTR 0x02 | ||
419 | #define IPR_RTS 0x04 | ||
420 | #define IPR_DCD 0x08 | ||
421 | #define IPR_CTSCHANGE 0x10 | ||
422 | #define IPR_DTRCHANGE 0x20 | ||
423 | #define IPR_RTSCHANGE 0x40 | ||
424 | #define IPR_DCDCHANGE 0x80 | ||
425 | |||
426 | #define IPR_CHANGEMASK 0xf0 | ||
427 | |||
428 | /*****************************************************************************/ | ||
429 | |||
430 | /* | ||
431 | * IO port interrupt and output register. | ||
432 | */ | ||
433 | #define IOPR_CTS 0x01 | ||
434 | #define IOPR_DTR 0x02 | ||
435 | #define IOPR_RTS 0x04 | ||
436 | #define IOPR_DCD 0x08 | ||
437 | #define IOPR_CTSCOS 0x10 | ||
438 | #define IOPR_DTRCOS 0x20 | ||
439 | #define IOPR_RTSCOS 0x40 | ||
440 | #define IOPR_DCDCOS 0x80 | ||
441 | |||
442 | /*****************************************************************************/ | ||
443 | |||
444 | /* | ||
445 | * IO port configuration register. | ||
446 | */ | ||
447 | #define IOPCR_SETCTS 0x00 | ||
448 | #define IOPCR_SETDTR 0x04 | ||
449 | #define IOPCR_SETRTS 0x10 | ||
450 | #define IOPCR_SETDCD 0x00 | ||
451 | |||
452 | #define IOPCR_SETSIGS (IOPCR_SETRTS | IOPCR_SETRTS | IOPCR_SETDTR | IOPCR_SETDCD) | ||
453 | |||
454 | /*****************************************************************************/ | ||
455 | |||
456 | /* | ||
457 | * General purpose output select register. | ||
458 | */ | ||
459 | #define GPORS_TXC1XA 0x08 | ||
460 | #define GPORS_TXC16XA 0x09 | ||
461 | #define GPORS_RXC16XA 0x0a | ||
462 | #define GPORS_TXC16XB 0x0b | ||
463 | #define GPORS_GPOR3 0x0c | ||
464 | #define GPORS_GPOR2 0x0d | ||
465 | #define GPORS_GPOR1 0x0e | ||
466 | #define GPORS_GPOR0 0x0f | ||
467 | |||
468 | /*****************************************************************************/ | ||
469 | |||
470 | /* | ||
471 | * General purpose output register. | ||
472 | */ | ||
473 | #define GPOR_0 0x01 | ||
474 | #define GPOR_1 0x02 | ||
475 | #define GPOR_2 0x04 | ||
476 | #define GPOR_3 0x08 | ||
477 | |||
478 | /*****************************************************************************/ | ||
479 | |||
480 | /* | ||
481 | * General purpose output clock register. | ||
482 | */ | ||
483 | #define GPORC_0NONE 0x00 | ||
484 | #define GPORC_0GIN0 0x01 | ||
485 | #define GPORC_0GIN1 0x02 | ||
486 | #define GPORC_0IO3A 0x02 | ||
487 | |||
488 | #define GPORC_1NONE 0x00 | ||
489 | #define GPORC_1GIN0 0x04 | ||
490 | #define GPORC_1GIN1 0x08 | ||
491 | #define GPORC_1IO3C 0x0c | ||
492 | |||
493 | #define GPORC_2NONE 0x00 | ||
494 | #define GPORC_2GIN0 0x10 | ||
495 | #define GPORC_2GIN1 0x20 | ||
496 | #define GPORC_2IO3E 0x20 | ||
497 | |||
498 | #define GPORC_3NONE 0x00 | ||
499 | #define GPORC_3GIN0 0x40 | ||
500 | #define GPORC_3GIN1 0x80 | ||
501 | #define GPORC_3IO3G 0xc0 | ||
502 | |||
503 | /*****************************************************************************/ | ||
504 | |||
505 | /* | ||
506 | * General purpose output data register. | ||
507 | */ | ||
508 | #define GPOD_0MASK 0x03 | ||
509 | #define GPOD_0SET1 0x00 | ||
510 | #define GPOD_0SET0 0x01 | ||
511 | #define GPOD_0SETR0 0x02 | ||
512 | #define GPOD_0SETIO3B 0x03 | ||
513 | |||
514 | #define GPOD_1MASK 0x0c | ||
515 | #define GPOD_1SET1 0x00 | ||
516 | #define GPOD_1SET0 0x04 | ||
517 | #define GPOD_1SETR0 0x08 | ||
518 | #define GPOD_1SETIO3D 0x0c | ||
519 | |||
520 | #define GPOD_2MASK 0x30 | ||
521 | #define GPOD_2SET1 0x00 | ||
522 | #define GPOD_2SET0 0x10 | ||
523 | #define GPOD_2SETR0 0x20 | ||
524 | #define GPOD_2SETIO3F 0x30 | ||
525 | |||
526 | #define GPOD_3MASK 0xc0 | ||
527 | #define GPOD_3SET1 0x00 | ||
528 | #define GPOD_3SET0 0x40 | ||
529 | #define GPOD_3SETR0 0x80 | ||
530 | #define GPOD_3SETIO3H 0xc0 | ||
531 | |||
532 | /*****************************************************************************/ | ||
533 | #endif | ||
diff --git a/include/linux/selinux_netlink.h b/include/linux/selinux_netlink.h new file mode 100644 index 00000000000..d239797785c --- /dev/null +++ b/include/linux/selinux_netlink.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Netlink event notifications for SELinux. | ||
3 | * | ||
4 | * Author: James Morris <jmorris@redhat.com> | ||
5 | * | ||
6 | * Copyright (C) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2, | ||
10 | * as published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef _LINUX_SELINUX_NETLINK_H | ||
13 | #define _LINUX_SELINUX_NETLINK_H | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | /* Message types. */ | ||
18 | #define SELNL_MSG_BASE 0x10 | ||
19 | enum { | ||
20 | SELNL_MSG_SETENFORCE = SELNL_MSG_BASE, | ||
21 | SELNL_MSG_POLICYLOAD, | ||
22 | SELNL_MSG_MAX | ||
23 | }; | ||
24 | |||
25 | #ifndef __KERNEL__ | ||
26 | /* Multicast groups - backwards compatiblility for userspace */ | ||
27 | #define SELNL_GRP_NONE 0x00000000 | ||
28 | #define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ | ||
29 | #define SELNL_GRP_ALL 0xffffffff | ||
30 | #endif | ||
31 | |||
32 | enum selinux_nlgroups { | ||
33 | SELNLGRP_NONE, | ||
34 | #define SELNLGRP_NONE SELNLGRP_NONE | ||
35 | SELNLGRP_AVC, | ||
36 | #define SELNLGRP_AVC SELNLGRP_AVC | ||
37 | __SELNLGRP_MAX | ||
38 | }; | ||
39 | #define SELNLGRP_MAX (__SELNLGRP_MAX - 1) | ||
40 | |||
41 | /* Message structures */ | ||
42 | struct selnl_msg_setenforce { | ||
43 | __s32 val; | ||
44 | }; | ||
45 | |||
46 | struct selnl_msg_policyload { | ||
47 | __u32 seqno; | ||
48 | }; | ||
49 | |||
50 | #endif /* _LINUX_SELINUX_NETLINK_H */ | ||
diff --git a/include/linux/serial167.h b/include/linux/serial167.h new file mode 100644 index 00000000000..59c81b70856 --- /dev/null +++ b/include/linux/serial167.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * serial167.h | ||
3 | * | ||
4 | * Richard Hirst [richard@sleepie.demon.co.uk] | ||
5 | * | ||
6 | * Based on cyclades.h | ||
7 | */ | ||
8 | |||
9 | struct cyclades_monitor { | ||
10 | unsigned long int_count; | ||
11 | unsigned long char_count; | ||
12 | unsigned long char_max; | ||
13 | unsigned long char_last; | ||
14 | }; | ||
15 | |||
16 | /* | ||
17 | * This is our internal structure for each serial port's state. | ||
18 | * | ||
19 | * Many fields are paralleled by the structure used by the serial_struct | ||
20 | * structure. | ||
21 | * | ||
22 | * For definitions of the flags field, see tty.h | ||
23 | */ | ||
24 | |||
25 | struct cyclades_port { | ||
26 | int magic; | ||
27 | int type; | ||
28 | int card; | ||
29 | int line; | ||
30 | int flags; /* defined in tty.h */ | ||
31 | struct tty_struct *tty; | ||
32 | int read_status_mask; | ||
33 | int timeout; | ||
34 | int xmit_fifo_size; | ||
35 | int cor1,cor2,cor3,cor4,cor5,cor6,cor7; | ||
36 | int tbpr,tco,rbpr,rco; | ||
37 | int ignore_status_mask; | ||
38 | int close_delay; | ||
39 | int IER; /* Interrupt Enable Register */ | ||
40 | unsigned long last_active; | ||
41 | int count; /* # of fd on device */ | ||
42 | int x_char; /* to be pushed out ASAP */ | ||
43 | int x_break; | ||
44 | int blocked_open; /* # of blocked opens */ | ||
45 | unsigned char *xmit_buf; | ||
46 | int xmit_head; | ||
47 | int xmit_tail; | ||
48 | int xmit_cnt; | ||
49 | int default_threshold; | ||
50 | int default_timeout; | ||
51 | wait_queue_head_t open_wait; | ||
52 | wait_queue_head_t close_wait; | ||
53 | struct cyclades_monitor mon; | ||
54 | }; | ||
55 | |||
56 | #define CYCLADES_MAGIC 0x4359 | ||
57 | |||
58 | #define CYGETMON 0x435901 | ||
59 | #define CYGETTHRESH 0x435902 | ||
60 | #define CYSETTHRESH 0x435903 | ||
61 | #define CYGETDEFTHRESH 0x435904 | ||
62 | #define CYSETDEFTHRESH 0x435905 | ||
63 | #define CYGETTIMEOUT 0x435906 | ||
64 | #define CYSETTIMEOUT 0x435907 | ||
65 | #define CYGETDEFTIMEOUT 0x435908 | ||
66 | #define CYSETDEFTIMEOUT 0x435909 | ||
67 | |||
68 | #define CyMaxChipsPerCard 1 | ||
69 | |||
70 | /**** cd2401 registers ****/ | ||
71 | |||
72 | #define CyGFRCR (0x81) | ||
73 | #define CyCCR (0x13) | ||
74 | #define CyCLR_CHAN (0x40) | ||
75 | #define CyINIT_CHAN (0x20) | ||
76 | #define CyCHIP_RESET (0x10) | ||
77 | #define CyENB_XMTR (0x08) | ||
78 | #define CyDIS_XMTR (0x04) | ||
79 | #define CyENB_RCVR (0x02) | ||
80 | #define CyDIS_RCVR (0x01) | ||
81 | #define CyCAR (0xee) | ||
82 | #define CyIER (0x11) | ||
83 | #define CyMdmCh (0x80) | ||
84 | #define CyRxExc (0x20) | ||
85 | #define CyRxData (0x08) | ||
86 | #define CyTxMpty (0x02) | ||
87 | #define CyTxRdy (0x01) | ||
88 | #define CyLICR (0x26) | ||
89 | #define CyRISR (0x89) | ||
90 | #define CyTIMEOUT (0x80) | ||
91 | #define CySPECHAR (0x70) | ||
92 | #define CyOVERRUN (0x08) | ||
93 | #define CyPARITY (0x04) | ||
94 | #define CyFRAME (0x02) | ||
95 | #define CyBREAK (0x01) | ||
96 | #define CyREOIR (0x84) | ||
97 | #define CyTEOIR (0x85) | ||
98 | #define CyMEOIR (0x86) | ||
99 | #define CyNOTRANS (0x08) | ||
100 | #define CyRFOC (0x30) | ||
101 | #define CyRDR (0xf8) | ||
102 | #define CyTDR (0xf8) | ||
103 | #define CyMISR (0x8b) | ||
104 | #define CyRISR (0x89) | ||
105 | #define CyTISR (0x8a) | ||
106 | #define CyMSVR1 (0xde) | ||
107 | #define CyMSVR2 (0xdf) | ||
108 | #define CyDSR (0x80) | ||
109 | #define CyDCD (0x40) | ||
110 | #define CyCTS (0x20) | ||
111 | #define CyDTR (0x02) | ||
112 | #define CyRTS (0x01) | ||
113 | #define CyRTPRL (0x25) | ||
114 | #define CyRTPRH (0x24) | ||
115 | #define CyCOR1 (0x10) | ||
116 | #define CyPARITY_NONE (0x00) | ||
117 | #define CyPARITY_E (0x40) | ||
118 | #define CyPARITY_O (0xC0) | ||
119 | #define Cy_5_BITS (0x04) | ||
120 | #define Cy_6_BITS (0x05) | ||
121 | #define Cy_7_BITS (0x06) | ||
122 | #define Cy_8_BITS (0x07) | ||
123 | #define CyCOR2 (0x17) | ||
124 | #define CyETC (0x20) | ||
125 | #define CyCtsAE (0x02) | ||
126 | #define CyCOR3 (0x16) | ||
127 | #define Cy_1_STOP (0x02) | ||
128 | #define Cy_2_STOP (0x04) | ||
129 | #define CyCOR4 (0x15) | ||
130 | #define CyREC_FIFO (0x0F) /* Receive FIFO threshold */ | ||
131 | #define CyCOR5 (0x14) | ||
132 | #define CyCOR6 (0x18) | ||
133 | #define CyCOR7 (0x07) | ||
134 | #define CyRBPR (0xcb) | ||
135 | #define CyRCOR (0xc8) | ||
136 | #define CyTBPR (0xc3) | ||
137 | #define CyTCOR (0xc0) | ||
138 | #define CySCHR1 (0x1f) | ||
139 | #define CySCHR2 (0x1e) | ||
140 | #define CyTPR (0xda) | ||
141 | #define CyPILR1 (0xe3) | ||
142 | #define CyPILR2 (0xe0) | ||
143 | #define CyPILR3 (0xe1) | ||
144 | #define CyCMR (0x1b) | ||
145 | #define CyASYNC (0x02) | ||
146 | #define CyLICR (0x26) | ||
147 | #define CyLIVR (0x09) | ||
148 | #define CySCRL (0x23) | ||
149 | #define CySCRH (0x22) | ||
150 | #define CyTFTC (0x80) | ||
151 | |||
152 | |||
153 | /* max number of chars in the FIFO */ | ||
154 | |||
155 | #define CyMAX_CHAR_FIFO 12 | ||
156 | |||
157 | /***************************************************************************/ | ||
diff --git a/include/linux/serialP.h b/include/linux/serialP.h new file mode 100644 index 00000000000..e811a615f69 --- /dev/null +++ b/include/linux/serialP.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * Private header file for the (dumb) serial driver | ||
3 | * | ||
4 | * Copyright (C) 1997 by Theodore Ts'o. | ||
5 | * | ||
6 | * Redistribution of this file is permitted under the terms of the GNU | ||
7 | * Public License (GPL) | ||
8 | */ | ||
9 | |||
10 | #ifndef _LINUX_SERIALP_H | ||
11 | #define _LINUX_SERIALP_H | ||
12 | |||
13 | /* | ||
14 | * This is our internal structure for each serial port's state. | ||
15 | * | ||
16 | * Many fields are paralleled by the structure used by the serial_struct | ||
17 | * structure. | ||
18 | * | ||
19 | * For definitions of the flags field, see tty.h | ||
20 | */ | ||
21 | |||
22 | #include <linux/termios.h> | ||
23 | #include <linux/workqueue.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/circ_buf.h> | ||
26 | #include <linux/wait.h> | ||
27 | |||
28 | struct serial_state { | ||
29 | int magic; | ||
30 | int baud_base; | ||
31 | unsigned long port; | ||
32 | int irq; | ||
33 | int flags; | ||
34 | int hub6; | ||
35 | int type; | ||
36 | int line; | ||
37 | int revision; /* Chip revision (950) */ | ||
38 | int xmit_fifo_size; | ||
39 | int custom_divisor; | ||
40 | int count; | ||
41 | u8 *iomem_base; | ||
42 | u16 iomem_reg_shift; | ||
43 | unsigned short close_delay; | ||
44 | unsigned short closing_wait; /* time to wait before closing */ | ||
45 | struct async_icount icount; | ||
46 | int io_type; | ||
47 | struct async_struct *info; | ||
48 | struct pci_dev *dev; | ||
49 | }; | ||
50 | |||
51 | struct async_struct { | ||
52 | int magic; | ||
53 | unsigned long port; | ||
54 | int hub6; | ||
55 | int flags; | ||
56 | int xmit_fifo_size; | ||
57 | struct serial_state *state; | ||
58 | struct tty_struct *tty; | ||
59 | int read_status_mask; | ||
60 | int ignore_status_mask; | ||
61 | int timeout; | ||
62 | int quot; | ||
63 | int x_char; /* xon/xoff character */ | ||
64 | int close_delay; | ||
65 | unsigned short closing_wait; | ||
66 | unsigned short closing_wait2; /* obsolete */ | ||
67 | int IER; /* Interrupt Enable Register */ | ||
68 | int MCR; /* Modem control register */ | ||
69 | int LCR; /* Line control register */ | ||
70 | int ACR; /* 16950 Additional Control Reg. */ | ||
71 | unsigned long event; | ||
72 | unsigned long last_active; | ||
73 | int line; | ||
74 | int blocked_open; /* # of blocked opens */ | ||
75 | struct circ_buf xmit; | ||
76 | spinlock_t xmit_lock; | ||
77 | u8 *iomem_base; | ||
78 | u16 iomem_reg_shift; | ||
79 | int io_type; | ||
80 | struct work_struct work; | ||
81 | struct tasklet_struct tlet; | ||
82 | #ifdef DECLARE_WAITQUEUE | ||
83 | wait_queue_head_t open_wait; | ||
84 | wait_queue_head_t close_wait; | ||
85 | wait_queue_head_t delta_msr_wait; | ||
86 | #else | ||
87 | struct wait_queue *open_wait; | ||
88 | struct wait_queue *close_wait; | ||
89 | struct wait_queue *delta_msr_wait; | ||
90 | #endif | ||
91 | struct async_struct *next_port; /* For the linked list */ | ||
92 | struct async_struct *prev_port; | ||
93 | }; | ||
94 | |||
95 | #define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base)) | ||
96 | |||
97 | #define SERIAL_MAGIC 0x5301 | ||
98 | #define SSTATE_MAGIC 0x5302 | ||
99 | |||
100 | /* | ||
101 | * Events are used to schedule things to happen at timer-interrupt | ||
102 | * time, instead of at rs interrupt time. | ||
103 | */ | ||
104 | #define RS_EVENT_WRITE_WAKEUP 0 | ||
105 | |||
106 | /* | ||
107 | * Multiport serial configuration structure --- internal structure | ||
108 | */ | ||
109 | struct rs_multiport_struct { | ||
110 | int port1; | ||
111 | unsigned char mask1, match1; | ||
112 | int port2; | ||
113 | unsigned char mask2, match2; | ||
114 | int port3; | ||
115 | unsigned char mask3, match3; | ||
116 | int port4; | ||
117 | unsigned char mask4, match4; | ||
118 | int port_monitor; | ||
119 | }; | ||
120 | |||
121 | #if defined(__alpha__) && !defined(CONFIG_PCI) | ||
122 | /* | ||
123 | * Digital did something really horribly wrong with the OUT1 and OUT2 | ||
124 | * lines on at least some ALPHA's. The failure mode is that if either | ||
125 | * is cleared, the machine locks up with endless interrupts. | ||
126 | * | ||
127 | * This is still used by arch/mips/au1000/common/serial.c for some weird | ||
128 | * reason (mips != alpha!) | ||
129 | */ | ||
130 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1) | ||
131 | #elif defined(CONFIG_SBC8560) | ||
132 | /* | ||
133 | * WindRiver did something similarly broken on their SBC8560 board. The | ||
134 | * UART tristates its IRQ output while OUT2 is clear, but they pulled | ||
135 | * the interrupt line _up_ instead of down, so if we register the IRQ | ||
136 | * while the UART is in that state, we die in an IRQ storm. */ | ||
137 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2) | ||
138 | #else | ||
139 | #define ALPHA_KLUDGE_MCR 0 | ||
140 | #endif | ||
141 | |||
142 | #endif /* _LINUX_SERIAL_H */ | ||
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h new file mode 100644 index 00000000000..543e361b15c --- /dev/null +++ b/include/linux/serial_reg.h | |||
@@ -0,0 +1,368 @@ | |||
1 | /* | ||
2 | * include/linux/serial_reg.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1994 by Theodore Ts'o. | ||
5 | * | ||
6 | * Redistribution of this file is permitted under the terms of the GNU | ||
7 | * Public License (GPL) | ||
8 | * | ||
9 | * These are the UART port assignments, expressed as offsets from the base | ||
10 | * register. These assignments should hold for any serial port based on | ||
11 | * a 8250, 16450, or 16550(A). | ||
12 | */ | ||
13 | |||
14 | #ifndef _LINUX_SERIAL_REG_H | ||
15 | #define _LINUX_SERIAL_REG_H | ||
16 | |||
17 | /* | ||
18 | * DLAB=0 | ||
19 | */ | ||
20 | #define UART_RX 0 /* In: Receive buffer */ | ||
21 | #define UART_TX 0 /* Out: Transmit buffer */ | ||
22 | |||
23 | #define UART_IER 1 /* Out: Interrupt Enable Register */ | ||
24 | #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ | ||
25 | #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ | ||
26 | #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ | ||
27 | #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ | ||
28 | /* | ||
29 | * Sleep mode for ST16650 and TI16750. For the ST16650, EFR[4]=1 | ||
30 | */ | ||
31 | #define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ | ||
32 | |||
33 | #define UART_IIR 2 /* In: Interrupt ID Register */ | ||
34 | #define UART_IIR_NO_INT 0x01 /* No interrupts pending */ | ||
35 | #define UART_IIR_ID 0x06 /* Mask for the interrupt ID */ | ||
36 | #define UART_IIR_MSI 0x00 /* Modem status interrupt */ | ||
37 | #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ | ||
38 | #define UART_IIR_RDI 0x04 /* Receiver data interrupt */ | ||
39 | #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ | ||
40 | |||
41 | #define UART_IIR_BUSY 0x07 /* DesignWare APB Busy Detect */ | ||
42 | |||
43 | #define UART_FCR 2 /* Out: FIFO Control Register */ | ||
44 | #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ | ||
45 | #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ | ||
46 | #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ | ||
47 | #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */ | ||
48 | /* | ||
49 | * Note: The FIFO trigger levels are chip specific: | ||
50 | * RX:76 = 00 01 10 11 TX:54 = 00 01 10 11 | ||
51 | * PC16550D: 1 4 8 14 xx xx xx xx | ||
52 | * TI16C550A: 1 4 8 14 xx xx xx xx | ||
53 | * TI16C550C: 1 4 8 14 xx xx xx xx | ||
54 | * ST16C550: 1 4 8 14 xx xx xx xx | ||
55 | * ST16C650: 8 16 24 28 16 8 24 30 PORT_16650V2 | ||
56 | * NS16C552: 1 4 8 14 xx xx xx xx | ||
57 | * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 | ||
58 | * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 | ||
59 | * TI16C752: 8 16 56 60 8 16 32 56 | ||
60 | * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA | ||
61 | */ | ||
62 | #define UART_FCR_R_TRIG_00 0x00 | ||
63 | #define UART_FCR_R_TRIG_01 0x40 | ||
64 | #define UART_FCR_R_TRIG_10 0x80 | ||
65 | #define UART_FCR_R_TRIG_11 0xc0 | ||
66 | #define UART_FCR_T_TRIG_00 0x00 | ||
67 | #define UART_FCR_T_TRIG_01 0x10 | ||
68 | #define UART_FCR_T_TRIG_10 0x20 | ||
69 | #define UART_FCR_T_TRIG_11 0x30 | ||
70 | |||
71 | #define UART_FCR_TRIGGER_MASK 0xC0 /* Mask for the FIFO trigger range */ | ||
72 | #define UART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */ | ||
73 | #define UART_FCR_TRIGGER_4 0x40 /* Mask for trigger set at 4 */ | ||
74 | #define UART_FCR_TRIGGER_8 0x80 /* Mask for trigger set at 8 */ | ||
75 | #define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ | ||
76 | /* 16650 definitions */ | ||
77 | #define UART_FCR6_R_TRIGGER_8 0x00 /* Mask for receive trigger set at 1 */ | ||
78 | #define UART_FCR6_R_TRIGGER_16 0x40 /* Mask for receive trigger set at 4 */ | ||
79 | #define UART_FCR6_R_TRIGGER_24 0x80 /* Mask for receive trigger set at 8 */ | ||
80 | #define UART_FCR6_R_TRIGGER_28 0xC0 /* Mask for receive trigger set at 14 */ | ||
81 | #define UART_FCR6_T_TRIGGER_16 0x00 /* Mask for transmit trigger set at 16 */ | ||
82 | #define UART_FCR6_T_TRIGGER_8 0x10 /* Mask for transmit trigger set at 8 */ | ||
83 | #define UART_FCR6_T_TRIGGER_24 0x20 /* Mask for transmit trigger set at 24 */ | ||
84 | #define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ | ||
85 | #define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750) */ | ||
86 | |||
87 | #define UART_LCR 3 /* Out: Line Control Register */ | ||
88 | /* | ||
89 | * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting | ||
90 | * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. | ||
91 | */ | ||
92 | #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ | ||
93 | #define UART_LCR_SBC 0x40 /* Set break control */ | ||
94 | #define UART_LCR_SPAR 0x20 /* Stick parity (?) */ | ||
95 | #define UART_LCR_EPAR 0x10 /* Even parity select */ | ||
96 | #define UART_LCR_PARITY 0x08 /* Parity Enable */ | ||
97 | #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 bit, 1=2 bits */ | ||
98 | #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ | ||
99 | #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ | ||
100 | #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ | ||
101 | #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ | ||
102 | |||
103 | /* | ||
104 | * Access to some registers depends on register access / configuration | ||
105 | * mode. | ||
106 | */ | ||
107 | #define UART_LCR_CONF_MODE_A UART_LCR_DLAB /* Configutation mode A */ | ||
108 | #define UART_LCR_CONF_MODE_B 0xBF /* Configutation mode B */ | ||
109 | |||
110 | #define UART_MCR 4 /* Out: Modem Control Register */ | ||
111 | #define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ | ||
112 | #define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ | ||
113 | #define UART_MCR_HW_RTS 0x40 /* Enable hw control of RTS (Tegra UART) */ | ||
114 | #define UART_MCR_XONANY 0x20 /* Enable Xon Any (TI16C752, EFR[4]=1) */ | ||
115 | #define UART_MCR_AFE 0x20 /* Enable auto-RTS/CTS (TI16C550C/TI16C750) */ | ||
116 | #define UART_MCR_HW_CTS 0x20 /* Enable HW based CTS control (Tegra UART)*/ | ||
117 | #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ | ||
118 | #define UART_MCR_OUT2 0x08 /* Out2 complement */ | ||
119 | #define UART_MCR_OUT1 0x04 /* Out1 complement */ | ||
120 | #define UART_MCR_RTS 0x02 /* RTS complement */ | ||
121 | #define UART_MCR_DTR 0x01 /* DTR complement */ | ||
122 | |||
123 | #define UART_LSR 5 /* In: Line Status Register */ | ||
124 | #define UART_LSR_FIFOE 0x80 /* Fifo error */ | ||
125 | #define UART_LSR_TEMT 0x40 /* Transmitter empty */ | ||
126 | #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ | ||
127 | #define UART_LSR_BI 0x10 /* Break interrupt indicator */ | ||
128 | #define UART_LSR_FE 0x08 /* Frame error indicator */ | ||
129 | #define UART_LSR_PE 0x04 /* Parity error indicator */ | ||
130 | #define UART_LSR_OE 0x02 /* Overrun error indicator */ | ||
131 | #define UART_LSR_DR 0x01 /* Receiver data ready */ | ||
132 | #define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */ | ||
133 | |||
134 | #define UART_MSR 6 /* In: Modem Status Register */ | ||
135 | #define UART_MSR_DCD 0x80 /* Data Carrier Detect */ | ||
136 | #define UART_MSR_RI 0x40 /* Ring Indicator */ | ||
137 | #define UART_MSR_DSR 0x20 /* Data Set Ready */ | ||
138 | #define UART_MSR_CTS 0x10 /* Clear to Send */ | ||
139 | #define UART_MSR_DDCD 0x08 /* Delta DCD */ | ||
140 | #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ | ||
141 | #define UART_MSR_DDSR 0x02 /* Delta DSR */ | ||
142 | #define UART_MSR_DCTS 0x01 /* Delta CTS */ | ||
143 | #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ | ||
144 | |||
145 | #define UART_SCR 7 /* I/O: Scratch Register */ | ||
146 | |||
147 | /* | ||
148 | * DLAB=1 | ||
149 | */ | ||
150 | #define UART_DLL 0 /* Out: Divisor Latch Low */ | ||
151 | #define UART_DLM 1 /* Out: Divisor Latch High */ | ||
152 | |||
153 | /* | ||
154 | * LCR=0xBF (or DLAB=1 for 16C660) | ||
155 | */ | ||
156 | #define UART_EFR 2 /* I/O: Extended Features Register */ | ||
157 | #define UART_EFR_CTS 0x80 /* CTS flow control */ | ||
158 | #define UART_EFR_RTS 0x40 /* RTS flow control */ | ||
159 | #define UART_EFR_SCD 0x20 /* Special character detect */ | ||
160 | #define UART_EFR_ECB 0x10 /* Enhanced control bit */ | ||
161 | /* | ||
162 | * the low four bits control software flow control | ||
163 | */ | ||
164 | |||
165 | /* | ||
166 | * LCR=0xBF, TI16C752, ST16650, ST16650A, ST16654 | ||
167 | */ | ||
168 | #define UART_XON1 4 /* I/O: Xon character 1 */ | ||
169 | #define UART_XON2 5 /* I/O: Xon character 2 */ | ||
170 | #define UART_XOFF1 6 /* I/O: Xoff character 1 */ | ||
171 | #define UART_XOFF2 7 /* I/O: Xoff character 2 */ | ||
172 | |||
173 | /* | ||
174 | * EFR[4]=1 MCR[6]=1, TI16C752 | ||
175 | */ | ||
176 | #define UART_TI752_TCR 6 /* I/O: transmission control register */ | ||
177 | #define UART_TI752_TLR 7 /* I/O: trigger level register */ | ||
178 | |||
179 | /* | ||
180 | * LCR=0xBF, XR16C85x | ||
181 | */ | ||
182 | #define UART_TRG 0 /* FCTR bit 7 selects Rx or Tx | ||
183 | * In: Fifo count | ||
184 | * Out: Fifo custom trigger levels */ | ||
185 | /* | ||
186 | * These are the definitions for the Programmable Trigger Register | ||
187 | */ | ||
188 | #define UART_TRG_1 0x01 | ||
189 | #define UART_TRG_4 0x04 | ||
190 | #define UART_TRG_8 0x08 | ||
191 | #define UART_TRG_16 0x10 | ||
192 | #define UART_TRG_32 0x20 | ||
193 | #define UART_TRG_64 0x40 | ||
194 | #define UART_TRG_96 0x60 | ||
195 | #define UART_TRG_120 0x78 | ||
196 | #define UART_TRG_128 0x80 | ||
197 | |||
198 | #define UART_FCTR 1 /* Feature Control Register */ | ||
199 | #define UART_FCTR_RTS_NODELAY 0x00 /* RTS flow control delay */ | ||
200 | #define UART_FCTR_RTS_4DELAY 0x01 | ||
201 | #define UART_FCTR_RTS_6DELAY 0x02 | ||
202 | #define UART_FCTR_RTS_8DELAY 0x03 | ||
203 | #define UART_FCTR_IRDA 0x04 /* IrDa data encode select */ | ||
204 | #define UART_FCTR_TX_INT 0x08 /* Tx interrupt type select */ | ||
205 | #define UART_FCTR_TRGA 0x00 /* Tx/Rx 550 trigger table select */ | ||
206 | #define UART_FCTR_TRGB 0x10 /* Tx/Rx 650 trigger table select */ | ||
207 | #define UART_FCTR_TRGC 0x20 /* Tx/Rx 654 trigger table select */ | ||
208 | #define UART_FCTR_TRGD 0x30 /* Tx/Rx 850 programmable trigger select */ | ||
209 | #define UART_FCTR_SCR_SWAP 0x40 /* Scratch pad register swap */ | ||
210 | #define UART_FCTR_RX 0x00 /* Programmable trigger mode select */ | ||
211 | #define UART_FCTR_TX 0x80 /* Programmable trigger mode select */ | ||
212 | |||
213 | /* | ||
214 | * LCR=0xBF, FCTR[6]=1 | ||
215 | */ | ||
216 | #define UART_EMSR 7 /* Extended Mode Select Register */ | ||
217 | #define UART_EMSR_FIFO_COUNT 0x01 /* Rx/Tx select */ | ||
218 | #define UART_EMSR_ALT_COUNT 0x02 /* Alternating count select */ | ||
219 | |||
220 | /* | ||
221 | * The Intel XScale on-chip UARTs define these bits | ||
222 | */ | ||
223 | #define UART_IER_DMAE 0x80 /* DMA Requests Enable */ | ||
224 | #define UART_IER_UUE 0x40 /* UART Unit Enable */ | ||
225 | #define UART_IER_NRZE 0x20 /* NRZ coding Enable */ | ||
226 | #define UART_IER_RTOIE 0x10 /* Receiver Time Out Interrupt Enable */ | ||
227 | |||
228 | #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ | ||
229 | |||
230 | #define UART_FCR_PXAR1 0x00 /* receive FIFO threshold = 1 */ | ||
231 | #define UART_FCR_PXAR8 0x40 /* receive FIFO threshold = 8 */ | ||
232 | #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ | ||
233 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ | ||
234 | |||
235 | /* | ||
236 | * Intel MID on-chip HSU (High Speed UART) defined bits | ||
237 | */ | ||
238 | #define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */ | ||
239 | #define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */ | ||
240 | #define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */ | ||
241 | #define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */ | ||
242 | |||
243 | #define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */ | ||
244 | #define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */ | ||
245 | #define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */ | ||
246 | #define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */ | ||
247 | |||
248 | #define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */ | ||
249 | #define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */ | ||
250 | |||
251 | #define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */ | ||
252 | #define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */ | ||
253 | |||
254 | /* | ||
255 | * These register definitions are for the 16C950 | ||
256 | */ | ||
257 | #define UART_ASR 0x01 /* Additional Status Register */ | ||
258 | #define UART_RFL 0x03 /* Receiver FIFO level */ | ||
259 | #define UART_TFL 0x04 /* Transmitter FIFO level */ | ||
260 | #define UART_ICR 0x05 /* Index Control Register */ | ||
261 | |||
262 | /* The 16950 ICR registers */ | ||
263 | #define UART_ACR 0x00 /* Additional Control Register */ | ||
264 | #define UART_CPR 0x01 /* Clock Prescalar Register */ | ||
265 | #define UART_TCR 0x02 /* Times Clock Register */ | ||
266 | #define UART_CKS 0x03 /* Clock Select Register */ | ||
267 | #define UART_TTL 0x04 /* Transmitter Interrupt Trigger Level */ | ||
268 | #define UART_RTL 0x05 /* Receiver Interrupt Trigger Level */ | ||
269 | #define UART_FCL 0x06 /* Flow Control Level Lower */ | ||
270 | #define UART_FCH 0x07 /* Flow Control Level Higher */ | ||
271 | #define UART_ID1 0x08 /* ID #1 */ | ||
272 | #define UART_ID2 0x09 /* ID #2 */ | ||
273 | #define UART_ID3 0x0A /* ID #3 */ | ||
274 | #define UART_REV 0x0B /* Revision */ | ||
275 | #define UART_CSR 0x0C /* Channel Software Reset */ | ||
276 | #define UART_NMR 0x0D /* Nine-bit Mode Register */ | ||
277 | #define UART_CTR 0xFF | ||
278 | |||
279 | /* | ||
280 | * The 16C950 Additional Control Register | ||
281 | */ | ||
282 | #define UART_ACR_RXDIS 0x01 /* Receiver disable */ | ||
283 | #define UART_ACR_TXDIS 0x02 /* Transmitter disable */ | ||
284 | #define UART_ACR_DSRFC 0x04 /* DSR Flow Control */ | ||
285 | #define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */ | ||
286 | #define UART_ACR_ICRRD 0x40 /* ICR Read enable */ | ||
287 | #define UART_ACR_ASREN 0x80 /* Additional status enable */ | ||
288 | |||
289 | |||
290 | |||
291 | /* | ||
292 | * These definitions are for the RSA-DV II/S card, from | ||
293 | * | ||
294 | * Kiyokazu SUTO <suto@ks-and-ks.ne.jp> | ||
295 | */ | ||
296 | |||
297 | #define UART_RSA_BASE (-8) | ||
298 | |||
299 | #define UART_RSA_MSR ((UART_RSA_BASE) + 0) /* I/O: Mode Select Register */ | ||
300 | |||
301 | #define UART_RSA_MSR_SWAP (1 << 0) /* Swap low/high 8 bytes in I/O port addr */ | ||
302 | #define UART_RSA_MSR_FIFO (1 << 2) /* Enable the external FIFO */ | ||
303 | #define UART_RSA_MSR_FLOW (1 << 3) /* Enable the auto RTS/CTS flow control */ | ||
304 | #define UART_RSA_MSR_ITYP (1 << 4) /* Level (1) / Edge triger (0) */ | ||
305 | |||
306 | #define UART_RSA_IER ((UART_RSA_BASE) + 1) /* I/O: Interrupt Enable Register */ | ||
307 | |||
308 | #define UART_RSA_IER_Rx_FIFO_H (1 << 0) /* Enable Rx FIFO half full int. */ | ||
309 | #define UART_RSA_IER_Tx_FIFO_H (1 << 1) /* Enable Tx FIFO half full int. */ | ||
310 | #define UART_RSA_IER_Tx_FIFO_E (1 << 2) /* Enable Tx FIFO empty int. */ | ||
311 | #define UART_RSA_IER_Rx_TOUT (1 << 3) /* Enable char receive timeout int */ | ||
312 | #define UART_RSA_IER_TIMER (1 << 4) /* Enable timer interrupt */ | ||
313 | |||
314 | #define UART_RSA_SRR ((UART_RSA_BASE) + 2) /* IN: Status Read Register */ | ||
315 | |||
316 | #define UART_RSA_SRR_Tx_FIFO_NEMP (1 << 0) /* Tx FIFO is not empty (1) */ | ||
317 | #define UART_RSA_SRR_Tx_FIFO_NHFL (1 << 1) /* Tx FIFO is not half full (1) */ | ||
318 | #define UART_RSA_SRR_Tx_FIFO_NFUL (1 << 2) /* Tx FIFO is not full (1) */ | ||
319 | #define UART_RSA_SRR_Rx_FIFO_NEMP (1 << 3) /* Rx FIFO is not empty (1) */ | ||
320 | #define UART_RSA_SRR_Rx_FIFO_NHFL (1 << 4) /* Rx FIFO is not half full (1) */ | ||
321 | #define UART_RSA_SRR_Rx_FIFO_NFUL (1 << 5) /* Rx FIFO is not full (1) */ | ||
322 | #define UART_RSA_SRR_Rx_TOUT (1 << 6) /* Character reception timeout occurred (1) */ | ||
323 | #define UART_RSA_SRR_TIMER (1 << 7) /* Timer interrupt occurred */ | ||
324 | |||
325 | #define UART_RSA_FRR ((UART_RSA_BASE) + 2) /* OUT: FIFO Reset Register */ | ||
326 | |||
327 | #define UART_RSA_TIVSR ((UART_RSA_BASE) + 3) /* I/O: Timer Interval Value Set Register */ | ||
328 | |||
329 | #define UART_RSA_TCR ((UART_RSA_BASE) + 4) /* OUT: Timer Control Register */ | ||
330 | |||
331 | #define UART_RSA_TCR_SWITCH (1 << 0) /* Timer on */ | ||
332 | |||
333 | /* | ||
334 | * The RSA DSV/II board has two fixed clock frequencies. One is the | ||
335 | * standard rate, and the other is 8 times faster. | ||
336 | */ | ||
337 | #define SERIAL_RSA_BAUD_BASE (921600) | ||
338 | #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) | ||
339 | |||
340 | /* | ||
341 | * Extra serial register definitions for the internal UARTs | ||
342 | * in TI OMAP processors. | ||
343 | */ | ||
344 | #define UART_OMAP_MDR1 0x08 /* Mode definition register */ | ||
345 | #define UART_OMAP_MDR2 0x09 /* Mode definition register 2 */ | ||
346 | #define UART_OMAP_SCR 0x10 /* Supplementary control register */ | ||
347 | #define UART_OMAP_SSR 0x11 /* Supplementary status register */ | ||
348 | #define UART_OMAP_EBLR 0x12 /* BOF length register */ | ||
349 | #define UART_OMAP_OSC_12M_SEL 0x13 /* OMAP1510 12MHz osc select */ | ||
350 | #define UART_OMAP_MVER 0x14 /* Module version register */ | ||
351 | #define UART_OMAP_SYSC 0x15 /* System configuration register */ | ||
352 | #define UART_OMAP_SYSS 0x16 /* System status register */ | ||
353 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ | ||
354 | |||
355 | /* | ||
356 | * These are the definitions for the MDR1 register | ||
357 | */ | ||
358 | #define UART_OMAP_MDR1_16X_MODE 0x00 /* UART 16x mode */ | ||
359 | #define UART_OMAP_MDR1_SIR_MODE 0x01 /* SIR mode */ | ||
360 | #define UART_OMAP_MDR1_16X_ABAUD_MODE 0x02 /* UART 16x auto-baud */ | ||
361 | #define UART_OMAP_MDR1_13X_MODE 0x03 /* UART 13x mode */ | ||
362 | #define UART_OMAP_MDR1_MIR_MODE 0x04 /* MIR mode */ | ||
363 | #define UART_OMAP_MDR1_FIR_MODE 0x05 /* FIR mode */ | ||
364 | #define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */ | ||
365 | #define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */ | ||
366 | |||
367 | #endif /* _LINUX_SERIAL_REG_H */ | ||
368 | |||
diff --git a/include/linux/sht15.h b/include/linux/sht15.h new file mode 100644 index 00000000000..f85c7c523da --- /dev/null +++ b/include/linux/sht15.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * sht15.h - support for the SHT15 Temperature and Humidity Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Jonathan Cameron | ||
5 | * | ||
6 | * Copyright (c) 2007 Wouter Horre | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * For further information, see the Documentation/hwmon/sht15 file. | ||
13 | */ | ||
14 | |||
15 | /** | ||
16 | * struct sht15_platform_data - sht15 connectivity info | ||
17 | * @gpio_data: no. of gpio to which bidirectional data line is | ||
18 | * connected. | ||
19 | * @gpio_sck: no. of gpio to which the data clock is connected. | ||
20 | * @supply_mv: supply voltage in mv. Overridden by regulator if | ||
21 | * available. | ||
22 | * @checksum: flag to indicate the checksum should be validated. | ||
23 | * @no_otp_reload: flag to indicate no reload from OTP. | ||
24 | * @low_resolution: flag to indicate the temp/humidity resolution to use. | ||
25 | */ | ||
26 | struct sht15_platform_data { | ||
27 | int gpio_data; | ||
28 | int gpio_sck; | ||
29 | int supply_mv; | ||
30 | bool checksum; | ||
31 | bool no_otp_reload; | ||
32 | bool low_resolution; | ||
33 | }; | ||
34 | |||
diff --git a/include/linux/sigma.h b/include/linux/sigma.h new file mode 100644 index 00000000000..d0de882c0d9 --- /dev/null +++ b/include/linux/sigma.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Load firmware files from Analog Devices SigmaStudio | ||
3 | * | ||
4 | * Copyright 2009-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #ifndef __SIGMA_FIRMWARE_H__ | ||
10 | #define __SIGMA_FIRMWARE_H__ | ||
11 | |||
12 | #include <linux/firmware.h> | ||
13 | #include <linux/types.h> | ||
14 | |||
15 | struct i2c_client; | ||
16 | |||
17 | #define SIGMA_MAGIC "ADISIGM" | ||
18 | |||
19 | struct sigma_firmware { | ||
20 | const struct firmware *fw; | ||
21 | size_t pos; | ||
22 | }; | ||
23 | |||
24 | struct sigma_firmware_header { | ||
25 | unsigned char magic[7]; | ||
26 | u8 version; | ||
27 | __le32 crc; | ||
28 | }; | ||
29 | |||
30 | enum { | ||
31 | SIGMA_ACTION_WRITEXBYTES = 0, | ||
32 | SIGMA_ACTION_WRITESINGLE, | ||
33 | SIGMA_ACTION_WRITESAFELOAD, | ||
34 | SIGMA_ACTION_DELAY, | ||
35 | SIGMA_ACTION_PLLWAIT, | ||
36 | SIGMA_ACTION_NOOP, | ||
37 | SIGMA_ACTION_END, | ||
38 | }; | ||
39 | |||
40 | struct sigma_action { | ||
41 | u8 instr; | ||
42 | u8 len_hi; | ||
43 | __le16 len; | ||
44 | __be16 addr; | ||
45 | unsigned char payload[]; | ||
46 | }; | ||
47 | |||
48 | static inline u32 sigma_action_len(struct sigma_action *sa) | ||
49 | { | ||
50 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); | ||
51 | } | ||
52 | |||
53 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); | ||
54 | |||
55 | #endif | ||
diff --git a/include/linux/smb349-charger.h b/include/linux/smb349-charger.h new file mode 100644 index 00000000000..116f036baf1 --- /dev/null +++ b/include/linux/smb349-charger.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * include/linux/smb349-charger.h | ||
3 | * | ||
4 | * Battery charger driver interface for Summit SMB349 | ||
5 | * | ||
6 | * Copyright (C) 2012 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_SMB349_CHARGER_H | ||
24 | #define __LINUX_SMB349_CHARGER_H | ||
25 | |||
26 | #include <linux/regulator/machine.h> | ||
27 | |||
28 | enum charging_states { | ||
29 | idle, | ||
30 | progress, | ||
31 | completed, | ||
32 | stopped, | ||
33 | }; | ||
34 | |||
35 | enum charger_type { | ||
36 | AC, | ||
37 | USB, | ||
38 | }; | ||
39 | |||
40 | typedef void (*charging_callback_t)(enum charging_states state, | ||
41 | enum charger_type chrg_type, void *args); | ||
42 | |||
43 | struct smb349_charger { | ||
44 | struct i2c_client *client; | ||
45 | struct device *dev; | ||
46 | void *charger_cb_data; | ||
47 | enum charging_states state; | ||
48 | enum charger_type chrg_type; | ||
49 | charging_callback_t charger_cb; | ||
50 | }; | ||
51 | |||
52 | int smb349_battery_online(void); | ||
53 | typedef void (*callback_t)(enum usb_otg_state to, | ||
54 | enum usb_otg_state from, void *args); | ||
55 | /* | ||
56 | * Register callback function for the client. | ||
57 | * Used by fuel-gauge driver to get battery charging properties. | ||
58 | */ | ||
59 | extern int register_callback(charging_callback_t cb, void *args); | ||
60 | extern int register_otg_callback(callback_t cb, void *args); | ||
61 | extern int update_charger_status(void); | ||
62 | |||
63 | #endif /*__LINUX_SMB349_CHARGER_H */ | ||
diff --git a/include/linux/snmp.h b/include/linux/snmp.h new file mode 100644 index 00000000000..e16557a357e --- /dev/null +++ b/include/linux/snmp.h | |||
@@ -0,0 +1,272 @@ | |||
1 | /* | ||
2 | * Definitions for MIBs | ||
3 | * | ||
4 | * Author: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> | ||
5 | */ | ||
6 | |||
7 | #ifndef _LINUX_SNMP_H | ||
8 | #define _LINUX_SNMP_H | ||
9 | |||
10 | /* ipstats mib definitions */ | ||
11 | /* | ||
12 | * RFC 1213: MIB-II | ||
13 | * RFC 2011 (updates 1213): SNMPv2-MIB-IP | ||
14 | * RFC 2863: Interfaces Group MIB | ||
15 | * RFC 2465: IPv6 MIB: General Group | ||
16 | * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables | ||
17 | */ | ||
18 | enum | ||
19 | { | ||
20 | IPSTATS_MIB_NUM = 0, | ||
21 | IPSTATS_MIB_INPKTS, /* InReceives */ | ||
22 | IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ | ||
23 | IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ | ||
24 | IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ | ||
25 | IPSTATS_MIB_INADDRERRORS, /* InAddrErrors */ | ||
26 | IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ | ||
27 | IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ | ||
28 | IPSTATS_MIB_INDISCARDS, /* InDiscards */ | ||
29 | IPSTATS_MIB_INDELIVERS, /* InDelivers */ | ||
30 | IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ | ||
31 | IPSTATS_MIB_OUTPKTS, /* OutRequests */ | ||
32 | IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ | ||
33 | IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ | ||
34 | IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ | ||
35 | IPSTATS_MIB_REASMREQDS, /* ReasmReqds */ | ||
36 | IPSTATS_MIB_REASMOKS, /* ReasmOKs */ | ||
37 | IPSTATS_MIB_REASMFAILS, /* ReasmFails */ | ||
38 | IPSTATS_MIB_FRAGOKS, /* FragOKs */ | ||
39 | IPSTATS_MIB_FRAGFAILS, /* FragFails */ | ||
40 | IPSTATS_MIB_FRAGCREATES, /* FragCreates */ | ||
41 | IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */ | ||
42 | IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ | ||
43 | IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ | ||
44 | IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ | ||
45 | IPSTATS_MIB_INOCTETS, /* InOctets */ | ||
46 | IPSTATS_MIB_OUTOCTETS, /* OutOctets */ | ||
47 | IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ | ||
48 | IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ | ||
49 | IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ | ||
50 | IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ | ||
51 | __IPSTATS_MIB_MAX | ||
52 | }; | ||
53 | |||
54 | /* icmp mib definitions */ | ||
55 | /* | ||
56 | * RFC 1213: MIB-II ICMP Group | ||
57 | * RFC 2011 (updates 1213): SNMPv2 MIB for IP: ICMP group | ||
58 | */ | ||
59 | enum | ||
60 | { | ||
61 | ICMP_MIB_NUM = 0, | ||
62 | ICMP_MIB_INMSGS, /* InMsgs */ | ||
63 | ICMP_MIB_INERRORS, /* InErrors */ | ||
64 | ICMP_MIB_INDESTUNREACHS, /* InDestUnreachs */ | ||
65 | ICMP_MIB_INTIMEEXCDS, /* InTimeExcds */ | ||
66 | ICMP_MIB_INPARMPROBS, /* InParmProbs */ | ||
67 | ICMP_MIB_INSRCQUENCHS, /* InSrcQuenchs */ | ||
68 | ICMP_MIB_INREDIRECTS, /* InRedirects */ | ||
69 | ICMP_MIB_INECHOS, /* InEchos */ | ||
70 | ICMP_MIB_INECHOREPS, /* InEchoReps */ | ||
71 | ICMP_MIB_INTIMESTAMPS, /* InTimestamps */ | ||
72 | ICMP_MIB_INTIMESTAMPREPS, /* InTimestampReps */ | ||
73 | ICMP_MIB_INADDRMASKS, /* InAddrMasks */ | ||
74 | ICMP_MIB_INADDRMASKREPS, /* InAddrMaskReps */ | ||
75 | ICMP_MIB_OUTMSGS, /* OutMsgs */ | ||
76 | ICMP_MIB_OUTERRORS, /* OutErrors */ | ||
77 | ICMP_MIB_OUTDESTUNREACHS, /* OutDestUnreachs */ | ||
78 | ICMP_MIB_OUTTIMEEXCDS, /* OutTimeExcds */ | ||
79 | ICMP_MIB_OUTPARMPROBS, /* OutParmProbs */ | ||
80 | ICMP_MIB_OUTSRCQUENCHS, /* OutSrcQuenchs */ | ||
81 | ICMP_MIB_OUTREDIRECTS, /* OutRedirects */ | ||
82 | ICMP_MIB_OUTECHOS, /* OutEchos */ | ||
83 | ICMP_MIB_OUTECHOREPS, /* OutEchoReps */ | ||
84 | ICMP_MIB_OUTTIMESTAMPS, /* OutTimestamps */ | ||
85 | ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ | ||
86 | ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ | ||
87 | ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ | ||
88 | __ICMP_MIB_MAX | ||
89 | }; | ||
90 | |||
91 | #define __ICMPMSG_MIB_MAX 512 /* Out+In for all 8-bit ICMP types */ | ||
92 | |||
93 | /* icmp6 mib definitions */ | ||
94 | /* | ||
95 | * RFC 2466: ICMPv6-MIB | ||
96 | */ | ||
97 | enum | ||
98 | { | ||
99 | ICMP6_MIB_NUM = 0, | ||
100 | ICMP6_MIB_INMSGS, /* InMsgs */ | ||
101 | ICMP6_MIB_INERRORS, /* InErrors */ | ||
102 | ICMP6_MIB_OUTMSGS, /* OutMsgs */ | ||
103 | ICMP6_MIB_OUTERRORS, /* OutErrors */ | ||
104 | __ICMP6_MIB_MAX | ||
105 | }; | ||
106 | |||
107 | #define __ICMP6MSG_MIB_MAX 512 /* Out+In for all 8-bit ICMPv6 types */ | ||
108 | |||
109 | /* tcp mib definitions */ | ||
110 | /* | ||
111 | * RFC 1213: MIB-II TCP group | ||
112 | * RFC 2012 (updates 1213): SNMPv2-MIB-TCP | ||
113 | */ | ||
114 | enum | ||
115 | { | ||
116 | TCP_MIB_NUM = 0, | ||
117 | TCP_MIB_RTOALGORITHM, /* RtoAlgorithm */ | ||
118 | TCP_MIB_RTOMIN, /* RtoMin */ | ||
119 | TCP_MIB_RTOMAX, /* RtoMax */ | ||
120 | TCP_MIB_MAXCONN, /* MaxConn */ | ||
121 | TCP_MIB_ACTIVEOPENS, /* ActiveOpens */ | ||
122 | TCP_MIB_PASSIVEOPENS, /* PassiveOpens */ | ||
123 | TCP_MIB_ATTEMPTFAILS, /* AttemptFails */ | ||
124 | TCP_MIB_ESTABRESETS, /* EstabResets */ | ||
125 | TCP_MIB_CURRESTAB, /* CurrEstab */ | ||
126 | TCP_MIB_INSEGS, /* InSegs */ | ||
127 | TCP_MIB_OUTSEGS, /* OutSegs */ | ||
128 | TCP_MIB_RETRANSSEGS, /* RetransSegs */ | ||
129 | TCP_MIB_INERRS, /* InErrs */ | ||
130 | TCP_MIB_OUTRSTS, /* OutRsts */ | ||
131 | __TCP_MIB_MAX | ||
132 | }; | ||
133 | |||
134 | /* udp mib definitions */ | ||
135 | /* | ||
136 | * RFC 1213: MIB-II UDP group | ||
137 | * RFC 2013 (updates 1213): SNMPv2-MIB-UDP | ||
138 | */ | ||
139 | enum | ||
140 | { | ||
141 | UDP_MIB_NUM = 0, | ||
142 | UDP_MIB_INDATAGRAMS, /* InDatagrams */ | ||
143 | UDP_MIB_NOPORTS, /* NoPorts */ | ||
144 | UDP_MIB_INERRORS, /* InErrors */ | ||
145 | UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ | ||
146 | UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ | ||
147 | UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ | ||
148 | __UDP_MIB_MAX | ||
149 | }; | ||
150 | |||
151 | /* linux mib definitions */ | ||
152 | enum | ||
153 | { | ||
154 | LINUX_MIB_NUM = 0, | ||
155 | LINUX_MIB_SYNCOOKIESSENT, /* SyncookiesSent */ | ||
156 | LINUX_MIB_SYNCOOKIESRECV, /* SyncookiesRecv */ | ||
157 | LINUX_MIB_SYNCOOKIESFAILED, /* SyncookiesFailed */ | ||
158 | LINUX_MIB_EMBRYONICRSTS, /* EmbryonicRsts */ | ||
159 | LINUX_MIB_PRUNECALLED, /* PruneCalled */ | ||
160 | LINUX_MIB_RCVPRUNED, /* RcvPruned */ | ||
161 | LINUX_MIB_OFOPRUNED, /* OfoPruned */ | ||
162 | LINUX_MIB_OUTOFWINDOWICMPS, /* OutOfWindowIcmps */ | ||
163 | LINUX_MIB_LOCKDROPPEDICMPS, /* LockDroppedIcmps */ | ||
164 | LINUX_MIB_ARPFILTER, /* ArpFilter */ | ||
165 | LINUX_MIB_TIMEWAITED, /* TimeWaited */ | ||
166 | LINUX_MIB_TIMEWAITRECYCLED, /* TimeWaitRecycled */ | ||
167 | LINUX_MIB_TIMEWAITKILLED, /* TimeWaitKilled */ | ||
168 | LINUX_MIB_PAWSPASSIVEREJECTED, /* PAWSPassiveRejected */ | ||
169 | LINUX_MIB_PAWSACTIVEREJECTED, /* PAWSActiveRejected */ | ||
170 | LINUX_MIB_PAWSESTABREJECTED, /* PAWSEstabRejected */ | ||
171 | LINUX_MIB_DELAYEDACKS, /* DelayedACKs */ | ||
172 | LINUX_MIB_DELAYEDACKLOCKED, /* DelayedACKLocked */ | ||
173 | LINUX_MIB_DELAYEDACKLOST, /* DelayedACKLost */ | ||
174 | LINUX_MIB_LISTENOVERFLOWS, /* ListenOverflows */ | ||
175 | LINUX_MIB_LISTENDROPS, /* ListenDrops */ | ||
176 | LINUX_MIB_TCPPREQUEUED, /* TCPPrequeued */ | ||
177 | LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG, /* TCPDirectCopyFromBacklog */ | ||
178 | LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE, /* TCPDirectCopyFromPrequeue */ | ||
179 | LINUX_MIB_TCPPREQUEUEDROPPED, /* TCPPrequeueDropped */ | ||
180 | LINUX_MIB_TCPHPHITS, /* TCPHPHits */ | ||
181 | LINUX_MIB_TCPHPHITSTOUSER, /* TCPHPHitsToUser */ | ||
182 | LINUX_MIB_TCPPUREACKS, /* TCPPureAcks */ | ||
183 | LINUX_MIB_TCPHPACKS, /* TCPHPAcks */ | ||
184 | LINUX_MIB_TCPRENORECOVERY, /* TCPRenoRecovery */ | ||
185 | LINUX_MIB_TCPSACKRECOVERY, /* TCPSackRecovery */ | ||
186 | LINUX_MIB_TCPSACKRENEGING, /* TCPSACKReneging */ | ||
187 | LINUX_MIB_TCPFACKREORDER, /* TCPFACKReorder */ | ||
188 | LINUX_MIB_TCPSACKREORDER, /* TCPSACKReorder */ | ||
189 | LINUX_MIB_TCPRENOREORDER, /* TCPRenoReorder */ | ||
190 | LINUX_MIB_TCPTSREORDER, /* TCPTSReorder */ | ||
191 | LINUX_MIB_TCPFULLUNDO, /* TCPFullUndo */ | ||
192 | LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ | ||
193 | LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ | ||
194 | LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ | ||
195 | LINUX_MIB_TCPLOSS, /* TCPLoss */ | ||
196 | LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ | ||
197 | LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ | ||
198 | LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ | ||
199 | LINUX_MIB_TCPLOSSFAILURES, /* TCPLossFailures */ | ||
200 | LINUX_MIB_TCPFASTRETRANS, /* TCPFastRetrans */ | ||
201 | LINUX_MIB_TCPFORWARDRETRANS, /* TCPForwardRetrans */ | ||
202 | LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ | ||
203 | LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ | ||
204 | LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ | ||
205 | LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ | ||
206 | LINUX_MIB_TCPSCHEDULERFAILED, /* TCPSchedulerFailed */ | ||
207 | LINUX_MIB_TCPRCVCOLLAPSED, /* TCPRcvCollapsed */ | ||
208 | LINUX_MIB_TCPDSACKOLDSENT, /* TCPDSACKOldSent */ | ||
209 | LINUX_MIB_TCPDSACKOFOSENT, /* TCPDSACKOfoSent */ | ||
210 | LINUX_MIB_TCPDSACKRECV, /* TCPDSACKRecv */ | ||
211 | LINUX_MIB_TCPDSACKOFORECV, /* TCPDSACKOfoRecv */ | ||
212 | LINUX_MIB_TCPABORTONSYN, /* TCPAbortOnSyn */ | ||
213 | LINUX_MIB_TCPABORTONDATA, /* TCPAbortOnData */ | ||
214 | LINUX_MIB_TCPABORTONCLOSE, /* TCPAbortOnClose */ | ||
215 | LINUX_MIB_TCPABORTONMEMORY, /* TCPAbortOnMemory */ | ||
216 | LINUX_MIB_TCPABORTONTIMEOUT, /* TCPAbortOnTimeout */ | ||
217 | LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ | ||
218 | LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ | ||
219 | LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ | ||
220 | LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */ | ||
221 | LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ | ||
222 | LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ | ||
223 | LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ | ||
224 | LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ | ||
225 | LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ | ||
226 | LINUX_MIB_SACKSHIFTED, | ||
227 | LINUX_MIB_SACKMERGED, | ||
228 | LINUX_MIB_SACKSHIFTFALLBACK, | ||
229 | LINUX_MIB_TCPBACKLOGDROP, | ||
230 | LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ | ||
231 | LINUX_MIB_TCPDEFERACCEPTDROP, | ||
232 | LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ | ||
233 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ | ||
234 | LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ | ||
235 | LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ | ||
236 | __LINUX_MIB_MAX | ||
237 | }; | ||
238 | |||
239 | /* linux Xfrm mib definitions */ | ||
240 | enum | ||
241 | { | ||
242 | LINUX_MIB_XFRMNUM = 0, | ||
243 | LINUX_MIB_XFRMINERROR, /* XfrmInError */ | ||
244 | LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */ | ||
245 | LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */ | ||
246 | LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ | ||
247 | LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ | ||
248 | LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ | ||
249 | LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */ | ||
250 | LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ | ||
251 | LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ | ||
252 | LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ | ||
253 | LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */ | ||
254 | LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */ | ||
255 | LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */ | ||
256 | LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */ | ||
257 | LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */ | ||
258 | LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */ | ||
259 | LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */ | ||
260 | LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ | ||
261 | LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ | ||
262 | LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ | ||
263 | LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */ | ||
264 | LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ | ||
265 | LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ | ||
266 | LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ | ||
267 | LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ | ||
268 | LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ | ||
269 | __LINUX_MIB_XFRMMAX | ||
270 | }; | ||
271 | |||
272 | #endif /* _LINUX_SNMP_H */ | ||
diff --git a/include/linux/sockios.h b/include/linux/sockios.h new file mode 100644 index 00000000000..f7ffe36db03 --- /dev/null +++ b/include/linux/sockios.h | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Definitions of the socket-level I/O control calls. | ||
7 | * | ||
8 | * Version: @(#)sockios.h 1.0.2 03/09/93 | ||
9 | * | ||
10 | * Authors: Ross Biro | ||
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | #ifndef _LINUX_SOCKIOS_H | ||
19 | #define _LINUX_SOCKIOS_H | ||
20 | |||
21 | #include <asm/sockios.h> | ||
22 | |||
23 | /* Linux-specific socket ioctls */ | ||
24 | #define SIOCINQ FIONREAD | ||
25 | #define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ | ||
26 | |||
27 | /* Routing table calls. */ | ||
28 | #define SIOCADDRT 0x890B /* add routing table entry */ | ||
29 | #define SIOCDELRT 0x890C /* delete routing table entry */ | ||
30 | #define SIOCRTMSG 0x890D /* call to routing system */ | ||
31 | |||
32 | /* Socket configuration controls. */ | ||
33 | #define SIOCGIFNAME 0x8910 /* get iface name */ | ||
34 | #define SIOCSIFLINK 0x8911 /* set iface channel */ | ||
35 | #define SIOCGIFCONF 0x8912 /* get iface list */ | ||
36 | #define SIOCGIFFLAGS 0x8913 /* get flags */ | ||
37 | #define SIOCSIFFLAGS 0x8914 /* set flags */ | ||
38 | #define SIOCGIFADDR 0x8915 /* get PA address */ | ||
39 | #define SIOCSIFADDR 0x8916 /* set PA address */ | ||
40 | #define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ | ||
41 | #define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ | ||
42 | #define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ | ||
43 | #define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ | ||
44 | #define SIOCGIFNETMASK 0x891b /* get network PA mask */ | ||
45 | #define SIOCSIFNETMASK 0x891c /* set network PA mask */ | ||
46 | #define SIOCGIFMETRIC 0x891d /* get metric */ | ||
47 | #define SIOCSIFMETRIC 0x891e /* set metric */ | ||
48 | #define SIOCGIFMEM 0x891f /* get memory address (BSD) */ | ||
49 | #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ | ||
50 | #define SIOCGIFMTU 0x8921 /* get MTU size */ | ||
51 | #define SIOCSIFMTU 0x8922 /* set MTU size */ | ||
52 | #define SIOCSIFNAME 0x8923 /* set interface name */ | ||
53 | #define SIOCSIFHWADDR 0x8924 /* set hardware address */ | ||
54 | #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ | ||
55 | #define SIOCSIFENCAP 0x8926 | ||
56 | #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ | ||
57 | #define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ | ||
58 | #define SIOCSIFSLAVE 0x8930 | ||
59 | #define SIOCADDMULTI 0x8931 /* Multicast address lists */ | ||
60 | #define SIOCDELMULTI 0x8932 | ||
61 | #define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ | ||
62 | #define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ | ||
63 | #define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ | ||
64 | #define SIOCGIFPFLAGS 0x8935 | ||
65 | #define SIOCDIFADDR 0x8936 /* delete PA address */ | ||
66 | #define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ | ||
67 | #define SIOCGIFCOUNT 0x8938 /* get number of devices */ | ||
68 | #define SIOCKILLADDR 0x8939 /* kill sockets with this local addr */ | ||
69 | |||
70 | #define SIOCGIFBR 0x8940 /* Bridging support */ | ||
71 | #define SIOCSIFBR 0x8941 /* Set bridging options */ | ||
72 | |||
73 | #define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ | ||
74 | #define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ | ||
75 | |||
76 | /* SIOCGIFDIVERT was: 0x8944 Frame diversion support */ | ||
77 | /* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */ | ||
78 | |||
79 | #define SIOCETHTOOL 0x8946 /* Ethtool interface */ | ||
80 | |||
81 | #define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ | ||
82 | #define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ | ||
83 | #define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ | ||
84 | |||
85 | #define SIOCWANDEV 0x894A /* get/set netdev parameters */ | ||
86 | |||
87 | #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ | ||
88 | |||
89 | /* ARP cache control calls. */ | ||
90 | /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ | ||
91 | #define SIOCDARP 0x8953 /* delete ARP table entry */ | ||
92 | #define SIOCGARP 0x8954 /* get ARP table entry */ | ||
93 | #define SIOCSARP 0x8955 /* set ARP table entry */ | ||
94 | |||
95 | /* RARP cache control calls. */ | ||
96 | #define SIOCDRARP 0x8960 /* delete RARP table entry */ | ||
97 | #define SIOCGRARP 0x8961 /* get RARP table entry */ | ||
98 | #define SIOCSRARP 0x8962 /* set RARP table entry */ | ||
99 | |||
100 | /* Driver configuration calls */ | ||
101 | |||
102 | #define SIOCGIFMAP 0x8970 /* Get device parameters */ | ||
103 | #define SIOCSIFMAP 0x8971 /* Set device parameters */ | ||
104 | |||
105 | /* DLCI configuration calls */ | ||
106 | |||
107 | #define SIOCADDDLCI 0x8980 /* Create new DLCI device */ | ||
108 | #define SIOCDELDLCI 0x8981 /* Delete DLCI device */ | ||
109 | |||
110 | #define SIOCGIFVLAN 0x8982 /* 802.1Q VLAN support */ | ||
111 | #define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ | ||
112 | |||
113 | /* bonding calls */ | ||
114 | |||
115 | #define SIOCBONDENSLAVE 0x8990 /* enslave a device to the bond */ | ||
116 | #define SIOCBONDRELEASE 0x8991 /* release a slave from the bond*/ | ||
117 | #define SIOCBONDSETHWADDR 0x8992 /* set the hw addr of the bond */ | ||
118 | #define SIOCBONDSLAVEINFOQUERY 0x8993 /* rtn info about slave state */ | ||
119 | #define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ | ||
120 | #define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ | ||
121 | |||
122 | /* bridge calls */ | ||
123 | #define SIOCBRADDBR 0x89a0 /* create new bridge device */ | ||
124 | #define SIOCBRDELBR 0x89a1 /* remove bridge device */ | ||
125 | #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ | ||
126 | #define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ | ||
127 | |||
128 | /* hardware time stamping: parameters in linux/net_tstamp.h */ | ||
129 | #define SIOCSHWTSTAMP 0x89b0 | ||
130 | |||
131 | /* Device private ioctl calls */ | ||
132 | |||
133 | /* | ||
134 | * These 16 ioctls are available to devices via the do_ioctl() device | ||
135 | * vector. Each device should include this file and redefine these names | ||
136 | * as their own. Because these are device dependent it is a good idea | ||
137 | * _NOT_ to issue them to random objects and hope. | ||
138 | * | ||
139 | * THESE IOCTLS ARE _DEPRECATED_ AND WILL DISAPPEAR IN 2.5.X -DaveM | ||
140 | */ | ||
141 | |||
142 | #define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ | ||
143 | |||
144 | /* | ||
145 | * These 16 ioctl calls are protocol private | ||
146 | */ | ||
147 | |||
148 | #define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ | ||
149 | #endif /* _LINUX_SOCKIOS_H */ | ||
diff --git a/include/linux/som.h b/include/linux/som.h new file mode 100644 index 00000000000..166594e4e7b --- /dev/null +++ b/include/linux/som.h | |||
@@ -0,0 +1,154 @@ | |||
1 | #ifndef _LINUX_SOM_H | ||
2 | #define _LINUX_SOM_H | ||
3 | |||
4 | /* File format definition for SOM executables / shared libraries */ | ||
5 | |||
6 | /* we need struct timespec */ | ||
7 | #include <linux/time.h> | ||
8 | |||
9 | #define SOM_PAGESIZE 4096 | ||
10 | |||
11 | /* this is the SOM header */ | ||
12 | struct som_hdr { | ||
13 | short system_id; /* magic number - system */ | ||
14 | short a_magic; /* magic number - file type */ | ||
15 | unsigned int version_id; /* versiod ID: YYMMDDHH */ | ||
16 | struct timespec file_time; /* system clock */ | ||
17 | unsigned int entry_space; /* space for entry point */ | ||
18 | unsigned int entry_subspace; /* subspace for entry point */ | ||
19 | unsigned int entry_offset; /* offset of entry point */ | ||
20 | unsigned int aux_header_location; /* auxiliary header location */ | ||
21 | unsigned int aux_header_size; /* auxiliary header size */ | ||
22 | unsigned int som_length; /* length of entire SOM */ | ||
23 | unsigned int presumed_dp; /* compiler's DP value */ | ||
24 | unsigned int space_location; /* space dictionary location */ | ||
25 | unsigned int space_total; /* number of space entries */ | ||
26 | unsigned int subspace_location; /* subspace entries location */ | ||
27 | unsigned int subspace_total; /* number of subspace entries */ | ||
28 | unsigned int loader_fixup_location; /* MPE/iX loader fixup */ | ||
29 | unsigned int loader_fixup_total; /* number of fixup records */ | ||
30 | unsigned int space_strings_location; /* (sub)space names */ | ||
31 | unsigned int space_strings_size; /* size of strings area */ | ||
32 | unsigned int init_array_location; /* reserved */ | ||
33 | unsigned int init_array_total; /* reserved */ | ||
34 | unsigned int compiler_location; /* module dictionary */ | ||
35 | unsigned int compiler_total; /* number of modules */ | ||
36 | unsigned int symbol_location; /* symbol dictionary */ | ||
37 | unsigned int symbol_total; /* number of symbols */ | ||
38 | unsigned int fixup_request_location; /* fixup requests */ | ||
39 | unsigned int fixup_request_total; /* number of fixup requests */ | ||
40 | unsigned int symbol_strings_location;/* module & symbol names area */ | ||
41 | unsigned int symbol_strings_size; /* size of strings area */ | ||
42 | unsigned int unloadable_sp_location; /* unloadable spaces location */ | ||
43 | unsigned int unloadable_sp_size; /* size of data */ | ||
44 | unsigned int checksum; | ||
45 | }; | ||
46 | |||
47 | /* values for system_id */ | ||
48 | |||
49 | #define SOM_SID_PARISC_1_0 0x020b | ||
50 | #define SOM_SID_PARISC_1_1 0x0210 | ||
51 | #define SOM_SID_PARISC_2_0 0x0214 | ||
52 | |||
53 | /* values for a_magic */ | ||
54 | |||
55 | #define SOM_LIB_EXEC 0x0104 | ||
56 | #define SOM_RELOCATABLE 0x0106 | ||
57 | #define SOM_EXEC_NONSHARE 0x0107 | ||
58 | #define SOM_EXEC_SHARE 0x0108 | ||
59 | #define SOM_EXEC_DEMAND 0x010B | ||
60 | #define SOM_LIB_DYN 0x010D | ||
61 | #define SOM_LIB_SHARE 0x010E | ||
62 | #define SOM_LIB_RELOC 0x0619 | ||
63 | |||
64 | /* values for version_id. Decimal not hex, yes. Grr. */ | ||
65 | |||
66 | #define SOM_ID_OLD 85082112 | ||
67 | #define SOM_ID_NEW 87102412 | ||
68 | |||
69 | struct aux_id { | ||
70 | unsigned int mandatory :1; /* the linker must understand this */ | ||
71 | unsigned int copy :1; /* Must be copied by the linker */ | ||
72 | unsigned int append :1; /* Must be merged by the linker */ | ||
73 | unsigned int ignore :1; /* Discard section if unknown */ | ||
74 | unsigned int reserved :12; | ||
75 | unsigned int type :16; /* Header type */ | ||
76 | unsigned int length; /* length of _following_ data */ | ||
77 | }; | ||
78 | |||
79 | /* The Exec Auxiliary Header. Called The HP-UX Header within HP apparently. */ | ||
80 | struct som_exec_auxhdr { | ||
81 | struct aux_id som_auxhdr; | ||
82 | int exec_tsize; /* Text size in bytes */ | ||
83 | int exec_tmem; /* Address to load text at */ | ||
84 | int exec_tfile; /* Location of text in file */ | ||
85 | int exec_dsize; /* Data size in bytes */ | ||
86 | int exec_dmem; /* Address to load data at */ | ||
87 | int exec_dfile; /* Location of data in file */ | ||
88 | int exec_bsize; /* Uninitialised data (bss) */ | ||
89 | int exec_entry; /* Address to start executing */ | ||
90 | int exec_flags; /* loader flags */ | ||
91 | int exec_bfill; /* initialisation value for bss */ | ||
92 | }; | ||
93 | |||
94 | /* Oh, the things people do to avoid casts. Shame it'll break with gcc's | ||
95 | * new aliasing rules really. | ||
96 | */ | ||
97 | union name_pt { | ||
98 | char * n_name; | ||
99 | unsigned int n_strx; | ||
100 | }; | ||
101 | |||
102 | /* The Space Dictionary */ | ||
103 | struct space_dictionary_record { | ||
104 | union name_pt name; /* index to subspace name */ | ||
105 | unsigned int is_loadable :1; /* loadable */ | ||
106 | unsigned int is_defined :1; /* defined within file */ | ||
107 | unsigned int is_private :1; /* not sharable */ | ||
108 | unsigned int has_intermediate_code :1; /* contains intermediate code */ | ||
109 | unsigned int is_tspecific :1; /* thread specific */ | ||
110 | unsigned int reserved :11; /* for future expansion */ | ||
111 | unsigned int sort_key :8; /* for linker */ | ||
112 | unsigned int reserved2 :8; /* for future expansion */ | ||
113 | |||
114 | int space_number; /* index */ | ||
115 | int subspace_index; /* index into subspace dict */ | ||
116 | unsigned int subspace_quantity; /* number of subspaces */ | ||
117 | int loader_fix_index; /* for loader */ | ||
118 | unsigned int loader_fix_quantity; /* for loader */ | ||
119 | int init_pointer_index; /* data pointer array index */ | ||
120 | unsigned int init_pointer_quantity; /* number of data pointers */ | ||
121 | }; | ||
122 | |||
123 | /* The Subspace Dictionary */ | ||
124 | struct subspace_dictionary_record { | ||
125 | int space_index; | ||
126 | unsigned int access_control_bits :7; | ||
127 | unsigned int memory_resident :1; | ||
128 | unsigned int dup_common :1; | ||
129 | unsigned int is_common :1; | ||
130 | unsigned int quadrant :2; | ||
131 | unsigned int initially_frozen :1; | ||
132 | unsigned int is_first :1; | ||
133 | unsigned int code_only :1; | ||
134 | unsigned int sort_key :8; | ||
135 | unsigned int replicate_init :1; | ||
136 | unsigned int continuation :1; | ||
137 | unsigned int is_tspecific :1; | ||
138 | unsigned int is_comdat :1; | ||
139 | unsigned int reserved :4; | ||
140 | |||
141 | int file_loc_init_value; | ||
142 | unsigned int initialization_length; | ||
143 | unsigned int subspace_start; | ||
144 | unsigned int subspace_length; | ||
145 | |||
146 | unsigned int reserved2 :5; | ||
147 | unsigned int alignment :27; | ||
148 | |||
149 | union name_pt name; | ||
150 | int fixup_request_index; | ||
151 | unsigned int fixup_request_quantity; | ||
152 | }; | ||
153 | |||
154 | #endif /* _LINUX_SOM_H */ | ||
diff --git a/include/linux/spi-tegra.h b/include/linux/spi-tegra.h new file mode 100644 index 00000000000..38096500551 --- /dev/null +++ b/include/linux/spi-tegra.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * include/linux/spi-tegra.c | ||
3 | * | ||
4 | * Copyright (C) 2011 NVIDIA Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_SPI_TEGRA_H | ||
22 | #define _LINUX_SPI_TEGRA_H | ||
23 | |||
24 | #include <linux/clk.h> | ||
25 | |||
26 | struct spi_clk_parent { | ||
27 | const char *name; | ||
28 | struct clk *parent_clk; | ||
29 | unsigned long fixed_clk_rate; | ||
30 | }; | ||
31 | |||
32 | struct tegra_spi_platform_data { | ||
33 | bool is_dma_based; | ||
34 | int max_dma_buffer; | ||
35 | bool is_clkon_always; | ||
36 | unsigned int max_rate; | ||
37 | struct spi_clk_parent *parent_clk_list; | ||
38 | int parent_clk_count; | ||
39 | }; | ||
40 | |||
41 | /* Controller data from device to pass some info like | ||
42 | * hw based chip select can be used or not and if yes | ||
43 | * then CS hold and setup time. */ | ||
44 | struct tegra_spi_device_controller_data { | ||
45 | bool is_hw_based_cs; | ||
46 | int cs_setup_clk_count; | ||
47 | int cs_hold_clk_count; | ||
48 | }; | ||
49 | |||
50 | #endif /* _LINUX_SPI_TEGRA_H */ | ||
diff --git a/include/linux/spi/Kbuild b/include/linux/spi/Kbuild new file mode 100644 index 00000000000..d375a082986 --- /dev/null +++ b/include/linux/spi/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += spidev.h | |||
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h new file mode 100644 index 00000000000..decf6d8c77b --- /dev/null +++ b/include/linux/spi/orion_spi.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * orion_spi.h | ||
3 | * | ||
4 | * This file is licensed under the terms of the GNU General Public | ||
5 | * License version 2. This program is licensed "as is" without any | ||
6 | * warranty of any kind, whether express or implied. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_SPI_ORION_SPI_H | ||
10 | #define __LINUX_SPI_ORION_SPI_H | ||
11 | |||
12 | struct orion_spi_info { | ||
13 | u32 tclk; /* no <linux/clk.h> support yet */ | ||
14 | u32 enable_clock_fix; | ||
15 | }; | ||
16 | |||
17 | |||
18 | #endif | ||
diff --git a/include/linux/spi/rm31080a_ts.h b/include/linux/spi/rm31080a_ts.h new file mode 100644 index 00000000000..13323a6f2ec --- /dev/null +++ b/include/linux/spi/rm31080a_ts.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _RM31080A_TS_H_ | ||
2 | #define _RM31080A_TS_H_ | ||
3 | |||
4 | #define ENABLE_RAW_DATA_QUEUE | ||
5 | |||
6 | #define RM_IOCTL_REPORT_POINT 0x1001 | ||
7 | #define RM_IOCTL_SET_HAL_PID 0x1002 | ||
8 | #define RM_IOCTL_INIT_START 0x1003 | ||
9 | #define RM_IOCTL_INIT_END 0x1004 | ||
10 | #define RM_IOCTL_FINISH_CALC 0x1005 | ||
11 | #define RM_IOCTL_SCRIBER_CTRL 0x1006 | ||
12 | #define RM_IOCTL_READ_RAW_DATA 0x1007 | ||
13 | #define RM_IOCTL_AUTOSCAN_CTRL 0x1008 | ||
14 | #define RM_IOCTL_NOISE_CHECK 0x1009 | ||
15 | #define RM_IOCTL_GET_PARAMETER 0x100A | ||
16 | #define RM_IOCTL_SET_PARAMETER 0x100B | ||
17 | |||
18 | #define RM_INPUT_RESOLUTION_X 4096 | ||
19 | #define RM_INPUT_RESOLUTION_Y 4096 | ||
20 | |||
21 | #define RM_TS_SIGNAL 44 | ||
22 | #define RM_TS_MAX_POINTS 16 | ||
23 | |||
24 | #define RM_SIGNAL_INTR 0x00000001 | ||
25 | #define RM_SIGNAL_SUSPEND 0x00000002 | ||
26 | #define RM_SIGNAL_RESUME 0x00000003 | ||
27 | |||
28 | typedef struct { | ||
29 | unsigned char ucTouchCount; | ||
30 | unsigned char ucID[RM_TS_MAX_POINTS]; | ||
31 | unsigned short usX[RM_TS_MAX_POINTS]; | ||
32 | unsigned short usY[RM_TS_MAX_POINTS]; | ||
33 | unsigned short usZ[RM_TS_MAX_POINTS]; | ||
34 | } rm_touch_event; | ||
35 | |||
36 | |||
37 | struct rm_spi_ts_platform_data{ | ||
38 | int gpio_reset; | ||
39 | int x_size; | ||
40 | int y_size; | ||
41 | unsigned char* config; | ||
42 | }; | ||
43 | |||
44 | #endif //_RM31080A_TS_H_ | ||
diff --git a/include/linux/spi/spidev.h b/include/linux/spi/spidev.h new file mode 100644 index 00000000000..52d9ed01855 --- /dev/null +++ b/include/linux/spi/spidev.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * include/linux/spi/spidev.h | ||
3 | * | ||
4 | * Copyright (C) 2006 SWAPP | ||
5 | * Andrea Paterniani <a.paterniani@swapp-eng.it> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef SPIDEV_H | ||
23 | #define SPIDEV_H | ||
24 | |||
25 | #include <linux/types.h> | ||
26 | |||
27 | /* User space versions of kernel symbols for SPI clocking modes, | ||
28 | * matching <linux/spi/spi.h> | ||
29 | */ | ||
30 | |||
31 | #define SPI_CPHA 0x01 | ||
32 | #define SPI_CPOL 0x02 | ||
33 | |||
34 | #define SPI_MODE_0 (0|0) | ||
35 | #define SPI_MODE_1 (0|SPI_CPHA) | ||
36 | #define SPI_MODE_2 (SPI_CPOL|0) | ||
37 | #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) | ||
38 | |||
39 | #define SPI_CS_HIGH 0x04 | ||
40 | #define SPI_LSB_FIRST 0x08 | ||
41 | #define SPI_3WIRE 0x10 | ||
42 | #define SPI_LOOP 0x20 | ||
43 | #define SPI_NO_CS 0x40 | ||
44 | #define SPI_READY 0x80 | ||
45 | |||
46 | /*---------------------------------------------------------------------------*/ | ||
47 | |||
48 | /* IOCTL commands */ | ||
49 | |||
50 | #define SPI_IOC_MAGIC 'k' | ||
51 | |||
52 | /** | ||
53 | * struct spi_ioc_transfer - describes a single SPI transfer | ||
54 | * @tx_buf: Holds pointer to userspace buffer with transmit data, or null. | ||
55 | * If no data is provided, zeroes are shifted out. | ||
56 | * @rx_buf: Holds pointer to userspace buffer for receive data, or null. | ||
57 | * @len: Length of tx and rx buffers, in bytes. | ||
58 | * @speed_hz: Temporary override of the device's bitrate. | ||
59 | * @bits_per_word: Temporary override of the device's wordsize. | ||
60 | * @delay_usecs: If nonzero, how long to delay after the last bit transfer | ||
61 | * before optionally deselecting the device before the next transfer. | ||
62 | * @cs_change: True to deselect device before starting the next transfer. | ||
63 | * | ||
64 | * This structure is mapped directly to the kernel spi_transfer structure; | ||
65 | * the fields have the same meanings, except of course that the pointers | ||
66 | * are in a different address space (and may be of different sizes in some | ||
67 | * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). | ||
68 | * Zero-initialize the structure, including currently unused fields, to | ||
69 | * accommodate potential future updates. | ||
70 | * | ||
71 | * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). | ||
72 | * Pass it an array of related transfers, they'll execute together. | ||
73 | * Each transfer may be half duplex (either direction) or full duplex. | ||
74 | * | ||
75 | * struct spi_ioc_transfer mesg[4]; | ||
76 | * ... | ||
77 | * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg); | ||
78 | * | ||
79 | * So for example one transfer might send a nine bit command (right aligned | ||
80 | * in a 16-bit word), the next could read a block of 8-bit data before | ||
81 | * terminating that command by temporarily deselecting the chip; the next | ||
82 | * could send a different nine bit command (re-selecting the chip), and the | ||
83 | * last transfer might write some register values. | ||
84 | */ | ||
85 | struct spi_ioc_transfer { | ||
86 | __u64 tx_buf; | ||
87 | __u64 rx_buf; | ||
88 | |||
89 | __u32 len; | ||
90 | __u32 speed_hz; | ||
91 | |||
92 | __u16 delay_usecs; | ||
93 | __u8 bits_per_word; | ||
94 | __u8 cs_change; | ||
95 | __u32 pad; | ||
96 | |||
97 | /* If the contents of 'struct spi_ioc_transfer' ever change | ||
98 | * incompatibly, then the ioctl number (currently 0) must change; | ||
99 | * ioctls with constant size fields get a bit more in the way of | ||
100 | * error checking than ones (like this) where that field varies. | ||
101 | * | ||
102 | * NOTE: struct layout is the same in 64bit and 32bit userspace. | ||
103 | */ | ||
104 | }; | ||
105 | |||
106 | /* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */ | ||
107 | #define SPI_MSGSIZE(N) \ | ||
108 | ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ | ||
109 | ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) | ||
110 | #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) | ||
111 | |||
112 | |||
113 | /* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) */ | ||
114 | #define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) | ||
115 | #define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) | ||
116 | |||
117 | /* Read / Write SPI bit justification */ | ||
118 | #define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8) | ||
119 | #define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8) | ||
120 | |||
121 | /* Read / Write SPI device word length (1..N) */ | ||
122 | #define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8) | ||
123 | #define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8) | ||
124 | |||
125 | /* Read / Write SPI device default max speed hz */ | ||
126 | #define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) | ||
127 | #define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) | ||
128 | |||
129 | |||
130 | |||
131 | #endif /* SPIDEV_H */ | ||
diff --git a/include/linux/stallion.h b/include/linux/stallion.h new file mode 100644 index 00000000000..336af33c6ea --- /dev/null +++ b/include/linux/stallion.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /*****************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * stallion.h -- stallion multiport serial driver. | ||
5 | * | ||
6 | * Copyright (C) 1996-1998 Stallion Technologies | ||
7 | * Copyright (C) 1994-1996 Greg Ungerer. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | /*****************************************************************************/ | ||
25 | #ifndef _STALLION_H | ||
26 | #define _STALLION_H | ||
27 | /*****************************************************************************/ | ||
28 | |||
29 | /* | ||
30 | * Define important driver constants here. | ||
31 | */ | ||
32 | #define STL_MAXBRDS 4 | ||
33 | #define STL_MAXPANELS 4 | ||
34 | #define STL_MAXBANKS 8 | ||
35 | #define STL_PORTSPERPANEL 16 | ||
36 | #define STL_MAXPORTS 64 | ||
37 | #define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) | ||
38 | |||
39 | |||
40 | /* | ||
41 | * Define a set of structures to hold all the board/panel/port info | ||
42 | * for our ports. These will be dynamically allocated as required. | ||
43 | */ | ||
44 | |||
45 | /* | ||
46 | * Define a ring queue structure for each port. This will hold the | ||
47 | * TX data waiting to be output. Characters are fed into this buffer | ||
48 | * from the line discipline (or even direct from user space!) and | ||
49 | * then fed into the UARTs during interrupts. Will use a classic ring | ||
50 | * queue here for this. The good thing about this type of ring queue | ||
51 | * is that the head and tail pointers can be updated without interrupt | ||
52 | * protection - since "write" code only needs to change the head, and | ||
53 | * interrupt code only needs to change the tail. | ||
54 | */ | ||
55 | struct stlrq { | ||
56 | char *buf; | ||
57 | char *head; | ||
58 | char *tail; | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | * Port, panel and board structures to hold status info about each. | ||
63 | * The board structure contains pointers to structures for each panel | ||
64 | * connected to it, and in turn each panel structure contains pointers | ||
65 | * for each port structure for each port on that panel. Note that | ||
66 | * the port structure also contains the board and panel number that it | ||
67 | * is associated with, this makes it (fairly) easy to get back to the | ||
68 | * board/panel info for a port. | ||
69 | */ | ||
70 | struct stlport { | ||
71 | unsigned long magic; | ||
72 | struct tty_port port; | ||
73 | unsigned int portnr; | ||
74 | unsigned int panelnr; | ||
75 | unsigned int brdnr; | ||
76 | int ioaddr; | ||
77 | int uartaddr; | ||
78 | unsigned int pagenr; | ||
79 | unsigned long istate; | ||
80 | int baud_base; | ||
81 | int custom_divisor; | ||
82 | int close_delay; | ||
83 | int closing_wait; | ||
84 | int openwaitcnt; | ||
85 | int brklen; | ||
86 | unsigned int sigs; | ||
87 | unsigned int rxignoremsk; | ||
88 | unsigned int rxmarkmsk; | ||
89 | unsigned int imr; | ||
90 | unsigned int crenable; | ||
91 | unsigned long clk; | ||
92 | unsigned long hwid; | ||
93 | void *uartp; | ||
94 | comstats_t stats; | ||
95 | struct stlrq tx; | ||
96 | }; | ||
97 | |||
98 | struct stlpanel { | ||
99 | unsigned long magic; | ||
100 | unsigned int panelnr; | ||
101 | unsigned int brdnr; | ||
102 | unsigned int pagenr; | ||
103 | unsigned int nrports; | ||
104 | int iobase; | ||
105 | void *uartp; | ||
106 | void (*isr)(struct stlpanel *panelp, unsigned int iobase); | ||
107 | unsigned int hwid; | ||
108 | unsigned int ackmask; | ||
109 | struct stlport *ports[STL_PORTSPERPANEL]; | ||
110 | }; | ||
111 | |||
112 | struct stlbrd { | ||
113 | unsigned long magic; | ||
114 | unsigned int brdnr; | ||
115 | unsigned int brdtype; | ||
116 | unsigned int state; | ||
117 | unsigned int nrpanels; | ||
118 | unsigned int nrports; | ||
119 | unsigned int nrbnks; | ||
120 | int irq; | ||
121 | int irqtype; | ||
122 | int (*isr)(struct stlbrd *brdp); | ||
123 | unsigned int ioaddr1; | ||
124 | unsigned int ioaddr2; | ||
125 | unsigned int iosize1; | ||
126 | unsigned int iosize2; | ||
127 | unsigned int iostatus; | ||
128 | unsigned int ioctrl; | ||
129 | unsigned int ioctrlval; | ||
130 | unsigned int hwid; | ||
131 | unsigned long clk; | ||
132 | unsigned int bnkpageaddr[STL_MAXBANKS]; | ||
133 | unsigned int bnkstataddr[STL_MAXBANKS]; | ||
134 | struct stlpanel *bnk2panel[STL_MAXBANKS]; | ||
135 | struct stlpanel *panels[STL_MAXPANELS]; | ||
136 | }; | ||
137 | |||
138 | |||
139 | /* | ||
140 | * Define MAGIC numbers used for above structures. | ||
141 | */ | ||
142 | #define STL_PORTMAGIC 0x5a7182c9 | ||
143 | #define STL_PANELMAGIC 0x7ef621a1 | ||
144 | #define STL_BOARDMAGIC 0xa2267f52 | ||
145 | |||
146 | /*****************************************************************************/ | ||
147 | #endif | ||
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild new file mode 100644 index 00000000000..98df21164a8 --- /dev/null +++ b/include/linux/sunrpc/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += debug.h | |||
diff --git a/include/linux/suspend_ioctls.h b/include/linux/suspend_ioctls.h new file mode 100644 index 00000000000..0b30382984f --- /dev/null +++ b/include/linux/suspend_ioctls.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _LINUX_SUSPEND_IOCTLS_H | ||
2 | #define _LINUX_SUSPEND_IOCTLS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | /* | ||
6 | * This structure is used to pass the values needed for the identification | ||
7 | * of the resume swap area from a user space to the kernel via the | ||
8 | * SNAPSHOT_SET_SWAP_AREA ioctl | ||
9 | */ | ||
10 | struct resume_swap_area { | ||
11 | __kernel_loff_t offset; | ||
12 | __u32 dev; | ||
13 | } __attribute__((packed)); | ||
14 | |||
15 | #define SNAPSHOT_IOC_MAGIC '3' | ||
16 | #define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1) | ||
17 | #define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2) | ||
18 | #define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4) | ||
19 | #define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5) | ||
20 | #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) | ||
21 | #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) | ||
22 | #define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ | ||
23 | struct resume_swap_area) | ||
24 | #define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, __kernel_loff_t) | ||
25 | #define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) | ||
26 | #define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) | ||
27 | #define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) | ||
28 | #define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) | ||
29 | #define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, __kernel_loff_t) | ||
30 | #define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, __kernel_loff_t) | ||
31 | #define SNAPSHOT_IOC_MAXNR 20 | ||
32 | |||
33 | #endif /* _LINUX_SUSPEND_IOCTLS_H */ | ||
diff --git a/include/linux/switch.h b/include/linux/switch.h new file mode 100644 index 00000000000..3e4c748e343 --- /dev/null +++ b/include/linux/switch.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Switch class driver | ||
3 | * | ||
4 | * Copyright (C) 2008 Google, Inc. | ||
5 | * Author: Mike Lockwood <lockwood@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_SWITCH_H__ | ||
19 | #define __LINUX_SWITCH_H__ | ||
20 | |||
21 | struct switch_dev { | ||
22 | const char *name; | ||
23 | struct device *dev; | ||
24 | int index; | ||
25 | int state; | ||
26 | |||
27 | ssize_t (*print_name)(struct switch_dev *sdev, char *buf); | ||
28 | ssize_t (*print_state)(struct switch_dev *sdev, char *buf); | ||
29 | }; | ||
30 | |||
31 | struct gpio_switch_platform_data { | ||
32 | const char *name; | ||
33 | unsigned gpio; | ||
34 | |||
35 | /* if NULL, switch_dev.name will be printed */ | ||
36 | const char *name_on; | ||
37 | const char *name_off; | ||
38 | /* if NULL, "0" or "1" will be printed */ | ||
39 | const char *state_on; | ||
40 | const char *state_off; | ||
41 | }; | ||
42 | |||
43 | extern int switch_dev_register(struct switch_dev *sdev); | ||
44 | extern void switch_dev_unregister(struct switch_dev *sdev); | ||
45 | |||
46 | static inline int switch_get_state(struct switch_dev *sdev) | ||
47 | { | ||
48 | return sdev->state; | ||
49 | } | ||
50 | |||
51 | extern void switch_set_state(struct switch_dev *sdev, int state); | ||
52 | |||
53 | #endif /* __LINUX_SWITCH_H__ */ | ||
diff --git a/include/linux/synaptics_i2c_rmi.h b/include/linux/synaptics_i2c_rmi.h new file mode 100644 index 00000000000..5539cc52077 --- /dev/null +++ b/include/linux/synaptics_i2c_rmi.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * include/linux/synaptics_i2c_rmi.h - platform data structure for f75375s sensor | ||
3 | * | ||
4 | * Copyright (C) 2008 Google, Inc. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_SYNAPTICS_I2C_RMI_H | ||
18 | #define _LINUX_SYNAPTICS_I2C_RMI_H | ||
19 | |||
20 | #define SYNAPTICS_I2C_RMI_NAME "synaptics-rmi-ts" | ||
21 | |||
22 | enum { | ||
23 | SYNAPTICS_FLIP_X = 1UL << 0, | ||
24 | SYNAPTICS_FLIP_Y = 1UL << 1, | ||
25 | SYNAPTICS_SWAP_XY = 1UL << 2, | ||
26 | SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3, | ||
27 | }; | ||
28 | |||
29 | struct synaptics_i2c_rmi_platform_data { | ||
30 | uint32_t version; /* Use this entry for panels with */ | ||
31 | /* (major << 8 | minor) version or above. */ | ||
32 | /* If non-zero another array entry follows */ | ||
33 | int (*power)(int on); /* Only valid in first array entry */ | ||
34 | uint32_t flags; | ||
35 | unsigned long irqflags; | ||
36 | uint32_t inactive_left; /* 0x10000 = screen width */ | ||
37 | uint32_t inactive_right; /* 0x10000 = screen width */ | ||
38 | uint32_t inactive_top; /* 0x10000 = screen height */ | ||
39 | uint32_t inactive_bottom; /* 0x10000 = screen height */ | ||
40 | uint32_t snap_left_on; /* 0x10000 = screen width */ | ||
41 | uint32_t snap_left_off; /* 0x10000 = screen width */ | ||
42 | uint32_t snap_right_on; /* 0x10000 = screen width */ | ||
43 | uint32_t snap_right_off; /* 0x10000 = screen width */ | ||
44 | uint32_t snap_top_on; /* 0x10000 = screen height */ | ||
45 | uint32_t snap_top_off; /* 0x10000 = screen height */ | ||
46 | uint32_t snap_bottom_on; /* 0x10000 = screen height */ | ||
47 | uint32_t snap_bottom_off; /* 0x10000 = screen height */ | ||
48 | uint32_t fuzz_x; /* 0x10000 = screen width */ | ||
49 | uint32_t fuzz_y; /* 0x10000 = screen height */ | ||
50 | int fuzz_p; | ||
51 | int fuzz_w; | ||
52 | int8_t sensitivity_adjust; | ||
53 | }; | ||
54 | |||
55 | #endif /* _LINUX_SYNAPTICS_I2C_RMI_H */ | ||
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h new file mode 100644 index 00000000000..d35e783a598 --- /dev/null +++ b/include/linux/sysdev.h | |||
@@ -0,0 +1,165 @@ | |||
1 | /** | ||
2 | * System devices follow a slightly different driver model. | ||
3 | * They don't need to do dynammic driver binding, can't be probed, | ||
4 | * and don't reside on any type of peripheral bus. | ||
5 | * So, we represent and treat them a little differently. | ||
6 | * | ||
7 | * We still have a notion of a driver for a system device, because we still | ||
8 | * want to perform basic operations on these devices. | ||
9 | * | ||
10 | * We also support auxiliary drivers binding to devices of a certain class. | ||
11 | * | ||
12 | * This allows configurable drivers to register themselves for devices of | ||
13 | * a certain type. And, it allows class definitions to reside in generic | ||
14 | * code while arch-specific code can register specific drivers. | ||
15 | * | ||
16 | * Auxiliary drivers registered with a NULL cls are registered as drivers | ||
17 | * for all system devices, and get notification calls for each device. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #ifndef _SYSDEV_H_ | ||
22 | #define _SYSDEV_H_ | ||
23 | |||
24 | #include <linux/kobject.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/pm.h> | ||
27 | |||
28 | |||
29 | struct sys_device; | ||
30 | struct sysdev_class_attribute; | ||
31 | |||
32 | struct sysdev_class { | ||
33 | const char *name; | ||
34 | struct list_head drivers; | ||
35 | struct sysdev_class_attribute **attrs; | ||
36 | struct kset kset; | ||
37 | }; | ||
38 | |||
39 | struct sysdev_class_attribute { | ||
40 | struct attribute attr; | ||
41 | ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *, | ||
42 | char *); | ||
43 | ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *, | ||
44 | const char *, size_t); | ||
45 | }; | ||
46 | |||
47 | #define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ | ||
48 | { \ | ||
49 | .attr = {.name = __stringify(_name), .mode = _mode }, \ | ||
50 | .show = _show, \ | ||
51 | .store = _store, \ | ||
52 | } | ||
53 | |||
54 | #define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ | ||
55 | struct sysdev_class_attribute attr_##_name = \ | ||
56 | _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) | ||
57 | |||
58 | |||
59 | extern int sysdev_class_register(struct sysdev_class *); | ||
60 | extern void sysdev_class_unregister(struct sysdev_class *); | ||
61 | |||
62 | extern int sysdev_class_create_file(struct sysdev_class *, | ||
63 | struct sysdev_class_attribute *); | ||
64 | extern void sysdev_class_remove_file(struct sysdev_class *, | ||
65 | struct sysdev_class_attribute *); | ||
66 | /** | ||
67 | * Auxiliary system device drivers. | ||
68 | */ | ||
69 | |||
70 | struct sysdev_driver { | ||
71 | struct list_head entry; | ||
72 | int (*add)(struct sys_device *); | ||
73 | int (*remove)(struct sys_device *); | ||
74 | }; | ||
75 | |||
76 | |||
77 | extern int sysdev_driver_register(struct sysdev_class *, struct sysdev_driver *); | ||
78 | extern void sysdev_driver_unregister(struct sysdev_class *, struct sysdev_driver *); | ||
79 | |||
80 | |||
81 | /** | ||
82 | * sys_devices can be simplified a lot from regular devices, because they're | ||
83 | * simply not as versatile. | ||
84 | */ | ||
85 | |||
86 | struct sys_device { | ||
87 | u32 id; | ||
88 | struct sysdev_class * cls; | ||
89 | struct kobject kobj; | ||
90 | }; | ||
91 | |||
92 | extern int sysdev_register(struct sys_device *); | ||
93 | extern void sysdev_unregister(struct sys_device *); | ||
94 | |||
95 | |||
96 | struct sysdev_attribute { | ||
97 | struct attribute attr; | ||
98 | ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *); | ||
99 | ssize_t (*store)(struct sys_device *, struct sysdev_attribute *, | ||
100 | const char *, size_t); | ||
101 | }; | ||
102 | |||
103 | |||
104 | #define _SYSDEV_ATTR(_name, _mode, _show, _store) \ | ||
105 | { \ | ||
106 | .attr = { .name = __stringify(_name), .mode = _mode }, \ | ||
107 | .show = _show, \ | ||
108 | .store = _store, \ | ||
109 | } | ||
110 | |||
111 | #define SYSDEV_ATTR(_name, _mode, _show, _store) \ | ||
112 | struct sysdev_attribute attr_##_name = \ | ||
113 | _SYSDEV_ATTR(_name, _mode, _show, _store); | ||
114 | |||
115 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | ||
116 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | ||
117 | |||
118 | /* Create/remove NULL terminated attribute list */ | ||
119 | static inline int | ||
120 | sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a) | ||
121 | { | ||
122 | return sysfs_create_files(&d->kobj, (const struct attribute **)a); | ||
123 | } | ||
124 | |||
125 | static inline void | ||
126 | sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a) | ||
127 | { | ||
128 | return sysfs_remove_files(&d->kobj, (const struct attribute **)a); | ||
129 | } | ||
130 | |||
131 | struct sysdev_ext_attribute { | ||
132 | struct sysdev_attribute attr; | ||
133 | void *var; | ||
134 | }; | ||
135 | |||
136 | /* | ||
137 | * Support for simple variable sysdev attributes. | ||
138 | * The pointer to the variable is stored in a sysdev_ext_attribute | ||
139 | */ | ||
140 | |||
141 | /* Add more types as needed */ | ||
142 | |||
143 | extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *, | ||
144 | char *); | ||
145 | extern ssize_t sysdev_store_ulong(struct sys_device *, | ||
146 | struct sysdev_attribute *, const char *, size_t); | ||
147 | extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *, | ||
148 | char *); | ||
149 | extern ssize_t sysdev_store_int(struct sys_device *, | ||
150 | struct sysdev_attribute *, const char *, size_t); | ||
151 | |||
152 | #define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
153 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \ | ||
154 | &(_var) } | ||
155 | #define SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
156 | struct sysdev_ext_attribute attr_##_name = \ | ||
157 | _SYSDEV_ULONG_ATTR(_name, _mode, _var); | ||
158 | #define _SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
159 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \ | ||
160 | &(_var) } | ||
161 | #define SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
162 | struct sysdev_ext_attribute attr_##_name = \ | ||
163 | _SYSDEV_INT_ATTR(_name, _mode, _var); | ||
164 | |||
165 | #endif /* _SYSDEV_H_ */ | ||
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h new file mode 100644 index 00000000000..2466e550a41 --- /dev/null +++ b/include/linux/taskstats.h | |||
@@ -0,0 +1,213 @@ | |||
1 | /* taskstats.h - exporting per-task statistics | ||
2 | * | ||
3 | * Copyright (C) Shailabh Nagar, IBM Corp. 2006 | ||
4 | * (C) Balbir Singh, IBM Corp. 2006 | ||
5 | * (C) Jay Lan, SGI, 2006 | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of version 2.1 of the GNU Lesser General Public License | ||
9 | * as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it would be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_TASKSTATS_H | ||
17 | #define _LINUX_TASKSTATS_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | |||
21 | /* Format for per-task data returned to userland when | ||
22 | * - a task exits | ||
23 | * - listener requests stats for a task | ||
24 | * | ||
25 | * The struct is versioned. Newer versions should only add fields to | ||
26 | * the bottom of the struct to maintain backward compatibility. | ||
27 | * | ||
28 | * | ||
29 | * To add new fields | ||
30 | * a) bump up TASKSTATS_VERSION | ||
31 | * b) add comment indicating new version number at end of struct | ||
32 | * c) add new fields after version comment; maintain 64-bit alignment | ||
33 | */ | ||
34 | |||
35 | |||
36 | #define TASKSTATS_VERSION 8 | ||
37 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN | ||
38 | * in linux/sched.h */ | ||
39 | |||
40 | struct taskstats { | ||
41 | |||
42 | /* The version number of this struct. This field is always set to | ||
43 | * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>. | ||
44 | * Each time the struct is changed, the value should be incremented. | ||
45 | */ | ||
46 | __u16 version; | ||
47 | __u32 ac_exitcode; /* Exit status */ | ||
48 | |||
49 | /* The accounting flags of a task as defined in <linux/acct.h> | ||
50 | * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. | ||
51 | */ | ||
52 | __u8 ac_flag; /* Record flags */ | ||
53 | __u8 ac_nice; /* task_nice */ | ||
54 | |||
55 | /* Delay accounting fields start | ||
56 | * | ||
57 | * All values, until comment "Delay accounting fields end" are | ||
58 | * available only if delay accounting is enabled, even though the last | ||
59 | * few fields are not delays | ||
60 | * | ||
61 | * xxx_count is the number of delay values recorded | ||
62 | * xxx_delay_total is the corresponding cumulative delay in nanoseconds | ||
63 | * | ||
64 | * xxx_delay_total wraps around to zero on overflow | ||
65 | * xxx_count incremented regardless of overflow | ||
66 | */ | ||
67 | |||
68 | /* Delay waiting for cpu, while runnable | ||
69 | * count, delay_total NOT updated atomically | ||
70 | */ | ||
71 | __u64 cpu_count __attribute__((aligned(8))); | ||
72 | __u64 cpu_delay_total; | ||
73 | |||
74 | /* Following four fields atomically updated using task->delays->lock */ | ||
75 | |||
76 | /* Delay waiting for synchronous block I/O to complete | ||
77 | * does not account for delays in I/O submission | ||
78 | */ | ||
79 | __u64 blkio_count; | ||
80 | __u64 blkio_delay_total; | ||
81 | |||
82 | /* Delay waiting for page fault I/O (swap in only) */ | ||
83 | __u64 swapin_count; | ||
84 | __u64 swapin_delay_total; | ||
85 | |||
86 | /* cpu "wall-clock" running time | ||
87 | * On some architectures, value will adjust for cpu time stolen | ||
88 | * from the kernel in involuntary waits due to virtualization. | ||
89 | * Value is cumulative, in nanoseconds, without a corresponding count | ||
90 | * and wraps around to zero silently on overflow | ||
91 | */ | ||
92 | __u64 cpu_run_real_total; | ||
93 | |||
94 | /* cpu "virtual" running time | ||
95 | * Uses time intervals seen by the kernel i.e. no adjustment | ||
96 | * for kernel's involuntary waits due to virtualization. | ||
97 | * Value is cumulative, in nanoseconds, without a corresponding count | ||
98 | * and wraps around to zero silently on overflow | ||
99 | */ | ||
100 | __u64 cpu_run_virtual_total; | ||
101 | /* Delay accounting fields end */ | ||
102 | /* version 1 ends here */ | ||
103 | |||
104 | /* Basic Accounting Fields start */ | ||
105 | char ac_comm[TS_COMM_LEN]; /* Command name */ | ||
106 | __u8 ac_sched __attribute__((aligned(8))); | ||
107 | /* Scheduling discipline */ | ||
108 | __u8 ac_pad[3]; | ||
109 | __u32 ac_uid __attribute__((aligned(8))); | ||
110 | /* User ID */ | ||
111 | __u32 ac_gid; /* Group ID */ | ||
112 | __u32 ac_pid; /* Process ID */ | ||
113 | __u32 ac_ppid; /* Parent process ID */ | ||
114 | __u32 ac_btime; /* Begin time [sec since 1970] */ | ||
115 | __u64 ac_etime __attribute__((aligned(8))); | ||
116 | /* Elapsed time [usec] */ | ||
117 | __u64 ac_utime; /* User CPU time [usec] */ | ||
118 | __u64 ac_stime; /* SYstem CPU time [usec] */ | ||
119 | __u64 ac_minflt; /* Minor Page Fault Count */ | ||
120 | __u64 ac_majflt; /* Major Page Fault Count */ | ||
121 | /* Basic Accounting Fields end */ | ||
122 | |||
123 | /* Extended accounting fields start */ | ||
124 | /* Accumulated RSS usage in duration of a task, in MBytes-usecs. | ||
125 | * The current rss usage is added to this counter every time | ||
126 | * a tick is charged to a task's system time. So, at the end we | ||
127 | * will have memory usage multiplied by system time. Thus an | ||
128 | * average usage per system time unit can be calculated. | ||
129 | */ | ||
130 | __u64 coremem; /* accumulated RSS usage in MB-usec */ | ||
131 | /* Accumulated virtual memory usage in duration of a task. | ||
132 | * Same as acct_rss_mem1 above except that we keep track of VM usage. | ||
133 | */ | ||
134 | __u64 virtmem; /* accumulated VM usage in MB-usec */ | ||
135 | |||
136 | /* High watermark of RSS and virtual memory usage in duration of | ||
137 | * a task, in KBytes. | ||
138 | */ | ||
139 | __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */ | ||
140 | __u64 hiwater_vm; /* High-water VM usage, in KB */ | ||
141 | |||
142 | /* The following four fields are I/O statistics of a task. */ | ||
143 | __u64 read_char; /* bytes read */ | ||
144 | __u64 write_char; /* bytes written */ | ||
145 | __u64 read_syscalls; /* read syscalls */ | ||
146 | __u64 write_syscalls; /* write syscalls */ | ||
147 | /* Extended accounting fields end */ | ||
148 | |||
149 | #define TASKSTATS_HAS_IO_ACCOUNTING | ||
150 | /* Per-task storage I/O accounting starts */ | ||
151 | __u64 read_bytes; /* bytes of read I/O */ | ||
152 | __u64 write_bytes; /* bytes of write I/O */ | ||
153 | __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */ | ||
154 | |||
155 | __u64 nvcsw; /* voluntary_ctxt_switches */ | ||
156 | __u64 nivcsw; /* nonvoluntary_ctxt_switches */ | ||
157 | |||
158 | /* time accounting for SMT machines */ | ||
159 | __u64 ac_utimescaled; /* utime scaled on frequency etc */ | ||
160 | __u64 ac_stimescaled; /* stime scaled on frequency etc */ | ||
161 | __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ | ||
162 | |||
163 | /* Delay waiting for memory reclaim */ | ||
164 | __u64 freepages_count; | ||
165 | __u64 freepages_delay_total; | ||
166 | }; | ||
167 | |||
168 | |||
169 | /* | ||
170 | * Commands sent from userspace | ||
171 | * Not versioned. New commands should only be inserted at the enum's end | ||
172 | * prior to __TASKSTATS_CMD_MAX | ||
173 | */ | ||
174 | |||
175 | enum { | ||
176 | TASKSTATS_CMD_UNSPEC = 0, /* Reserved */ | ||
177 | TASKSTATS_CMD_GET, /* user->kernel request/get-response */ | ||
178 | TASKSTATS_CMD_NEW, /* kernel->user event */ | ||
179 | __TASKSTATS_CMD_MAX, | ||
180 | }; | ||
181 | |||
182 | #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1) | ||
183 | |||
184 | enum { | ||
185 | TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */ | ||
186 | TASKSTATS_TYPE_PID, /* Process id */ | ||
187 | TASKSTATS_TYPE_TGID, /* Thread group id */ | ||
188 | TASKSTATS_TYPE_STATS, /* taskstats structure */ | ||
189 | TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */ | ||
190 | TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */ | ||
191 | TASKSTATS_TYPE_NULL, /* contains nothing */ | ||
192 | __TASKSTATS_TYPE_MAX, | ||
193 | }; | ||
194 | |||
195 | #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1) | ||
196 | |||
197 | enum { | ||
198 | TASKSTATS_CMD_ATTR_UNSPEC = 0, | ||
199 | TASKSTATS_CMD_ATTR_PID, | ||
200 | TASKSTATS_CMD_ATTR_TGID, | ||
201 | TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, | ||
202 | TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, | ||
203 | __TASKSTATS_CMD_ATTR_MAX, | ||
204 | }; | ||
205 | |||
206 | #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1) | ||
207 | |||
208 | /* NETLINK_GENERIC related info */ | ||
209 | |||
210 | #define TASKSTATS_GENL_NAME "TASKSTATS" | ||
211 | #define TASKSTATS_GENL_VERSION 0x1 | ||
212 | |||
213 | #endif /* _LINUX_TASKSTATS_H */ | ||
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild new file mode 100644 index 00000000000..67b501c302b --- /dev/null +++ b/include/linux/tc_act/Kbuild | |||
@@ -0,0 +1,7 @@ | |||
1 | header-y += tc_gact.h | ||
2 | header-y += tc_ipt.h | ||
3 | header-y += tc_mirred.h | ||
4 | header-y += tc_pedit.h | ||
5 | header-y += tc_nat.h | ||
6 | header-y += tc_skbedit.h | ||
7 | header-y += tc_csum.h | ||
diff --git a/include/linux/tc_act/tc_csum.h b/include/linux/tc_act/tc_csum.h new file mode 100644 index 00000000000..a047c49a315 --- /dev/null +++ b/include/linux/tc_act/tc_csum.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef __LINUX_TC_CSUM_H | ||
2 | #define __LINUX_TC_CSUM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | #define TCA_ACT_CSUM 16 | ||
8 | |||
9 | enum { | ||
10 | TCA_CSUM_UNSPEC, | ||
11 | TCA_CSUM_PARMS, | ||
12 | TCA_CSUM_TM, | ||
13 | __TCA_CSUM_MAX | ||
14 | }; | ||
15 | #define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) | ||
16 | |||
17 | enum { | ||
18 | TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1, | ||
19 | TCA_CSUM_UPDATE_FLAG_ICMP = 2, | ||
20 | TCA_CSUM_UPDATE_FLAG_IGMP = 4, | ||
21 | TCA_CSUM_UPDATE_FLAG_TCP = 8, | ||
22 | TCA_CSUM_UPDATE_FLAG_UDP = 16, | ||
23 | TCA_CSUM_UPDATE_FLAG_UDPLITE = 32 | ||
24 | }; | ||
25 | |||
26 | struct tc_csum { | ||
27 | tc_gen; | ||
28 | |||
29 | __u32 update_flags; | ||
30 | }; | ||
31 | |||
32 | #endif /* __LINUX_TC_CSUM_H */ | ||
diff --git a/include/linux/tc_act/tc_gact.h b/include/linux/tc_act/tc_gact.h new file mode 100644 index 00000000000..f7bf94eed51 --- /dev/null +++ b/include/linux/tc_act/tc_gact.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef __LINUX_TC_GACT_H | ||
2 | #define __LINUX_TC_GACT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | #define TCA_ACT_GACT 5 | ||
8 | struct tc_gact { | ||
9 | tc_gen; | ||
10 | |||
11 | }; | ||
12 | |||
13 | struct tc_gact_p { | ||
14 | #define PGACT_NONE 0 | ||
15 | #define PGACT_NETRAND 1 | ||
16 | #define PGACT_DETERM 2 | ||
17 | #define MAX_RAND (PGACT_DETERM + 1 ) | ||
18 | __u16 ptype; | ||
19 | __u16 pval; | ||
20 | int paction; | ||
21 | }; | ||
22 | |||
23 | enum { | ||
24 | TCA_GACT_UNSPEC, | ||
25 | TCA_GACT_TM, | ||
26 | TCA_GACT_PARMS, | ||
27 | TCA_GACT_PROB, | ||
28 | __TCA_GACT_MAX | ||
29 | }; | ||
30 | #define TCA_GACT_MAX (__TCA_GACT_MAX - 1) | ||
31 | |||
32 | #endif | ||
diff --git a/include/linux/tc_act/tc_ipt.h b/include/linux/tc_act/tc_ipt.h new file mode 100644 index 00000000000..a2335563d21 --- /dev/null +++ b/include/linux/tc_act/tc_ipt.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __LINUX_TC_IPT_H | ||
2 | #define __LINUX_TC_IPT_H | ||
3 | |||
4 | #include <linux/pkt_cls.h> | ||
5 | |||
6 | #define TCA_ACT_IPT 6 | ||
7 | |||
8 | enum { | ||
9 | TCA_IPT_UNSPEC, | ||
10 | TCA_IPT_TABLE, | ||
11 | TCA_IPT_HOOK, | ||
12 | TCA_IPT_INDEX, | ||
13 | TCA_IPT_CNT, | ||
14 | TCA_IPT_TM, | ||
15 | TCA_IPT_TARG, | ||
16 | __TCA_IPT_MAX | ||
17 | }; | ||
18 | #define TCA_IPT_MAX (__TCA_IPT_MAX - 1) | ||
19 | |||
20 | #endif | ||
diff --git a/include/linux/tc_act/tc_mirred.h b/include/linux/tc_act/tc_mirred.h new file mode 100644 index 00000000000..7561750e8fd --- /dev/null +++ b/include/linux/tc_act/tc_mirred.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __LINUX_TC_MIR_H | ||
2 | #define __LINUX_TC_MIR_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | #define TCA_ACT_MIRRED 8 | ||
8 | #define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ | ||
9 | #define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ | ||
10 | #define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ | ||
11 | #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ | ||
12 | |||
13 | struct tc_mirred { | ||
14 | tc_gen; | ||
15 | int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ | ||
16 | __u32 ifindex; /* ifindex of egress port */ | ||
17 | }; | ||
18 | |||
19 | enum { | ||
20 | TCA_MIRRED_UNSPEC, | ||
21 | TCA_MIRRED_TM, | ||
22 | TCA_MIRRED_PARMS, | ||
23 | __TCA_MIRRED_MAX | ||
24 | }; | ||
25 | #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/tc_act/tc_nat.h b/include/linux/tc_act/tc_nat.h new file mode 100644 index 00000000000..6663aeba0b9 --- /dev/null +++ b/include/linux/tc_act/tc_nat.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __LINUX_TC_NAT_H | ||
2 | #define __LINUX_TC_NAT_H | ||
3 | |||
4 | #include <linux/pkt_cls.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | #define TCA_ACT_NAT 9 | ||
8 | |||
9 | enum { | ||
10 | TCA_NAT_UNSPEC, | ||
11 | TCA_NAT_PARMS, | ||
12 | TCA_NAT_TM, | ||
13 | __TCA_NAT_MAX | ||
14 | }; | ||
15 | #define TCA_NAT_MAX (__TCA_NAT_MAX - 1) | ||
16 | |||
17 | #define TCA_NAT_FLAG_EGRESS 1 | ||
18 | |||
19 | struct tc_nat { | ||
20 | tc_gen; | ||
21 | __be32 old_addr; | ||
22 | __be32 new_addr; | ||
23 | __be32 mask; | ||
24 | __u32 flags; | ||
25 | }; | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/tc_act/tc_pedit.h b/include/linux/tc_act/tc_pedit.h new file mode 100644 index 00000000000..716cfabcd5b --- /dev/null +++ b/include/linux/tc_act/tc_pedit.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef __LINUX_TC_PED_H | ||
2 | #define __LINUX_TC_PED_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | #define TCA_ACT_PEDIT 7 | ||
8 | |||
9 | enum { | ||
10 | TCA_PEDIT_UNSPEC, | ||
11 | TCA_PEDIT_TM, | ||
12 | TCA_PEDIT_PARMS, | ||
13 | __TCA_PEDIT_MAX | ||
14 | }; | ||
15 | #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) | ||
16 | |||
17 | struct tc_pedit_key { | ||
18 | __u32 mask; /* AND */ | ||
19 | __u32 val; /*XOR */ | ||
20 | __u32 off; /*offset */ | ||
21 | __u32 at; | ||
22 | __u32 offmask; | ||
23 | __u32 shift; | ||
24 | }; | ||
25 | |||
26 | struct tc_pedit_sel { | ||
27 | tc_gen; | ||
28 | unsigned char nkeys; | ||
29 | unsigned char flags; | ||
30 | struct tc_pedit_key keys[0]; | ||
31 | }; | ||
32 | #define tc_pedit tc_pedit_sel | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h new file mode 100644 index 00000000000..7a2e910a5f0 --- /dev/null +++ b/include/linux/tc_act/tc_skbedit.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008, Intel Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Author: Alexander Duyck <alexander.h.duyck@intel.com> | ||
18 | */ | ||
19 | |||
20 | #ifndef __LINUX_TC_SKBEDIT_H | ||
21 | #define __LINUX_TC_SKBEDIT_H | ||
22 | |||
23 | #include <linux/pkt_cls.h> | ||
24 | |||
25 | #define TCA_ACT_SKBEDIT 11 | ||
26 | |||
27 | #define SKBEDIT_F_PRIORITY 0x1 | ||
28 | #define SKBEDIT_F_QUEUE_MAPPING 0x2 | ||
29 | #define SKBEDIT_F_MARK 0x4 | ||
30 | |||
31 | struct tc_skbedit { | ||
32 | tc_gen; | ||
33 | }; | ||
34 | |||
35 | enum { | ||
36 | TCA_SKBEDIT_UNSPEC, | ||
37 | TCA_SKBEDIT_TM, | ||
38 | TCA_SKBEDIT_PARMS, | ||
39 | TCA_SKBEDIT_PRIORITY, | ||
40 | TCA_SKBEDIT_QUEUE_MAPPING, | ||
41 | TCA_SKBEDIT_MARK, | ||
42 | __TCA_SKBEDIT_MAX | ||
43 | }; | ||
44 | #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) | ||
45 | |||
46 | #endif | ||
diff --git a/include/linux/tc_ematch/Kbuild b/include/linux/tc_ematch/Kbuild new file mode 100644 index 00000000000..4a58a1c32a0 --- /dev/null +++ b/include/linux/tc_ematch/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | header-y += tc_em_cmp.h | ||
2 | header-y += tc_em_meta.h | ||
3 | header-y += tc_em_nbyte.h | ||
4 | header-y += tc_em_text.h | ||
diff --git a/include/linux/tc_ematch/tc_em_cmp.h b/include/linux/tc_ematch/tc_em_cmp.h new file mode 100644 index 00000000000..f34bb1bae08 --- /dev/null +++ b/include/linux/tc_ematch/tc_em_cmp.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __LINUX_TC_EM_CMP_H | ||
2 | #define __LINUX_TC_EM_CMP_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | struct tcf_em_cmp { | ||
8 | __u32 val; | ||
9 | __u32 mask; | ||
10 | __u16 off; | ||
11 | __u8 align:4; | ||
12 | __u8 flags:4; | ||
13 | __u8 layer:4; | ||
14 | __u8 opnd:4; | ||
15 | }; | ||
16 | |||
17 | enum { | ||
18 | TCF_EM_ALIGN_U8 = 1, | ||
19 | TCF_EM_ALIGN_U16 = 2, | ||
20 | TCF_EM_ALIGN_U32 = 4 | ||
21 | }; | ||
22 | |||
23 | #define TCF_EM_CMP_TRANS 1 | ||
24 | |||
25 | #endif | ||
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h new file mode 100644 index 00000000000..b11f8ce2d3c --- /dev/null +++ b/include/linux/tc_ematch/tc_em_meta.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef __LINUX_TC_EM_META_H | ||
2 | #define __LINUX_TC_EM_META_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | enum { | ||
8 | TCA_EM_META_UNSPEC, | ||
9 | TCA_EM_META_HDR, | ||
10 | TCA_EM_META_LVALUE, | ||
11 | TCA_EM_META_RVALUE, | ||
12 | __TCA_EM_META_MAX | ||
13 | }; | ||
14 | #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) | ||
15 | |||
16 | struct tcf_meta_val { | ||
17 | __u16 kind; | ||
18 | __u8 shift; | ||
19 | __u8 op; | ||
20 | }; | ||
21 | |||
22 | #define TCF_META_TYPE_MASK (0xf << 12) | ||
23 | #define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) | ||
24 | #define TCF_META_ID_MASK 0x7ff | ||
25 | #define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) | ||
26 | |||
27 | enum { | ||
28 | TCF_META_TYPE_VAR, | ||
29 | TCF_META_TYPE_INT, | ||
30 | __TCF_META_TYPE_MAX | ||
31 | }; | ||
32 | #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) | ||
33 | |||
34 | enum { | ||
35 | TCF_META_ID_VALUE, | ||
36 | TCF_META_ID_RANDOM, | ||
37 | TCF_META_ID_LOADAVG_0, | ||
38 | TCF_META_ID_LOADAVG_1, | ||
39 | TCF_META_ID_LOADAVG_2, | ||
40 | TCF_META_ID_DEV, | ||
41 | TCF_META_ID_PRIORITY, | ||
42 | TCF_META_ID_PROTOCOL, | ||
43 | TCF_META_ID_PKTTYPE, | ||
44 | TCF_META_ID_PKTLEN, | ||
45 | TCF_META_ID_DATALEN, | ||
46 | TCF_META_ID_MACLEN, | ||
47 | TCF_META_ID_NFMARK, | ||
48 | TCF_META_ID_TCINDEX, | ||
49 | TCF_META_ID_RTCLASSID, | ||
50 | TCF_META_ID_RTIIF, | ||
51 | TCF_META_ID_SK_FAMILY, | ||
52 | TCF_META_ID_SK_STATE, | ||
53 | TCF_META_ID_SK_REUSE, | ||
54 | TCF_META_ID_SK_BOUND_IF, | ||
55 | TCF_META_ID_SK_REFCNT, | ||
56 | TCF_META_ID_SK_SHUTDOWN, | ||
57 | TCF_META_ID_SK_PROTO, | ||
58 | TCF_META_ID_SK_TYPE, | ||
59 | TCF_META_ID_SK_RCVBUF, | ||
60 | TCF_META_ID_SK_RMEM_ALLOC, | ||
61 | TCF_META_ID_SK_WMEM_ALLOC, | ||
62 | TCF_META_ID_SK_OMEM_ALLOC, | ||
63 | TCF_META_ID_SK_WMEM_QUEUED, | ||
64 | TCF_META_ID_SK_RCV_QLEN, | ||
65 | TCF_META_ID_SK_SND_QLEN, | ||
66 | TCF_META_ID_SK_ERR_QLEN, | ||
67 | TCF_META_ID_SK_FORWARD_ALLOCS, | ||
68 | TCF_META_ID_SK_SNDBUF, | ||
69 | TCF_META_ID_SK_ALLOCS, | ||
70 | __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */ | ||
71 | TCF_META_ID_SK_HASH, | ||
72 | TCF_META_ID_SK_LINGERTIME, | ||
73 | TCF_META_ID_SK_ACK_BACKLOG, | ||
74 | TCF_META_ID_SK_MAX_ACK_BACKLOG, | ||
75 | TCF_META_ID_SK_PRIO, | ||
76 | TCF_META_ID_SK_RCVLOWAT, | ||
77 | TCF_META_ID_SK_RCVTIMEO, | ||
78 | TCF_META_ID_SK_SNDTIMEO, | ||
79 | TCF_META_ID_SK_SENDMSG_OFF, | ||
80 | TCF_META_ID_SK_WRITE_PENDING, | ||
81 | TCF_META_ID_VLAN_TAG, | ||
82 | TCF_META_ID_RXHASH, | ||
83 | __TCF_META_ID_MAX | ||
84 | }; | ||
85 | #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) | ||
86 | |||
87 | struct tcf_meta_hdr { | ||
88 | struct tcf_meta_val left; | ||
89 | struct tcf_meta_val right; | ||
90 | }; | ||
91 | |||
92 | #endif | ||
diff --git a/include/linux/tc_ematch/tc_em_nbyte.h b/include/linux/tc_ematch/tc_em_nbyte.h new file mode 100644 index 00000000000..7172cfb999c --- /dev/null +++ b/include/linux/tc_ematch/tc_em_nbyte.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __LINUX_TC_EM_NBYTE_H | ||
2 | #define __LINUX_TC_EM_NBYTE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | struct tcf_em_nbyte { | ||
8 | __u16 off; | ||
9 | __u16 len:12; | ||
10 | __u8 layer:4; | ||
11 | }; | ||
12 | |||
13 | #endif | ||
diff --git a/include/linux/tc_ematch/tc_em_text.h b/include/linux/tc_ematch/tc_em_text.h new file mode 100644 index 00000000000..5aac4045ba8 --- /dev/null +++ b/include/linux/tc_ematch/tc_em_text.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __LINUX_TC_EM_TEXT_H | ||
2 | #define __LINUX_TC_EM_TEXT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/pkt_cls.h> | ||
6 | |||
7 | #define TC_EM_TEXT_ALGOSIZ 16 | ||
8 | |||
9 | struct tcf_em_text { | ||
10 | char algo[TC_EM_TEXT_ALGOSIZ]; | ||
11 | __u16 from_offset; | ||
12 | __u16 to_offset; | ||
13 | __u16 pattern_len; | ||
14 | __u8 from_layer:4; | ||
15 | __u8 to_layer:4; | ||
16 | __u8 pad; | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/tegra_audio.h b/include/linux/tegra_audio.h new file mode 100644 index 00000000000..6416cd01861 --- /dev/null +++ b/include/linux/tegra_audio.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* include/linux/tegra_audio.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * Author: | ||
6 | * Iliyan Malchev <malchev@google.com> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef _TEGRA_AUDIO_H | ||
20 | #define _TEGRA_AUDIO_H | ||
21 | |||
22 | #include <linux/ioctl.h> | ||
23 | |||
24 | #define TEGRA_AUDIO_MAGIC 't' | ||
25 | |||
26 | #define TEGRA_AUDIO_IN_START _IO(TEGRA_AUDIO_MAGIC, 0) | ||
27 | #define TEGRA_AUDIO_IN_STOP _IO(TEGRA_AUDIO_MAGIC, 1) | ||
28 | |||
29 | struct tegra_audio_in_config { | ||
30 | int rate; | ||
31 | int stereo; | ||
32 | }; | ||
33 | |||
34 | struct dam_srate { | ||
35 | unsigned int in_sample_rate; | ||
36 | unsigned int out_sample_rate; | ||
37 | unsigned int audio_bits; | ||
38 | unsigned int client_bits; | ||
39 | unsigned int audio_channels; | ||
40 | unsigned int client_channels; | ||
41 | unsigned int apbif_chan; | ||
42 | }; | ||
43 | |||
44 | #define TEGRA_AUDIO_IN_SET_CONFIG _IOW(TEGRA_AUDIO_MAGIC, 2, \ | ||
45 | const struct tegra_audio_in_config *) | ||
46 | #define TEGRA_AUDIO_IN_GET_CONFIG _IOR(TEGRA_AUDIO_MAGIC, 3, \ | ||
47 | struct tegra_audio_in_config *) | ||
48 | |||
49 | #define TEGRA_AUDIO_IN_SET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 4, \ | ||
50 | const unsigned int *) | ||
51 | #define TEGRA_AUDIO_IN_GET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 5, \ | ||
52 | unsigned int *) | ||
53 | #define TEGRA_AUDIO_OUT_SET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 6, \ | ||
54 | const unsigned int *) | ||
55 | #define TEGRA_AUDIO_OUT_GET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 7, \ | ||
56 | unsigned int *) | ||
57 | |||
58 | #define TEGRA_AUDIO_OUT_FLUSH _IO(TEGRA_AUDIO_MAGIC, 10) | ||
59 | |||
60 | #define TEGRA_AUDIO_BIT_FORMAT_DEFAULT 0 | ||
61 | #define TEGRA_AUDIO_BIT_FORMAT_DSP 1 | ||
62 | #define TEGRA_AUDIO_SET_BIT_FORMAT _IOW(TEGRA_AUDIO_MAGIC, 11, \ | ||
63 | const unsigned int *) | ||
64 | #define TEGRA_AUDIO_GET_BIT_FORMAT _IOR(TEGRA_AUDIO_MAGIC, 12, \ | ||
65 | unsigned int *) | ||
66 | |||
67 | #define DAM_SRC_START _IOW(TEGRA_AUDIO_MAGIC, 13, struct dam_srate *) | ||
68 | #define DAM_SRC_STOP _IO(TEGRA_AUDIO_MAGIC, 14) | ||
69 | #define DAM_MIXING_START _IOW(TEGRA_AUDIO_MAGIC, 15, struct dam_srate *) | ||
70 | #define DAM_MIXING_STOP _IO(TEGRA_AUDIO_MAGIC, 16) | ||
71 | #define DAM_SET_MIXING_FLAG _IO(TEGRA_AUDIO_MAGIC, 17) | ||
72 | |||
73 | #define I2S_START _IOW(TEGRA_AUDIO_MAGIC, 15, struct i2s_pcm_format *) | ||
74 | #define I2S_STOP _IOW(TEGRA_AUDIO_MAGIC, 16, struct i2s_pcm_format *) | ||
75 | #define I2S_LOOPBACK _IOW(TEGRA_AUDIO_MAGIC, 17, unsigned int *) | ||
76 | #define I2S_MODE_I2S _IOW(TEGRA_AUDIO_MAGIC, 18, unsigned int *) | ||
77 | |||
78 | extern bool tegra_is_voice_call_active(); | ||
79 | |||
80 | #endif/*_CPCAP_AUDIO_H*/ | ||
diff --git a/include/linux/tegra_avp.h b/include/linux/tegra_avp.h new file mode 100644 index 00000000000..9dc92f82136 --- /dev/null +++ b/include/linux/tegra_avp.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Google, Inc. | ||
3 | * Author: Dima Zavin <dima@android.com> | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef __LINUX_TEGRA_AVP_H | ||
17 | #define __LINUX_TEGRA_AVP_H | ||
18 | |||
19 | #include <linux/ioctl.h> | ||
20 | #include <linux/types.h> | ||
21 | |||
22 | #define TEGRA_AVP_LIB_MAX_NAME 32 | ||
23 | #define TEGRA_AVP_LIB_MAX_ARGS 220 /* DO NOT CHANGE THIS! */ | ||
24 | |||
25 | struct tegra_avp_lib { | ||
26 | char name[TEGRA_AVP_LIB_MAX_NAME]; | ||
27 | void __user *args; | ||
28 | size_t args_len; | ||
29 | int greedy; | ||
30 | unsigned long handle; | ||
31 | }; | ||
32 | |||
33 | struct tegra_avp_platform_data { | ||
34 | unsigned long emc_clk_rate; | ||
35 | }; | ||
36 | #define TEGRA_AVP_IOCTL_MAGIC 'r' | ||
37 | |||
38 | #define TEGRA_AVP_IOCTL_LOAD_LIB _IOWR(TEGRA_AVP_IOCTL_MAGIC, 0x40, struct tegra_avp_lib) | ||
39 | #define TEGRA_AVP_IOCTL_UNLOAD_LIB _IOW(TEGRA_AVP_IOCTL_MAGIC, 0x41, unsigned long) | ||
40 | |||
41 | #define TEGRA_AVP_IOCTL_MIN_NR _IOC_NR(TEGRA_AVP_IOCTL_LOAD_LIB) | ||
42 | #define TEGRA_AVP_IOCTL_MAX_NR _IOC_NR(TEGRA_AVP_IOCTL_UNLOAD_LIB) | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/tegra_caif.h b/include/linux/tegra_caif.h new file mode 100644 index 00000000000..fed67499def --- /dev/null +++ b/include/linux/tegra_caif.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* include/linux/tegra_caif.h | ||
2 | * | ||
3 | * Copyright (C) 2011 NVIDIA Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _TEGRA_CAIF_H_ | ||
21 | #define _TEGRA_CAIF_H_ | ||
22 | |||
23 | /* The GPIO details needed by the rainbow caif */ | ||
24 | struct tegra_caif_platform_data { | ||
25 | int reset; | ||
26 | int power; | ||
27 | int awr; | ||
28 | int cwr; | ||
29 | int spi_int; | ||
30 | int spi_ss; | ||
31 | }; | ||
32 | |||
33 | #endif /* _TEGRA_CAIF_H_ */ | ||
34 | |||
diff --git a/include/linux/tegra_ion.h b/include/linux/tegra_ion.h new file mode 100644 index 00000000000..73e190908b8 --- /dev/null +++ b/include/linux/tegra_ion.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * include/linux/tegra_ion.h | ||
3 | * | ||
4 | * Copyright (C) 2011, NVIDIA Corporation. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | #include <linux/ion.h> | ||
19 | |||
20 | #if !defined(__KERNEL__) | ||
21 | #define __user | ||
22 | #endif | ||
23 | |||
24 | #ifndef _LINUX_TEGRA_ION_H | ||
25 | #define _LINUX_TEGRA_ION_H | ||
26 | |||
27 | struct tegra_ion_id_data { | ||
28 | struct ion_handle *handle; | ||
29 | unsigned long id; | ||
30 | size_t size; | ||
31 | }; | ||
32 | |||
33 | struct tegra_ion_pin_data { | ||
34 | struct ion_handle **handles; /* array of handles to pin/unpin */ | ||
35 | unsigned long *addr; /* array pf addresses to return */ | ||
36 | unsigned long count; /* number of entries in handles */ | ||
37 | }; | ||
38 | |||
39 | /* Cache operations. */ | ||
40 | enum { | ||
41 | TEGRA_ION_CACHE_OP_WB = 0, | ||
42 | TEGRA_ION_CACHE_OP_INV, | ||
43 | TEGRA_ION_CACHE_OP_WB_INV, | ||
44 | }; | ||
45 | |||
46 | struct tegra_ion_cache_maint_data { | ||
47 | unsigned long addr; | ||
48 | struct ion_handle *handle; | ||
49 | size_t len; | ||
50 | unsigned int op; | ||
51 | }; | ||
52 | |||
53 | struct tegra_ion_rw_data { | ||
54 | unsigned long addr; /* user pointer*/ | ||
55 | struct ion_handle *handle; | ||
56 | unsigned int offset; /* offset into handle mem */ | ||
57 | unsigned int elem_size; /* individual atome size */ | ||
58 | unsigned int mem_stride; /*delta in bytes between atoms in handle mem*/ | ||
59 | unsigned int user_stride; /* delta in bytes between atoms in user */ | ||
60 | unsigned int count; /* number of atoms to copy */ | ||
61 | }; | ||
62 | |||
63 | struct tegra_ion_get_params_data { | ||
64 | struct ion_handle *handle; | ||
65 | size_t size; | ||
66 | unsigned int align; | ||
67 | unsigned int heap; | ||
68 | unsigned long addr; | ||
69 | }; | ||
70 | |||
71 | /* Custom Ioctl's. */ | ||
72 | enum { | ||
73 | TEGRA_ION_ALLOC_FROM_ID = 0, | ||
74 | TEGRA_ION_GET_ID, | ||
75 | TEGRA_ION_PIN, | ||
76 | TEGRA_ION_UNPIN, | ||
77 | TEGRA_ION_CACHE_MAINT, | ||
78 | TEGRA_ION_READ, | ||
79 | TEGRA_ION_WRITE, | ||
80 | TEGRA_ION_GET_PARAM, | ||
81 | }; | ||
82 | |||
83 | /* List of heaps in the system. */ | ||
84 | enum { | ||
85 | TEGRA_ION_HEAP_CARVEOUT = 0, | ||
86 | TEGRA_ION_HEAP_IRAM, | ||
87 | TEGRA_ION_HEAP_VPR, | ||
88 | TEGRA_ION_HEAP_IOMMU | ||
89 | }; | ||
90 | |||
91 | #endif /* _LINUX_TEGRA_ION_H */ | ||
diff --git a/include/linux/tegra_mediaserver.h b/include/linux/tegra_mediaserver.h new file mode 100644 index 00000000000..f28473baf63 --- /dev/null +++ b/include/linux/tegra_mediaserver.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* include/linux/tegra_mediaserver.h | ||
2 | * | ||
3 | * Media Server driver for NVIDIA Tegra SoCs | ||
4 | * | ||
5 | * Copyright (c) 2011, NVIDIA Corporation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | |||
23 | #ifndef _TEGRA_MEDIASERVER_H | ||
24 | #define _TEGRA_MEDIASERVER_H | ||
25 | |||
26 | #include <linux/ioctl.h> | ||
27 | |||
28 | #define TEGRA_MEDIASERVER_MAGIC 'm' | ||
29 | #define TEGRA_MEDIASERVER_IOCTL_ALLOC \ | ||
30 | _IOWR(TEGRA_MEDIASERVER_MAGIC, 0x40, \ | ||
31 | union tegra_mediaserver_alloc_info) | ||
32 | |||
33 | enum tegra_mediaserver_resource_type { | ||
34 | TEGRA_MEDIASERVER_RESOURCE_BLOCK = 0, | ||
35 | TEGRA_MEDIASERVER_RESOURCE_IRAM, | ||
36 | }; | ||
37 | |||
38 | enum tegra_mediaserver_block_type { | ||
39 | TEGRA_MEDIASERVER_BLOCK_AUDDEC = 0, | ||
40 | TEGRA_MEDIASERVER_BLOCK_VIDDEC, | ||
41 | }; | ||
42 | |||
43 | enum tegra_mediaserver_iram_type { | ||
44 | TEGRA_MEDIASERVER_IRAM_SCRATCH = 0, | ||
45 | TEGRA_MEDIASERVER_IRAM_SHARED, | ||
46 | }; | ||
47 | |||
48 | |||
49 | struct tegra_mediaserver_block_info { | ||
50 | int nvmm_block_handle; | ||
51 | int avp_block_handle; | ||
52 | int avp_block_library_handle; | ||
53 | int service_handle; | ||
54 | int service_library_handle; | ||
55 | }; | ||
56 | |||
57 | struct tegra_mediaserver_iram_info { | ||
58 | unsigned long rm_handle; | ||
59 | int physical_address; | ||
60 | }; | ||
61 | |||
62 | union tegra_mediaserver_alloc_info { | ||
63 | struct { | ||
64 | int tegra_mediaserver_resource_type; | ||
65 | |||
66 | union { | ||
67 | struct tegra_mediaserver_block_info block; | ||
68 | |||
69 | struct { | ||
70 | int tegra_mediaserver_iram_type; | ||
71 | int alignment; | ||
72 | size_t size; | ||
73 | } iram; | ||
74 | } u; | ||
75 | } in; | ||
76 | |||
77 | struct { | ||
78 | union { | ||
79 | struct { | ||
80 | int count; | ||
81 | } block; | ||
82 | |||
83 | struct tegra_mediaserver_iram_info iram; | ||
84 | } u; | ||
85 | } out; | ||
86 | }; | ||
87 | |||
88 | |||
89 | #define TEGRA_MEDIASERVER_IOCTL_FREE \ | ||
90 | _IOR(TEGRA_MEDIASERVER_MAGIC, 0x41, union tegra_mediaserver_free_info) | ||
91 | |||
92 | union tegra_mediaserver_free_info { | ||
93 | struct { | ||
94 | int tegra_mediaserver_resource_type; | ||
95 | |||
96 | union { | ||
97 | int nvmm_block_handle; | ||
98 | int iram_rm_handle; | ||
99 | } u; | ||
100 | } in; | ||
101 | }; | ||
102 | |||
103 | |||
104 | #define TEGRA_MEDIASERVER_IOCTL_UPDATE_BLOCK_INFO \ | ||
105 | _IOR(TEGRA_MEDIASERVER_MAGIC, 0x45, \ | ||
106 | union tegra_mediaserver_update_block_info) | ||
107 | |||
108 | union tegra_mediaserver_update_block_info { | ||
109 | struct tegra_mediaserver_block_info in; | ||
110 | }; | ||
111 | #endif | ||
112 | |||
diff --git a/include/linux/tegra_nvavp.h b/include/linux/tegra_nvavp.h new file mode 100644 index 00000000000..32dc4c62b4b --- /dev/null +++ b/include/linux/tegra_nvavp.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * include/linux/tegra_nvavp.h | ||
3 | * | ||
4 | * Copyright (C) 2011 NVIDIA Corp. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_TEGRA_NVAVP_H | ||
12 | #define __LINUX_TEGRA_NVAVP_H | ||
13 | |||
14 | #include <linux/ioctl.h> | ||
15 | #include <linux/types.h> | ||
16 | |||
17 | #define NVAVP_MAX_RELOCATION_COUNT 64 | ||
18 | |||
19 | /* avp submit flags */ | ||
20 | #define NVAVP_FLAG_NONE 0x00000000 | ||
21 | #define NVAVP_UCODE_EXT 0x00000001 /*use external ucode provided */ | ||
22 | |||
23 | enum { | ||
24 | NVAVP_MODULE_ID_AVP = 2, | ||
25 | NVAVP_MODULE_ID_VCP = 3, | ||
26 | NVAVP_MODULE_ID_BSEA = 27, | ||
27 | NVAVP_MODULE_ID_VDE = 28, | ||
28 | NVAVP_MODULE_ID_MPE = 29, | ||
29 | NVAVP_MODULE_ID_EMC = 75, | ||
30 | }; | ||
31 | |||
32 | struct nvavp_cmdbuf { | ||
33 | __u32 mem; | ||
34 | __u32 offset; | ||
35 | __u32 words; | ||
36 | }; | ||
37 | |||
38 | struct nvavp_reloc { | ||
39 | __u32 cmdbuf_mem; | ||
40 | __u32 cmdbuf_offset; | ||
41 | __u32 target; | ||
42 | __u32 target_offset; | ||
43 | }; | ||
44 | |||
45 | struct nvavp_syncpt { | ||
46 | __u32 id; | ||
47 | __u32 value; | ||
48 | }; | ||
49 | |||
50 | struct nvavp_pushbuffer_submit_hdr { | ||
51 | struct nvavp_cmdbuf cmdbuf; | ||
52 | struct nvavp_reloc *relocs; | ||
53 | __u32 num_relocs; | ||
54 | struct nvavp_syncpt *syncpt; | ||
55 | __u32 flags; | ||
56 | }; | ||
57 | |||
58 | struct nvavp_set_nvmap_fd_args { | ||
59 | __u32 fd; | ||
60 | }; | ||
61 | |||
62 | struct nvavp_clock_args { | ||
63 | __u32 id; | ||
64 | __u32 rate; | ||
65 | }; | ||
66 | |||
67 | #define NVAVP_IOCTL_MAGIC 'n' | ||
68 | |||
69 | #define NVAVP_IOCTL_SET_NVMAP_FD _IOW(NVAVP_IOCTL_MAGIC, 0x60, \ | ||
70 | struct nvavp_set_nvmap_fd_args) | ||
71 | #define NVAVP_IOCTL_GET_SYNCPOINT_ID _IOR(NVAVP_IOCTL_MAGIC, 0x61, \ | ||
72 | __u32) | ||
73 | #define NVAVP_IOCTL_PUSH_BUFFER_SUBMIT _IOWR(NVAVP_IOCTL_MAGIC, 0x63, \ | ||
74 | struct nvavp_pushbuffer_submit_hdr) | ||
75 | #define NVAVP_IOCTL_SET_CLOCK _IOWR(NVAVP_IOCTL_MAGIC, 0x64, \ | ||
76 | struct nvavp_clock_args) | ||
77 | #define NVAVP_IOCTL_GET_CLOCK _IOR(NVAVP_IOCTL_MAGIC, 0x65, \ | ||
78 | struct nvavp_clock_args) | ||
79 | |||
80 | |||
81 | #define NVAVP_IOCTL_MIN_NR _IOC_NR(NVAVP_IOCTL_SET_NVMAP_FD) | ||
82 | #define NVAVP_IOCTL_MAX_NR _IOC_NR(NVAVP_IOCTL_GET_CLOCK) | ||
83 | |||
84 | #endif /* __LINUX_TEGRA_NVAVP_H */ | ||
diff --git a/include/linux/tegra_pwm_bl.h b/include/linux/tegra_pwm_bl.h new file mode 100644 index 00000000000..71a81f2eda8 --- /dev/null +++ b/include/linux/tegra_pwm_bl.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* Tegra PWM backlight data * | ||
2 | * | ||
3 | * Copyright (C) 2011 NVIDIA Corporation | ||
4 | * Author: Renuka Apte <rapte@nvidia.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef TEGRA_PWM_BL_H | ||
13 | #define TEGRA_PWM_BL_H | ||
14 | |||
15 | #include <linux/backlight.h> | ||
16 | |||
17 | struct platform_tegra_pwm_backlight_data { | ||
18 | int which_dc; | ||
19 | int which_pwm; | ||
20 | void (*switch_to_sfio)(int); | ||
21 | int gpio_conf_to_sfio; | ||
22 | unsigned int dft_brightness; | ||
23 | unsigned int max_brightness; | ||
24 | unsigned int period; | ||
25 | unsigned int clk_div; | ||
26 | unsigned int clk_select; | ||
27 | int (*notify)(struct device *dev, int brightness); | ||
28 | int (*check_fb)(struct device *dev, struct fb_info *info); | ||
29 | }; | ||
30 | |||
31 | #endif /* TERGA_PWM_BL_H */ | ||
diff --git a/include/linux/tegra_rpc.h b/include/linux/tegra_rpc.h new file mode 100644 index 00000000000..16e6367cf56 --- /dev/null +++ b/include/linux/tegra_rpc.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Dima Zavin <dima@android.com> | ||
6 | * | ||
7 | * Based on original code from NVIDIA, and a partial rewrite by: | ||
8 | * Gary King <gking@nvidia.com> | ||
9 | * | ||
10 | * This software is licensed under the terms of the GNU General Public | ||
11 | * License version 2, as published by the Free Software Foundation, and | ||
12 | * may be copied, distributed, and modified under those terms. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_TEGRA_RPC_H | ||
22 | #define __LINUX_TEGRA_RPC_H | ||
23 | |||
24 | #define TEGRA_RPC_MAX_MSG_LEN 256 | ||
25 | |||
26 | /* Note: the actual size of the name in the protocol message is 16 bytes, | ||
27 | * but that is because the name there is not NUL terminated, only NUL | ||
28 | * padded. */ | ||
29 | #define TEGRA_RPC_MAX_NAME_LEN 17 | ||
30 | |||
31 | struct tegra_rpc_port_desc { | ||
32 | char name[TEGRA_RPC_MAX_NAME_LEN]; | ||
33 | int notify_fd; /* fd representing a trpc_sema to signal when a | ||
34 | * message has been received */ | ||
35 | }; | ||
36 | |||
37 | #define TEGRA_RPC_IOCTL_MAGIC 'r' | ||
38 | |||
39 | #define TEGRA_RPC_IOCTL_PORT_CREATE _IOW(TEGRA_RPC_IOCTL_MAGIC, 0x20, struct tegra_rpc_port_desc) | ||
40 | #define TEGRA_RPC_IOCTL_PORT_GET_NAME _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x21, char *) | ||
41 | #define TEGRA_RPC_IOCTL_PORT_CONNECT _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x22, long) | ||
42 | #define TEGRA_RPC_IOCTL_PORT_LISTEN _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x23, long) | ||
43 | |||
44 | #define TEGRA_RPC_IOCTL_MIN_NR _IOC_NR(TEGRA_RPC_IOCTL_PORT_CREATE) | ||
45 | #define TEGRA_RPC_IOCTL_MAX_NR _IOC_NR(TEGRA_RPC_IOCTL_PORT_LISTEN) | ||
46 | |||
47 | #endif | ||
diff --git a/include/linux/tegra_sema.h b/include/linux/tegra_sema.h new file mode 100644 index 00000000000..7b423b6cb5c --- /dev/null +++ b/include/linux/tegra_sema.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Dima Zavin <dima@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_TEGRA_SEMA_H | ||
19 | #define __LINUX_TEGRA_SEMA_H | ||
20 | |||
21 | /* this shares the magic with the tegra RPC and AVP drivers. | ||
22 | * See include/linux/tegra_avp.h and include/linux/tegra_rpc.h */ | ||
23 | #define TEGRA_SEMA_IOCTL_MAGIC 'r' | ||
24 | |||
25 | /* If IOCTL_WAIT is interrupted by a signal and the timeout was not -1, | ||
26 | * then the value pointed to by the argument will be updated with the amount | ||
27 | * of time remaining for the wait. */ | ||
28 | #define TEGRA_SEMA_IOCTL_WAIT _IOW(TEGRA_SEMA_IOCTL_MAGIC, 0x30, long *) | ||
29 | #define TEGRA_SEMA_IOCTL_SIGNAL _IO(TEGRA_SEMA_IOCTL_MAGIC, 0x31) | ||
30 | |||
31 | #define TEGRA_SEMA_IOCTL_MIN_NR _IOC_NR(TEGRA_SEMA_IOCTL_WAIT) | ||
32 | #define TEGRA_SEMA_IOCTL_MAX_NR _IOC_NR(TEGRA_SEMA_IOCTL_SIGNAL) | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/tegra_spdif.h b/include/linux/tegra_spdif.h new file mode 100644 index 00000000000..8d7f6457a0d --- /dev/null +++ b/include/linux/tegra_spdif.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* include/linux/tegra_spdif.h | ||
2 | * | ||
3 | * SPDIF audio driver for NVIDIA Tegra SoCs | ||
4 | * | ||
5 | * Copyright (c) 2008-2009, NVIDIA Corporation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef _TEGRA_SPDIF_H | ||
23 | #define _TEGRA_SPDIF_H | ||
24 | |||
25 | #include <linux/ioctl.h> | ||
26 | |||
27 | #define TEGRA_SPDIF_MAGIC 's' | ||
28 | |||
29 | |||
30 | |||
31 | struct tegra_audio_buf_config { | ||
32 | unsigned size; /* order */ | ||
33 | unsigned threshold; /* order */ | ||
34 | unsigned chunk; /* order */ | ||
35 | }; | ||
36 | |||
37 | |||
38 | |||
39 | #define TEGRA_AUDIO_OUT_SET_BUF_CONFIG _IOW(TEGRA_SPDIF_MAGIC, 0, \ | ||
40 | const struct tegra_audio_buf_config *) | ||
41 | #define TEGRA_AUDIO_OUT_GET_BUF_CONFIG _IOR(TEGRA_SPDIF_MAGIC, 1, \ | ||
42 | struct tegra_audio_buf_config *) | ||
43 | |||
44 | #define TEGRA_AUDIO_OUT_GET_ERROR_COUNT _IOR(TEGRA_SPDIF_MAGIC, 2, \ | ||
45 | unsigned *) | ||
46 | |||
47 | struct tegra_audio_out_preload { | ||
48 | void *data; | ||
49 | size_t len; | ||
50 | size_t len_written; | ||
51 | }; | ||
52 | |||
53 | #define TEGRA_AUDIO_OUT_PRELOAD_FIFO _IOWR(TEGRA_SPDIF_MAGIC, 3, \ | ||
54 | struct tegra_audio_out_preload *) | ||
55 | |||
56 | #endif/*_TEGRA_SPDIF_H*/ | ||
diff --git a/include/linux/tegra_uart.h b/include/linux/tegra_uart.h new file mode 100644 index 00000000000..38912ea9706 --- /dev/null +++ b/include/linux/tegra_uart.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* include/linux/tegra_uart.h | ||
2 | * | ||
3 | * Copyright (C) 2011 NVIDIA Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _TEGRA_UART_H_ | ||
21 | #define _TEGRA_UART_H_ | ||
22 | |||
23 | #include <linux/clk.h> | ||
24 | |||
25 | struct uart_clk_parent { | ||
26 | const char *name; | ||
27 | struct clk *parent_clk; | ||
28 | unsigned long fixed_clk_rate; | ||
29 | }; | ||
30 | |||
31 | struct tegra_uart_platform_data { | ||
32 | void (*wake_peer)(struct uart_port *); | ||
33 | struct uart_clk_parent *parent_clk_list; | ||
34 | int parent_clk_count; | ||
35 | bool is_loopback; | ||
36 | }; | ||
37 | |||
38 | int tegra_uart_is_tx_empty(struct uart_port *); | ||
39 | void tegra_uart_request_clock_on(struct uart_port *); | ||
40 | void tegra_uart_set_mctrl(struct uart_port *, unsigned int); | ||
41 | void tegra_uart_request_clock_off(struct uart_port *uport); | ||
42 | |||
43 | #endif /* _TEGRA_UART_H_ */ | ||
44 | |||
diff --git a/include/linux/telephony.h b/include/linux/telephony.h new file mode 100644 index 00000000000..f63afe330ad --- /dev/null +++ b/include/linux/telephony.h | |||
@@ -0,0 +1,262 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * telephony.h | ||
4 | * | ||
5 | * Basic Linux Telephony Interface | ||
6 | * | ||
7 | * (c) Copyright 1999-2001 Quicknet Technologies, Inc. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * Authors: Ed Okerson, <eokerson@quicknet.net> | ||
15 | * Greg Herlein, <gherlein@quicknet.net> | ||
16 | * | ||
17 | * Contributors: Alan Cox, <alan@lxorguk.ukuu.org.uk> | ||
18 | * David W. Erhart, <derhart@quicknet.net> | ||
19 | * | ||
20 | * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR | ||
21 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT | ||
22 | * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET | ||
23 | * TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, | ||
26 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
27 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | ||
28 | * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION | ||
29 | * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | ||
30 | * | ||
31 | *****************************************************************************/ | ||
32 | |||
33 | #ifndef TELEPHONY_H | ||
34 | #define TELEPHONY_H | ||
35 | |||
36 | #define TELEPHONY_VERSION 3013 | ||
37 | |||
38 | #define PHONE_VENDOR_IXJ 1 | ||
39 | #define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ | ||
40 | #define PHONE_VENDOR_VOICETRONIX 2 | ||
41 | #define PHONE_VENDOR_ACULAB 3 | ||
42 | #define PHONE_VENDOR_DIGI 4 | ||
43 | #define PHONE_VENDOR_FRANKLIN 5 | ||
44 | |||
45 | /****************************************************************************** | ||
46 | * Vendor Summary Information Area | ||
47 | * | ||
48 | * Quicknet Technologies, Inc. - makes low density analog telephony cards | ||
49 | * with audio compression, POTS and PSTN interfaces (www.quicknet.net) | ||
50 | * | ||
51 | * (other vendors following this API shuld add a short description of | ||
52 | * the telephony products they support under Linux) | ||
53 | * | ||
54 | *****************************************************************************/ | ||
55 | #define QTI_PHONEJACK 100 | ||
56 | #define QTI_LINEJACK 300 | ||
57 | #define QTI_PHONEJACK_LITE 400 | ||
58 | #define QTI_PHONEJACK_PCI 500 | ||
59 | #define QTI_PHONECARD 600 | ||
60 | |||
61 | /****************************************************************************** | ||
62 | * | ||
63 | * The capabilities ioctls can inform you of the capabilities of each phone | ||
64 | * device installed in your system. The PHONECTL_CAPABILITIES ioctl | ||
65 | * returns an integer value indicating the number of capabilities the | ||
66 | * device has. The PHONECTL_CAPABILITIES_LIST will fill an array of | ||
67 | * capability structs with all of its capabilities. The | ||
68 | * PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns | ||
69 | * a TRUE if the device has that capability, otherwise it returns false. | ||
70 | * | ||
71 | ******************************************************************************/ | ||
72 | typedef enum { | ||
73 | vendor = 0, | ||
74 | device, | ||
75 | port, | ||
76 | codec, | ||
77 | dsp | ||
78 | } phone_cap; | ||
79 | |||
80 | struct phone_capability { | ||
81 | char desc[80]; | ||
82 | phone_cap captype; | ||
83 | int cap; | ||
84 | int handle; | ||
85 | }; | ||
86 | |||
87 | typedef enum { | ||
88 | pots = 0, | ||
89 | pstn, | ||
90 | handset, | ||
91 | speaker | ||
92 | } phone_ports; | ||
93 | |||
94 | #define PHONE_CAPABILITIES _IO ('q', 0x80) | ||
95 | #define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *) | ||
96 | #define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *) | ||
97 | |||
98 | typedef struct { | ||
99 | char month[3]; | ||
100 | char day[3]; | ||
101 | char hour[3]; | ||
102 | char min[3]; | ||
103 | int numlen; | ||
104 | char number[11]; | ||
105 | int namelen; | ||
106 | char name[80]; | ||
107 | } PHONE_CID; | ||
108 | |||
109 | #define PHONE_RING _IO ('q', 0x83) | ||
110 | #define PHONE_HOOKSTATE _IO ('q', 0x84) | ||
111 | #define PHONE_MAXRINGS _IOW ('q', 0x85, char) | ||
112 | #define PHONE_RING_CADENCE _IOW ('q', 0x86, short) | ||
113 | #define OLD_PHONE_RING_START _IO ('q', 0x87) | ||
114 | #define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *) | ||
115 | #define PHONE_RING_STOP _IO ('q', 0x88) | ||
116 | |||
117 | #define USA_RING_CADENCE 0xC0C0 | ||
118 | |||
119 | #define PHONE_REC_CODEC _IOW ('q', 0x89, int) | ||
120 | #define PHONE_REC_START _IO ('q', 0x8A) | ||
121 | #define PHONE_REC_STOP _IO ('q', 0x8B) | ||
122 | #define PHONE_REC_DEPTH _IOW ('q', 0x8C, int) | ||
123 | #define PHONE_FRAME _IOW ('q', 0x8D, int) | ||
124 | #define PHONE_REC_VOLUME _IOW ('q', 0x8E, int) | ||
125 | #define PHONE_REC_VOLUME_LINEAR _IOW ('q', 0xDB, int) | ||
126 | #define PHONE_REC_LEVEL _IO ('q', 0x8F) | ||
127 | |||
128 | #define PHONE_PLAY_CODEC _IOW ('q', 0x90, int) | ||
129 | #define PHONE_PLAY_START _IO ('q', 0x91) | ||
130 | #define PHONE_PLAY_STOP _IO ('q', 0x92) | ||
131 | #define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int) | ||
132 | #define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int) | ||
133 | #define PHONE_PLAY_VOLUME_LINEAR _IOW ('q', 0xDC, int) | ||
134 | #define PHONE_PLAY_LEVEL _IO ('q', 0x95) | ||
135 | #define PHONE_DTMF_READY _IOR ('q', 0x96, int) | ||
136 | #define PHONE_GET_DTMF _IOR ('q', 0x97, int) | ||
137 | #define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int) | ||
138 | #define PHONE_DTMF_OOB _IOW ('q', 0x99, int) | ||
139 | #define PHONE_EXCEPTION _IOR ('q', 0x9A, int) | ||
140 | #define PHONE_PLAY_TONE _IOW ('q', 0x9B, char) | ||
141 | #define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int) | ||
142 | #define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int) | ||
143 | #define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E) | ||
144 | #define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F) | ||
145 | #define PHONE_GET_TONE_STATE _IO ('q', 0xA0) | ||
146 | #define PHONE_BUSY _IO ('q', 0xA1) | ||
147 | #define PHONE_RINGBACK _IO ('q', 0xA2) | ||
148 | #define PHONE_DIALTONE _IO ('q', 0xA3) | ||
149 | #define PHONE_CPT_STOP _IO ('q', 0xA4) | ||
150 | |||
151 | #define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int) | ||
152 | #define PHONE_PSTN_GET_STATE _IO ('q', 0xA5) | ||
153 | |||
154 | #define PSTN_ON_HOOK 0 | ||
155 | #define PSTN_RINGING 1 | ||
156 | #define PSTN_OFF_HOOK 2 | ||
157 | #define PSTN_PULSE_DIAL 3 | ||
158 | |||
159 | /****************************************************************************** | ||
160 | * | ||
161 | * The wink duration is tunable with this ioctl. The default wink duration | ||
162 | * is 320ms. You do not need to use this ioctl if you do not require a | ||
163 | * different wink duration. | ||
164 | * | ||
165 | ******************************************************************************/ | ||
166 | #define PHONE_WINK_DURATION _IOW ('q', 0xA6, int) | ||
167 | #define PHONE_WINK _IOW ('q', 0xAA, int) | ||
168 | |||
169 | /****************************************************************************** | ||
170 | * | ||
171 | * Codec Definitions | ||
172 | * | ||
173 | ******************************************************************************/ | ||
174 | typedef enum { | ||
175 | G723_63 = 1, | ||
176 | G723_53 = 2, | ||
177 | TS85 = 3, | ||
178 | TS48 = 4, | ||
179 | TS41 = 5, | ||
180 | G728 = 6, | ||
181 | G729 = 7, | ||
182 | ULAW = 8, | ||
183 | ALAW = 9, | ||
184 | LINEAR16 = 10, | ||
185 | LINEAR8 = 11, | ||
186 | WSS = 12, | ||
187 | G729B = 13 | ||
188 | } phone_codec; | ||
189 | |||
190 | struct phone_codec_data | ||
191 | { | ||
192 | phone_codec type; | ||
193 | unsigned short buf_min, buf_opt, buf_max; | ||
194 | }; | ||
195 | |||
196 | #define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *) | ||
197 | #define PHONE_PSTN_LINETEST _IO ('q', 0xA8) | ||
198 | |||
199 | /****************************************************************************** | ||
200 | * | ||
201 | * This controls the VAD/CNG functionality of G.723.1. The driver will | ||
202 | * always pass full size frames, any unused bytes will be padded with zeros, | ||
203 | * and frames passed to the driver should also be padded with zeros. The | ||
204 | * frame type is encoded in the least significant two bits of the first | ||
205 | * WORD of the frame as follows: | ||
206 | * | ||
207 | * bits 1-0 Frame Type Data Rate Significant Words | ||
208 | * 00 0 G.723.1 6.3 12 | ||
209 | * 01 1 G.723.1 5.3 10 | ||
210 | * 10 2 VAD/CNG 2 | ||
211 | * 11 3 Repeat last CNG 2 bits | ||
212 | * | ||
213 | ******************************************************************************/ | ||
214 | #define PHONE_VAD _IOW ('q', 0xA9, int) | ||
215 | |||
216 | |||
217 | /****************************************************************************** | ||
218 | * | ||
219 | * The exception structure allows us to multiplex multiple events onto the | ||
220 | * select() exception set. If any of these flags are set select() will | ||
221 | * return with a positive indication on the exception set. The dtmf_ready | ||
222 | * bit indicates if there is data waiting in the DTMF buffer. The | ||
223 | * hookstate bit is set if there is a change in hookstate status, it does not | ||
224 | * indicate the current state of the hookswitch. The pstn_ring bit | ||
225 | * indicates that the DAA on a LineJACK card has detected ring voltage on | ||
226 | * the PSTN port. The caller_id bit indicates that caller_id data has been | ||
227 | * received and is available. The pstn_wink bit indicates that the DAA on | ||
228 | * the LineJACK has received a wink from the telco switch. The f0, f1, f2 | ||
229 | * and f3 bits indicate that the filter has been triggered by detecting the | ||
230 | * frequency programmed into that filter. | ||
231 | * | ||
232 | * The remaining bits should be set to zero. They will become defined over time | ||
233 | * for other interface cards and their needs. | ||
234 | * | ||
235 | ******************************************************************************/ | ||
236 | struct phone_except | ||
237 | { | ||
238 | unsigned int dtmf_ready:1; | ||
239 | unsigned int hookstate:1; | ||
240 | unsigned int pstn_ring:1; | ||
241 | unsigned int caller_id:1; | ||
242 | unsigned int pstn_wink:1; | ||
243 | unsigned int f0:1; | ||
244 | unsigned int f1:1; | ||
245 | unsigned int f2:1; | ||
246 | unsigned int f3:1; | ||
247 | unsigned int flash:1; | ||
248 | unsigned int fc0:1; | ||
249 | unsigned int fc1:1; | ||
250 | unsigned int fc2:1; | ||
251 | unsigned int fc3:1; | ||
252 | unsigned int reserved:18; | ||
253 | }; | ||
254 | |||
255 | union telephony_exception { | ||
256 | struct phone_except bits; | ||
257 | unsigned int bytes; | ||
258 | }; | ||
259 | |||
260 | |||
261 | #endif /* TELEPHONY_H */ | ||
262 | |||
diff --git a/include/linux/termios.h b/include/linux/termios.h new file mode 100644 index 00000000000..2acd0c1f8a2 --- /dev/null +++ b/include/linux/termios.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _LINUX_TERMIOS_H | ||
2 | #define _LINUX_TERMIOS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/termios.h> | ||
6 | |||
7 | #define NFF 5 | ||
8 | |||
9 | struct termiox | ||
10 | { | ||
11 | __u16 x_hflag; | ||
12 | __u16 x_cflag; | ||
13 | __u16 x_rflag[NFF]; | ||
14 | __u16 x_sflag; | ||
15 | }; | ||
16 | |||
17 | #define RTSXOFF 0x0001 /* RTS flow control on input */ | ||
18 | #define CTSXON 0x0002 /* CTS flow control on output */ | ||
19 | #define DTRXOFF 0x0004 /* DTR flow control on input */ | ||
20 | #define DSRXON 0x0008 /* DCD flow control on output */ | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h new file mode 100644 index 00000000000..546e2234e4b --- /dev/null +++ b/include/linux/timecompare.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * Utility code which helps transforming between two different time | ||
3 | * bases, called "source" and "target" time in this code. | ||
4 | * | ||
5 | * Source time has to be provided via the timecounter API while target | ||
6 | * time is accessed via a function callback whose prototype | ||
7 | * intentionally matches ktime_get() and ktime_get_real(). These | ||
8 | * interfaces where chosen like this so that the code serves its | ||
9 | * initial purpose without additional glue code. | ||
10 | * | ||
11 | * This purpose is synchronizing a hardware clock in a NIC with system | ||
12 | * time, in order to implement the Precision Time Protocol (PTP, | ||
13 | * IEEE1588) with more accurate hardware assisted time stamping. In | ||
14 | * that context only synchronization against system time (= | ||
15 | * ktime_get_real()) is currently needed. But this utility code might | ||
16 | * become useful in other situations, which is why it was written as | ||
17 | * general purpose utility code. | ||
18 | * | ||
19 | * The source timecounter is assumed to return monotonically | ||
20 | * increasing time (but this code does its best to compensate if that | ||
21 | * is not the case) whereas target time may jump. | ||
22 | * | ||
23 | * The target time corresponding to a source time is determined by | ||
24 | * reading target time, reading source time, reading target time | ||
25 | * again, then assuming that average target time corresponds to source | ||
26 | * time. In other words, the assumption is that reading the source | ||
27 | * time is slow and involves equal time for sending the request and | ||
28 | * receiving the reply, whereas reading target time is assumed to be | ||
29 | * fast. | ||
30 | * | ||
31 | * Copyright (C) 2009 Intel Corporation. | ||
32 | * Author: Patrick Ohly <patrick.ohly@intel.com> | ||
33 | * | ||
34 | * This program is free software; you can redistribute it and/or modify it | ||
35 | * under the terms and conditions of the GNU General Public License, | ||
36 | * version 2, as published by the Free Software Foundation. | ||
37 | * | ||
38 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
39 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
40 | * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for | ||
41 | * more details. | ||
42 | * | ||
43 | * You should have received a copy of the GNU General Public License along with | ||
44 | * this program; if not, write to the Free Software Foundation, Inc., | ||
45 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
46 | */ | ||
47 | #ifndef _LINUX_TIMECOMPARE_H | ||
48 | #define _LINUX_TIMECOMPARE_H | ||
49 | |||
50 | #include <linux/clocksource.h> | ||
51 | #include <linux/ktime.h> | ||
52 | |||
53 | /** | ||
54 | * struct timecompare - stores state and configuration for the two clocks | ||
55 | * | ||
56 | * Initialize to zero, then set source/target/num_samples. | ||
57 | * | ||
58 | * Transformation between source time and target time is done with: | ||
59 | * target_time = source_time + offset + | ||
60 | * (source_time - last_update) * skew / | ||
61 | * TIMECOMPARE_SKEW_RESOLUTION | ||
62 | * | ||
63 | * @source: used to get source time stamps via timecounter_read() | ||
64 | * @target: function returning target time (for example, ktime_get | ||
65 | * for monotonic time, or ktime_get_real for wall clock) | ||
66 | * @num_samples: number of times that source time and target time are to | ||
67 | * be compared when determining their offset | ||
68 | * @offset: (target time - source time) at the time of the last update | ||
69 | * @skew: average (target time - source time) / delta source time * | ||
70 | * TIMECOMPARE_SKEW_RESOLUTION | ||
71 | * @last_update: last source time stamp when time offset was measured | ||
72 | */ | ||
73 | struct timecompare { | ||
74 | struct timecounter *source; | ||
75 | ktime_t (*target)(void); | ||
76 | int num_samples; | ||
77 | |||
78 | s64 offset; | ||
79 | s64 skew; | ||
80 | u64 last_update; | ||
81 | }; | ||
82 | |||
83 | /** | ||
84 | * timecompare_transform - transform source time stamp into target time base | ||
85 | * @sync: context for time sync | ||
86 | * @source_tstamp: the result of timecounter_read() or | ||
87 | * timecounter_cyc2time() | ||
88 | */ | ||
89 | extern ktime_t timecompare_transform(struct timecompare *sync, | ||
90 | u64 source_tstamp); | ||
91 | |||
92 | /** | ||
93 | * timecompare_offset - measure current (target time - source time) offset | ||
94 | * @sync: context for time sync | ||
95 | * @offset: average offset during sample period returned here | ||
96 | * @source_tstamp: average source time during sample period returned here | ||
97 | * | ||
98 | * Returns number of samples used. Might be zero (= no result) in the | ||
99 | * unlikely case that target time was monotonically decreasing for all | ||
100 | * samples (= broken). | ||
101 | */ | ||
102 | extern int timecompare_offset(struct timecompare *sync, | ||
103 | s64 *offset, | ||
104 | u64 *source_tstamp); | ||
105 | |||
106 | extern void __timecompare_update(struct timecompare *sync, | ||
107 | u64 source_tstamp); | ||
108 | |||
109 | /** | ||
110 | * timecompare_update - update offset and skew by measuring current offset | ||
111 | * @sync: context for time sync | ||
112 | * @source_tstamp: the result of timecounter_read() or | ||
113 | * timecounter_cyc2time(), pass zero to force update | ||
114 | * | ||
115 | * Updates are only done at most once per second. | ||
116 | */ | ||
117 | static inline void timecompare_update(struct timecompare *sync, | ||
118 | u64 source_tstamp) | ||
119 | { | ||
120 | if (!source_tstamp || | ||
121 | (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC) | ||
122 | __timecompare_update(sync, source_tstamp); | ||
123 | } | ||
124 | |||
125 | #endif /* _LINUX_TIMECOMPARE_H */ | ||
diff --git a/include/linux/times.h b/include/linux/times.h new file mode 100644 index 00000000000..87b62615ced --- /dev/null +++ b/include/linux/times.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _LINUX_TIMES_H | ||
2 | #define _LINUX_TIMES_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct tms { | ||
7 | __kernel_clock_t tms_utime; | ||
8 | __kernel_clock_t tms_stime; | ||
9 | __kernel_clock_t tms_cutime; | ||
10 | __kernel_clock_t tms_cstime; | ||
11 | }; | ||
12 | |||
13 | #endif | ||
diff --git a/include/linux/tiocl.h b/include/linux/tiocl.h new file mode 100644 index 00000000000..4756862c4ed --- /dev/null +++ b/include/linux/tiocl.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef _LINUX_TIOCL_H | ||
2 | #define _LINUX_TIOCL_H | ||
3 | |||
4 | #define TIOCL_SETSEL 2 /* set a selection */ | ||
5 | #define TIOCL_SELCHAR 0 /* select characters */ | ||
6 | #define TIOCL_SELWORD 1 /* select whole words */ | ||
7 | #define TIOCL_SELLINE 2 /* select whole lines */ | ||
8 | #define TIOCL_SELPOINTER 3 /* show the pointer */ | ||
9 | #define TIOCL_SELCLEAR 4 /* clear visibility of selection */ | ||
10 | #define TIOCL_SELMOUSEREPORT 16 /* report beginning of selection */ | ||
11 | #define TIOCL_SELBUTTONMASK 15 /* button mask for report */ | ||
12 | /* selection extent */ | ||
13 | struct tiocl_selection { | ||
14 | unsigned short xs; /* X start */ | ||
15 | unsigned short ys; /* Y start */ | ||
16 | unsigned short xe; /* X end */ | ||
17 | unsigned short ye; /* Y end */ | ||
18 | unsigned short sel_mode; /* selection mode */ | ||
19 | }; | ||
20 | |||
21 | #define TIOCL_PASTESEL 3 /* paste previous selection */ | ||
22 | #define TIOCL_UNBLANKSCREEN 4 /* unblank screen */ | ||
23 | |||
24 | #define TIOCL_SELLOADLUT 5 | ||
25 | /* set characters to be considered alphabetic when selecting */ | ||
26 | /* u32[8] bit array, 4 bytes-aligned with type */ | ||
27 | |||
28 | /* these two don't return a value: they write it back in the type */ | ||
29 | #define TIOCL_GETSHIFTSTATE 6 /* write shift state */ | ||
30 | #define TIOCL_GETMOUSEREPORTING 7 /* write whether mouse event are reported */ | ||
31 | #define TIOCL_SETVESABLANK 10 /* set vesa blanking mode */ | ||
32 | #define TIOCL_SETKMSGREDIRECT 11 /* restrict kernel messages to a vt */ | ||
33 | #define TIOCL_GETFGCONSOLE 12 /* get foreground vt */ | ||
34 | #define TIOCL_SCROLLCONSOLE 13 /* scroll console */ | ||
35 | #define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */ | ||
36 | #define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */ | ||
37 | #define TIOCL_GETKMSGREDIRECT 17 /* get the vt the kernel messages are restricted to */ | ||
38 | |||
39 | #endif /* _LINUX_TIOCL_H */ | ||
diff --git a/include/linux/tipc.h b/include/linux/tipc.h new file mode 100644 index 00000000000..f2d90091cc2 --- /dev/null +++ b/include/linux/tipc.h | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * include/linux/tipc.h: Include file for TIPC socket interface | ||
3 | * | ||
4 | * Copyright (c) 2003-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, 2010-2011, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _LINUX_TIPC_H_ | ||
38 | #define _LINUX_TIPC_H_ | ||
39 | |||
40 | #include <linux/types.h> | ||
41 | |||
42 | /* | ||
43 | * TIPC addressing primitives | ||
44 | */ | ||
45 | |||
46 | struct tipc_portid { | ||
47 | __u32 ref; | ||
48 | __u32 node; | ||
49 | }; | ||
50 | |||
51 | struct tipc_name { | ||
52 | __u32 type; | ||
53 | __u32 instance; | ||
54 | }; | ||
55 | |||
56 | struct tipc_name_seq { | ||
57 | __u32 type; | ||
58 | __u32 lower; | ||
59 | __u32 upper; | ||
60 | }; | ||
61 | |||
62 | static inline __u32 tipc_addr(unsigned int zone, | ||
63 | unsigned int cluster, | ||
64 | unsigned int node) | ||
65 | { | ||
66 | return (zone << 24) | (cluster << 12) | node; | ||
67 | } | ||
68 | |||
69 | static inline unsigned int tipc_zone(__u32 addr) | ||
70 | { | ||
71 | return addr >> 24; | ||
72 | } | ||
73 | |||
74 | static inline unsigned int tipc_cluster(__u32 addr) | ||
75 | { | ||
76 | return (addr >> 12) & 0xfff; | ||
77 | } | ||
78 | |||
79 | static inline unsigned int tipc_node(__u32 addr) | ||
80 | { | ||
81 | return addr & 0xfff; | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * Application-accessible port name types | ||
86 | */ | ||
87 | |||
88 | #define TIPC_CFG_SRV 0 /* configuration service name type */ | ||
89 | #define TIPC_TOP_SRV 1 /* topology service name type */ | ||
90 | #define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ | ||
91 | |||
92 | /* | ||
93 | * Publication scopes when binding port names and port name sequences | ||
94 | */ | ||
95 | |||
96 | #define TIPC_ZONE_SCOPE 1 | ||
97 | #define TIPC_CLUSTER_SCOPE 2 | ||
98 | #define TIPC_NODE_SCOPE 3 | ||
99 | |||
100 | /* | ||
101 | * Limiting values for messages | ||
102 | */ | ||
103 | |||
104 | #define TIPC_MAX_USER_MSG_SIZE 66000U | ||
105 | |||
106 | /* | ||
107 | * Message importance levels | ||
108 | */ | ||
109 | |||
110 | #define TIPC_LOW_IMPORTANCE 0 | ||
111 | #define TIPC_MEDIUM_IMPORTANCE 1 | ||
112 | #define TIPC_HIGH_IMPORTANCE 2 | ||
113 | #define TIPC_CRITICAL_IMPORTANCE 3 | ||
114 | |||
115 | /* | ||
116 | * Msg rejection/connection shutdown reasons | ||
117 | */ | ||
118 | |||
119 | #define TIPC_OK 0 | ||
120 | #define TIPC_ERR_NO_NAME 1 | ||
121 | #define TIPC_ERR_NO_PORT 2 | ||
122 | #define TIPC_ERR_NO_NODE 3 | ||
123 | #define TIPC_ERR_OVERLOAD 4 | ||
124 | #define TIPC_CONN_SHUTDOWN 5 | ||
125 | |||
126 | /* | ||
127 | * TIPC topology subscription service definitions | ||
128 | */ | ||
129 | |||
130 | #define TIPC_SUB_PORTS 0x01 /* filter for port availability */ | ||
131 | #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ | ||
132 | #define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ | ||
133 | |||
134 | #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ | ||
135 | |||
136 | struct tipc_subscr { | ||
137 | struct tipc_name_seq seq; /* name sequence of interest */ | ||
138 | __u32 timeout; /* subscription duration (in ms) */ | ||
139 | __u32 filter; /* bitmask of filter options */ | ||
140 | char usr_handle[8]; /* available for subscriber use */ | ||
141 | }; | ||
142 | |||
143 | #define TIPC_PUBLISHED 1 /* publication event */ | ||
144 | #define TIPC_WITHDRAWN 2 /* withdraw event */ | ||
145 | #define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ | ||
146 | |||
147 | struct tipc_event { | ||
148 | __u32 event; /* event type */ | ||
149 | __u32 found_lower; /* matching name seq instances */ | ||
150 | __u32 found_upper; /* " " " " */ | ||
151 | struct tipc_portid port; /* associated port */ | ||
152 | struct tipc_subscr s; /* associated subscription */ | ||
153 | }; | ||
154 | |||
155 | /* | ||
156 | * Socket API | ||
157 | */ | ||
158 | |||
159 | #ifndef AF_TIPC | ||
160 | #define AF_TIPC 30 | ||
161 | #endif | ||
162 | |||
163 | #ifndef PF_TIPC | ||
164 | #define PF_TIPC AF_TIPC | ||
165 | #endif | ||
166 | |||
167 | #ifndef SOL_TIPC | ||
168 | #define SOL_TIPC 271 | ||
169 | #endif | ||
170 | |||
171 | #define TIPC_ADDR_NAMESEQ 1 | ||
172 | #define TIPC_ADDR_MCAST 1 | ||
173 | #define TIPC_ADDR_NAME 2 | ||
174 | #define TIPC_ADDR_ID 3 | ||
175 | |||
176 | struct sockaddr_tipc { | ||
177 | unsigned short family; | ||
178 | unsigned char addrtype; | ||
179 | signed char scope; | ||
180 | union { | ||
181 | struct tipc_portid id; | ||
182 | struct tipc_name_seq nameseq; | ||
183 | struct { | ||
184 | struct tipc_name name; | ||
185 | __u32 domain; | ||
186 | } name; | ||
187 | } addr; | ||
188 | }; | ||
189 | |||
190 | /* | ||
191 | * Ancillary data objects supported by recvmsg() | ||
192 | */ | ||
193 | |||
194 | #define TIPC_ERRINFO 1 /* error info */ | ||
195 | #define TIPC_RETDATA 2 /* returned data */ | ||
196 | #define TIPC_DESTNAME 3 /* destination name */ | ||
197 | |||
198 | /* | ||
199 | * TIPC-specific socket option values | ||
200 | */ | ||
201 | |||
202 | #define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ | ||
203 | #define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */ | ||
204 | #define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ | ||
205 | #define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ | ||
206 | #define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ | ||
207 | #define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ | ||
208 | |||
209 | #endif | ||
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h new file mode 100644 index 00000000000..0db239590b4 --- /dev/null +++ b/include/linux/tipc_config.h | |||
@@ -0,0 +1,391 @@ | |||
1 | /* | ||
2 | * include/linux/tipc_config.h: Include file for TIPC configuration interface | ||
3 | * | ||
4 | * Copyright (c) 2003-2006, Ericsson AB | ||
5 | * Copyright (c) 2005-2007, 2010-2011, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _LINUX_TIPC_CONFIG_H_ | ||
38 | #define _LINUX_TIPC_CONFIG_H_ | ||
39 | |||
40 | #include <linux/types.h> | ||
41 | #include <linux/string.h> | ||
42 | #include <asm/byteorder.h> | ||
43 | |||
44 | /* | ||
45 | * Configuration | ||
46 | * | ||
47 | * All configuration management messaging involves sending a request message | ||
48 | * to the TIPC configuration service on a node, which sends a reply message | ||
49 | * back. (In the future multi-message replies may be supported.) | ||
50 | * | ||
51 | * Both request and reply messages consist of a transport header and payload. | ||
52 | * The transport header contains info about the desired operation; | ||
53 | * the payload consists of zero or more type/length/value (TLV) items | ||
54 | * which specify parameters or results for the operation. | ||
55 | * | ||
56 | * For many operations, the request and reply messages have a fixed number | ||
57 | * of TLVs (usually zero or one); however, some reply messages may return | ||
58 | * a variable number of TLVs. A failed request is denoted by the presence | ||
59 | * of an "error string" TLV in the reply message instead of the TLV(s) the | ||
60 | * reply should contain if the request succeeds. | ||
61 | */ | ||
62 | |||
63 | /* | ||
64 | * Public commands: | ||
65 | * May be issued by any process. | ||
66 | * Accepted by own node, or by remote node only if remote management enabled. | ||
67 | */ | ||
68 | |||
69 | #define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */ | ||
70 | #define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */ | ||
71 | #define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */ | ||
72 | #define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */ | ||
73 | #define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */ | ||
74 | #define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ | ||
75 | #define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ | ||
76 | #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ | ||
77 | #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ | ||
78 | |||
79 | /* | ||
80 | * Protected commands: | ||
81 | * May only be issued by "network administration capable" process. | ||
82 | * Accepted by own node, or by remote node only if remote management enabled | ||
83 | * and this node is zone manager. | ||
84 | */ | ||
85 | |||
86 | #define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ | ||
87 | #define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ | ||
88 | #define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ | ||
89 | #define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ | ||
90 | #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ | ||
91 | #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ | ||
92 | #define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ | ||
93 | #define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ | ||
94 | #define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ | ||
95 | |||
96 | #define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */ | ||
97 | #define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */ | ||
98 | #define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */ | ||
99 | #define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */ | ||
100 | #define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */ | ||
101 | #define TIPC_CMD_SET_LOG_SIZE 0x410A /* tx unsigned, rx none */ | ||
102 | #define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ | ||
103 | #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ | ||
104 | |||
105 | /* | ||
106 | * Private commands: | ||
107 | * May only be issued by "network administration capable" process. | ||
108 | * Accepted by own node only; cannot be used on a remote node. | ||
109 | */ | ||
110 | |||
111 | #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ | ||
112 | #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ | ||
113 | #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ | ||
114 | #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ | ||
115 | #define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ | ||
116 | #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ | ||
117 | #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ | ||
118 | #define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ | ||
119 | #define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ | ||
120 | #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ | ||
121 | |||
122 | /* | ||
123 | * Reserved commands: | ||
124 | * May not be issued by any process. | ||
125 | * Used internally by TIPC. | ||
126 | */ | ||
127 | |||
128 | #define TIPC_CMD_NOT_NET_ADMIN 0xC001 /* tx none, rx none */ | ||
129 | |||
130 | /* | ||
131 | * TLV types defined for TIPC | ||
132 | */ | ||
133 | |||
134 | #define TIPC_TLV_NONE 0 /* no TLV present */ | ||
135 | #define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/ | ||
136 | #define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */ | ||
137 | #define TIPC_TLV_STRING 3 /* char[128] (max) */ | ||
138 | #define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */ | ||
139 | #define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */ | ||
140 | |||
141 | #define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */ | ||
142 | #define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */ | ||
143 | #define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */ | ||
144 | #define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */ | ||
145 | #define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */ | ||
146 | #define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */ | ||
147 | #define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */ | ||
148 | #define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */ | ||
149 | #define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */ | ||
150 | #define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */ | ||
151 | #define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ | ||
152 | |||
153 | /* | ||
154 | * Maximum sizes of TIPC bearer-related names (including terminating NUL) | ||
155 | */ | ||
156 | |||
157 | #define TIPC_MAX_MEDIA_NAME 16 /* format = media */ | ||
158 | #define TIPC_MAX_IF_NAME 16 /* format = interface */ | ||
159 | #define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */ | ||
160 | #define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */ | ||
161 | |||
162 | /* | ||
163 | * Link priority limits (min, default, max, media default) | ||
164 | */ | ||
165 | |||
166 | #define TIPC_MIN_LINK_PRI 0 | ||
167 | #define TIPC_DEF_LINK_PRI 10 | ||
168 | #define TIPC_MAX_LINK_PRI 31 | ||
169 | #define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1) | ||
170 | |||
171 | /* | ||
172 | * Link tolerance limits (min, default, max), in ms | ||
173 | */ | ||
174 | |||
175 | #define TIPC_MIN_LINK_TOL 50 | ||
176 | #define TIPC_DEF_LINK_TOL 1500 | ||
177 | #define TIPC_MAX_LINK_TOL 30000 | ||
178 | |||
179 | #if (TIPC_MIN_LINK_TOL < 16) | ||
180 | #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" | ||
181 | #endif | ||
182 | |||
183 | /* | ||
184 | * Link window limits (min, default, max), in packets | ||
185 | */ | ||
186 | |||
187 | #define TIPC_MIN_LINK_WIN 16 | ||
188 | #define TIPC_DEF_LINK_WIN 50 | ||
189 | #define TIPC_MAX_LINK_WIN 150 | ||
190 | |||
191 | |||
192 | struct tipc_node_info { | ||
193 | __be32 addr; /* network address of node */ | ||
194 | __be32 up; /* 0=down, 1= up */ | ||
195 | }; | ||
196 | |||
197 | struct tipc_link_info { | ||
198 | __be32 dest; /* network address of peer node */ | ||
199 | __be32 up; /* 0=down, 1=up */ | ||
200 | char str[TIPC_MAX_LINK_NAME]; /* link name */ | ||
201 | }; | ||
202 | |||
203 | struct tipc_bearer_config { | ||
204 | __be32 priority; /* Range [1,31]. Override per link */ | ||
205 | __be32 disc_domain; /* <Z.C.N> describing desired nodes */ | ||
206 | char name[TIPC_MAX_BEARER_NAME]; | ||
207 | }; | ||
208 | |||
209 | struct tipc_link_config { | ||
210 | __be32 value; | ||
211 | char name[TIPC_MAX_LINK_NAME]; | ||
212 | }; | ||
213 | |||
214 | #define TIPC_NTQ_ALLTYPES 0x80000000 | ||
215 | |||
216 | struct tipc_name_table_query { | ||
217 | __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ | ||
218 | __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ | ||
219 | __be32 lowbound; /* (i.e. displays all entries of name table) */ | ||
220 | __be32 upbound; | ||
221 | }; | ||
222 | |||
223 | /* | ||
224 | * The error string TLV is a null-terminated string describing the cause | ||
225 | * of the request failure. To simplify error processing (and to save space) | ||
226 | * the first character of the string can be a special error code character | ||
227 | * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason. | ||
228 | */ | ||
229 | |||
230 | #define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */ | ||
231 | #define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */ | ||
232 | #define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */ | ||
233 | #define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */ | ||
234 | #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ | ||
235 | #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ | ||
236 | |||
237 | /* | ||
238 | * A TLV consists of a descriptor, followed by the TLV value. | ||
239 | * TLV descriptor fields are stored in network byte order; | ||
240 | * TLV values must also be stored in network byte order (where applicable). | ||
241 | * TLV descriptors must be aligned to addresses which are multiple of 4, | ||
242 | * so up to 3 bytes of padding may exist at the end of the TLV value area. | ||
243 | * There must not be any padding between the TLV descriptor and its value. | ||
244 | */ | ||
245 | |||
246 | struct tlv_desc { | ||
247 | __be16 tlv_len; /* TLV length (descriptor + value) */ | ||
248 | __be16 tlv_type; /* TLV identifier */ | ||
249 | }; | ||
250 | |||
251 | #define TLV_ALIGNTO 4 | ||
252 | |||
253 | #define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1)) | ||
254 | #define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen)) | ||
255 | #define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen))) | ||
256 | #define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0))) | ||
257 | |||
258 | static inline int TLV_OK(const void *tlv, __u16 space) | ||
259 | { | ||
260 | /* | ||
261 | * Would also like to check that "tlv" is a multiple of 4, | ||
262 | * but don't know how to do this in a portable way. | ||
263 | * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler | ||
264 | * won't allow binary "&" with a pointer. | ||
265 | * - Tried casting "tlv" to integer type, but causes warning about size | ||
266 | * mismatch when pointer is bigger than chosen type (int, long, ...). | ||
267 | */ | ||
268 | |||
269 | return (space >= TLV_SPACE(0)) && | ||
270 | (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space); | ||
271 | } | ||
272 | |||
273 | static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type) | ||
274 | { | ||
275 | return TLV_OK(tlv, space) && | ||
276 | (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type); | ||
277 | } | ||
278 | |||
279 | static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) | ||
280 | { | ||
281 | struct tlv_desc *tlv_ptr; | ||
282 | int tlv_len; | ||
283 | |||
284 | tlv_len = TLV_LENGTH(len); | ||
285 | tlv_ptr = (struct tlv_desc *)tlv; | ||
286 | tlv_ptr->tlv_type = htons(type); | ||
287 | tlv_ptr->tlv_len = htons(tlv_len); | ||
288 | if (len && data) | ||
289 | memcpy(TLV_DATA(tlv_ptr), data, tlv_len); | ||
290 | return TLV_SPACE(len); | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * A TLV list descriptor simplifies processing of messages | ||
295 | * containing multiple TLVs. | ||
296 | */ | ||
297 | |||
298 | struct tlv_list_desc { | ||
299 | struct tlv_desc *tlv_ptr; /* ptr to current TLV */ | ||
300 | __u32 tlv_space; /* # bytes from curr TLV to list end */ | ||
301 | }; | ||
302 | |||
303 | static inline void TLV_LIST_INIT(struct tlv_list_desc *list, | ||
304 | void *data, __u32 space) | ||
305 | { | ||
306 | list->tlv_ptr = (struct tlv_desc *)data; | ||
307 | list->tlv_space = space; | ||
308 | } | ||
309 | |||
310 | static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list) | ||
311 | { | ||
312 | return (list->tlv_space == 0); | ||
313 | } | ||
314 | |||
315 | static inline int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type) | ||
316 | { | ||
317 | return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type); | ||
318 | } | ||
319 | |||
320 | static inline void *TLV_LIST_DATA(struct tlv_list_desc *list) | ||
321 | { | ||
322 | return TLV_DATA(list->tlv_ptr); | ||
323 | } | ||
324 | |||
325 | static inline void TLV_LIST_STEP(struct tlv_list_desc *list) | ||
326 | { | ||
327 | __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len)); | ||
328 | |||
329 | list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space); | ||
330 | list->tlv_space -= tlv_space; | ||
331 | } | ||
332 | |||
333 | /* | ||
334 | * Configuration messages exchanged via NETLINK_GENERIC use the following | ||
335 | * family id, name, version and command. | ||
336 | */ | ||
337 | #define TIPC_GENL_NAME "TIPC" | ||
338 | #define TIPC_GENL_VERSION 0x1 | ||
339 | #define TIPC_GENL_CMD 0x1 | ||
340 | |||
341 | /* | ||
342 | * TIPC specific header used in NETLINK_GENERIC requests. | ||
343 | */ | ||
344 | struct tipc_genlmsghdr { | ||
345 | __u32 dest; /* Destination address */ | ||
346 | __u16 cmd; /* Command */ | ||
347 | __u16 reserved; /* Unused */ | ||
348 | }; | ||
349 | |||
350 | #define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr)) | ||
351 | |||
352 | /* | ||
353 | * Configuration messages exchanged via TIPC sockets use the TIPC configuration | ||
354 | * message header, which is defined below. This structure is analogous | ||
355 | * to the Netlink message header, but fields are stored in network byte order | ||
356 | * and no padding is permitted between the header and the message data | ||
357 | * that follows. | ||
358 | */ | ||
359 | |||
360 | struct tipc_cfg_msg_hdr { | ||
361 | __be32 tcm_len; /* Message length (including header) */ | ||
362 | __be16 tcm_type; /* Command type */ | ||
363 | __be16 tcm_flags; /* Additional flags */ | ||
364 | char tcm_reserved[8]; /* Unused */ | ||
365 | }; | ||
366 | |||
367 | #define TCM_F_REQUEST 0x1 /* Flag: Request message */ | ||
368 | #define TCM_F_MORE 0x2 /* Flag: Message to be continued */ | ||
369 | |||
370 | #define TCM_ALIGN(datalen) (((datalen)+3) & ~3) | ||
371 | #define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen) | ||
372 | #define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen))) | ||
373 | #define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0))) | ||
374 | |||
375 | static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags, | ||
376 | void *data, __u16 data_len) | ||
377 | { | ||
378 | struct tipc_cfg_msg_hdr *tcm_hdr; | ||
379 | int msg_len; | ||
380 | |||
381 | msg_len = TCM_LENGTH(data_len); | ||
382 | tcm_hdr = (struct tipc_cfg_msg_hdr *)msg; | ||
383 | tcm_hdr->tcm_len = htonl(msg_len); | ||
384 | tcm_hdr->tcm_type = htons(cmd); | ||
385 | tcm_hdr->tcm_flags = htons(flags); | ||
386 | if (data_len && data) | ||
387 | memcpy(TCM_DATA(msg), data, data_len); | ||
388 | return TCM_SPACE(data_len); | ||
389 | } | ||
390 | |||
391 | #endif | ||
diff --git a/include/linux/tps80031-charger.h b/include/linux/tps80031-charger.h new file mode 100644 index 00000000000..26c228edc30 --- /dev/null +++ b/include/linux/tps80031-charger.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * include/linux/tps80031-charger.h | ||
3 | * | ||
4 | * Battery charger driver interface for TI TPS80031 PMIC | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __LINUX_TPS80031_CHARGER_H | ||
25 | #define __LINUX_TPS80031_CHARGER_H | ||
26 | |||
27 | #include <linux/regulator/machine.h> | ||
28 | |||
29 | enum charging_states { | ||
30 | charging_state_idle, | ||
31 | charging_state_charging_in_progress, | ||
32 | charging_state_charging_completed, | ||
33 | charging_state_charging_stopped, | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * Callback type definition which is called when any state changed in the | ||
38 | * charging. | ||
39 | */ | ||
40 | typedef void (*charging_callback_t)(enum charging_states state, void *args); | ||
41 | |||
42 | struct tps80031_charger_platform_data { | ||
43 | int regulator_id; | ||
44 | int max_charge_volt_mV; | ||
45 | int max_charge_current_mA; | ||
46 | int charging_term_current_mA; | ||
47 | int refresh_time; | ||
48 | int irq_base; | ||
49 | int watch_time_sec; | ||
50 | struct regulator_consumer_supply *consumer_supplies; | ||
51 | int num_consumer_supplies; | ||
52 | int (*board_init)(void *board_data); | ||
53 | void *board_data; | ||
54 | }; | ||
55 | |||
56 | /** | ||
57 | * Register the callback function for the client. This callback gets called | ||
58 | * when there is any change in the chanrging states. | ||
59 | */ | ||
60 | extern int register_charging_state_callback(charging_callback_t cb, void *args); | ||
61 | |||
62 | #endif /*__LINUX_TPS80031_CHARGER_H */ | ||
diff --git a/include/linux/tracedump.h b/include/linux/tracedump.h new file mode 100644 index 00000000000..9e86946e354 --- /dev/null +++ b/include/linux/tracedump.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * include/linux/tracedump.h | ||
3 | * | ||
4 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_KERNEL_TRACEDUMP_H | ||
22 | #define _LINUX_KERNEL_TRACEDUMP_H | ||
23 | |||
24 | /* tracedump | ||
25 | * This module provides additional mechanisms for retreiving tracing data. | ||
26 | * For details on configurations, parameters and usage, see tracedump.txt. | ||
27 | */ | ||
28 | |||
29 | #define TD_NO_PRINT 0 | ||
30 | #define TD_PRINT_CONSOLE 1 | ||
31 | #define TD_PRINT_USER 2 | ||
32 | |||
33 | /* Dump the tracer to console */ | ||
34 | int tracedump_dump(size_t max_out); | ||
35 | |||
36 | /* Dumping functions */ | ||
37 | int tracedump_init(void); | ||
38 | ssize_t tracedump_all(int print_to); | ||
39 | ssize_t tracedump_next(size_t max_out, int print_to); | ||
40 | int tracedump_reset(void); | ||
41 | int tracedump_deinit(void); | ||
42 | |||
43 | #endif /* _LINUX_KERNEL_TRACEDUMP_H */ | ||
diff --git a/include/linux/tracelevel.h b/include/linux/tracelevel.h new file mode 100644 index 00000000000..ac3351c6ed8 --- /dev/null +++ b/include/linux/tracelevel.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * include/linux/tracelevel.c | ||
3 | * | ||
4 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef _TRACELEVEL_H | ||
22 | #define _TRACELEVEL_H | ||
23 | |||
24 | /* tracelevel allows a subsystem author to add priorities to | ||
25 | * trace_events. For usage details, see tracelevel.txt. | ||
26 | */ | ||
27 | |||
28 | #define TRACELEVEL_ERR 3 | ||
29 | #define TRACELEVEL_WARN 2 | ||
30 | #define TRACELEVEL_INFO 1 | ||
31 | #define TRACELEVEL_DEBUG 0 | ||
32 | |||
33 | #define TRACELEVEL_MAX TRACELEVEL_ERR | ||
34 | #define TRACELEVEL_DEFAULT TRACELEVEL_ERR | ||
35 | |||
36 | int __tracelevel_register(char *name, unsigned int level); | ||
37 | int tracelevel_set_level(int level); | ||
38 | |||
39 | #define tracelevel_register(name, level) \ | ||
40 | __tracelevel_register(#name, level) | ||
41 | |||
42 | #endif /* _TRACELEVEL_H */ | ||
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h new file mode 100644 index 00000000000..bfc84a7aecc --- /dev/null +++ b/include/linux/trdevice.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. NET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Definitions for the Token-ring handlers. | ||
7 | * | ||
8 | * Version: @(#)eth.h 1.0.4 05/13/93 | ||
9 | * | ||
10 | * Authors: Ross Biro | ||
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | ||
12 | * | ||
13 | * Relocated to include/linux where it belongs by Alan Cox | ||
14 | * <gw4pts@gw4pts.ampr.org> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or | ||
17 | * modify it under the terms of the GNU General Public License | ||
18 | * as published by the Free Software Foundation; either version | ||
19 | * 2 of the License, or (at your option) any later version. | ||
20 | * | ||
21 | * WARNING: This move may well be temporary. This file will get merged with others RSN. | ||
22 | * | ||
23 | */ | ||
24 | #ifndef _LINUX_TRDEVICE_H | ||
25 | #define _LINUX_TRDEVICE_H | ||
26 | |||
27 | |||
28 | #include <linux/if_tr.h> | ||
29 | |||
30 | #ifdef __KERNEL__ | ||
31 | extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev); | ||
32 | extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); | ||
33 | extern struct net_device *alloc_trdev(int sizeof_priv); | ||
34 | |||
35 | #endif | ||
36 | |||
37 | #endif /* _LINUX_TRDEVICE_H */ | ||
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h new file mode 100644 index 00000000000..3536965913b --- /dev/null +++ b/include/linux/udf_fs_i.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * udf_fs_i.h | ||
3 | * | ||
4 | * This file is intended for the Linux kernel/module. | ||
5 | * | ||
6 | * COPYRIGHT | ||
7 | * This file is distributed under the terms of the GNU General Public | ||
8 | * License (GPL). Copies of the GPL can be obtained from: | ||
9 | * ftp://prep.ai.mit.edu/pub/gnu/GPL | ||
10 | * Each contributing author retains all rights to their own work. | ||
11 | */ | ||
12 | #ifndef _UDF_FS_I_H | ||
13 | #define _UDF_FS_I_H 1 | ||
14 | |||
15 | /* exported IOCTLs, we have 'l', 0x40-0x7f */ | ||
16 | #define UDF_GETEASIZE _IOR('l', 0x40, int) | ||
17 | #define UDF_GETEABLOCK _IOR('l', 0x41, void *) | ||
18 | #define UDF_GETVOLIDENT _IOR('l', 0x42, void *) | ||
19 | #define UDF_RELOCATE_BLOCKS _IOWR('l', 0x43, long) | ||
20 | |||
21 | #endif /* _UDF_FS_I_H */ | ||
diff --git a/include/linux/uid_stat.h b/include/linux/uid_stat.h new file mode 100644 index 00000000000..6bd6c4e52d1 --- /dev/null +++ b/include/linux/uid_stat.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* include/linux/uid_stat.h | ||
2 | * | ||
3 | * Copyright (C) 2008-2009 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef __uid_stat_h | ||
17 | #define __uid_stat_h | ||
18 | |||
19 | /* Contains definitions for resource tracking per uid. */ | ||
20 | |||
21 | #ifdef CONFIG_UID_STAT | ||
22 | int uid_stat_tcp_snd(uid_t uid, int size); | ||
23 | int uid_stat_tcp_rcv(uid_t uid, int size); | ||
24 | #else | ||
25 | #define uid_stat_tcp_snd(uid, size) do {} while (0); | ||
26 | #define uid_stat_tcp_rcv(uid, size) do {} while (0); | ||
27 | #endif | ||
28 | |||
29 | #endif /* _LINUX_UID_STAT_H */ | ||
diff --git a/include/linux/ultrasound.h b/include/linux/ultrasound.h new file mode 100644 index 00000000000..71339dc531c --- /dev/null +++ b/include/linux/ultrasound.h | |||
@@ -0,0 +1,103 @@ | |||
1 | #ifndef _ULTRASOUND_H_ | ||
2 | #define _ULTRASOUND_H_ | ||
3 | /* | ||
4 | * ultrasound.h - Macros for programming the Gravis Ultrasound | ||
5 | * These macros are extremely device dependent | ||
6 | * and not portable. | ||
7 | */ | ||
8 | /* | ||
9 | * Copyright (C) by Hannu Savolainen 1993-1997 | ||
10 | * | ||
11 | * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) | ||
12 | * Version 2 (June 1991). See the "COPYING" file distributed with this software | ||
13 | * for more info. | ||
14 | */ | ||
15 | |||
16 | |||
17 | /* | ||
18 | * Private events for Gravis Ultrasound (GUS) | ||
19 | * | ||
20 | * Format: | ||
21 | * byte 0 - SEQ_PRIVATE (0xfe) | ||
22 | * byte 1 - Synthesizer device number (0-N) | ||
23 | * byte 2 - Command (see below) | ||
24 | * byte 3 - Voice number (0-31) | ||
25 | * bytes 4 and 5 - parameter P1 (unsigned short) | ||
26 | * bytes 6 and 7 - parameter P2 (unsigned short) | ||
27 | * | ||
28 | * Commands: | ||
29 | * Each command affects one voice defined in byte 3. | ||
30 | * Unused parameters (P1 and/or P2 *MUST* be initialized to zero). | ||
31 | * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16) | ||
32 | * _GUS_VOICESAMPLE- ************ OBSOLETE ************* | ||
33 | * _GUS_VOICEON - Starts voice (P1=voice mode) | ||
34 | * _GUS_VOICEOFF - Stops voice (no parameters) | ||
35 | * _GUS_VOICEFADE - Stops the voice smoothly. | ||
36 | * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) | ||
37 | * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7) | ||
38 | * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) | ||
39 | * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) | ||
40 | * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) | ||
41 | * (Like GUS_VOICEVOL but doesn't change the hw | ||
42 | * volume. It just updates volume in the voice table). | ||
43 | * | ||
44 | * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume) | ||
45 | * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate) | ||
46 | * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode) | ||
47 | * _GUS_RAMPON - Starts volume ramping (no parameters) | ||
48 | * _GUS_RAMPOFF - Stops volume ramping (no parameters) | ||
49 | * _GUS_VOLUME_SCALE - Changes the volume calculation constants | ||
50 | * for all voices. | ||
51 | */ | ||
52 | |||
53 | #define _GUS_NUMVOICES 0x00 | ||
54 | #define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */ | ||
55 | #define _GUS_VOICEON 0x02 | ||
56 | #define _GUS_VOICEOFF 0x03 | ||
57 | #define _GUS_VOICEMODE 0x04 | ||
58 | #define _GUS_VOICEBALA 0x05 | ||
59 | #define _GUS_VOICEFREQ 0x06 | ||
60 | #define _GUS_VOICEVOL 0x07 | ||
61 | #define _GUS_RAMPRANGE 0x08 | ||
62 | #define _GUS_RAMPRATE 0x09 | ||
63 | #define _GUS_RAMPMODE 0x0a | ||
64 | #define _GUS_RAMPON 0x0b | ||
65 | #define _GUS_RAMPOFF 0x0c | ||
66 | #define _GUS_VOICEFADE 0x0d | ||
67 | #define _GUS_VOLUME_SCALE 0x0e | ||
68 | #define _GUS_VOICEVOL2 0x0f | ||
69 | #define _GUS_VOICE_POS 0x10 | ||
70 | |||
71 | /* | ||
72 | * GUS API macros | ||
73 | */ | ||
74 | |||
75 | #define _GUS_CMD(chn, voice, cmd, p1, p2) \ | ||
76 | {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\ | ||
77 | _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\ | ||
78 | _seqbuf[_seqbufptr+3] = voice;\ | ||
79 | *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\ | ||
80 | *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\ | ||
81 | _SEQ_ADVBUF(8);} | ||
82 | |||
83 | #define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0) | ||
84 | #define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */ | ||
85 | #define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0) | ||
86 | #define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0) | ||
87 | #define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0) | ||
88 | #define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0) | ||
89 | #define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0) | ||
90 | #define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \ | ||
91 | (p) & 0xffff, ((p) >> 16) & 0xffff) | ||
92 | #define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0) | ||
93 | #define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0) | ||
94 | #define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high)) | ||
95 | #define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2)) | ||
96 | #define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0) | ||
97 | #define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0) | ||
98 | #define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0) | ||
99 | #define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2)) | ||
100 | #define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \ | ||
101 | (p) & 0xffff, ((p) >> 16) & 0xffff) | ||
102 | |||
103 | #endif | ||
diff --git a/include/linux/un.h b/include/linux/un.h new file mode 100644 index 00000000000..45561c564b8 --- /dev/null +++ b/include/linux/un.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _LINUX_UN_H | ||
2 | #define _LINUX_UN_H | ||
3 | |||
4 | #define UNIX_PATH_MAX 108 | ||
5 | |||
6 | struct sockaddr_un { | ||
7 | sa_family_t sun_family; /* AF_UNIX */ | ||
8 | char sun_path[UNIX_PATH_MAX]; /* pathname */ | ||
9 | }; | ||
10 | |||
11 | #endif /* _LINUX_UN_H */ | ||
diff --git a/include/linux/unistd.h b/include/linux/unistd.h new file mode 100644 index 00000000000..aa8d5b5e2e3 --- /dev/null +++ b/include/linux/unistd.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _LINUX_UNISTD_H_ | ||
2 | #define _LINUX_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * Include machine specific syscall numbers | ||
6 | */ | ||
7 | #include <asm/unistd.h> | ||
8 | |||
9 | #endif /* _LINUX_UNISTD_H_ */ | ||
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild new file mode 100644 index 00000000000..ed91fb62674 --- /dev/null +++ b/include/linux/usb/Kbuild | |||
@@ -0,0 +1,9 @@ | |||
1 | header-y += audio.h | ||
2 | header-y += cdc.h | ||
3 | header-y += ch9.h | ||
4 | header-y += ch11.h | ||
5 | header-y += functionfs.h | ||
6 | header-y += gadgetfs.h | ||
7 | header-y += midi.h | ||
8 | header-y += g_printer.h | ||
9 | header-y += tmc.h | ||
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h new file mode 100644 index 00000000000..81a927930bf --- /dev/null +++ b/include/linux/usb/cdc.h | |||
@@ -0,0 +1,412 @@ | |||
1 | /* | ||
2 | * USB Communications Device Class (CDC) definitions | ||
3 | * | ||
4 | * CDC says how to talk to lots of different types of network adapters, | ||
5 | * notably ethernet adapters and various modems. It's used mostly with | ||
6 | * firmware based USB peripherals. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_USB_CDC_H | ||
10 | #define __LINUX_USB_CDC_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | |||
14 | #define USB_CDC_SUBCLASS_ACM 0x02 | ||
15 | #define USB_CDC_SUBCLASS_ETHERNET 0x06 | ||
16 | #define USB_CDC_SUBCLASS_WHCM 0x08 | ||
17 | #define USB_CDC_SUBCLASS_DMM 0x09 | ||
18 | #define USB_CDC_SUBCLASS_MDLM 0x0a | ||
19 | #define USB_CDC_SUBCLASS_OBEX 0x0b | ||
20 | #define USB_CDC_SUBCLASS_EEM 0x0c | ||
21 | #define USB_CDC_SUBCLASS_NCM 0x0d | ||
22 | |||
23 | #define USB_CDC_PROTO_NONE 0 | ||
24 | |||
25 | #define USB_CDC_ACM_PROTO_AT_V25TER 1 | ||
26 | #define USB_CDC_ACM_PROTO_AT_PCCA101 2 | ||
27 | #define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3 | ||
28 | #define USB_CDC_ACM_PROTO_AT_GSM 4 | ||
29 | #define USB_CDC_ACM_PROTO_AT_3G 5 | ||
30 | #define USB_CDC_ACM_PROTO_AT_CDMA 6 | ||
31 | #define USB_CDC_ACM_PROTO_VENDOR 0xff | ||
32 | |||
33 | #define USB_CDC_PROTO_EEM 7 | ||
34 | |||
35 | #define USB_CDC_NCM_PROTO_NTB 1 | ||
36 | |||
37 | /*-------------------------------------------------------------------------*/ | ||
38 | |||
39 | /* | ||
40 | * Class-Specific descriptors ... there are a couple dozen of them | ||
41 | */ | ||
42 | |||
43 | #define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ | ||
44 | #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ | ||
45 | #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ | ||
46 | #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ | ||
47 | #define USB_CDC_COUNTRY_TYPE 0x07 | ||
48 | #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ | ||
49 | #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ | ||
50 | #define USB_CDC_WHCM_TYPE 0x11 | ||
51 | #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ | ||
52 | #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ | ||
53 | #define USB_CDC_DMM_TYPE 0x14 | ||
54 | #define USB_CDC_OBEX_TYPE 0x15 | ||
55 | #define USB_CDC_NCM_TYPE 0x1a | ||
56 | |||
57 | /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ | ||
58 | struct usb_cdc_header_desc { | ||
59 | __u8 bLength; | ||
60 | __u8 bDescriptorType; | ||
61 | __u8 bDescriptorSubType; | ||
62 | |||
63 | __le16 bcdCDC; | ||
64 | } __attribute__ ((packed)); | ||
65 | |||
66 | /* "Call Management Descriptor" from CDC spec 5.2.3.2 */ | ||
67 | struct usb_cdc_call_mgmt_descriptor { | ||
68 | __u8 bLength; | ||
69 | __u8 bDescriptorType; | ||
70 | __u8 bDescriptorSubType; | ||
71 | |||
72 | __u8 bmCapabilities; | ||
73 | #define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01 | ||
74 | #define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02 | ||
75 | |||
76 | __u8 bDataInterface; | ||
77 | } __attribute__ ((packed)); | ||
78 | |||
79 | /* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */ | ||
80 | struct usb_cdc_acm_descriptor { | ||
81 | __u8 bLength; | ||
82 | __u8 bDescriptorType; | ||
83 | __u8 bDescriptorSubType; | ||
84 | |||
85 | __u8 bmCapabilities; | ||
86 | } __attribute__ ((packed)); | ||
87 | |||
88 | /* capabilities from 5.2.3.3 */ | ||
89 | |||
90 | #define USB_CDC_COMM_FEATURE 0x01 | ||
91 | #define USB_CDC_CAP_LINE 0x02 | ||
92 | #define USB_CDC_CAP_BRK 0x04 | ||
93 | #define USB_CDC_CAP_NOTIFY 0x08 | ||
94 | |||
95 | /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ | ||
96 | struct usb_cdc_union_desc { | ||
97 | __u8 bLength; | ||
98 | __u8 bDescriptorType; | ||
99 | __u8 bDescriptorSubType; | ||
100 | |||
101 | __u8 bMasterInterface0; | ||
102 | __u8 bSlaveInterface0; | ||
103 | /* ... and there could be other slave interfaces */ | ||
104 | } __attribute__ ((packed)); | ||
105 | |||
106 | /* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */ | ||
107 | struct usb_cdc_country_functional_desc { | ||
108 | __u8 bLength; | ||
109 | __u8 bDescriptorType; | ||
110 | __u8 bDescriptorSubType; | ||
111 | |||
112 | __u8 iCountryCodeRelDate; | ||
113 | __le16 wCountyCode0; | ||
114 | /* ... and there can be a lot of country codes */ | ||
115 | } __attribute__ ((packed)); | ||
116 | |||
117 | /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ | ||
118 | struct usb_cdc_network_terminal_desc { | ||
119 | __u8 bLength; | ||
120 | __u8 bDescriptorType; | ||
121 | __u8 bDescriptorSubType; | ||
122 | |||
123 | __u8 bEntityId; | ||
124 | __u8 iName; | ||
125 | __u8 bChannelIndex; | ||
126 | __u8 bPhysicalInterface; | ||
127 | } __attribute__ ((packed)); | ||
128 | |||
129 | /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ | ||
130 | struct usb_cdc_ether_desc { | ||
131 | __u8 bLength; | ||
132 | __u8 bDescriptorType; | ||
133 | __u8 bDescriptorSubType; | ||
134 | |||
135 | __u8 iMACAddress; | ||
136 | __le32 bmEthernetStatistics; | ||
137 | __le16 wMaxSegmentSize; | ||
138 | __le16 wNumberMCFilters; | ||
139 | __u8 bNumberPowerFilters; | ||
140 | } __attribute__ ((packed)); | ||
141 | |||
142 | /* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */ | ||
143 | struct usb_cdc_dmm_desc { | ||
144 | __u8 bFunctionLength; | ||
145 | __u8 bDescriptorType; | ||
146 | __u8 bDescriptorSubtype; | ||
147 | __u16 bcdVersion; | ||
148 | __le16 wMaxCommand; | ||
149 | } __attribute__ ((packed)); | ||
150 | |||
151 | /* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ | ||
152 | struct usb_cdc_mdlm_desc { | ||
153 | __u8 bLength; | ||
154 | __u8 bDescriptorType; | ||
155 | __u8 bDescriptorSubType; | ||
156 | |||
157 | __le16 bcdVersion; | ||
158 | __u8 bGUID[16]; | ||
159 | } __attribute__ ((packed)); | ||
160 | |||
161 | /* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */ | ||
162 | struct usb_cdc_mdlm_detail_desc { | ||
163 | __u8 bLength; | ||
164 | __u8 bDescriptorType; | ||
165 | __u8 bDescriptorSubType; | ||
166 | |||
167 | /* type is associated with mdlm_desc.bGUID */ | ||
168 | __u8 bGuidDescriptorType; | ||
169 | __u8 bDetailData[0]; | ||
170 | } __attribute__ ((packed)); | ||
171 | |||
172 | /* "OBEX Control Model Functional Descriptor" */ | ||
173 | struct usb_cdc_obex_desc { | ||
174 | __u8 bLength; | ||
175 | __u8 bDescriptorType; | ||
176 | __u8 bDescriptorSubType; | ||
177 | |||
178 | __le16 bcdVersion; | ||
179 | } __attribute__ ((packed)); | ||
180 | |||
181 | /* "NCM Control Model Functional Descriptor" */ | ||
182 | struct usb_cdc_ncm_desc { | ||
183 | __u8 bLength; | ||
184 | __u8 bDescriptorType; | ||
185 | __u8 bDescriptorSubType; | ||
186 | |||
187 | __le16 bcdNcmVersion; | ||
188 | __u8 bmNetworkCapabilities; | ||
189 | } __attribute__ ((packed)); | ||
190 | /*-------------------------------------------------------------------------*/ | ||
191 | |||
192 | /* | ||
193 | * Class-Specific Control Requests (6.2) | ||
194 | * | ||
195 | * section 3.6.2.1 table 4 has the ACM profile, for modems. | ||
196 | * section 3.8.2 table 10 has the ethernet profile. | ||
197 | * | ||
198 | * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant, | ||
199 | * heavily dependent on the encapsulated (proprietary) command mechanism. | ||
200 | */ | ||
201 | |||
202 | #define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 | ||
203 | #define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 | ||
204 | #define USB_CDC_REQ_SET_LINE_CODING 0x20 | ||
205 | #define USB_CDC_REQ_GET_LINE_CODING 0x21 | ||
206 | #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 | ||
207 | #define USB_CDC_REQ_SEND_BREAK 0x23 | ||
208 | #define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 | ||
209 | #define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 | ||
210 | #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 | ||
211 | #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 | ||
212 | #define USB_CDC_GET_ETHERNET_STATISTIC 0x44 | ||
213 | #define USB_CDC_GET_NTB_PARAMETERS 0x80 | ||
214 | #define USB_CDC_GET_NET_ADDRESS 0x81 | ||
215 | #define USB_CDC_SET_NET_ADDRESS 0x82 | ||
216 | #define USB_CDC_GET_NTB_FORMAT 0x83 | ||
217 | #define USB_CDC_SET_NTB_FORMAT 0x84 | ||
218 | #define USB_CDC_GET_NTB_INPUT_SIZE 0x85 | ||
219 | #define USB_CDC_SET_NTB_INPUT_SIZE 0x86 | ||
220 | #define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87 | ||
221 | #define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88 | ||
222 | #define USB_CDC_GET_CRC_MODE 0x89 | ||
223 | #define USB_CDC_SET_CRC_MODE 0x8a | ||
224 | |||
225 | /* Line Coding Structure from CDC spec 6.2.13 */ | ||
226 | struct usb_cdc_line_coding { | ||
227 | __le32 dwDTERate; | ||
228 | __u8 bCharFormat; | ||
229 | #define USB_CDC_1_STOP_BITS 0 | ||
230 | #define USB_CDC_1_5_STOP_BITS 1 | ||
231 | #define USB_CDC_2_STOP_BITS 2 | ||
232 | |||
233 | __u8 bParityType; | ||
234 | #define USB_CDC_NO_PARITY 0 | ||
235 | #define USB_CDC_ODD_PARITY 1 | ||
236 | #define USB_CDC_EVEN_PARITY 2 | ||
237 | #define USB_CDC_MARK_PARITY 3 | ||
238 | #define USB_CDC_SPACE_PARITY 4 | ||
239 | |||
240 | __u8 bDataBits; | ||
241 | } __attribute__ ((packed)); | ||
242 | |||
243 | /* table 62; bits in multicast filter */ | ||
244 | #define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) | ||
245 | #define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ | ||
246 | #define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) | ||
247 | #define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) | ||
248 | #define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ | ||
249 | |||
250 | |||
251 | /*-------------------------------------------------------------------------*/ | ||
252 | |||
253 | /* | ||
254 | * Class-Specific Notifications (6.3) sent by interrupt transfers | ||
255 | * | ||
256 | * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications | ||
257 | * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS | ||
258 | * RNDIS also defines its own bit-incompatible notifications | ||
259 | */ | ||
260 | |||
261 | #define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00 | ||
262 | #define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01 | ||
263 | #define USB_CDC_NOTIFY_SERIAL_STATE 0x20 | ||
264 | #define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a | ||
265 | |||
266 | struct usb_cdc_notification { | ||
267 | __u8 bmRequestType; | ||
268 | __u8 bNotificationType; | ||
269 | __le16 wValue; | ||
270 | __le16 wIndex; | ||
271 | __le16 wLength; | ||
272 | } __attribute__ ((packed)); | ||
273 | |||
274 | struct usb_cdc_speed_change { | ||
275 | __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */ | ||
276 | __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */ | ||
277 | } __attribute__ ((packed)); | ||
278 | |||
279 | /*-------------------------------------------------------------------------*/ | ||
280 | |||
281 | /* | ||
282 | * Class Specific structures and constants | ||
283 | * | ||
284 | * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1 | ||
285 | * | ||
286 | */ | ||
287 | |||
288 | struct usb_cdc_ncm_ntb_parameters { | ||
289 | __le16 wLength; | ||
290 | __le16 bmNtbFormatsSupported; | ||
291 | __le32 dwNtbInMaxSize; | ||
292 | __le16 wNdpInDivisor; | ||
293 | __le16 wNdpInPayloadRemainder; | ||
294 | __le16 wNdpInAlignment; | ||
295 | __le16 wPadding1; | ||
296 | __le32 dwNtbOutMaxSize; | ||
297 | __le16 wNdpOutDivisor; | ||
298 | __le16 wNdpOutPayloadRemainder; | ||
299 | __le16 wNdpOutAlignment; | ||
300 | __le16 wNtbOutMaxDatagrams; | ||
301 | } __attribute__ ((packed)); | ||
302 | |||
303 | /* | ||
304 | * CDC NCM transfer headers, CDC NCM subclass 3.2 | ||
305 | */ | ||
306 | |||
307 | #define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */ | ||
308 | #define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */ | ||
309 | |||
310 | struct usb_cdc_ncm_nth16 { | ||
311 | __le32 dwSignature; | ||
312 | __le16 wHeaderLength; | ||
313 | __le16 wSequence; | ||
314 | __le16 wBlockLength; | ||
315 | __le16 wNdpIndex; | ||
316 | } __attribute__ ((packed)); | ||
317 | |||
318 | struct usb_cdc_ncm_nth32 { | ||
319 | __le32 dwSignature; | ||
320 | __le16 wHeaderLength; | ||
321 | __le16 wSequence; | ||
322 | __le32 dwBlockLength; | ||
323 | __le32 dwNdpIndex; | ||
324 | } __attribute__ ((packed)); | ||
325 | |||
326 | /* | ||
327 | * CDC NCM datagram pointers, CDC NCM subclass 3.3 | ||
328 | */ | ||
329 | |||
330 | #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ | ||
331 | #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ | ||
332 | #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ | ||
333 | #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ | ||
334 | |||
335 | /* 16-bit NCM Datagram Pointer Entry */ | ||
336 | struct usb_cdc_ncm_dpe16 { | ||
337 | __le16 wDatagramIndex; | ||
338 | __le16 wDatagramLength; | ||
339 | } __attribute__((__packed__)); | ||
340 | |||
341 | /* 16-bit NCM Datagram Pointer Table */ | ||
342 | struct usb_cdc_ncm_ndp16 { | ||
343 | __le32 dwSignature; | ||
344 | __le16 wLength; | ||
345 | __le16 wNextNdpIndex; | ||
346 | struct usb_cdc_ncm_dpe16 dpe16[0]; | ||
347 | } __attribute__ ((packed)); | ||
348 | |||
349 | /* 32-bit NCM Datagram Pointer Entry */ | ||
350 | struct usb_cdc_ncm_dpe32 { | ||
351 | __le32 dwDatagramIndex; | ||
352 | __le32 dwDatagramLength; | ||
353 | } __attribute__((__packed__)); | ||
354 | |||
355 | /* 32-bit NCM Datagram Pointer Table */ | ||
356 | struct usb_cdc_ncm_ndp32 { | ||
357 | __le32 dwSignature; | ||
358 | __le16 wLength; | ||
359 | __le16 wReserved6; | ||
360 | __le32 dwNextNdpIndex; | ||
361 | __le32 dwReserved12; | ||
362 | struct usb_cdc_ncm_dpe32 dpe32[0]; | ||
363 | } __attribute__ ((packed)); | ||
364 | |||
365 | /* CDC NCM subclass 3.2.1 and 3.2.2 */ | ||
366 | #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C | ||
367 | #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010 | ||
368 | |||
369 | /* CDC NCM subclass 3.3.3 Datagram Formatting */ | ||
370 | #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30 | ||
371 | #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31 | ||
372 | |||
373 | /* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */ | ||
374 | #define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00 | ||
375 | #define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE | ||
376 | |||
377 | /* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */ | ||
378 | #define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0) | ||
379 | #define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1) | ||
380 | #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) | ||
381 | #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) | ||
382 | #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) | ||
383 | #define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5) | ||
384 | |||
385 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | ||
386 | #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) | ||
387 | #define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1) | ||
388 | |||
389 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | ||
390 | #define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04 | ||
391 | #define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C | ||
392 | |||
393 | /* CDC NCM subclass 6.2.5 SetNtbFormat */ | ||
394 | #define USB_CDC_NCM_NTB16_FORMAT 0x00 | ||
395 | #define USB_CDC_NCM_NTB32_FORMAT 0x01 | ||
396 | |||
397 | /* CDC NCM subclass 6.2.7 SetNtbInputSize */ | ||
398 | #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 | ||
399 | #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 | ||
400 | |||
401 | /* NTB Input Size Structure */ | ||
402 | struct usb_cdc_ncm_ndp_input_size { | ||
403 | __le32 dwNtbInMaxSize; | ||
404 | __le16 wNtbInMaxDatagrams; | ||
405 | __le16 wReserved; | ||
406 | } __attribute__ ((packed)); | ||
407 | |||
408 | /* CDC NCM subclass 6.2.11 SetCrcMode */ | ||
409 | #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 | ||
410 | #define USB_CDC_NCM_CRC_APPENDED 0x01 | ||
411 | |||
412 | #endif /* __LINUX_USB_CDC_H */ | ||
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h new file mode 100644 index 00000000000..4ebaf082417 --- /dev/null +++ b/include/linux/usb/ch11.h | |||
@@ -0,0 +1,246 @@ | |||
1 | /* | ||
2 | * This file holds Hub protocol constants and data structures that are | ||
3 | * defined in chapter 11 (Hub Specification) of the USB 2.0 specification. | ||
4 | * | ||
5 | * It is used/shared between the USB core, the HCDs and couple of other USB | ||
6 | * drivers. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_CH11_H | ||
10 | #define __LINUX_CH11_H | ||
11 | |||
12 | #include <linux/types.h> /* __u8 etc */ | ||
13 | |||
14 | /* | ||
15 | * Hub request types | ||
16 | */ | ||
17 | |||
18 | #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) | ||
19 | #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) | ||
20 | |||
21 | /* | ||
22 | * Hub class requests | ||
23 | * See USB 2.0 spec Table 11-16 | ||
24 | */ | ||
25 | #define HUB_CLEAR_TT_BUFFER 8 | ||
26 | #define HUB_RESET_TT 9 | ||
27 | #define HUB_GET_TT_STATE 10 | ||
28 | #define HUB_STOP_TT 11 | ||
29 | #define HUB_SET_DEPTH 12 | ||
30 | |||
31 | /* | ||
32 | * Hub class additional requests defined by USB 3.0 spec | ||
33 | * See USB 3.0 spec Table 10-6 | ||
34 | */ | ||
35 | #define HUB_SET_DEPTH 12 | ||
36 | #define HUB_GET_PORT_ERR_COUNT 13 | ||
37 | |||
38 | /* | ||
39 | * Hub Class feature numbers | ||
40 | * See USB 2.0 spec Table 11-17 | ||
41 | */ | ||
42 | #define C_HUB_LOCAL_POWER 0 | ||
43 | #define C_HUB_OVER_CURRENT 1 | ||
44 | |||
45 | /* | ||
46 | * Port feature numbers | ||
47 | * See USB 2.0 spec Table 11-17 | ||
48 | */ | ||
49 | #define USB_PORT_FEAT_CONNECTION 0 | ||
50 | #define USB_PORT_FEAT_ENABLE 1 | ||
51 | #define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */ | ||
52 | #define USB_PORT_FEAT_OVER_CURRENT 3 | ||
53 | #define USB_PORT_FEAT_RESET 4 | ||
54 | #define USB_PORT_FEAT_L1 5 /* L1 suspend */ | ||
55 | #define USB_PORT_FEAT_POWER 8 | ||
56 | #define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */ | ||
57 | #define USB_PORT_FEAT_C_CONNECTION 16 | ||
58 | #define USB_PORT_FEAT_C_ENABLE 17 | ||
59 | #define USB_PORT_FEAT_C_SUSPEND 18 | ||
60 | #define USB_PORT_FEAT_C_OVER_CURRENT 19 | ||
61 | #define USB_PORT_FEAT_C_RESET 20 | ||
62 | #define USB_PORT_FEAT_TEST 21 | ||
63 | #define USB_PORT_FEAT_INDICATOR 22 | ||
64 | #define USB_PORT_FEAT_C_PORT_L1 23 | ||
65 | #define USB_PORT_FEAT_C_PORT_LINK_STATE 25 | ||
66 | #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26 | ||
67 | #define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27 | ||
68 | #define USB_PORT_FEAT_BH_PORT_RESET 28 | ||
69 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 | ||
70 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 | ||
71 | |||
72 | /* | ||
73 | * Port feature selectors added by USB 3.0 spec. | ||
74 | * See USB 3.0 spec Table 10-7 | ||
75 | */ | ||
76 | #define USB_PORT_FEAT_LINK_STATE 5 | ||
77 | #define USB_PORT_FEAT_U1_TIMEOUT 23 | ||
78 | #define USB_PORT_FEAT_U2_TIMEOUT 24 | ||
79 | #define USB_PORT_FEAT_C_LINK_STATE 25 | ||
80 | #define USB_PORT_FEAT_C_CONFIG_ERR 26 | ||
81 | #define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 | ||
82 | #define USB_PORT_FEAT_BH_PORT_RESET 28 | ||
83 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 | ||
84 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 | ||
85 | |||
86 | /* | ||
87 | * Hub Status and Hub Change results | ||
88 | * See USB 2.0 spec Table 11-19 and Table 11-20 | ||
89 | */ | ||
90 | struct usb_port_status { | ||
91 | __le16 wPortStatus; | ||
92 | __le16 wPortChange; | ||
93 | } __attribute__ ((packed)); | ||
94 | |||
95 | /* | ||
96 | * wPortStatus bit field | ||
97 | * See USB 2.0 spec Table 11-21 | ||
98 | */ | ||
99 | #define USB_PORT_STAT_CONNECTION 0x0001 | ||
100 | #define USB_PORT_STAT_ENABLE 0x0002 | ||
101 | #define USB_PORT_STAT_SUSPEND 0x0004 | ||
102 | #define USB_PORT_STAT_OVERCURRENT 0x0008 | ||
103 | #define USB_PORT_STAT_RESET 0x0010 | ||
104 | #define USB_PORT_STAT_L1 0x0020 | ||
105 | /* bits 6 to 7 are reserved */ | ||
106 | #define USB_PORT_STAT_POWER 0x0100 | ||
107 | #define USB_PORT_STAT_LOW_SPEED 0x0200 | ||
108 | #define USB_PORT_STAT_HIGH_SPEED 0x0400 | ||
109 | #define USB_PORT_STAT_TEST 0x0800 | ||
110 | #define USB_PORT_STAT_INDICATOR 0x1000 | ||
111 | /* bits 13 to 15 are reserved */ | ||
112 | |||
113 | /* | ||
114 | * Additions to wPortStatus bit field from USB 3.0 | ||
115 | * See USB 3.0 spec Table 10-10 | ||
116 | */ | ||
117 | #define USB_PORT_STAT_LINK_STATE 0x01e0 | ||
118 | #define USB_SS_PORT_STAT_POWER 0x0200 | ||
119 | #define USB_SS_PORT_STAT_SPEED 0x1c00 | ||
120 | #define USB_PORT_STAT_SPEED_5GBPS 0x0000 | ||
121 | /* Valid only if port is enabled */ | ||
122 | /* Bits that are the same from USB 2.0 */ | ||
123 | #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \ | ||
124 | USB_PORT_STAT_ENABLE | \ | ||
125 | USB_PORT_STAT_OVERCURRENT | \ | ||
126 | USB_PORT_STAT_RESET) | ||
127 | |||
128 | /* | ||
129 | * Definitions for PORT_LINK_STATE values | ||
130 | * (bits 5-8) in wPortStatus | ||
131 | */ | ||
132 | #define USB_SS_PORT_LS_U0 0x0000 | ||
133 | #define USB_SS_PORT_LS_U1 0x0020 | ||
134 | #define USB_SS_PORT_LS_U2 0x0040 | ||
135 | #define USB_SS_PORT_LS_U3 0x0060 | ||
136 | #define USB_SS_PORT_LS_SS_DISABLED 0x0080 | ||
137 | #define USB_SS_PORT_LS_RX_DETECT 0x00a0 | ||
138 | #define USB_SS_PORT_LS_SS_INACTIVE 0x00c0 | ||
139 | #define USB_SS_PORT_LS_POLLING 0x00e0 | ||
140 | #define USB_SS_PORT_LS_RECOVERY 0x0100 | ||
141 | #define USB_SS_PORT_LS_HOT_RESET 0x0120 | ||
142 | #define USB_SS_PORT_LS_COMP_MOD 0x0140 | ||
143 | #define USB_SS_PORT_LS_LOOPBACK 0x0160 | ||
144 | |||
145 | /* | ||
146 | * wPortChange bit field | ||
147 | * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10 | ||
148 | * Bits 0 to 5 shown, bits 6 to 15 are reserved | ||
149 | */ | ||
150 | #define USB_PORT_STAT_C_CONNECTION 0x0001 | ||
151 | #define USB_PORT_STAT_C_ENABLE 0x0002 | ||
152 | #define USB_PORT_STAT_C_SUSPEND 0x0004 | ||
153 | #define USB_PORT_STAT_C_OVERCURRENT 0x0008 | ||
154 | #define USB_PORT_STAT_C_RESET 0x0010 | ||
155 | #define USB_PORT_STAT_C_L1 0x0020 | ||
156 | /* | ||
157 | * USB 3.0 wPortChange bit fields | ||
158 | * See USB 3.0 spec Table 10-11 | ||
159 | */ | ||
160 | #define USB_PORT_STAT_C_BH_RESET 0x0020 | ||
161 | #define USB_PORT_STAT_C_LINK_STATE 0x0040 | ||
162 | #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 | ||
163 | |||
164 | /* | ||
165 | * wHubCharacteristics (masks) | ||
166 | * See USB 2.0 spec Table 11-13, offset 3 | ||
167 | */ | ||
168 | #define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ | ||
169 | #define HUB_CHAR_COMPOUND 0x0004 /* D2 */ | ||
170 | #define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ | ||
171 | #define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ | ||
172 | #define HUB_CHAR_PORTIND 0x0080 /* D7 */ | ||
173 | |||
174 | struct usb_hub_status { | ||
175 | __le16 wHubStatus; | ||
176 | __le16 wHubChange; | ||
177 | } __attribute__ ((packed)); | ||
178 | |||
179 | /* | ||
180 | * Hub Status & Hub Change bit masks | ||
181 | * See USB 2.0 spec Table 11-19 and Table 11-20 | ||
182 | * Bits 0 and 1 for wHubStatus and wHubChange | ||
183 | * Bits 2 to 15 are reserved for both | ||
184 | */ | ||
185 | #define HUB_STATUS_LOCAL_POWER 0x0001 | ||
186 | #define HUB_STATUS_OVERCURRENT 0x0002 | ||
187 | #define HUB_CHANGE_LOCAL_POWER 0x0001 | ||
188 | #define HUB_CHANGE_OVERCURRENT 0x0002 | ||
189 | |||
190 | |||
191 | /* | ||
192 | * Hub descriptor | ||
193 | * See USB 2.0 spec Table 11-13 | ||
194 | */ | ||
195 | |||
196 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) | ||
197 | #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a) | ||
198 | #define USB_DT_HUB_NONVAR_SIZE 7 | ||
199 | #define USB_DT_SS_HUB_SIZE 12 | ||
200 | |||
201 | struct usb_hub_descriptor { | ||
202 | __u8 bDescLength; | ||
203 | __u8 bDescriptorType; | ||
204 | __u8 bNbrPorts; | ||
205 | __le16 wHubCharacteristics; | ||
206 | __u8 bPwrOn2PwrGood; | ||
207 | __u8 bHubContrCurrent; | ||
208 | |||
209 | /* 2.0 and 3.0 hubs differ here */ | ||
210 | union { | ||
211 | struct { | ||
212 | /* add 1 bit for hub status change; round to bytes */ | ||
213 | __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
214 | __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
215 | } __attribute__ ((packed)) hs; | ||
216 | |||
217 | struct { | ||
218 | __u8 bHubHdrDecLat; | ||
219 | __u16 wHubDelay; | ||
220 | __u16 DeviceRemovable; | ||
221 | } __attribute__ ((packed)) ss; | ||
222 | } u; | ||
223 | } __attribute__ ((packed)); | ||
224 | |||
225 | /* port indicator status selectors, tables 11-7 and 11-25 */ | ||
226 | #define HUB_LED_AUTO 0 | ||
227 | #define HUB_LED_AMBER 1 | ||
228 | #define HUB_LED_GREEN 2 | ||
229 | #define HUB_LED_OFF 3 | ||
230 | |||
231 | enum hub_led_mode { | ||
232 | INDICATOR_AUTO = 0, | ||
233 | INDICATOR_CYCLE, | ||
234 | /* software blinks for attention: software, hardware, reserved */ | ||
235 | INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF, | ||
236 | INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF, | ||
237 | INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF | ||
238 | } __attribute__ ((packed)); | ||
239 | |||
240 | /* Transaction Translator Think Times, in bits */ | ||
241 | #define HUB_TTTT_8_BITS 0x00 | ||
242 | #define HUB_TTTT_16_BITS 0x20 | ||
243 | #define HUB_TTTT_24_BITS 0x40 | ||
244 | #define HUB_TTTT_32_BITS 0x60 | ||
245 | |||
246 | #endif /* __LINUX_CH11_H */ | ||
diff --git a/include/linux/usb/f_accessory.h b/include/linux/usb/f_accessory.h new file mode 100644 index 00000000000..5b2dcf9728e --- /dev/null +++ b/include/linux/usb/f_accessory.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Gadget Function Driver for Android USB accessories | ||
3 | * | ||
4 | * Copyright (C) 2011 Google, Inc. | ||
5 | * Author: Mike Lockwood <lockwood@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_F_ACCESSORY_H | ||
19 | #define __LINUX_USB_F_ACCESSORY_H | ||
20 | |||
21 | /* Use Google Vendor ID when in accessory mode */ | ||
22 | #define USB_ACCESSORY_VENDOR_ID 0x18D1 | ||
23 | |||
24 | |||
25 | /* Product ID to use when in accessory mode */ | ||
26 | #define USB_ACCESSORY_PRODUCT_ID 0x2D00 | ||
27 | |||
28 | /* Product ID to use when in accessory mode and adb is enabled */ | ||
29 | #define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01 | ||
30 | |||
31 | /* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */ | ||
32 | #define ACCESSORY_STRING_MANUFACTURER 0 | ||
33 | #define ACCESSORY_STRING_MODEL 1 | ||
34 | #define ACCESSORY_STRING_DESCRIPTION 2 | ||
35 | #define ACCESSORY_STRING_VERSION 3 | ||
36 | #define ACCESSORY_STRING_URI 4 | ||
37 | #define ACCESSORY_STRING_SERIAL 5 | ||
38 | |||
39 | /* Control request for retrieving device's protocol version (currently 1) | ||
40 | * | ||
41 | * requestType: USB_DIR_IN | USB_TYPE_VENDOR | ||
42 | * request: ACCESSORY_GET_PROTOCOL | ||
43 | * value: 0 | ||
44 | * index: 0 | ||
45 | * data version number (16 bits little endian) | ||
46 | */ | ||
47 | #define ACCESSORY_GET_PROTOCOL 51 | ||
48 | |||
49 | /* Control request for host to send a string to the device | ||
50 | * | ||
51 | * requestType: USB_DIR_OUT | USB_TYPE_VENDOR | ||
52 | * request: ACCESSORY_SEND_STRING | ||
53 | * value: 0 | ||
54 | * index: string ID | ||
55 | * data zero terminated UTF8 string | ||
56 | * | ||
57 | * The device can later retrieve these strings via the | ||
58 | * ACCESSORY_GET_STRING_* ioctls | ||
59 | */ | ||
60 | #define ACCESSORY_SEND_STRING 52 | ||
61 | |||
62 | /* Control request for starting device in accessory mode. | ||
63 | * The host sends this after setting all its strings to the device. | ||
64 | * | ||
65 | * requestType: USB_DIR_OUT | USB_TYPE_VENDOR | ||
66 | * request: ACCESSORY_START | ||
67 | * value: 0 | ||
68 | * index: 0 | ||
69 | * data none | ||
70 | */ | ||
71 | #define ACCESSORY_START 53 | ||
72 | |||
73 | /* ioctls for retrieving strings set by the host */ | ||
74 | #define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256]) | ||
75 | #define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256]) | ||
76 | #define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256]) | ||
77 | #define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256]) | ||
78 | #define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256]) | ||
79 | #define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256]) | ||
80 | /* returns 1 if there is a start request pending */ | ||
81 | #define ACCESSORY_IS_START_REQUESTED _IO('M', 7) | ||
82 | |||
83 | #endif /* __LINUX_USB_F_ACCESSORY_H */ | ||
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h new file mode 100644 index 00000000000..7422b17c6eb --- /dev/null +++ b/include/linux/usb/f_mtp.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Gadget Function Driver for MTP | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * Author: Mike Lockwood <lockwood@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_F_MTP_H | ||
19 | #define __LINUX_USB_F_MTP_H | ||
20 | |||
21 | #include <linux/ioctl.h> | ||
22 | |||
23 | #ifdef __KERNEL__ | ||
24 | |||
25 | struct mtp_data_header { | ||
26 | /* length of packet, including this header */ | ||
27 | uint32_t length; | ||
28 | /* container type (2 for data packet) */ | ||
29 | uint16_t type; | ||
30 | /* MTP command code */ | ||
31 | uint16_t command; | ||
32 | /* MTP transaction ID */ | ||
33 | uint32_t transaction_id; | ||
34 | }; | ||
35 | |||
36 | #endif /* __KERNEL__ */ | ||
37 | |||
38 | struct mtp_file_range { | ||
39 | /* file descriptor for file to transfer */ | ||
40 | int fd; | ||
41 | /* offset in file for start of transfer */ | ||
42 | loff_t offset; | ||
43 | /* number of bytes to transfer */ | ||
44 | int64_t length; | ||
45 | /* MTP command ID for data header, | ||
46 | * used only for MTP_SEND_FILE_WITH_HEADER | ||
47 | */ | ||
48 | uint16_t command; | ||
49 | /* MTP transaction ID for data header, | ||
50 | * used only for MTP_SEND_FILE_WITH_HEADER | ||
51 | */ | ||
52 | uint32_t transaction_id; | ||
53 | }; | ||
54 | |||
55 | struct mtp_event { | ||
56 | /* size of the event */ | ||
57 | size_t length; | ||
58 | /* event data to send */ | ||
59 | void *data; | ||
60 | }; | ||
61 | |||
62 | /* Sends the specified file range to the host */ | ||
63 | #define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range) | ||
64 | /* Receives data from the host and writes it to a file. | ||
65 | * The file is created if it does not exist. | ||
66 | */ | ||
67 | #define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range) | ||
68 | /* Sends an event to the host via the interrupt endpoint */ | ||
69 | #define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event) | ||
70 | /* Sends the specified file range to the host, | ||
71 | * with a 12 byte MTP data packet header at the beginning. | ||
72 | */ | ||
73 | #define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range) | ||
74 | |||
75 | #endif /* __LINUX_USB_F_MTP_H */ | ||
diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h new file mode 100644 index 00000000000..6178fde50f7 --- /dev/null +++ b/include/linux/usb/g_printer.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * g_printer.h -- Header file for USB Printer gadget driver | ||
3 | * | ||
4 | * Copyright (C) 2007 Craig W. Nadler | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_USB_G_PRINTER_H | ||
22 | #define __LINUX_USB_G_PRINTER_H | ||
23 | |||
24 | #define PRINTER_NOT_ERROR 0x08 | ||
25 | #define PRINTER_SELECTED 0x10 | ||
26 | #define PRINTER_PAPER_EMPTY 0x20 | ||
27 | |||
28 | /* The 'g' code is also used by gadgetfs ioctl requests. | ||
29 | * Don't add any colliding codes to either driver, and keep | ||
30 | * them in unique ranges (size 0x20 for now). | ||
31 | */ | ||
32 | #define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) | ||
33 | #define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) | ||
34 | |||
35 | #endif /* __LINUX_USB_G_PRINTER_H */ | ||
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h new file mode 100644 index 00000000000..0bb12e0d4f8 --- /dev/null +++ b/include/linux/usb/gadgetfs.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Filesystem based user-mode API to USB Gadget controller hardware | ||
3 | * | ||
4 | * Other than ep0 operations, most things are done by read() and write() | ||
5 | * on endpoint files found in one directory. They are configured by | ||
6 | * writing descriptors, and then may be used for normal stream style | ||
7 | * i/o requests. When ep0 is configured, the device can enumerate; | ||
8 | * when it's closed, the device disconnects from usb. Operations on | ||
9 | * ep0 require ioctl() operations. | ||
10 | * | ||
11 | * Configuration and device descriptors get written to /dev/gadget/$CHIP, | ||
12 | * which may then be used to read usb_gadgetfs_event structs. The driver | ||
13 | * may activate endpoints as it handles SET_CONFIGURATION setup events, | ||
14 | * or earlier; writing endpoint descriptors to /dev/gadget/$ENDPOINT | ||
15 | * then performing data transfers by reading or writing. | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_GADGETFS_H | ||
19 | #define __LINUX_USB_GADGETFS_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <linux/ioctl.h> | ||
23 | |||
24 | #include <linux/usb/ch9.h> | ||
25 | |||
26 | /* | ||
27 | * Events are delivered on the ep0 file descriptor, when the user mode driver | ||
28 | * reads from this file descriptor after writing the descriptors. Don't | ||
29 | * stop polling this descriptor. | ||
30 | */ | ||
31 | |||
32 | enum usb_gadgetfs_event_type { | ||
33 | GADGETFS_NOP = 0, | ||
34 | |||
35 | GADGETFS_CONNECT, | ||
36 | GADGETFS_DISCONNECT, | ||
37 | GADGETFS_SETUP, | ||
38 | GADGETFS_SUSPEND, | ||
39 | /* and likely more ! */ | ||
40 | }; | ||
41 | |||
42 | /* NOTE: this structure must stay the same size and layout on | ||
43 | * both 32-bit and 64-bit kernels. | ||
44 | */ | ||
45 | struct usb_gadgetfs_event { | ||
46 | union { | ||
47 | /* NOP, DISCONNECT, SUSPEND: nothing | ||
48 | * ... some hardware can't report disconnection | ||
49 | */ | ||
50 | |||
51 | /* CONNECT: just the speed */ | ||
52 | enum usb_device_speed speed; | ||
53 | |||
54 | /* SETUP: packet; DATA phase i/o precedes next event | ||
55 | *(setup.bmRequestType & USB_DIR_IN) flags direction | ||
56 | * ... includes SET_CONFIGURATION, SET_INTERFACE | ||
57 | */ | ||
58 | struct usb_ctrlrequest setup; | ||
59 | } u; | ||
60 | enum usb_gadgetfs_event_type type; | ||
61 | }; | ||
62 | |||
63 | |||
64 | /* The 'g' code is also used by printer gadget ioctl requests. | ||
65 | * Don't add any colliding codes to either driver, and keep | ||
66 | * them in unique ranges (size 0x20 for now). | ||
67 | */ | ||
68 | |||
69 | /* endpoint ioctls */ | ||
70 | |||
71 | /* IN transfers may be reported to the gadget driver as complete | ||
72 | * when the fifo is loaded, before the host reads the data; | ||
73 | * OUT transfers may be reported to the host's "client" driver as | ||
74 | * complete when they're sitting in the FIFO unread. | ||
75 | * THIS returns how many bytes are "unclaimed" in the endpoint fifo | ||
76 | * (needed for precise fault handling, when the hardware allows it) | ||
77 | */ | ||
78 | #define GADGETFS_FIFO_STATUS _IO('g', 1) | ||
79 | |||
80 | /* discards any unclaimed data in the fifo. */ | ||
81 | #define GADGETFS_FIFO_FLUSH _IO('g', 2) | ||
82 | |||
83 | /* resets endpoint halt+toggle; used to implement set_interface. | ||
84 | * some hardware (like pxa2xx) can't support this. | ||
85 | */ | ||
86 | #define GADGETFS_CLEAR_HALT _IO('g', 3) | ||
87 | |||
88 | #endif /* __LINUX_USB_GADGETFS_H */ | ||
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h new file mode 100644 index 00000000000..51f17b16d31 --- /dev/null +++ b/include/linux/usb/langwell_otg.h | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB OTG transceiver driver | ||
3 | * Copyright (C) 2008 - 2010, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef __LANGWELL_OTG_H | ||
21 | #define __LANGWELL_OTG_H | ||
22 | |||
23 | #include <linux/usb/intel_mid_otg.h> | ||
24 | |||
25 | #define CI_USBCMD 0x30 | ||
26 | # define USBCMD_RST BIT(1) | ||
27 | # define USBCMD_RS BIT(0) | ||
28 | #define CI_USBSTS 0x34 | ||
29 | # define USBSTS_SLI BIT(8) | ||
30 | # define USBSTS_URI BIT(6) | ||
31 | # define USBSTS_PCI BIT(2) | ||
32 | #define CI_PORTSC1 0x74 | ||
33 | # define PORTSC_PP BIT(12) | ||
34 | # define PORTSC_LS (BIT(11) | BIT(10)) | ||
35 | # define PORTSC_SUSP BIT(7) | ||
36 | # define PORTSC_CCS BIT(0) | ||
37 | #define CI_HOSTPC1 0xb4 | ||
38 | # define HOSTPC1_PHCD BIT(22) | ||
39 | #define CI_OTGSC 0xf4 | ||
40 | # define OTGSC_DPIE BIT(30) | ||
41 | # define OTGSC_1MSE BIT(29) | ||
42 | # define OTGSC_BSEIE BIT(28) | ||
43 | # define OTGSC_BSVIE BIT(27) | ||
44 | # define OTGSC_ASVIE BIT(26) | ||
45 | # define OTGSC_AVVIE BIT(25) | ||
46 | # define OTGSC_IDIE BIT(24) | ||
47 | # define OTGSC_DPIS BIT(22) | ||
48 | # define OTGSC_1MSS BIT(21) | ||
49 | # define OTGSC_BSEIS BIT(20) | ||
50 | # define OTGSC_BSVIS BIT(19) | ||
51 | # define OTGSC_ASVIS BIT(18) | ||
52 | # define OTGSC_AVVIS BIT(17) | ||
53 | # define OTGSC_IDIS BIT(16) | ||
54 | # define OTGSC_DPS BIT(14) | ||
55 | # define OTGSC_1MST BIT(13) | ||
56 | # define OTGSC_BSE BIT(12) | ||
57 | # define OTGSC_BSV BIT(11) | ||
58 | # define OTGSC_ASV BIT(10) | ||
59 | # define OTGSC_AVV BIT(9) | ||
60 | # define OTGSC_ID BIT(8) | ||
61 | # define OTGSC_HABA BIT(7) | ||
62 | # define OTGSC_HADP BIT(6) | ||
63 | # define OTGSC_IDPU BIT(5) | ||
64 | # define OTGSC_DP BIT(4) | ||
65 | # define OTGSC_OT BIT(3) | ||
66 | # define OTGSC_HAAR BIT(2) | ||
67 | # define OTGSC_VC BIT(1) | ||
68 | # define OTGSC_VD BIT(0) | ||
69 | # define OTGSC_INTEN_MASK (0x7f << 24) | ||
70 | # define OTGSC_INT_MASK (0x5f << 24) | ||
71 | # define OTGSC_INTSTS_MASK (0x7f << 16) | ||
72 | #define CI_USBMODE 0xf8 | ||
73 | # define USBMODE_CM (BIT(1) | BIT(0)) | ||
74 | # define USBMODE_IDLE 0 | ||
75 | # define USBMODE_DEVICE 0x2 | ||
76 | # define USBMODE_HOST 0x3 | ||
77 | #define USBCFG_ADDR 0xff10801c | ||
78 | #define USBCFG_LEN 4 | ||
79 | # define USBCFG_VBUSVAL BIT(14) | ||
80 | # define USBCFG_AVALID BIT(13) | ||
81 | # define USBCFG_BVALID BIT(12) | ||
82 | # define USBCFG_SESEND BIT(11) | ||
83 | |||
84 | #define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI) | ||
85 | |||
86 | enum langwell_otg_timer_type { | ||
87 | TA_WAIT_VRISE_TMR, | ||
88 | TA_WAIT_BCON_TMR, | ||
89 | TA_AIDL_BDIS_TMR, | ||
90 | TB_ASE0_BRST_TMR, | ||
91 | TB_SE0_SRP_TMR, | ||
92 | TB_SRP_INIT_TMR, | ||
93 | TB_SRP_FAIL_TMR, | ||
94 | TB_BUS_SUSPEND_TMR | ||
95 | }; | ||
96 | |||
97 | #define TA_WAIT_VRISE 100 | ||
98 | #define TA_WAIT_BCON 30000 | ||
99 | #define TA_AIDL_BDIS 15000 | ||
100 | #define TB_ASE0_BRST 5000 | ||
101 | #define TB_SE0_SRP 2 | ||
102 | #define TB_SRP_INIT 100 | ||
103 | #define TB_SRP_FAIL 5500 | ||
104 | #define TB_BUS_SUSPEND 500 | ||
105 | |||
106 | struct langwell_otg_timer { | ||
107 | unsigned long expires; /* Number of count increase to timeout */ | ||
108 | unsigned long count; /* Tick counter */ | ||
109 | void (*function)(unsigned long); /* Timeout function */ | ||
110 | unsigned long data; /* Data passed to function */ | ||
111 | struct list_head list; | ||
112 | }; | ||
113 | |||
114 | struct langwell_otg { | ||
115 | struct intel_mid_otg_xceiv iotg; | ||
116 | struct device *dev; | ||
117 | |||
118 | void __iomem *usbcfg; /* SCCBUSB config Reg */ | ||
119 | |||
120 | unsigned region; | ||
121 | unsigned cfg_region; | ||
122 | |||
123 | struct work_struct work; | ||
124 | struct workqueue_struct *qwork; | ||
125 | struct timer_list hsm_timer; | ||
126 | |||
127 | spinlock_t lock; | ||
128 | spinlock_t wq_lock; | ||
129 | |||
130 | struct notifier_block iotg_notifier; | ||
131 | }; | ||
132 | |||
133 | static inline | ||
134 | struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg) | ||
135 | { | ||
136 | return container_of(iotg, struct langwell_otg, iotg); | ||
137 | } | ||
138 | |||
139 | #endif /* __LANGWELL_OTG_H__ */ | ||
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h new file mode 100644 index 00000000000..2d2d1bbad9d --- /dev/null +++ b/include/linux/usb/langwell_udc.h | |||
@@ -0,0 +1,310 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB Device Controller driver | ||
3 | * Copyright (C) 2008-2009, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef __LANGWELL_UDC_H | ||
21 | #define __LANGWELL_UDC_H | ||
22 | |||
23 | |||
24 | /* MACRO defines */ | ||
25 | #define CAP_REG_OFFSET 0x0 | ||
26 | #define OP_REG_OFFSET 0x28 | ||
27 | |||
28 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | ||
29 | |||
30 | #define DQH_ALIGNMENT 2048 | ||
31 | #define DTD_ALIGNMENT 64 | ||
32 | #define DMA_BOUNDARY 4096 | ||
33 | |||
34 | #define EP0_MAX_PKT_SIZE 64 | ||
35 | #define EP_DIR_IN 1 | ||
36 | #define EP_DIR_OUT 0 | ||
37 | |||
38 | #define FLUSH_TIMEOUT 1000 | ||
39 | #define RESET_TIMEOUT 1000 | ||
40 | #define SETUPSTAT_TIMEOUT 100 | ||
41 | #define PRIME_TIMEOUT 100 | ||
42 | |||
43 | |||
44 | /* device memory space registers */ | ||
45 | |||
46 | /* Capability Registers, BAR0 + CAP_REG_OFFSET */ | ||
47 | struct langwell_cap_regs { | ||
48 | /* offset: 0x0 */ | ||
49 | u8 caplength; /* offset of Operational Register */ | ||
50 | u8 _reserved3; | ||
51 | u16 hciversion; /* H: BCD encoding of host version */ | ||
52 | u32 hcsparams; /* H: host port steering logic capability */ | ||
53 | u32 hccparams; /* H: host multiple mode control capability */ | ||
54 | #define HCC_LEN BIT(17) /* Link power management (LPM) capability */ | ||
55 | u8 _reserved4[0x20-0xc]; | ||
56 | /* offset: 0x20 */ | ||
57 | u16 dciversion; /* BCD encoding of device version */ | ||
58 | u8 _reserved5[0x24-0x22]; | ||
59 | u32 dccparams; /* overall device controller capability */ | ||
60 | #define HOSTCAP BIT(8) /* host capable */ | ||
61 | #define DEVCAP BIT(7) /* device capable */ | ||
62 | #define DEN(d) \ | ||
63 | (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */ | ||
64 | } __attribute__ ((packed)); | ||
65 | |||
66 | |||
67 | /* Operational Registers, BAR0 + OP_REG_OFFSET */ | ||
68 | struct langwell_op_regs { | ||
69 | /* offset: 0x28 */ | ||
70 | u32 extsts; | ||
71 | #define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */ | ||
72 | #define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */ | ||
73 | #define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */ | ||
74 | #define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */ | ||
75 | #define EXTS_TI1NAKI BIT(0) /* NAK interrupt */ | ||
76 | u32 extintr; | ||
77 | #define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */ | ||
78 | #define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */ | ||
79 | #define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */ | ||
80 | #define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */ | ||
81 | #define EXTI_NAKE BIT(0) /* NAK interrupt enable */ | ||
82 | /* offset: 0x30 */ | ||
83 | u32 usbcmd; | ||
84 | #define CMD_HIRD(u) \ | ||
85 | (((u)>>24)&0xf) /* bits 27:24, host init resume duration */ | ||
86 | #define CMD_ITC(u) \ | ||
87 | (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */ | ||
88 | #define CMD_PPE BIT(15) /* per-port change events enable */ | ||
89 | #define CMD_ATDTW BIT(14) /* add dTD tripwire */ | ||
90 | #define CMD_SUTW BIT(13) /* setup tripwire */ | ||
91 | #define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */ | ||
92 | #define CMD_FS2 BIT(10) /* frame list size */ | ||
93 | #define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */ | ||
94 | #define CMD_ASP0 BIT(8) | ||
95 | #define CMD_LR BIT(7) /* light host/device controller reset */ | ||
96 | #define CMD_IAA BIT(6) /* interrupt on async advance doorbell */ | ||
97 | #define CMD_ASE BIT(5) /* asynchronous schedule enable */ | ||
98 | #define CMD_PSE BIT(4) /* periodic schedule enable */ | ||
99 | #define CMD_FS1 BIT(3) | ||
100 | #define CMD_FS0 BIT(2) | ||
101 | #define CMD_RST BIT(1) /* controller reset */ | ||
102 | #define CMD_RUNSTOP BIT(0) /* run/stop */ | ||
103 | u32 usbsts; | ||
104 | #define STS_PPCI(u) \ | ||
105 | (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */ | ||
106 | #define STS_AS BIT(15) /* asynchronous schedule status */ | ||
107 | #define STS_PS BIT(14) /* periodic schedule status */ | ||
108 | #define STS_RCL BIT(13) /* reclamation */ | ||
109 | #define STS_HCH BIT(12) /* HC halted */ | ||
110 | #define STS_ULPII BIT(10) /* ULPI interrupt */ | ||
111 | #define STS_SLI BIT(8) /* DC suspend */ | ||
112 | #define STS_SRI BIT(7) /* SOF received */ | ||
113 | #define STS_URI BIT(6) /* USB reset received */ | ||
114 | #define STS_AAI BIT(5) /* interrupt on async advance */ | ||
115 | #define STS_SEI BIT(4) /* system error */ | ||
116 | #define STS_FRI BIT(3) /* frame list rollover */ | ||
117 | #define STS_PCI BIT(2) /* port change detect */ | ||
118 | #define STS_UEI BIT(1) /* USB error interrupt */ | ||
119 | #define STS_UI BIT(0) /* USB interrupt */ | ||
120 | u32 usbintr; | ||
121 | /* bits 31:16, per-port interrupt enable */ | ||
122 | #define INTR_PPCE(u) (((u)>>16)&0xffff) | ||
123 | #define INTR_ULPIE BIT(10) /* ULPI enable */ | ||
124 | #define INTR_SLE BIT(8) /* DC sleep/suspend enable */ | ||
125 | #define INTR_SRE BIT(7) /* SOF received enable */ | ||
126 | #define INTR_URE BIT(6) /* USB reset enable */ | ||
127 | #define INTR_AAE BIT(5) /* interrupt on async advance enable */ | ||
128 | #define INTR_SEE BIT(4) /* system error enable */ | ||
129 | #define INTR_FRE BIT(3) /* frame list rollover enable */ | ||
130 | #define INTR_PCE BIT(2) /* port change detect enable */ | ||
131 | #define INTR_UEE BIT(1) /* USB error interrupt enable */ | ||
132 | #define INTR_UE BIT(0) /* USB interrupt enable */ | ||
133 | u32 frindex; /* frame index */ | ||
134 | #define FRINDEX_MASK (0x3fff << 0) | ||
135 | u32 ctrldssegment; /* not used */ | ||
136 | u32 deviceaddr; | ||
137 | #define USBADR_SHIFT 25 | ||
138 | #define USBADR(d) \ | ||
139 | (((d)>>25)&0x7f) /* bits 31:25, device address */ | ||
140 | #define USBADR_MASK (0x7f << 25) | ||
141 | #define USBADRA BIT(24) /* device address advance */ | ||
142 | u32 endpointlistaddr;/* endpoint list top memory address */ | ||
143 | /* bits 31:11, endpoint list pointer */ | ||
144 | #define EPBASE(d) (((d)>>11)&0x1fffff) | ||
145 | #define ENDPOINTLISTADDR_MASK (0x1fffff << 11) | ||
146 | u32 ttctrl; /* H: TT operatin, not used */ | ||
147 | /* offset: 0x50 */ | ||
148 | u32 burstsize; /* burst size of data movement */ | ||
149 | #define TXPBURST(b) \ | ||
150 | (((b)>>8)&0xff) /* bits 15:8, TX burst length */ | ||
151 | #define RXPBURST(b) \ | ||
152 | (((b)>>0)&0xff) /* bits 7:0, RX burst length */ | ||
153 | u32 txfilltuning; /* TX tuning */ | ||
154 | u32 txttfilltuning; /* H: TX TT tuning */ | ||
155 | u32 ic_usb; /* control the IC_USB FS/LS transceiver */ | ||
156 | /* offset: 0x60 */ | ||
157 | u32 ulpi_viewport; /* indirect access to ULPI PHY */ | ||
158 | #define ULPIWU BIT(31) /* ULPI wakeup */ | ||
159 | #define ULPIRUN BIT(30) /* ULPI read/write run */ | ||
160 | #define ULPIRW BIT(29) /* ULPI read/write control */ | ||
161 | #define ULPISS BIT(27) /* ULPI sync state */ | ||
162 | #define ULPIPORT(u) \ | ||
163 | (((u)>>24)&7) /* bits 26:24, ULPI port number */ | ||
164 | #define ULPIADDR(u) \ | ||
165 | (((u)>>16)&0xff) /* bits 23:16, ULPI data address */ | ||
166 | #define ULPIDATRD(u) \ | ||
167 | (((u)>>8)&0xff) /* bits 15:8, ULPI data read */ | ||
168 | #define ULPIDATWR(u) \ | ||
169 | (((u)>>0)&0xff) /* bits 7:0, ULPI date write */ | ||
170 | u8 _reserved6[0x70-0x64]; | ||
171 | /* offset: 0x70 */ | ||
172 | u32 configflag; /* H: not used */ | ||
173 | u32 portsc1; /* port status */ | ||
174 | #define DA(p) \ | ||
175 | (((p)>>25)&0x7f) /* bits 31:25, device address */ | ||
176 | #define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */ | ||
177 | #define PORTS_WKOC BIT(22) /* wake on over-current enable */ | ||
178 | #define PORTS_WKDS BIT(21) /* wake on disconnect enable */ | ||
179 | #define PORTS_WKCN BIT(20) /* wake on connect enable */ | ||
180 | #define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */ | ||
181 | #define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ | ||
182 | #define PORTS_PO BIT(13) /* port owner */ | ||
183 | #define PORTS_PP BIT(12) /* port power */ | ||
184 | #define PORTS_LS (BIT(11) | BIT(10)) /* line status */ | ||
185 | #define PORTS_SLP BIT(9) /* suspend using L1 */ | ||
186 | #define PORTS_PR BIT(8) /* port reset */ | ||
187 | #define PORTS_SUSP BIT(7) /* suspend */ | ||
188 | #define PORTS_FPR BIT(6) /* force port resume */ | ||
189 | #define PORTS_OCC BIT(5) /* over-current change */ | ||
190 | #define PORTS_OCA BIT(4) /* over-current active */ | ||
191 | #define PORTS_PEC BIT(3) /* port enable/disable change */ | ||
192 | #define PORTS_PE BIT(2) /* port enable/disable */ | ||
193 | #define PORTS_CSC BIT(1) /* connect status change */ | ||
194 | #define PORTS_CCS BIT(0) /* current connect status */ | ||
195 | u8 _reserved7[0xb4-0x78]; | ||
196 | /* offset: 0xb4 */ | ||
197 | u32 devlc; /* control LPM and each USB port behavior */ | ||
198 | /* bits 31:29, parallel transceiver select */ | ||
199 | #define LPM_PTS(d) (((d)>>29)&7) | ||
200 | #define LPM_STS BIT(28) /* serial transceiver select */ | ||
201 | #define LPM_PTW BIT(27) /* parallel transceiver width */ | ||
202 | #define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */ | ||
203 | #define LPM_PSPD_MASK (BIT(26) | BIT(25)) | ||
204 | #define LPM_SPEED_FULL 0 | ||
205 | #define LPM_SPEED_LOW 1 | ||
206 | #define LPM_SPEED_HIGH 2 | ||
207 | #define LPM_SRT BIT(24) /* shorten reset time */ | ||
208 | #define LPM_PFSC BIT(23) /* port force full speed connect */ | ||
209 | #define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */ | ||
210 | #define LPM_STL BIT(16) /* STALL reply to LPM token */ | ||
211 | #define LPM_BA(d) \ | ||
212 | (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */ | ||
213 | #define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */ | ||
214 | u8 _reserved8[0xf4-0xb8]; | ||
215 | /* offset: 0xf4 */ | ||
216 | u32 otgsc; /* On-The-Go status and control */ | ||
217 | #define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */ | ||
218 | #define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */ | ||
219 | #define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */ | ||
220 | #define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */ | ||
221 | #define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */ | ||
222 | #define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */ | ||
223 | #define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */ | ||
224 | #define OTGSC_DPIS BIT(22) /* data pulse interrupt status */ | ||
225 | #define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */ | ||
226 | #define OTGSC_BSEIS BIT(20) /* B session end interrupt status */ | ||
227 | #define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */ | ||
228 | #define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */ | ||
229 | #define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */ | ||
230 | #define OTGSC_IDIS BIT(16) /* USB ID interrupt status */ | ||
231 | #define OTGSC_DPS BIT(14) /* data bus pulsing status */ | ||
232 | #define OTGSC_MST BIT(13) /* 1 ms timer toggle */ | ||
233 | #define OTGSC_BSE BIT(12) /* B session end */ | ||
234 | #define OTGSC_BSV BIT(11) /* B session valid */ | ||
235 | #define OTGSC_ASV BIT(10) /* A session valid */ | ||
236 | #define OTGSC_AVV BIT(9) /* A VBUS valid */ | ||
237 | #define OTGSC_USBID BIT(8) /* USB ID */ | ||
238 | #define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */ | ||
239 | #define OTGSC_HADP BIT(6) /* hw assist data pulse */ | ||
240 | #define OTGSC_IDPU BIT(5) /* ID pullup */ | ||
241 | #define OTGSC_DP BIT(4) /* data pulsing */ | ||
242 | #define OTGSC_OT BIT(3) /* OTG termination */ | ||
243 | #define OTGSC_HAAR BIT(2) /* hw assist auto reset */ | ||
244 | #define OTGSC_VC BIT(1) /* VBUS charge */ | ||
245 | #define OTGSC_VD BIT(0) /* VBUS discharge */ | ||
246 | u32 usbmode; | ||
247 | #define MODE_VBPS BIT(5) /* R/W VBUS power select */ | ||
248 | #define MODE_SDIS BIT(4) /* R/W stream disable mode */ | ||
249 | #define MODE_SLOM BIT(3) /* R/W setup lockout mode */ | ||
250 | #define MODE_ENSE BIT(2) /* endian select */ | ||
251 | #define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */ | ||
252 | #define MODE_IDLE 0 | ||
253 | #define MODE_DEVICE 2 | ||
254 | #define MODE_HOST 3 | ||
255 | u8 _reserved9[0x100-0xfc]; | ||
256 | /* offset: 0x100 */ | ||
257 | u32 endptnak; | ||
258 | #define EPTN(e) \ | ||
259 | (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */ | ||
260 | #define EPRN(e) \ | ||
261 | (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */ | ||
262 | u32 endptnaken; | ||
263 | #define EPTNE(e) \ | ||
264 | (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */ | ||
265 | #define EPRNE(e) \ | ||
266 | (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */ | ||
267 | u32 endptsetupstat; | ||
268 | #define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */ | ||
269 | #define EP0SETUPSTAT_MASK 1 | ||
270 | u32 endptprime; | ||
271 | /* bits 31:16, prime endpoint transmit buffer */ | ||
272 | #define PETB(e) (((e)>>16)&0xffff) | ||
273 | /* bits 15:0, prime endpoint receive buffer */ | ||
274 | #define PERB(e) (((e)>>0)&0xffff) | ||
275 | /* offset: 0x110 */ | ||
276 | u32 endptflush; | ||
277 | /* bits 31:16, flush endpoint transmit buffer */ | ||
278 | #define FETB(e) (((e)>>16)&0xffff) | ||
279 | /* bits 15:0, flush endpoint receive buffer */ | ||
280 | #define FERB(e) (((e)>>0)&0xffff) | ||
281 | u32 endptstat; | ||
282 | /* bits 31:16, endpoint transmit buffer ready */ | ||
283 | #define ETBR(e) (((e)>>16)&0xffff) | ||
284 | /* bits 15:0, endpoint receive buffer ready */ | ||
285 | #define ERBR(e) (((e)>>0)&0xffff) | ||
286 | u32 endptcomplete; | ||
287 | /* bits 31:16, endpoint transmit complete event */ | ||
288 | #define ETCE(e) (((e)>>16)&0xffff) | ||
289 | /* bits 15:0, endpoint receive complete event */ | ||
290 | #define ERCE(e) (((e)>>0)&0xffff) | ||
291 | /* offset: 0x11c */ | ||
292 | u32 endptctrl[16]; | ||
293 | #define EPCTRL_TXE BIT(23) /* TX endpoint enable */ | ||
294 | #define EPCTRL_TXR BIT(22) /* TX data toggle reset */ | ||
295 | #define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */ | ||
296 | #define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */ | ||
297 | #define EPCTRL_TXT_SHIFT 18 | ||
298 | #define EPCTRL_TXD BIT(17) /* TX endpoint data source */ | ||
299 | #define EPCTRL_TXS BIT(16) /* TX endpoint STALL */ | ||
300 | #define EPCTRL_RXE BIT(7) /* RX endpoint enable */ | ||
301 | #define EPCTRL_RXR BIT(6) /* RX data toggle reset */ | ||
302 | #define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */ | ||
303 | #define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */ | ||
304 | #define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */ | ||
305 | #define EPCTRL_RXD BIT(1) /* RX endpoint data sink */ | ||
306 | #define EPCTRL_RXS BIT(0) /* RX endpoint STALL */ | ||
307 | } __attribute__ ((packed)); | ||
308 | |||
309 | #endif /* __LANGWELL_UDC_H */ | ||
310 | |||
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h new file mode 100644 index 00000000000..c8c52e3c91d --- /dev/null +++ b/include/linux/usb/midi.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * <linux/usb/midi.h> -- USB MIDI definitions. | ||
3 | * | ||
4 | * Copyright (C) 2006 Thumtronics Pty Ltd. | ||
5 | * Developed for Thumtronics by Grey Innovation | ||
6 | * Ben Williamson <ben.williamson@greyinnovation.com> | ||
7 | * | ||
8 | * This software is distributed under the terms of the GNU General Public | ||
9 | * License ("GPL") version 2, as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This file holds USB constants and structures defined | ||
12 | * by the USB Device Class Definition for MIDI Devices. | ||
13 | * Comments below reference relevant sections of that document: | ||
14 | * | ||
15 | * http://www.usb.org/developers/devclass_docs/midi10.pdf | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_MIDI_H | ||
19 | #define __LINUX_USB_MIDI_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | /* A.1 MS Class-Specific Interface Descriptor Subtypes */ | ||
24 | #define USB_MS_HEADER 0x01 | ||
25 | #define USB_MS_MIDI_IN_JACK 0x02 | ||
26 | #define USB_MS_MIDI_OUT_JACK 0x03 | ||
27 | #define USB_MS_ELEMENT 0x04 | ||
28 | |||
29 | /* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ | ||
30 | #define USB_MS_GENERAL 0x01 | ||
31 | |||
32 | /* A.3 MS MIDI IN and OUT Jack Types */ | ||
33 | #define USB_MS_EMBEDDED 0x01 | ||
34 | #define USB_MS_EXTERNAL 0x02 | ||
35 | |||
36 | /* 6.1.2.1 Class-Specific MS Interface Header Descriptor */ | ||
37 | struct usb_ms_header_descriptor { | ||
38 | __u8 bLength; | ||
39 | __u8 bDescriptorType; | ||
40 | __u8 bDescriptorSubtype; | ||
41 | __le16 bcdMSC; | ||
42 | __le16 wTotalLength; | ||
43 | } __attribute__ ((packed)); | ||
44 | |||
45 | #define USB_DT_MS_HEADER_SIZE 7 | ||
46 | |||
47 | /* 6.1.2.2 MIDI IN Jack Descriptor */ | ||
48 | struct usb_midi_in_jack_descriptor { | ||
49 | __u8 bLength; | ||
50 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
51 | __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */ | ||
52 | __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ | ||
53 | __u8 bJackID; | ||
54 | __u8 iJack; | ||
55 | } __attribute__ ((packed)); | ||
56 | |||
57 | #define USB_DT_MIDI_IN_SIZE 6 | ||
58 | |||
59 | struct usb_midi_source_pin { | ||
60 | __u8 baSourceID; | ||
61 | __u8 baSourcePin; | ||
62 | } __attribute__ ((packed)); | ||
63 | |||
64 | /* 6.1.2.3 MIDI OUT Jack Descriptor */ | ||
65 | struct usb_midi_out_jack_descriptor { | ||
66 | __u8 bLength; | ||
67 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
68 | __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */ | ||
69 | __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ | ||
70 | __u8 bJackID; | ||
71 | __u8 bNrInputPins; /* p */ | ||
72 | struct usb_midi_source_pin pins[]; /* [p] */ | ||
73 | /*__u8 iJack; -- omitted due to variable-sized pins[] */ | ||
74 | } __attribute__ ((packed)); | ||
75 | |||
76 | #define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) | ||
77 | |||
78 | /* As above, but more useful for defining your own descriptors: */ | ||
79 | #define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \ | ||
80 | struct usb_midi_out_jack_descriptor_##p { \ | ||
81 | __u8 bLength; \ | ||
82 | __u8 bDescriptorType; \ | ||
83 | __u8 bDescriptorSubtype; \ | ||
84 | __u8 bJackType; \ | ||
85 | __u8 bJackID; \ | ||
86 | __u8 bNrInputPins; \ | ||
87 | struct usb_midi_source_pin pins[p]; \ | ||
88 | __u8 iJack; \ | ||
89 | } __attribute__ ((packed)) | ||
90 | |||
91 | /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ | ||
92 | struct usb_ms_endpoint_descriptor { | ||
93 | __u8 bLength; /* 4+n */ | ||
94 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ | ||
95 | __u8 bDescriptorSubtype; /* USB_MS_GENERAL */ | ||
96 | __u8 bNumEmbMIDIJack; /* n */ | ||
97 | __u8 baAssocJackID[]; /* [n] */ | ||
98 | } __attribute__ ((packed)); | ||
99 | |||
100 | #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) | ||
101 | |||
102 | /* As above, but more useful for defining your own descriptors: */ | ||
103 | #define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \ | ||
104 | struct usb_ms_endpoint_descriptor_##n { \ | ||
105 | __u8 bLength; \ | ||
106 | __u8 bDescriptorType; \ | ||
107 | __u8 bDescriptorSubtype; \ | ||
108 | __u8 bNumEmbMIDIJack; \ | ||
109 | __u8 baAssocJackID[n]; \ | ||
110 | } __attribute__ ((packed)) | ||
111 | |||
112 | #endif /* __LINUX_USB_MIDI_H */ | ||
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h new file mode 100644 index 00000000000..f9f5189a73b --- /dev/null +++ b/include/linux/usb/otg_id.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_OTG_ID_H | ||
19 | #define __LINUX_USB_OTG_ID_H | ||
20 | |||
21 | #include <linux/notifier.h> | ||
22 | #include <linux/plist.h> | ||
23 | |||
24 | /** | ||
25 | * otg_id_notifier_block | ||
26 | * | ||
27 | * @priority: Order the notifications will be called in. Higher numbers | ||
28 | * get called first. | ||
29 | * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable | ||
30 | * has been identified | ||
31 | * @proxy_wait: Called during otg_id_notify if a previous handler returns | ||
32 | * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify. | ||
33 | * This is used when a handler knows what's connected but can't detect | ||
34 | * the change itself. | ||
35 | * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to | ||
36 | * release detection resources to allow a new identification to occur. | ||
37 | */ | ||
38 | |||
39 | struct otg_id_notifier_block { | ||
40 | int priority; | ||
41 | int (*detect)(struct otg_id_notifier_block *otg_id_nb); | ||
42 | int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb); | ||
43 | void (*cancel)(struct otg_id_notifier_block *otg_id_nb); | ||
44 | struct plist_node p; | ||
45 | }; | ||
46 | |||
47 | #define OTG_ID_PROXY_WAIT 2 | ||
48 | #define OTG_ID_HANDLED 1 | ||
49 | #define OTG_ID_UNHANDLED 0 | ||
50 | |||
51 | int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb); | ||
52 | void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb); | ||
53 | |||
54 | void otg_id_notify(void); | ||
55 | int otg_id_suspend(void); | ||
56 | void otg_id_resume(void); | ||
57 | |||
58 | #endif /* __LINUX_USB_OTG_ID_H */ | ||
diff --git a/include/linux/usb/tmc.h b/include/linux/usb/tmc.h new file mode 100644 index 00000000000..c045ae12556 --- /dev/null +++ b/include/linux/usb/tmc.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany | ||
3 | * Copyright (C) 2008 Novell, Inc. | ||
4 | * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de> | ||
5 | * | ||
6 | * This file holds USB constants defined by the USB Device Class | ||
7 | * Definition for Test and Measurement devices published by the USB-IF. | ||
8 | * | ||
9 | * It also has the ioctl definitions for the usbtmc kernel driver that | ||
10 | * userspace needs to know about. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_USB_TMC_H | ||
14 | #define __LINUX_USB_TMC_H | ||
15 | |||
16 | /* USB TMC status values */ | ||
17 | #define USBTMC_STATUS_SUCCESS 0x01 | ||
18 | #define USBTMC_STATUS_PENDING 0x02 | ||
19 | #define USBTMC_STATUS_FAILED 0x80 | ||
20 | #define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 | ||
21 | #define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 | ||
22 | #define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83 | ||
23 | |||
24 | /* USB TMC requests values */ | ||
25 | #define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1 | ||
26 | #define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2 | ||
27 | #define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3 | ||
28 | #define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4 | ||
29 | #define USBTMC_REQUEST_INITIATE_CLEAR 5 | ||
30 | #define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6 | ||
31 | #define USBTMC_REQUEST_GET_CAPABILITIES 7 | ||
32 | #define USBTMC_REQUEST_INDICATOR_PULSE 64 | ||
33 | |||
34 | /* Request values for USBTMC driver's ioctl entry point */ | ||
35 | #define USBTMC_IOC_NR 91 | ||
36 | #define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1) | ||
37 | #define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2) | ||
38 | #define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3) | ||
39 | #define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4) | ||
40 | #define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6) | ||
41 | #define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7) | ||
42 | |||
43 | #endif | ||
diff --git a/include/linux/usb/video.h b/include/linux/usb/video.h new file mode 100644 index 00000000000..3b3b95e01f7 --- /dev/null +++ b/include/linux/usb/video.h | |||
@@ -0,0 +1,568 @@ | |||
1 | /* | ||
2 | * USB Video Class definitions. | ||
3 | * | ||
4 | * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be> | ||
5 | * | ||
6 | * This file holds USB constants and structures defined by the USB Device | ||
7 | * Class Definition for Video Devices. Unless otherwise stated, comments | ||
8 | * below reference relevant sections of the USB Video Class 1.1 specification | ||
9 | * available at | ||
10 | * | ||
11 | * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_USB_VIDEO_H | ||
15 | #define __LINUX_USB_VIDEO_H | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | |||
19 | /* -------------------------------------------------------------------------- | ||
20 | * UVC constants | ||
21 | */ | ||
22 | |||
23 | /* A.2. Video Interface Subclass Codes */ | ||
24 | #define UVC_SC_UNDEFINED 0x00 | ||
25 | #define UVC_SC_VIDEOCONTROL 0x01 | ||
26 | #define UVC_SC_VIDEOSTREAMING 0x02 | ||
27 | #define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03 | ||
28 | |||
29 | /* A.3. Video Interface Protocol Codes */ | ||
30 | #define UVC_PC_PROTOCOL_UNDEFINED 0x00 | ||
31 | |||
32 | /* A.5. Video Class-Specific VC Interface Descriptor Subtypes */ | ||
33 | #define UVC_VC_DESCRIPTOR_UNDEFINED 0x00 | ||
34 | #define UVC_VC_HEADER 0x01 | ||
35 | #define UVC_VC_INPUT_TERMINAL 0x02 | ||
36 | #define UVC_VC_OUTPUT_TERMINAL 0x03 | ||
37 | #define UVC_VC_SELECTOR_UNIT 0x04 | ||
38 | #define UVC_VC_PROCESSING_UNIT 0x05 | ||
39 | #define UVC_VC_EXTENSION_UNIT 0x06 | ||
40 | |||
41 | /* A.6. Video Class-Specific VS Interface Descriptor Subtypes */ | ||
42 | #define UVC_VS_UNDEFINED 0x00 | ||
43 | #define UVC_VS_INPUT_HEADER 0x01 | ||
44 | #define UVC_VS_OUTPUT_HEADER 0x02 | ||
45 | #define UVC_VS_STILL_IMAGE_FRAME 0x03 | ||
46 | #define UVC_VS_FORMAT_UNCOMPRESSED 0x04 | ||
47 | #define UVC_VS_FRAME_UNCOMPRESSED 0x05 | ||
48 | #define UVC_VS_FORMAT_MJPEG 0x06 | ||
49 | #define UVC_VS_FRAME_MJPEG 0x07 | ||
50 | #define UVC_VS_FORMAT_MPEG2TS 0x0a | ||
51 | #define UVC_VS_FORMAT_DV 0x0c | ||
52 | #define UVC_VS_COLORFORMAT 0x0d | ||
53 | #define UVC_VS_FORMAT_FRAME_BASED 0x10 | ||
54 | #define UVC_VS_FRAME_FRAME_BASED 0x11 | ||
55 | #define UVC_VS_FORMAT_STREAM_BASED 0x12 | ||
56 | |||
57 | /* A.7. Video Class-Specific Endpoint Descriptor Subtypes */ | ||
58 | #define UVC_EP_UNDEFINED 0x00 | ||
59 | #define UVC_EP_GENERAL 0x01 | ||
60 | #define UVC_EP_ENDPOINT 0x02 | ||
61 | #define UVC_EP_INTERRUPT 0x03 | ||
62 | |||
63 | /* A.8. Video Class-Specific Request Codes */ | ||
64 | #define UVC_RC_UNDEFINED 0x00 | ||
65 | #define UVC_SET_CUR 0x01 | ||
66 | #define UVC_GET_CUR 0x81 | ||
67 | #define UVC_GET_MIN 0x82 | ||
68 | #define UVC_GET_MAX 0x83 | ||
69 | #define UVC_GET_RES 0x84 | ||
70 | #define UVC_GET_LEN 0x85 | ||
71 | #define UVC_GET_INFO 0x86 | ||
72 | #define UVC_GET_DEF 0x87 | ||
73 | |||
74 | /* A.9.1. VideoControl Interface Control Selectors */ | ||
75 | #define UVC_VC_CONTROL_UNDEFINED 0x00 | ||
76 | #define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01 | ||
77 | #define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02 | ||
78 | |||
79 | /* A.9.2. Terminal Control Selectors */ | ||
80 | #define UVC_TE_CONTROL_UNDEFINED 0x00 | ||
81 | |||
82 | /* A.9.3. Selector Unit Control Selectors */ | ||
83 | #define UVC_SU_CONTROL_UNDEFINED 0x00 | ||
84 | #define UVC_SU_INPUT_SELECT_CONTROL 0x01 | ||
85 | |||
86 | /* A.9.4. Camera Terminal Control Selectors */ | ||
87 | #define UVC_CT_CONTROL_UNDEFINED 0x00 | ||
88 | #define UVC_CT_SCANNING_MODE_CONTROL 0x01 | ||
89 | #define UVC_CT_AE_MODE_CONTROL 0x02 | ||
90 | #define UVC_CT_AE_PRIORITY_CONTROL 0x03 | ||
91 | #define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04 | ||
92 | #define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05 | ||
93 | #define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06 | ||
94 | #define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07 | ||
95 | #define UVC_CT_FOCUS_AUTO_CONTROL 0x08 | ||
96 | #define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09 | ||
97 | #define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a | ||
98 | #define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b | ||
99 | #define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c | ||
100 | #define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d | ||
101 | #define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e | ||
102 | #define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f | ||
103 | #define UVC_CT_ROLL_RELATIVE_CONTROL 0x10 | ||
104 | #define UVC_CT_PRIVACY_CONTROL 0x11 | ||
105 | |||
106 | /* A.9.5. Processing Unit Control Selectors */ | ||
107 | #define UVC_PU_CONTROL_UNDEFINED 0x00 | ||
108 | #define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01 | ||
109 | #define UVC_PU_BRIGHTNESS_CONTROL 0x02 | ||
110 | #define UVC_PU_CONTRAST_CONTROL 0x03 | ||
111 | #define UVC_PU_GAIN_CONTROL 0x04 | ||
112 | #define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05 | ||
113 | #define UVC_PU_HUE_CONTROL 0x06 | ||
114 | #define UVC_PU_SATURATION_CONTROL 0x07 | ||
115 | #define UVC_PU_SHARPNESS_CONTROL 0x08 | ||
116 | #define UVC_PU_GAMMA_CONTROL 0x09 | ||
117 | #define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a | ||
118 | #define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b | ||
119 | #define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c | ||
120 | #define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d | ||
121 | #define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e | ||
122 | #define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f | ||
123 | #define UVC_PU_HUE_AUTO_CONTROL 0x10 | ||
124 | #define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11 | ||
125 | #define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12 | ||
126 | |||
127 | /* A.9.7. VideoStreaming Interface Control Selectors */ | ||
128 | #define UVC_VS_CONTROL_UNDEFINED 0x00 | ||
129 | #define UVC_VS_PROBE_CONTROL 0x01 | ||
130 | #define UVC_VS_COMMIT_CONTROL 0x02 | ||
131 | #define UVC_VS_STILL_PROBE_CONTROL 0x03 | ||
132 | #define UVC_VS_STILL_COMMIT_CONTROL 0x04 | ||
133 | #define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 | ||
134 | #define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06 | ||
135 | #define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07 | ||
136 | #define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 | ||
137 | #define UVC_VS_SYNC_DELAY_CONTROL 0x09 | ||
138 | |||
139 | /* B.1. USB Terminal Types */ | ||
140 | #define UVC_TT_VENDOR_SPECIFIC 0x0100 | ||
141 | #define UVC_TT_STREAMING 0x0101 | ||
142 | |||
143 | /* B.2. Input Terminal Types */ | ||
144 | #define UVC_ITT_VENDOR_SPECIFIC 0x0200 | ||
145 | #define UVC_ITT_CAMERA 0x0201 | ||
146 | #define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202 | ||
147 | |||
148 | /* B.3. Output Terminal Types */ | ||
149 | #define UVC_OTT_VENDOR_SPECIFIC 0x0300 | ||
150 | #define UVC_OTT_DISPLAY 0x0301 | ||
151 | #define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302 | ||
152 | |||
153 | /* B.4. External Terminal Types */ | ||
154 | #define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400 | ||
155 | #define UVC_COMPOSITE_CONNECTOR 0x0401 | ||
156 | #define UVC_SVIDEO_CONNECTOR 0x0402 | ||
157 | #define UVC_COMPONENT_CONNECTOR 0x0403 | ||
158 | |||
159 | /* 2.4.2.2. Status Packet Type */ | ||
160 | #define UVC_STATUS_TYPE_CONTROL 1 | ||
161 | #define UVC_STATUS_TYPE_STREAMING 2 | ||
162 | |||
163 | /* 2.4.3.3. Payload Header Information */ | ||
164 | #define UVC_STREAM_EOH (1 << 7) | ||
165 | #define UVC_STREAM_ERR (1 << 6) | ||
166 | #define UVC_STREAM_STI (1 << 5) | ||
167 | #define UVC_STREAM_RES (1 << 4) | ||
168 | #define UVC_STREAM_SCR (1 << 3) | ||
169 | #define UVC_STREAM_PTS (1 << 2) | ||
170 | #define UVC_STREAM_EOF (1 << 1) | ||
171 | #define UVC_STREAM_FID (1 << 0) | ||
172 | |||
173 | /* 4.1.2. Control Capabilities */ | ||
174 | #define UVC_CONTROL_CAP_GET (1 << 0) | ||
175 | #define UVC_CONTROL_CAP_SET (1 << 1) | ||
176 | #define UVC_CONTROL_CAP_DISABLED (1 << 2) | ||
177 | #define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3) | ||
178 | #define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4) | ||
179 | |||
180 | /* ------------------------------------------------------------------------ | ||
181 | * UVC structures | ||
182 | */ | ||
183 | |||
184 | /* All UVC descriptors have these 3 fields at the beginning */ | ||
185 | struct uvc_descriptor_header { | ||
186 | __u8 bLength; | ||
187 | __u8 bDescriptorType; | ||
188 | __u8 bDescriptorSubType; | ||
189 | } __attribute__((packed)); | ||
190 | |||
191 | /* 3.7.2. Video Control Interface Header Descriptor */ | ||
192 | struct uvc_header_descriptor { | ||
193 | __u8 bLength; | ||
194 | __u8 bDescriptorType; | ||
195 | __u8 bDescriptorSubType; | ||
196 | __u16 bcdUVC; | ||
197 | __u16 wTotalLength; | ||
198 | __u32 dwClockFrequency; | ||
199 | __u8 bInCollection; | ||
200 | __u8 baInterfaceNr[]; | ||
201 | } __attribute__((__packed__)); | ||
202 | |||
203 | #define UVC_DT_HEADER_SIZE(n) (12+(n)) | ||
204 | |||
205 | #define UVC_HEADER_DESCRIPTOR(n) \ | ||
206 | uvc_header_descriptor_##n | ||
207 | |||
208 | #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ | ||
209 | struct UVC_HEADER_DESCRIPTOR(n) { \ | ||
210 | __u8 bLength; \ | ||
211 | __u8 bDescriptorType; \ | ||
212 | __u8 bDescriptorSubType; \ | ||
213 | __u16 bcdUVC; \ | ||
214 | __u16 wTotalLength; \ | ||
215 | __u32 dwClockFrequency; \ | ||
216 | __u8 bInCollection; \ | ||
217 | __u8 baInterfaceNr[n]; \ | ||
218 | } __attribute__ ((packed)) | ||
219 | |||
220 | /* 3.7.2.1. Input Terminal Descriptor */ | ||
221 | struct uvc_input_terminal_descriptor { | ||
222 | __u8 bLength; | ||
223 | __u8 bDescriptorType; | ||
224 | __u8 bDescriptorSubType; | ||
225 | __u8 bTerminalID; | ||
226 | __u16 wTerminalType; | ||
227 | __u8 bAssocTerminal; | ||
228 | __u8 iTerminal; | ||
229 | } __attribute__((__packed__)); | ||
230 | |||
231 | #define UVC_DT_INPUT_TERMINAL_SIZE 8 | ||
232 | |||
233 | /* 3.7.2.2. Output Terminal Descriptor */ | ||
234 | struct uvc_output_terminal_descriptor { | ||
235 | __u8 bLength; | ||
236 | __u8 bDescriptorType; | ||
237 | __u8 bDescriptorSubType; | ||
238 | __u8 bTerminalID; | ||
239 | __u16 wTerminalType; | ||
240 | __u8 bAssocTerminal; | ||
241 | __u8 bSourceID; | ||
242 | __u8 iTerminal; | ||
243 | } __attribute__((__packed__)); | ||
244 | |||
245 | #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 | ||
246 | |||
247 | /* 3.7.2.3. Camera Terminal Descriptor */ | ||
248 | struct uvc_camera_terminal_descriptor { | ||
249 | __u8 bLength; | ||
250 | __u8 bDescriptorType; | ||
251 | __u8 bDescriptorSubType; | ||
252 | __u8 bTerminalID; | ||
253 | __u16 wTerminalType; | ||
254 | __u8 bAssocTerminal; | ||
255 | __u8 iTerminal; | ||
256 | __u16 wObjectiveFocalLengthMin; | ||
257 | __u16 wObjectiveFocalLengthMax; | ||
258 | __u16 wOcularFocalLength; | ||
259 | __u8 bControlSize; | ||
260 | __u8 bmControls[3]; | ||
261 | } __attribute__((__packed__)); | ||
262 | |||
263 | #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) | ||
264 | |||
265 | /* 3.7.2.4. Selector Unit Descriptor */ | ||
266 | struct uvc_selector_unit_descriptor { | ||
267 | __u8 bLength; | ||
268 | __u8 bDescriptorType; | ||
269 | __u8 bDescriptorSubType; | ||
270 | __u8 bUnitID; | ||
271 | __u8 bNrInPins; | ||
272 | __u8 baSourceID[0]; | ||
273 | __u8 iSelector; | ||
274 | } __attribute__((__packed__)); | ||
275 | |||
276 | #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) | ||
277 | |||
278 | #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
279 | uvc_selector_unit_descriptor_##n | ||
280 | |||
281 | #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
282 | struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ | ||
283 | __u8 bLength; \ | ||
284 | __u8 bDescriptorType; \ | ||
285 | __u8 bDescriptorSubType; \ | ||
286 | __u8 bUnitID; \ | ||
287 | __u8 bNrInPins; \ | ||
288 | __u8 baSourceID[n]; \ | ||
289 | __u8 iSelector; \ | ||
290 | } __attribute__ ((packed)) | ||
291 | |||
292 | /* 3.7.2.5. Processing Unit Descriptor */ | ||
293 | struct uvc_processing_unit_descriptor { | ||
294 | __u8 bLength; | ||
295 | __u8 bDescriptorType; | ||
296 | __u8 bDescriptorSubType; | ||
297 | __u8 bUnitID; | ||
298 | __u8 bSourceID; | ||
299 | __u16 wMaxMultiplier; | ||
300 | __u8 bControlSize; | ||
301 | __u8 bmControls[2]; | ||
302 | __u8 iProcessing; | ||
303 | } __attribute__((__packed__)); | ||
304 | |||
305 | #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) | ||
306 | |||
307 | /* 3.7.2.6. Extension Unit Descriptor */ | ||
308 | struct uvc_extension_unit_descriptor { | ||
309 | __u8 bLength; | ||
310 | __u8 bDescriptorType; | ||
311 | __u8 bDescriptorSubType; | ||
312 | __u8 bUnitID; | ||
313 | __u8 guidExtensionCode[16]; | ||
314 | __u8 bNumControls; | ||
315 | __u8 bNrInPins; | ||
316 | __u8 baSourceID[0]; | ||
317 | __u8 bControlSize; | ||
318 | __u8 bmControls[0]; | ||
319 | __u8 iExtension; | ||
320 | } __attribute__((__packed__)); | ||
321 | |||
322 | #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) | ||
323 | |||
324 | #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
325 | uvc_extension_unit_descriptor_##p_##n | ||
326 | |||
327 | #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
328 | struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ | ||
329 | __u8 bLength; \ | ||
330 | __u8 bDescriptorType; \ | ||
331 | __u8 bDescriptorSubType; \ | ||
332 | __u8 bUnitID; \ | ||
333 | __u8 guidExtensionCode[16]; \ | ||
334 | __u8 bNumControls; \ | ||
335 | __u8 bNrInPins; \ | ||
336 | __u8 baSourceID[p]; \ | ||
337 | __u8 bControlSize; \ | ||
338 | __u8 bmControls[n]; \ | ||
339 | __u8 iExtension; \ | ||
340 | } __attribute__ ((packed)) | ||
341 | |||
342 | /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */ | ||
343 | struct uvc_control_endpoint_descriptor { | ||
344 | __u8 bLength; | ||
345 | __u8 bDescriptorType; | ||
346 | __u8 bDescriptorSubType; | ||
347 | __u16 wMaxTransferSize; | ||
348 | } __attribute__((__packed__)); | ||
349 | |||
350 | #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 | ||
351 | |||
352 | /* 3.9.2.1. Input Header Descriptor */ | ||
353 | struct uvc_input_header_descriptor { | ||
354 | __u8 bLength; | ||
355 | __u8 bDescriptorType; | ||
356 | __u8 bDescriptorSubType; | ||
357 | __u8 bNumFormats; | ||
358 | __u16 wTotalLength; | ||
359 | __u8 bEndpointAddress; | ||
360 | __u8 bmInfo; | ||
361 | __u8 bTerminalLink; | ||
362 | __u8 bStillCaptureMethod; | ||
363 | __u8 bTriggerSupport; | ||
364 | __u8 bTriggerUsage; | ||
365 | __u8 bControlSize; | ||
366 | __u8 bmaControls[]; | ||
367 | } __attribute__((__packed__)); | ||
368 | |||
369 | #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) | ||
370 | |||
371 | #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
372 | uvc_input_header_descriptor_##n_##p | ||
373 | |||
374 | #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
375 | struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
376 | __u8 bLength; \ | ||
377 | __u8 bDescriptorType; \ | ||
378 | __u8 bDescriptorSubType; \ | ||
379 | __u8 bNumFormats; \ | ||
380 | __u16 wTotalLength; \ | ||
381 | __u8 bEndpointAddress; \ | ||
382 | __u8 bmInfo; \ | ||
383 | __u8 bTerminalLink; \ | ||
384 | __u8 bStillCaptureMethod; \ | ||
385 | __u8 bTriggerSupport; \ | ||
386 | __u8 bTriggerUsage; \ | ||
387 | __u8 bControlSize; \ | ||
388 | __u8 bmaControls[p][n]; \ | ||
389 | } __attribute__ ((packed)) | ||
390 | |||
391 | /* 3.9.2.2. Output Header Descriptor */ | ||
392 | struct uvc_output_header_descriptor { | ||
393 | __u8 bLength; | ||
394 | __u8 bDescriptorType; | ||
395 | __u8 bDescriptorSubType; | ||
396 | __u8 bNumFormats; | ||
397 | __u16 wTotalLength; | ||
398 | __u8 bEndpointAddress; | ||
399 | __u8 bTerminalLink; | ||
400 | __u8 bControlSize; | ||
401 | __u8 bmaControls[]; | ||
402 | } __attribute__((__packed__)); | ||
403 | |||
404 | #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) | ||
405 | |||
406 | #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
407 | uvc_output_header_descriptor_##n_##p | ||
408 | |||
409 | #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
410 | struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
411 | __u8 bLength; \ | ||
412 | __u8 bDescriptorType; \ | ||
413 | __u8 bDescriptorSubType; \ | ||
414 | __u8 bNumFormats; \ | ||
415 | __u16 wTotalLength; \ | ||
416 | __u8 bEndpointAddress; \ | ||
417 | __u8 bTerminalLink; \ | ||
418 | __u8 bControlSize; \ | ||
419 | __u8 bmaControls[p][n]; \ | ||
420 | } __attribute__ ((packed)) | ||
421 | |||
422 | /* 3.9.2.6. Color matching descriptor */ | ||
423 | struct uvc_color_matching_descriptor { | ||
424 | __u8 bLength; | ||
425 | __u8 bDescriptorType; | ||
426 | __u8 bDescriptorSubType; | ||
427 | __u8 bColorPrimaries; | ||
428 | __u8 bTransferCharacteristics; | ||
429 | __u8 bMatrixCoefficients; | ||
430 | } __attribute__((__packed__)); | ||
431 | |||
432 | #define UVC_DT_COLOR_MATCHING_SIZE 6 | ||
433 | |||
434 | /* 4.3.1.1. Video Probe and Commit Controls */ | ||
435 | struct uvc_streaming_control { | ||
436 | __u16 bmHint; | ||
437 | __u8 bFormatIndex; | ||
438 | __u8 bFrameIndex; | ||
439 | __u32 dwFrameInterval; | ||
440 | __u16 wKeyFrameRate; | ||
441 | __u16 wPFrameRate; | ||
442 | __u16 wCompQuality; | ||
443 | __u16 wCompWindowSize; | ||
444 | __u16 wDelay; | ||
445 | __u32 dwMaxVideoFrameSize; | ||
446 | __u32 dwMaxPayloadTransferSize; | ||
447 | __u32 dwClockFrequency; | ||
448 | __u8 bmFramingInfo; | ||
449 | __u8 bPreferedVersion; | ||
450 | __u8 bMinVersion; | ||
451 | __u8 bMaxVersion; | ||
452 | } __attribute__((__packed__)); | ||
453 | |||
454 | /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */ | ||
455 | struct uvc_format_uncompressed { | ||
456 | __u8 bLength; | ||
457 | __u8 bDescriptorType; | ||
458 | __u8 bDescriptorSubType; | ||
459 | __u8 bFormatIndex; | ||
460 | __u8 bNumFrameDescriptors; | ||
461 | __u8 guidFormat[16]; | ||
462 | __u8 bBitsPerPixel; | ||
463 | __u8 bDefaultFrameIndex; | ||
464 | __u8 bAspectRatioX; | ||
465 | __u8 bAspectRatioY; | ||
466 | __u8 bmInterfaceFlags; | ||
467 | __u8 bCopyProtect; | ||
468 | } __attribute__((__packed__)); | ||
469 | |||
470 | #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 | ||
471 | |||
472 | /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */ | ||
473 | struct uvc_frame_uncompressed { | ||
474 | __u8 bLength; | ||
475 | __u8 bDescriptorType; | ||
476 | __u8 bDescriptorSubType; | ||
477 | __u8 bFrameIndex; | ||
478 | __u8 bmCapabilities; | ||
479 | __u16 wWidth; | ||
480 | __u16 wHeight; | ||
481 | __u32 dwMinBitRate; | ||
482 | __u32 dwMaxBitRate; | ||
483 | __u32 dwMaxVideoFrameBufferSize; | ||
484 | __u32 dwDefaultFrameInterval; | ||
485 | __u8 bFrameIntervalType; | ||
486 | __u32 dwFrameInterval[]; | ||
487 | } __attribute__((__packed__)); | ||
488 | |||
489 | #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) | ||
490 | |||
491 | #define UVC_FRAME_UNCOMPRESSED(n) \ | ||
492 | uvc_frame_uncompressed_##n | ||
493 | |||
494 | #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ | ||
495 | struct UVC_FRAME_UNCOMPRESSED(n) { \ | ||
496 | __u8 bLength; \ | ||
497 | __u8 bDescriptorType; \ | ||
498 | __u8 bDescriptorSubType; \ | ||
499 | __u8 bFrameIndex; \ | ||
500 | __u8 bmCapabilities; \ | ||
501 | __u16 wWidth; \ | ||
502 | __u16 wHeight; \ | ||
503 | __u32 dwMinBitRate; \ | ||
504 | __u32 dwMaxBitRate; \ | ||
505 | __u32 dwMaxVideoFrameBufferSize; \ | ||
506 | __u32 dwDefaultFrameInterval; \ | ||
507 | __u8 bFrameIntervalType; \ | ||
508 | __u32 dwFrameInterval[n]; \ | ||
509 | } __attribute__ ((packed)) | ||
510 | |||
511 | /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */ | ||
512 | struct uvc_format_mjpeg { | ||
513 | __u8 bLength; | ||
514 | __u8 bDescriptorType; | ||
515 | __u8 bDescriptorSubType; | ||
516 | __u8 bFormatIndex; | ||
517 | __u8 bNumFrameDescriptors; | ||
518 | __u8 bmFlags; | ||
519 | __u8 bDefaultFrameIndex; | ||
520 | __u8 bAspectRatioX; | ||
521 | __u8 bAspectRatioY; | ||
522 | __u8 bmInterfaceFlags; | ||
523 | __u8 bCopyProtect; | ||
524 | } __attribute__((__packed__)); | ||
525 | |||
526 | #define UVC_DT_FORMAT_MJPEG_SIZE 11 | ||
527 | |||
528 | /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */ | ||
529 | struct uvc_frame_mjpeg { | ||
530 | __u8 bLength; | ||
531 | __u8 bDescriptorType; | ||
532 | __u8 bDescriptorSubType; | ||
533 | __u8 bFrameIndex; | ||
534 | __u8 bmCapabilities; | ||
535 | __u16 wWidth; | ||
536 | __u16 wHeight; | ||
537 | __u32 dwMinBitRate; | ||
538 | __u32 dwMaxBitRate; | ||
539 | __u32 dwMaxVideoFrameBufferSize; | ||
540 | __u32 dwDefaultFrameInterval; | ||
541 | __u8 bFrameIntervalType; | ||
542 | __u32 dwFrameInterval[]; | ||
543 | } __attribute__((__packed__)); | ||
544 | |||
545 | #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) | ||
546 | |||
547 | #define UVC_FRAME_MJPEG(n) \ | ||
548 | uvc_frame_mjpeg_##n | ||
549 | |||
550 | #define DECLARE_UVC_FRAME_MJPEG(n) \ | ||
551 | struct UVC_FRAME_MJPEG(n) { \ | ||
552 | __u8 bLength; \ | ||
553 | __u8 bDescriptorType; \ | ||
554 | __u8 bDescriptorSubType; \ | ||
555 | __u8 bFrameIndex; \ | ||
556 | __u8 bmCapabilities; \ | ||
557 | __u16 wWidth; \ | ||
558 | __u16 wHeight; \ | ||
559 | __u32 dwMinBitRate; \ | ||
560 | __u32 dwMaxBitRate; \ | ||
561 | __u32 dwMaxVideoFrameBufferSize; \ | ||
562 | __u32 dwDefaultFrameInterval; \ | ||
563 | __u8 bFrameIntervalType; \ | ||
564 | __u32 dwFrameInterval[n]; \ | ||
565 | } __attribute__ ((packed)) | ||
566 | |||
567 | #endif /* __LINUX_USB_VIDEO_H */ | ||
568 | |||
diff --git a/include/linux/utime.h b/include/linux/utime.h new file mode 100644 index 00000000000..5cdf673afbd --- /dev/null +++ b/include/linux/utime.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _LINUX_UTIME_H | ||
2 | #define _LINUX_UTIME_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct utimbuf { | ||
7 | __kernel_time_t actime; | ||
8 | __kernel_time_t modtime; | ||
9 | }; | ||
10 | |||
11 | #endif | ||
diff --git a/include/linux/uvcvideo.h b/include/linux/uvcvideo.h new file mode 100644 index 00000000000..f46a53f060d --- /dev/null +++ b/include/linux/uvcvideo.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef __LINUX_UVCVIDEO_H_ | ||
2 | #define __LINUX_UVCVIDEO_H_ | ||
3 | |||
4 | #include <linux/ioctl.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | /* | ||
8 | * Dynamic controls | ||
9 | */ | ||
10 | |||
11 | /* Data types for UVC control data */ | ||
12 | #define UVC_CTRL_DATA_TYPE_RAW 0 | ||
13 | #define UVC_CTRL_DATA_TYPE_SIGNED 1 | ||
14 | #define UVC_CTRL_DATA_TYPE_UNSIGNED 2 | ||
15 | #define UVC_CTRL_DATA_TYPE_BOOLEAN 3 | ||
16 | #define UVC_CTRL_DATA_TYPE_ENUM 4 | ||
17 | #define UVC_CTRL_DATA_TYPE_BITMASK 5 | ||
18 | |||
19 | /* Control flags */ | ||
20 | #define UVC_CTRL_FLAG_SET_CUR (1 << 0) | ||
21 | #define UVC_CTRL_FLAG_GET_CUR (1 << 1) | ||
22 | #define UVC_CTRL_FLAG_GET_MIN (1 << 2) | ||
23 | #define UVC_CTRL_FLAG_GET_MAX (1 << 3) | ||
24 | #define UVC_CTRL_FLAG_GET_RES (1 << 4) | ||
25 | #define UVC_CTRL_FLAG_GET_DEF (1 << 5) | ||
26 | /* Control should be saved at suspend and restored at resume. */ | ||
27 | #define UVC_CTRL_FLAG_RESTORE (1 << 6) | ||
28 | /* Control can be updated by the camera. */ | ||
29 | #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7) | ||
30 | |||
31 | #define UVC_CTRL_FLAG_GET_RANGE \ | ||
32 | (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \ | ||
33 | UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \ | ||
34 | UVC_CTRL_FLAG_GET_DEF) | ||
35 | |||
36 | struct uvc_menu_info { | ||
37 | __u32 value; | ||
38 | __u8 name[32]; | ||
39 | }; | ||
40 | |||
41 | struct uvc_xu_control_mapping { | ||
42 | __u32 id; | ||
43 | __u8 name[32]; | ||
44 | __u8 entity[16]; | ||
45 | __u8 selector; | ||
46 | |||
47 | __u8 size; | ||
48 | __u8 offset; | ||
49 | __u32 v4l2_type; | ||
50 | __u32 data_type; | ||
51 | |||
52 | struct uvc_menu_info __user *menu_info; | ||
53 | __u32 menu_count; | ||
54 | |||
55 | __u32 reserved[4]; | ||
56 | }; | ||
57 | |||
58 | struct uvc_xu_control_query { | ||
59 | __u8 unit; | ||
60 | __u8 selector; | ||
61 | __u8 query; | ||
62 | __u16 size; | ||
63 | __u8 __user *data; | ||
64 | }; | ||
65 | |||
66 | #define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping) | ||
67 | #define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query) | ||
68 | |||
69 | #endif | ||
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h new file mode 100644 index 00000000000..5ea7f753a34 --- /dev/null +++ b/include/linux/v4l2-mediabus.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * Media Bus API header | ||
3 | * | ||
4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_V4L2_MEDIABUS_H | ||
12 | #define __LINUX_V4L2_MEDIABUS_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/videodev2.h> | ||
16 | |||
17 | /* | ||
18 | * These pixel codes uniquely identify data formats on the media bus. Mostly | ||
19 | * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is | ||
20 | * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the | ||
21 | * data format is fixed. Additionally, "2X8" means that one pixel is transferred | ||
22 | * in two 8-bit samples, "BE" or "LE" specify in which order those samples are | ||
23 | * transferred over the bus: "LE" means that the least significant bits are | ||
24 | * transferred first, "BE" means that the most significant bits are transferred | ||
25 | * first, and "PADHI" and "PADLO" define which bits - low or high, in the | ||
26 | * incomplete high byte, are filled with padding bits. | ||
27 | * | ||
28 | * The pixel codes are grouped by type, bus_width, bits per component, samples | ||
29 | * per pixel and order of subsamples. Numerical values are sorted using generic | ||
30 | * numerical sort order (8 thus comes before 10). | ||
31 | * | ||
32 | * As their value can't change when a new pixel code is inserted in the | ||
33 | * enumeration, the pixel codes are explicitly given a numerical value. The next | ||
34 | * free values for each category are listed below, update them when inserting | ||
35 | * new pixel codes. | ||
36 | */ | ||
37 | enum v4l2_mbus_pixelcode { | ||
38 | V4L2_MBUS_FMT_FIXED = 0x0001, | ||
39 | |||
40 | /* RGB - next is 0x1009 */ | ||
41 | V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001, | ||
42 | V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002, | ||
43 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003, | ||
44 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004, | ||
45 | V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005, | ||
46 | V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006, | ||
47 | V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, | ||
48 | V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, | ||
49 | |||
50 | /* YUV (including grey) - next is 0x2014 */ | ||
51 | V4L2_MBUS_FMT_Y8_1X8 = 0x2001, | ||
52 | V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, | ||
53 | V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003, | ||
54 | V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004, | ||
55 | V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005, | ||
56 | V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006, | ||
57 | V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007, | ||
58 | V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008, | ||
59 | V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009, | ||
60 | V4L2_MBUS_FMT_Y10_1X10 = 0x200a, | ||
61 | V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, | ||
62 | V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, | ||
63 | V4L2_MBUS_FMT_Y12_1X12 = 0x2013, | ||
64 | V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f, | ||
65 | V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, | ||
66 | V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, | ||
67 | V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012, | ||
68 | V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, | ||
69 | V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, | ||
70 | |||
71 | /* Bayer - next is 0x3015 */ | ||
72 | V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, | ||
73 | V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013, | ||
74 | V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002, | ||
75 | V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014, | ||
76 | V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b, | ||
77 | V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c, | ||
78 | V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009, | ||
79 | V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d, | ||
80 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003, | ||
81 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004, | ||
82 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005, | ||
83 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006, | ||
84 | V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007, | ||
85 | V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e, | ||
86 | V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a, | ||
87 | V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f, | ||
88 | V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008, | ||
89 | V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010, | ||
90 | V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011, | ||
91 | V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012, | ||
92 | |||
93 | /* JPEG compressed formats - next is 0x4002 */ | ||
94 | V4L2_MBUS_FMT_JPEG_1X8 = 0x4001, | ||
95 | }; | ||
96 | |||
97 | /** | ||
98 | * struct v4l2_mbus_framefmt - frame format on the media bus | ||
99 | * @width: frame width | ||
100 | * @height: frame height | ||
101 | * @code: data format code (from enum v4l2_mbus_pixelcode) | ||
102 | * @field: used interlacing type (from enum v4l2_field) | ||
103 | * @colorspace: colorspace of the data (from enum v4l2_colorspace) | ||
104 | */ | ||
105 | struct v4l2_mbus_framefmt { | ||
106 | __u32 width; | ||
107 | __u32 height; | ||
108 | __u32 code; | ||
109 | __u32 field; | ||
110 | __u32 colorspace; | ||
111 | __u32 reserved[7]; | ||
112 | }; | ||
113 | |||
114 | #endif | ||
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h new file mode 100644 index 00000000000..ed29cbbebfe --- /dev/null +++ b/include/linux/v4l2-subdev.h | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * V4L2 subdev userspace API | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation | ||
5 | * | ||
6 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
7 | * Sakari Ailus <sakari.ailus@iki.fi> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_V4L2_SUBDEV_H | ||
24 | #define __LINUX_V4L2_SUBDEV_H | ||
25 | |||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/v4l2-mediabus.h> | ||
29 | |||
30 | /** | ||
31 | * enum v4l2_subdev_format_whence - Media bus format type | ||
32 | * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only | ||
33 | * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device | ||
34 | */ | ||
35 | enum v4l2_subdev_format_whence { | ||
36 | V4L2_SUBDEV_FORMAT_TRY = 0, | ||
37 | V4L2_SUBDEV_FORMAT_ACTIVE = 1, | ||
38 | }; | ||
39 | |||
40 | /** | ||
41 | * struct v4l2_subdev_format - Pad-level media bus format | ||
42 | * @which: format type (from enum v4l2_subdev_format_whence) | ||
43 | * @pad: pad number, as reported by the media API | ||
44 | * @format: media bus format (format code and frame size) | ||
45 | */ | ||
46 | struct v4l2_subdev_format { | ||
47 | __u32 which; | ||
48 | __u32 pad; | ||
49 | struct v4l2_mbus_framefmt format; | ||
50 | __u32 reserved[8]; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * struct v4l2_subdev_crop - Pad-level crop settings | ||
55 | * @which: format type (from enum v4l2_subdev_format_whence) | ||
56 | * @pad: pad number, as reported by the media API | ||
57 | * @rect: pad crop rectangle boundaries | ||
58 | */ | ||
59 | struct v4l2_subdev_crop { | ||
60 | __u32 which; | ||
61 | __u32 pad; | ||
62 | struct v4l2_rect rect; | ||
63 | __u32 reserved[8]; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration | ||
68 | * @pad: pad number, as reported by the media API | ||
69 | * @index: format index during enumeration | ||
70 | * @code: format code (from enum v4l2_mbus_pixelcode) | ||
71 | */ | ||
72 | struct v4l2_subdev_mbus_code_enum { | ||
73 | __u32 pad; | ||
74 | __u32 index; | ||
75 | __u32 code; | ||
76 | __u32 reserved[9]; | ||
77 | }; | ||
78 | |||
79 | /** | ||
80 | * struct v4l2_subdev_frame_size_enum - Media bus format enumeration | ||
81 | * @pad: pad number, as reported by the media API | ||
82 | * @index: format index during enumeration | ||
83 | * @code: format code (from enum v4l2_mbus_pixelcode) | ||
84 | */ | ||
85 | struct v4l2_subdev_frame_size_enum { | ||
86 | __u32 index; | ||
87 | __u32 pad; | ||
88 | __u32 code; | ||
89 | __u32 min_width; | ||
90 | __u32 max_width; | ||
91 | __u32 min_height; | ||
92 | __u32 max_height; | ||
93 | __u32 reserved[9]; | ||
94 | }; | ||
95 | |||
96 | /** | ||
97 | * struct v4l2_subdev_frame_interval - Pad-level frame rate | ||
98 | * @pad: pad number, as reported by the media API | ||
99 | * @interval: frame interval in seconds | ||
100 | */ | ||
101 | struct v4l2_subdev_frame_interval { | ||
102 | __u32 pad; | ||
103 | struct v4l2_fract interval; | ||
104 | __u32 reserved[9]; | ||
105 | }; | ||
106 | |||
107 | /** | ||
108 | * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration | ||
109 | * @pad: pad number, as reported by the media API | ||
110 | * @index: frame interval index during enumeration | ||
111 | * @code: format code (from enum v4l2_mbus_pixelcode) | ||
112 | * @width: frame width in pixels | ||
113 | * @height: frame height in pixels | ||
114 | * @interval: frame interval in seconds | ||
115 | */ | ||
116 | struct v4l2_subdev_frame_interval_enum { | ||
117 | __u32 index; | ||
118 | __u32 pad; | ||
119 | __u32 code; | ||
120 | __u32 width; | ||
121 | __u32 height; | ||
122 | struct v4l2_fract interval; | ||
123 | __u32 reserved[9]; | ||
124 | }; | ||
125 | |||
126 | #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) | ||
127 | #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) | ||
128 | #define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ | ||
129 | _IOWR('V', 21, struct v4l2_subdev_frame_interval) | ||
130 | #define VIDIOC_SUBDEV_S_FRAME_INTERVAL \ | ||
131 | _IOWR('V', 22, struct v4l2_subdev_frame_interval) | ||
132 | #define VIDIOC_SUBDEV_ENUM_MBUS_CODE \ | ||
133 | _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) | ||
134 | #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ | ||
135 | _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) | ||
136 | #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ | ||
137 | _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) | ||
138 | #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) | ||
139 | #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) | ||
140 | |||
141 | #endif | ||
diff --git a/include/linux/version.h b/include/linux/version.h new file mode 100644 index 00000000000..6afe5dfae5a --- /dev/null +++ b/include/linux/version.h | |||
@@ -0,0 +1,2 @@ | |||
1 | #define LINUX_VERSION_CODE 196874 | ||
2 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
diff --git a/include/linux/veth.h b/include/linux/veth.h new file mode 100644 index 00000000000..3354c1eb424 --- /dev/null +++ b/include/linux/veth.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __NET_VETH_H_ | ||
2 | #define __NET_VETH_H_ | ||
3 | |||
4 | enum { | ||
5 | VETH_INFO_UNSPEC, | ||
6 | VETH_INFO_PEER, | ||
7 | |||
8 | __VETH_INFO_MAX | ||
9 | #define VETH_INFO_MAX (__VETH_INFO_MAX - 1) | ||
10 | }; | ||
11 | |||
12 | #endif | ||
diff --git a/include/linux/vhost.h b/include/linux/vhost.h new file mode 100644 index 00000000000..e847f1e3075 --- /dev/null +++ b/include/linux/vhost.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef _LINUX_VHOST_H | ||
2 | #define _LINUX_VHOST_H | ||
3 | /* Userspace interface for in-kernel virtio accelerators. */ | ||
4 | |||
5 | /* vhost is used to reduce the number of system calls involved in virtio. | ||
6 | * | ||
7 | * Existing virtio net code is used in the guest without modification. | ||
8 | * | ||
9 | * This header includes interface used by userspace hypervisor for | ||
10 | * device configuration. | ||
11 | */ | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/compiler.h> | ||
15 | #include <linux/ioctl.h> | ||
16 | #include <linux/virtio_config.h> | ||
17 | #include <linux/virtio_ring.h> | ||
18 | |||
19 | struct vhost_vring_state { | ||
20 | unsigned int index; | ||
21 | unsigned int num; | ||
22 | }; | ||
23 | |||
24 | struct vhost_vring_file { | ||
25 | unsigned int index; | ||
26 | int fd; /* Pass -1 to unbind from file. */ | ||
27 | |||
28 | }; | ||
29 | |||
30 | struct vhost_vring_addr { | ||
31 | unsigned int index; | ||
32 | /* Option flags. */ | ||
33 | unsigned int flags; | ||
34 | /* Flag values: */ | ||
35 | /* Whether log address is valid. If set enables logging. */ | ||
36 | #define VHOST_VRING_F_LOG 0 | ||
37 | |||
38 | /* Start of array of descriptors (virtually contiguous) */ | ||
39 | __u64 desc_user_addr; | ||
40 | /* Used structure address. Must be 32 bit aligned */ | ||
41 | __u64 used_user_addr; | ||
42 | /* Available structure address. Must be 16 bit aligned */ | ||
43 | __u64 avail_user_addr; | ||
44 | /* Logging support. */ | ||
45 | /* Log writes to used structure, at offset calculated from specified | ||
46 | * address. Address must be 32 bit aligned. */ | ||
47 | __u64 log_guest_addr; | ||
48 | }; | ||
49 | |||
50 | struct vhost_memory_region { | ||
51 | __u64 guest_phys_addr; | ||
52 | __u64 memory_size; /* bytes */ | ||
53 | __u64 userspace_addr; | ||
54 | __u64 flags_padding; /* No flags are currently specified. */ | ||
55 | }; | ||
56 | |||
57 | /* All region addresses and sizes must be 4K aligned. */ | ||
58 | #define VHOST_PAGE_SIZE 0x1000 | ||
59 | |||
60 | struct vhost_memory { | ||
61 | __u32 nregions; | ||
62 | __u32 padding; | ||
63 | struct vhost_memory_region regions[0]; | ||
64 | }; | ||
65 | |||
66 | /* ioctls */ | ||
67 | |||
68 | #define VHOST_VIRTIO 0xAF | ||
69 | |||
70 | /* Features bitmask for forward compatibility. Transport bits are used for | ||
71 | * vhost specific features. */ | ||
72 | #define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64) | ||
73 | #define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64) | ||
74 | |||
75 | /* Set current process as the (exclusive) owner of this file descriptor. This | ||
76 | * must be called before any other vhost command. Further calls to | ||
77 | * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */ | ||
78 | #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01) | ||
79 | /* Give up ownership, and reset the device to default values. | ||
80 | * Allows subsequent call to VHOST_OWNER_SET to succeed. */ | ||
81 | #define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02) | ||
82 | |||
83 | /* Set up/modify memory layout */ | ||
84 | #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory) | ||
85 | |||
86 | /* Write logging setup. */ | ||
87 | /* Memory writes can optionally be logged by setting bit at an offset | ||
88 | * (calculated from the physical address) from specified log base. | ||
89 | * The bit is set using an atomic 32 bit operation. */ | ||
90 | /* Set base address for logging. */ | ||
91 | #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64) | ||
92 | /* Specify an eventfd file descriptor to signal on log write. */ | ||
93 | #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int) | ||
94 | |||
95 | /* Ring setup. */ | ||
96 | /* Set number of descriptors in ring. This parameter can not | ||
97 | * be modified while ring is running (bound to a device). */ | ||
98 | #define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state) | ||
99 | /* Set addresses for the ring. */ | ||
100 | #define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr) | ||
101 | /* Base value where queue looks for available descriptors */ | ||
102 | #define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state) | ||
103 | /* Get accessor: reads index, writes value in num */ | ||
104 | #define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state) | ||
105 | |||
106 | /* The following ioctls use eventfd file descriptors to signal and poll | ||
107 | * for events. */ | ||
108 | |||
109 | /* Set eventfd to poll for added buffers */ | ||
110 | #define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file) | ||
111 | /* Set eventfd to signal when buffers have beed used */ | ||
112 | #define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file) | ||
113 | /* Set eventfd to signal an error */ | ||
114 | #define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file) | ||
115 | |||
116 | /* VHOST_NET specific defines */ | ||
117 | |||
118 | /* Attach virtio net ring to a raw socket, or tap device. | ||
119 | * The socket must be already bound to an ethernet device, this device will be | ||
120 | * used for transmit. Pass fd -1 to unbind from the socket and the transmit | ||
121 | * device. This can be used to stop the ring (e.g. for migration). */ | ||
122 | #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file) | ||
123 | |||
124 | /* Feature bits */ | ||
125 | /* Log all write descriptors. Can be changed while device is active. */ | ||
126 | #define VHOST_F_LOG_ALL 26 | ||
127 | /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ | ||
128 | #define VHOST_NET_F_VIRTIO_NET_HDR 27 | ||
129 | |||
130 | #endif | ||
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h new file mode 100644 index 00000000000..277c4ad44e8 --- /dev/null +++ b/include/linux/virtio_9p.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _LINUX_VIRTIO_9P_H | ||
2 | #define _LINUX_VIRTIO_9P_H | ||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * 3. Neither the name of IBM nor the names of its contributors | ||
15 | * may be used to endorse or promote products derived from this software | ||
16 | * without specific prior written permission. | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE | ||
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
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 | #include <linux/types.h> | ||
29 | #include <linux/virtio_ids.h> | ||
30 | #include <linux/virtio_config.h> | ||
31 | |||
32 | /* The feature bitmap for virtio 9P */ | ||
33 | |||
34 | /* The mount point is specified in a config variable */ | ||
35 | #define VIRTIO_9P_MOUNT_TAG 0 | ||
36 | |||
37 | struct virtio_9p_config { | ||
38 | /* length of the tag name */ | ||
39 | __u16 tag_len; | ||
40 | /* non-NULL terminated tag name */ | ||
41 | __u8 tag[0]; | ||
42 | } __attribute__((packed)); | ||
43 | |||
44 | #endif /* _LINUX_VIRTIO_9P_H */ | ||
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h new file mode 100644 index 00000000000..652dc8bea92 --- /dev/null +++ b/include/linux/virtio_balloon.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _LINUX_VIRTIO_BALLOON_H | ||
2 | #define _LINUX_VIRTIO_BALLOON_H | ||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * 3. Neither the name of IBM nor the names of its contributors | ||
15 | * may be used to endorse or promote products derived from this software | ||
16 | * without specific prior written permission. | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE | ||
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
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 | #include <linux/virtio_ids.h> | ||
29 | #include <linux/virtio_config.h> | ||
30 | |||
31 | /* The feature bitmap for virtio balloon */ | ||
32 | #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ | ||
33 | #define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */ | ||
34 | |||
35 | /* Size of a PFN in the balloon interface. */ | ||
36 | #define VIRTIO_BALLOON_PFN_SHIFT 12 | ||
37 | |||
38 | struct virtio_balloon_config | ||
39 | { | ||
40 | /* Number of pages host wants Guest to give up. */ | ||
41 | __le32 num_pages; | ||
42 | /* Number of pages we've actually got in balloon. */ | ||
43 | __le32 actual; | ||
44 | }; | ||
45 | |||
46 | #define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ | ||
47 | #define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */ | ||
48 | #define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */ | ||
49 | #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ | ||
50 | #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ | ||
51 | #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ | ||
52 | #define VIRTIO_BALLOON_S_NR 6 | ||
53 | |||
54 | struct virtio_balloon_stat { | ||
55 | u16 tag; | ||
56 | u64 val; | ||
57 | } __attribute__((packed)); | ||
58 | |||
59 | #endif /* _LINUX_VIRTIO_BALLOON_H */ | ||
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h new file mode 100644 index 00000000000..e0edb40ca7a --- /dev/null +++ b/include/linux/virtio_blk.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef _LINUX_VIRTIO_BLK_H | ||
2 | #define _LINUX_VIRTIO_BLK_H | ||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * 3. Neither the name of IBM nor the names of its contributors | ||
15 | * may be used to endorse or promote products derived from this software | ||
16 | * without specific prior written permission. | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE | ||
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
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 | #include <linux/types.h> | ||
29 | #include <linux/virtio_ids.h> | ||
30 | #include <linux/virtio_config.h> | ||
31 | |||
32 | /* Feature bits */ | ||
33 | #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ | ||
34 | #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ | ||
35 | #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ | ||
36 | #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ | ||
37 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ | ||
38 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ | ||
39 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ | ||
40 | #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ | ||
41 | #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ | ||
42 | |||
43 | #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ | ||
44 | |||
45 | struct virtio_blk_config { | ||
46 | /* The capacity (in 512-byte sectors). */ | ||
47 | __u64 capacity; | ||
48 | /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ | ||
49 | __u32 size_max; | ||
50 | /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ | ||
51 | __u32 seg_max; | ||
52 | /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ | ||
53 | struct virtio_blk_geometry { | ||
54 | __u16 cylinders; | ||
55 | __u8 heads; | ||
56 | __u8 sectors; | ||
57 | } geometry; | ||
58 | |||
59 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ | ||
60 | __u32 blk_size; | ||
61 | |||
62 | /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ | ||
63 | /* exponent for physical block per logical block. */ | ||
64 | __u8 physical_block_exp; | ||
65 | /* alignment offset in logical blocks. */ | ||
66 | __u8 alignment_offset; | ||
67 | /* minimum I/O size without performance penalty in logical blocks. */ | ||
68 | __u16 min_io_size; | ||
69 | /* optimal sustained I/O size in logical blocks. */ | ||
70 | __u32 opt_io_size; | ||
71 | |||
72 | } __attribute__((packed)); | ||
73 | |||
74 | /* | ||
75 | * Command types | ||
76 | * | ||
77 | * Usage is a bit tricky as some bits are used as flags and some are not. | ||
78 | * | ||
79 | * Rules: | ||
80 | * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or | ||
81 | * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own | ||
82 | * and may not be combined with any of the other flags. | ||
83 | */ | ||
84 | |||
85 | /* These two define direction. */ | ||
86 | #define VIRTIO_BLK_T_IN 0 | ||
87 | #define VIRTIO_BLK_T_OUT 1 | ||
88 | |||
89 | /* This bit says it's a scsi command, not an actual read or write. */ | ||
90 | #define VIRTIO_BLK_T_SCSI_CMD 2 | ||
91 | |||
92 | /* Cache flush command */ | ||
93 | #define VIRTIO_BLK_T_FLUSH 4 | ||
94 | |||
95 | /* Get device ID command */ | ||
96 | #define VIRTIO_BLK_T_GET_ID 8 | ||
97 | |||
98 | /* Barrier before this op. */ | ||
99 | #define VIRTIO_BLK_T_BARRIER 0x80000000 | ||
100 | |||
101 | /* This is the first element of the read scatter-gather list. */ | ||
102 | struct virtio_blk_outhdr { | ||
103 | /* VIRTIO_BLK_T* */ | ||
104 | __u32 type; | ||
105 | /* io priority. */ | ||
106 | __u32 ioprio; | ||
107 | /* Sector (ie. 512 byte offset) */ | ||
108 | __u64 sector; | ||
109 | }; | ||
110 | |||
111 | struct virtio_scsi_inhdr { | ||
112 | __u32 errors; | ||
113 | __u32 data_len; | ||
114 | __u32 sense_len; | ||
115 | __u32 residual; | ||
116 | }; | ||
117 | |||
118 | /* And this is the final byte of the write scatter-gather list. */ | ||
119 | #define VIRTIO_BLK_S_OK 0 | ||
120 | #define VIRTIO_BLK_S_IOERR 1 | ||
121 | #define VIRTIO_BLK_S_UNSUPP 2 | ||
122 | #endif /* _LINUX_VIRTIO_BLK_H */ | ||
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h new file mode 100644 index 00000000000..85bb0bb66ff --- /dev/null +++ b/include/linux/virtio_ids.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef _LINUX_VIRTIO_IDS_H | ||
2 | #define _LINUX_VIRTIO_IDS_H | ||
3 | /* | ||
4 | * Virtio IDs | ||
5 | * | ||
6 | * This header is BSD licensed so anyone can use the definitions to implement | ||
7 | * compatible drivers/servers. | ||
8 | * | ||
9 | * Redistribution and use in source and binary forms, with or without | ||
10 | * modification, are permitted provided that the following conditions | ||
11 | * are met: | ||
12 | * 1. Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * 2. Redistributions in binary form must reproduce the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer in the | ||
16 | * documentation and/or other materials provided with the distribution. | ||
17 | * 3. Neither the name of IBM nor the names of its contributors | ||
18 | * may be used to endorse or promote products derived from this software | ||
19 | * without specific prior written permission. | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
23 | * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE | ||
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
30 | * SUCH DAMAGE. */ | ||
31 | |||
32 | #define VIRTIO_ID_NET 1 /* virtio net */ | ||
33 | #define VIRTIO_ID_BLOCK 2 /* virtio block */ | ||
34 | #define VIRTIO_ID_CONSOLE 3 /* virtio console */ | ||
35 | #define VIRTIO_ID_RNG 4 /* virtio ring */ | ||
36 | #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ | ||
37 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ | ||
38 | |||
39 | #endif /* _LINUX_VIRTIO_IDS_H */ | ||
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h new file mode 100644 index 00000000000..970d5a2a904 --- /dev/null +++ b/include/linux/virtio_net.h | |||
@@ -0,0 +1,155 @@ | |||
1 | #ifndef _LINUX_VIRTIO_NET_H | ||
2 | #define _LINUX_VIRTIO_NET_H | ||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * 3. Neither the name of IBM nor the names of its contributors | ||
15 | * may be used to endorse or promote products derived from this software | ||
16 | * without specific prior written permission. | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE | ||
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
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 | #include <linux/types.h> | ||
29 | #include <linux/virtio_ids.h> | ||
30 | #include <linux/virtio_config.h> | ||
31 | #include <linux/if_ether.h> | ||
32 | |||
33 | /* The feature bitmap for virtio net */ | ||
34 | #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ | ||
35 | #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ | ||
36 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ | ||
37 | #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ | ||
38 | #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ | ||
39 | #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ | ||
40 | #define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ | ||
41 | #define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ | ||
42 | #define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ | ||
43 | #define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ | ||
44 | #define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ | ||
45 | #define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ | ||
46 | #define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ | ||
47 | #define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ | ||
48 | #define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ | ||
49 | #define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ | ||
50 | #define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ | ||
51 | #define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ | ||
52 | |||
53 | #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ | ||
54 | |||
55 | struct virtio_net_config { | ||
56 | /* The config defining mac address (if VIRTIO_NET_F_MAC) */ | ||
57 | __u8 mac[6]; | ||
58 | /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ | ||
59 | __u16 status; | ||
60 | } __attribute__((packed)); | ||
61 | |||
62 | /* This is the first element of the scatter-gather list. If you don't | ||
63 | * specify GSO or CSUM features, you can simply ignore the header. */ | ||
64 | struct virtio_net_hdr { | ||
65 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset | ||
66 | #define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid | ||
67 | __u8 flags; | ||
68 | #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame | ||
69 | #define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) | ||
70 | #define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) | ||
71 | #define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP | ||
72 | #define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set | ||
73 | __u8 gso_type; | ||
74 | __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ | ||
75 | __u16 gso_size; /* Bytes to append to hdr_len per frame */ | ||
76 | __u16 csum_start; /* Position to start checksumming from */ | ||
77 | __u16 csum_offset; /* Offset after that to place checksum */ | ||
78 | }; | ||
79 | |||
80 | /* This is the version of the header to use when the MRG_RXBUF | ||
81 | * feature has been negotiated. */ | ||
82 | struct virtio_net_hdr_mrg_rxbuf { | ||
83 | struct virtio_net_hdr hdr; | ||
84 | __u16 num_buffers; /* Number of merged rx buffers */ | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * Control virtqueue data structures | ||
89 | * | ||
90 | * The control virtqueue expects a header in the first sg entry | ||
91 | * and an ack/status response in the last entry. Data for the | ||
92 | * command goes in between. | ||
93 | */ | ||
94 | struct virtio_net_ctrl_hdr { | ||
95 | __u8 class; | ||
96 | __u8 cmd; | ||
97 | } __attribute__((packed)); | ||
98 | |||
99 | typedef __u8 virtio_net_ctrl_ack; | ||
100 | |||
101 | #define VIRTIO_NET_OK 0 | ||
102 | #define VIRTIO_NET_ERR 1 | ||
103 | |||
104 | /* | ||
105 | * Control the RX mode, ie. promisucous, allmulti, etc... | ||
106 | * All commands require an "out" sg entry containing a 1 byte | ||
107 | * state value, zero = disable, non-zero = enable. Commands | ||
108 | * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature. | ||
109 | * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA. | ||
110 | */ | ||
111 | #define VIRTIO_NET_CTRL_RX 0 | ||
112 | #define VIRTIO_NET_CTRL_RX_PROMISC 0 | ||
113 | #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 | ||
114 | #define VIRTIO_NET_CTRL_RX_ALLUNI 2 | ||
115 | #define VIRTIO_NET_CTRL_RX_NOMULTI 3 | ||
116 | #define VIRTIO_NET_CTRL_RX_NOUNI 4 | ||
117 | #define VIRTIO_NET_CTRL_RX_NOBCAST 5 | ||
118 | |||
119 | /* | ||
120 | * Control the MAC filter table. | ||
121 | * | ||
122 | * The MAC filter table is managed by the hypervisor, the guest should | ||
123 | * assume the size is infinite. Filtering should be considered | ||
124 | * non-perfect, ie. based on hypervisor resources, the guest may | ||
125 | * received packets from sources not specified in the filter list. | ||
126 | * | ||
127 | * In addition to the class/cmd header, the TABLE_SET command requires | ||
128 | * two out scatterlists. Each contains a 4 byte count of entries followed | ||
129 | * by a concatenated byte stream of the ETH_ALEN MAC addresses. The | ||
130 | * first sg list contains unicast addresses, the second is for multicast. | ||
131 | * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature | ||
132 | * is available. | ||
133 | */ | ||
134 | struct virtio_net_ctrl_mac { | ||
135 | __u32 entries; | ||
136 | __u8 macs[][ETH_ALEN]; | ||
137 | } __attribute__((packed)); | ||
138 | |||
139 | #define VIRTIO_NET_CTRL_MAC 1 | ||
140 | #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 | ||
141 | |||
142 | /* | ||
143 | * Control VLAN filtering | ||
144 | * | ||
145 | * The VLAN filter table is controlled via a simple ADD/DEL interface. | ||
146 | * VLAN IDs not added may be filterd by the hypervisor. Del is the | ||
147 | * opposite of add. Both commands expect an out entry containing a 2 | ||
148 | * byte VLAN ID. VLAN filterting is available with the | ||
149 | * VIRTIO_NET_F_CTRL_VLAN feature bit. | ||
150 | */ | ||
151 | #define VIRTIO_NET_CTRL_VLAN 2 | ||
152 | #define VIRTIO_NET_CTRL_VLAN_ADD 0 | ||
153 | #define VIRTIO_NET_CTRL_VLAN_DEL 1 | ||
154 | |||
155 | #endif /* _LINUX_VIRTIO_NET_H */ | ||
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h new file mode 100644 index 00000000000..ea66f3f60d6 --- /dev/null +++ b/include/linux/virtio_pci.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Virtio PCI driver | ||
3 | * | ||
4 | * This module allows virtio devices to be used over a virtual PCI device. | ||
5 | * This can be used with QEMU based VMMs like KVM or Xen. | ||
6 | * | ||
7 | * Copyright IBM Corp. 2007 | ||
8 | * | ||
9 | * Authors: | ||
10 | * Anthony Liguori <aliguori@us.ibm.com> | ||
11 | * | ||
12 | * This header is BSD licensed so anyone can use the definitions to implement | ||
13 | * compatible drivers/servers. | ||
14 | * | ||
15 | * Redistribution and use in source and binary forms, with or without | ||
16 | * modification, are permitted provided that the following conditions | ||
17 | * are met: | ||
18 | * 1. Redistributions of source code must retain the above copyright | ||
19 | * notice, this list of conditions and the following disclaimer. | ||
20 | * 2. Redistributions in binary form must reproduce the above copyright | ||
21 | * notice, this list of conditions and the following disclaimer in the | ||
22 | * documentation and/or other materials provided with the distribution. | ||
23 | * 3. Neither the name of IBM nor the names of its contributors | ||
24 | * may be used to endorse or promote products derived from this software | ||
25 | * without specific prior written permission. | ||
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
29 | * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE | ||
30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
36 | * SUCH DAMAGE. | ||
37 | */ | ||
38 | |||
39 | #ifndef _LINUX_VIRTIO_PCI_H | ||
40 | #define _LINUX_VIRTIO_PCI_H | ||
41 | |||
42 | #include <linux/virtio_config.h> | ||
43 | |||
44 | /* A 32-bit r/o bitmask of the features supported by the host */ | ||
45 | #define VIRTIO_PCI_HOST_FEATURES 0 | ||
46 | |||
47 | /* A 32-bit r/w bitmask of features activated by the guest */ | ||
48 | #define VIRTIO_PCI_GUEST_FEATURES 4 | ||
49 | |||
50 | /* A 32-bit r/w PFN for the currently selected queue */ | ||
51 | #define VIRTIO_PCI_QUEUE_PFN 8 | ||
52 | |||
53 | /* A 16-bit r/o queue size for the currently selected queue */ | ||
54 | #define VIRTIO_PCI_QUEUE_NUM 12 | ||
55 | |||
56 | /* A 16-bit r/w queue selector */ | ||
57 | #define VIRTIO_PCI_QUEUE_SEL 14 | ||
58 | |||
59 | /* A 16-bit r/w queue notifier */ | ||
60 | #define VIRTIO_PCI_QUEUE_NOTIFY 16 | ||
61 | |||
62 | /* An 8-bit device status register. */ | ||
63 | #define VIRTIO_PCI_STATUS 18 | ||
64 | |||
65 | /* An 8-bit r/o interrupt status register. Reading the value will return the | ||
66 | * current contents of the ISR and will also clear it. This is effectively | ||
67 | * a read-and-acknowledge. */ | ||
68 | #define VIRTIO_PCI_ISR 19 | ||
69 | |||
70 | /* The bit of the ISR which indicates a device configuration change. */ | ||
71 | #define VIRTIO_PCI_ISR_CONFIG 0x2 | ||
72 | |||
73 | /* MSI-X registers: only enabled if MSI-X is enabled. */ | ||
74 | /* A 16-bit vector for configuration changes. */ | ||
75 | #define VIRTIO_MSI_CONFIG_VECTOR 20 | ||
76 | /* A 16-bit vector for selected queue notifications. */ | ||
77 | #define VIRTIO_MSI_QUEUE_VECTOR 22 | ||
78 | /* Vector value used to disable MSI for queue */ | ||
79 | #define VIRTIO_MSI_NO_VECTOR 0xffff | ||
80 | |||
81 | /* The remaining space is defined by each driver as the per-driver | ||
82 | * configuration space */ | ||
83 | #define VIRTIO_PCI_CONFIG(dev) ((dev)->msix_enabled ? 24 : 20) | ||
84 | |||
85 | /* Virtio ABI version, this must match exactly */ | ||
86 | #define VIRTIO_PCI_ABI_VERSION 0 | ||
87 | |||
88 | /* How many bits to shift physical queue address written to QUEUE_PFN. | ||
89 | * 12 is historical, and due to x86 page size. */ | ||
90 | #define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 | ||
91 | |||
92 | /* The alignment to use between consumer and producer parts of vring. | ||
93 | * x86 pagesize again. */ | ||
94 | #define VIRTIO_PCI_VRING_ALIGN 4096 | ||
95 | #endif | ||
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h new file mode 100644 index 00000000000..c4d5de896f0 --- /dev/null +++ b/include/linux/virtio_rng.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _LINUX_VIRTIO_RNG_H | ||
2 | #define _LINUX_VIRTIO_RNG_H | ||
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
5 | #include <linux/virtio_ids.h> | ||
6 | #include <linux/virtio_config.h> | ||
7 | |||
8 | #endif /* _LINUX_VIRTIO_RNG_H */ | ||
diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h new file mode 100644 index 00000000000..a096d24ada1 --- /dev/null +++ b/include/linux/wakelock.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* include/linux/wakelock.h | ||
2 | * | ||
3 | * Copyright (C) 2007-2008 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_WAKELOCK_H | ||
17 | #define _LINUX_WAKELOCK_H | ||
18 | |||
19 | #include <linux/list.h> | ||
20 | #include <linux/ktime.h> | ||
21 | |||
22 | /* A wake_lock prevents the system from entering suspend or other low power | ||
23 | * states when active. If the type is set to WAKE_LOCK_SUSPEND, the wake_lock | ||
24 | * prevents a full system suspend. If the type is WAKE_LOCK_IDLE, low power | ||
25 | * states that cause large interrupt latencies or that disable a set of | ||
26 | * interrupts will not entered from idle until the wake_locks are released. | ||
27 | */ | ||
28 | |||
29 | enum { | ||
30 | WAKE_LOCK_SUSPEND, /* Prevent suspend */ | ||
31 | WAKE_LOCK_IDLE, /* Prevent low power idle */ | ||
32 | WAKE_LOCK_TYPE_COUNT | ||
33 | }; | ||
34 | |||
35 | struct wake_lock { | ||
36 | #ifdef CONFIG_HAS_WAKELOCK | ||
37 | struct list_head link; | ||
38 | int flags; | ||
39 | const char *name; | ||
40 | unsigned long expires; | ||
41 | #ifdef CONFIG_WAKELOCK_STAT | ||
42 | struct { | ||
43 | int count; | ||
44 | int expire_count; | ||
45 | int wakeup_count; | ||
46 | ktime_t total_time; | ||
47 | ktime_t prevent_suspend_time; | ||
48 | ktime_t max_time; | ||
49 | ktime_t last_time; | ||
50 | } stat; | ||
51 | #endif | ||
52 | #endif | ||
53 | }; | ||
54 | |||
55 | #ifdef CONFIG_HAS_WAKELOCK | ||
56 | |||
57 | void wake_lock_init(struct wake_lock *lock, int type, const char *name); | ||
58 | void wake_lock_destroy(struct wake_lock *lock); | ||
59 | void wake_lock(struct wake_lock *lock); | ||
60 | void wake_lock_timeout(struct wake_lock *lock, long timeout); | ||
61 | void wake_unlock(struct wake_lock *lock); | ||
62 | |||
63 | /* wake_lock_active returns a non-zero value if the wake_lock is currently | ||
64 | * locked. If the wake_lock has a timeout, it does not check the timeout | ||
65 | * but if the timeout had aready been checked it will return 0. | ||
66 | */ | ||
67 | int wake_lock_active(struct wake_lock *lock); | ||
68 | |||
69 | /* has_wake_lock returns 0 if no wake locks of the specified type are active, | ||
70 | * and non-zero if one or more wake locks are held. Specifically it returns | ||
71 | * -1 if one or more wake locks with no timeout are active or the | ||
72 | * number of jiffies until all active wake locks time out. | ||
73 | */ | ||
74 | long has_wake_lock(int type); | ||
75 | |||
76 | #else | ||
77 | |||
78 | static inline void wake_lock_init(struct wake_lock *lock, int type, | ||
79 | const char *name) {} | ||
80 | static inline void wake_lock_destroy(struct wake_lock *lock) {} | ||
81 | static inline void wake_lock(struct wake_lock *lock) {} | ||
82 | static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) {} | ||
83 | static inline void wake_unlock(struct wake_lock *lock) {} | ||
84 | |||
85 | static inline int wake_lock_active(struct wake_lock *lock) { return 0; } | ||
86 | static inline long has_wake_lock(int type) { return 0; } | ||
87 | |||
88 | #endif | ||
89 | |||
90 | #endif | ||
91 | |||
diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h new file mode 100644 index 00000000000..f07e0679fb8 --- /dev/null +++ b/include/linux/wifi_tiwlan.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* include/linux/wifi_tiwlan.h | ||
2 | * | ||
3 | * Copyright (C) 2008 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | #ifndef _LINUX_WIFI_TIWLAN_H_ | ||
16 | #define _LINUX_WIFI_TIWLAN_H_ | ||
17 | |||
18 | #include <linux/wlan_plat.h> | ||
19 | |||
20 | #define WMPA_NUMBER_OF_SECTIONS 3 | ||
21 | #define WMPA_NUMBER_OF_BUFFERS 160 | ||
22 | #define WMPA_SECTION_HEADER 24 | ||
23 | #define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64) | ||
24 | #define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256) | ||
25 | #define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048) | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/wimax.h b/include/linux/wimax.h new file mode 100644 index 00000000000..9f6b77af2f6 --- /dev/null +++ b/include/linux/wimax.h | |||
@@ -0,0 +1,239 @@ | |||
1 | /* | ||
2 | * Linux WiMax | ||
3 | * API for user space | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * * Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * * Redistributions in binary form must reproduce the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer in | ||
16 | * the documentation and/or other materials provided with the | ||
17 | * distribution. | ||
18 | * * Neither the name of Intel Corporation nor the names of its | ||
19 | * contributors may be used to endorse or promote products derived | ||
20 | * from this software without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | * | ||
34 | * | ||
35 | * Intel Corporation <linux-wimax@intel.com> | ||
36 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
37 | * - Initial implementation | ||
38 | * | ||
39 | * | ||
40 | * This file declares the user/kernel protocol that is spoken over | ||
41 | * Generic Netlink, as well as any type declaration that is to be used | ||
42 | * by kernel and user space. | ||
43 | * | ||
44 | * It is intended for user space to clone it verbatim to use it as a | ||
45 | * primary reference for definitions. | ||
46 | * | ||
47 | * Stuff intended for kernel usage as well as full protocol and stack | ||
48 | * documentation is rooted in include/net/wimax.h. | ||
49 | */ | ||
50 | |||
51 | #ifndef __LINUX__WIMAX_H__ | ||
52 | #define __LINUX__WIMAX_H__ | ||
53 | |||
54 | #include <linux/types.h> | ||
55 | |||
56 | enum { | ||
57 | /** | ||
58 | * Version of the interface (unsigned decimal, MMm, max 25.5) | ||
59 | * M - Major: change if removing or modifying an existing call. | ||
60 | * m - minor: change when adding a new call | ||
61 | */ | ||
62 | WIMAX_GNL_VERSION = 01, | ||
63 | /* Generic NetLink attributes */ | ||
64 | WIMAX_GNL_ATTR_INVALID = 0x00, | ||
65 | WIMAX_GNL_ATTR_MAX = 10, | ||
66 | }; | ||
67 | |||
68 | |||
69 | /* | ||
70 | * Generic NetLink operations | ||
71 | * | ||
72 | * Most of these map to an API call; _OP_ stands for operation, _RP_ | ||
73 | * for reply and _RE_ for report (aka: signal). | ||
74 | */ | ||
75 | enum { | ||
76 | WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */ | ||
77 | WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */ | ||
78 | WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */ | ||
79 | WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */ | ||
80 | WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */ | ||
81 | WIMAX_GNL_OP_STATE_GET, /* Request for current state */ | ||
82 | }; | ||
83 | |||
84 | |||
85 | /* Message from user / to user */ | ||
86 | enum { | ||
87 | WIMAX_GNL_MSG_IFIDX = 1, | ||
88 | WIMAX_GNL_MSG_PIPE_NAME, | ||
89 | WIMAX_GNL_MSG_DATA, | ||
90 | }; | ||
91 | |||
92 | |||
93 | /* | ||
94 | * wimax_rfkill() | ||
95 | * | ||
96 | * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's | ||
97 | * switch state (DISABLED/ENABLED). | ||
98 | */ | ||
99 | enum wimax_rf_state { | ||
100 | WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */ | ||
101 | WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */ | ||
102 | WIMAX_RF_QUERY = 2, | ||
103 | }; | ||
104 | |||
105 | /* Attributes */ | ||
106 | enum { | ||
107 | WIMAX_GNL_RFKILL_IFIDX = 1, | ||
108 | WIMAX_GNL_RFKILL_STATE, | ||
109 | }; | ||
110 | |||
111 | |||
112 | /* Attributes for wimax_reset() */ | ||
113 | enum { | ||
114 | WIMAX_GNL_RESET_IFIDX = 1, | ||
115 | }; | ||
116 | |||
117 | /* Attributes for wimax_state_get() */ | ||
118 | enum { | ||
119 | WIMAX_GNL_STGET_IFIDX = 1, | ||
120 | }; | ||
121 | |||
122 | /* | ||
123 | * Attributes for the Report State Change | ||
124 | * | ||
125 | * For now we just have the old and new states; new attributes might | ||
126 | * be added later on. | ||
127 | */ | ||
128 | enum { | ||
129 | WIMAX_GNL_STCH_IFIDX = 1, | ||
130 | WIMAX_GNL_STCH_STATE_OLD, | ||
131 | WIMAX_GNL_STCH_STATE_NEW, | ||
132 | }; | ||
133 | |||
134 | |||
135 | /** | ||
136 | * enum wimax_st - The different states of a WiMAX device | ||
137 | * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed, | ||
138 | * but still wimax_dev_add() hasn't been called. There is no state. | ||
139 | * | ||
140 | * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and | ||
141 | * networking stacks, but it is not initialized (normally that is | ||
142 | * done with 'ifconfig DEV up' [or equivalent], which can upload | ||
143 | * firmware and enable communications with the device). | ||
144 | * In this state, the device is powered down and using as less | ||
145 | * power as possible. | ||
146 | * This state is the default after a call to wimax_dev_add(). It | ||
147 | * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED | ||
148 | * or %WIMAX_ST_RADIO_OFF in _probe() after the call to | ||
149 | * wimax_dev_add(). | ||
150 | * It is recommended that the driver leaves this state when | ||
151 | * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV | ||
152 | * down'. | ||
153 | * | ||
154 | * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API | ||
155 | * operations are allowed to proceed except the ones needed to | ||
156 | * complete the device clean up process. | ||
157 | * | ||
158 | * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device | ||
159 | * is setup, but the device still requires some configuration | ||
160 | * before being operational. | ||
161 | * Some WiMAX API calls might work. | ||
162 | * | ||
163 | * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether | ||
164 | * by hardware or software switches). | ||
165 | * It is recommended to always leave the device in this state | ||
166 | * after initialization. | ||
167 | * | ||
168 | * @WIMAX_ST_READY: The device is fully up and radio is on. | ||
169 | * | ||
170 | * @WIMAX_ST_SCANNING: [optional] The device has been instructed to | ||
171 | * scan. In this state, the device cannot be actively connected to | ||
172 | * a network. | ||
173 | * | ||
174 | * @WIMAX_ST_CONNECTING: The device is connecting to a network. This | ||
175 | * state exists because in some devices, the connect process can | ||
176 | * include a number of negotiations between user space, kernel | ||
177 | * space and the device. User space needs to know what the device | ||
178 | * is doing. If the connect sequence in a device is atomic and | ||
179 | * fast, the device can transition directly to CONNECTED | ||
180 | * | ||
181 | * @WIMAX_ST_CONNECTED: The device is connected to a network. | ||
182 | * | ||
183 | * @__WIMAX_ST_INVALID: This is an invalid state used to mark the | ||
184 | * maximum numeric value of states. | ||
185 | * | ||
186 | * Description: | ||
187 | * | ||
188 | * Transitions from one state to another one are atomic and can only | ||
189 | * be caused in kernel space with wimax_state_change(). To read the | ||
190 | * state, use wimax_state_get(). | ||
191 | * | ||
192 | * States starting with __ are internal and shall not be used or | ||
193 | * referred to by drivers or userspace. They look ugly, but that's the | ||
194 | * point -- if any use is made non-internal to the stack, it is easier | ||
195 | * to catch on review. | ||
196 | * | ||
197 | * All API operations [with well defined exceptions] will take the | ||
198 | * device mutex before starting and then check the state. If the state | ||
199 | * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or | ||
200 | * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with | ||
201 | * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN. | ||
202 | * | ||
203 | * The order of the definitions is important, so we can do numerical | ||
204 | * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready | ||
205 | * to operate). | ||
206 | */ | ||
207 | /* | ||
208 | * The allowed state transitions are described in the table below | ||
209 | * (states in rows can go to states in columns where there is an X): | ||
210 | * | ||
211 | * UNINI RADIO READY SCAN CONNEC CONNEC | ||
212 | * NULL DOWN QUIESCING TIALIZED OFF NING TING TED | ||
213 | * NULL - x | ||
214 | * DOWN - x x x | ||
215 | * QUIESCING x - | ||
216 | * UNINITIALIZED x - x | ||
217 | * RADIO_OFF x - x | ||
218 | * READY x x - x x x | ||
219 | * SCANNING x x x - x x | ||
220 | * CONNECTING x x x x - x | ||
221 | * CONNECTED x x x - | ||
222 | * | ||
223 | * This table not available in kernel-doc because the formatting messes it up. | ||
224 | */ | ||
225 | enum wimax_st { | ||
226 | __WIMAX_ST_NULL = 0, | ||
227 | WIMAX_ST_DOWN, | ||
228 | __WIMAX_ST_QUIESCING, | ||
229 | WIMAX_ST_UNINITIALIZED, | ||
230 | WIMAX_ST_RADIO_OFF, | ||
231 | WIMAX_ST_READY, | ||
232 | WIMAX_ST_SCANNING, | ||
233 | WIMAX_ST_CONNECTING, | ||
234 | WIMAX_ST_CONNECTED, | ||
235 | __WIMAX_ST_INVALID /* Always keep last */ | ||
236 | }; | ||
237 | |||
238 | |||
239 | #endif /* #ifndef __LINUX__WIMAX_H__ */ | ||
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild new file mode 100644 index 00000000000..3cb4f269bb0 --- /dev/null +++ b/include/linux/wimax/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += i2400m.h | |||
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h new file mode 100644 index 00000000000..62d35615356 --- /dev/null +++ b/include/linux/wimax/i2400m.h | |||
@@ -0,0 +1,572 @@ | |||
1 | /* | ||
2 | * Intel Wireless WiMax Connection 2400m | ||
3 | * Host-Device protocol interface definitions | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * * Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * * Redistributions in binary form must reproduce the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer in | ||
16 | * the documentation and/or other materials provided with the | ||
17 | * distribution. | ||
18 | * * Neither the name of Intel Corporation nor the names of its | ||
19 | * contributors may be used to endorse or promote products derived | ||
20 | * from this software without specific prior written permission. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | * | ||
34 | * | ||
35 | * Intel Corporation <linux-wimax@intel.com> | ||
36 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
37 | * - Initial implementation | ||
38 | * | ||
39 | * | ||
40 | * This header defines the data structures and constants used to | ||
41 | * communicate with the device. | ||
42 | * | ||
43 | * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL | ||
44 | * | ||
45 | * The firmware upload protocol is quite simple and only requires a | ||
46 | * handful of commands. See drivers/net/wimax/i2400m/fw.c for more | ||
47 | * details. | ||
48 | * | ||
49 | * The BCF data structure is for the firmware file header. | ||
50 | * | ||
51 | * | ||
52 | * THE DATA / CONTROL PROTOCOL | ||
53 | * | ||
54 | * This is the normal protocol spoken with the device once the | ||
55 | * firmware is uploaded. It transports data payloads and control | ||
56 | * messages back and forth. | ||
57 | * | ||
58 | * It consists 'messages' that pack one or more payloads each. The | ||
59 | * format is described in detail in drivers/net/wimax/i2400m/rx.c and | ||
60 | * tx.c. | ||
61 | * | ||
62 | * | ||
63 | * THE L3L4 PROTOCOL | ||
64 | * | ||
65 | * The term L3L4 refers to Layer 3 (the device), Layer 4 (the | ||
66 | * driver/host software). | ||
67 | * | ||
68 | * This is the control protocol used by the host to control the i2400m | ||
69 | * device (scan, connect, disconnect...). This is sent to / received | ||
70 | * as control frames. These frames consist of a header and zero or | ||
71 | * more TLVs with information. We call each control frame a "message". | ||
72 | * | ||
73 | * Each message is composed of: | ||
74 | * | ||
75 | * HEADER | ||
76 | * [TLV0 + PAYLOAD0] | ||
77 | * [TLV1 + PAYLOAD1] | ||
78 | * [...] | ||
79 | * [TLVN + PAYLOADN] | ||
80 | * | ||
81 | * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are | ||
82 | * defined by a TLV structure (Type Length Value) which is a 'header' | ||
83 | * (struct i2400m_tlv_hdr) and then the payload. | ||
84 | * | ||
85 | * All integers are represented as Little Endian. | ||
86 | * | ||
87 | * - REQUESTS AND EVENTS | ||
88 | * | ||
89 | * The requests can be clasified as follows: | ||
90 | * | ||
91 | * COMMAND: implies a request from the host to the device requesting | ||
92 | * an action being performed. The device will reply with a | ||
93 | * message (with the same type as the command), status and | ||
94 | * no (TLV) payload. Execution of a command might cause | ||
95 | * events (of different type) to be sent later on as | ||
96 | * device's state changes. | ||
97 | * | ||
98 | * GET/SET: similar to COMMAND, but will not cause other | ||
99 | * EVENTs. The reply, in the case of GET, will contain | ||
100 | * TLVs with the requested information. | ||
101 | * | ||
102 | * EVENT: asynchronous messages sent from the device, maybe as a | ||
103 | * consequence of previous COMMANDs but disassociated from | ||
104 | * them. | ||
105 | * | ||
106 | * Only one request might be pending at the same time (ie: don't | ||
107 | * parallelize nor post another GET request before the previous | ||
108 | * COMMAND has been acknowledged with it's corresponding reply by the | ||
109 | * device). | ||
110 | * | ||
111 | * The different requests and their formats are described below: | ||
112 | * | ||
113 | * I2400M_MT_* Message types | ||
114 | * I2400M_MS_* Message status (for replies, events) | ||
115 | * i2400m_tlv_* TLVs | ||
116 | * | ||
117 | * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the | ||
118 | * operation. | ||
119 | */ | ||
120 | |||
121 | #ifndef __LINUX__WIMAX__I2400M_H__ | ||
122 | #define __LINUX__WIMAX__I2400M_H__ | ||
123 | |||
124 | #include <linux/types.h> | ||
125 | |||
126 | |||
127 | /* | ||
128 | * Host Device Interface (HDI) common to all busses | ||
129 | */ | ||
130 | |||
131 | /* Boot-mode (firmware upload mode) commands */ | ||
132 | |||
133 | /* Header for the firmware file */ | ||
134 | struct i2400m_bcf_hdr { | ||
135 | __le32 module_type; | ||
136 | __le32 header_len; | ||
137 | __le32 header_version; | ||
138 | __le32 module_id; | ||
139 | __le32 module_vendor; | ||
140 | __le32 date; /* BCD YYYMMDD */ | ||
141 | __le32 size; /* in dwords */ | ||
142 | __le32 key_size; /* in dwords */ | ||
143 | __le32 modulus_size; /* in dwords */ | ||
144 | __le32 exponent_size; /* in dwords */ | ||
145 | __u8 reserved[88]; | ||
146 | } __attribute__ ((packed)); | ||
147 | |||
148 | /* Boot mode opcodes */ | ||
149 | enum i2400m_brh_opcode { | ||
150 | I2400M_BRH_READ = 1, | ||
151 | I2400M_BRH_WRITE = 2, | ||
152 | I2400M_BRH_JUMP = 3, | ||
153 | I2400M_BRH_SIGNED_JUMP = 8, | ||
154 | I2400M_BRH_HASH_PAYLOAD_ONLY = 9, | ||
155 | }; | ||
156 | |||
157 | /* Boot mode command masks and stuff */ | ||
158 | enum i2400m_brh { | ||
159 | I2400M_BRH_SIGNATURE = 0xcbbc0000, | ||
160 | I2400M_BRH_SIGNATURE_MASK = 0xffff0000, | ||
161 | I2400M_BRH_SIGNATURE_SHIFT = 16, | ||
162 | I2400M_BRH_OPCODE_MASK = 0x0000000f, | ||
163 | I2400M_BRH_RESPONSE_MASK = 0x000000f0, | ||
164 | I2400M_BRH_RESPONSE_SHIFT = 4, | ||
165 | I2400M_BRH_DIRECT_ACCESS = 0x00000400, | ||
166 | I2400M_BRH_RESPONSE_REQUIRED = 0x00000200, | ||
167 | I2400M_BRH_USE_CHECKSUM = 0x00000100, | ||
168 | }; | ||
169 | |||
170 | |||
171 | /** | ||
172 | * i2400m_bootrom_header - Header for a boot-mode command | ||
173 | * | ||
174 | * @cmd: the above command descriptor | ||
175 | * @target_addr: where on the device memory should the action be performed. | ||
176 | * @data_size: for read/write, amount of data to be read/written | ||
177 | * @block_checksum: checksum value (if applicable) | ||
178 | * @payload: the beginning of data attached to this header | ||
179 | */ | ||
180 | struct i2400m_bootrom_header { | ||
181 | __le32 command; /* Compose with enum i2400_brh */ | ||
182 | __le32 target_addr; | ||
183 | __le32 data_size; | ||
184 | __le32 block_checksum; | ||
185 | char payload[0]; | ||
186 | } __attribute__ ((packed)); | ||
187 | |||
188 | |||
189 | /* | ||
190 | * Data / control protocol | ||
191 | */ | ||
192 | |||
193 | /* Packet types for the host-device interface */ | ||
194 | enum i2400m_pt { | ||
195 | I2400M_PT_DATA = 0, | ||
196 | I2400M_PT_CTRL, | ||
197 | I2400M_PT_TRACE, /* For device debug */ | ||
198 | I2400M_PT_RESET_WARM, /* device reset */ | ||
199 | I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */ | ||
200 | I2400M_PT_EDATA, /* Extended RX data */ | ||
201 | I2400M_PT_ILLEGAL | ||
202 | }; | ||
203 | |||
204 | |||
205 | /* | ||
206 | * Payload for a data packet | ||
207 | * | ||
208 | * This is prefixed to each and every outgoing DATA type. | ||
209 | */ | ||
210 | struct i2400m_pl_data_hdr { | ||
211 | __le32 reserved; | ||
212 | } __attribute__((packed)); | ||
213 | |||
214 | |||
215 | /* | ||
216 | * Payload for an extended data packet | ||
217 | * | ||
218 | * New in fw v1.4 | ||
219 | * | ||
220 | * @reorder: if this payload has to be reorder or not (and how) | ||
221 | * @cs: the type of data in the packet, as defined per (802.16e | ||
222 | * T11.13.19.1). Currently only 2 (IPv4 packet) supported. | ||
223 | * | ||
224 | * This is prefixed to each and every INCOMING DATA packet. | ||
225 | */ | ||
226 | struct i2400m_pl_edata_hdr { | ||
227 | __le32 reorder; /* bits defined in i2400m_ro */ | ||
228 | __u8 cs; | ||
229 | __u8 reserved[11]; | ||
230 | } __attribute__((packed)); | ||
231 | |||
232 | enum i2400m_cs { | ||
233 | I2400M_CS_IPV4_0 = 0, | ||
234 | I2400M_CS_IPV4 = 2, | ||
235 | }; | ||
236 | |||
237 | enum i2400m_ro { | ||
238 | I2400M_RO_NEEDED = 0x01, | ||
239 | I2400M_RO_TYPE = 0x03, | ||
240 | I2400M_RO_TYPE_SHIFT = 1, | ||
241 | I2400M_RO_CIN = 0x0f, | ||
242 | I2400M_RO_CIN_SHIFT = 4, | ||
243 | I2400M_RO_FBN = 0x07ff, | ||
244 | I2400M_RO_FBN_SHIFT = 8, | ||
245 | I2400M_RO_SN = 0x07ff, | ||
246 | I2400M_RO_SN_SHIFT = 21, | ||
247 | }; | ||
248 | |||
249 | enum i2400m_ro_type { | ||
250 | I2400M_RO_TYPE_RESET = 0, | ||
251 | I2400M_RO_TYPE_PACKET, | ||
252 | I2400M_RO_TYPE_WS, | ||
253 | I2400M_RO_TYPE_PACKET_WS, | ||
254 | }; | ||
255 | |||
256 | |||
257 | /* Misc constants */ | ||
258 | enum { | ||
259 | I2400M_PL_ALIGN = 16, /* Payload data size alignment */ | ||
260 | I2400M_PL_SIZE_MAX = 0x3EFF, | ||
261 | I2400M_MAX_PLS_IN_MSG = 60, | ||
262 | /* protocol barkers: sync sequences; for notifications they | ||
263 | * are sent in groups of four. */ | ||
264 | I2400M_H2D_PREVIEW_BARKER = 0xcafe900d, | ||
265 | I2400M_COLD_RESET_BARKER = 0xc01dc01d, | ||
266 | I2400M_WARM_RESET_BARKER = 0x50f750f7, | ||
267 | I2400M_NBOOT_BARKER = 0xdeadbeef, | ||
268 | I2400M_SBOOT_BARKER = 0x0ff1c1a1, | ||
269 | I2400M_SBOOT_BARKER_6050 = 0x80000001, | ||
270 | I2400M_ACK_BARKER = 0xfeedbabe, | ||
271 | I2400M_D2H_MSG_BARKER = 0xbeefbabe, | ||
272 | }; | ||
273 | |||
274 | |||
275 | /* | ||
276 | * Hardware payload descriptor | ||
277 | * | ||
278 | * Bitfields encoded in a struct to enforce typing semantics. | ||
279 | * | ||
280 | * Look in rx.c and tx.c for a full description of the format. | ||
281 | */ | ||
282 | struct i2400m_pld { | ||
283 | __le32 val; | ||
284 | } __attribute__ ((packed)); | ||
285 | |||
286 | #define I2400M_PLD_SIZE_MASK 0x00003fff | ||
287 | #define I2400M_PLD_TYPE_SHIFT 16 | ||
288 | #define I2400M_PLD_TYPE_MASK 0x000f0000 | ||
289 | |||
290 | /* | ||
291 | * Header for a TX message or RX message | ||
292 | * | ||
293 | * @barker: preamble | ||
294 | * @size: used for management of the FIFO queue buffer; before | ||
295 | * sending, this is converted to be a real preamble. This | ||
296 | * indicates the real size of the TX message that starts at this | ||
297 | * point. If the highest bit is set, then this message is to be | ||
298 | * skipped. | ||
299 | * @sequence: sequence number of this message | ||
300 | * @offset: offset where the message itself starts -- see the comments | ||
301 | * in the file header about message header and payload descriptor | ||
302 | * alignment. | ||
303 | * @num_pls: number of payloads in this message | ||
304 | * @padding: amount of padding bytes at the end of the message to make | ||
305 | * it be of block-size aligned | ||
306 | * | ||
307 | * Look in rx.c and tx.c for a full description of the format. | ||
308 | */ | ||
309 | struct i2400m_msg_hdr { | ||
310 | union { | ||
311 | __le32 barker; | ||
312 | __u32 size; /* same size type as barker!! */ | ||
313 | }; | ||
314 | union { | ||
315 | __le32 sequence; | ||
316 | __u32 offset; /* same size type as barker!! */ | ||
317 | }; | ||
318 | __le16 num_pls; | ||
319 | __le16 rsv1; | ||
320 | __le16 padding; | ||
321 | __le16 rsv2; | ||
322 | struct i2400m_pld pld[0]; | ||
323 | } __attribute__ ((packed)); | ||
324 | |||
325 | |||
326 | |||
327 | /* | ||
328 | * L3/L4 control protocol | ||
329 | */ | ||
330 | |||
331 | enum { | ||
332 | /* Interface version */ | ||
333 | I2400M_L3L4_VERSION = 0x0100, | ||
334 | }; | ||
335 | |||
336 | /* Message types */ | ||
337 | enum i2400m_mt { | ||
338 | I2400M_MT_RESERVED = 0x0000, | ||
339 | I2400M_MT_INVALID = 0xffff, | ||
340 | I2400M_MT_REPORT_MASK = 0x8000, | ||
341 | |||
342 | I2400M_MT_GET_SCAN_RESULT = 0x4202, | ||
343 | I2400M_MT_SET_SCAN_PARAM = 0x4402, | ||
344 | I2400M_MT_CMD_RF_CONTROL = 0x4602, | ||
345 | I2400M_MT_CMD_SCAN = 0x4603, | ||
346 | I2400M_MT_CMD_CONNECT = 0x4604, | ||
347 | I2400M_MT_CMD_DISCONNECT = 0x4605, | ||
348 | I2400M_MT_CMD_EXIT_IDLE = 0x4606, | ||
349 | I2400M_MT_GET_LM_VERSION = 0x5201, | ||
350 | I2400M_MT_GET_DEVICE_INFO = 0x5202, | ||
351 | I2400M_MT_GET_LINK_STATUS = 0x5203, | ||
352 | I2400M_MT_GET_STATISTICS = 0x5204, | ||
353 | I2400M_MT_GET_STATE = 0x5205, | ||
354 | I2400M_MT_GET_MEDIA_STATUS = 0x5206, | ||
355 | I2400M_MT_SET_INIT_CONFIG = 0x5404, | ||
356 | I2400M_MT_CMD_INIT = 0x5601, | ||
357 | I2400M_MT_CMD_TERMINATE = 0x5602, | ||
358 | I2400M_MT_CMD_MODE_OF_OP = 0x5603, | ||
359 | I2400M_MT_CMD_RESET_DEVICE = 0x5604, | ||
360 | I2400M_MT_CMD_MONITOR_CONTROL = 0x5605, | ||
361 | I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606, | ||
362 | I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201, | ||
363 | I2400M_MT_SET_EAP_SUCCESS = 0x6402, | ||
364 | I2400M_MT_SET_EAP_FAIL = 0x6403, | ||
365 | I2400M_MT_SET_EAP_KEY = 0x6404, | ||
366 | I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602, | ||
367 | I2400M_MT_REPORT_SCAN_RESULT = 0xc002, | ||
368 | I2400M_MT_REPORT_STATE = 0xd002, | ||
369 | I2400M_MT_REPORT_POWERSAVE_READY = 0xd005, | ||
370 | I2400M_MT_REPORT_EAP_REQUEST = 0xe002, | ||
371 | I2400M_MT_REPORT_EAP_RESTART = 0xe003, | ||
372 | I2400M_MT_REPORT_ALT_ACCEPT = 0xe004, | ||
373 | I2400M_MT_REPORT_KEY_REQUEST = 0xe005, | ||
374 | }; | ||
375 | |||
376 | |||
377 | /* | ||
378 | * Message Ack Status codes | ||
379 | * | ||
380 | * When a message is replied-to, this status is reported. | ||
381 | */ | ||
382 | enum i2400m_ms { | ||
383 | I2400M_MS_DONE_OK = 0, | ||
384 | I2400M_MS_DONE_IN_PROGRESS = 1, | ||
385 | I2400M_MS_INVALID_OP = 2, | ||
386 | I2400M_MS_BAD_STATE = 3, | ||
387 | I2400M_MS_ILLEGAL_VALUE = 4, | ||
388 | I2400M_MS_MISSING_PARAMS = 5, | ||
389 | I2400M_MS_VERSION_ERROR = 6, | ||
390 | I2400M_MS_ACCESSIBILITY_ERROR = 7, | ||
391 | I2400M_MS_BUSY = 8, | ||
392 | I2400M_MS_CORRUPTED_TLV = 9, | ||
393 | I2400M_MS_UNINITIALIZED = 10, | ||
394 | I2400M_MS_UNKNOWN_ERROR = 11, | ||
395 | I2400M_MS_PRODUCTION_ERROR = 12, | ||
396 | I2400M_MS_NO_RF = 13, | ||
397 | I2400M_MS_NOT_READY_FOR_POWERSAVE = 14, | ||
398 | I2400M_MS_THERMAL_CRITICAL = 15, | ||
399 | I2400M_MS_MAX | ||
400 | }; | ||
401 | |||
402 | |||
403 | /** | ||
404 | * i2400m_tlv - enumeration of the different types of TLVs | ||
405 | * | ||
406 | * TLVs stand for type-length-value and are the header for a payload | ||
407 | * composed of almost anything. Each payload has a type assigned | ||
408 | * and a length. | ||
409 | */ | ||
410 | enum i2400m_tlv { | ||
411 | I2400M_TLV_L4_MESSAGE_VERSIONS = 129, | ||
412 | I2400M_TLV_SYSTEM_STATE = 141, | ||
413 | I2400M_TLV_MEDIA_STATUS = 161, | ||
414 | I2400M_TLV_RF_OPERATION = 162, | ||
415 | I2400M_TLV_RF_STATUS = 163, | ||
416 | I2400M_TLV_DEVICE_RESET_TYPE = 132, | ||
417 | I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601, | ||
418 | I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611, | ||
419 | I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614, | ||
420 | I2400M_TLV_CONFIG_DL_HOST_REORDER = 615, | ||
421 | }; | ||
422 | |||
423 | |||
424 | struct i2400m_tlv_hdr { | ||
425 | __le16 type; | ||
426 | __le16 length; /* payload's */ | ||
427 | __u8 pl[0]; | ||
428 | } __attribute__((packed)); | ||
429 | |||
430 | |||
431 | struct i2400m_l3l4_hdr { | ||
432 | __le16 type; | ||
433 | __le16 length; /* payload's */ | ||
434 | __le16 version; | ||
435 | __le16 resv1; | ||
436 | __le16 status; | ||
437 | __le16 resv2; | ||
438 | struct i2400m_tlv_hdr pl[0]; | ||
439 | } __attribute__((packed)); | ||
440 | |||
441 | |||
442 | /** | ||
443 | * i2400m_system_state - different states of the device | ||
444 | */ | ||
445 | enum i2400m_system_state { | ||
446 | I2400M_SS_UNINITIALIZED = 1, | ||
447 | I2400M_SS_INIT, | ||
448 | I2400M_SS_READY, | ||
449 | I2400M_SS_SCAN, | ||
450 | I2400M_SS_STANDBY, | ||
451 | I2400M_SS_CONNECTING, | ||
452 | I2400M_SS_WIMAX_CONNECTED, | ||
453 | I2400M_SS_DATA_PATH_CONNECTED, | ||
454 | I2400M_SS_IDLE, | ||
455 | I2400M_SS_DISCONNECTING, | ||
456 | I2400M_SS_OUT_OF_ZONE, | ||
457 | I2400M_SS_SLEEPACTIVE, | ||
458 | I2400M_SS_PRODUCTION, | ||
459 | I2400M_SS_CONFIG, | ||
460 | I2400M_SS_RF_OFF, | ||
461 | I2400M_SS_RF_SHUTDOWN, | ||
462 | I2400M_SS_DEVICE_DISCONNECT, | ||
463 | I2400M_SS_MAX, | ||
464 | }; | ||
465 | |||
466 | |||
467 | /** | ||
468 | * i2400m_tlv_system_state - report on the state of the system | ||
469 | * | ||
470 | * @state: see enum i2400m_system_state | ||
471 | */ | ||
472 | struct i2400m_tlv_system_state { | ||
473 | struct i2400m_tlv_hdr hdr; | ||
474 | __le32 state; | ||
475 | } __attribute__((packed)); | ||
476 | |||
477 | |||
478 | struct i2400m_tlv_l4_message_versions { | ||
479 | struct i2400m_tlv_hdr hdr; | ||
480 | __le16 major; | ||
481 | __le16 minor; | ||
482 | __le16 branch; | ||
483 | __le16 reserved; | ||
484 | } __attribute__((packed)); | ||
485 | |||
486 | |||
487 | struct i2400m_tlv_detailed_device_info { | ||
488 | struct i2400m_tlv_hdr hdr; | ||
489 | __u8 reserved1[400]; | ||
490 | __u8 mac_address[6]; | ||
491 | __u8 reserved2[2]; | ||
492 | } __attribute__((packed)); | ||
493 | |||
494 | |||
495 | enum i2400m_rf_switch_status { | ||
496 | I2400M_RF_SWITCH_ON = 1, | ||
497 | I2400M_RF_SWITCH_OFF = 2, | ||
498 | }; | ||
499 | |||
500 | struct i2400m_tlv_rf_switches_status { | ||
501 | struct i2400m_tlv_hdr hdr; | ||
502 | __u8 sw_rf_switch; /* 1 ON, 2 OFF */ | ||
503 | __u8 hw_rf_switch; /* 1 ON, 2 OFF */ | ||
504 | __u8 reserved[2]; | ||
505 | } __attribute__((packed)); | ||
506 | |||
507 | |||
508 | enum { | ||
509 | i2400m_rf_operation_on = 1, | ||
510 | i2400m_rf_operation_off = 2 | ||
511 | }; | ||
512 | |||
513 | struct i2400m_tlv_rf_operation { | ||
514 | struct i2400m_tlv_hdr hdr; | ||
515 | __le32 status; /* 1 ON, 2 OFF */ | ||
516 | } __attribute__((packed)); | ||
517 | |||
518 | |||
519 | enum i2400m_tlv_reset_type { | ||
520 | I2400M_RESET_TYPE_COLD = 1, | ||
521 | I2400M_RESET_TYPE_WARM | ||
522 | }; | ||
523 | |||
524 | struct i2400m_tlv_device_reset_type { | ||
525 | struct i2400m_tlv_hdr hdr; | ||
526 | __le32 reset_type; | ||
527 | } __attribute__((packed)); | ||
528 | |||
529 | |||
530 | struct i2400m_tlv_config_idle_parameters { | ||
531 | struct i2400m_tlv_hdr hdr; | ||
532 | __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments | ||
533 | * 0 disabled */ | ||
534 | __le32 idle_paging_interval; /* frames */ | ||
535 | } __attribute__((packed)); | ||
536 | |||
537 | |||
538 | enum i2400m_media_status { | ||
539 | I2400M_MEDIA_STATUS_LINK_UP = 1, | ||
540 | I2400M_MEDIA_STATUS_LINK_DOWN, | ||
541 | I2400M_MEDIA_STATUS_LINK_RENEW, | ||
542 | }; | ||
543 | |||
544 | struct i2400m_tlv_media_status { | ||
545 | struct i2400m_tlv_hdr hdr; | ||
546 | __le32 media_status; | ||
547 | } __attribute__((packed)); | ||
548 | |||
549 | |||
550 | /* New in v1.4 */ | ||
551 | struct i2400m_tlv_config_idle_timeout { | ||
552 | struct i2400m_tlv_hdr hdr; | ||
553 | __le32 timeout; /* 100 to 300000 ms [5min], 100 increments | ||
554 | * 0 disabled */ | ||
555 | } __attribute__((packed)); | ||
556 | |||
557 | /* New in v1.4 -- for backward compat, will be removed */ | ||
558 | struct i2400m_tlv_config_d2h_data_format { | ||
559 | struct i2400m_tlv_hdr hdr; | ||
560 | __u8 format; /* 0 old format, 1 enhanced */ | ||
561 | __u8 reserved[3]; | ||
562 | } __attribute__((packed)); | ||
563 | |||
564 | /* New in v1.4 */ | ||
565 | struct i2400m_tlv_config_dl_host_reorder { | ||
566 | struct i2400m_tlv_hdr hdr; | ||
567 | __u8 reorder; /* 0 disabled, 1 enabled */ | ||
568 | __u8 reserved[3]; | ||
569 | } __attribute__((packed)); | ||
570 | |||
571 | |||
572 | #endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */ | ||
diff --git a/include/linux/wl127x-rfkill.h b/include/linux/wl127x-rfkill.h new file mode 100644 index 00000000000..9057ec63d5d --- /dev/null +++ b/include/linux/wl127x-rfkill.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Bluetooth TI wl127x rfkill power control via GPIO | ||
3 | * | ||
4 | * Copyright (C) 2009 Motorola, Inc. | ||
5 | * Copyright (C) 2008 Texas Instruments | ||
6 | * Initial code: Pavan Savoy <pavan.savoy@gmail.com> (wl127x_power.c) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _LINUX_WL127X_RFKILL_H | ||
25 | #define _LINUX_WL127X_RFKILL_H | ||
26 | |||
27 | #include <linux/rfkill.h> | ||
28 | |||
29 | struct wl127x_rfkill_platform_data { | ||
30 | int nshutdown_gpio; | ||
31 | |||
32 | struct rfkill *rfkill; /* for driver only */ | ||
33 | }; | ||
34 | |||
35 | #endif | ||
diff --git a/include/linux/wlan_plat.h b/include/linux/wlan_plat.h new file mode 100644 index 00000000000..40ec3482d1e --- /dev/null +++ b/include/linux/wlan_plat.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* include/linux/wlan_plat.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | #ifndef _LINUX_WLAN_PLAT_H_ | ||
16 | #define _LINUX_WLAN_PLAT_H_ | ||
17 | |||
18 | struct wifi_platform_data { | ||
19 | int (*set_power)(int val); | ||
20 | int (*set_reset)(int val); | ||
21 | int (*set_carddetect)(int val); | ||
22 | void *(*mem_prealloc)(int section, unsigned long size); | ||
23 | int (*get_mac_addr)(unsigned char *buf); | ||
24 | void *(*get_country_code)(char *ccode); | ||
25 | }; | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/x25.h b/include/linux/x25.h new file mode 100644 index 00000000000..6450a7f1207 --- /dev/null +++ b/include/linux/x25.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * These are the public elements of the Linux kernel X.25 implementation. | ||
3 | * | ||
4 | * History | ||
5 | * mar/20/00 Daniela Squassoni Disabling/enabling of facilities | ||
6 | * negotiation. | ||
7 | * apr/02/05 Shaun Pereira Selective sub address matching with | ||
8 | * call user data | ||
9 | */ | ||
10 | |||
11 | #ifndef X25_KERNEL_H | ||
12 | #define X25_KERNEL_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | #define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) | ||
17 | #define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) | ||
18 | #define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) | ||
19 | #define SIOCX25SFACILITIES (SIOCPROTOPRIVATE + 3) | ||
20 | #define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) | ||
21 | #define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) | ||
22 | #define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) | ||
23 | #define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) | ||
24 | #define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) | ||
25 | #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) | ||
26 | #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) | ||
27 | #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) | ||
28 | #define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12) | ||
29 | |||
30 | /* | ||
31 | * Values for {get,set}sockopt. | ||
32 | */ | ||
33 | #define X25_QBITINCL 1 | ||
34 | |||
35 | /* | ||
36 | * X.25 Packet Size values. | ||
37 | */ | ||
38 | #define X25_PS16 4 | ||
39 | #define X25_PS32 5 | ||
40 | #define X25_PS64 6 | ||
41 | #define X25_PS128 7 | ||
42 | #define X25_PS256 8 | ||
43 | #define X25_PS512 9 | ||
44 | #define X25_PS1024 10 | ||
45 | #define X25_PS2048 11 | ||
46 | #define X25_PS4096 12 | ||
47 | |||
48 | /* | ||
49 | * An X.121 address, it is held as ASCII text, null terminated, up to 15 | ||
50 | * digits and a null terminator. | ||
51 | */ | ||
52 | struct x25_address { | ||
53 | char x25_addr[16]; | ||
54 | }; | ||
55 | |||
56 | /* | ||
57 | * Linux X.25 Address structure, used for bind, and connect mostly. | ||
58 | */ | ||
59 | struct sockaddr_x25 { | ||
60 | sa_family_t sx25_family; /* Must be AF_X25 */ | ||
61 | struct x25_address sx25_addr; /* X.121 Address */ | ||
62 | }; | ||
63 | |||
64 | /* | ||
65 | * DTE/DCE subscription options. | ||
66 | * | ||
67 | * As this is missing lots of options, user should expect major | ||
68 | * changes of this structure in 2.5.x which might break compatibilty. | ||
69 | * The somewhat ugly dimension 200-sizeof() is needed to maintain | ||
70 | * backward compatibility. | ||
71 | */ | ||
72 | struct x25_subscrip_struct { | ||
73 | char device[200-sizeof(unsigned long)]; | ||
74 | unsigned long global_facil_mask; /* 0 to disable negotiation */ | ||
75 | unsigned int extended; | ||
76 | }; | ||
77 | |||
78 | /* values for above global_facil_mask */ | ||
79 | |||
80 | #define X25_MASK_REVERSE 0x01 | ||
81 | #define X25_MASK_THROUGHPUT 0x02 | ||
82 | #define X25_MASK_PACKET_SIZE 0x04 | ||
83 | #define X25_MASK_WINDOW_SIZE 0x08 | ||
84 | |||
85 | #define X25_MASK_CALLING_AE 0x10 | ||
86 | #define X25_MASK_CALLED_AE 0x20 | ||
87 | |||
88 | |||
89 | /* | ||
90 | * Routing table control structure. | ||
91 | */ | ||
92 | struct x25_route_struct { | ||
93 | struct x25_address address; | ||
94 | unsigned int sigdigits; | ||
95 | char device[200]; | ||
96 | }; | ||
97 | |||
98 | /* | ||
99 | * Facilities structure. | ||
100 | */ | ||
101 | struct x25_facilities { | ||
102 | unsigned int winsize_in, winsize_out; | ||
103 | unsigned int pacsize_in, pacsize_out; | ||
104 | unsigned int throughput; | ||
105 | unsigned int reverse; | ||
106 | }; | ||
107 | |||
108 | /* | ||
109 | * ITU DTE facilities | ||
110 | * Only the called and calling address | ||
111 | * extension are currently implemented. | ||
112 | * The rest are in place to avoid the struct | ||
113 | * changing size if someone needs them later | ||
114 | */ | ||
115 | |||
116 | struct x25_dte_facilities { | ||
117 | __u16 delay_cumul; | ||
118 | __u16 delay_target; | ||
119 | __u16 delay_max; | ||
120 | __u8 min_throughput; | ||
121 | __u8 expedited; | ||
122 | __u8 calling_len; | ||
123 | __u8 called_len; | ||
124 | __u8 calling_ae[20]; | ||
125 | __u8 called_ae[20]; | ||
126 | }; | ||
127 | |||
128 | /* | ||
129 | * Call User Data structure. | ||
130 | */ | ||
131 | struct x25_calluserdata { | ||
132 | unsigned int cudlength; | ||
133 | unsigned char cuddata[128]; | ||
134 | }; | ||
135 | |||
136 | /* | ||
137 | * Call clearing Cause and Diagnostic structure. | ||
138 | */ | ||
139 | struct x25_causediag { | ||
140 | unsigned char cause; | ||
141 | unsigned char diagnostic; | ||
142 | }; | ||
143 | |||
144 | /* | ||
145 | * Further optional call user data match length selection | ||
146 | */ | ||
147 | struct x25_subaddr { | ||
148 | unsigned int cudmatchlength; | ||
149 | }; | ||
150 | |||
151 | #endif | ||
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h new file mode 100644 index 00000000000..22e61fdf75a --- /dev/null +++ b/include/linux/xfrm.h | |||
@@ -0,0 +1,504 @@ | |||
1 | #ifndef _LINUX_XFRM_H | ||
2 | #define _LINUX_XFRM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* All of the structures in this file may not change size as they are | ||
7 | * passed into the kernel from userspace via netlink sockets. | ||
8 | */ | ||
9 | |||
10 | /* Structure to encapsulate addresses. I do not want to use | ||
11 | * "standard" structure. My apologies. | ||
12 | */ | ||
13 | typedef union { | ||
14 | __be32 a4; | ||
15 | __be32 a6[4]; | ||
16 | } xfrm_address_t; | ||
17 | |||
18 | /* Ident of a specific xfrm_state. It is used on input to lookup | ||
19 | * the state by (spi,daddr,ah/esp) or to store information about | ||
20 | * spi, protocol and tunnel address on output. | ||
21 | */ | ||
22 | struct xfrm_id { | ||
23 | xfrm_address_t daddr; | ||
24 | __be32 spi; | ||
25 | __u8 proto; | ||
26 | }; | ||
27 | |||
28 | struct xfrm_sec_ctx { | ||
29 | __u8 ctx_doi; | ||
30 | __u8 ctx_alg; | ||
31 | __u16 ctx_len; | ||
32 | __u32 ctx_sid; | ||
33 | char ctx_str[0]; | ||
34 | }; | ||
35 | |||
36 | /* Security Context Domains of Interpretation */ | ||
37 | #define XFRM_SC_DOI_RESERVED 0 | ||
38 | #define XFRM_SC_DOI_LSM 1 | ||
39 | |||
40 | /* Security Context Algorithms */ | ||
41 | #define XFRM_SC_ALG_RESERVED 0 | ||
42 | #define XFRM_SC_ALG_SELINUX 1 | ||
43 | |||
44 | /* Selector, used as selector both on policy rules (SPD) and SAs. */ | ||
45 | |||
46 | struct xfrm_selector { | ||
47 | xfrm_address_t daddr; | ||
48 | xfrm_address_t saddr; | ||
49 | __be16 dport; | ||
50 | __be16 dport_mask; | ||
51 | __be16 sport; | ||
52 | __be16 sport_mask; | ||
53 | __u16 family; | ||
54 | __u8 prefixlen_d; | ||
55 | __u8 prefixlen_s; | ||
56 | __u8 proto; | ||
57 | int ifindex; | ||
58 | __kernel_uid32_t user; | ||
59 | }; | ||
60 | |||
61 | #define XFRM_INF (~(__u64)0) | ||
62 | |||
63 | struct xfrm_lifetime_cfg { | ||
64 | __u64 soft_byte_limit; | ||
65 | __u64 hard_byte_limit; | ||
66 | __u64 soft_packet_limit; | ||
67 | __u64 hard_packet_limit; | ||
68 | __u64 soft_add_expires_seconds; | ||
69 | __u64 hard_add_expires_seconds; | ||
70 | __u64 soft_use_expires_seconds; | ||
71 | __u64 hard_use_expires_seconds; | ||
72 | }; | ||
73 | |||
74 | struct xfrm_lifetime_cur { | ||
75 | __u64 bytes; | ||
76 | __u64 packets; | ||
77 | __u64 add_time; | ||
78 | __u64 use_time; | ||
79 | }; | ||
80 | |||
81 | struct xfrm_replay_state { | ||
82 | __u32 oseq; | ||
83 | __u32 seq; | ||
84 | __u32 bitmap; | ||
85 | }; | ||
86 | |||
87 | struct xfrm_replay_state_esn { | ||
88 | unsigned int bmp_len; | ||
89 | __u32 oseq; | ||
90 | __u32 seq; | ||
91 | __u32 oseq_hi; | ||
92 | __u32 seq_hi; | ||
93 | __u32 replay_window; | ||
94 | __u32 bmp[0]; | ||
95 | }; | ||
96 | |||
97 | struct xfrm_algo { | ||
98 | char alg_name[64]; | ||
99 | unsigned int alg_key_len; /* in bits */ | ||
100 | char alg_key[0]; | ||
101 | }; | ||
102 | |||
103 | struct xfrm_algo_auth { | ||
104 | char alg_name[64]; | ||
105 | unsigned int alg_key_len; /* in bits */ | ||
106 | unsigned int alg_trunc_len; /* in bits */ | ||
107 | char alg_key[0]; | ||
108 | }; | ||
109 | |||
110 | struct xfrm_algo_aead { | ||
111 | char alg_name[64]; | ||
112 | unsigned int alg_key_len; /* in bits */ | ||
113 | unsigned int alg_icv_len; /* in bits */ | ||
114 | char alg_key[0]; | ||
115 | }; | ||
116 | |||
117 | struct xfrm_stats { | ||
118 | __u32 replay_window; | ||
119 | __u32 replay; | ||
120 | __u32 integrity_failed; | ||
121 | }; | ||
122 | |||
123 | enum { | ||
124 | XFRM_POLICY_TYPE_MAIN = 0, | ||
125 | XFRM_POLICY_TYPE_SUB = 1, | ||
126 | XFRM_POLICY_TYPE_MAX = 2, | ||
127 | XFRM_POLICY_TYPE_ANY = 255 | ||
128 | }; | ||
129 | |||
130 | enum { | ||
131 | XFRM_POLICY_IN = 0, | ||
132 | XFRM_POLICY_OUT = 1, | ||
133 | XFRM_POLICY_FWD = 2, | ||
134 | XFRM_POLICY_MASK = 3, | ||
135 | XFRM_POLICY_MAX = 3 | ||
136 | }; | ||
137 | |||
138 | enum { | ||
139 | XFRM_SHARE_ANY, /* No limitations */ | ||
140 | XFRM_SHARE_SESSION, /* For this session only */ | ||
141 | XFRM_SHARE_USER, /* For this user only */ | ||
142 | XFRM_SHARE_UNIQUE /* Use once */ | ||
143 | }; | ||
144 | |||
145 | #define XFRM_MODE_TRANSPORT 0 | ||
146 | #define XFRM_MODE_TUNNEL 1 | ||
147 | #define XFRM_MODE_ROUTEOPTIMIZATION 2 | ||
148 | #define XFRM_MODE_IN_TRIGGER 3 | ||
149 | #define XFRM_MODE_BEET 4 | ||
150 | #define XFRM_MODE_MAX 5 | ||
151 | |||
152 | /* Netlink configuration messages. */ | ||
153 | enum { | ||
154 | XFRM_MSG_BASE = 0x10, | ||
155 | |||
156 | XFRM_MSG_NEWSA = 0x10, | ||
157 | #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA | ||
158 | XFRM_MSG_DELSA, | ||
159 | #define XFRM_MSG_DELSA XFRM_MSG_DELSA | ||
160 | XFRM_MSG_GETSA, | ||
161 | #define XFRM_MSG_GETSA XFRM_MSG_GETSA | ||
162 | |||
163 | XFRM_MSG_NEWPOLICY, | ||
164 | #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY | ||
165 | XFRM_MSG_DELPOLICY, | ||
166 | #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY | ||
167 | XFRM_MSG_GETPOLICY, | ||
168 | #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY | ||
169 | |||
170 | XFRM_MSG_ALLOCSPI, | ||
171 | #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI | ||
172 | XFRM_MSG_ACQUIRE, | ||
173 | #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE | ||
174 | XFRM_MSG_EXPIRE, | ||
175 | #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE | ||
176 | |||
177 | XFRM_MSG_UPDPOLICY, | ||
178 | #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY | ||
179 | XFRM_MSG_UPDSA, | ||
180 | #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA | ||
181 | |||
182 | XFRM_MSG_POLEXPIRE, | ||
183 | #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE | ||
184 | |||
185 | XFRM_MSG_FLUSHSA, | ||
186 | #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA | ||
187 | XFRM_MSG_FLUSHPOLICY, | ||
188 | #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY | ||
189 | |||
190 | XFRM_MSG_NEWAE, | ||
191 | #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE | ||
192 | XFRM_MSG_GETAE, | ||
193 | #define XFRM_MSG_GETAE XFRM_MSG_GETAE | ||
194 | |||
195 | XFRM_MSG_REPORT, | ||
196 | #define XFRM_MSG_REPORT XFRM_MSG_REPORT | ||
197 | |||
198 | XFRM_MSG_MIGRATE, | ||
199 | #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE | ||
200 | |||
201 | XFRM_MSG_NEWSADINFO, | ||
202 | #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO | ||
203 | XFRM_MSG_GETSADINFO, | ||
204 | #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO | ||
205 | |||
206 | XFRM_MSG_NEWSPDINFO, | ||
207 | #define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO | ||
208 | XFRM_MSG_GETSPDINFO, | ||
209 | #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO | ||
210 | |||
211 | XFRM_MSG_MAPPING, | ||
212 | #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING | ||
213 | __XFRM_MSG_MAX | ||
214 | }; | ||
215 | #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) | ||
216 | |||
217 | #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) | ||
218 | |||
219 | /* | ||
220 | * Generic LSM security context for comunicating to user space | ||
221 | * NOTE: Same format as sadb_x_sec_ctx | ||
222 | */ | ||
223 | struct xfrm_user_sec_ctx { | ||
224 | __u16 len; | ||
225 | __u16 exttype; | ||
226 | __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ | ||
227 | __u8 ctx_doi; | ||
228 | __u16 ctx_len; | ||
229 | }; | ||
230 | |||
231 | struct xfrm_user_tmpl { | ||
232 | struct xfrm_id id; | ||
233 | __u16 family; | ||
234 | xfrm_address_t saddr; | ||
235 | __u32 reqid; | ||
236 | __u8 mode; | ||
237 | __u8 share; | ||
238 | __u8 optional; | ||
239 | __u32 aalgos; | ||
240 | __u32 ealgos; | ||
241 | __u32 calgos; | ||
242 | }; | ||
243 | |||
244 | struct xfrm_encap_tmpl { | ||
245 | __u16 encap_type; | ||
246 | __be16 encap_sport; | ||
247 | __be16 encap_dport; | ||
248 | xfrm_address_t encap_oa; | ||
249 | }; | ||
250 | |||
251 | /* AEVENT flags */ | ||
252 | enum xfrm_ae_ftype_t { | ||
253 | XFRM_AE_UNSPEC, | ||
254 | XFRM_AE_RTHR=1, /* replay threshold*/ | ||
255 | XFRM_AE_RVAL=2, /* replay value */ | ||
256 | XFRM_AE_LVAL=4, /* lifetime value */ | ||
257 | XFRM_AE_ETHR=8, /* expiry timer threshold */ | ||
258 | XFRM_AE_CR=16, /* Event cause is replay update */ | ||
259 | XFRM_AE_CE=32, /* Event cause is timer expiry */ | ||
260 | XFRM_AE_CU=64, /* Event cause is policy update */ | ||
261 | __XFRM_AE_MAX | ||
262 | |||
263 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) | ||
264 | }; | ||
265 | |||
266 | struct xfrm_userpolicy_type { | ||
267 | __u8 type; | ||
268 | __u16 reserved1; | ||
269 | __u8 reserved2; | ||
270 | }; | ||
271 | |||
272 | /* Netlink message attributes. */ | ||
273 | enum xfrm_attr_type_t { | ||
274 | XFRMA_UNSPEC, | ||
275 | XFRMA_ALG_AUTH, /* struct xfrm_algo */ | ||
276 | XFRMA_ALG_CRYPT, /* struct xfrm_algo */ | ||
277 | XFRMA_ALG_COMP, /* struct xfrm_algo */ | ||
278 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ | ||
279 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ | ||
280 | XFRMA_SA, /* struct xfrm_usersa_info */ | ||
281 | XFRMA_POLICY, /*struct xfrm_userpolicy_info */ | ||
282 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ | ||
283 | XFRMA_LTIME_VAL, | ||
284 | XFRMA_REPLAY_VAL, | ||
285 | XFRMA_REPLAY_THRESH, | ||
286 | XFRMA_ETIMER_THRESH, | ||
287 | XFRMA_SRCADDR, /* xfrm_address_t */ | ||
288 | XFRMA_COADDR, /* xfrm_address_t */ | ||
289 | XFRMA_LASTUSED, /* unsigned long */ | ||
290 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ | ||
291 | XFRMA_MIGRATE, | ||
292 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ | ||
293 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ | ||
294 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ | ||
295 | XFRMA_MARK, /* struct xfrm_mark */ | ||
296 | XFRMA_TFCPAD, /* __u32 */ | ||
297 | XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ | ||
298 | __XFRMA_MAX | ||
299 | |||
300 | #define XFRMA_MAX (__XFRMA_MAX - 1) | ||
301 | }; | ||
302 | |||
303 | struct xfrm_mark { | ||
304 | __u32 v; /* value */ | ||
305 | __u32 m; /* mask */ | ||
306 | }; | ||
307 | |||
308 | enum xfrm_sadattr_type_t { | ||
309 | XFRMA_SAD_UNSPEC, | ||
310 | XFRMA_SAD_CNT, | ||
311 | XFRMA_SAD_HINFO, | ||
312 | __XFRMA_SAD_MAX | ||
313 | |||
314 | #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) | ||
315 | }; | ||
316 | |||
317 | struct xfrmu_sadhinfo { | ||
318 | __u32 sadhcnt; /* current hash bkts */ | ||
319 | __u32 sadhmcnt; /* max allowed hash bkts */ | ||
320 | }; | ||
321 | |||
322 | enum xfrm_spdattr_type_t { | ||
323 | XFRMA_SPD_UNSPEC, | ||
324 | XFRMA_SPD_INFO, | ||
325 | XFRMA_SPD_HINFO, | ||
326 | __XFRMA_SPD_MAX | ||
327 | |||
328 | #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) | ||
329 | }; | ||
330 | |||
331 | struct xfrmu_spdinfo { | ||
332 | __u32 incnt; | ||
333 | __u32 outcnt; | ||
334 | __u32 fwdcnt; | ||
335 | __u32 inscnt; | ||
336 | __u32 outscnt; | ||
337 | __u32 fwdscnt; | ||
338 | }; | ||
339 | |||
340 | struct xfrmu_spdhinfo { | ||
341 | __u32 spdhcnt; | ||
342 | __u32 spdhmcnt; | ||
343 | }; | ||
344 | |||
345 | struct xfrm_usersa_info { | ||
346 | struct xfrm_selector sel; | ||
347 | struct xfrm_id id; | ||
348 | xfrm_address_t saddr; | ||
349 | struct xfrm_lifetime_cfg lft; | ||
350 | struct xfrm_lifetime_cur curlft; | ||
351 | struct xfrm_stats stats; | ||
352 | __u32 seq; | ||
353 | __u32 reqid; | ||
354 | __u16 family; | ||
355 | __u8 mode; /* XFRM_MODE_xxx */ | ||
356 | __u8 replay_window; | ||
357 | __u8 flags; | ||
358 | #define XFRM_STATE_NOECN 1 | ||
359 | #define XFRM_STATE_DECAP_DSCP 2 | ||
360 | #define XFRM_STATE_NOPMTUDISC 4 | ||
361 | #define XFRM_STATE_WILDRECV 8 | ||
362 | #define XFRM_STATE_ICMP 16 | ||
363 | #define XFRM_STATE_AF_UNSPEC 32 | ||
364 | #define XFRM_STATE_ALIGN4 64 | ||
365 | #define XFRM_STATE_ESN 128 | ||
366 | }; | ||
367 | |||
368 | struct xfrm_usersa_id { | ||
369 | xfrm_address_t daddr; | ||
370 | __be32 spi; | ||
371 | __u16 family; | ||
372 | __u8 proto; | ||
373 | }; | ||
374 | |||
375 | struct xfrm_aevent_id { | ||
376 | struct xfrm_usersa_id sa_id; | ||
377 | xfrm_address_t saddr; | ||
378 | __u32 flags; | ||
379 | __u32 reqid; | ||
380 | }; | ||
381 | |||
382 | struct xfrm_userspi_info { | ||
383 | struct xfrm_usersa_info info; | ||
384 | __u32 min; | ||
385 | __u32 max; | ||
386 | }; | ||
387 | |||
388 | struct xfrm_userpolicy_info { | ||
389 | struct xfrm_selector sel; | ||
390 | struct xfrm_lifetime_cfg lft; | ||
391 | struct xfrm_lifetime_cur curlft; | ||
392 | __u32 priority; | ||
393 | __u32 index; | ||
394 | __u8 dir; | ||
395 | __u8 action; | ||
396 | #define XFRM_POLICY_ALLOW 0 | ||
397 | #define XFRM_POLICY_BLOCK 1 | ||
398 | __u8 flags; | ||
399 | #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ | ||
400 | /* Automatically expand selector to include matching ICMP payloads. */ | ||
401 | #define XFRM_POLICY_ICMP 2 | ||
402 | __u8 share; | ||
403 | }; | ||
404 | |||
405 | struct xfrm_userpolicy_id { | ||
406 | struct xfrm_selector sel; | ||
407 | __u32 index; | ||
408 | __u8 dir; | ||
409 | }; | ||
410 | |||
411 | struct xfrm_user_acquire { | ||
412 | struct xfrm_id id; | ||
413 | xfrm_address_t saddr; | ||
414 | struct xfrm_selector sel; | ||
415 | struct xfrm_userpolicy_info policy; | ||
416 | __u32 aalgos; | ||
417 | __u32 ealgos; | ||
418 | __u32 calgos; | ||
419 | __u32 seq; | ||
420 | }; | ||
421 | |||
422 | struct xfrm_user_expire { | ||
423 | struct xfrm_usersa_info state; | ||
424 | __u8 hard; | ||
425 | }; | ||
426 | |||
427 | struct xfrm_user_polexpire { | ||
428 | struct xfrm_userpolicy_info pol; | ||
429 | __u8 hard; | ||
430 | }; | ||
431 | |||
432 | struct xfrm_usersa_flush { | ||
433 | __u8 proto; | ||
434 | }; | ||
435 | |||
436 | struct xfrm_user_report { | ||
437 | __u8 proto; | ||
438 | struct xfrm_selector sel; | ||
439 | }; | ||
440 | |||
441 | /* Used by MIGRATE to pass addresses IKE should use to perform | ||
442 | * SA negotiation with the peer */ | ||
443 | struct xfrm_user_kmaddress { | ||
444 | xfrm_address_t local; | ||
445 | xfrm_address_t remote; | ||
446 | __u32 reserved; | ||
447 | __u16 family; | ||
448 | }; | ||
449 | |||
450 | struct xfrm_user_migrate { | ||
451 | xfrm_address_t old_daddr; | ||
452 | xfrm_address_t old_saddr; | ||
453 | xfrm_address_t new_daddr; | ||
454 | xfrm_address_t new_saddr; | ||
455 | __u8 proto; | ||
456 | __u8 mode; | ||
457 | __u16 reserved; | ||
458 | __u32 reqid; | ||
459 | __u16 old_family; | ||
460 | __u16 new_family; | ||
461 | }; | ||
462 | |||
463 | struct xfrm_user_mapping { | ||
464 | struct xfrm_usersa_id id; | ||
465 | __u32 reqid; | ||
466 | xfrm_address_t old_saddr; | ||
467 | xfrm_address_t new_saddr; | ||
468 | __be16 old_sport; | ||
469 | __be16 new_sport; | ||
470 | }; | ||
471 | |||
472 | #ifndef __KERNEL__ | ||
473 | /* backwards compatibility for userspace */ | ||
474 | #define XFRMGRP_ACQUIRE 1 | ||
475 | #define XFRMGRP_EXPIRE 2 | ||
476 | #define XFRMGRP_SA 4 | ||
477 | #define XFRMGRP_POLICY 8 | ||
478 | #define XFRMGRP_REPORT 0x20 | ||
479 | #endif | ||
480 | |||
481 | enum xfrm_nlgroups { | ||
482 | XFRMNLGRP_NONE, | ||
483 | #define XFRMNLGRP_NONE XFRMNLGRP_NONE | ||
484 | XFRMNLGRP_ACQUIRE, | ||
485 | #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE | ||
486 | XFRMNLGRP_EXPIRE, | ||
487 | #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE | ||
488 | XFRMNLGRP_SA, | ||
489 | #define XFRMNLGRP_SA XFRMNLGRP_SA | ||
490 | XFRMNLGRP_POLICY, | ||
491 | #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY | ||
492 | XFRMNLGRP_AEVENTS, | ||
493 | #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS | ||
494 | XFRMNLGRP_REPORT, | ||
495 | #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT | ||
496 | XFRMNLGRP_MIGRATE, | ||
497 | #define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE | ||
498 | XFRMNLGRP_MAPPING, | ||
499 | #define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING | ||
500 | __XFRMNLGRP_MAX | ||
501 | }; | ||
502 | #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) | ||
503 | |||
504 | #endif /* _LINUX_XFRM_H */ | ||