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 
13 static unsigned int nr_entries;
14 
15 int ioapic_init(void)
16 {
18 
19  /* Bare MMIO? */
20  if ( id == ~0u )
21  return -ENODEV;
22 
25 
26  return 0;
27 }
28 
29 int 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;
40  ioapic_write32(IOAPIC_REDIR_ENTRY(entry), redir);
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  */
static unsigned int nr_entries
Definition: io-apic.c:13
#define EINVAL
Definition: errno.h:33
static uint32_t ioapic_read32(unsigned int reg)
Definition: io-apic.h:36
#define MASK_EXTR(v, m)
Definition: numbers.h:40
int ioapic_set_mask(unsigned int entry, bool mask)
Set the mask bit on a redirection entry.
Definition: io-apic.c:29
x86 IO-APIC register definitions and utility functions.
static void ioapic_write32(unsigned int reg, uint32_t val)
Definition: io-apic.h:48
#define IOAPIC_REDIR_MASK_SHIFT
Definition: io-apic.h:27
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16
#define IOAPIC_REDIR_ENTRY(e)
Definition: io-apic.h:26
#define ENODEV
Definition: errno.h:32
#define IOAPIC_ID
Definition: io-apic.h:21
#define IOAPIC_MAXREDIR_MASK
Definition: io-apic.h:24
#define IOAPIC_VERSION
Definition: io-apic.h:23
int ioapic_init(void)
Discover and initialise the IO-APIC.
Definition: io-apic.c:15