Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: ron.jolly@gefanuc.com (Ron Jolly)
Subject: Driver crashes on Alpha GS series, OK on DS series
Date: 9 Oct 2002 09:32:02 -0700	[thread overview]
Message-ID: <c76164d.0210090832.4430140c@posting.google.com> (raw)

Hello all
I have written a driver for Tru64 5.1a 1885 that works successfully on
a DS-20 a DS-10 and a PWS500au all running 5.1a 1885. 
All functions of the driver work correctly on a GS-160 and GS-80
except for the xx2g_mmap() call which quite unceremoniously crashes
the system. The GS-160 and GS-80 are also running 5.1A 1885.
The drivers xx2g_mmap function is returning a pointer to a user
application to be able to directly access memory space on a PCI
network board.
The really tough stuff, such as setting up and performing a  DMA
transfer works successfully on all the afore mentioned systems. I am
not necessarily suspecting the GS series hardare architecture is the
problem. The GS160 has 12 CPUs and 12GB of memory, the GS-80 has 6
CPUs and 6 GB of memory. The DS-20 that is used for primary testing
has 2 SMP CPUs and 1GB of memory. The OS crashes at the point in the
user app when the returned pointer is used for the first time.
Using a VMETRO PCI analyzer,I see that the PIO operation never makes
it to the PCI bus, so I suspect the xx2g_mmap routine returned a
kernal page frame number that was not valid for my boards space. What
does the Kernal do with the KPFN? It is rather difficult to debug as
both of the Alpha GS systems are on the other side of the world from
my location.

Here is the source to the drivers xx2g_mmap() routine:
Any suggestions apprecitated.

Thanks
Ron
ron.jolly@gefanuc.com

/******************************************************************************
*  FUNCTION:    xx2g_mmap
*
*  PURPOSE: Entry point for mmap(2) call. The xx2g_mmap()
*		routine is invoked by the kernel as a result of an  
*		application calling the mmap(2) system call.  xx2g_mmap 
*		returns the page frame number corresponding to the page
* 		at the specified offset.     
*
*  PARAMETERS: 	device, offset, protection
*  RETURNS:     Kernel Page Frame Number
*  GLOBALS:     None  
*
******************************************************************************/

int
xx2g_mmap(
    			dev_t   dev,        /* Major/minor device number     */
    			off_t	offset,         
    			int        prot        
)
{
   int                unit = XXUNIT(dev);
   register UCB       ucb  = &ucbs[unit]; 
   io_handle_t lio_handle =  ucb->ucb_netmem; /* BAR3 saved in
xx_probe()routine */
   unsigned long      physaddr;
   long        kpfnum;
   caddr_t	phys_addr = 0;
	
	WHENDEBUG( XX2G_DBTRACE){
	    printf("\n%s%d: mmap entry lio_handle %lx  offset %lx, prot
%x\n", me, unit, lio_handle, offset, prot);
 	} 

   if(ucb->ucb_netmem == NULL){
   	WHENDEBUG( XX2G_DBERROR ){
  		printf("%s%d: mmap was passed a NULL XX2g base
address\n",me,unit);
	}
 	return(EFAULT); 
   }

	WHENDEBUG( XX2G_DBTRACE){
	    printf("%s%d: Call iohandle_to_phys \n",me, unit);
 	} 
	
 /* Convert the IO handle (in this case the passed in BAR3 register
value) to a valid physical address */
    physaddr = iohandle_to_phys ( lio_handle, HANDLE_DENSE_SPACE |
HANDLE_LONGWORD);
  
  if(physaddr != 0){

	WHENDEBUG( XX2G_DBTRACE ){
	    printf("%s%d: Call PHYS_TO_KSEG \n",me, unit);
 	}
 
        /* Convert the physical address to a kernel-unmapped virtual
address */
	phys_addr = (caddr_t)PHYS_TO_KSEG( physaddr );

	kpfnum = (long) ((((u_long)phys_addr + offset) >> PAGE_SHIFT) &
UINT_MAX);

      	WHENDEBUG( XX2G_DBTRACE ){
		printf("%s%d: mmap -> iohandle_to_phys succeeded physaddr: %lx  
			  phys_addr: %lx   kernel page frame num: %lx \n",me,
				unit, physaddr, phys_addr, kpfnum);
	}
        return (int) kpfnum; /* Return the Kernal Page Frame Number */
   }
   else{
   	WHENDEBUG( XX2G_DBERROR ){
  		printf("%s%d: xx2g_mmap call Failed - iohandle_to_phys returned
NULL \n",me,unit);
	}
	return(EFAULT); 
   } 
   return(ESUCCESS);    
 }

////////////////////////////////////////////////////////////////////////////////


                 reply	other threads:[~2002-10-09 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox