io.h (f01387d2693813eb5271a3448e6a082322c7d75d) io.h (15d45cce3a0e0716fa49c768f887c6406dfb91f7)
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000, 06 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.

--- 153 unchanged lines hidden (view full) ---

162#define virt_to_bus virt_to_phys
163#define bus_to_virt phys_to_virt
164
165/*
166 * Change "struct page" to physical address.
167 */
168#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
169
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000, 06 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.

--- 153 unchanged lines hidden (view full) ---

162#define virt_to_bus virt_to_phys
163#define bus_to_virt phys_to_virt
164
165/*
166 * Change "struct page" to physical address.
167 */
168#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
169
170extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
170extern void __iomem * __ioremap(phys_addr_t offset, phys_addr_t size, unsigned long flags);
171extern void __iounmap(const volatile void __iomem *addr);
172
173#ifndef CONFIG_PCI
174struct pci_dev;
175static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
176#endif
177
171extern void __iounmap(const volatile void __iomem *addr);
172
173#ifndef CONFIG_PCI
174struct pci_dev;
175static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
176#endif
177
178static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
178static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long size,
179 unsigned long flags)
180{
181 void __iomem *addr = plat_ioremap(offset, size, flags);
182
183 if (addr)
184 return addr;
185
179 unsigned long flags)
180{
181 void __iomem *addr = plat_ioremap(offset, size, flags);
182
183 if (addr)
184 return addr;
185
186#define __IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
186#define __IS_LOW512(addr) (!((phys_addr_t)(addr) & (phys_addr_t) ~0x1fffffffULL))
187
188 if (cpu_has_64bit_addresses) {
189 u64 base = UNCAC_BASE;
190
191 /*
192 * R10000 supports a 2 bit uncached attribute therefore
193 * UNCAC_BASE may not equal IO_BASE.
194 */
195 if (flags == _CACHE_UNCACHED)
196 base = (u64) IO_BASE;
197 return (void __iomem *) (unsigned long) (base + offset);
198 } else if (__builtin_constant_p(offset) &&
199 __builtin_constant_p(size) && __builtin_constant_p(flags)) {
187
188 if (cpu_has_64bit_addresses) {
189 u64 base = UNCAC_BASE;
190
191 /*
192 * R10000 supports a 2 bit uncached attribute therefore
193 * UNCAC_BASE may not equal IO_BASE.
194 */
195 if (flags == _CACHE_UNCACHED)
196 base = (u64) IO_BASE;
197 return (void __iomem *) (unsigned long) (base + offset);
198 } else if (__builtin_constant_p(offset) &&
199 __builtin_constant_p(size) && __builtin_constant_p(flags)) {
200 phys_t phys_addr, last_addr;
200 phys_addr_t phys_addr, last_addr;
201
202 phys_addr = fixup_bigphys_addr(offset, size);
203
204 /* Don't allow wraparound or zero size. */
205 last_addr = phys_addr + size - 1;
206 if (!size || last_addr < phys_addr)
207 return NULL;
208

--- 425 unchanged lines hidden ---
201
202 phys_addr = fixup_bigphys_addr(offset, size);
203
204 /* Don't allow wraparound or zero size. */
205 last_addr = phys_addr + size - 1;
206 if (!size || last_addr < phys_addr)
207 return NULL;
208

--- 425 unchanged lines hidden ---