PERFORCE change 29899 for review
    Marcel Moolenaar 
    marcel at FreeBSD.org
       
    Sun Apr 27 15:44:26 PDT 2003
    
    
  
http://perforce.freebsd.org/chv.cgi?CH=29899
Change 29899 by marcel at marcel_pluto2 on 2003/04/27 15:43:34
	Step 2: Use the right field from the FADT table to get the
		hardware timer address. The ACPI CA code converts
		v1.x tables into v2 tables so we don't have to worry
		about it outselves.
	
	Strangely enough the timer still doesn't seem to work. So I
	guess a step 3 is needed as well. This isn't wrong AFAICT,
	so let's get this in...
Affected files ...
.. //depot/projects/ia64/sys/dev/acpica/acpi_timer.c#10 edit
Differences ...
==== //depot/projects/ia64/sys/dev/acpica/acpi_timer.c#10 (text+ko) ====
@@ -149,7 +149,8 @@
 {
     device_t	dev;
     char	desc[40];
-    int		rid, i, j;
+    u_long	rlen, rstart;
+    int		i, j, rid, rtype;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
@@ -164,10 +165,17 @@
 	return_VOID;
     }
     acpi_timer_dev = dev;
+
     rid = 0;
-    bus_set_resource(dev, SYS_RES_IOPORT, rid, AcpiGbl_FADT->V1_PmTmrBlk, sizeof(u_int32_t));
-    if ((acpi_timer_reg = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE)) == NULL) {
-	device_printf(dev, "couldn't allocate I/O resource (port 0x%x)\n", AcpiGbl_FADT->V1_PmTmrBlk);
+    rlen = 3 + AcpiGbl_FADT->TmrValExt;		/* 24 or 32 bit timers. */
+    rtype = (AcpiGbl_FADT->XPmTmrBlk.AddressSpaceId)
+      ? SYS_RES_IOPORT : SYS_RES_MEMORY;
+    rstart = AcpiGbl_FADT->XPmTmrBlk.Address;
+    bus_set_resource(dev, rtype, rid, rstart, 4);
+    acpi_timer_reg = bus_alloc_resource(dev, rtype, &rid, 0, ~0, 1, RF_ACTIVE);
+    if (acpi_timer_reg == NULL) {
+	device_printf(dev, "couldn't allocate I/O resource (%s 0x%lx)\n",
+	  (rtype == SYS_RES_IOPORT) ? "port" : "mem", rstart);
 	return_VOID;
     }
     if (testenv("debug.acpi.timer_test"))
@@ -186,7 +194,7 @@
     }
     tc_init(&acpi_timer_timecounter);
 
-    sprintf(desc, "%d-bit timer at 3.579545MHz", AcpiGbl_FADT->TmrValExt ? 32 : 24);
+    sprintf(desc, "%d-bit timer at 3.579545MHz", (int)(rlen << 3));
     device_set_desc_copy(dev, desc);
 
     return_VOID;
    
    
More information about the p4-projects
mailing list