Hi,
this patch adds a pointer to the LinuxBIOS table which points to the root device. I use it to access the LB device tree from Open Firmware.
There is one patch for v2 and another one for v3.
Bye,
Jens
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@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).
#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?
char buf[64];
Why? It's never used in the patch(?)
/* 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?
Uwe.
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@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
On Thu, Sep 13, 2007 at 09:58:30PM +0200, Jens Freimann wrote:
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.
OK, that should be fixed in lxbios then, I guess.
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@freimann.org
Thanks, r500 (with some minor changes).
+/**
- Add pointer to device tree to LinuxBIOS table
- @param head Pointer to lbtable header
Missing @return here, I added a TODO for now.
Uwe.
Jens, thanks, this is interesting! how does one test? how are you testing?
ron
* Jens Freimann jens@freimann.org [070911 23:30]:
Hi,
this patch adds a pointer to the LinuxBIOS table which points to the root device. I use it to access the LB device tree from Open Firmware.
There is one patch for v2 and another one for v3.
One question: How can we prevent the memory from being overwritten? I think the device tree area also has to be marked reserved in the memory entries.
Am Dienstag, den 25.09.2007, 12:17 +0200 schrieb Stefan Reinauer:
- Jens Freimann jens@freimann.org [070911 23:30]:
Hi,
this patch adds a pointer to the LinuxBIOS table which points to the root device. I use it to access the LB device tree from Open Firmware.
There is one patch for v2 and another one for v3.
One question: How can we prevent the memory from being overwritten? I think the device tree area also has to be marked reserved in the memory entries.
Good question. That's the problem I have with v2, where the device tree area is overwritten while on v3 it (coincidentally?) isn't.
Jens