Accessing the Host Memory (x86) by the Agent (MPC 8540)

aishwarya bhas aish_bhaskaran at yahoo.co.in
Thu Apr 5 03:24:28 EST 2007


Hi....
  
   We are using linux kernel 2.6.9. x86 acts as the host and MPC8540  is placed in the PCI slot of the host.MPC8540 is configured in agent  mode and it runs on u-boot.The uboot version that we are using is  u-boot-1.1.2.
  
  The steps that we followed to accomplish the above task is as follows:-
  
  1.)Allocated memory in the host (x86), using kmalloc and returned the ptrdata....
  
  //Allocating 20 K of memory in the Host RAM
  
    ptrdata = (unsigned volatile long *) kmalloc( 20 * 1024 , GFP_KERNEL);
  
  
  2.)We write to pci outbound registers, so that the MPC8540 could access the
    
   host memory......
  
  
  (a)pci translation register (b)pci base register (c) pci attribute register.
  
  
  We converted this virtual address to PCI Bus address... using virt_to_bus() function..     
  
    ulTemp  = ( unsigned volatile long  ) virt_to_bus ( void * ) ptrdata);
   
  // To Mask the lower 12 bits for translation address
  
     ulTemp =  swap(ulTemp >> 12) ;
  
   //Outbound Translation Register
  
      writel(ulTemp,  (unsigned long)ioaddr+ 0x8C20);
  
    //ioaddr is address that we got after remapping  ioaddr = ioremap_nocache((pio_start), pio_len);
  
   //Outbound Base Address Register
   
     writel((swap(0xE0000000 >> 12)) ,  (unsigned long)ioaddr+ 0x8C28);
  
   //Outbound Attribute Register
  
      writel(swap(0x8004401A),  (unsigned long)ioaddr+ 0x8C30);
  
      We also tried with the Attribute Register value 0x8005501C...
   
      We also used the function wmb() after writing to the  outbound registers, since it guarantees ordering in write operations..
      
      After this we wrote some value in the ptrdata(i.e in the virtual address),for testing .
  
  3.)We used the minicom to check whether we are able to access the host memory from the agent by doing md 0xE000_0000
  
   i.e to find whether we were able to get the value which we wrote  in the ptrdata(ie. in the virtual address got from kmalloc) ....( Also  not sure if this is the way we have to do.....) . But we are getting  all values as zeroes.
  
  4.) We checked in Bus Command Register, whether the Bus master and Memory is  enabled....
  
      This is the Configuration Register value :
  
  Algs: bus master, 66Mhz, fast devsel, latency 64
          Memory at dee00000 (32-bit, non-prefetchable) [size=1M]
          [virtual] Memory at dedf0000 (32-bit, non-prefetchable) [size=64K]
          Capabilities: [60] #00 [0000]
  00: 57 10 08 00 46 01 b0 20 20 01 20 0b 00 40 00 00
  10: 00 00 e0 de 00 00 00 00 00 00 00 00 00 00 00 00
  20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  30: 00 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00
  40: 00 00 00 00 09 00 00 80 00 00 00 00 00 00 00 00
  50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  
   We aren't sure of whether, we have to write to the physical address or to the
  Virtual address ofthe host RAM i.e x86 by configuring these outbound
  Registers......
  
  Cud anybody solve our problem. tell us if we are missing anything,any step.Please respond to our request.It is urgent.
  
  
  Thanks 
  Aishwariya
 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20070404/7cc231be/attachment.htm 


More information about the Linuxppc-embedded mailing list