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
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 */
+};
+
#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;
+ lbdev->size = sizeof(*lbdev);
+ lbdev->dev_root_ptr = &dev_root;
+ char buf[64];
+ printk_debug("DEV POINTER: %lx\n", lbdev->dev_root_ptr);
+
+ 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)
@@ -408,9 +429,13 @@
/* Record our motheboard */
lb_mainboard(head);
+
/* 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);
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 (Arbeitskopie)
@@ -135,6 +135,12 @@
struct lb_memory_range map[0];
};
+struct lb_devtree {
+ u32 tag;
+ u32 size;
+ u32 dev_root_ptr; /* pointer to root device */
+};
+
#define LB_TAG_HWRPB 0x0002
struct lb_hwrpb {
u32 tag;
Index: arch/x86/linuxbios_table.c
===================================================================
--- arch/x86/linuxbios_table.c (Revision 496)
+++ arch/x86/linuxbios_table.c (Arbeitskopie)
@@ -385,6 +385,25 @@
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 = 0xE;
+ lbdev->size = sizeof(*lbdev);
+ lbdev->dev_root_ptr = &dev_root;
+ char buf[64];
+
+ 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 +456,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