idle governor: Avoid lock acquisition to read pm_qos before entering idle
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / alpha / kernel / pc873xx.c
blob27dcbff85613aa1716b60e2548027aea3505c2cb
1 #include <linux/ioport.h>
2 #include <asm/io.h>
4 #include "pc873xx.h"
6 static unsigned pc873xx_probelist[] = {0x398, 0x26e, 0};
8 static char *pc873xx_names[] = {
9 "PC87303", "PC87306", "PC87312", "PC87332", "PC87334"
12 static unsigned int base, model;
15 unsigned int __init pc873xx_get_base()
17 return base;
20 char *__init pc873xx_get_model()
22 return pc873xx_names[model];
25 static unsigned char __init pc873xx_read(unsigned int base, int reg)
27 outb(reg, base);
28 return inb(base + 1);
31 static void __init pc873xx_write(unsigned int base, int reg, unsigned char data)
33 unsigned long flags;
35 local_irq_save(flags);
36 outb(reg, base);
37 outb(data, base + 1);
38 outb(data, base + 1); /* Must be written twice */
39 local_irq_restore(flags);
42 int __init pc873xx_probe(void)
44 int val, index = 0;
46 while ((base = pc873xx_probelist[index++])) {
48 if (request_region(base, 2, "Super IO PC873xx") == NULL)
49 continue;
51 val = pc873xx_read(base, REG_SID);
52 if ((val & 0xf0) == 0x10) {
53 model = PC87332;
54 break;
55 } else if ((val & 0xf8) == 0x70) {
56 model = PC87306;
57 break;
58 } else if ((val & 0xf8) == 0x50) {
59 model = PC87334;
60 break;
61 } else if ((val & 0xf8) == 0x40) {
62 model = PC87303;
63 break;
66 release_region(base, 2);
69 return (base == 0) ? -1 : 1;
72 void __init pc873xx_enable_epp19(void)
74 unsigned char data;
76 printk(KERN_INFO "PC873xx enabling EPP v1.9\n");
77 data = pc873xx_read(base, REG_PCR);
78 pc873xx_write(base, REG_PCR, (data & 0xFC) | 0x02);
81 void __init pc873xx_enable_ide(void)
83 unsigned char data;
85 printk(KERN_INFO "PC873xx enabling IDE interrupt\n");
86 data = pc873xx_read(base, REG_FER);
87 pc873xx_write(base, REG_FER, data | 0x40);