~ubuntu-branches/debian/jessie/arcboot/jessie

« back to all changes in this revision

Viewing changes to tip22/kernel/parse_rd_cmd_line-2002-05-09.diff

  • Committer: Bazaar Package Importer
  • Author(s): Guido Guenther
  • Date: 2004-03-02 12:01:14 UTC
  • Revision ID: james.westby@ubuntu.com-20040302120114-0pukal9hlpt3k0l7
Tags: 0.3.8.1
correct subarch detection for IP32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: arch/mips/kernel/setup.c
 
2
===================================================================
 
3
RCS file: /cvs/linux/arch/mips/kernel/setup.c,v
 
4
retrieving revision 1.96.2.12
 
5
diff -u -u -r1.96.2.12 setup.c
 
6
--- arch/mips/kernel/setup.c    2002/02/15 21:05:48     1.96.2.12
 
7
+++ arch/mips/kernel/setup.c    2002/05/09 17:17:59
 
8
@@ -650,6 +650,38 @@
 
9
        }
 
10
 }
 
11
 
 
12
+static inline void parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_end)
 
13
+{
 
14
+       char c = ' ', *to = command_line, *from = saved_command_line;
 
15
+       int len = 0;
 
16
+       unsigned long rd_size = 0;
 
17
+
 
18
+       for (;;) {
 
19
+               /*
 
20
+                * "rd_start=0xNNNNNNNN" defines the memory address of an initrd
 
21
+                * "rd_size=0xNN" it's size
 
22
+                */
 
23
+               if (c == ' ' && !memcmp(from, "rd_start=", 9)) {
 
24
+                       if (to != command_line)
 
25
+                               to--;
 
26
+                       (*rd_start) = memparse(from + 9, &from);
 
27
+               }
 
28
+               if (c == ' ' && !memcmp(from, "rd_size=", 8)) {
 
29
+                       if (to != command_line)
 
30
+                               to--;
 
31
+                       rd_size = memparse(from + 8, &from);
 
32
+               }
 
33
+               c = *(from++);
 
34
+               if (!c)
 
35
+                       break;
 
36
+               if (CL_SIZE <= ++len)
 
37
+                       break;
 
38
+               *(to++) = c;
 
39
+       }
 
40
+       *to = '\0';
 
41
+       (*rd_end) = (*rd_start) + rd_size;
 
42
+}
 
43
+
 
44
 void __init setup_arch(char **cmdline_p)
 
45
 {
 
46
        void atlas_setup(void);
 
47
@@ -674,10 +706,7 @@
 
48
 
 
49
        unsigned long bootmap_size;
 
50
        unsigned long start_pfn, max_pfn, max_low_pfn, first_usable_pfn;
 
51
-#ifdef CONFIG_BLK_DEV_INITRD
 
52
-       unsigned long tmp;
 
53
-       unsigned long* initrd_header;
 
54
-#endif
 
55
+       unsigned long end = &_end;
 
56
 
 
57
        int i;
 
58
 
 
59
@@ -828,22 +857,18 @@
 
60
 #define MAXMEM_PFN     PFN_DOWN(MAXMEM)
 
61
 
 
62
 #ifdef CONFIG_BLK_DEV_INITRD
 
63
-       tmp = (((unsigned long)&_end + PAGE_SIZE-1) & PAGE_MASK) - 8; 
 
64
-       if (tmp < (unsigned long)&_end) 
 
65
-               tmp += PAGE_SIZE;
 
66
-       initrd_header = (unsigned long *)tmp;
 
67
-       if (initrd_header[0] == 0x494E5244) {
 
68
-               initrd_start = (unsigned long)&initrd_header[2];
 
69
-               initrd_end = initrd_start + initrd_header[1];
 
70
+       parse_rd_cmdline(&initrd_start, &initrd_end);
 
71
+       if(initrd_start && initrd_end)
 
72
+               end = initrd_end;
 
73
+       else {
 
74
+               initrd_start = initrd_end = 0;
 
75
        }
 
76
-       start_pfn = PFN_UP(__pa((&_end)+(initrd_end - initrd_start) + PAGE_SIZE));
 
77
-#else
 
78
+#endif /* CONFIG_BLK_DEV_INITRD */
 
79
        /*
 
80
         * Partially used pages are not usable - thus
 
81
         * we are rounding upwards.
 
82
         */
 
83
-       start_pfn = PFN_UP(__pa(&_end));
 
84
-#endif /* CONFIG_BLK_DEV_INITRD */
 
85
+       start_pfn = PFN_UP(__pa(end));
 
86
 
 
87
        /* Find the highest page frame number we have available.  */
 
88
        max_pfn = 0;