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 /* PCI definitions */
31 #define PCI_BUS_NUMBERS 1
32 
33 #define PCI_CTRL_ADDR_REG 0xCF8
34 #define PCI_CTRL_DATA_REG 0xCFC
35 
36 #define PCI_INTA 1
37 #define PCI_INTB 2
38 #define PCI_INTC 3
39 #define PCI_INTD 4
40 
41 /**
42  *
43  * @brief Convert PCI interrupt PIN to IRQ
44  *
45  * This file is only used by QEMU, which emulates the i440fx chipset.
46  * INTx are mapped to IRQs 10 and 11 after being swizzled.
47  *
48  * @return IRQ number, -1 if the result is incorrect
49  *
50  */
51 
pci_pin2irq(int bus,int dev,int pin)52 static inline int pci_pin2irq(int bus, int dev, int pin)
53 {
54 	ARG_UNUSED(bus);
55 
56 	if ((pin < PCI_INTA) || (pin > PCI_INTD)) {
57 		return -1;
58 	}
59 
60 	return 10 + (((pin + dev - 1) >> 1) & 1);
61 }
62 
63 #endif /* __SOC_H_ */
64