PCI手动配置

江户川111 2015-09-25 10:46:26
最近在X86的bsp,比如pcPentium4目录下, 有批次CfgIntStub.c文件.
里面的sysPciPirqShow可以显示从bios读出的路由表. 但是我发现我的卡卡所在的bus号不在这个表中,请问怎么添加,BIOS添加不行,因为我的设备BIOS没有那个选项,所以各位大神有没有其他办法。谢谢
...全文
1100 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
土豆 2015-12-25
  • 打赏
  • 举报
回复
请问哥们最后怎么搞定的? 以前玩过PCI,现在差不多了忘记了。应该是可以通过枚举总线上的设备找到所有设备的,这是我以前写的函数去查询PCI设备:
PRIVATE STATUS probPciDevice(UINT bus, PCI_TARGET_INFO* target)
{
    UINT32 dev_vend;        /* Device/Vendor identifier         */
    int device;             /* Device location                  */
    int function;           /* Function location                */
    UINT8 btemp;            /* Temporary holding area           */

    if(target==NULL)
    {
        PCI_PRINT(SYSLOG_LEVEL_ERROR,"NULL pointer.\n");
        return ERROR;
    }

    /* Locate each active function on the current bus */
    for (device = 0; device < PCI_MAX_DEV; device++)
    {
        /* Check each function until an unused one is detected */
        for (function = 0; function < PCI_MAX_FUNC; function++)
        {
            /* Check for a valid device/vendor number */
            pciConfigInLong (bus, device, function, PCI_CFG_VENDOR_ID, &dev_vend);

            /* If function 0 then check next dev else check next function */
            if ( ((dev_vend & 0x0000ffff) == 0xFFFF) || ((dev_vend & 0x0000ffff) == 0x0000) )
            {
                if (function == 0)
                    break;      /* non-existent device, goto next device */
                else
                    continue;   /* function empty, try the next function */
            }

            if(((dev_vend & 0x0000ffff) == target->vendorId) || (((dev_vend>>16) & 0x0000ffff) == target->deviceId) )
            {
                PCI_PRINT(SYSLOG_LEVEL_DEBUG,"Found PCI device: vendorID=%04X, deviceID=%04X, bus=%d, device=%d, function=%d\n",
                        target->vendorId, target->deviceId, bus, device,function);
                target->busNo     = bus;
                target->deviceNo  = device;
                target->funcionNo = function;
                return OK;
            }

            /* Proceed to next device if this is a single function device */
            if (function == 0)
            {
                pciConfigInByte (bus, device, function, PCI_CFG_HEADER_TYPE, &btemp);
                if ((btemp & PCI_HEADER_MULTI_FUNC) == 0)
                    break;
            }

        }
    }

    return ERROR;
}

2,179

社区成员

发帖
与我相关
我的任务
社区描述
xworks是美国 Wind River System 公司( 以下简称风河公司 ,即 WRS 公司)推出的一个实时操作系统。
社区管理员
  • VxWorks开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧