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 <[EMAIL PROTECTED]>
> >
> > 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
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 <[EMAIL PROTECTED]>
Index: include/tables.h
===================================================================
--- include/tables.h (revision 496)
+++ include/tables.h (working copy)
@@ -167,6 +167,14 @@
u8 string[0];
};
+#define LB_TAG_DEVTREE_PTR 0x000e
+
+struct lb_devtree {
+ u32 tag;
+ u32 size;
+ u32 dev_root_ptr; /* pointer to root device */
+};
+
/* The following structures are for the cmos definitions table */
#define LB_TAG_CMOS_OPTION_TABLE 200
/* cmos header record */
Index: arch/x86/linuxbios_table.c
===================================================================
--- arch/x86/linuxbios_table.c (revision 496)
+++ arch/x86/linuxbios_table.c (working copy)
@@ -385,6 +385,24 @@
return mem;
}
+/**
+ * Add pointer to 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 = LB_TAG_DEVTREE_PTR;
+ lbdev->size = sizeof(*lbdev);
+ lbdev->dev_root_ptr = &dev_root;
+
+ return lbdev;
+}
+
unsigned long write_linuxbios_table(
unsigned long low_table_start, unsigned long low_table_end,
unsigned long rom_table_start, unsigned long rom_table_end)
@@ -437,6 +455,9 @@
/* Record our various random string information */
lb_strings(head);
+ /* Record a pointer to LinuxBIOS device tree */
+ lb_devtree(head);
+
/* Remember where my valid memory ranges are */
return lb_table_fini(head);
--
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios