<p>Subrata Banik has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21536">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">arch/x86: Add ebda read/write functions into EBDA library<br><br>This patch provides new APIs to write into EBDA area<br>and read from EBDA area based on user input structure.<br><br>Change-Id: I26d5c0ba82c842f0b734a8e0f03abf148737c5c4<br>Signed-off-by: Subrata Banik <subrata.banik@intel.com><br>---<br>M src/arch/x86/ebda.c<br>M src/arch/x86/include/arch/ebda.h<br>2 files changed, 67 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/21536/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/arch/x86/ebda.c b/src/arch/x86/ebda.c<br>index c828aa4..61db30e 100644<br>--- a/src/arch/x86/ebda.c<br>+++ b/src/arch/x86/ebda.c<br>@@ -20,6 +20,58 @@<br> #include <arch/ebda.h><br> #include <arch/acpi.h><br> #include <commonlib/endian.h><br>+#include <console/console.h><br>+<br>+static void *get_ebda_start(void)<br>+{<br>+    return (void *)((uintptr_t)DEFAULT_EBDA_SEGMENT << 4);<br>+}<br>+<br>+/*<br>+ * EBDA area is representing a 1KB memory area just below<br>+ * the top of conventional memory (below 1MB)<br>+ */<br>+<br>+/*<br>+ * write_ebda_data is a wrapper function to write into EBDA area<br>+ * in DWORD mode.<br>+ *<br>+ * data = data to be written into EBDA area<br>+ * length = input data size in bytes<br>+ */<br>+void write_ebda_data(void *data, size_t length)<br>+{<br>+      void *ebda;<br>+  int count = 0;<br>+<br>+    if (length > DEFAULT_EBDA_SIZE)<br>+           die("Input data width is more than EBDA size!");<br>+<br>+        ebda = get_ebda_start();<br>+<br>+  while (count < length) {<br>+          write_le32(ebda, *((uint32_t *)(data + count)));<br>+             count += sizeof(uint32_t);<br>+           ebda += sizeof(uint32_t);<br>+    }<br>+}<br>+<br>+/*<br>+ * read_ebda_data is a wrapper function to read from EBDA area<br>+ *<br>+ * return data read from EBDA area<br>+ */<br>+void *read_ebda_data(size_t length)<br>+{<br>+     void *ebda;<br>+  static void *data;<br>+<br>+        ebda = get_ebda_start();<br>+<br>+  memcpy(data, ebda, length);<br>+<br>+       return data;<br>+}<br> <br> void setup_ebda(u32 low_memory_size, u16 ebda_segment, u16 ebda_size)<br> {<br>@@ -36,7 +88,7 @@<br> <br>         low_memory_kb = low_memory_size >> 10;<br>  ebda_kb = ebda_size >> 10;<br>-     ebda = (void *)((uintptr_t)ebda_segment << 4);<br>+ ebda = get_ebda_start();<br> <br>   /* clear BIOS DATA AREA */<br>    zero_n(X86_BDA_BASE, X86_BDA_SIZE);<br>diff --git a/src/arch/x86/include/arch/ebda.h b/src/arch/x86/include/arch/ebda.h<br>index 428bc92..7e2e4fa 100644<br>--- a/src/arch/x86/include/arch/ebda.h<br>+++ b/src/arch/x86/include/arch/ebda.h<br>@@ -31,5 +31,19 @@<br> <br> void setup_ebda(u32 low_memory_size, u16 ebda_segment, u16 ebda_size);<br> void setup_default_ebda(void);<br>+/*<br>+ * write_ebda_data is a wrapper function to write into EBDA area<br>+ * in DWORD mode.<br>+ *<br>+ * data = data to be written into EBDA area<br>+ * length = input data size in bytes<br>+ */<br>+void write_ebda_data(void *data, size_t length);<br>+/*<br>+ * read_ebda_data is a wrapper function to read from EBDA area<br>+ *<br>+ * return data read from EBDA area<br>+ */<br>+void *read_ebda_data(size_t length);<br> <br> #endif<br></pre><p>To view, visit <a href="https://review.coreboot.org/21536">change 21536</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21536"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I26d5c0ba82c842f0b734a8e0f03abf148737c5c4 </div>
<div style="display:none"> Gerrit-Change-Number: 21536 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Subrata Banik <subrata.banik@intel.com> </div>