~ubuntu-branches/ubuntu/lucid/xenomai/lucid

« back to all changes in this revision

Viewing changes to ksrc/arch/x86/hal-common.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Rodriguez
  • Date: 2009-06-24 22:17:01 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090624221701-mwnah8aj90zmp6uj
Tags: 2.4.8-2ubuntu1
* Merge from debian unstable (LP: #391918), remaining changes:
  - Add lpia to supported architectures.
  - debian/rules: Create file for debhelper to pick up, use debhelper to
    install it.
  - debian/libxenomai1.dirs: Do not create directory.
  - debian/libxenomai1.preinst: Remove symlink on upgrade, remove old udev.
    rule unless modified in which case move to new name.
  - debian/libxenomai1.postinst: Do not create symlink.
  - debian/libxenomai1.postrm: No symlink to remove.
  - Bump build-depend on debhelper to install udev rules into
    /lib/udev/rules.d, add Breaks on udev to get correct version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
 
103
103
        rthal_local_irq_save_hw(flags);
104
104
        apic_wait_icr_idle();
105
 
        apic_write_around(APIC_ICR,
 
105
        apic_write(APIC_ICR,
106
106
                          APIC_DM_FIXED | APIC_DEST_ALLBUT | INT_DEST_ADDR_MODE
107
107
                          | vector);
108
108
        rthal_local_irq_restore_hw(flags);
132
132
                         struct clock_event_device *cdev),
133
133
        int cpu)
134
134
{
135
 
        unsigned long tmfreq;
136
 
        int tickval, err;
 
135
        unsigned long dummy, *tmfreq = &dummy;
 
136
        int tickval, err, res;
 
137
 
 
138
        if (cpu_timers_requested == 0) {
 
139
                err = rthal_irq_request(RTHAL_APIC_TIMER_IPI,
 
140
                                        (rthal_irq_handler_t) tick_handler,
 
141
                                        NULL, NULL);
 
142
                if (err)
 
143
                        return err;
 
144
        }
137
145
 
138
146
        /* This code works both for UP+LAPIC and SMP configurations. */
139
147
 
 
148
        if (rthal_timerfreq_arg == 0)
 
149
                tmfreq = &rthal_tunables.timer_freq;
 
150
 
140
151
#ifdef __IPIPE_FEATURE_REQUEST_TICKDEV
141
 
        int res = ipipe_request_tickdev("lapic", mode_emul, tick_emul, cpu,
142
 
                                        &tmfreq);
 
152
        res = ipipe_request_tickdev("lapic", mode_emul, tick_emul, cpu,
 
153
                                    tmfreq);
143
154
#else
144
 
        int res = ipipe_request_tickdev("lapic",
145
 
                                        (compat_emumode_t)mode_emul,
146
 
                                        (compat_emutick_t)tick_emul,
147
 
                                        cpu);
148
 
        tmfreq = RTHAL_COMPAT_TIMERFREQ;
 
155
        *tmfreq = RTHAL_COMPAT_TIMERFREQ;
 
156
        res = ipipe_request_tickdev("lapic", (compat_emumode_t)mode_emul,
 
157
                                    (compat_emutick_t)tick_emul, cpu);
149
158
#endif
150
159
 
151
160
        switch (res) {
167
176
                break;
168
177
 
169
178
        case CLOCK_EVT_MODE_SHUTDOWN:
170
 
                return -ENODEV;
 
179
                res = -ENODEV;
 
180
                /* fall through */
171
181
 
172
182
        default:
 
183
                if (cpu_timers_requested == 0)
 
184
                        rthal_irq_release(RTHAL_APIC_TIMER_IPI);
173
185
                return res;
174
186
        }
175
187
        rthal_ktimer_saved_mode = res;
176
188
 
177
 
        if (rthal_timerfreq_arg == 0)
178
 
                rthal_tunables.timer_freq = tmfreq;
179
 
 
180
189
        /*
181
190
         * The rest of the initialization should only be performed
182
191
         * once by a single CPU.
183
192
         */
184
 
        if (cpu_timers_requested++ > 0)
185
 
                goto out;
186
 
 
187
 
        err = rthal_irq_request(RTHAL_APIC_TIMER_IPI,
188
 
                                (rthal_irq_handler_t) tick_handler, NULL, NULL);
189
 
 
190
 
        if (err)
191
 
                return err;
192
 
 
193
 
        rthal_timer_set_oneshot(1);
194
 
 
195
 
        rthal_nmi_init(&rthal_latency_above_max);
196
 
out:
 
193
        if (cpu_timers_requested++ == 0) {
 
194
                rthal_timer_set_oneshot(1);
 
195
 
 
196
                rthal_nmi_init(&rthal_latency_above_max);
 
197
        }
 
198
 
197
199
        return tickval;
198
200
}
199
201
 
270
272
 
271
273
        rthal_nmi_release();
272
274
 
273
 
        rthal_irq_release(RTHAL_APIC_TIMER_IPI);
274
 
 
275
275
        if (rthal_ktimer_saved_mode == KTIMER_MODE_PERIODIC)
276
276
                rthal_timer_set_periodic();
277
277
        else if (rthal_ktimer_saved_mode == KTIMER_MODE_ONESHOT)
278
278
                rthal_timer_set_oneshot(0);
 
279
 
 
280
        rthal_irq_release(RTHAL_APIC_TIMER_IPI);
279
281
}
280
282
 
281
283