本文整理汇总了C++中IOPCIDevice::enablePCIPowerManagement方法的典型用法代码示例。如果您正苦于以下问题:C++ IOPCIDevice::enablePCIPowerManagement方法的具体用法?C++ IOPCIDevice::enablePCIPowerManagement怎么用?C++ IOPCIDevice::enablePCIPowerManagement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOPCIDevice
的用法示例。
在下文中一共展示了IOPCIDevice::enablePCIPowerManagement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DbgPrint
/**
* at_probe - Device Initialization Routine
* @pdev: PCI device information struct
* @ent: entry in at_pci_tbl
*
* Returns 0 on success, negative on failure
*
* at_probe initializes an adapter identified by a pci_dev structure.
* The OS initialization, configuring of the adapter private structure,
* and a hardware reset occur.
**/
bool AtherosL1Ethernet::atProbe()
{
u16 vendorId, deviceId;
at_adapter *adapter=&adapter_;
IOPCIDevice *pdev = adapter_.pdev;
pdev->setBusMasterEnable(true);
pdev->setMemoryEnable(true);
pdev->setIOEnable(true);
vendorId = pdev->configRead16(kIOPCIConfigVendorID);
deviceId = pdev->configRead16(kIOPCIConfigDeviceID);
DbgPrint("Vendor ID %x, device ID %x\n", vendorId, deviceId);
DbgPrint("MMR0 address %x\n", (u32)pdev->configRead32(kIOPCIConfigBaseAddress0));
pdev->enablePCIPowerManagement();
hw_addr_ = pdev->mapDeviceMemoryWithRegister(kIOPCIConfigBaseAddress0);
if (hw_addr_ == NULL)
{
ErrPrint("Couldn't map io regs\n");
return false;
}
DbgPrint("Memory mapped at bus address %x, virtual address %x, length %d\n", (u32)hw_addr_->getPhysicalAddress(),
(u32)hw_addr_->getVirtualAddress(), (u32)hw_addr_->getLength());
hw_addr_->retain();
adapter->hw.mmr_base = reinterpret_cast<char *>(hw_addr_->getVirtualAddress());
DbgPrint("REG_VPD_CAP = %x\n", OSReadLittleInt32(adapter->hw.mmr_base, REG_VPD_CAP));
DbgPrint("REG_PCIE_CAP_LIST = %x\n", OSReadLittleInt32(adapter->hw.mmr_base, REG_PCIE_CAP_LIST));
DbgPrint("REG_MASTER_CTRL = %x\n", OSReadLittleInt32(adapter->hw.mmr_base, REG_MASTER_CTRL));
at_setup_pcicmd(pdev);
/* get user settings */
at_check_options(adapter);
/* setup the private structure */
if(at_sw_init(adapter))
{
ErrPrint("Couldn't init software\n");
return false;
}
/* Init GPHY as early as possible due to power saving issue */
at_phy_init(&adapter->hw);
/* reset the controller to
* put the device in a known good starting state */
if (at_reset_hw(&adapter->hw))
{
ErrPrint("Couldn't reset hardware\n");
return false; //TO-DO: Uncomment
}
/* copy the MAC address out of the EEPROM */
at_read_mac_addr(&adapter->hw);
return true;
}