aboutsummaryrefslogtreecommitdiff
path: root/arch/tile/include/asm/pci.h
blob: b0c15da2d5d58e91dedb4fd21978a7506683c65c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * Copyright 2010 Tilera Corporation. All Rights Reserved.
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation, version 2.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 *   NON INFRINGEMENT.  See the GNU General Public License for
 *   more details.
 */

#ifndef _ASM_TILE_PCI_H
#define _ASM_TILE_PCI_H

#include <asm/pci-bridge.h>

/*
 * The hypervisor maps the entirety of CPA-space as bus addresses, so
 * bus addresses are physical addresses.  The networking and block
 * device layers use this boolean for bounce buffer decisions.
 */
#define PCI_DMA_BUS_IS_PHYS     1

struct pci_controller *pci_bus_to_hose(int bus);
unsigned char __init common_swizzle(struct pci_dev *dev, unsigned char *pinp);
int __init tile_pci_init(void);
void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
void __devinit pcibios_fixup_bus(struct pci_bus *bus);

int __devinit _tile_cfg_read(struct pci_controller *hose,
				    int bus,
				    int slot,
				    int function,
				    int offset,
				    int size,
				    u32 *val);
int __devinit _tile_cfg_write(struct pci_controller *hose,
				     int bus,
				     int slot,
				     int function,
				     int offset,
				     int size,
				     u32 val);

/*
 * These are used to to config reads and writes in the early stages of
 * setup before the driver infrastructure has been set up enough to be
 * able to do config reads and writes.
 */
#define early_cfg_read(where, size, value) \
	_tile_cfg_read(controller, \
		       current_bus, \
		       pci_slot, \
		       pci_fn, \
		       where, \
		       size, \
		       value)

#define early_cfg_write(where, size, value) \
	_tile_cfg_write(controller, \
		       current_bus, \
		       pci_slot, \
		       pci_fn, \
		       where, \
		       size, \
		       value)



#define PCICFG_BYTE	1
#define PCICFG_WORD	2
#define PCICFG_DWORD	4

#define	TILE_NUM_PCIE	2

#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)

/*
 * This decides whether to display the domain number in /proc.
 */
static inline int pci_proc_domain(struct pci_bus *bus)
{
	return 1;
}

/*
 * I/O space is currently not supported.
 */

#define TILE_PCIE_LOWER_IO		0x0
#define TILE_PCIE_UPPER_IO		0x10000
#define TILE_PCIE_PCIE_IO_SIZE		0x0000FFFF

#define _PAGE_NO_CACHE		0
#define _PAGE_GUARDED		0


#define pcibios_assign_all_busses()    pci_assign_all_buses
extern int pci_assign_all_buses;

static inline void pcibios_set_master(struct pci_dev *dev)
{
	/* No special bus mastering setup handling */
}

#define PCIBIOS_MIN_MEM		0
#define PCIBIOS_MIN_IO		TILE_PCIE_LOWER_IO

/*
 * This flag tells if the platform is TILEmpower that needs
 * special configuration for the PLX switch chip.
 */
extern int blade_pci;

/* implement the pci_ DMA API in terms of the generic device dma_ one */
#include <asm-generic/pci-dma-compat.h>

/* generic pci stuff */
#include <asm-generic/pci.h>

/* Use any cpu for PCI. */
#define cpumask_of_pcibus(bus) cpu_online_mask

#endif /* _ASM_TILE_PCI_H */