Linux ACPI
 help / color / mirror / Atom feed
* [PATCH] ACPI: Fix resource allocation for fixed hardware in MMIO
@ 2005-09-16 17:34 Bjorn Helgaas
       [not found] ` <200509161134.24735.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2005-09-16 17:34 UTC (permalink / raw)
  To: Len Brown; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

ACPI supports fixed hardware (PM_TMR, GPE blocks, etc) in either
I/O port or MMIO space, but used to always request the regions from
I/O space, even for MMIO hardware.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>

Index: work-vga2/drivers/acpi/motherboard.c
===================================================================
--- work-vga2.orig/drivers/acpi/motherboard.c	2005-09-14 09:28:10.000000000 -0600
+++ work-vga2/drivers/acpi/motherboard.c	2005-09-14 10:39:05.000000000 -0600
@@ -123,41 +123,46 @@
 		},
 };
 
+static void __init acpi_request_region (struct acpi_generic_address *addr,
+	unsigned int length, char *desc)
+{
+	if (!addr->address || !length)
+		return;
+
+	if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO)
+		request_region(addr->address, length, desc);
+	else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+		request_mem_region(addr->address, length, desc);
+}
+
 static void __init acpi_reserve_resources(void)
 {
-	if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
-		request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
+	acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk,
 			       acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
 
-	if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
-		request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
+	acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk,
 			       acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
 
-	if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-		request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address,
+	acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk,
 			       acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
 
-	if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-		request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address,
+	acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk,
 			       acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
 
-	if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
-		request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR");
+	if (acpi_gbl_FADT->pm_tm_len == 4)
+		acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "PM_TMR");
 
-	if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
-		request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
+	acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk,
 			       acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
 
 	/* Length of GPE blocks must be a non-negative multiple of 2 */
 
-	if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
-	    !(acpi_gbl_FADT->gpe0_blk_len & 0x1))
-		request_region(acpi_gbl_FADT->xgpe0_blk.address,
+	if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
+		acpi_request_region(&acpi_gbl_FADT->xgpe0_blk,
 			       acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
 
-	if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
-	    !(acpi_gbl_FADT->gpe1_blk_len & 0x1))
-		request_region(acpi_gbl_FADT->xgpe1_blk.address,
+	if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
+		acpi_request_region(&acpi_gbl_FADT->xgpe1_blk,
 			       acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
 }
 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php

^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE: [PATCH] ACPI: Fix resource allocation for fixed hardware in MMIO
@ 2005-10-24  1:24 Li, Shaohua
  2005-10-24 14:53 ` Bjorn Helgaas
  0 siblings, 1 reply; 4+ messages in thread
From: Li, Shaohua @ 2005-10-24  1:24 UTC (permalink / raw)
  To: Bjorn Helgaas, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Brown, Len

Hi Bjorn,
>> ACPI supports fixed hardware (PM_TMR, GPE blocks, etc) in either
>> I/O port or MMIO space, but used to always request the regions from
>> I/O space, even for MMIO hardware.
>
><poke> any news on this or the following few patches?  Should I
>resend them?
I missed this before. Should we do the same thing in
'acpi_reserve_io_ranges' and in pnp system.c? The resources listed in
acpi_gbl_FADT generally also listed in motherboard devices (PNP0C01,
PNP0C02). We doubly request it is to workaround some buggy BIOS.

Thanks,
Shaohua


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-10-24 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-16 17:34 [PATCH] ACPI: Fix resource allocation for fixed hardware in MMIO Bjorn Helgaas
     [not found] ` <200509161134.24735.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-10-20 18:43   ` Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2005-10-24  1:24 Li, Shaohua
2005-10-24 14:53 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox