找回密码
 加入我们
搜索
      
查看: 5476|回复: 13

[主板] AMD主板的几个疑问

[复制链接]
发表于 2023-11-16 16:15 | 显示全部楼层
本帖最后由 danety 于 2023-11-16 16:17 编辑

#
# These variables are device properties.  For people who are very
# curious about this, you can download the Windows Driver Kit headers and
# look for pciprop.h.  All of these are contained in that file.
#
$devpkey_PciDevice_DeviceType = "{3AB22E31-8264-4b4e-9AF5-A8D2D8E33E62}  1"
$devpkey_PciDevice_RequiresReservedMemoryRegion = "{3AB22E31-8264-4b4e-9AF5-A8D2D8E33E62}  34"
$devpkey_PciDevice_AcsCompatibleUpHierarchy = "{3AB22E31-8264-4b4e-9AF5-A8D2D8E33E62}  31"

$devprop_PciDevice_DeviceType_PciConventional                        =   0
$devprop_PciDevice_DeviceType_PciX                                   =   1
$devprop_PciDevice_DeviceType_PciExpressEndpoint                     =   2
$devprop_PciDevice_DeviceType_PciExpressLegacyEndpoint               =   3
$devprop_PciDevice_DeviceType_PciExpressRootComplexIntegratedEndpoint=   4
$devprop_PciDevice_DeviceType_PciExpressTreatedAsPci                 =   5
$devprop_PciDevice_BridgeType_PciConventional                        =   6
$devprop_PciDevice_BridgeType_PciX                                   =   7
$devprop_PciDevice_BridgeType_PciExpressRootPort                     =   8
$devprop_PciDevice_BridgeType_PciExpressUpstreamSwitchPort           =   9
$devprop_PciDevice_BridgeType_PciExpressDownstreamSwitchPort         =  10
$devprop_PciDevice_BridgeType_PciExpressToPciXBridge                 =  11
$devprop_PciDevice_BridgeType_PciXToExpressBridge                    =  12
$devprop_PciDevice_BridgeType_PciExpressTreatedAsPci                 =  13
$devprop_PciDevice_BridgeType_PciExpressEventCollector               =  14

$devprop_PciDevice_AcsCompatibleUpHierarchy_NotSupported             =   0
$devprop_PciDevice_AcsCompatibleUpHierarchy_SingleFunctionSupported  =   1
$devprop_PciDevice_AcsCompatibleUpHierarchy_NoP2PSupported           =   2
$devprop_PciDevice_AcsCompatibleUpHierarchy_Supported                =   3


write-host "Generating a list of PCI Express endpoint devices"
$pnpdevs = Get-PnpDevice -PresentOnly
$pcidevs = $pnpdevs | Where-Object {$_.InstanceId -like "PCI*"}

foreach ($pcidev in $pcidevs) {
    Write-Host ""
    Write-Host ""
    Write-Host -ForegroundColor White -BackgroundColor Black $pcidev.FriendlyName

    $rmrr =  ($pcidev | Get-PnpDeviceProperty $devpkey_PciDevice_RequiresReservedMemoryRegion).Data
    if ($rmrr -ne 0) {
        write-host -ForegroundColor Red -BackgroundColor Black "BIOS requires that this device remain attached to BIOS-owned memory.  Not assignable."
        continue
    }

    $acsUp =  ($pcidev | Get-PnpDeviceProperty $devpkey_PciDevice_AcsCompatibleUpHierarchy).Data
    if ($acsUp -eq $devprop_PciDevice_AcsCompatibleUpHierarchy_NotSupported) {
        write-host -ForegroundColor Red -BackgroundColor Black "Traffic from this device may be redirected to other devices in the system.  Not assignable."
        continue
    }

    $devtype = ($pcidev | Get-PnpDeviceProperty $devpkey_PciDevice_DeviceType).Data
    if ($devtype -eq $devprop_PciDevice_DeviceType_PciExpressEndpoint) {
        Write-Host "Express Endpoint -- more secure."
    } else {
        if ($devtype -eq $devprop_PciDevice_DeviceType_PciExpressRootComplexIntegratedEndpoint) {
            Write-Host "Embedded Endpoint -- less secure."
        } else {
            if ($devtype -eq $devprop_PciDevice_DeviceType_PciExpressTreatedAsPci) {
                Write-Host -ForegroundColor Red -BackgroundColor Black "BIOS kept control of PCI Express for this device.  Not assignable."
            } else {
                Write-Host -ForegroundColor Red -BackgroundColor Black "Old-style PCI device, switch port, etc.  Not assignable."
            }
            continue
        }
    }

    $locationpath = ($pcidev | get-pnpdeviceproperty DEVPKEY_Device_LocationPaths).data[0]

    #
    # Now do a check for the interrupts that the device uses.  Line-based interrupts
    # aren't assignable.
    #
    $doubleslashDevId = "*" + $pcidev.PNPDeviceID.Replace("\","\\") + "*"
    $irqAssignments = gwmi -query "select * from Win32_PnPAllocatedResource" | Where-Object {$_.__RELPATH -like "*Win32_IRQResource*"} | Where-Object {$_.Dependent -like $doubleslashDevId}

    #$irqAssignments | Format-Table -Property __RELPATH

    if ($irqAssignments.length -eq 0) {
        Write-Host -ForegroundColor Green -BackgroundColor Black "    And it has no interrupts at all -- assignment can work."
    } else {
        #
        # Find the message-signaled interrupts.  They are reported with a really big number in
        # decimal, one which always happens to start with "42949...".
        #
        $msiAssignments = $irqAssignments | Where-Object {$_.Antecedent -like "*IRQNumber=42949*"}
   
        #$msiAssignments | Format-Table -Property __RELPATH

        if ($msiAssignments.length -eq 0) {
            Write-Host -ForegroundColor Red -BackgroundColor Black "All of the interrupts are line-based, no assignment can work."
            continue
        } else {
            Write-Host -ForegroundColor Green -BackgroundColor Black "    And its interrupts are message-based, assignment can work."
        }
    }

    #
    # Print out the location path, as that's the way to refer to this device that won't
    # change even if you add or remove devices from the machine or change the way that
    # the BIOS is configured.
    #
    $locationpath
}

#
# Now look at the host as a whole.  Asking whether the host supports SR-IOV
# is mostly equivalent to asking whether it supports Discrete Device
# Assignment.
#
if ((Get-VMHost).IovSupport -eq $false) {
    Write-Host ""
    write-host "Unfortunately, this machine doesn't support using them in a VM."
    Write-Host ""
    (Get-VMHost).IovSupportReasons
}


上面文件保存为ps文件,在powershell里运行一下,每一个pcie设备支不支持直通,以及不支持的原因都会显示出来
直通既需要主板的支持也需要pcie设备的支持
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

Archiver|手机版|小黑屋|Chiphell ( 沪ICP备12027953号-5 )沪公网备310112100042806 上海市互联网违法与不良信息举报中心

GMT+8, 2025-8-27 05:19 , Processed in 0.007567 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2007-2024 Chiphell.com All rights reserved.

快速回复 返回顶部 返回列表