public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@hp.com>
To: linux-ia64@vger.kernel.org
Subject: [PATCH] 2.4 make hpzx1 fake pci device safer
Date: Wed, 19 Nov 2003 16:30:39 +0000	[thread overview]
Message-ID: <marc-linux-ia64-106925945515887@msgid-missing> (raw)


   The fake PCI devices created in the 2.4 zx1 machvec provide PCI-like
config space access to the chipset.  However, there are some registers
in there that have side effects that you don't just want to stumble
across.  These are all out beyond the configuration header space, so
nothing should rely on them.  This patch prevents access to the
dangerous one that you'd touch looking through /proc/bus/pci.  You can
probably still shoot yourself in the foot, but you shouldn't be able to
do it by reading through the proc files.  2.6 has removed these fake
devices, so the patch is not applicable.  Thanks,

	Alex

-- 
Alex Williamson                             HP Linux & Open Source Lab

=== arch/ia64/hp/zx1/hpzx1_misc.c 1.7 vs edited ==--- 1.7/arch/ia64/hp/zx1/hpzx1_misc.c	Thu Oct 16 15:56:24 2003
+++ edited/arch/ia64/hp/zx1/hpzx1_misc.c	Wed Nov 19 09:16:57 2003
@@ -50,7 +50,14 @@
 		fake_dev->sizing = 0; \
 		return PCIBIOS_SUCCESSFUL; \
 	} \
-	*value = read##sz(fake_dev->mapped_csrs + where); \
+	switch (where & ~0x7) { \
+		case 0x48: /* initiates config cycles */ \
+		case 0x78: /* elroy suspend mode register */ \
+			*value = 0; \
+			break; \
+		default: \
+			*value = read##sz(fake_dev->mapped_csrs + where); \
+	} \
 	if (where = PCI_COMMAND) \
 		*value |= PCI_COMMAND_MEMORY; /* SBA omits this */ \
 	return PCIBIOS_SUCCESSFUL; \
@@ -68,8 +75,14 @@
 		if (value = (u##bits) ~0) \
 			fake_dev->sizing = 1; \
 		return PCIBIOS_SUCCESSFUL; \
-	} else \
-		write##sz(value, fake_dev->mapped_csrs + where); \
+	} \
+	switch (where & ~0x7) { \
+		case 0x48: /* initiates config cycles */ \
+		case 0x78: /* elroy suspend mode register */ \
+			break; \
+		default: \
+			write##sz(value, fake_dev->mapped_csrs + where); \
+	} \
 	return PCIBIOS_SUCCESSFUL; \
 }
 



                 reply	other threads:[~2003-11-19 16:30 UTC|newest]

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

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=marc-linux-ia64-106925945515887@msgid-missing \
    --to=alex.williamson@hp.com \
    --cc=linux-ia64@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