Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / board-js2x / slof / ioapic.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 \ ( ioapic-addr -- )
14 \ IO-APIC setup.
15
16 CONSTANT ioapic
17
18 : ioapic@  ( offset -- x )  ioapic rb! ioapic 10 + rl@-le ;
19 : ioapic!  ( x offset -- )  ioapic rb! ioapic 10 + rl!-le ;
20
21 : init-ioapic  ( irq# -- )
22    1a000 or 1 ioapic@ 10 rshift 1+ 0  ?DO
23       0 i 2* 11 + ioapic! dup
24       \ move all ISA IRQs to 40 and higher,
25       \ as to not conflict with U3/U4 internal
26       \ IRQs. ISA IRQs are positive edge.
27       dup ff and 0c <  IF  a000 - 40 +  THEN
28       i 2* 10 + ioapic! 1+  LOOP  drop
29 ;
30
31 : dump-ioapic  ( -- )
32    1 ioapic@ 10 rshift 1+
33    dup cr . ." irqs" 0  ?DO
34       cr i 2 0.r space i 2* 11 + ioapic@ 8 0.r
35       i 2* 10 + ioapic@ 8 0.r  LOOP
36 ;