PPC fixes for SMP; also fix the stack overflow detection, remove
[opensuse:kernel.git] / arch / ppc / kernel / setup.c
1 /*
2  * BK Id: %F% %I% %G% %U% %#%
3  */
4 /*
5  * Common prep/pmac/chrp boot and setup code.
6  */
7
8 #include <linux/config.h>
9 #include <linux/module.h>
10 #include <linux/string.h>
11 #include <linux/sched.h>
12 #include <linux/init.h>
13 #include <linux/reboot.h>
14 #include <linux/delay.h>
15 #include <linux/blk.h>
16 #include <linux/ide.h>
17 #include <linux/tty.h>
18 #include <linux/bootmem.h>
19 #include <linux/seq_file.h>
20
21 #include <asm/residual.h>
22 #include <asm/io.h>
23 #include <asm/prom.h>
24 #include <asm/processor.h>
25 #include <asm/pgtable.h>
26 #include <asm/bootinfo.h>
27 #include <asm/setup.h>
28 #include <asm/amigappc.h>
29 #include <asm/smp.h>
30 #include <asm/elf.h>
31 #include <asm/cputable.h>
32 #include <asm/bootx.h>
33 #include <asm/btext.h>
34 #include <asm/machdep.h>
35 #include <asm/uaccess.h>
36 #include <asm/system.h>
37 #include <asm/pmac_feature.h>
38
39 #if defined CONFIG_KGDB
40 #include <asm/kgdb.h>
41 #endif
42
43 extern void platform_init(unsigned long r3, unsigned long r4,
44                 unsigned long r5, unsigned long r6, unsigned long r7);
45 extern void bootx_init(unsigned long r4, unsigned long phys);
46 extern void identify_cpu(unsigned long offset, unsigned long cpu);
47 extern void do_cpu_ftr_fixups(unsigned long offset);
48 extern void reloc_got2(unsigned long offset);
49
50 #ifdef CONFIG_XMON
51 extern void xmon_map_scc(void);
52 #endif
53
54 #ifdef CONFIG_KGDB
55 extern void kgdb_map_scc(void);
56 #endif
57
58 extern boot_infos_t *boot_infos;
59 char saved_command_line[256];
60 unsigned char aux_device_present;
61 struct ide_machdep_calls ppc_ide_md;
62 char *sysmap;
63 unsigned long sysmap_size;
64
65 /* Used with the BI_MEMSIZE bootinfo parameter to store the memory
66    size value reported by the boot loader. */ 
67 unsigned int boot_mem_size;
68
69 unsigned long ISA_DMA_THRESHOLD;
70 unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
71
72 #ifdef CONFIG_ALL_PPC
73 int _machine = 0;
74
75 extern void prep_init(unsigned long r3, unsigned long r4,
76                 unsigned long r5, unsigned long r6, unsigned long r7);
77 extern void pmac_init(unsigned long r3, unsigned long r4,
78                 unsigned long r5, unsigned long r6, unsigned long r7);
79 extern void chrp_init(unsigned long r3, unsigned long r4,
80                 unsigned long r5, unsigned long r6, unsigned long r7);
81 #endif /* CONFIG_ALL_PPC */
82
83 #ifdef CONFIG_MAGIC_SYSRQ
84 unsigned long SYSRQ_KEY;
85 #endif /* CONFIG_MAGIC_SYSRQ */
86
87 #ifdef CONFIG_VGA_CONSOLE
88 unsigned long vgacon_remap_base;
89 #endif
90
91 struct machdep_calls ppc_md;
92
93 /*
94  * These are used in binfmt_elf.c to put aux entries on the stack
95  * for each elf executable being started.
96  */
97 int dcache_bsize;
98 int icache_bsize;
99 int ucache_bsize;
100
101 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_FB_VGA16) || \
102     defined(CONFIG_FB_VGA16_MODULE) || defined(CONFIG_FB_VESA)
103 struct screen_info screen_info = {
104         0, 25,                  /* orig-x, orig-y */
105         0,                      /* unused */
106         0,                      /* orig-video-page */
107         0,                      /* orig-video-mode */
108         80,                     /* orig-video-cols */
109         0,0,0,                  /* ega_ax, ega_bx, ega_cx */
110         25,                     /* orig-video-lines */
111         1,                      /* orig-video-isVGA */
112         16                      /* orig-video-points */
113 };
114 #endif /* CONFIG_VGA_CONSOLE || CONFIG_FB_VGA16 || CONFIG_FB_VESA */
115
116 void machine_restart(char *cmd)
117 {
118         ppc_md.restart(cmd);
119 }
120   
121 void machine_power_off(void)
122 {
123         ppc_md.power_off();
124 }
125   
126 void machine_halt(void)
127 {
128         ppc_md.halt();
129 }
130
131 #ifdef CONFIG_TAU
132 extern u32 cpu_temp(unsigned long cpu);
133 extern u32 cpu_temp_both(unsigned long cpu);
134 #endif /* CONFIG_TAU */
135
136 int show_cpuinfo(struct seq_file *m, void *v)
137 {
138         int i = (int) v - 1;
139         int err = 0;
140         unsigned int pvr;
141         unsigned short maj, min;
142         unsigned long lpj;
143
144         if (i >= NR_CPUS) {
145                 /* Show summary information */
146 #ifdef CONFIG_SMP
147                 unsigned long bogosum = 0;
148                 for (i = 0; i < smp_num_cpus; ++i)
149                         if (cpu_online_map & (1 << i))
150                                 bogosum += cpu_data[i].loops_per_jiffy;
151                 seq_printf(m, "total bogomips\t: %lu.%02lu\n",
152                            bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
153 #endif /* CONFIG_SMP */
154
155                 if (ppc_md.show_cpuinfo != NULL)
156                         err = ppc_md.show_cpuinfo(m);
157                 return err;
158         }
159
160 #ifdef CONFIG_SMP
161         if (!(cpu_online_map & (1 << i)))
162                 return 0;
163         pvr = cpu_data[i].pvr;
164         lpj = cpu_data[i].loops_per_jiffy;
165         seq_printf(m, "processor\t: %d\n", i);
166 #else
167         pvr = mfspr(PVR);
168         lpj = loops_per_jiffy;
169 #endif
170
171         seq_printf(m, "cpu\t\t: ");
172
173         if (cur_cpu_spec[i]->pvr_mask)
174                 seq_printf(m, "%s", cur_cpu_spec[i]->cpu_name);
175         else
176                 seq_printf(m, "unknown (%08x)", pvr);
177 #ifdef CONFIG_ALTIVEC
178         if (cur_cpu_spec[i]->cpu_features & CPU_FTR_ALTIVEC)
179                 seq_printf(m, ", altivec supported");
180 #endif
181         seq_printf(m, "\n");
182
183 #ifdef CONFIG_TAU
184         if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) {
185 #ifdef CONFIG_TAU_AVERAGE
186                 /* more straightforward, but potentially misleading */
187                 seq_printf(m,  "temperature \t: %u C (uncalibrated)\n",
188                            cpu_temp(i));
189 #else
190                 /* show the actual temp sensor range */
191                 u32 temp;
192                 temp = cpu_temp_both(i);
193                 seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
194                            temp & 0xff, temp >> 16);
195 #endif
196         }
197 #endif /* CONFIG_TAU */
198
199         if (ppc_md.show_percpuinfo != NULL) {
200                 err = ppc_md.show_percpuinfo(m, i);
201                 if (err)
202                         return err;
203         }
204
205         switch (PVR_VER(pvr)) {
206         case 0x0020:    /* 403 family */
207                 maj = PVR_MAJ(pvr) + 1;
208                 min = PVR_MIN(pvr);
209                 break;
210         case 0x1008:    /* 740P/750P ?? */
211                 maj = ((pvr >> 8) & 0xFF) - 1;
212                 min = pvr & 0xFF;
213                 break;
214         default:
215                 maj = (pvr >> 8) & 0xFF;
216                 min = pvr & 0xFF;
217                 break;
218         }
219
220         seq_printf(m, "revision\t: %hd.%hd (pvr %04x %04x)\n", 
221                    maj, min, PVR_VER(pvr), PVR_REV(pvr));
222
223         seq_printf(m, "bogomips\t: %lu.%02lu\n",
224                    lpj / (500000/HZ), (lpj / (5000/HZ)) % 100);
225
226 #ifdef CONFIG_SMP
227         seq_printf(m, "\n");
228 #endif
229
230         return 0;
231 }
232
233
234 static void *c_start(struct seq_file *m, loff_t *pos)
235 {
236         int i = *pos;
237
238         return i <= NR_CPUS? (void *) (i + 1): NULL;
239 }
240
241 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
242 {
243         ++*pos;
244         return c_start(m, pos);
245 }
246
247 static void c_stop(struct seq_file *m, void *v)
248 {
249 }
250
251 struct seq_operations cpuinfo_op = {
252         start:  c_start,
253         next:   c_next,
254         stop:   c_stop,
255         show:   show_cpuinfo,
256 };
257
258 /*
259  * We're called here very early in the boot.  We determine the machine
260  * type and call the appropriate low-level setup functions.
261  *  -- Cort <cort@fsmlabs.com>
262  *
263  * Note that the kernel may be running at an address which is different
264  * from the address that it was linked at, so we must use RELOC/PTRRELOC
265  * to access static data (including strings).  -- paulus
266  */
267 __init
268 unsigned long
269 early_init(int r3, int r4, int r5)
270 {
271         extern char __bss_start, _end;
272         unsigned long phys;
273         unsigned long offset = reloc_offset();
274
275         /* Default */
276         phys = offset + KERNELBASE;
277
278         /* First zero the BSS -- use memset, some arches don't have
279          * caches on yet */
280         memset_io(PTRRELOC(&__bss_start), 0, &_end - &__bss_start);
281
282         /*
283          * Identify the CPU type and fix up code sections
284          * that depend on which cpu we have.
285          */
286         identify_cpu(offset, 0);
287         do_cpu_ftr_fixups(offset);
288
289 #if defined(CONFIG_ALL_PPC)
290         reloc_got2(offset);
291
292         /* If we came here from BootX, clear the screen,
293          * set up some pointers and return. */
294         if ((r3 == 0x426f6f58) && (r5 == 0))
295                 bootx_init(r4, phys);
296
297         /*
298          * don't do anything on prep
299          * for now, don't use bootinfo because it breaks yaboot 0.5
300          * and assume that if we didn't find a magic number, we have OF
301          */
302         else if (*(unsigned long *)(0) != 0xdeadc0de)
303                 phys = prom_init(r3, r4, (prom_entry)r5);
304
305         reloc_got2(-offset);
306 #endif
307
308         return phys;
309 }
310
311 #ifdef CONFIG_ALL_PPC
312 void __init
313 intuit_machine_type(void)
314 {
315         char *model;
316         struct device_node *root;
317                         
318         /* ask the OF info if we're a chrp or pmac */
319         root = find_path_device("/");
320         if (root != 0) {
321                 /* assume pmac unless proven to be chrp -- Cort */
322                 _machine = _MACH_Pmac;
323                 model = get_property(root, "device_type", NULL);
324                 if (model && !strncmp("chrp", model, 4))
325                         _machine = _MACH_chrp;
326                 else {
327                         model = get_property(root, "model", NULL);
328                         if (model && !strncmp(model, "IBM", 3))
329                                 _machine = _MACH_chrp;
330                 }
331         }
332 }
333
334 /*
335  * The ALL_PPC version of platform_init...
336  */
337 void __init
338 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
339               unsigned long r6, unsigned long r7)
340 {
341 #ifdef CONFIG_BOOTX_TEXT
342         if (boot_text_mapped) {
343                 btext_clearscreen();
344                 btext_welcome();
345         }
346 #endif  
347
348         parse_bootinfo(find_bootinfo());
349
350         /* if we didn't get any bootinfo telling us what we are... */
351         if (_machine == 0) {
352                 /* prep boot loader tells us if we're prep or not */
353                 if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
354                         _machine = _MACH_prep;
355         }
356
357         /* not much more to do here, if prep */
358         if (_machine == _MACH_prep) {
359                 prep_init(r3, r4, r5, r6, r7);
360                 return;
361         }
362
363         /* prom_init has already been called from __start */
364         if (boot_infos)
365                 relocate_nodes();
366
367         /* If we aren't PReP, we can find out if we're Pmac
368          * or CHRP with this. */
369         if (_machine == 0)
370                 intuit_machine_type();
371
372         /* finish_device_tree may need _machine defined. */
373         finish_device_tree();
374
375         /*
376          * If we were booted via quik, r3 points to the physical
377          * address of the command-line parameters.
378          * If we were booted from an xcoff image (i.e. netbooted or
379          * booted from floppy), we get the command line from the
380          * bootargs property of the /chosen node.
381          * If an initial ramdisk is present, r3 and r4
382          * are used for initrd_start and initrd_size,
383          * otherwise they contain 0xdeadbeef.  
384          */
385         if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) {
386                 cmd_line[0] = 0;
387                 strncpy(cmd_line, (char *)r3 + KERNELBASE,
388                         sizeof(cmd_line));
389         } else if (boot_infos != 0) {
390                 /* booted by BootX - check for ramdisk */
391                 if (boot_infos->kernelParamsOffset != 0)
392                         strncpy(cmd_line, (char *) boot_infos
393                                 + boot_infos->kernelParamsOffset,
394                                 sizeof(cmd_line));
395 #ifdef CONFIG_BLK_DEV_INITRD
396                 if (boot_infos->ramDisk) {
397                         initrd_start = (unsigned long) boot_infos
398                                 + boot_infos->ramDisk;
399                         initrd_end = initrd_start + boot_infos->ramDiskSize;
400                         initrd_below_start_ok = 1;
401                 }
402 #endif
403         } else {
404                 struct device_node *chosen;
405                 char *p;
406                         
407 #ifdef CONFIG_BLK_DEV_INITRD
408                 if (r3 && r4 && r4 != 0xdeadbeef) {
409                         if (r3 < KERNELBASE)
410                                 r3 += KERNELBASE;
411                         initrd_start = r3;
412                         initrd_end = r3 + r4;
413                         ROOT_DEV = mk_kdev(RAMDISK_MAJOR, 0);
414                         initrd_below_start_ok = 1;
415                 }
416 #endif
417                 chosen = find_devices("chosen");
418                 if (chosen != NULL) {
419                         p = get_property(chosen, "bootargs", NULL);
420                         if (p && *p) {
421                                 cmd_line[0] = 0;
422                                 strncpy(cmd_line, p, sizeof(cmd_line));
423                         }
424                 }
425         }
426         cmd_line[sizeof(cmd_line) - 1] = 0;
427 #ifdef CONFIG_ADB
428         if (strstr(cmd_line, "adb_sync")) {
429                 extern int __adb_probe_sync;
430                 __adb_probe_sync = 1;
431         }
432 #endif /* CONFIG_ADB */ 
433
434         switch (_machine) {
435         case _MACH_Pmac:
436                 pmac_init(r3, r4, r5, r6, r7);
437                 break;
438         case _MACH_chrp:
439                 chrp_init(r3, r4, r5, r6, r7);
440                 break;
441         }
442 }
443 #endif /* CONFIG_ALL_PPC */
444
445 struct bi_record *find_bootinfo(void)
446 {
447         struct bi_record *rec;
448         extern char __bss_start[];
449
450         rec = (struct bi_record *)_ALIGN((ulong)__bss_start+(1<<20)-1,(1<<20));
451         if ( rec->tag != BI_FIRST ) {
452                 /*
453                  * This 0x10000 offset is a terrible hack but it will go away when
454                  * we have the bootloader handle all the relocation and
455                  * prom calls -- Cort
456                  */
457                 rec = (struct bi_record *)_ALIGN((ulong)__bss_start+0x10000+(1<<20)-1,(1<<20));
458                 if ( rec->tag != BI_FIRST )
459                         return NULL;
460         }
461         return rec;
462 }
463
464 void parse_bootinfo(struct bi_record *rec)
465 {
466         if (rec == NULL || rec->tag != BI_FIRST)
467                 return;
468         while (rec->tag != BI_LAST) {
469                 ulong *data = rec->data;
470                 switch (rec->tag) {
471                 case BI_CMD_LINE:
472                         memcpy(cmd_line, (void *)data, rec->size);
473                         break;
474                 case BI_SYSMAP:
475                         sysmap = (char *)((data[0] >= (KERNELBASE)) ? data[0] :
476                                           (data[0]+KERNELBASE));
477                         sysmap_size = data[1];
478                         break;
479 #ifdef CONFIG_BLK_DEV_INITRD
480                 case BI_INITRD:
481                         initrd_start = data[0] + KERNELBASE;
482                         initrd_end = data[0] + data[1] + KERNELBASE;
483                         break;
484 #endif /* CONFIG_BLK_DEV_INITRD */
485 #ifdef CONFIG_ALL_PPC
486                 case BI_MACHTYPE:
487                         _machine = data[0];
488                         break;
489 #endif /* CONFIG_ALL_PPC */
490                 case BI_MEMSIZE:
491                         boot_mem_size = data[0];
492                         break;
493                 }
494                 rec = (struct bi_record *)((ulong)rec + rec->size);
495         }
496 }
497
498 /*
499  * Find out what kind of machine we're on and save any data we need
500  * from the early boot process (devtree is copied on pmac by prom_init()).
501  * This is called very early on the boot process, after a minimal
502  * MMU environment has been set up but before MMU_init is called.
503  */
504 void __init
505 machine_init(unsigned long r3, unsigned long r4, unsigned long r5,
506              unsigned long r6, unsigned long r7)
507 {
508 #ifdef CONFIG_CMDLINE
509         strcpy(cmd_line, CONFIG_CMDLINE);
510 #endif /* CONFIG_CMDLINE */
511
512         platform_init(r3, r4, r5, r6, r7);
513
514         if (ppc_md.progress)
515                 ppc_md.progress("id mach(): done", 0x200);
516 }
517
518 /* Checks "l2cr=xxxx" command-line option */
519 int __init ppc_setup_l2cr(char *str)
520 {
521         if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR) {
522                 unsigned long val = simple_strtoul(str, NULL, 0);
523                 printk(KERN_INFO "l2cr set to %lx\n", val);
524                 _set_L2CR(0);           /* force invalidate by disable cache */
525                 _set_L2CR(val);         /* and enable it */
526         }
527         return 1;
528 }
529 __setup("l2cr=", ppc_setup_l2cr);
530
531 int __init ppc_init(void)
532 {
533         /* clear the progress line */
534         if ( ppc_md.progress ) ppc_md.progress("             ", 0xffff);
535         
536         if (ppc_md.init != NULL) {
537                 ppc_md.init();
538         }
539         return 0;
540 }
541
542 arch_initcall(ppc_init);
543
544 /* Warning, IO base is not yet inited */
545 void __init setup_arch(char **cmdline_p)
546 {
547         extern int panic_timeout;
548         extern char _etext[], _edata[];
549         extern char *klimit;
550         extern void do_init_bootmem(void);
551
552         /* so udelay does something sensible, assume <= 1000 bogomips */
553         loops_per_jiffy = 500000000 / HZ;
554
555 #ifdef CONFIG_ALL_PPC
556         /* This could be called "early setup arch", it must be done
557          * now because xmon need it
558          */
559         if (_machine == _MACH_Pmac)
560                 pmac_feature_init();    /* New cool way */
561 #endif /* CONFIG_ALL_PPC */
562
563 #ifdef CONFIG_XMON
564         xmon_map_scc();
565         if (strstr(cmd_line, "xmon"))
566                 xmon(0);
567 #endif /* CONFIG_XMON */
568         if ( ppc_md.progress ) ppc_md.progress("setup_arch: enter", 0x3eab);
569
570 #if defined(CONFIG_KGDB)
571         kgdb_map_scc();
572         set_debug_traps();
573         if (strstr(cmd_line, "nokgdb"))
574                 printk("kgdb default breakpoint deactivated on command line\n");
575         else {
576                 printk("kgdb default breakpoint activated\n");
577                 breakpoint();
578         }
579 #endif
580
581         /*
582          * Set cache line size based on type of cpu as a default.
583          * Systems with OF can look in the properties on the cpu node(s)
584          * for a possibly more accurate value.
585          */
586         if (cur_cpu_spec[0]->cpu_features & CPU_FTR_SPLIT_ID_CACHE) {
587                 dcache_bsize = cur_cpu_spec[0]->dcache_bsize;
588                 icache_bsize = cur_cpu_spec[0]->icache_bsize;
589                 ucache_bsize = 0;
590         } else
591                 ucache_bsize = dcache_bsize = icache_bsize
592                         = cur_cpu_spec[0]->dcache_bsize;
593
594         /* reboot on panic */
595         panic_timeout = 180;
596
597         init_mm.start_code = PAGE_OFFSET;
598         init_mm.end_code = (unsigned long) _etext;
599         init_mm.end_data = (unsigned long) _edata;
600         init_mm.brk = (unsigned long) klimit;
601         
602         /* Save unparsed command line copy for /proc/cmdline */
603         strcpy(saved_command_line, cmd_line);
604         *cmdline_p = cmd_line;
605
606         /* set up the bootmem stuff with available memory */
607         do_init_bootmem();
608         if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab);
609
610         ppc_md.setup_arch();
611         if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
612
613         paging_init();
614         sort_exception_table();
615
616         /* this is for modules since _machine can be a define -- Cort */
617         ppc_md.ppc_machine = _machine;
618 }
619
620 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
621 /* Convert the shorts/longs in hd_driveid from little to big endian;
622  * chars are endian independant, of course, but strings need to be flipped.
623  * (Despite what it says in drivers/block/ide.h, they come up as little
624  * endian...)
625  *
626  * Changes to linux/hdreg.h may require changes here. */
627 void ppc_generic_ide_fix_driveid(struct hd_driveid *id)
628 {
629         int i;
630         unsigned short *stringcast;
631
632         id->config         = __le16_to_cpu(id->config);
633         id->cyls           = __le16_to_cpu(id->cyls);
634         id->reserved2      = __le16_to_cpu(id->reserved2);
635         id->heads          = __le16_to_cpu(id->heads);
636         id->track_bytes    = __le16_to_cpu(id->track_bytes);
637         id->sector_bytes   = __le16_to_cpu(id->sector_bytes);
638         id->sectors        = __le16_to_cpu(id->sectors);
639         id->vendor0        = __le16_to_cpu(id->vendor0);
640         id->vendor1        = __le16_to_cpu(id->vendor1);
641         id->vendor2        = __le16_to_cpu(id->vendor2);
642         stringcast = (unsigned short *)&id->serial_no[0];
643         for (i = 0; i < (20/2); i++)
644                 stringcast[i] = __le16_to_cpu(stringcast[i]);
645         id->buf_type       = __le16_to_cpu(id->buf_type);
646         id->buf_size       = __le16_to_cpu(id->buf_size);
647         id->ecc_bytes      = __le16_to_cpu(id->ecc_bytes);
648         stringcast = (unsigned short *)&id->fw_rev[0];
649         for (i = 0; i < (8/2); i++)
650                 stringcast[i] = __le16_to_cpu(stringcast[i]);
651         stringcast = (unsigned short *)&id->model[0];
652         for (i = 0; i < (40/2); i++)
653                 stringcast[i] = __le16_to_cpu(stringcast[i]);
654         id->dword_io       = __le16_to_cpu(id->dword_io);
655         id->reserved50     = __le16_to_cpu(id->reserved50);
656         id->field_valid    = __le16_to_cpu(id->field_valid);
657         id->cur_cyls       = __le16_to_cpu(id->cur_cyls);
658         id->cur_heads      = __le16_to_cpu(id->cur_heads);
659         id->cur_sectors    = __le16_to_cpu(id->cur_sectors);
660         id->cur_capacity0  = __le16_to_cpu(id->cur_capacity0);
661         id->cur_capacity1  = __le16_to_cpu(id->cur_capacity1);
662         id->lba_capacity   = __le32_to_cpu(id->lba_capacity);
663         id->dma_1word      = __le16_to_cpu(id->dma_1word);
664         id->dma_mword      = __le16_to_cpu(id->dma_mword);
665         id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes);
666         id->eide_dma_min   = __le16_to_cpu(id->eide_dma_min);
667         id->eide_dma_time  = __le16_to_cpu(id->eide_dma_time);
668         id->eide_pio       = __le16_to_cpu(id->eide_pio);
669         id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy);
670         for (i = 0; i < 2; i++)
671                 id->words69_70[i] = __le16_to_cpu(id->words69_70[i]);
672         for (i = 0; i < 4; i++)
673                 id->words71_74[i] = __le16_to_cpu(id->words71_74[i]);
674         id->queue_depth    = __le16_to_cpu(id->queue_depth);
675         for (i = 0; i < 4; i++)
676                 id->words76_79[i] = __le16_to_cpu(id->words76_79[i]);
677         id->major_rev_num  = __le16_to_cpu(id->major_rev_num);
678         id->minor_rev_num  = __le16_to_cpu(id->minor_rev_num);
679         id->command_set_1  = __le16_to_cpu(id->command_set_1);
680         id->command_set_2  = __le16_to_cpu(id->command_set_2);
681         id->cfsse          = __le16_to_cpu(id->cfsse);
682         id->cfs_enable_1   = __le16_to_cpu(id->cfs_enable_1);
683         id->cfs_enable_2   = __le16_to_cpu(id->cfs_enable_2);
684         id->csf_default    = __le16_to_cpu(id->csf_default);
685         id->dma_ultra      = __le16_to_cpu(id->dma_ultra);
686         id->word89         = __le16_to_cpu(id->word89);
687         id->word90         = __le16_to_cpu(id->word90);
688         id->CurAPMvalues   = __le16_to_cpu(id->CurAPMvalues);
689         id->word92         = __le16_to_cpu(id->word92);
690         id->hw_config      = __le16_to_cpu(id->hw_config);
691         id->acoustic       = __le16_to_cpu(id->acoustic);
692         for (i = 0; i < 5; i++)
693                 id->words95_99[i]  = __le16_to_cpu(id->words95_99[i]);
694         id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2);
695         for (i = 0; i < 22; i++)
696                 id->words104_125[i]   = __le16_to_cpu(id->words104_125[i]);
697         id->last_lun       = __le16_to_cpu(id->last_lun);
698         id->word127        = __le16_to_cpu(id->word127);
699         id->dlf            = __le16_to_cpu(id->dlf);
700         id->csfo           = __le16_to_cpu(id->csfo);
701         for (i = 0; i < 26; i++)
702                 id->words130_155[i] = __le16_to_cpu(id->words130_155[i]);
703         id->word156        = __le16_to_cpu(id->word156);
704         for (i = 0; i < 3; i++)
705                 id->words157_159[i] = __le16_to_cpu(id->words157_159[i]);
706         id->cfa_power      = __le16_to_cpu(id->cfa_power);
707         for (i = 0; i < 14; i++)
708                 id->words161_175[i] = __le16_to_cpu(id->words161_175[i]);
709         for (i = 0; i < 31; i++)
710                 id->words176_205[i] = __le16_to_cpu(id->words176_205[i]);
711         for (i = 0; i < 48; i++)
712                 id->words206_254[i] = __le16_to_cpu(id->words206_254[i]);
713         id->integrity_word  = __le16_to_cpu(id->integrity_word);
714 }
715 #endif