Leonsoft
驱动小牛
驱动小牛
  • 注册日期2003-05-08
  • 最后登录2012-08-11
  • 粉丝1
  • 关注0
  • 积分21分
  • 威望281点
  • 贡献值1点
  • 好评度103点
  • 原创分0分
  • 专家分0分
阅读:1506回复:0

a DMA PCI Device Driver doesn't work in Vista x64 + 4G RAM platform!!

楼主#
更多 发布于:2007-10-30 10:39
Hi
  I writed a BDA driver for a PCI TV card device,I found that my driver can
work well on Vista32/XP32/XPx64 + 4G RAM platform, and work well on Vista x64
+ less than 4G RAM, but can't work on Vista x64 + 4G RAM, this problem make
me confused. I guess that this problem maybe result from the DMA addressing
in Vista x64, or MS change the DMA addressing in Vista x64 after XP
x64,so,the DMA configuration of my driver doesn't compatible with Vista x64.
  the following codes is config DMA.

#if defined(_AMD64_)||defined(_IA64_)
 if (Mm64BitPhysicalAddress) //if system support 64-bit physical addressing
 {
  desc.Dma64BitAddresses = TRUE;
  desc.Dma32BitAddresses = FALSE;
  KdPrint(("Mm64BitPhysicalAddress is TRUE \n"));
 }
 else
 {
  desc.Dma32BitAddresses = TRUE;
  desc.Dma64BitAddresses = FALSE;
  KdPrint(("Mm64BitPhysicalAddress is FALSE \n"));
 }
#else
 desc.Dma64BitAddresses = FALSE;
 desc.Dma32BitAddresses = TRUE;
#endif
 desc.AutoInitialize = FALSE;
 desc.MaximumLength = (ULONG) -1;
 m_MaxMapRegisters = (desc.MaximumLength / PAGE_SIZE) + 1;
 m_pDMAObject = IoGetDmaAdapter( pKSDevice->PhysicalDeviceObject,
  &desc,
  &m_MaxMapRegisters);
 m_MaxMapRegisters=(TABLE_SIZE)/8;
    KdPrint(("DMA MaxMap Cnt=%d\n",m_MaxMapRegisters));
 if(!m_pDMAObject)
 {
  KdPrint(("@@@Couldn't GetDMA adapter resource!\n"));
  CleanUpResources();
  return STATUS_INSUFFICIENT_RESOURCES;
 }
 ////Allocate DMA Table memory!
 for(index=0;index<DMA_INT_CNT;index++)
 {
  m_DMAPara[index].KsDMA_Table_VA=(PULONG)(m_pDMAObject->DmaOperations)->
   AllocateCommonBuffer(m_pDMAObject,
   TABLE_SIZE,
   &m_DMAPara[index].KsDMA_Table_PA,
   FALSE);
  if(!m_DMAPara[index].KsDMA_Table_VA)
  {
   KdPrint(("@@@Allocate DMA%d Table Fail!\n",index));
   CleanUpResources();
   return STATUS_INSUFFICIENT_RESOURCES;
  }
  m_DMAPara[index].KsdwDMATableSize=TABLE_SIZE;
 }

 can you give me an idea?

 thanks

 best regards
I will do the best with what the God gave me.
游客

返回顶部