Xen Test Framework
io-apic.c
Go to the documentation of this file.
1
7#include <xtf/lib.h>
8
9#include <xen/errno.h>
10
11#include <arch/io-apic.h>
12
13static unsigned int nr_entries;
14
15int ioapic_init(void)
16{
18
19 /* Bare MMIO? */
20 if ( id == ~0u )
21 return -ENODEV;
22
25
26 return 0;
27}
28
29int ioapic_set_mask(unsigned int entry, bool mask)
30{
31 uint32_t redir;
32
33 if ( entry >= nr_entries )
34 return -EINVAL;
35
36 redir = ioapic_read32(IOAPIC_REDIR_ENTRY(entry));
37 redir &= ~(1u << IOAPIC_REDIR_MASK_SHIFT);
38 if ( mask )
39 redir |= 1u << IOAPIC_REDIR_MASK_SHIFT;
41
42 return 0;
43}
44
45/*
46 * Local variables:
47 * mode: C
48 * c-file-style: "BSD"
49 * c-basic-offset: 4
50 * tab-width: 4
51 * indent-tabs-mode: nil
52 * End:
53 */
#define EINVAL
Definition: errno.h:33
#define ENODEV
Definition: errno.h:32
int ioapic_set_mask(unsigned int entry, bool mask)
Set the mask bit on a redirection entry.
Definition: io-apic.c:29
static unsigned int nr_entries
Definition: io-apic.c:13
int ioapic_init(void)
Discover and initialise the IO-APIC.
Definition: io-apic.c:15
x86 IO-APIC register definitions and utility functions.
#define IOAPIC_ID
Definition: io-apic.h:21
#define IOAPIC_REDIR_MASK_SHIFT
Definition: io-apic.h:27
static void ioapic_write32(unsigned int reg, uint32_t val)
Definition: io-apic.h:48
#define IOAPIC_VERSION
Definition: io-apic.h:23
#define IOAPIC_MAXREDIR_MASK
Definition: io-apic.h:24
static uint32_t ioapic_read32(unsigned int reg)
Definition: io-apic.h:36
#define IOAPIC_REDIR_ENTRY(e)
Definition: io-apic.h:26
#define MASK_EXTR(v, m)
Definition: numbers.h:40
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16