Soliciting opinions on an extension of the bootinfo structure

Andrew Duane aduane at juniper.net
Thu Sep 8 22:10:42 UTC 2011


I'm proposing an extension framework for the bootinfo structure used to pass information from the bootstrap/loader to the kernel. Although I'm only proposing this for the MIPS bootinfo, it's completely applicable to any of them.

What I propose is adding an optional platform extension structure: bootinfo_pext, surrounded by #ifdef BOOTINFO_PEXT

struct bootinfo {
        ....
        u_int32_t       bi_kernend;             /* end of kernel space */
        u_int32_t       bi_envp;                /* environment */
        u_int32_t       bi_modulep;             /* preloaded modules */
+#ifdef BOOTINFO_PEXT
+       struct bootinfo_pext    bi_pext;        /* platform extensions if defined */
+#endif
 };

Then, any vendor, platform, architecture, family, or developer could define a new header file (or expand an existing one) with a definition of struct bootinfo_pext, and a #define BOOTINFO_PEXT. Include the new (or existing) header file in your source, and you have whatever extensions you want, without affecting other platforms, architectures, families, or developers. The file we're looking to add is sys/mips/cavium/bootinfo_octeon.h:

+/*
+ * Platform bootinfo extensions for OCTEON bootinfo structure
+ *
+ * Specific vendors can add their own bootinfo_pext structures
+ * surrounded by #ifdef OCTEON_VENDOR_XXX
+ */
+
+#include "opt_cvmx.h"          /* For OCTEON_VENDOR_XXX definitions */
+
+#ifdef OCTEON_VENDOR_JUNIPER
+#define BOOTINFO_PEXT          /* include bootinfo_pext in main structure */
+#define BOOTINFO_PEXT_MAGIC    0xCADECADE
+#define BOOTINFO_PEXT_VERSION  1
+
+struct bootinfo_pext {
+        int             pext_i2cid;
+        u_int32_t       pext_flags;
+        u_int32_t       pext_magic;             /* Magic number for octeon pext */
+        u_int32_t       pext_version;           /* Version of pext */
+        u_int16_t       pext_uboot_major_rev;
+        u_int16_t       pext_uboot_minor_rev;
+        u_int16_t       pext_loader_major_rev;
+        u_int16_t       pext_loader_minor_rev;
+};
+#endif /* OCTEON_VENDOR_JUNIPER */


Reasonable? Unreasonable? Insane?

--
Andrew Duane             Juniper Networks
978-589-0551              10 Technology Park Dr
aduane at juniper.net      Westford, MA  01886-3418


More information about the freebsd-arch mailing list