[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 3/6] x86/time: support 32-bit wide ACPI PM timer



I have no idea why we didn't do so from the beginning.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Tested-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
Tested-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -481,22 +481,23 @@ static int __init acpi_parse_fadt(struct
        if (fadt->header.revision >= FADT2_REVISION_ID) {
                /* FADT rev. 2 */
                if (fadt->xpm_timer_block.space_id ==
-                   ACPI_ADR_SPACE_SYSTEM_IO)
+                   ACPI_ADR_SPACE_SYSTEM_IO) {
                        pmtmr_ioport = fadt->xpm_timer_block.address;
-               /*
-                * "X" fields are optional extensions to the original V1.0
-                * fields, so we must selectively expand V1.0 fields if the
-                * corresponding X field is zero.
-                */
-               if (!pmtmr_ioport)
-                       pmtmr_ioport = fadt->pm_timer_block;
-       } else {
-               /* FADT rev. 1 */
+                       pmtmr_width = fadt->xpm_timer_block.bit_width;
+               }
+       }
+       /*
+        * "X" fields are optional extensions to the original V1.0
+        * fields, so we must selectively expand V1.0 fields if the
+        * corresponding X field is zero.
+        */
+       if (!pmtmr_ioport) {
                pmtmr_ioport = fadt->pm_timer_block;
+               pmtmr_width = fadt->pm_timer_length == 4 ? 24 : 0;
        }
        if (pmtmr_ioport)
-               printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
-                      pmtmr_ioport);
+               printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x (%u bits)\n",
+                      pmtmr_ioport, pmtmr_width);
 #endif
 
        acpi_smi_cmd       = fadt->smi_command;
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -403,6 +403,7 @@ static struct platform_timesource __init
  */
 
 u32 __read_mostly pmtmr_ioport;
+unsigned int __initdata pmtmr_width;
 
 /* ACPI PM timer ticks at 3.579545 MHz. */
 #define ACPI_PM_FREQUENCY 3579545
@@ -417,9 +418,15 @@ static s64 __init init_pmtimer(struct pl
     u64 start;
     u32 count, target, mask = 0xffffff;
 
-    if ( pmtmr_ioport == 0 )
+    if ( !pmtmr_ioport || !pmtmr_width )
         return 0;
 
+    if ( pmtmr_width == 32 )
+    {
+        pts->counter_bits = 32;
+        mask = 0xffffffff;
+    }
+
     count = inl(pmtmr_ioport) & mask;
     start = rdtsc_ordered();
     target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -146,6 +146,7 @@ extern u32 x86_acpiid_to_apicid[];
 #define INVALID_ACPIID         (-1U)
 
 extern u32 pmtmr_ioport;
+extern unsigned int pmtmr_width;
 
 int acpi_dmar_init(void);
 void acpi_mmcfg_init(void);



Attachment: x86-PMTMR-32bit.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.