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 <sys/util.h>
19 
20 #ifndef _ASMLANGUAGE
21 #include <device.h>
22 #include <random/rand32.h>
23 #endif
24 
25 /*
26  * UART
27  */
28 #define UART_NS16550_ACCESS_IOPORT 0x3f8
29 
30 
31 /* PCI definitions */
32 /* FIXME: The values below copied from generic ia32 soc, we need to get the
33  * correct numbers for Atom and the minnowboard
34  *
35  * This is added now to get basic enumartion of devices and verify that PCI
36  * driver is functional.
37  */
38 #define PCI_BUS_NUMBERS 1
39 
40 #define PCI_CTRL_ADDR_REG 0xCF8
41 #define PCI_CTRL_DATA_REG 0xCFC
42 
43 #define PCI_INTA 1
44 #define PCI_INTB 2
45 #define PCI_INTC 3
46 #define PCI_INTD 4
47 
48 /**
49  *
50  * @brief Convert PCI interrupt PIN to IRQ
51  *
52  * @return IRQ number, -1 if the result is incorrect
53  *
54  */
55 
pci_pin2irq(int bus,int dev,int pin)56 static inline int pci_pin2irq(int bus, int dev, int pin)
57 {
58 	ARG_UNUSED(bus);
59 
60 	if ((pin < PCI_INTA) || (pin > PCI_INTD)) {
61 		return -1;
62 	}
63 	return 10 + (((pin + dev - 1) >> 1) & 1);
64 }
65 
66 #endif /* __SOC_H_ */
67