powerpc: Next round of bootwrapper flat dt patches
cover powerpc: Next round of bootwrapper flat dt patches
I'm resumitting the entire patch series because I messed up the threading and made some changes to simple_alloc.
Mark
---
Hi,
This patch series is a respin of--and complete replacement for--the bootwrapper reorg patches that I sent out a while back. I also included the flatdevtree.c file which is the latest version that Paul sent plus changes that I've made.
The patches apply to powerpc.git commit id:
ba00003aa83a61b615542dd66f5af8fb4a7cee1d
Paul, it would really help the rest of us if you would apply these patches quickly. There are several people waiting for this work but there are so many versions of so many patches that no one knows what to use. Plus, it would get more people testing/debugging the flatdevtree code.
Summary of changes:
===================
more reorg patch
----------------
- This patch includes Paul's changes to zImage.lds.S which define _dtb_start & _dtb_end and a related patch for the wrapper script.
- I changed main.c:start() a little so that the call to ft_init() is done in platform_init(). I did this because of an interface change to ft_init which now require some platform knowledge.
- I added a realloc() call to dt_ops so it can be passed to ft_open.
flatdevtree patch
-----------------
- I did not debug all of the flatdevtree.c code. I only debugged ft_find_device, ft_get_prop, ft_set_prop and their supporting routines.
- I added a phandle table (insided the cxt) to track phandles returned by ft_find_device(). Now the value returned by ft_find_device() is a phandle which is nothing more than an index into the phandle table. The phandle table contains the address of the corresponding node. When the flat dt is edited/moved, the node pointers in the phandle table are updated accordingly so no phandles kept by the caller become stale.
- I tested shrinking, and expanding an existing property but did not test adding a new property.
- I'm not sure of the usefulness of the genealogy stuff but I left it there in case Paul has plans for it. I did not test ft_get_parent (the only user of genealogy).
simple_realloc patch
--------------------
- The flatdevtree code needs a realloc now so that is implemented in here.
- As the name implies, it is a simple allocator which uses a table to track what's been allocated. simple_alloc_init() let's the caller set where the heap is, its size, the granularity of its allocations, and how many entries the table has.
- Once a slot in the table is used, its base & size are set. This allows the code to be much simpler.
non-OF serial console patch
---------------------------
- I decided not to look for a /cpus/<some cpu>/64-bit property and instead get either 1 or 2 "32-bit things" from the uart's 'virtual-reg' property. If there is 1, its 32-bits; if its 2, its 64-bits.
Mark
PATCH 1/4 powerpc: More bootwrapper reorg
More reorganization of the bootwrapper:
- Add dtb section to zImage
- ft_init now called by platform_init
- Pack a flat dt before calling kernel
- Remove size parameter from free
- printf only calls console_ops.write it its not NULL
- Some cleanup
---
main.c | 27 ++++++--------------------- of.c | 8 +------- ops.h | 25 ++++++++++++++----------- stdio.c | 3 ++- wrapper | 4 ++-- zImage.lds.S | 5 +++++ 6 files changed, 30 insertions(+), 42 deletions(-)
---
arch/powerpc/boot/main.c +6 -21
@@ -27,6 +27,8 @@ extern char _vmlinux_start[];extern char _vmlinux_end[];extern char _initrd_start[];extern char _initrd_end[]; +extern char _dtb_start[]; +extern char _dtb_end[];struct addr_range {unsigned long addr;
@@ -250,10 +252,6 @@ #endifflush_cache ((void *)vmlinux.addr, vmlinux.size); } -void __attribute__ ((weak))ft_init (void *dt_blob) -{ -} -/* A buffer that may be edited by tools operating on a zImage binary so as to * edit the command line passed to vmlinux (by setting /chosen/bootargs). * The buffer is put in it's own section so that tools may locate it easier.
@@ -285,19 +283,12 @@ static void set_cmdline(char *buf)setprop (devp,"bootargs" , buf,strlen (buf) +1 ); } -/* Section where ft can be tacked on after zImage is built */ -union blobspace { -struct boot_param_header hdr; -char space[8 *1024 ]; -} dt_blob __attribute__((__section__("__builtin_ft"))); -struct platform_ops platform_ops;struct dt_ops dt_ops;struct console_ops console_ops;void start (unsigned long a1,unsigned long a2,void *promptr,void *sp) { -int have_dt =0 ;kernel_entry_t kentry;char cmdline[COMMAND_LINE_SIZE ];
@@ -306,15 +297,7 @@ void start(unsigned long a1, unsigned lomemset (&dt_ops,0 ,sizeof (dt_ops));memset (&console_ops,0 ,sizeof (console_ops)); -/* Override the dt_ops and device tree if there was an flat dev -* tree attached to the zImage. -*/ -if (dt_blob.hdr.magic ==OF_DT_HEADER ) { - have_dt =1 ; -ft_init (&dt_blob); - } - -if (platform_init (promptr)) +if (platform_init (promptr, _dtb_start, _dtb_end))exit ();if (console_ops.open && (console_ops.open () <0 ))exit ();
@@ -342,8 +325,10 @@ void start(unsigned long a1, unsigned lo console_ops.close (); kentry = (kernel_entry_t ) vmlinux.addr; -if (have_dt) +if (_dtb_end > _dtb_start) { + dt_ops.ft_pack ();kentry (dt_ops.ft_addr (),0 ,NULL ); + }else /* XXX initrd addr/size should be passed in properties */ kentry (a1, a2, promptr);
arch/powerpc/boot/of.c +1 -7
@@ -256,24 +256,18 @@ static void of_console_write(char *buf,call_prom ("write" ,3 ,1 , of_stdout_handle, buf, len); } -int platform_init (void *promptr) +int platform_init (void *promptr,char *dt_blob_start,char *dt_blob_end) { - platform_ops.fixups =NULL ; platform_ops.image_hdr = of_image_hdr; platform_ops.malloc = of_try_claim; - platform_ops.free =NULL ; platform_ops.exit = of_exit; dt_ops.finddevice = of_finddevice; dt_ops.getprop = of_getprop; dt_ops.setprop = of_setprop; - dt_ops.translate_addr =NULL ; console_ops.open = of_console_open; console_ops.write = of_console_write; - console_ops.edit_cmdline =NULL ; - console_ops.close =NULL ; - console_ops.data =NULL ; prom = (int (*)(void *))promptr;return 0 ;
arch/powerpc/boot/ops.h +14 -11
@@ -22,7 +22,8 @@ struct platform_ops {void (*fixups)(void );void (*image_hdr)(const void *);void * (*malloc)(u32 size); -void (*free)(void *ptr,u32 size); +void (*free)(void *ptr); +void * (*realloc)(void *ptr,unsigned long size);void (*exit)(void ); };extern struct platform_ops platform_ops;
@@ -30,12 +31,11 @@ extern struct platform_ops platform_ops;/* Device Tree operations */ struct dt_ops {void * (*finddevice)(const char *name); -int (*getprop)(const void *node,const char *name,void *buf, +int (*getprop)(const void *phandle,const char *name,void *buf,const int buflen); -int (*setprop)(const void *node,const char *name, +int (*setprop)(const void *phandle,const char *name,const void *buf,const int buflen); -u64 (*translate_addr)(const char *path,const u32 *in_addr, -const u32 addr_len); +void (*ft_pack)(void );unsigned long (*ft_addr)(void ); };extern struct dt_ops dt_ops;
@@ -59,10 +59,13 @@ struct serial_console_data {void (*close)(void ); }; -extern int platform_init (void *promptr); -extern void simple_alloc_init (void ); -extern void ft_init (void *dt_blob); -extern int serial_console_init (void ); +int platform_init (void *promptr,char *dt_blob_start,char *dt_blob_end); +int ft_init (void *dt_blob,unsigned int max_size,unsigned int max_find_device); +int serial_console_init (void ); +int ns16550_console_init (void *devp,struct serial_console_data *scdp); +void *simple_alloc_init (char *base,u32 heap_size,u32 granularity, +u32 max_allocs); +static inline void *finddevice (const char *name) {
@@ -84,10 +87,10 @@ static inline void *malloc(u32 size)return (platform_ops.malloc) ? platform_ops.malloc (size) :NULL ; } -static inline void free (void *ptr,u32 size) +static inline void free (void *ptr) {if (platform_ops.free) - platform_ops.free (ptr, size); + platform_ops.free (ptr); }static inline void exit (void )
arch/powerpc/boot/stdio.c +2 -1
@@ -320,6 +320,7 @@ printf(const char *fmt, ...)va_start (args, fmt); n =vsprintf (sprint_buf, fmt, args);va_end (args); - console_ops.write (sprint_buf, n); +if (console_ops.write) + console_ops.write (sprint_buf, n);return n; }
arch/powerpc/boot/wrapper +2 -2
@@ -179,11 +179,11 @@ if [ -z "$cacheit" ]; then fi if [ -n "$initrd" ]; then - addsec $tmp "$initrd" initrd + addsec $tmp "$initrd" $isection fi if [ -n "$dtb" ]; then - addsec $tmp "$dtb" dtb + addsec $tmp "$dtb" .kernel:dtb fi if [ "$platform" != "miboot" ]; then
arch/powerpc/boot/zImage.lds.S +5 -0
@@ -21,6 +21,11 @@ SECTIONS __got2_end = .; } + . = ALIGN(8); + _dtb_start = .; + .kernel:dtb : { *(.kernel:dtb) } + _dtb_end = .; + . = ALIGN(4096); _vmlinux_start = .; .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
Re: [PATCH 1/4] powerpc: More bootwrapper reorg
Quoted 2 lines · Mark A. Greer
More reorganization of the bootwrapper:
- Add dtb section to zImage
Unfortunately it doesn't build for powermac because zImage.coff.lds is missing the _dtb_start/end symbols. Could you add the necessary bits to zImage.coff.lds and resend?
Paul.
Re: [PATCH 1/4] powerpc: More bootwrapper reorg
Quoted 8 lines · Paul Mackerras
Quoted 2 lines · Mark A. Greer
More reorganization of the bootwrapper:
- Add dtb section to zImageUnfortunately it doesn't build for powermac because
zImage.coff.ldsis missing the _dtb_start/end symbols. Could you add the necessary bits tozImage.coff.ldsand resend?
Sure. See below.
I did my best swag on zImage.coff.lds but I'm not a coff or lds expert so please make sure that they're correct. I could compile pmac32_defconfig with this patch.
The other patches will be on their way momentarily too.
Mark
---
More reorganization of the bootwrapper:
- Add dtb section to zImage
- ft_init now called by platform_init
- Pack a flat dt before calling kernel
- Remove size parameter from free
- printf only calls console_ops.write it its not NULL
- Some cleanup
---
main.c | 27 ++++++--------------------- of.c | 8 +------- ops.h | 25 ++++++++++++++----------- stdio.c | 3 ++- wrapper | 4 ++-- zImage.coff.lds.S | 4 ++++ zImage.lds.S | 5 +++++ 7 files changed, 34 insertions(+), 42 deletions(-)
---
arch/powerpc/boot/main.c +6 -21
@@ -27,6 +27,8 @@ extern char _vmlinux_start[];extern char _vmlinux_end[];extern char _initrd_start[];extern char _initrd_end[]; +extern char _dtb_start[]; +extern char _dtb_end[];struct addr_range {unsigned long addr;
@@ -250,10 +252,6 @@ #endifflush_cache ((void *)vmlinux.addr, vmlinux.size); } -void __attribute__ ((weak))ft_init (void *dt_blob) -{ -} -/* A buffer that may be edited by tools operating on a zImage binary so as to * edit the command line passed to vmlinux (by setting /chosen/bootargs). * The buffer is put in it's own section so that tools may locate it easier.
@@ -285,19 +283,12 @@ static void set_cmdline(char *buf)setprop (devp,"bootargs" , buf,strlen (buf) +1 ); } -/* Section where ft can be tacked on after zImage is built */ -union blobspace { -struct boot_param_header hdr; -char space[8 *1024 ]; -} dt_blob __attribute__((__section__("__builtin_ft"))); -struct platform_ops platform_ops;struct dt_ops dt_ops;struct console_ops console_ops;void start (unsigned long a1,unsigned long a2,void *promptr,void *sp) { -int have_dt =0 ;kernel_entry_t kentry;char cmdline[COMMAND_LINE_SIZE ];
@@ -306,15 +297,7 @@ void start(unsigned long a1, unsigned lomemset (&dt_ops,0 ,sizeof (dt_ops));memset (&console_ops,0 ,sizeof (console_ops)); -/* Override the dt_ops and device tree if there was an flat dev -* tree attached to the zImage. -*/ -if (dt_blob.hdr.magic ==OF_DT_HEADER ) { - have_dt =1 ; -ft_init (&dt_blob); - } - -if (platform_init (promptr)) +if (platform_init (promptr, _dtb_start, _dtb_end))exit ();if (console_ops.open && (console_ops.open () <0 ))exit ();
@@ -342,8 +325,10 @@ void start(unsigned long a1, unsigned lo console_ops.close (); kentry = (kernel_entry_t ) vmlinux.addr; -if (have_dt) +if (_dtb_end > _dtb_start) { + dt_ops.ft_pack ();kentry (dt_ops.ft_addr (),0 ,NULL ); + }else /* XXX initrd addr/size should be passed in properties */ kentry (a1, a2, promptr);
arch/powerpc/boot/of.c +1 -7
@@ -256,24 +256,18 @@ static void of_console_write(char *buf,call_prom ("write" ,3 ,1 , of_stdout_handle, buf, len); } -int platform_init (void *promptr) +int platform_init (void *promptr,char *dt_blob_start,char *dt_blob_end) { - platform_ops.fixups =NULL ; platform_ops.image_hdr = of_image_hdr; platform_ops.malloc = of_try_claim; - platform_ops.free =NULL ; platform_ops.exit = of_exit; dt_ops.finddevice = of_finddevice; dt_ops.getprop = of_getprop; dt_ops.setprop = of_setprop; - dt_ops.translate_addr =NULL ; console_ops.open = of_console_open; console_ops.write = of_console_write; - console_ops.edit_cmdline =NULL ; - console_ops.close =NULL ; - console_ops.data =NULL ; prom = (int (*)(void *))promptr;return 0 ;
arch/powerpc/boot/ops.h +14 -11
@@ -22,7 +22,8 @@ struct platform_ops {void (*fixups)(void );void (*image_hdr)(const void *);void * (*malloc)(u32 size); -void (*free)(void *ptr,u32 size); +void (*free)(void *ptr); +void * (*realloc)(void *ptr,unsigned long size);void (*exit)(void ); };extern struct platform_ops platform_ops;
@@ -30,12 +31,11 @@ extern struct platform_ops platform_ops;/* Device Tree operations */ struct dt_ops {void * (*finddevice)(const char *name); -int (*getprop)(const void *node,const char *name,void *buf, +int (*getprop)(const void *phandle,const char *name,void *buf,const int buflen); -int (*setprop)(const void *node,const char *name, +int (*setprop)(const void *phandle,const char *name,const void *buf,const int buflen); -u64 (*translate_addr)(const char *path,const u32 *in_addr, -const u32 addr_len); +void (*ft_pack)(void );unsigned long (*ft_addr)(void ); };extern struct dt_ops dt_ops;
@@ -59,10 +59,13 @@ struct serial_console_data {void (*close)(void ); }; -extern int platform_init (void *promptr); -extern void simple_alloc_init (void ); -extern void ft_init (void *dt_blob); -extern int serial_console_init (void ); +int platform_init (void *promptr,char *dt_blob_start,char *dt_blob_end); +int ft_init (void *dt_blob,unsigned int max_size,unsigned int max_find_device); +int serial_console_init (void ); +int ns16550_console_init (void *devp,struct serial_console_data *scdp); +void *simple_alloc_init (char *base,u32 heap_size,u32 granularity, +u32 max_allocs); +static inline void *finddevice (const char *name) {
@@ -84,10 +87,10 @@ static inline void *malloc(u32 size)return (platform_ops.malloc) ? platform_ops.malloc (size) :NULL ; } -static inline void free (void *ptr,u32 size) +static inline void free (void *ptr) {if (platform_ops.free) - platform_ops.free (ptr, size); + platform_ops.free (ptr); }static inline void exit (void )
arch/powerpc/boot/stdio.c +2 -1
@@ -320,6 +320,7 @@ printf(const char *fmt, ...)va_start (args, fmt); n =vsprintf (sprint_buf, fmt, args);va_end (args); - console_ops.write (sprint_buf, n); +if (console_ops.write) + console_ops.write (sprint_buf, n);return n; }
arch/powerpc/boot/wrapper +2 -2
@@ -179,11 +179,11 @@ if [ -z "$cacheit" ]; then fi if [ -n "$initrd" ]; then - addsec $tmp "$initrd" initrd + addsec $tmp "$initrd" $isection fi if [ -n "$dtb" ]; then - addsec $tmp "$dtb" dtb + addsec $tmp "$dtb" .kernel:dtb fi if [ "$platform" != "miboot" ]; then
arch/powerpc/boot/zImage.coff.lds.S +4 -0
@@ -21,6 +21,10 @@ SECTIONS *(.got2) __got2_end = .; + _dtb_start = .; + *(.kernel:dtb) + _dtb_end = .; + _vmlinux_start = .; *(.kernel:vmlinux.strip) _vmlinux_end = .;
arch/powerpc/boot/zImage.lds.S +5 -0
@@ -21,6 +21,11 @@ SECTIONS __got2_end = .; } + . = ALIGN(8); + _dtb_start = .; + .kernel:dtb : { *(.kernel:dtb) } + _dtb_end = .; + . = ALIGN(4096); _vmlinux_start = .; .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
PATCH 2/4 powerpc: Add flatdevtree source
In reply to Mark A. GreerAdd the latest version of the flatdevtree code and corresponding glue.
A phandle table now tracks values returned by ft_find_device(). The value returned by ft_find_device() is a phandle which is really an index into the phandle table. The phandle table contains the address of the corresponding node. When the flat dt is edited/moved, the node pointers in the phandle table are updated accordingly so no phandles kept by the caller become stale.
---
Makefile | 3 flatdevtree.c | 876 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flatdevtree.h | 62 +++ flatdevtree_env.h | 47 ++ flatdevtree_misc.c | 56 +++ 5 files changed, 1042 insertions(+), 2 deletions(-)
---
arch/powerpc/boot/Makefile +2 -1
@@ -40,7 +40,8 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ $(addprefix $(obj)/,$(zlibheader)) -src-wlib := string.S stdio.c main.c div64.S $(zlib) +src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c div64.S \ + $(zlib) src-plat := of.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
arch/powerpc/boot/flatdevtree.c new file +876 -0
876 lines not on this page · raw message
arch/powerpc/boot/flatdevtree.h +61 -1
72 lines not on this page · raw message
arch/powerpc/boot/flatdevtree_env.h new file +47 -0
47 lines not on this page · raw message
arch/powerpc/boot/flatdevtree_misc.c new file +56 -0
56 lines not on this page · raw message
PATCH 1/1 powerpc: realloc & other bug fixes for flatdevtree
Fix some bugs in flatdevtree.c:
- ft_reorder should update cxt->p.
- ft_make_space didn't follow realloc() semantics properly and accessed freed memory.
- Fix some other bugs in ft_make_space.
- Don't set cxt->isordered in ft_open to force an ft_reorder the first time ft_make_space is called. Required so that a malloc is used to get a pointer that the the realloc in ft_make_space can validly use later.
- Make ft_end_tree only call adjust_string_offsets if the offsets changed.
---
flatdevtree.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-)
---
arch/powerpc/boot/flatdevtree.c +13 -9
@@ -176,6 +176,7 @@ static int ft_reorder(struct ft_cxt *cxtmemcpy (p, cxt->rgn[FT_STRUCT ].start, cxt->rgn[FT_STRUCT ].size);ft_node_update_after (cxt, cxt->rgn[FT_STRUCT ].start, p - cxt->rgn[FT_STRUCT ].start); + cxt->p += p - cxt->rgn[FT_STRUCT ].start; cxt->rgn[FT_STRUCT ].start = p; p = pend - cxt->rgn[FT_STRINGS ].size;
@@ -281,7 +282,7 @@ static int ft_make_space(struct ft_cxt */* cast is to shut gcc up; we know nextra >= 0 */ if (tot < (unsigned int )nextra) {/* have to reallocate */ -char *newp, *oldp, *new_start; +char *newp, *new_start;int shift;if (!cxt->realloc)
@@ -291,21 +292,18 @@ static int ft_make_space(struct ft_cxt *if (!newp)return 0 ; cxt->max_size = size; - oldp = (char *)cxt->bph; - shift = newp - oldp; + shift = newp - (char *)cxt->bph; -if (shift !=0 ) {/* realloc can return same addr */ +if (shift) {/* realloc can return same addr */ cxt->bph = (struct boot_param_header *)newp; -memmove (newp, oldp,sizeof (struct boot_param_header ));ft_node_update_after (cxt, cxt->rgn[FT_STRUCT ].start, shift); -for (r =FT_RSVMAP ; r <=FT_STRUCT ; ++r) { +for (r =FT_RSVMAP ; r <=FT_STRINGS ; ++r) { new_start = cxt->rgn[r].start + shift; -memmove (new_start, cxt->rgn[r].start, - cxt->rgn[r].size); cxt->rgn[r].start = new_start; } *pp += shift; + cxt->str_anchor += shift; }/* move strings up to the end */
@@ -561,7 +559,10 @@ int ft_open(struct ft_cxt *cxt, void *bl cxt->rgn[FT_STRUCT ].size =struct_size (cxt); cxt->rgn[FT_STRINGS ].start = blob +be32_to_cpu (bph->off_dt_strings); cxt->rgn[FT_STRINGS ].size =be32_to_cpu (bph->dt_strings_size); +/* Leave as '0' to force first ft_make_space call to do a ft_reorder +* and move dt to an area allocated by realloc. cxt->isordered = ft_ordered(cxt); +*/ cxt->p = cxt->rgn[FT_STRUCT ].start; cxt->str_anchor = cxt->rgn[FT_STRINGS ].start;
@@ -597,13 +598,16 @@ void ft_end_tree(struct ft_cxt *cxt)struct boot_param_header *bph = cxt->bph;char *p, *oldstr, *str, *endp;unsigned long ssize; +int adj;if (!cxt->isordered)return ;/* we haven't touched anything */ /* adjust string offsets */ oldstr = cxt->rgn[FT_STRINGS ].start; -adjust_string_offsets (cxt, cxt->str_anchor - oldstr); + adj = cxt->str_anchor - oldstr; +if (adj) +adjust_string_offsets (cxt, adj);/* make strings end on 8-byte boundary */ ssize = cxt->rgn[FT_STRINGS ].size;
Re: [PATCH 2/4] powerpc: Add flatdevtree source
In reply to Mark A. GreerQuoted 1 line · Mark A. Greer
Add the latest version of the flatdevtree code and corresponding glue.
Please resend with the fixes you posted subsequently applied. Same for your patch 4/4.
Paul.
Re: [PATCH 2/4] powerpc: Add flatdevtree source
Quoted 6 lines · Paul Mackerras
Quoted 1 line · Mark A. Greer
Add the latest version of the flatdevtree code and corresponding glue.
Please resend with the fixes you posted subsequently applied. Same for your patch 4/4.
Add the latest version of the flatdevtree code and corresponding glue.
A phandle table now tracks values returned by ft_find_device(). The value returned by ft_find_device() is a phandle which is really an index into the phandle table. The phandle table contains the address of the corresponding node. When the flat dt is edited/moved, the node pointers in the phandle table are updated accordingly so no phandles kept by the caller become stale.
---
Makefile | 3 flatdevtree.c | 880 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flatdevtree.h | 62 +++ flatdevtree_env.h | 47 ++ flatdevtree_misc.c | 56 +++ 5 files changed, 1046 insertions(+), 2 deletions(-)
---
arch/powerpc/boot/Makefile +2 -1
@@ -40,7 +40,8 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ $(addprefix $(obj)/,$(zlibheader)) -src-wlib := string.S stdio.c main.c div64.S $(zlib) +src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c div64.S \ + $(zlib) src-plat := of.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
arch/powerpc/boot/flatdevtree.c new file +880 -0
880 lines not on this page · raw message
arch/powerpc/boot/flatdevtree.h +61 -1
72 lines not on this page · raw message
arch/powerpc/boot/flatdevtree_env.h new file +47 -0
47 lines not on this page · raw message
arch/powerpc/boot/flatdevtree_misc.c new file +56 -0
56 lines not on this page · raw message
PATCH 3/4 powerpc: Add non-OF serial console support
In reply to Mark A. GreerAdd serial console support for non-OF systems. There is a generic serial console layer which calls a serial console driver. Included is the serial console driver for the ns16550 class of uarts. Necessary support routines are added as well.
---
Makefile | 4 - io.h | 53 +++++++++++++++++++++++ ns16550.c | 76 +++++++++++++++++++++++++++++++++ serial.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ util.S | 101 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 374 insertions(+), 2 deletions(-)
---
arch/powerpc/boot/Makefile +2 -2
@@ -40,8 +40,8 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ $(addprefix $(obj)/,$(zlibheader)) -src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c div64.S \ - $(zlib) +src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c ns16550.c \ + serial.c div64.S util.S $(zlib) src-plat := of.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
arch/powerpc/boot/io.h new file +53 -0
53 lines not on this page · raw message
arch/powerpc/boot/ns16550.c new file +76 -0
76 lines not on this page · raw message
arch/powerpc/boot/serial.c new file +142 -0
142 lines not on this page · raw message
arch/powerpc/boot/util.S new file +101 -0
101 lines not on this page · raw message
Re: [PATCH 3/4] powerpc: Add non-OF serial console support
Changed how ns16550.c sets up reg_base with data from 'virtual-reg' property.
Mark
---
Add serial console support for non-OF systems. There is a generic serial console layer which calls a serial console driver. Included is the serial console driver for the ns16550 class of uarts. Necessary support routines are added as well.
---
Makefile | 4 - io.h | 53 +++++++++++++++++++++++ ns16550.c | 74 ++++++++++++++++++++++++++++++++ serial.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ util.S | 101 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 372 insertions(+), 2 deletions(-)
---
arch/powerpc/boot/Makefile +2 -2
@@ -40,8 +40,8 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ $(addprefix $(obj)/,$(zlibheader)) -src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c div64.S \ - $(zlib) +src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c ns16550.c \ + serial.c div64.S util.S $(zlib) src-plat := of.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
arch/powerpc/boot/io.h new file +53 -0
53 lines not on this page · raw message
arch/powerpc/boot/ns16550.c new file +74 -0
74 lines not on this page · raw message
arch/powerpc/boot/serial.c new file +142 -0
142 lines not on this page · raw message
arch/powerpc/boot/util.S new file +101 -0
101 lines not on this page · raw message
PATCH 4/4 powerpc: Add simple memory allocator to bootwrapper
In reply to Mark A. GreerProvide primitive malloc, free, and realloc functions for bootwrapper.
---
Makefile | 2 simple_alloc.c | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-)
---
arch/powerpc/boot/Makefile +1 -1
@@ -41,7 +41,7 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlibheader)) src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c ns16550.c \ - serial.c div64.S util.S $(zlib) + serial.c simple_alloc.c div64.S util.S $(zlib) src-plat := of.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
arch/powerpc/boot/simple_alloc.c new file +147 -0
147 lines not on this page · raw message
PATCH 1/1 powerpc: change bad ptr handling in simple_alloc
Some minor changes to simple_alloc.c:
- Make simple_realloc return NULL if the ptr passed to it wasn't from a previous simple_malloc or simple_realloc.
- Change tracking of base of unused memory.
---
simple_alloc.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
---
arch/powerpc/boot/simple_alloc.c +10 -9
@@ -26,6 +26,7 @@ static struct alloc_info {static u32 tbl_entries;static u32 alloc_min; +static u32 next_base;static u32 space_left;/*
@@ -36,20 +37,20 @@ static u32 space_left;static void *simple_malloc (u32 size) {u32 i; -struct alloc_info *p = alloc_tbl, *prevp =NULL ; +struct alloc_info *p = alloc_tbl;if (size ==0 ) goto err_out; size =_ALIGN_UP (size, alloc_min); -for (i=0 ; i<tbl_entries; i++) { +for (i=0 ; i<tbl_entries; i++, p++)if (!(p->flags &ENTRY_BEEN_USED )) {/* never been used */ if (size <= space_left) { -if (i >0 ) - p->base = prevp->base + prevp->size; + p->base = next_base; p->size = size; p->flags =ENTRY_BEEN_USED |ENTRY_IN_USE ; + next_base += size; space_left -= size;return (void *)p->base; }
@@ -60,8 +61,6 @@ static void *simple_malloc(u32 size) p->flags |=ENTRY_IN_USE ;return (void *)p->base; } - prevp = p++; - } err_out:return NULL ; }
@@ -103,10 +102,12 @@ static void *simple_realloc(void *ptr, ureturn NULL ; } -/* also malloc if ptr didn't come from simple_malloc/realloc */ -if ((ptr ==NULL ) || ((p =simple_find_entry (ptr)) ==NULL )) +if (ptr ==NULL )return simple_malloc (size); + p =simple_find_entry (ptr); +if (p ==NULL )/* ptr not from simple_malloc/simple_realloc */ +return NULL ;if (size <= p->size)/* fits in current block */ return ptr;
@@ -136,7 +137,7 @@ void *simple_alloc_init(char *base, u32 heap_base =_ALIGN_UP ((u32 )alloc_tbl + tbl_size, alloc_min); - alloc_tbl[0 ].base = heap_base; + next_base = heap_base; space_left = heap_size; platform_ops.malloc = simple_malloc;
Re: [PATCH 4/4] powerpc: Add simple memory allocator to bootwrapper
Resending patch that combines previous two patches with this subject.
Mark
---
Provide primitive malloc, free, and realloc functions for bootwrapper.
---
Makefile | 2 simple_alloc.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-)
---
arch/powerpc/boot/Makefile +1 -1
@@ -41,7 +41,7 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlibheader)) src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c ns16550.c \ - serial.c div64.S util.S $(zlib) + serial.c simple_alloc.c div64.S util.S $(zlib) src-plat := of.c src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
arch/powerpc/boot/simple_alloc.c new file +149 -0
149 lines not on this page · raw message
PATCH 1/1 Fixed some missing files to be deleted when running make clean
In reply to Mark A. GreerFixed some missing files to be deleted when running make clean
---
These patches apply against the latest series of Mark's bootwrapper patches. They fix some missing files that need to be cleaned.
commit b05c2cae79ba02edd7263e19fe5f722c67c3c5cb
tree 3016e7e0f0b84d36ded2ec1c1ff5efe98cc94d4c
parent 44ae8267b3597965b485669885ff68384640b95a
author Matthew McClintock <[email protected]> Mon, 23 Oct 2006 14:09:47 -0500
committer Matthew McClintock <[email protected]> Mon, 23 Oct 2006 14:09:47 -0500
arch/powerpc/boot/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/boot/Makefile +1 -1
@@ -75,7 +75,7 @@ quiet_cmd_copy_zliblinuxheader = COPY @cp $< $@ clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ - $(obj)/empty.c + empty.c zImage.coff.lds zImage.lds zImage.sandpoint quiet_cmd_bootcc = BOOTCC $@ cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o
$@ $<