Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / slof / fs / quiesce.fs
1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
8 \ *
9 \ * Contributors:
10 \ *     IBM Corporation - initial implementation
11 \ ****************************************************************************/
12
13
14 100 CONSTANT quiesce-xt#
15
16 \ The array with the quiesce execution tokens:
17 CREATE quiesce-xts quiesce-xt# cells allot
18 quiesce-xts quiesce-xt# cells erase
19
20 0 VALUE quiesce-done?
21
22
23 \ Add a token to the quiesce execution token array:
24 : add-quiesce-xt  ( xt -- )
25    quiesce-xt# 0 DO
26       quiesce-xts I cells +    ( xt arrayptr )
27       dup @ 0=                 ( xt arrayptr true|false )
28       IF
29          ! UNLOOP EXIT
30       ELSE                     ( xt arrayptr )
31          over swap             ( xt xt arrayptr )
32          @ =                   \ xt already stored ?
33          IF
34             drop UNLOOP EXIT
35          THEN                  ( xt )
36       THEN
37    LOOP
38    drop                        ( xt -- )
39    ." Warning: quiesce xt list is full." cr
40 ;
41
42
43 \ The quiesce call asserts that the firmware and all hardware
44 \ is in a sane state (e.g. assert that no background DMA is
45 \ running anymore)
46 : quiesce  ( -- )
47    quiesce-done? IF EXIT THEN
48    true to quiesce-done?
49    quiesce-xt# 0 DO
50       quiesce-xts I cells +    ( arrayptr )
51       @ dup IF                 ( xt )
52          EXECUTE
53       ELSE
54          drop UNLOOP EXIT
55       THEN
56    LOOP
57 ;
58