mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy_d_dunlap@linux.intel.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: akpm <akpm@osdl.org>,
	bob.picco@hp.com, venki <venkatesh.pallipadi@intel.com>
Subject: [PATCH 2/3 -mm] hpet: use HPET physical addresses for dup. detection
Date: Tue, 18 Oct 2005 13:54:59 -0700	[thread overview]
Message-ID: <20051018135459.4402189c.randy_d_dunlap@linux.intel.com> (raw)

From: Randy Dunlap <randy_d_dunlap@linux.intel.com>

- Use HPET physical address to detect duplicates, not logical addresses.
  Using logical (mapped) addresses fails to detect duplicates
  because ioremap() returns a new mapped address each time.
- iounmap() regions when duplicate/busy areas are found.

Signed-off-by: Randy Dunlap <randy_d_dunlap@linux.intel.com>
---

Index: linux-2614-rc4-mm1/drivers/char/hpet.c
===================================================================
--- linux-2614-rc4-mm1.orig/drivers/char/hpet.c
+++ linux-2614-rc4-mm1/drivers/char/hpet.c
@@ -809,8 +809,11 @@ int hpet_alloc(struct hpet_data *hdp)
 	 * ACPI also reports hpet, then we catch it here.
 	 */
 	for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
-		if (hpetp->hp_hpet == hdp->hd_address)
+		if (hpetp->hp_hpet_phys == hdp->hd_phys_address) {
+			printk(KERN_DEBUG "%s: duplicate HPET ignored\n",
+				__FUNCTION__);
 			return 0;
+		}
 
 	siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) *
 				      sizeof(struct hpet_dev));
@@ -858,8 +861,8 @@ int hpet_alloc(struct hpet_data *hdp)
 	do_div(temp, period);
 	hpetp->hp_tick_freq = temp; /* ticks per second */
 
-	printk(KERN_INFO "hpet%d: at MMIO 0x%lx, IRQ%s",
-		hpetp->hp_which, hdp->hd_phys_address,
+	printk(KERN_INFO "hpet%d: at MMIO 0x%lx (virtual 0x%p), IRQ%s",
+		hpetp->hp_which, hdp->hd_phys_address, hdp->hd_address,
 		hpetp->hp_ntimer > 1 ? "s" : "");
 	for (i = 0; i < hpetp->hp_ntimer; i++)
 		printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]);
@@ -922,8 +925,12 @@ static acpi_status hpet_resources(struct
 		hdp->hd_address = ioremap(addr.min_address_range, size);
 
 		for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
-			if (hpetp->hp_hpet == hdp->hd_address)
+			if (hpetp->hp_hpet_phys == hdp->hd_phys_address) {
+				printk(KERN_DEBUG "%s: 0x%lx is busy\n",
+					__FUNCTION__, hdp->hd_phys_address);
+				iounmap(hdp->hd_address);
 				return -EBUSY;
+			}
 	} else if (res->type == ACPI_RSTYPE_FIXED_MEM32) {
 		struct acpi_resource_fixed_mem32 *fixmem32;
 
@@ -936,7 +943,10 @@ static acpi_status hpet_resources(struct
 						HPET_RANGE_SIZE);
 
 		for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
-			if (hpetp->hp_hpet == hdp->hd_address) {
+			if (hpetp->hp_hpet_phys == hdp->hd_phys_address) {
+				printk(KERN_DEBUG "%s: 0x%lx is busy\n",
+					__FUNCTION__, hdp->hd_phys_address);
+				iounmap(hdp->hd_address);
 				return -EBUSY;
 			}
 	} else if (res->type == ACPI_RSTYPE_EXT_IRQ) {


---

                 reply	other threads:[~2005-10-18 20:53 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=20051018135459.4402189c.randy_d_dunlap@linux.intel.com \
    --to=randy_d_dunlap@linux.intel.com \
    --cc=akpm@osdl.org \
    --cc=bob.picco@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=venkatesh.pallipadi@intel.com \
    /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