[BACK]Return to clock.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / x86 / isa

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/x86/isa/clock.c between version 1.28 and 1.28.4.2

version 1.28, 2008/04/06 12:19:36 version 1.28.4.2, 2009/05/04 08:12:10
Line 168  int sysbeepmatch(device_t, cfdata_t, voi
Line 168  int sysbeepmatch(device_t, cfdata_t, voi
 void sysbeepattach(device_t, device_t, void *);  void sysbeepattach(device_t, device_t, void *);
 int sysbeepdetach(device_t, int);  int sysbeepdetach(device_t, int);
   
 CFATTACH_DECL_NEW(sysbeep, 0,  CFATTACH_DECL3_NEW(sysbeep, 0,
     sysbeepmatch, sysbeepattach, sysbeepdetach, NULL);      sysbeepmatch, sysbeepattach, sysbeepdetach, NULL, NULL, NULL,
       DVF_DETACH_SHUTDOWN);
   
 static int ppi_attached;  static int ppi_attached;
 static pcppi_tag_t ppicookie;  static pcppi_tag_t ppicookie;
Line 361  startrtclock(void)
Line 362  startrtclock(void)
         /* Check diagnostic status */          /* Check diagnostic status */
         if ((s = mc146818_read(NULL, NVRAM_DIAG)) != 0) { /* XXX softc */          if ((s = mc146818_read(NULL, NVRAM_DIAG)) != 0) { /* XXX softc */
                 char bits[128];                  char bits[128];
                 printf("RTC BIOS diagnostic error %s\n",                  snprintb(bits, sizeof(bits), NVRAM_DIAG_BITS, s);
                     bitmask_snprintf(s, NVRAM_DIAG_BITS, bits, sizeof(bits)));                  printf("RTC BIOS diagnostic error %s\n", bits);
         }          }
   
         tc_init(&i8254_timecounter);          tc_init(&i8254_timecounter);
   
         init_TSC();  
         rtc_register();          rtc_register();
 }  }
   
Line 420  i8254_get_timecount(struct timecounter *
Line 419  i8254_get_timecount(struct timecounter *
 {  {
         u_int count;          u_int count;
         uint16_t rdval;          uint16_t rdval;
         int s;          u_long psl;
   
         /* Don't want someone screwing with the counter while we're here. */          /* Don't want someone screwing with the counter while we're here. */
         s = splhigh();          psl = x86_read_psl();
           x86_disable_intr();
         __cpu_simple_lock(&tmr_lock);          __cpu_simple_lock(&tmr_lock);
         /* Select timer0 and latch counter value. */          /* Select timer0 and latch counter value. */
         outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);          outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
         /* insb to make the read atomic */          /* insb to make the read atomic */
         insb(IO_TIMER1+TIMER_CNTR0, &rdval, 2);          rdval = inb(IO_TIMER1+TIMER_CNTR0);
           rdval |= (inb(IO_TIMER1+TIMER_CNTR0) << 8);
         count = rtclock_tval - rdval;          count = rtclock_tval - rdval;
         if (rtclock_tval && (count < i8254_lastcount &&          if (rtclock_tval && (count < i8254_lastcount &&
                              (!i8254_ticked || rtclock_tval == 0xFFFF))) {                               (!i8254_ticked || rtclock_tval == 0xFFFF))) {
Line 438  i8254_get_timecount(struct timecounter *
Line 439  i8254_get_timecount(struct timecounter *
         i8254_lastcount = count;          i8254_lastcount = count;
         count += i8254_offset;          count += i8254_offset;
         __cpu_simple_unlock(&tmr_lock);          __cpu_simple_unlock(&tmr_lock);
         splx(s);          x86_write_psl(psl);
   
         return (count);          return (count);
 }  }
Line 447  unsigned int
Line 448  unsigned int
 gettick(void)  gettick(void)
 {  {
         uint16_t rdval;          uint16_t rdval;
         int s;          u_long psl;
   
         if (clock_broken_latch)          if (clock_broken_latch)
                 return (gettick_broken_latch());                  return (gettick_broken_latch());
   
         /* Don't want someone screwing with the counter while we're here. */          /* Don't want someone screwing with the counter while we're here. */
         s = splhigh();          psl = x86_read_psl();
           x86_disable_intr();
         __cpu_simple_lock(&tmr_lock);          __cpu_simple_lock(&tmr_lock);
         /* Select counter 0 and latch it. */          /* Select counter 0 and latch it. */
         outb(IO_TIMER1+TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);          outb(IO_TIMER1+TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
         /* insb to make the read atomic */          rdval = inb(IO_TIMER1+TIMER_CNTR0);
         insb(IO_TIMER1+TIMER_CNTR0, &rdval, 2);          rdval |= (inb(IO_TIMER1+TIMER_CNTR0) << 8);
         __cpu_simple_unlock(&tmr_lock);          __cpu_simple_unlock(&tmr_lock);
         splx(s);          x86_write_psl(psl);
   
         return rdval;          return rdval;
 }  }
Line 502  i8254_delay(unsigned int n)
Line 504  i8254_delay(unsigned int n)
                 remaining = (unsigned long long) n * TIMER_FREQ / 1000000;                  remaining = (unsigned long long) n * TIMER_FREQ / 1000000;
         }          }
   
         while (remaining > 0) {          while (remaining > 1) {
 #ifdef CLOCK_PARANOIA  #ifdef CLOCK_PARANOIA
                 int delta;                  int delta;
                 cur_tick = gettick();                  cur_tick = gettick();

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.28.4.2

CVSweb <webmaster@jp.NetBSD.org>