~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to hw/heathrow_pic.c

  • Committer: ths
  • Date: 2007-06-17 15:32:30 UTC
  • Revision ID: git-v1:ffb04fcf089865952592f1f8855c2848d4514a89
Allow relative paths for the interpreter prefix in linux-user emulation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2984 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Heathrow PIC support (OldWorld PowerMac)
3
 
 *
4
 
 * Copyright (c) 2005-2007 Fabrice Bellard
5
 
 * Copyright (c) 2007 Jocelyn Mayer
6
 
 *
 
2
 * Heathrow PIC support (standard PowerMac PIC)
 
3
 * 
 
4
 * Copyright (c) 2005 Fabrice Bellard
 
5
 * 
7
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8
7
 * of this software and associated documentation files (the "Software"), to deal
9
8
 * in the Software without restriction, including without limitation the rights
22
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
22
 * THE SOFTWARE.
24
23
 */
25
 
#include "hw.h"
26
 
#include "ppc_mac.h"
 
24
#include "vl.h"
27
25
 
28
26
//#define DEBUG
29
27
 
36
34
 
37
35
typedef struct HeathrowPICS {
38
36
    HeathrowPIC pics[2];
39
 
    qemu_irq *irqs;
40
37
} HeathrowPICS;
41
38
 
42
39
static inline int check_irq(HeathrowPIC *pic)
48
45
static void heathrow_pic_update(HeathrowPICS *s)
49
46
{
50
47
    if (check_irq(&s->pics[0]) || check_irq(&s->pics[1])) {
51
 
        qemu_irq_raise(s->irqs[0]);
 
48
        cpu_interrupt(first_cpu, CPU_INTERRUPT_HARD);
52
49
    } else {
53
 
        qemu_irq_lower(s->irqs[0]);
 
50
        cpu_reset_interrupt(first_cpu, CPU_INTERRUPT_HARD);
54
51
    }
55
52
}
56
53
 
60
57
    HeathrowPIC *pic;
61
58
    unsigned int n;
62
59
 
63
 
#ifdef TARGET_WORDS_BIGENDIAN
64
60
    value = bswap32(value);
 
61
#ifdef DEBUG
 
62
    printf("pic_writel: %08x: %08x\n",
 
63
           addr, value);
65
64
#endif
66
65
    n = ((addr & 0xfff) - 0x10) >> 4;
67
 
#ifdef DEBUG
68
 
    printf("pic_writel: " PADDRX " %u: %08x\n", addr, n, value);
69
 
#endif
70
66
    if (n >= 2)
71
67
        return;
72
68
    pic = &s->pics[n];
92
88
    HeathrowPIC *pic;
93
89
    unsigned int n;
94
90
    uint32_t value;
95
 
 
 
91
    
96
92
    n = ((addr & 0xfff) - 0x10) >> 4;
97
93
    if (n >= 2) {
98
94
        value = 0;
114
110
        }
115
111
    }
116
112
#ifdef DEBUG
117
 
    printf("pic_readl: " PADDRX " %u: %08x\n", addr, n, value);
 
113
    printf("pic_readl: %08x: %08x\n",
 
114
           addr, value);
118
115
#endif
119
 
#ifdef TARGET_WORDS_BIGENDIAN
120
116
    value = bswap32(value);
121
 
#endif
122
117
    return value;
123
118
}
124
119
 
161
156
    heathrow_pic_update(s);
162
157
}
163
158
 
164
 
qemu_irq *heathrow_pic_init(int *pmem_index,
165
 
                            int nb_cpus, qemu_irq **irqs)
 
159
qemu_irq *heathrow_pic_init(int *pmem_index)
166
160
{
167
161
    HeathrowPICS *s;
168
 
 
 
162
    
169
163
    s = qemu_mallocz(sizeof(HeathrowPICS));
170
164
    s->pics[0].level_triggered = 0;
171
165
    s->pics[1].level_triggered = 0x1ff00000;
172
 
    /* only 1 CPU */
173
 
    s->irqs = irqs[0];
174
166
    *pmem_index = cpu_register_io_memory(0, pic_read, pic_write, s);
175
 
 
176
167
    return qemu_allocate_irqs(heathrow_pic_set_irq, s, 64);
177
168
}