Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Feb 2003 11:22:13 -0800
From:      walt <wa1ter@myrealbox.com>
To:        freebsd-current@freebsd.org
Subject:   Re: patch for the nVidia driver and -CURRENT
Message-ID:  <3E5BC265.8090009@myrealbox.com>
In-Reply-To: <b3gckj$2eoj$1@FreeBSD.csie.NCTU.edu.tw>
References:  <b3gckj$2eoj$1@FreeBSD.csie.NCTU.edu.tw>

next in thread | previous in thread | raw e-mail | index | archive | help
Maxime Henrion wrote:
> --X1bOJ3K7DJ5YkBrT
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> 	Hi all,
> 
> 
> Recent interface changes made the nVidia driver unbuildable on -CURRENT.
> The attached patch should make it work as it used to.  Please let me
> know if it doesn't.

Yes!  <Mmmmmwahhhh!> [Big kiss to Maxime]  Thank you!

The only thing I needed to do to make it work was to delete this line
from nv-freebsd.h:

#error This driver does not support FreeBSD 5.0/-CURRENT!

As long as you are patching you may as well patch that one also, yes?

> --X1bOJ3K7DJ5YkBrT
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="nvidia.patch"
> 
> diff -u NVIDIA_FreeBSD-1.0-3203/src/nv-freebsd.h nvidia/src/nv-freebsd.h
> --- NVIDIA_FreeBSD-1.0-3203/src/nv-freebsd.h	Wed Oct 30 15:30:58 2002
> +++ nvidia/src/nv-freebsd.h	Tue Feb 25 00:00:48 2003
> @@ -86,6 +83,7 @@
>  
>  #if __FreeBSD_version >= 500000
>  #include <sys/mutex.h>
> +#include <sys/filedesc.h>
>  #include <dev/pci/pcireg.h>
>  #include <dev/pci/pcivar.h>
>  
> @@ -306,7 +304,8 @@
>  int    nvidia_open_dev       (struct nvidia_softc *);
>  int    nvidia_close_ctl      (dev_t, d_thread_t *);
>  int    nvidia_close_dev      (struct nvidia_softc *, dev_t, d_thread_t *);
> -int    nvidia_mmap_dev       (struct nvidia_softc *, vm_offset_t);
> +int    nvidia_mmap_dev       (struct nvidia_softc *, vm_offset_t,
> +    				vm_offset_t *);
>  
>  #endif /* __NV_FREEBSD_H__ */
>  
> diff -u NVIDIA_FreeBSD-1.0-3203/src/nvidia_dev.c nvidia/src/nvidia_dev.c
> --- NVIDIA_FreeBSD-1.0-3203/src/nvidia_dev.c	Wed Oct 30 15:30:58 2002
> +++ nvidia/src/nvidia_dev.c	Mon Feb 24 23:59:21 2003
> @@ -135,6 +135,7 @@
>  int nvidia_dev_mmap(
>      dev_t dev,
>      vm_offset_t offset,
> +    vm_offset_t *paddr,
>      int nprot
>  )
>  {
> @@ -148,7 +149,7 @@
>      nv = sc->nv_state;
>  
>      nv_lock_api(nv);
> -    status = nvidia_mmap_dev(sc, offset);
> +    status = nvidia_mmap_dev(sc, offset, paddr);
>      nv_unlock_api(nv);
>  
>      return status;
> diff -u NVIDIA_FreeBSD-1.0-3203/src/nvidia_subr.c nvidia/src/nvidia_subr.c
> --- NVIDIA_FreeBSD-1.0-3203/src/nvidia_subr.c	Wed Oct 30 15:30:58 2002
> +++ nvidia/src/nvidia_subr.c	Tue Feb 25 00:00:14 2003
> @@ -1401,7 +1405,8 @@
>  
>  int nvidia_mmap_dev(
>      struct nvidia_softc *sc,
> -    vm_offset_t offset
> +    vm_offset_t offset,
> +    vm_offset_t *paddr
>  )
>  {
>      nv_alloc_t *at;
> @@ -1412,14 +1417,20 @@
>       * are physical addresses and mapped into user-space directly. We can
>       * only do some basic sanity checking here.
>       */
> -    if (IS_FB_OFFSET(nv, offset, PAGE_SIZE))
> -        return atop(offset);
> +    if (IS_FB_OFFSET(nv, offset, PAGE_SIZE)) {
> +        *paddr = offset; 
> +        return 0;
> +    }
>      
> -    if (IS_REG_OFFSET(nv, offset, PAGE_SIZE))
> -        return atop(offset);
> +    if (IS_REG_OFFSET(nv, offset, PAGE_SIZE)) {
> +        *paddr = offset; 
> +        return 0;
> +    }
>      
> -    if (IS_AGP_OFFSET(nv, offset, PAGE_SIZE))
> -        return atop(offset);
> +    if (IS_AGP_OFFSET(nv, offset, PAGE_SIZE)) {
> +        *paddr = offset; 
> +        return 0;
> +    }
>  
>      /*
>       * If the offset does not fall into any of the relevant apertures, we
> @@ -1431,7 +1442,8 @@
>      SLIST_FOREACH(at, &sc->alloc_list, list) {
>          if (offset >= at->address &&
>                  offset < at->address + at->size)
> -            return atop(vtophys(offset));
> +            *paddr = vtophys(offset);
> +            return 0;
>      }
>  
>      return -1;
> 
> --X1bOJ3K7DJ5YkBrT--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E5BC265.8090009>