1 /*
2  * Copyright (c) 2010-2015, Wind River Systems, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Board configuration macros for the ia32 platform
10  *
11  * This header file is used to specify and describe board-level aspects for
12  * the 'ia32' platform.
13  */
14 
15 #ifndef __SOC_H_
16 #define __SOC_H_
17 
18 #include <zephyr/sys/util.h>
19 
20 #ifndef _ASMLANGUAGE
21 #include <zephyr/device.h>
22 #include <zephyr/random/random.h>
23 #endif
24 
25 /* PCI definitions */
26 /* FIXME: The values below copied from generic ia32 soc, we need to get the
27  * correct numbers for Atom and the minnowboard
28  *
29  * This is added now to get basic enumeration of devices and verify that PCI
30  * driver is functional.
31  */
32 #define PCI_BUS_NUMBERS 1
33 
34 #define PCI_CTRL_ADDR_REG 0xCF8
35 #define PCI_CTRL_DATA_REG 0xCFC
36 
37 #define PCI_INTA 1
38 #define PCI_INTB 2
39 #define PCI_INTC 3
40 #define PCI_INTD 4
41 
42 /**
43  *
44  * @brief Convert PCI interrupt PIN to IRQ
45  *
46  * @return IRQ number, -1 if the result is incorrect
47  *
48  */
49 
pci_pin2irq(int bus,int dev,int pin)50 static inline int pci_pin2irq(int bus, int dev, int pin)
51 {
52 	ARG_UNUSED(bus);
53 
54 	if ((pin < PCI_INTA) || (pin > PCI_INTD)) {
55 		return -1;
56 	}
57 	return 10 + (((pin + dev - 1) >> 1) & 1);
58 }
59 
60 #endif /* __SOC_H_ */
61