- updated uml patches.
[opensuse:kernel-source.git] / patches.arch / linux-2.6.0-test3-ia64-030815
1 diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig
2 --- a/arch/ia64/Kconfig Fri Aug 15 18:23:28 2003
3 +++ b/arch/ia64/Kconfig Fri Aug 15 18:23:28 2003
4 @@ -648,6 +648,33 @@
5           keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
6           unless you really know what this hack does.
7  
8 +config IA64_EARLY_PRINTK
9 +       bool "Early printk support"
10 +       depends on DEBUG_KERNEL && !IA64_GENERIC
11 +       help
12 +         Selecting this option uses the VGA screen or serial console for
13 +         printk() output before the consoles are initialised.  It is useful
14 +         for debugging problems early in the boot process, but only if you
15 +         have a suitable VGA/serial console attached.  If you're unsure,
16 +         select N.
17 +
18 +config IA64_EARLY_PRINTK_UART
19 +       bool "Early printk on MMIO serial port"
20 +       depends on IA64_EARLY_PRINTK
21 +
22 +config IA64_EARLY_PRINTK_UART_BASE
23 +       hex "UART MMIO base address"
24 +       depends on IA64_EARLY_PRINTK_UART
25 +       default "ff5e0000"
26 +
27 +config IA64_EARLY_PRINTK_VGA
28 +       bool "Early printk on VGA"
29 +       depends on IA64_EARLY_PRINTK
30 +
31 +config IA64_EARLY_PRINTK_SGI_SN
32 +       bool "Early printk on SGI SN serial console"
33 +       depends on IA64_EARLY_PRINTK && (IA64_GENERIC || IA64_SGI_SN2)
34 +
35  config DEBUG_SLAB
36         bool "Debug memory allocations"
37         depends on DEBUG_KERNEL
38 diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
39 --- a/arch/ia64/ia32/sys_ia32.c Fri Aug 15 18:23:27 2003
40 +++ b/arch/ia64/ia32/sys_ia32.c Fri Aug 15 18:23:27 2003
41 @@ -1374,7 +1374,7 @@
42                         break;
43                 old_fs = get_fs();
44                 set_fs(KERNEL_DS);
45 -               err = sys_msgctl(first, second, &m64);
46 +               err = sys_msgctl(first, second, (struct msqid_ds *)&m64);
47                 set_fs(old_fs);
48                 break;
49  
50 @@ -1382,7 +1382,7 @@
51               case MSG_STAT:
52                 old_fs = get_fs();
53                 set_fs(KERNEL_DS);
54 -               err = sys_msgctl(first, second, (void *) &m64);
55 +               err = sys_msgctl(first, second, (struct msqid_ds *)&m64);
56                 set_fs(old_fs);
57  
58                 if (version == IPC_64) {
59 @@ -1518,7 +1518,7 @@
60                         break;
61                 old_fs = get_fs();
62                 set_fs(KERNEL_DS);
63 -               err = sys_shmctl(first, second, &s64);
64 +               err = sys_shmctl(first, second, (struct shmid_ds *)&s64);
65                 set_fs(old_fs);
66                 break;
67  
68 @@ -1526,7 +1526,7 @@
69               case SHM_STAT:
70                 old_fs = get_fs();
71                 set_fs(KERNEL_DS);
72 -               err = sys_shmctl(first, second, (void *) &s64);
73 +               err = sys_shmctl(first, second, (struct shmid_ds *)&s64);
74                 set_fs(old_fs);
75                 if (err < 0)
76                         break;
77 @@ -1693,6 +1693,10 @@
78         }
79         return i;
80  }
81 +
82 +asmlinkage long
83 +compat_sys_wait4 (compat_pid_t pid, compat_uint_t * stat_addr, int options,
84 +                struct compat_rusage *ru);
85  
86  asmlinkage long
87  sys32_waitpid (int pid, unsigned int *stat_addr, int options)
88 diff -Nru a/arch/ia64/kernel/efivars.c b/arch/ia64/kernel/efivars.c
89 --- a/arch/ia64/kernel/efivars.c        Fri Aug 15 18:23:27 2003
90 +++ b/arch/ia64/kernel/efivars.c        Fri Aug 15 18:23:27 2003
91 @@ -168,13 +168,12 @@
92                          efi_char16_t *variable_name,
93                          efi_guid_t *vendor_guid)
94  {
95 -
96         int i, short_name_size = variable_name_size / sizeof(efi_char16_t) + 38;
97         char *short_name;
98         efivar_entry_t *new_efivar;
99  
100 -        short_name = kmalloc(short_name_size+1, GFP_KERNEL);
101 -        new_efivar = kmalloc(sizeof(efivar_entry_t), GFP_KERNEL);
102 +       short_name = kmalloc(short_name_size+1, GFP_KERNEL);
103 +       new_efivar = kmalloc(sizeof(efivar_entry_t), GFP_KERNEL);
104  
105         if (!short_name || !new_efivar)  {
106                 if (short_name)        kfree(short_name);
107 @@ -210,9 +209,9 @@
108         new_efivar->entry->read_proc = efivar_read;
109         new_efivar->entry->write_proc = efivar_write;
110  
111 -        spin_lock(&efivars_lock);
112 -        list_add(&new_efivar->list, &efivar_list);
113 -        spin_unlock(&efivars_lock);
114 +       spin_lock(&efivars_lock);
115 +       list_add(&new_efivar->list, &efivar_list);
116 +       spin_unlock(&efivars_lock);
117  
118         return 0;
119  }
120 @@ -283,7 +282,7 @@
121         if (!var_data)
122                 return -ENOMEM;
123         if (copy_from_user(var_data, buffer, size)) {
124 -                kfree(var_data);
125 +               kfree(var_data);
126                 return -EFAULT;
127         }
128  
129 @@ -344,12 +343,73 @@
130         return size;
131  }
132  
133 +/*
134 + * The EFI system table contains pointers to the SAL system table,
135 + * HCDP, ACPI, SMBIOS, etc, that may be useful to applications.
136 + */
137 +static ssize_t
138 +efi_systab_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
139 +{
140 +       void *data;
141 +       u8 *proc_buffer;
142 +       ssize_t size, length;
143 +       int ret;
144 +       const int max_nr_entries = 7;   /* num ptrs to tables we could expose */
145 +       const int max_line_len = 80;
146 +
147 +       if (!efi.systab)
148 +               return 0;
149  
150 +       proc_buffer = kmalloc(max_nr_entries * max_line_len, GFP_KERNEL);
151 +       if (!proc_buffer)
152 +               return -ENOMEM;
153 +
154 +       length = 0;
155 +       if (efi.mps)
156 +               length += sprintf(proc_buffer + length, "MPS=0x%lx\n", __pa(efi.mps));
157 +       if (efi.acpi20)
158 +               length += sprintf(proc_buffer + length, "ACPI20=0x%lx\n", __pa(efi.acpi20));
159 +       if (efi.acpi)
160 +               length += sprintf(proc_buffer + length, "ACPI=0x%lx\n", __pa(efi.acpi));
161 +       if (efi.smbios)
162 +               length += sprintf(proc_buffer + length, "SMBIOS=0x%lx\n", __pa(efi.smbios));
163 +       if (efi.sal_systab)
164 +               length += sprintf(proc_buffer + length, "SAL=0x%lx\n", __pa(efi.sal_systab));
165 +       if (efi.hcdp)
166 +               length += sprintf(proc_buffer + length, "HCDP=0x%lx\n", __pa(efi.hcdp));
167 +       if (efi.boot_info)
168 +               length += sprintf(proc_buffer + length, "BOOTINFO=0x%lx\n", __pa(efi.boot_info));
169 +
170 +       if (*ppos >= length) {
171 +               ret = 0;
172 +               goto out;
173 +       }
174 +
175 +       data = proc_buffer + file->f_pos;
176 +       size = length - file->f_pos;
177 +       if (size > count)
178 +               size = count;
179 +       if (copy_to_user(buffer, data, size)) {
180 +               ret = -EFAULT;
181 +               goto out;
182 +       }
183 +
184 +       *ppos += size;
185 +       ret = size;
186 +
187 +out:
188 +       kfree(proc_buffer);
189 +       return ret;
190 +}
191 +
192 +static struct proc_dir_entry *efi_systab_entry;
193 +static struct file_operations efi_systab_fops = {
194 +       .read = efi_systab_read,
195 +};
196  
197  static int __init
198  efivars_init(void)
199  {
200 -
201         efi_status_t status;
202         efi_guid_t vendor_guid;
203         efi_char16_t *variable_name = kmalloc(1024, GFP_KERNEL);
204 @@ -357,13 +417,17 @@
205  
206         printk(KERN_INFO "EFI Variables Facility v%s\n", EFIVARS_VERSION);
207  
208 -        /* Since efi.c happens before procfs is available,
209 -           we create the directory here if it doesn't
210 -           already exist.  There's probably a better way
211 -           to do this.
212 -        */
213 -        if (!efi_dir)
214 -                efi_dir = proc_mkdir("efi", NULL);
215 +       /* Since efi.c happens before procfs is available,
216 +          we create the directory here if it doesn't
217 +          already exist.  There's probably a better way
218 +          to do this.
219 +       */
220 +       if (!efi_dir)
221 +               efi_dir = proc_mkdir("efi", NULL);
222 +
223 +       efi_systab_entry = create_proc_entry("systab", S_IRUSR | S_IRGRP, efi_dir);
224 +       if (efi_systab_entry)
225 +               efi_systab_entry->proc_fops = &efi_systab_fops;
226  
227         efi_vars_dir = proc_mkdir("vars", efi_dir);
228  
229 @@ -407,7 +471,9 @@
230         struct list_head *pos, *n;
231         efivar_entry_t *efivar;
232  
233 -        spin_lock(&efivars_lock);
234 +       spin_lock(&efivars_lock);
235 +       if (efi_systab_entry)
236 +               remove_proc_entry(efi_systab_entry->name, efi_dir);
237         list_for_each_safe(pos, n, &efivar_list) {
238                 efivar = efivar_entry(pos);
239                 remove_proc_entry(efivar->entry->name, efi_vars_dir);
240 diff -Nru a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
241 --- a/arch/ia64/kernel/entry.S  Fri Aug 15 18:23:27 2003
242 +++ b/arch/ia64/kernel/entry.S  Fri Aug 15 18:23:27 2003
243 @@ -113,7 +113,7 @@
244   *           u64 tls)
245   */
246  GLOBAL_ENTRY(sys_clone2)
247 -       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
248 +       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(6)
249         alloc r16=ar.pfs,6,2,6,0
250         DO_SAVE_SWITCH_STACK
251         adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
252 @@ -142,7 +142,7 @@
253   *     Deprecated.  Use sys_clone2() instead.
254   */
255  GLOBAL_ENTRY(sys_clone)
256 -       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
257 +       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
258         alloc r16=ar.pfs,5,2,6,0
259         DO_SAVE_SWITCH_STACK
260         adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
261 diff -Nru a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
262 --- a/arch/ia64/kernel/mca.c    Fri Aug 15 18:23:27 2003
263 +++ b/arch/ia64/kernel/mca.c    Fri Aug 15 18:23:27 2003
264 @@ -115,6 +115,7 @@
265         .name =         "mca_wkup"
266  };
267  
268 +#ifdef CONFIG_ACPI
269  static struct irqaction mca_cpe_irqaction = {
270         .handler =      ia64_mca_cpe_int_handler,
271         .flags =        SA_INTERRUPT,
272 @@ -126,6 +127,7 @@
273         .flags =        SA_INTERRUPT,
274         .name =         "cpe_poll"
275  };
276 +#endif /* CONFIG_ACPI */
277  
278  #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */
279  #define MIN_CPE_POLL_INTERVAL (2*60*HZ)  /* 2 minutes */
280 @@ -434,6 +436,7 @@
281  
282  device_initcall(ia64_mca_check_errors);
283  
284 +#ifdef CONFIG_ACPI
285  /*
286   * ia64_mca_register_cpev
287   *
288 @@ -458,6 +461,7 @@
289         IA64_MCA_DEBUG("ia64_mca_platform_init: corrected platform error "
290                        "vector %#x setup and enabled\n", cpev);
291  }
292 +#endif /* CONFIG_ACPI */
293  
294  #endif /* PLATFORM_MCA_HANDLERS */
295  
296 @@ -750,6 +754,7 @@
297         /* Setup the MCA wakeup interrupt vector */
298         register_percpu_irq(IA64_MCA_WAKEUP_VECTOR, &mca_wkup_irqaction);
299  
300 +#ifdef CONFIG_ACPI
301         /* Setup the CPE interrupt vector */
302         {
303                 irq_desc_t *desc;
304 @@ -767,6 +772,7 @@
305                         ia64_mca_register_cpev(cpev);
306                 }
307         }
308 +#endif
309  
310         /* Initialize the areas set aside by the OS to buffer the
311          * platform/processor error states for MCA/INIT/CMC
312 @@ -1279,11 +1285,13 @@
313         init_timer(&cpe_poll_timer);
314         cpe_poll_timer.function = ia64_mca_cpe_poll;
315  
316 +#ifdef CONFIG_ACPI
317         /* If platform doesn't support CPEI, get the timer going. */
318         if (acpi_request_vector(ACPI_INTERRUPT_CPEI) < 0 && cpe_poll_enabled) {
319                 register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);
320                 ia64_mca_cpe_poll(0UL);
321         }
322 +#endif
323  
324         return 0;
325  }
326 @@ -1398,6 +1406,9 @@
327  
328         // SAL will tell us the maximum size of any error record of this type
329         max_size = ia64_sal_get_state_info_size(sal_info_type);
330 +       if (!max_size)
331 +               /* alloc_bootmem() doesn't like zero-sized allocations! */
332 +               return;
333  
334         // set up OS data structures to hold error info
335         IA64_LOG_ALLOCATE(sal_info_type, max_size);
336 diff -Nru a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
337 --- a/arch/ia64/kernel/process.c        Fri Aug 15 18:23:27 2003
338 +++ b/arch/ia64/kernel/process.c        Fri Aug 15 18:23:27 2003
339 @@ -45,7 +45,7 @@
340  ia64_do_show_stack (struct unw_frame_info *info, void *arg)
341  {
342         unsigned long ip, sp, bsp;
343 -       char buf[80];                   /* don't make it so big that it overflows the stack! */
344 +       char buf[128];                  /* don't make it so big that it overflows the stack! */
345  
346         printk("\nCall Trace:\n");
347         do {
348 @@ -55,7 +55,9 @@
349  
350                 unw_get_sp(info, &sp);
351                 unw_get_bsp(info, &bsp);
352 -               snprintf(buf, sizeof(buf), " [<%016lx>] %%s\n\t\t\t\tsp=%016lx bsp=%016lx\n",
353 +               snprintf(buf, sizeof(buf),
354 +                        " [<%016lx>] %%s\n"
355 +                        "                                sp=%016lx bsp=%016lx\n",
356                          ip, sp, bsp);
357                 print_symbol(buf, ip);
358         } while (unw_unwind(info) >= 0);
359 diff -Nru a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
360 --- a/drivers/acpi/pci_irq.c    Fri Aug 15 18:23:27 2003
361 +++ b/drivers/acpi/pci_irq.c    Fri Aug 15 18:23:27 2003
362 @@ -24,6 +24,8 @@
363   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
364   */
365  
366 +#include <linux/config.h>
367 +
368  #include <linux/kernel.h>
369  #include <linux/module.h>
370  #include <linux/init.h>
371 @@ -35,6 +37,9 @@
372  #include <linux/acpi.h>
373  #ifdef CONFIG_X86_IO_APIC
374  #include <asm/mpspec.h>
375 +#endif
376 +#ifdef CONFIG_IOSAPIC
377 +# include <asm/iosapic.h>
378  #endif
379  #include <acpi/acpi_bus.h>
380  #include <acpi/acpi_drivers.h>
381 diff -Nru a/drivers/acpi/tables.c b/drivers/acpi/tables.c
382 --- a/drivers/acpi/tables.c     Fri Aug 15 18:23:27 2003
383 +++ b/drivers/acpi/tables.c     Fri Aug 15 18:23:27 2003
384 @@ -256,10 +256,17 @@
385  
386         /* Map the DSDT header via the pointer in the FADT */
387         if (id == ACPI_DSDT) {
388 -               struct acpi_table_fadt *fadt = (struct acpi_table_fadt *) *header;
389 +               struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header;
390 +
391 +               if (fadt->header.revision == 3 && fadt->Xdsdt) {
392 +                       *header = (void *) __acpi_map_table(fadt->Xdsdt,
393 +                                       sizeof(struct acpi_table_header));
394 +               } else if (fadt->V1_dsdt) {
395 +                       *header = (void *) __acpi_map_table(fadt->V1_dsdt,
396 +                                       sizeof(struct acpi_table_header));
397 +               } else
398 +                       *header = 0;
399  
400 -               *header = (void *) __acpi_map_table(fadt->dsdt_addr,
401 -                               sizeof(struct acpi_table_header));
402                 if (!*header) {
403                         printk(KERN_WARNING PREFIX "Unable to map DSDT\n");
404                         return -ENODEV;
405 diff -Nru a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
406 --- a/drivers/media/radio/Makefile      Fri Aug 15 18:23:27 2003
407 +++ b/drivers/media/radio/Makefile      Fri Aug 15 18:23:27 2003
408 @@ -2,6 +2,8 @@
409  # Makefile for the kernel character device drivers.
410  #
411  
412 +obj-y          := dummy.o
413 +
414  miropcm20-objs := miropcm20-rds-core.o miropcm20-radio.o
415  
416  obj-$(CONFIG_RADIO_AZTECH) += radio-aztech.o
417 diff -Nru a/drivers/media/radio/dummy.c b/drivers/media/radio/dummy.c
418 --- /dev/null   Wed Dec 31 16:00:00 1969
419 +++ b/drivers/media/radio/dummy.c       Fri Aug 15 18:23:28 2003
420 @@ -0,0 +1 @@
421 +/* just so the linker knows what kind of object files it's deadling with... */
422 diff -Nru a/drivers/media/video/Makefile b/drivers/media/video/Makefile
423 --- a/drivers/media/video/Makefile      Fri Aug 15 18:23:27 2003
424 +++ b/drivers/media/video/Makefile      Fri Aug 15 18:23:27 2003
425 @@ -6,6 +6,8 @@
426                         bttv-risc.o bttv-vbi.o
427  zoran-objs      :=     zr36120.o zr36120_i2c.o zr36120_mem.o
428  
429 +obj-y          :=      dummy.o
430 +
431  obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o
432  
433  obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \
434 diff -Nru a/drivers/media/video/dummy.c b/drivers/media/video/dummy.c
435 --- /dev/null   Wed Dec 31 16:00:00 1969
436 +++ b/drivers/media/video/dummy.c       Fri Aug 15 18:23:28 2003
437 @@ -0,0 +1 @@
438 +/* just so the linker knows what kind of object files it's deadling with... */
439 diff -Nru a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
440 --- a/drivers/net/tulip/media.c Fri Aug 15 18:23:27 2003
441 +++ b/drivers/net/tulip/media.c Fri Aug 15 18:23:27 2003
442 @@ -278,6 +278,10 @@
443                                 for (i = 0; i < init_length; i++)
444                                         outl(init_sequence[i], ioaddr + CSR12);
445                         }
446 +
447 +                       (void) inl(ioaddr + CSR6); /* flush CSR12 writes */
448 +                       udelay(500);            /* Give MII time to recover */
449 +
450                         tmp_info = get_u16(&misc_info[1]);
451                         if (tmp_info)
452                                 tp->advertising[phy_num] = tmp_info | 1;
453 diff -Nru a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
454 --- a/drivers/scsi/qla1280.c    Fri Aug 15 18:23:28 2003
455 +++ b/drivers/scsi/qla1280.c    Fri Aug 15 18:23:28 2003
456 @@ -284,7 +284,7 @@
457  #define  QL1280_TARGET_MODE_SUPPORT    0       /* Target mode support */
458  #define  QL1280_LUN_SUPPORT            0
459  #define  WATCHDOGTIMER                 0
460 -#define  MEMORY_MAPPED_IO              0
461 +#define  MEMORY_MAPPED_IO              1
462  #define  DEBUG_QLA1280_INTR            0
463  #define  USE_NVRAM_DEFAULTS           0
464  #define  DEBUG_PRINT_NVRAM             0
465 @@ -2491,7 +2491,7 @@
466         /*
467          * Get memory mapped I/O address.
468          */
469 -       pci_read_config_word (ha->pdev, PCI_BASE_ADDRESS_1, &mmapbase);
470 +       pci_read_config_dword (ha->pdev, PCI_BASE_ADDRESS_1, &mmapbase);
471         mmapbase &= PCI_BASE_ADDRESS_MEM_MASK;
472  
473         /*
474 diff -Nru a/include/asm-ia64/sn/nodepda.h b/include/asm-ia64/sn/nodepda.h
475 --- a/include/asm-ia64/sn/nodepda.h     Fri Aug 15 18:23:27 2003
476 +++ b/include/asm-ia64/sn/nodepda.h     Fri Aug 15 18:23:27 2003
477 @@ -12,6 +12,7 @@
478  #include <linux/config.h>
479  #include <asm/sn/sgi.h>
480  #include <asm/irq.h>
481 +#include <asm/topology.h>
482  #include <asm/sn/intr.h>
483  #include <asm/sn/router.h>
484  #include <asm/sn/pda.h>
485 @@ -127,7 +128,7 @@
486   * Check if given a compact node id the corresponding node has all the
487   * cpus disabled. 
488   */
489 -#define is_headless_node(cnode)                (!test_bit(cnode, &node_has_active_cpus))
490 +#define is_headless_node(cnode)                (!node_to_cpumask(cnode))
491  
492  /*
493   * Check if given a node vertex handle the corresponding node has all the
494 diff -Nru a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
495 --- a/include/asm-ia64/unistd.h Fri Aug 15 18:23:27 2003
496 +++ b/include/asm-ia64/unistd.h Fri Aug 15 18:23:27 2003
497 @@ -257,96 +257,138 @@
498  
499  extern long __ia64_syscall (long a0, long a1, long a2, long a3, long a4, long nr);
500  
501 -#define _syscall0(type,name)                                           \
502 -type                                                                   \
503 -name (void)                                                            \
504 -{                                                                      \
505 -       register long dummy1 __asm__ ("out0");                          \
506 -       register long dummy2 __asm__ ("out1");                          \
507 -       register long dummy3 __asm__ ("out2");                          \
508 -       register long dummy4 __asm__ ("out3");                          \
509 -       register long dummy5 __asm__ ("out4");                          \
510 -                                                                       \
511 -       return __ia64_syscall(dummy1, dummy2, dummy3, dummy4, dummy5,   \
512 -                             __NR_##name);                             \
513 -}
514 -
515 -#define _syscall1(type,name,type1,arg1)                                        \
516 -type                                                                   \
517 -name (type1 arg1)                                                      \
518 -{                                                                      \
519 -       register long dummy2 __asm__ ("out1");                          \
520 -       register long dummy3 __asm__ ("out2");                          \
521 -       register long dummy4 __asm__ ("out3");                          \
522 -       register long dummy5 __asm__ ("out4");                          \
523 -                                                                       \
524 -       return __ia64_syscall((long) arg1, dummy2, dummy3, dummy4,      \
525 -                             dummy5, __NR_##name);                     \
526 -}
527 -
528 -#define _syscall2(type,name,type1,arg1,type2,arg2)                     \
529 -type                                                                   \
530 -name (type1 arg1, type2 arg2)                                          \
531 -{                                                                      \
532 -       register long dummy3 __asm__ ("out2");                          \
533 -       register long dummy4 __asm__ ("out3");                          \
534 -       register long dummy5 __asm__ ("out4");                          \
535 -                                                                       \
536 -       return __ia64_syscall((long) arg1, (long) arg2, dummy3, dummy4, \
537 -                             dummy5, __NR_##name);                     \
538 -}
539 -
540 -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)          \
541 -type                                                                   \
542 -name (type1 arg1, type2 arg2, type3 arg3)                              \
543 -{                                                                      \
544 -       register long dummy4 __asm__ ("out3");                          \
545 -       register long dummy5 __asm__ ("out4");                          \
546 -                                                                       \
547 -       return __ia64_syscall((long) arg1, (long) arg2, (long) arg3,    \
548 -                             dummy4, dummy5, __NR_##name);             \
549 -}
550 -
551 -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)       \
552 -type                                                                           \
553 -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4)                          \
554 -{                                                                              \
555 -       register long dummy5 __asm__ ("out4");                                  \
556 -                                                                               \
557 -       return __ia64_syscall((long) arg1, (long) arg2, (long) arg3,            \
558 -                             (long) arg4, dummy5, __NR_##name);                \
559 -}
560 -
561 -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5)    \
562 -type                                                                                   \
563 -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)                      \
564 -{                                                                                      \
565 -       return __ia64_syscall((long) arg1, (long) arg2, (long) arg3,                    \
566 -                             (long) arg4, (long) arg5, __NR_##name);                   \
567 +#ifdef __KERNEL_SYSCALLS__
568 +
569 +#include <linux/string.h>
570 +#include <linux/signal.h>
571 +#include <asm/ptrace.h>
572 +#include <linux/stringify.h>
573 +
574 +static inline long
575 +open (const char * name, int mode, int flags)
576 +{
577 +       extern long sys_open (const char *, int, int);
578 +       return sys_open(name, mode, flags);
579  }
580  
581 -#ifdef __KERNEL_SYSCALLS__
582 +static inline long
583 +dup (int fd)
584 +{
585 +       extern long sys_dup (int);
586 +       return sys_dup(fd);
587 +}
588 +
589 +static inline long
590 +close (int fd)
591 +{
592 +       extern long sys_close(unsigned int);
593 +       return sys_close(fd);
594 +}
595 +
596 +static inline off_t
597 +lseek (int fd, off_t off, int whence)
598 +{
599 +       extern off_t sys_lseek (int, off_t, int);
600 +       return sys_lseek(fd, off, whence);
601 +}
602 +
603 +static inline long
604 +_exit (int value)
605 +{
606 +       extern long sys_exit (int);
607 +       return sys_exit(value);
608 +}
609 +
610 +#define exit(x) _exit(x)
611 +
612 +static inline long
613 +write (int fd, const char * buf, size_t nr)
614 +{
615 +       extern long sys_write (int, const char *, size_t);
616 +       return sys_write(fd, buf, nr);
617 +}
618 +
619 +static inline long
620 +read (int fd, char * buf, size_t nr)
621 +{
622 +       extern long sys_read (int, char *, size_t);
623 +       return sys_read(fd, buf, nr);
624 +}
625 +
626 +
627 +static inline long
628 +setsid (void)
629 +{
630 +       extern long sys_setsid (void);
631 +       return sys_setsid();
632 +}
633  
634  struct rusage;
635  
636 -static inline _syscall0(pid_t,setsid)
637 -static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
638 -static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
639 -static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
640 -static inline _syscall1(int,dup,int,fd)
641 -static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
642 -static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
643 -static inline _syscall1(int,close,int,fd)
644 -static inline _syscall4(pid_t,wait4,pid_t,pid,int *,wait_stat,int,options,struct rusage*, rusage)
645 -static inline _syscall2(pid_t,clone,unsigned long,flags,void*,sp);
646 +static inline pid_t
647 +waitpid (int pid, int * wait_stat, int flags)
648 +{
649 +       extern asmlinkage long sys_wait4 (pid_t, unsigned int *, int, struct rusage *);
650 +
651 +       return sys_wait4(pid, wait_stat, flags, NULL);
652 +}
653  
654 -#define __NR__exit __NR_exit
655 -static inline _syscall1(int,_exit,int,exitcode)
656 +
657 +static inline int
658 +execve (const char *filename, char *const av[], char *const ep[])
659 +{
660 +       register long r8 asm("r8");
661 +       register long r10 asm("r10");
662 +       register long r15 asm("r15") = __NR_execve;
663 +       register long out0 asm("out0") = (long)filename;
664 +       register long out1 asm("out1") = (long)av;
665 +       register long out2 asm("out2") = (long)ep;
666 +
667 +       asm volatile ("break " __stringify(__BREAK_SYSCALL) ";;\n\t"
668 +                     : "=r" (r8), "=r" (r10), "=r" (r15), "=r" (out0), "=r" (out1), "=r" (out2)
669 +                     : "2" (r15), "3" (out0), "4" (out1), "5" (out2)
670 +                     : "memory", "out3", "out4", "out5", "out6", "out7",
671 +                     /* Non-stacked integer registers, minus r8, r10, r15, r13  */
672 +                     "r2", "r3", "r9", "r11", "r12", "r14", "r16", "r17", "r18",
673 +                     "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
674 +                     "r28", "r29", "r30", "r31",
675 +                     /* Predicate registers.  */
676 +                     "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
677 +                     /* Non-rotating fp registers.  */
678 +                     "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
679 +                     /* Branch registers.  */
680 +                     "b6", "b7" );
681 +       return r8;
682 +}
683  
684  static inline pid_t
685 -waitpid (int pid, int *wait_stat, int flags)
686 +clone (unsigned long flags, void *sp)
687  {
688 -       return wait4(pid, wait_stat, flags, NULL);
689 +       register long r8 asm("r8");
690 +       register long r10 asm("r10");
691 +       register long r15 asm("r15") = __NR_clone;
692 +       register long out0 asm("out0") = (long)flags;
693 +       register long out1 asm("out1") = (long)sp;
694 +       long retval;
695 +
696 +       /* clone clobbers current, hence the "r13" in the clobbers list */
697 +       asm volatile ( "break " __stringify(__BREAK_SYSCALL) ";;\n\t"
698 +                      : "=r" (r8), "=r" (r10), "=r" (r15), "=r" (out0), "=r" (out1)
699 +                      : "2" (r15), "3" (out0), "4" (out1)
700 +                      : "memory", "out2", "out3", "out4", "out5", "out6", "out7", "r13",
701 +                      /* Non-stacked integer registers, minus r8, r10, r15, r13  */
702 +                      "r2", "r3", "r9", "r11", "r12", "r14", "r16", "r17", "r18",
703 +                      "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
704 +                      "r28", "r29", "r30", "r31",
705 +                      /* Predicate registers.  */
706 +                      "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
707 +                      /* Non-rotating fp registers.  */
708 +                      "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
709 +                      /* Branch registers.  */
710 +                      "b6", "b7" );
711 +       retval = r8;
712 +       return retval;;
713 +
714  }
715  
716  #endif /* __KERNEL_SYSCALLS__ */
717 diff -Nru a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
718 --- a/include/linux/nfs_fs.h    Fri Aug 15 18:23:27 2003
719 +++ b/include/linux/nfs_fs.h    Fri Aug 15 18:23:27 2003
720 @@ -410,7 +410,7 @@
721  nfs_size_to_loff_t(__u64 size)
722  {
723         loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1;
724 -       if (size > maxsz)
725 +       if (size > (__u64) maxsz)
726                 return maxsz;
727         return (loff_t) size;
728  }
729 diff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h
730 --- a/include/linux/sysctl.h    Fri Aug 15 18:23:27 2003
731 +++ b/include/linux/sysctl.h    Fri Aug 15 18:23:27 2003
732 @@ -126,6 +126,7 @@
733         KERN_PANIC_ON_OOPS=57,  /* int: whether we will panic on an oops */
734         KERN_HPPA_PWRSW=58,     /* int: hppa soft-power enable */
735         KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */
736 +       KERN_CACHEDECAYTICKS=60,/* ulong: value for cache_decay_ticks (EXPERIMENTAL!) */
737  };
738  
739  
740 diff -Nru a/kernel/printk.c b/kernel/printk.c
741 --- a/kernel/printk.c   Fri Aug 15 18:23:28 2003
742 +++ b/kernel/printk.c   Fri Aug 15 18:23:28 2003
743 @@ -313,6 +313,12 @@
744                         __call_console_drivers(start, end);
745                 }
746         }
747 +#ifdef CONFIG_IA64_EARLY_PRINTK
748 +       if (!console_drivers) {
749 +               void early_printk (const char *str, size_t len);
750 +               early_printk(&LOG_BUF(start), end - start);
751 +       }
752 +#endif
753  }
754  
755  /*
756 @@ -630,7 +636,11 @@
757                  * for us.
758                  */
759                 spin_lock_irqsave(&logbuf_lock, flags);
760 +#ifdef CONFIG_IA64_EARLY_PRINTK
761 +               con_start = log_end;
762 +#else
763                 con_start = log_start;
764 +#endif
765                 spin_unlock_irqrestore(&logbuf_lock, flags);
766         }
767         release_console_sem();
768 @@ -683,3 +693,117 @@
769                 tty->driver->write(tty, 0, msg, strlen(msg));
770         return;
771  }
772 +
773 +#ifdef CONFIG_IA64_EARLY_PRINTK
774 +
775 +#include <asm/io.h>
776 +
777 +# ifdef CONFIG_IA64_EARLY_PRINTK_VGA
778 +
779 +
780 +#define VGABASE                ((char *)0xc0000000000b8000)
781 +#define VGALINES       24
782 +#define VGACOLS                80
783 +
784 +static int current_ypos = VGALINES, current_xpos = 0;
785 +
786 +static void
787 +early_printk_vga (const char *str, size_t len)
788 +{
789 +       char c;
790 +       int  i, k, j;
791 +
792 +       while (len-- > 0) {
793 +               c = *str++;
794 +               if (current_ypos >= VGALINES) {
795 +                       /* scroll 1 line up */
796 +                       for (k = 1, j = 0; k < VGALINES; k++, j++) {
797 +                               for (i = 0; i < VGACOLS; i++) {
798 +                                       writew(readw(VGABASE + 2*(VGACOLS*k + i)),
799 +                                              VGABASE + 2*(VGACOLS*j + i));
800 +                               }
801 +                       }
802 +                       for (i = 0; i < VGACOLS; i++) {
803 +                               writew(0x720, VGABASE + 2*(VGACOLS*j + i));
804 +                       }
805 +                       current_ypos = VGALINES-1;
806 +               }
807 +               if (c == '\n') {
808 +                       current_xpos = 0;
809 +                       current_ypos++;
810 +               } else if (c != '\r')  {
811 +                       writew(((0x7 << 8) | (unsigned short) c),
812 +                              VGABASE + 2*(VGACOLS*current_ypos + current_xpos++));
813 +                       if (current_xpos >= VGACOLS) {
814 +                               current_xpos = 0;
815 +                               current_ypos++;
816 +                       }
817 +               }
818 +       }
819 +}
820 +
821 +# endif /* CONFIG_IA64_EARLY_PRINTK_VGA */
822 +
823 +# ifdef CONFIG_IA64_EARLY_PRINTK_UART
824 +
825 +#include <linux/serial_reg.h>
826 +#include <asm/system.h>
827 +
828 +static void early_printk_uart(const char *str, size_t len)
829 +{
830 +       static char *uart = NULL;
831 +       unsigned long uart_base;
832 +       char c;
833 +
834 +       if (!uart) {
835 +               uart_base = 0;
836 +#  ifdef CONFIG_SERIAL_8250_HCDP
837 +               {
838 +                       extern unsigned long hcdp_early_uart(void);
839 +                       uart_base = hcdp_early_uart();
840 +               }
841 +#  endif
842 +#  if CONFIG_IA64_EARLY_PRINTK_UART_BASE
843 +               if (!uart_base)
844 +                       uart_base = CONFIG_IA64_EARLY_PRINTK_UART_BASE;
845 +#  endif
846 +               if (!uart_base)
847 +                       return;
848 +
849 +               uart = ioremap(uart_base, 64);
850 +               if (!uart)
851 +                       return;
852 +       }
853 +
854 +       while (len-- > 0) {
855 +               c = *str++;
856 +               while ((readb(uart + UART_LSR) & UART_LSR_TEMT) == 0)
857 +                       cpu_relax(); /* spin */
858 +
859 +               writeb(c, uart + UART_TX);
860 +
861 +               if (c == '\n')
862 +                       writeb('\r', uart + UART_TX);
863 +       }
864 +}
865 +
866 +# endif /* CONFIG_IA64_EARLY_PRINTK_UART */
867 +
868 +#ifdef CONFIG_IA64_EARLY_PRINTK_SGI_SN
869 +extern int sn_sal_console_out(const char *str, int len);
870 +#endif
871 +
872 +void early_printk(const char *str, size_t len)
873 +{
874 +#ifdef CONFIG_IA64_EARLY_PRINTK_UART
875 +       early_printk_uart(str, len);
876 +#endif
877 +#ifdef CONFIG_IA64_EARLY_PRINTK_VGA
878 +       early_printk_vga(str, len);
879 +#endif
880 +#ifdef CONFIG_IA64_EARLY_PRINTK_SGI_SN
881 +       sn_sal_console_out(str, len);
882 +#endif
883 +}
884 +
885 +#endif /* CONFIG_IA64_EARLY_PRINTK */
886 diff -Nru a/kernel/sysctl.c b/kernel/sysctl.c
887 --- a/kernel/sysctl.c   Fri Aug 15 18:23:27 2003
888 +++ b/kernel/sysctl.c   Fri Aug 15 18:23:27 2003
889 @@ -580,6 +580,16 @@
890                 .mode           = 0644,
891                 .proc_handler   = &proc_dointvec,
892         },
893 +#ifdef CONFIG_SMP
894 +       {
895 +               .ctl_name       = KERN_CACHEDECAYTICKS,
896 +               .procname       = "cache_decay_ticks",
897 +               .data           = &cache_decay_ticks,
898 +               .maxlen         = sizeof(cache_decay_ticks),
899 +               .mode           = 0644,
900 +               .proc_handler   = &proc_doulongvec_minmax,
901 +       },
902 +#endif
903         { .ctl_name = 0 }
904  };
905  
906 diff -Nru a/mm/memory.c b/mm/memory.c
907 --- a/mm/memory.c       Fri Aug 15 18:23:27 2003
908 +++ b/mm/memory.c       Fri Aug 15 18:23:27 2003
909 @@ -114,8 +114,10 @@
910         }
911         pmd = pmd_offset(dir, 0);
912         pgd_clear(dir);
913 -       for (j = 0; j < PTRS_PER_PMD ; j++)
914 +       for (j = 0; j < PTRS_PER_PMD ; j++) {
915 +               prefetchw(pmd + j + PREFETCH_STRIDE/sizeof(*pmd));
916                 free_one_pmd(tlb, pmd+j);
917 +       }
918         pmd_free_tlb(tlb, pmd);
919  }
920