Subject: Re: alpha pci pio problems
To: Simon Burge <simonb@NetBSD.ORG>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-alpha
Date: 06/26/2000 22:47:05
On Tue, Jun 27, 2000 at 03:05:05PM +1000, Simon Burge wrote:

 > Good call!  uvm_fault only used an int for the offset to pass to d_mmap.
 > With the following, the offsets passed to d_mmap look good and I can
 > now run a basically unaltered SuperProbe although it tells me it can't
 > find any PCI cards - although that's better than wedging my machine!

Well, it's a start :-)

 > Any hassles with the following patch?

Some comments, below.

 > Simon.
 > --
 > Index: uvm_device.c
 > ===================================================================
 > RCS file: /cvsroot/syssrc/sys/uvm/uvm_device.c,v
 > retrieving revision 1.26
 > diff -p -u -r1.26 uvm_device.c
 > --- uvm_device.c	2000/06/26 14:21:17	1.26
 > +++ uvm_device.c	2000/06/27 05:04:19
 > @@ -406,8 +406,7 @@ udv_fault(ufi, vaddr, pps, npages, cente
 >  	struct vm_map_entry *entry = ufi->entry;
 >  	struct uvm_object *uobj = entry->object.uvm_obj;
 >  	struct uvm_device *udv = (struct uvm_device *)uobj;
 > -	vaddr_t curr_va;
 > -	int curr_offset;
 > +	vaddr_t curr_va, curr_offset;

curr_offset should be an off_t, since that's what the d_mmap function
takes.

 >  	paddr_t paddr, mdpgno;
 >  	int lcv, retval;
 >  	dev_t device;
 > @@ -448,7 +447,7 @@ udv_fault(ufi, vaddr, pps, npages, cente
 >  	 * addresses in a submap must match the main map, this is ok.
 >  	 */
 >  	/* udv offset = (offset from start of entry) + entry's offset */
 > -	curr_offset = (int)((vaddr - entry->start) + entry->offset);
 > +	curr_offset = (vaddr - entry->start) + entry->offset;

...and write this line like:

	curr_offset = entry->offset + (vaddr - entry->start);

...just to make it a little more clear as to what the code intends.

Other than that, please commit it, and when you submit the d_mmap
changes for 1.5, include this change as well.

 >  	/* pmap va = vaddr (virtual address of pps[0]) */
 >  	curr_va = vaddr;
 >  	
 > @@ -473,8 +472,8 @@ udv_fault(ufi, vaddr, pps, npages, cente
 >  		paddr = pmap_phys_address(mdpgno);
 >  		mapprot = ufi->entry->protection;
 >  		UVMHIST_LOG(maphist,
 > -		    "  MAPPING: device: pm=0x%x, va=0x%x, pa=0x%x, at=%d",
 > -		    ufi->orig_map->pmap, curr_va, (int)paddr, mapprot);
 > +		    "  MAPPING: device: pm=0x%x, va=0x%x, pa=0x%lx, at=%d",
 > +		    ufi->orig_map->pmap, curr_va, paddr, mapprot);
 >  		if (pmap_enter(ufi->orig_map->pmap, curr_va, paddr,
 >  		    mapprot, PMAP_CANFAIL | mapprot) != KERN_SUCCESS) {
 >  			/*
 > 

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>