OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [ia64/] [ia32/] [ia32_ioctl.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * IA32 Architecture-specific ioctl shim code
3
 *
4
 * Copyright (C) 2000 VA Linux Co
5
 * Copyright (C) 2000 Don Dugger <n0ano@valinux.com>
6
 * Copyright (C) 2001 Hewlett-Packard Co
7
 *      David Mosberger-Tang <davidm@hpl.hp.com>
8
 */
9
 
10
#include <linux/types.h>
11
#include <linux/dirent.h>
12
#include <linux/msdos_fs.h>
13
#include <linux/mtio.h>
14
#include <linux/ncp_fs.h>
15
#include <linux/capi.h>
16
#include <linux/videodev.h>
17
#include <linux/synclink.h>
18
#include <linux/atmdev.h>
19
#include <linux/atm_eni.h>
20
#include <linux/atm_nicstar.h>
21
#include <linux/atm_zatm.h>
22
#include <linux/atm_idt77105.h>
23
#include <linux/ppp_defs.h>
24
#include <linux/if_ppp.h>
25
#include <linux/ixjuser.h>
26
#include <linux/i2o-dev.h>
27
 
28
#include <asm/ia32.h>
29
 
30
#include <../drivers/char/drm/drm.h>
31
 
32
 
33
#define IOCTL_NR(a)     ((a) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT))
34
 
35
#define DO_IOCTL(fd, cmd, arg) ({                       \
36
        int _ret;                                       \
37
        mm_segment_t _old_fs = get_fs();                \
38
                                                        \
39
        set_fs(KERNEL_DS);                              \
40
        _ret = sys_ioctl(fd, cmd, (unsigned long)arg);  \
41
        set_fs(_old_fs);                                \
42
        _ret;                                           \
43
})
44
 
45
#define P(i)    ((void *)(unsigned long)(i))
46
 
47
asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
48
 
49
static long
50
put_dirent32 (struct dirent *d, struct linux32_dirent *d32)
51
{
52
        size_t namelen = strlen(d->d_name);
53
 
54
        return (put_user(d->d_ino, &d32->d_ino)
55
                || put_user(d->d_off, &d32->d_off)
56
                || put_user(d->d_reclen, &d32->d_reclen)
57
                || copy_to_user(d32->d_name, d->d_name, namelen + 1));
58
}
59
 
60
asmlinkage long
61
sys32_ioctl (unsigned int fd, unsigned int cmd, unsigned int arg)
62
{
63
        long ret;
64
 
65
        switch (IOCTL_NR(cmd)) {
66
              case IOCTL_NR(VFAT_IOCTL_READDIR_SHORT):
67
              case IOCTL_NR(VFAT_IOCTL_READDIR_BOTH): {
68
                      struct linux32_dirent *d32 = P(arg);
69
                      struct dirent d[2];
70
 
71
                      ret = DO_IOCTL(fd, _IOR('r', _IOC_NR(cmd),
72
                                              struct dirent [2]),
73
                                     (unsigned long) d);
74
                      if (ret < 0)
75
                          return ret;
76
 
77
                      if (put_dirent32(d, d32) || put_dirent32(d + 1, d32 + 1))
78
                          return -EFAULT;
79
 
80
                      return ret;
81
              }
82
                case IOCTL_NR(SIOCGIFCONF):
83
                {
84
                        struct ifconf32 {
85
                                int             ifc_len;
86
                                unsigned int    ifc_ptr;
87
                        } ifconf32;
88
                        struct ifconf ifconf;
89
                        int i, n;
90
                        char *p32, *p64;
91
                        char buf[32];   /* sizeof IA32 ifreq structure */
92
 
93
                        if (copy_from_user(&ifconf32, P(arg), sizeof(ifconf32)))
94
                                return -EFAULT;
95
                        ifconf.ifc_len = ifconf32.ifc_len;
96
                        ifconf.ifc_req = P(ifconf32.ifc_ptr);
97
                        ret = DO_IOCTL(fd, SIOCGIFCONF, &ifconf);
98
                        ifconf32.ifc_len = ifconf.ifc_len;
99
                        if (copy_to_user(P(arg), &ifconf32, sizeof(ifconf32)))
100
                                return -EFAULT;
101
                        n = ifconf.ifc_len / sizeof(struct ifreq);
102
                        p32 = P(ifconf32.ifc_ptr);
103
                        p64 = P(ifconf32.ifc_ptr);
104
                        for (i = 0; i < n; i++) {
105
                                if (copy_from_user(buf, p64, sizeof(struct ifreq)))
106
                                        return -EFAULT;
107
                                if (copy_to_user(p32, buf, sizeof(buf)))
108
                                        return -EFAULT;
109
                                p32 += sizeof(buf);
110
                                p64 += sizeof(struct ifreq);
111
                        }
112
                        return ret;
113
                }
114
 
115
              case IOCTL_NR(DRM_IOCTL_VERSION):
116
              {
117
                      drm_version_t ver;
118
                      struct {
119
                              int       version_major;
120
                              int       version_minor;
121
                              int       version_patchlevel;
122
                              unsigned int name_len;
123
                              unsigned int name; /* pointer */
124
                              unsigned int date_len;
125
                              unsigned int date; /* pointer */
126
                              unsigned int desc_len;
127
                              unsigned int desc; /* pointer */
128
                      } ver32;
129
 
130
                      if (copy_from_user(&ver32, P(arg), sizeof(ver32)))
131
                              return -EFAULT;
132
                      ver.name_len = ver32.name_len;
133
                      ver.name = P(ver32.name);
134
                      ver.date_len = ver32.date_len;
135
                      ver.date = P(ver32.date);
136
                      ver.desc_len = ver32.desc_len;
137
                      ver.desc = P(ver32.desc);
138
                      ret = DO_IOCTL(fd, DRM_IOCTL_VERSION, &ver);
139
                      if (ret >= 0) {
140
                              ver32.version_major = ver.version_major;
141
                              ver32.version_minor = ver.version_minor;
142
                              ver32.version_patchlevel = ver.version_patchlevel;
143
                              ver32.name_len = ver.name_len;
144
                              ver32.date_len = ver.date_len;
145
                              ver32.desc_len = ver.desc_len;
146
                              if (copy_to_user(P(arg), &ver32, sizeof(ver32)))
147
                                      return -EFAULT;
148
                      }
149
                      return ret;
150
              }
151
 
152
              case IOCTL_NR(DRM_IOCTL_GET_UNIQUE):
153
              {
154
                      drm_unique_t un;
155
                      struct {
156
                              unsigned int unique_len;
157
                              unsigned int unique;
158
                      } un32;
159
 
160
                      if (copy_from_user(&un32, P(arg), sizeof(un32)))
161
                              return -EFAULT;
162
                      un.unique_len = un32.unique_len;
163
                      un.unique = P(un32.unique);
164
                      ret = DO_IOCTL(fd, DRM_IOCTL_GET_UNIQUE, &un);
165
                      if (ret >= 0) {
166
                              un32.unique_len = un.unique_len;
167
                              if (copy_to_user(P(arg), &un32, sizeof(un32)))
168
                                      return -EFAULT;
169
                      }
170
                      return ret;
171
              }
172
              case IOCTL_NR(DRM_IOCTL_SET_UNIQUE):
173
              case IOCTL_NR(DRM_IOCTL_ADD_MAP):
174
              case IOCTL_NR(DRM_IOCTL_ADD_BUFS):
175
              case IOCTL_NR(DRM_IOCTL_MARK_BUFS):
176
              case IOCTL_NR(DRM_IOCTL_INFO_BUFS):
177
              case IOCTL_NR(DRM_IOCTL_MAP_BUFS):
178
              case IOCTL_NR(DRM_IOCTL_FREE_BUFS):
179
              case IOCTL_NR(DRM_IOCTL_ADD_CTX):
180
              case IOCTL_NR(DRM_IOCTL_RM_CTX):
181
              case IOCTL_NR(DRM_IOCTL_MOD_CTX):
182
              case IOCTL_NR(DRM_IOCTL_GET_CTX):
183
              case IOCTL_NR(DRM_IOCTL_SWITCH_CTX):
184
              case IOCTL_NR(DRM_IOCTL_NEW_CTX):
185
              case IOCTL_NR(DRM_IOCTL_RES_CTX):
186
 
187
              case IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE):
188
              case IOCTL_NR(DRM_IOCTL_AGP_RELEASE):
189
              case IOCTL_NR(DRM_IOCTL_AGP_ENABLE):
190
              case IOCTL_NR(DRM_IOCTL_AGP_INFO):
191
              case IOCTL_NR(DRM_IOCTL_AGP_ALLOC):
192
              case IOCTL_NR(DRM_IOCTL_AGP_FREE):
193
              case IOCTL_NR(DRM_IOCTL_AGP_BIND):
194
              case IOCTL_NR(DRM_IOCTL_AGP_UNBIND):
195
 
196
                /* Mga specific ioctls */
197
 
198
              case IOCTL_NR(DRM_IOCTL_MGA_INIT):
199
 
200
                /* I810 specific ioctls */
201
 
202
              case IOCTL_NR(DRM_IOCTL_I810_GETBUF):
203
              case IOCTL_NR(DRM_IOCTL_I810_COPY):
204
 
205
              case IOCTL_NR(MTIOCGET):
206
              case IOCTL_NR(MTIOCPOS):
207
              case IOCTL_NR(MTIOCGETCONFIG):
208
              case IOCTL_NR(MTIOCSETCONFIG):
209
              case IOCTL_NR(PPPIOCSCOMPRESS):
210
              case IOCTL_NR(PPPIOCGIDLE):
211
              case IOCTL_NR(NCP_IOC_GET_FS_INFO_V2):
212
              case IOCTL_NR(NCP_IOC_GETOBJECTNAME):
213
              case IOCTL_NR(NCP_IOC_SETOBJECTNAME):
214
              case IOCTL_NR(NCP_IOC_GETPRIVATEDATA):
215
              case IOCTL_NR(NCP_IOC_SETPRIVATEDATA):
216
              case IOCTL_NR(NCP_IOC_GETMOUNTUID2):
217
              case IOCTL_NR(CAPI_MANUFACTURER_CMD):
218
              case IOCTL_NR(VIDIOCGTUNER):
219
              case IOCTL_NR(VIDIOCSTUNER):
220
              case IOCTL_NR(VIDIOCGWIN):
221
              case IOCTL_NR(VIDIOCSWIN):
222
              case IOCTL_NR(VIDIOCGFBUF):
223
              case IOCTL_NR(VIDIOCSFBUF):
224
              case IOCTL_NR(MGSL_IOCSPARAMS):
225
              case IOCTL_NR(MGSL_IOCGPARAMS):
226
              case IOCTL_NR(ATM_GETNAMES):
227
              case IOCTL_NR(ATM_GETLINKRATE):
228
              case IOCTL_NR(ATM_GETTYPE):
229
              case IOCTL_NR(ATM_GETESI):
230
              case IOCTL_NR(ATM_GETADDR):
231
              case IOCTL_NR(ATM_RSTADDR):
232
              case IOCTL_NR(ATM_ADDADDR):
233
              case IOCTL_NR(ATM_DELADDR):
234
              case IOCTL_NR(ATM_GETCIRANGE):
235
              case IOCTL_NR(ATM_SETCIRANGE):
236
              case IOCTL_NR(ATM_SETESI):
237
              case IOCTL_NR(ATM_SETESIF):
238
              case IOCTL_NR(ATM_GETSTAT):
239
              case IOCTL_NR(ATM_GETSTATZ):
240
              case IOCTL_NR(ATM_GETLOOP):
241
              case IOCTL_NR(ATM_SETLOOP):
242
              case IOCTL_NR(ATM_QUERYLOOP):
243
              case IOCTL_NR(ENI_SETMULT):
244
              case IOCTL_NR(NS_GETPSTAT):
245
                /* case IOCTL_NR(NS_SETBUFLEV): This is a duplicate case with ZATM_GETPOOLZ */
246
              case IOCTL_NR(ZATM_GETPOOLZ):
247
              case IOCTL_NR(ZATM_GETPOOL):
248
              case IOCTL_NR(ZATM_SETPOOL):
249
              case IOCTL_NR(ZATM_GETTHIST):
250
              case IOCTL_NR(IDT77105_GETSTAT):
251
              case IOCTL_NR(IDT77105_GETSTATZ):
252
              case IOCTL_NR(IXJCTL_TONE_CADENCE):
253
              case IOCTL_NR(IXJCTL_FRAMES_READ):
254
              case IOCTL_NR(IXJCTL_FRAMES_WRITTEN):
255
              case IOCTL_NR(IXJCTL_READ_WAIT):
256
              case IOCTL_NR(IXJCTL_WRITE_WAIT):
257
              case IOCTL_NR(IXJCTL_DRYBUFFER_READ):
258
              case IOCTL_NR(I2OHRTGET):
259
              case IOCTL_NR(I2OLCTGET):
260
              case IOCTL_NR(I2OPARMSET):
261
              case IOCTL_NR(I2OPARMGET):
262
              case IOCTL_NR(I2OSWDL):
263
              case IOCTL_NR(I2OSWUL):
264
              case IOCTL_NR(I2OSWDEL):
265
              case IOCTL_NR(I2OHTML):
266
                break;
267
              default:
268
                return sys_ioctl(fd, cmd, (unsigned long)arg);
269
 
270
        }
271
        printk(KERN_ERR "%x:unimplemented IA32 ioctl system call\n", cmd);
272
        return -EINVAL;
273
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.