Print this page
OS-2366 ddi_periodic_add(9F) is entirely rubbish


 101 #include <sys/thread.h>
 102 #include <sys/sysconf.h>
 103 #include <sys/vm_machparam.h>
 104 #include <sys/archsystm.h>
 105 #include <sys/machsystm.h>
 106 #include <vm/hat.h>
 107 #include <vm/hat_i86.h>
 108 #include <sys/pmem.h>
 109 #include <sys/smp_impldefs.h>
 110 #include <sys/x86_archext.h>
 111 #include <sys/cpuvar.h>
 112 #include <sys/segments.h>
 113 #include <sys/clconf.h>
 114 #include <sys/kobj.h>
 115 #include <sys/kobj_lex.h>
 116 #include <sys/cpc_impl.h>
 117 #include <sys/cpu_module.h>
 118 #include <sys/smbios.h>
 119 #include <sys/debug_info.h>
 120 #include <sys/bootinfo.h>
 121 #include <sys/ddi_timer.h>
 122 #include <sys/systeminfo.h>
 123 #include <sys/multiboot.h>
 124 
 125 #ifdef  __xpv
 126 
 127 #include <sys/hypervisor.h>
 128 #include <sys/xen_mmu.h>
 129 #include <sys/evtchn_impl.h>
 130 #include <sys/gnttab.h>
 131 #include <sys/xpv_panic.h>
 132 #include <xen/sys/xenbus_comms.h>
 133 #include <xen/public/physdev.h>
 134 
 135 extern void xen_late_startup(void);
 136 
 137 struct xen_evt_data cpu0_evt_data;
 138 
 139 #else   /* __xpv */
 140 #include <sys/memlist_impl.h>
 141 


2228 #if defined(__amd64) && !defined(__xpv)
2229         /*
2230          * Intel IOMMU has been setup/initialized in ddi_impl.c
2231          * Start it up now.
2232          */
2233         immu_startup();
2234 #endif
2235 
2236         PRM_POINT("Enabling interrupts");
2237         (*picinitf)();
2238         sti();
2239 #if defined(__xpv)
2240         ASSERT(CPU->cpu_m.mcpu_vcpu_info->evtchn_upcall_mask == 0);
2241         xen_late_startup();
2242 #endif
2243 
2244         (void) add_avsoftintr((void *)&softlevel1_hdl, 1, softlevel1,
2245             "softlevel1", NULL, NULL); /* XXX to be moved later */
2246 
2247         /*
2248          * Register these software interrupts for ddi timer.
2249          * Software interrupts up to the level 10 are supported.
2250          */
2251         for (i = DDI_IPL_1; i <= DDI_IPL_10; i++) {
2252                 char name[sizeof ("timer_softintr") + 2];
2253                 (void) sprintf(name, "timer_softintr%02d", i);
2254                 (void) add_avsoftintr((void *)&softlevel_hdl[i-1], i,
2255                     (avfunc)timer_softintr, name, (caddr_t)(uintptr_t)i, NULL);

2256         }
2257 
2258 #if !defined(__xpv)
2259         if (modload("drv", "amd_iommu") < 0) {
2260                 PRM_POINT("No AMD IOMMU present\n");
2261         } else if (ddi_hold_installed_driver(ddi_name_to_major(
2262             "amd_iommu")) == NULL) {
2263                 prom_printf("ERROR: failed to attach AMD IOMMU\n");
2264         }
2265 #endif
2266         post_startup_cpu_fixups();
2267 
2268         PRM_POINT("startup_end() done");
2269 }
2270 
2271 /*
2272  * Don't remove the following 2 variables.  They are necessary
2273  * for reading the hostid from the legacy file (/kernel/misc/sysinit).
2274  */
2275 char *_hs1107 = hw_serial;




 101 #include <sys/thread.h>
 102 #include <sys/sysconf.h>
 103 #include <sys/vm_machparam.h>
 104 #include <sys/archsystm.h>
 105 #include <sys/machsystm.h>
 106 #include <vm/hat.h>
 107 #include <vm/hat_i86.h>
 108 #include <sys/pmem.h>
 109 #include <sys/smp_impldefs.h>
 110 #include <sys/x86_archext.h>
 111 #include <sys/cpuvar.h>
 112 #include <sys/segments.h>
 113 #include <sys/clconf.h>
 114 #include <sys/kobj.h>
 115 #include <sys/kobj_lex.h>
 116 #include <sys/cpc_impl.h>
 117 #include <sys/cpu_module.h>
 118 #include <sys/smbios.h>
 119 #include <sys/debug_info.h>
 120 #include <sys/bootinfo.h>
 121 #include <sys/ddi_periodic.h>
 122 #include <sys/systeminfo.h>
 123 #include <sys/multiboot.h>
 124 
 125 #ifdef  __xpv
 126 
 127 #include <sys/hypervisor.h>
 128 #include <sys/xen_mmu.h>
 129 #include <sys/evtchn_impl.h>
 130 #include <sys/gnttab.h>
 131 #include <sys/xpv_panic.h>
 132 #include <xen/sys/xenbus_comms.h>
 133 #include <xen/public/physdev.h>
 134 
 135 extern void xen_late_startup(void);
 136 
 137 struct xen_evt_data cpu0_evt_data;
 138 
 139 #else   /* __xpv */
 140 #include <sys/memlist_impl.h>
 141 


2228 #if defined(__amd64) && !defined(__xpv)
2229         /*
2230          * Intel IOMMU has been setup/initialized in ddi_impl.c
2231          * Start it up now.
2232          */
2233         immu_startup();
2234 #endif
2235 
2236         PRM_POINT("Enabling interrupts");
2237         (*picinitf)();
2238         sti();
2239 #if defined(__xpv)
2240         ASSERT(CPU->cpu_m.mcpu_vcpu_info->evtchn_upcall_mask == 0);
2241         xen_late_startup();
2242 #endif
2243 
2244         (void) add_avsoftintr((void *)&softlevel1_hdl, 1, softlevel1,
2245             "softlevel1", NULL, NULL); /* XXX to be moved later */
2246 
2247         /*
2248          * Register software interrupt handlers for ddi_periodic_add(9F).
2249          * Software interrupts up to the level 10 are supported.
2250          */
2251         for (i = DDI_IPL_1; i <= DDI_IPL_10; i++) {


2252                 (void) add_avsoftintr((void *)&softlevel_hdl[i-1], i,
2253                     (avfunc)ddi_periodic_softintr, "ddi_periodic",
2254                     (caddr_t)(uintptr_t)i, NULL);
2255         }
2256 
2257 #if !defined(__xpv)
2258         if (modload("drv", "amd_iommu") < 0) {
2259                 PRM_POINT("No AMD IOMMU present\n");
2260         } else if (ddi_hold_installed_driver(ddi_name_to_major(
2261             "amd_iommu")) == NULL) {
2262                 prom_printf("ERROR: failed to attach AMD IOMMU\n");
2263         }
2264 #endif
2265         post_startup_cpu_fixups();
2266 
2267         PRM_POINT("startup_end() done");
2268 }
2269 
2270 /*
2271  * Don't remove the following 2 variables.  They are necessary
2272  * for reading the hostid from the legacy file (/kernel/misc/sysinit).
2273  */
2274 char *_hs1107 = hw_serial;