1
2
3
4
5
6
7
8
9
10#ifndef __FTPCI100_H
11#define __FTPCI100_H
12
13
14struct ftpci100_ahbc {
15 unsigned int iosize;
16 unsigned int prot;
17 unsigned int rsved[8];
18 unsigned int conf;
19 unsigned int data;
20};
21
22
23
24
25#define FTPCI100_BASE_IO_SIZE(x) (ffs(x) - 1)
26
27
28
29
30#define PCI_INT_MASK 0x4c
31#define PCI_MEM_BASE_SIZE1 0x50
32#define PCI_MEM_BASE_SIZE2 0x54
33#define PCI_MEM_BASE_SIZE3 0x58
34
35
36
37
38#define PCI_INTA_ENABLE (1 << 22)
39#define PCI_INTB_ENABLE (1 << 23)
40#define PCI_INTC_ENABLE (1 << 24)
41#define PCI_INTD_ENABLE (1 << 25)
42
43
44
45
46#define FTPCI100_BASE_ADR_SIZE(x) ((ffs(x) - 1) << 16)
47
48#define FTPCI100_MAX_FUNCTIONS 20
49#define PCI_IRQ_LINES 4
50
51#define MAX_BUS_NUM 256
52#define MAX_DEV_NUM 32
53#define MAX_FUN_NUM 8
54
55#define PCI_MAX_BAR_PER_FUNC 6
56
57
58
59
60#define FTPCI100_MEM_SIZE(x) (ffs(x) << 24)
61
62
63#define FTPCI100_BRIDGE_VENDORID 0x159b
64#define FTPCI100_BRIDGE_DEVICEID 0x4321
65
66void pci_ftpci_init(void);
67
68struct pcibar {
69 unsigned int size;
70 unsigned int addr;
71};
72
73struct pci_config {
74 unsigned int bus;
75 unsigned int dev;
76 unsigned int func;
77 unsigned int pin;
78 unsigned short v_id;
79 unsigned short d_id;
80 struct pcibar bar[PCI_MAX_BAR_PER_FUNC + 1];
81};
82
83#endif
84