Message ID | 1431893048-5214-25-git-send-email-parth.dixit@linaro.org |
---|---|
State | New |
Headers | show |
On 20 May 2015 at 21:46, Jan Beulich <JBeulich@suse.com> wrote: > >>> On 17.05.15 at 22:03, <parth.dixit@linaro.org> wrote: > > --- a/xen/include/xen/efi.h > > +++ b/xen/include/xen/efi.h > > @@ -8,7 +8,7 @@ > > extern const bool_t efi_enabled; > > > > #define EFI_INVALID_TABLE_ADDR (~0UL) > > - > > +#define EFI_MEM_DESC_V1 1 > > /* Add fields here only if they need to be referenced from non-EFI > code. */ > > struct efi { > > unsigned long mps; /* MPS table */ > > @@ -20,6 +20,15 @@ struct efi { > > > > extern struct efi efi; > > > > +struct efi_memory_desc { > > + u32 type; > > + u32 pad; > > + u64 phys_addr; > > + u64 virt_addr; > > + u64 num_pages; > > + u64 attribute; > > +}; > > + > > #ifndef __ASSEMBLY__ > > > > union xenpf_efi_info; > > NAK - you're supposed to use what is already there, or give a good > reason why redundant declarations are needed. > > I thought efi fields that need to be refreneced from non-efi code can be added here. Is this not correct? Although i am rethinking about the design so that efi tables are extracted in the common efi code and passed to non efi code as it is done in case of device tree. I'll post rfc for that would that be okay? > Jan > >
+shannon On 26 May 2015 at 13:51, Jan Beulich <JBeulich@suse.com> wrote: >>>> On 24.05.15 at 08:30, <parth.dixit@linaro.org> wrote: >> On 20 May 2015 at 21:46, Jan Beulich <JBeulich@suse.com> wrote: >> >>> >>> On 17.05.15 at 22:03, <parth.dixit@linaro.org> wrote: >>> > --- a/xen/include/xen/efi.h >>> > +++ b/xen/include/xen/efi.h >>> > @@ -8,7 +8,7 @@ >>> > extern const bool_t efi_enabled; >>> > >>> > #define EFI_INVALID_TABLE_ADDR (~0UL) >>> > - >>> > +#define EFI_MEM_DESC_V1 1 >>> > /* Add fields here only if they need to be referenced from non-EFI >>> code. */ >>> > struct efi { >>> > unsigned long mps; /* MPS table */ >>> > @@ -20,6 +20,15 @@ struct efi { >>> > >>> > extern struct efi efi; >>> > >>> > +struct efi_memory_desc { >>> > + u32 type; >>> > + u32 pad; >>> > + u64 phys_addr; >>> > + u64 virt_addr; >>> > + u64 num_pages; >>> > + u64 attribute; >>> > +}; >>> > + >>> > #ifndef __ASSEMBLY__ >>> > >>> > union xenpf_efi_info; >>> >>> NAK - you're supposed to use what is already there, or give a good >>> reason why redundant declarations are needed. >>> >>> I thought efi fields that need to be refreneced from non-efi code can be >> added here. >> Is this not correct? >> Although i am rethinking about the design so that efi tables are extracted >> in the common efi code and passed >> to non efi code as it is done in case of device tree. I'll post rfc for >> that would that be okay? > > At the first glance this would seem to be the right approach. > > Btw - please correct your reply style such that it is immediately clear > which parts comprise your response and which parts are what you > respond to (you have a misguiding > on the first line of your reply > text here as well as in the reply to 02/41). > > Jan >
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index e688a78..865b81a 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -10,6 +10,7 @@ #include <xen/errno.h> #include <xen/device_tree.h> #include <xen/acpi.h> +#include <xen/efi.h> #include <xen/libfdt/libfdt.h> #include <xen/guest_access.h> #include <xen/iocap.h> @@ -1219,6 +1220,51 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, return res; } #ifdef CONFIG_ACPI +/* + * Create place holder for efi values. + * Actual values will be replaced later + */ +static int make_efi_nodes(struct domain *d,void *fdt, + const struct kernel_info *kinfo) +{ + u64 fdt_val64; + u32 fdt_val32; + int desc_size = sizeof(struct efi_memory_desc); + int desc_ver = EFI_MEM_DESC_V1; + int res; + u64 addr = 0; + + fdt_val64 = cpu_to_fdt64((u64)(uintptr_t)addr); + res = fdt_property(fdt, "linux,uefi-system-table", + &fdt_val64, sizeof(fdt_val64)); + if ( res ) + return res; + + fdt_val64 = cpu_to_fdt64((u64)(uintptr_t)addr); + res = fdt_property(fdt, "linux,uefi-mmap-start", + &fdt_val64, sizeof(fdt_val64)); + if ( res ) + return res; + + fdt_val32 = cpu_to_fdt32(desc_size); + res = fdt_property(fdt, "linux,uefi-mmap-size", + &fdt_val32, sizeof(fdt_val32)); + if ( res ) + return res; + + fdt_val32 = cpu_to_fdt32(desc_size); + res = fdt_property(fdt, "linux,uefi-mmap-desc-size", + &fdt_val32, sizeof(fdt_val32)); + if ( res ) + return res; + + fdt_val32 = cpu_to_fdt32(desc_ver); + res = fdt_property(fdt, "linux,uefi-mmap-desc-ver", + &fdt_val32, sizeof(fdt_val32)); + + return res; +} + static int make_chosen_node(struct domain *d, const struct kernel_info *kinfo) { int res = 0; @@ -1255,6 +1301,10 @@ static int make_chosen_node(struct domain *d, const struct kernel_info *kinfo) return res; } + res = make_efi_nodes(d, fdt, kinfo); + if ( res ) + return res; + res = fdt_end_node(fdt); return res; diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h index 48de8e0..26b2f45 100644 --- a/xen/include/xen/efi.h +++ b/xen/include/xen/efi.h @@ -8,7 +8,7 @@ extern const bool_t efi_enabled; #define EFI_INVALID_TABLE_ADDR (~0UL) - +#define EFI_MEM_DESC_V1 1 /* Add fields here only if they need to be referenced from non-EFI code. */ struct efi { unsigned long mps; /* MPS table */ @@ -20,6 +20,15 @@ struct efi { extern struct efi efi; +struct efi_memory_desc { + u32 type; + u32 pad; + u64 phys_addr; + u64 virt_addr; + u64 num_pages; + u64 attribute; +}; + #ifndef __ASSEMBLY__ union xenpf_efi_info;
RSDP and memory map will be passed via efi table. DTB wil contain the address of EFI table, starting address of memory map desctiption table and description size. Address of EFI table and memory map description is not available at the time creation of DT. Create stub entries which will be fixed later Signed-off-by: Parth Dixit <parth.dixit@linaro.org> --- xen/arch/arm/domain_build.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ xen/include/xen/efi.h | 11 +++++++++- 2 files changed, 60 insertions(+), 1 deletion(-)