Print this page
4804 apix & pcplusmp are nearly warning free already
Tentatively Reviewed by: Robert Mustacchi <rm@joyent.com>


 198         apic_timer_disable,
 199         apic_post_cyclic_setup,
 200         apic_preshutdown,
 201         apic_intr_ops,                  /* Advanced DDI Interrupt framework */
 202         apic_state,                     /* save, restore apic state for S3 */
 203         apic_cpu_ops,                   /* CPU control interface. */
 204 };
 205 
 206 struct psm_ops *psmops = &apic_ops;
 207 
 208 static struct   psm_info apic_psm_info = {
 209         PSM_INFO_VER01_7,                       /* version */
 210         PSM_OWN_EXCLUSIVE,                      /* ownership */
 211         (struct psm_ops *)&apic_ops,                /* operation */
 212         APIC_PCPLUSMP_NAME,                     /* machine name */
 213         "pcplusmp v1.4 compatible",
 214 };
 215 
 216 static void *apic_hdlp;
 217 
 218 /*
 219  * apic_let_idle_redistribute can have the following values:
 220  * 0 - If clock decremented it from 1 to 0, clock has to call redistribute.
 221  * apic_redistribute_lock prevents multiple idle cpus from redistributing
 222  */
 223 int     apic_num_idle_redistributions = 0;
 224 static  int apic_let_idle_redistribute = 0;
 225 
 226 /* to gather intr data and redistribute */
 227 static void apic_redistribute_compute(void);
 228 
 229 /*
 230  *      This is the loadable module wrapper
 231  */
 232 
 233 int
 234 _init(void)
 235 {
 236         if (apic_coarse_hrtime)
 237                 apic_ops.psm_gethrtime = &apic_gettime;
 238         return (psm_mod_init(&apic_hdlp, &apic_psm_info));
 239 }
 240 
 241 int
 242 _fini(void)
 243 {
 244         return (psm_mod_fini(&apic_hdlp, &apic_psm_info));
 245 }


 781          * APIC_CPU_ONLINE flag here rather than setting aci_status completely.
 782          */
 783         cpun = psm_get_cpu_id();
 784         apic_cpus[cpun].aci_status |= APIC_CPU_ONLINE;
 785 
 786         apic_reg_ops->apic_write(APIC_DIVIDE_REG, apic_divide_reg_init);
 787         return (PSM_SUCCESS);
 788 }
 789 
 790 /*
 791  * type == -1 indicates it is an internal request. Do not change
 792  * resv_vector for these requests
 793  */
 794 static int
 795 apic_get_ipivect(int ipl, int type)
 796 {
 797         uchar_t vector;
 798         int irq;
 799 
 800         if ((irq = apic_allocate_irq(APIC_VECTOR(ipl))) != -1) {
 801                 if (vector = apic_allocate_vector(ipl, irq, 1)) {
 802                         apic_irq_table[irq]->airq_mps_intr_index =
 803                             RESERVE_INDEX;
 804                         apic_irq_table[irq]->airq_vector = vector;
 805                         if (type != -1) {
 806                                 apic_resv_vector[ipl] = vector;
 807                         }
 808                         return (irq);
 809                 }
 810         }
 811         apic_error |= APIC_ERR_GET_IPIVECT_FAIL;
 812         return (-1);    /* shouldn't happen */
 813 }
 814 
 815 static int
 816 apic_getclkirq(int ipl)
 817 {
 818         int     irq;
 819 
 820         if ((irq = apic_get_ipivect(ipl, -1)) == -1)
 821                 return (-1);




 198         apic_timer_disable,
 199         apic_post_cyclic_setup,
 200         apic_preshutdown,
 201         apic_intr_ops,                  /* Advanced DDI Interrupt framework */
 202         apic_state,                     /* save, restore apic state for S3 */
 203         apic_cpu_ops,                   /* CPU control interface. */
 204 };
 205 
 206 struct psm_ops *psmops = &apic_ops;
 207 
 208 static struct   psm_info apic_psm_info = {
 209         PSM_INFO_VER01_7,                       /* version */
 210         PSM_OWN_EXCLUSIVE,                      /* ownership */
 211         (struct psm_ops *)&apic_ops,                /* operation */
 212         APIC_PCPLUSMP_NAME,                     /* machine name */
 213         "pcplusmp v1.4 compatible",
 214 };
 215 
 216 static void *apic_hdlp;
 217 








 218 /* to gather intr data and redistribute */
 219 static void apic_redistribute_compute(void);
 220 
 221 /*
 222  *      This is the loadable module wrapper
 223  */
 224 
 225 int
 226 _init(void)
 227 {
 228         if (apic_coarse_hrtime)
 229                 apic_ops.psm_gethrtime = &apic_gettime;
 230         return (psm_mod_init(&apic_hdlp, &apic_psm_info));
 231 }
 232 
 233 int
 234 _fini(void)
 235 {
 236         return (psm_mod_fini(&apic_hdlp, &apic_psm_info));
 237 }


 773          * APIC_CPU_ONLINE flag here rather than setting aci_status completely.
 774          */
 775         cpun = psm_get_cpu_id();
 776         apic_cpus[cpun].aci_status |= APIC_CPU_ONLINE;
 777 
 778         apic_reg_ops->apic_write(APIC_DIVIDE_REG, apic_divide_reg_init);
 779         return (PSM_SUCCESS);
 780 }
 781 
 782 /*
 783  * type == -1 indicates it is an internal request. Do not change
 784  * resv_vector for these requests
 785  */
 786 static int
 787 apic_get_ipivect(int ipl, int type)
 788 {
 789         uchar_t vector;
 790         int irq;
 791 
 792         if ((irq = apic_allocate_irq(APIC_VECTOR(ipl))) != -1) {
 793                 if ((vector = apic_allocate_vector(ipl, irq, 1))) {
 794                         apic_irq_table[irq]->airq_mps_intr_index =
 795                             RESERVE_INDEX;
 796                         apic_irq_table[irq]->airq_vector = vector;
 797                         if (type != -1) {
 798                                 apic_resv_vector[ipl] = vector;
 799                         }
 800                         return (irq);
 801                 }
 802         }
 803         apic_error |= APIC_ERR_GET_IPIVECT_FAIL;
 804         return (-1);    /* shouldn't happen */
 805 }
 806 
 807 static int
 808 apic_getclkirq(int ipl)
 809 {
 810         int     irq;
 811 
 812         if ((irq = apic_get_ipivect(ipl, -1)) == -1)
 813                 return (-1);