Lines Matching defs:hdl

97 #define	HDLOPS(hdl)	((hdl)->cmih_ops)
267 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
269 if (hdl != NULL)
270 hdl->cmih_flags |= CMIH_F_INJACTV;
280 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
282 ASSERT(hdl == NULL || hdl->cmih_flags & CMIH_F_INJACTV);
283 if (hdl != NULL)
284 hdl->cmih_flags &= ~CMIH_F_INJACTV;
302 #define CMI_MSRI_HASHIDX(hdl, msr) \
303 (((uintptr_t)(hdl) >> 3 + (msr)) % (CMI_MSRI_HASHSZ - 1))
318 #define CMI_MSRI_MATCH(ent, hdl, req_msr) \
319 ((ent)->msrie_hdl == (hdl) && (ent)->msrie_msrnum == (req_msr))
324 msri_addent(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t val)
326 int idx = CMI_MSRI_HASHIDX(hdl, msr);
333 if (CMI_MSRI_MATCH(hep, hdl, msr))
341 hep->msrie_hdl = hdl;
360 msri_lookup(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t *valp)
362 int idx = CMI_MSRI_HASHIDX(hdl, msr);
378 if (CMI_MSRI_MATCH(hep, hdl, msr)) {
393 msri_rment(cmi_hdl_impl_t *hdl, uint_t msr)
396 int idx = CMI_MSRI_HASHIDX(hdl, msr);
404 if (CMI_MSRI_MATCH(hep, hdl, msr)) {
576 #define HDLPRIV(hdl) ((cpu_t *)(hdl)->cmih_hdlpriv)
579 ntv_vendor(cmi_hdl_impl_t *hdl)
581 return (cpuid_getvendor(HDLPRIV(hdl)));
585 ntv_vendorstr(cmi_hdl_impl_t *hdl)
587 return (cpuid_getvendorstr(HDLPRIV(hdl)));
591 ntv_family(cmi_hdl_impl_t *hdl)
593 return (cpuid_getfamily(HDLPRIV(hdl)));
597 ntv_model(cmi_hdl_impl_t *hdl)
599 return (cpuid_getmodel(HDLPRIV(hdl)));
603 ntv_stepping(cmi_hdl_impl_t *hdl)
605 return (cpuid_getstep(HDLPRIV(hdl)));
609 ntv_chipid(cmi_hdl_impl_t *hdl)
611 return (hdl->cmih_chipid);
616 ntv_procnodeid(cmi_hdl_impl_t *hdl)
618 return (hdl->cmih_procnodeid);
622 ntv_procnodes_per_pkg(cmi_hdl_impl_t *hdl)
624 return (hdl->cmih_procnodes_per_pkg);
628 ntv_coreid(cmi_hdl_impl_t *hdl)
630 return (hdl->cmih_coreid);
634 ntv_strandid(cmi_hdl_impl_t *hdl)
636 return (hdl->cmih_strandid);
640 ntv_strand_apicid(cmi_hdl_impl_t *hdl)
642 return (cpuid_get_apicid(HDLPRIV(hdl)));
646 ntv_smbiosid(cmi_hdl_impl_t *hdl)
648 return (hdl->cmih_smbiosid);
652 ntv_smb_chipid(cmi_hdl_impl_t *hdl)
654 return (hdl->cmih_smb_chipid);
658 ntv_smb_bboard(cmi_hdl_impl_t *hdl)
660 return (hdl->cmih_smb_bboard);
664 ntv_chiprev(cmi_hdl_impl_t *hdl)
666 return (cpuid_getchiprev(HDLPRIV(hdl)));
670 ntv_chiprevstr(cmi_hdl_impl_t *hdl)
672 return (cpuid_getchiprevstr(HDLPRIV(hdl)));
676 ntv_getsockettype(cmi_hdl_impl_t *hdl)
678 return (cpuid_getsockettype(HDLPRIV(hdl)));
682 ntv_getsocketstr(cmi_hdl_impl_t *hdl)
684 return (cpuid_getsocketstr(HDLPRIV(hdl)));
688 ntv_logical_id(cmi_hdl_impl_t *hdl)
690 return (HDLPRIV(hdl)->cpu_id);
707 ntv_getcr4(cmi_hdl_impl_t *hdl)
709 cpu_t *cp = HDLPRIV(hdl);
731 ntv_setcr4(cmi_hdl_impl_t *hdl, ulong_t val)
733 cpu_t *cp = HDLPRIV(hdl);
765 ntv_rdmsr(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t *valp)
767 cpu_t *cp = HDLPRIV(hdl);
769 if (!(hdl->cmih_msrsrc & CMI_MSR_FLAG_RD_HWOK))
803 ntv_wrmsr(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t val)
805 cpu_t *cp = HDLPRIV(hdl);
807 if (!(hdl->cmih_msrsrc & CMI_MSR_FLAG_WR_HWOK))
815 ntv_msrinterpose(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t val)
817 msri_addent(hdl, msr, val);
838 ntv_int(cmi_hdl_impl_t *hdl, int int_no)
840 cpu_t *cp = HDLPRIV(hdl);
846 ntv_online(cmi_hdl_impl_t *hdl, int new_status, int *old_status)
849 processorid_t cpuid = HDLPRIV(hdl)->cpu_id;
852 if (hdl->cmih_flags & CMIH_F_DEAD)
874 #define HDLPRIV(hdl) ((xen_mc_lcpu_cookie_t)(hdl)->cmih_hdlpriv)
880 xpv_vendor(cmi_hdl_impl_t *hdl)
883 HDLPRIV(hdl))));
887 xpv_vendorstr(cmi_hdl_impl_t *hdl)
889 return (xen_physcpu_vendorstr(HDLPRIV(hdl)));
893 xpv_family(cmi_hdl_impl_t *hdl)
895 return (xen_physcpu_family(HDLPRIV(hdl)));
899 xpv_model(cmi_hdl_impl_t *hdl)
901 return (xen_physcpu_model(HDLPRIV(hdl)));
905 xpv_stepping(cmi_hdl_impl_t *hdl)
907 return (xen_physcpu_stepping(HDLPRIV(hdl)));
911 xpv_chipid(cmi_hdl_impl_t *hdl)
913 return (hdl->cmih_chipid);
917 xpv_procnodeid(cmi_hdl_impl_t *hdl)
919 return (hdl->cmih_procnodeid);
923 xpv_procnodes_per_pkg(cmi_hdl_impl_t *hdl)
925 return (hdl->cmih_procnodes_per_pkg);
929 xpv_coreid(cmi_hdl_impl_t *hdl)
931 return (hdl->cmih_coreid);
935 xpv_strandid(cmi_hdl_impl_t *hdl)
937 return (hdl->cmih_strandid);
941 xpv_strand_apicid(cmi_hdl_impl_t *hdl)
943 return (xen_physcpu_initial_apicid(HDLPRIV(hdl)));
947 xpv_smbiosid(cmi_hdl_impl_t *hdl)
949 return (hdl->cmih_smbiosid);
953 xpv_smb_chipid(cmi_hdl_impl_t *hdl)
955 return (hdl->cmih_smb_chipid);
959 xpv_smb_bboard(cmi_hdl_impl_t *hdl)
961 return (hdl->cmih_smb_bboard);
967 xpv_chiprev(cmi_hdl_impl_t *hdl)
969 return (_cpuid_chiprev(xpv_vendor(hdl), xpv_family(hdl),
970 xpv_model(hdl), xpv_stepping(hdl)));
976 xpv_chiprevstr(cmi_hdl_impl_t *hdl)
978 return (_cpuid_chiprevstr(xpv_vendor(hdl), xpv_family(hdl),
979 xpv_model(hdl), xpv_stepping(hdl)));
985 xpv_getsockettype(cmi_hdl_impl_t *hdl)
987 return (_cpuid_skt(xpv_vendor(hdl), xpv_family(hdl),
988 xpv_model(hdl), xpv_stepping(hdl)));
994 xpv_getsocketstr(cmi_hdl_impl_t *hdl)
996 return (_cpuid_sktstr(xpv_vendor(hdl), xpv_family(hdl),
997 xpv_model(hdl), xpv_stepping(hdl)));
1001 xpv_logical_id(cmi_hdl_impl_t *hdl)
1003 return (xen_physcpu_logical_id(HDLPRIV(hdl)));
1007 xpv_rdmsr(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t *valp)
1011 *valp = xen_physcpu_mcg_cap(HDLPRIV(hdl));
1034 xpv_wrmsr_cmn(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t val, boolean_t intpose)
1039 if (!(hdl->cmih_flags & CMIH_F_INJACTV))
1048 mci->mcinj_cpunr = xen_physcpu_logical_id(HDLPRIV(hdl));
1059 xpv_wrmsr(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t val)
1061 return (xpv_wrmsr_cmn(hdl, msr, val, B_FALSE));
1066 xpv_msrinterpose(cmi_hdl_impl_t *hdl, uint_t msr, uint64_t val)
1068 return (xpv_wrmsr_cmn(hdl, msr, val, B_TRUE));
1072 xpv_int(cmi_hdl_impl_t *hdl, int int_no)
1077 if (!(hdl->cmih_flags & CMIH_F_INJACTV))
1085 mce->mceinj_cpunr = xen_physcpu_logical_id(HDLPRIV(hdl));
1091 xpv_online(cmi_hdl_impl_t *hdl, int new_status, int *old_status)
1115 xs.u.cpu_hotplug.cpu = xen_physcpu_logical_id(HDLPRIV(hdl));
1231 cmi_hdl_impl_t *hdl;
1266 hdl = kmem_zalloc(sizeof (*hdl), KM_SLEEP);
1268 hdl->cmih_class = class;
1269 HDLOPS(hdl) = &cmi_hdl_ops;
1270 hdl->cmih_chipid = chipid;
1271 hdl->cmih_coreid = coreid;
1272 hdl->cmih_strandid = strandid;
1273 hdl->cmih_mstrand = cpu_is_cmt(priv);
1274 hdl->cmih_hdlpriv = priv;
1276 hdl->cmih_msrsrc = CMI_MSR_FLAG_RD_INTERPOSEOK |
1283 hdl->cmih_procnodeid = xen_physcpu_chipid((xen_mc_lcpu_cookie_t)priv);
1284 hdl->cmih_procnodes_per_pkg = 1;
1286 hdl->cmih_msrsrc = CMI_MSR_FLAG_RD_HWOK | CMI_MSR_FLAG_RD_INTERPOSEOK |
1288 hdl->cmih_procnodeid = cpuid_get_procnodeid((cpu_t *)priv);
1289 hdl->cmih_procnodes_per_pkg =
1306 kmem_free(hdl, sizeof (*hdl));
1320 ent->cmae_hdlp = hdl;
1321 hdl->cmih_refcntp = &ent->cmae_refcnt;
1324 return ((cmi_hdl_t)hdl);
1336 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1342 strand_apicid = ntv_strand_apicid(hdl);
1344 strand_apicid = xpv_strand_apicid(hdl);
1354 hdl->cmih_smb_chipid = chip_inst;
1355 hdl->cmih_smbiosid = smb_id;
1363 hdl->cmih_smb_bboard = fm_smb_bboard(strand_apicid);
1365 if (hdl->cmih_smb_bboard == NULL)
1375 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1377 ASSERT(*hdl->cmih_refcntp != 0); /* must not be the initial hold */
1379 atomic_inc_32(hdl->cmih_refcntp);
1420 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1422 ASSERT(*hdl->cmih_refcntp > 0);
1423 atomic_dec_32(hdl->cmih_refcntp);
1429 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1433 ASSERT(*hdl->cmih_refcntp > 0);
1434 atomic_dec_32(hdl->cmih_refcntp);
1435 hdl->cmih_flags |= CMIH_F_DEAD;
1437 ent = cmi_hdl_ent_lookup(hdl->cmih_chipid, hdl->cmih_coreid,
1438 hdl->cmih_strandid);
1449 kmem_free(hdl, sizeof (*hdl));
1467 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1469 ASSERT(hdl->cmih_mcops == NULL && hdl->cmih_mcdata == NULL);
1470 hdl->cmih_mcops = mcops;
1471 hdl->cmih_mcdata = mcdata;
1553 cmi_hdl_impl_t *hdl = ent->cmae_hdlp;
1554 if ((*cbfunc)((cmi_hdl_t)hdl, arg1, arg2, arg3)
1556 cmi_hdl_rele((cmi_hdl_t)hdl);
1559 cmi_hdl_rele((cmi_hdl_t)hdl);
1695 cmi_ntv_hwdisable_mce(cmi_hdl_t hdl)
1698 cmi_hdl_impl_t *thdl = IMPLHDL(hdl);
1715 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1717 hdl->cmih_msrsrc &= ~CMI_MSR_FLAG_RD_HWOK;
1723 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1725 hdl->cmih_msrsrc &= ~CMI_MSR_FLAG_WR_HWOK;
1731 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1740 if ((hdl->cmih_msrsrc & CMI_MSR_FLAG_RD_INTERPOSEOK) &&
1741 msri_lookup(hdl, msr, valp))
1744 if (HDLOPS(hdl)->cmio_rdmsr == NULL)
1747 return (HDLOPS(hdl)->cmio_rdmsr(hdl, msr, valp));
1753 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1756 msri_rment(hdl, msr);
1758 if (HDLOPS(hdl)->cmio_wrmsr == NULL)
1761 return (HDLOPS(hdl)->cmio_wrmsr(hdl, msr, val));
1767 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1770 if (HDLOPS(hdl)->cmio_getcr4 == NULL ||
1771 HDLOPS(hdl)->cmio_setcr4 == NULL)
1774 cr4 = HDLOPS(hdl)->cmio_getcr4(hdl);
1776 HDLOPS(hdl)->cmio_setcr4(hdl, cr4 | CR4_MCE);
1782 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1785 if (HDLOPS(hdl)->cmio_msrinterpose == NULL)
1791 HDLOPS(hdl)->cmio_msrinterpose(hdl, regs->cmr_msrnum,
1802 cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
1806 msri_addent(hdl, regs->cmr_msrnum, regs->cmr_msrval);
1825 int *interpose, ddi_acc_handle_t hdl)
1843 if (hdl)
1844 val = pci_config_get8(hdl, (off_t)reg);
1850 if (hdl)
1851 val = pci_config_get16(hdl, (off_t)reg);
1857 if (hdl)
1858 val = pci_config_get32(hdl, (off_t)reg);
1871 ddi_acc_handle_t hdl)
1874 hdl));
1879 ddi_acc_handle_t hdl)
1882 hdl));
1887 ddi_acc_handle_t hdl)
1889 return (cmi_pci_get_cmn(bus, dev, func, reg, 4, interpose, hdl));
1912 ddi_acc_handle_t hdl, uint32_t val)
1924 if (hdl)
1925 pci_config_put8(hdl, (off_t)reg, (uint8_t)val);
1932 if (hdl)
1933 pci_config_put16(hdl, (off_t)reg, (uint16_t)val);
1940 if (hdl)
1941 pci_config_put32(hdl, (off_t)reg, val);
1953 cmi_pci_putb(int bus, int dev, int func, int reg, ddi_acc_handle_t hdl,
1956 cmi_pci_put_cmn(bus, dev, func, reg, 1, hdl, val);
1960 cmi_pci_putw(int bus, int dev, int func, int reg, ddi_acc_handle_t hdl,
1963 cmi_pci_put_cmn(bus, dev, func, reg, 2, hdl, val);
1967 cmi_pci_putl(int bus, int dev, int func, int reg, ddi_acc_handle_t hdl,
1970 cmi_pci_put_cmn(bus, dev, func, reg, 4, hdl, val);