summaryrefslogtreecommitdiffstats
path: root/include/asm-mn10300/pci.h
blob: 205192c52bb5708507a58939f870136e2a1d7c0b (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
129
130
131
132
133
/* MN10300 PCI definitions
 *
 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public Licence
 * as published by the Free Software Foundation; either version
 * 2 of the Licence, or (at your option) any later version.
 */
#ifndef _ASM_PCI_H
#define _ASM_PCI_H

#ifdef __KERNEL__
#include <linux/mm.h>		/* for struct page */

#if 0
#define __pcbdebug(FMT, ADDR, ...) \
	printk(KERN_DEBUG "PCIBRIDGE[%08x]: "FMT"\n", \
	       (u32)(ADDR), ##__VA_ARGS__)

#define __pcidebug(FMT, BUS, DEVFN, WHERE,...)		\
do {							\
	printk(KERN_DEBUG "PCI[%02x:%02x.%x + %02x]: "FMT"\n",	\
	       (BUS)->number,					\
	       PCI_SLOT(DEVFN),					\
	       PCI_FUNC(DEVFN),					\
	       (u32)(WHERE), ##__VA_ARGS__);			\
} while (0)

#else
#define __pcbdebug(FMT, ADDR, ...)		do {} while (0)
#define __pcidebug(FMT, BUS, DEVFN, WHERE, ...)	do {} while (0)
#endif

/* Can be used to override the logic in pci_scan_bus for skipping
 * already-configured bus numbers - to be used for buggy BIOSes or
 * architectures with incomplete PCI setup by the loader */

#ifdef CONFIG_PCI
#define pcibios_assign_all_busses()	1
extern void unit_pci_init(void);
#else
#define pcibios_assign_all_busses()	0
#endif

extern unsigned long pci_mem_start;
#define PCIBIOS_MIN_IO		0xBE000004
#define PCIBIOS_MIN_MEM		0xB8000000

void pcibios_set_master(struct pci_dev *dev);
void pcibios_penalize_isa_irq(int irq);

/* Dynamic DMA mapping stuff.
 * i386 has everything mapped statically.
 */

#include <linux/types.h>
#include <linux/slab.h>
#include <asm/scatterlist.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <asm/io.h>

struct pci_dev;

/* The PCI address space does equal the physical memory
 * address space.  The networking and block device layers use
 * this boolean for bounce buffer decisions.
 */
#define PCI_DMA_BUS_IS_PHYS	(1)


/* This is always fine. */
#define pci_dac_dma_supported(pci_dev, mask)	(0)

/*
 * These macros should be used after a pci_map_sg call has been done
 * to get bus addresses of each of the SG entries and their lengths.
 * You should only work with the number of sg entries pci_map_sg
 * returns.
 */
#define sg_dma_address(sg)	((sg)->dma_address)
#define sg_dma_len(sg)		((sg)->length)

/* Return the index of the PCI controller for device. */
static inline int pci_controller_num(struct pci_dev *dev)
{
	return 0;
}

#define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
			       enum pci_mmap_state mmap_state,
			       int write_combine);

#endif /* __KERNEL__ */

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

/**
 * pcibios_resource_to_bus - convert resource to PCI bus address
 * @dev: device which owns this resource
 * @region: converted bus-centric region (start,end)
 * @res: resource to convert
 *
 * Convert a resource to a PCI device bus address or bus window.
 */
extern void pcibios_resource_to_bus(struct pci_dev *dev,
				    struct pci_bus_region *region,
				    struct resource *res);

extern void pcibios_bus_to_resource(struct pci_dev *dev,
				    struct resource *res,
				    struct pci_bus_region *region);

static inline struct resource *
pcibios_select_root(struct pci_dev *pdev, struct resource *res)
{
	struct resource *root = NULL;

	if (res->flags & IORESOURCE_IO)
		root = &ioport_resource;
	if (res->flags & IORESOURCE_MEM)
		root = &iomem_resource;

	return root;
}

#define pcibios_scan_all_fns(a, b)	0

#endif /* _ASM_PCI_H */