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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [drivers/] [input/] [serio/] [i8042-x86ia64io.h] - Blame information for rev 62

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 62 marcus.erl
#ifndef _I8042_X86IA64IO_H
2
#define _I8042_X86IA64IO_H
3
 
4
/*
5
 * This program is free software; you can redistribute it and/or modify it
6
 * under the terms of the GNU General Public License version 2 as published by
7
 * the Free Software Foundation.
8
 */
9
 
10
/*
11
 * Names.
12
 */
13
 
14
#define I8042_KBD_PHYS_DESC "isa0060/serio0"
15
#define I8042_AUX_PHYS_DESC "isa0060/serio1"
16
#define I8042_MUX_PHYS_DESC "isa0060/serio%d"
17
 
18
/*
19
 * IRQs.
20
 */
21
 
22
#if defined(__ia64__)
23
# define I8042_MAP_IRQ(x)       isa_irq_to_vector((x))
24
#else
25
# define I8042_MAP_IRQ(x)       (x)
26
#endif
27
 
28
#define I8042_KBD_IRQ   i8042_kbd_irq
29
#define I8042_AUX_IRQ   i8042_aux_irq
30
 
31
static int i8042_kbd_irq;
32
static int i8042_aux_irq;
33
 
34
/*
35
 * Register numbers.
36
 */
37
 
38
#define I8042_COMMAND_REG       i8042_command_reg
39
#define I8042_STATUS_REG        i8042_command_reg
40
#define I8042_DATA_REG          i8042_data_reg
41
 
42
static int i8042_command_reg = 0x64;
43
static int i8042_data_reg = 0x60;
44
 
45
 
46
static inline int i8042_read_data(void)
47
{
48
        return inb(I8042_DATA_REG);
49
}
50
 
51
static inline int i8042_read_status(void)
52
{
53
        return inb(I8042_STATUS_REG);
54
}
55
 
56
static inline void i8042_write_data(int val)
57
{
58
        outb(val, I8042_DATA_REG);
59
}
60
 
61
static inline void i8042_write_command(int val)
62
{
63
        outb(val, I8042_COMMAND_REG);
64
}
65
 
66
#if defined(__i386__)
67
 
68
#include <linux/dmi.h>
69
 
70
static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
71
        {
72
                /* AUX LOOP command does not raise AUX IRQ */
73
                .ident = "ASUS P65UP5",
74
                .matches = {
75
                        DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
76
                        DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
77
                        DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
78
                },
79
        },
80
        {
81
                .ident = "Compaq Proliant 8500",
82
                .matches = {
83
                        DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
84
                        DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
85
                        DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
86
                },
87
        },
88
        {
89
                .ident = "Compaq Proliant DL760",
90
                .matches = {
91
                        DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
92
                        DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
93
                        DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
94
                },
95
        },
96
        {
97
                .ident = "OQO Model 01",
98
                .matches = {
99
                        DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
100
                        DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
101
                        DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
102
                },
103
        },
104
        {
105
                /* AUX LOOP does not work properly */
106
                .ident = "ULI EV4873",
107
                .matches = {
108
                        DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
109
                        DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
110
                        DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
111
                },
112
        },
113
        {
114
                .ident = "Microsoft Virtual Machine",
115
                .matches = {
116
                        DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
117
                        DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
118
                        DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
119
                },
120
        },
121
        { }
122
};
123
 
124
/*
125
 * Some Fujitsu notebooks are having trouble with touchpads if
126
 * active multiplexing mode is activated. Luckily they don't have
127
 * external PS/2 ports so we can safely disable it.
128
 * ... apparently some Toshibas don't like MUX mode either and
129
 * die horrible death on reboot.
130
 */
131
static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
132
        {
133
                .ident = "Fujitsu Lifebook P7010/P7010D",
134
                .matches = {
135
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
136
                        DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
137
                },
138
        },
139
        {
140
                .ident = "Fujitsu Lifebook P7010",
141
                .matches = {
142
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
143
                        DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
144
                },
145
        },
146
        {
147
                .ident = "Fujitsu Lifebook P5020D",
148
                .matches = {
149
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
150
                        DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
151
                },
152
        },
153
        {
154
                .ident = "Fujitsu Lifebook S2000",
155
                .matches = {
156
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
157
                        DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
158
                },
159
        },
160
        {
161
                .ident = "Fujitsu Lifebook S6230",
162
                .matches = {
163
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
164
                        DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
165
                },
166
        },
167
        {
168
                .ident = "Fujitsu T70H",
169
                .matches = {
170
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
171
                        DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
172
                },
173
        },
174
        {
175
                .ident = "Fujitsu-Siemens Lifebook T3010",
176
                .matches = {
177
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
178
                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
179
                },
180
        },
181
        {
182
                .ident = "Fujitsu-Siemens Lifebook E4010",
183
                .matches = {
184
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
185
                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
186
                },
187
        },
188
        {
189
                /*
190
                 * No data is coming from the touchscreen unless KBC
191
                 * is in legacy mode.
192
                 */
193
                .ident = "Panasonic CF-29",
194
                .matches = {
195
                        DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
196
                        DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
197
                },
198
        },
199
        {
200
                /*
201
                 * Errors on MUX ports are reported without raising AUXDATA
202
                 * causing "spurious NAK" messages.
203
                 */
204
                .ident = "HP Pavilion DV4017EA",
205
                .matches = {
206
                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
207
                        DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
208
                },
209
        },
210
        {
211
                /*
212
                 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
213
                 */
214
                .ident = "HP Pavilion ZT1000",
215
                .matches = {
216
                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
217
                        DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
218
                        DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
219
                },
220
        },
221
        {
222
                /*
223
                 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
224
                 */
225
                .ident = "HP Pavilion DV4270ca",
226
                .matches = {
227
                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
228
                        DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
229
                },
230
        },
231
        {
232
                .ident = "Toshiba P10",
233
                .matches = {
234
                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
235
                        DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
236
                },
237
        },
238
        {
239
                .ident = "Toshiba Equium A110",
240
                .matches = {
241
                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
242
                        DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
243
                },
244
        },
245
        {
246
                .ident = "Alienware Sentia",
247
                .matches = {
248
                        DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
249
                        DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
250
                },
251
        },
252
        {
253
                .ident = "Sharp Actius MM20",
254
                .matches = {
255
                        DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
256
                        DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
257
                },
258
        },
259
        {
260
                .ident = "Sony Vaio FS-115b",
261
                .matches = {
262
                        DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
263
                        DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
264
                },
265
        },
266
        {
267
                .ident = "Amoi M636/A737",
268
                .matches = {
269
                        DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
270
                        DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
271
                },
272
        },
273
        { }
274
};
275
 
276
 
277
 
278
#endif
279
 
280
 
281
#ifdef CONFIG_PNP
282
#include <linux/pnp.h>
283
 
284
static int i8042_pnp_kbd_registered;
285
static unsigned int i8042_pnp_kbd_devices;
286
static int i8042_pnp_aux_registered;
287
static unsigned int i8042_pnp_aux_devices;
288
 
289
static int i8042_pnp_command_reg;
290
static int i8042_pnp_data_reg;
291
static int i8042_pnp_kbd_irq;
292
static int i8042_pnp_aux_irq;
293
 
294
static char i8042_pnp_kbd_name[32];
295
static char i8042_pnp_aux_name[32];
296
 
297
static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
298
{
299
        if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
300
                i8042_pnp_data_reg = pnp_port_start(dev,0);
301
 
302
        if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
303
                i8042_pnp_command_reg = pnp_port_start(dev, 1);
304
 
305
        if (pnp_irq_valid(dev,0))
306
                i8042_pnp_kbd_irq = pnp_irq(dev, 0);
307
 
308
        strncpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
309
        if (strlen(pnp_dev_name(dev))) {
310
                strncat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
311
                strncat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
312
        }
313
 
314
        i8042_pnp_kbd_devices++;
315
        return 0;
316
}
317
 
318
static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
319
{
320
        if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
321
                i8042_pnp_data_reg = pnp_port_start(dev,0);
322
 
323
        if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
324
                i8042_pnp_command_reg = pnp_port_start(dev, 1);
325
 
326
        if (pnp_irq_valid(dev, 0))
327
                i8042_pnp_aux_irq = pnp_irq(dev, 0);
328
 
329
        strncpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
330
        if (strlen(pnp_dev_name(dev))) {
331
                strncat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
332
                strncat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
333
        }
334
 
335
        i8042_pnp_aux_devices++;
336
        return 0;
337
}
338
 
339
static struct pnp_device_id pnp_kbd_devids[] = {
340
        { .id = "PNP0303", .driver_data = 0 },
341
        { .id = "PNP030b", .driver_data = 0 },
342
        { .id = "", },
343
};
344
 
345
static struct pnp_driver i8042_pnp_kbd_driver = {
346
        .name           = "i8042 kbd",
347
        .id_table       = pnp_kbd_devids,
348
        .probe          = i8042_pnp_kbd_probe,
349
};
350
 
351
static struct pnp_device_id pnp_aux_devids[] = {
352
        { .id = "FJC6000", .driver_data = 0 },
353
        { .id = "FJC6001", .driver_data = 0 },
354
        { .id = "PNP0f03", .driver_data = 0 },
355
        { .id = "PNP0f0b", .driver_data = 0 },
356
        { .id = "PNP0f0e", .driver_data = 0 },
357
        { .id = "PNP0f12", .driver_data = 0 },
358
        { .id = "PNP0f13", .driver_data = 0 },
359
        { .id = "PNP0f19", .driver_data = 0 },
360
        { .id = "PNP0f1c", .driver_data = 0 },
361
        { .id = "SYN0801", .driver_data = 0 },
362
        { .id = "", },
363
};
364
 
365
static struct pnp_driver i8042_pnp_aux_driver = {
366
        .name           = "i8042 aux",
367
        .id_table       = pnp_aux_devids,
368
        .probe          = i8042_pnp_aux_probe,
369
};
370
 
371
static void i8042_pnp_exit(void)
372
{
373
        if (i8042_pnp_kbd_registered) {
374
                i8042_pnp_kbd_registered = 0;
375
                pnp_unregister_driver(&i8042_pnp_kbd_driver);
376
        }
377
 
378
        if (i8042_pnp_aux_registered) {
379
                i8042_pnp_aux_registered = 0;
380
                pnp_unregister_driver(&i8042_pnp_aux_driver);
381
        }
382
}
383
 
384
static int __init i8042_pnp_init(void)
385
{
386
        char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
387
        int pnp_data_busted = 0;
388
        int err;
389
 
390
        if (i8042_nopnp) {
391
                printk(KERN_INFO "i8042: PNP detection disabled\n");
392
                return 0;
393
        }
394
 
395
        err = pnp_register_driver(&i8042_pnp_kbd_driver);
396
        if (!err)
397
                i8042_pnp_kbd_registered = 1;
398
 
399
        err = pnp_register_driver(&i8042_pnp_aux_driver);
400
        if (!err)
401
                i8042_pnp_aux_registered = 1;
402
 
403
        if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
404
                i8042_pnp_exit();
405
#if defined(__ia64__)
406
                return -ENODEV;
407
#else
408
                printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
409
                return 0;
410
#endif
411
        }
412
 
413
        if (i8042_pnp_kbd_devices)
414
                snprintf(kbd_irq_str, sizeof(kbd_irq_str),
415
                        "%d", i8042_pnp_kbd_irq);
416
        if (i8042_pnp_aux_devices)
417
                snprintf(aux_irq_str, sizeof(aux_irq_str),
418
                        "%d", i8042_pnp_aux_irq);
419
 
420
        printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
421
                i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
422
                i8042_pnp_aux_name,
423
                i8042_pnp_data_reg, i8042_pnp_command_reg,
424
                kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
425
                aux_irq_str);
426
 
427
#if defined(__ia64__)
428
        if (!i8042_pnp_kbd_devices)
429
                i8042_nokbd = 1;
430
        if (!i8042_pnp_aux_devices)
431
                i8042_noaux = 1;
432
#endif
433
 
434
        if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
435
              i8042_pnp_data_reg != i8042_data_reg) ||
436
            !i8042_pnp_data_reg) {
437
                printk(KERN_WARNING
438
                        "PNP: PS/2 controller has invalid data port %#x; "
439
                        "using default %#x\n",
440
                        i8042_pnp_data_reg, i8042_data_reg);
441
                i8042_pnp_data_reg = i8042_data_reg;
442
                pnp_data_busted = 1;
443
        }
444
 
445
        if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
446
              i8042_pnp_command_reg != i8042_command_reg) ||
447
            !i8042_pnp_command_reg) {
448
                printk(KERN_WARNING
449
                        "PNP: PS/2 controller has invalid command port %#x; "
450
                        "using default %#x\n",
451
                        i8042_pnp_command_reg, i8042_command_reg);
452
                i8042_pnp_command_reg = i8042_command_reg;
453
                pnp_data_busted = 1;
454
        }
455
 
456
        if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
457
                printk(KERN_WARNING
458
                        "PNP: PS/2 controller doesn't have KBD irq; "
459
                        "using default %d\n", i8042_kbd_irq);
460
                i8042_pnp_kbd_irq = i8042_kbd_irq;
461
                pnp_data_busted = 1;
462
        }
463
 
464
        if (!i8042_noaux && !i8042_pnp_aux_irq) {
465
                if (!pnp_data_busted && i8042_pnp_kbd_irq) {
466
                        printk(KERN_WARNING
467
                                "PNP: PS/2 appears to have AUX port disabled, "
468
                                "if this is incorrect please boot with "
469
                                "i8042.nopnp\n");
470
                        i8042_noaux = 1;
471
                } else {
472
                        printk(KERN_WARNING
473
                                "PNP: PS/2 controller doesn't have AUX irq; "
474
                                "using default %d\n", i8042_aux_irq);
475
                        i8042_pnp_aux_irq = i8042_aux_irq;
476
                }
477
        }
478
 
479
        i8042_data_reg = i8042_pnp_data_reg;
480
        i8042_command_reg = i8042_pnp_command_reg;
481
        i8042_kbd_irq = i8042_pnp_kbd_irq;
482
        i8042_aux_irq = i8042_pnp_aux_irq;
483
 
484
        return 0;
485
}
486
 
487
#else
488
static inline int i8042_pnp_init(void) { return 0; }
489
static inline void i8042_pnp_exit(void) { }
490
#endif
491
 
492
static int __init i8042_platform_init(void)
493
{
494
        int retval;
495
 
496
/*
497
 * On ix86 platforms touching the i8042 data register region can do really
498
 * bad things. Because of this the region is always reserved on ix86 boxes.
499
 *
500
 *      if (!request_region(I8042_DATA_REG, 16, "i8042"))
501
 *              return -EBUSY;
502
 */
503
 
504
        i8042_kbd_irq = I8042_MAP_IRQ(1);
505
        i8042_aux_irq = I8042_MAP_IRQ(12);
506
 
507
        retval = i8042_pnp_init();
508
        if (retval)
509
                return retval;
510
 
511
#if defined(__ia64__)
512
        i8042_reset = 1;
513
#endif
514
 
515
#if defined(__i386__)
516
        if (dmi_check_system(i8042_dmi_noloop_table))
517
                i8042_noloop = 1;
518
 
519
        if (dmi_check_system(i8042_dmi_nomux_table))
520
                i8042_nomux = 1;
521
#endif
522
 
523
        return retval;
524
}
525
 
526
static inline void i8042_platform_exit(void)
527
{
528
        i8042_pnp_exit();
529
}
530
 
531
#endif /* _I8042_X86IA64IO_H */

powered by: WebSVN 2.1.0

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