set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
hpet_id = hpet_read32(HPET_ID);
- if ( hpet_id == 0 )
+ if ( (hpet_id & HPET_ID_REV) == 0 )
{
- printk("BAD HPET vendor id.\n");
+ printk("BAD HPET revision id.\n");
return 0;
}
for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ )
{
- cfg = hpet_read32(HPET_T0_CFG + i*0x20);
+ cfg = hpet_read32(HPET_Tn_CFG(i));
cfg &= ~HPET_TN_ENABLE;
- hpet_write32(cfg & ~HPET_TN_ENABLE, HPET_T0_CFG);
+ hpet_write32(cfg, HPET_Tn_CFG(i));
}
cfg = hpet_read32(HPET_CFG);
#define HPET_T2_CMP 0x148
#define HPET_T2_ROUTE 0x150
+#define HPET_Tn_CFG(n) (HPET_T0_CFG + n * 0x20)
+#define HPET_Tn_CMP(n) (HPET_T0_CMP + n * 0x20)
+#define HPET_Tn_ROUTE(n) (HPET_T0_ROUTE + n * 0x20)
+
#define HPET_ID_VENDOR 0xffff0000
#define HPET_ID_LEGSUP 0x00008000
#define HPET_ID_NUMBER 0x00001f00