Print this page
XXX nobios


 124 #ifdef __xpv
 125 start_info_t *xen_info;
 126 shared_info_t *HYPERVISOR_shared_info;
 127 #endif
 128 
 129 /*
 130  * some allocator statistics
 131  */
 132 static ulong_t total_bop_alloc_scratch = 0;
 133 static ulong_t total_bop_alloc_kernel = 0;
 134 
 135 static void build_firmware_properties(void);
 136 
 137 static int early_allocation = 1;
 138 
 139 int force_fastreboot = 0;
 140 volatile int fastreboot_onpanic = 0;
 141 int post_fastreboot = 0;
 142 #ifdef  __xpv
 143 volatile int fastreboot_capable = 0;

 144 #else
 145 volatile int fastreboot_capable = 1;

 146 #endif
 147 
 148 /*
 149  * Information saved from current boot for fast reboot.
 150  * If the information size exceeds what we have allocated, fast reboot
 151  * will not be supported.
 152  */
 153 multiboot_info_t saved_mbi;
 154 mb_memory_map_t saved_mmap[FASTBOOT_SAVED_MMAP_COUNT];
 155 uint8_t saved_drives[FASTBOOT_SAVED_DRIVES_SIZE];
 156 char saved_cmdline[FASTBOOT_SAVED_CMDLINE_LEN];
 157 int saved_cmdline_len = 0;
 158 size_t saved_file_size[FASTBOOT_MAX_FILES_MAP];
 159 
 160 /*
 161  * Turn off fastreboot_onpanic to avoid panic loop.
 162  */
 163 char fastreboot_onpanic_cmdline[FASTBOOT_SAVED_CMDLINE_LEN];
 164 static const char fastreboot_onpanic_args[] = " -B fastreboot_onpanic=0";
 165 


2492                 }
2493         }
2494 
2495         /*
2496          * Use Maximum Physical Address from the MSCT table as upper limit for
2497          * memory hot-adding by default. It may be overridden by value from
2498          * the SRAT table or the "plat-dr-physmax" boot option.
2499          */
2500         plat_dr_physmax = btop(tp->MaxAddress + 1);
2501 
2502         /*
2503          * Existence of MSCT implies CPU/memory hotplug-capability for the
2504          * platform.
2505          */
2506         plat_dr_options |= PLAT_DR_FEATURE_CPU;
2507         plat_dr_options |= PLAT_DR_FEATURE_MEMORY;
2508 
2509         return (tp);
2510 }
2511 










































2512 #else /* __xpv */
2513 static void
2514 enumerate_xen_cpus()
2515 {
2516         processorid_t   id, max_id;
2517 
2518         /*
2519          * User-set boot-ncpus overrides enumeration
2520          */
2521         if (do_bsys_getproplen(NULL, BOOT_NCPUS_NAME) >= 0)
2522                 return;
2523 
2524         /*
2525          * Probe every possible virtual CPU id and remember the
2526          * highest id present; the count of CPUs is one greater
2527          * than this.  This tacitly assumes at least cpu 0 is present.
2528          */
2529         max_id = 0;
2530         for (id = 0; id < MAX_VIRT_CPUS; id++)
2531                 if (HYPERVISOR_vcpu_op(VCPUOP_is_up, id, NULL) == 0)
2532                         max_id = id;
2533 
2534         bsetpropsi(BOOT_NCPUS_NAME, max_id+1);
2535 
2536 }
2537 #endif /* __xpv */
2538 
2539 static void
2540 build_firmware_properties(void)
2541 {
2542         ACPI_TABLE_HEADER *tp = NULL;
2543 
2544 #ifndef __xpv



2545         if ((tp = find_fw_table(ACPI_SIG_MSCT)) != NULL)
2546                 msct_ptr = process_msct((ACPI_TABLE_MSCT *)tp);
2547         else
2548                 msct_ptr = NULL;
2549 
2550         if ((tp = find_fw_table(ACPI_SIG_MADT)) != NULL)
2551                 process_madt((ACPI_TABLE_MADT *)tp);
2552 
2553         if ((srat_ptr = (ACPI_TABLE_SRAT *)
2554             find_fw_table(ACPI_SIG_SRAT)) != NULL)
2555                 process_srat(srat_ptr);
2556 
2557         if (slit_ptr = (ACPI_TABLE_SLIT *)find_fw_table(ACPI_SIG_SLIT))
2558                 process_slit(slit_ptr);
2559 
2560         tp = find_fw_table(ACPI_SIG_MCFG);
2561 #else /* __xpv */
2562         enumerate_xen_cpus();
2563         if (DOMAIN_IS_INITDOMAIN(xen_info))
2564                 tp = find_fw_table(ACPI_SIG_MCFG);




 124 #ifdef __xpv
 125 start_info_t *xen_info;
 126 shared_info_t *HYPERVISOR_shared_info;
 127 #endif
 128 
 129 /*
 130  * some allocator statistics
 131  */
 132 static ulong_t total_bop_alloc_scratch = 0;
 133 static ulong_t total_bop_alloc_kernel = 0;
 134 
 135 static void build_firmware_properties(void);
 136 
 137 static int early_allocation = 1;
 138 
 139 int force_fastreboot = 0;
 140 volatile int fastreboot_onpanic = 0;
 141 int post_fastreboot = 0;
 142 #ifdef  __xpv
 143 volatile int fastreboot_capable = 0;
 144 boolean_t bios_calls_available = B_FALSE;
 145 #else
 146 volatile int fastreboot_capable = 1;
 147 boolean_t bios_calls_available = B_TRUE;
 148 #endif
 149 
 150 /*
 151  * Information saved from current boot for fast reboot.
 152  * If the information size exceeds what we have allocated, fast reboot
 153  * will not be supported.
 154  */
 155 multiboot_info_t saved_mbi;
 156 mb_memory_map_t saved_mmap[FASTBOOT_SAVED_MMAP_COUNT];
 157 uint8_t saved_drives[FASTBOOT_SAVED_DRIVES_SIZE];
 158 char saved_cmdline[FASTBOOT_SAVED_CMDLINE_LEN];
 159 int saved_cmdline_len = 0;
 160 size_t saved_file_size[FASTBOOT_MAX_FILES_MAP];
 161 
 162 /*
 163  * Turn off fastreboot_onpanic to avoid panic loop.
 164  */
 165 char fastreboot_onpanic_cmdline[FASTBOOT_SAVED_CMDLINE_LEN];
 166 static const char fastreboot_onpanic_args[] = " -B fastreboot_onpanic=0";
 167 


2494                 }
2495         }
2496 
2497         /*
2498          * Use Maximum Physical Address from the MSCT table as upper limit for
2499          * memory hot-adding by default. It may be overridden by value from
2500          * the SRAT table or the "plat-dr-physmax" boot option.
2501          */
2502         plat_dr_physmax = btop(tp->MaxAddress + 1);
2503 
2504         /*
2505          * Existence of MSCT implies CPU/memory hotplug-capability for the
2506          * platform.
2507          */
2508         plat_dr_options |= PLAT_DR_FEATURE_CPU;
2509         plat_dr_options |= PLAT_DR_FEATURE_MEMORY;
2510 
2511         return (tp);
2512 }
2513 
2514 /*
2515  * If this system has a PC-compatible BIOS, it will have handlers for
2516  * various well-known BIOS calls.  These calls take the form of INT
2517  * instructions, revectoring to the nominated entry in the real mode
2518  * Interrupt Vector Table (IVT).  If all of the commonly used entries (from
2519  * INT 10h up to INT 1Ah) are zero, we almost certainly don't want to make
2520  * use of BOP_DOINT() later.
2521  *
2522  * The IVT begins at linear address 0 on the 8086.  Though later CPUs
2523  * allowed it to be moved, it seems that most BIOS implementations choose
2524  * not to do so for compatibility reasons.  Our BIOS call trampoline (see
2525  * "idt_info" in "uts/i86pc/ml/bios_call_src.s") also assumes this address.
2526  */
2527 static int
2528 system_has_bios(void)
2529 {
2530         uint32_t all_ivts = 0;
2531 
2532         DBG_MSG("\nBIOS IVT Entries:\n");
2533         for (uint32_t intnum = 0x10; intnum <= 0x1a; intnum++) {
2534                 /*
2535                  * The first software interrupt number (i.e. INT 0h) maps to
2536                  * vector number 32 in the IVT.  Each entry in the IVT is
2537                  * four bytes, describing a 16 bit far call address.
2538                  */
2539                 uintptr_t slot = 4 * (32 + intnum);
2540                 uint32_t ivte = *((uint32_t *)slot);
2541 
2542                 if (ivte != 0) {
2543                         DBG(intnum);
2544                         DBG(ivte);
2545                 }
2546                 all_ivts |= ivte;
2547         }
2548         if (all_ivts == 0) {
2549                 DBG_MSG("System has no BIOS IVT entries\n");
2550         }
2551         DBG_MSG("\n");
2552 
2553         return (all_ivts != 0);
2554 }
2555 
2556 #else /* __xpv */
2557 static void
2558 enumerate_xen_cpus()
2559 {
2560         processorid_t   id, max_id;
2561 
2562         /*
2563          * User-set boot-ncpus overrides enumeration
2564          */
2565         if (do_bsys_getproplen(NULL, BOOT_NCPUS_NAME) >= 0)
2566                 return;
2567 
2568         /*
2569          * Probe every possible virtual CPU id and remember the
2570          * highest id present; the count of CPUs is one greater
2571          * than this.  This tacitly assumes at least cpu 0 is present.
2572          */
2573         max_id = 0;
2574         for (id = 0; id < MAX_VIRT_CPUS; id++)
2575                 if (HYPERVISOR_vcpu_op(VCPUOP_is_up, id, NULL) == 0)
2576                         max_id = id;
2577 
2578         bsetpropsi(BOOT_NCPUS_NAME, max_id+1);
2579 
2580 }
2581 #endif /* __xpv */
2582 
2583 static void
2584 build_firmware_properties(void)
2585 {
2586         ACPI_TABLE_HEADER *tp = NULL;
2587 
2588 #ifndef __xpv
2589         if (do_bsys_getproplen(NULL, "no-bios") > 0 || !system_has_bios())
2590                 bios_calls_available = B_FALSE;
2591 
2592         if ((tp = find_fw_table(ACPI_SIG_MSCT)) != NULL)
2593                 msct_ptr = process_msct((ACPI_TABLE_MSCT *)tp);
2594         else
2595                 msct_ptr = NULL;
2596 
2597         if ((tp = find_fw_table(ACPI_SIG_MADT)) != NULL)
2598                 process_madt((ACPI_TABLE_MADT *)tp);
2599 
2600         if ((srat_ptr = (ACPI_TABLE_SRAT *)
2601             find_fw_table(ACPI_SIG_SRAT)) != NULL)
2602                 process_srat(srat_ptr);
2603 
2604         if (slit_ptr = (ACPI_TABLE_SLIT *)find_fw_table(ACPI_SIG_SLIT))
2605                 process_slit(slit_ptr);
2606 
2607         tp = find_fw_table(ACPI_SIG_MCFG);
2608 #else /* __xpv */
2609         enumerate_xen_cpus();
2610         if (DOMAIN_IS_INITDOMAIN(xen_info))
2611                 tp = find_fw_table(ACPI_SIG_MCFG);