libpayload: Add PAYLOAD_INFO macro
authorJordan Crouse <jordan.crouse@amd.com>
Tue, 27 May 2008 20:06:54 +0000 (20:06 +0000)
committerJordan Crouse <jordan.crouse@amd.com>
Tue, 27 May 2008 20:06:54 +0000 (20:06 +0000)
Adds the PAYLOAD_INFO macro to store payload information in a data
section in the ELF which can be consumed by other entities.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3354 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

payloads/libpayload/include/libpayload.h
payloads/libpayload/lib/libpayload.ldscript

index c05aafb37c16af35aca9902c73375c3159b5af14..dc2f5eec1b561b00bd76374f1e05874e1ab57203 100644 (file)
 
 #define RAND_MAX 0x7fffffff
 
+/* Payload information parameters - these are used to pass information
+ * to the entity loading the payload
+ * Usage:  PAYLOAD_INFO(key, value)
+ * Example:  PAYLOAD_INFO(name, "CoreInfo!")
+ */
+
+#define _pstruct(key) __pinfo_ ##key
+#define PAYLOAD_INFO(key, value)                                        \
+static const char _pstruct(key)[]                                        \
+  __attribute__((__used__))                                              \
+  __attribute__((section(".note.pinfo"),unused)) = #key "=" value
+
 /* Some NVRAM byte definitions */
 #define NVRAM_RTC_SECONDS        0
 #define NVRAM_RTC_MINUTES        2
index 7ae49e5808e802d926c7cb9fa4ecbf51d7a5f492..400c1377a5579ddff1a66bda08eb7173c8d36adc 100644 (file)
@@ -81,5 +81,5 @@ SECTIONS
 
        _end = .;
 
-       /DISCARD/ : { *(.comment) *(.note) *(.note.*) }
+       /DISCARD/ : { *(.comment) }
 }