This source file includes following definitions.
- pvh_get_root_pointer
- mem_map_via_hcall
- init_pvh_bootparams
- xen_pvh_init
- hypervisor_specific_init
- xen_prepare_pvh
   1 
   2 #include <linux/acpi.h>
   3 
   4 #include <xen/hvc-console.h>
   5 
   6 #include <asm/io_apic.h>
   7 #include <asm/hypervisor.h>
   8 #include <asm/e820/api.h>
   9 #include <asm/x86_init.h>
  10 
  11 #include <asm/xen/interface.h>
  12 
  13 #include <xen/xen.h>
  14 #include <xen/interface/hvm/start_info.h>
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 struct boot_params pvh_bootparams __attribute__((section(".data")));
  23 struct hvm_start_info pvh_start_info __attribute__((section(".data")));
  24 
  25 unsigned int pvh_start_info_sz = sizeof(pvh_start_info);
  26 
  27 static u64 pvh_get_root_pointer(void)
  28 {
  29         return pvh_start_info.rsdp_paddr;
  30 }
  31 
  32 
  33 
  34 
  35 
  36 
  37 
  38 
  39 void __init __weak mem_map_via_hcall(struct boot_params *ptr __maybe_unused)
  40 {
  41         xen_raw_printk("Error: Could not find memory map\n");
  42         BUG();
  43 }
  44 
  45 static void __init init_pvh_bootparams(bool xen_guest)
  46 {
  47         if ((pvh_start_info.version > 0) && (pvh_start_info.memmap_entries)) {
  48                 struct hvm_memmap_table_entry *ep;
  49                 int i;
  50 
  51                 ep = __va(pvh_start_info.memmap_paddr);
  52                 pvh_bootparams.e820_entries = pvh_start_info.memmap_entries;
  53 
  54                 for (i = 0; i < pvh_bootparams.e820_entries ; i++, ep++) {
  55                         pvh_bootparams.e820_table[i].addr = ep->addr;
  56                         pvh_bootparams.e820_table[i].size = ep->size;
  57                         pvh_bootparams.e820_table[i].type = ep->type;
  58                 }
  59         } else if (xen_guest) {
  60                 mem_map_via_hcall(&pvh_bootparams);
  61         } else {
  62                 
  63                 BUG();
  64         }
  65 
  66         if (pvh_bootparams.e820_entries < E820_MAX_ENTRIES_ZEROPAGE - 1) {
  67                 pvh_bootparams.e820_table[pvh_bootparams.e820_entries].addr =
  68                         ISA_START_ADDRESS;
  69                 pvh_bootparams.e820_table[pvh_bootparams.e820_entries].size =
  70                         ISA_END_ADDRESS - ISA_START_ADDRESS;
  71                 pvh_bootparams.e820_table[pvh_bootparams.e820_entries].type =
  72                         E820_TYPE_RESERVED;
  73                 pvh_bootparams.e820_entries++;
  74         } else
  75                 xen_raw_printk("Warning: Can fit ISA range into e820\n");
  76 
  77         pvh_bootparams.hdr.cmd_line_ptr =
  78                 pvh_start_info.cmdline_paddr;
  79 
  80         
  81         if (pvh_start_info.nr_modules) {
  82                 struct hvm_modlist_entry *modaddr =
  83                         __va(pvh_start_info.modlist_paddr);
  84                 pvh_bootparams.hdr.ramdisk_image = modaddr->paddr;
  85                 pvh_bootparams.hdr.ramdisk_size = modaddr->size;
  86         }
  87 
  88         
  89 
  90 
  91 
  92 
  93 
  94         pvh_bootparams.hdr.version = (2 << 8) | 12;
  95         pvh_bootparams.hdr.type_of_loader = ((xen_guest ? 0x9 : 0xb) << 4) | 0;
  96 
  97         x86_init.acpi.get_root_pointer = pvh_get_root_pointer;
  98 }
  99 
 100 
 101 
 102 
 103 
 104 void __init __weak xen_pvh_init(struct boot_params *boot_params)
 105 {
 106         xen_raw_printk("Error: Missing xen PVH initialization\n");
 107         BUG();
 108 }
 109 
 110 static void hypervisor_specific_init(bool xen_guest)
 111 {
 112         if (xen_guest)
 113                 xen_pvh_init(&pvh_bootparams);
 114 }
 115 
 116 
 117 
 118 
 119 
 120 void __init xen_prepare_pvh(void)
 121 {
 122 
 123         u32 msr = xen_cpuid_base();
 124         bool xen_guest = !!msr;
 125 
 126         if (pvh_start_info.magic != XEN_HVM_START_MAGIC_VALUE) {
 127                 xen_raw_printk("Error: Unexpected magic value (0x%08x)\n",
 128                                 pvh_start_info.magic);
 129                 BUG();
 130         }
 131 
 132         memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
 133 
 134         hypervisor_specific_init(xen_guest);
 135 
 136         init_pvh_bootparams(xen_guest);
 137 }