* Final stage of CPU identification. */
| 1629 | * Final stage of CPU identification. |
| 1630 | */ |
| 1631 | void |
| 1632 | finishidentcpu(void) |
| 1633 | { |
| 1634 | u_int regs[4]; |
| 1635 | #ifdef __i386__ |
| 1636 | u_char ccr3; |
| 1637 | #endif |
| 1638 | |
| 1639 | identify_cpu_fixup_bsp(); |
| 1640 | |
| 1641 | if (cpu_high >= 5 && (cpu_feature2 & CPUID2_MON) != 0) { |
| 1642 | do_cpuid(5, regs); |
| 1643 | cpu_mon_mwait_flags = regs[2]; |
| 1644 | cpu_mon_min_size = regs[0] & CPUID5_MON_MIN_SIZE; |
| 1645 | cpu_mon_max_size = regs[1] & CPUID5_MON_MAX_SIZE; |
| 1646 | } |
| 1647 | |
| 1648 | identify_cpu2(); |
| 1649 | |
| 1650 | #ifdef __i386__ |
| 1651 | if (cpu_high > 0 && |
| 1652 | (cpu_vendor_id == CPU_VENDOR_INTEL || |
| 1653 | cpu_vendor_id == CPU_VENDOR_AMD || |
| 1654 | cpu_vendor_id == CPU_VENDOR_HYGON || |
| 1655 | cpu_vendor_id == CPU_VENDOR_TRANSMETA || |
| 1656 | cpu_vendor_id == CPU_VENDOR_CENTAUR || |
| 1657 | cpu_vendor_id == CPU_VENDOR_NSC)) { |
| 1658 | do_cpuid(0x80000000, regs); |
| 1659 | if (regs[0] >= 0x80000000) |
| 1660 | cpu_exthigh = regs[0]; |
| 1661 | } |
| 1662 | #else |
| 1663 | if (cpu_vendor_id == CPU_VENDOR_INTEL || |
| 1664 | cpu_vendor_id == CPU_VENDOR_AMD || |
| 1665 | cpu_vendor_id == CPU_VENDOR_HYGON || |
| 1666 | cpu_vendor_id == CPU_VENDOR_CENTAUR) { |
| 1667 | do_cpuid(0x80000000, regs); |
| 1668 | cpu_exthigh = regs[0]; |
| 1669 | } |
| 1670 | #endif |
| 1671 | if (cpu_exthigh >= 0x80000001) { |
| 1672 | do_cpuid(0x80000001, regs); |
| 1673 | amd_feature = regs[3] & ~(cpu_feature & 0x0183f3ff); |
| 1674 | amd_feature2 = regs[2]; |
| 1675 | } |
| 1676 | if (cpu_exthigh >= 0x80000007) { |
| 1677 | do_cpuid(0x80000007, regs); |
| 1678 | amd_rascap = regs[1]; |
| 1679 | amd_pminfo = regs[3]; |
| 1680 | } |
| 1681 | if (cpu_exthigh >= 0x80000008) { |
| 1682 | do_cpuid(0x80000008, regs); |
| 1683 | cpu_maxphyaddr = regs[0] & 0xff; |
| 1684 | amd_extended_feature_extensions = regs[1]; |
| 1685 | cpu_procinfo2 = regs[2]; |
| 1686 | } else { |
| 1687 | cpu_maxphyaddr = (cpu_feature & CPUID_PAE) != 0 ? 36 : 32; |
| 1688 | } |
no test coverage detected