summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-10-17 08:10:25 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-17 08:10:25 +0200
commite66acf22a48a8163292eae03bca9baac874905bc (patch)
tree16cbd12d66b6c85637be89a2939306a4c9406ccb /include
parent9156b904baf981561a8ed486db52746b04d2e464 (diff)
parent9341918ba869bcbdd1b9147d1ae85f1f27440557 (diff)
downloadbarebox-e66acf22a48a8163292eae03bca9baac874905bc.tar.gz
barebox-e66acf22a48a8163292eae03bca9baac874905bc.tar.xz
Merge branch 'for-next/rsa'
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/barebox.lds.h80
-rw-r--r--include/command.h21
-rw-r--r--include/rsa.h5
3 files changed, 76 insertions, 30 deletions
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index 74d3ca4a96..b6ca8eb2be 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -16,7 +16,8 @@
#define PRE_IMAGE
#endif
-#define INITCALLS \
+#define BAREBOX_INITCALLS \
+ __barebox_initcalls_start = .; \
KEEP(*(.initcall.0)) \
KEEP(*(.initcall.1)) \
KEEP(*(.initcall.2)) \
@@ -31,34 +32,47 @@
KEEP(*(.initcall.11)) \
KEEP(*(.initcall.12)) \
KEEP(*(.initcall.13)) \
- KEEP(*(.initcall.14))
+ KEEP(*(.initcall.14)) \
+ __barebox_initcalls_end = .;
-#define EXITCALLS \
+#define BAREBOX_EXITCALLS \
+ __barebox_exitcalls_start = .; \
KEEP(*(.exitcall.0)) \
KEEP(*(.exitcall.1)) \
KEEP(*(.exitcall.2)) \
KEEP(*(.exitcall.3)) \
KEEP(*(.exitcall.4)) \
KEEP(*(.exitcall.5)) \
- KEEP(*(.exitcall.6))
-
-#define BAREBOX_CMDS KEEP(*(SORT_BY_NAME(.barebox_cmd*)))
-
-#define BAREBOX_RATP_CMDS KEEP(*(SORT_BY_NAME(.barebox_ratp_cmd*)))
-
-#define BAREBOX_SYMS KEEP(*(__usymtab))
-
-#define BAREBOX_MAGICVARS KEEP(*(SORT_BY_NAME(.barebox_magicvar*)))
-
-#define BAREBOX_CLK_TABLE() \
- . = ALIGN(8); \
+ KEEP(*(.exitcall.6)) \
+ __barebox_exitcalls_end = .;
+
+#define BAREBOX_CMDS \
+ __barebox_cmd_start = .; \
+ KEEP(*(SORT_BY_NAME(.barebox_cmd*))) \
+ __barebox_cmd_end = .;
+
+#define BAREBOX_RATP_CMDS \
+ __barebox_ratp_cmd_start = .; \
+ KEEP(*(SORT_BY_NAME(.barebox_ratp_cmd*))) \
+ __barebox_ratp_cmd_end = .;
+
+#define BAREBOX_SYMS \
+ __usymtab_start = .; \
+ KEEP(*(__usymtab)) \
+ __usymtab_end = .;
+
+#define BAREBOX_MAGICVARS \
+ __barebox_magicvar_start = .; \
+ KEEP(*(SORT_BY_NAME(.barebox_magicvar*))) \
+ __barebox_magicvar_end = .;
+
+#define BAREBOX_CLK_TABLE \
__clk_of_table_start = .; \
KEEP(*(.__clk_of_table)); \
KEEP(*(.__clk_of_table_end)); \
__clk_of_table_end = .;
-#define BAREBOX_DTB() \
- . = ALIGN(8); \
+#define BAREBOX_DTB \
__dtb_start = .; \
KEEP(*(.dtb.rodata.*)); \
__dtb_end = .;
@@ -69,6 +83,38 @@
*(.barebox_imd_0*) \
KEEP(*(.barebox_imd_end))
+#ifdef CONFIG_PCI
+#define BAREBOX_PCI_FIXUP \
+ __start_pci_fixups_early = .; \
+ KEEP(*(.pci_fixup_early)) \
+ __end_pci_fixups_early = .; \
+ __start_pci_fixups_header = .; \
+ KEEP(*(.pci_fixup_header)) \
+ __end_pci_fixups_header = .; \
+ __start_pci_fixups_enable = .; \
+ KEEP(*(.pci_fixup_enable)) \
+ __end_pci_fixups_enable = .;
+#else
+#define BAREBOX_PCI_FIXUP
+#endif
+
+#define BAREBOX_RSA_KEYS \
+ __rsa_keys_start = .; \
+ KEEP(*(.rsa_keys.rodata.*)); \
+ __rsa_keys_end = .; \
+
+#define RO_DATA_SECTION \
+ BAREBOX_INITCALLS \
+ BAREBOX_EXITCALLS \
+ BAREBOX_CMDS \
+ BAREBOX_RATP_CMDS \
+ BAREBOX_SYMS \
+ BAREBOX_MAGICVARS \
+ BAREBOX_CLK_TABLE \
+ BAREBOX_DTB \
+ BAREBOX_RSA_KEYS \
+ BAREBOX_PCI_FIXUP
+
#if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE < CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
#define MAX_BARE_INIT_SIZE CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE
diff --git a/include/command.h b/include/command.h
index 0afc5c7550..7555d0053c 100644
--- a/include/command.h
+++ b/include/command.h
@@ -53,15 +53,10 @@ struct command {
const char *help; /* Help message (long) */
void (*usage)(void);
#endif
-}
-#ifdef __x86_64__
-/* This is required because the linker will put symbols on a 64 bit alignment */
-__attribute__((aligned(64)))
-#endif
-;
+};
-extern struct command __barebox_cmd_start;
-extern struct command __barebox_cmd_end;
+extern struct command * const __barebox_cmd_start[];
+extern struct command * const __barebox_cmd_end[];
/* common/command.c */
@@ -89,10 +84,12 @@ int run_command(const char *cmd);
#endif /* __ASSEMBLY__ */
-#define BAREBOX_CMD_START(_name) \
-extern const struct command __barebox_cmd_##_name; \
-const struct command __barebox_cmd_##_name \
- __attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) = { \
+#define BAREBOX_CMD_START(_name) \
+static struct command __barebox_cmd_##_name; \
+const struct command *barebox_cmd_##_name \
+ __attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) \
+ = &__barebox_cmd_##_name; \
+static struct command __barebox_cmd_##_name = { \
.name = #_name,
#define BAREBOX_CMD_END \
diff --git a/include/rsa.h b/include/rsa.h
index feb8c31200..803660d19a 100644
--- a/include/rsa.h
+++ b/include/rsa.h
@@ -28,6 +28,7 @@ struct rsa_public_key {
uint32_t *modulus; /* modulus as little endian array */
uint32_t *rr; /* R^2 as little endian array */
uint64_t exponent; /* public exponent */
+ char *key_name_hint;
};
/**
@@ -49,6 +50,8 @@ int rsa_verify(const struct rsa_public_key *key, const uint8_t *sig,
/* This is the maximum signature length that we support, in bits */
#define RSA_MAX_SIG_BITS 4096
-int rsa_of_read_key(struct device_node *node, struct rsa_public_key *key);
+struct rsa_public_key *rsa_of_read_key(struct device_node *node);
+void rsa_key_free(struct rsa_public_key *key);
+struct rsa_public_key *rsa_get_key(const char *name);
#endif