diff options
159 files changed, 1605 insertions, 1571 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 71729d0f013d..4ec2dd5455f3 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -176,7 +176,7 @@ config MACH_DECSTATION | |||
176 | bool "DECstations" | 176 | bool "DECstations" |
177 | select BOOT_ELF32 | 177 | select BOOT_ELF32 |
178 | select DMA_NONCOHERENT | 178 | select DMA_NONCOHERENT |
179 | select EARLY_PRINTK | 179 | select SYS_HAS_EARLY_PRINTK |
180 | select IRQ_CPU | 180 | select IRQ_CPU |
181 | select SYS_HAS_CPU_R3000 | 181 | select SYS_HAS_CPU_R3000 |
182 | select SYS_HAS_CPU_R4X00 | 182 | select SYS_HAS_CPU_R4X00 |
@@ -242,6 +242,7 @@ config MACH_JAZZ | |||
242 | config LASAT | 242 | config LASAT |
243 | bool "LASAT Networks platforms" | 243 | bool "LASAT Networks platforms" |
244 | select DMA_NONCOHERENT | 244 | select DMA_NONCOHERENT |
245 | select SYS_HAS_EARLY_PRINTK | ||
245 | select HW_HAS_PCI | 246 | select HW_HAS_PCI |
246 | select MIPS_GT64120 | 247 | select MIPS_GT64120 |
247 | select MIPS_NILE4 | 248 | select MIPS_NILE4 |
@@ -256,6 +257,7 @@ config MIPS_ATLAS | |||
256 | bool "MIPS Atlas board" | 257 | bool "MIPS Atlas board" |
257 | select BOOT_ELF32 | 258 | select BOOT_ELF32 |
258 | select DMA_NONCOHERENT | 259 | select DMA_NONCOHERENT |
260 | select SYS_HAS_EARLY_PRINTK | ||
259 | select IRQ_CPU | 261 | select IRQ_CPU |
260 | select HW_HAS_PCI | 262 | select HW_HAS_PCI |
261 | select MIPS_BOARDS_GEN | 263 | select MIPS_BOARDS_GEN |
@@ -301,6 +303,7 @@ config MIPS_MALTA | |||
301 | select SYS_HAS_CPU_MIPS64_R1 | 303 | select SYS_HAS_CPU_MIPS64_R1 |
302 | select SYS_HAS_CPU_NEVADA | 304 | select SYS_HAS_CPU_NEVADA |
303 | select SYS_HAS_CPU_RM7000 | 305 | select SYS_HAS_CPU_RM7000 |
306 | select SYS_HAS_EARLY_PRINTK | ||
304 | select SYS_SUPPORTS_32BIT_KERNEL | 307 | select SYS_SUPPORTS_32BIT_KERNEL |
305 | select SYS_SUPPORTS_64BIT_KERNEL | 308 | select SYS_SUPPORTS_64BIT_KERNEL |
306 | select SYS_SUPPORTS_BIG_ENDIAN | 309 | select SYS_SUPPORTS_BIG_ENDIAN |
@@ -316,6 +319,7 @@ config MIPS_SEAD | |||
316 | depends on EXPERIMENTAL | 319 | depends on EXPERIMENTAL |
317 | select IRQ_CPU | 320 | select IRQ_CPU |
318 | select DMA_NONCOHERENT | 321 | select DMA_NONCOHERENT |
322 | select SYS_HAS_EARLY_PRINTK | ||
319 | select MIPS_BOARDS_GEN | 323 | select MIPS_BOARDS_GEN |
320 | select SYS_HAS_CPU_MIPS32_R1 | 324 | select SYS_HAS_CPU_MIPS32_R1 |
321 | select SYS_HAS_CPU_MIPS32_R2 | 325 | select SYS_HAS_CPU_MIPS32_R2 |
@@ -353,9 +357,11 @@ config WR_PPMC | |||
353 | config MIPS_SIM | 357 | config MIPS_SIM |
354 | bool 'MIPS simulator (MIPSsim)' | 358 | bool 'MIPS simulator (MIPSsim)' |
355 | select DMA_NONCOHERENT | 359 | select DMA_NONCOHERENT |
360 | select SYS_HAS_EARLY_PRINTK | ||
356 | select IRQ_CPU | 361 | select IRQ_CPU |
357 | select SYS_HAS_CPU_MIPS32_R1 | 362 | select SYS_HAS_CPU_MIPS32_R1 |
358 | select SYS_HAS_CPU_MIPS32_R2 | 363 | select SYS_HAS_CPU_MIPS32_R2 |
364 | select SYS_HAS_EARLY_PRINTK | ||
359 | select SYS_SUPPORTS_32BIT_KERNEL | 365 | select SYS_SUPPORTS_32BIT_KERNEL |
360 | select SYS_SUPPORTS_BIG_ENDIAN | 366 | select SYS_SUPPORTS_BIG_ENDIAN |
361 | select SYS_SUPPORTS_LITTLE_ENDIAN | 367 | select SYS_SUPPORTS_LITTLE_ENDIAN |
@@ -376,6 +382,7 @@ config MOMENCO_JAGUAR_ATX | |||
376 | select RM7000_CPU_SCACHE | 382 | select RM7000_CPU_SCACHE |
377 | select SWAP_IO_SPACE | 383 | select SWAP_IO_SPACE |
378 | select SYS_HAS_CPU_RM9000 | 384 | select SYS_HAS_CPU_RM9000 |
385 | select SYS_HAS_EARLY_PRINTK | ||
379 | select SYS_SUPPORTS_32BIT_KERNEL | 386 | select SYS_SUPPORTS_32BIT_KERNEL |
380 | select SYS_SUPPORTS_64BIT_KERNEL | 387 | select SYS_SUPPORTS_64BIT_KERNEL |
381 | select SYS_SUPPORTS_BIG_ENDIAN | 388 | select SYS_SUPPORTS_BIG_ENDIAN |
@@ -513,6 +520,7 @@ config PMC_YOSEMITE | |||
513 | select IRQ_CPU_RM9K | 520 | select IRQ_CPU_RM9K |
514 | select SWAP_IO_SPACE | 521 | select SWAP_IO_SPACE |
515 | select SYS_HAS_CPU_RM9000 | 522 | select SYS_HAS_CPU_RM9000 |
523 | select SYS_HAS_EARLY_PRINTK | ||
516 | select SYS_SUPPORTS_32BIT_KERNEL | 524 | select SYS_SUPPORTS_32BIT_KERNEL |
517 | select SYS_SUPPORTS_64BIT_KERNEL | 525 | select SYS_SUPPORTS_64BIT_KERNEL |
518 | select SYS_SUPPORTS_BIG_ENDIAN | 526 | select SYS_SUPPORTS_BIG_ENDIAN |
@@ -573,6 +581,7 @@ config SGI_IP22 | |||
573 | select SWAP_IO_SPACE | 581 | select SWAP_IO_SPACE |
574 | select SYS_HAS_CPU_R4X00 | 582 | select SYS_HAS_CPU_R4X00 |
575 | select SYS_HAS_CPU_R5000 | 583 | select SYS_HAS_CPU_R5000 |
584 | select SYS_HAS_EARLY_PRINTK | ||
576 | select SYS_SUPPORTS_32BIT_KERNEL | 585 | select SYS_SUPPORTS_32BIT_KERNEL |
577 | select SYS_SUPPORTS_64BIT_KERNEL | 586 | select SYS_SUPPORTS_64BIT_KERNEL |
578 | select SYS_SUPPORTS_BIG_ENDIAN | 587 | select SYS_SUPPORTS_BIG_ENDIAN |
@@ -587,7 +596,7 @@ config SGI_IP27 | |||
587 | select ARC64 | 596 | select ARC64 |
588 | select BOOT_ELF64 | 597 | select BOOT_ELF64 |
589 | select DMA_IP27 | 598 | select DMA_IP27 |
590 | select EARLY_PRINTK | 599 | select SYS_HAS_EARLY_PRINTK |
591 | select HW_HAS_PCI | 600 | select HW_HAS_PCI |
592 | select NR_CPUS_DEFAULT_64 | 601 | select NR_CPUS_DEFAULT_64 |
593 | select PCI_DOMAINS | 602 | select PCI_DOMAINS |
@@ -749,6 +758,7 @@ config SNI_RM | |||
749 | select SYS_HAS_CPU_R5000 | 758 | select SYS_HAS_CPU_R5000 |
750 | select SYS_HAS_CPU_R10000 | 759 | select SYS_HAS_CPU_R10000 |
751 | select R5000_CPU_SCACHE | 760 | select R5000_CPU_SCACHE |
761 | select SYS_HAS_EARLY_PRINTK | ||
752 | select SYS_SUPPORTS_32BIT_KERNEL | 762 | select SYS_SUPPORTS_32BIT_KERNEL |
753 | select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL | 763 | select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL |
754 | select SYS_SUPPORTS_BIG_ENDIAN | 764 | select SYS_SUPPORTS_BIG_ENDIAN |
@@ -897,6 +907,20 @@ config DMA_NEED_PCI_MAP_STATE | |||
897 | bool | 907 | bool |
898 | 908 | ||
899 | config EARLY_PRINTK | 909 | config EARLY_PRINTK |
910 | bool "Early printk" if EMBEDDED && DEBUG_KERNEL | ||
911 | depends on SYS_HAS_EARLY_PRINTK | ||
912 | default y | ||
913 | help | ||
914 | This option enables special console drivers which allow the kernel | ||
915 | to print messages very early in the bootup process. | ||
916 | |||
917 | This is useful for kernel debugging when your machine crashes very | ||
918 | early before the console code is initialized. For normal operation | ||
919 | it is not recommended because it looks on some machines ugly and | ||
920 | oesn't cooperate with an X server. You should normally N here, | ||
921 | unless you want to debug such a crash. | ||
922 | |||
923 | config SYS_HAS_EARLY_PRINTK | ||
900 | bool | 924 | bool |
901 | 925 | ||
902 | config GENERIC_ISA_DMA | 926 | config GENERIC_ISA_DMA |
@@ -1033,6 +1057,7 @@ config SOC_PNX8550 | |||
1033 | select DMA_NONCOHERENT | 1057 | select DMA_NONCOHERENT |
1034 | select HW_HAS_PCI | 1058 | select HW_HAS_PCI |
1035 | select SYS_HAS_CPU_MIPS32_R1 | 1059 | select SYS_HAS_CPU_MIPS32_R1 |
1060 | select SYS_HAS_EARLY_PRINTK | ||
1036 | select SYS_SUPPORTS_32BIT_KERNEL | 1061 | select SYS_SUPPORTS_32BIT_KERNEL |
1037 | select GENERIC_HARDIRQS_NO__DO_IRQ | 1062 | select GENERIC_HARDIRQS_NO__DO_IRQ |
1038 | select SYS_SUPPORTS_KGDB | 1063 | select SYS_SUPPORTS_KGDB |
@@ -1093,7 +1118,7 @@ config HAVE_STD_PC_SERIAL_PORT | |||
1093 | 1118 | ||
1094 | config ARC_CONSOLE | 1119 | config ARC_CONSOLE |
1095 | bool "ARC console support" | 1120 | bool "ARC console support" |
1096 | depends on SGI_IP22 || SNI_RM | 1121 | depends on SGI_IP22 || (SNI_RM && CPU_LITTLE_ENDIAN) |
1097 | 1122 | ||
1098 | config ARC_MEMORY | 1123 | config ARC_MEMORY |
1099 | bool | 1124 | bool |
@@ -1895,10 +1920,6 @@ config HZ | |||
1895 | 1920 | ||
1896 | source "kernel/Kconfig.preempt" | 1921 | source "kernel/Kconfig.preempt" |
1897 | 1922 | ||
1898 | config RTC_DS1742 | ||
1899 | bool "DS1742 BRAM/RTC support" | ||
1900 | depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927 | ||
1901 | |||
1902 | config MIPS_INSANE_LARGE | 1923 | config MIPS_INSANE_LARGE |
1903 | bool "Support for large 64-bit configurations" | 1924 | bool "Support for large 64-bit configurations" |
1904 | depends on CPU_R10000 && 64BIT | 1925 | depends on CPU_R10000 && 64BIT |
diff --git a/arch/mips/arc/console.c b/arch/mips/arc/console.c index 6a9d144512c0..0fe6032999cb 100644 --- a/arch/mips/arc/console.c +++ b/arch/mips/arc/console.c | |||
@@ -29,35 +29,3 @@ void prom_putchar(char c) | |||
29 | ArcWrite(1, &it, 1, &cnt); | 29 | ArcWrite(1, &it, 1, &cnt); |
30 | bc_enable(); | 30 | bc_enable(); |
31 | } | 31 | } |
32 | |||
33 | char prom_getchar(void) | ||
34 | { | ||
35 | ULONG cnt; | ||
36 | CHAR c; | ||
37 | |||
38 | bc_disable(); | ||
39 | ArcRead(0, &c, 1, &cnt); | ||
40 | bc_enable(); | ||
41 | |||
42 | return c; | ||
43 | } | ||
44 | |||
45 | void prom_printf(char *fmt, ...) | ||
46 | { | ||
47 | va_list args; | ||
48 | char ppbuf[1024]; | ||
49 | char *bptr; | ||
50 | |||
51 | va_start(args, fmt); | ||
52 | vsprintf(ppbuf, fmt, args); | ||
53 | |||
54 | bptr = ppbuf; | ||
55 | |||
56 | while (*bptr != 0) { | ||
57 | if (*bptr == '\n') | ||
58 | prom_putchar('\r'); | ||
59 | |||
60 | prom_putchar(*bptr++); | ||
61 | } | ||
62 | va_end(args); | ||
63 | } | ||
diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c index 76ab505ca693..0ac8f42d3752 100644 --- a/arch/mips/arc/init.c +++ b/arch/mips/arc/init.c | |||
@@ -24,12 +24,15 @@ void __init prom_init(void) | |||
24 | { | 24 | { |
25 | PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK; | 25 | PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK; |
26 | romvec = ROMVECTOR; | 26 | romvec = ROMVECTOR; |
27 | ULONG cnt; | ||
28 | CHAR c; | ||
29 | |||
27 | prom_argc = fw_arg0; | 30 | prom_argc = fw_arg0; |
28 | _prom_argv = (LONG *) fw_arg1; | 31 | _prom_argv = (LONG *) fw_arg1; |
29 | _prom_envp = (LONG *) fw_arg2; | 32 | _prom_envp = (LONG *) fw_arg2; |
30 | 33 | ||
31 | if (pb->magic != 0x53435241) { | 34 | if (pb->magic != 0x53435241) { |
32 | prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic); | 35 | printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", pb->magic); |
33 | while(1) | 36 | while(1) |
34 | ; | 37 | ; |
35 | } | 38 | } |
@@ -41,8 +44,8 @@ void __init prom_init(void) | |||
41 | prom_meminit(); | 44 | prom_meminit(); |
42 | 45 | ||
43 | #ifdef DEBUG_PROM_INIT | 46 | #ifdef DEBUG_PROM_INIT |
44 | prom_printf("Press a key to reboot\n"); | 47 | pr_info("Press a key to reboot\n"); |
45 | prom_getchar(); | 48 | ArcRead(0, &c, 1, &cnt); |
46 | ArcEnterInteractiveMode(); | 49 | ArcEnterInteractiveMode(); |
47 | #endif | 50 | #endif |
48 | } | 51 | } |
diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c index 456cb81a32d9..83d15791ef6a 100644 --- a/arch/mips/arc/memory.c +++ b/arch/mips/arc/memory.c | |||
@@ -118,11 +118,11 @@ void __init prom_meminit(void) | |||
118 | #ifdef DEBUG | 118 | #ifdef DEBUG |
119 | int i = 0; | 119 | int i = 0; |
120 | 120 | ||
121 | prom_printf("ARCS MEMORY DESCRIPTOR dump:\n"); | 121 | printk("ARCS MEMORY DESCRIPTOR dump:\n"); |
122 | p = ArcGetMemoryDescriptor(PROM_NULL_MDESC); | 122 | p = ArcGetMemoryDescriptor(PROM_NULL_MDESC); |
123 | while(p) { | 123 | while(p) { |
124 | prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n", | 124 | printk("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n", |
125 | i, p, p->base, p->pages, mtypes(p->type)); | 125 | i, p, p->base, p->pages, mtypes(p->type)); |
126 | p = ArcGetMemoryDescriptor(p); | 126 | p = ArcGetMemoryDescriptor(p); |
127 | i++; | 127 | i++; |
128 | } | 128 | } |
diff --git a/arch/mips/arc/tree.c b/arch/mips/arc/tree.c index 2aedd4f52839..abd1786ea09b 100644 --- a/arch/mips/arc/tree.c +++ b/arch/mips/arc/tree.c | |||
@@ -93,11 +93,11 @@ static char *iflags[] = { | |||
93 | static void __init | 93 | static void __init |
94 | dump_component(pcomponent *p) | 94 | dump_component(pcomponent *p) |
95 | { | 95 | { |
96 | prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>", | 96 | printk("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>", |
97 | p, classes[p->class], types[p->type], | 97 | p, classes[p->class], types[p->type], |
98 | iflags[p->iflags], p->vers, p->rev); | 98 | iflags[p->iflags], p->vers, p->rev); |
99 | prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n", | 99 | printk("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n", |
100 | p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname); | 100 | p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname); |
101 | } | 101 | } |
102 | 102 | ||
103 | static void __init | 103 | static void __init |
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c index 13f9bf5f91a6..7bc5af8917da 100644 --- a/arch/mips/au1000/mtx-1/board_setup.c +++ b/arch/mips/au1000/mtx-1/board_setup.c | |||
@@ -43,6 +43,9 @@ | |||
43 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
44 | #include <asm/mach-au1x00/au1000.h> | 44 | #include <asm/mach-au1x00/au1000.h> |
45 | 45 | ||
46 | extern int (*board_pci_idsel)(unsigned int devsel, int assert); | ||
47 | int mtx1_pci_idsel(unsigned int devsel, int assert); | ||
48 | |||
46 | void board_reset (void) | 49 | void board_reset (void) |
47 | { | 50 | { |
48 | /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ | 51 | /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ |
@@ -66,19 +69,43 @@ void __init board_setup(void) | |||
66 | #endif | 69 | #endif |
67 | 70 | ||
68 | // initialize sys_pinfunc: | 71 | // initialize sys_pinfunc: |
69 | // disable second ethernet port (SYS_PF_NI2) | 72 | au_writel( SYS_PF_NI2, SYS_PINFUNC ); |
70 | // set U3/GPIO23 to GPIO23 (SYS_PF_U3) | ||
71 | au_writel( SYS_PF_NI2 | SYS_PF_U3, SYS_PINFUNC ); | ||
72 | 73 | ||
73 | // initialize GPIO | 74 | // initialize GPIO |
74 | au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); | 75 | au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); |
75 | au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF | 76 | au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF |
76 | au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF | 77 | au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF |
78 | au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON | ||
77 | au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF | 79 | au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF |
78 | 80 | ||
79 | // enable LED and set it to green | 81 | // enable LED and set it to green |
80 | au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); | 82 | au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); |
81 | au_writel( 0x18000800, GPIO2_OUTPUT ); | 83 | au_writel( 0x18000800, GPIO2_OUTPUT ); |
82 | 84 | ||
85 | board_pci_idsel = mtx1_pci_idsel; | ||
86 | |||
83 | printk("4G Systems MTX-1 Board\n"); | 87 | printk("4G Systems MTX-1 Board\n"); |
84 | } | 88 | } |
89 | |||
90 | int | ||
91 | mtx1_pci_idsel(unsigned int devsel, int assert) | ||
92 | { | ||
93 | #define MTX_IDSEL_ONLY_0_AND_3 0 | ||
94 | #if MTX_IDSEL_ONLY_0_AND_3 | ||
95 | if (devsel != 0 && devsel != 3) { | ||
96 | printk("*** not 0 or 3\n"); | ||
97 | return 0; | ||
98 | } | ||
99 | #endif | ||
100 | |||
101 | if (assert && devsel != 0) { | ||
102 | // supress signal to cardbus | ||
103 | au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF | ||
104 | } | ||
105 | else { | ||
106 | au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON | ||
107 | } | ||
108 | au_sync_udelay(1); | ||
109 | return 1; | ||
110 | } | ||
111 | |||
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c index 4693a4eb2b82..a4fa0f227e42 100644 --- a/arch/mips/au1000/mtx-1/irqmap.c +++ b/arch/mips/au1000/mtx-1/irqmap.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <asm/mach-au1x00/au1000.h> | 48 | #include <asm/mach-au1x00/au1000.h> |
49 | 49 | ||
50 | char irq_tab_alchemy[][5] __initdata = { | 50 | char irq_tab_alchemy[][5] __initdata = { |
51 | [0] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */ | 51 | [0] = { -1, INTA, INTA, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */ |
52 | [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ | 52 | [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ |
53 | [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */ | 53 | [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */ |
54 | [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ | 54 | [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ |
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c index 46c23b66bc17..fff20d28114f 100644 --- a/arch/mips/cobalt/console.c +++ b/arch/mips/cobalt/console.c | |||
@@ -19,29 +19,3 @@ static void putchar(int c) | |||
19 | 19 | ||
20 | COBALT_UART[UART_TX] = c; | 20 | COBALT_UART[UART_TX] = c; |
21 | } | 21 | } |
22 | |||
23 | static void cons_write(struct console *c, const char *s, unsigned n) | ||
24 | { | ||
25 | while(n-- && *s) | ||
26 | putchar(*s++); | ||
27 | } | ||
28 | |||
29 | static struct console cons_info = | ||
30 | { | ||
31 | .name = "uart", | ||
32 | .write = cons_write, | ||
33 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
34 | .index = -1, | ||
35 | }; | ||
36 | |||
37 | void __init cobalt_early_console(void) | ||
38 | { | ||
39 | register_console(&cons_info); | ||
40 | |||
41 | printk("Cobalt: early console registered\n"); | ||
42 | } | ||
43 | |||
44 | void __init disable_early_printk(void) | ||
45 | { | ||
46 | unregister_console(&cons_info); | ||
47 | } | ||
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c index 415ff8710b55..88d34f11385a 100644 --- a/arch/mips/cobalt/setup.c +++ b/arch/mips/cobalt/setup.c | |||
@@ -79,37 +79,38 @@ static struct resource cobalt_io_resource = { | |||
79 | .flags = IORESOURCE_IO | 79 | .flags = IORESOURCE_IO |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static struct resource cobalt_io_resources[] = { | 82 | /* |
83 | { | 83 | * Cobalt doesn't have PS/2 keyboard/mouse interfaces, |
84 | * keyboard conntroller is never used. | ||
85 | * Also PCI-ISA bridge DMA contoroller is never used. | ||
86 | */ | ||
87 | static struct resource cobalt_reserved_resources[] = { | ||
88 | { /* dma1 */ | ||
84 | .start = 0x00, | 89 | .start = 0x00, |
85 | .end = 0x1f, | 90 | .end = 0x1f, |
86 | .name = "dma1", | 91 | .name = "reserved", |
87 | .flags = IORESOURCE_BUSY | 92 | .flags = IORESOURCE_BUSY | IORESOURCE_IO, |
88 | }, { | 93 | }, |
89 | .start = 0x40, | 94 | { /* keyboard */ |
90 | .end = 0x5f, | ||
91 | .name = "timer", | ||
92 | .flags = IORESOURCE_BUSY | ||
93 | }, { | ||
94 | .start = 0x60, | 95 | .start = 0x60, |
95 | .end = 0x6f, | 96 | .end = 0x6f, |
96 | .name = "keyboard", | 97 | .name = "reserved", |
97 | .flags = IORESOURCE_BUSY | 98 | .flags = IORESOURCE_BUSY | IORESOURCE_IO, |
98 | }, { | 99 | }, |
100 | { /* dma page reg */ | ||
99 | .start = 0x80, | 101 | .start = 0x80, |
100 | .end = 0x8f, | 102 | .end = 0x8f, |
101 | .name = "dma page reg", | 103 | .name = "reserved", |
102 | .flags = IORESOURCE_BUSY | 104 | .flags = IORESOURCE_BUSY | IORESOURCE_IO, |
103 | }, { | 105 | }, |
106 | { /* dma2 */ | ||
104 | .start = 0xc0, | 107 | .start = 0xc0, |
105 | .end = 0xdf, | 108 | .end = 0xdf, |
106 | .name = "dma2", | 109 | .name = "reserved", |
107 | .flags = IORESOURCE_BUSY | 110 | .flags = IORESOURCE_BUSY | IORESOURCE_IO, |
108 | }, | 111 | }, |
109 | }; | 112 | }; |
110 | 113 | ||
111 | #define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource)) | ||
112 | |||
113 | static struct pci_controller cobalt_pci_controller = { | 114 | static struct pci_controller cobalt_pci_controller = { |
114 | .pci_ops = >64111_pci_ops, | 115 | .pci_ops = >64111_pci_ops, |
115 | .mem_resource = &cobalt_mem_resource, | 116 | .mem_resource = &cobalt_mem_resource, |
@@ -133,9 +134,9 @@ void __init plat_mem_setup(void) | |||
133 | /* I/O port resource must include LCD/buttons */ | 134 | /* I/O port resource must include LCD/buttons */ |
134 | ioport_resource.end = 0x0fffffff; | 135 | ioport_resource.end = 0x0fffffff; |
135 | 136 | ||
136 | /* request I/O space for devices used on all i[345]86 PCs */ | 137 | /* These resources have been reserved by VIA SuperI/O chip. */ |
137 | for (i = 0; i < COBALT_IO_RESOURCES; i++) | 138 | for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++) |
138 | request_resource(&ioport_resource, cobalt_io_resources + i); | 139 | request_resource(&ioport_resource, cobalt_reserved_resources + i); |
139 | 140 | ||
140 | /* Read the cobalt id register out of the PCI config space */ | 141 | /* Read the cobalt id register out of the PCI config space */ |
141 | PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3)); | 142 | PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3)); |
@@ -150,10 +151,6 @@ void __init plat_mem_setup(void) | |||
150 | #endif | 151 | #endif |
151 | 152 | ||
152 | if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { | 153 | if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { |
153 | #ifdef CONFIG_EARLY_PRINTK | ||
154 | cobalt_early_console(); | ||
155 | #endif | ||
156 | |||
157 | #ifdef CONFIG_SERIAL_8250 | 154 | #ifdef CONFIG_SERIAL_8250 |
158 | uart.line = 0; | 155 | uart.line = 0; |
159 | uart.type = PORT_UNKNOWN; | 156 | uart.type = PORT_UNKNOWN; |
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig index 9ebb522fbbbd..98b9fbc042f4 100644 --- a/arch/mips/configs/jmr3927_defconfig +++ b/arch/mips/configs/jmr3927_defconfig | |||
@@ -148,7 +148,6 @@ CONFIG_HZ=1000 | |||
148 | CONFIG_PREEMPT_NONE=y | 148 | CONFIG_PREEMPT_NONE=y |
149 | # CONFIG_PREEMPT_VOLUNTARY is not set | 149 | # CONFIG_PREEMPT_VOLUNTARY is not set |
150 | # CONFIG_PREEMPT is not set | 150 | # CONFIG_PREEMPT is not set |
151 | CONFIG_RTC_DS1742=y | ||
152 | # CONFIG_KEXEC is not set | 151 | # CONFIG_KEXEC is not set |
153 | CONFIG_LOCKDEP_SUPPORT=y | 152 | CONFIG_LOCKDEP_SUPPORT=y |
154 | CONFIG_STACKTRACE_SUPPORT=y | 153 | CONFIG_STACKTRACE_SUPPORT=y |
@@ -802,7 +801,28 @@ CONFIG_USB_ARCH_HAS_EHCI=y | |||
802 | # | 801 | # |
803 | # Real Time Clock | 802 | # Real Time Clock |
804 | # | 803 | # |
805 | # CONFIG_RTC_CLASS is not set | 804 | CONFIG_RTC_LIB=y |
805 | CONFIG_RTC_CLASS=y | ||
806 | CONFIG_RTC_HCTOSYS=y | ||
807 | CONFIG_RTC_HCTOSYS_DEVICE="rtc0" | ||
808 | # CONFIG_RTC_DEBUG is not set | ||
809 | |||
810 | # | ||
811 | # RTC interfaces | ||
812 | # | ||
813 | CONFIG_RTC_INTF_SYSFS=y | ||
814 | CONFIG_RTC_INTF_PROC=y | ||
815 | CONFIG_RTC_INTF_DEV=y | ||
816 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set | ||
817 | |||
818 | # | ||
819 | # RTC drivers | ||
820 | # | ||
821 | # CONFIG_RTC_DRV_DS1553 is not set | ||
822 | CONFIG_RTC_DRV_DS1742=y | ||
823 | # CONFIG_RTC_DRV_M48T86 is not set | ||
824 | # CONFIG_RTC_DRV_TEST is not set | ||
825 | # CONFIG_RTC_DRV_V3020 is not set | ||
806 | 826 | ||
807 | # | 827 | # |
808 | # DMA Engine support | 828 | # DMA Engine support |
diff --git a/arch/mips/dec/prom/console.c b/arch/mips/dec/prom/console.c index cade16ec7e5a..65419bf32441 100644 --- a/arch/mips/dec/prom/console.c +++ b/arch/mips/dec/prom/console.c | |||
@@ -16,40 +16,12 @@ | |||
16 | 16 | ||
17 | #include <asm/dec/prom.h> | 17 | #include <asm/dec/prom.h> |
18 | 18 | ||
19 | static void __init prom_console_write(struct console *con, const char *s, | 19 | void prom_putchar(char c) |
20 | unsigned int c) | ||
21 | { | 20 | { |
22 | static char sfmt[] __initdata = "%%%us"; | 21 | char s[2]; |
23 | char fmt[13]; | ||
24 | 22 | ||
25 | snprintf(fmt, sizeof(fmt), sfmt, c); | 23 | s[0] = c; |
26 | prom_printf(fmt, s); | 24 | s[1] = '\0'; |
27 | } | ||
28 | |||
29 | static struct console promcons __initdata = { | ||
30 | .name = "prom", | ||
31 | .write = prom_console_write, | ||
32 | .flags = CON_PRINTBUFFER, | ||
33 | .index = -1, | ||
34 | }; | ||
35 | |||
36 | static int promcons_output __initdata = 0; | ||
37 | |||
38 | void __init register_prom_console(void) | ||
39 | { | ||
40 | if (!promcons_output) { | ||
41 | promcons_output = 1; | ||
42 | register_console(&promcons); | ||
43 | } | ||
44 | } | ||
45 | 25 | ||
46 | void __init unregister_prom_console(void) | 26 | prom_printf( s); |
47 | { | ||
48 | if (promcons_output) { | ||
49 | unregister_console(&promcons); | ||
50 | promcons_output = 0; | ||
51 | } | ||
52 | } | 27 | } |
53 | |||
54 | void disable_early_printk(void) | ||
55 | __attribute__((alias("unregister_prom_console"))); | ||
diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c index c4e3c1ea0d48..cd85924e2572 100644 --- a/arch/mips/dec/prom/identify.c +++ b/arch/mips/dec/prom/identify.c | |||
@@ -26,9 +26,6 @@ | |||
26 | 26 | ||
27 | #include "dectypes.h" | 27 | #include "dectypes.h" |
28 | 28 | ||
29 | extern unsigned long mips_machgroup; | ||
30 | extern unsigned long mips_machtype; | ||
31 | |||
32 | static const char *dec_system_strings[] = { | 29 | static const char *dec_system_strings[] = { |
33 | [MACH_DSUNKNOWN] "unknown DECstation", | 30 | [MACH_DSUNKNOWN] "unknown DECstation", |
34 | [MACH_DS23100] "DECstation 2100/3100", | 31 | [MACH_DS23100] "DECstation 2100/3100", |
diff --git a/arch/mips/gt64120/ev64120/promcon.c b/arch/mips/gt64120/ev64120/promcon.c index b5937c4ba7db..6e0ecfed9640 100644 --- a/arch/mips/gt64120/ev64120/promcon.c +++ b/arch/mips/gt64120/ev64120/promcon.c | |||
@@ -24,11 +24,6 @@ static void prom_console_write(struct console *co, const char *s, | |||
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | int prom_getchar(void) | ||
28 | { | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static struct console sercons = { | 27 | static struct console sercons = { |
33 | .name = "ttyS", | 28 | .name = "ttyS", |
34 | .write = prom_console_write, | 29 | .write = prom_console_write, |
diff --git a/arch/mips/jmr3927/common/Makefile b/arch/mips/jmr3927/common/Makefile index cb09a8eede15..01e7db19bcbe 100644 --- a/arch/mips/jmr3927/common/Makefile +++ b/arch/mips/jmr3927/common/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the common code of TOSHIBA JMR-TX3927 board | 2 | # Makefile for the common code of TOSHIBA JMR-TX3927 board |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += prom.o puts.o rtc_ds1742.o | 5 | obj-y += prom.o puts.o |
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c deleted file mode 100644 index e6561345d12a..000000000000 --- a/arch/mips/jmr3927/common/rtc_ds1742.c +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2001 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. | ||
4 | * ahennessy@mvista.com | ||
5 | * | ||
6 | * arch/mips/jmr3927/common/rtc_ds1742.c | ||
7 | * Based on arch/mips/ddb5xxx/common/rtc_ds1386.c | ||
8 | * low-level RTC hookups for s for Dallas 1742 chip. | ||
9 | * | ||
10 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | |||
33 | |||
34 | /* | ||
35 | * This file exports a function, rtc_ds1386_init(), which expects an | ||
36 | * uncached base address as the argument. It will set the two function | ||
37 | * pointers expected by the MIPS generic timer code. | ||
38 | */ | ||
39 | |||
40 | #include <linux/bcd.h> | ||
41 | #include <linux/types.h> | ||
42 | #include <linux/time.h> | ||
43 | #include <linux/rtc.h> | ||
44 | #include <linux/ds1742rtc.h> | ||
45 | |||
46 | #include <asm/time.h> | ||
47 | #include <asm/addrspace.h> | ||
48 | |||
49 | #include <asm/debug.h> | ||
50 | |||
51 | #define EPOCH 2000 | ||
52 | |||
53 | static unsigned long rtc_base; | ||
54 | |||
55 | static unsigned long | ||
56 | rtc_ds1742_get_time(void) | ||
57 | { | ||
58 | unsigned int year, month, day, hour, minute, second; | ||
59 | unsigned int century; | ||
60 | unsigned long flags; | ||
61 | |||
62 | spin_lock_irqsave(&rtc_lock, flags); | ||
63 | rtc_write(RTC_READ, RTC_CONTROL); | ||
64 | second = BCD2BIN(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK); | ||
65 | minute = BCD2BIN(rtc_read(RTC_MINUTES)); | ||
66 | hour = BCD2BIN(rtc_read(RTC_HOURS)); | ||
67 | day = BCD2BIN(rtc_read(RTC_DATE)); | ||
68 | month = BCD2BIN(rtc_read(RTC_MONTH)); | ||
69 | year = BCD2BIN(rtc_read(RTC_YEAR)); | ||
70 | century = BCD2BIN(rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK); | ||
71 | rtc_write(0, RTC_CONTROL); | ||
72 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
73 | |||
74 | year += century * 100; | ||
75 | |||
76 | return mktime(year, month, day, hour, minute, second); | ||
77 | } | ||
78 | extern void to_tm(unsigned long tim, struct rtc_time * tm); | ||
79 | |||
80 | static int | ||
81 | rtc_ds1742_set_time(unsigned long t) | ||
82 | { | ||
83 | struct rtc_time tm; | ||
84 | u8 year, month, day, hour, minute, second; | ||
85 | u8 cmos_year, cmos_month, cmos_day, cmos_hour, cmos_minute, cmos_second; | ||
86 | int cmos_century; | ||
87 | unsigned long flags; | ||
88 | |||
89 | spin_lock_irqsave(&rtc_lock, flags); | ||
90 | rtc_write(RTC_READ, RTC_CONTROL); | ||
91 | cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK); | ||
92 | cmos_minute = (u8)rtc_read(RTC_MINUTES); | ||
93 | cmos_hour = (u8)rtc_read(RTC_HOURS); | ||
94 | cmos_day = (u8)rtc_read(RTC_DATE); | ||
95 | cmos_month = (u8)rtc_read(RTC_MONTH); | ||
96 | cmos_year = (u8)rtc_read(RTC_YEAR); | ||
97 | cmos_century = rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK; | ||
98 | |||
99 | rtc_write(RTC_WRITE, RTC_CONTROL); | ||
100 | |||
101 | /* convert */ | ||
102 | to_tm(t, &tm); | ||
103 | |||
104 | /* check each field one by one */ | ||
105 | year = BIN2BCD(tm.tm_year - EPOCH); | ||
106 | if (year != cmos_year) { | ||
107 | rtc_write(year,RTC_YEAR); | ||
108 | } | ||
109 | |||
110 | month = BIN2BCD(tm.tm_mon); | ||
111 | if (month != (cmos_month & 0x1f)) { | ||
112 | rtc_write((month & 0x1f) | (cmos_month & ~0x1f),RTC_MONTH); | ||
113 | } | ||
114 | |||
115 | day = BIN2BCD(tm.tm_mday); | ||
116 | if (day != cmos_day) { | ||
117 | |||
118 | rtc_write(day, RTC_DATE); | ||
119 | } | ||
120 | |||
121 | if (cmos_hour & 0x40) { | ||
122 | /* 12 hour format */ | ||
123 | hour = 0x40; | ||
124 | if (tm.tm_hour > 12) { | ||
125 | hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f); | ||
126 | } else { | ||
127 | hour |= BIN2BCD(tm.tm_hour); | ||
128 | } | ||
129 | } else { | ||
130 | /* 24 hour format */ | ||
131 | hour = BIN2BCD(tm.tm_hour) & 0x3f; | ||
132 | } | ||
133 | if (hour != cmos_hour) rtc_write(hour, RTC_HOURS); | ||
134 | |||
135 | minute = BIN2BCD(tm.tm_min); | ||
136 | if (minute != cmos_minute) { | ||
137 | rtc_write(minute, RTC_MINUTES); | ||
138 | } | ||
139 | |||
140 | second = BIN2BCD(tm.tm_sec); | ||
141 | if (second != cmos_second) { | ||
142 | rtc_write(second & RTC_SECONDS_MASK,RTC_SECONDS); | ||
143 | } | ||
144 | |||
145 | /* RTC_CENTURY and RTC_CONTROL share same address... */ | ||
146 | rtc_write(cmos_century, RTC_CONTROL); | ||
147 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | void | ||
153 | rtc_ds1742_init(unsigned long base) | ||
154 | { | ||
155 | u8 cmos_second; | ||
156 | |||
157 | /* remember the base */ | ||
158 | rtc_base = base; | ||
159 | db_assert((rtc_base & 0xe0000000) == KSEG1); | ||
160 | |||
161 | /* set the function pointers */ | ||
162 | rtc_mips_get_time = rtc_ds1742_get_time; | ||
163 | rtc_mips_set_time = rtc_ds1742_set_time; | ||
164 | |||
165 | /* clear oscillator stop bit */ | ||
166 | rtc_write(RTC_READ, RTC_CONTROL); | ||
167 | cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK); | ||
168 | rtc_write(RTC_WRITE, RTC_CONTROL); | ||
169 | rtc_write(cmos_second, RTC_SECONDS); /* clear msb */ | ||
170 | rtc_write(0, RTC_CONTROL); | ||
171 | } | ||
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c index 7ca3d6d07b34..fc523bda068f 100644 --- a/arch/mips/jmr3927/rbhma3100/setup.c +++ b/arch/mips/jmr3927/rbhma3100/setup.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/param.h> /* for HZ */ | 45 | #include <linux/param.h> /* for HZ */ |
46 | #include <linux/delay.h> | 46 | #include <linux/delay.h> |
47 | #include <linux/pm.h> | 47 | #include <linux/pm.h> |
48 | #include <linux/platform_device.h> | ||
48 | #ifdef CONFIG_SERIAL_TXX9 | 49 | #ifdef CONFIG_SERIAL_TXX9 |
49 | #include <linux/tty.h> | 50 | #include <linux/tty.h> |
50 | #include <linux/serial.h> | 51 | #include <linux/serial.h> |
@@ -137,10 +138,6 @@ int jmr3927_ccfg_toeon = 0; | |||
137 | 138 | ||
138 | static inline void do_reset(void) | 139 | static inline void do_reset(void) |
139 | { | 140 | { |
140 | #ifdef CONFIG_TC35815 | ||
141 | extern void tc35815_killall(void); | ||
142 | tc35815_killall(); | ||
143 | #endif | ||
144 | #if 1 /* Resetting PCI bus */ | 141 | #if 1 /* Resetting PCI bus */ |
145 | jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); | 142 | jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); |
146 | jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR); | 143 | jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR); |
@@ -176,19 +173,10 @@ static cycle_t jmr3927_hpt_read(void) | |||
176 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; | 173 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; |
177 | } | 174 | } |
178 | 175 | ||
179 | #define USE_RTC_DS1742 | ||
180 | #ifdef USE_RTC_DS1742 | ||
181 | extern void rtc_ds1742_init(unsigned long base); | ||
182 | #endif | ||
183 | static void __init jmr3927_time_init(void) | 176 | static void __init jmr3927_time_init(void) |
184 | { | 177 | { |
185 | clocksource_mips.read = jmr3927_hpt_read; | 178 | clocksource_mips.read = jmr3927_hpt_read; |
186 | mips_hpt_frequency = JMR3927_TIMER_CLK; | 179 | mips_hpt_frequency = JMR3927_TIMER_CLK; |
187 | #ifdef USE_RTC_DS1742 | ||
188 | if (jmr3927_have_nvram()) { | ||
189 | rtc_ds1742_init(JMR3927_IOC_NVRAMB_ADDR); | ||
190 | } | ||
191 | #endif | ||
192 | } | 180 | } |
193 | 181 | ||
194 | void __init plat_timer_setup(struct irqaction *irq) | 182 | void __init plat_timer_setup(struct irqaction *irq) |
@@ -544,3 +532,32 @@ void __init tx3927_setup(void) | |||
544 | printk("TX3927 D-Cache WriteBack (CWF) .\n"); | 532 | printk("TX3927 D-Cache WriteBack (CWF) .\n"); |
545 | } | 533 | } |
546 | } | 534 | } |
535 | |||
536 | /* This trick makes rtc-ds1742 driver usable as is. */ | ||
537 | unsigned long __swizzle_addr_b(unsigned long port) | ||
538 | { | ||
539 | if ((port & 0xffff0000) != JMR3927_IOC_NVRAMB_ADDR) | ||
540 | return port; | ||
541 | port = (port & 0xffff0000) | (port & 0x7fff << 1); | ||
542 | #ifdef __BIG_ENDIAN | ||
543 | return port; | ||
544 | #else | ||
545 | return port | 1; | ||
546 | #endif | ||
547 | } | ||
548 | EXPORT_SYMBOL(__swizzle_addr_b); | ||
549 | |||
550 | static int __init jmr3927_rtc_init(void) | ||
551 | { | ||
552 | struct resource res = { | ||
553 | .start = JMR3927_IOC_NVRAMB_ADDR - IO_BASE, | ||
554 | .end = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1, | ||
555 | .flags = IORESOURCE_MEM, | ||
556 | }; | ||
557 | struct platform_device *dev; | ||
558 | if (!jmr3927_have_nvram()) | ||
559 | return -ENODEV; | ||
560 | dev = platform_device_register_simple("ds1742", -1, &res, 1); | ||
561 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
562 | } | ||
563 | device_initcall(jmr3927_rtc_init); | ||
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index a3dad394acb7..49246264cc7c 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -65,5 +65,6 @@ obj-$(CONFIG_64BIT) += cpu-bugs64.o | |||
65 | obj-$(CONFIG_I8253) += i8253.o | 65 | obj-$(CONFIG_I8253) += i8253.o |
66 | 66 | ||
67 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o | 67 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o |
68 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | ||
68 | 69 | ||
69 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | 70 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) |
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c new file mode 100644 index 000000000000..304efdc5682f --- /dev/null +++ b/arch/mips/kernel/early_printk.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org) | ||
7 | * Copyright (C) 2007 MIPS Technologies, Inc. | ||
8 | * written by Ralf Baechle (ralf@linux-mips.org) | ||
9 | */ | ||
10 | #include <linux/console.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | extern void prom_putchar(char); | ||
14 | |||
15 | static void early_console_write(struct console *con, const char *s, unsigned n) | ||
16 | { | ||
17 | while (n-- && *s) { | ||
18 | if (*s == '\n') | ||
19 | prom_putchar('\r'); | ||
20 | prom_putchar(*s); | ||
21 | s++; | ||
22 | } | ||
23 | } | ||
24 | |||
25 | static struct console early_console = { | ||
26 | .name = "early", | ||
27 | .write = early_console_write, | ||
28 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
29 | .index = -1 | ||
30 | }; | ||
31 | |||
32 | void __init setup_early_printk(void) | ||
33 | { | ||
34 | register_console(&early_console); | ||
35 | } | ||
36 | |||
37 | void __init disable_early_printk(void) | ||
38 | { | ||
39 | unregister_console(&early_console); | ||
40 | } | ||
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index fc4dd6c9dd80..30d433f14f93 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -166,34 +166,6 @@ out: | |||
166 | return error; | 166 | return error; |
167 | } | 167 | } |
168 | 168 | ||
169 | asmlinkage long | ||
170 | sysn32_waitid(int which, compat_pid_t pid, | ||
171 | siginfo_t __user *uinfo, int options, | ||
172 | struct compat_rusage __user *uru) | ||
173 | { | ||
174 | struct rusage ru; | ||
175 | long ret; | ||
176 | mm_segment_t old_fs = get_fs(); | ||
177 | int si_signo; | ||
178 | |||
179 | if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo))) | ||
180 | return -EFAULT; | ||
181 | |||
182 | set_fs (KERNEL_DS); | ||
183 | ret = sys_waitid(which, pid, uinfo, options, | ||
184 | uru ? (struct rusage __user *) &ru : NULL); | ||
185 | set_fs (old_fs); | ||
186 | |||
187 | if (__get_user(si_signo, &uinfo->si_signo)) | ||
188 | return -EFAULT; | ||
189 | if (ret < 0 || si_signo == 0) | ||
190 | return ret; | ||
191 | |||
192 | if (uru) | ||
193 | ret = put_compat_rusage(&ru, uru); | ||
194 | return ret; | ||
195 | } | ||
196 | |||
197 | #define RLIM_INFINITY32 0x7fffffff | 169 | #define RLIM_INFINITY32 0x7fffffff |
198 | #define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) | 170 | #define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) |
199 | 171 | ||
@@ -572,151 +544,6 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad, | |||
572 | flags); | 544 | flags); |
573 | } | 545 | } |
574 | 546 | ||
575 | /* Argument list sizes for sys_socketcall */ | ||
576 | #define AL(x) ((x) * sizeof(unsigned int)) | ||
577 | static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | ||
578 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | ||
579 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)}; | ||
580 | #undef AL | ||
581 | |||
582 | /* | ||
583 | * System call vectors. | ||
584 | * | ||
585 | * Argument checking cleaned up. Saved 20% in size. | ||
586 | * This function doesn't need to set the kernel lock because | ||
587 | * it is set by the callees. | ||
588 | */ | ||
589 | |||
590 | asmlinkage long sys32_socketcall(int call, unsigned int __user *args32) | ||
591 | { | ||
592 | unsigned int a[6]; | ||
593 | unsigned int a0,a1; | ||
594 | int err; | ||
595 | |||
596 | extern asmlinkage long sys_socket(int family, int type, int protocol); | ||
597 | extern asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen); | ||
598 | extern asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen); | ||
599 | extern asmlinkage long sys_listen(int fd, int backlog); | ||
600 | extern asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen); | ||
601 | extern asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len); | ||
602 | extern asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len); | ||
603 | extern asmlinkage long sys_socketpair(int family, int type, int protocol, int __user *usockvec); | ||
604 | extern asmlinkage long sys_send(int fd, void __user * buff, size_t len, unsigned flags); | ||
605 | extern asmlinkage long sys_sendto(int fd, void __user * buff, size_t len, unsigned flags, | ||
606 | struct sockaddr __user *addr, int addr_len); | ||
607 | extern asmlinkage long sys_recv(int fd, void __user * ubuf, size_t size, unsigned flags); | ||
608 | extern asmlinkage long sys_recvfrom(int fd, void __user * ubuf, size_t size, unsigned flags, | ||
609 | struct sockaddr __user *addr, int __user *addr_len); | ||
610 | extern asmlinkage long sys_shutdown(int fd, int how); | ||
611 | extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen); | ||
612 | extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen); | ||
613 | extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); | ||
614 | extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags); | ||
615 | |||
616 | |||
617 | if(call<1||call>SYS_RECVMSG) | ||
618 | return -EINVAL; | ||
619 | |||
620 | /* copy_from_user should be SMP safe. */ | ||
621 | if (copy_from_user(a, args32, socketcall_nargs[call])) | ||
622 | return -EFAULT; | ||
623 | |||
624 | a0=a[0]; | ||
625 | a1=a[1]; | ||
626 | |||
627 | switch(call) | ||
628 | { | ||
629 | case SYS_SOCKET: | ||
630 | err = sys_socket(a0,a1,a[2]); | ||
631 | break; | ||
632 | case SYS_BIND: | ||
633 | err = sys_bind(a0,(struct sockaddr __user *)A(a1), a[2]); | ||
634 | break; | ||
635 | case SYS_CONNECT: | ||
636 | err = sys_connect(a0, (struct sockaddr __user *)A(a1), a[2]); | ||
637 | break; | ||
638 | case SYS_LISTEN: | ||
639 | err = sys_listen(a0,a1); | ||
640 | break; | ||
641 | case SYS_ACCEPT: | ||
642 | err = sys_accept(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2])); | ||
643 | break; | ||
644 | case SYS_GETSOCKNAME: | ||
645 | err = sys_getsockname(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2])); | ||
646 | break; | ||
647 | case SYS_GETPEERNAME: | ||
648 | err = sys_getpeername(a0, (struct sockaddr __user *)A(a1), (int __user *)A(a[2])); | ||
649 | break; | ||
650 | case SYS_SOCKETPAIR: | ||
651 | err = sys_socketpair(a0,a1, a[2], (int __user *)A(a[3])); | ||
652 | break; | ||
653 | case SYS_SEND: | ||
654 | err = sys_send(a0, (void __user *)A(a1), a[2], a[3]); | ||
655 | break; | ||
656 | case SYS_SENDTO: | ||
657 | err = sys_sendto(a0,(void __user *)A(a1), a[2], a[3], | ||
658 | (struct sockaddr __user *)A(a[4]), a[5]); | ||
659 | break; | ||
660 | case SYS_RECV: | ||
661 | err = sys_recv(a0, (void __user *)A(a1), a[2], a[3]); | ||
662 | break; | ||
663 | case SYS_RECVFROM: | ||
664 | err = sys_recvfrom(a0, (void __user *)A(a1), a[2], a[3], | ||
665 | (struct sockaddr __user *)A(a[4]), (int __user *)A(a[5])); | ||
666 | break; | ||
667 | case SYS_SHUTDOWN: | ||
668 | err = sys_shutdown(a0,a1); | ||
669 | break; | ||
670 | case SYS_SETSOCKOPT: | ||
671 | err = sys_setsockopt(a0, a1, a[2], (char __user *)A(a[3]), a[4]); | ||
672 | break; | ||
673 | case SYS_GETSOCKOPT: | ||
674 | err = sys_getsockopt(a0, a1, a[2], (char __user *)A(a[3]), (int __user *)A(a[4])); | ||
675 | break; | ||
676 | case SYS_SENDMSG: | ||
677 | err = sys_sendmsg(a0, (struct msghdr __user *) A(a1), a[2]); | ||
678 | break; | ||
679 | case SYS_RECVMSG: | ||
680 | err = sys_recvmsg(a0, (struct msghdr __user *) A(a1), a[2]); | ||
681 | break; | ||
682 | default: | ||
683 | err = -EINVAL; | ||
684 | break; | ||
685 | } | ||
686 | return err; | ||
687 | } | ||
688 | |||
689 | struct sigevent32 { | ||
690 | u32 sigev_value; | ||
691 | u32 sigev_signo; | ||
692 | u32 sigev_notify; | ||
693 | u32 payload[(64 / 4) - 3]; | ||
694 | }; | ||
695 | |||
696 | extern asmlinkage long | ||
697 | sys_timer_create(clockid_t which_clock, | ||
698 | struct sigevent __user *timer_event_spec, | ||
699 | timer_t __user * created_timer_id); | ||
700 | |||
701 | long | ||
702 | sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id) | ||
703 | { | ||
704 | struct sigevent __user *p = NULL; | ||
705 | if (se32) { | ||
706 | struct sigevent se; | ||
707 | p = compat_alloc_user_space(sizeof(struct sigevent)); | ||
708 | memset(&se, 0, sizeof(struct sigevent)); | ||
709 | if (get_user(se.sigev_value.sival_int, &se32->sigev_value) || | ||
710 | __get_user(se.sigev_signo, &se32->sigev_signo) || | ||
711 | __get_user(se.sigev_notify, &se32->sigev_notify) || | ||
712 | __copy_from_user(&se._sigev_un._pad, &se32->payload, | ||
713 | sizeof(se32->payload)) || | ||
714 | copy_to_user(p, &se, sizeof(se))) | ||
715 | return -EFAULT; | ||
716 | } | ||
717 | return sys_timer_create(clock, p, timer_id); | ||
718 | } | ||
719 | |||
720 | save_static_function(sys32_clone); | 547 | save_static_function(sys32_clone); |
721 | __attribute_used__ noinline static int | 548 | __attribute_used__ noinline static int |
722 | _sys32_clone(nabi_no_regargs struct pt_regs regs) | 549 | _sys32_clone(nabi_no_regargs struct pt_regs regs) |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 2ceda4644a4d..f17e31e3bff2 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -340,7 +340,7 @@ EXPORT(sysn32_call_table) | |||
340 | PTR compat_sys_statfs64 | 340 | PTR compat_sys_statfs64 |
341 | PTR compat_sys_fstatfs64 | 341 | PTR compat_sys_fstatfs64 |
342 | PTR sys_sendfile64 | 342 | PTR sys_sendfile64 |
343 | PTR sys32_timer_create /* 6220 */ | 343 | PTR compat_sys_timer_create /* 6220 */ |
344 | PTR compat_sys_timer_settime | 344 | PTR compat_sys_timer_settime |
345 | PTR compat_sys_timer_gettime | 345 | PTR compat_sys_timer_gettime |
346 | PTR sys_timer_getoverrun | 346 | PTR sys_timer_getoverrun |
@@ -361,7 +361,7 @@ EXPORT(sysn32_call_table) | |||
361 | PTR compat_sys_mq_notify | 361 | PTR compat_sys_mq_notify |
362 | PTR compat_sys_mq_getsetattr | 362 | PTR compat_sys_mq_getsetattr |
363 | PTR sys_ni_syscall /* 6240, sys_vserver */ | 363 | PTR sys_ni_syscall /* 6240, sys_vserver */ |
364 | PTR sysn32_waitid | 364 | PTR compat_sys_waitid |
365 | PTR sys_ni_syscall /* available, was setaltroot */ | 365 | PTR sys_ni_syscall /* available, was setaltroot */ |
366 | PTR sys_add_key | 366 | PTR sys_add_key |
367 | PTR sys_request_key | 367 | PTR sys_request_key |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index bcc42489dc3c..142c9b70c026 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -307,7 +307,7 @@ sys_call_table: | |||
307 | PTR compat_sys_statfs | 307 | PTR compat_sys_statfs |
308 | PTR compat_sys_fstatfs /* 4100 */ | 308 | PTR compat_sys_fstatfs /* 4100 */ |
309 | PTR sys_ni_syscall /* sys_ioperm */ | 309 | PTR sys_ni_syscall /* sys_ioperm */ |
310 | PTR sys32_socketcall | 310 | PTR compat_sys_socketcall |
311 | PTR sys_syslog | 311 | PTR sys_syslog |
312 | PTR compat_sys_setitimer | 312 | PTR compat_sys_setitimer |
313 | PTR compat_sys_getitimer /* 4105 */ | 313 | PTR compat_sys_getitimer /* 4105 */ |
@@ -462,7 +462,7 @@ sys_call_table: | |||
462 | PTR sys_fadvise64_64 | 462 | PTR sys_fadvise64_64 |
463 | PTR compat_sys_statfs64 /* 4255 */ | 463 | PTR compat_sys_statfs64 /* 4255 */ |
464 | PTR compat_sys_fstatfs64 | 464 | PTR compat_sys_fstatfs64 |
465 | PTR sys32_timer_create | 465 | PTR compat_sys_timer_create |
466 | PTR compat_sys_timer_settime | 466 | PTR compat_sys_timer_settime |
467 | PTR compat_sys_timer_gettime | 467 | PTR compat_sys_timer_gettime |
468 | PTR sys_timer_getoverrun /* 4260 */ | 468 | PTR sys_timer_getoverrun /* 4260 */ |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 11ab222a2e97..4975da0bfb63 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -525,6 +525,14 @@ void __init setup_arch(char **cmdline_p) | |||
525 | { | 525 | { |
526 | cpu_probe(); | 526 | cpu_probe(); |
527 | prom_init(); | 527 | prom_init(); |
528 | |||
529 | #ifdef CONFIG_EARLY_PRINTK | ||
530 | { | ||
531 | extern void setup_early_printk(void); | ||
532 | |||
533 | setup_early_printk(); | ||
534 | } | ||
535 | #endif | ||
528 | cpu_report(); | 536 | cpu_report(); |
529 | 537 | ||
530 | #if defined(CONFIG_VT) | 538 | #if defined(CONFIG_VT) |
diff --git a/arch/mips/lasat/lasat_board.c b/arch/mips/lasat/lasat_board.c index d425120b0282..fbe9a87bd0ad 100644 --- a/arch/mips/lasat/lasat_board.c +++ b/arch/mips/lasat/lasat_board.c | |||
@@ -110,12 +110,13 @@ int lasat_init_board_info(void) | |||
110 | sizeof(struct lasat_eeprom_struct) - 4); | 110 | sizeof(struct lasat_eeprom_struct) - 4); |
111 | 111 | ||
112 | if (crc != lasat_board_info.li_eeprom_info.crc32) { | 112 | if (crc != lasat_board_info.li_eeprom_info.crc32) { |
113 | prom_printf("WARNING...\nWARNING...\nEEPROM CRC does not match calculated, attempting to soldier on...\n"); | 113 | printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM CRC does " |
114 | "not match calculated, attempting to soldier on...\n"); | ||
114 | } | 115 | } |
115 | 116 | ||
116 | if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION) | 117 | if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION) { |
117 | { | 118 | printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM version " |
118 | prom_printf("WARNING...\nWARNING...\nEEPROM version %d, wanted version %d, attempting to soldier on...\n", | 119 | "%d, wanted version %d, attempting to soldier on...\n", |
119 | (unsigned int)lasat_board_info.li_eeprom_info.version, | 120 | (unsigned int)lasat_board_info.li_eeprom_info.version, |
120 | LASAT_EEPROM_VERSION); | 121 | LASAT_EEPROM_VERSION); |
121 | } | 122 | } |
@@ -124,7 +125,9 @@ int lasat_init_board_info(void) | |||
124 | cfg1 = lasat_board_info.li_eeprom_info.cfg[1]; | 125 | cfg1 = lasat_board_info.li_eeprom_info.cfg[1]; |
125 | 126 | ||
126 | if ( LASAT_W0_DSCTYPE(cfg0) != 1) { | 127 | if ( LASAT_W0_DSCTYPE(cfg0) != 1) { |
127 | prom_printf("WARNING...\nWARNING...\nInvalid configuration read from EEPROM, attempting to soldier on..."); | 128 | printk(KERN_WARNING "WARNING...\nWARNING...\n" |
129 | "Invalid configuration read from EEPROM, attempting to " | ||
130 | "soldier on..."); | ||
128 | } | 131 | } |
129 | /* We have a valid configuration */ | 132 | /* We have a valid configuration */ |
130 | 133 | ||
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c index d47692f73a26..812c6ac366be 100644 --- a/arch/mips/lasat/prom.c +++ b/arch/mips/lasat/prom.c | |||
@@ -23,10 +23,6 @@ | |||
23 | #define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1) | 23 | #define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1) |
24 | #define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2) | 24 | #define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2) |
25 | 25 | ||
26 | static void null_prom_printf(const char * fmt, ...) | ||
27 | { | ||
28 | } | ||
29 | |||
30 | static void null_prom_display(const char *string, int pos, int clear) | 26 | static void null_prom_display(const char *string, int pos, int clear) |
31 | { | 27 | { |
32 | } | 28 | } |
@@ -40,50 +36,29 @@ static void null_prom_putc(char c) | |||
40 | } | 36 | } |
41 | 37 | ||
42 | /* these are functions provided by the bootloader */ | 38 | /* these are functions provided by the bootloader */ |
43 | static void (* prom_putc)(char c) = null_prom_putc; | 39 | static void (* __prom_putc)(char c) = null_prom_putc; |
44 | void (* prom_printf)(const char * fmt, ...) = null_prom_printf; | 40 | |
41 | void prom_putchar(char c) | ||
42 | { | ||
43 | __prom_putc(c); | ||
44 | } | ||
45 | |||
45 | void (* prom_display)(const char *string, int pos, int clear) = | 46 | void (* prom_display)(const char *string, int pos, int clear) = |
46 | null_prom_display; | 47 | null_prom_display; |
47 | void (* prom_monitor)(void) = null_prom_monitor; | 48 | void (* prom_monitor)(void) = null_prom_monitor; |
48 | 49 | ||
49 | unsigned int lasat_ndelay_divider; | 50 | unsigned int lasat_ndelay_divider; |
50 | 51 | ||
51 | #define PROM_PRINTFBUF_SIZE 256 | ||
52 | static char prom_printfbuf[PROM_PRINTFBUF_SIZE]; | ||
53 | |||
54 | static void real_prom_printf(const char * fmt, ...) | ||
55 | { | ||
56 | va_list ap; | ||
57 | int len; | ||
58 | char *c = prom_printfbuf; | ||
59 | int i; | ||
60 | |||
61 | va_start(ap, fmt); | ||
62 | len = vsnprintf(prom_printfbuf, PROM_PRINTFBUF_SIZE, fmt, ap); | ||
63 | va_end(ap); | ||
64 | |||
65 | /* output overflowed the buffer */ | ||
66 | if (len < 0 || len > PROM_PRINTFBUF_SIZE) | ||
67 | len = PROM_PRINTFBUF_SIZE; | ||
68 | |||
69 | for (i=0; i < len; i++) { | ||
70 | if (*c == '\n') | ||
71 | prom_putc('\r'); | ||
72 | prom_putc(*c++); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | static void setup_prom_vectors(void) | 52 | static void setup_prom_vectors(void) |
77 | { | 53 | { |
78 | u32 version = *(u32 *)(RESET_VECTOR + 0x90); | 54 | u32 version = *(u32 *)(RESET_VECTOR + 0x90); |
79 | 55 | ||
80 | if (version >= 307) { | 56 | if (version >= 307) { |
81 | prom_display = (void *)PROM_DISPLAY_ADDR; | 57 | prom_display = (void *)PROM_DISPLAY_ADDR; |
82 | prom_putc = (void *)PROM_PUTC_ADDR; | 58 | __prom_putc = (void *)PROM_PUTC_ADDR; |
83 | prom_printf = real_prom_printf; | ||
84 | prom_monitor = (void *)PROM_MONITOR_ADDR; | 59 | prom_monitor = (void *)PROM_MONITOR_ADDR; |
85 | } | 60 | } |
86 | prom_printf("prom vectors set up\n"); | 61 | printk("prom vectors set up\n"); |
87 | } | 62 | } |
88 | 63 | ||
89 | static struct at93c_defs at93c_defs[N_MACHTYPES] = { | 64 | static struct at93c_defs at93c_defs[N_MACHTYPES] = { |
@@ -101,11 +76,11 @@ void __init prom_init(void) | |||
101 | setup_prom_vectors(); | 76 | setup_prom_vectors(); |
102 | 77 | ||
103 | if (current_cpu_data.cputype == CPU_R5000) { | 78 | if (current_cpu_data.cputype == CPU_R5000) { |
104 | prom_printf("LASAT 200 board\n"); | 79 | printk("LASAT 200 board\n"); |
105 | mips_machtype = MACH_LASAT_200; | 80 | mips_machtype = MACH_LASAT_200; |
106 | lasat_ndelay_divider = LASAT_200_DIVIDER; | 81 | lasat_ndelay_divider = LASAT_200_DIVIDER; |
107 | } else { | 82 | } else { |
108 | prom_printf("LASAT 100 board\n"); | 83 | printk("LASAT 100 board\n"); |
109 | mips_machtype = MACH_LASAT_100; | 84 | mips_machtype = MACH_LASAT_100; |
110 | lasat_ndelay_divider = LASAT_100_DIVIDER; | 85 | lasat_ndelay_divider = LASAT_100_DIVIDER; |
111 | } | 86 | } |
diff --git a/arch/mips/lasat/prom.h b/arch/mips/lasat/prom.h index 07be7bf1e4a3..019d45fbd268 100644 --- a/arch/mips/lasat/prom.h +++ b/arch/mips/lasat/prom.h | |||
@@ -2,5 +2,4 @@ | |||
2 | #define PROM_H | 2 | #define PROM_H |
3 | extern void (* prom_display)(const char *string, int pos, int clear); | 3 | extern void (* prom_display)(const char *string, int pos, int clear); |
4 | extern void (* prom_monitor)(void); | 4 | extern void (* prom_monitor)(void); |
5 | extern void (* prom_printf)(const char * fmt, ...); | ||
6 | #endif | 5 | #endif |
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c index 14c55168f1ff..488007f13988 100644 --- a/arch/mips/lasat/setup.c +++ b/arch/mips/lasat/setup.c | |||
@@ -116,7 +116,6 @@ static void lasat_time_init(void) | |||
116 | 116 | ||
117 | void __init plat_timer_setup(struct irqaction *irq) | 117 | void __init plat_timer_setup(struct irqaction *irq) |
118 | { | 118 | { |
119 | write_c0_compare( read_c0_count() + mips_hpt_frequency / HZ); | ||
120 | change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5); | 119 | change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5); |
121 | } | 120 | } |
122 | 121 | ||
@@ -179,5 +178,5 @@ void __init plat_mem_setup(void) | |||
179 | /* Switch from prom exception handler to normal mode */ | 178 | /* Switch from prom exception handler to normal mode */ |
180 | change_c0_status(ST0_BEV,0); | 179 | change_c0_status(ST0_BEV,0); |
181 | 180 | ||
182 | prom_printf("Lasat specific initialization complete\n"); | 181 | pr_info("Lasat specific initialization complete\n"); |
183 | } | 182 | } |
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 52e0ec8bcb15..d7d3b14dcfb2 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile | |||
@@ -2,8 +2,8 @@ | |||
2 | # Makefile for MIPS-specific library files.. | 2 | # Makefile for MIPS-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o promlib.o \ | 5 | lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o strlen_user.o \ |
6 | strlen_user.o strncpy_user.o strnlen_user.o uncached.o | 6 | strncpy_user.o strnlen_user.o uncached.o |
7 | 7 | ||
8 | obj-y += iomap.o | 8 | obj-y += iomap.o |
9 | obj-$(CONFIG_PCI) += iomap-pci.o | 9 | obj-$(CONFIG_PCI) += iomap-pci.o |
diff --git a/arch/mips/lib/promlib.c b/arch/mips/lib/promlib.c deleted file mode 100644 index dddfe98b4ded..000000000000 --- a/arch/mips/lib/promlib.c +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #include <stdarg.h> | ||
2 | #include <linux/kernel.h> | ||
3 | |||
4 | extern void prom_putchar(char); | ||
5 | |||
6 | void prom_printf(char *fmt, ...) | ||
7 | { | ||
8 | va_list args; | ||
9 | char ppbuf[1024]; | ||
10 | char *bptr; | ||
11 | |||
12 | va_start(args, fmt); | ||
13 | vsprintf(ppbuf, fmt, args); | ||
14 | |||
15 | bptr = ppbuf; | ||
16 | |||
17 | while (*bptr != 0) { | ||
18 | if (*bptr == '\n') | ||
19 | prom_putchar('\r'); | ||
20 | |||
21 | prom_putchar(*bptr++); | ||
22 | } | ||
23 | va_end(args); | ||
24 | } | ||
diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile index 0a30f5dc9b72..aade36d78787 100644 --- a/arch/mips/mips-boards/generic/Makefile +++ b/arch/mips/mips-boards/generic/Makefile | |||
@@ -18,7 +18,9 @@ | |||
18 | # Makefile for the MIPS boards generic routines under Linux. | 18 | # Makefile for the MIPS boards generic routines under Linux. |
19 | # | 19 | # |
20 | 20 | ||
21 | obj-y := reset.o display.o init.o memory.o printf.o \ | 21 | obj-y := reset.o display.o init.o memory.o \ |
22 | cmdline.o time.o | 22 | cmdline.o time.o |
23 | |||
24 | obj-$(CONFIG_EARLY_PRINTK) += console.o | ||
23 | obj-$(CONFIG_PCI) += pci.o | 25 | obj-$(CONFIG_PCI) += pci.o |
24 | obj-$(CONFIG_KGDB) += gdb_hook.o | 26 | obj-$(CONFIG_KGDB) += gdb_hook.o |
diff --git a/arch/mips/mips-boards/generic/printf.c b/arch/mips/mips-boards/generic/console.c index 1a711bd79b51..4d8ab99e4155 100644 --- a/arch/mips/mips-boards/generic/printf.c +++ b/arch/mips/mips-boards/generic/console.c | |||
@@ -17,10 +17,9 @@ | |||
17 | * | 17 | * |
18 | * Putting things on the screen/serial line using YAMONs facilities. | 18 | * Putting things on the screen/serial line using YAMONs facilities. |
19 | */ | 19 | */ |
20 | #include <linux/console.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | ||
22 | #include <linux/serial_reg.h> | 22 | #include <linux/serial_reg.h> |
23 | #include <linux/spinlock.h> | ||
24 | #include <asm/io.h> | 23 | #include <asm/io.h> |
25 | 24 | ||
26 | #ifdef CONFIG_MIPS_ATLAS | 25 | #ifdef CONFIG_MIPS_ATLAS |
@@ -67,12 +66,3 @@ int prom_putchar(char c) | |||
67 | 66 | ||
68 | return 1; | 67 | return 1; |
69 | } | 68 | } |
70 | |||
71 | char prom_getchar(void) | ||
72 | { | ||
73 | while (!(serial_in(UART_LSR) & UART_LSR_DR)) | ||
74 | ; | ||
75 | |||
76 | return serial_in(UART_RX); | ||
77 | } | ||
78 | |||
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c index 58a0fe883591..b11337600129 100644 --- a/arch/mips/mips-boards/generic/init.c +++ b/arch/mips/mips-boards/generic/init.c | |||
@@ -167,7 +167,7 @@ static void __init console_config(void) | |||
167 | flow = 'r'; | 167 | flow = 'r'; |
168 | sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow); | 168 | sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow); |
169 | strcat (prom_getcmdline(), console_string); | 169 | strcat (prom_getcmdline(), console_string); |
170 | prom_printf("Config serial console:%s\n", console_string); | 170 | pr_info("Config serial console:%s\n", console_string); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | #endif | 173 | #endif |
@@ -210,8 +210,9 @@ void __init kgdb_config (void) | |||
210 | generic_getDebugChar = rs_getDebugChar; | 210 | generic_getDebugChar = rs_getDebugChar; |
211 | } | 211 | } |
212 | 212 | ||
213 | prom_printf("KGDB: Using serial line /dev/ttyS%d at %d for session, " | 213 | pr_info("KGDB: Using serial line /dev/ttyS%d at %d for " |
214 | "please connect your debugger\n", line ? 1 : 0, speed); | 214 | "session, please connect your debugger\n", |
215 | line ? 1 : 0, speed); | ||
215 | 216 | ||
216 | { | 217 | { |
217 | char *s; | 218 | char *s; |
@@ -382,7 +383,7 @@ void __init prom_init(void) | |||
382 | board_nmi_handler_setup = mips_nmi_setup; | 383 | board_nmi_handler_setup = mips_nmi_setup; |
383 | board_ejtag_handler_setup = mips_ejtag_setup; | 384 | board_ejtag_handler_setup = mips_ejtag_setup; |
384 | 385 | ||
385 | prom_printf("\nLINUX started...\n"); | 386 | pr_info("\nLINUX started...\n"); |
386 | prom_init_cmdline(); | 387 | prom_init_cmdline(); |
387 | prom_meminit(); | 388 | prom_meminit(); |
388 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 389 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c index ebf0e16c5a0d..ae39953da2c4 100644 --- a/arch/mips/mips-boards/generic/memory.c +++ b/arch/mips/mips-boards/generic/memory.c | |||
@@ -59,11 +59,12 @@ struct prom_pmemblock * __init prom_getmdesc(void) | |||
59 | /* otherwise look in the environment */ | 59 | /* otherwise look in the environment */ |
60 | memsize_str = prom_getenv("memsize"); | 60 | memsize_str = prom_getenv("memsize"); |
61 | if (!memsize_str) { | 61 | if (!memsize_str) { |
62 | prom_printf("memsize not set in boot prom, set to default (32Mb)\n"); | 62 | printk(KERN_WARNING |
63 | "memsize not set in boot prom, set to default (32Mb)\n"); | ||
63 | physical_memsize = 0x02000000; | 64 | physical_memsize = 0x02000000; |
64 | } else { | 65 | } else { |
65 | #ifdef DEBUG | 66 | #ifdef DEBUG |
66 | prom_printf("prom_memsize = %s\n", memsize_str); | 67 | pr_debug("prom_memsize = %s\n", memsize_str); |
67 | #endif | 68 | #endif |
68 | physical_memsize = simple_strtol(memsize_str, NULL, 0); | 69 | physical_memsize = simple_strtol(memsize_str, NULL, 0); |
69 | } | 70 | } |
@@ -141,12 +142,12 @@ void __init prom_meminit(void) | |||
141 | struct prom_pmemblock *p; | 142 | struct prom_pmemblock *p; |
142 | 143 | ||
143 | #ifdef DEBUG | 144 | #ifdef DEBUG |
144 | prom_printf("YAMON MEMORY DESCRIPTOR dump:\n"); | 145 | pr_debug("YAMON MEMORY DESCRIPTOR dump:\n"); |
145 | p = prom_getmdesc(); | 146 | p = prom_getmdesc(); |
146 | while (p->size) { | 147 | while (p->size) { |
147 | int i = 0; | 148 | int i = 0; |
148 | prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n", | 149 | pr_debug("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n", |
149 | i, p, p->base, p->size, mtypes[p->type]); | 150 | i, p, p->base, p->size, mtypes[p->type]); |
150 | p++; | 151 | p++; |
151 | i++; | 152 | i++; |
152 | } | 153 | } |
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c index a3c3a1d462b2..df2a2bd3aa5d 100644 --- a/arch/mips/mips-boards/generic/time.c +++ b/arch/mips/mips-boards/generic/time.c | |||
@@ -295,7 +295,4 @@ void __init plat_timer_setup(struct irqaction *irq) | |||
295 | irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU; | 295 | irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU; |
296 | set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); | 296 | set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); |
297 | #endif | 297 | #endif |
298 | |||
299 | /* to generate the first timer interrupt */ | ||
300 | write_c0_compare (read_c0_count() + mips_hpt_frequency/HZ); | ||
301 | } | 298 | } |
diff --git a/arch/mips/mips-boards/sim/Makefile b/arch/mips/mips-boards/sim/Makefile index a12e32aafde0..6aeebc9122f2 100644 --- a/arch/mips/mips-boards/sim/Makefile +++ b/arch/mips/mips-boards/sim/Makefile | |||
@@ -1,5 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. | 2 | # Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. |
3 | # Copyright (C) 2007 MIPS Technologies, Inc. | ||
4 | # written by Ralf Baechle (ralf@linux-mips.org) | ||
3 | # | 5 | # |
4 | # This program is free software; you can distribute it and/or modify it | 6 | # This program is free software; you can distribute it and/or modify it |
5 | # under the terms of the GNU General Public License (Version 2) as | 7 | # under the terms of the GNU General Public License (Version 2) as |
@@ -15,5 +17,7 @@ | |||
15 | # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 17 | # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
16 | # | 18 | # |
17 | 19 | ||
18 | obj-y := sim_setup.o sim_mem.o sim_time.o sim_printf.o sim_int.o sim_cmdline.o | 20 | obj-y := sim_setup.o sim_mem.o sim_time.o sim_int.o sim_cmdline.o |
21 | |||
22 | obj-$(CONFIG_EARLY_PRINTK) += sim_console.o | ||
19 | obj-$(CONFIG_SMP) += sim_smp.o | 23 | obj-$(CONFIG_SMP) += sim_smp.o |
diff --git a/arch/mips/mips-boards/sim/sim_printf.c b/arch/mips/mips-boards/sim/sim_console.c index 3ee5a0b501a6..de595a9ccb27 100644 --- a/arch/mips/mips-boards/sim/sim_printf.c +++ b/arch/mips/mips-boards/sim/sim_console.c | |||
@@ -1,7 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | ||
3 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can distribute it and/or modify it | 2 | * This program is free software; you can distribute it and/or modify it |
6 | * under the terms of the GNU General Public License (Version 2) as | 3 | * under the terms of the GNU General Public License (Version 2) as |
7 | * published by the Free Software Foundation. | 4 | * published by the Free Software Foundation. |
@@ -15,14 +12,14 @@ | |||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | 12 | * with this program; if not, write to the Free Software Foundation, Inc., |
16 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 13 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
17 | * | 14 | * |
18 | * Putting things on the screen/serial line using YAMONs facilities. | 15 | * Carsten Langgaard, carstenl@mips.com |
16 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
17 | * Copyright (C) 2007 MIPS Technologies, Inc. | ||
18 | * written by Ralf Baechle | ||
19 | */ | 19 | */ |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | ||
22 | #include <linux/serial_reg.h> | 21 | #include <linux/serial_reg.h> |
23 | #include <linux/spinlock.h> | ||
24 | #include <asm/io.h> | 22 | #include <asm/io.h> |
25 | #include <asm/system.h> | ||
26 | 23 | ||
27 | static inline unsigned int serial_in(int offset) | 24 | static inline unsigned int serial_in(int offset) |
28 | { | 25 | { |
@@ -34,41 +31,10 @@ static inline void serial_out(int offset, int value) | |||
34 | outb(value, 0x3f8 + offset); | 31 | outb(value, 0x3f8 + offset); |
35 | } | 32 | } |
36 | 33 | ||
37 | int putPromChar(char c) | 34 | void __init prom_putchar(char c) |
38 | { | 35 | { |
39 | while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0) | 36 | while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0) |
40 | ; | 37 | ; |
41 | 38 | ||
42 | serial_out(UART_TX, c); | 39 | serial_out(UART_TX, c); |
43 | |||
44 | return 1; | ||
45 | } | ||
46 | |||
47 | char getPromChar(void) | ||
48 | { | ||
49 | while (!(serial_in(UART_LSR) & 1)) | ||
50 | ; | ||
51 | |||
52 | return serial_in(UART_RX); | ||
53 | } | ||
54 | |||
55 | void prom_printf(char *fmt, ...) | ||
56 | { | ||
57 | va_list args; | ||
58 | int l; | ||
59 | char *p, *buf_end; | ||
60 | char buf[1024]; | ||
61 | |||
62 | va_start(args, fmt); | ||
63 | l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */ | ||
64 | va_end(args); | ||
65 | |||
66 | buf_end = buf + l; | ||
67 | |||
68 | for (p = buf; p < buf_end; p++) { | ||
69 | /* Crude cr/nl handling is better than none */ | ||
70 | if (*p == '\n') | ||
71 | putPromChar('\r'); | ||
72 | putPromChar(*p); | ||
73 | } | ||
74 | } | 40 | } |
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c index 46bc16f8b15d..e408ef0bcd6e 100644 --- a/arch/mips/mips-boards/sim/sim_mem.c +++ b/arch/mips/mips-boards/sim/sim_mem.c | |||
@@ -46,7 +46,7 @@ struct prom_pmemblock * __init prom_getmdesc(void) | |||
46 | unsigned int memsize; | 46 | unsigned int memsize; |
47 | 47 | ||
48 | memsize = 0x02000000; | 48 | memsize = 0x02000000; |
49 | prom_printf("Setting default memory size 0x%08x\n", memsize); | 49 | pr_info("Setting default memory size 0x%08x\n", memsize); |
50 | 50 | ||
51 | memset(mdesc, 0, sizeof(mdesc)); | 51 | memset(mdesc, 0, sizeof(mdesc)); |
52 | 52 | ||
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c index ea2066c3a1f7..b705f09e57c3 100644 --- a/arch/mips/mips-boards/sim/sim_setup.c +++ b/arch/mips/mips-boards/sim/sim_setup.c | |||
@@ -55,7 +55,7 @@ void __init plat_mem_setup(void) | |||
55 | serial_init(); | 55 | serial_init(); |
56 | 56 | ||
57 | board_time_init = sim_time_init; | 57 | board_time_init = sim_time_init; |
58 | prom_printf("Linux started...\n"); | 58 | pr_info("Linux started...\n"); |
59 | 59 | ||
60 | #ifdef CONFIG_MIPS_MT_SMP | 60 | #ifdef CONFIG_MIPS_MT_SMP |
61 | sanitize_tlb_entries(); | 61 | sanitize_tlb_entries(); |
@@ -66,7 +66,7 @@ void prom_init(void) | |||
66 | { | 66 | { |
67 | set_io_port_base(0xbfd00000); | 67 | set_io_port_base(0xbfd00000); |
68 | 68 | ||
69 | prom_printf("\nLINUX started...\n"); | 69 | pr_info("\nLINUX started...\n"); |
70 | prom_init_cmdline(); | 70 | prom_init_cmdline(); |
71 | prom_meminit(); | 71 | prom_meminit(); |
72 | } | 72 | } |
@@ -91,7 +91,7 @@ static void __init serial_init(void) | |||
91 | s.timeout = 4; | 91 | s.timeout = 4; |
92 | 92 | ||
93 | if (early_serial_setup(&s) != 0) { | 93 | if (early_serial_setup(&s) != 0) { |
94 | prom_printf(KERN_ERR "Serial setup failed!\n"); | 94 | printk(KERN_ERR "Serial setup failed!\n"); |
95 | } | 95 | } |
96 | 96 | ||
97 | #endif | 97 | #endif |
diff --git a/arch/mips/mips-boards/sim/sim_time.c b/arch/mips/mips-boards/sim/sim_time.c index 30711d016fed..d3a21c741514 100644 --- a/arch/mips/mips-boards/sim/sim_time.c +++ b/arch/mips/mips-boards/sim/sim_time.c | |||
@@ -199,7 +199,4 @@ void __init plat_timer_setup(struct irqaction *irq) | |||
199 | irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU; | 199 | irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU; |
200 | set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); | 200 | set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); |
201 | #endif | 201 | #endif |
202 | |||
203 | /* to generate the first timer interrupt */ | ||
204 | write_c0_compare(read_c0_count() + (mips_hpt_frequency/HZ)); | ||
205 | } | 202 | } |
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c index e19fbb9ee47f..11a916629d3b 100644 --- a/arch/mips/mm/cerr-sb1.c +++ b/arch/mips/mm/cerr-sb1.c | |||
@@ -77,66 +77,66 @@ static uint32_t extract_dc(unsigned short addr, int data); | |||
77 | static inline void breakout_errctl(unsigned int val) | 77 | static inline void breakout_errctl(unsigned int val) |
78 | { | 78 | { |
79 | if (val & CP0_ERRCTL_RECOVERABLE) | 79 | if (val & CP0_ERRCTL_RECOVERABLE) |
80 | prom_printf(" recoverable"); | 80 | printk(" recoverable"); |
81 | if (val & CP0_ERRCTL_DCACHE) | 81 | if (val & CP0_ERRCTL_DCACHE) |
82 | prom_printf(" dcache"); | 82 | printk(" dcache"); |
83 | if (val & CP0_ERRCTL_ICACHE) | 83 | if (val & CP0_ERRCTL_ICACHE) |
84 | prom_printf(" icache"); | 84 | printk(" icache"); |
85 | if (val & CP0_ERRCTL_MULTIBUS) | 85 | if (val & CP0_ERRCTL_MULTIBUS) |
86 | prom_printf(" multiple-buserr"); | 86 | printk(" multiple-buserr"); |
87 | prom_printf("\n"); | 87 | printk("\n"); |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline void breakout_cerri(unsigned int val) | 90 | static inline void breakout_cerri(unsigned int val) |
91 | { | 91 | { |
92 | if (val & CP0_CERRI_TAG_PARITY) | 92 | if (val & CP0_CERRI_TAG_PARITY) |
93 | prom_printf(" tag-parity"); | 93 | printk(" tag-parity"); |
94 | if (val & CP0_CERRI_DATA_PARITY) | 94 | if (val & CP0_CERRI_DATA_PARITY) |
95 | prom_printf(" data-parity"); | 95 | printk(" data-parity"); |
96 | if (val & CP0_CERRI_EXTERNAL) | 96 | if (val & CP0_CERRI_EXTERNAL) |
97 | prom_printf(" external"); | 97 | printk(" external"); |
98 | prom_printf("\n"); | 98 | printk("\n"); |
99 | } | 99 | } |
100 | 100 | ||
101 | static inline void breakout_cerrd(unsigned int val) | 101 | static inline void breakout_cerrd(unsigned int val) |
102 | { | 102 | { |
103 | switch (val & CP0_CERRD_CAUSES) { | 103 | switch (val & CP0_CERRD_CAUSES) { |
104 | case CP0_CERRD_LOAD: | 104 | case CP0_CERRD_LOAD: |
105 | prom_printf(" load,"); | 105 | printk(" load,"); |
106 | break; | 106 | break; |
107 | case CP0_CERRD_STORE: | 107 | case CP0_CERRD_STORE: |
108 | prom_printf(" store,"); | 108 | printk(" store,"); |
109 | break; | 109 | break; |
110 | case CP0_CERRD_FILLWB: | 110 | case CP0_CERRD_FILLWB: |
111 | prom_printf(" fill/wb,"); | 111 | printk(" fill/wb,"); |
112 | break; | 112 | break; |
113 | case CP0_CERRD_COHERENCY: | 113 | case CP0_CERRD_COHERENCY: |
114 | prom_printf(" coherency,"); | 114 | printk(" coherency,"); |
115 | break; | 115 | break; |
116 | case CP0_CERRD_DUPTAG: | 116 | case CP0_CERRD_DUPTAG: |
117 | prom_printf(" duptags,"); | 117 | printk(" duptags,"); |
118 | break; | 118 | break; |
119 | default: | 119 | default: |
120 | prom_printf(" NO CAUSE,"); | 120 | printk(" NO CAUSE,"); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | if (!(val & CP0_CERRD_TYPES)) | 123 | if (!(val & CP0_CERRD_TYPES)) |
124 | prom_printf(" NO TYPE"); | 124 | printk(" NO TYPE"); |
125 | else { | 125 | else { |
126 | if (val & CP0_CERRD_MULTIPLE) | 126 | if (val & CP0_CERRD_MULTIPLE) |
127 | prom_printf(" multi-err"); | 127 | printk(" multi-err"); |
128 | if (val & CP0_CERRD_TAG_STATE) | 128 | if (val & CP0_CERRD_TAG_STATE) |
129 | prom_printf(" tag-state"); | 129 | printk(" tag-state"); |
130 | if (val & CP0_CERRD_TAG_ADDRESS) | 130 | if (val & CP0_CERRD_TAG_ADDRESS) |
131 | prom_printf(" tag-address"); | 131 | printk(" tag-address"); |
132 | if (val & CP0_CERRD_DATA_SBE) | 132 | if (val & CP0_CERRD_DATA_SBE) |
133 | prom_printf(" data-SBE"); | 133 | printk(" data-SBE"); |
134 | if (val & CP0_CERRD_DATA_DBE) | 134 | if (val & CP0_CERRD_DATA_DBE) |
135 | prom_printf(" data-DBE"); | 135 | printk(" data-DBE"); |
136 | if (val & CP0_CERRD_EXTERNAL) | 136 | if (val & CP0_CERRD_EXTERNAL) |
137 | prom_printf(" external"); | 137 | printk(" external"); |
138 | } | 138 | } |
139 | prom_printf("\n"); | 139 | printk("\n"); |
140 | } | 140 | } |
141 | 141 | ||
142 | #ifndef CONFIG_SIBYTE_BUS_WATCHER | 142 | #ifndef CONFIG_SIBYTE_BUS_WATCHER |
@@ -157,18 +157,18 @@ static void check_bus_watcher(void) | |||
157 | l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG); | 157 | l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG); |
158 | #endif | 158 | #endif |
159 | memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS)); | 159 | memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS)); |
160 | prom_printf("Bus watcher error counters: %08x %08x\n", l2_err, memio_err); | 160 | printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err); |
161 | prom_printf("\nLast recorded signature:\n"); | 161 | printk("\nLast recorded signature:\n"); |
162 | prom_printf("Request %02x from %d, answered by %d with Dcode %d\n", | 162 | printk("Request %02x from %d, answered by %d with Dcode %d\n", |
163 | (unsigned int)(G_SCD_BERR_TID(status) & 0x3f), | 163 | (unsigned int)(G_SCD_BERR_TID(status) & 0x3f), |
164 | (int)(G_SCD_BERR_TID(status) >> 6), | 164 | (int)(G_SCD_BERR_TID(status) >> 6), |
165 | (int)G_SCD_BERR_RID(status), | 165 | (int)G_SCD_BERR_RID(status), |
166 | (int)G_SCD_BERR_DCODE(status)); | 166 | (int)G_SCD_BERR_DCODE(status)); |
167 | #ifdef DUMP_L2_ECC_TAG_ON_ERROR | 167 | #ifdef DUMP_L2_ECC_TAG_ON_ERROR |
168 | prom_printf("Last L2 tag w/ bad ECC: %016llx\n", l2_tag); | 168 | printk("Last L2 tag w/ bad ECC: %016llx\n", l2_tag); |
169 | #endif | 169 | #endif |
170 | } else { | 170 | } else { |
171 | prom_printf("Bus watcher indicates no error\n"); | 171 | printk("Bus watcher indicates no error\n"); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | #else | 174 | #else |
@@ -187,11 +187,11 @@ asmlinkage void sb1_cache_error(void) | |||
187 | #else | 187 | #else |
188 | csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); | 188 | csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); |
189 | #endif | 189 | #endif |
190 | prom_printf("Trace buffer frozen\n"); | 190 | printk("Trace buffer frozen\n"); |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | prom_printf("Cache error exception on CPU %x:\n", | 193 | printk("Cache error exception on CPU %x:\n", |
194 | (read_c0_prid() >> 25) & 0x7); | 194 | (read_c0_prid() >> 25) & 0x7); |
195 | 195 | ||
196 | __asm__ __volatile__ ( | 196 | __asm__ __volatile__ ( |
197 | " .set push\n\t" | 197 | " .set push\n\t" |
@@ -209,43 +209,43 @@ asmlinkage void sb1_cache_error(void) | |||
209 | "=r" (dpahi), "=r" (dpalo), "=r" (eepc)); | 209 | "=r" (dpahi), "=r" (dpalo), "=r" (eepc)); |
210 | 210 | ||
211 | cerr_dpa = (((uint64_t)dpahi) << 32) | dpalo; | 211 | cerr_dpa = (((uint64_t)dpahi) << 32) | dpalo; |
212 | prom_printf(" c0_errorepc == %08x\n", eepc); | 212 | printk(" c0_errorepc == %08x\n", eepc); |
213 | prom_printf(" c0_errctl == %08x", errctl); | 213 | printk(" c0_errctl == %08x", errctl); |
214 | breakout_errctl(errctl); | 214 | breakout_errctl(errctl); |
215 | if (errctl & CP0_ERRCTL_ICACHE) { | 215 | if (errctl & CP0_ERRCTL_ICACHE) { |
216 | prom_printf(" c0_cerr_i == %08x", cerr_i); | 216 | printk(" c0_cerr_i == %08x", cerr_i); |
217 | breakout_cerri(cerr_i); | 217 | breakout_cerri(cerr_i); |
218 | if (CP0_CERRI_IDX_VALID(cerr_i)) { | 218 | if (CP0_CERRI_IDX_VALID(cerr_i)) { |
219 | /* Check index of EPC, allowing for delay slot */ | 219 | /* Check index of EPC, allowing for delay slot */ |
220 | if (((eepc & SB1_CACHE_INDEX_MASK) != (cerr_i & SB1_CACHE_INDEX_MASK)) && | 220 | if (((eepc & SB1_CACHE_INDEX_MASK) != (cerr_i & SB1_CACHE_INDEX_MASK)) && |
221 | ((eepc & SB1_CACHE_INDEX_MASK) != ((cerr_i & SB1_CACHE_INDEX_MASK) - 4))) | 221 | ((eepc & SB1_CACHE_INDEX_MASK) != ((cerr_i & SB1_CACHE_INDEX_MASK) - 4))) |
222 | prom_printf(" cerr_i idx doesn't match eepc\n"); | 222 | printk(" cerr_i idx doesn't match eepc\n"); |
223 | else { | 223 | else { |
224 | res = extract_ic(cerr_i & SB1_CACHE_INDEX_MASK, | 224 | res = extract_ic(cerr_i & SB1_CACHE_INDEX_MASK, |
225 | (cerr_i & CP0_CERRI_DATA) != 0); | 225 | (cerr_i & CP0_CERRI_DATA) != 0); |
226 | if (!(res & cerr_i)) | 226 | if (!(res & cerr_i)) |
227 | prom_printf("...didn't see indicated icache problem\n"); | 227 | printk("...didn't see indicated icache problem\n"); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | } | 230 | } |
231 | if (errctl & CP0_ERRCTL_DCACHE) { | 231 | if (errctl & CP0_ERRCTL_DCACHE) { |
232 | prom_printf(" c0_cerr_d == %08x", cerr_d); | 232 | printk(" c0_cerr_d == %08x", cerr_d); |
233 | breakout_cerrd(cerr_d); | 233 | breakout_cerrd(cerr_d); |
234 | if (CP0_CERRD_DPA_VALID(cerr_d)) { | 234 | if (CP0_CERRD_DPA_VALID(cerr_d)) { |
235 | prom_printf(" c0_cerr_dpa == %010llx\n", cerr_dpa); | 235 | printk(" c0_cerr_dpa == %010llx\n", cerr_dpa); |
236 | if (!CP0_CERRD_IDX_VALID(cerr_d)) { | 236 | if (!CP0_CERRD_IDX_VALID(cerr_d)) { |
237 | res = extract_dc(cerr_dpa & SB1_CACHE_INDEX_MASK, | 237 | res = extract_dc(cerr_dpa & SB1_CACHE_INDEX_MASK, |
238 | (cerr_d & CP0_CERRD_DATA) != 0); | 238 | (cerr_d & CP0_CERRD_DATA) != 0); |
239 | if (!(res & cerr_d)) | 239 | if (!(res & cerr_d)) |
240 | prom_printf("...didn't see indicated dcache problem\n"); | 240 | printk("...didn't see indicated dcache problem\n"); |
241 | } else { | 241 | } else { |
242 | if ((cerr_dpa & SB1_CACHE_INDEX_MASK) != (cerr_d & SB1_CACHE_INDEX_MASK)) | 242 | if ((cerr_dpa & SB1_CACHE_INDEX_MASK) != (cerr_d & SB1_CACHE_INDEX_MASK)) |
243 | prom_printf(" cerr_d idx doesn't match cerr_dpa\n"); | 243 | printk(" cerr_d idx doesn't match cerr_dpa\n"); |
244 | else { | 244 | else { |
245 | res = extract_dc(cerr_d & SB1_CACHE_INDEX_MASK, | 245 | res = extract_dc(cerr_d & SB1_CACHE_INDEX_MASK, |
246 | (cerr_d & CP0_CERRD_DATA) != 0); | 246 | (cerr_d & CP0_CERRD_DATA) != 0); |
247 | if (!(res & cerr_d)) | 247 | if (!(res & cerr_d)) |
248 | prom_printf("...didn't see indicated problem\n"); | 248 | printk("...didn't see indicated problem\n"); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | } | 251 | } |
@@ -334,7 +334,7 @@ static uint32_t extract_ic(unsigned short addr, int data) | |||
334 | uint8_t lru; | 334 | uint8_t lru; |
335 | int res = 0; | 335 | int res = 0; |
336 | 336 | ||
337 | prom_printf("Icache index 0x%04x ", addr); | 337 | printk("Icache index 0x%04x ", addr); |
338 | for (way = 0; way < 4; way++) { | 338 | for (way = 0; way < 4; way++) { |
339 | /* Index-load-tag-I */ | 339 | /* Index-load-tag-I */ |
340 | __asm__ __volatile__ ( | 340 | __asm__ __volatile__ ( |
@@ -354,7 +354,7 @@ static uint32_t extract_ic(unsigned short addr, int data) | |||
354 | taglo = ((unsigned long long)taglohi << 32) | taglolo; | 354 | taglo = ((unsigned long long)taglohi << 32) | taglolo; |
355 | if (way == 0) { | 355 | if (way == 0) { |
356 | lru = (taghi >> 14) & 0xff; | 356 | lru = (taghi >> 14) & 0xff; |
357 | prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", | 357 | printk("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", |
358 | ((addr >> 5) & 0x3), /* bank */ | 358 | ((addr >> 5) & 0x3), /* bank */ |
359 | ((addr >> 7) & 0x3f), /* index */ | 359 | ((addr >> 7) & 0x3f), /* index */ |
360 | (lru & 0x3), | 360 | (lru & 0x3), |
@@ -369,19 +369,19 @@ static uint32_t extract_ic(unsigned short addr, int data) | |||
369 | if (valid) { | 369 | if (valid) { |
370 | tlo_tmp = taglo & 0xfff3ff; | 370 | tlo_tmp = taglo & 0xfff3ff; |
371 | if (((taglo >> 10) & 1) ^ range_parity(tlo_tmp, 23, 0)) { | 371 | if (((taglo >> 10) & 1) ^ range_parity(tlo_tmp, 23, 0)) { |
372 | prom_printf(" ** bad parity in VTag0/G/ASID\n"); | 372 | printk(" ** bad parity in VTag0/G/ASID\n"); |
373 | res |= CP0_CERRI_TAG_PARITY; | 373 | res |= CP0_CERRI_TAG_PARITY; |
374 | } | 374 | } |
375 | if (((taglo >> 11) & 1) ^ range_parity(taglo, 63, 24)) { | 375 | if (((taglo >> 11) & 1) ^ range_parity(taglo, 63, 24)) { |
376 | prom_printf(" ** bad parity in R/VTag1\n"); | 376 | printk(" ** bad parity in R/VTag1\n"); |
377 | res |= CP0_CERRI_TAG_PARITY; | 377 | res |= CP0_CERRI_TAG_PARITY; |
378 | } | 378 | } |
379 | } | 379 | } |
380 | if (valid ^ ((taghi >> 27) & 1)) { | 380 | if (valid ^ ((taghi >> 27) & 1)) { |
381 | prom_printf(" ** bad parity for valid bit\n"); | 381 | printk(" ** bad parity for valid bit\n"); |
382 | res |= CP0_CERRI_TAG_PARITY; | 382 | res |= CP0_CERRI_TAG_PARITY; |
383 | } | 383 | } |
384 | prom_printf(" %d [VA %016llx] [Vld? %d] raw tags: %08X-%016llX\n", | 384 | printk(" %d [VA %016llx] [Vld? %d] raw tags: %08X-%016llX\n", |
385 | way, va, valid, taghi, taglo); | 385 | way, va, valid, taghi, taglo); |
386 | 386 | ||
387 | if (data) { | 387 | if (data) { |
@@ -407,21 +407,21 @@ static uint32_t extract_ic(unsigned short addr, int data) | |||
407 | : "r" ((way << 13) | addr | (offset << 3))); | 407 | : "r" ((way << 13) | addr | (offset << 3))); |
408 | predecode = (datahi >> 8) & 0xff; | 408 | predecode = (datahi >> 8) & 0xff; |
409 | if (((datahi >> 16) & 1) != (uint32_t)range_parity(predecode, 7, 0)) { | 409 | if (((datahi >> 16) & 1) != (uint32_t)range_parity(predecode, 7, 0)) { |
410 | prom_printf(" ** bad parity in predecode\n"); | 410 | printk(" ** bad parity in predecode\n"); |
411 | res |= CP0_CERRI_DATA_PARITY; | 411 | res |= CP0_CERRI_DATA_PARITY; |
412 | } | 412 | } |
413 | /* XXXKW should/could check predecode bits themselves */ | 413 | /* XXXKW should/could check predecode bits themselves */ |
414 | if (((datahi >> 4) & 0xf) ^ inst_parity(insta)) { | 414 | if (((datahi >> 4) & 0xf) ^ inst_parity(insta)) { |
415 | prom_printf(" ** bad parity in instruction a\n"); | 415 | printk(" ** bad parity in instruction a\n"); |
416 | res |= CP0_CERRI_DATA_PARITY; | 416 | res |= CP0_CERRI_DATA_PARITY; |
417 | } | 417 | } |
418 | if ((datahi & 0xf) ^ inst_parity(instb)) { | 418 | if ((datahi & 0xf) ^ inst_parity(instb)) { |
419 | prom_printf(" ** bad parity in instruction b\n"); | 419 | printk(" ** bad parity in instruction b\n"); |
420 | res |= CP0_CERRI_DATA_PARITY; | 420 | res |= CP0_CERRI_DATA_PARITY; |
421 | } | 421 | } |
422 | prom_printf(" %05X-%08X%08X", datahi, insta, instb); | 422 | printk(" %05X-%08X%08X", datahi, insta, instb); |
423 | } | 423 | } |
424 | prom_printf("\n"); | 424 | printk("\n"); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | return res; | 427 | return res; |
@@ -489,7 +489,7 @@ static uint32_t extract_dc(unsigned short addr, int data) | |||
489 | uint8_t ecc, lru; | 489 | uint8_t ecc, lru; |
490 | int res = 0; | 490 | int res = 0; |
491 | 491 | ||
492 | prom_printf("Dcache index 0x%04x ", addr); | 492 | printk("Dcache index 0x%04x ", addr); |
493 | for (way = 0; way < 4; way++) { | 493 | for (way = 0; way < 4; way++) { |
494 | __asm__ __volatile__ ( | 494 | __asm__ __volatile__ ( |
495 | " .set push\n\t" | 495 | " .set push\n\t" |
@@ -509,7 +509,7 @@ static uint32_t extract_dc(unsigned short addr, int data) | |||
509 | pa = (taglo & 0xFFFFFFE000ULL) | addr; | 509 | pa = (taglo & 0xFFFFFFE000ULL) | addr; |
510 | if (way == 0) { | 510 | if (way == 0) { |
511 | lru = (taghi >> 14) & 0xff; | 511 | lru = (taghi >> 14) & 0xff; |
512 | prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", | 512 | printk("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", |
513 | ((addr >> 11) & 0x2) | ((addr >> 5) & 1), /* bank */ | 513 | ((addr >> 11) & 0x2) | ((addr >> 5) & 1), /* bank */ |
514 | ((addr >> 6) & 0x3f), /* index */ | 514 | ((addr >> 6) & 0x3f), /* index */ |
515 | (lru & 0x3), | 515 | (lru & 0x3), |
@@ -519,15 +519,15 @@ static uint32_t extract_dc(unsigned short addr, int data) | |||
519 | } | 519 | } |
520 | state = (taghi >> 25) & 0x1f; | 520 | state = (taghi >> 25) & 0x1f; |
521 | valid = DC_TAG_VALID(state); | 521 | valid = DC_TAG_VALID(state); |
522 | prom_printf(" %d [PA %010llx] [state %s (%02x)] raw tags: %08X-%016llX\n", | 522 | printk(" %d [PA %010llx] [state %s (%02x)] raw tags: %08X-%016llX\n", |
523 | way, pa, dc_state_str(state), state, taghi, taglo); | 523 | way, pa, dc_state_str(state), state, taghi, taglo); |
524 | if (valid) { | 524 | if (valid) { |
525 | if (((taglo >> 11) & 1) ^ range_parity(taglo, 39, 26)) { | 525 | if (((taglo >> 11) & 1) ^ range_parity(taglo, 39, 26)) { |
526 | prom_printf(" ** bad parity in PTag1\n"); | 526 | printk(" ** bad parity in PTag1\n"); |
527 | res |= CP0_CERRD_TAG_ADDRESS; | 527 | res |= CP0_CERRD_TAG_ADDRESS; |
528 | } | 528 | } |
529 | if (((taglo >> 10) & 1) ^ range_parity(taglo, 25, 13)) { | 529 | if (((taglo >> 10) & 1) ^ range_parity(taglo, 25, 13)) { |
530 | prom_printf(" ** bad parity in PTag0\n"); | 530 | printk(" ** bad parity in PTag0\n"); |
531 | res |= CP0_CERRD_TAG_ADDRESS; | 531 | res |= CP0_CERRD_TAG_ADDRESS; |
532 | } | 532 | } |
533 | } else { | 533 | } else { |
@@ -567,13 +567,13 @@ static uint32_t extract_dc(unsigned short addr, int data) | |||
567 | } | 567 | } |
568 | res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE; | 568 | res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE; |
569 | } | 569 | } |
570 | prom_printf(" %02X-%016llX", datahi, datalo); | 570 | printk(" %02X-%016llX", datahi, datalo); |
571 | } | 571 | } |
572 | prom_printf("\n"); | 572 | printk("\n"); |
573 | if (bad_ecc) | 573 | if (bad_ecc) |
574 | prom_printf(" dwords w/ bad ECC: %d %d %d %d\n", | 574 | printk(" dwords w/ bad ECC: %d %d %d %d\n", |
575 | !!(bad_ecc & 8), !!(bad_ecc & 4), | 575 | !!(bad_ecc & 8), !!(bad_ecc & 4), |
576 | !!(bad_ecc & 2), !!(bad_ecc & 1)); | 576 | !!(bad_ecc & 2), !!(bad_ecc & 1)); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | return res; | 579 | return res; |
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index a72093ad105f..f503d02e403b 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -295,7 +295,7 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | |||
295 | 295 | ||
296 | /* Make sure that gcc doesn't leave the empty loop body. */ | 296 | /* Make sure that gcc doesn't leave the empty loop body. */ |
297 | for (i = 0; i < nelems; i++, sg++) { | 297 | for (i = 0; i < nelems; i++, sg++) { |
298 | if (!plat_device_is_coherent(dev)) | 298 | if (cpu_is_noncoherent_r10000(dev)) |
299 | __dma_sync((unsigned long)page_address(sg->page), | 299 | __dma_sync((unsigned long)page_address(sg->page), |
300 | sg->length, direction); | 300 | sg->length, direction); |
301 | plat_unmap_dma_mem(sg->dma_address); | 301 | plat_unmap_dma_mem(sg->dma_address); |
diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c index 2292d0ec47fc..2c30b4f56245 100644 --- a/arch/mips/momentum/jaguar_atx/ja-console.c +++ b/arch/mips/momentum/jaguar_atx/ja-console.c | |||
@@ -74,11 +74,6 @@ void prom_putchar(char c) | |||
74 | uart->iu_thr = c; | 74 | uart->iu_thr = c; |
75 | } | 75 | } |
76 | 76 | ||
77 | char __init prom_getchar(void) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | static void inline ja_console_probe(void) | 77 | static void inline ja_console_probe(void) |
83 | { | 78 | { |
84 | struct uart_port up; | 79 | struct uart_port up; |
diff --git a/arch/mips/momentum/jaguar_atx/platform.c b/arch/mips/momentum/jaguar_atx/platform.c index 3df36eda75af..771e55f39875 100644 --- a/arch/mips/momentum/jaguar_atx/platform.c +++ b/arch/mips/momentum/jaguar_atx/platform.c | |||
@@ -47,11 +47,7 @@ static struct resource mv64x60_eth0_resources[] = { | |||
47 | }, | 47 | }, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static char eth0_mac_addr[ETH_ALEN]; | ||
51 | |||
52 | static struct mv643xx_eth_platform_data eth0_pd = { | 50 | static struct mv643xx_eth_platform_data eth0_pd = { |
53 | .mac_addr = eth0_mac_addr, | ||
54 | |||
55 | .tx_sram_addr = MV_SRAM_BASE_ETH0, | 51 | .tx_sram_addr = MV_SRAM_BASE_ETH0, |
56 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 52 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
57 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 53 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -80,11 +76,7 @@ static struct resource mv64x60_eth1_resources[] = { | |||
80 | }, | 76 | }, |
81 | }; | 77 | }; |
82 | 78 | ||
83 | static char eth1_mac_addr[ETH_ALEN]; | ||
84 | |||
85 | static struct mv643xx_eth_platform_data eth1_pd = { | 79 | static struct mv643xx_eth_platform_data eth1_pd = { |
86 | .mac_addr = eth1_mac_addr, | ||
87 | |||
88 | .tx_sram_addr = MV_SRAM_BASE_ETH1, | 80 | .tx_sram_addr = MV_SRAM_BASE_ETH1, |
89 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 81 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
90 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 82 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -113,11 +105,7 @@ static struct resource mv64x60_eth2_resources[] = { | |||
113 | }, | 105 | }, |
114 | }; | 106 | }; |
115 | 107 | ||
116 | static char eth2_mac_addr[ETH_ALEN]; | 108 | static struct mv643xx_eth_platform_data eth2_pd; |
117 | |||
118 | static struct mv643xx_eth_platform_data eth2_pd = { | ||
119 | .mac_addr = eth2_mac_addr, | ||
120 | }; | ||
121 | 109 | ||
122 | static struct platform_device eth2_device = { | 110 | static struct platform_device eth2_device = { |
123 | .name = MV643XX_ETH_NAME, | 111 | .name = MV643XX_ETH_NAME, |
@@ -200,9 +188,9 @@ static int __init mv643xx_eth_add_pds(void) | |||
200 | int ret; | 188 | int ret; |
201 | 189 | ||
202 | get_mac(mac); | 190 | get_mac(mac); |
203 | eth_mac_add(eth0_mac_addr, mac, 0); | 191 | eth_mac_add(eth0_pd.mac_addr, mac, 0); |
204 | eth_mac_add(eth1_mac_addr, mac, 1); | 192 | eth_mac_add(eth1_pd.mac_addr, mac, 1); |
205 | eth_mac_add(eth2_mac_addr, mac, 2); | 193 | eth_mac_add(eth2_pd.mac_addr, mac, 2); |
206 | ret = platform_add_devices(mv643xx_eth_pd_devs, | 194 | ret = platform_add_devices(mv643xx_eth_pd_devs, |
207 | ARRAY_SIZE(mv643xx_eth_pd_devs)); | 195 | ARRAY_SIZE(mv643xx_eth_pd_devs)); |
208 | 196 | ||
diff --git a/arch/mips/momentum/ocelot_3/platform.c b/arch/mips/momentum/ocelot_3/platform.c index 024aef25f372..b80733f0c66d 100644 --- a/arch/mips/momentum/ocelot_3/platform.c +++ b/arch/mips/momentum/ocelot_3/platform.c | |||
@@ -47,11 +47,7 @@ static struct resource mv64x60_eth0_resources[] = { | |||
47 | }, | 47 | }, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static char eth0_mac_addr[ETH_ALEN]; | ||
51 | |||
52 | static struct mv643xx_eth_platform_data eth0_pd = { | 50 | static struct mv643xx_eth_platform_data eth0_pd = { |
53 | .mac_addr = eth0_mac_addr, | ||
54 | |||
55 | .tx_sram_addr = MV_SRAM_BASE_ETH0, | 51 | .tx_sram_addr = MV_SRAM_BASE_ETH0, |
56 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 52 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
57 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 53 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -80,11 +76,7 @@ static struct resource mv64x60_eth1_resources[] = { | |||
80 | }, | 76 | }, |
81 | }; | 77 | }; |
82 | 78 | ||
83 | static char eth1_mac_addr[ETH_ALEN]; | ||
84 | |||
85 | static struct mv643xx_eth_platform_data eth1_pd = { | 79 | static struct mv643xx_eth_platform_data eth1_pd = { |
86 | .mac_addr = eth1_mac_addr, | ||
87 | |||
88 | .tx_sram_addr = MV_SRAM_BASE_ETH1, | 80 | .tx_sram_addr = MV_SRAM_BASE_ETH1, |
89 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 81 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
90 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 82 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -113,11 +105,7 @@ static struct resource mv64x60_eth2_resources[] = { | |||
113 | }, | 105 | }, |
114 | }; | 106 | }; |
115 | 107 | ||
116 | static char eth2_mac_addr[ETH_ALEN]; | 108 | static struct mv643xx_eth_platform_data eth2_pd; |
117 | |||
118 | static struct mv643xx_eth_platform_data eth2_pd = { | ||
119 | .mac_addr = eth2_mac_addr, | ||
120 | }; | ||
121 | 109 | ||
122 | static struct platform_device eth2_device = { | 110 | static struct platform_device eth2_device = { |
123 | .name = MV643XX_ETH_NAME, | 111 | .name = MV643XX_ETH_NAME, |
@@ -200,9 +188,9 @@ static int __init mv643xx_eth_add_pds(void) | |||
200 | int ret; | 188 | int ret; |
201 | 189 | ||
202 | get_mac(mac); | 190 | get_mac(mac); |
203 | eth_mac_add(eth0_mac_addr, mac, 0); | 191 | eth_mac_add(eth0_pd.mac_addr, mac, 0); |
204 | eth_mac_add(eth1_mac_addr, mac, 1); | 192 | eth_mac_add(eth1_pd.mac_addr, mac, 1); |
205 | eth_mac_add(eth2_mac_addr, mac, 2); | 193 | eth_mac_add(eth2_pd.mac_addr, mac, 2); |
206 | ret = platform_add_devices(mv643xx_eth_pd_devs, | 194 | ret = platform_add_devices(mv643xx_eth_pd_devs, |
207 | ARRAY_SIZE(mv643xx_eth_pd_devs)); | 195 | ARRAY_SIZE(mv643xx_eth_pd_devs)); |
208 | 196 | ||
diff --git a/arch/mips/momentum/ocelot_c/platform.c b/arch/mips/momentum/ocelot_c/platform.c index fac8b2499387..f7cd303f3eba 100644 --- a/arch/mips/momentum/ocelot_c/platform.c +++ b/arch/mips/momentum/ocelot_c/platform.c | |||
@@ -46,11 +46,7 @@ static struct resource mv64x60_eth0_resources[] = { | |||
46 | }, | 46 | }, |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static char eth0_mac_addr[ETH_ALEN]; | ||
50 | |||
51 | static struct mv643xx_eth_platform_data eth0_pd = { | 49 | static struct mv643xx_eth_platform_data eth0_pd = { |
52 | .mac_addr = eth0_mac_addr, | ||
53 | |||
54 | .tx_sram_addr = MV_SRAM_BASE_ETH0, | 50 | .tx_sram_addr = MV_SRAM_BASE_ETH0, |
55 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 51 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
56 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 52 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -79,11 +75,7 @@ static struct resource mv64x60_eth1_resources[] = { | |||
79 | }, | 75 | }, |
80 | }; | 76 | }; |
81 | 77 | ||
82 | static char eth1_mac_addr[ETH_ALEN]; | ||
83 | |||
84 | static struct mv643xx_eth_platform_data eth1_pd = { | 78 | static struct mv643xx_eth_platform_data eth1_pd = { |
85 | .mac_addr = eth1_mac_addr, | ||
86 | |||
87 | .tx_sram_addr = MV_SRAM_BASE_ETH1, | 79 | .tx_sram_addr = MV_SRAM_BASE_ETH1, |
88 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 80 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
89 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 81 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -174,8 +166,8 @@ static int __init mv643xx_eth_add_pds(void) | |||
174 | int ret; | 166 | int ret; |
175 | 167 | ||
176 | get_mac(mac); | 168 | get_mac(mac); |
177 | eth_mac_add(eth0_mac_addr, mac, 0); | 169 | eth_mac_add(eth0_pd.mac_addr, mac, 0); |
178 | eth_mac_add(eth1_mac_addr, mac, 1); | 170 | eth_mac_add(eth1_pd.mac_addr, mac, 1); |
179 | ret = platform_add_devices(mv643xx_eth_pd_devs, | 171 | ret = platform_add_devices(mv643xx_eth_pd_devs, |
180 | ARRAY_SIZE(mv643xx_eth_pd_devs)); | 172 | ARRAY_SIZE(mv643xx_eth_pd_devs)); |
181 | 173 | ||
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index 455d76ad06d8..9d08608aaa51 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
@@ -223,10 +223,12 @@ static inline int n_counters(void) | |||
223 | switch (current_cpu_data.cputype) { | 223 | switch (current_cpu_data.cputype) { |
224 | case CPU_R10000: | 224 | case CPU_R10000: |
225 | counters = 2; | 225 | counters = 2; |
226 | break; | ||
226 | 227 | ||
227 | case CPU_R12000: | 228 | case CPU_R12000: |
228 | case CPU_R14000: | 229 | case CPU_R14000: |
229 | counters = 4; | 230 | counters = 4; |
231 | break; | ||
230 | 232 | ||
231 | default: | 233 | default: |
232 | counters = __n_counters(); | 234 | counters = __n_counters(); |
diff --git a/arch/mips/pci/fixup-jmr3927.c b/arch/mips/pci/fixup-jmr3927.c index f8696081c5b1..6e72d213f4cd 100644 --- a/arch/mips/pci/fixup-jmr3927.c +++ b/arch/mips/pci/fixup-jmr3927.c | |||
@@ -38,6 +38,10 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
38 | { | 38 | { |
39 | unsigned char irq = pin; | 39 | unsigned char irq = pin; |
40 | 40 | ||
41 | /* SMSC SLC90E66 IDE uses irq 14, 15 (default) */ | ||
42 | if (dev->vendor == PCI_VENDOR_ID_EFAR && | ||
43 | dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1) | ||
44 | return irq; | ||
41 | /* IRQ rotation (PICMG) */ | 45 | /* IRQ rotation (PICMG) */ |
42 | irq--; /* 0-3 */ | 46 | irq--; /* 0-3 */ |
43 | if (dev->bus->parent == NULL && | 47 | if (dev->bus->parent == NULL && |
@@ -93,13 +97,3 @@ int pcibios_plat_dev_init(struct pci_dev *dev) | |||
93 | { | 97 | { |
94 | return 0; | 98 | return 0; |
95 | } | 99 | } |
96 | |||
97 | int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
98 | { | ||
99 | /* SMSC SLC90E66 IDE uses irq 14, 15 (default) */ | ||
100 | if (!(dev->vendor == PCI_VENDOR_ID_EFAR && | ||
101 | dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1)) | ||
102 | return pci_get_irq(dev, pin); | ||
103 | |||
104 | dev->irq = irq; | ||
105 | } | ||
diff --git a/arch/mips/pci/fixup-sni.c b/arch/mips/pci/fixup-sni.c index 0c9a4732d455..36e5fb1b3786 100644 --- a/arch/mips/pci/fixup-sni.c +++ b/arch/mips/pci/fixup-sni.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <asm/mipsregs.h> | 14 | #include <asm/mipsregs.h> |
15 | #include <asm/sni.h> | 15 | #include <asm/sni.h> |
16 | 16 | ||
17 | #include <irq.h> | ||
18 | |||
17 | /* | 19 | /* |
18 | * PCIMT Shortcuts ... | 20 | * PCIMT Shortcuts ... |
19 | */ | 21 | */ |
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c index 8ae46481fcb7..7932dfe5eb9b 100644 --- a/arch/mips/pci/ops-au1000.c +++ b/arch/mips/pci/ops-au1000.c | |||
@@ -172,7 +172,11 @@ static int config_access(unsigned char access_type, struct pci_bus *bus, | |||
172 | error = -1; | 172 | error = -1; |
173 | DBG("Au1x Master Abort\n"); | 173 | DBG("Au1x Master Abort\n"); |
174 | } else if ((status >> 28) & 0xf) { | 174 | } else if ((status >> 28) & 0xf) { |
175 | DBG("PCI ERR detected: status %x\n", status); | 175 | DBG("PCI ERR detected: device %d, status %x\n", device, ((status >> 28) & 0xf)); |
176 | |||
177 | /* clear errors */ | ||
178 | au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD); | ||
179 | |||
176 | *data = 0xffffffff; | 180 | *data = 0xffffffff; |
177 | error = -1; | 181 | error = -1; |
178 | } | 182 | } |
diff --git a/arch/mips/philips/pnx8550/common/prom.c b/arch/mips/philips/pnx8550/common/prom.c index 8aeed6c2b8c3..2f567452e7ac 100644 --- a/arch/mips/philips/pnx8550/common/prom.c +++ b/arch/mips/philips/pnx8550/common/prom.c | |||
@@ -112,7 +112,7 @@ void __init prom_free_prom_memory(void) | |||
112 | 112 | ||
113 | extern int pnx8550_console_port; | 113 | extern int pnx8550_console_port; |
114 | 114 | ||
115 | /* used by prom_printf */ | 115 | /* used by early printk */ |
116 | void prom_putchar(char c) | 116 | void prom_putchar(char c) |
117 | { | 117 | { |
118 | if (pnx8550_console_port != -1) { | 118 | if (pnx8550_console_port != -1) { |
diff --git a/arch/mips/philips/pnx8550/common/setup.c b/arch/mips/philips/pnx8550/common/setup.c index e62123ca9b64..5bd737477685 100644 --- a/arch/mips/philips/pnx8550/common/setup.c +++ b/arch/mips/philips/pnx8550/common/setup.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #include <uart.h> | 41 | #include <uart.h> |
42 | #include <nand.h> | 42 | #include <nand.h> |
43 | 43 | ||
44 | extern void prom_printf(char *fmt, ...); | ||
45 | |||
46 | extern void __init board_setup(void); | 44 | extern void __init board_setup(void); |
47 | extern void pnx8550_machine_restart(char *); | 45 | extern void pnx8550_machine_restart(char *); |
48 | extern void pnx8550_machine_halt(void); | 46 | extern void pnx8550_machine_halt(void); |
@@ -51,7 +49,6 @@ extern struct resource ioport_resource; | |||
51 | extern struct resource iomem_resource; | 49 | extern struct resource iomem_resource; |
52 | extern void pnx8550_time_init(void); | 50 | extern void pnx8550_time_init(void); |
53 | extern void rs_kgdb_hook(int tty_no); | 51 | extern void rs_kgdb_hook(int tty_no); |
54 | extern void prom_printf(char *fmt, ...); | ||
55 | extern char *prom_getcmdline(void); | 52 | extern char *prom_getcmdline(void); |
56 | 53 | ||
57 | struct resource standard_io_resources[] = { | 54 | struct resource standard_io_resources[] = { |
@@ -141,7 +138,7 @@ void __init plat_mem_setup(void) | |||
141 | argptr += strlen("console=ttyS"); | 138 | argptr += strlen("console=ttyS"); |
142 | pnx8550_console_port = *argptr == '0' ? 0 : 1; | 139 | pnx8550_console_port = *argptr == '0' ? 0 : 1; |
143 | 140 | ||
144 | /* We must initialize the UART (console) before prom_printf */ | 141 | /* We must initialize the UART (console) before early printk */ |
145 | /* Set LCR to 8-bit and BAUD to 38400 (no 5) */ | 142 | /* Set LCR to 8-bit and BAUD to 38400 (no 5) */ |
146 | ip3106_lcr(UART_BASE, pnx8550_console_port) = | 143 | ip3106_lcr(UART_BASE, pnx8550_console_port) = |
147 | PNX8XXX_UART_LCR_8BIT; | 144 | PNX8XXX_UART_LCR_8BIT; |
@@ -155,8 +152,8 @@ void __init plat_mem_setup(void) | |||
155 | argptr += strlen("kgdb=ttyS"); | 152 | argptr += strlen("kgdb=ttyS"); |
156 | line = *argptr == '0' ? 0 : 1; | 153 | line = *argptr == '0' ? 0 : 1; |
157 | rs_kgdb_hook(line); | 154 | rs_kgdb_hook(line); |
158 | prom_printf("KGDB: Using ttyS%i for session, " | 155 | pr_info("KGDB: Using ttyS%i for session, " |
159 | "please connect your debugger\n", line ? 1 : 0); | 156 | "please connect your debugger\n", line ? 1 : 0); |
160 | } | 157 | } |
161 | #endif | 158 | #endif |
162 | return; | 159 | return; |
diff --git a/arch/mips/pmc-sierra/yosemite/py-console.c b/arch/mips/pmc-sierra/yosemite/py-console.c index 757e605693ff..b7f1d9c4a8a3 100644 --- a/arch/mips/pmc-sierra/yosemite/py-console.c +++ b/arch/mips/pmc-sierra/yosemite/py-console.c | |||
@@ -107,8 +107,3 @@ void prom_putchar(char c) | |||
107 | while ((readb_outer_space(lsr) & 0x20) == 0); | 107 | while ((readb_outer_space(lsr) & 0x20) == 0); |
108 | writeb_outer_space(thr, c); | 108 | writeb_outer_space(thr, c); |
109 | } | 109 | } |
110 | |||
111 | char __init prom_getchar(void) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
diff --git a/arch/mips/sgi-ip27/ip27-console.c b/arch/mips/sgi-ip27/ip27-console.c index 14211e382374..3ba830651c58 100644 --- a/arch/mips/sgi-ip27/ip27-console.c +++ b/arch/mips/sgi-ip27/ip27-console.c | |||
@@ -6,12 +6,6 @@ | |||
6 | * Copyright (C) 2001, 2002 Ralf Baechle | 6 | * Copyright (C) 2001, 2002 Ralf Baechle |
7 | */ | 7 | */ |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/console.h> | ||
10 | #include <linux/kdev_t.h> | ||
11 | #include <linux/major.h> | ||
12 | #include <linux/termios.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/tty.h> | ||
15 | 9 | ||
16 | #include <asm/page.h> | 10 | #include <asm/page.h> |
17 | #include <asm/semaphore.h> | 11 | #include <asm/semaphore.h> |
@@ -38,37 +32,10 @@ static inline struct ioc3_uartregs *console_uart(void) | |||
38 | return &ioc3->sregs.uarta; | 32 | return &ioc3->sregs.uarta; |
39 | } | 33 | } |
40 | 34 | ||
41 | void prom_putchar(char c) | 35 | void __init prom_putchar(char c) |
42 | { | 36 | { |
43 | struct ioc3_uartregs *uart = console_uart(); | 37 | struct ioc3_uartregs *uart = console_uart(); |
44 | 38 | ||
45 | while ((uart->iu_lsr & 0x20) == 0); | 39 | while ((uart->iu_lsr & 0x20) == 0); |
46 | uart->iu_thr = c; | 40 | uart->iu_thr = c; |
47 | } | 41 | } |
48 | |||
49 | static void ioc3_console_write(struct console *con, const char *s, unsigned n) | ||
50 | { | ||
51 | while (n-- && *s) { | ||
52 | if (*s == '\n') | ||
53 | prom_putchar('\r'); | ||
54 | prom_putchar(*s); | ||
55 | s++; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | static struct console ioc3_console = { | ||
60 | .name = "ioc3", | ||
61 | .write = ioc3_console_write, | ||
62 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
63 | .index = -1 | ||
64 | }; | ||
65 | |||
66 | __init void ip27_setup_console(void) | ||
67 | { | ||
68 | register_console(&ioc3_console); | ||
69 | } | ||
70 | |||
71 | void __init disable_early_printk(void) | ||
72 | { | ||
73 | unregister_console(&ioc3_console); | ||
74 | } | ||
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig index ec7a2cffacf0..67dac6204b6d 100644 --- a/arch/mips/sibyte/Kconfig +++ b/arch/mips/sibyte/Kconfig | |||
@@ -116,6 +116,7 @@ config SB1_CERR_STALL | |||
116 | config SIBYTE_CFE | 116 | config SIBYTE_CFE |
117 | bool "Booting from CFE" | 117 | bool "Booting from CFE" |
118 | depends on SIBYTE_SB1xxx_SOC | 118 | depends on SIBYTE_SB1xxx_SOC |
119 | select SYS_HAS_EARLY_PRINTK | ||
119 | help | 120 | help |
120 | Make use of the CFE API for enumerating available memory, | 121 | Make use of the CFE API for enumerating available memory, |
121 | controlling secondary CPUs, and possibly console output. | 122 | controlling secondary CPUs, and possibly console output. |
@@ -131,6 +132,7 @@ config SIBYTE_CFE_CONSOLE | |||
131 | config SIBYTE_STANDALONE | 132 | config SIBYTE_STANDALONE |
132 | bool | 133 | bool |
133 | depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE | 134 | depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE |
135 | select SYS_HAS_EARLY_PRINTK | ||
134 | default y | 136 | default y |
135 | 137 | ||
136 | config SIBYTE_STANDALONE_RAM_SIZE | 138 | config SIBYTE_STANDALONE_RAM_SIZE |
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c index 1dc5d05d8962..20af0f1bb7bf 100644 --- a/arch/mips/sibyte/bcm1480/irq.c +++ b/arch/mips/sibyte/bcm1480/irq.c | |||
@@ -420,7 +420,7 @@ void __init arch_init_irq(void) | |||
420 | #ifdef CONFIG_GDB_CONSOLE | 420 | #ifdef CONFIG_GDB_CONSOLE |
421 | register_gdb_console(); | 421 | register_gdb_console(); |
422 | #endif | 422 | #endif |
423 | prom_printf("Waiting for GDB on UART port %d\n", kgdb_port); | 423 | printk("Waiting for GDB on UART port %d\n", kgdb_port); |
424 | set_debug_traps(); | 424 | set_debug_traps(); |
425 | breakpoint(); | 425 | breakpoint(); |
426 | } | 426 | } |
diff --git a/arch/mips/sibyte/bcm1480/setup.c b/arch/mips/sibyte/bcm1480/setup.c index 8236d0c48542..bdaac34ae708 100644 --- a/arch/mips/sibyte/bcm1480/setup.c +++ b/arch/mips/sibyte/bcm1480/setup.c | |||
@@ -69,7 +69,7 @@ static inline int sys_rev_decode(void) | |||
69 | break; | 69 | break; |
70 | 70 | ||
71 | default: | 71 | default: |
72 | prom_printf("Unknown part type %x\n", part_type); | 72 | printk("Unknown part type %x\n", part_type); |
73 | ret = 1; | 73 | ret = 1; |
74 | break; | 74 | break; |
75 | } | 75 | } |
@@ -102,7 +102,7 @@ static inline int setup_bcm1x80_bcm1x55(void) | |||
102 | pass_str = "B0 (pass2)"; | 102 | pass_str = "B0 (pass2)"; |
103 | break; | 103 | break; |
104 | default: | 104 | default: |
105 | prom_printf("Unknown %s rev %x\n", soc_str, soc_pass); | 105 | printk("Unknown %s rev %x\n", soc_str, soc_pass); |
106 | periph_rev = 1; | 106 | periph_rev = 1; |
107 | pass_str = "Unknown Revision"; | 107 | pass_str = "Unknown Revision"; |
108 | break; | 108 | break; |
@@ -122,14 +122,14 @@ void bcm1480_setup(void) | |||
122 | soc_pass = G_SYS_REVISION(sys_rev); | 122 | soc_pass = G_SYS_REVISION(sys_rev); |
123 | 123 | ||
124 | if (sys_rev_decode()) { | 124 | if (sys_rev_decode()) { |
125 | prom_printf("Restart after failure to identify SiByte chip\n"); | 125 | printk("Restart after failure to identify SiByte chip\n"); |
126 | machine_restart(NULL); | 126 | machine_restart(NULL); |
127 | } | 127 | } |
128 | 128 | ||
129 | plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); | 129 | plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); |
130 | zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); | 130 | zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); |
131 | 131 | ||
132 | prom_printf("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n", | 132 | printk("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n", |
133 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); | 133 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); |
134 | prom_printf("Board type: %s\n", get_system_type()); | 134 | printk("Board type: %s\n", get_system_type()); |
135 | } | 135 | } |
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c index 9e6099e69622..ae4a92c3e529 100644 --- a/arch/mips/sibyte/cfe/setup.c +++ b/arch/mips/sibyte/cfe/setup.c | |||
@@ -221,10 +221,10 @@ static int __init initrd_setup(char *str) | |||
221 | goto fail; | 221 | goto fail; |
222 | } | 222 | } |
223 | initrd_end = initrd_start + initrd_size; | 223 | initrd_end = initrd_start + initrd_size; |
224 | prom_printf("Found initrd of %lx@%lx\n", initrd_size, initrd_start); | 224 | printk("Found initrd of %lx@%lx\n", initrd_size, initrd_start); |
225 | return 1; | 225 | return 1; |
226 | fail: | 226 | fail: |
227 | prom_printf("Bad initrd argument. Disabling initrd\n"); | 227 | printk("Bad initrd argument. Disabling initrd\n"); |
228 | initrd_start = 0; | 228 | initrd_start = 0; |
229 | initrd_end = 0; | 229 | initrd_end = 0; |
230 | return 1; | 230 | return 1; |
@@ -281,7 +281,7 @@ void __init prom_init(void) | |||
281 | } | 281 | } |
282 | if (cfe_eptseal != CFE_EPTSEAL) { | 282 | if (cfe_eptseal != CFE_EPTSEAL) { |
283 | /* too early for panic to do any good */ | 283 | /* too early for panic to do any good */ |
284 | prom_printf("CFE's entrypoint seal doesn't match. Spinning."); | 284 | printk("CFE's entrypoint seal doesn't match. Spinning."); |
285 | while (1) ; | 285 | while (1) ; |
286 | } | 286 | } |
287 | cfe_init(cfe_handle, cfe_ept); | 287 | cfe_init(cfe_handle, cfe_ept); |
@@ -303,7 +303,7 @@ void __init prom_init(void) | |||
303 | } else { | 303 | } else { |
304 | /* The loader should have set the command line */ | 304 | /* The loader should have set the command line */ |
305 | /* too early for panic to do any good */ | 305 | /* too early for panic to do any good */ |
306 | prom_printf("LINUX_CMDLINE not defined in cfe."); | 306 | printk("LINUX_CMDLINE not defined in cfe."); |
307 | while (1) ; | 307 | while (1) ; |
308 | } | 308 | } |
309 | } | 309 | } |
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c index d0ee1d5b8223..1cb042eab720 100644 --- a/arch/mips/sibyte/sb1250/setup.c +++ b/arch/mips/sibyte/sb1250/setup.c | |||
@@ -67,7 +67,7 @@ static int __init sys_rev_decode(void) | |||
67 | ret = setup_bcm112x(); | 67 | ret = setup_bcm112x(); |
68 | break; | 68 | break; |
69 | default: | 69 | default: |
70 | prom_printf("Unknown SOC type %x\n", soc_type); | 70 | printk("Unknown SOC type %x\n", soc_type); |
71 | ret = 1; | 71 | ret = 1; |
72 | break; | 72 | break; |
73 | } | 73 | } |
@@ -112,7 +112,7 @@ static int __init setup_bcm1250(void) | |||
112 | pass_str = "A0-A6"; | 112 | pass_str = "A0-A6"; |
113 | war_pass = K_SYS_REVISION_BCM1250_PASS2; | 113 | war_pass = K_SYS_REVISION_BCM1250_PASS2; |
114 | } else { | 114 | } else { |
115 | prom_printf("Unknown BCM1250 rev %x\n", soc_pass); | 115 | printk("Unknown BCM1250 rev %x\n", soc_pass); |
116 | ret = 1; | 116 | ret = 1; |
117 | } | 117 | } |
118 | break; | 118 | break; |
@@ -140,7 +140,7 @@ static int __init setup_bcm112x(void) | |||
140 | pass_str = "A2"; | 140 | pass_str = "A2"; |
141 | break; | 141 | break; |
142 | default: | 142 | default: |
143 | prom_printf("Unknown %s rev %x\n", soc_str, soc_pass); | 143 | printk("Unknown %s rev %x\n", soc_str, soc_pass); |
144 | ret = 1; | 144 | ret = 1; |
145 | } | 145 | } |
146 | return ret; | 146 | return ret; |
@@ -158,21 +158,21 @@ void __init sb1250_setup(void) | |||
158 | soc_pass = G_SYS_REVISION(sys_rev); | 158 | soc_pass = G_SYS_REVISION(sys_rev); |
159 | 159 | ||
160 | if (sys_rev_decode()) { | 160 | if (sys_rev_decode()) { |
161 | prom_printf("Restart after failure to identify SiByte chip\n"); | 161 | printk("Restart after failure to identify SiByte chip\n"); |
162 | machine_restart(NULL); | 162 | machine_restart(NULL); |
163 | } | 163 | } |
164 | 164 | ||
165 | plldiv = G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); | 165 | plldiv = G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); |
166 | zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); | 166 | zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); |
167 | 167 | ||
168 | prom_printf("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n", | 168 | printk("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n", |
169 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); | 169 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); |
170 | prom_printf("Board type: %s\n", get_system_type()); | 170 | printk("Board type: %s\n", get_system_type()); |
171 | 171 | ||
172 | switch (war_pass) { | 172 | switch (war_pass) { |
173 | case K_SYS_REVISION_BCM1250_PASS1: | 173 | case K_SYS_REVISION_BCM1250_PASS1: |
174 | #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS | 174 | #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS |
175 | prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " | 175 | printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " |
176 | "and the kernel doesn't have the proper " | 176 | "and the kernel doesn't have the proper " |
177 | "workarounds compiled in. @@@@\n"); | 177 | "workarounds compiled in. @@@@\n"); |
178 | bad_config = 1; | 178 | bad_config = 1; |
@@ -182,27 +182,27 @@ void __init sb1250_setup(void) | |||
182 | /* Pass 2 - easiest as default for now - so many numbers */ | 182 | /* Pass 2 - easiest as default for now - so many numbers */ |
183 | #if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \ | 183 | #if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \ |
184 | !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) | 184 | !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) |
185 | prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the " | 185 | printk("@@@@ This is a BCM1250 A3-A10 board, and the " |
186 | "kernel doesn't have the proper workarounds " | 186 | "kernel doesn't have the proper workarounds " |
187 | "compiled in. @@@@\n"); | 187 | "compiled in. @@@@\n"); |
188 | bad_config = 1; | 188 | bad_config = 1; |
189 | #endif | 189 | #endif |
190 | #ifdef CONFIG_CPU_HAS_PREFETCH | 190 | #ifdef CONFIG_CPU_HAS_PREFETCH |
191 | prom_printf("@@@@ Prefetches may be enabled in this kernel, " | 191 | printk("@@@@ Prefetches may be enabled in this kernel, " |
192 | "but are buggy on this board. @@@@\n"); | 192 | "but are buggy on this board. @@@@\n"); |
193 | bad_config = 1; | 193 | bad_config = 1; |
194 | #endif | 194 | #endif |
195 | break; | 195 | break; |
196 | case K_SYS_REVISION_BCM1250_PASS2_2: | 196 | case K_SYS_REVISION_BCM1250_PASS2_2: |
197 | #ifndef CONFIG_SB1_PASS_2_WORKAROUNDS | 197 | #ifndef CONFIG_SB1_PASS_2_WORKAROUNDS |
198 | prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the " | 198 | printk("@@@@ This is a BCM1250 B1/B2. board, and the " |
199 | "kernel doesn't have the proper workarounds " | 199 | "kernel doesn't have the proper workarounds " |
200 | "compiled in. @@@@\n"); | 200 | "compiled in. @@@@\n"); |
201 | bad_config = 1; | 201 | bad_config = 1; |
202 | #endif | 202 | #endif |
203 | #if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \ | 203 | #if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \ |
204 | !defined(CONFIG_CPU_HAS_PREFETCH) | 204 | !defined(CONFIG_CPU_HAS_PREFETCH) |
205 | prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is " | 205 | printk("@@@@ This is a BCM1250 B1/B2, but the kernel is " |
206 | "conservatively configured for an 'A' stepping. " | 206 | "conservatively configured for an 'A' stepping. " |
207 | "@@@@\n"); | 207 | "@@@@\n"); |
208 | #endif | 208 | #endif |
@@ -211,7 +211,7 @@ void __init sb1250_setup(void) | |||
211 | break; | 211 | break; |
212 | } | 212 | } |
213 | if (bad_config) { | 213 | if (bad_config) { |
214 | prom_printf("Invalid configuration for this chip.\n"); | 214 | printk("Invalid configuration for this chip.\n"); |
215 | machine_restart(NULL); | 215 | machine_restart(NULL); |
216 | } | 216 | } |
217 | } | 217 | } |
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c index 6a44bbf0b732..643366eb854a 100644 --- a/arch/mips/sni/sniprom.c +++ b/arch/mips/sni/sniprom.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) | 9 | * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define DEBUG | ||
13 | |||
12 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | 15 | #include <linux/init.h> |
14 | #include <linux/string.h> | 16 | #include <linux/string.h> |
@@ -32,14 +34,13 @@ | |||
32 | #define PROM_ENTRY(x) (PROM_VEC + (x)) | 34 | #define PROM_ENTRY(x) (PROM_VEC + (x)) |
33 | 35 | ||
34 | 36 | ||
35 | #define DEBUG | ||
36 | #ifdef DEBUG | ||
37 | #define DBG_PRINTF(x...) prom_printf(x) | ||
38 | #else | ||
39 | #define DBG_PRINTF(x...) | ||
40 | #endif | ||
41 | |||
42 | static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR); | 37 | static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR); |
38 | |||
39 | void prom_putchar(char c) | ||
40 | { | ||
41 | __prom_putchar(c); | ||
42 | } | ||
43 | |||
43 | static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV); | 44 | static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV); |
44 | static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF); | 45 | static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF); |
45 | 46 | ||
@@ -48,26 +49,6 @@ char *prom_getenv (char *s) | |||
48 | return __prom_getenv(s); | 49 | return __prom_getenv(s); |
49 | } | 50 | } |
50 | 51 | ||
51 | void prom_printf(char *fmt, ...) | ||
52 | { | ||
53 | va_list args; | ||
54 | char ppbuf[1024]; | ||
55 | char *bptr; | ||
56 | |||
57 | va_start(args, fmt); | ||
58 | vsprintf(ppbuf, fmt, args); | ||
59 | |||
60 | bptr = ppbuf; | ||
61 | |||
62 | while (*bptr != 0) { | ||
63 | if (*bptr == '\n') | ||
64 | __prom_putchar('\r'); | ||
65 | |||
66 | __prom_putchar(*bptr++); | ||
67 | } | ||
68 | va_end(args); | ||
69 | } | ||
70 | |||
71 | void __init prom_free_prom_memory(void) | 52 | void __init prom_free_prom_memory(void) |
72 | { | 53 | { |
73 | } | 54 | } |
@@ -94,15 +75,15 @@ static void sni_idprom_dump(void) | |||
94 | { | 75 | { |
95 | int i; | 76 | int i; |
96 | 77 | ||
97 | prom_printf("SNI IDProm dump:\n"); | 78 | pr_debug("SNI IDProm dump:\n"); |
98 | for (i = 0; i < 256; i++) { | 79 | for (i = 0; i < 256; i++) { |
99 | if (i%16 == 0) | 80 | if (i%16 == 0) |
100 | prom_printf("%04x ", i); | 81 | pr_debug("%04x ", i); |
101 | 82 | ||
102 | prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); | 83 | printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); |
103 | 84 | ||
104 | if (i % 16 == 15) | 85 | if (i % 16 == 15) |
105 | prom_printf("\n"); | 86 | printk("\n"); |
106 | } | 87 | } |
107 | } | 88 | } |
108 | #endif | 89 | #endif |
@@ -121,12 +102,12 @@ static void sni_mem_init(void ) | |||
121 | /* MemSIZE from prom in 16MByte chunks */ | 102 | /* MemSIZE from prom in 16MByte chunks */ |
122 | memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; | 103 | memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; |
123 | 104 | ||
124 | DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize); | 105 | pr_debug("IDProm memsize: %lu MByte\n", memsize); |
125 | 106 | ||
126 | /* get memory bank layout from prom */ | 107 | /* get memory bank layout from prom */ |
127 | __prom_get_memconf(&memconf); | 108 | __prom_get_memconf(&memconf); |
128 | 109 | ||
129 | DBG_PRINTF("prom_get_mem_conf memory configuration:\n"); | 110 | pr_debug("prom_get_mem_conf memory configuration:\n"); |
130 | for (i = 0;i < 8 && memconf[i].size; i++) { | 111 | for (i = 0;i < 8 && memconf[i].size; i++) { |
131 | if (sni_brd_type == SNI_BRD_PCI_TOWER || | 112 | if (sni_brd_type == SNI_BRD_PCI_TOWER || |
132 | sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) { | 113 | sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) { |
@@ -135,7 +116,7 @@ static void sni_mem_init(void ) | |||
135 | memconf[i].base -= 0x20000000; | 116 | memconf[i].base -= 0x20000000; |
136 | } | 117 | } |
137 | } | 118 | } |
138 | DBG_PRINTF("Bank%d: %08x @ %08x\n", i, | 119 | pr_debug("Bank%d: %08x @ %08x\n", i, |
139 | memconf[i].size, memconf[i].base); | 120 | memconf[i].size, memconf[i].base); |
140 | add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM); | 121 | add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM); |
141 | } | 122 | } |
@@ -248,7 +229,7 @@ void __init prom_init(void) | |||
248 | systype = "RM300-Exx"; | 229 | systype = "RM300-Exx"; |
249 | break; | 230 | break; |
250 | } | 231 | } |
251 | DBG_PRINTF("Found SNI brdtype %02x name %s\n", sni_brd_type,systype); | 232 | pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type,systype); |
252 | 233 | ||
253 | #ifdef DEBUG | 234 | #ifdef DEBUG |
254 | sni_idprom_dump(); | 235 | sni_idprom_dump(); |
diff --git a/arch/mips/tx4927/common/tx4927_setup.c b/arch/mips/tx4927/common/tx4927_setup.c index 941c441729b0..c8e49feb345b 100644 --- a/arch/mips/tx4927/common/tx4927_setup.c +++ b/arch/mips/tx4927/common/tx4927_setup.c | |||
@@ -81,18 +81,8 @@ void __init tx4927_time_init(void) | |||
81 | 81 | ||
82 | void __init plat_timer_setup(struct irqaction *irq) | 82 | void __init plat_timer_setup(struct irqaction *irq) |
83 | { | 83 | { |
84 | u32 count; | ||
85 | u32 c1; | ||
86 | u32 c2; | ||
87 | |||
88 | setup_irq(TX4927_IRQ_CPU_TIMER, irq); | 84 | setup_irq(TX4927_IRQ_CPU_TIMER, irq); |
89 | 85 | ||
90 | /* to generate the first timer interrupt */ | ||
91 | c1 = read_c0_count(); | ||
92 | count = c1 + (mips_hpt_frequency / HZ); | ||
93 | write_c0_compare(count); | ||
94 | c2 = read_c0_count(); | ||
95 | |||
96 | #ifdef CONFIG_TOSHIBA_RBTX4927 | 86 | #ifdef CONFIG_TOSHIBA_RBTX4927 |
97 | { | 87 | { |
98 | extern void toshiba_rbtx4927_timer_setup(struct irqaction | 88 | extern void toshiba_rbtx4927_timer_setup(struct irqaction |
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c index dcce88f403c9..5cc30c10e746 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c | |||
@@ -132,9 +132,6 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB | |||
132 | #include <asm/wbflush.h> | 132 | #include <asm/wbflush.h> |
133 | #include <linux/bootmem.h> | 133 | #include <linux/bootmem.h> |
134 | #include <linux/blkdev.h> | 134 | #include <linux/blkdev.h> |
135 | #ifdef CONFIG_RTC_DS1742 | ||
136 | #include <linux/ds1742rtc.h> | ||
137 | #endif | ||
138 | #ifdef CONFIG_TOSHIBA_FPCIB0 | 135 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
139 | #include <asm/tx4927/smsc_fdc37m81x.h> | 136 | #include <asm/tx4927/smsc_fdc37m81x.h> |
140 | #endif | 137 | #endif |
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c index 7316a78fdd68..0f7576dfd141 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
54 | #include <linux/timex.h> | 54 | #include <linux/timex.h> |
55 | #include <linux/pm.h> | 55 | #include <linux/pm.h> |
56 | #include <linux/platform_device.h> | ||
56 | 57 | ||
57 | #include <asm/bootinfo.h> | 58 | #include <asm/bootinfo.h> |
58 | #include <asm/page.h> | 59 | #include <asm/page.h> |
@@ -64,9 +65,6 @@ | |||
64 | #include <asm/time.h> | 65 | #include <asm/time.h> |
65 | #include <linux/bootmem.h> | 66 | #include <linux/bootmem.h> |
66 | #include <linux/blkdev.h> | 67 | #include <linux/blkdev.h> |
67 | #ifdef CONFIG_RTC_DS1742 | ||
68 | #include <linux/ds1742rtc.h> | ||
69 | #endif | ||
70 | #ifdef CONFIG_TOSHIBA_FPCIB0 | 68 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
71 | #include <asm/tx4927/smsc_fdc37m81x.h> | 69 | #include <asm/tx4927/smsc_fdc37m81x.h> |
72 | #endif | 70 | #endif |
@@ -1020,69 +1018,12 @@ void __init toshiba_rbtx4927_setup(void) | |||
1020 | "+\n"); | 1018 | "+\n"); |
1021 | } | 1019 | } |
1022 | 1020 | ||
1023 | #ifdef CONFIG_RTC_DS1742 | ||
1024 | extern unsigned long rtc_ds1742_get_time(void); | ||
1025 | extern int rtc_ds1742_set_time(unsigned long); | ||
1026 | extern void rtc_ds1742_wait(void); | ||
1027 | #endif | ||
1028 | |||
1029 | void __init | 1021 | void __init |
1030 | toshiba_rbtx4927_time_init(void) | 1022 | toshiba_rbtx4927_time_init(void) |
1031 | { | 1023 | { |
1032 | u32 c1; | ||
1033 | u32 c2; | ||
1034 | |||
1035 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n"); | 1024 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n"); |
1036 | 1025 | ||
1037 | #ifdef CONFIG_RTC_DS1742 | 1026 | mips_hpt_frequency = tx4927_cpu_clock / 2; |
1038 | |||
1039 | rtc_mips_get_time = rtc_ds1742_get_time; | ||
1040 | rtc_mips_set_time = rtc_ds1742_set_time; | ||
1041 | |||
1042 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1043 | ":rtc_ds1742_init()-\n"); | ||
1044 | rtc_ds1742_init(0xbc010000); | ||
1045 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1046 | ":rtc_ds1742_init()+\n"); | ||
1047 | |||
1048 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1049 | ":Calibrate mips_hpt_frequency-\n"); | ||
1050 | rtc_ds1742_wait(); | ||
1051 | |||
1052 | /* get the count */ | ||
1053 | c1 = read_c0_count(); | ||
1054 | |||
1055 | /* wait for the seconds to change again */ | ||
1056 | rtc_ds1742_wait(); | ||
1057 | |||
1058 | /* get the count again */ | ||
1059 | c2 = read_c0_count(); | ||
1060 | |||
1061 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1062 | ":Calibrate mips_hpt_frequency+\n"); | ||
1063 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1064 | ":c1=%12u\n", c1); | ||
1065 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1066 | ":c2=%12u\n", c2); | ||
1067 | |||
1068 | /* this diff is as close as we are going to get to counter ticks per sec */ | ||
1069 | mips_hpt_frequency = abs(c2 - c1); | ||
1070 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1071 | ":f1=%12u\n", mips_hpt_frequency); | ||
1072 | |||
1073 | /* round to 1/10th of a MHz */ | ||
1074 | mips_hpt_frequency /= (100 * 1000); | ||
1075 | mips_hpt_frequency *= (100 * 1000); | ||
1076 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1077 | ":f2=%12u\n", mips_hpt_frequency); | ||
1078 | |||
1079 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO, | ||
1080 | ":mips_hpt_frequency=%uHz (%uMHz)\n", | ||
1081 | mips_hpt_frequency, | ||
1082 | mips_hpt_frequency / 1000000); | ||
1083 | #else | ||
1084 | mips_hpt_frequency = 100000000; | ||
1085 | #endif | ||
1086 | 1027 | ||
1087 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); | 1028 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); |
1088 | 1029 | ||
@@ -1095,3 +1036,16 @@ void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq) | |||
1095 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, | 1036 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, |
1096 | "+\n"); | 1037 | "+\n"); |
1097 | } | 1038 | } |
1039 | |||
1040 | static int __init toshiba_rbtx4927_rtc_init(void) | ||
1041 | { | ||
1042 | struct resource res = { | ||
1043 | .start = 0x1c010000, | ||
1044 | .end = 0x1c010000 + 0x800 - 1, | ||
1045 | .flags = IORESOURCE_MEM, | ||
1046 | }; | ||
1047 | struct platform_device *dev = | ||
1048 | platform_device_register_simple("ds1742", -1, &res, 1); | ||
1049 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
1050 | } | ||
1051 | device_initcall(toshiba_rbtx4927_rtc_init); | ||
diff --git a/arch/mips/tx4938/common/setup.c b/arch/mips/tx4938/common/setup.c index dc87d92bb08d..142abf453e40 100644 --- a/arch/mips/tx4938/common/setup.c +++ b/arch/mips/tx4938/common/setup.c | |||
@@ -55,14 +55,5 @@ tx4938_time_init(void) | |||
55 | 55 | ||
56 | void __init plat_timer_setup(struct irqaction *irq) | 56 | void __init plat_timer_setup(struct irqaction *irq) |
57 | { | 57 | { |
58 | u32 count; | ||
59 | u32 c1; | ||
60 | u32 c2; | ||
61 | |||
62 | setup_irq(TX4938_IRQ_CPU_TIMER, irq); | 58 | setup_irq(TX4938_IRQ_CPU_TIMER, irq); |
63 | |||
64 | c1 = read_c0_count(); | ||
65 | count = c1 + (mips_hpt_frequency / HZ); | ||
66 | write_c0_compare(count); | ||
67 | c2 = read_c0_count(); | ||
68 | } | 59 | } |
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c index dab6169e31ca..48c24f7518c2 100644 --- a/arch/sparc/kernel/of_device.c +++ b/arch/sparc/kernel/of_device.c | |||
@@ -495,7 +495,7 @@ static void __init build_device_resources(struct of_device *op, | |||
495 | u32 *reg = (preg + (index * ((na + ns) * 4))); | 495 | u32 *reg = (preg + (index * ((na + ns) * 4))); |
496 | struct device_node *dp = op->node; | 496 | struct device_node *dp = op->node; |
497 | struct device_node *pp = p_op->node; | 497 | struct device_node *pp = p_op->node; |
498 | struct of_bus *pbus; | 498 | struct of_bus *pbus, *dbus; |
499 | u64 size, result = OF_BAD_ADDR; | 499 | u64 size, result = OF_BAD_ADDR; |
500 | unsigned long flags; | 500 | unsigned long flags; |
501 | int dna, dns; | 501 | int dna, dns; |
@@ -516,6 +516,7 @@ static void __init build_device_resources(struct of_device *op, | |||
516 | 516 | ||
517 | dna = na; | 517 | dna = na; |
518 | dns = ns; | 518 | dns = ns; |
519 | dbus = bus; | ||
519 | 520 | ||
520 | while (1) { | 521 | while (1) { |
521 | dp = pp; | 522 | dp = pp; |
@@ -528,13 +529,13 @@ static void __init build_device_resources(struct of_device *op, | |||
528 | pbus = of_match_bus(pp); | 529 | pbus = of_match_bus(pp); |
529 | pbus->count_cells(dp, &pna, &pns); | 530 | pbus->count_cells(dp, &pna, &pns); |
530 | 531 | ||
531 | if (build_one_resource(dp, bus, pbus, addr, | 532 | if (build_one_resource(dp, dbus, pbus, addr, |
532 | dna, dns, pna)) | 533 | dna, dns, pna)) |
533 | break; | 534 | break; |
534 | 535 | ||
535 | dna = pna; | 536 | dna = pna; |
536 | dns = pns; | 537 | dns = pns; |
537 | bus = pbus; | 538 | dbus = pbus; |
538 | } | 539 | } |
539 | 540 | ||
540 | build_res: | 541 | build_res: |
@@ -549,9 +550,6 @@ static void __init build_device_resources(struct of_device *op, | |||
549 | r->start = result & 0xffffffff; | 550 | r->start = result & 0xffffffff; |
550 | r->end = result + size - 1; | 551 | r->end = result + size - 1; |
551 | r->flags = flags | ((result >> 32ULL) & 0xffUL); | 552 | r->flags = flags | ((result >> 32ULL) & 0xffUL); |
552 | } else { | ||
553 | r->start = ~0UL; | ||
554 | r->end = ~0UL; | ||
555 | } | 553 | } |
556 | r->name = op->node->name; | 554 | r->name = op->node->name; |
557 | } | 555 | } |
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 207f1b6eef53..3fa5f95c4614 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
@@ -944,6 +944,14 @@ int pcibios_assign_resource(struct pci_dev *pdev, int resource) | |||
944 | return -ENXIO; | 944 | return -ENXIO; |
945 | } | 945 | } |
946 | 946 | ||
947 | struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) | ||
948 | { | ||
949 | struct pcidev_cookie *pc = pdev->sysdata; | ||
950 | |||
951 | return pc->prom_node; | ||
952 | } | ||
953 | EXPORT_SYMBOL(pci_device_to_OF_node); | ||
954 | |||
947 | /* | 955 | /* |
948 | * This probably belongs here rather than ioport.c because | 956 | * This probably belongs here rather than ioport.c because |
949 | * we do not want this crud linked into SBus kernels. | 957 | * we do not want this crud linked into SBus kernels. |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index ad74e5e8778e..fb9bf1e4d036 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -581,7 +581,7 @@ static void __init build_device_resources(struct of_device *op, | |||
581 | u32 *reg = (preg + (index * ((na + ns) * 4))); | 581 | u32 *reg = (preg + (index * ((na + ns) * 4))); |
582 | struct device_node *dp = op->node; | 582 | struct device_node *dp = op->node; |
583 | struct device_node *pp = p_op->node; | 583 | struct device_node *pp = p_op->node; |
584 | struct of_bus *pbus; | 584 | struct of_bus *pbus, *dbus; |
585 | u64 size, result = OF_BAD_ADDR; | 585 | u64 size, result = OF_BAD_ADDR; |
586 | unsigned long flags; | 586 | unsigned long flags; |
587 | int dna, dns; | 587 | int dna, dns; |
@@ -599,6 +599,7 @@ static void __init build_device_resources(struct of_device *op, | |||
599 | 599 | ||
600 | dna = na; | 600 | dna = na; |
601 | dns = ns; | 601 | dns = ns; |
602 | dbus = bus; | ||
602 | 603 | ||
603 | while (1) { | 604 | while (1) { |
604 | dp = pp; | 605 | dp = pp; |
@@ -611,13 +612,13 @@ static void __init build_device_resources(struct of_device *op, | |||
611 | pbus = of_match_bus(pp); | 612 | pbus = of_match_bus(pp); |
612 | pbus->count_cells(dp, &pna, &pns); | 613 | pbus->count_cells(dp, &pna, &pns); |
613 | 614 | ||
614 | if (build_one_resource(dp, bus, pbus, addr, | 615 | if (build_one_resource(dp, dbus, pbus, addr, |
615 | dna, dns, pna)) | 616 | dna, dns, pna)) |
616 | break; | 617 | break; |
617 | 618 | ||
618 | dna = pna; | 619 | dna = pna; |
619 | dns = pns; | 620 | dns = pns; |
620 | bus = pbus; | 621 | dbus = pbus; |
621 | } | 622 | } |
622 | 623 | ||
623 | build_res: | 624 | build_res: |
@@ -635,9 +636,6 @@ static void __init build_device_resources(struct of_device *op, | |||
635 | r->start = result; | 636 | r->start = result; |
636 | r->end = result + size - 1; | 637 | r->end = result + size - 1; |
637 | r->flags = flags; | 638 | r->flags = flags; |
638 | } else { | ||
639 | r->start = ~0UL; | ||
640 | r->end = ~0UL; | ||
641 | } | 639 | } |
642 | r->name = op->node->name; | 640 | r->name = op->node->name; |
643 | } | 641 | } |
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index 6fedfb98f8b0..196b4b72482b 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c | |||
@@ -681,4 +681,12 @@ void arch_teardown_msi_irq(unsigned int virt_irq) | |||
681 | } | 681 | } |
682 | #endif /* !(CONFIG_PCI_MSI) */ | 682 | #endif /* !(CONFIG_PCI_MSI) */ |
683 | 683 | ||
684 | struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) | ||
685 | { | ||
686 | struct pcidev_cookie *pc = pdev->sysdata; | ||
687 | |||
688 | return pc->op->node; | ||
689 | } | ||
690 | EXPORT_SYMBOL(pci_device_to_OF_node); | ||
691 | |||
684 | #endif /* !(CONFIG_PCI) */ | 692 | #endif /* !(CONFIG_PCI) */ |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 1539734bbbad..43cc43d7b591 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -219,10 +219,12 @@ static void ahci_thaw(struct ata_port *ap); | |||
219 | static void ahci_error_handler(struct ata_port *ap); | 219 | static void ahci_error_handler(struct ata_port *ap); |
220 | static void ahci_vt8251_error_handler(struct ata_port *ap); | 220 | static void ahci_vt8251_error_handler(struct ata_port *ap); |
221 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); | 221 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); |
222 | #ifdef CONFIG_PM | ||
222 | static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg); | 223 | static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg); |
223 | static int ahci_port_resume(struct ata_port *ap); | 224 | static int ahci_port_resume(struct ata_port *ap); |
224 | static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | 225 | static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
225 | static int ahci_pci_device_resume(struct pci_dev *pdev); | 226 | static int ahci_pci_device_resume(struct pci_dev *pdev); |
227 | #endif | ||
226 | 228 | ||
227 | static struct scsi_host_template ahci_sht = { | 229 | static struct scsi_host_template ahci_sht = { |
228 | .module = THIS_MODULE, | 230 | .module = THIS_MODULE, |
@@ -241,8 +243,10 @@ static struct scsi_host_template ahci_sht = { | |||
241 | .slave_configure = ata_scsi_slave_config, | 243 | .slave_configure = ata_scsi_slave_config, |
242 | .slave_destroy = ata_scsi_slave_destroy, | 244 | .slave_destroy = ata_scsi_slave_destroy, |
243 | .bios_param = ata_std_bios_param, | 245 | .bios_param = ata_std_bios_param, |
246 | #ifdef CONFIG_PM | ||
244 | .suspend = ata_scsi_device_suspend, | 247 | .suspend = ata_scsi_device_suspend, |
245 | .resume = ata_scsi_device_resume, | 248 | .resume = ata_scsi_device_resume, |
249 | #endif | ||
246 | }; | 250 | }; |
247 | 251 | ||
248 | static const struct ata_port_operations ahci_ops = { | 252 | static const struct ata_port_operations ahci_ops = { |
@@ -271,8 +275,10 @@ static const struct ata_port_operations ahci_ops = { | |||
271 | .error_handler = ahci_error_handler, | 275 | .error_handler = ahci_error_handler, |
272 | .post_internal_cmd = ahci_post_internal_cmd, | 276 | .post_internal_cmd = ahci_post_internal_cmd, |
273 | 277 | ||
278 | #ifdef CONFIG_PM | ||
274 | .port_suspend = ahci_port_suspend, | 279 | .port_suspend = ahci_port_suspend, |
275 | .port_resume = ahci_port_resume, | 280 | .port_resume = ahci_port_resume, |
281 | #endif | ||
276 | 282 | ||
277 | .port_start = ahci_port_start, | 283 | .port_start = ahci_port_start, |
278 | .port_stop = ahci_port_stop, | 284 | .port_stop = ahci_port_stop, |
@@ -304,8 +310,10 @@ static const struct ata_port_operations ahci_vt8251_ops = { | |||
304 | .error_handler = ahci_vt8251_error_handler, | 310 | .error_handler = ahci_vt8251_error_handler, |
305 | .post_internal_cmd = ahci_post_internal_cmd, | 311 | .post_internal_cmd = ahci_post_internal_cmd, |
306 | 312 | ||
313 | #ifdef CONFIG_PM | ||
307 | .port_suspend = ahci_port_suspend, | 314 | .port_suspend = ahci_port_suspend, |
308 | .port_resume = ahci_port_resume, | 315 | .port_resume = ahci_port_resume, |
316 | #endif | ||
309 | 317 | ||
310 | .port_start = ahci_port_start, | 318 | .port_start = ahci_port_start, |
311 | .port_stop = ahci_port_stop, | 319 | .port_stop = ahci_port_stop, |
@@ -436,8 +444,10 @@ static struct pci_driver ahci_pci_driver = { | |||
436 | .id_table = ahci_pci_tbl, | 444 | .id_table = ahci_pci_tbl, |
437 | .probe = ahci_init_one, | 445 | .probe = ahci_init_one, |
438 | .remove = ata_pci_remove_one, | 446 | .remove = ata_pci_remove_one, |
447 | #ifdef CONFIG_PM | ||
439 | .suspend = ahci_pci_device_suspend, | 448 | .suspend = ahci_pci_device_suspend, |
440 | .resume = ahci_pci_device_resume, | 449 | .resume = ahci_pci_device_resume, |
450 | #endif | ||
441 | }; | 451 | }; |
442 | 452 | ||
443 | 453 | ||
@@ -577,6 +587,7 @@ static void ahci_power_up(void __iomem *port_mmio, u32 cap) | |||
577 | writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); | 587 | writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); |
578 | } | 588 | } |
579 | 589 | ||
590 | #ifdef CONFIG_PM | ||
580 | static void ahci_power_down(void __iomem *port_mmio, u32 cap) | 591 | static void ahci_power_down(void __iomem *port_mmio, u32 cap) |
581 | { | 592 | { |
582 | u32 cmd, scontrol; | 593 | u32 cmd, scontrol; |
@@ -594,6 +605,7 @@ static void ahci_power_down(void __iomem *port_mmio, u32 cap) | |||
594 | cmd &= ~PORT_CMD_SPIN_UP; | 605 | cmd &= ~PORT_CMD_SPIN_UP; |
595 | writel(cmd, port_mmio + PORT_CMD); | 606 | writel(cmd, port_mmio + PORT_CMD); |
596 | } | 607 | } |
608 | #endif | ||
597 | 609 | ||
598 | static void ahci_init_port(void __iomem *port_mmio, u32 cap, | 610 | static void ahci_init_port(void __iomem *port_mmio, u32 cap, |
599 | dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma) | 611 | dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma) |
@@ -1335,6 +1347,7 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) | |||
1335 | } | 1347 | } |
1336 | } | 1348 | } |
1337 | 1349 | ||
1350 | #ifdef CONFIG_PM | ||
1338 | static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) | 1351 | static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) |
1339 | { | 1352 | { |
1340 | struct ahci_host_priv *hpriv = ap->host->private_data; | 1353 | struct ahci_host_priv *hpriv = ap->host->private_data; |
@@ -1413,6 +1426,7 @@ static int ahci_pci_device_resume(struct pci_dev *pdev) | |||
1413 | 1426 | ||
1414 | return 0; | 1427 | return 0; |
1415 | } | 1428 | } |
1429 | #endif | ||
1416 | 1430 | ||
1417 | static int ahci_port_start(struct ata_port *ap) | 1431 | static int ahci_port_start(struct ata_port *ap) |
1418 | { | 1432 | { |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index f48b4883c930..d8e79882b880 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -119,8 +119,10 @@ static struct scsi_host_template generic_sht = { | |||
119 | .slave_configure = ata_scsi_slave_config, | 119 | .slave_configure = ata_scsi_slave_config, |
120 | .slave_destroy = ata_scsi_slave_destroy, | 120 | .slave_destroy = ata_scsi_slave_destroy, |
121 | .bios_param = ata_std_bios_param, | 121 | .bios_param = ata_std_bios_param, |
122 | #ifdef CONFIG_PM | ||
122 | .resume = ata_scsi_device_resume, | 123 | .resume = ata_scsi_device_resume, |
123 | .suspend = ata_scsi_device_suspend, | 124 | .suspend = ata_scsi_device_suspend, |
125 | #endif | ||
124 | }; | 126 | }; |
125 | 127 | ||
126 | static struct ata_port_operations generic_port_ops = { | 128 | static struct ata_port_operations generic_port_ops = { |
@@ -230,8 +232,10 @@ static struct pci_driver ata_generic_pci_driver = { | |||
230 | .id_table = ata_generic, | 232 | .id_table = ata_generic, |
231 | .probe = ata_generic_init_one, | 233 | .probe = ata_generic_init_one, |
232 | .remove = ata_pci_remove_one, | 234 | .remove = ata_pci_remove_one, |
235 | #ifdef CONFIG_PM | ||
233 | .suspend = ata_pci_device_suspend, | 236 | .suspend = ata_pci_device_suspend, |
234 | .resume = ata_pci_device_resume, | 237 | .resume = ata_pci_device_resume, |
238 | #endif | ||
235 | }; | 239 | }; |
236 | 240 | ||
237 | static int __init ata_generic_init(void) | 241 | static int __init ata_generic_init(void) |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 61572d8c78ad..dc42ba1b46f7 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -253,8 +253,10 @@ static struct pci_driver piix_pci_driver = { | |||
253 | .id_table = piix_pci_tbl, | 253 | .id_table = piix_pci_tbl, |
254 | .probe = piix_init_one, | 254 | .probe = piix_init_one, |
255 | .remove = ata_pci_remove_one, | 255 | .remove = ata_pci_remove_one, |
256 | #ifdef CONFIG_PM | ||
256 | .suspend = ata_pci_device_suspend, | 257 | .suspend = ata_pci_device_suspend, |
257 | .resume = ata_pci_device_resume, | 258 | .resume = ata_pci_device_resume, |
259 | #endif | ||
258 | }; | 260 | }; |
259 | 261 | ||
260 | static struct scsi_host_template piix_sht = { | 262 | static struct scsi_host_template piix_sht = { |
@@ -273,8 +275,10 @@ static struct scsi_host_template piix_sht = { | |||
273 | .slave_configure = ata_scsi_slave_config, | 275 | .slave_configure = ata_scsi_slave_config, |
274 | .slave_destroy = ata_scsi_slave_destroy, | 276 | .slave_destroy = ata_scsi_slave_destroy, |
275 | .bios_param = ata_std_bios_param, | 277 | .bios_param = ata_std_bios_param, |
278 | #ifdef CONFIG_PM | ||
276 | .resume = ata_scsi_device_resume, | 279 | .resume = ata_scsi_device_resume, |
277 | .suspend = ata_scsi_device_suspend, | 280 | .suspend = ata_scsi_device_suspend, |
281 | #endif | ||
278 | }; | 282 | }; |
279 | 283 | ||
280 | static const struct ata_port_operations piix_pata_ops = { | 284 | static const struct ata_port_operations piix_pata_ops = { |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index ac3d1204ea35..dc362fa01ca4 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1850,8 +1850,11 @@ int ata_bus_probe(struct ata_port *ap) | |||
1850 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 1850 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
1851 | ap->device[i].pio_mode = XFER_PIO_0; | 1851 | ap->device[i].pio_mode = XFER_PIO_0; |
1852 | 1852 | ||
1853 | /* read IDENTIFY page and configure devices */ | 1853 | /* read IDENTIFY page and configure devices. We have to do the identify |
1854 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 1854 | specific sequence bass-ackwards so that PDIAG- is released by |
1855 | the slave device */ | ||
1856 | |||
1857 | for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { | ||
1855 | dev = &ap->device[i]; | 1858 | dev = &ap->device[i]; |
1856 | 1859 | ||
1857 | if (tries[i]) | 1860 | if (tries[i]) |
@@ -1864,6 +1867,15 @@ int ata_bus_probe(struct ata_port *ap) | |||
1864 | dev->id); | 1867 | dev->id); |
1865 | if (rc) | 1868 | if (rc) |
1866 | goto fail; | 1869 | goto fail; |
1870 | } | ||
1871 | |||
1872 | /* After the identify sequence we can now set up the devices. We do | ||
1873 | this in the normal order so that the user doesn't get confused */ | ||
1874 | |||
1875 | for(i = 0; i < ATA_MAX_DEVICES; i++) { | ||
1876 | dev = &ap->device[i]; | ||
1877 | if (!ata_dev_enabled(dev)) | ||
1878 | continue; | ||
1867 | 1879 | ||
1868 | ap->eh_context.i.flags |= ATA_EHI_PRINTINFO; | 1880 | ap->eh_context.i.flags |= ATA_EHI_PRINTINFO; |
1869 | rc = ata_dev_configure(dev); | 1881 | rc = ata_dev_configure(dev); |
@@ -2556,12 +2568,11 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2556 | * host channels are not permitted to do so. | 2568 | * host channels are not permitted to do so. |
2557 | */ | 2569 | */ |
2558 | if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) | 2570 | if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) |
2559 | ap->host->simplex_claimed = 1; | 2571 | ap->host->simplex_claimed = ap; |
2560 | 2572 | ||
2561 | /* step5: chip specific finalisation */ | 2573 | /* step5: chip specific finalisation */ |
2562 | if (ap->ops->post_set_mode) | 2574 | if (ap->ops->post_set_mode) |
2563 | ap->ops->post_set_mode(ap); | 2575 | ap->ops->post_set_mode(ap); |
2564 | |||
2565 | out: | 2576 | out: |
2566 | if (rc) | 2577 | if (rc) |
2567 | *r_failed_dev = dev; | 2578 | *r_failed_dev = dev; |
@@ -3444,7 +3455,7 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
3444 | "device is on DMA blacklist, disabling DMA\n"); | 3455 | "device is on DMA blacklist, disabling DMA\n"); |
3445 | } | 3456 | } |
3446 | 3457 | ||
3447 | if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed) { | 3458 | if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed != ap) { |
3448 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 3459 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
3449 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " | 3460 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " |
3450 | "other device, disabling DMA\n"); | 3461 | "other device, disabling DMA\n"); |
@@ -5343,6 +5354,7 @@ int ata_flush_cache(struct ata_device *dev) | |||
5343 | return 0; | 5354 | return 0; |
5344 | } | 5355 | } |
5345 | 5356 | ||
5357 | #ifdef CONFIG_PM | ||
5346 | static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, | 5358 | static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, |
5347 | unsigned int action, unsigned int ehi_flags, | 5359 | unsigned int action, unsigned int ehi_flags, |
5348 | int wait) | 5360 | int wait) |
@@ -5458,6 +5470,7 @@ void ata_host_resume(struct ata_host *host) | |||
5458 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); | 5470 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); |
5459 | host->dev->power.power_state = PMSG_ON; | 5471 | host->dev->power.power_state = PMSG_ON; |
5460 | } | 5472 | } |
5473 | #endif | ||
5461 | 5474 | ||
5462 | /** | 5475 | /** |
5463 | * ata_port_start - Set port up for dma. | 5476 | * ata_port_start - Set port up for dma. |
@@ -6093,6 +6106,7 @@ int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits) | |||
6093 | return (tmp == bits->val) ? 1 : 0; | 6106 | return (tmp == bits->val) ? 1 : 0; |
6094 | } | 6107 | } |
6095 | 6108 | ||
6109 | #ifdef CONFIG_PM | ||
6096 | void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) | 6110 | void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) |
6097 | { | 6111 | { |
6098 | pci_save_state(pdev); | 6112 | pci_save_state(pdev); |
@@ -6144,6 +6158,8 @@ int ata_pci_device_resume(struct pci_dev *pdev) | |||
6144 | ata_host_resume(host); | 6158 | ata_host_resume(host); |
6145 | return rc; | 6159 | return rc; |
6146 | } | 6160 | } |
6161 | #endif /* CONFIG_PM */ | ||
6162 | |||
6147 | #endif /* CONFIG_PCI */ | 6163 | #endif /* CONFIG_PCI */ |
6148 | 6164 | ||
6149 | 6165 | ||
@@ -6352,8 +6368,10 @@ EXPORT_SYMBOL_GPL(sata_scr_write); | |||
6352 | EXPORT_SYMBOL_GPL(sata_scr_write_flush); | 6368 | EXPORT_SYMBOL_GPL(sata_scr_write_flush); |
6353 | EXPORT_SYMBOL_GPL(ata_port_online); | 6369 | EXPORT_SYMBOL_GPL(ata_port_online); |
6354 | EXPORT_SYMBOL_GPL(ata_port_offline); | 6370 | EXPORT_SYMBOL_GPL(ata_port_offline); |
6371 | #ifdef CONFIG_PM | ||
6355 | EXPORT_SYMBOL_GPL(ata_host_suspend); | 6372 | EXPORT_SYMBOL_GPL(ata_host_suspend); |
6356 | EXPORT_SYMBOL_GPL(ata_host_resume); | 6373 | EXPORT_SYMBOL_GPL(ata_host_resume); |
6374 | #endif /* CONFIG_PM */ | ||
6357 | EXPORT_SYMBOL_GPL(ata_id_string); | 6375 | EXPORT_SYMBOL_GPL(ata_id_string); |
6358 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 6376 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
6359 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); | 6377 | EXPORT_SYMBOL_GPL(ata_id_to_dma_mode); |
@@ -6369,16 +6387,20 @@ EXPORT_SYMBOL_GPL(pci_test_config_bits); | |||
6369 | EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); | 6387 | EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); |
6370 | EXPORT_SYMBOL_GPL(ata_pci_init_one); | 6388 | EXPORT_SYMBOL_GPL(ata_pci_init_one); |
6371 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); | 6389 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); |
6390 | #ifdef CONFIG_PM | ||
6372 | EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend); | 6391 | EXPORT_SYMBOL_GPL(ata_pci_device_do_suspend); |
6373 | EXPORT_SYMBOL_GPL(ata_pci_device_do_resume); | 6392 | EXPORT_SYMBOL_GPL(ata_pci_device_do_resume); |
6374 | EXPORT_SYMBOL_GPL(ata_pci_device_suspend); | 6393 | EXPORT_SYMBOL_GPL(ata_pci_device_suspend); |
6375 | EXPORT_SYMBOL_GPL(ata_pci_device_resume); | 6394 | EXPORT_SYMBOL_GPL(ata_pci_device_resume); |
6395 | #endif /* CONFIG_PM */ | ||
6376 | EXPORT_SYMBOL_GPL(ata_pci_default_filter); | 6396 | EXPORT_SYMBOL_GPL(ata_pci_default_filter); |
6377 | EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); | 6397 | EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); |
6378 | #endif /* CONFIG_PCI */ | 6398 | #endif /* CONFIG_PCI */ |
6379 | 6399 | ||
6400 | #ifdef CONFIG_PM | ||
6380 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); | 6401 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); |
6381 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); | 6402 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); |
6403 | #endif /* CONFIG_PM */ | ||
6382 | 6404 | ||
6383 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | 6405 | EXPORT_SYMBOL_GPL(ata_eng_timeout); |
6384 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 6406 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index cad0d6db6df5..7349c3dbf774 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -52,8 +52,33 @@ enum { | |||
52 | 52 | ||
53 | static void __ata_port_freeze(struct ata_port *ap); | 53 | static void __ata_port_freeze(struct ata_port *ap); |
54 | static void ata_eh_finish(struct ata_port *ap); | 54 | static void ata_eh_finish(struct ata_port *ap); |
55 | #ifdef CONFIG_PM | ||
55 | static void ata_eh_handle_port_suspend(struct ata_port *ap); | 56 | static void ata_eh_handle_port_suspend(struct ata_port *ap); |
56 | static void ata_eh_handle_port_resume(struct ata_port *ap); | 57 | static void ata_eh_handle_port_resume(struct ata_port *ap); |
58 | static int ata_eh_suspend(struct ata_port *ap, | ||
59 | struct ata_device **r_failed_dev); | ||
60 | static void ata_eh_prep_resume(struct ata_port *ap); | ||
61 | static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev); | ||
62 | #else /* CONFIG_PM */ | ||
63 | static void ata_eh_handle_port_suspend(struct ata_port *ap) | ||
64 | { } | ||
65 | |||
66 | static void ata_eh_handle_port_resume(struct ata_port *ap) | ||
67 | { } | ||
68 | |||
69 | static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static void ata_eh_prep_resume(struct ata_port *ap) | ||
75 | { } | ||
76 | |||
77 | static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | #endif /* CONFIG_PM */ | ||
57 | 82 | ||
58 | static void ata_ering_record(struct ata_ering *ering, int is_io, | 83 | static void ata_ering_record(struct ata_ering *ering, int is_io, |
59 | unsigned int err_mask) | 84 | unsigned int err_mask) |
@@ -1790,6 +1815,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1790 | return rc; | 1815 | return rc; |
1791 | } | 1816 | } |
1792 | 1817 | ||
1818 | #ifdef CONFIG_PM | ||
1793 | /** | 1819 | /** |
1794 | * ata_eh_suspend - handle suspend EH action | 1820 | * ata_eh_suspend - handle suspend EH action |
1795 | * @ap: target host port | 1821 | * @ap: target host port |
@@ -1947,6 +1973,7 @@ static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
1947 | DPRINTK("EXIT\n"); | 1973 | DPRINTK("EXIT\n"); |
1948 | return 0; | 1974 | return 0; |
1949 | } | 1975 | } |
1976 | #endif /* CONFIG_PM */ | ||
1950 | 1977 | ||
1951 | static int ata_port_nr_enabled(struct ata_port *ap) | 1978 | static int ata_port_nr_enabled(struct ata_port *ap) |
1952 | { | 1979 | { |
@@ -2249,6 +2276,7 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2249 | ata_eh_finish(ap); | 2276 | ata_eh_finish(ap); |
2250 | } | 2277 | } |
2251 | 2278 | ||
2279 | #ifdef CONFIG_PM | ||
2252 | /** | 2280 | /** |
2253 | * ata_eh_handle_port_suspend - perform port suspend operation | 2281 | * ata_eh_handle_port_suspend - perform port suspend operation |
2254 | * @ap: port to suspend | 2282 | * @ap: port to suspend |
@@ -2364,3 +2392,4 @@ static void ata_eh_handle_port_resume(struct ata_port *ap) | |||
2364 | } | 2392 | } |
2365 | spin_unlock_irqrestore(ap->lock, flags); | 2393 | spin_unlock_irqrestore(ap->lock, flags); |
2366 | } | 2394 | } |
2395 | #endif /* CONFIG_PM */ | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 00a9a6c8f83c..6cc817a10204 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -510,6 +510,7 @@ static void ata_dump_status(unsigned id, struct ata_taskfile *tf) | |||
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | #ifdef CONFIG_PM | ||
513 | /** | 514 | /** |
514 | * ata_scsi_device_suspend - suspend ATA device associated with sdev | 515 | * ata_scsi_device_suspend - suspend ATA device associated with sdev |
515 | * @sdev: the SCSI device to suspend | 516 | * @sdev: the SCSI device to suspend |
@@ -634,6 +635,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev) | |||
634 | sdev->sdev_gendev.power.power_state = PMSG_ON; | 635 | sdev->sdev_gendev.power.power_state = PMSG_ON; |
635 | return 0; | 636 | return 0; |
636 | } | 637 | } |
638 | #endif /* CONFIG_PM */ | ||
637 | 639 | ||
638 | /** | 640 | /** |
639 | * ata_to_sense_error - convert ATA error to SCSI error | 641 | * ata_to_sense_error - convert ATA error to SCSI error |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index a90ed00c07e0..11ea552a58ca 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -345,8 +345,10 @@ static struct scsi_host_template ali_sht = { | |||
345 | .slave_configure = ata_scsi_slave_config, | 345 | .slave_configure = ata_scsi_slave_config, |
346 | .slave_destroy = ata_scsi_slave_destroy, | 346 | .slave_destroy = ata_scsi_slave_destroy, |
347 | .bios_param = ata_std_bios_param, | 347 | .bios_param = ata_std_bios_param, |
348 | #ifdef CONFIG_PM | ||
348 | .resume = ata_scsi_device_resume, | 349 | .resume = ata_scsi_device_resume, |
349 | .suspend = ata_scsi_device_suspend, | 350 | .suspend = ata_scsi_device_suspend, |
351 | #endif | ||
350 | }; | 352 | }; |
351 | 353 | ||
352 | /* | 354 | /* |
@@ -667,11 +669,13 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
667 | return ata_pci_init_one(pdev, port_info, 2); | 669 | return ata_pci_init_one(pdev, port_info, 2); |
668 | } | 670 | } |
669 | 671 | ||
672 | #ifdef CONFIG_PM | ||
670 | static int ali_reinit_one(struct pci_dev *pdev) | 673 | static int ali_reinit_one(struct pci_dev *pdev) |
671 | { | 674 | { |
672 | ali_init_chipset(pdev); | 675 | ali_init_chipset(pdev); |
673 | return ata_pci_device_resume(pdev); | 676 | return ata_pci_device_resume(pdev); |
674 | } | 677 | } |
678 | #endif | ||
675 | 679 | ||
676 | static const struct pci_device_id ali[] = { | 680 | static const struct pci_device_id ali[] = { |
677 | { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), }, | 681 | { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), }, |
@@ -685,8 +689,10 @@ static struct pci_driver ali_pci_driver = { | |||
685 | .id_table = ali, | 689 | .id_table = ali, |
686 | .probe = ali_init_one, | 690 | .probe = ali_init_one, |
687 | .remove = ata_pci_remove_one, | 691 | .remove = ata_pci_remove_one, |
692 | #ifdef CONFIG_PM | ||
688 | .suspend = ata_pci_device_suspend, | 693 | .suspend = ata_pci_device_suspend, |
689 | .resume = ali_reinit_one, | 694 | .resume = ali_reinit_one, |
695 | #endif | ||
690 | }; | 696 | }; |
691 | 697 | ||
692 | static int __init ali_init(void) | 698 | static int __init ali_init(void) |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 3c760d0f4717..18381762908b 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -334,8 +334,10 @@ static struct scsi_host_template amd_sht = { | |||
334 | .slave_configure = ata_scsi_slave_config, | 334 | .slave_configure = ata_scsi_slave_config, |
335 | .slave_destroy = ata_scsi_slave_destroy, | 335 | .slave_destroy = ata_scsi_slave_destroy, |
336 | .bios_param = ata_std_bios_param, | 336 | .bios_param = ata_std_bios_param, |
337 | #ifdef CONFIG_PM | ||
337 | .resume = ata_scsi_device_resume, | 338 | .resume = ata_scsi_device_resume, |
338 | .suspend = ata_scsi_device_suspend, | 339 | .suspend = ata_scsi_device_suspend, |
340 | #endif | ||
339 | }; | 341 | }; |
340 | 342 | ||
341 | static struct ata_port_operations amd33_port_ops = { | 343 | static struct ata_port_operations amd33_port_ops = { |
@@ -663,6 +665,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
663 | return ata_pci_init_one(pdev, port_info, 2); | 665 | return ata_pci_init_one(pdev, port_info, 2); |
664 | } | 666 | } |
665 | 667 | ||
668 | #ifdef CONFIG_PM | ||
666 | static int amd_reinit_one(struct pci_dev *pdev) | 669 | static int amd_reinit_one(struct pci_dev *pdev) |
667 | { | 670 | { |
668 | if (pdev->vendor == PCI_VENDOR_ID_AMD) { | 671 | if (pdev->vendor == PCI_VENDOR_ID_AMD) { |
@@ -679,6 +682,7 @@ static int amd_reinit_one(struct pci_dev *pdev) | |||
679 | } | 682 | } |
680 | return ata_pci_device_resume(pdev); | 683 | return ata_pci_device_resume(pdev); |
681 | } | 684 | } |
685 | #endif | ||
682 | 686 | ||
683 | static const struct pci_device_id amd[] = { | 687 | static const struct pci_device_id amd[] = { |
684 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 }, | 688 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 }, |
@@ -708,8 +712,10 @@ static struct pci_driver amd_pci_driver = { | |||
708 | .id_table = amd, | 712 | .id_table = amd, |
709 | .probe = amd_init_one, | 713 | .probe = amd_init_one, |
710 | .remove = ata_pci_remove_one, | 714 | .remove = ata_pci_remove_one, |
715 | #ifdef CONFIG_PM | ||
711 | .suspend = ata_pci_device_suspend, | 716 | .suspend = ata_pci_device_suspend, |
712 | .resume = amd_reinit_one, | 717 | .resume = amd_reinit_one, |
718 | #endif | ||
713 | }; | 719 | }; |
714 | 720 | ||
715 | static int __init amd_init(void) | 721 | static int __init amd_init(void) |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index c3eb40c91c80..51d9923be02e 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -224,8 +224,10 @@ static struct scsi_host_template atiixp_sht = { | |||
224 | .slave_configure = ata_scsi_slave_config, | 224 | .slave_configure = ata_scsi_slave_config, |
225 | .slave_destroy = ata_scsi_slave_destroy, | 225 | .slave_destroy = ata_scsi_slave_destroy, |
226 | .bios_param = ata_std_bios_param, | 226 | .bios_param = ata_std_bios_param, |
227 | #ifdef CONFIG_PM | ||
227 | .resume = ata_scsi_device_resume, | 228 | .resume = ata_scsi_device_resume, |
228 | .suspend = ata_scsi_device_suspend, | 229 | .suspend = ata_scsi_device_suspend, |
230 | #endif | ||
229 | }; | 231 | }; |
230 | 232 | ||
231 | static struct ata_port_operations atiixp_port_ops = { | 233 | static struct ata_port_operations atiixp_port_ops = { |
@@ -290,8 +292,10 @@ static struct pci_driver atiixp_pci_driver = { | |||
290 | .id_table = atiixp, | 292 | .id_table = atiixp, |
291 | .probe = atiixp_init_one, | 293 | .probe = atiixp_init_one, |
292 | .remove = ata_pci_remove_one, | 294 | .remove = ata_pci_remove_one, |
295 | #ifdef CONFIG_PM | ||
293 | .resume = ata_pci_device_resume, | 296 | .resume = ata_pci_device_resume, |
294 | .suspend = ata_pci_device_suspend, | 297 | .suspend = ata_pci_device_suspend, |
298 | #endif | ||
295 | }; | 299 | }; |
296 | 300 | ||
297 | static int __init atiixp_init(void) | 301 | static int __init atiixp_init(void) |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index da098282b5f6..5b13bdd1edc0 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * pata_cmd64x.c - ATI PATA for new ATA layer | 2 | * pata_cmd64x.c - CMD64x PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@redhat.com> |
5 | * | 5 | * |
@@ -285,8 +285,10 @@ static struct scsi_host_template cmd64x_sht = { | |||
285 | .slave_configure = ata_scsi_slave_config, | 285 | .slave_configure = ata_scsi_slave_config, |
286 | .slave_destroy = ata_scsi_slave_destroy, | 286 | .slave_destroy = ata_scsi_slave_destroy, |
287 | .bios_param = ata_std_bios_param, | 287 | .bios_param = ata_std_bios_param, |
288 | #ifdef CONFIG_PM | ||
288 | .resume = ata_scsi_device_resume, | 289 | .resume = ata_scsi_device_resume, |
289 | .suspend = ata_scsi_device_suspend, | 290 | .suspend = ata_scsi_device_suspend, |
291 | #endif | ||
290 | }; | 292 | }; |
291 | 293 | ||
292 | static struct ata_port_operations cmd64x_port_ops = { | 294 | static struct ata_port_operations cmd64x_port_ops = { |
@@ -479,6 +481,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
479 | return ata_pci_init_one(pdev, port_info, 2); | 481 | return ata_pci_init_one(pdev, port_info, 2); |
480 | } | 482 | } |
481 | 483 | ||
484 | #ifdef CONFIG_PM | ||
482 | static int cmd64x_reinit_one(struct pci_dev *pdev) | 485 | static int cmd64x_reinit_one(struct pci_dev *pdev) |
483 | { | 486 | { |
484 | u8 mrdmode; | 487 | u8 mrdmode; |
@@ -492,6 +495,7 @@ static int cmd64x_reinit_one(struct pci_dev *pdev) | |||
492 | #endif | 495 | #endif |
493 | return ata_pci_device_resume(pdev); | 496 | return ata_pci_device_resume(pdev); |
494 | } | 497 | } |
498 | #endif | ||
495 | 499 | ||
496 | static const struct pci_device_id cmd64x[] = { | 500 | static const struct pci_device_id cmd64x[] = { |
497 | { PCI_VDEVICE(CMD, PCI_DEVICE_ID_CMD_643), 0 }, | 501 | { PCI_VDEVICE(CMD, PCI_DEVICE_ID_CMD_643), 0 }, |
@@ -507,8 +511,10 @@ static struct pci_driver cmd64x_pci_driver = { | |||
507 | .id_table = cmd64x, | 511 | .id_table = cmd64x, |
508 | .probe = cmd64x_init_one, | 512 | .probe = cmd64x_init_one, |
509 | .remove = ata_pci_remove_one, | 513 | .remove = ata_pci_remove_one, |
514 | #ifdef CONFIG_PM | ||
510 | .suspend = ata_pci_device_suspend, | 515 | .suspend = ata_pci_device_suspend, |
511 | .resume = cmd64x_reinit_one, | 516 | .resume = cmd64x_reinit_one, |
517 | #endif | ||
512 | }; | 518 | }; |
513 | 519 | ||
514 | static int __init cmd64x_init(void) | 520 | static int __init cmd64x_init(void) |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 8ff2d58c599e..7ef834250a43 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -167,8 +167,10 @@ static struct scsi_host_template cs5520_sht = { | |||
167 | .slave_configure = ata_scsi_slave_config, | 167 | .slave_configure = ata_scsi_slave_config, |
168 | .slave_destroy = ata_scsi_slave_destroy, | 168 | .slave_destroy = ata_scsi_slave_destroy, |
169 | .bios_param = ata_std_bios_param, | 169 | .bios_param = ata_std_bios_param, |
170 | #ifdef CONFIG_PM | ||
170 | .resume = ata_scsi_device_resume, | 171 | .resume = ata_scsi_device_resume, |
171 | .suspend = ata_scsi_device_suspend, | 172 | .suspend = ata_scsi_device_suspend, |
173 | #endif | ||
172 | }; | 174 | }; |
173 | 175 | ||
174 | static struct ata_port_operations cs5520_port_ops = { | 176 | static struct ata_port_operations cs5520_port_ops = { |
@@ -308,6 +310,7 @@ static void __devexit cs5520_remove_one(struct pci_dev *pdev) | |||
308 | ata_host_detach(host); | 310 | ata_host_detach(host); |
309 | } | 311 | } |
310 | 312 | ||
313 | #ifdef CONFIG_PM | ||
311 | /** | 314 | /** |
312 | * cs5520_reinit_one - device resume | 315 | * cs5520_reinit_one - device resume |
313 | * @pdev: PCI device | 316 | * @pdev: PCI device |
@@ -347,6 +350,7 @@ static int cs5520_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
347 | pci_save_state(pdev); | 350 | pci_save_state(pdev); |
348 | return 0; | 351 | return 0; |
349 | } | 352 | } |
353 | #endif /* CONFIG_PM */ | ||
350 | 354 | ||
351 | /* For now keep DMA off. We can set it for all but A rev CS5510 once the | 355 | /* For now keep DMA off. We can set it for all but A rev CS5510 once the |
352 | core ATA code can handle it */ | 356 | core ATA code can handle it */ |
@@ -363,8 +367,10 @@ static struct pci_driver cs5520_pci_driver = { | |||
363 | .id_table = pata_cs5520, | 367 | .id_table = pata_cs5520, |
364 | .probe = cs5520_init_one, | 368 | .probe = cs5520_init_one, |
365 | .remove = cs5520_remove_one, | 369 | .remove = cs5520_remove_one, |
370 | #ifdef CONFIG_PM | ||
366 | .suspend = cs5520_pci_device_suspend, | 371 | .suspend = cs5520_pci_device_suspend, |
367 | .resume = cs5520_reinit_one, | 372 | .resume = cs5520_reinit_one, |
373 | #endif | ||
368 | }; | 374 | }; |
369 | 375 | ||
370 | static int __init cs5520_init(void) | 376 | static int __init cs5520_init(void) |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 78c7cdfff69d..db63e80e608b 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -188,8 +188,10 @@ static struct scsi_host_template cs5530_sht = { | |||
188 | .slave_configure = ata_scsi_slave_config, | 188 | .slave_configure = ata_scsi_slave_config, |
189 | .slave_destroy = ata_scsi_slave_destroy, | 189 | .slave_destroy = ata_scsi_slave_destroy, |
190 | .bios_param = ata_std_bios_param, | 190 | .bios_param = ata_std_bios_param, |
191 | #ifdef CONFIG_PM | ||
191 | .resume = ata_scsi_device_resume, | 192 | .resume = ata_scsi_device_resume, |
192 | .suspend = ata_scsi_device_suspend, | 193 | .suspend = ata_scsi_device_suspend, |
194 | #endif | ||
193 | }; | 195 | }; |
194 | 196 | ||
195 | static struct ata_port_operations cs5530_port_ops = { | 197 | static struct ata_port_operations cs5530_port_ops = { |
@@ -376,6 +378,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
376 | return ata_pci_init_one(pdev, port_info, 2); | 378 | return ata_pci_init_one(pdev, port_info, 2); |
377 | } | 379 | } |
378 | 380 | ||
381 | #ifdef CONFIG_PM | ||
379 | static int cs5530_reinit_one(struct pci_dev *pdev) | 382 | static int cs5530_reinit_one(struct pci_dev *pdev) |
380 | { | 383 | { |
381 | /* If we fail on resume we are doomed */ | 384 | /* If we fail on resume we are doomed */ |
@@ -383,6 +386,7 @@ static int cs5530_reinit_one(struct pci_dev *pdev) | |||
383 | BUG(); | 386 | BUG(); |
384 | return ata_pci_device_resume(pdev); | 387 | return ata_pci_device_resume(pdev); |
385 | } | 388 | } |
389 | #endif /* CONFIG_PM */ | ||
386 | 390 | ||
387 | static const struct pci_device_id cs5530[] = { | 391 | static const struct pci_device_id cs5530[] = { |
388 | { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), }, | 392 | { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE), }, |
@@ -395,8 +399,10 @@ static struct pci_driver cs5530_pci_driver = { | |||
395 | .id_table = cs5530, | 399 | .id_table = cs5530, |
396 | .probe = cs5530_init_one, | 400 | .probe = cs5530_init_one, |
397 | .remove = ata_pci_remove_one, | 401 | .remove = ata_pci_remove_one, |
402 | #ifdef CONFIG_PM | ||
398 | .suspend = ata_pci_device_suspend, | 403 | .suspend = ata_pci_device_suspend, |
399 | .resume = cs5530_reinit_one, | 404 | .resume = cs5530_reinit_one, |
405 | #endif | ||
400 | }; | 406 | }; |
401 | 407 | ||
402 | static int __init cs5530_init(void) | 408 | static int __init cs5530_init(void) |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index 17bc693cc514..1572e5c9031a 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -185,8 +185,10 @@ static struct scsi_host_template cs5535_sht = { | |||
185 | .slave_configure = ata_scsi_slave_config, | 185 | .slave_configure = ata_scsi_slave_config, |
186 | .slave_destroy = ata_scsi_slave_destroy, | 186 | .slave_destroy = ata_scsi_slave_destroy, |
187 | .bios_param = ata_std_bios_param, | 187 | .bios_param = ata_std_bios_param, |
188 | #ifdef CONFIG_PM | ||
188 | .resume = ata_scsi_device_resume, | 189 | .resume = ata_scsi_device_resume, |
189 | .suspend = ata_scsi_device_suspend, | 190 | .suspend = ata_scsi_device_suspend, |
191 | #endif | ||
190 | }; | 192 | }; |
191 | 193 | ||
192 | static struct ata_port_operations cs5535_port_ops = { | 194 | static struct ata_port_operations cs5535_port_ops = { |
@@ -270,8 +272,10 @@ static struct pci_driver cs5535_pci_driver = { | |||
270 | .id_table = cs5535, | 272 | .id_table = cs5535, |
271 | .probe = cs5535_init_one, | 273 | .probe = cs5535_init_one, |
272 | .remove = ata_pci_remove_one, | 274 | .remove = ata_pci_remove_one, |
275 | #ifdef CONFIG_PM | ||
273 | .suspend = ata_pci_device_suspend, | 276 | .suspend = ata_pci_device_suspend, |
274 | .resume = ata_pci_device_resume, | 277 | .resume = ata_pci_device_resume, |
278 | #endif | ||
275 | }; | 279 | }; |
276 | 280 | ||
277 | static int __init cs5535_init(void) | 281 | static int __init cs5535_init(void) |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 63f48f08763d..f69dde5f7066 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -136,8 +136,10 @@ static struct scsi_host_template cy82c693_sht = { | |||
136 | .slave_configure = ata_scsi_slave_config, | 136 | .slave_configure = ata_scsi_slave_config, |
137 | .slave_destroy = ata_scsi_slave_destroy, | 137 | .slave_destroy = ata_scsi_slave_destroy, |
138 | .bios_param = ata_std_bios_param, | 138 | .bios_param = ata_std_bios_param, |
139 | #ifdef CONFIG_PM | ||
139 | .resume = ata_scsi_device_resume, | 140 | .resume = ata_scsi_device_resume, |
140 | .suspend = ata_scsi_device_suspend, | 141 | .suspend = ata_scsi_device_suspend, |
142 | #endif | ||
141 | }; | 143 | }; |
142 | 144 | ||
143 | static struct ata_port_operations cy82c693_port_ops = { | 145 | static struct ata_port_operations cy82c693_port_ops = { |
@@ -206,8 +208,10 @@ static struct pci_driver cy82c693_pci_driver = { | |||
206 | .id_table = cy82c693, | 208 | .id_table = cy82c693, |
207 | .probe = cy82c693_init_one, | 209 | .probe = cy82c693_init_one, |
208 | .remove = ata_pci_remove_one, | 210 | .remove = ata_pci_remove_one, |
211 | #ifdef CONFIG_PM | ||
209 | .suspend = ata_pci_device_suspend, | 212 | .suspend = ata_pci_device_suspend, |
210 | .resume = ata_pci_device_resume, | 213 | .resume = ata_pci_device_resume, |
214 | #endif | ||
211 | }; | 215 | }; |
212 | 216 | ||
213 | static int __init cy82c693_init(void) | 217 | static int __init cy82c693_init(void) |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index c19b6a8a7dc6..dac7a6554f6c 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -234,8 +234,10 @@ static struct scsi_host_template efar_sht = { | |||
234 | .slave_configure = ata_scsi_slave_config, | 234 | .slave_configure = ata_scsi_slave_config, |
235 | .slave_destroy = ata_scsi_slave_destroy, | 235 | .slave_destroy = ata_scsi_slave_destroy, |
236 | .bios_param = ata_std_bios_param, | 236 | .bios_param = ata_std_bios_param, |
237 | #ifdef CONFIG_PM | ||
237 | .resume = ata_scsi_device_resume, | 238 | .resume = ata_scsi_device_resume, |
238 | .suspend = ata_scsi_device_suspend, | 239 | .suspend = ata_scsi_device_suspend, |
240 | #endif | ||
239 | }; | 241 | }; |
240 | 242 | ||
241 | static const struct ata_port_operations efar_ops = { | 243 | static const struct ata_port_operations efar_ops = { |
@@ -317,8 +319,10 @@ static struct pci_driver efar_pci_driver = { | |||
317 | .id_table = efar_pci_tbl, | 319 | .id_table = efar_pci_tbl, |
318 | .probe = efar_init_one, | 320 | .probe = efar_init_one, |
319 | .remove = ata_pci_remove_one, | 321 | .remove = ata_pci_remove_one, |
322 | #ifdef CONFIG_PM | ||
320 | .suspend = ata_pci_device_suspend, | 323 | .suspend = ata_pci_device_suspend, |
321 | .resume = ata_pci_device_resume, | 324 | .resume = ata_pci_device_resume, |
325 | #endif | ||
322 | }; | 326 | }; |
323 | 327 | ||
324 | static int __init efar_init(void) | 328 | static int __init efar_init(void) |
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index e7d33c628a61..baf35f876030 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -328,8 +328,10 @@ static struct scsi_host_template hpt36x_sht = { | |||
328 | .slave_configure = ata_scsi_slave_config, | 328 | .slave_configure = ata_scsi_slave_config, |
329 | .slave_destroy = ata_scsi_slave_destroy, | 329 | .slave_destroy = ata_scsi_slave_destroy, |
330 | .bios_param = ata_std_bios_param, | 330 | .bios_param = ata_std_bios_param, |
331 | #ifdef CONFIG_PM | ||
331 | .resume = ata_scsi_device_resume, | 332 | .resume = ata_scsi_device_resume, |
332 | .suspend = ata_scsi_device_suspend, | 333 | .suspend = ata_scsi_device_suspend, |
334 | #endif | ||
333 | }; | 335 | }; |
334 | 336 | ||
335 | /* | 337 | /* |
@@ -457,12 +459,13 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
457 | return ata_pci_init_one(dev, port_info, 2); | 459 | return ata_pci_init_one(dev, port_info, 2); |
458 | } | 460 | } |
459 | 461 | ||
462 | #ifdef CONFIG_PM | ||
460 | static int hpt36x_reinit_one(struct pci_dev *dev) | 463 | static int hpt36x_reinit_one(struct pci_dev *dev) |
461 | { | 464 | { |
462 | hpt36x_init_chipset(dev); | 465 | hpt36x_init_chipset(dev); |
463 | return ata_pci_device_resume(dev); | 466 | return ata_pci_device_resume(dev); |
464 | } | 467 | } |
465 | 468 | #endif | |
466 | 469 | ||
467 | static const struct pci_device_id hpt36x[] = { | 470 | static const struct pci_device_id hpt36x[] = { |
468 | { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), }, | 471 | { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), }, |
@@ -474,8 +477,10 @@ static struct pci_driver hpt36x_pci_driver = { | |||
474 | .id_table = hpt36x, | 477 | .id_table = hpt36x, |
475 | .probe = hpt36x_init_one, | 478 | .probe = hpt36x_init_one, |
476 | .remove = ata_pci_remove_one, | 479 | .remove = ata_pci_remove_one, |
480 | #ifdef CONFIG_PM | ||
477 | .suspend = ata_pci_device_suspend, | 481 | .suspend = ata_pci_device_suspend, |
478 | .resume = hpt36x_reinit_one, | 482 | .resume = hpt36x_reinit_one, |
483 | #endif | ||
479 | }; | 484 | }; |
480 | 485 | ||
481 | static int __init hpt36x_init(void) | 486 | static int __init hpt36x_init(void) |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index 483ce7c12c9a..813485c8526c 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -119,8 +119,10 @@ static struct scsi_host_template hpt3x3_sht = { | |||
119 | .slave_configure = ata_scsi_slave_config, | 119 | .slave_configure = ata_scsi_slave_config, |
120 | .slave_destroy = ata_scsi_slave_destroy, | 120 | .slave_destroy = ata_scsi_slave_destroy, |
121 | .bios_param = ata_std_bios_param, | 121 | .bios_param = ata_std_bios_param, |
122 | #ifdef CONFIG_PM | ||
122 | .resume = ata_scsi_device_resume, | 123 | .resume = ata_scsi_device_resume, |
123 | .suspend = ata_scsi_device_suspend, | 124 | .suspend = ata_scsi_device_suspend, |
125 | #endif | ||
124 | }; | 126 | }; |
125 | 127 | ||
126 | static struct ata_port_operations hpt3x3_port_ops = { | 128 | static struct ata_port_operations hpt3x3_port_ops = { |
@@ -206,11 +208,13 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
206 | return ata_pci_init_one(dev, port_info, 2); | 208 | return ata_pci_init_one(dev, port_info, 2); |
207 | } | 209 | } |
208 | 210 | ||
211 | #ifdef CONFIG_PM | ||
209 | static int hpt3x3_reinit_one(struct pci_dev *dev) | 212 | static int hpt3x3_reinit_one(struct pci_dev *dev) |
210 | { | 213 | { |
211 | hpt3x3_init_chipset(dev); | 214 | hpt3x3_init_chipset(dev); |
212 | return ata_pci_device_resume(dev); | 215 | return ata_pci_device_resume(dev); |
213 | } | 216 | } |
217 | #endif | ||
214 | 218 | ||
215 | static const struct pci_device_id hpt3x3[] = { | 219 | static const struct pci_device_id hpt3x3[] = { |
216 | { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), }, | 220 | { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT343), }, |
@@ -223,8 +227,10 @@ static struct pci_driver hpt3x3_pci_driver = { | |||
223 | .id_table = hpt3x3, | 227 | .id_table = hpt3x3, |
224 | .probe = hpt3x3_init_one, | 228 | .probe = hpt3x3_init_one, |
225 | .remove = ata_pci_remove_one, | 229 | .remove = ata_pci_remove_one, |
230 | #ifdef CONFIG_PM | ||
226 | .suspend = ata_pci_device_suspend, | 231 | .suspend = ata_pci_device_suspend, |
227 | .resume = hpt3x3_reinit_one, | 232 | .resume = hpt3x3_reinit_one, |
233 | #endif | ||
228 | }; | 234 | }; |
229 | 235 | ||
230 | static int __init hpt3x3_init(void) | 236 | static int __init hpt3x3_init(void) |
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index 7eac869dfcd3..ea734701555e 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -246,8 +246,10 @@ static struct scsi_host_template it8213_sht = { | |||
246 | .dma_boundary = ATA_DMA_BOUNDARY, | 246 | .dma_boundary = ATA_DMA_BOUNDARY, |
247 | .slave_configure = ata_scsi_slave_config, | 247 | .slave_configure = ata_scsi_slave_config, |
248 | .bios_param = ata_std_bios_param, | 248 | .bios_param = ata_std_bios_param, |
249 | #ifdef CONFIG_PM | ||
249 | .resume = ata_scsi_device_resume, | 250 | .resume = ata_scsi_device_resume, |
250 | .suspend = ata_scsi_device_suspend, | 251 | .suspend = ata_scsi_device_suspend, |
252 | #endif | ||
251 | }; | 253 | }; |
252 | 254 | ||
253 | static const struct ata_port_operations it8213_ops = { | 255 | static const struct ata_port_operations it8213_ops = { |
@@ -330,8 +332,10 @@ static struct pci_driver it8213_pci_driver = { | |||
330 | .id_table = it8213_pci_tbl, | 332 | .id_table = it8213_pci_tbl, |
331 | .probe = it8213_init_one, | 333 | .probe = it8213_init_one, |
332 | .remove = ata_pci_remove_one, | 334 | .remove = ata_pci_remove_one, |
335 | #ifdef CONFIG_PM | ||
333 | .suspend = ata_pci_device_suspend, | 336 | .suspend = ata_pci_device_suspend, |
334 | .resume = ata_pci_device_resume, | 337 | .resume = ata_pci_device_resume, |
338 | #endif | ||
335 | }; | 339 | }; |
336 | 340 | ||
337 | static int __init it8213_init(void) | 341 | static int __init it8213_init(void) |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 903137a6da5e..35ecb2ba067b 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -646,8 +646,10 @@ static struct scsi_host_template it821x_sht = { | |||
646 | .slave_configure = ata_scsi_slave_config, | 646 | .slave_configure = ata_scsi_slave_config, |
647 | .slave_destroy = ata_scsi_slave_destroy, | 647 | .slave_destroy = ata_scsi_slave_destroy, |
648 | .bios_param = ata_std_bios_param, | 648 | .bios_param = ata_std_bios_param, |
649 | #ifdef CONFIG_PM | ||
649 | .resume = ata_scsi_device_resume, | 650 | .resume = ata_scsi_device_resume, |
650 | .suspend = ata_scsi_device_suspend, | 651 | .suspend = ata_scsi_device_suspend, |
652 | #endif | ||
651 | }; | 653 | }; |
652 | 654 | ||
653 | static struct ata_port_operations it821x_smart_port_ops = { | 655 | static struct ata_port_operations it821x_smart_port_ops = { |
@@ -780,6 +782,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
780 | return ata_pci_init_one(pdev, port_info, 2); | 782 | return ata_pci_init_one(pdev, port_info, 2); |
781 | } | 783 | } |
782 | 784 | ||
785 | #ifdef CONFIG_PM | ||
783 | static int it821x_reinit_one(struct pci_dev *pdev) | 786 | static int it821x_reinit_one(struct pci_dev *pdev) |
784 | { | 787 | { |
785 | /* Resume - turn raid back off if need be */ | 788 | /* Resume - turn raid back off if need be */ |
@@ -787,6 +790,7 @@ static int it821x_reinit_one(struct pci_dev *pdev) | |||
787 | it821x_disable_raid(pdev); | 790 | it821x_disable_raid(pdev); |
788 | return ata_pci_device_resume(pdev); | 791 | return ata_pci_device_resume(pdev); |
789 | } | 792 | } |
793 | #endif | ||
790 | 794 | ||
791 | static const struct pci_device_id it821x[] = { | 795 | static const struct pci_device_id it821x[] = { |
792 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), }, | 796 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), }, |
@@ -800,8 +804,10 @@ static struct pci_driver it821x_pci_driver = { | |||
800 | .id_table = it821x, | 804 | .id_table = it821x, |
801 | .probe = it821x_init_one, | 805 | .probe = it821x_init_one, |
802 | .remove = ata_pci_remove_one, | 806 | .remove = ata_pci_remove_one, |
807 | #ifdef CONFIG_PM | ||
803 | .suspend = ata_pci_device_suspend, | 808 | .suspend = ata_pci_device_suspend, |
804 | .resume = it821x_reinit_one, | 809 | .resume = it821x_reinit_one, |
810 | #endif | ||
805 | }; | 811 | }; |
806 | 812 | ||
807 | static int __init it821x_init(void) | 813 | static int __init it821x_init(void) |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 47d0f94fd792..033319e8b6cf 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -137,6 +137,10 @@ static struct scsi_host_template jmicron_sht = { | |||
137 | .slave_destroy = ata_scsi_slave_destroy, | 137 | .slave_destroy = ata_scsi_slave_destroy, |
138 | /* Use standard CHS mapping rules */ | 138 | /* Use standard CHS mapping rules */ |
139 | .bios_param = ata_std_bios_param, | 139 | .bios_param = ata_std_bios_param, |
140 | #ifdef CONFIG_PM | ||
141 | .suspend = ata_scsi_device_suspend, | ||
142 | .resume = ata_scsi_device_resume, | ||
143 | #endif | ||
140 | }; | 144 | }; |
141 | 145 | ||
142 | static const struct ata_port_operations jmicron_ops = { | 146 | static const struct ata_port_operations jmicron_ops = { |
@@ -225,8 +229,10 @@ static struct pci_driver jmicron_pci_driver = { | |||
225 | .id_table = jmicron_pci_tbl, | 229 | .id_table = jmicron_pci_tbl, |
226 | .probe = jmicron_init_one, | 230 | .probe = jmicron_init_one, |
227 | .remove = ata_pci_remove_one, | 231 | .remove = ata_pci_remove_one, |
232 | #ifdef CONFIG_PM | ||
228 | .suspend = ata_pci_device_suspend, | 233 | .suspend = ata_pci_device_suspend, |
229 | .resume = ata_pci_device_resume, | 234 | .resume = ata_pci_device_resume, |
235 | #endif | ||
230 | }; | 236 | }; |
231 | 237 | ||
232 | static int __init jmicron_init(void) | 238 | static int __init jmicron_init(void) |
@@ -238,6 +244,7 @@ static void __exit jmicron_exit(void) | |||
238 | { | 244 | { |
239 | pci_unregister_driver(&jmicron_pci_driver); | 245 | pci_unregister_driver(&jmicron_pci_driver); |
240 | } | 246 | } |
247 | #endif | ||
241 | 248 | ||
242 | module_init(jmicron_init); | 249 | module_init(jmicron_init); |
243 | module_exit(jmicron_exit); | 250 | module_exit(jmicron_exit); |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 6ee61c67163a..fc5b73d78e00 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -186,7 +186,10 @@ static struct ata_port_operations legacy_port_ops = { | |||
186 | .exec_command = ata_exec_command, | 186 | .exec_command = ata_exec_command, |
187 | .dev_select = ata_std_dev_select, | 187 | .dev_select = ata_std_dev_select, |
188 | 188 | ||
189 | .freeze = ata_bmdma_freeze, | ||
190 | .thaw = ata_bmdma_thaw, | ||
189 | .error_handler = ata_bmdma_error_handler, | 191 | .error_handler = ata_bmdma_error_handler, |
192 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
190 | 193 | ||
191 | .qc_prep = ata_qc_prep, | 194 | .qc_prep = ata_qc_prep, |
192 | .qc_issue = ata_qc_issue_prot, | 195 | .qc_issue = ata_qc_issue_prot, |
@@ -298,7 +301,10 @@ static struct ata_port_operations pdc20230_port_ops = { | |||
298 | .exec_command = ata_exec_command, | 301 | .exec_command = ata_exec_command, |
299 | .dev_select = ata_std_dev_select, | 302 | .dev_select = ata_std_dev_select, |
300 | 303 | ||
304 | .freeze = ata_bmdma_freeze, | ||
305 | .thaw = ata_bmdma_thaw, | ||
301 | .error_handler = ata_bmdma_error_handler, | 306 | .error_handler = ata_bmdma_error_handler, |
307 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
302 | 308 | ||
303 | .qc_prep = ata_qc_prep, | 309 | .qc_prep = ata_qc_prep, |
304 | .qc_issue = ata_qc_issue_prot, | 310 | .qc_issue = ata_qc_issue_prot, |
@@ -350,7 +356,10 @@ static struct ata_port_operations ht6560a_port_ops = { | |||
350 | .exec_command = ata_exec_command, | 356 | .exec_command = ata_exec_command, |
351 | .dev_select = ata_std_dev_select, | 357 | .dev_select = ata_std_dev_select, |
352 | 358 | ||
359 | .freeze = ata_bmdma_freeze, | ||
360 | .thaw = ata_bmdma_thaw, | ||
353 | .error_handler = ata_bmdma_error_handler, | 361 | .error_handler = ata_bmdma_error_handler, |
362 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
354 | 363 | ||
355 | .qc_prep = ata_qc_prep, | 364 | .qc_prep = ata_qc_prep, |
356 | .qc_issue = ata_qc_issue_prot, | 365 | .qc_issue = ata_qc_issue_prot, |
@@ -413,7 +422,10 @@ static struct ata_port_operations ht6560b_port_ops = { | |||
413 | .exec_command = ata_exec_command, | 422 | .exec_command = ata_exec_command, |
414 | .dev_select = ata_std_dev_select, | 423 | .dev_select = ata_std_dev_select, |
415 | 424 | ||
425 | .freeze = ata_bmdma_freeze, | ||
426 | .thaw = ata_bmdma_thaw, | ||
416 | .error_handler = ata_bmdma_error_handler, | 427 | .error_handler = ata_bmdma_error_handler, |
428 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
417 | 429 | ||
418 | .qc_prep = ata_qc_prep, | 430 | .qc_prep = ata_qc_prep, |
419 | .qc_issue = ata_qc_issue_prot, | 431 | .qc_issue = ata_qc_issue_prot, |
@@ -531,7 +543,10 @@ static struct ata_port_operations opti82c611a_port_ops = { | |||
531 | .exec_command = ata_exec_command, | 543 | .exec_command = ata_exec_command, |
532 | .dev_select = ata_std_dev_select, | 544 | .dev_select = ata_std_dev_select, |
533 | 545 | ||
546 | .freeze = ata_bmdma_freeze, | ||
547 | .thaw = ata_bmdma_thaw, | ||
534 | .error_handler = ata_bmdma_error_handler, | 548 | .error_handler = ata_bmdma_error_handler, |
549 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
535 | 550 | ||
536 | .qc_prep = ata_qc_prep, | 551 | .qc_prep = ata_qc_prep, |
537 | .qc_issue = ata_qc_issue_prot, | 552 | .qc_issue = ata_qc_issue_prot, |
@@ -661,7 +676,10 @@ static struct ata_port_operations opti82c46x_port_ops = { | |||
661 | .exec_command = ata_exec_command, | 676 | .exec_command = ata_exec_command, |
662 | .dev_select = ata_std_dev_select, | 677 | .dev_select = ata_std_dev_select, |
663 | 678 | ||
679 | .freeze = ata_bmdma_freeze, | ||
680 | .thaw = ata_bmdma_thaw, | ||
664 | .error_handler = ata_bmdma_error_handler, | 681 | .error_handler = ata_bmdma_error_handler, |
682 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
665 | 683 | ||
666 | .qc_prep = ata_qc_prep, | 684 | .qc_prep = ata_qc_prep, |
667 | .qc_issue = opti82c46x_qc_issue_prot, | 685 | .qc_issue = opti82c46x_qc_issue_prot, |
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 13a70ac6f1dc..6dd7c4ef3e66 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -103,8 +103,10 @@ static struct scsi_host_template marvell_sht = { | |||
103 | .slave_destroy = ata_scsi_slave_destroy, | 103 | .slave_destroy = ata_scsi_slave_destroy, |
104 | /* Use standard CHS mapping rules */ | 104 | /* Use standard CHS mapping rules */ |
105 | .bios_param = ata_std_bios_param, | 105 | .bios_param = ata_std_bios_param, |
106 | #ifdef CONFIG_PM | ||
106 | .resume = ata_scsi_device_resume, | 107 | .resume = ata_scsi_device_resume, |
107 | .suspend = ata_scsi_device_suspend, | 108 | .suspend = ata_scsi_device_suspend, |
109 | #endif | ||
108 | }; | 110 | }; |
109 | 111 | ||
110 | static const struct ata_port_operations marvell_ops = { | 112 | static const struct ata_port_operations marvell_ops = { |
@@ -199,8 +201,10 @@ static struct pci_driver marvell_pci_driver = { | |||
199 | .id_table = marvell_pci_tbl, | 201 | .id_table = marvell_pci_tbl, |
200 | .probe = marvell_init_one, | 202 | .probe = marvell_init_one, |
201 | .remove = ata_pci_remove_one, | 203 | .remove = ata_pci_remove_one, |
204 | #ifdef CONFIG_PM | ||
202 | .suspend = ata_pci_device_suspend, | 205 | .suspend = ata_pci_device_suspend, |
203 | .resume = ata_pci_device_resume, | 206 | .resume = ata_pci_device_resume, |
207 | #endif | ||
204 | }; | 208 | }; |
205 | 209 | ||
206 | static int __init marvell_init(void) | 210 | static int __init marvell_init(void) |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 29e1809e5ecf..f5d88729ca79 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -280,6 +280,10 @@ static struct scsi_host_template mpc52xx_ata_sht = { | |||
280 | .dma_boundary = ATA_DMA_BOUNDARY, | 280 | .dma_boundary = ATA_DMA_BOUNDARY, |
281 | .slave_configure = ata_scsi_slave_config, | 281 | .slave_configure = ata_scsi_slave_config, |
282 | .bios_param = ata_std_bios_param, | 282 | .bios_param = ata_std_bios_param, |
283 | #ifdef CONFIG_PM | ||
284 | .suspend = ata_scsi_device_suspend, | ||
285 | .resume = ata_scsi_device_resume, | ||
286 | #endif | ||
283 | }; | 287 | }; |
284 | 288 | ||
285 | static struct ata_port_operations mpc52xx_ata_port_ops = { | 289 | static struct ata_port_operations mpc52xx_ata_port_ops = { |
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c index f2e7115f7ab9..4abe45ac19a2 100644 --- a/drivers/ata/pata_mpiix.c +++ b/drivers/ata/pata_mpiix.c | |||
@@ -165,8 +165,10 @@ static struct scsi_host_template mpiix_sht = { | |||
165 | .slave_configure = ata_scsi_slave_config, | 165 | .slave_configure = ata_scsi_slave_config, |
166 | .slave_destroy = ata_scsi_slave_destroy, | 166 | .slave_destroy = ata_scsi_slave_destroy, |
167 | .bios_param = ata_std_bios_param, | 167 | .bios_param = ata_std_bios_param, |
168 | #ifdef CONFIG_PM | ||
168 | .resume = ata_scsi_device_resume, | 169 | .resume = ata_scsi_device_resume, |
169 | .suspend = ata_scsi_device_suspend, | 170 | .suspend = ata_scsi_device_suspend, |
171 | #endif | ||
170 | }; | 172 | }; |
171 | 173 | ||
172 | static struct ata_port_operations mpiix_port_ops = { | 174 | static struct ata_port_operations mpiix_port_ops = { |
@@ -270,8 +272,10 @@ static struct pci_driver mpiix_pci_driver = { | |||
270 | .id_table = mpiix, | 272 | .id_table = mpiix, |
271 | .probe = mpiix_init_one, | 273 | .probe = mpiix_init_one, |
272 | .remove = ata_pci_remove_one, | 274 | .remove = ata_pci_remove_one, |
275 | #ifdef CONFIG_PM | ||
273 | .suspend = ata_pci_device_suspend, | 276 | .suspend = ata_pci_device_suspend, |
274 | .resume = ata_pci_device_resume, | 277 | .resume = ata_pci_device_resume, |
278 | #endif | ||
275 | }; | 279 | }; |
276 | 280 | ||
277 | static int __init mpiix_init(void) | 281 | static int __init mpiix_init(void) |
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index e8393e19be47..38f99b38a5ea 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -63,8 +63,10 @@ static struct scsi_host_template netcell_sht = { | |||
63 | .slave_destroy = ata_scsi_slave_destroy, | 63 | .slave_destroy = ata_scsi_slave_destroy, |
64 | /* Use standard CHS mapping rules */ | 64 | /* Use standard CHS mapping rules */ |
65 | .bios_param = ata_std_bios_param, | 65 | .bios_param = ata_std_bios_param, |
66 | #ifdef CONFIG_PM | ||
66 | .resume = ata_scsi_device_resume, | 67 | .resume = ata_scsi_device_resume, |
67 | .suspend = ata_scsi_device_suspend, | 68 | .suspend = ata_scsi_device_suspend, |
69 | #endif | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | static const struct ata_port_operations netcell_ops = { | 72 | static const struct ata_port_operations netcell_ops = { |
@@ -153,8 +155,10 @@ static struct pci_driver netcell_pci_driver = { | |||
153 | .id_table = netcell_pci_tbl, | 155 | .id_table = netcell_pci_tbl, |
154 | .probe = netcell_init_one, | 156 | .probe = netcell_init_one, |
155 | .remove = ata_pci_remove_one, | 157 | .remove = ata_pci_remove_one, |
158 | #ifdef CONFIG_PM | ||
156 | .suspend = ata_pci_device_suspend, | 159 | .suspend = ata_pci_device_suspend, |
157 | .resume = ata_pci_device_resume, | 160 | .resume = ata_pci_device_resume, |
161 | #endif | ||
158 | }; | 162 | }; |
159 | 163 | ||
160 | static int __init netcell_init(void) | 164 | static int __init netcell_init(void) |
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index 3d1fa487c486..9944a28daa9c 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -157,8 +157,10 @@ static struct scsi_host_template ns87410_sht = { | |||
157 | .slave_configure = ata_scsi_slave_config, | 157 | .slave_configure = ata_scsi_slave_config, |
158 | .slave_destroy = ata_scsi_slave_destroy, | 158 | .slave_destroy = ata_scsi_slave_destroy, |
159 | .bios_param = ata_std_bios_param, | 159 | .bios_param = ata_std_bios_param, |
160 | #ifdef CONFIG_PM | ||
160 | .resume = ata_scsi_device_resume, | 161 | .resume = ata_scsi_device_resume, |
161 | .suspend = ata_scsi_device_suspend, | 162 | .suspend = ata_scsi_device_suspend, |
163 | #endif | ||
162 | }; | 164 | }; |
163 | 165 | ||
164 | static struct ata_port_operations ns87410_port_ops = { | 166 | static struct ata_port_operations ns87410_port_ops = { |
@@ -212,8 +214,10 @@ static struct pci_driver ns87410_pci_driver = { | |||
212 | .id_table = ns87410, | 214 | .id_table = ns87410, |
213 | .probe = ns87410_init_one, | 215 | .probe = ns87410_init_one, |
214 | .remove = ata_pci_remove_one, | 216 | .remove = ata_pci_remove_one, |
217 | #ifdef CONFIG_PM | ||
215 | .suspend = ata_pci_device_suspend, | 218 | .suspend = ata_pci_device_suspend, |
216 | .resume = ata_pci_device_resume, | 219 | .resume = ata_pci_device_resume, |
220 | #endif | ||
217 | }; | 221 | }; |
218 | 222 | ||
219 | static int __init ns87410_init(void) | 223 | static int __init ns87410_init(void) |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index 2389107a2006..da68cd19efd6 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -233,8 +233,10 @@ static struct scsi_host_template oldpiix_sht = { | |||
233 | .slave_configure = ata_scsi_slave_config, | 233 | .slave_configure = ata_scsi_slave_config, |
234 | .slave_destroy = ata_scsi_slave_destroy, | 234 | .slave_destroy = ata_scsi_slave_destroy, |
235 | .bios_param = ata_std_bios_param, | 235 | .bios_param = ata_std_bios_param, |
236 | #ifdef CONFIG_PM | ||
236 | .resume = ata_scsi_device_resume, | 237 | .resume = ata_scsi_device_resume, |
237 | .suspend = ata_scsi_device_suspend, | 238 | .suspend = ata_scsi_device_suspend, |
239 | #endif | ||
238 | }; | 240 | }; |
239 | 241 | ||
240 | static const struct ata_port_operations oldpiix_pata_ops = { | 242 | static const struct ata_port_operations oldpiix_pata_ops = { |
@@ -316,8 +318,10 @@ static struct pci_driver oldpiix_pci_driver = { | |||
316 | .id_table = oldpiix_pci_tbl, | 318 | .id_table = oldpiix_pci_tbl, |
317 | .probe = oldpiix_init_one, | 319 | .probe = oldpiix_init_one, |
318 | .remove = ata_pci_remove_one, | 320 | .remove = ata_pci_remove_one, |
321 | #ifdef CONFIG_PM | ||
319 | .suspend = ata_pci_device_suspend, | 322 | .suspend = ata_pci_device_suspend, |
320 | .resume = ata_pci_device_resume, | 323 | .resume = ata_pci_device_resume, |
324 | #endif | ||
321 | }; | 325 | }; |
322 | 326 | ||
323 | static int __init oldpiix_init(void) | 327 | static int __init oldpiix_init(void) |
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c index 1b3cd5369f03..3fd3a35c2241 100644 --- a/drivers/ata/pata_opti.c +++ b/drivers/ata/pata_opti.c | |||
@@ -179,8 +179,10 @@ static struct scsi_host_template opti_sht = { | |||
179 | .slave_configure = ata_scsi_slave_config, | 179 | .slave_configure = ata_scsi_slave_config, |
180 | .slave_destroy = ata_scsi_slave_destroy, | 180 | .slave_destroy = ata_scsi_slave_destroy, |
181 | .bios_param = ata_std_bios_param, | 181 | .bios_param = ata_std_bios_param, |
182 | #ifdef CONFIG_PM | ||
182 | .resume = ata_scsi_device_resume, | 183 | .resume = ata_scsi_device_resume, |
183 | .suspend = ata_scsi_device_suspend, | 184 | .suspend = ata_scsi_device_suspend, |
185 | #endif | ||
184 | }; | 186 | }; |
185 | 187 | ||
186 | static struct ata_port_operations opti_port_ops = { | 188 | static struct ata_port_operations opti_port_ops = { |
@@ -244,8 +246,10 @@ static struct pci_driver opti_pci_driver = { | |||
244 | .id_table = opti, | 246 | .id_table = opti, |
245 | .probe = opti_init_one, | 247 | .probe = opti_init_one, |
246 | .remove = ata_pci_remove_one, | 248 | .remove = ata_pci_remove_one, |
249 | #ifdef CONFIG_PM | ||
247 | .suspend = ata_pci_device_suspend, | 250 | .suspend = ata_pci_device_suspend, |
248 | .resume = ata_pci_device_resume, | 251 | .resume = ata_pci_device_resume, |
252 | #endif | ||
249 | }; | 253 | }; |
250 | 254 | ||
251 | static int __init opti_init(void) | 255 | static int __init opti_init(void) |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index b76c976e505c..9764907e8a13 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -360,8 +360,10 @@ static struct scsi_host_template optidma_sht = { | |||
360 | .slave_configure = ata_scsi_slave_config, | 360 | .slave_configure = ata_scsi_slave_config, |
361 | .slave_destroy = ata_scsi_slave_destroy, | 361 | .slave_destroy = ata_scsi_slave_destroy, |
362 | .bios_param = ata_std_bios_param, | 362 | .bios_param = ata_std_bios_param, |
363 | #ifdef CONFIG_PM | ||
363 | .resume = ata_scsi_device_resume, | 364 | .resume = ata_scsi_device_resume, |
364 | .suspend = ata_scsi_device_suspend, | 365 | .suspend = ata_scsi_device_suspend, |
366 | #endif | ||
365 | }; | 367 | }; |
366 | 368 | ||
367 | static struct ata_port_operations optidma_port_ops = { | 369 | static struct ata_port_operations optidma_port_ops = { |
@@ -524,8 +526,10 @@ static struct pci_driver optidma_pci_driver = { | |||
524 | .id_table = optidma, | 526 | .id_table = optidma, |
525 | .probe = optidma_init_one, | 527 | .probe = optidma_init_one, |
526 | .remove = ata_pci_remove_one, | 528 | .remove = ata_pci_remove_one, |
529 | #ifdef CONFIG_PM | ||
527 | .suspend = ata_pci_device_suspend, | 530 | .suspend = ata_pci_device_suspend, |
528 | .resume = ata_pci_device_resume, | 531 | .resume = ata_pci_device_resume, |
532 | #endif | ||
529 | }; | 533 | }; |
530 | 534 | ||
531 | static int __init optidma_init(void) | 535 | static int __init optidma_init(void) |
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index 80685388c2bd..3fb417780166 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -267,8 +267,10 @@ static struct scsi_host_template pdc202xx_sht = { | |||
267 | .slave_configure = ata_scsi_slave_config, | 267 | .slave_configure = ata_scsi_slave_config, |
268 | .slave_destroy = ata_scsi_slave_destroy, | 268 | .slave_destroy = ata_scsi_slave_destroy, |
269 | .bios_param = ata_std_bios_param, | 269 | .bios_param = ata_std_bios_param, |
270 | #ifdef CONFIG_PM | ||
270 | .resume = ata_scsi_device_resume, | 271 | .resume = ata_scsi_device_resume, |
271 | .suspend = ata_scsi_device_suspend, | 272 | .suspend = ata_scsi_device_suspend, |
273 | #endif | ||
272 | }; | 274 | }; |
273 | 275 | ||
274 | static struct ata_port_operations pdc2024x_port_ops = { | 276 | static struct ata_port_operations pdc2024x_port_ops = { |
@@ -399,8 +401,10 @@ static struct pci_driver pdc202xx_pci_driver = { | |||
399 | .id_table = pdc202xx, | 401 | .id_table = pdc202xx, |
400 | .probe = pdc202xx_init_one, | 402 | .probe = pdc202xx_init_one, |
401 | .remove = ata_pci_remove_one, | 403 | .remove = ata_pci_remove_one, |
404 | #ifdef CONFIG_PM | ||
402 | .suspend = ata_pci_device_suspend, | 405 | .suspend = ata_pci_device_suspend, |
403 | .resume = ata_pci_device_resume, | 406 | .resume = ata_pci_device_resume, |
407 | #endif | ||
404 | }; | 408 | }; |
405 | 409 | ||
406 | static int __init pdc202xx_init(void) | 410 | static int __init pdc202xx_init(void) |
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index c2f87da60336..c3810012f3f4 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -363,7 +363,8 @@ static __init int qdi_init(void) | |||
363 | release_region(port, 2); | 363 | release_region(port, 2); |
364 | continue; | 364 | continue; |
365 | } | 365 | } |
366 | ct += qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); | 366 | if (qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04) == 0) |
367 | ct++; | ||
367 | } | 368 | } |
368 | if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) { | 369 | if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) { |
369 | /* QD6580: dual channel */ | 370 | /* QD6580: dual channel */ |
@@ -375,11 +376,14 @@ static __init int qdi_init(void) | |||
375 | res = inb(port + 3); | 376 | res = inb(port + 3); |
376 | if (res & 1) { | 377 | if (res & 1) { |
377 | /* Single channel mode */ | 378 | /* Single channel mode */ |
378 | ct += qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); | 379 | if (qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04)) |
380 | ct++; | ||
379 | } else { | 381 | } else { |
380 | /* Dual channel mode */ | 382 | /* Dual channel mode */ |
381 | ct += qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04); | 383 | if (qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04) == 0) |
382 | ct += qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04); | 384 | ct++; |
385 | if (qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04) == 0) | ||
386 | ct++; | ||
383 | } | 387 | } |
384 | } | 388 | } |
385 | } | 389 | } |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 0d1e571ef633..9a9132c9e331 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -228,8 +228,10 @@ static struct scsi_host_template radisys_sht = { | |||
228 | .slave_configure = ata_scsi_slave_config, | 228 | .slave_configure = ata_scsi_slave_config, |
229 | .slave_destroy = ata_scsi_slave_destroy, | 229 | .slave_destroy = ata_scsi_slave_destroy, |
230 | .bios_param = ata_std_bios_param, | 230 | .bios_param = ata_std_bios_param, |
231 | #ifdef CONFIG_PM | ||
231 | .resume = ata_scsi_device_resume, | 232 | .resume = ata_scsi_device_resume, |
232 | .suspend = ata_scsi_device_suspend, | 233 | .suspend = ata_scsi_device_suspend, |
234 | #endif | ||
233 | }; | 235 | }; |
234 | 236 | ||
235 | static const struct ata_port_operations radisys_pata_ops = { | 237 | static const struct ata_port_operations radisys_pata_ops = { |
@@ -312,8 +314,10 @@ static struct pci_driver radisys_pci_driver = { | |||
312 | .id_table = radisys_pci_tbl, | 314 | .id_table = radisys_pci_tbl, |
313 | .probe = radisys_init_one, | 315 | .probe = radisys_init_one, |
314 | .remove = ata_pci_remove_one, | 316 | .remove = ata_pci_remove_one, |
317 | #ifdef CONFIG_PM | ||
315 | .suspend = ata_pci_device_suspend, | 318 | .suspend = ata_pci_device_suspend, |
316 | .resume = ata_pci_device_resume, | 319 | .resume = ata_pci_device_resume, |
320 | #endif | ||
317 | }; | 321 | }; |
318 | 322 | ||
319 | static int __init radisys_init(void) | 323 | static int __init radisys_init(void) |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 60fc598f765d..f522daa2a6aa 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -94,8 +94,10 @@ static struct scsi_host_template rz1000_sht = { | |||
94 | .slave_configure = ata_scsi_slave_config, | 94 | .slave_configure = ata_scsi_slave_config, |
95 | .slave_destroy = ata_scsi_slave_destroy, | 95 | .slave_destroy = ata_scsi_slave_destroy, |
96 | .bios_param = ata_std_bios_param, | 96 | .bios_param = ata_std_bios_param, |
97 | #ifdef CONFIG_PM | ||
97 | .resume = ata_scsi_device_resume, | 98 | .resume = ata_scsi_device_resume, |
98 | .suspend = ata_scsi_device_suspend, | 99 | .suspend = ata_scsi_device_suspend, |
100 | #endif | ||
99 | }; | 101 | }; |
100 | 102 | ||
101 | static struct ata_port_operations rz1000_port_ops = { | 103 | static struct ata_port_operations rz1000_port_ops = { |
@@ -178,6 +180,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
178 | return -ENODEV; | 180 | return -ENODEV; |
179 | } | 181 | } |
180 | 182 | ||
183 | #ifdef CONFIG_PM | ||
181 | static int rz1000_reinit_one(struct pci_dev *pdev) | 184 | static int rz1000_reinit_one(struct pci_dev *pdev) |
182 | { | 185 | { |
183 | /* If this fails on resume (which is a "cant happen" case), we | 186 | /* If this fails on resume (which is a "cant happen" case), we |
@@ -186,6 +189,7 @@ static int rz1000_reinit_one(struct pci_dev *pdev) | |||
186 | panic("rz1000 fifo"); | 189 | panic("rz1000 fifo"); |
187 | return ata_pci_device_resume(pdev); | 190 | return ata_pci_device_resume(pdev); |
188 | } | 191 | } |
192 | #endif | ||
189 | 193 | ||
190 | static const struct pci_device_id pata_rz1000[] = { | 194 | static const struct pci_device_id pata_rz1000[] = { |
191 | { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), }, | 195 | { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), }, |
@@ -199,8 +203,10 @@ static struct pci_driver rz1000_pci_driver = { | |||
199 | .id_table = pata_rz1000, | 203 | .id_table = pata_rz1000, |
200 | .probe = rz1000_init_one, | 204 | .probe = rz1000_init_one, |
201 | .remove = ata_pci_remove_one, | 205 | .remove = ata_pci_remove_one, |
206 | #ifdef CONFIG_PM | ||
202 | .suspend = ata_pci_device_suspend, | 207 | .suspend = ata_pci_device_suspend, |
203 | .resume = rz1000_reinit_one, | 208 | .resume = rz1000_reinit_one, |
209 | #endif | ||
204 | }; | 210 | }; |
205 | 211 | ||
206 | static int __init rz1000_init(void) | 212 | static int __init rz1000_init(void) |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 58e42fbd14f9..93b3ed0f9e8a 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -194,8 +194,10 @@ static struct scsi_host_template sc1200_sht = { | |||
194 | .slave_configure = ata_scsi_slave_config, | 194 | .slave_configure = ata_scsi_slave_config, |
195 | .slave_destroy = ata_scsi_slave_destroy, | 195 | .slave_destroy = ata_scsi_slave_destroy, |
196 | .bios_param = ata_std_bios_param, | 196 | .bios_param = ata_std_bios_param, |
197 | #ifdef CONFIG_PM | ||
197 | .resume = ata_scsi_device_resume, | 198 | .resume = ata_scsi_device_resume, |
198 | .suspend = ata_scsi_device_suspend, | 199 | .suspend = ata_scsi_device_suspend, |
200 | #endif | ||
199 | }; | 201 | }; |
200 | 202 | ||
201 | static struct ata_port_operations sc1200_port_ops = { | 203 | static struct ata_port_operations sc1200_port_ops = { |
@@ -210,7 +212,10 @@ static struct ata_port_operations sc1200_port_ops = { | |||
210 | .exec_command = ata_exec_command, | 212 | .exec_command = ata_exec_command, |
211 | .dev_select = ata_std_dev_select, | 213 | .dev_select = ata_std_dev_select, |
212 | 214 | ||
215 | .freeze = ata_bmdma_freeze, | ||
216 | .thaw = ata_bmdma_thaw, | ||
213 | .error_handler = ata_bmdma_error_handler, | 217 | .error_handler = ata_bmdma_error_handler, |
218 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
214 | 219 | ||
215 | .bmdma_setup = ata_bmdma_setup, | 220 | .bmdma_setup = ata_bmdma_setup, |
216 | .bmdma_start = ata_bmdma_start, | 221 | .bmdma_start = ata_bmdma_start, |
@@ -266,8 +271,10 @@ static struct pci_driver sc1200_pci_driver = { | |||
266 | .id_table = sc1200, | 271 | .id_table = sc1200, |
267 | .probe = sc1200_init_one, | 272 | .probe = sc1200_init_one, |
268 | .remove = ata_pci_remove_one, | 273 | .remove = ata_pci_remove_one, |
274 | #ifdef CONFIG_PM | ||
269 | .suspend = ata_pci_device_suspend, | 275 | .suspend = ata_pci_device_suspend, |
270 | .resume = ata_pci_device_resume, | 276 | .resume = ata_pci_device_resume, |
277 | #endif | ||
271 | }; | 278 | }; |
272 | 279 | ||
273 | static int __init sc1200_init(void) | 280 | static int __init sc1200_init(void) |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 45866098fbf9..f3ed141fdc0e 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -984,8 +984,10 @@ static struct scsi_host_template scc_sht = { | |||
984 | .slave_configure = ata_scsi_slave_config, | 984 | .slave_configure = ata_scsi_slave_config, |
985 | .slave_destroy = ata_scsi_slave_destroy, | 985 | .slave_destroy = ata_scsi_slave_destroy, |
986 | .bios_param = ata_std_bios_param, | 986 | .bios_param = ata_std_bios_param, |
987 | #ifdef CONFIG_PM | ||
987 | .resume = ata_scsi_device_resume, | 988 | .resume = ata_scsi_device_resume, |
988 | .suspend = ata_scsi_device_suspend, | 989 | .suspend = ata_scsi_device_suspend, |
990 | #endif | ||
989 | }; | 991 | }; |
990 | 992 | ||
991 | static const struct ata_port_operations scc_pata_ops = { | 993 | static const struct ata_port_operations scc_pata_ops = { |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index dde7eb9f72bb..598eef810a74 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -319,8 +319,10 @@ static struct scsi_host_template serverworks_sht = { | |||
319 | .slave_configure = ata_scsi_slave_config, | 319 | .slave_configure = ata_scsi_slave_config, |
320 | .slave_destroy = ata_scsi_slave_destroy, | 320 | .slave_destroy = ata_scsi_slave_destroy, |
321 | .bios_param = ata_std_bios_param, | 321 | .bios_param = ata_std_bios_param, |
322 | #ifdef CONFIG_PM | ||
322 | .resume = ata_scsi_device_resume, | 323 | .resume = ata_scsi_device_resume, |
323 | .suspend = ata_scsi_device_suspend, | 324 | .suspend = ata_scsi_device_suspend, |
325 | #endif | ||
324 | }; | 326 | }; |
325 | 327 | ||
326 | static struct ata_port_operations serverworks_osb4_port_ops = { | 328 | static struct ata_port_operations serverworks_osb4_port_ops = { |
@@ -548,6 +550,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
548 | return ata_pci_init_one(pdev, port_info, ports); | 550 | return ata_pci_init_one(pdev, port_info, ports); |
549 | } | 551 | } |
550 | 552 | ||
553 | #ifdef CONFIG_PM | ||
551 | static int serverworks_reinit_one(struct pci_dev *pdev) | 554 | static int serverworks_reinit_one(struct pci_dev *pdev) |
552 | { | 555 | { |
553 | /* Force master latency timer to 64 PCI clocks */ | 556 | /* Force master latency timer to 64 PCI clocks */ |
@@ -571,6 +574,7 @@ static int serverworks_reinit_one(struct pci_dev *pdev) | |||
571 | } | 574 | } |
572 | return ata_pci_device_resume(pdev); | 575 | return ata_pci_device_resume(pdev); |
573 | } | 576 | } |
577 | #endif | ||
574 | 578 | ||
575 | static const struct pci_device_id serverworks[] = { | 579 | static const struct pci_device_id serverworks[] = { |
576 | { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0}, | 580 | { PCI_VDEVICE(SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0}, |
@@ -587,8 +591,10 @@ static struct pci_driver serverworks_pci_driver = { | |||
587 | .id_table = serverworks, | 591 | .id_table = serverworks, |
588 | .probe = serverworks_init_one, | 592 | .probe = serverworks_init_one, |
589 | .remove = ata_pci_remove_one, | 593 | .remove = ata_pci_remove_one, |
594 | #ifdef CONFIG_PM | ||
590 | .suspend = ata_pci_device_suspend, | 595 | .suspend = ata_pci_device_suspend, |
591 | .resume = serverworks_reinit_one, | 596 | .resume = serverworks_reinit_one, |
597 | #endif | ||
592 | }; | 598 | }; |
593 | 599 | ||
594 | static int __init serverworks_init(void) | 600 | static int __init serverworks_init(void) |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 1cb67b221c28..dab2889a556f 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -236,6 +236,10 @@ static struct scsi_host_template sil680_sht = { | |||
236 | .slave_configure = ata_scsi_slave_config, | 236 | .slave_configure = ata_scsi_slave_config, |
237 | .slave_destroy = ata_scsi_slave_destroy, | 237 | .slave_destroy = ata_scsi_slave_destroy, |
238 | .bios_param = ata_std_bios_param, | 238 | .bios_param = ata_std_bios_param, |
239 | #ifdef CONFIG_PM | ||
240 | .suspend = ata_scsi_device_suspend, | ||
241 | .resume = ata_scsi_device_resume, | ||
242 | #endif | ||
239 | }; | 243 | }; |
240 | 244 | ||
241 | static struct ata_port_operations sil680_port_ops = { | 245 | static struct ata_port_operations sil680_port_ops = { |
@@ -377,11 +381,13 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
377 | return ata_pci_init_one(pdev, port_info, 2); | 381 | return ata_pci_init_one(pdev, port_info, 2); |
378 | } | 382 | } |
379 | 383 | ||
384 | #ifdef CONFIG_PM | ||
380 | static int sil680_reinit_one(struct pci_dev *pdev) | 385 | static int sil680_reinit_one(struct pci_dev *pdev) |
381 | { | 386 | { |
382 | sil680_init_chip(pdev); | 387 | sil680_init_chip(pdev); |
383 | return ata_pci_device_resume(pdev); | 388 | return ata_pci_device_resume(pdev); |
384 | } | 389 | } |
390 | #endif | ||
385 | 391 | ||
386 | static const struct pci_device_id sil680[] = { | 392 | static const struct pci_device_id sil680[] = { |
387 | { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), }, | 393 | { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680), }, |
@@ -394,8 +400,10 @@ static struct pci_driver sil680_pci_driver = { | |||
394 | .id_table = sil680, | 400 | .id_table = sil680, |
395 | .probe = sil680_init_one, | 401 | .probe = sil680_init_one, |
396 | .remove = ata_pci_remove_one, | 402 | .remove = ata_pci_remove_one, |
403 | #ifdef CONFIG_PM | ||
397 | .suspend = ata_pci_device_suspend, | 404 | .suspend = ata_pci_device_suspend, |
398 | .resume = sil680_reinit_one, | 405 | .resume = sil680_reinit_one, |
406 | #endif | ||
399 | }; | 407 | }; |
400 | 408 | ||
401 | static int __init sil680_init(void) | 409 | static int __init sil680_init(void) |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index be300923b27e..f48207865930 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -575,8 +575,10 @@ static struct scsi_host_template sis_sht = { | |||
575 | .slave_configure = ata_scsi_slave_config, | 575 | .slave_configure = ata_scsi_slave_config, |
576 | .slave_destroy = ata_scsi_slave_destroy, | 576 | .slave_destroy = ata_scsi_slave_destroy, |
577 | .bios_param = ata_std_bios_param, | 577 | .bios_param = ata_std_bios_param, |
578 | #ifdef CONFIG_PM | ||
578 | .resume = ata_scsi_device_resume, | 579 | .resume = ata_scsi_device_resume, |
579 | .suspend = ata_scsi_device_suspend, | 580 | .suspend = ata_scsi_device_suspend, |
581 | #endif | ||
580 | }; | 582 | }; |
581 | 583 | ||
582 | static const struct ata_port_operations sis_133_ops = { | 584 | static const struct ata_port_operations sis_133_ops = { |
@@ -1032,8 +1034,10 @@ static struct pci_driver sis_pci_driver = { | |||
1032 | .id_table = sis_pci_tbl, | 1034 | .id_table = sis_pci_tbl, |
1033 | .probe = sis_init_one, | 1035 | .probe = sis_init_one, |
1034 | .remove = ata_pci_remove_one, | 1036 | .remove = ata_pci_remove_one, |
1037 | #ifdef CONFIG_PM | ||
1035 | .suspend = ata_pci_device_suspend, | 1038 | .suspend = ata_pci_device_suspend, |
1036 | .resume = ata_pci_device_resume, | 1039 | .resume = ata_pci_device_resume, |
1040 | #endif | ||
1037 | }; | 1041 | }; |
1038 | 1042 | ||
1039 | static int __init sis_init(void) | 1043 | static int __init sis_init(void) |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 13e81f0ef1f7..b681441cfcb9 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -234,7 +234,10 @@ static struct ata_port_operations sl82c105_port_ops = { | |||
234 | .exec_command = ata_exec_command, | 234 | .exec_command = ata_exec_command, |
235 | .dev_select = ata_std_dev_select, | 235 | .dev_select = ata_std_dev_select, |
236 | 236 | ||
237 | .freeze = ata_bmdma_freeze, | ||
238 | .thaw = ata_bmdma_thaw, | ||
237 | .error_handler = sl82c105_error_handler, | 239 | .error_handler = sl82c105_error_handler, |
240 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
238 | 241 | ||
239 | .bmdma_setup = ata_bmdma_setup, | 242 | .bmdma_setup = ata_bmdma_setup, |
240 | .bmdma_start = sl82c105_bmdma_start, | 243 | .bmdma_start = sl82c105_bmdma_start, |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index 453ab90b721e..71418f2a0cdb 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
@@ -193,8 +193,10 @@ static struct scsi_host_template triflex_sht = { | |||
193 | .slave_configure = ata_scsi_slave_config, | 193 | .slave_configure = ata_scsi_slave_config, |
194 | .slave_destroy = ata_scsi_slave_destroy, | 194 | .slave_destroy = ata_scsi_slave_destroy, |
195 | .bios_param = ata_std_bios_param, | 195 | .bios_param = ata_std_bios_param, |
196 | #ifdef CONFIG_PM | ||
196 | .resume = ata_scsi_device_resume, | 197 | .resume = ata_scsi_device_resume, |
197 | .suspend = ata_scsi_device_suspend, | 198 | .suspend = ata_scsi_device_suspend, |
199 | #endif | ||
198 | }; | 200 | }; |
199 | 201 | ||
200 | static struct ata_port_operations triflex_port_ops = { | 202 | static struct ata_port_operations triflex_port_ops = { |
@@ -260,8 +262,10 @@ static struct pci_driver triflex_pci_driver = { | |||
260 | .id_table = triflex, | 262 | .id_table = triflex, |
261 | .probe = triflex_init_one, | 263 | .probe = triflex_init_one, |
262 | .remove = ata_pci_remove_one, | 264 | .remove = ata_pci_remove_one, |
265 | #ifdef CONFIG_PM | ||
263 | .suspend = ata_pci_device_suspend, | 266 | .suspend = ata_pci_device_suspend, |
264 | .resume = ata_pci_device_resume, | 267 | .resume = ata_pci_device_resume, |
268 | #endif | ||
265 | }; | 269 | }; |
266 | 270 | ||
267 | static int __init triflex_init(void) | 271 | static int __init triflex_init(void) |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 20fc2d0dcfa1..946ade0e1f1b 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -305,8 +305,10 @@ static struct scsi_host_template via_sht = { | |||
305 | .slave_configure = ata_scsi_slave_config, | 305 | .slave_configure = ata_scsi_slave_config, |
306 | .slave_destroy = ata_scsi_slave_destroy, | 306 | .slave_destroy = ata_scsi_slave_destroy, |
307 | .bios_param = ata_std_bios_param, | 307 | .bios_param = ata_std_bios_param, |
308 | #ifdef CONFIG_PM | ||
308 | .resume = ata_scsi_device_resume, | 309 | .resume = ata_scsi_device_resume, |
309 | .suspend = ata_scsi_device_suspend, | 310 | .suspend = ata_scsi_device_suspend, |
311 | #endif | ||
310 | }; | 312 | }; |
311 | 313 | ||
312 | static struct ata_port_operations via_port_ops = { | 314 | static struct ata_port_operations via_port_ops = { |
@@ -560,6 +562,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
560 | return ata_pci_init_one(pdev, port_info, 2); | 562 | return ata_pci_init_one(pdev, port_info, 2); |
561 | } | 563 | } |
562 | 564 | ||
565 | #ifdef CONFIG_PM | ||
563 | /** | 566 | /** |
564 | * via_reinit_one - reinit after resume | 567 | * via_reinit_one - reinit after resume |
565 | * @pdev; PCI device | 568 | * @pdev; PCI device |
@@ -592,6 +595,7 @@ static int via_reinit_one(struct pci_dev *pdev) | |||
592 | } | 595 | } |
593 | return ata_pci_device_resume(pdev); | 596 | return ata_pci_device_resume(pdev); |
594 | } | 597 | } |
598 | #endif | ||
595 | 599 | ||
596 | static const struct pci_device_id via[] = { | 600 | static const struct pci_device_id via[] = { |
597 | { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), }, | 601 | { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), }, |
@@ -607,8 +611,10 @@ static struct pci_driver via_pci_driver = { | |||
607 | .id_table = via, | 611 | .id_table = via, |
608 | .probe = via_init_one, | 612 | .probe = via_init_one, |
609 | .remove = ata_pci_remove_one, | 613 | .remove = ata_pci_remove_one, |
614 | #ifdef CONFIG_PM | ||
610 | .suspend = ata_pci_device_suspend, | 615 | .suspend = ata_pci_device_suspend, |
611 | .resume = via_reinit_one, | 616 | .resume = via_reinit_one, |
617 | #endif | ||
612 | }; | 618 | }; |
613 | 619 | ||
614 | static int __init via_init(void) | 620 | static int __init via_init(void) |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 31b636fac98e..3193a603d1a1 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -135,8 +135,10 @@ static struct scsi_host_template inic_sht = { | |||
135 | .slave_configure = inic_slave_config, | 135 | .slave_configure = inic_slave_config, |
136 | .slave_destroy = ata_scsi_slave_destroy, | 136 | .slave_destroy = ata_scsi_slave_destroy, |
137 | .bios_param = ata_std_bios_param, | 137 | .bios_param = ata_std_bios_param, |
138 | #ifdef CONFIG_PM | ||
138 | .suspend = ata_scsi_device_suspend, | 139 | .suspend = ata_scsi_device_suspend, |
139 | .resume = ata_scsi_device_resume, | 140 | .resume = ata_scsi_device_resume, |
141 | #endif | ||
140 | }; | 142 | }; |
141 | 143 | ||
142 | static const int scr_map[] = { | 144 | static const int scr_map[] = { |
@@ -632,6 +634,7 @@ static int init_controller(void __iomem *mmio_base, u16 hctl) | |||
632 | return 0; | 634 | return 0; |
633 | } | 635 | } |
634 | 636 | ||
637 | #ifdef CONFIG_PM | ||
635 | static int inic_pci_device_resume(struct pci_dev *pdev) | 638 | static int inic_pci_device_resume(struct pci_dev *pdev) |
636 | { | 639 | { |
637 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 640 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
@@ -642,7 +645,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev) | |||
642 | ata_pci_device_do_resume(pdev); | 645 | ata_pci_device_do_resume(pdev); |
643 | 646 | ||
644 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { | 647 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { |
645 | printk("XXX\n"); | ||
646 | rc = init_controller(mmio_base, hpriv->cached_hctl); | 648 | rc = init_controller(mmio_base, hpriv->cached_hctl); |
647 | if (rc) | 649 | if (rc) |
648 | return rc; | 650 | return rc; |
@@ -652,6 +654,7 @@ static int inic_pci_device_resume(struct pci_dev *pdev) | |||
652 | 654 | ||
653 | return 0; | 655 | return 0; |
654 | } | 656 | } |
657 | #endif | ||
655 | 658 | ||
656 | static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 659 | static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
657 | { | 660 | { |
@@ -755,8 +758,10 @@ static const struct pci_device_id inic_pci_tbl[] = { | |||
755 | static struct pci_driver inic_pci_driver = { | 758 | static struct pci_driver inic_pci_driver = { |
756 | .name = DRV_NAME, | 759 | .name = DRV_NAME, |
757 | .id_table = inic_pci_tbl, | 760 | .id_table = inic_pci_tbl, |
761 | #ifdef CONFIG_PM | ||
758 | .suspend = ata_pci_device_suspend, | 762 | .suspend = ata_pci_device_suspend, |
759 | .resume = inic_pci_device_resume, | 763 | .resume = inic_pci_device_resume, |
764 | #endif | ||
760 | .probe = inic_init_one, | 765 | .probe = inic_init_one, |
761 | .remove = ata_pci_remove_one, | 766 | .remove = ata_pci_remove_one, |
762 | }; | 767 | }; |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 30eed12b3631..388d07fab5f7 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -230,7 +230,9 @@ struct nv_host_priv { | |||
230 | 230 | ||
231 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 231 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
232 | static void nv_remove_one (struct pci_dev *pdev); | 232 | static void nv_remove_one (struct pci_dev *pdev); |
233 | #ifdef CONFIG_PM | ||
233 | static int nv_pci_device_resume(struct pci_dev *pdev); | 234 | static int nv_pci_device_resume(struct pci_dev *pdev); |
235 | #endif | ||
234 | static void nv_ck804_host_stop(struct ata_host *host); | 236 | static void nv_ck804_host_stop(struct ata_host *host); |
235 | static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance); | 237 | static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance); |
236 | static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance); | 238 | static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance); |
@@ -251,8 +253,10 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance); | |||
251 | static void nv_adma_irq_clear(struct ata_port *ap); | 253 | static void nv_adma_irq_clear(struct ata_port *ap); |
252 | static int nv_adma_port_start(struct ata_port *ap); | 254 | static int nv_adma_port_start(struct ata_port *ap); |
253 | static void nv_adma_port_stop(struct ata_port *ap); | 255 | static void nv_adma_port_stop(struct ata_port *ap); |
256 | #ifdef CONFIG_PM | ||
254 | static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg); | 257 | static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg); |
255 | static int nv_adma_port_resume(struct ata_port *ap); | 258 | static int nv_adma_port_resume(struct ata_port *ap); |
259 | #endif | ||
256 | static void nv_adma_error_handler(struct ata_port *ap); | 260 | static void nv_adma_error_handler(struct ata_port *ap); |
257 | static void nv_adma_host_stop(struct ata_host *host); | 261 | static void nv_adma_host_stop(struct ata_host *host); |
258 | static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc); | 262 | static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc); |
@@ -295,8 +299,10 @@ static struct pci_driver nv_pci_driver = { | |||
295 | .name = DRV_NAME, | 299 | .name = DRV_NAME, |
296 | .id_table = nv_pci_tbl, | 300 | .id_table = nv_pci_tbl, |
297 | .probe = nv_init_one, | 301 | .probe = nv_init_one, |
302 | #ifdef CONFIG_PM | ||
298 | .suspend = ata_pci_device_suspend, | 303 | .suspend = ata_pci_device_suspend, |
299 | .resume = nv_pci_device_resume, | 304 | .resume = nv_pci_device_resume, |
305 | #endif | ||
300 | .remove = nv_remove_one, | 306 | .remove = nv_remove_one, |
301 | }; | 307 | }; |
302 | 308 | ||
@@ -316,8 +322,10 @@ static struct scsi_host_template nv_sht = { | |||
316 | .slave_configure = ata_scsi_slave_config, | 322 | .slave_configure = ata_scsi_slave_config, |
317 | .slave_destroy = ata_scsi_slave_destroy, | 323 | .slave_destroy = ata_scsi_slave_destroy, |
318 | .bios_param = ata_std_bios_param, | 324 | .bios_param = ata_std_bios_param, |
325 | #ifdef CONFIG_PM | ||
319 | .suspend = ata_scsi_device_suspend, | 326 | .suspend = ata_scsi_device_suspend, |
320 | .resume = ata_scsi_device_resume, | 327 | .resume = ata_scsi_device_resume, |
328 | #endif | ||
321 | }; | 329 | }; |
322 | 330 | ||
323 | static struct scsi_host_template nv_adma_sht = { | 331 | static struct scsi_host_template nv_adma_sht = { |
@@ -336,8 +344,10 @@ static struct scsi_host_template nv_adma_sht = { | |||
336 | .slave_configure = nv_adma_slave_config, | 344 | .slave_configure = nv_adma_slave_config, |
337 | .slave_destroy = ata_scsi_slave_destroy, | 345 | .slave_destroy = ata_scsi_slave_destroy, |
338 | .bios_param = ata_std_bios_param, | 346 | .bios_param = ata_std_bios_param, |
347 | #ifdef CONFIG_PM | ||
339 | .suspend = ata_scsi_device_suspend, | 348 | .suspend = ata_scsi_device_suspend, |
340 | .resume = ata_scsi_device_resume, | 349 | .resume = ata_scsi_device_resume, |
350 | #endif | ||
341 | }; | 351 | }; |
342 | 352 | ||
343 | static const struct ata_port_operations nv_generic_ops = { | 353 | static const struct ata_port_operations nv_generic_ops = { |
@@ -449,8 +459,10 @@ static const struct ata_port_operations nv_adma_ops = { | |||
449 | .scr_write = nv_scr_write, | 459 | .scr_write = nv_scr_write, |
450 | .port_start = nv_adma_port_start, | 460 | .port_start = nv_adma_port_start, |
451 | .port_stop = nv_adma_port_stop, | 461 | .port_stop = nv_adma_port_stop, |
462 | #ifdef CONFIG_PM | ||
452 | .port_suspend = nv_adma_port_suspend, | 463 | .port_suspend = nv_adma_port_suspend, |
453 | .port_resume = nv_adma_port_resume, | 464 | .port_resume = nv_adma_port_resume, |
465 | #endif | ||
454 | .host_stop = nv_adma_host_stop, | 466 | .host_stop = nv_adma_host_stop, |
455 | }; | 467 | }; |
456 | 468 | ||
@@ -1003,6 +1015,7 @@ static void nv_adma_port_stop(struct ata_port *ap) | |||
1003 | writew(0, mmio + NV_ADMA_CTL); | 1015 | writew(0, mmio + NV_ADMA_CTL); |
1004 | } | 1016 | } |
1005 | 1017 | ||
1018 | #ifdef CONFIG_PM | ||
1006 | static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg) | 1019 | static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg) |
1007 | { | 1020 | { |
1008 | struct nv_adma_port_priv *pp = ap->private_data; | 1021 | struct nv_adma_port_priv *pp = ap->private_data; |
@@ -1053,6 +1066,7 @@ static int nv_adma_port_resume(struct ata_port *ap) | |||
1053 | 1066 | ||
1054 | return 0; | 1067 | return 0; |
1055 | } | 1068 | } |
1069 | #endif | ||
1056 | 1070 | ||
1057 | static void nv_adma_setup_port(struct ata_probe_ent *probe_ent, unsigned int port) | 1071 | static void nv_adma_setup_port(struct ata_probe_ent *probe_ent, unsigned int port) |
1058 | { | 1072 | { |
@@ -1555,6 +1569,7 @@ static void nv_remove_one (struct pci_dev *pdev) | |||
1555 | kfree(hpriv); | 1569 | kfree(hpriv); |
1556 | } | 1570 | } |
1557 | 1571 | ||
1572 | #ifdef CONFIG_PM | ||
1558 | static int nv_pci_device_resume(struct pci_dev *pdev) | 1573 | static int nv_pci_device_resume(struct pci_dev *pdev) |
1559 | { | 1574 | { |
1560 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 1575 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
@@ -1602,6 +1617,7 @@ static int nv_pci_device_resume(struct pci_dev *pdev) | |||
1602 | 1617 | ||
1603 | return 0; | 1618 | return 0; |
1604 | } | 1619 | } |
1620 | #endif | ||
1605 | 1621 | ||
1606 | static void nv_ck804_host_stop(struct ata_host *host) | 1622 | static void nv_ck804_host_stop(struct ata_host *host) |
1607 | { | 1623 | { |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index f7179c646bef..917b7ea4ef7c 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -183,8 +183,10 @@ static struct scsi_host_template sil_sht = { | |||
183 | .slave_configure = ata_scsi_slave_config, | 183 | .slave_configure = ata_scsi_slave_config, |
184 | .slave_destroy = ata_scsi_slave_destroy, | 184 | .slave_destroy = ata_scsi_slave_destroy, |
185 | .bios_param = ata_std_bios_param, | 185 | .bios_param = ata_std_bios_param, |
186 | #ifdef CONFIG_PM | ||
186 | .suspend = ata_scsi_device_suspend, | 187 | .suspend = ata_scsi_device_suspend, |
187 | .resume = ata_scsi_device_resume, | 188 | .resume = ata_scsi_device_resume, |
189 | #endif | ||
188 | }; | 190 | }; |
189 | 191 | ||
190 | static const struct ata_port_operations sil_ops = { | 192 | static const struct ata_port_operations sil_ops = { |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index b1bab82b16de..75d961599651 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -380,8 +380,10 @@ static struct scsi_host_template sil24_sht = { | |||
380 | .slave_configure = ata_scsi_slave_config, | 380 | .slave_configure = ata_scsi_slave_config, |
381 | .slave_destroy = ata_scsi_slave_destroy, | 381 | .slave_destroy = ata_scsi_slave_destroy, |
382 | .bios_param = ata_std_bios_param, | 382 | .bios_param = ata_std_bios_param, |
383 | #ifdef CONFIG_PM | ||
383 | .suspend = ata_scsi_device_suspend, | 384 | .suspend = ata_scsi_device_suspend, |
384 | .resume = ata_scsi_device_resume, | 385 | .resume = ata_scsi_device_resume, |
386 | #endif | ||
385 | }; | 387 | }; |
386 | 388 | ||
387 | static const struct ata_port_operations sil24_ops = { | 389 | static const struct ata_port_operations sil24_ops = { |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index bb022ed4a866..8d17d8df3662 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -530,7 +530,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
530 | u16 aoemajor; | 530 | u16 aoemajor; |
531 | 531 | ||
532 | hin = (struct aoe_hdr *) skb->mac.raw; | 532 | hin = (struct aoe_hdr *) skb->mac.raw; |
533 | aoemajor = be16_to_cpu(hin->major); | 533 | aoemajor = be16_to_cpu(get_unaligned(&hin->major)); |
534 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); | 534 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); |
535 | if (d == NULL) { | 535 | if (d == NULL) { |
536 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " | 536 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " |
@@ -542,7 +542,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
542 | 542 | ||
543 | spin_lock_irqsave(&d->lock, flags); | 543 | spin_lock_irqsave(&d->lock, flags); |
544 | 544 | ||
545 | n = be32_to_cpu(hin->tag); | 545 | n = be32_to_cpu(get_unaligned(&hin->tag)); |
546 | f = getframe(d, n); | 546 | f = getframe(d, n); |
547 | if (f == NULL) { | 547 | if (f == NULL) { |
548 | calc_rttavg(d, -tsince(n)); | 548 | calc_rttavg(d, -tsince(n)); |
@@ -550,9 +550,9 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
550 | snprintf(ebuf, sizeof ebuf, | 550 | snprintf(ebuf, sizeof ebuf, |
551 | "%15s e%d.%d tag=%08x@%08lx\n", | 551 | "%15s e%d.%d tag=%08x@%08lx\n", |
552 | "unexpected rsp", | 552 | "unexpected rsp", |
553 | be16_to_cpu(hin->major), | 553 | be16_to_cpu(get_unaligned(&hin->major)), |
554 | hin->minor, | 554 | hin->minor, |
555 | be32_to_cpu(hin->tag), | 555 | be32_to_cpu(get_unaligned(&hin->tag)), |
556 | jiffies); | 556 | jiffies); |
557 | aoechr_error(ebuf); | 557 | aoechr_error(ebuf); |
558 | return; | 558 | return; |
@@ -631,7 +631,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
631 | printk(KERN_INFO | 631 | printk(KERN_INFO |
632 | "aoe: unrecognized ata command %2.2Xh for %d.%d\n", | 632 | "aoe: unrecognized ata command %2.2Xh for %d.%d\n", |
633 | ahout->cmdstat, | 633 | ahout->cmdstat, |
634 | be16_to_cpu(hin->major), | 634 | be16_to_cpu(get_unaligned(&hin->major)), |
635 | hin->minor); | 635 | hin->minor); |
636 | } | 636 | } |
637 | } | 637 | } |
@@ -733,7 +733,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
733 | * Enough people have their dip switches set backwards to | 733 | * Enough people have their dip switches set backwards to |
734 | * warrant a loud message for this special case. | 734 | * warrant a loud message for this special case. |
735 | */ | 735 | */ |
736 | aoemajor = be16_to_cpu(h->major); | 736 | aoemajor = be16_to_cpu(get_unaligned(&h->major)); |
737 | if (aoemajor == 0xfff) { | 737 | if (aoemajor == 0xfff) { |
738 | printk(KERN_ERR "aoe: Warning: shelf address is all ones. " | 738 | printk(KERN_ERR "aoe: Warning: shelf address is all ones. " |
739 | "Check shelf dip switches.\n"); | 739 | "Check shelf dip switches.\n"); |
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index 9626e0f5da9d..aab6d91a2c22 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/netdevice.h> | 9 | #include <linux/netdevice.h> |
10 | #include <linux/moduleparam.h> | 10 | #include <linux/moduleparam.h> |
11 | #include <asm/unaligned.h> | ||
11 | #include "aoe.h" | 12 | #include "aoe.h" |
12 | 13 | ||
13 | #define NECODES 5 | 14 | #define NECODES 5 |
@@ -123,7 +124,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
123 | skb_push(skb, ETH_HLEN); /* (1) */ | 124 | skb_push(skb, ETH_HLEN); /* (1) */ |
124 | 125 | ||
125 | h = (struct aoe_hdr *) skb->mac.raw; | 126 | h = (struct aoe_hdr *) skb->mac.raw; |
126 | n = be32_to_cpu(h->tag); | 127 | n = be32_to_cpu(get_unaligned(&h->tag)); |
127 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) | 128 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) |
128 | goto exit; | 129 | goto exit; |
129 | 130 | ||
@@ -133,7 +134,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
133 | n = 0; | 134 | n = 0; |
134 | if (net_ratelimit()) | 135 | if (net_ratelimit()) |
135 | printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n", | 136 | printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n", |
136 | be16_to_cpu(h->major), h->minor, | 137 | be16_to_cpu(get_unaligned(&h->major)), h->minor, |
137 | h->err, aoe_errlist[n]); | 138 | h->err, aoe_errlist[n]); |
138 | goto exit; | 139 | goto exit; |
139 | } | 140 | } |
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 04574a9d4430..0d122bf889db 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include "vmx.h" | 15 | #include "vmx.h" |
16 | #include <linux/kvm.h> | 16 | #include <linux/kvm.h> |
17 | #include <linux/kvm_para.h> | ||
17 | 18 | ||
18 | #define CR0_PE_MASK (1ULL << 0) | 19 | #define CR0_PE_MASK (1ULL << 0) |
19 | #define CR0_TS_MASK (1ULL << 3) | 20 | #define CR0_TS_MASK (1ULL << 3) |
@@ -237,6 +238,9 @@ struct kvm_vcpu { | |||
237 | unsigned long cr0; | 238 | unsigned long cr0; |
238 | unsigned long cr2; | 239 | unsigned long cr2; |
239 | unsigned long cr3; | 240 | unsigned long cr3; |
241 | gpa_t para_state_gpa; | ||
242 | struct page *para_state_page; | ||
243 | gpa_t hypercall_gpa; | ||
240 | unsigned long cr4; | 244 | unsigned long cr4; |
241 | unsigned long cr8; | 245 | unsigned long cr8; |
242 | u64 pdptrs[4]; /* pae */ | 246 | u64 pdptrs[4]; /* pae */ |
@@ -305,6 +309,7 @@ struct kvm { | |||
305 | int busy; | 309 | int busy; |
306 | unsigned long rmap_overflow; | 310 | unsigned long rmap_overflow; |
307 | struct list_head vm_list; | 311 | struct list_head vm_list; |
312 | struct file *filp; | ||
308 | }; | 313 | }; |
309 | 314 | ||
310 | struct kvm_stat { | 315 | struct kvm_stat { |
@@ -339,7 +344,7 @@ struct kvm_arch_ops { | |||
339 | int (*vcpu_create)(struct kvm_vcpu *vcpu); | 344 | int (*vcpu_create)(struct kvm_vcpu *vcpu); |
340 | void (*vcpu_free)(struct kvm_vcpu *vcpu); | 345 | void (*vcpu_free)(struct kvm_vcpu *vcpu); |
341 | 346 | ||
342 | struct kvm_vcpu *(*vcpu_load)(struct kvm_vcpu *vcpu); | 347 | void (*vcpu_load)(struct kvm_vcpu *vcpu); |
343 | void (*vcpu_put)(struct kvm_vcpu *vcpu); | 348 | void (*vcpu_put)(struct kvm_vcpu *vcpu); |
344 | void (*vcpu_decache)(struct kvm_vcpu *vcpu); | 349 | void (*vcpu_decache)(struct kvm_vcpu *vcpu); |
345 | 350 | ||
@@ -382,6 +387,8 @@ struct kvm_arch_ops { | |||
382 | int (*run)(struct kvm_vcpu *vcpu, struct kvm_run *run); | 387 | int (*run)(struct kvm_vcpu *vcpu, struct kvm_run *run); |
383 | int (*vcpu_setup)(struct kvm_vcpu *vcpu); | 388 | int (*vcpu_setup)(struct kvm_vcpu *vcpu); |
384 | void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu); | 389 | void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu); |
390 | void (*patch_hypercall)(struct kvm_vcpu *vcpu, | ||
391 | unsigned char *hypercall_addr); | ||
385 | }; | 392 | }; |
386 | 393 | ||
387 | extern struct kvm_stat kvm_stat; | 394 | extern struct kvm_stat kvm_stat; |
@@ -476,6 +483,8 @@ void kvm_mmu_post_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes); | |||
476 | int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva); | 483 | int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva); |
477 | void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); | 484 | void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); |
478 | 485 | ||
486 | int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run); | ||
487 | |||
479 | static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, | 488 | static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, |
480 | u32 error_code) | 489 | u32 error_code) |
481 | { | 490 | { |
@@ -523,7 +532,7 @@ static inline struct kvm_mmu_page *page_header(hpa_t shadow_page) | |||
523 | { | 532 | { |
524 | struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT); | 533 | struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT); |
525 | 534 | ||
526 | return (struct kvm_mmu_page *)page->private; | 535 | return (struct kvm_mmu_page *)page_private(page); |
527 | } | 536 | } |
528 | 537 | ||
529 | static inline u16 read_fs(void) | 538 | static inline u16 read_fs(void) |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index af866147ff25..a163bca38973 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/kvm.h> | 20 | #include <linux/kvm.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/magic.h> | ||
23 | #include <asm/processor.h> | 24 | #include <asm/processor.h> |
24 | #include <linux/percpu.h> | 25 | #include <linux/percpu.h> |
25 | #include <linux/gfp.h> | 26 | #include <linux/gfp.h> |
@@ -36,6 +37,9 @@ | |||
36 | #include <asm/desc.h> | 37 | #include <asm/desc.h> |
37 | #include <linux/sysdev.h> | 38 | #include <linux/sysdev.h> |
38 | #include <linux/cpu.h> | 39 | #include <linux/cpu.h> |
40 | #include <linux/file.h> | ||
41 | #include <linux/fs.h> | ||
42 | #include <linux/mount.h> | ||
39 | 43 | ||
40 | #include "x86_emulate.h" | 44 | #include "x86_emulate.h" |
41 | #include "segment_descriptor.h" | 45 | #include "segment_descriptor.h" |
@@ -72,6 +76,8 @@ static struct kvm_stats_debugfs_item { | |||
72 | 76 | ||
73 | static struct dentry *debugfs_dir; | 77 | static struct dentry *debugfs_dir; |
74 | 78 | ||
79 | struct vfsmount *kvmfs_mnt; | ||
80 | |||
75 | #define MAX_IO_MSRS 256 | 81 | #define MAX_IO_MSRS 256 |
76 | 82 | ||
77 | #define CR0_RESEVED_BITS 0xffffffff1ffaffc0ULL | 83 | #define CR0_RESEVED_BITS 0xffffffff1ffaffc0ULL |
@@ -90,6 +96,58 @@ struct segment_descriptor_64 { | |||
90 | 96 | ||
91 | #endif | 97 | #endif |
92 | 98 | ||
99 | static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl, | ||
100 | unsigned long arg); | ||
101 | |||
102 | static struct inode *kvmfs_inode(struct file_operations *fops) | ||
103 | { | ||
104 | int error = -ENOMEM; | ||
105 | struct inode *inode = new_inode(kvmfs_mnt->mnt_sb); | ||
106 | |||
107 | if (!inode) | ||
108 | goto eexit_1; | ||
109 | |||
110 | inode->i_fop = fops; | ||
111 | |||
112 | /* | ||
113 | * Mark the inode dirty from the very beginning, | ||
114 | * that way it will never be moved to the dirty | ||
115 | * list because mark_inode_dirty() will think | ||
116 | * that it already _is_ on the dirty list. | ||
117 | */ | ||
118 | inode->i_state = I_DIRTY; | ||
119 | inode->i_mode = S_IRUSR | S_IWUSR; | ||
120 | inode->i_uid = current->fsuid; | ||
121 | inode->i_gid = current->fsgid; | ||
122 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
123 | return inode; | ||
124 | |||
125 | eexit_1: | ||
126 | return ERR_PTR(error); | ||
127 | } | ||
128 | |||
129 | static struct file *kvmfs_file(struct inode *inode, void *private_data) | ||
130 | { | ||
131 | struct file *file = get_empty_filp(); | ||
132 | |||
133 | if (!file) | ||
134 | return ERR_PTR(-ENFILE); | ||
135 | |||
136 | file->f_path.mnt = mntget(kvmfs_mnt); | ||
137 | file->f_path.dentry = d_alloc_anon(inode); | ||
138 | if (!file->f_path.dentry) | ||
139 | return ERR_PTR(-ENOMEM); | ||
140 | file->f_mapping = inode->i_mapping; | ||
141 | |||
142 | file->f_pos = 0; | ||
143 | file->f_flags = O_RDWR; | ||
144 | file->f_op = inode->i_fop; | ||
145 | file->f_mode = FMODE_READ | FMODE_WRITE; | ||
146 | file->f_version = 0; | ||
147 | file->private_data = private_data; | ||
148 | return file; | ||
149 | } | ||
150 | |||
93 | unsigned long segment_base(u16 selector) | 151 | unsigned long segment_base(u16 selector) |
94 | { | 152 | { |
95 | struct descriptor_table gdt; | 153 | struct descriptor_table gdt; |
@@ -126,10 +184,8 @@ static inline int valid_vcpu(int n) | |||
126 | return likely(n >= 0 && n < KVM_MAX_VCPUS); | 184 | return likely(n >= 0 && n < KVM_MAX_VCPUS); |
127 | } | 185 | } |
128 | 186 | ||
129 | int kvm_read_guest(struct kvm_vcpu *vcpu, | 187 | int kvm_read_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size, |
130 | gva_t addr, | 188 | void *dest) |
131 | unsigned long size, | ||
132 | void *dest) | ||
133 | { | 189 | { |
134 | unsigned char *host_buf = dest; | 190 | unsigned char *host_buf = dest; |
135 | unsigned long req_size = size; | 191 | unsigned long req_size = size; |
@@ -161,10 +217,8 @@ int kvm_read_guest(struct kvm_vcpu *vcpu, | |||
161 | } | 217 | } |
162 | EXPORT_SYMBOL_GPL(kvm_read_guest); | 218 | EXPORT_SYMBOL_GPL(kvm_read_guest); |
163 | 219 | ||
164 | int kvm_write_guest(struct kvm_vcpu *vcpu, | 220 | int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size, |
165 | gva_t addr, | 221 | void *data) |
166 | unsigned long size, | ||
167 | void *data) | ||
168 | { | 222 | { |
169 | unsigned char *host_buf = data; | 223 | unsigned char *host_buf = data; |
170 | unsigned long req_size = size; | 224 | unsigned long req_size = size; |
@@ -174,12 +228,15 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, | |||
174 | unsigned now; | 228 | unsigned now; |
175 | unsigned offset; | 229 | unsigned offset; |
176 | hva_t guest_buf; | 230 | hva_t guest_buf; |
231 | gfn_t gfn; | ||
177 | 232 | ||
178 | paddr = gva_to_hpa(vcpu, addr); | 233 | paddr = gva_to_hpa(vcpu, addr); |
179 | 234 | ||
180 | if (is_error_hpa(paddr)) | 235 | if (is_error_hpa(paddr)) |
181 | break; | 236 | break; |
182 | 237 | ||
238 | gfn = vcpu->mmu.gva_to_gpa(vcpu, addr) >> PAGE_SHIFT; | ||
239 | mark_page_dirty(vcpu->kvm, gfn); | ||
183 | guest_buf = (hva_t)kmap_atomic( | 240 | guest_buf = (hva_t)kmap_atomic( |
184 | pfn_to_page(paddr >> PAGE_SHIFT), KM_USER0); | 241 | pfn_to_page(paddr >> PAGE_SHIFT), KM_USER0); |
185 | offset = addr & ~PAGE_MASK; | 242 | offset = addr & ~PAGE_MASK; |
@@ -195,24 +252,30 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, | |||
195 | } | 252 | } |
196 | EXPORT_SYMBOL_GPL(kvm_write_guest); | 253 | EXPORT_SYMBOL_GPL(kvm_write_guest); |
197 | 254 | ||
198 | static int vcpu_slot(struct kvm_vcpu *vcpu) | 255 | /* |
256 | * Switches to specified vcpu, until a matching vcpu_put() | ||
257 | */ | ||
258 | static void vcpu_load(struct kvm_vcpu *vcpu) | ||
199 | { | 259 | { |
200 | return vcpu - vcpu->kvm->vcpus; | 260 | mutex_lock(&vcpu->mutex); |
261 | kvm_arch_ops->vcpu_load(vcpu); | ||
201 | } | 262 | } |
202 | 263 | ||
203 | /* | 264 | /* |
204 | * Switches to specified vcpu, until a matching vcpu_put() | 265 | * Switches to specified vcpu, until a matching vcpu_put(). Will return NULL |
266 | * if the slot is not populated. | ||
205 | */ | 267 | */ |
206 | static struct kvm_vcpu *vcpu_load(struct kvm *kvm, int vcpu_slot) | 268 | static struct kvm_vcpu *vcpu_load_slot(struct kvm *kvm, int slot) |
207 | { | 269 | { |
208 | struct kvm_vcpu *vcpu = &kvm->vcpus[vcpu_slot]; | 270 | struct kvm_vcpu *vcpu = &kvm->vcpus[slot]; |
209 | 271 | ||
210 | mutex_lock(&vcpu->mutex); | 272 | mutex_lock(&vcpu->mutex); |
211 | if (unlikely(!vcpu->vmcs)) { | 273 | if (!vcpu->vmcs) { |
212 | mutex_unlock(&vcpu->mutex); | 274 | mutex_unlock(&vcpu->mutex); |
213 | return NULL; | 275 | return NULL; |
214 | } | 276 | } |
215 | return kvm_arch_ops->vcpu_load(vcpu); | 277 | kvm_arch_ops->vcpu_load(vcpu); |
278 | return vcpu; | ||
216 | } | 279 | } |
217 | 280 | ||
218 | static void vcpu_put(struct kvm_vcpu *vcpu) | 281 | static void vcpu_put(struct kvm_vcpu *vcpu) |
@@ -221,13 +284,13 @@ static void vcpu_put(struct kvm_vcpu *vcpu) | |||
221 | mutex_unlock(&vcpu->mutex); | 284 | mutex_unlock(&vcpu->mutex); |
222 | } | 285 | } |
223 | 286 | ||
224 | static int kvm_dev_open(struct inode *inode, struct file *filp) | 287 | static struct kvm *kvm_create_vm(void) |
225 | { | 288 | { |
226 | struct kvm *kvm = kzalloc(sizeof(struct kvm), GFP_KERNEL); | 289 | struct kvm *kvm = kzalloc(sizeof(struct kvm), GFP_KERNEL); |
227 | int i; | 290 | int i; |
228 | 291 | ||
229 | if (!kvm) | 292 | if (!kvm) |
230 | return -ENOMEM; | 293 | return ERR_PTR(-ENOMEM); |
231 | 294 | ||
232 | spin_lock_init(&kvm->lock); | 295 | spin_lock_init(&kvm->lock); |
233 | INIT_LIST_HEAD(&kvm->active_mmu_pages); | 296 | INIT_LIST_HEAD(&kvm->active_mmu_pages); |
@@ -243,7 +306,11 @@ static int kvm_dev_open(struct inode *inode, struct file *filp) | |||
243 | list_add(&kvm->vm_list, &vm_list); | 306 | list_add(&kvm->vm_list, &vm_list); |
244 | spin_unlock(&kvm_lock); | 307 | spin_unlock(&kvm_lock); |
245 | } | 308 | } |
246 | filp->private_data = kvm; | 309 | return kvm; |
310 | } | ||
311 | |||
312 | static int kvm_dev_open(struct inode *inode, struct file *filp) | ||
313 | { | ||
247 | return 0; | 314 | return 0; |
248 | } | 315 | } |
249 | 316 | ||
@@ -281,9 +348,10 @@ static void kvm_free_physmem(struct kvm *kvm) | |||
281 | 348 | ||
282 | static void kvm_free_vcpu(struct kvm_vcpu *vcpu) | 349 | static void kvm_free_vcpu(struct kvm_vcpu *vcpu) |
283 | { | 350 | { |
284 | if (!vcpu_load(vcpu->kvm, vcpu_slot(vcpu))) | 351 | if (!vcpu->vmcs) |
285 | return; | 352 | return; |
286 | 353 | ||
354 | vcpu_load(vcpu); | ||
287 | kvm_mmu_destroy(vcpu); | 355 | kvm_mmu_destroy(vcpu); |
288 | vcpu_put(vcpu); | 356 | vcpu_put(vcpu); |
289 | kvm_arch_ops->vcpu_free(vcpu); | 357 | kvm_arch_ops->vcpu_free(vcpu); |
@@ -299,14 +367,24 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
299 | 367 | ||
300 | static int kvm_dev_release(struct inode *inode, struct file *filp) | 368 | static int kvm_dev_release(struct inode *inode, struct file *filp) |
301 | { | 369 | { |
302 | struct kvm *kvm = filp->private_data; | 370 | return 0; |
371 | } | ||
303 | 372 | ||
373 | static void kvm_destroy_vm(struct kvm *kvm) | ||
374 | { | ||
304 | spin_lock(&kvm_lock); | 375 | spin_lock(&kvm_lock); |
305 | list_del(&kvm->vm_list); | 376 | list_del(&kvm->vm_list); |
306 | spin_unlock(&kvm_lock); | 377 | spin_unlock(&kvm_lock); |
307 | kvm_free_vcpus(kvm); | 378 | kvm_free_vcpus(kvm); |
308 | kvm_free_physmem(kvm); | 379 | kvm_free_physmem(kvm); |
309 | kfree(kvm); | 380 | kfree(kvm); |
381 | } | ||
382 | |||
383 | static int kvm_vm_release(struct inode *inode, struct file *filp) | ||
384 | { | ||
385 | struct kvm *kvm = filp->private_data; | ||
386 | |||
387 | kvm_destroy_vm(kvm); | ||
310 | return 0; | 388 | return 0; |
311 | } | 389 | } |
312 | 390 | ||
@@ -457,7 +535,7 @@ EXPORT_SYMBOL_GPL(set_cr4); | |||
457 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | 535 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) |
458 | { | 536 | { |
459 | if (is_long_mode(vcpu)) { | 537 | if (is_long_mode(vcpu)) { |
460 | if ( cr3 & CR3_L_MODE_RESEVED_BITS) { | 538 | if (cr3 & CR3_L_MODE_RESEVED_BITS) { |
461 | printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n"); | 539 | printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n"); |
462 | inject_gp(vcpu); | 540 | inject_gp(vcpu); |
463 | return; | 541 | return; |
@@ -533,55 +611,11 @@ void fx_init(struct kvm_vcpu *vcpu) | |||
533 | } | 611 | } |
534 | EXPORT_SYMBOL_GPL(fx_init); | 612 | EXPORT_SYMBOL_GPL(fx_init); |
535 | 613 | ||
536 | /* | 614 | static void do_remove_write_access(struct kvm_vcpu *vcpu, int slot) |
537 | * Creates some virtual cpus. Good luck creating more than one. | ||
538 | */ | ||
539 | static int kvm_dev_ioctl_create_vcpu(struct kvm *kvm, int n) | ||
540 | { | 615 | { |
541 | int r; | 616 | spin_lock(&vcpu->kvm->lock); |
542 | struct kvm_vcpu *vcpu; | 617 | kvm_mmu_slot_remove_write_access(vcpu, slot); |
543 | 618 | spin_unlock(&vcpu->kvm->lock); | |
544 | r = -EINVAL; | ||
545 | if (!valid_vcpu(n)) | ||
546 | goto out; | ||
547 | |||
548 | vcpu = &kvm->vcpus[n]; | ||
549 | |||
550 | mutex_lock(&vcpu->mutex); | ||
551 | |||
552 | if (vcpu->vmcs) { | ||
553 | mutex_unlock(&vcpu->mutex); | ||
554 | return -EEXIST; | ||
555 | } | ||
556 | |||
557 | vcpu->host_fx_image = (char*)ALIGN((hva_t)vcpu->fx_buf, | ||
558 | FX_IMAGE_ALIGN); | ||
559 | vcpu->guest_fx_image = vcpu->host_fx_image + FX_IMAGE_SIZE; | ||
560 | |||
561 | r = kvm_arch_ops->vcpu_create(vcpu); | ||
562 | if (r < 0) | ||
563 | goto out_free_vcpus; | ||
564 | |||
565 | r = kvm_mmu_create(vcpu); | ||
566 | if (r < 0) | ||
567 | goto out_free_vcpus; | ||
568 | |||
569 | kvm_arch_ops->vcpu_load(vcpu); | ||
570 | r = kvm_mmu_setup(vcpu); | ||
571 | if (r >= 0) | ||
572 | r = kvm_arch_ops->vcpu_setup(vcpu); | ||
573 | vcpu_put(vcpu); | ||
574 | |||
575 | if (r < 0) | ||
576 | goto out_free_vcpus; | ||
577 | |||
578 | return 0; | ||
579 | |||
580 | out_free_vcpus: | ||
581 | kvm_free_vcpu(vcpu); | ||
582 | mutex_unlock(&vcpu->mutex); | ||
583 | out: | ||
584 | return r; | ||
585 | } | 619 | } |
586 | 620 | ||
587 | /* | 621 | /* |
@@ -590,8 +624,8 @@ out: | |||
590 | * | 624 | * |
591 | * Discontiguous memory is allowed, mostly for framebuffers. | 625 | * Discontiguous memory is allowed, mostly for framebuffers. |
592 | */ | 626 | */ |
593 | static int kvm_dev_ioctl_set_memory_region(struct kvm *kvm, | 627 | static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, |
594 | struct kvm_memory_region *mem) | 628 | struct kvm_memory_region *mem) |
595 | { | 629 | { |
596 | int r; | 630 | int r; |
597 | gfn_t base_gfn; | 631 | gfn_t base_gfn; |
@@ -674,7 +708,7 @@ raced: | |||
674 | | __GFP_ZERO); | 708 | | __GFP_ZERO); |
675 | if (!new.phys_mem[i]) | 709 | if (!new.phys_mem[i]) |
676 | goto out_free; | 710 | goto out_free; |
677 | new.phys_mem[i]->private = 0; | 711 | set_page_private(new.phys_mem[i],0); |
678 | } | 712 | } |
679 | } | 713 | } |
680 | 714 | ||
@@ -711,9 +745,11 @@ raced: | |||
711 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 745 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
712 | struct kvm_vcpu *vcpu; | 746 | struct kvm_vcpu *vcpu; |
713 | 747 | ||
714 | vcpu = vcpu_load(kvm, i); | 748 | vcpu = vcpu_load_slot(kvm, i); |
715 | if (!vcpu) | 749 | if (!vcpu) |
716 | continue; | 750 | continue; |
751 | if (new.flags & KVM_MEM_LOG_DIRTY_PAGES) | ||
752 | do_remove_write_access(vcpu, mem->slot); | ||
717 | kvm_mmu_reset_context(vcpu); | 753 | kvm_mmu_reset_context(vcpu); |
718 | vcpu_put(vcpu); | 754 | vcpu_put(vcpu); |
719 | } | 755 | } |
@@ -729,18 +765,11 @@ out: | |||
729 | return r; | 765 | return r; |
730 | } | 766 | } |
731 | 767 | ||
732 | static void do_remove_write_access(struct kvm_vcpu *vcpu, int slot) | ||
733 | { | ||
734 | spin_lock(&vcpu->kvm->lock); | ||
735 | kvm_mmu_slot_remove_write_access(vcpu, slot); | ||
736 | spin_unlock(&vcpu->kvm->lock); | ||
737 | } | ||
738 | |||
739 | /* | 768 | /* |
740 | * Get (and clear) the dirty memory log for a memory slot. | 769 | * Get (and clear) the dirty memory log for a memory slot. |
741 | */ | 770 | */ |
742 | static int kvm_dev_ioctl_get_dirty_log(struct kvm *kvm, | 771 | static int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, |
743 | struct kvm_dirty_log *log) | 772 | struct kvm_dirty_log *log) |
744 | { | 773 | { |
745 | struct kvm_memory_slot *memslot; | 774 | struct kvm_memory_slot *memslot; |
746 | int r, i; | 775 | int r, i; |
@@ -765,21 +794,21 @@ static int kvm_dev_ioctl_get_dirty_log(struct kvm *kvm, | |||
765 | if (!memslot->dirty_bitmap) | 794 | if (!memslot->dirty_bitmap) |
766 | goto out; | 795 | goto out; |
767 | 796 | ||
768 | n = ALIGN(memslot->npages, 8) / 8; | 797 | n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; |
769 | 798 | ||
770 | for (i = 0; !any && i < n; ++i) | 799 | for (i = 0; !any && i < n/sizeof(long); ++i) |
771 | any = memslot->dirty_bitmap[i]; | 800 | any = memslot->dirty_bitmap[i]; |
772 | 801 | ||
773 | r = -EFAULT; | 802 | r = -EFAULT; |
774 | if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) | 803 | if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) |
775 | goto out; | 804 | goto out; |
776 | 805 | ||
777 | |||
778 | if (any) { | 806 | if (any) { |
779 | cleared = 0; | 807 | cleared = 0; |
780 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 808 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
781 | struct kvm_vcpu *vcpu = vcpu_load(kvm, i); | 809 | struct kvm_vcpu *vcpu; |
782 | 810 | ||
811 | vcpu = vcpu_load_slot(kvm, i); | ||
783 | if (!vcpu) | 812 | if (!vcpu) |
784 | continue; | 813 | continue; |
785 | if (!cleared) { | 814 | if (!cleared) { |
@@ -903,8 +932,9 @@ static int emulator_read_emulated(unsigned long addr, | |||
903 | return X86EMUL_CONTINUE; | 932 | return X86EMUL_CONTINUE; |
904 | else { | 933 | else { |
905 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); | 934 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); |
935 | |||
906 | if (gpa == UNMAPPED_GVA) | 936 | if (gpa == UNMAPPED_GVA) |
907 | return vcpu_printf(vcpu, "not present\n"), X86EMUL_PROPAGATE_FAULT; | 937 | return X86EMUL_PROPAGATE_FAULT; |
908 | vcpu->mmio_needed = 1; | 938 | vcpu->mmio_needed = 1; |
909 | vcpu->mmio_phys_addr = gpa; | 939 | vcpu->mmio_phys_addr = gpa; |
910 | vcpu->mmio_size = bytes; | 940 | vcpu->mmio_size = bytes; |
@@ -928,6 +958,7 @@ static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
928 | return 0; | 958 | return 0; |
929 | page = gfn_to_page(m, gpa >> PAGE_SHIFT); | 959 | page = gfn_to_page(m, gpa >> PAGE_SHIFT); |
930 | kvm_mmu_pre_write(vcpu, gpa, bytes); | 960 | kvm_mmu_pre_write(vcpu, gpa, bytes); |
961 | mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT); | ||
931 | virt = kmap_atomic(page, KM_USER0); | 962 | virt = kmap_atomic(page, KM_USER0); |
932 | memcpy(virt + offset_in_page(gpa), &val, bytes); | 963 | memcpy(virt + offset_in_page(gpa), &val, bytes); |
933 | kunmap_atomic(virt, KM_USER0); | 964 | kunmap_atomic(virt, KM_USER0); |
@@ -1142,6 +1173,42 @@ int emulate_instruction(struct kvm_vcpu *vcpu, | |||
1142 | } | 1173 | } |
1143 | EXPORT_SYMBOL_GPL(emulate_instruction); | 1174 | EXPORT_SYMBOL_GPL(emulate_instruction); |
1144 | 1175 | ||
1176 | int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
1177 | { | ||
1178 | unsigned long nr, a0, a1, a2, a3, a4, a5, ret; | ||
1179 | |||
1180 | kvm_arch_ops->decache_regs(vcpu); | ||
1181 | ret = -KVM_EINVAL; | ||
1182 | #ifdef CONFIG_X86_64 | ||
1183 | if (is_long_mode(vcpu)) { | ||
1184 | nr = vcpu->regs[VCPU_REGS_RAX]; | ||
1185 | a0 = vcpu->regs[VCPU_REGS_RDI]; | ||
1186 | a1 = vcpu->regs[VCPU_REGS_RSI]; | ||
1187 | a2 = vcpu->regs[VCPU_REGS_RDX]; | ||
1188 | a3 = vcpu->regs[VCPU_REGS_RCX]; | ||
1189 | a4 = vcpu->regs[VCPU_REGS_R8]; | ||
1190 | a5 = vcpu->regs[VCPU_REGS_R9]; | ||
1191 | } else | ||
1192 | #endif | ||
1193 | { | ||
1194 | nr = vcpu->regs[VCPU_REGS_RBX] & -1u; | ||
1195 | a0 = vcpu->regs[VCPU_REGS_RAX] & -1u; | ||
1196 | a1 = vcpu->regs[VCPU_REGS_RCX] & -1u; | ||
1197 | a2 = vcpu->regs[VCPU_REGS_RDX] & -1u; | ||
1198 | a3 = vcpu->regs[VCPU_REGS_RSI] & -1u; | ||
1199 | a4 = vcpu->regs[VCPU_REGS_RDI] & -1u; | ||
1200 | a5 = vcpu->regs[VCPU_REGS_RBP] & -1u; | ||
1201 | } | ||
1202 | switch (nr) { | ||
1203 | default: | ||
1204 | ; | ||
1205 | } | ||
1206 | vcpu->regs[VCPU_REGS_RAX] = ret; | ||
1207 | kvm_arch_ops->cache_regs(vcpu); | ||
1208 | return 1; | ||
1209 | } | ||
1210 | EXPORT_SYMBOL_GPL(kvm_hypercall); | ||
1211 | |||
1145 | static u64 mk_cr_64(u64 curr_cr, u32 new_val) | 1212 | static u64 mk_cr_64(u64 curr_cr, u32 new_val) |
1146 | { | 1213 | { |
1147 | return (curr_cr & ~((1ULL << 32) - 1)) | new_val; | 1214 | return (curr_cr & ~((1ULL << 32) - 1)) | new_val; |
@@ -1208,6 +1275,75 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val, | |||
1208 | } | 1275 | } |
1209 | } | 1276 | } |
1210 | 1277 | ||
1278 | /* | ||
1279 | * Register the para guest with the host: | ||
1280 | */ | ||
1281 | static int vcpu_register_para(struct kvm_vcpu *vcpu, gpa_t para_state_gpa) | ||
1282 | { | ||
1283 | struct kvm_vcpu_para_state *para_state; | ||
1284 | hpa_t para_state_hpa, hypercall_hpa; | ||
1285 | struct page *para_state_page; | ||
1286 | unsigned char *hypercall; | ||
1287 | gpa_t hypercall_gpa; | ||
1288 | |||
1289 | printk(KERN_DEBUG "kvm: guest trying to enter paravirtual mode\n"); | ||
1290 | printk(KERN_DEBUG ".... para_state_gpa: %08Lx\n", para_state_gpa); | ||
1291 | |||
1292 | /* | ||
1293 | * Needs to be page aligned: | ||
1294 | */ | ||
1295 | if (para_state_gpa != PAGE_ALIGN(para_state_gpa)) | ||
1296 | goto err_gp; | ||
1297 | |||
1298 | para_state_hpa = gpa_to_hpa(vcpu, para_state_gpa); | ||
1299 | printk(KERN_DEBUG ".... para_state_hpa: %08Lx\n", para_state_hpa); | ||
1300 | if (is_error_hpa(para_state_hpa)) | ||
1301 | goto err_gp; | ||
1302 | |||
1303 | mark_page_dirty(vcpu->kvm, para_state_gpa >> PAGE_SHIFT); | ||
1304 | para_state_page = pfn_to_page(para_state_hpa >> PAGE_SHIFT); | ||
1305 | para_state = kmap_atomic(para_state_page, KM_USER0); | ||
1306 | |||
1307 | printk(KERN_DEBUG ".... guest version: %d\n", para_state->guest_version); | ||
1308 | printk(KERN_DEBUG ".... size: %d\n", para_state->size); | ||
1309 | |||
1310 | para_state->host_version = KVM_PARA_API_VERSION; | ||
1311 | /* | ||
1312 | * We cannot support guests that try to register themselves | ||
1313 | * with a newer API version than the host supports: | ||
1314 | */ | ||
1315 | if (para_state->guest_version > KVM_PARA_API_VERSION) { | ||
1316 | para_state->ret = -KVM_EINVAL; | ||
1317 | goto err_kunmap_skip; | ||
1318 | } | ||
1319 | |||
1320 | hypercall_gpa = para_state->hypercall_gpa; | ||
1321 | hypercall_hpa = gpa_to_hpa(vcpu, hypercall_gpa); | ||
1322 | printk(KERN_DEBUG ".... hypercall_hpa: %08Lx\n", hypercall_hpa); | ||
1323 | if (is_error_hpa(hypercall_hpa)) { | ||
1324 | para_state->ret = -KVM_EINVAL; | ||
1325 | goto err_kunmap_skip; | ||
1326 | } | ||
1327 | |||
1328 | printk(KERN_DEBUG "kvm: para guest successfully registered.\n"); | ||
1329 | vcpu->para_state_page = para_state_page; | ||
1330 | vcpu->para_state_gpa = para_state_gpa; | ||
1331 | vcpu->hypercall_gpa = hypercall_gpa; | ||
1332 | |||
1333 | mark_page_dirty(vcpu->kvm, hypercall_gpa >> PAGE_SHIFT); | ||
1334 | hypercall = kmap_atomic(pfn_to_page(hypercall_hpa >> PAGE_SHIFT), | ||
1335 | KM_USER1) + (hypercall_hpa & ~PAGE_MASK); | ||
1336 | kvm_arch_ops->patch_hypercall(vcpu, hypercall); | ||
1337 | kunmap_atomic(hypercall, KM_USER1); | ||
1338 | |||
1339 | para_state->ret = 0; | ||
1340 | err_kunmap_skip: | ||
1341 | kunmap_atomic(para_state, KM_USER0); | ||
1342 | return 0; | ||
1343 | err_gp: | ||
1344 | return 1; | ||
1345 | } | ||
1346 | |||
1211 | int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) | 1347 | int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) |
1212 | { | 1348 | { |
1213 | u64 data; | 1349 | u64 data; |
@@ -1316,6 +1452,12 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1316 | case MSR_IA32_MISC_ENABLE: | 1452 | case MSR_IA32_MISC_ENABLE: |
1317 | vcpu->ia32_misc_enable_msr = data; | 1453 | vcpu->ia32_misc_enable_msr = data; |
1318 | break; | 1454 | break; |
1455 | /* | ||
1456 | * This is the 'probe whether the host is KVM' logic: | ||
1457 | */ | ||
1458 | case MSR_KVM_API_MAGIC: | ||
1459 | return vcpu_register_para(vcpu, data); | ||
1460 | |||
1319 | default: | 1461 | default: |
1320 | printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); | 1462 | printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); |
1321 | return 1; | 1463 | return 1; |
@@ -1338,8 +1480,7 @@ void kvm_resched(struct kvm_vcpu *vcpu) | |||
1338 | { | 1480 | { |
1339 | vcpu_put(vcpu); | 1481 | vcpu_put(vcpu); |
1340 | cond_resched(); | 1482 | cond_resched(); |
1341 | /* Cannot fail - no vcpu unplug yet. */ | 1483 | vcpu_load(vcpu); |
1342 | vcpu_load(vcpu->kvm, vcpu_slot(vcpu)); | ||
1343 | } | 1484 | } |
1344 | EXPORT_SYMBOL_GPL(kvm_resched); | 1485 | EXPORT_SYMBOL_GPL(kvm_resched); |
1345 | 1486 | ||
@@ -1361,17 +1502,11 @@ void save_msrs(struct vmx_msr_entry *e, int n) | |||
1361 | } | 1502 | } |
1362 | EXPORT_SYMBOL_GPL(save_msrs); | 1503 | EXPORT_SYMBOL_GPL(save_msrs); |
1363 | 1504 | ||
1364 | static int kvm_dev_ioctl_run(struct kvm *kvm, struct kvm_run *kvm_run) | 1505 | static int kvm_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1365 | { | 1506 | { |
1366 | struct kvm_vcpu *vcpu; | ||
1367 | int r; | 1507 | int r; |
1368 | 1508 | ||
1369 | if (!valid_vcpu(kvm_run->vcpu)) | 1509 | vcpu_load(vcpu); |
1370 | return -EINVAL; | ||
1371 | |||
1372 | vcpu = vcpu_load(kvm, kvm_run->vcpu); | ||
1373 | if (!vcpu) | ||
1374 | return -ENOENT; | ||
1375 | 1510 | ||
1376 | /* re-sync apic's tpr */ | 1511 | /* re-sync apic's tpr */ |
1377 | vcpu->cr8 = kvm_run->cr8; | 1512 | vcpu->cr8 = kvm_run->cr8; |
@@ -1394,16 +1529,10 @@ static int kvm_dev_ioctl_run(struct kvm *kvm, struct kvm_run *kvm_run) | |||
1394 | return r; | 1529 | return r; |
1395 | } | 1530 | } |
1396 | 1531 | ||
1397 | static int kvm_dev_ioctl_get_regs(struct kvm *kvm, struct kvm_regs *regs) | 1532 | static int kvm_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, |
1533 | struct kvm_regs *regs) | ||
1398 | { | 1534 | { |
1399 | struct kvm_vcpu *vcpu; | 1535 | vcpu_load(vcpu); |
1400 | |||
1401 | if (!valid_vcpu(regs->vcpu)) | ||
1402 | return -EINVAL; | ||
1403 | |||
1404 | vcpu = vcpu_load(kvm, regs->vcpu); | ||
1405 | if (!vcpu) | ||
1406 | return -ENOENT; | ||
1407 | 1536 | ||
1408 | kvm_arch_ops->cache_regs(vcpu); | 1537 | kvm_arch_ops->cache_regs(vcpu); |
1409 | 1538 | ||
@@ -1440,16 +1569,10 @@ static int kvm_dev_ioctl_get_regs(struct kvm *kvm, struct kvm_regs *regs) | |||
1440 | return 0; | 1569 | return 0; |
1441 | } | 1570 | } |
1442 | 1571 | ||
1443 | static int kvm_dev_ioctl_set_regs(struct kvm *kvm, struct kvm_regs *regs) | 1572 | static int kvm_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, |
1573 | struct kvm_regs *regs) | ||
1444 | { | 1574 | { |
1445 | struct kvm_vcpu *vcpu; | 1575 | vcpu_load(vcpu); |
1446 | |||
1447 | if (!valid_vcpu(regs->vcpu)) | ||
1448 | return -EINVAL; | ||
1449 | |||
1450 | vcpu = vcpu_load(kvm, regs->vcpu); | ||
1451 | if (!vcpu) | ||
1452 | return -ENOENT; | ||
1453 | 1576 | ||
1454 | vcpu->regs[VCPU_REGS_RAX] = regs->rax; | 1577 | vcpu->regs[VCPU_REGS_RAX] = regs->rax; |
1455 | vcpu->regs[VCPU_REGS_RBX] = regs->rbx; | 1578 | vcpu->regs[VCPU_REGS_RBX] = regs->rbx; |
@@ -1486,16 +1609,12 @@ static void get_segment(struct kvm_vcpu *vcpu, | |||
1486 | return kvm_arch_ops->get_segment(vcpu, var, seg); | 1609 | return kvm_arch_ops->get_segment(vcpu, var, seg); |
1487 | } | 1610 | } |
1488 | 1611 | ||
1489 | static int kvm_dev_ioctl_get_sregs(struct kvm *kvm, struct kvm_sregs *sregs) | 1612 | static int kvm_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, |
1613 | struct kvm_sregs *sregs) | ||
1490 | { | 1614 | { |
1491 | struct kvm_vcpu *vcpu; | ||
1492 | struct descriptor_table dt; | 1615 | struct descriptor_table dt; |
1493 | 1616 | ||
1494 | if (!valid_vcpu(sregs->vcpu)) | 1617 | vcpu_load(vcpu); |
1495 | return -EINVAL; | ||
1496 | vcpu = vcpu_load(kvm, sregs->vcpu); | ||
1497 | if (!vcpu) | ||
1498 | return -ENOENT; | ||
1499 | 1618 | ||
1500 | get_segment(vcpu, &sregs->cs, VCPU_SREG_CS); | 1619 | get_segment(vcpu, &sregs->cs, VCPU_SREG_CS); |
1501 | get_segment(vcpu, &sregs->ds, VCPU_SREG_DS); | 1620 | get_segment(vcpu, &sregs->ds, VCPU_SREG_DS); |
@@ -1537,18 +1656,14 @@ static void set_segment(struct kvm_vcpu *vcpu, | |||
1537 | return kvm_arch_ops->set_segment(vcpu, var, seg); | 1656 | return kvm_arch_ops->set_segment(vcpu, var, seg); |
1538 | } | 1657 | } |
1539 | 1658 | ||
1540 | static int kvm_dev_ioctl_set_sregs(struct kvm *kvm, struct kvm_sregs *sregs) | 1659 | static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, |
1660 | struct kvm_sregs *sregs) | ||
1541 | { | 1661 | { |
1542 | struct kvm_vcpu *vcpu; | ||
1543 | int mmu_reset_needed = 0; | 1662 | int mmu_reset_needed = 0; |
1544 | int i; | 1663 | int i; |
1545 | struct descriptor_table dt; | 1664 | struct descriptor_table dt; |
1546 | 1665 | ||
1547 | if (!valid_vcpu(sregs->vcpu)) | 1666 | vcpu_load(vcpu); |
1548 | return -EINVAL; | ||
1549 | vcpu = vcpu_load(kvm, sregs->vcpu); | ||
1550 | if (!vcpu) | ||
1551 | return -ENOENT; | ||
1552 | 1667 | ||
1553 | set_segment(vcpu, &sregs->cs, VCPU_SREG_CS); | 1668 | set_segment(vcpu, &sregs->cs, VCPU_SREG_CS); |
1554 | set_segment(vcpu, &sregs->ds, VCPU_SREG_DS); | 1669 | set_segment(vcpu, &sregs->ds, VCPU_SREG_DS); |
@@ -1654,20 +1769,14 @@ static int do_set_msr(struct kvm_vcpu *vcpu, unsigned index, u64 *data) | |||
1654 | * | 1769 | * |
1655 | * @return number of msrs set successfully. | 1770 | * @return number of msrs set successfully. |
1656 | */ | 1771 | */ |
1657 | static int __msr_io(struct kvm *kvm, struct kvm_msrs *msrs, | 1772 | static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs, |
1658 | struct kvm_msr_entry *entries, | 1773 | struct kvm_msr_entry *entries, |
1659 | int (*do_msr)(struct kvm_vcpu *vcpu, | 1774 | int (*do_msr)(struct kvm_vcpu *vcpu, |
1660 | unsigned index, u64 *data)) | 1775 | unsigned index, u64 *data)) |
1661 | { | 1776 | { |
1662 | struct kvm_vcpu *vcpu; | ||
1663 | int i; | 1777 | int i; |
1664 | 1778 | ||
1665 | if (!valid_vcpu(msrs->vcpu)) | 1779 | vcpu_load(vcpu); |
1666 | return -EINVAL; | ||
1667 | |||
1668 | vcpu = vcpu_load(kvm, msrs->vcpu); | ||
1669 | if (!vcpu) | ||
1670 | return -ENOENT; | ||
1671 | 1780 | ||
1672 | for (i = 0; i < msrs->nmsrs; ++i) | 1781 | for (i = 0; i < msrs->nmsrs; ++i) |
1673 | if (do_msr(vcpu, entries[i].index, &entries[i].data)) | 1782 | if (do_msr(vcpu, entries[i].index, &entries[i].data)) |
@@ -1683,7 +1792,7 @@ static int __msr_io(struct kvm *kvm, struct kvm_msrs *msrs, | |||
1683 | * | 1792 | * |
1684 | * @return number of msrs set successfully. | 1793 | * @return number of msrs set successfully. |
1685 | */ | 1794 | */ |
1686 | static int msr_io(struct kvm *kvm, struct kvm_msrs __user *user_msrs, | 1795 | static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs, |
1687 | int (*do_msr)(struct kvm_vcpu *vcpu, | 1796 | int (*do_msr)(struct kvm_vcpu *vcpu, |
1688 | unsigned index, u64 *data), | 1797 | unsigned index, u64 *data), |
1689 | int writeback) | 1798 | int writeback) |
@@ -1711,7 +1820,7 @@ static int msr_io(struct kvm *kvm, struct kvm_msrs __user *user_msrs, | |||
1711 | if (copy_from_user(entries, user_msrs->entries, size)) | 1820 | if (copy_from_user(entries, user_msrs->entries, size)) |
1712 | goto out_free; | 1821 | goto out_free; |
1713 | 1822 | ||
1714 | r = n = __msr_io(kvm, &msrs, entries, do_msr); | 1823 | r = n = __msr_io(vcpu, &msrs, entries, do_msr); |
1715 | if (r < 0) | 1824 | if (r < 0) |
1716 | goto out_free; | 1825 | goto out_free; |
1717 | 1826 | ||
@@ -1730,38 +1839,31 @@ out: | |||
1730 | /* | 1839 | /* |
1731 | * Translate a guest virtual address to a guest physical address. | 1840 | * Translate a guest virtual address to a guest physical address. |
1732 | */ | 1841 | */ |
1733 | static int kvm_dev_ioctl_translate(struct kvm *kvm, struct kvm_translation *tr) | 1842 | static int kvm_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, |
1843 | struct kvm_translation *tr) | ||
1734 | { | 1844 | { |
1735 | unsigned long vaddr = tr->linear_address; | 1845 | unsigned long vaddr = tr->linear_address; |
1736 | struct kvm_vcpu *vcpu; | ||
1737 | gpa_t gpa; | 1846 | gpa_t gpa; |
1738 | 1847 | ||
1739 | vcpu = vcpu_load(kvm, tr->vcpu); | 1848 | vcpu_load(vcpu); |
1740 | if (!vcpu) | 1849 | spin_lock(&vcpu->kvm->lock); |
1741 | return -ENOENT; | ||
1742 | spin_lock(&kvm->lock); | ||
1743 | gpa = vcpu->mmu.gva_to_gpa(vcpu, vaddr); | 1850 | gpa = vcpu->mmu.gva_to_gpa(vcpu, vaddr); |
1744 | tr->physical_address = gpa; | 1851 | tr->physical_address = gpa; |
1745 | tr->valid = gpa != UNMAPPED_GVA; | 1852 | tr->valid = gpa != UNMAPPED_GVA; |
1746 | tr->writeable = 1; | 1853 | tr->writeable = 1; |
1747 | tr->usermode = 0; | 1854 | tr->usermode = 0; |
1748 | spin_unlock(&kvm->lock); | 1855 | spin_unlock(&vcpu->kvm->lock); |
1749 | vcpu_put(vcpu); | 1856 | vcpu_put(vcpu); |
1750 | 1857 | ||
1751 | return 0; | 1858 | return 0; |
1752 | } | 1859 | } |
1753 | 1860 | ||
1754 | static int kvm_dev_ioctl_interrupt(struct kvm *kvm, struct kvm_interrupt *irq) | 1861 | static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, |
1862 | struct kvm_interrupt *irq) | ||
1755 | { | 1863 | { |
1756 | struct kvm_vcpu *vcpu; | ||
1757 | |||
1758 | if (!valid_vcpu(irq->vcpu)) | ||
1759 | return -EINVAL; | ||
1760 | if (irq->irq < 0 || irq->irq >= 256) | 1864 | if (irq->irq < 0 || irq->irq >= 256) |
1761 | return -EINVAL; | 1865 | return -EINVAL; |
1762 | vcpu = vcpu_load(kvm, irq->vcpu); | 1866 | vcpu_load(vcpu); |
1763 | if (!vcpu) | ||
1764 | return -ENOENT; | ||
1765 | 1867 | ||
1766 | set_bit(irq->irq, vcpu->irq_pending); | 1868 | set_bit(irq->irq, vcpu->irq_pending); |
1767 | set_bit(irq->irq / BITS_PER_LONG, &vcpu->irq_summary); | 1869 | set_bit(irq->irq / BITS_PER_LONG, &vcpu->irq_summary); |
@@ -1771,17 +1873,12 @@ static int kvm_dev_ioctl_interrupt(struct kvm *kvm, struct kvm_interrupt *irq) | |||
1771 | return 0; | 1873 | return 0; |
1772 | } | 1874 | } |
1773 | 1875 | ||
1774 | static int kvm_dev_ioctl_debug_guest(struct kvm *kvm, | 1876 | static int kvm_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, |
1775 | struct kvm_debug_guest *dbg) | 1877 | struct kvm_debug_guest *dbg) |
1776 | { | 1878 | { |
1777 | struct kvm_vcpu *vcpu; | ||
1778 | int r; | 1879 | int r; |
1779 | 1880 | ||
1780 | if (!valid_vcpu(dbg->vcpu)) | 1881 | vcpu_load(vcpu); |
1781 | return -EINVAL; | ||
1782 | vcpu = vcpu_load(kvm, dbg->vcpu); | ||
1783 | if (!vcpu) | ||
1784 | return -ENOENT; | ||
1785 | 1882 | ||
1786 | r = kvm_arch_ops->set_guest_debug(vcpu, dbg); | 1883 | r = kvm_arch_ops->set_guest_debug(vcpu, dbg); |
1787 | 1884 | ||
@@ -1790,30 +1887,129 @@ static int kvm_dev_ioctl_debug_guest(struct kvm *kvm, | |||
1790 | return r; | 1887 | return r; |
1791 | } | 1888 | } |
1792 | 1889 | ||
1793 | static long kvm_dev_ioctl(struct file *filp, | 1890 | static int kvm_vcpu_release(struct inode *inode, struct file *filp) |
1794 | unsigned int ioctl, unsigned long arg) | ||
1795 | { | 1891 | { |
1796 | struct kvm *kvm = filp->private_data; | 1892 | struct kvm_vcpu *vcpu = filp->private_data; |
1893 | |||
1894 | fput(vcpu->kvm->filp); | ||
1895 | return 0; | ||
1896 | } | ||
1897 | |||
1898 | static struct file_operations kvm_vcpu_fops = { | ||
1899 | .release = kvm_vcpu_release, | ||
1900 | .unlocked_ioctl = kvm_vcpu_ioctl, | ||
1901 | .compat_ioctl = kvm_vcpu_ioctl, | ||
1902 | }; | ||
1903 | |||
1904 | /* | ||
1905 | * Allocates an inode for the vcpu. | ||
1906 | */ | ||
1907 | static int create_vcpu_fd(struct kvm_vcpu *vcpu) | ||
1908 | { | ||
1909 | int fd, r; | ||
1910 | struct inode *inode; | ||
1911 | struct file *file; | ||
1912 | |||
1913 | atomic_inc(&vcpu->kvm->filp->f_count); | ||
1914 | inode = kvmfs_inode(&kvm_vcpu_fops); | ||
1915 | if (IS_ERR(inode)) { | ||
1916 | r = PTR_ERR(inode); | ||
1917 | goto out1; | ||
1918 | } | ||
1919 | |||
1920 | file = kvmfs_file(inode, vcpu); | ||
1921 | if (IS_ERR(file)) { | ||
1922 | r = PTR_ERR(file); | ||
1923 | goto out2; | ||
1924 | } | ||
1925 | |||
1926 | r = get_unused_fd(); | ||
1927 | if (r < 0) | ||
1928 | goto out3; | ||
1929 | fd = r; | ||
1930 | fd_install(fd, file); | ||
1931 | |||
1932 | return fd; | ||
1933 | |||
1934 | out3: | ||
1935 | fput(file); | ||
1936 | out2: | ||
1937 | iput(inode); | ||
1938 | out1: | ||
1939 | fput(vcpu->kvm->filp); | ||
1940 | return r; | ||
1941 | } | ||
1942 | |||
1943 | /* | ||
1944 | * Creates some virtual cpus. Good luck creating more than one. | ||
1945 | */ | ||
1946 | static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n) | ||
1947 | { | ||
1948 | int r; | ||
1949 | struct kvm_vcpu *vcpu; | ||
1950 | |||
1951 | r = -EINVAL; | ||
1952 | if (!valid_vcpu(n)) | ||
1953 | goto out; | ||
1954 | |||
1955 | vcpu = &kvm->vcpus[n]; | ||
1956 | |||
1957 | mutex_lock(&vcpu->mutex); | ||
1958 | |||
1959 | if (vcpu->vmcs) { | ||
1960 | mutex_unlock(&vcpu->mutex); | ||
1961 | return -EEXIST; | ||
1962 | } | ||
1963 | |||
1964 | vcpu->host_fx_image = (char*)ALIGN((hva_t)vcpu->fx_buf, | ||
1965 | FX_IMAGE_ALIGN); | ||
1966 | vcpu->guest_fx_image = vcpu->host_fx_image + FX_IMAGE_SIZE; | ||
1967 | |||
1968 | r = kvm_arch_ops->vcpu_create(vcpu); | ||
1969 | if (r < 0) | ||
1970 | goto out_free_vcpus; | ||
1971 | |||
1972 | r = kvm_mmu_create(vcpu); | ||
1973 | if (r < 0) | ||
1974 | goto out_free_vcpus; | ||
1975 | |||
1976 | kvm_arch_ops->vcpu_load(vcpu); | ||
1977 | r = kvm_mmu_setup(vcpu); | ||
1978 | if (r >= 0) | ||
1979 | r = kvm_arch_ops->vcpu_setup(vcpu); | ||
1980 | vcpu_put(vcpu); | ||
1981 | |||
1982 | if (r < 0) | ||
1983 | goto out_free_vcpus; | ||
1984 | |||
1985 | r = create_vcpu_fd(vcpu); | ||
1986 | if (r < 0) | ||
1987 | goto out_free_vcpus; | ||
1988 | |||
1989 | return r; | ||
1990 | |||
1991 | out_free_vcpus: | ||
1992 | kvm_free_vcpu(vcpu); | ||
1993 | mutex_unlock(&vcpu->mutex); | ||
1994 | out: | ||
1995 | return r; | ||
1996 | } | ||
1997 | |||
1998 | static long kvm_vcpu_ioctl(struct file *filp, | ||
1999 | unsigned int ioctl, unsigned long arg) | ||
2000 | { | ||
2001 | struct kvm_vcpu *vcpu = filp->private_data; | ||
1797 | void __user *argp = (void __user *)arg; | 2002 | void __user *argp = (void __user *)arg; |
1798 | int r = -EINVAL; | 2003 | int r = -EINVAL; |
1799 | 2004 | ||
1800 | switch (ioctl) { | 2005 | switch (ioctl) { |
1801 | case KVM_GET_API_VERSION: | ||
1802 | r = KVM_API_VERSION; | ||
1803 | break; | ||
1804 | case KVM_CREATE_VCPU: { | ||
1805 | r = kvm_dev_ioctl_create_vcpu(kvm, arg); | ||
1806 | if (r) | ||
1807 | goto out; | ||
1808 | break; | ||
1809 | } | ||
1810 | case KVM_RUN: { | 2006 | case KVM_RUN: { |
1811 | struct kvm_run kvm_run; | 2007 | struct kvm_run kvm_run; |
1812 | 2008 | ||
1813 | r = -EFAULT; | 2009 | r = -EFAULT; |
1814 | if (copy_from_user(&kvm_run, argp, sizeof kvm_run)) | 2010 | if (copy_from_user(&kvm_run, argp, sizeof kvm_run)) |
1815 | goto out; | 2011 | goto out; |
1816 | r = kvm_dev_ioctl_run(kvm, &kvm_run); | 2012 | r = kvm_vcpu_ioctl_run(vcpu, &kvm_run); |
1817 | if (r < 0 && r != -EINTR) | 2013 | if (r < 0 && r != -EINTR) |
1818 | goto out; | 2014 | goto out; |
1819 | if (copy_to_user(argp, &kvm_run, sizeof kvm_run)) { | 2015 | if (copy_to_user(argp, &kvm_run, sizeof kvm_run)) { |
@@ -1825,10 +2021,8 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1825 | case KVM_GET_REGS: { | 2021 | case KVM_GET_REGS: { |
1826 | struct kvm_regs kvm_regs; | 2022 | struct kvm_regs kvm_regs; |
1827 | 2023 | ||
1828 | r = -EFAULT; | 2024 | memset(&kvm_regs, 0, sizeof kvm_regs); |
1829 | if (copy_from_user(&kvm_regs, argp, sizeof kvm_regs)) | 2025 | r = kvm_vcpu_ioctl_get_regs(vcpu, &kvm_regs); |
1830 | goto out; | ||
1831 | r = kvm_dev_ioctl_get_regs(kvm, &kvm_regs); | ||
1832 | if (r) | 2026 | if (r) |
1833 | goto out; | 2027 | goto out; |
1834 | r = -EFAULT; | 2028 | r = -EFAULT; |
@@ -1843,7 +2037,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1843 | r = -EFAULT; | 2037 | r = -EFAULT; |
1844 | if (copy_from_user(&kvm_regs, argp, sizeof kvm_regs)) | 2038 | if (copy_from_user(&kvm_regs, argp, sizeof kvm_regs)) |
1845 | goto out; | 2039 | goto out; |
1846 | r = kvm_dev_ioctl_set_regs(kvm, &kvm_regs); | 2040 | r = kvm_vcpu_ioctl_set_regs(vcpu, &kvm_regs); |
1847 | if (r) | 2041 | if (r) |
1848 | goto out; | 2042 | goto out; |
1849 | r = 0; | 2043 | r = 0; |
@@ -1852,10 +2046,8 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1852 | case KVM_GET_SREGS: { | 2046 | case KVM_GET_SREGS: { |
1853 | struct kvm_sregs kvm_sregs; | 2047 | struct kvm_sregs kvm_sregs; |
1854 | 2048 | ||
1855 | r = -EFAULT; | 2049 | memset(&kvm_sregs, 0, sizeof kvm_sregs); |
1856 | if (copy_from_user(&kvm_sregs, argp, sizeof kvm_sregs)) | 2050 | r = kvm_vcpu_ioctl_get_sregs(vcpu, &kvm_sregs); |
1857 | goto out; | ||
1858 | r = kvm_dev_ioctl_get_sregs(kvm, &kvm_sregs); | ||
1859 | if (r) | 2051 | if (r) |
1860 | goto out; | 2052 | goto out; |
1861 | r = -EFAULT; | 2053 | r = -EFAULT; |
@@ -1870,7 +2062,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1870 | r = -EFAULT; | 2062 | r = -EFAULT; |
1871 | if (copy_from_user(&kvm_sregs, argp, sizeof kvm_sregs)) | 2063 | if (copy_from_user(&kvm_sregs, argp, sizeof kvm_sregs)) |
1872 | goto out; | 2064 | goto out; |
1873 | r = kvm_dev_ioctl_set_sregs(kvm, &kvm_sregs); | 2065 | r = kvm_vcpu_ioctl_set_sregs(vcpu, &kvm_sregs); |
1874 | if (r) | 2066 | if (r) |
1875 | goto out; | 2067 | goto out; |
1876 | r = 0; | 2068 | r = 0; |
@@ -1882,7 +2074,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1882 | r = -EFAULT; | 2074 | r = -EFAULT; |
1883 | if (copy_from_user(&tr, argp, sizeof tr)) | 2075 | if (copy_from_user(&tr, argp, sizeof tr)) |
1884 | goto out; | 2076 | goto out; |
1885 | r = kvm_dev_ioctl_translate(kvm, &tr); | 2077 | r = kvm_vcpu_ioctl_translate(vcpu, &tr); |
1886 | if (r) | 2078 | if (r) |
1887 | goto out; | 2079 | goto out; |
1888 | r = -EFAULT; | 2080 | r = -EFAULT; |
@@ -1897,7 +2089,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1897 | r = -EFAULT; | 2089 | r = -EFAULT; |
1898 | if (copy_from_user(&irq, argp, sizeof irq)) | 2090 | if (copy_from_user(&irq, argp, sizeof irq)) |
1899 | goto out; | 2091 | goto out; |
1900 | r = kvm_dev_ioctl_interrupt(kvm, &irq); | 2092 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); |
1901 | if (r) | 2093 | if (r) |
1902 | goto out; | 2094 | goto out; |
1903 | r = 0; | 2095 | r = 0; |
@@ -1909,19 +2101,45 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1909 | r = -EFAULT; | 2101 | r = -EFAULT; |
1910 | if (copy_from_user(&dbg, argp, sizeof dbg)) | 2102 | if (copy_from_user(&dbg, argp, sizeof dbg)) |
1911 | goto out; | 2103 | goto out; |
1912 | r = kvm_dev_ioctl_debug_guest(kvm, &dbg); | 2104 | r = kvm_vcpu_ioctl_debug_guest(vcpu, &dbg); |
1913 | if (r) | 2105 | if (r) |
1914 | goto out; | 2106 | goto out; |
1915 | r = 0; | 2107 | r = 0; |
1916 | break; | 2108 | break; |
1917 | } | 2109 | } |
2110 | case KVM_GET_MSRS: | ||
2111 | r = msr_io(vcpu, argp, get_msr, 1); | ||
2112 | break; | ||
2113 | case KVM_SET_MSRS: | ||
2114 | r = msr_io(vcpu, argp, do_set_msr, 0); | ||
2115 | break; | ||
2116 | default: | ||
2117 | ; | ||
2118 | } | ||
2119 | out: | ||
2120 | return r; | ||
2121 | } | ||
2122 | |||
2123 | static long kvm_vm_ioctl(struct file *filp, | ||
2124 | unsigned int ioctl, unsigned long arg) | ||
2125 | { | ||
2126 | struct kvm *kvm = filp->private_data; | ||
2127 | void __user *argp = (void __user *)arg; | ||
2128 | int r = -EINVAL; | ||
2129 | |||
2130 | switch (ioctl) { | ||
2131 | case KVM_CREATE_VCPU: | ||
2132 | r = kvm_vm_ioctl_create_vcpu(kvm, arg); | ||
2133 | if (r < 0) | ||
2134 | goto out; | ||
2135 | break; | ||
1918 | case KVM_SET_MEMORY_REGION: { | 2136 | case KVM_SET_MEMORY_REGION: { |
1919 | struct kvm_memory_region kvm_mem; | 2137 | struct kvm_memory_region kvm_mem; |
1920 | 2138 | ||
1921 | r = -EFAULT; | 2139 | r = -EFAULT; |
1922 | if (copy_from_user(&kvm_mem, argp, sizeof kvm_mem)) | 2140 | if (copy_from_user(&kvm_mem, argp, sizeof kvm_mem)) |
1923 | goto out; | 2141 | goto out; |
1924 | r = kvm_dev_ioctl_set_memory_region(kvm, &kvm_mem); | 2142 | r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_mem); |
1925 | if (r) | 2143 | if (r) |
1926 | goto out; | 2144 | goto out; |
1927 | break; | 2145 | break; |
@@ -1932,16 +2150,112 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1932 | r = -EFAULT; | 2150 | r = -EFAULT; |
1933 | if (copy_from_user(&log, argp, sizeof log)) | 2151 | if (copy_from_user(&log, argp, sizeof log)) |
1934 | goto out; | 2152 | goto out; |
1935 | r = kvm_dev_ioctl_get_dirty_log(kvm, &log); | 2153 | r = kvm_vm_ioctl_get_dirty_log(kvm, &log); |
1936 | if (r) | 2154 | if (r) |
1937 | goto out; | 2155 | goto out; |
1938 | break; | 2156 | break; |
1939 | } | 2157 | } |
1940 | case KVM_GET_MSRS: | 2158 | default: |
1941 | r = msr_io(kvm, argp, get_msr, 1); | 2159 | ; |
2160 | } | ||
2161 | out: | ||
2162 | return r; | ||
2163 | } | ||
2164 | |||
2165 | static struct page *kvm_vm_nopage(struct vm_area_struct *vma, | ||
2166 | unsigned long address, | ||
2167 | int *type) | ||
2168 | { | ||
2169 | struct kvm *kvm = vma->vm_file->private_data; | ||
2170 | unsigned long pgoff; | ||
2171 | struct kvm_memory_slot *slot; | ||
2172 | struct page *page; | ||
2173 | |||
2174 | *type = VM_FAULT_MINOR; | ||
2175 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | ||
2176 | slot = gfn_to_memslot(kvm, pgoff); | ||
2177 | if (!slot) | ||
2178 | return NOPAGE_SIGBUS; | ||
2179 | page = gfn_to_page(slot, pgoff); | ||
2180 | if (!page) | ||
2181 | return NOPAGE_SIGBUS; | ||
2182 | get_page(page); | ||
2183 | return page; | ||
2184 | } | ||
2185 | |||
2186 | static struct vm_operations_struct kvm_vm_vm_ops = { | ||
2187 | .nopage = kvm_vm_nopage, | ||
2188 | }; | ||
2189 | |||
2190 | static int kvm_vm_mmap(struct file *file, struct vm_area_struct *vma) | ||
2191 | { | ||
2192 | vma->vm_ops = &kvm_vm_vm_ops; | ||
2193 | return 0; | ||
2194 | } | ||
2195 | |||
2196 | static struct file_operations kvm_vm_fops = { | ||
2197 | .release = kvm_vm_release, | ||
2198 | .unlocked_ioctl = kvm_vm_ioctl, | ||
2199 | .compat_ioctl = kvm_vm_ioctl, | ||
2200 | .mmap = kvm_vm_mmap, | ||
2201 | }; | ||
2202 | |||
2203 | static int kvm_dev_ioctl_create_vm(void) | ||
2204 | { | ||
2205 | int fd, r; | ||
2206 | struct inode *inode; | ||
2207 | struct file *file; | ||
2208 | struct kvm *kvm; | ||
2209 | |||
2210 | inode = kvmfs_inode(&kvm_vm_fops); | ||
2211 | if (IS_ERR(inode)) { | ||
2212 | r = PTR_ERR(inode); | ||
2213 | goto out1; | ||
2214 | } | ||
2215 | |||
2216 | kvm = kvm_create_vm(); | ||
2217 | if (IS_ERR(kvm)) { | ||
2218 | r = PTR_ERR(kvm); | ||
2219 | goto out2; | ||
2220 | } | ||
2221 | |||
2222 | file = kvmfs_file(inode, kvm); | ||
2223 | if (IS_ERR(file)) { | ||
2224 | r = PTR_ERR(file); | ||
2225 | goto out3; | ||
2226 | } | ||
2227 | kvm->filp = file; | ||
2228 | |||
2229 | r = get_unused_fd(); | ||
2230 | if (r < 0) | ||
2231 | goto out4; | ||
2232 | fd = r; | ||
2233 | fd_install(fd, file); | ||
2234 | |||
2235 | return fd; | ||
2236 | |||
2237 | out4: | ||
2238 | fput(file); | ||
2239 | out3: | ||
2240 | kvm_destroy_vm(kvm); | ||
2241 | out2: | ||
2242 | iput(inode); | ||
2243 | out1: | ||
2244 | return r; | ||
2245 | } | ||
2246 | |||
2247 | static long kvm_dev_ioctl(struct file *filp, | ||
2248 | unsigned int ioctl, unsigned long arg) | ||
2249 | { | ||
2250 | void __user *argp = (void __user *)arg; | ||
2251 | int r = -EINVAL; | ||
2252 | |||
2253 | switch (ioctl) { | ||
2254 | case KVM_GET_API_VERSION: | ||
2255 | r = KVM_API_VERSION; | ||
1942 | break; | 2256 | break; |
1943 | case KVM_SET_MSRS: | 2257 | case KVM_CREATE_VM: |
1944 | r = msr_io(kvm, argp, do_set_msr, 0); | 2258 | r = kvm_dev_ioctl_create_vm(); |
1945 | break; | 2259 | break; |
1946 | case KVM_GET_MSR_INDEX_LIST: { | 2260 | case KVM_GET_MSR_INDEX_LIST: { |
1947 | struct kvm_msr_list __user *user_msr_list = argp; | 2261 | struct kvm_msr_list __user *user_msr_list = argp; |
@@ -1977,43 +2291,11 @@ out: | |||
1977 | return r; | 2291 | return r; |
1978 | } | 2292 | } |
1979 | 2293 | ||
1980 | static struct page *kvm_dev_nopage(struct vm_area_struct *vma, | ||
1981 | unsigned long address, | ||
1982 | int *type) | ||
1983 | { | ||
1984 | struct kvm *kvm = vma->vm_file->private_data; | ||
1985 | unsigned long pgoff; | ||
1986 | struct kvm_memory_slot *slot; | ||
1987 | struct page *page; | ||
1988 | |||
1989 | *type = VM_FAULT_MINOR; | ||
1990 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | ||
1991 | slot = gfn_to_memslot(kvm, pgoff); | ||
1992 | if (!slot) | ||
1993 | return NOPAGE_SIGBUS; | ||
1994 | page = gfn_to_page(slot, pgoff); | ||
1995 | if (!page) | ||
1996 | return NOPAGE_SIGBUS; | ||
1997 | get_page(page); | ||
1998 | return page; | ||
1999 | } | ||
2000 | |||
2001 | static struct vm_operations_struct kvm_dev_vm_ops = { | ||
2002 | .nopage = kvm_dev_nopage, | ||
2003 | }; | ||
2004 | |||
2005 | static int kvm_dev_mmap(struct file *file, struct vm_area_struct *vma) | ||
2006 | { | ||
2007 | vma->vm_ops = &kvm_dev_vm_ops; | ||
2008 | return 0; | ||
2009 | } | ||
2010 | |||
2011 | static struct file_operations kvm_chardev_ops = { | 2294 | static struct file_operations kvm_chardev_ops = { |
2012 | .open = kvm_dev_open, | 2295 | .open = kvm_dev_open, |
2013 | .release = kvm_dev_release, | 2296 | .release = kvm_dev_release, |
2014 | .unlocked_ioctl = kvm_dev_ioctl, | 2297 | .unlocked_ioctl = kvm_dev_ioctl, |
2015 | .compat_ioctl = kvm_dev_ioctl, | 2298 | .compat_ioctl = kvm_dev_ioctl, |
2016 | .mmap = kvm_dev_mmap, | ||
2017 | }; | 2299 | }; |
2018 | 2300 | ||
2019 | static struct miscdevice kvm_dev = { | 2301 | static struct miscdevice kvm_dev = { |
@@ -2080,13 +2362,17 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, | |||
2080 | int cpu = (long)v; | 2362 | int cpu = (long)v; |
2081 | 2363 | ||
2082 | switch (val) { | 2364 | switch (val) { |
2083 | case CPU_DEAD: | 2365 | case CPU_DOWN_PREPARE: |
2084 | case CPU_UP_CANCELED: | 2366 | case CPU_UP_CANCELED: |
2367 | printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", | ||
2368 | cpu); | ||
2085 | decache_vcpus_on_cpu(cpu); | 2369 | decache_vcpus_on_cpu(cpu); |
2086 | smp_call_function_single(cpu, kvm_arch_ops->hardware_disable, | 2370 | smp_call_function_single(cpu, kvm_arch_ops->hardware_disable, |
2087 | NULL, 0, 1); | 2371 | NULL, 0, 1); |
2088 | break; | 2372 | break; |
2089 | case CPU_UP_PREPARE: | 2373 | case CPU_ONLINE: |
2374 | printk(KERN_INFO "kvm: enabling virtualization on CPU%d\n", | ||
2375 | cpu); | ||
2090 | smp_call_function_single(cpu, kvm_arch_ops->hardware_enable, | 2376 | smp_call_function_single(cpu, kvm_arch_ops->hardware_enable, |
2091 | NULL, 0, 1); | 2377 | NULL, 0, 1); |
2092 | break; | 2378 | break; |
@@ -2121,13 +2407,13 @@ static void kvm_exit_debug(void) | |||
2121 | static int kvm_suspend(struct sys_device *dev, pm_message_t state) | 2407 | static int kvm_suspend(struct sys_device *dev, pm_message_t state) |
2122 | { | 2408 | { |
2123 | decache_vcpus_on_cpu(raw_smp_processor_id()); | 2409 | decache_vcpus_on_cpu(raw_smp_processor_id()); |
2124 | on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1); | 2410 | on_each_cpu(kvm_arch_ops->hardware_disable, NULL, 0, 1); |
2125 | return 0; | 2411 | return 0; |
2126 | } | 2412 | } |
2127 | 2413 | ||
2128 | static int kvm_resume(struct sys_device *dev) | 2414 | static int kvm_resume(struct sys_device *dev) |
2129 | { | 2415 | { |
2130 | on_each_cpu(kvm_arch_ops->hardware_enable, 0, 0, 1); | 2416 | on_each_cpu(kvm_arch_ops->hardware_enable, NULL, 0, 1); |
2131 | return 0; | 2417 | return 0; |
2132 | } | 2418 | } |
2133 | 2419 | ||
@@ -2144,6 +2430,18 @@ static struct sys_device kvm_sysdev = { | |||
2144 | 2430 | ||
2145 | hpa_t bad_page_address; | 2431 | hpa_t bad_page_address; |
2146 | 2432 | ||
2433 | static int kvmfs_get_sb(struct file_system_type *fs_type, int flags, | ||
2434 | const char *dev_name, void *data, struct vfsmount *mnt) | ||
2435 | { | ||
2436 | return get_sb_pseudo(fs_type, "kvm:", NULL, KVMFS_SUPER_MAGIC, mnt); | ||
2437 | } | ||
2438 | |||
2439 | static struct file_system_type kvm_fs_type = { | ||
2440 | .name = "kvmfs", | ||
2441 | .get_sb = kvmfs_get_sb, | ||
2442 | .kill_sb = kill_anon_super, | ||
2443 | }; | ||
2444 | |||
2147 | int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module) | 2445 | int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module) |
2148 | { | 2446 | { |
2149 | int r; | 2447 | int r; |
@@ -2220,8 +2518,16 @@ void kvm_exit_arch(void) | |||
2220 | static __init int kvm_init(void) | 2518 | static __init int kvm_init(void) |
2221 | { | 2519 | { |
2222 | static struct page *bad_page; | 2520 | static struct page *bad_page; |
2223 | int r = 0; | 2521 | int r; |
2522 | |||
2523 | r = register_filesystem(&kvm_fs_type); | ||
2524 | if (r) | ||
2525 | goto out3; | ||
2224 | 2526 | ||
2527 | kvmfs_mnt = kern_mount(&kvm_fs_type); | ||
2528 | r = PTR_ERR(kvmfs_mnt); | ||
2529 | if (IS_ERR(kvmfs_mnt)) | ||
2530 | goto out2; | ||
2225 | kvm_init_debug(); | 2531 | kvm_init_debug(); |
2226 | 2532 | ||
2227 | kvm_init_msr_list(); | 2533 | kvm_init_msr_list(); |
@@ -2234,10 +2540,14 @@ static __init int kvm_init(void) | |||
2234 | bad_page_address = page_to_pfn(bad_page) << PAGE_SHIFT; | 2540 | bad_page_address = page_to_pfn(bad_page) << PAGE_SHIFT; |
2235 | memset(__va(bad_page_address), 0, PAGE_SIZE); | 2541 | memset(__va(bad_page_address), 0, PAGE_SIZE); |
2236 | 2542 | ||
2237 | return r; | 2543 | return 0; |
2238 | 2544 | ||
2239 | out: | 2545 | out: |
2240 | kvm_exit_debug(); | 2546 | kvm_exit_debug(); |
2547 | mntput(kvmfs_mnt); | ||
2548 | out2: | ||
2549 | unregister_filesystem(&kvm_fs_type); | ||
2550 | out3: | ||
2241 | return r; | 2551 | return r; |
2242 | } | 2552 | } |
2243 | 2553 | ||
@@ -2245,6 +2555,8 @@ static __exit void kvm_exit(void) | |||
2245 | { | 2555 | { |
2246 | kvm_exit_debug(); | 2556 | kvm_exit_debug(); |
2247 | __free_page(pfn_to_page(bad_page_address >> PAGE_SHIFT)); | 2557 | __free_page(pfn_to_page(bad_page_address >> PAGE_SHIFT)); |
2558 | mntput(kvmfs_mnt); | ||
2559 | unregister_filesystem(&kvm_fs_type); | ||
2248 | } | 2560 | } |
2249 | 2561 | ||
2250 | module_init(kvm_init) | 2562 | module_init(kvm_init) |
diff --git a/drivers/kvm/kvm_svm.h b/drivers/kvm/kvm_svm.h index 74cc862f4935..624f1ca48657 100644 --- a/drivers/kvm/kvm_svm.h +++ b/drivers/kvm/kvm_svm.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __KVM_SVM_H | 1 | #ifndef __KVM_SVM_H |
2 | #define __KVM_SVM_H | 2 | #define __KVM_SVM_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | ||
4 | #include <linux/types.h> | 5 | #include <linux/types.h> |
5 | #include <linux/list.h> | 6 | #include <linux/list.h> |
6 | #include <asm/msr.h> | 7 | #include <asm/msr.h> |
@@ -18,7 +19,7 @@ static const u32 host_save_msrs[] = { | |||
18 | MSR_IA32_LASTBRANCHTOIP, MSR_IA32_LASTINTFROMIP,MSR_IA32_LASTINTTOIP,*/ | 19 | MSR_IA32_LASTBRANCHTOIP, MSR_IA32_LASTINTFROMIP,MSR_IA32_LASTINTTOIP,*/ |
19 | }; | 20 | }; |
20 | 21 | ||
21 | #define NR_HOST_SAVE_MSRS (sizeof(host_save_msrs) / sizeof(*host_save_msrs)) | 22 | #define NR_HOST_SAVE_MSRS ARRAY_SIZE(host_save_msrs) |
22 | #define NUM_DB_REGS 4 | 23 | #define NUM_DB_REGS 4 |
23 | 24 | ||
24 | struct vcpu_svm { | 25 | struct vcpu_svm { |
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index be793770f31b..a1a93368f314 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -298,18 +298,18 @@ static void rmap_add(struct kvm_vcpu *vcpu, u64 *spte) | |||
298 | if (!is_rmap_pte(*spte)) | 298 | if (!is_rmap_pte(*spte)) |
299 | return; | 299 | return; |
300 | page = pfn_to_page((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT); | 300 | page = pfn_to_page((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT); |
301 | if (!page->private) { | 301 | if (!page_private(page)) { |
302 | rmap_printk("rmap_add: %p %llx 0->1\n", spte, *spte); | 302 | rmap_printk("rmap_add: %p %llx 0->1\n", spte, *spte); |
303 | page->private = (unsigned long)spte; | 303 | set_page_private(page,(unsigned long)spte); |
304 | } else if (!(page->private & 1)) { | 304 | } else if (!(page_private(page) & 1)) { |
305 | rmap_printk("rmap_add: %p %llx 1->many\n", spte, *spte); | 305 | rmap_printk("rmap_add: %p %llx 1->many\n", spte, *spte); |
306 | desc = mmu_alloc_rmap_desc(vcpu); | 306 | desc = mmu_alloc_rmap_desc(vcpu); |
307 | desc->shadow_ptes[0] = (u64 *)page->private; | 307 | desc->shadow_ptes[0] = (u64 *)page_private(page); |
308 | desc->shadow_ptes[1] = spte; | 308 | desc->shadow_ptes[1] = spte; |
309 | page->private = (unsigned long)desc | 1; | 309 | set_page_private(page,(unsigned long)desc | 1); |
310 | } else { | 310 | } else { |
311 | rmap_printk("rmap_add: %p %llx many->many\n", spte, *spte); | 311 | rmap_printk("rmap_add: %p %llx many->many\n", spte, *spte); |
312 | desc = (struct kvm_rmap_desc *)(page->private & ~1ul); | 312 | desc = (struct kvm_rmap_desc *)(page_private(page) & ~1ul); |
313 | while (desc->shadow_ptes[RMAP_EXT-1] && desc->more) | 313 | while (desc->shadow_ptes[RMAP_EXT-1] && desc->more) |
314 | desc = desc->more; | 314 | desc = desc->more; |
315 | if (desc->shadow_ptes[RMAP_EXT-1]) { | 315 | if (desc->shadow_ptes[RMAP_EXT-1]) { |
@@ -337,12 +337,12 @@ static void rmap_desc_remove_entry(struct kvm_vcpu *vcpu, | |||
337 | if (j != 0) | 337 | if (j != 0) |
338 | return; | 338 | return; |
339 | if (!prev_desc && !desc->more) | 339 | if (!prev_desc && !desc->more) |
340 | page->private = (unsigned long)desc->shadow_ptes[0]; | 340 | set_page_private(page,(unsigned long)desc->shadow_ptes[0]); |
341 | else | 341 | else |
342 | if (prev_desc) | 342 | if (prev_desc) |
343 | prev_desc->more = desc->more; | 343 | prev_desc->more = desc->more; |
344 | else | 344 | else |
345 | page->private = (unsigned long)desc->more | 1; | 345 | set_page_private(page,(unsigned long)desc->more | 1); |
346 | mmu_free_rmap_desc(vcpu, desc); | 346 | mmu_free_rmap_desc(vcpu, desc); |
347 | } | 347 | } |
348 | 348 | ||
@@ -356,20 +356,20 @@ static void rmap_remove(struct kvm_vcpu *vcpu, u64 *spte) | |||
356 | if (!is_rmap_pte(*spte)) | 356 | if (!is_rmap_pte(*spte)) |
357 | return; | 357 | return; |
358 | page = pfn_to_page((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT); | 358 | page = pfn_to_page((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT); |
359 | if (!page->private) { | 359 | if (!page_private(page)) { |
360 | printk(KERN_ERR "rmap_remove: %p %llx 0->BUG\n", spte, *spte); | 360 | printk(KERN_ERR "rmap_remove: %p %llx 0->BUG\n", spte, *spte); |
361 | BUG(); | 361 | BUG(); |
362 | } else if (!(page->private & 1)) { | 362 | } else if (!(page_private(page) & 1)) { |
363 | rmap_printk("rmap_remove: %p %llx 1->0\n", spte, *spte); | 363 | rmap_printk("rmap_remove: %p %llx 1->0\n", spte, *spte); |
364 | if ((u64 *)page->private != spte) { | 364 | if ((u64 *)page_private(page) != spte) { |
365 | printk(KERN_ERR "rmap_remove: %p %llx 1->BUG\n", | 365 | printk(KERN_ERR "rmap_remove: %p %llx 1->BUG\n", |
366 | spte, *spte); | 366 | spte, *spte); |
367 | BUG(); | 367 | BUG(); |
368 | } | 368 | } |
369 | page->private = 0; | 369 | set_page_private(page,0); |
370 | } else { | 370 | } else { |
371 | rmap_printk("rmap_remove: %p %llx many->many\n", spte, *spte); | 371 | rmap_printk("rmap_remove: %p %llx many->many\n", spte, *spte); |
372 | desc = (struct kvm_rmap_desc *)(page->private & ~1ul); | 372 | desc = (struct kvm_rmap_desc *)(page_private(page) & ~1ul); |
373 | prev_desc = NULL; | 373 | prev_desc = NULL; |
374 | while (desc) { | 374 | while (desc) { |
375 | for (i = 0; i < RMAP_EXT && desc->shadow_ptes[i]; ++i) | 375 | for (i = 0; i < RMAP_EXT && desc->shadow_ptes[i]; ++i) |
@@ -398,11 +398,11 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn) | |||
398 | BUG_ON(!slot); | 398 | BUG_ON(!slot); |
399 | page = gfn_to_page(slot, gfn); | 399 | page = gfn_to_page(slot, gfn); |
400 | 400 | ||
401 | while (page->private) { | 401 | while (page_private(page)) { |
402 | if (!(page->private & 1)) | 402 | if (!(page_private(page) & 1)) |
403 | spte = (u64 *)page->private; | 403 | spte = (u64 *)page_private(page); |
404 | else { | 404 | else { |
405 | desc = (struct kvm_rmap_desc *)(page->private & ~1ul); | 405 | desc = (struct kvm_rmap_desc *)(page_private(page) & ~1ul); |
406 | spte = desc->shadow_ptes[0]; | 406 | spte = desc->shadow_ptes[0]; |
407 | } | 407 | } |
408 | BUG_ON(!spte); | 408 | BUG_ON(!spte); |
@@ -1218,7 +1218,7 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu) | |||
1218 | INIT_LIST_HEAD(&page_header->link); | 1218 | INIT_LIST_HEAD(&page_header->link); |
1219 | if ((page = alloc_page(GFP_KERNEL)) == NULL) | 1219 | if ((page = alloc_page(GFP_KERNEL)) == NULL) |
1220 | goto error_1; | 1220 | goto error_1; |
1221 | page->private = (unsigned long)page_header; | 1221 | set_page_private(page, (unsigned long)page_header); |
1222 | page_header->page_hpa = (hpa_t)page_to_pfn(page) << PAGE_SHIFT; | 1222 | page_header->page_hpa = (hpa_t)page_to_pfn(page) << PAGE_SHIFT; |
1223 | memset(__va(page_header->page_hpa), 0, PAGE_SIZE); | 1223 | memset(__va(page_header->page_hpa), 0, PAGE_SIZE); |
1224 | list_add(&page_header->link, &vcpu->free_pages); | 1224 | list_add(&page_header->link, &vcpu->free_pages); |
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index b6b90e9e1301..f3bcee904651 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -128,8 +128,10 @@ static int FNAME(walk_addr)(struct guest_walker *walker, | |||
128 | goto access_error; | 128 | goto access_error; |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | if (!(*ptep & PT_ACCESSED_MASK)) | 131 | if (!(*ptep & PT_ACCESSED_MASK)) { |
132 | *ptep |= PT_ACCESSED_MASK; /* avoid rmw */ | 132 | mark_page_dirty(vcpu->kvm, table_gfn); |
133 | *ptep |= PT_ACCESSED_MASK; | ||
134 | } | ||
133 | 135 | ||
134 | if (walker->level == PT_PAGE_TABLE_LEVEL) { | 136 | if (walker->level == PT_PAGE_TABLE_LEVEL) { |
135 | walker->gfn = (*ptep & PT_BASE_ADDR_MASK) | 137 | walker->gfn = (*ptep & PT_BASE_ADDR_MASK) |
@@ -185,6 +187,12 @@ static void FNAME(release_walker)(struct guest_walker *walker) | |||
185 | kunmap_atomic(walker->table, KM_USER0); | 187 | kunmap_atomic(walker->table, KM_USER0); |
186 | } | 188 | } |
187 | 189 | ||
190 | static void FNAME(mark_pagetable_dirty)(struct kvm *kvm, | ||
191 | struct guest_walker *walker) | ||
192 | { | ||
193 | mark_page_dirty(kvm, walker->table_gfn[walker->level - 1]); | ||
194 | } | ||
195 | |||
188 | static void FNAME(set_pte)(struct kvm_vcpu *vcpu, u64 guest_pte, | 196 | static void FNAME(set_pte)(struct kvm_vcpu *vcpu, u64 guest_pte, |
189 | u64 *shadow_pte, u64 access_bits, gfn_t gfn) | 197 | u64 *shadow_pte, u64 access_bits, gfn_t gfn) |
190 | { | 198 | { |
@@ -348,12 +356,15 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu, | |||
348 | } else if (kvm_mmu_lookup_page(vcpu, gfn)) { | 356 | } else if (kvm_mmu_lookup_page(vcpu, gfn)) { |
349 | pgprintk("%s: found shadow page for %lx, marking ro\n", | 357 | pgprintk("%s: found shadow page for %lx, marking ro\n", |
350 | __FUNCTION__, gfn); | 358 | __FUNCTION__, gfn); |
359 | mark_page_dirty(vcpu->kvm, gfn); | ||
360 | FNAME(mark_pagetable_dirty)(vcpu->kvm, walker); | ||
351 | *guest_ent |= PT_DIRTY_MASK; | 361 | *guest_ent |= PT_DIRTY_MASK; |
352 | *write_pt = 1; | 362 | *write_pt = 1; |
353 | return 0; | 363 | return 0; |
354 | } | 364 | } |
355 | mark_page_dirty(vcpu->kvm, gfn); | 365 | mark_page_dirty(vcpu->kvm, gfn); |
356 | *shadow_ent |= PT_WRITABLE_MASK; | 366 | *shadow_ent |= PT_WRITABLE_MASK; |
367 | FNAME(mark_pagetable_dirty)(vcpu->kvm, walker); | ||
357 | *guest_ent |= PT_DIRTY_MASK; | 368 | *guest_ent |= PT_DIRTY_MASK; |
358 | rmap_add(vcpu, shadow_ent); | 369 | rmap_add(vcpu, shadow_ent); |
359 | 370 | ||
@@ -430,9 +441,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
430 | /* | 441 | /* |
431 | * mmio: emulate if accessible, otherwise its a guest fault. | 442 | * mmio: emulate if accessible, otherwise its a guest fault. |
432 | */ | 443 | */ |
433 | if (is_io_pte(*shadow_pte)) { | 444 | if (is_io_pte(*shadow_pte)) |
434 | return 1; | 445 | return 1; |
435 | } | ||
436 | 446 | ||
437 | ++kvm_stat.pf_fixed; | 447 | ++kvm_stat.pf_fixed; |
438 | kvm_mmu_audit(vcpu, "post page fault (fixed)"); | 448 | kvm_mmu_audit(vcpu, "post page fault (fixed)"); |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 83da4ea150a3..3d8ea7ac2ecc 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | ||
18 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
19 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
20 | #include <linux/profile.h> | 21 | #include <linux/profile.h> |
@@ -75,7 +76,7 @@ struct svm_init_data { | |||
75 | 76 | ||
76 | static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; | 77 | static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; |
77 | 78 | ||
78 | #define NUM_MSR_MAPS (sizeof(msrpm_ranges) / sizeof(*msrpm_ranges)) | 79 | #define NUM_MSR_MAPS ARRAY_SIZE(msrpm_ranges) |
79 | #define MSRS_RANGE_SIZE 2048 | 80 | #define MSRS_RANGE_SIZE 2048 |
80 | #define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2) | 81 | #define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2) |
81 | 82 | ||
@@ -485,6 +486,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
485 | 486 | ||
486 | control->intercept = (1ULL << INTERCEPT_INTR) | | 487 | control->intercept = (1ULL << INTERCEPT_INTR) | |
487 | (1ULL << INTERCEPT_NMI) | | 488 | (1ULL << INTERCEPT_NMI) | |
489 | (1ULL << INTERCEPT_SMI) | | ||
488 | /* | 490 | /* |
489 | * selective cr0 intercept bug? | 491 | * selective cr0 intercept bug? |
490 | * 0: 0f 22 d8 mov %eax,%cr3 | 492 | * 0: 0f 22 d8 mov %eax,%cr3 |
@@ -553,7 +555,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
553 | * cr0 val on cpu init should be 0x60000010, we enable cpu | 555 | * cr0 val on cpu init should be 0x60000010, we enable cpu |
554 | * cache by default. the orderly way is to enable cache in bios. | 556 | * cache by default. the orderly way is to enable cache in bios. |
555 | */ | 557 | */ |
556 | save->cr0 = 0x00000010 | CR0_PG_MASK; | 558 | save->cr0 = 0x00000010 | CR0_PG_MASK | CR0_WP_MASK; |
557 | save->cr4 = CR4_PAE_MASK; | 559 | save->cr4 = CR4_PAE_MASK; |
558 | /* rdx = ?? */ | 560 | /* rdx = ?? */ |
559 | } | 561 | } |
@@ -598,10 +600,9 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu) | |||
598 | kfree(vcpu->svm); | 600 | kfree(vcpu->svm); |
599 | } | 601 | } |
600 | 602 | ||
601 | static struct kvm_vcpu *svm_vcpu_load(struct kvm_vcpu *vcpu) | 603 | static void svm_vcpu_load(struct kvm_vcpu *vcpu) |
602 | { | 604 | { |
603 | get_cpu(); | 605 | get_cpu(); |
604 | return vcpu; | ||
605 | } | 606 | } |
606 | 607 | ||
607 | static void svm_vcpu_put(struct kvm_vcpu *vcpu) | 608 | static void svm_vcpu_put(struct kvm_vcpu *vcpu) |
@@ -1042,22 +1043,22 @@ static int io_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1042 | 1043 | ||
1043 | addr_mask = io_adress(vcpu, _in, &kvm_run->io.address); | 1044 | addr_mask = io_adress(vcpu, _in, &kvm_run->io.address); |
1044 | if (!addr_mask) { | 1045 | if (!addr_mask) { |
1045 | printk(KERN_DEBUG "%s: get io address failed\n", __FUNCTION__); | 1046 | printk(KERN_DEBUG "%s: get io address failed\n", |
1047 | __FUNCTION__); | ||
1046 | return 1; | 1048 | return 1; |
1047 | } | 1049 | } |
1048 | 1050 | ||
1049 | if (kvm_run->io.rep) { | 1051 | if (kvm_run->io.rep) { |
1050 | kvm_run->io.count = vcpu->regs[VCPU_REGS_RCX] & addr_mask; | 1052 | kvm_run->io.count |
1053 | = vcpu->regs[VCPU_REGS_RCX] & addr_mask; | ||
1051 | kvm_run->io.string_down = (vcpu->svm->vmcb->save.rflags | 1054 | kvm_run->io.string_down = (vcpu->svm->vmcb->save.rflags |
1052 | & X86_EFLAGS_DF) != 0; | 1055 | & X86_EFLAGS_DF) != 0; |
1053 | } | 1056 | } |
1054 | } else { | 1057 | } else |
1055 | kvm_run->io.value = vcpu->svm->vmcb->save.rax; | 1058 | kvm_run->io.value = vcpu->svm->vmcb->save.rax; |
1056 | } | ||
1057 | return 0; | 1059 | return 0; |
1058 | } | 1060 | } |
1059 | 1061 | ||
1060 | |||
1061 | static int nop_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1062 | static int nop_on_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1062 | { | 1063 | { |
1063 | return 1; | 1064 | return 1; |
@@ -1075,6 +1076,12 @@ static int halt_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1075 | return 0; | 1076 | return 0; |
1076 | } | 1077 | } |
1077 | 1078 | ||
1079 | static int vmmcall_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
1080 | { | ||
1081 | vcpu->svm->vmcb->save.rip += 3; | ||
1082 | return kvm_hypercall(vcpu, kvm_run); | ||
1083 | } | ||
1084 | |||
1078 | static int invalid_op_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1085 | static int invalid_op_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1079 | { | 1086 | { |
1080 | inject_ud(vcpu); | 1087 | inject_ud(vcpu); |
@@ -1275,7 +1282,7 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
1275 | [SVM_EXIT_TASK_SWITCH] = task_switch_interception, | 1282 | [SVM_EXIT_TASK_SWITCH] = task_switch_interception, |
1276 | [SVM_EXIT_SHUTDOWN] = shutdown_interception, | 1283 | [SVM_EXIT_SHUTDOWN] = shutdown_interception, |
1277 | [SVM_EXIT_VMRUN] = invalid_op_interception, | 1284 | [SVM_EXIT_VMRUN] = invalid_op_interception, |
1278 | [SVM_EXIT_VMMCALL] = invalid_op_interception, | 1285 | [SVM_EXIT_VMMCALL] = vmmcall_interception, |
1279 | [SVM_EXIT_VMLOAD] = invalid_op_interception, | 1286 | [SVM_EXIT_VMLOAD] = invalid_op_interception, |
1280 | [SVM_EXIT_VMSAVE] = invalid_op_interception, | 1287 | [SVM_EXIT_VMSAVE] = invalid_op_interception, |
1281 | [SVM_EXIT_STGI] = invalid_op_interception, | 1288 | [SVM_EXIT_STGI] = invalid_op_interception, |
@@ -1297,7 +1304,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1297 | __FUNCTION__, vcpu->svm->vmcb->control.exit_int_info, | 1304 | __FUNCTION__, vcpu->svm->vmcb->control.exit_int_info, |
1298 | exit_code); | 1305 | exit_code); |
1299 | 1306 | ||
1300 | if (exit_code >= sizeof(svm_exit_handlers) / sizeof(*svm_exit_handlers) | 1307 | if (exit_code >= ARRAY_SIZE(svm_exit_handlers) |
1301 | || svm_exit_handlers[exit_code] == 0) { | 1308 | || svm_exit_handlers[exit_code] == 0) { |
1302 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; | 1309 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; |
1303 | printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n", | 1310 | printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n", |
@@ -1668,6 +1675,18 @@ static int is_disabled(void) | |||
1668 | return 0; | 1675 | return 0; |
1669 | } | 1676 | } |
1670 | 1677 | ||
1678 | static void | ||
1679 | svm_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall) | ||
1680 | { | ||
1681 | /* | ||
1682 | * Patch in the VMMCALL instruction: | ||
1683 | */ | ||
1684 | hypercall[0] = 0x0f; | ||
1685 | hypercall[1] = 0x01; | ||
1686 | hypercall[2] = 0xd9; | ||
1687 | hypercall[3] = 0xc3; | ||
1688 | } | ||
1689 | |||
1671 | static struct kvm_arch_ops svm_arch_ops = { | 1690 | static struct kvm_arch_ops svm_arch_ops = { |
1672 | .cpu_has_kvm_support = has_svm, | 1691 | .cpu_has_kvm_support = has_svm, |
1673 | .disabled_by_bios = is_disabled, | 1692 | .disabled_by_bios = is_disabled, |
@@ -1716,6 +1735,7 @@ static struct kvm_arch_ops svm_arch_ops = { | |||
1716 | .run = svm_vcpu_run, | 1735 | .run = svm_vcpu_run, |
1717 | .skip_emulated_instruction = skip_emulated_instruction, | 1736 | .skip_emulated_instruction = skip_emulated_instruction, |
1718 | .vcpu_setup = svm_vcpu_setup, | 1737 | .vcpu_setup = svm_vcpu_setup, |
1738 | .patch_hypercall = svm_patch_hypercall, | ||
1719 | }; | 1739 | }; |
1720 | 1740 | ||
1721 | static int __init svm_init(void) | 1741 | static int __init svm_init(void) |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index fd4e91734388..c07178e61122 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "vmx.h" | 19 | #include "vmx.h" |
20 | #include "kvm_vmx.h" | 20 | #include "kvm_vmx.h" |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | ||
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
23 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
24 | #include <linux/profile.h> | 25 | #include <linux/profile.h> |
@@ -27,7 +28,6 @@ | |||
27 | 28 | ||
28 | #include "segment_descriptor.h" | 29 | #include "segment_descriptor.h" |
29 | 30 | ||
30 | |||
31 | MODULE_AUTHOR("Qumranet"); | 31 | MODULE_AUTHOR("Qumranet"); |
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
@@ -76,7 +76,7 @@ static const u32 vmx_msr_index[] = { | |||
76 | #endif | 76 | #endif |
77 | MSR_EFER, MSR_K6_STAR, | 77 | MSR_EFER, MSR_K6_STAR, |
78 | }; | 78 | }; |
79 | #define NR_VMX_MSR (sizeof(vmx_msr_index) / sizeof(*vmx_msr_index)) | 79 | #define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index) |
80 | 80 | ||
81 | static inline int is_page_fault(u32 intr_info) | 81 | static inline int is_page_fault(u32 intr_info) |
82 | { | 82 | { |
@@ -204,7 +204,7 @@ static void vmcs_write64(unsigned long field, u64 value) | |||
204 | * Switches to specified vcpu, until a matching vcpu_put(), but assumes | 204 | * Switches to specified vcpu, until a matching vcpu_put(), but assumes |
205 | * vcpu mutex is already taken. | 205 | * vcpu mutex is already taken. |
206 | */ | 206 | */ |
207 | static struct kvm_vcpu *vmx_vcpu_load(struct kvm_vcpu *vcpu) | 207 | static void vmx_vcpu_load(struct kvm_vcpu *vcpu) |
208 | { | 208 | { |
209 | u64 phys_addr = __pa(vcpu->vmcs); | 209 | u64 phys_addr = __pa(vcpu->vmcs); |
210 | int cpu; | 210 | int cpu; |
@@ -242,7 +242,6 @@ static struct kvm_vcpu *vmx_vcpu_load(struct kvm_vcpu *vcpu) | |||
242 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); | 242 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); |
243 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ | 243 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ |
244 | } | 244 | } |
245 | return vcpu; | ||
246 | } | 245 | } |
247 | 246 | ||
248 | static void vmx_vcpu_put(struct kvm_vcpu *vcpu) | 247 | static void vmx_vcpu_put(struct kvm_vcpu *vcpu) |
@@ -418,10 +417,9 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | |||
418 | case MSR_IA32_SYSENTER_ESP: | 417 | case MSR_IA32_SYSENTER_ESP: |
419 | vmcs_write32(GUEST_SYSENTER_ESP, data); | 418 | vmcs_write32(GUEST_SYSENTER_ESP, data); |
420 | break; | 419 | break; |
421 | case MSR_IA32_TIME_STAMP_COUNTER: { | 420 | case MSR_IA32_TIME_STAMP_COUNTER: |
422 | guest_write_tsc(data); | 421 | guest_write_tsc(data); |
423 | break; | 422 | break; |
424 | } | ||
425 | default: | 423 | default: |
426 | msr = find_msr_entry(vcpu, msr_index); | 424 | msr = find_msr_entry(vcpu, msr_index); |
427 | if (msr) { | 425 | if (msr) { |
@@ -793,6 +791,9 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
793 | */ | 791 | */ |
794 | static void vmx_set_cr0_no_modeswitch(struct kvm_vcpu *vcpu, unsigned long cr0) | 792 | static void vmx_set_cr0_no_modeswitch(struct kvm_vcpu *vcpu, unsigned long cr0) |
795 | { | 793 | { |
794 | if (!vcpu->rmode.active && !(cr0 & CR0_PE_MASK)) | ||
795 | enter_rmode(vcpu); | ||
796 | |||
796 | vcpu->rmode.active = ((cr0 & CR0_PE_MASK) == 0); | 797 | vcpu->rmode.active = ((cr0 & CR0_PE_MASK) == 0); |
797 | update_exception_bitmap(vcpu); | 798 | update_exception_bitmap(vcpu); |
798 | vmcs_writel(CR0_READ_SHADOW, cr0); | 799 | vmcs_writel(CR0_READ_SHADOW, cr0); |
@@ -1467,6 +1468,18 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1467 | return 0; | 1468 | return 0; |
1468 | } | 1469 | } |
1469 | 1470 | ||
1471 | static void | ||
1472 | vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall) | ||
1473 | { | ||
1474 | /* | ||
1475 | * Patch in the VMCALL instruction: | ||
1476 | */ | ||
1477 | hypercall[0] = 0x0f; | ||
1478 | hypercall[1] = 0x01; | ||
1479 | hypercall[2] = 0xc1; | ||
1480 | hypercall[3] = 0xc3; | ||
1481 | } | ||
1482 | |||
1470 | static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1483 | static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1471 | { | 1484 | { |
1472 | u64 exit_qualification; | 1485 | u64 exit_qualification; |
@@ -1643,6 +1656,12 @@ static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1643 | return 0; | 1656 | return 0; |
1644 | } | 1657 | } |
1645 | 1658 | ||
1659 | static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
1660 | { | ||
1661 | vmcs_writel(GUEST_RIP, vmcs_readl(GUEST_RIP)+3); | ||
1662 | return kvm_hypercall(vcpu, kvm_run); | ||
1663 | } | ||
1664 | |||
1646 | /* | 1665 | /* |
1647 | * The exit handlers return 1 if the exit was handled fully and guest execution | 1666 | * The exit handlers return 1 if the exit was handled fully and guest execution |
1648 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs | 1667 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs |
@@ -1661,6 +1680,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
1661 | [EXIT_REASON_MSR_WRITE] = handle_wrmsr, | 1680 | [EXIT_REASON_MSR_WRITE] = handle_wrmsr, |
1662 | [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window, | 1681 | [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window, |
1663 | [EXIT_REASON_HLT] = handle_halt, | 1682 | [EXIT_REASON_HLT] = handle_halt, |
1683 | [EXIT_REASON_VMCALL] = handle_vmcall, | ||
1664 | }; | 1684 | }; |
1665 | 1685 | ||
1666 | static const int kvm_vmx_max_exit_handlers = | 1686 | static const int kvm_vmx_max_exit_handlers = |
@@ -2062,6 +2082,7 @@ static struct kvm_arch_ops vmx_arch_ops = { | |||
2062 | .run = vmx_vcpu_run, | 2082 | .run = vmx_vcpu_run, |
2063 | .skip_emulated_instruction = skip_emulated_instruction, | 2083 | .skip_emulated_instruction = skip_emulated_instruction, |
2064 | .vcpu_setup = vmx_vcpu_setup, | 2084 | .vcpu_setup = vmx_vcpu_setup, |
2085 | .patch_hypercall = vmx_patch_hypercall, | ||
2065 | }; | 2086 | }; |
2066 | 2087 | ||
2067 | static int __init vmx_init(void) | 2088 | static int __init vmx_init(void) |
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h index 782a6cf158a5..82278f850259 100644 --- a/drivers/net/cxgb3/version.h +++ b/drivers/net/cxgb3/version.h | |||
@@ -35,7 +35,7 @@ | |||
35 | #define DRV_DESC "Chelsio T3 Network Driver" | 35 | #define DRV_DESC "Chelsio T3 Network Driver" |
36 | #define DRV_NAME "cxgb3" | 36 | #define DRV_NAME "cxgb3" |
37 | /* Driver version */ | 37 | /* Driver version */ |
38 | #define DRV_VERSION "1.0" | 38 | #define DRV_VERSION "1.0-ko" |
39 | #define FW_VERSION_MAJOR 3 | 39 | #define FW_VERSION_MAJOR 3 |
40 | #define FW_VERSION_MINOR 2 | 40 | #define FW_VERSION_MINOR 2 |
41 | #endif /* __CHELSIO_VERSION_H */ | 41 | #endif /* __CHELSIO_VERSION_H */ |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 3e045a695dbc..be2ddbb6ef56 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1380,7 +1380,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1380 | 1380 | ||
1381 | pd = pdev->dev.platform_data; | 1381 | pd = pdev->dev.platform_data; |
1382 | if (pd) { | 1382 | if (pd) { |
1383 | if (pd->mac_addr) | 1383 | if (is_valid_ether_addr(pd->mac_addr)) |
1384 | memcpy(dev->dev_addr, pd->mac_addr, 6); | 1384 | memcpy(dev->dev_addr, pd->mac_addr, 6); |
1385 | 1385 | ||
1386 | if (pd->phy_addr || pd->force_phy_addr) | 1386 | if (pd->phy_addr || pd->force_phy_addr) |
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index 7cb0a41c5cb4..7d4e90cf49e8 100644 --- a/drivers/net/mv643xx_eth.h +++ b/drivers/net/mv643xx_eth.h | |||
@@ -9,6 +9,8 @@ | |||
9 | 9 | ||
10 | #include <linux/mv643xx.h> | 10 | #include <linux/mv643xx.h> |
11 | 11 | ||
12 | #include <asm/dma-mapping.h> | ||
13 | |||
12 | /* Checksum offload for Tx works for most packets, but | 14 | /* Checksum offload for Tx works for most packets, but |
13 | * fails if previous packet sent did not use hw csum | 15 | * fails if previous packet sent did not use hw csum |
14 | */ | 16 | */ |
@@ -47,7 +49,7 @@ | |||
47 | #define ETH_HW_IP_ALIGN 2 /* hw aligns IP header */ | 49 | #define ETH_HW_IP_ALIGN 2 /* hw aligns IP header */ |
48 | #define ETH_WRAPPER_LEN (ETH_HW_IP_ALIGN + ETH_HLEN + \ | 50 | #define ETH_WRAPPER_LEN (ETH_HW_IP_ALIGN + ETH_HLEN + \ |
49 | ETH_VLAN_HLEN + ETH_FCS_LEN) | 51 | ETH_VLAN_HLEN + ETH_FCS_LEN) |
50 | #define ETH_RX_SKB_SIZE (dev->mtu + ETH_WRAPPER_LEN + ETH_DMA_ALIGN) | 52 | #define ETH_RX_SKB_SIZE (dev->mtu + ETH_WRAPPER_LEN + dma_get_cache_alignment()) |
51 | 53 | ||
52 | #define ETH_RX_QUEUES_ENABLED (1 << 0) /* use only Q0 for receive */ | 54 | #define ETH_RX_QUEUES_ENABLED (1 << 0) /* use only Q0 for receive */ |
53 | #define ETH_TX_QUEUES_ENABLED (1 << 0) /* use only Q0 for transmit */ | 55 | #define ETH_TX_QUEUES_ENABLED (1 << 0) /* use only Q0 for transmit */ |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 954842e85ab9..b05dc6ed7fb7 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /************************************************************************* | 1 | /************************************************************************* |
2 | * myri10ge.c: Myricom Myri-10G Ethernet driver. | 2 | * myri10ge.c: Myricom Myri-10G Ethernet driver. |
3 | * | 3 | * |
4 | * Copyright (C) 2005, 2006 Myricom, Inc. | 4 | * Copyright (C) 2005 - 2007 Myricom, Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without |
@@ -16,17 +16,17 @@ | |||
16 | * may be used to endorse or promote products derived from this software | 16 | * may be used to endorse or promote products derived from this software |
17 | * without specific prior written permission. | 17 | * without specific prior written permission. |
18 | * | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | * | 30 | * |
31 | * | 31 | * |
32 | * If the eeprom on your board is not recent enough, you will need to get a | 32 | * If the eeprom on your board is not recent enough, you will need to get a |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 2807ef400fb5..81742e4e5610 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -72,6 +72,8 @@ | |||
72 | #define FLASH_SECTOR_SIZE (64 * 1024) | 72 | #define FLASH_SECTOR_SIZE (64 * 1024) |
73 | #define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) | 73 | #define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) |
74 | 74 | ||
75 | #define PHAN_VENDOR_ID 0x4040 | ||
76 | |||
75 | #define RCV_DESC_RINGSIZE \ | 77 | #define RCV_DESC_RINGSIZE \ |
76 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) | 78 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) |
77 | #define STATUS_DESC_RINGSIZE \ | 79 | #define STATUS_DESC_RINGSIZE \ |
@@ -82,7 +84,7 @@ | |||
82 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) | 84 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) |
83 | #define RCV_BUFFSIZE \ | 85 | #define RCV_BUFFSIZE \ |
84 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) | 86 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) |
85 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) | 87 | #define find_diff_among(a,b,range) ((a)<=(b)?((b)-(a)):((b)+(range)-(a))) |
86 | 88 | ||
87 | #define NETXEN_NETDEV_STATUS 0x1 | 89 | #define NETXEN_NETDEV_STATUS 0x1 |
88 | #define NETXEN_RCV_PRODUCER_OFFSET 0 | 90 | #define NETXEN_RCV_PRODUCER_OFFSET 0 |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 6252e9a87278..986ef98db229 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -82,8 +82,7 @@ static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = { | |||
82 | #define NETXEN_NIC_STATS_LEN ARRAY_SIZE(netxen_nic_gstrings_stats) | 82 | #define NETXEN_NIC_STATS_LEN ARRAY_SIZE(netxen_nic_gstrings_stats) |
83 | 83 | ||
84 | static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { | 84 | static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { |
85 | "Register_Test_offline", "EEPROM_Test_offline", | 85 | "Register_Test_on_offline", |
86 | "Interrupt_Test_offline", "Loopback_Test_offline", | ||
87 | "Link_Test_on_offline" | 86 | "Link_Test_on_offline" |
88 | }; | 87 | }; |
89 | 88 | ||
@@ -394,19 +393,12 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
394 | } | 393 | } |
395 | } | 394 | } |
396 | 395 | ||
397 | static void | ||
398 | netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
399 | { | ||
400 | wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC; | ||
401 | /* options can be added depending upon the mode */ | ||
402 | wol->wolopts = 0; | ||
403 | } | ||
404 | |||
405 | static u32 netxen_nic_test_link(struct net_device *dev) | 396 | static u32 netxen_nic_test_link(struct net_device *dev) |
406 | { | 397 | { |
407 | struct netxen_port *port = netdev_priv(dev); | 398 | struct netxen_port *port = netdev_priv(dev); |
408 | struct netxen_adapter *adapter = port->adapter; | 399 | struct netxen_adapter *adapter = port->adapter; |
409 | __u32 status; | 400 | __u32 status; |
401 | int val; | ||
410 | 402 | ||
411 | /* read which mode */ | 403 | /* read which mode */ |
412 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 404 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
@@ -415,11 +407,13 @@ static u32 netxen_nic_test_link(struct net_device *dev) | |||
415 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 407 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
416 | &status) != 0) | 408 | &status) != 0) |
417 | return -EIO; | 409 | return -EIO; |
418 | else | 410 | else { |
419 | return (netxen_get_phy_link(status)); | 411 | val = netxen_get_phy_link(status); |
412 | return !val; | ||
413 | } | ||
420 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | 414 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { |
421 | int val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 415 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
422 | return val == XG_LINK_UP; | 416 | return (val == XG_LINK_UP) ? 0 : 1; |
423 | } | 417 | } |
424 | return -EIO; | 418 | return -EIO; |
425 | } | 419 | } |
@@ -606,100 +600,21 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
606 | 600 | ||
607 | static int netxen_nic_reg_test(struct net_device *dev) | 601 | static int netxen_nic_reg_test(struct net_device *dev) |
608 | { | 602 | { |
609 | struct netxen_port *port = netdev_priv(dev); | 603 | struct netxen_adapter *adapter = netdev_priv(dev); |
610 | struct netxen_adapter *adapter = port->adapter; | 604 | u32 data_read, data_written; |
611 | u32 data_read, data_written, save; | ||
612 | __u32 mode; | ||
613 | |||
614 | /* | ||
615 | * first test the "Read Only" registers by writing which mode | ||
616 | */ | ||
617 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | ||
618 | if (netxen_get_niu_enable_ge(mode)) { /* GB Mode */ | ||
619 | netxen_nic_read_w0(adapter, | ||
620 | NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum), | ||
621 | &data_read); | ||
622 | |||
623 | save = data_read; | ||
624 | if (data_read) | ||
625 | data_written = data_read & NETXEN_NIC_INVALID_DATA; | ||
626 | else | ||
627 | data_written = NETXEN_NIC_INVALID_DATA; | ||
628 | netxen_nic_write_w0(adapter, | ||
629 | NETXEN_NIU_GB_MII_MGMT_STATUS(port-> | ||
630 | portnum), | ||
631 | data_written); | ||
632 | netxen_nic_read_w0(adapter, | ||
633 | NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum), | ||
634 | &data_read); | ||
635 | |||
636 | if (data_written == data_read) { | ||
637 | netxen_nic_write_w0(adapter, | ||
638 | NETXEN_NIU_GB_MII_MGMT_STATUS(port-> | ||
639 | portnum), | ||
640 | save); | ||
641 | |||
642 | return 0; | ||
643 | } | ||
644 | |||
645 | /* netxen_niu_gb_mii_mgmt_indicators is read only */ | ||
646 | netxen_nic_read_w0(adapter, | ||
647 | NETXEN_NIU_GB_MII_MGMT_INDICATE(port-> | ||
648 | portnum), | ||
649 | &data_read); | ||
650 | |||
651 | save = data_read; | ||
652 | if (data_read) | ||
653 | data_written = data_read & NETXEN_NIC_INVALID_DATA; | ||
654 | else | ||
655 | data_written = NETXEN_NIC_INVALID_DATA; | ||
656 | netxen_nic_write_w0(adapter, | ||
657 | NETXEN_NIU_GB_MII_MGMT_INDICATE(port-> | ||
658 | portnum), | ||
659 | data_written); | ||
660 | |||
661 | netxen_nic_read_w0(adapter, | ||
662 | NETXEN_NIU_GB_MII_MGMT_INDICATE(port-> | ||
663 | portnum), | ||
664 | &data_read); | ||
665 | |||
666 | if (data_written == data_read) { | ||
667 | netxen_nic_write_w0(adapter, | ||
668 | NETXEN_NIU_GB_MII_MGMT_INDICATE | ||
669 | (port->portnum), save); | ||
670 | return 0; | ||
671 | } | ||
672 | 605 | ||
673 | /* netxen_niu_gb_interface_status is read only */ | 606 | netxen_nic_read_w0(adapter, NETXEN_PCIX_PH_REG(0), &data_read); |
674 | netxen_nic_read_w0(adapter, | 607 | if ((data_read & 0xffff) != PHAN_VENDOR_ID) |
675 | NETXEN_NIU_GB_INTERFACE_STATUS(port-> | 608 | return 1; |
676 | portnum), | ||
677 | &data_read); | ||
678 | 609 | ||
679 | save = data_read; | 610 | data_written = (u32)0xa5a5a5a5; |
680 | if (data_read) | ||
681 | data_written = data_read & NETXEN_NIC_INVALID_DATA; | ||
682 | else | ||
683 | data_written = NETXEN_NIC_INVALID_DATA; | ||
684 | netxen_nic_write_w0(adapter, | ||
685 | NETXEN_NIU_GB_INTERFACE_STATUS(port-> | ||
686 | portnum), | ||
687 | data_written); | ||
688 | 611 | ||
689 | netxen_nic_read_w0(adapter, | 612 | netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written); |
690 | NETXEN_NIU_GB_INTERFACE_STATUS(port-> | 613 | data_read = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_SCRATCHPAD_TEST)); |
691 | portnum), | 614 | if (data_written != data_read) |
692 | &data_read); | 615 | return 1; |
693 | 616 | ||
694 | if (data_written == data_read) { | 617 | return 0; |
695 | netxen_nic_write_w0(adapter, | ||
696 | NETXEN_NIU_GB_INTERFACE_STATUS | ||
697 | (port->portnum), save); | ||
698 | |||
699 | return 0; | ||
700 | } | ||
701 | } /* GB Mode */ | ||
702 | return 1; | ||
703 | } | 618 | } |
704 | 619 | ||
705 | static int netxen_nic_diag_test_count(struct net_device *dev) | 620 | static int netxen_nic_diag_test_count(struct net_device *dev) |
@@ -713,26 +628,20 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, | |||
713 | { | 628 | { |
714 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ | 629 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ |
715 | /* link test */ | 630 | /* link test */ |
716 | if (!(data[4] = (u64) netxen_nic_test_link(dev))) | 631 | if ((data[1] = (u64) netxen_nic_test_link(dev))) |
717 | eth_test->flags |= ETH_TEST_FL_FAILED; | 632 | eth_test->flags |= ETH_TEST_FL_FAILED; |
718 | 633 | ||
719 | if (netif_running(dev)) | ||
720 | dev->stop(dev); | ||
721 | |||
722 | /* register tests */ | 634 | /* register tests */ |
723 | if (!(data[0] = netxen_nic_reg_test(dev))) | 635 | if ((data[0] = netxen_nic_reg_test(dev))) |
724 | eth_test->flags |= ETH_TEST_FL_FAILED; | 636 | eth_test->flags |= ETH_TEST_FL_FAILED; |
725 | /* other tests pass as of now */ | ||
726 | data[1] = data[2] = data[3] = 1; | ||
727 | if (netif_running(dev)) | ||
728 | dev->open(dev); | ||
729 | } else { /* online tests */ | 637 | } else { /* online tests */ |
730 | /* link test */ | 638 | /* register tests */ |
731 | if (!(data[4] = (u64) netxen_nic_test_link(dev))) | 639 | if((data[0] = netxen_nic_reg_test(dev))) |
732 | eth_test->flags |= ETH_TEST_FL_FAILED; | 640 | eth_test->flags |= ETH_TEST_FL_FAILED; |
733 | 641 | ||
734 | /* other tests pass by default */ | 642 | /* link test */ |
735 | data[0] = data[1] = data[2] = data[3] = 1; | 643 | if ((data[1] = (u64) netxen_nic_test_link(dev))) |
644 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
736 | } | 645 | } |
737 | } | 646 | } |
738 | 647 | ||
@@ -783,7 +692,6 @@ struct ethtool_ops netxen_nic_ethtool_ops = { | |||
783 | .get_drvinfo = netxen_nic_get_drvinfo, | 692 | .get_drvinfo = netxen_nic_get_drvinfo, |
784 | .get_regs_len = netxen_nic_get_regs_len, | 693 | .get_regs_len = netxen_nic_get_regs_len, |
785 | .get_regs = netxen_nic_get_regs, | 694 | .get_regs = netxen_nic_get_regs, |
786 | .get_wol = netxen_nic_get_wol, | ||
787 | .get_link = ethtool_op_get_link, | 695 | .get_link = ethtool_op_get_link, |
788 | .get_eeprom_len = netxen_nic_get_eeprom_len, | 696 | .get_eeprom_len = netxen_nic_get_eeprom_len, |
789 | .get_eeprom = netxen_nic_get_eeprom, | 697 | .get_eeprom = netxen_nic_get_eeprom, |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index deec796f90da..a2877f33fa85 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -508,8 +508,8 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) | |||
508 | void netxen_load_firmware(struct netxen_adapter *adapter) | 508 | void netxen_load_firmware(struct netxen_adapter *adapter) |
509 | { | 509 | { |
510 | int i; | 510 | int i; |
511 | long data, size = 0; | 511 | u32 data, size = 0; |
512 | long flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE; | 512 | u32 flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE; |
513 | u64 off; | 513 | u64 off; |
514 | void __iomem *addr; | 514 | void __iomem *addr; |
515 | 515 | ||
@@ -951,6 +951,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
951 | netxen_nic_driver_name); | 951 | netxen_nic_driver_name); |
952 | return; | 952 | return; |
953 | } | 953 | } |
954 | *ptr32 = le32_to_cpu(*ptr32); | ||
954 | ptr32++; | 955 | ptr32++; |
955 | addr += sizeof(u32); | 956 | addr += sizeof(u32); |
956 | } | 957 | } |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 2f965701a95b..586d32b676af 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -38,13 +38,13 @@ | |||
38 | #include "netxen_nic_phan_reg.h" | 38 | #include "netxen_nic_phan_reg.h" |
39 | 39 | ||
40 | struct crb_addr_pair { | 40 | struct crb_addr_pair { |
41 | long addr; | 41 | u32 addr; |
42 | long data; | 42 | u32 data; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define NETXEN_MAX_CRB_XFORM 60 | 45 | #define NETXEN_MAX_CRB_XFORM 60 |
46 | static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; | 46 | static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; |
47 | #define NETXEN_ADDR_ERROR ((unsigned long ) 0xffffffff ) | 47 | #define NETXEN_ADDR_ERROR (0xffffffff) |
48 | 48 | ||
49 | #define crb_addr_transform(name) \ | 49 | #define crb_addr_transform(name) \ |
50 | crb_addr_xform[NETXEN_HW_PX_MAP_CRB_##name] = \ | 50 | crb_addr_xform[NETXEN_HW_PX_MAP_CRB_##name] = \ |
@@ -252,10 +252,10 @@ void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | |||
252 | * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB | 252 | * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB |
253 | * address to external PCI CRB address. | 253 | * address to external PCI CRB address. |
254 | */ | 254 | */ |
255 | unsigned long netxen_decode_crb_addr(unsigned long addr) | 255 | u32 netxen_decode_crb_addr(u32 addr) |
256 | { | 256 | { |
257 | int i; | 257 | int i; |
258 | unsigned long base_addr, offset, pci_base; | 258 | u32 base_addr, offset, pci_base; |
259 | 259 | ||
260 | crb_addr_transform_setup(); | 260 | crb_addr_transform_setup(); |
261 | 261 | ||
@@ -756,7 +756,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
756 | int n, i; | 756 | int n, i; |
757 | int init_delay = 0; | 757 | int init_delay = 0; |
758 | struct crb_addr_pair *buf; | 758 | struct crb_addr_pair *buf; |
759 | unsigned long off; | 759 | u32 off; |
760 | 760 | ||
761 | /* resetall */ | 761 | /* resetall */ |
762 | status = netxen_nic_get_board_info(adapter); | 762 | status = netxen_nic_get_board_info(adapter); |
@@ -813,14 +813,13 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
813 | if (verbose) | 813 | if (verbose) |
814 | printk("%s: PCI: 0x%08x == 0x%08x\n", | 814 | printk("%s: PCI: 0x%08x == 0x%08x\n", |
815 | netxen_nic_driver_name, (unsigned int) | 815 | netxen_nic_driver_name, (unsigned int) |
816 | netxen_decode_crb_addr((unsigned long) | 816 | netxen_decode_crb_addr(addr), val); |
817 | addr), val); | ||
818 | } | 817 | } |
819 | for (i = 0; i < n; i++) { | 818 | for (i = 0; i < n; i++) { |
820 | 819 | ||
821 | off = netxen_decode_crb_addr((unsigned long)buf[i].addr); | 820 | off = netxen_decode_crb_addr(buf[i].addr); |
822 | if (off == NETXEN_ADDR_ERROR) { | 821 | if (off == NETXEN_ADDR_ERROR) { |
823 | printk(KERN_ERR"CRB init value out of range %lx\n", | 822 | printk(KERN_ERR"CRB init value out of range %x\n", |
824 | buf[i].addr); | 823 | buf[i].addr); |
825 | continue; | 824 | continue; |
826 | } | 825 | } |
@@ -927,6 +926,10 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) | |||
927 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) | 926 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) |
928 | { | 927 | { |
929 | if (adapter->dummy_dma.addr) { | 928 | if (adapter->dummy_dma.addr) { |
929 | writel(0, NETXEN_CRB_NORMALIZE(adapter, | ||
930 | CRB_HOST_DUMMY_BUF_ADDR_HI)); | ||
931 | writel(0, NETXEN_CRB_NORMALIZE(adapter, | ||
932 | CRB_HOST_DUMMY_BUF_ADDR_LO)); | ||
930 | pci_free_consistent(adapter->ahw.pdev, | 933 | pci_free_consistent(adapter->ahw.pdev, |
931 | NETXEN_HOST_DUMMY_DMA_SIZE, | 934 | NETXEN_HOST_DUMMY_DMA_SIZE, |
932 | adapter->dummy_dma.addr, | 935 | adapter->dummy_dma.addr, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 1bf3d494b92f..7d2525e76abb 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -42,8 +42,6 @@ | |||
42 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | 44 | ||
45 | #define PHAN_VENDOR_ID 0x4040 | ||
46 | |||
47 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 45 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
48 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
49 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); | 47 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); |
@@ -379,6 +377,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
379 | netdev->tx_timeout = netxen_tx_timeout; | 377 | netdev->tx_timeout = netxen_tx_timeout; |
380 | netdev->watchdog_timeo = HZ; | 378 | netdev->watchdog_timeo = HZ; |
381 | 379 | ||
380 | netxen_nic_change_mtu(netdev, netdev->mtu); | ||
381 | |||
382 | SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); | 382 | SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); |
383 | netdev->poll = netxen_nic_poll; | 383 | netdev->poll = netxen_nic_poll; |
384 | netdev->weight = NETXEN_NETDEV_WEIGHT; | 384 | netdev->weight = NETXEN_NETDEV_WEIGHT; |
@@ -434,13 +434,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
434 | adapter->port_count++; | 434 | adapter->port_count++; |
435 | adapter->port[i] = port; | 435 | adapter->port[i] = port; |
436 | } | 436 | } |
437 | #ifndef CONFIG_PPC64 | ||
438 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 437 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
439 | netxen_pinit_from_rom(adapter, 0); | 438 | netxen_pinit_from_rom(adapter, 0); |
440 | udelay(500); | 439 | udelay(500); |
441 | netxen_load_firmware(adapter); | 440 | netxen_load_firmware(adapter); |
442 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 441 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
443 | #endif | ||
444 | /* | 442 | /* |
445 | * delay a while to ensure that the Pegs are up & running. | 443 | * delay a while to ensure that the Pegs are up & running. |
446 | * Otherwise, we might see some flaky behaviour. | 444 | * Otherwise, we might see some flaky behaviour. |
@@ -529,12 +527,13 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
529 | free_irq(adapter->irq, adapter); | 527 | free_irq(adapter->irq, adapter); |
530 | netxen_nic_stop_all_ports(adapter); | 528 | netxen_nic_stop_all_ports(adapter); |
531 | /* leave the hw in the same state as reboot */ | 529 | /* leave the hw in the same state as reboot */ |
532 | netxen_pinit_from_rom(adapter, 0); | ||
533 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 530 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
531 | netxen_pinit_from_rom(adapter, 0); | ||
532 | udelay(500); | ||
534 | netxen_load_firmware(adapter); | 533 | netxen_load_firmware(adapter); |
535 | netxen_free_adapter_offload(adapter); | 534 | netxen_free_adapter_offload(adapter); |
536 | 535 | ||
537 | udelay(500); /* Delay for a while to drain the DMA engines */ | 536 | mdelay(1000); /* Delay for a while to drain the DMA engines */ |
538 | for (i = 0; i < adapter->port_count; i++) { | 537 | for (i = 0; i < adapter->port_count; i++) { |
539 | port = adapter->port[i]; | 538 | port = adapter->port[i]; |
540 | if ((port) && (port->netdev)) { | 539 | if ((port) && (port->netdev)) { |
@@ -545,7 +544,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
545 | 544 | ||
546 | if ((adapter->flags & NETXEN_NIC_MSI_ENABLED)) | 545 | if ((adapter->flags & NETXEN_NIC_MSI_ENABLED)) |
547 | pci_disable_msi(pdev); | 546 | pci_disable_msi(pdev); |
548 | pci_set_drvdata(pdev, NULL); | ||
549 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) | 547 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) |
550 | netxen_free_hw_resources(adapter); | 548 | netxen_free_hw_resources(adapter); |
551 | 549 | ||
@@ -556,6 +554,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
556 | 554 | ||
557 | pci_release_regions(pdev); | 555 | pci_release_regions(pdev); |
558 | pci_disable_device(pdev); | 556 | pci_disable_device(pdev); |
557 | pci_set_drvdata(pdev, NULL); | ||
559 | 558 | ||
560 | for (ctxid = 0; ctxid < MAX_RCV_CTX; ++ctxid) { | 559 | for (ctxid = 0; ctxid < MAX_RCV_CTX; ++ctxid) { |
561 | recv_ctx = &adapter->recv_ctx[ctxid]; | 560 | recv_ctx = &adapter->recv_ctx[ctxid]; |
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index 7879f855af0b..0c7c94328b7f 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
@@ -102,6 +102,9 @@ | |||
102 | #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) | 102 | #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) |
103 | #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) | 103 | #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) |
104 | 104 | ||
105 | /* used for ethtool tests */ | ||
106 | #define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) | ||
107 | |||
105 | /* | 108 | /* |
106 | * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address | 109 | * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address |
107 | * which can be read by the Phantom host to get producer/consumer indexes from | 110 | * which can be read by the Phantom host to get producer/consumer indexes from |
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 3a14d19b72bd..d3f65dab306c 100755 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -2210,7 +2210,7 @@ static int ql_send_map(struct ql3_adapter *qdev, | |||
2210 | { | 2210 | { |
2211 | struct oal *oal; | 2211 | struct oal *oal; |
2212 | struct oal_entry *oal_entry; | 2212 | struct oal_entry *oal_entry; |
2213 | int len = skb->len; | 2213 | int len = skb_headlen(skb); |
2214 | dma_addr_t map; | 2214 | dma_addr_t map; |
2215 | int err; | 2215 | int err; |
2216 | int completed_segs, i; | 2216 | int completed_segs, i; |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index eae2b63951f1..e3a7e3ceab77 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -1703,19 +1703,6 @@ static void tc35815_chip_init(struct net_device *dev) | |||
1703 | spin_unlock_irqrestore(&lp->lock, flags); | 1703 | spin_unlock_irqrestore(&lp->lock, flags); |
1704 | } | 1704 | } |
1705 | 1705 | ||
1706 | /* XXX */ | ||
1707 | void | ||
1708 | tc35815_killall(void) | ||
1709 | { | ||
1710 | struct net_device *dev; | ||
1711 | |||
1712 | for (dev = root_tc35815_dev; dev; dev = ((struct tc35815_local *)dev->priv)->next_module) { | ||
1713 | if (dev->flags&IFF_UP){ | ||
1714 | dev->stop(dev); | ||
1715 | } | ||
1716 | } | ||
1717 | } | ||
1718 | |||
1719 | static struct pci_driver tc35815_driver = { | 1706 | static struct pci_driver tc35815_driver = { |
1720 | .name = TC35815_MODULE_NAME, | 1707 | .name = TC35815_MODULE_NAME, |
1721 | .probe = tc35815_probe, | 1708 | .probe = tc35815_probe, |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 9d67f11422ec..dacea4fd3337 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -63,7 +63,7 @@ MODULE_PARM_DESC (debug, "de2104x bitmapped message enable number"); | |||
63 | 63 | ||
64 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ | 64 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ |
65 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ | 65 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ |
66 | || defined(__sparc_) || defined(__ia64__) \ | 66 | || defined(__sparc__) || defined(__ia64__) \ |
67 | || defined(__sh__) || defined(__mips__) | 67 | || defined(__sh__) || defined(__mips__) |
68 | static int rx_copybreak = 1518; | 68 | static int rx_copybreak = 1518; |
69 | #else | 69 | #else |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 5a35354aa523..e3774a522372 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -67,7 +67,7 @@ const char * const medianame[32] = { | |||
67 | 67 | ||
68 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ | 68 | /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ |
69 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ | 69 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ |
70 | || defined(__sparc_) || defined(__ia64__) \ | 70 | || defined(__sparc__) || defined(__ia64__) \ |
71 | || defined(__sh__) || defined(__mips__) | 71 | || defined(__sh__) || defined(__mips__) |
72 | static int rx_copybreak = 1518; | 72 | static int rx_copybreak = 1518; |
73 | #else | 73 | #else |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 73c831a3b747..e594af46ff05 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -2733,8 +2733,9 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2733 | * dangling pins on the second core. Be careful | 2733 | * dangling pins on the second core. Be careful |
2734 | * and ignore these cores here. | 2734 | * and ignore these cores here. |
2735 | */ | 2735 | */ |
2736 | if (bcm->pci_dev->device != 0x4324) { | 2736 | if (1 /*bcm->pci_dev->device != 0x4324*/ ) { |
2737 | dprintk(KERN_INFO PFX "Ignoring additional 802.11 core.\n"); | 2737 | /* TODO: A PHY */ |
2738 | dprintk(KERN_INFO PFX "Ignoring additional 802.11a core.\n"); | ||
2738 | continue; | 2739 | continue; |
2739 | } | 2740 | } |
2740 | } | 2741 | } |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 7e228aded4c2..46ba1235f03a 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -1026,8 +1026,7 @@ int radeon_screen_blank(struct radeonfb_info *rinfo, int blank, int mode_switch) | |||
1026 | break; | 1026 | break; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | /* let fbcon do a soft blank for us */ | 1029 | return 0; |
1030 | return (blank == FB_BLANK_NORMAL) ? -EINVAL : 0; | ||
1031 | } | 1030 | } |
1032 | 1031 | ||
1033 | static int radeonfb_blank (int blank, struct fb_info *info) | 1032 | static int radeonfb_blank (int blank, struct fb_info *info) |
diff --git a/include/asm-mips/ds1742.h b/include/asm-mips/ds1742.h deleted file mode 100644 index c2f2c32da637..000000000000 --- a/include/asm-mips/ds1742.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2006 by Ralf Baechle (ralf@linux-mips.org) | ||
7 | */ | ||
8 | #ifndef _ASM_DS1742_H | ||
9 | #define _ASM_DS1742_H | ||
10 | |||
11 | #include <ds1742.h> | ||
12 | |||
13 | #endif /* _ASM_DS1742_H */ | ||
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h index baf412967afa..c50e68ffa3af 100644 --- a/include/asm-mips/jmr3927/jmr3927.h +++ b/include/asm-mips/jmr3927/jmr3927.h | |||
@@ -179,12 +179,6 @@ static inline int jmr3927_have_isac(void) | |||
179 | #define jmr3927_have_nvram() \ | 179 | #define jmr3927_have_nvram() \ |
180 | ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT) | 180 | ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT) |
181 | 181 | ||
182 | /* NVRAM macro */ | ||
183 | #define jmr3927_nvram_in(ofs) \ | ||
184 | jmr3927_ioc_reg_in(JMR3927_IOC_NVRAMB_ADDR + ((ofs) << 1)) | ||
185 | #define jmr3927_nvram_out(d, ofs) \ | ||
186 | jmr3927_ioc_reg_out(d, JMR3927_IOC_NVRAMB_ADDR + ((ofs) << 1)) | ||
187 | |||
188 | /* LED macro */ | 182 | /* LED macro */ |
189 | #define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) | 183 | #define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) |
190 | #define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR) | 184 | #define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR) |
diff --git a/include/asm-mips/lasat/lasat.h b/include/asm-mips/lasat/lasat.h index 181afc5c0f1d..42077e367a5b 100644 --- a/include/asm-mips/lasat/lasat.h +++ b/include/asm-mips/lasat/lasat.h | |||
@@ -237,8 +237,6 @@ static inline void lasat_ndelay(unsigned int ns) | |||
237 | __delay(ns / lasat_ndelay_divider); | 237 | __delay(ns / lasat_ndelay_divider); |
238 | } | 238 | } |
239 | 239 | ||
240 | extern void (* prom_printf)(const char *fmt, ...); | ||
241 | |||
242 | #endif /* !defined (_LANGUAGE_ASSEMBLY) */ | 240 | #endif /* !defined (_LANGUAGE_ASSEMBLY) */ |
243 | 241 | ||
244 | #define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef | 242 | #define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef |
diff --git a/include/asm-mips/mach-atlas/mc146818rtc.h b/include/asm-mips/mach-atlas/mc146818rtc.h index a73a5698420c..51d337e1bbd1 100644 --- a/include/asm-mips/mach-atlas/mc146818rtc.h +++ b/include/asm-mips/mach-atlas/mc146818rtc.h | |||
@@ -55,6 +55,6 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr) | |||
55 | 55 | ||
56 | #define RTC_ALWAYS_BCD 0 | 56 | #define RTC_ALWAYS_BCD 0 |
57 | 57 | ||
58 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) | 58 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900) |
59 | 59 | ||
60 | #endif /* __ASM_MACH_ATLAS_MC146818RTC_H */ | 60 | #endif /* __ASM_MACH_ATLAS_MC146818RTC_H */ |
diff --git a/include/asm-mips/mach-generic/dma-coherence.h b/include/asm-mips/mach-generic/dma-coherence.h index df71822fd27b..76e04e7feb84 100644 --- a/include/asm-mips/mach-generic/dma-coherence.h +++ b/include/asm-mips/mach-generic/dma-coherence.h | |||
@@ -11,22 +11,24 @@ | |||
11 | 11 | ||
12 | struct device; | 12 | struct device; |
13 | 13 | ||
14 | static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) | 14 | static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, |
15 | size_t size) | ||
15 | { | 16 | { |
16 | return virt_to_phys(addr); | 17 | return virt_to_phys(addr); |
17 | } | 18 | } |
18 | 19 | ||
19 | static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) | 20 | static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, |
21 | struct page *page) | ||
20 | { | 22 | { |
21 | return page_to_phys(page); | 23 | return page_to_phys(page); |
22 | } | 24 | } |
23 | 25 | ||
24 | static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) | 26 | static inline unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) |
25 | { | 27 | { |
26 | return dma_addr; | 28 | return dma_addr; |
27 | } | 29 | } |
28 | 30 | ||
29 | static void plat_unmap_dma_mem(dma_addr_t dma_addr) | 31 | static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) |
30 | { | 32 | { |
31 | } | 33 | } |
32 | 34 | ||
diff --git a/include/asm-mips/mach-generic/mc146818rtc.h b/include/asm-mips/mach-generic/mc146818rtc.h index 90c2e6f77faa..0b9a942f079d 100644 --- a/include/asm-mips/mach-generic/mc146818rtc.h +++ b/include/asm-mips/mach-generic/mc146818rtc.h | |||
@@ -30,7 +30,7 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr) | |||
30 | #define RTC_ALWAYS_BCD 1 | 30 | #define RTC_ALWAYS_BCD 1 |
31 | 31 | ||
32 | #ifndef mc146818_decode_year | 32 | #ifndef mc146818_decode_year |
33 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) | 33 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900) |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #endif /* __ASM_MACH_GENERIC_MC146818RTC_H */ | 36 | #endif /* __ASM_MACH_GENERIC_MC146818RTC_H */ |
diff --git a/include/asm-mips/mach-jmr3927/ds1742.h b/include/asm-mips/mach-jmr3927/ds1742.h deleted file mode 100644 index 8a8fef6d07fa..000000000000 --- a/include/asm-mips/mach-jmr3927/ds1742.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2003, 06 by Ralf Baechle | ||
7 | */ | ||
8 | #ifndef __ASM_MACH_JMR3927_DS1742_H | ||
9 | #define __ASM_MACH_JMR3927_DS1742_H | ||
10 | |||
11 | #include <asm/jmr3927/jmr3927.h> | ||
12 | |||
13 | #define rtc_read(reg) (jmr3927_nvram_in(reg)) | ||
14 | #define rtc_write(data, reg) (jmr3927_nvram_out((data),(reg))) | ||
15 | |||
16 | #endif /* __ASM_MACH_JMR3927_DS1742_H */ | ||
diff --git a/include/asm-mips/mach-jmr3927/mangle-port.h b/include/asm-mips/mach-jmr3927/mangle-port.h new file mode 100644 index 000000000000..501a202631b5 --- /dev/null +++ b/include/asm-mips/mach-jmr3927/mangle-port.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef __ASM_MACH_JMR3927_MANGLE_PORT_H | ||
2 | #define __ASM_MACH_JMR3927_MANGLE_PORT_H | ||
3 | |||
4 | extern unsigned long __swizzle_addr_b(unsigned long port); | ||
5 | #define __swizzle_addr_w(port) (port) | ||
6 | #define __swizzle_addr_l(port) (port) | ||
7 | #define __swizzle_addr_q(port) (port) | ||
8 | |||
9 | #define ioswabb(a,x) (x) | ||
10 | #define __mem_ioswabb(a,x) (x) | ||
11 | #define ioswabw(a,x) le16_to_cpu(x) | ||
12 | #define __mem_ioswabw(a,x) (x) | ||
13 | #define ioswabl(a,x) le32_to_cpu(x) | ||
14 | #define __mem_ioswabl(a,x) (x) | ||
15 | #define ioswabq(a,x) le64_to_cpu(x) | ||
16 | #define __mem_ioswabq(a,x) (x) | ||
17 | |||
18 | #endif /* __ASM_MACH_JMR3927_MANGLE_PORT_H */ | ||
diff --git a/include/asm-mips/mach-mips/mc146818rtc.h b/include/asm-mips/mach-mips/mc146818rtc.h index 6730ba066576..ea612f37f614 100644 --- a/include/asm-mips/mach-mips/mc146818rtc.h +++ b/include/asm-mips/mach-mips/mc146818rtc.h | |||
@@ -43,6 +43,6 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr) | |||
43 | 43 | ||
44 | #define RTC_ALWAYS_BCD 0 | 44 | #define RTC_ALWAYS_BCD 0 |
45 | 45 | ||
46 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) | 46 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900) |
47 | 47 | ||
48 | #endif /* __ASM_MACH_MALTA_MC146818RTC_H */ | 48 | #endif /* __ASM_MACH_MALTA_MC146818RTC_H */ |
diff --git a/include/asm-mips/mach-rm/mc146818rtc.h b/include/asm-mips/mach-rm/mc146818rtc.h index d37ae68dc6a3..145bce096fe9 100644 --- a/include/asm-mips/mach-rm/mc146818rtc.h +++ b/include/asm-mips/mach-rm/mc146818rtc.h | |||
@@ -7,11 +7,15 @@ | |||
7 | * | 7 | * |
8 | * RTC routines for PC style attached Dallas chip with ARC epoch. | 8 | * RTC routines for PC style attached Dallas chip with ARC epoch. |
9 | */ | 9 | */ |
10 | #ifndef __ASM_MACH_RM200_MC146818RTC_H | 10 | #ifndef __ASM_MACH_RM_MC146818RTC_H |
11 | #define __ASM_MACH_RM200_MC146818RTC_H | 11 | #define __ASM_MACH_RM_MC146818RTC_H |
12 | 12 | ||
13 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
14 | #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900) | ||
15 | #else | ||
13 | #define mc146818_decode_year(year) ((year) + 1980) | 16 | #define mc146818_decode_year(year) ((year) + 1980) |
17 | #endif | ||
14 | 18 | ||
15 | #include_next <mc146818rtc.h> | 19 | #include_next <mc146818rtc.h> |
16 | 20 | ||
17 | #endif /* __ASM_MACH_RM200_MC146818RTC_H */ | 21 | #endif /* __ASM_MACH_RM_MC146818RTC_H */ |
diff --git a/include/asm-mips/mips-boards/prom.h b/include/asm-mips/mips-boards/prom.h index 7bf6f5f6ab9c..daaf9f98fc63 100644 --- a/include/asm-mips/mips-boards/prom.h +++ b/include/asm-mips/mips-boards/prom.h | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | extern char *prom_getcmdline(void); | 29 | extern char *prom_getcmdline(void); |
30 | extern char *prom_getenv(char *name); | 30 | extern char *prom_getenv(char *name); |
31 | extern void setup_prom_printf(int tty_no); | ||
32 | extern void prom_printf(char *fmt, ...); | ||
33 | extern void prom_init_cmdline(void); | 31 | extern void prom_init_cmdline(void); |
34 | extern void prom_meminit(void); | 32 | extern void prom_meminit(void); |
35 | extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem); | 33 | extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem); |
diff --git a/include/asm-mips/sgialib.h b/include/asm-mips/sgialib.h index 73f097315502..bfce5c786f1c 100644 --- a/include/asm-mips/sgialib.h +++ b/include/asm-mips/sgialib.h | |||
@@ -33,9 +33,6 @@ extern int prom_flags; | |||
33 | extern void prom_putchar(char c); | 33 | extern void prom_putchar(char c); |
34 | extern char prom_getchar(void); | 34 | extern char prom_getchar(void); |
35 | 35 | ||
36 | /* Generic printf() using ARCS console I/O. */ | ||
37 | extern void prom_printf(char *fmt, ...); | ||
38 | |||
39 | /* Memory descriptor management. */ | 36 | /* Memory descriptor management. */ |
40 | #define PROM_MAX_PMEMBLOCKS 32 | 37 | #define PROM_MAX_PMEMBLOCKS 32 |
41 | struct prom_pmemblock { | 38 | struct prom_pmemblock { |
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h index 2ba6988ddc8e..dfb29e13bce0 100644 --- a/include/asm-mips/sibyte/sb1250.h +++ b/include/asm-mips/sibyte/sb1250.h | |||
@@ -57,8 +57,6 @@ extern void bcm1480_mask_irq(int cpu, int irq); | |||
57 | extern void bcm1480_unmask_irq(int cpu, int irq); | 57 | extern void bcm1480_unmask_irq(int cpu, int irq); |
58 | extern void bcm1480_smp_finish(void); | 58 | extern void bcm1480_smp_finish(void); |
59 | 59 | ||
60 | extern void prom_printf(char *fmt, ...); | ||
61 | |||
62 | #define AT_spin \ | 60 | #define AT_spin \ |
63 | __asm__ __volatile__ ( \ | 61 | __asm__ __volatile__ ( \ |
64 | ".set noat\n" \ | 62 | ".set noat\n" \ |
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h index 38644742f011..a750c688408b 100644 --- a/include/asm-sparc/pci.h +++ b/include/asm-sparc/pci.h | |||
@@ -165,6 +165,9 @@ static inline int pci_dma_mapping_error(dma_addr_t dma_addr) | |||
165 | return (dma_addr == PCI_DMA_ERROR_CODE); | 165 | return (dma_addr == PCI_DMA_ERROR_CODE); |
166 | } | 166 | } |
167 | 167 | ||
168 | struct device_node; | ||
169 | extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); | ||
170 | |||
168 | #endif /* __KERNEL__ */ | 171 | #endif /* __KERNEL__ */ |
169 | 172 | ||
170 | /* generic pci stuff */ | 173 | /* generic pci stuff */ |
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h index 86c13dccea3d..274868d8598d 100644 --- a/include/asm-sparc/prom.h +++ b/include/asm-sparc/prom.h | |||
@@ -91,6 +91,7 @@ extern struct property *of_find_property(struct device_node *np, | |||
91 | extern int of_device_is_compatible(struct device_node *device, const char *); | 91 | extern int of_device_is_compatible(struct device_node *device, const char *); |
92 | extern void *of_get_property(struct device_node *node, const char *name, | 92 | extern void *of_get_property(struct device_node *node, const char *name, |
93 | int *lenp); | 93 | int *lenp); |
94 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | ||
94 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 95 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
95 | extern int of_getintprop_default(struct device_node *np, | 96 | extern int of_getintprop_default(struct device_node *np, |
96 | const char *name, | 97 | const char *name, |
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index ca6560288ae8..b14a725b430d 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h | |||
@@ -312,6 +312,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | |||
312 | return PCI_IRQ_NONE; | 312 | return PCI_IRQ_NONE; |
313 | } | 313 | } |
314 | 314 | ||
315 | struct device_node; | ||
316 | extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); | ||
317 | |||
315 | #endif /* __KERNEL__ */ | 318 | #endif /* __KERNEL__ */ |
316 | 319 | ||
317 | #endif /* __SPARC64_PCI_H */ | 320 | #endif /* __SPARC64_PCI_H */ |
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index 99671ed6625d..0eca2d98627f 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -99,6 +99,7 @@ extern struct property *of_find_property(struct device_node *np, | |||
99 | extern int of_device_is_compatible(struct device_node *device, const char *); | 99 | extern int of_device_is_compatible(struct device_node *device, const char *); |
100 | extern void *of_get_property(struct device_node *node, const char *name, | 100 | extern void *of_get_property(struct device_node *node, const char *name, |
101 | int *lenp); | 101 | int *lenp); |
102 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | ||
102 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 103 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
103 | extern int of_getintprop_default(struct device_node *np, | 104 | extern int of_getintprop_default(struct device_node *np, |
104 | const char *name, | 105 | const char *name, |
diff --git a/include/linux/ds1742rtc.h b/include/linux/ds1742rtc.h deleted file mode 100644 index a83cdd1cafc9..000000000000 --- a/include/linux/ds1742rtc.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * ds1742rtc.h - register definitions for the Real-Time-Clock / CMOS RAM | ||
3 | * | ||
4 | * Copyright (C) 1999-2001 Toshiba Corporation | ||
5 | * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org) | ||
6 | * | ||
7 | * Permission is hereby granted to copy, modify and redistribute this code | ||
8 | * in terms of the GNU Library General Public License, Version 2 or later, | ||
9 | * at your option. | ||
10 | */ | ||
11 | #ifndef __LINUX_DS1742RTC_H | ||
12 | #define __LINUX_DS1742RTC_H | ||
13 | |||
14 | #include <asm/ds1742.h> | ||
15 | |||
16 | #define RTC_BRAM_SIZE 0x800 | ||
17 | #define RTC_OFFSET 0x7f8 | ||
18 | |||
19 | /* | ||
20 | * Register summary | ||
21 | */ | ||
22 | #define RTC_CONTROL (RTC_OFFSET + 0) | ||
23 | #define RTC_CENTURY (RTC_OFFSET + 0) | ||
24 | #define RTC_SECONDS (RTC_OFFSET + 1) | ||
25 | #define RTC_MINUTES (RTC_OFFSET + 2) | ||
26 | #define RTC_HOURS (RTC_OFFSET + 3) | ||
27 | #define RTC_DAY (RTC_OFFSET + 4) | ||
28 | #define RTC_DATE (RTC_OFFSET + 5) | ||
29 | #define RTC_MONTH (RTC_OFFSET + 6) | ||
30 | #define RTC_YEAR (RTC_OFFSET + 7) | ||
31 | |||
32 | #define RTC_CENTURY_MASK 0x3f | ||
33 | #define RTC_SECONDS_MASK 0x7f | ||
34 | #define RTC_DAY_MASK 0x07 | ||
35 | |||
36 | /* | ||
37 | * Bits in the Control/Century register | ||
38 | */ | ||
39 | #define RTC_WRITE 0x80 | ||
40 | #define RTC_READ 0x40 | ||
41 | |||
42 | /* | ||
43 | * Bits in the Seconds register | ||
44 | */ | ||
45 | #define RTC_STOP 0x80 | ||
46 | |||
47 | /* | ||
48 | * Bits in the Day register | ||
49 | */ | ||
50 | #define RTC_BATT_FLAG 0x80 | ||
51 | #define RTC_FREQ_TEST 0x40 | ||
52 | |||
53 | #endif /* __LINUX_DS1742RTC_H */ | ||
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index f3604593fb76..275354ffa1cb 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <asm/types.h> | 11 | #include <asm/types.h> |
12 | #include <linux/ioctl.h> | 12 | #include <linux/ioctl.h> |
13 | 13 | ||
14 | #define KVM_API_VERSION 3 | 14 | #define KVM_API_VERSION 4 |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Architectural interrupt line count, and the size of the bitmap needed | 17 | * Architectural interrupt line count, and the size of the bitmap needed |
@@ -52,11 +52,10 @@ enum kvm_exit_reason { | |||
52 | /* for KVM_RUN */ | 52 | /* for KVM_RUN */ |
53 | struct kvm_run { | 53 | struct kvm_run { |
54 | /* in */ | 54 | /* in */ |
55 | __u32 vcpu; | ||
56 | __u32 emulated; /* skip current instruction */ | 55 | __u32 emulated; /* skip current instruction */ |
57 | __u32 mmio_completed; /* mmio request completed */ | 56 | __u32 mmio_completed; /* mmio request completed */ |
58 | __u8 request_interrupt_window; | 57 | __u8 request_interrupt_window; |
59 | __u8 padding1[3]; | 58 | __u8 padding1[7]; |
60 | 59 | ||
61 | /* out */ | 60 | /* out */ |
62 | __u32 exit_type; | 61 | __u32 exit_type; |
@@ -111,10 +110,6 @@ struct kvm_run { | |||
111 | 110 | ||
112 | /* for KVM_GET_REGS and KVM_SET_REGS */ | 111 | /* for KVM_GET_REGS and KVM_SET_REGS */ |
113 | struct kvm_regs { | 112 | struct kvm_regs { |
114 | /* in */ | ||
115 | __u32 vcpu; | ||
116 | __u32 padding; | ||
117 | |||
118 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ | 113 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ |
119 | __u64 rax, rbx, rcx, rdx; | 114 | __u64 rax, rbx, rcx, rdx; |
120 | __u64 rsi, rdi, rsp, rbp; | 115 | __u64 rsi, rdi, rsp, rbp; |
@@ -141,10 +136,6 @@ struct kvm_dtable { | |||
141 | 136 | ||
142 | /* for KVM_GET_SREGS and KVM_SET_SREGS */ | 137 | /* for KVM_GET_SREGS and KVM_SET_SREGS */ |
143 | struct kvm_sregs { | 138 | struct kvm_sregs { |
144 | /* in */ | ||
145 | __u32 vcpu; | ||
146 | __u32 padding; | ||
147 | |||
148 | /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ | 139 | /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ |
149 | struct kvm_segment cs, ds, es, fs, gs, ss; | 140 | struct kvm_segment cs, ds, es, fs, gs, ss; |
150 | struct kvm_segment tr, ldt; | 141 | struct kvm_segment tr, ldt; |
@@ -163,8 +154,8 @@ struct kvm_msr_entry { | |||
163 | 154 | ||
164 | /* for KVM_GET_MSRS and KVM_SET_MSRS */ | 155 | /* for KVM_GET_MSRS and KVM_SET_MSRS */ |
165 | struct kvm_msrs { | 156 | struct kvm_msrs { |
166 | __u32 vcpu; | ||
167 | __u32 nmsrs; /* number of msrs in entries */ | 157 | __u32 nmsrs; /* number of msrs in entries */ |
158 | __u32 pad; | ||
168 | 159 | ||
169 | struct kvm_msr_entry entries[0]; | 160 | struct kvm_msr_entry entries[0]; |
170 | }; | 161 | }; |
@@ -179,8 +170,6 @@ struct kvm_msr_list { | |||
179 | struct kvm_translation { | 170 | struct kvm_translation { |
180 | /* in */ | 171 | /* in */ |
181 | __u64 linear_address; | 172 | __u64 linear_address; |
182 | __u32 vcpu; | ||
183 | __u32 padding; | ||
184 | 173 | ||
185 | /* out */ | 174 | /* out */ |
186 | __u64 physical_address; | 175 | __u64 physical_address; |
@@ -193,7 +182,6 @@ struct kvm_translation { | |||
193 | /* for KVM_INTERRUPT */ | 182 | /* for KVM_INTERRUPT */ |
194 | struct kvm_interrupt { | 183 | struct kvm_interrupt { |
195 | /* in */ | 184 | /* in */ |
196 | __u32 vcpu; | ||
197 | __u32 irq; | 185 | __u32 irq; |
198 | }; | 186 | }; |
199 | 187 | ||
@@ -206,8 +194,8 @@ struct kvm_breakpoint { | |||
206 | /* for KVM_DEBUG_GUEST */ | 194 | /* for KVM_DEBUG_GUEST */ |
207 | struct kvm_debug_guest { | 195 | struct kvm_debug_guest { |
208 | /* int */ | 196 | /* int */ |
209 | __u32 vcpu; | ||
210 | __u32 enabled; | 197 | __u32 enabled; |
198 | __u32 pad; | ||
211 | struct kvm_breakpoint breakpoints[4]; | 199 | struct kvm_breakpoint breakpoints[4]; |
212 | __u32 singlestep; | 200 | __u32 singlestep; |
213 | }; | 201 | }; |
@@ -224,20 +212,36 @@ struct kvm_dirty_log { | |||
224 | 212 | ||
225 | #define KVMIO 0xAE | 213 | #define KVMIO 0xAE |
226 | 214 | ||
215 | /* | ||
216 | * ioctls for /dev/kvm fds: | ||
217 | */ | ||
227 | #define KVM_GET_API_VERSION _IO(KVMIO, 1) | 218 | #define KVM_GET_API_VERSION _IO(KVMIO, 1) |
219 | #define KVM_CREATE_VM _IO(KVMIO, 2) /* returns a VM fd */ | ||
220 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 15, struct kvm_msr_list) | ||
221 | |||
222 | /* | ||
223 | * ioctls for VM fds | ||
224 | */ | ||
225 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 10, struct kvm_memory_region) | ||
226 | /* | ||
227 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns | ||
228 | * a vcpu fd. | ||
229 | */ | ||
230 | #define KVM_CREATE_VCPU _IOW(KVMIO, 11, int) | ||
231 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 12, struct kvm_dirty_log) | ||
232 | |||
233 | /* | ||
234 | * ioctls for vcpu fds | ||
235 | */ | ||
228 | #define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run) | 236 | #define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run) |
229 | #define KVM_GET_REGS _IOWR(KVMIO, 3, struct kvm_regs) | 237 | #define KVM_GET_REGS _IOR(KVMIO, 3, struct kvm_regs) |
230 | #define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs) | 238 | #define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs) |
231 | #define KVM_GET_SREGS _IOWR(KVMIO, 5, struct kvm_sregs) | 239 | #define KVM_GET_SREGS _IOR(KVMIO, 5, struct kvm_sregs) |
232 | #define KVM_SET_SREGS _IOW(KVMIO, 6, struct kvm_sregs) | 240 | #define KVM_SET_SREGS _IOW(KVMIO, 6, struct kvm_sregs) |
233 | #define KVM_TRANSLATE _IOWR(KVMIO, 7, struct kvm_translation) | 241 | #define KVM_TRANSLATE _IOWR(KVMIO, 7, struct kvm_translation) |
234 | #define KVM_INTERRUPT _IOW(KVMIO, 8, struct kvm_interrupt) | 242 | #define KVM_INTERRUPT _IOW(KVMIO, 8, struct kvm_interrupt) |
235 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) | 243 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) |
236 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 10, struct kvm_memory_region) | ||
237 | #define KVM_CREATE_VCPU _IOW(KVMIO, 11, int /* vcpu_slot */) | ||
238 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 12, struct kvm_dirty_log) | ||
239 | #define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) | 244 | #define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) |
240 | #define KVM_SET_MSRS _IOWR(KVMIO, 14, struct kvm_msrs) | 245 | #define KVM_SET_MSRS _IOW(KVMIO, 14, struct kvm_msrs) |
241 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 15, struct kvm_msr_list) | ||
242 | 246 | ||
243 | #endif | 247 | #endif |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h new file mode 100644 index 000000000000..3b292565a693 --- /dev/null +++ b/include/linux/kvm_para.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef __LINUX_KVM_PARA_H | ||
2 | #define __LINUX_KVM_PARA_H | ||
3 | |||
4 | /* | ||
5 | * Guest OS interface for KVM paravirtualization | ||
6 | * | ||
7 | * Note: this interface is totally experimental, and is certain to change | ||
8 | * as we make progress. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * Per-VCPU descriptor area shared between guest and host. Writable to | ||
13 | * both guest and host. Registered with the host by the guest when | ||
14 | * a guest acknowledges paravirtual mode. | ||
15 | * | ||
16 | * NOTE: all addresses are guest-physical addresses (gpa), to make it | ||
17 | * easier for the hypervisor to map between the various addresses. | ||
18 | */ | ||
19 | struct kvm_vcpu_para_state { | ||
20 | /* | ||
21 | * API version information for compatibility. If there's any support | ||
22 | * mismatch (too old host trying to execute too new guest) then | ||
23 | * the host will deny entry into paravirtual mode. Any other | ||
24 | * combination (new host + old guest and new host + new guest) | ||
25 | * is supposed to work - new host versions will support all old | ||
26 | * guest API versions. | ||
27 | */ | ||
28 | u32 guest_version; | ||
29 | u32 host_version; | ||
30 | u32 size; | ||
31 | u32 ret; | ||
32 | |||
33 | /* | ||
34 | * The address of the vm exit instruction (VMCALL or VMMCALL), | ||
35 | * which the host will patch according to the CPU model the | ||
36 | * VM runs on: | ||
37 | */ | ||
38 | u64 hypercall_gpa; | ||
39 | |||
40 | } __attribute__ ((aligned(PAGE_SIZE))); | ||
41 | |||
42 | #define KVM_PARA_API_VERSION 1 | ||
43 | |||
44 | /* | ||
45 | * This is used for an RDMSR's ECX parameter to probe for a KVM host. | ||
46 | * Hopefully no CPU vendor will use up this number. This is placed well | ||
47 | * out of way of the typical space occupied by CPU vendors' MSR indices, | ||
48 | * and we think (or at least hope) it wont be occupied in the future | ||
49 | * either. | ||
50 | */ | ||
51 | #define MSR_KVM_API_MAGIC 0x87655678 | ||
52 | |||
53 | #define KVM_EINVAL 1 | ||
54 | |||
55 | /* | ||
56 | * Hypercall calling convention: | ||
57 | * | ||
58 | * Each hypercall may have 0-6 parameters. | ||
59 | * | ||
60 | * 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-1 | ||
61 | * | ||
62 | * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention | ||
63 | * order: RDI, RSI, RDX, RCX, R8, R9. | ||
64 | * | ||
65 | * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP. | ||
66 | * (the first 3 are according to the gcc regparm calling convention) | ||
67 | * | ||
68 | * No registers are clobbered by the hypercall, except that the | ||
69 | * return value is in RAX. | ||
70 | */ | ||
71 | #define __NR_hypercalls 0 | ||
72 | |||
73 | #endif | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 045fb3a72d59..e3f32f3189b2 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -403,8 +403,7 @@ struct ata_host { | |||
403 | void *private_data; | 403 | void *private_data; |
404 | const struct ata_port_operations *ops; | 404 | const struct ata_port_operations *ops; |
405 | unsigned long flags; | 405 | unsigned long flags; |
406 | int simplex_claimed; /* Keep seperate in case we | 406 | struct ata_port *simplex_claimed; /* channel owning the DMA */ |
407 | ever need to do this locked */ | ||
408 | struct ata_port *ports[0]; | 407 | struct ata_port *ports[0]; |
409 | }; | 408 | }; |
410 | 409 | ||
@@ -719,10 +718,12 @@ extern void ata_std_ports(struct ata_ioports *ioaddr); | |||
719 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 718 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
720 | unsigned int n_ports); | 719 | unsigned int n_ports); |
721 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 720 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
721 | #ifdef CONFIG_PM | ||
722 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); | 722 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
723 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); | 723 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); |
724 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | 724 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
725 | extern int ata_pci_device_resume(struct pci_dev *pdev); | 725 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
726 | #endif | ||
726 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 727 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
727 | #endif /* CONFIG_PCI */ | 728 | #endif /* CONFIG_PCI */ |
728 | extern int ata_device_add(const struct ata_probe_ent *ent); | 729 | extern int ata_device_add(const struct ata_probe_ent *ent); |
@@ -748,10 +749,12 @@ extern int sata_scr_write(struct ata_port *ap, int reg, u32 val); | |||
748 | extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); | 749 | extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); |
749 | extern int ata_port_online(struct ata_port *ap); | 750 | extern int ata_port_online(struct ata_port *ap); |
750 | extern int ata_port_offline(struct ata_port *ap); | 751 | extern int ata_port_offline(struct ata_port *ap); |
752 | #ifdef CONFIG_PM | ||
751 | extern int ata_scsi_device_resume(struct scsi_device *); | 753 | extern int ata_scsi_device_resume(struct scsi_device *); |
752 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); | 754 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); |
753 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); | 755 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
754 | extern void ata_host_resume(struct ata_host *host); | 756 | extern void ata_host_resume(struct ata_host *host); |
757 | #endif | ||
755 | extern int ata_ratelimit(void); | 758 | extern int ata_ratelimit(void); |
756 | extern int ata_busy_sleep(struct ata_port *ap, | 759 | extern int ata_busy_sleep(struct ata_port *ap, |
757 | unsigned long timeout_pat, unsigned long timeout); | 760 | unsigned long timeout_pat, unsigned long timeout); |
diff --git a/include/linux/magic.h b/include/linux/magic.h index b32c8a97fcec..a9c6567fe70c 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define HPFS_SUPER_MAGIC 0xf995e849 | 13 | #define HPFS_SUPER_MAGIC 0xf995e849 |
14 | #define ISOFS_SUPER_MAGIC 0x9660 | 14 | #define ISOFS_SUPER_MAGIC 0x9660 |
15 | #define JFFS2_SUPER_MAGIC 0x72b6 | 15 | #define JFFS2_SUPER_MAGIC 0x72b6 |
16 | #define KVMFS_SUPER_MAGIC 0x19700426 | ||
16 | 17 | ||
17 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ | 18 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ |
18 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ | 19 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ |
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h index aff25c000abf..e7d4da1cc9fa 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h | |||
@@ -1288,7 +1288,6 @@ struct mv64xxx_i2c_pdata { | |||
1288 | #define MV643XX_ETH_NAME "mv643xx_eth" | 1288 | #define MV643XX_ETH_NAME "mv643xx_eth" |
1289 | 1289 | ||
1290 | struct mv643xx_eth_platform_data { | 1290 | struct mv643xx_eth_platform_data { |
1291 | char *mac_addr; /* pointer to mac address */ | ||
1292 | u16 force_phy_addr; /* force override if phy_addr == 0 */ | 1291 | u16 force_phy_addr; /* force override if phy_addr == 0 */ |
1293 | u16 phy_addr; | 1292 | u16 phy_addr; |
1294 | 1293 | ||
@@ -1303,6 +1302,7 @@ struct mv643xx_eth_platform_data { | |||
1303 | u32 tx_sram_size; | 1302 | u32 tx_sram_size; |
1304 | u32 rx_sram_addr; | 1303 | u32 rx_sram_addr; |
1305 | u32 rx_sram_size; | 1304 | u32 rx_sram_size; |
1305 | u8 mac_addr[6]; /* mac address if non-zero*/ | ||
1306 | }; | 1306 | }; |
1307 | 1307 | ||
1308 | #endif /* __ASM_MV643XX_H */ | 1308 | #endif /* __ASM_MV643XX_H */ |