[LinuxBIOS] [PATCH] Add pointer to device tree to LinuxBIOS table

Jens Freimann jens at freimann.org
Thu Sep 13 21:58:30 CEST 2007


Hi,

attached is the fixed version of my patch. So far only for v3, because I
ran into another problem with v2 that needs to be fixed first. 

Am Donnerstag, den 13.09.2007, 03:32 +0200 schrieb Uwe Hermann: 
> On Tue, Sep 11, 2007 at 11:30:20PM +0200, Jens Freimann wrote:
> > Add a pointer to the root device to the LinuxBIOS table. Used for
> > example to access the device list from Open Firmware.
> > 
> > Signed-off-by: Jens Freimann <jens at freimann.org>
> > 
> > Index: src/include/boot/linuxbios_tables.h
> > ===================================================================
> > --- src/include/boot/linuxbios_tables.h	(Revision 2770)
> > +++ src/include/boot/linuxbios_tables.h	(Arbeitskopie)
> > @@ -106,6 +106,12 @@
> >  	struct lb_memory_range map[0];
> >  };
> >  
> > +struct lb_devtree {
> > +    uint32_t tag;
> > +    uint32_t size;
> > +    uint32_t dev_root_ptr; /* pointer to root device */
> > +};
> 
> Fix the coding style please (TABs, not spaces, for indentation).

Done.

> >  #define LB_TAG_HWRPB	0x0002
> >  struct lb_hwrpb {
> >  	uint32_t tag;
> > Index: src/arch/i386/boot/linuxbios_table.c
> > ===================================================================
> > --- src/arch/i386/boot/linuxbios_table.c	(Revision 2770)
> > +++ src/arch/i386/boot/linuxbios_table.c	(Arbeitskopie)
> > @@ -348,6 +348,27 @@
> >  	return mem;
> >  }
> >  
> > +/**
> > + * Add entire device tree to LinuxBIOS table
> > + *
> > + * @param head Pointer to lbtable header
> > + */
> > +struct lb_devtree *lb_devtree(struct lb_header *head)
> > +{
> > +     struct lb_devtree *lbdev = NULL;
> > +     struct device *dev = NULL;
> > +
> > +     lbdev = (struct lb_devtree *)lb_new_record(head);
> > +     lbdev->tag = 0xE;
> 
> What is 0xe? Should probably be some #define with a descriptive name
> for better readability?

Done. 

> > +     char buf[64];

Removed, because it was unused. 

> >  	/* Record our various random string information */
> >  	lb_strings(head);
> >  
> > +    /* Record the LinuxBIOS device tree */
> > +    lb_devtree(head);
> > +
> >  	/* Remember where my valid memory ranges are */
> >  	return lb_table_fini(head);
>  	
> Someone should double-check that this doesn't break any existing tools
> (lxbios?) or expectations in the code. Do we consider this as "public API"
> of some sort or doesn't it matter at all if it changes?

I tried lxbios. To me it seems to work fine. Of course when dumping the
lbtable it prints "UNKNOWN" for the newly introduced LB_DEVTREE_PTR
(0xE) tag.


Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lbdevtreepointer_v3.diff
Type: text/x-patch
Size: 1701 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20070913/a6def130/attachment.diff>


More information about the coreboot mailing list