4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2017, Joyent, Inc.
  25  */
  26 /*
  27  * Copyright (c) 2010, Intel Corporation.
  28  * All rights reserved.
  29  */
  30 
  31 #include <sys/types.h>
  32 #include <sys/t_lock.h>
  33 #include <sys/param.h>
  34 #include <sys/segments.h>
  35 #include <sys/sysmacros.h>
  36 #include <sys/signal.h>
  37 #include <sys/systm.h>
  38 #include <sys/user.h>
  39 #include <sys/mman.h>
  40 #include <sys/vm.h>
  41 
  42 #include <sys/disp.h>
  43 #include <sys/class.h>
 
 
 154 
 155 /*
 156  * The panicbuf array is used to record messages and state:
 157  */
 158 char panicbuf[PANICBUFSIZE];
 159 
 160 /*
 161  * Flags to control Dynamic Reconfiguration features.
 162  */
 163 uint64_t plat_dr_options;
 164 
 165 /*
 166  * Maximum physical address for memory DR operations.
 167  */
 168 uint64_t plat_dr_physmax;
 169 
 170 /*
 171  * maxphys - used during physio
 172  * klustsize - used for klustering by swapfs and specfs
 173  */
 174 int maxphys = 56 * 1024;    /* XXX See vm_subr.c - max b_count in physio */
 175 int klustsize = 56 * 1024;
 176 
 177 caddr_t p0_va;          /* Virtual address for accessing physical page 0 */
 178 
 179 /*
 180  * defined here, though unused on x86,
 181  * to make kstat_fr.c happy.
 182  */
 183 int vac;
 184 
 185 void debug_enter(char *);
 186 
 187 extern void pm_cfb_check_and_powerup(void);
 188 extern void pm_cfb_rele(void);
 189 
 190 extern fastboot_info_t newkernel;
 191 
 192 /*
 193  * Machine dependent code to reboot.
 194  * "mdep" is interpreted as a character pointer; if non-null, it is a pointer
 
 
1222         return (ENOTSUP);
1223 }
1224 
1225 pgcnt_t
1226 num_phys_pages()
1227 {
1228         pgcnt_t npages = 0;
1229         struct memlist *mp;
1230 
1231 #if defined(__xpv)
1232         if (DOMAIN_IS_INITDOMAIN(xen_info))
1233                 return (xpv_nr_phys_pages());
1234 #endif /* __xpv */
1235 
1236         for (mp = phys_install; mp != NULL; mp = mp->ml_next)
1237                 npages += mp->ml_size >> PAGESHIFT;
1238 
1239         return (npages);
1240 }
1241 
1242 /* cpu threshold for compressed dumps */
1243 #ifdef _LP64
1244 uint_t dump_plat_mincpu_default = DUMP_PLAT_X86_64_MINCPU;
1245 #else
1246 uint_t dump_plat_mincpu_default = DUMP_PLAT_X86_32_MINCPU;
1247 #endif
1248 
1249 int
1250 dump_plat_addr()
1251 {
1252 #ifdef __xpv
1253         pfn_t pfn = mmu_btop(xen_info->shared_info) | PFN_IS_FOREIGN_MFN;
1254         mem_vtop_t mem_vtop;
1255         int cnt;
1256 
1257         /*
1258          * On the hypervisor, we want to dump the page with shared_info on it.
1259          */
1260         if (!IN_XPV_PANIC()) {
1261                 mem_vtop.m_as = &kas;
1262                 mem_vtop.m_va = HYPERVISOR_shared_info;
1263                 mem_vtop.m_pfn = pfn;
1264                 dumpvp_write(&mem_vtop, sizeof (mem_vtop_t));
1265                 cnt = 1;
1266         } else {
1267                 cnt = dump_xpv_addr();
1268         }
 
 | 
 
 
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright 2017, Joyent, Inc.
  26  */
  27 /*
  28  * Copyright (c) 2010, Intel Corporation.
  29  * All rights reserved.
  30  */
  31 
  32 #include <sys/types.h>
  33 #include <sys/t_lock.h>
  34 #include <sys/param.h>
  35 #include <sys/segments.h>
  36 #include <sys/sysmacros.h>
  37 #include <sys/signal.h>
  38 #include <sys/systm.h>
  39 #include <sys/user.h>
  40 #include <sys/mman.h>
  41 #include <sys/vm.h>
  42 
  43 #include <sys/disp.h>
  44 #include <sys/class.h>
 
 
 155 
 156 /*
 157  * The panicbuf array is used to record messages and state:
 158  */
 159 char panicbuf[PANICBUFSIZE];
 160 
 161 /*
 162  * Flags to control Dynamic Reconfiguration features.
 163  */
 164 uint64_t plat_dr_options;
 165 
 166 /*
 167  * Maximum physical address for memory DR operations.
 168  */
 169 uint64_t plat_dr_physmax;
 170 
 171 /*
 172  * maxphys - used during physio
 173  * klustsize - used for klustering by swapfs and specfs
 174  */
 175 volatile int maxphys = 56 * 1024; /* See vm_subr.c - max b_bcount in physio */
 176 int klustsize = 56 * 1024;
 177 
 178 caddr_t p0_va;          /* Virtual address for accessing physical page 0 */
 179 
 180 /*
 181  * defined here, though unused on x86,
 182  * to make kstat_fr.c happy.
 183  */
 184 int vac;
 185 
 186 void debug_enter(char *);
 187 
 188 extern void pm_cfb_check_and_powerup(void);
 189 extern void pm_cfb_rele(void);
 190 
 191 extern fastboot_info_t newkernel;
 192 
 193 /*
 194  * Machine dependent code to reboot.
 195  * "mdep" is interpreted as a character pointer; if non-null, it is a pointer
 
 
1223         return (ENOTSUP);
1224 }
1225 
1226 pgcnt_t
1227 num_phys_pages()
1228 {
1229         pgcnt_t npages = 0;
1230         struct memlist *mp;
1231 
1232 #if defined(__xpv)
1233         if (DOMAIN_IS_INITDOMAIN(xen_info))
1234                 return (xpv_nr_phys_pages());
1235 #endif /* __xpv */
1236 
1237         for (mp = phys_install; mp != NULL; mp = mp->ml_next)
1238                 npages += mp->ml_size >> PAGESHIFT;
1239 
1240         return (npages);
1241 }
1242 
1243 int
1244 dump_plat_addr()
1245 {
1246 #ifdef __xpv
1247         pfn_t pfn = mmu_btop(xen_info->shared_info) | PFN_IS_FOREIGN_MFN;
1248         mem_vtop_t mem_vtop;
1249         int cnt;
1250 
1251         /*
1252          * On the hypervisor, we want to dump the page with shared_info on it.
1253          */
1254         if (!IN_XPV_PANIC()) {
1255                 mem_vtop.m_as = &kas;
1256                 mem_vtop.m_va = HYPERVISOR_shared_info;
1257                 mem_vtop.m_pfn = pfn;
1258                 dumpvp_write(&mem_vtop, sizeof (mem_vtop_t));
1259                 cnt = 1;
1260         } else {
1261                 cnt = dump_xpv_addr();
1262         }
 
 |