forked from luck/tmp_suning_uos_patched
3d5134ee83
This rewrites pretty much from scratch the handling of MMIO and PIO space allocations on powerpc64. The main goals are: - Get rid of imalloc and use more common code where possible - Simplify the current mess so that PIO space is allocated and mapped in a single place for PCI bridges - Handle allocation constraints of PIO for all bridges including hot plugged ones within the 2GB space reserved for IO ports, so that devices on hotplugged busses will now work with drivers that assume IO ports fit in an int. - Cleanup and separate tracking of the ISA space in the reserved low 64K of IO space. No ISA -> Nothing mapped there. I booted a cell blade with IDE on PIO and MMIO and a dual G5 so far, that's it :-) With this patch, all allocations are done using the code in mm/vmalloc.c, though we use the low level __get_vm_area with explicit start/stop constraints in order to manage separate areas for vmalloc/vmap, ioremap, and PCI IOs. This greatly simplifies a lot of things, as you can see in the diffstat of that patch :-) A new pair of functions pcibios_map/unmap_io_space() now replace all of the previous code that used to manipulate PCI IOs space. The allocation is done at mapping time, which is now called from scan_phb's, just before the devices are probed (instead of after, which is by itself a bug fix). The only other caller is the PCI hotplug code for hot adding PCI-PCI bridges (slots). imalloc is gone, as is the "sub-allocation" thing, but I do beleive that hotplug should still work in the sense that the space allocation is always done by the PHB, but if you unmap a child bus of this PHB (which seems to be possible), then the code should properly tear down all the HPTE mappings for that area of the PHB allocated IO space. I now always reserve the first 64K of IO space for the bridge with the ISA bus on it. I have moved the code for tracking ISA in a separate file which should also make it smarter if we ever are capable of hot unplugging or re-plugging an ISA bridge. This should have a side effect on platforms like powermac where VGA IOs will no longer work. This is done on purpose though as they would have worked semi-randomly before. The idea at this point is to isolate drivers that might need to access those and fix them by providing a proper function to obtain an offset to the legacy IOs of a given bus. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
94 lines
2.8 KiB
C
94 lines
2.8 KiB
C
/*
|
|
* Declarations of procedures and variables shared between files
|
|
* in arch/ppc/mm/.
|
|
*
|
|
* Derived from arch/ppc/mm/init.c:
|
|
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
|
|
*
|
|
* Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
|
|
* and Cort Dougan (PReP) (cort@cs.nmt.edu)
|
|
* Copyright (C) 1996 Paul Mackerras
|
|
* Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
|
|
*
|
|
* Derived from "arch/i386/mm/init.c"
|
|
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
|
|
*
|
|
* 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; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*
|
|
*/
|
|
#include <linux/mm.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/mmu.h>
|
|
|
|
extern void hash_preload(struct mm_struct *mm, unsigned long ea,
|
|
unsigned long access, unsigned long trap);
|
|
|
|
|
|
#ifdef CONFIG_PPC32
|
|
extern void mapin_ram(void);
|
|
extern int map_page(unsigned long va, phys_addr_t pa, int flags);
|
|
extern void setbat(int index, unsigned long virt, unsigned long phys,
|
|
unsigned int size, int flags);
|
|
extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
|
|
unsigned int size, int flags, unsigned int pid);
|
|
extern void invalidate_tlbcam_entry(int index);
|
|
|
|
extern int __map_without_bats;
|
|
extern unsigned long ioremap_base;
|
|
extern unsigned int rtas_data, rtas_size;
|
|
|
|
struct _PTE;
|
|
extern struct _PTE *Hash, *Hash_end;
|
|
extern unsigned long Hash_size, Hash_mask;
|
|
|
|
extern unsigned int num_tlbcam_entries;
|
|
#endif
|
|
|
|
extern unsigned long ioremap_bot;
|
|
extern unsigned long __max_low_memory;
|
|
extern unsigned long __initial_memory_limit;
|
|
extern unsigned long total_memory;
|
|
extern unsigned long total_lowmem;
|
|
|
|
/* ...and now those things that may be slightly different between processor
|
|
* architectures. -- Dan
|
|
*/
|
|
#if defined(CONFIG_8xx)
|
|
#define flush_HPTE(X, va, pg) _tlbie(va)
|
|
#define MMU_init_hw() do { } while(0)
|
|
#define mmu_mapin_ram() (0UL)
|
|
|
|
#elif defined(CONFIG_4xx)
|
|
#define flush_HPTE(X, va, pg) _tlbie(va)
|
|
extern void MMU_init_hw(void);
|
|
extern unsigned long mmu_mapin_ram(void);
|
|
|
|
#elif defined(CONFIG_FSL_BOOKE)
|
|
#define flush_HPTE(X, va, pg) _tlbie(va)
|
|
extern void MMU_init_hw(void);
|
|
extern unsigned long mmu_mapin_ram(void);
|
|
extern void adjust_total_lowmem(void);
|
|
|
|
#elif defined(CONFIG_PPC32)
|
|
/* anything 32-bit except 4xx or 8xx */
|
|
extern void MMU_init_hw(void);
|
|
extern unsigned long mmu_mapin_ram(void);
|
|
|
|
/* Be careful....this needs to be updated if we ever encounter 603 SMPs,
|
|
* which includes all new 82xx processors. We need tlbie/tlbsync here
|
|
* in that case (I think). -- Dan.
|
|
*/
|
|
static inline void flush_HPTE(unsigned context, unsigned long va,
|
|
unsigned long pdval)
|
|
{
|
|
if ((Hash != 0) &&
|
|
cpu_has_feature(CPU_FTR_HPTE_TABLE))
|
|
flush_hash_pages(0, va, pdval, 1);
|
|
else
|
|
_tlbie(va);
|
|
}
|
|
#endif
|