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