* [patch 01/25] Patch for nvidia divide by zero error for 7600 pci-express card
@ 2006-11-02 5:50 akpm
2006-11-07 16:16 ` Wink Saville
2006-11-13 16:03 ` James Simmons
0 siblings, 2 replies; 3+ messages in thread
From: akpm @ 2006-11-02 5:50 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: akpm
From: Wink Saville <wink@saville.com>
The following patch resolves the divide by zero error I encountered on my system:
http://marc.10east.com/?l=linux-fbdev-devel&m=116058257024413&w=2
I accomplished this by merging what I thought was appropriate from:
http://webcvs.freedesktop.org/xorg/driver/xf86-video-nv/src/
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
drivers/video/nvidia/nv_hw.c | 12 +++++++++---
drivers/video/nvidia/nv_setup.c | 18 +++++++++++++++++-
drivers/video/nvidia/nv_type.h | 1 +
drivers/video/nvidia/nvidia.c | 24 ++++++++++++------------
4 files changed, 39 insertions(+), 16 deletions(-)
diff -puN drivers/video/nvidia/nv_hw.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_hw.c
--- a/drivers/video/nvidia/nv_hw.c~patch-for-nvidia-divide-by-zero-error-for-7600
+++ a/drivers/video/nvidia/nv_hw.c
@@ -145,12 +145,18 @@ static void nvGetClocks(struct nvidia_pa
if (par->Architecture >= NV_ARCH_40) {
pll = NV_RD32(par->PMC, 0x4020);
- P = (pll >> 16) & 0x03;
+ P = (pll >> 16) & 0x07;
pll = NV_RD32(par->PMC, 0x4024);
M = pll & 0xFF;
N = (pll >> 8) & 0xFF;
- MB = (pll >> 16) & 0xFF;
- NB = (pll >> 24) & 0xFF;
+ if(((par->Chipset & 0xfff0) == 0x0290) ||
+ ((par->Chipset & 0xfff0) == 0x0390)) {
+ MB = 1;
+ NB = 1;
+ } else {
+ MB = (pll >> 16) & 0xFF;
+ NB = (pll >> 24) & 0xFF;
+ }
*MClk = ((N * NB * par->CrystalFreqKHz) / (M * MB)) >> P;
pll = NV_RD32(par->PMC, 0x4000);
diff -puN drivers/video/nvidia/nv_setup.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_setup.c
--- a/drivers/video/nvidia/nv_setup.c~patch-for-nvidia-divide-by-zero-error-for-7600
+++ a/drivers/video/nvidia/nv_setup.c
@@ -359,6 +359,7 @@ int NVCommonSetup(struct fb_info *info)
case 0x0186:
case 0x0187:
case 0x018D:
+ case 0x0228:
case 0x0286:
case 0x028C:
case 0x0316:
@@ -382,6 +383,10 @@ int NVCommonSetup(struct fb_info *info)
case 0x034C:
case 0x0160:
case 0x0166:
+ case 0x0169:
+ case 0x016B:
+ case 0x016C:
+ case 0x016D:
case 0x00C8:
case 0x00CC:
case 0x0144:
@@ -639,12 +644,23 @@ int NVCommonSetup(struct fb_info *info)
par->fpHeight = NV_RD32(par->PRAMDAC, 0x0800) + 1;
par->fpSyncs = NV_RD32(par->PRAMDAC, 0x0848) & 0x30000033;
- printk("Panel size is %i x %i\n", par->fpWidth, par->fpHeight);
+ printk("nvidiafb: Panel size is %i x %i\n", par->fpWidth, par->fpHeight);
}
if (monA)
info->monspecs = *monA;
+ if (!par->FlatPanel || !par->twoHeads)
+ par->FPDither = 0;
+
+ par->LVDS = 0;
+ if (par->FlatPanel && par->twoHeads) {
+ NV_WR32(par->PRAMDAC0, 0x08B0, 0x00010004);
+ if (par->PRAMDAC0[0x08b4] & 1)
+ par->LVDS = 1;
+ printk("nvidiafb: Panel is %s\n", par->LVDS ? "LVDS" : "TMDS");
+ }
+
kfree(edidA);
kfree(edidB);
done:
diff -puN drivers/video/nvidia/nv_type.h~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_type.h
--- a/drivers/video/nvidia/nv_type.h~patch-for-nvidia-divide-by-zero-error-for-7600
+++ a/drivers/video/nvidia/nv_type.h
@@ -129,6 +129,7 @@ struct nvidia_par {
int fpHeight;
int PanelTweak;
int paneltweak;
+ int LVDS;
int pm_state;
u32 crtcSync_read;
u32 fpSyncs;
diff -puN drivers/video/nvidia/nvidia.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nvidia.c
--- a/drivers/video/nvidia/nvidia.c~patch-for-nvidia-divide-by-zero-error-for-7600
+++ a/drivers/video/nvidia/nvidia.c
@@ -1160,20 +1160,20 @@ static u32 __devinit nvidia_get_arch(str
case 0x0340: /* GeForceFX 5700 */
arch = NV_ARCH_30;
break;
- case 0x0040:
- case 0x00C0:
- case 0x0120:
+ case 0x0040: /* GeForce 6800 */
+ case 0x00C0: /* GeForce 6800 */
+ case 0x0120: /* GeForce 6800 */
case 0x0130:
- case 0x0140:
- case 0x0160:
- case 0x01D0:
- case 0x0090:
- case 0x0210:
- case 0x0220:
+ case 0x0140: /* GeForce 6600 */
+ case 0x0160: /* GeForce 6200 */
+ case 0x01D0: /* GeForce 7200, 7300, 7400 */
+ case 0x0090: /* GeForce 7800 */
+ case 0x0210: /* GeForce 6800 */
+ case 0x0220: /* GeForce 6200 */
case 0x0230:
- case 0x0240:
- case 0x0290:
- case 0x0390:
+ case 0x0240: /* GeForce 6100 */
+ case 0x0290: /* GeForce 7900 */
+ case 0x0390: /* GeForce 7600 */
arch = NV_ARCH_40;
break;
case 0x0020: /* TNT, TNT2 */
_
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 01/25] Patch for nvidia divide by zero error for 7600 pci-express card
2006-11-02 5:50 [patch 01/25] Patch for nvidia divide by zero error for 7600 pci-express card akpm
@ 2006-11-07 16:16 ` Wink Saville
2006-11-13 16:03 ` James Simmons
1 sibling, 0 replies; 3+ messages in thread
From: Wink Saville @ 2006-11-07 16:16 UTC (permalink / raw)
To: akpm; +Cc: linux-fbdev-devel
akpm@osdl.org wrote:
> From: Wink Saville <wink@saville.com>
>
> The following patch resolves the divide by zero error I encountered on my system:
>
> http://marc.10east.com/?l=linux-fbdev-devel&m=116058257024413&w=2
>
> I accomplished this by merging what I thought was appropriate from:
>
> http://webcvs.freedesktop.org/xorg/driver/xf86-video-nv/src/
>
>
>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
>
> drivers/video/nvidia/nv_hw.c | 12 +++++++++---
> drivers/video/nvidia/nv_setup.c | 18 +++++++++++++++++-
> drivers/video/nvidia/nv_type.h | 1 +
> drivers/video/nvidia/nvidia.c | 24 ++++++++++++------------
> 4 files changed, 39 insertions(+), 16 deletions(-)
>
> diff -puN drivers/video/nvidia/nv_hw.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_hw.c
> --- a/drivers/video/nvidia/nv_hw.c~patch-for-nvidia-divide-by-zero-error-for-7600
> +++ a/drivers/video/nvidia/nv_hw.c
> @@ -145,12 +145,18 @@ static void nvGetClocks(struct nvidia_pa
>
<snip>
> + case 0x0290: /* GeForce 7900 */
> + case 0x0390: /* GeForce 7600 */
> arch = NV_ARCH_40;
> break;
> case 0x0020: /* TNT, TNT2 */
> _
>
After some trials and tribulations and help from Andrew Morton and Junio Hamano (thanks), I was able to successfully test this patch as sourced from v2.6.19-rc4-mm2. There is still the problem that the framebuffer console doesn't work, the display is blank until X comes up, but at least it doesn't crash.
I'm suspecting a configuration problem, my configuration file can be seen in my post from 10/14/2006 as seen here; http://marc.10east.com/?l=linux-fbdev-devel&m=116085527611531&w=2, if anyone has some suggestions I'll be glad to investigate further.
Regards,
Wink Saville
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 01/25] Patch for nvidia divide by zero error for 7600 pci-express card
2006-11-02 5:50 [patch 01/25] Patch for nvidia divide by zero error for 7600 pci-express card akpm
2006-11-07 16:16 ` Wink Saville
@ 2006-11-13 16:03 ` James Simmons
1 sibling, 0 replies; 3+ messages in thread
From: James Simmons @ 2006-11-13 16:03 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: akpm
Acked-by: James Simmons <jsimmons@infradead.org>
On Wed, 1 Nov 2006, akpm@osdl.org wrote:
> From: Wink Saville <wink@saville.com>
>
> The following patch resolves the divide by zero error I encountered on my system:
>
> http://marc.10east.com/?l=linux-fbdev-devel&m=116058257024413&w=2
>
> I accomplished this by merging what I thought was appropriate from:
>
> http://webcvs.freedesktop.org/xorg/driver/xf86-video-nv/src/
>
>
>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
>
> drivers/video/nvidia/nv_hw.c | 12 +++++++++---
> drivers/video/nvidia/nv_setup.c | 18 +++++++++++++++++-
> drivers/video/nvidia/nv_type.h | 1 +
> drivers/video/nvidia/nvidia.c | 24 ++++++++++++------------
> 4 files changed, 39 insertions(+), 16 deletions(-)
>
> diff -puN drivers/video/nvidia/nv_hw.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_hw.c
> --- a/drivers/video/nvidia/nv_hw.c~patch-for-nvidia-divide-by-zero-error-for-7600
> +++ a/drivers/video/nvidia/nv_hw.c
> @@ -145,12 +145,18 @@ static void nvGetClocks(struct nvidia_pa
>
> if (par->Architecture >= NV_ARCH_40) {
> pll = NV_RD32(par->PMC, 0x4020);
> - P = (pll >> 16) & 0x03;
> + P = (pll >> 16) & 0x07;
> pll = NV_RD32(par->PMC, 0x4024);
> M = pll & 0xFF;
> N = (pll >> 8) & 0xFF;
> - MB = (pll >> 16) & 0xFF;
> - NB = (pll >> 24) & 0xFF;
> + if(((par->Chipset & 0xfff0) == 0x0290) ||
> + ((par->Chipset & 0xfff0) == 0x0390)) {
> + MB = 1;
> + NB = 1;
> + } else {
> + MB = (pll >> 16) & 0xFF;
> + NB = (pll >> 24) & 0xFF;
> + }
> *MClk = ((N * NB * par->CrystalFreqKHz) / (M * MB)) >> P;
>
> pll = NV_RD32(par->PMC, 0x4000);
> diff -puN drivers/video/nvidia/nv_setup.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_setup.c
> --- a/drivers/video/nvidia/nv_setup.c~patch-for-nvidia-divide-by-zero-error-for-7600
> +++ a/drivers/video/nvidia/nv_setup.c
> @@ -359,6 +359,7 @@ int NVCommonSetup(struct fb_info *info)
> case 0x0186:
> case 0x0187:
> case 0x018D:
> + case 0x0228:
> case 0x0286:
> case 0x028C:
> case 0x0316:
> @@ -382,6 +383,10 @@ int NVCommonSetup(struct fb_info *info)
> case 0x034C:
> case 0x0160:
> case 0x0166:
> + case 0x0169:
> + case 0x016B:
> + case 0x016C:
> + case 0x016D:
> case 0x00C8:
> case 0x00CC:
> case 0x0144:
> @@ -639,12 +644,23 @@ int NVCommonSetup(struct fb_info *info)
> par->fpHeight = NV_RD32(par->PRAMDAC, 0x0800) + 1;
> par->fpSyncs = NV_RD32(par->PRAMDAC, 0x0848) & 0x30000033;
>
> - printk("Panel size is %i x %i\n", par->fpWidth, par->fpHeight);
> + printk("nvidiafb: Panel size is %i x %i\n", par->fpWidth, par->fpHeight);
> }
>
> if (monA)
> info->monspecs = *monA;
>
> + if (!par->FlatPanel || !par->twoHeads)
> + par->FPDither = 0;
> +
> + par->LVDS = 0;
> + if (par->FlatPanel && par->twoHeads) {
> + NV_WR32(par->PRAMDAC0, 0x08B0, 0x00010004);
> + if (par->PRAMDAC0[0x08b4] & 1)
> + par->LVDS = 1;
> + printk("nvidiafb: Panel is %s\n", par->LVDS ? "LVDS" : "TMDS");
> + }
> +
> kfree(edidA);
> kfree(edidB);
> done:
> diff -puN drivers/video/nvidia/nv_type.h~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nv_type.h
> --- a/drivers/video/nvidia/nv_type.h~patch-for-nvidia-divide-by-zero-error-for-7600
> +++ a/drivers/video/nvidia/nv_type.h
> @@ -129,6 +129,7 @@ struct nvidia_par {
> int fpHeight;
> int PanelTweak;
> int paneltweak;
> + int LVDS;
> int pm_state;
> u32 crtcSync_read;
> u32 fpSyncs;
> diff -puN drivers/video/nvidia/nvidia.c~patch-for-nvidia-divide-by-zero-error-for-7600 drivers/video/nvidia/nvidia.c
> --- a/drivers/video/nvidia/nvidia.c~patch-for-nvidia-divide-by-zero-error-for-7600
> +++ a/drivers/video/nvidia/nvidia.c
> @@ -1160,20 +1160,20 @@ static u32 __devinit nvidia_get_arch(str
> case 0x0340: /* GeForceFX 5700 */
> arch = NV_ARCH_30;
> break;
> - case 0x0040:
> - case 0x00C0:
> - case 0x0120:
> + case 0x0040: /* GeForce 6800 */
> + case 0x00C0: /* GeForce 6800 */
> + case 0x0120: /* GeForce 6800 */
> case 0x0130:
> - case 0x0140:
> - case 0x0160:
> - case 0x01D0:
> - case 0x0090:
> - case 0x0210:
> - case 0x0220:
> + case 0x0140: /* GeForce 6600 */
> + case 0x0160: /* GeForce 6200 */
> + case 0x01D0: /* GeForce 7200, 7300, 7400 */
> + case 0x0090: /* GeForce 7800 */
> + case 0x0210: /* GeForce 6800 */
> + case 0x0220: /* GeForce 6200 */
> case 0x0230:
> - case 0x0240:
> - case 0x0290:
> - case 0x0390:
> + case 0x0240: /* GeForce 6100 */
> + case 0x0290: /* GeForce 7900 */
> + case 0x0390: /* GeForce 7600 */
> arch = NV_ARCH_40;
> break;
> case 0x0020: /* TNT, TNT2 */
> _
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-13 16:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02 5:50 [patch 01/25] Patch for nvidia divide by zero error for 7600 pci-express card akpm
2006-11-07 16:16 ` Wink Saville
2006-11-13 16:03 ` James Simmons
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).