mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Prakash K. Cheemplavam" <prakashkc@gmx.de>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Martin Drab <drab@kepler.fjfi.cvut.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	akpm@osdl.org
Subject: [PATCH] Re: APIC/LAPIC hanging problems on nForce2 system.
Date: Thu, 06 Jan 2005 16:04:27 +0100	[thread overview]
Message-ID: <41DD537B.9030304@gmx.de> (raw)
In-Reply-To: <58cb370e05010605527f87297e@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2676 bytes --]


>>Well, I also think it is quite stupid to only apply the fix if
>>disconnect is enabled at boot time and don't apply it if it is not. The
>>kernel dev responsible for it is rather pedantic: Fix only when needed,

[..]
> Changing _only_ "fixup" bits seems like a reasonable compromise IMO.
> Could you (or Martin) make a patch and submit it to -mm for testing?

Ok, here it goes. It's the first time I write a patch for the kernel, so
please don't bash me. I hope my logics were alright, so please
proof-read it. I haven't tested it yet...

It simplifies the function to

static void __init pci_fixup_nforce2(struct pci_dev *dev)
{
	u32 val;

	/*
	 * Chip  Old value   New value
	 * C17   0x1F0FFF01  0x1F01FF01
	 * C18D  0x9F0FFF01  0x9F01FF01
	 *
	 * Northbridge chip version may be determined by
	 * reading the PCI revision ID (0xC1 or greater is C18D).
	 */
	pci_read_config_dword(dev, 0x6c, &val);

	/*
	 * Apply fixup if needed, but don't touch disconnect state
	 */
	if ((val & 0x00FF0000) != 0x00010000) {
		printk(KERN_WARNING "PCI: nForce2 C1 Halt Disconnect fixup\n");
		pci_write_config_dword(dev, 0x6c, (val & 0xFF00FFFF) | 0x00010000);
	}
}



This patch applies the Nforce2 C1 halt disconnect fix, no matter if
disconnect is enabled of not. I don't know whether checking the whole
affected byte is necessary or the nibble would be enough (I am no Nvidia
engineer).

Signed-off-by: Prakash Punnoor <prakashp@arcor.de>

(My name is soon officially to be changed, in case you are wondering.)


--- arch/i386/pci/fixup.c.o	2005-01-06 15:43:40.535842320 +0100
+++ arch/i386/pci/fixup.c	2005-01-06 16:00:50.174313480 +0100
@@ -227,10 +227,7 @@
   */
  static void __init pci_fixup_nforce2(struct pci_dev *dev)
  {
-	u32 val, fixed_val;
-	u8 rev;
-
-	pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
+	u32 val;

  	/*
  	 * Chip  Old value   New value
@@ -240,17 +237,14 @@
  	 * Northbridge chip version may be determined by
  	 * reading the PCI revision ID (0xC1 or greater is C18D).
  	 */
-	fixed_val = rev < 0xC1 ? 0x1F01FF01 : 0x9F01FF01;
-
  	pci_read_config_dword(dev, 0x6c, &val);

  	/*
-	 * Apply fixup only if C1 Halt Disconnect is enabled
-	 * (bit28) because it is not supported on some boards.
+	 * Apply fixup if needed, but don't touch disconnect state
  	 */
-	if ((val & (1 << 28)) && val != fixed_val) {
+	if ((val & 0x00FF0000) != 0x00010000) {
  		printk(KERN_WARNING "PCI: nForce2 C1 Halt Disconnect fixup\n");
-		pci_write_config_dword(dev, 0x6c, fixed_val);
+		pci_write_config_dword(dev, 0x6c, (val & 0xFF00FFFF) | 0x00010000);
  	}
  }
  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA,
PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2);



[-- Attachment #1.2: always_nforce2_c1_fix.patch --]
[-- Type: text/x-patch, Size: 1151 bytes --]

--- arch/i386/pci/fixup.c.o	2005-01-06 15:43:40.535842320 +0100
+++ arch/i386/pci/fixup.c	2005-01-06 16:00:50.174313480 +0100
@@ -227,10 +227,7 @@
  */
 static void __init pci_fixup_nforce2(struct pci_dev *dev)
 {
-	u32 val, fixed_val;
-	u8 rev;
-
-	pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
+	u32 val;

 	/*
 	 * Chip  Old value   New value
@@ -240,17 +237,14 @@
 	 * Northbridge chip version may be determined by
 	 * reading the PCI revision ID (0xC1 or greater is C18D).
 	 */
-	fixed_val = rev < 0xC1 ? 0x1F01FF01 : 0x9F01FF01;
-
 	pci_read_config_dword(dev, 0x6c, &val);

 	/*
-	 * Apply fixup only if C1 Halt Disconnect is enabled
-	 * (bit28) because it is not supported on some boards.
+	 * Apply fixup if needed, but don't touch disconnect state
 	 */
-	if ((val & (1 << 28)) && val != fixed_val) {
+	if ((val & 0x00FF0000) != 0x00010000) {
 		printk(KERN_WARNING "PCI: nForce2 C1 Halt Disconnect fixup\n");
-		pci_write_config_dword(dev, 0x6c, fixed_val);
+		pci_write_config_dword(dev, 0x6c, (val & 0xFF00FFFF) | 0x00010000);
 	}
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-01-06 15:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-05 15:28 Martin Drab
2005-01-05 16:05 ` Zwane Mwaikambo
2005-01-05 16:56   ` Martin Drab
2005-01-05 16:50 ` Prakash K. Cheemplavam
2005-01-05 17:06   ` Martin Drab
2005-01-05 17:17     ` Prakash K. Cheemplavam
2005-01-05 17:22       ` Martin Drab
2005-01-05 17:26         ` Prakash K. Cheemplavam
2005-01-05 17:30           ` Martin Drab
2005-01-06  0:14           ` Martin Drab
2005-01-06  9:03             ` Prakash K. Cheemplavam
2005-01-06 13:52               ` Bartlomiej Zolnierkiewicz
2005-01-06 15:04                 ` Prakash K. Cheemplavam [this message]
2005-01-06 23:46                   ` [PATCH] " Andrew Morton
2005-01-07  0:28                     ` Prakash K. Cheemplavam
2005-01-07  0:49                       ` Andrew Morton
2005-01-07 11:47                         ` Martin Drab
2005-01-07 13:53                         ` Prakash K. Cheemplavam
2005-01-07 15:34                           ` Bartlomiej Zolnierkiewicz
2005-01-06 14:18               ` Martin Drab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41DD537B.9030304@gmx.de \
    --to=prakashkc@gmx.de \
    --cc=akpm@osdl.org \
    --cc=bzolnier@gmail.com \
    --cc=drab@kepler.fjfi.cvut.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome