aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-01-30 07:33:14 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:14 -0500
commit466eed22d127a1f16e1251cdc54a9f8f944140c0 (patch)
treef9b85efa895f3e2dd7f112a4aded5b2ae0bd0ca2
parentfb8830e72d9bd86f1e7b6886cb1886c391130f86 (diff)
x86: isolate PIC/PIT in/out calls
Rather than remove and/or mangle inb_p/outb_p we want to remove the use of them from inappropriate places. For the PIC/PIT this may eventually depend on 32/64bitism or similar so start by adding inb/outb_pit and inb/outb_pic so that we can make them use any scheme we settle on without disturbing the existing, correct (for ISA), port 0x80 usage. (eg we can make inb_pit use udelay without messing up inb_p). Floppy already does this for the fdc. That really only leaves the CMOS as a core logic item to tackle, and bits of parallel port handling in the chipset layers. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/apm_32.c6
-rw-r--r--arch/x86/kernel/i8253.c30
-rw-r--r--arch/x86/kernel/i8259_32.c20
-rw-r--r--arch/x86/kernel/i8259_64.c20
-rw-r--r--arch/x86/kernel/vmiclock_32.c2
-rw-r--r--include/asm-x86/i8253.h3
-rw-r--r--include/asm-x86/i8259.h3
7 files changed, 45 insertions, 39 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 955dd43b1676..d4438ef296d8 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1174,11 +1174,11 @@ static void reinit_timer(void)
1174 1174
1175 spin_lock_irqsave(&i8253_lock, flags); 1175 spin_lock_irqsave(&i8253_lock, flags);
1176 /* set the clock to HZ */ 1176 /* set the clock to HZ */
1177 outb_p(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ 1177 outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
1178 udelay(10); 1178 udelay(10);
1179 outb_p(LATCH & 0xff, PIT_CH0); /* LSB */ 1179 outb_pit(LATCH & 0xff, PIT_CH0); /* LSB */
1180 udelay(10); 1180 udelay(10);
1181 outb(LATCH >> 8, PIT_CH0); /* MSB */ 1181 outb_pit(LATCH >> 8, PIT_CH0); /* MSB */
1182 udelay(10); 1182 udelay(10);
1183 spin_unlock_irqrestore(&i8253_lock, flags); 1183 spin_unlock_irqrestore(&i8253_lock, flags);
1184#endif 1184#endif
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index c76fef1ce355..ef62b07b2b48 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -43,26 +43,26 @@ static void init_pit_timer(enum clock_event_mode mode,
43 switch(mode) { 43 switch(mode) {
44 case CLOCK_EVT_MODE_PERIODIC: 44 case CLOCK_EVT_MODE_PERIODIC:
45 /* binary, mode 2, LSB/MSB, ch 0 */ 45 /* binary, mode 2, LSB/MSB, ch 0 */
46 outb_p(0x34, PIT_MODE); 46 outb_pit(0x34, PIT_MODE);
47 outb_p(LATCH & 0xff , PIT_CH0); /* LSB */ 47 outb_pit(LATCH & 0xff , PIT_CH0); /* LSB */
48 outb(LATCH >> 8 , PIT_CH0); /* MSB */ 48 outb_pit(LATCH >> 8 , PIT_CH0); /* MSB */
49 break; 49 break;
50 50
51 case CLOCK_EVT_MODE_SHUTDOWN: 51 case CLOCK_EVT_MODE_SHUTDOWN:
52 case CLOCK_EVT_MODE_UNUSED: 52 case CLOCK_EVT_MODE_UNUSED:
53 if (evt->mode == CLOCK_EVT_MODE_PERIODIC || 53 if (evt->mode == CLOCK_EVT_MODE_PERIODIC ||
54 evt->mode == CLOCK_EVT_MODE_ONESHOT) { 54 evt->mode == CLOCK_EVT_MODE_ONESHOT) {
55 outb_p(0x30, PIT_MODE); 55 outb_pit(0x30, PIT_MODE);
56 outb_p(0, PIT_CH0); 56 outb_pit(0, PIT_CH0);
57 outb_p(0, PIT_CH0); 57 outb_pit(0, PIT_CH0);
58 } 58 }
59 pit_disable_clocksource(); 59 pit_disable_clocksource();
60 break; 60 break;
61 61
62 case CLOCK_EVT_MODE_ONESHOT: 62 case CLOCK_EVT_MODE_ONESHOT:
63 /* One shot setup */ 63 /* One shot setup */
64 outb_p(0x38, PIT_MODE);
65 pit_disable_clocksource(); 64 pit_disable_clocksource();
65 outb_pit(0x38, PIT_MODE);
66 break; 66 break;
67 67
68 case CLOCK_EVT_MODE_RESUME: 68 case CLOCK_EVT_MODE_RESUME:
@@ -80,8 +80,8 @@ static void init_pit_timer(enum clock_event_mode mode,
80static int pit_next_event(unsigned long delta, struct clock_event_device *evt) 80static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
81{ 81{
82 spin_lock(&i8253_lock); 82 spin_lock(&i8253_lock);
83 outb_p(delta & 0xff , PIT_CH0); /* LSB */ 83 outb_pit(delta & 0xff , PIT_CH0); /* LSB */
84 outb(delta >> 8 , PIT_CH0); /* MSB */ 84 outb_pit(delta >> 8 , PIT_CH0); /* MSB */
85 spin_unlock(&i8253_lock); 85 spin_unlock(&i8253_lock);
86 86
87 return 0; 87 return 0;
@@ -153,15 +153,15 @@ static cycle_t pit_read(void)
153 * count), it cannot be newer. 153 * count), it cannot be newer.
154 */ 154 */
155 jifs = jiffies; 155 jifs = jiffies;
156 outb_p(0x00, PIT_MODE); /* latch the count ASAP */ 156 outb_pit(0x00, PIT_MODE); /* latch the count ASAP */
157 count = inb_p(PIT_CH0); /* read the latched count */ 157 count = inb_pit(PIT_CH0); /* read the latched count */
158 count |= inb_p(PIT_CH0) << 8; 158 count |= inb_pit(PIT_CH0) << 8;
159 159
160 /* VIA686a test code... reset the latch if count > max + 1 */ 160 /* VIA686a test code... reset the latch if count > max + 1 */
161 if (count > LATCH) { 161 if (count > LATCH) {
162 outb_p(0x34, PIT_MODE); 162 outb_pit(0x34, PIT_MODE);
163 outb_p(LATCH & 0xff, PIT_CH0); 163 outb_pit(LATCH & 0xff, PIT_CH0);
164 outb(LATCH >> 8, PIT_CH0); 164 outb_pit(LATCH >> 8, PIT_CH0);
165 count = LATCH - 1; 165 count = LATCH - 1;
166 } 166 }
167 167
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index f201e7da1bbc..2d25b77102fe 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -289,20 +289,20 @@ void init_8259A(int auto_eoi)
289 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ 289 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
290 290
291 /* 291 /*
292 * outb_p - this has to work on a wide range of PC hardware. 292 * outb_pic - this has to work on a wide range of PC hardware.
293 */ 293 */
294 outb_p(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */ 294 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */
295 outb_p(0x20 + 0, PIC_MASTER_IMR); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */ 295 outb_pic(0x20 + 0, PIC_MASTER_IMR); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */
296 outb_p(1U << PIC_CASCADE_IR, PIC_MASTER_IMR); /* 8259A-1 (the master) has a slave on IR2 */ 296 outb_pic(1U << PIC_CASCADE_IR, PIC_MASTER_IMR); /* 8259A-1 (the master) has a slave on IR2 */
297 if (auto_eoi) /* master does Auto EOI */ 297 if (auto_eoi) /* master does Auto EOI */
298 outb_p(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR); 298 outb_pic(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR);
299 else /* master expects normal EOI */ 299 else /* master expects normal EOI */
300 outb_p(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR); 300 outb_pic(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR);
301 301
302 outb_p(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */ 302 outb_pic(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */
303 outb_p(0x20 + 8, PIC_SLAVE_IMR); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */ 303 outb_pic(0x20 + 8, PIC_SLAVE_IMR); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */
304 outb_p(PIC_CASCADE_IR, PIC_SLAVE_IMR); /* 8259A-2 is a slave on master's IR2 */ 304 outb_pic(PIC_CASCADE_IR, PIC_SLAVE_IMR); /* 8259A-2 is a slave on master's IR2 */
305 outb_p(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR); /* (slave's support for AEOI in flat mode is to be investigated) */ 305 outb_pic(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR); /* (slave's support for AEOI in flat mode is to be investigated) */
306 if (auto_eoi) 306 if (auto_eoi)
307 /* 307 /*
308 * In AEOI mode we just have to mask the interrupt 308 * In AEOI mode we just have to mask the interrupt
diff --git a/arch/x86/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
index 99c8406ae253..d3edb9f23f2c 100644
--- a/arch/x86/kernel/i8259_64.c
+++ b/arch/x86/kernel/i8259_64.c
@@ -359,25 +359,25 @@ void init_8259A(int auto_eoi)
359 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ 359 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
360 360
361 /* 361 /*
362 * outb_p - this has to work on a wide range of PC hardware. 362 * outb_pic - this has to work on a wide range of PC hardware.
363 */ 363 */
364 outb_p(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */ 364 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */
365 /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */ 365 /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */
366 outb_p(IRQ0_VECTOR, PIC_MASTER_IMR); 366 outb_pic(IRQ0_VECTOR, PIC_MASTER_IMR);
367 /* 8259A-1 (the master) has a slave on IR2 */ 367 /* 8259A-1 (the master) has a slave on IR2 */
368 outb_p(0x04, PIC_MASTER_IMR); 368 outb_pic(0x04, PIC_MASTER_IMR);
369 if (auto_eoi) /* master does Auto EOI */ 369 if (auto_eoi) /* master does Auto EOI */
370 outb_p(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR); 370 outb_pic(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR);
371 else /* master expects normal EOI */ 371 else /* master expects normal EOI */
372 outb_p(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR); 372 outb_pic(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR);
373 373
374 outb_p(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */ 374 outb_pic(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */
375 /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */ 375 /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */
376 outb_p(IRQ8_VECTOR, PIC_SLAVE_IMR); 376 outb_pic(IRQ8_VECTOR, PIC_SLAVE_IMR);
377 /* 8259A-2 is a slave on master's IR2 */ 377 /* 8259A-2 is a slave on master's IR2 */
378 outb_p(PIC_CASCADE_IR, PIC_SLAVE_IMR); 378 outb_pic(PIC_CASCADE_IR, PIC_SLAVE_IMR);
379 /* (slave's support for AEOI in flat mode is to be investigated) */ 379 /* (slave's support for AEOI in flat mode is to be investigated) */
380 outb_p(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR); 380 outb_pic(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR);
381 381
382 if (auto_eoi) 382 if (auto_eoi)
383 /* 383 /*
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
index 57f9ef5a324c..a2b030780aa9 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -237,7 +237,7 @@ static void __devinit vmi_time_init_clockevent(void)
237void __init vmi_time_init(void) 237void __init vmi_time_init(void)
238{ 238{
239 /* Disable PIT: BIOSes start PIT CH0 with 18.2hz peridic. */ 239 /* Disable PIT: BIOSes start PIT CH0 with 18.2hz peridic. */
240 outb_p(0x3a, PIT_MODE); /* binary, mode 5, LSB/MSB, ch 0 */ 240 outb_pit(0x3a, PIT_MODE); /* binary, mode 5, LSB/MSB, ch 0 */
241 241
242 vmi_time_init_clockevent(); 242 vmi_time_init_clockevent();
243 setup_irq(0, &vmi_clock_action); 243 setup_irq(0, &vmi_clock_action);
diff --git a/include/asm-x86/i8253.h b/include/asm-x86/i8253.h
index 747548ec5d1d..b51c0487fc41 100644
--- a/include/asm-x86/i8253.h
+++ b/include/asm-x86/i8253.h
@@ -12,4 +12,7 @@ extern struct clock_event_device *global_clock_event;
12 12
13extern void setup_pit_timer(void); 13extern void setup_pit_timer(void);
14 14
15#define inb_pit inb_p
16#define outb_pit outb_p
17
15#endif /* __ASM_I8253_H__ */ 18#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-x86/i8259.h b/include/asm-x86/i8259.h
index cabcc6cf3923..67c319e0efc7 100644
--- a/include/asm-x86/i8259.h
+++ b/include/asm-x86/i8259.h
@@ -29,4 +29,7 @@ extern void enable_8259A_irq(unsigned int irq);
29extern void disable_8259A_irq(unsigned int irq); 29extern void disable_8259A_irq(unsigned int irq);
30extern unsigned int startup_8259A_irq(unsigned int irq); 30extern unsigned int startup_8259A_irq(unsigned int irq);
31 31
32#define inb_pic inb_p
33#define outb_pic outb_p
34
32#endif /* __ASM_I8259_H__ */ 35#endif /* __ASM_I8259_H__ */