avr32: added mem kernel command line option support
PATCH 1/1 avr32: added mem kernel command line option support
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
---
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +19 -0
@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]" + */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p); + if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1; + return 0; +} +early_param("mem", early_mem); + static int __init parse_tag_core(struct tag *tag) { if (tag->hdr.size > 2) {
Quoted 8 lines · On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
Signed-off-by Marco Stornelli <[email protected]>---
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 288
Quoted 6 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]"
[KkMmGg]
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 295
Quoted 7 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p);
memparse() returns an unsigned long long. Is the truncation OK for avr32?
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char
Quoted 13 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +9
-1+ if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1; + return 0; +} +early_param("mem", early_mem); + static int __init parse_tag_core(struct tag *tag) { if (tag->hdr.size > 2) { --
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
If you see the above function early_parse_fbmem:
static int __init early_parse_fbmem(char *p)
{
int ret;
unsigned long align;
fbmem_size = memparse(p, &p);
.........
where fbmem_size is a resource_size_t (u32 because avr32 is a 32-bit architecture), so I used the same philosophy. Maybe I can remove unsigned long and replace it with resource_size_t to be more uniform.
Randy Dunlap ha scritto:
Quoted 57 lines · On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
Quoted 10 lines
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
Signed-off-by Marco Stornelli <[email protected]>---
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 289
Quoted 7 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]"[KkMmGg]
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p);
memparse()returns an unsigned long long. Is the truncation OK for avr32?Quoted 12 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +9
-0+ if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1; + return 0; +} +early_param("mem", early_mem); + static int __init parse_tag_core(struct tag *tag){ if (tag->hdr.size > 2) {Quoted 2 lines
--
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
Signature · 7 lines
Marco Stornelli Embedded Software Engineer CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni http://www.coritel.it [email protected] +39 06 72582838
Quoted 7 lines · On Mon, 15 Sep 2008 16:57:10 +0200 Marco Stornelli wrote:
If you see the above function
early_parse_fbmem:static int
__initearly_parse_fbmem(char *p)
{
int ret;
unsigned long align;
Quoted 6 lines
fbmem_size=memparse(p, &p);
.........where
fbmem_sizeis aresource_size_t(u32 because avr32 is a 32-bit architecture), so I used the same philosophy. Maybe I can remove unsigned long and replace it withresource_size_tto be more uniform.
Yes, I think that would be better.
Thanks.
Quoted 35 lines
Randy Dunlap ha scritto:
Quoted 34 lines · On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
Quoted 10 lines
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
Signed-off-by Marco Stornelli <[email protected]>---
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 289
Quoted 7 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]"[KkMmGg]
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p);
memparse()returns an unsigned long long. Is the truncation OK for avr32?
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +5
-0+ if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1;Quoted 8 lines
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +4
-0+ return 0; +} +early_param("mem", early_mem); + static int __init parse_tag_core(struct tag *tag){ if (tag->hdr.size > 2) {--
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
From: Marco Stornelli <[email protected]>
Fixed the type of size and start, now they are resource_size_t. Fixed the double pointer parameter, now it's only a single pointer.
---
--- linux-2.6.26.5/arch/avr32/kernel/setup.c.orig 2008-09-15 11:30:00.000000000 +0200
+++ linux-2.6.26.5/arch/avr32/kernel/setup.c 2008-09-15 11:30:17.000000000 +0200
@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char }early_param("fbmem", early_parse_fbmem);
+/*
+ * Pick out the memory size. We look for mem=size@start,
+ * where start and size are "size[KkMmGg]"
+ */
+static int __init early_mem(char *p)
+{
+ resource_size_t size, start;
+
+ start = system_ram->start;
+ size = memparse(p, &p);
+ if (**p == '@')
+ start = memparse(p + 1, &p);
+
+ system_ram->start = start;
+ system_ram->end = system_ram->start + size - 1;
+ return 0;
+}
+early_param("mem", early_mem);
+
static int __init parse_tag_core(struct tag *tag) {
if (tag->hdr.size > 2) {
Randy Dunlap ha scritto:
Quoted 84 lines · On Mon, 15 Sep 2008 16:57:10 +0200 Marco Stornelli wrote:
Quoted 9 lines
If you see the above function
early_parse_fbmem:static int
__initearly_parse_fbmem(char *p)
{
int ret;
unsigned long align;Quoted 7 lines
fbmem_size=memparse(p, &p);
.........where
fbmem_sizeis aresource_size_t(u32 because avr32 is a 32-bit architecture), so I used the same philosophy. Maybe I can remove unsigned long and replace it withresource_size_tto be more uniform.Yes, I think that would be better.
Thanks.
Quoted 39 lines
Randy Dunlap ha scritto:
Quoted 37 lines · On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
Quoted 11 lines
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
Signed-off-by Marco Stornelli <[email protected]>---
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 290
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]"[KkMmGg]
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char
Quoted 9 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p);
memparse()returns an unsigned long long. Is the truncation OK for avr32?Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +6
-0+ if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1; + return 0;Quoted 8 lines
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0+} +early_param("mem", early_mem); +static int
__initparse_tag_core(struct tag *tag){ if (tag->hdr.size > 2) {--
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
Signature · 7 lines
Marco Stornelli Embedded Software Engineer CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni http://www.coritel.it [email protected] +39 06 72582838
Quoted 16 lines · On Mon, 15 Sep 2008 17:30:48 +0200 Marco Stornelli wrote:
From: Marco Stornelli <[email protected]>
Fixed the type of size and start, now they are
resource_size_t. Fixed the double pointer parameter, now it's only a single pointer.Signed-off-by Marco Stornelli <[email protected]>---
--- linux-2.6.26.5/arch/avr32/kernel/setup.c.orig 2008-09-15 11:30:00.000000000 +0200+++
linux-2.6.26.5/arch/avr32/kernel/setup.c2008-09-15 11:30:17.000000000 +0200setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +2
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start,
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 297
Quoted 10 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +10
-0+ * where start and size are "size[KkMmGg]" + */ +static int __init early_mem(char *p) +{ + resource_size_t size, start; + + start = system_ram->start; + size = memparse(p, &p); + if (**p == '@') + start = memparse(p + 1, &p);
Lots of whitespace damage here. Your first patch looked OK for whitespace, so something changed....
Quoted 74 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ + system_ram->start = start; + system_ram->end = system_ram->start + size - 1; + return 0; +} +early_param("mem", early_mem); + static int __init parse_tag_core(struct tag *tag) { if (tag->hdr.size > 2) {Randy Dunlap ha scritto:
Quoted 62 lines · On Mon, 15 Sep 2008 16:57:10 +0200 Marco Stornelli wrote:
Quoted 9 lines
If you see the above function
early_parse_fbmem:static int
__initearly_parse_fbmem(char *p)
{
int ret;
unsigned long align;Quoted 7 lines
fbmem_size=memparse(p, &p);
.........where
fbmem_sizeis aresource_size_t(u32 because avr32 is a 32-bit architecture), so I used the same philosophy. Maybe I can remove unsigned long and replace it withresource_size_tto be more uniform.Yes, I think that would be better.
Thanks.
Quoted 39 lines
Randy Dunlap ha scritto:
Quoted 37 lines · On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
Quoted 11 lines
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
Signed-off-by Marco Stornelli <[email protected]>---
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 290
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]"[KkMmGg]
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char
Quoted 9 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p);
memparse()returns an unsigned long long. Is the truncation OK for avr32?
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +5
-0+ if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +4
-0+ return 0; +} +early_param("mem", early_mem); +static int
__initparse_tag_core(struct tag *tag){ if (tag->hdr.size > 2) {--
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
From: Marco Stornelli <[email protected]>
Now is it ok? Sorry but it's the first time I submit a patch for the kernel.
---
--- linux-2.6.26.3/arch/avr32/kernel/setup.c.orig 2008-09-15
11:30:00.000000000 +0200
+++ linux-2.6.26.3/arch/avr32/kernel/setup.c 2008-09-16
09:06:31.000000000 +0200
@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char
}
early_param("fbmem", early_parse_fbmem);
+/*
+ * Pick out the memory size. We look for mem=size@start,
+ * where start and size are "size[KkMmGg]"
+ */
+static int __init early_mem(char *p)
+{
+ resource_size_t size, start;
+
+ start = system_ram->start;
+ size = memparse(p, &p);
+ if (*p == '@')
+ start = memparse(p + 1, &p);
+
+ system_ram->start = start;
+ system_ram->end = system_ram->start + size - 1;
+ return 0;
+}
+early_param("mem", early_mem);
+
static int __init parse_tag_core(struct tag *tag) {
if (tag->hdr.size > 2) {
Randy Dunlap ha scritto:
Quoted 126 lines · On Mon, 15 Sep 2008 17:30:48 +0200 Marco Stornelli wrote:
Quoted 17 lines
From: Marco Stornelli <[email protected]>
Fixed the type of size and start, now they are
resource_size_t. Fixed the double pointer parameter, now it's only a single pointer.Signed-off-by Marco Stornelli <[email protected]>---
--- linux-2.6.26.5/arch/avr32/kernel/setup.c.orig 2008-09-15 11:30:00.000000000 +0200+++
linux-2.6.26.5/arch/avr32/kernel/setup.c2008-09-15 11:30:17.000000000 +0200setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +2
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start,setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 297
Quoted 10 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +10
-0+ * where start and size are "size[KkMmGg]" + */ +static int __init early_mem(char *p) +{ + resource_size_t size, start; + + start = system_ram->start; + size = memparse(p, &p); + if (**p == '@') + start = memparse(p + 1, &p);Lots of whitespace damage here. Your first patch looked OK for whitespace, so something changed....
Quoted 73 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ + system_ram->start = start; + system_ram->end = system_ram->start + size - 1; + return 0; +} +early_param("mem", early_mem); + static int __init parse_tag_core(struct tag *tag) { if (tag->hdr.size > 2) {Randy Dunlap ha scritto:
Quoted 61 lines · On Mon, 15 Sep 2008 16:57:10 +0200 Marco Stornelli wrote:
Quoted 9 lines
If you see the above function
early_parse_fbmem:static int
__initearly_parse_fbmem(char *p)
{
int ret;
unsigned long align;Quoted 7 lines
fbmem_size=memparse(p, &p);
.........where
fbmem_sizeis aresource_size_t(u32 because avr32 is a 32-bit architecture), so I used the same philosophy. Maybe I can remove unsigned long and replace it withresource_size_tto be more uniform.Yes, I think that would be better.
Thanks.
Quoted 39 lines
Randy Dunlap ha scritto:
Quoted 37 lines · On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
Quoted 11 lines
From: Marco Stornelli <[email protected]>
Added support for the mem kernel command line option
Signed-off-by Marco Stornelli <[email protected]>---
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char · line 290
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +3
-0@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char } early_param("fbmem", early_parse_fbmem); +/* + * Pick out the memory size. We look for mem=size@start, + * where start and size are "size[KkMm]"[KkMmGg]
setup.c 2008-09-15 11:30:17.000000000 +0200 static int __init early_parse_fbmem(char
Quoted 9 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +7
-0+ */ +static int __init early_mem(char **p) +{ + unsigned long size, start; + + start = system_ram->start; + size = memparse(*p, p);
memparse()returns an unsigned long long. Is the truncation OK for avr32?Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +5
-0+ if (**p == '@') + start = memparse(*p + 1, p); + + system_ram->start = start; + system_ram->end = system_ram->start + size - 1;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
setup.c 2008-09-15 11:30:17.000000000 +0200 renamed from setup.c.orig 2008-09-15 11:30:00.000000000 +0200 +4
-0+ return 0; +} +early_param("mem", early_mem); +static int
__initparse_tag_core(struct tag *tag){ if (tag->hdr.size > 2) {--
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
Signature · 7 lines
Marco Stornelli Embedded Software Engineer CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni http://www.coritel.it [email protected] +39 06 72582838
Haavard Skinnemoen
AppliedQuoted 1 line · Marco Stornelli
User-Agent: Thunderbird 2.0.0.16 (X11/20080720)
Please see Documentation/email-clients.txt. Thunderbird apparently has pretty braindead defaults, but can be taught to behave.
Quoted 3 lines
From: Marco Stornelli <[email protected]>
Now is it ok? Sorry but it's the first time I submit a patch for the kernel.
Not really, sorry. This part is line-wrapped:
Quoted 4 lines
--- linux-2.6.26.3/arch/avr32/kernel/setup.c.orig 2008-09-15
11:30:00.000000000 +0200
+++linux-2.6.26.3/arch/avr32/kernel/setup.c2008-09-16
09:06:31.000000000 +0200
I've fixed it up, but I recommend that you send a few patches to yourself and try to fix your setup. It's not much of a problem for a small patch like this, but longer, more complicated ones may take quite some time to unmangle.
The rest of the patch looks good. Although avr32 only supports 32-bit physical addresses, I believe resource_size_t is more correct than unsigned long.
Applied, thanks.
Haavard