diff options
author | Randy Dunlap <randy_d_dunlap@linux.intel.com> | 2005-10-30 18:03:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:31 -0500 |
commit | b6ab126211e2ab17eecbd063b99742a6b04b228e (patch) | |
tree | b92172fb297b29d0fb32e08ac0a2aaaee4fdc2d6 /drivers/char | |
parent | 757c4724099a31a61754ea5202802eaa1def851c (diff) |
[PATCH] hpet: use HPET physical addresses for dup. detection
- 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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hpet.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index e605259e3753..86a2ee40078b 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -809,8 +809,11 @@ int hpet_alloc(struct hpet_data *hdp) | |||
809 | * ACPI also reports hpet, then we catch it here. | 809 | * ACPI also reports hpet, then we catch it here. |
810 | */ | 810 | */ |
811 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) | 811 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) |
812 | if (hpetp->hp_hpet == hdp->hd_address) | 812 | if (hpetp->hp_hpet_phys == hdp->hd_phys_address) { |
813 | printk(KERN_DEBUG "%s: duplicate HPET ignored\n", | ||
814 | __FUNCTION__); | ||
813 | return 0; | 815 | return 0; |
816 | } | ||
814 | 817 | ||
815 | siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) * | 818 | siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) * |
816 | sizeof(struct hpet_dev)); | 819 | sizeof(struct hpet_dev)); |
@@ -858,8 +861,8 @@ int hpet_alloc(struct hpet_data *hdp) | |||
858 | do_div(temp, period); | 861 | do_div(temp, period); |
859 | hpetp->hp_tick_freq = temp; /* ticks per second */ | 862 | hpetp->hp_tick_freq = temp; /* ticks per second */ |
860 | 863 | ||
861 | printk(KERN_INFO "hpet%d: at MMIO 0x%lx, IRQ%s", | 864 | printk(KERN_INFO "hpet%d: at MMIO 0x%lx (virtual 0x%p), IRQ%s", |
862 | hpetp->hp_which, hdp->hd_phys_address, | 865 | hpetp->hp_which, hdp->hd_phys_address, hdp->hd_address, |
863 | hpetp->hp_ntimer > 1 ? "s" : ""); | 866 | hpetp->hp_ntimer > 1 ? "s" : ""); |
864 | for (i = 0; i < hpetp->hp_ntimer; i++) | 867 | for (i = 0; i < hpetp->hp_ntimer; i++) |
865 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); | 868 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); |
@@ -922,8 +925,12 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
922 | hdp->hd_address = ioremap(addr.min_address_range, size); | 925 | hdp->hd_address = ioremap(addr.min_address_range, size); |
923 | 926 | ||
924 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) | 927 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) |
925 | if (hpetp->hp_hpet == hdp->hd_address) | 928 | if (hpetp->hp_hpet_phys == hdp->hd_phys_address) { |
929 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | ||
930 | __FUNCTION__, hdp->hd_phys_address); | ||
931 | iounmap(hdp->hd_address); | ||
926 | return -EBUSY; | 932 | return -EBUSY; |
933 | } | ||
927 | } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { | 934 | } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { |
928 | struct acpi_resource_fixed_mem32 *fixmem32; | 935 | struct acpi_resource_fixed_mem32 *fixmem32; |
929 | 936 | ||
@@ -936,7 +943,10 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
936 | HPET_RANGE_SIZE); | 943 | HPET_RANGE_SIZE); |
937 | 944 | ||
938 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) | 945 | for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) |
939 | if (hpetp->hp_hpet == hdp->hd_address) { | 946 | if (hpetp->hp_hpet_phys == hdp->hd_phys_address) { |
947 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | ||
948 | __FUNCTION__, hdp->hd_phys_address); | ||
949 | iounmap(hdp->hd_address); | ||
940 | return -EBUSY; | 950 | return -EBUSY; |
941 | } | 951 | } |
942 | } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { | 952 | } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { |