blob: 3044a88357faf3e575f0f47930fa8bdc3c98c036 [file] [log] [blame]
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -08001/*
2 * linux/kernel/time/tick-broadcast.c
3 *
4 * This file contains functions which emulate a local clock-event
5 * device via a broadcast event source.
6 *
7 * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
8 * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
9 * Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
10 *
11 * This code is licenced under the GPL version 2. For details see
12 * kernel-base/COPYING.
13 */
14#include <linux/cpu.h>
15#include <linux/err.h>
16#include <linux/hrtimer.h>
Russell Kingd7b90682008-04-17 07:46:24 +020017#include <linux/interrupt.h>
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -080018#include <linux/percpu.h>
19#include <linux/profile.h>
20#include <linux/sched.h>
21#include <linux/tick.h>
22
23#include "tick-internal.h"
24
25/*
26 * Broadcast support for broken x86 hardware, where the local apic
27 * timer stops in C3 state.
28 */
29
30struct tick_device tick_broadcast_device;
31static cpumask_t tick_broadcast_mask;
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -080032static DEFINE_SPINLOCK(tick_broadcast_lock);
Thomas Gleixneraa276e12008-06-09 19:15:00 +020033static int tick_broadcast_force;
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -080034
Thomas Gleixner5590a532007-07-21 04:37:35 -070035#ifdef CONFIG_TICK_ONESHOT
36static void tick_broadcast_clear_oneshot(int cpu);
37#else
38static inline void tick_broadcast_clear_oneshot(int cpu) { }
39#endif
40
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -080041/*
Ingo Molnar289f4802007-02-16 01:28:15 -080042 * Debugging: see timer_list.c
43 */
44struct tick_device *tick_get_broadcast_device(void)
45{
46 return &tick_broadcast_device;
47}
48
49cpumask_t *tick_get_broadcast_mask(void)
50{
51 return &tick_broadcast_mask;
52}
53
54/*
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -080055 * Start the device in periodic mode
56 */
57static void tick_broadcast_start_periodic(struct clock_event_device *bc)
58{
Thomas Gleixner18de5bc2007-07-21 04:37:34 -070059 if (bc)
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -080060 tick_setup_periodic(bc, 1);
61}
62
63/*
64 * Check, if the device can be utilized as broadcast device:
65 */
66int tick_check_broadcast_device(struct clock_event_device *dev)
67{
Venki Pallipadi4a932322007-10-12 23:04:23 +020068 if ((tick_broadcast_device.evtdev &&
69 tick_broadcast_device.evtdev->rating >= dev->rating) ||
70 (dev->features & CLOCK_EVT_FEAT_C3STOP))
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -080071 return 0;
72
73 clockevents_exchange_device(NULL, dev);
74 tick_broadcast_device.evtdev = dev;
75 if (!cpus_empty(tick_broadcast_mask))
76 tick_broadcast_start_periodic(dev);
77 return 1;
78}
79
80/*
81 * Check, if the device is the broadcast device
82 */
83int tick_is_broadcast_device(struct clock_event_device *dev)
84{
85 return (dev && tick_broadcast_device.evtdev == dev);
86}
87
88/*
89 * Check, if the device is disfunctional and a place holder, which
90 * needs to be handled by the broadcast device.
91 */
92int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu)
93{
94 unsigned long flags;
95 int ret = 0;
96
97 spin_lock_irqsave(&tick_broadcast_lock, flags);
98
99 /*
100 * Devices might be registered with both periodic and oneshot
101 * mode disabled. This signals, that the device needs to be
102 * operated from the broadcast device and is a placeholder for
103 * the cpu local device.
104 */
105 if (!tick_device_is_functional(dev)) {
106 dev->event_handler = tick_handle_periodic;
107 cpu_set(cpu, tick_broadcast_mask);
108 tick_broadcast_start_periodic(tick_broadcast_device.evtdev);
109 ret = 1;
Thomas Gleixner5590a532007-07-21 04:37:35 -0700110 } else {
111 /*
112 * When the new device is not affected by the stop
113 * feature and the cpu is marked in the broadcast mask
114 * then clear the broadcast bit.
115 */
116 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) {
117 int cpu = smp_processor_id();
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800118
Thomas Gleixner5590a532007-07-21 04:37:35 -0700119 cpu_clear(cpu, tick_broadcast_mask);
120 tick_broadcast_clear_oneshot(cpu);
121 }
122 }
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800123 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
124 return ret;
125}
126
127/*
128 * Broadcast the event to the cpus, which are set in the mask
129 */
Thomas Gleixner186e3cb2008-01-30 13:30:01 +0100130static void tick_do_broadcast(cpumask_t mask)
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800131{
Thomas Gleixner186e3cb2008-01-30 13:30:01 +0100132 int cpu = smp_processor_id();
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800133 struct tick_device *td;
134
135 /*
136 * Check, if the current cpu is in the mask
137 */
138 if (cpu_isset(cpu, mask)) {
139 cpu_clear(cpu, mask);
140 td = &per_cpu(tick_cpu_device, cpu);
141 td->evtdev->event_handler(td->evtdev);
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800142 }
143
144 if (!cpus_empty(mask)) {
145 /*
146 * It might be necessary to actually check whether the devices
147 * have different broadcast functions. For now, just use the
148 * one of the first device. This works as long as we have this
149 * misfeature only on x86 (lapic)
150 */
151 cpu = first_cpu(mask);
152 td = &per_cpu(tick_cpu_device, cpu);
153 td->evtdev->broadcast(mask);
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800154 }
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800155}
156
157/*
158 * Periodic broadcast:
159 * - invoke the broadcast handlers
160 */
161static void tick_do_periodic_broadcast(void)
162{
163 cpumask_t mask;
164
165 spin_lock(&tick_broadcast_lock);
166
167 cpus_and(mask, cpu_online_map, tick_broadcast_mask);
168 tick_do_broadcast(mask);
169
170 spin_unlock(&tick_broadcast_lock);
171}
172
173/*
174 * Event handler for periodic broadcast ticks
175 */
176static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
177{
Thomas Gleixnerd4496b32008-09-03 21:36:57 +0000178 ktime_t next;
179
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800180 tick_do_periodic_broadcast();
181
182 /*
183 * The device is in periodic mode. No reprogramming necessary:
184 */
185 if (dev->mode == CLOCK_EVT_MODE_PERIODIC)
186 return;
187
188 /*
189 * Setup the next period for devices, which do not have
Thomas Gleixnerd4496b32008-09-03 21:36:57 +0000190 * periodic mode. We read dev->next_event first and add to it
191 * when the event alrady expired. clockevents_program_event()
192 * sets dev->next_event only when the event is really
193 * programmed to the device.
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800194 */
Thomas Gleixnerd4496b32008-09-03 21:36:57 +0000195 for (next = dev->next_event; ;) {
196 next = ktime_add(next, tick_period);
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800197
198 if (!clockevents_program_event(dev, next, ktime_get()))
199 return;
200 tick_do_periodic_broadcast();
201 }
202}
203
204/*
205 * Powerstate information: The system enters/leaves a state, where
206 * affected devices might stop
207 */
208static void tick_do_broadcast_on_off(void *why)
209{
210 struct clock_event_device *bc, *dev;
211 struct tick_device *td;
212 unsigned long flags, *reason = why;
213 int cpu;
214
215 spin_lock_irqsave(&tick_broadcast_lock, flags);
216
217 cpu = smp_processor_id();
218 td = &per_cpu(tick_cpu_device, cpu);
219 dev = td->evtdev;
220 bc = tick_broadcast_device.evtdev;
221
222 /*
Thomas Gleixner1595f452007-10-14 22:57:45 +0200223 * Is the device not affected by the powerstate ?
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800224 */
Thomas Gleixner1595f452007-10-14 22:57:45 +0200225 if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800226 goto out;
227
Thomas Gleixner3dfbc882007-10-17 18:04:32 +0200228 if (!tick_device_is_functional(dev))
229 goto out;
Thomas Gleixner1595f452007-10-14 22:57:45 +0200230
231 switch (*reason) {
232 case CLOCK_EVT_NOTIFY_BROADCAST_ON:
233 case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800234 if (!cpu_isset(cpu, tick_broadcast_mask)) {
235 cpu_set(cpu, tick_broadcast_mask);
236 if (td->mode == TICKDEV_MODE_PERIODIC)
237 clockevents_set_mode(dev,
238 CLOCK_EVT_MODE_SHUTDOWN);
239 }
Thomas Gleixner3dfbc882007-10-17 18:04:32 +0200240 if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
Thomas Gleixneraa276e12008-06-09 19:15:00 +0200241 tick_broadcast_force = 1;
Thomas Gleixner1595f452007-10-14 22:57:45 +0200242 break;
243 case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
Thomas Gleixneraa276e12008-06-09 19:15:00 +0200244 if (!tick_broadcast_force &&
245 cpu_isset(cpu, tick_broadcast_mask)) {
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800246 cpu_clear(cpu, tick_broadcast_mask);
247 if (td->mode == TICKDEV_MODE_PERIODIC)
248 tick_setup_periodic(dev, 0);
249 }
Thomas Gleixner1595f452007-10-14 22:57:45 +0200250 break;
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800251 }
252
253 if (cpus_empty(tick_broadcast_mask))
254 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
255 else {
256 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
257 tick_broadcast_start_periodic(bc);
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800258 else
259 tick_broadcast_setup_oneshot(bc);
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800260 }
261out:
262 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
263}
264
265/*
266 * Powerstate information: The system enters/leaves a state, where
267 * affected devices might stop.
268 */
269void tick_broadcast_on_off(unsigned long reason, int *oncpu)
270{
Avi Kivitybf020cb2007-10-16 23:26:24 -0700271 if (!cpu_isset(*oncpu, cpu_online_map))
Glauber Costa833df312008-04-18 13:38:58 -0700272 printk(KERN_ERR "tick-broadcast: ignoring broadcast for "
Thomas Gleixner72fcde92007-05-23 13:57:30 -0700273 "offline CPU #%d\n", *oncpu);
Avi Kivitybf020cb2007-10-16 23:26:24 -0700274 else
275 smp_call_function_single(*oncpu, tick_do_broadcast_on_off,
Jens Axboe8691e5a2008-06-06 11:18:06 +0200276 &reason, 1);
Thomas Gleixnerf8381cb2007-02-16 01:28:02 -0800277}
278
279/*
280 * Set the periodic handler depending on broadcast on/off
281 */
282void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
283{
284 if (!broadcast)
285 dev->event_handler = tick_handle_periodic;
286 else
287 dev->event_handler = tick_handle_periodic_broadcast;
288}
289
290/*
291 * Remove a CPU from broadcasting
292 */
293void tick_shutdown_broadcast(unsigned int *cpup)
294{
295 struct clock_event_device *bc;
296 unsigned long flags;
297 unsigned int cpu = *cpup;
298
299 spin_lock_irqsave(&tick_broadcast_lock, flags);
300
301 bc = tick_broadcast_device.evtdev;
302 cpu_clear(cpu, tick_broadcast_mask);
303
304 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
305 if (bc && cpus_empty(tick_broadcast_mask))
306 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
307 }
308
309 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
310}
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800311
Thomas Gleixner6321dd62007-03-06 08:25:42 +0100312void tick_suspend_broadcast(void)
313{
314 struct clock_event_device *bc;
315 unsigned long flags;
316
317 spin_lock_irqsave(&tick_broadcast_lock, flags);
318
319 bc = tick_broadcast_device.evtdev;
Thomas Gleixner18de5bc2007-07-21 04:37:34 -0700320 if (bc)
Thomas Gleixner6321dd62007-03-06 08:25:42 +0100321 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
322
323 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
324}
325
326int tick_resume_broadcast(void)
327{
328 struct clock_event_device *bc;
329 unsigned long flags;
330 int broadcast = 0;
331
332 spin_lock_irqsave(&tick_broadcast_lock, flags);
333
334 bc = tick_broadcast_device.evtdev;
Thomas Gleixner6321dd62007-03-06 08:25:42 +0100335
Thomas Gleixnercd05a1f2007-03-17 00:25:52 +0100336 if (bc) {
Thomas Gleixner18de5bc2007-07-21 04:37:34 -0700337 clockevents_set_mode(bc, CLOCK_EVT_MODE_RESUME);
338
Thomas Gleixnercd05a1f2007-03-17 00:25:52 +0100339 switch (tick_broadcast_device.mode) {
340 case TICKDEV_MODE_PERIODIC:
341 if(!cpus_empty(tick_broadcast_mask))
342 tick_broadcast_start_periodic(bc);
343 broadcast = cpu_isset(smp_processor_id(),
344 tick_broadcast_mask);
345 break;
346 case TICKDEV_MODE_ONESHOT:
347 broadcast = tick_resume_broadcast_oneshot(bc);
348 break;
349 }
Thomas Gleixner6321dd62007-03-06 08:25:42 +0100350 }
351 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
352
353 return broadcast;
354}
355
356
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800357#ifdef CONFIG_TICK_ONESHOT
358
359static cpumask_t tick_broadcast_oneshot_mask;
360
Ingo Molnar289f4802007-02-16 01:28:15 -0800361/*
362 * Debugging: see timer_list.c
363 */
364cpumask_t *tick_get_broadcast_oneshot_mask(void)
365{
366 return &tick_broadcast_oneshot_mask;
367}
368
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800369static int tick_broadcast_set_event(ktime_t expires, int force)
370{
371 struct clock_event_device *bc = tick_broadcast_device.evtdev;
372 ktime_t now = ktime_get();
373 int res;
374
375 for(;;) {
376 res = clockevents_program_event(bc, expires, now);
377 if (!res || !force)
378 return res;
379 now = ktime_get();
380 expires = ktime_add(now, ktime_set(0, bc->min_delta_ns));
381 }
382}
383
Thomas Gleixnercd05a1f2007-03-17 00:25:52 +0100384int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
385{
386 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
Thomas Gleixnerb7e113d2007-09-22 22:29:06 +0000387 return 0;
Thomas Gleixnercd05a1f2007-03-17 00:25:52 +0100388}
389
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800390/*
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800391 * Handle oneshot mode broadcasting
392 */
393static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
394{
395 struct tick_device *td;
396 cpumask_t mask;
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100397 ktime_t now, next_event;
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800398 int cpu;
399
400 spin_lock(&tick_broadcast_lock);
401again:
402 dev->next_event.tv64 = KTIME_MAX;
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100403 next_event.tv64 = KTIME_MAX;
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800404 mask = CPU_MASK_NONE;
405 now = ktime_get();
406 /* Find all expired events */
Mike Traviscad0e452008-05-12 21:21:13 +0200407 for_each_cpu_mask_nr(cpu, tick_broadcast_oneshot_mask) {
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800408 td = &per_cpu(tick_cpu_device, cpu);
409 if (td->evtdev->next_event.tv64 <= now.tv64)
410 cpu_set(cpu, mask);
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100411 else if (td->evtdev->next_event.tv64 < next_event.tv64)
412 next_event.tv64 = td->evtdev->next_event.tv64;
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800413 }
414
415 /*
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100416 * Wakeup the cpus which have an expired event.
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800417 */
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100418 tick_do_broadcast(mask);
419
420 /*
421 * Two reasons for reprogram:
422 *
423 * - The global event did not expire any CPU local
424 * events. This happens in dyntick mode, as the maximum PIT
425 * delta is quite small.
426 *
427 * - There are pending events on sleeping CPUs which were not
428 * in the event mask
429 */
430 if (next_event.tv64 != KTIME_MAX) {
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800431 /*
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100432 * Rearm the broadcast device. If event expired,
433 * repeat the above
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800434 */
Thomas Gleixnercdc6f272007-12-18 18:05:58 +0100435 if (tick_broadcast_set_event(next_event, 0))
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800436 goto again;
437 }
438 spin_unlock(&tick_broadcast_lock);
439}
440
441/*
442 * Powerstate information: The system enters/leaves a state, where
443 * affected devices might stop
444 */
445void tick_broadcast_oneshot_control(unsigned long reason)
446{
447 struct clock_event_device *bc, *dev;
448 struct tick_device *td;
449 unsigned long flags;
450 int cpu;
451
452 spin_lock_irqsave(&tick_broadcast_lock, flags);
453
454 /*
455 * Periodic mode does not care about the enter/exit of power
456 * states
457 */
458 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
459 goto out;
460
461 bc = tick_broadcast_device.evtdev;
462 cpu = smp_processor_id();
463 td = &per_cpu(tick_cpu_device, cpu);
464 dev = td->evtdev;
465
466 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
467 goto out;
468
469 if (reason == CLOCK_EVT_NOTIFY_BROADCAST_ENTER) {
470 if (!cpu_isset(cpu, tick_broadcast_oneshot_mask)) {
471 cpu_set(cpu, tick_broadcast_oneshot_mask);
472 clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
473 if (dev->next_event.tv64 < bc->next_event.tv64)
474 tick_broadcast_set_event(dev->next_event, 1);
475 }
476 } else {
477 if (cpu_isset(cpu, tick_broadcast_oneshot_mask)) {
478 cpu_clear(cpu, tick_broadcast_oneshot_mask);
479 clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
480 if (dev->next_event.tv64 != KTIME_MAX)
481 tick_program_event(dev->next_event, 1);
482 }
483 }
484
485out:
486 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
487}
488
Thomas Gleixner5590a532007-07-21 04:37:35 -0700489/*
490 * Reset the one shot broadcast for a cpu
491 *
492 * Called with tick_broadcast_lock held
493 */
494static void tick_broadcast_clear_oneshot(int cpu)
495{
496 cpu_clear(cpu, tick_broadcast_oneshot_mask);
497}
498
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800499/**
Li Zefan8dce39c2007-11-05 14:51:10 -0800500 * tick_broadcast_setup_oneshot - setup the broadcast device
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800501 */
502void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
503{
Venki Pallipadi4a932322007-10-12 23:04:23 +0200504 bc->event_handler = tick_handle_oneshot_broadcast;
505 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
506 bc->next_event.tv64 = KTIME_MAX;
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800507}
508
509/*
510 * Select oneshot operating mode for the broadcast device
511 */
512void tick_broadcast_switch_to_oneshot(void)
513{
514 struct clock_event_device *bc;
515 unsigned long flags;
516
517 spin_lock_irqsave(&tick_broadcast_lock, flags);
518
519 tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT;
520 bc = tick_broadcast_device.evtdev;
521 if (bc)
522 tick_broadcast_setup_oneshot(bc);
523 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
524}
525
526
527/*
528 * Remove a dead CPU from broadcasting
529 */
530void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
531{
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800532 unsigned long flags;
533 unsigned int cpu = *cpup;
534
535 spin_lock_irqsave(&tick_broadcast_lock, flags);
536
Thomas Gleixner31d9b392007-09-16 15:36:43 +0200537 /*
538 * Clear the broadcast mask flag for the dead cpu, but do not
539 * stop the broadcast device!
540 */
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800541 cpu_clear(cpu, tick_broadcast_oneshot_mask);
542
Thomas Gleixner79bf2bb2007-02-16 01:28:03 -0800543 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
544}
545
546#endif