blob: b05605d2538d6e214152f5d554d2f90f9690ecb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Registers map and definitions for mIA LM2 processor
*/
#ifndef __CROS_EC_IA32_INTERRUPTS_H
#define __CROS_EC_IA32_INTERRUPTS_H
#ifndef __ASSEMBLER__
#include <stdint.h>
#define USHRT_MAX 0xFFFF
typedef struct {
unsigned irq;
unsigned trigger;
unsigned polarity;
unsigned vector;
} irq_desc_t;
#define INTR_DESC(__irq,__vector,__trig) \
{ \
.irq = __irq, \
.trigger = __trig, \
.polarity = IOAPIC_REDTBL_INTPOL_HIGH, \
.vector = __vector \
}
#define LEVEL_INTR(__irq, __vector) \
INTR_DESC(__irq, __vector, IOAPIC_REDTBL_TRIGGER_LEVEL)
#define EDGE_INTR(__irq, __vector) \
INTR_DESC(__irq, __vector, IOAPIC_REDTBL_TRIGGER_EDGE)
#endif
/* ISH has a single core processor */
#define DEST_APIC_ID 0
#define NUM_VECTORS 256
/* APIC bit definitions. */
#define APIC_DIV_16 0x03
#define APIC_ENABLE_BIT (1UL << 8UL)
#define APIC_SPURIOUS_INT REG32(ISH_LAPIC_BASE + 0xF0UL )
#define APIC_LVT_ERROR REG32(ISH_LAPIC_BASE + 0x370UL)
#ifndef __ASSEMBLER__
typedef void (*isr_handler_t) (void);
void init_interrupts(void);
void mask_interrupt(unsigned int irq);
void unmask_interrupt(unsigned int irq);
/**
* disable current all enabled intrrupts
* return current irq mask bitmap
* power management typically use 'disable_all_interrupts' to disable current
* all interrupts and save current interrupts enabling settings before enter
* low power state, and use 'restore_interrupts' to restore the interrupts
* settings after exit low power state.
*/
uint64_t disable_all_interrupts(void);
void restore_interrupts(uint64_t irq_map);
/* Only call in interrupt context */
uint32_t get_current_interrupt_vector(void);
#endif
#endif /* __CROS_EC_IA32_INTERRUPTS_H */
|