From b3c59de8a59924b1d89d5c8db1a70bee889bf856 Mon Sep 17 00:00:00 2001 From: Christopher Hoover Date: Wed, 17 Jul 2002 02:18:53 +0100 Subject: [ARM PATCH] 1199/1: ISA Macros expected for platforms This makes IRDA happy. --- include/asm-arm/io.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 21ca5ae0b847..ebaef59d788a 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -28,6 +28,13 @@ #include #include +/* + * ISA I/O bus memory addresses are 1:1 with the physical address. + */ +#define isa_virt_to_bus virt_to_phys +#define isa_page_to_bus page_to_phys +#define isa_bus_to_virt phys_to_virt + /* * Generic IO read/write. These perform native-endian accesses. Note * that some architectures will want to re-define __raw_{read,write}w. -- cgit v1.2.3 From 42c4f574617bdf37c61cc8e74f36c868a3dd9a14 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 18 Jul 2002 01:13:10 +0100 Subject: [ARM] ARM keyboard code fixups for the input layer. The ARM specific parts of the input layer are being submitted via Vojtech. This cset covers the arch/arm and include/asm-arm parts of the changes necessary to use these drivers. --- arch/arm/lib/kbd.c | 278 ++++++++++++++++++++++++++++- include/asm-arm/arch-ebsa285/keyboard.h | 61 +------ include/asm-arm/arch-integrator/keyboard.h | 11 +- include/asm-arm/arch-rpc/keyboard.h | 11 +- include/asm-arm/arch-sa1100/keyboard.h | 13 -- include/asm-arm/hardware/sa1111.h | 137 +++----------- 6 files changed, 301 insertions(+), 210 deletions(-) (limited to 'include') diff --git a/arch/arm/lib/kbd.c b/arch/arm/lib/kbd.c index 25ee8a5d33dd..23c74df7c4d0 100644 --- a/arch/arm/lib/kbd.c +++ b/arch/arm/lib/kbd.c @@ -1,13 +1,279 @@ #include #include +#include +#include -int (*k_setkeycode)(unsigned int, unsigned int); -int (*k_getkeycode)(unsigned int); -int (*k_translate)(unsigned char, unsigned char *, char); -char (*k_unexpected_up)(unsigned char); +/* + * Translation of escaped scancodes to keycodes. + * This is now user-settable. + * The keycodes 1-88,96-111,119 are fairly standard, and + * should probably not be changed - changing might confuse X. + * X also interprets scancode 0x5d (KEY_Begin). + * + * For 1-88 keycode equals scancode. + */ + +#define E0_KPENTER 96 +#define E0_RCTRL 97 +#define E0_KPSLASH 98 +#define E0_PRSCR 99 +#define E0_RALT 100 +#define E0_BREAK 101 /* (control-pause) */ +#define E0_HOME 102 +#define E0_UP 103 +#define E0_PGUP 104 +#define E0_LEFT 105 +#define E0_RIGHT 106 +#define E0_END 107 +#define E0_DOWN 108 +#define E0_PGDN 109 +#define E0_INS 110 +#define E0_DEL 111 + +/* for USB 106 keyboard */ +#define E0_YEN 124 +#define E0_BACKSLASH 89 + + +#define E1_PAUSE 119 + +/* + * The keycodes below are randomly located in 89-95,112-118,120-127. + * They could be thrown away (and all occurrences below replaced by 0), + * but that would force many users to use the `setkeycodes' utility, where + * they needed not before. It does not matter that there are duplicates, as + * long as no duplication occurs for any single keyboard. + */ +#define SC_LIM 89 + +#define FOCUS_PF1 85 /* actual code! */ +#define FOCUS_PF2 89 +#define FOCUS_PF3 90 +#define FOCUS_PF4 91 +#define FOCUS_PF5 92 +#define FOCUS_PF6 93 +#define FOCUS_PF7 94 +#define FOCUS_PF8 95 +#define FOCUS_PF9 120 +#define FOCUS_PF10 121 +#define FOCUS_PF11 122 +#define FOCUS_PF12 123 + +#define JAP_86 124 +/* tfj@olivia.ping.dk: + * The four keys are located over the numeric keypad, and are + * labelled A1-A4. It's an rc930 keyboard, from + * Regnecentralen/RC International, Now ICL. + * Scancodes: 59, 5a, 5b, 5c. + */ +#define RGN1 124 +#define RGN2 125 +#define RGN3 126 +#define RGN4 127 + +static unsigned char high_keys[128 - SC_LIM] = { + RGN1, RGN2, RGN3, RGN4, 0, 0, 0, /* 0x59-0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */ + 0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12, /* 0x68-0x6f */ + 0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3, /* 0x70-0x77 */ + FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7, /* 0x78-0x7b */ + FOCUS_PF8, JAP_86, FOCUS_PF10, 0 /* 0x7c-0x7f */ +}; + +/* BTC */ +#define E0_MACRO 112 +/* LK450 */ +#define E0_F13 113 +#define E0_F14 114 +#define E0_HELP 115 +#define E0_DO 116 +#define E0_F17 117 +#define E0_KPMINPLUS 118 +/* + * My OmniKey generates e0 4c for the "OMNI" key and the + * right alt key does nada. [kkoller@nyx10.cs.du.edu] + */ +#define E0_OK 124 +/* + * New microsoft keyboard is rumoured to have + * e0 5b (left window button), e0 5c (right window button), + * e0 5d (menu button). [or: LBANNER, RBANNER, RMENU] + * [or: Windows_L, Windows_R, TaskMan] + */ +#define E0_MSLW 125 +#define E0_MSRW 126 +#define E0_MSTM 127 + +static unsigned char e0_keys[128] = { + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x07 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x08-0x0f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */ + 0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0, /* 0x18-0x1f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */ + 0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */ + E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP, /* 0x38-0x3f */ + E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME, /* 0x40-0x47 */ + E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END, /* 0x48-0x4f */ + E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0, /* 0x50-0x57 */ + 0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0, /* 0x58-0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */ + 0, 0, 0, 0, 0, 0, 0, E0_MACRO, /* 0x68-0x6f */ + //0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */ + 0, 0, 0, 0, 0, E0_BACKSLASH, 0, 0, /* 0x70-0x77 */ + 0, 0, 0, E0_YEN, 0, 0, 0, 0 /* 0x78-0x7f */ +}; + +static int gen_setkeycode(unsigned int scancode, unsigned int keycode) +{ + if (scancode < SC_LIM || scancode > 255 || keycode > 127) + return -EINVAL; + if (scancode < 128) + high_keys[scancode - SC_LIM] = keycode; + else + e0_keys[scancode - 128] = keycode; + return 0; +} + +static int gen_getkeycode(unsigned int scancode) +{ + return + (scancode < SC_LIM || scancode > 255) ? -EINVAL : + (scancode < + 128) ? high_keys[scancode - SC_LIM] : e0_keys[scancode - 128]; +} + +static int +gen_translate(unsigned char scancode, unsigned char *keycode, char raw_mode) +{ + static int prev_scancode = 0; + + /* special prefix scancodes.. */ + if (scancode == 0xe0 || scancode == 0xe1) { + prev_scancode = scancode; + return 0; + } + + /* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */ + if (scancode == 0x00 || scancode == 0xff) { + prev_scancode = 0; + return 0; + } + + scancode &= 0x7f; + + if (prev_scancode) { + /* + * usually it will be 0xe0, but a Pause key generates + * e1 1d 45 e1 9d c5 when pressed, and nothing when released + */ + if (prev_scancode != 0xe0) { + if (prev_scancode == 0xe1 && scancode == 0x1d) { + prev_scancode = 0x100; + return 0; + } + else if (prev_scancode == 0x100 + && scancode == 0x45) { + *keycode = E1_PAUSE; + prev_scancode = 0; + } else { +#ifdef KBD_REPORT_UNKN + if (!raw_mode) + printk(KERN_INFO + "keyboard: unknown e1 escape sequence\n"); +#endif + prev_scancode = 0; + return 0; + } + } else { + prev_scancode = 0; + /* + * The keyboard maintains its own internal caps lock and + * num lock statuses. In caps lock mode E0 AA precedes make + * code and E0 2A follows break code. In num lock mode, + * E0 2A precedes make code and E0 AA follows break code. + * We do our own book-keeping, so we will just ignore these. + */ + /* + * For my keyboard there is no caps lock mode, but there are + * both Shift-L and Shift-R modes. The former mode generates + * E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs. + * So, we should also ignore the latter. - aeb@cwi.nl + */ + if (scancode == 0x2a || scancode == 0x36) + return 0; + + if (e0_keys[scancode]) + *keycode = e0_keys[scancode]; + else { +#ifdef KBD_REPORT_UNKN + if (!raw_mode) + printk(KERN_INFO + "keyboard: unknown scancode e0 %02x\n", + scancode); +#endif + return 0; + } + } + } else if (scancode >= SC_LIM) { + /* This happens with the FOCUS 9000 keyboard + Its keys PF1..PF12 are reported to generate + 55 73 77 78 79 7a 7b 7c 74 7e 6d 6f + Moreover, unless repeated, they do not generate + key-down events, so we have to zero up_flag below */ + /* Also, Japanese 86/106 keyboards are reported to + generate 0x73 and 0x7d for \ - and \ | respectively. */ + /* Also, some Brazilian keyboard is reported to produce + 0x73 and 0x7e for \ ? and KP-dot, respectively. */ + + *keycode = high_keys[scancode - SC_LIM]; + + if (!*keycode) { + if (!raw_mode) { +#ifdef KBD_REPORT_UNKN + printk(KERN_INFO + "keyboard: unrecognized scancode (%02x)" + " - ignored\n", scancode); +#endif + } + return 0; + } + } else + *keycode = scancode; + return 1; +} + +static char gen_unexpected_up(unsigned char keycode) +{ + /* unexpected, but this can happen: maybe this was a key release for a + FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */ + if (keycode >= SC_LIM || keycode == 85) + return 0; + else + return 0200; +} + +/* + * These are the default mappings + */ +int (*k_setkeycode)(unsigned int, unsigned int) = gen_setkeycode; +int (*k_getkeycode)(unsigned int) = gen_getkeycode; +int (*k_translate)(unsigned char, unsigned char *, char) = gen_translate; +char (*k_unexpected_up)(unsigned char) = gen_unexpected_up; void (*k_leds)(unsigned char); +/* Simple translation table for the SysRq keys */ + #ifdef CONFIG_MAGIC_SYSRQ -int k_sysrq_key; -unsigned char *k_sysrq_xlate; +static unsigned char gen_sysrq_xlate[128] = + "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ + "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ + "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ + "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */ + "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */ + "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ + "\r\000/"; /* 0x60 - 0x6f */ + +unsigned char *k_sysrq_xlate = gen_sysrq_xlate; +int k_sysrq_key = 0x54; #endif diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h index 968163b3f883..f47b43fe800c 100644 --- a/include/asm-arm/arch-ebsa285/keyboard.h +++ b/include/asm-arm/arch-ebsa285/keyboard.h @@ -6,63 +6,4 @@ * Copyright (C) 1998-2001 Russell King * (C) 1998 Phil Blundell */ -#include -#include -#include -#include - -#define KEYBOARD_IRQ IRQ_ISA_KEYBOARD -#define NR_SCANCODES 128 - -#define kbd_disable_irq() do { } while (0) -#define kbd_enable_irq() do { } while (0) - -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); -extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, - char raw_mode); -extern char pckbd_unexpected_up(unsigned char keycode); -extern void pckbd_leds(unsigned char leds); -extern void pckbd_init_hw(void); -extern unsigned char pckbd_sysrq_xlate[128]; - -static inline void kbd_init_hw(void) -{ - if (have_isa_bridge) { - k_setkeycode = pckbd_setkeycode; - k_getkeycode = pckbd_getkeycode; - k_translate = pckbd_translate; - k_unexpected_up = pckbd_unexpected_up; - k_leds = pckbd_leds; -#ifdef CONFIG_MAGIC_SYSRQ - k_sysrq_key = 0x54; - k_sysrq_xlate = pckbd_sysrq_xlate; -#endif - pckbd_init_hw(); - } -} - - -/* - * The rest of this file is to do with supporting pc_keyb.c - */ - -/* resource allocation */ -#define kbd_request_region() request_region(0x60, 16, "keyboard") -#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ - "keyboard", NULL) - -/* How to access the keyboard macros on this platform. */ -#define kbd_read_input() inb(KBD_DATA_REG) -#define kbd_read_status() inb(KBD_STATUS_REG) -#define kbd_write_output(val) outb(val, KBD_DATA_REG) -#define kbd_write_command(val) outb(val, KBD_CNTL_REG) - -/* Some stoneage hardware needs delays after some operations. */ -#define kbd_pause() do { } while(0) - -#define aux_request_irq(hand, dev_id) \ - request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id) - -#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) - +#define kbd_init_hw() do { } while (0) diff --git a/include/asm-arm/arch-integrator/keyboard.h b/include/asm-arm/arch-integrator/keyboard.h index 48aab706c868..2ca4754586a9 100644 --- a/include/asm-arm/arch-integrator/keyboard.h +++ b/include/asm-arm/arch-integrator/keyboard.h @@ -17,13 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Keyboard driver definitions for the Integrator architecture + * Now using the input subsystem... */ -#include - -#define NR_SCANCODES 128 - -extern int kmi_kbd_init(void); - -#define kbd_disable_irq() disable_irq(IRQ_KMIINT0) -#define kbd_enable_irq() enable_irq(IRQ_KMIINT0) -#define kbd_init_hw() kmi_kbd_init() +#define kbd_init_hw() do { } while (0) diff --git a/include/asm-arm/arch-rpc/keyboard.h b/include/asm-arm/arch-rpc/keyboard.h index 8aed4bd00fba..db187f96b1cc 100644 --- a/include/asm-arm/arch-rpc/keyboard.h +++ b/include/asm-arm/arch-rpc/keyboard.h @@ -8,13 +8,6 @@ * published by the Free Software Foundation. * * Keyboard driver definitions for RiscPC architecture + * Now using the input subsystem... */ -#include - -#define NR_SCANCODES 128 - -extern int ps2kbd_init_hw(void); - -#define kbd_disable_irq() disable_irq(IRQ_KEYBOARDRX) -#define kbd_enable_irq() enable_irq(IRQ_KEYBOARDRX) -#define kbd_init_hw() ps2kbd_init_hw() +#define kbd_init_hw() do { } while (0) diff --git a/include/asm-arm/arch-sa1100/keyboard.h b/include/asm-arm/arch-sa1100/keyboard.h index aa7f317092e5..e2a0c0196bfc 100644 --- a/include/asm-arm/arch-sa1100/keyboard.h +++ b/include/asm-arm/arch-sa1100/keyboard.h @@ -8,21 +8,13 @@ #include #include -#include -#define kbd_disable_irq() do { } while(0) -#define kbd_enable_irq() do { } while(0) - -extern int sa1111_kbd_init_hw(void); extern void gc_kbd_init_hw(void); extern void smartio_kbd_init_hw(void); extern void cerf_kbd_init_hw(void); static inline void kbd_init_hw(void) { - if ((machine_is_assabet() && machine_has_neponset()) || - machine_is_graphicsmaster()) - sa1111_kbd_init_hw(); if (machine_is_graphicsclient()) gc_kbd_init_hw(); if (machine_is_adsbitsy()) @@ -31,11 +23,6 @@ static inline void kbd_init_hw(void) if (machine_is_cerf()) cerf_kbd_init_hw(); #endif -#ifdef CONFIG_SA1100_PT_SYSTEM3 - /* TODO: add system 3 board specific functions here */ - if (machine_is_pt_system3()) - sa1111_kbd_init_hw(); -#endif } #endif /* _SA1100_KEYBOARD_H */ diff --git a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h index a6ef00569bc6..f00889d5976c 100644 --- a/include/asm-arm/hardware/sa1111.h +++ b/include/asm-arm/hardware/sa1111.h @@ -529,120 +529,31 @@ * */ -#define _KBD( x ) _SA1111( 0x0A00 ) -#define _MSE( x ) _SA1111( 0x0C00 ) - -#define _KBDCR _SA1111( 0x0A00 ) -#define _KBDSTAT _SA1111( 0x0A04 ) -#define _KBDDATA _SA1111( 0x0A08 ) -#define _KBDCLKDIV _SA1111( 0x0A0C ) -#define _KBDPRECNT _SA1111( 0x0A10 ) -#define _MSECR _SA1111( 0x0C00 ) -#define _MSESTAT _SA1111( 0x0C04 ) -#define _MSEDATA _SA1111( 0x0C08 ) -#define _MSECLKDIV _SA1111( 0x0C0C ) -#define _MSEPRECNT _SA1111( 0x0C10 ) - -#if ( LANGUAGE == C ) - -#define KBDCR __CCREG(0x0a00) -#define KBDSTAT __CCREG(0x0a04) -#define KBDDATA __CCREG(0x0a08) -#define KBDCLKDIV __CCREG(0x0a0c) -#define KBDPRECNT __CCREG(0x0a10) -#define MSECR __CCREG(0x0c00) -#define MSESTAT __CCREG(0x0c04) -#define MSEDATA __CCREG(0x0c08) -#define MSECLKDIV __CCREG(0x0c0c) -#define MSEPRECNT __CCREG(0x0c10) - -#define KBDCR_ENA 0x08 -#define KBDCR_FKD 0x02 -#define KBDCR_FKC 0x01 - -#define KBDSTAT_TXE 0x80 -#define KBDSTAT_TXB 0x40 -#define KBDSTAT_RXF 0x20 -#define KBDSTAT_RXB 0x10 -#define KBDSTAT_ENA 0x08 -#define KBDSTAT_RXP 0x04 -#define KBDSTAT_KBD 0x02 -#define KBDSTAT_KBC 0x01 - -#define KBDCLKDIV_DivVal Fld(4,0) - -#define MSECR_ENA 0x08 -#define MSECR_FKD 0x02 -#define MSECR_FKC 0x01 - -#define MSESTAT_TXE 0x80 -#define MSESTAT_TXB 0x40 -#define MSESTAT_RXF 0x20 -#define MSESTAT_RXB 0x10 -#define MSESTAT_ENA 0x08 -#define MSESTAT_RXP 0x04 -#define MSESTAT_MSD 0x02 -#define MSESTAT_MSC 0x01 - -#define MSECLKDIV_DivVal Fld(4,0) - -#define KBDTEST1_CD 0x80 -#define KBDTEST1_RC1 0x40 -#define KBDTEST1_MC 0x20 -#define KBDTEST1_C Fld(2,3) -#define KBDTEST1_T2 0x40 -#define KBDTEST1_T1 0x20 -#define KBDTEST1_T0 0x10 -#define KBDTEST2_TICBnRES 0x08 -#define KBDTEST2_RKC 0x04 -#define KBDTEST2_RKD 0x02 -#define KBDTEST2_SEL 0x01 -#define KBDTEST3_ms_16 0x80 -#define KBDTEST3_us_64 0x40 -#define KBDTEST3_us_16 0x20 -#define KBDTEST3_DIV8 0x10 -#define KBDTEST3_DIn 0x08 -#define KBDTEST3_CIn 0x04 -#define KBDTEST3_KD 0x02 -#define KBDTEST3_KC 0x01 -#define KBDTEST4_BC12 0x80 -#define KBDTEST4_BC11 0x40 -#define KBDTEST4_TRES 0x20 -#define KBDTEST4_CLKOE 0x10 -#define KBDTEST4_CRES 0x08 -#define KBDTEST4_RXB 0x04 -#define KBDTEST4_TXB 0x02 -#define KBDTEST4_SRX 0x01 - -#define MSETEST1_CD 0x80 -#define MSETEST1_RC1 0x40 -#define MSETEST1_MC 0x20 -#define MSETEST1_C Fld(2,3) -#define MSETEST1_T2 0x40 -#define MSETEST1_T1 0x20 -#define MSETEST1_T0 0x10 -#define MSETEST2_TICBnRES 0x08 -#define MSETEST2_RKC 0x04 -#define MSETEST2_RKD 0x02 -#define MSETEST2_SEL 0x01 -#define MSETEST3_ms_16 0x80 -#define MSETEST3_us_64 0x40 -#define MSETEST3_us_16 0x20 -#define MSETEST3_DIV8 0x10 -#define MSETEST3_DIn 0x08 -#define MSETEST3_CIn 0x04 -#define MSETEST3_KD 0x02 -#define MSETEST3_KC 0x01 -#define MSETEST4_BC12 0x80 -#define MSETEST4_BC11 0x40 -#define MSETEST4_TRES 0x20 -#define MSETEST4_CLKOE 0x10 -#define MSETEST4_CRES 0x08 -#define MSETEST4_RXB 0x04 -#define MSETEST4_TXB 0x02 -#define MSETEST4_SRX 0x01 +#define SA1111_KBD 0x0a00 +#define SA1111_MSE 0x0c00 -#endif /* LANGUAGE == C */ +/* + * These are offsets from the above bases. + */ +#define SA1111_PS2CR 0x0000 +#define SA1111_PS2STAT 0x0004 +#define SA1111_PS2DATA 0x0008 +#define SA1111_PS2CLKDIV 0x000c +#define SA1111_PS2PRECNT 0x0010 + +#define PS2CR_ENA 0x08 +#define PS2CR_FKD 0x02 +#define PS2CR_FKC 0x01 + +#define PS2STAT_STP 0x0100 +#define PS2STAT_TXE 0x0080 +#define PS2STAT_TXB 0x0040 +#define PS2STAT_RXF 0x0020 +#define PS2STAT_RXB 0x0010 +#define PS2STAT_ENA 0x0008 +#define PS2STAT_RXP 0x0004 +#define PS2STAT_KBD 0x0002 +#define PS2STAT_KBC 0x0001 /* * PCMCIA Interface -- cgit v1.2.3 From 5f4affe8edef521b92adb46d43fdbaa977468144 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 27 Jul 2002 18:53:40 +0100 Subject: [ARM] Cleanup fallout from global IRQ changes. Replace local_save_flags_cli with local_irq_save. Remove duplicate cli, sti, save_flags and restore_flags definitions. --- include/asm-arm/atomic.h | 14 +++++++------- include/asm-arm/proc-armv/system.h | 36 ++++++++++++++++-------------------- include/asm-arm/system.h | 7 ------- 3 files changed, 23 insertions(+), 34 deletions(-) (limited to 'include') diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h index d1b48d65ff23..ba9e4b72d821 100644 --- a/include/asm-arm/atomic.h +++ b/include/asm-arm/atomic.h @@ -36,7 +36,7 @@ static inline void atomic_add(int i, volatile atomic_t *v) { unsigned long flags; - local_save_flags_cli(flags); + local_irq_save(flags); v->counter += i; local_irq_restore(flags); } @@ -45,7 +45,7 @@ static inline void atomic_sub(int i, volatile atomic_t *v) { unsigned long flags; - local_save_flags_cli(flags); + local_irq_save(flags); v->counter -= i; local_irq_restore(flags); } @@ -54,7 +54,7 @@ static inline void atomic_inc(volatile atomic_t *v) { unsigned long flags; - local_save_flags_cli(flags); + local_irq_save(flags); v->counter += 1; local_irq_restore(flags); } @@ -63,7 +63,7 @@ static inline void atomic_dec(volatile atomic_t *v) { unsigned long flags; - local_save_flags_cli(flags); + local_irq_save(flags); v->counter -= 1; local_irq_restore(flags); } @@ -73,7 +73,7 @@ static inline int atomic_dec_and_test(volatile atomic_t *v) unsigned long flags; int val; - local_save_flags_cli(flags); + local_irq_save(flags); val = v->counter; v->counter = val -= 1; local_irq_restore(flags); @@ -86,7 +86,7 @@ static inline int atomic_add_negative(int i, volatile atomic_t *v) unsigned long flags; int val; - local_save_flags_cli(flags); + local_irq_save(flags); val = v->counter; v->counter = val += i; local_irq_restore(flags); @@ -98,7 +98,7 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) { unsigned long flags; - local_save_flags_cli(flags); + local_irq_save(flags); *addr &= ~mask; local_irq_restore(flags); } diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index d9647dc39f6a..e95668d52510 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -43,17 +43,23 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ #endif /* - * A couple of speedups for the ARM + * Save the current interrupt enable state. */ +#define local_save_flags(x) \ + ({ \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ local_save_flags" \ + : "=r" (x) : : "memory"); \ + }) /* * Save the current interrupt enable state & disable IRQs */ -#define local_save_flags_cli(x) \ +#define local_irq_save(x) \ ({ \ unsigned long temp; \ __asm__ __volatile__( \ - "mrs %0, cpsr @ save_flags_cli\n" \ + "mrs %0, cpsr @ local_irq_save\n" \ " orr %1, %0, #128\n" \ " msr cpsr_c, %1" \ : "=r" (x), "=r" (temp) \ @@ -64,11 +70,11 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * Enable IRQs */ -#define local_irq_enable() \ +#define local_irq_enable() \ ({ \ unsigned long temp; \ __asm__ __volatile__( \ - "mrs %0, cpsr @ sti\n" \ + "mrs %0, cpsr @ local_irq_enable\n" \ " bic %0, %0, #128\n" \ " msr cpsr_c, %0" \ : "=r" (temp) \ @@ -79,11 +85,11 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * Disable IRQs */ -#define local_irq_disable() \ +#define local_irq_disable() \ ({ \ unsigned long temp; \ __asm__ __volatile__( \ - "mrs %0, cpsr @ cli\n" \ + "mrs %0, cpsr @ local_irq_disable\n" \ " orr %0, %0, #128\n" \ " msr cpsr_c, %0" \ : "=r" (temp) \ @@ -121,22 +127,12 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ : "memory"); \ }) -/* - * save current IRQ & FIQ state - */ -#define local_save_flags(x) \ - __asm__ __volatile__( \ - "mrs %0, cpsr @ save_flags\n" \ - : "=r" (x) \ - : \ - : "memory") - /* * restore saved IRQ & FIQ state */ #define local_irq_restore(x) \ __asm__ __volatile__( \ - "msr cpsr_c, %0 @ restore_flags\n" \ + "msr cpsr_c, %0 @ local_irq_restore\n" \ : \ : "r" (x) \ : "memory") @@ -168,14 +164,14 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size switch (size) { #ifdef swp_is_buggy case 1: - local_save_flags_cli(flags); + local_irq_save(flags); ret = *(volatile unsigned char *)ptr; *(volatile unsigned char *)ptr = x; local_irq_restore(flags); break; case 4: - local_save_flags_cli(flags); + local_irq_save(flags); ret = *(volatile unsigned long *)ptr; *(volatile unsigned long *)ptr = x; local_irq_restore(flags); diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index f110ae2eb76b..7f62208d6b6b 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -75,9 +75,6 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info mb(); \ } while (0) -/* For spinlocks etc */ -#define local_irq_save(x) local_save_flags_cli(x) - #ifdef CONFIG_SMP #error SMP not supported @@ -91,12 +88,8 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info #define smp_rmb() barrier() #define smp_wmb() barrier() -#define cli() local_irq_disable() -#define sti() local_irq_enable() #define clf() __clf() #define stf() __stf() -#define save_flags(x) local_save_flags(x) -#define restore_flags(x) local_irq_restore(x) #endif /* CONFIG_SMP */ -- cgit v1.2.3 From 07ca706f8ae563522e7f7fae62f55b393b79c36d Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 27 Jul 2002 19:00:34 +0100 Subject: [ARM] Remove {prepare,finish}_arch_{schedule,switch} These macros are no longer required; the generic versions defined in sched.c are sufficient for ARM. --- include/asm-arm/system.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 7f62208d6b6b..25b6975fbceb 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -64,11 +64,6 @@ extern asmlinkage void __backtrace(void); struct thread_info; extern struct task_struct *__switch_to(struct thread_info *, struct thread_info *); -#define prepare_arch_schedule(prev) do { } while(0) -#define finish_arch_schedule(prev) do { } while(0) -#define prepare_arch_switch(rq) do { } while(0) -#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) - #define switch_to(prev,next,last) \ do { \ __switch_to(prev->thread_info,next->thread_info); \ -- cgit v1.2.3 From b8d99b4c25ed0cde97bf8958dcd0804afa82e3ed Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 27 Jul 2002 19:20:44 +0100 Subject: [ARM] Update ARM IRQ code for 2.5.28 global IRQ changes irq_enter/irq_exit no longer take arguments. We also use the x86 methods for hardirq.h and softirq.h; they're sufficient for ARM. --- arch/arm/kernel/irq.c | 12 ++++----- include/asm-arm/hardirq.h | 69 ++++++++++++++++++++++++++++++++++++++--------- include/asm-arm/softirq.h | 24 +++++++---------- 3 files changed, 71 insertions(+), 34 deletions(-) (limited to 'include') diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 79b647132c55..e8d788b364c7 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -217,14 +217,14 @@ do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) desc->triggered = 1; - irq_enter(cpu, irq); + irq_enter(); kstat.irqs[cpu][irq]++; action = desc->action; if (action) __do_irq(irq, desc->action, regs); - irq_exit(cpu, irq); + irq_exit(); } /* @@ -256,7 +256,7 @@ do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) */ desc->running = 1; - irq_enter(cpu, irq); + irq_enter(); kstat.irqs[cpu][irq]++; do { @@ -274,7 +274,7 @@ do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) __do_irq(irq, action, regs); } while (desc->pending); - irq_exit(cpu, irq); + irq_exit(); desc->running = 0; @@ -311,7 +311,7 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) desc->chip->ack(irq); if (likely(desc->enabled)) { - irq_enter(cpu, irq); + irq_enter(); kstat.irqs[cpu][irq]++; /* @@ -325,7 +325,7 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) !check_irq_lock(desc, irq, regs))) desc->chip->unmask(irq); } - irq_exit(cpu, irq); + irq_exit(); } } diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index c96c7a390692..0e6a5492e1e4 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h @@ -17,27 +17,70 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ /* - * Are we in an interrupt context? Either doing bottom half - * or hardware interrupt processing? + * We put the hardirq and softirq counter into the preemption + * counter. The bitmask has the following meaning: + * + * - bits 0-7 are the preemption count (max depth: 256) + * - bits 8-15 are the softirq count (max # of softirqs: 256) + * - bits 16-23 are the hardirq count (max # of hardirqs: 256) + * - bit 26 is the PREEMPT_ACTIVE flag */ -#define in_interrupt() ({ const int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) +#define PREEMPT_BITS 8 +#define SOFTIRQ_BITS 8 +#define HARDIRQ_BITS 8 -#define in_irq() (local_irq_count(smp_processor_id()) != 0) +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) -#ifndef CONFIG_SMP +#define __MASK(x) ((1UL << (x))-1) + +#define PREEMPT_MASK (__MASK(PREEMPT_BITS) << PREEMPT_SHIFT) +#define HARDIRQ_MASK (__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) +#define SOFTIRQ_MASK (__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) + +#define hardirq_count() (preempt_count() & HARDIRQ_MASK) +#define softirq_count() (preempt_count() & SOFTIRQ_MASK) +#define irq_count() (preempt_count() & (HARDIRQ_MASK|SOFTIRQ_MASK)) -#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock(cpu) do { } while (0) +#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) +#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) +#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) -#define irq_enter(cpu,irq) (local_irq_count(cpu)++) -#define irq_exit(cpu,irq) (local_irq_count(cpu)--) +/* + * The hardirq mask has to be large enough to have space + * for potentially all IRQ sources in the system nesting + * on a single CPU: + */ +#if (1 << HARDIRQ_BITS) < NR_IRQS +# error HARDIRQ_BITS is too low! +#endif -#define synchronize_irq() do { } while (0) -#define release_irqlock(cpu) do { } while (0) +/* + * Are we doing bottom half or hardware interrupt processing? + * Are we in a softirq context? Interrupt context? + */ +#define in_irq() (hardirq_count()) +#define in_softirq() (softirq_count()) +#define in_interrupt() (irq_count()) + +#define hardirq_trylock() (!in_interrupt()) +#define hardirq_endlock() do { } while (0) + +#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) + +#ifndef CONFIG_SMP +#define irq_exit() \ + do { \ + preempt_count() -= HARDIRQ_OFFSET; \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + __asm__("bl%? __do_softirq": : : "lr");/* out of line */\ + preempt_enable_no_resched(); \ + } while (0) +#define synchronize_irq(irq) barrier() #else #error SMP not supported -#endif /* CONFIG_SMP */ +#endif #endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-arm/softirq.h b/include/asm-arm/softirq.h index 6653175f53d8..3dfcdb13ecaf 100644 --- a/include/asm-arm/softirq.h +++ b/include/asm-arm/softirq.h @@ -1,26 +1,20 @@ #ifndef __ASM_SOFTIRQ_H #define __ASM_SOFTIRQ_H -#include +#include #include -#define __cpu_bh_enable(cpu) \ - do { barrier(); local_bh_count(cpu)--; preempt_enable(); } while (0) -#define cpu_bh_disable(cpu) \ - do { preempt_disable(); local_bh_count(cpu)++; barrier(); } while (0) +#define local_bh_disable() \ + do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) +#define __local_bh_enable() \ + do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) -#define local_bh_disable() cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable() __cpu_bh_enable(smp_processor_id()) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -#define _local_bh_enable() \ +#define local_bh_enable() \ do { \ - unsigned int *ptr = &local_bh_count(smp_processor_id()); \ - if (!--*ptr && ptr[-2]) \ + __local_bh_enable(); \ + if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ __asm__("bl%? __do_softirq": : : "lr");/* out of line */\ + preempt_check_resched(); \ } while (0) -#define local_bh_enable() do { _local_bh_enable(); preempt_enable(); } while (0) - #endif /* __ASM_SOFTIRQ_H */ -- cgit v1.2.3 From f9c79bf4d8ccc22dcb027370ce730480132ae401 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 27 Jul 2002 23:32:02 +0100 Subject: [ARM] Make ARM work with rmap ARM can use the generic rmap.h. It doesn't need its own version. --- include/asm-arm/proc-armv/rmap.h | 51 ---------------------------------------- include/asm-arm/rmap.h | 2 +- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 include/asm-arm/proc-armv/rmap.h (limited to 'include') diff --git a/include/asm-arm/proc-armv/rmap.h b/include/asm-arm/proc-armv/rmap.h deleted file mode 100644 index f775d26eea88..000000000000 --- a/include/asm-arm/proc-armv/rmap.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _ARMV_RMAP_H -#define _ARMV_RMAP_H -/* - * linux/include/asm-arm/proc-armv/rmap.h - * - * Architecture dependant parts of the reverse mapping code, - * - * ARM is different since hardware page tables are smaller than - * the page size and Linux uses a "duplicate" one with extra info. - * For rmap this means that the first 2 kB of a page are the hardware - * page tables and the last 2 kB are the software page tables. - */ - -static inline void pgtable_add_rmap(pte_t * ptep, struct mm_struct * mm, unsigned long address) -{ - struct page * page = virt_to_page(ptep); - - page->mm = mm; - page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1); - inc_page_state(nr_page_table_pages); -} - -static inline void pgtable_remove_rmap(pte_t * ptep) -{ - struct page * page = virt_to_page(ptep); - - page->mm = NULL; - page->index = 0; - dec_page_state(nr_page_table_pages); -} - -static inline struct mm_struct * ptep_to_mm(pte_t * ptep) -{ - struct page * page = virt_to_page(ptep); - - return page->mm; -} - -/* The page table takes half of the page */ -#define PTE_MASK ((PAGE_SIZE / 2) - 1) - -static inline unsigned long ptep_to_address(pte_t * ptep) -{ - struct page * page = virt_to_page(ptep); - unsigned long low_bits; - - low_bits = ((unsigned long)ptep & PTE_MASK) * PTRS_PER_PTE; - return page->index + low_bits; -} - -#endif /* _ARMV_RMAP_H */ diff --git a/include/asm-arm/rmap.h b/include/asm-arm/rmap.h index d79cb373829b..bb9ee93c1796 100644 --- a/include/asm-arm/rmap.h +++ b/include/asm-arm/rmap.h @@ -1,6 +1,6 @@ #ifndef _ARM_RMAP_H #define _ARM_RMAP_H -#include +#include #endif /* _ARM_RMAP_H */ -- cgit v1.2.3 From 32b3f93f9e56ba46c7af0b90aee1caf149f865be Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 27 Jul 2002 23:46:05 +0100 Subject: [ARM] Remove mach-types.h header file from asm/arch/hardware.h Someone included mach-types.h into asm/arch/hardware.h, which causes the whole kernel to needlessly rebuild when the machine type file is updated. Move mach-types.h include into the files that really need it. --- arch/arm/mach-sa1100/adsbitsy.c | 1 + arch/arm/mach-sa1100/assabet.c | 1 + arch/arm/mach-sa1100/badge4.c | 1 + arch/arm/mach-sa1100/freebird.c | 1 + arch/arm/mach-sa1100/graphicsmaster.c | 1 + arch/arm/mach-sa1100/h3600.c | 1 + arch/arm/mach-sa1100/huw_webpanel.c | 1 + arch/arm/mach-sa1100/neponset.c | 1 + arch/arm/mach-sa1100/omnimeter.c | 1 + arch/arm/mach-sa1100/pfs168.c | 1 + arch/arm/mach-sa1100/sa1111.c | 1 + arch/arm/mach-sa1100/system3.c | 1 + arch/arm/mach-sa1100/yopy.c | 1 + include/asm-arm/arch-sa1100/hardware.h | 2 -- 14 files changed, 13 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-sa1100/adsbitsy.c b/arch/arm/mach-sa1100/adsbitsy.c index dae8502155b6..30e401122666 100644 --- a/arch/arm/mach-sa1100/adsbitsy.c +++ b/arch/arm/mach-sa1100/adsbitsy.c @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index f6ab3d2415c0..124a2ea93a48 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c index 4625493b729c..029680a5ba03 100644 --- a/arch/arm/mach-sa1100/badge4.c +++ b/arch/arm/mach-sa1100/badge4.c @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/freebird.c b/arch/arm/mach-sa1100/freebird.c index 9217aa3aed6f..bb50c58a1f38 100644 --- a/arch/arm/mach-sa1100/freebird.c +++ b/arch/arm/mach-sa1100/freebird.c @@ -9,6 +9,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/graphicsmaster.c b/arch/arm/mach-sa1100/graphicsmaster.c index 1c31e2bd791c..ed144191fa1c 100644 --- a/arch/arm/mach-sa1100/graphicsmaster.c +++ b/arch/arm/mach-sa1100/graphicsmaster.c @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index befe3fa5a93e..000125e4f95a 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/huw_webpanel.c b/arch/arm/mach-sa1100/huw_webpanel.c index 2015e3f5c094..348bbaa9c078 100644 --- a/arch/arm/mach-sa1100/huw_webpanel.c +++ b/arch/arm/mach-sa1100/huw_webpanel.c @@ -8,6 +8,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index bdcef2cb001a..a731a2680d84 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm/mach-sa1100/omnimeter.c b/arch/arm/mach-sa1100/omnimeter.c index 8666559dcf7c..0da9d76637b8 100644 --- a/arch/arm/mach-sa1100/omnimeter.c +++ b/arch/arm/mach-sa1100/omnimeter.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/pfs168.c b/arch/arm/mach-sa1100/pfs168.c index 34ef3dc3ad4d..b374138964b3 100644 --- a/arch/arm/mach-sa1100/pfs168.c +++ b/arch/arm/mach-sa1100/pfs168.c @@ -9,6 +9,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-sa1100/sa1111.c b/arch/arm/mach-sa1100/sa1111.c index b54e48622b68..90f62e5fffee 100644 --- a/arch/arm/mach-sa1100/sa1111.c +++ b/arch/arm/mach-sa1100/sa1111.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm/mach-sa1100/system3.c b/arch/arm/mach-sa1100/system3.c index 397b35c84d3c..33f8d01d340e 100644 --- a/arch/arm/mach-sa1100/system3.c +++ b/arch/arm/mach-sa1100/system3.c @@ -44,6 +44,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm/mach-sa1100/yopy.c b/arch/arm/mach-sa1100/yopy.c index f52c5d7683ee..dc6ea9d9dfeb 100644 --- a/arch/arm/mach-sa1100/yopy.c +++ b/arch/arm/mach-sa1100/yopy.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h index f12446570ffd..8a505f6c3ed3 100644 --- a/include/asm-arm/arch-sa1100/hardware.h +++ b/include/asm-arm/arch-sa1100/hardware.h @@ -13,8 +13,6 @@ #define __ASM_ARCH_HARDWARE_H #include -#include - /* Flushing areas */ #define FLUSH_BASE_PHYS 0xe0000000 /* SA1100 zero bank */ -- cgit v1.2.3 From 9f3d6f92336aca4d1291a65af652045142eca0e7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 27 Jul 2002 06:07:03 -0700 Subject: [PATCH] Hot-plug CPU notifier warning fix As pointed out by Andrew Morton, this fixes: softirq.c: In function `spawn_ksoftirqd': softirq.c:416: warning: statement with no effect --- include/linux/smp.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/smp.h b/include/linux/smp.h index 454fdcdf14d2..df77d136f5e2 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -101,9 +101,13 @@ static inline void smp_send_reschedule_all(void) { } #define this_cpu(var) var /* Need to know about CPUs going up/down? */ -#define register_cpu_notifier(nb) 0 -#define unregister_cpu_notifier(nb) do { } while(0) - +static inline int register_cpu_notifier(struct notifier_block *nb) +{ + return 0; +} +static inline void unregister_cpu_notifier(struct notifier_block *nb) +{ +} #endif /* !SMP */ #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) -- cgit v1.2.3 From c997a03d28c9c79cd65ecfec3bd08097cb20f2bc Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Sat, 27 Jul 2002 06:08:53 -0700 Subject: [PATCH] LSM file locking patch is bogus - Remove third argument from file_lock security op. Whether the lock is blocking or not cannot make any difference to a security module! - Fix the call in sys_flock to pass the translated lock command, not the original. - Add a call in fcntl_setlease. If they're going to know about two types of lock, let's tell them about the third too. --- fs/locks.c | 12 ++++++------ include/linux/security.h | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/fs/locks.c b/fs/locks.c index cb801127400a..3b606b44e7df 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1242,6 +1242,9 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg) return -EACCES; if (!S_ISREG(inode->i_mode)) return -EINVAL; + error = security_ops->file_lock(filp, arg); + if (error) + return error; lock_kernel(); @@ -1359,8 +1362,7 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int cmd) if (error < 0) goto out_putf; - error = security_ops->file_lock(filp, cmd, - (cmd & LOCK_NB) ? 0 : 1); + error = security_ops->file_lock(filp, lock->fl_type); if (error) goto out_putf; @@ -1494,8 +1496,7 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock *l) goto out; } - error = security_ops->file_lock(filp, file_lock->fl_type, - cmd == F_SETLKW); + error = security_ops->file_lock(filp, file_lock->fl_type); if (error) goto out; @@ -1618,8 +1619,7 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 *l) goto out; } - error = security_ops->file_lock(filp, file_lock->fl_type, - cmd == F_SETLKW64); + error = security_ops->file_lock(filp, file_lock->fl_type); if (error) goto out; diff --git a/include/linux/security.h b/include/linux/security.h index 156e9ddce632..34fd73a0fed2 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -407,7 +407,6 @@ struct swap_info_struct; * @file contains the file structure. * @cmd contains the posix-translated lock operation to perform * (e.g. F_RDLCK, F_WRLCK). - * @blocking indicates if the request is for a blocking lock. * Return 0 if permission is granted. * @file_fcntl: * Check permission before allowing the file operation specified by @cmd @@ -753,7 +752,7 @@ struct security_operations { int (*file_mmap) (struct file * file, unsigned long prot, unsigned long flags); int (*file_mprotect) (struct vm_area_struct * vma, unsigned long prot); - int (*file_lock) (struct file * file, unsigned int cmd, int blocking); + int (*file_lock) (struct file * file, unsigned int cmd); int (*file_fcntl) (struct file * file, unsigned int cmd, unsigned long arg); int (*file_set_fowner) (struct file * file); -- cgit v1.2.3 From 0884bb3507a878d1a55a630f1e67d287f3ee1e32 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 27 Jul 2002 06:09:26 -0700 Subject: [PATCH] PATCH: 2.5.29 Fix cmd640 config locking We use the pci host lock so that we lock config space portably while handling the CMD640 config space via our own routines to avoid pci bios tripping CMD640 hardware stuff. We need to use this lock in order to ensure that we lock at a portable layer. Also add the 2.4.19 fixes for avoiding wrong probes, and the fix noted on the list. --- drivers/ide/cmd640.c | 86 +++++++++++++++++++++++++++++++++++++++++----------- drivers/pci/access.c | 3 +- include/linux/pci.h | 2 ++ 3 files changed, 72 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c index e8325b9e7690..5b37260142f6 100644 --- a/drivers/ide/cmd640.c +++ b/drivers/ide/cmd640.c @@ -109,6 +109,7 @@ #include #include #include +#include #include @@ -214,19 +215,16 @@ static unsigned int cmd640_chip_version; * Therefore, we must use direct IO instead. */ -/* This is broken, but no more so than the old code.. */ -static spinlock_t cmd640_lock = SPIN_LOCK_UNLOCKED; - /* PCI method 1 access */ static void put_cmd640_reg_pci1 (unsigned short reg, u8 val) { unsigned long flags; - - spin_lock_irqsave(&cmd640_lock, flags); - outl_p((reg & 0xfc) | cmd640_key, 0xcf8); + + spin_lock_irqsave(&pci_lock, flags); + outb_p((reg & 0xfc) | cmd640_key, 0xcf8); outb_p(val, (reg & 3) | 0xcfc); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&pci_lock, flags); } static u8 get_cmd640_reg_pci1 (unsigned short reg) @@ -234,10 +232,10 @@ static u8 get_cmd640_reg_pci1 (unsigned short reg) u8 b; unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); - outl_p((reg & 0xfc) | cmd640_key, 0xcf8); - b = inb_p((reg & 3) | 0xcfc); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_lock_irqsave(&pci_lock, flags); + outb_p((reg & 0xfc) | cmd640_key, 0xcf8); + b=inb_p((reg & 3) | 0xcfc); + spin_unlock_irqrestore(&pci_lock, flags); return b; } @@ -247,11 +245,11 @@ static void put_cmd640_reg_pci2 (unsigned short reg, u8 val) { unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&pci_lock, flags); outb_p(0x10, 0xcf8); outb_p(val, cmd640_key + reg); outb_p(0, 0xcf8); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&pci_lock, flags); } static u8 get_cmd640_reg_pci2 (unsigned short reg) @@ -259,11 +257,11 @@ static u8 get_cmd640_reg_pci2 (unsigned short reg) u8 b; unsigned long flags; - spin_lock_irqsave(&cmd640_lock, flags); + spin_lock_irqsave(&pci_lock, flags); outb_p(0x10, 0xcf8); b = inb_p(cmd640_key + reg); outb_p(0, 0xcf8); - spin_unlock_irqrestore(&cmd640_lock, flags); + spin_unlock_irqrestore(&pci_lock, flags); return b; } @@ -574,7 +572,7 @@ static void program_drive_counts (unsigned int index) /* * Now that everything is ready, program the new timings */ - spin_lock(&cmd640_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); /* * Program the address_setup clocks into ARTTIM reg, * and then the active/recovery counts into the DRWTIM reg @@ -695,9 +693,61 @@ out_lock: #endif +/** + * pci_conf1 - check for PCI type 1 configuration + * + * Issues a safe probe sequence for PCI configuration type 1 and + * returns non-zero if conf1 is supported. Takes the pci_config lock + */ + +static int pci_conf1(void) +{ + u32 tmp; + unsigned long flags; + + spin_lock_irqsave(&pci_lock, flags); + + OUT_BYTE(0x01, 0xCFB); + tmp = inl(0xCF8); + outl(0x80000000, 0xCF8); + if (inl(0xCF8) == 0x80000000) { + spin_unlock_irqrestore(&pci_lock, flags); + outl(tmp, 0xCF8); + return 1; + } + outl(tmp, 0xCF8); + spin_unlock_irqrestore(&pci_lock, flags); + return 0; +} + +/** + * pci_conf2 - check for PCI type 2 configuration + * + * Issues a safe probe sequence for PCI configuration type 2 and + * returns non-zero if conf2 is supported. Takes the pci_config lock. + */ + + +static int pci_conf2(void) +{ + unsigned long flags; + spin_lock_irqsave(&pci_lock, flags); + + OUT_BYTE(0x00, 0xCFB); + OUT_BYTE(0x00, 0xCF8); + OUT_BYTE(0x00, 0xCFA); + if (IN_BYTE(0xCF8) == 0x00 && IN_BYTE(0xCFA) == 0x00) { + spin_unlock_irqrestore(&pci_lock, flags); + return 1; + } + spin_unlock_irqrestore(&pci_lock, flags); + return 0; +} + /* * Probe for a cmd640 chipset, and initialize it if found. Called from ide.c */ + int __init ide_probe_for_cmd640x(void) { #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED @@ -712,9 +762,9 @@ int __init ide_probe_for_cmd640x(void) bus_type = "VLB"; } else { cmd640_vlb = 0; - if (probe_for_cmd640_pci1()) + if (pci_conf1() && probe_for_cmd640_pci1()) bus_type = "PCI (type1)"; - else if (probe_for_cmd640_pci2()) + else if (pci_conf2() && probe_for_cmd640_pci2()) bus_type = "PCI (type2)"; else return 0; diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 5546095e5a1f..53c08e427647 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c @@ -7,7 +7,7 @@ * configuration space. */ -static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED; +spinlock_t pci_lock = SPIN_LOCK_UNLOCKED; /* * Wrappers for all PCI configuration access functions. They just check @@ -44,3 +44,4 @@ EXPORT_SYMBOL(pci_read_config_dword); EXPORT_SYMBOL(pci_write_config_byte); EXPORT_SYMBOL(pci_write_config_word); EXPORT_SYMBOL(pci_write_config_dword); +EXPORT_SYMBOL(pci_lock); diff --git a/include/linux/pci.h b/include/linux/pci.h index 5099b9f382e0..c5f593251536 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -567,6 +567,8 @@ int pci_write_config_byte(struct pci_dev *dev, int where, u8 val); int pci_write_config_word(struct pci_dev *dev, int where, u16 val); int pci_write_config_dword(struct pci_dev *dev, int where, u32 val); +extern spinlock_t pci_lock; + int pci_enable_device(struct pci_dev *dev); void pci_disable_device(struct pci_dev *dev); void pci_set_master(struct pci_dev *dev); -- cgit v1.2.3