Commit 6ac5310e authored by Ralf Baechle's avatar Ralf Baechle

Merge branch '3.10-fixes' into mips-for-linux-next

This that should have been fixed but weren't, way to much, intrusive
and late.
parents 704e6460 3f90b82d
...@@ -420,7 +420,6 @@ config POWERTV ...@@ -420,7 +420,6 @@ config POWERTV
select CSRC_POWERTV select CSRC_POWERTV
select DMA_NONCOHERENT select DMA_NONCOHERENT
select HW_HAS_PCI select HW_HAS_PCI
select SYS_HAS_EARLY_PRINTK
select SYS_HAS_CPU_MIPS32_R2 select SYS_HAS_CPU_MIPS32_R2
select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_BIG_ENDIAN
......
...@@ -132,7 +132,7 @@ static void __init ap136_pci_init(u8 *eeprom) ...@@ -132,7 +132,7 @@ static void __init ap136_pci_init(u8 *eeprom)
ath79_register_pci(); ath79_register_pci();
} }
#else #else
static inline void ap136_pci_init(void) {} static inline void ap136_pci_init(u8 *eeprom) {}
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
static void __init ap136_setup(void) static void __init ap136_setup(void)
......
...@@ -12,14 +12,9 @@ config BCM63XX_CPU_6328 ...@@ -12,14 +12,9 @@ config BCM63XX_CPU_6328
config BCM63XX_CPU_6338 config BCM63XX_CPU_6338
bool "support 6338 CPU" bool "support 6338 CPU"
select HW_HAS_PCI select HW_HAS_PCI
select USB_ARCH_HAS_OHCI
select USB_OHCI_BIG_ENDIAN_DESC
select USB_OHCI_BIG_ENDIAN_MMIO
config BCM63XX_CPU_6345 config BCM63XX_CPU_6345
bool "support 6345 CPU" bool "support 6345 CPU"
select USB_OHCI_BIG_ENDIAN_DESC
select USB_OHCI_BIG_ENDIAN_MMIO
config BCM63XX_CPU_6348 config BCM63XX_CPU_6348
bool "support 6348 CPU" bool "support 6348 CPU"
......
...@@ -13,10 +13,11 @@ CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt ...@@ -13,10 +13,11 @@ CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt
CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt
obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o
obj-y += dma-octeon.o flash_setup.o obj-y += dma-octeon.o
obj-y += octeon-memcpy.o obj-y += octeon-memcpy.o
obj-y += executive/ obj-y += executive/
obj-$(CONFIG_MTD) += flash_setup.o
obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Copyright (C) 2008, 2009 Wind River Systems * Copyright (C) 2008, 2009 Wind River Systems
* written by Ralf Baechle <ralf@linux-mips.org> * written by Ralf Baechle <ralf@linux-mips.org>
*/ */
#include <linux/compiler.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/console.h> #include <linux/console.h>
...@@ -694,7 +695,7 @@ void __init prom_init(void) ...@@ -694,7 +695,7 @@ void __init prom_init(void)
if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) { if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) {
pr_info("Skipping L2 locking due to reduced L2 cache size\n"); pr_info("Skipping L2 locking due to reduced L2 cache size\n");
} else { } else {
uint32_t ebase = read_c0_ebase() & 0x3ffff000; uint32_t __maybe_unused ebase = read_c0_ebase() & 0x3ffff000;
#ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB
/* TLB refill */ /* TLB refill */
cvmx_l2c_lock_mem_region(ebase, 0x100); cvmx_l2c_lock_mem_region(ebase, 0x100);
...@@ -978,7 +979,7 @@ void __init plat_mem_setup(void) ...@@ -978,7 +979,7 @@ void __init plat_mem_setup(void)
cvmx_bootmem_unlock(); cvmx_bootmem_unlock();
/* Add the memory region for the kernel. */ /* Add the memory region for the kernel. */
kernel_start = (unsigned long) _text; kernel_start = (unsigned long) _text;
kernel_size = ALIGN(_end - _text, 0x100000); kernel_size = _end - _text;
/* Adjust for physical offset. */ /* Adjust for physical offset. */
kernel_start &= ~0xffffffff80000000ULL; kernel_start &= ~0xffffffff80000000ULL;
......
...@@ -406,12 +406,12 @@ int cfe_setenv(char *name, char *val) ...@@ -406,12 +406,12 @@ int cfe_setenv(char *name, char *val)
return xiocb.xiocb_status; return xiocb.xiocb_status;
} }
int cfe_write(int handle, unsigned char *buffer, int length) int cfe_write(int handle, const char *buffer, int length)
{ {
return cfe_writeblk(handle, 0, buffer, length); return cfe_writeblk(handle, 0, buffer, length);
} }
int cfe_writeblk(int handle, s64 offset, unsigned char *buffer, int length) int cfe_writeblk(int handle, s64 offset, const char *buffer, int length)
{ {
struct cfe_xiocb xiocb; struct cfe_xiocb xiocb;
......
...@@ -115,8 +115,8 @@ int cfe_read(int handle, unsigned char *buffer, int length); ...@@ -115,8 +115,8 @@ int cfe_read(int handle, unsigned char *buffer, int length);
int cfe_readblk(int handle, int64_t offset, unsigned char *buffer, int cfe_readblk(int handle, int64_t offset, unsigned char *buffer,
int length); int length);
int cfe_setenv(char *name, char *val); int cfe_setenv(char *name, char *val);
int cfe_write(int handle, unsigned char *buffer, int length); int cfe_write(int handle, const char *buffer, int length);
int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer, int cfe_writeblk(int handle, int64_t offset, const char *buffer,
int length); int length);
#endif /* CFE_API_H */ #endif /* CFE_API_H */
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#ifndef __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H #ifndef __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H
#define __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H #define __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H
#include <linux/bug.h>
struct device; struct device;
extern void octeon_pci_dma_init(void); extern void octeon_pci_dma_init(void);
...@@ -21,18 +23,21 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, ...@@ -21,18 +23,21 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
size_t size) size_t size)
{ {
BUG(); BUG();
return 0;
} }
static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
struct page *page) struct page *page)
{ {
BUG(); BUG();
return 0;
} }
static inline unsigned long plat_dma_addr_to_phys(struct device *dev, static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
dma_addr_t dma_addr) dma_addr_t dma_addr)
{ {
BUG(); BUG();
return 0;
} }
static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
...@@ -44,6 +49,7 @@ static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, ...@@ -44,6 +49,7 @@ static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
static inline int plat_dma_supported(struct device *dev, u64 mask) static inline int plat_dma_supported(struct device *dev, u64 mask)
{ {
BUG(); BUG();
return 0;
} }
static inline void plat_extra_sync_for_device(struct device *dev) static inline void plat_extra_sync_for_device(struct device *dev)
...@@ -60,6 +66,7 @@ static inline int plat_dma_mapping_error(struct device *dev, ...@@ -60,6 +66,7 @@ static inline int plat_dma_mapping_error(struct device *dev,
dma_addr_t dma_addr) dma_addr_t dma_addr)
{ {
BUG(); BUG();
return 0;
} }
dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
......
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2012 Cavium, Inc.
*/
#ifndef _ASM_MACH_CAVIUM_OCTEON_SPACES_H
#define _ASM_MACH_CAVIUM_OCTEON_SPACES_H
#include <linux/const.h>
#ifdef CONFIG_64BIT
/* They are all the same and some OCTEON II cores cannot handle 0xa8.. */
#define CAC_BASE _AC(0x8000000000000000, UL)
#define UNCAC_BASE _AC(0x8000000000000000, UL)
#define IO_BASE _AC(0x8000000000000000, UL)
#endif /* CONFIG_64BIT */
#include <asm/mach-generic/spaces.h>
#endif /* _ASM_MACH_CAVIUM_OCTEON_SPACES_H */
...@@ -23,6 +23,53 @@ ...@@ -23,6 +23,53 @@
dsrl \res, NSRI_NODEID_SHFT dsrl \res, NSRI_NODEID_SHFT
.endm .endm
/*
* TLB bits
*/
#define PAGE_GLOBAL (1 << 6)
#define PAGE_VALID (1 << 7)
#define PAGE_DIRTY (1 << 8)
#define CACHE_CACHABLE_COW (5 << 9)
/*
* inputs are the text nasid in t1, data nasid in t2.
*/
.macro MAPPED_KERNEL_SETUP_TLB
#ifdef CONFIG_MAPPED_KERNEL
/*
* This needs to read the nasid - assume 0 for now.
* Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
* 0+DVG in tlblo_1.
*/
dli t0, 0xffffffffc0000000
dmtc0 t0, CP0_ENTRYHI
li t0, 0x1c000 # Offset of text into node memory
dsll t1, NASID_SHFT # Shift text nasid into place
dsll t2, NASID_SHFT # Same for data nasid
or t1, t1, t0 # Physical load address of kernel text
or t2, t2, t0 # Physical load address of kernel data
dsrl t1, 12 # 4K pfn
dsrl t2, 12 # 4K pfn
dsll t1, 6 # Get pfn into place
dsll t2, 6 # Get pfn into place
li t0, ((PAGE_GLOBAL | PAGE_VALID | CACHE_CACHABLE_COW) >> 6)
or t0, t0, t1
mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr
li t0, ((PAGE_GLOBAL | PAGE_VALID | PAGE_DIRTY | CACHE_CACHABLE_COW) >> 6)
or t0, t0, t2
mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr
li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
mtc0 t0, CP0_PAGEMASK
li t0, 0 # KMAP_INX
mtc0 t0, CP0_INDEX
li t0, 1
mtc0 t0, CP0_WIRED
tlbwi
#else
mtc0 zero, CP0_WIRED
#endif
.endm
/* /*
* Intentionally empty macro, used in head.S. Override in * Intentionally empty macro, used in head.S. Override in
* arch/mips/mach-xxx/kernel-entry-init.h when necessary. * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
......
...@@ -23,12 +23,6 @@ ...@@ -23,12 +23,6 @@
#define ASCII_DISPLAY_WORD_BASE 0x1f000410 #define ASCII_DISPLAY_WORD_BASE 0x1f000410
#define ASCII_DISPLAY_POS_BASE 0x1f000418 #define ASCII_DISPLAY_POS_BASE 0x1f000418
/*
* Reset register.
*/
#define SOFTRES_REG 0x1f000500
#define GORESET 0x42
/* /*
* Revision register. * Revision register.
*/ */
......
...@@ -113,7 +113,7 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long cpu) ...@@ -113,7 +113,7 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
if (! ((asid += ASID_INC) & ASID_MASK) ) { if (! ((asid += ASID_INC) & ASID_MASK) ) {
if (cpu_has_vtag_icache) if (cpu_has_vtag_icache)
flush_icache_all(); flush_icache_all();
#ifdef CONFIG_VIRTUALIZATION #ifdef CONFIG_KVM
kvm_local_flush_tlb_all(); /* start new asid cycle */ kvm_local_flush_tlb_all(); /* start new asid cycle */
#else #else
local_flush_tlb_all(); /* start new asid cycle */ local_flush_tlb_all(); /* start new asid cycle */
......
...@@ -47,6 +47,15 @@ typedef struct xtalk_piomap_s *xtalk_piomap_t; ...@@ -47,6 +47,15 @@ typedef struct xtalk_piomap_s *xtalk_piomap_t;
#define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT)) #define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
#define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS)) #define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
#ifdef CONFIG_PCI
extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
#else
static inline int bridge_probe(nasid_t nasid, int widget, int masterwid)
{
return 0;
}
#endif
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* _ASM_XTALK_XTALK_H */ #endif /* _ASM_XTALK_XTALK_H */
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#ifndef _UAPI_ASM_FCNTL_H #ifndef _UAPI_ASM_FCNTL_H
#define _UAPI_ASM_FCNTL_H #define _UAPI_ASM_FCNTL_H
#include <asm/sgidefs.h>
#define O_APPEND 0x0008 #define O_APPEND 0x0008
#define O_DSYNC 0x0010 /* used to be O_SYNC, see below */ #define O_DSYNC 0x0010 /* used to be O_SYNC, see below */
...@@ -55,7 +56,8 @@ ...@@ -55,7 +56,8 @@
* contain all the same fields as struct flock. * contain all the same fields as struct flock.
*/ */
#ifdef CONFIG_32BIT #if _MIPS_SIM != _MIPS_SIM_ABI64
#include <linux/types.h> #include <linux/types.h>
struct flock { struct flock {
...@@ -70,7 +72,7 @@ struct flock { ...@@ -70,7 +72,7 @@ struct flock {
#define HAVE_ARCH_STRUCT_FLOCK #define HAVE_ARCH_STRUCT_FLOCK
#endif /* CONFIG_32BIT */ #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
#include <asm-generic/fcntl.h> #include <asm-generic/fcntl.h>
......
...@@ -409,10 +409,11 @@ enum mm_32f_73_minor_op { ...@@ -409,10 +409,11 @@ enum mm_32f_73_minor_op {
enum mm_16c_minor_op { enum mm_16c_minor_op {
mm_lwm16_op = 0x04, mm_lwm16_op = 0x04,
mm_swm16_op = 0x05, mm_swm16_op = 0x05,
mm_jr16_op = 0x18, mm_jr16_op = 0x0c,
mm_jrc_op = 0x1a, mm_jrc_op = 0x0d,
mm_jalr16_op = 0x1c, mm_jalr16_op = 0x0e,
mm_jalrs16_op = 0x1e, mm_jalrs16_op = 0x0f,
mm_jraddiusp_op = 0x18,
}; };
/* /*
......
...@@ -14,25 +14,25 @@ ...@@ -14,25 +14,25 @@
struct msqid64_ds { struct msqid64_ds {
struct ipc64_perm msg_perm; struct ipc64_perm msg_perm;
#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) #if !defined(__mips64) && defined(__MIPSEB__)
unsigned long __unused1; unsigned long __unused1;
#endif #endif
__kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_stime; /* last msgsnd time */
#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) #if !defined(__mips64) && defined(__MIPSEL__)
unsigned long __unused1; unsigned long __unused1;
#endif #endif
#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) #if !defined(__mips64) && defined(__MIPSEB__)
unsigned long __unused2; unsigned long __unused2;
#endif #endif
__kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_rtime; /* last msgrcv time */
#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) #if !defined(__mips64) && defined(__MIPSEL__)
unsigned long __unused2; unsigned long __unused2;
#endif #endif
#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) #if !defined(__mips64) && defined(__MIPSEB__)
unsigned long __unused3; unsigned long __unused3;
#endif #endif
__kernel_time_t msg_ctime; /* last change time */ __kernel_time_t msg_ctime; /* last change time */
#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) #if !defined(__mips64) && defined(__MIPSEL__)
unsigned long __unused3; unsigned long __unused3;
#endif #endif
unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_cbytes; /* current number of bytes on queue */
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* but we keep the old value on MIPS32, * but we keep the old value on MIPS32,
* for compatibility: * for compatibility:
*/ */
#ifdef CONFIG_32BIT #ifndef __mips64
# define RLIM_INFINITY 0x7fffffffUL # define RLIM_INFINITY 0x7fffffffUL
#endif #endif
......
...@@ -25,10 +25,10 @@ struct siginfo; ...@@ -25,10 +25,10 @@ struct siginfo;
/* /*
* Careful to keep union _sifields from shifting ... * Careful to keep union _sifields from shifting ...
*/ */
#ifdef CONFIG_32BIT #if __SIZEOF_LONG__ == 4
#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
#endif #endif
#ifdef CONFIG_64BIT #if __SIZEOF_LONG__ == 8
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
#endif #endif
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#define __SWAB_64_THRU_32__ #define __SWAB_64_THRU_32__
#ifdef CONFIG_CPU_MIPSR2 #if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
static inline __attribute_const__ __u16 __arch_swab16(__u16 x) static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
{ {
...@@ -39,10 +39,10 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x) ...@@ -39,10 +39,10 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
#define __arch_swab32 __arch_swab32 #define __arch_swab32 __arch_swab32
/* /*
* Having already checked for CONFIG_CPU_MIPSR2, enable the * Having already checked for MIPS R2, enable the optimized version for
* optimized version for 64-bit kernel on r2 CPUs. * 64-bit kernel on r2 CPUs.
*/ */
#ifdef CONFIG_64BIT #ifdef __mips64
static inline __attribute_const__ __u64 __arch_swab64(__u64 x) static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
{ {
__asm__( __asm__(
...@@ -54,6 +54,6 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 x) ...@@ -54,6 +54,6 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
return x; return x;
} }
#define __arch_swab64 __arch_swab64 #define __arch_swab64 __arch_swab64
#endif /* CONFIG_64BIT */ #endif /* __mips64 */
#endif /* CONFIG_CPU_MIPSR2 */ #endif /* MIPS R2 or newer */
#endif /* _ASM_SWAB_H */ #endif /* _ASM_SWAB_H */
...@@ -25,12 +25,16 @@ ...@@ -25,12 +25,16 @@
#define MCOUNT_OFFSET_INSNS 4 #define MCOUNT_OFFSET_INSNS 4
#endif #endif
#ifdef CONFIG_DYNAMIC_FTRACE
/* Arch override because MIPS doesn't need to run this from stop_machine() */ /* Arch override because MIPS doesn't need to run this from stop_machine() */
void arch_ftrace_update_code(int command) void arch_ftrace_update_code(int command)
{ {
ftrace_modify_all_code(command); ftrace_modify_all_code(command);
} }
#endif
/* /*
* Check if the address is in kernel space * Check if the address is in kernel space
* *
......
...@@ -27,45 +27,6 @@ ...@@ -27,45 +27,6 @@
#include <kernel-entry-init.h> #include <kernel-entry-init.h>
/*
* inputs are the text nasid in t1, data nasid in t2.
*/
.macro MAPPED_KERNEL_SETUP_TLB
#ifdef CONFIG_MAPPED_KERNEL
/*
* This needs to read the nasid - assume 0 for now.
* Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
* 0+DVG in tlblo_1.
*/
dli t0, 0xffffffffc0000000
dmtc0 t0, CP0_ENTRYHI
li t0, 0x1c000 # Offset of text into node memory
dsll t1, NASID_SHFT # Shift text nasid into place
dsll t2, NASID_SHFT # Same for data nasid
or t1, t1, t0 # Physical load address of kernel text
or t2, t2, t0 # Physical load address of kernel data
dsrl t1, 12 # 4K pfn
dsrl t2, 12 # 4K pfn
dsll t1, 6 # Get pfn into place
dsll t2, 6 # Get pfn into place
li t0, ((_PAGE_GLOBAL|_PAGE_VALID| _CACHE_CACHABLE_COW) >> 6)
or t0, t0, t1
mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr
li t0, ((_PAGE_GLOBAL|_PAGE_VALID| _PAGE_DIRTY|_CACHE_CACHABLE_COW) >> 6)
or t0, t0, t2
mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr
li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
mtc0 t0, CP0_PAGEMASK
li t0, 0 # KMAP_INX
mtc0 t0, CP0_INDEX
li t0, 1
mtc0 t0, CP0_WIRED
tlbwi
#else
mtc0 zero, CP0_WIRED
#endif
.endm
/* /*
* For the moment disable interrupts, mark the kernel mode and * For the moment disable interrupts, mark the kernel mode and
* set ST0_KX so that the CPU does not spit fire when using * set ST0_KX so that the CPU does not spit fire when using
......
...@@ -93,26 +93,27 @@ static void rm7k_wait_irqoff(void) ...@@ -93,26 +93,27 @@ static void rm7k_wait_irqoff(void)
} }
/* /*
* The Au1xxx wait is available only if using 32khz counter or * Au1 'wait' is only useful when the 32kHz counter is used as timer,
* external timer source, but specifically not CP0 Counter. * since coreclock (and the cp0 counter) stops upon executing it. Only an
* alchemy/common/time.c may override cpu_wait! * interrupt can wake it, so they must be enabled before entering idle modes.
*/ */
static void au1k_wait(void) static void au1k_wait(void)
{ {
unsigned long c0status = read_c0_status() | 1; /* irqs on */
__asm__( __asm__(
" .set mips3 \n" " .set mips3 \n"
" cache 0x14, 0(%0) \n" " cache 0x14, 0(%0) \n"
" cache 0x14, 32(%0) \n" " cache 0x14, 32(%0) \n"
" sync \n" " sync \n"
" nop \n" " mtc0 %1, $12 \n" /* wr c0status */
" wait \n" " wait \n"
" nop \n" " nop \n"
" nop \n" " nop \n"
" nop \n" " nop \n"
" nop \n" " nop \n"
" .set mips0 \n" " .set mips0 \n"
: : "r" (au1k_wait)); : : "r" (au1k_wait), "r" (c0status));
local_irq_enable();
} }
static int __initdata nowait; static int __initdata nowait;
......
...@@ -437,7 +437,6 @@ static ssize_t file_write(struct file *file, const char __user * buffer, ...@@ -437,7 +437,6 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
size_t count, loff_t * ppos) size_t count, loff_t * ppos)
{ {
int minor = iminor(file_inode(file)); int minor = iminor(file_inode(file));
struct rtlx_channel *rt = &rtlx->channel[minor];
/* any space left... */ /* any space left... */
if (!rtlx_write_poll(minor)) { if (!rtlx_write_poll(minor)) {
......
...@@ -1668,7 +1668,6 @@ void *set_vi_handler(int n, vi_handler_t addr) ...@@ -1668,7 +1668,6 @@ void *set_vi_handler(int n, vi_handler_t addr)
} }
extern void tlb_init(void); extern void tlb_init(void);
extern void flush_tlb_handlers(void);
/* /*
* Timer interrupt * Timer interrupt
...@@ -2006,7 +2005,6 @@ void __init trap_init(void) ...@@ -2006,7 +2005,6 @@ void __init trap_init(void)
set_handler(0x080, &except_vec3_generic, 0x80); set_handler(0x080, &except_vec3_generic, 0x80);
local_flush_icache_range(ebase, ebase + 0x400); local_flush_icache_range(ebase, ebase + 0x400);
flush_tlb_handlers();
sort_extable(__start___dbe_table, __stop___dbe_table); sort_extable(__start___dbe_table, __stop___dbe_table);
......
...@@ -111,6 +111,7 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c) ...@@ -111,6 +111,7 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
* disable the register. * disable the register.
*/ */
write_c0_watchlo0(7); write_c0_watchlo0(7);
back_to_back_c0_hazard();
t = read_c0_watchlo0(); t = read_c0_watchlo0();
write_c0_watchlo0(0); write_c0_watchlo0(0);
c->watch_reg_masks[0] = t & 7; c->watch_reg_masks[0] = t & 7;
...@@ -121,12 +122,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c) ...@@ -121,12 +122,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
c->watch_reg_use_cnt = 1; c->watch_reg_use_cnt = 1;
t = read_c0_watchhi0(); t = read_c0_watchhi0();
write_c0_watchhi0(t | 0xff8); write_c0_watchhi0(t | 0xff8);
back_to_back_c0_hazard();
t = read_c0_watchhi0(); t = read_c0_watchhi0();
c->watch_reg_masks[0] |= (t & 0xff8); c->watch_reg_masks[0] |= (t & 0xff8);
if ((t & 0x80000000) == 0) if ((t & 0x80000000) == 0)
return; return;
write_c0_watchlo1(7); write_c0_watchlo1(7);
back_to_back_c0_hazard();
t = read_c0_watchlo1(); t = read_c0_watchlo1();
write_c0_watchlo1(0); write_c0_watchlo1(0);
c->watch_reg_masks[1] = t & 7; c->watch_reg_masks[1] = t & 7;
...@@ -135,12 +138,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c) ...@@ -135,12 +138,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
c->watch_reg_use_cnt = 2; c->watch_reg_use_cnt = 2;
t = read_c0_watchhi1(); t = read_c0_watchhi1();
write_c0_watchhi1(t | 0xff8); write_c0_watchhi1(t | 0xff8);
back_to_back_c0_hazard();
t = read_c0_watchhi1(); t = read_c0_watchhi1();
c->watch_reg_masks[1] |= (t & 0xff8); c->watch_reg_masks[1] |= (t & 0xff8);
if ((t & 0x80000000) == 0) if ((t & 0x80000000) == 0)
return; return;
write_c0_watchlo2(7); write_c0_watchlo2(7);
back_to_back_c0_hazard();
t = read_c0_watchlo2(); t = read_c0_watchlo2();
write_c0_watchlo2(0); write_c0_watchlo2(0);
c->watch_reg_masks[2] = t & 7; c->watch_reg_masks[2] = t & 7;
...@@ -149,12 +154,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c) ...@@ -149,12 +154,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
c->watch_reg_use_cnt = 3; c->watch_reg_use_cnt = 3;
t = read_c0_watchhi2(); t = read_c0_watchhi2();
write_c0_watchhi2(t | 0xff8); write_c0_watchhi2(t | 0xff8);
back_to_back_c0_hazard();
t = read_c0_watchhi2(); t = read_c0_watchhi2();
c->watch_reg_masks[2] |= (t & 0xff8); c->watch_reg_masks[2] |= (t & 0xff8);
if ((t & 0x80000000) == 0) if ((t & 0x80000000) == 0)
return; return;
write_c0_watchlo3(7); write_c0_watchlo3(7);
back_to_back_c0_hazard();
t = read_c0_watchlo3(); t = read_c0_watchlo3();
write_c0_watchlo3(0); write_c0_watchlo3(0);
c->watch_reg_masks[3] = t & 7; c->watch_reg_masks[3] = t & 7;
...@@ -163,6 +170,7 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c) ...@@ -163,6 +170,7 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
c->watch_reg_use_cnt = 4; c->watch_reg_use_cnt = 4;
t = read_c0_watchhi3(); t = read_c0_watchhi3();
write_c0_watchhi3(t | 0xff8); write_c0_watchhi3(t | 0xff8);
back_to_back_c0_hazard();
t = read_c0_watchhi3(); t = read_c0_watchhi3();
c->watch_reg_masks[3] |= (t & 0xff8); c->watch_reg_masks[3] |= (t & 0xff8);
if ((t & 0x80000000) == 0) if ((t & 0x80000000) == 0)
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* option) any later version. * option) any later version.
*/ */
#include <linux/pci.h>
#include <cs5536/cs5536.h> #include <cs5536/cs5536.h>
#include <cs5536/cs5536_pci.h> #include <cs5536/cs5536_pci.h>
...@@ -314,3 +315,16 @@ u32 pci_isa_read_reg(int reg) ...@@ -314,3 +315,16 @@ u32 pci_isa_read_reg(int reg)
return conf_data; return conf_data;
} }
/*
* The mfgpt timer interrupt is running early, so we must keep the south bridge
* mmio always enabled. Otherwise we may race with the PCI configuration which
* may temporarily disable it. When that happens and the timer interrupt fires,
* we are not able to clear it and the system will hang.
*/
static void cs5536_isa_mmio_always_on(struct pci_dev *dev)
{
dev->mmio_always_on = 1;
}
DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA,
PCI_CLASS_BRIDGE_ISA, 8, cs5536_isa_mmio_always_on);
...@@ -182,11 +182,7 @@ asmlinkage void sb1_cache_error(void) ...@@ -182,11 +182,7 @@ asmlinkage void sb1_cache_error(void)
#ifdef CONFIG_SIBYTE_BW_TRACE #ifdef CONFIG_SIBYTE_BW_TRACE
/* Freeze the trace buffer now */ /* Freeze the trace buffer now */
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
csr_out32(M_BCM1480_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
#else
csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG)); csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
#endif
printk("Trace buffer frozen\n"); printk("Trace buffer frozen\n");
#endif #endif
......
...@@ -1948,6 +1948,19 @@ static void __cpuinit build_r4000_tlb_load_handler(void) ...@@ -1948,6 +1948,19 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
uasm_i_nop(&p); uasm_i_nop(&p);
uasm_i_tlbr(&p); uasm_i_tlbr(&p);
switch (current_cpu_type()) {
default:
if (cpu_has_mips_r2) {
uasm_i_ehb(&p);
case CPU_CAVIUM_OCTEON:
case CPU_CAVIUM_OCTEON_PLUS:
case CPU_CAVIUM_OCTEON2:
break;
}
}
/* Examine entrylo 0 or 1 based on ptr. */ /* Examine entrylo 0 or 1 based on ptr. */
if (use_bbit_insns()) { if (use_bbit_insns()) {
uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
...@@ -2002,6 +2015,19 @@ static void __cpuinit build_r4000_tlb_load_handler(void) ...@@ -2002,6 +2015,19 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
uasm_i_nop(&p); uasm_i_nop(&p);
uasm_i_tlbr(&p); uasm_i_tlbr(&p);
switch (current_cpu_type()) {
default:
if (cpu_has_mips_r2) {
uasm_i_ehb(&p);
case CPU_CAVIUM_OCTEON:
case CPU_CAVIUM_OCTEON_PLUS:
case CPU_CAVIUM_OCTEON2:
break;
}
}
/* Examine entrylo 0 or 1 based on ptr. */ /* Examine entrylo 0 or 1 based on ptr. */
if (use_bbit_insns()) { if (use_bbit_insns()) {
uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
...@@ -2170,6 +2196,20 @@ static void __cpuinit build_r4000_tlb_modify_handler(void) ...@@ -2170,6 +2196,20 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
dump_handler("r4000_tlb_modify", handle_tlbm, handle_tlbm_size); dump_handler("r4000_tlb_modify", handle_tlbm, handle_tlbm_size);
} }
static void __cpuinit flush_tlb_handlers(void)
{
local_flush_icache_range((unsigned long)handle_tlbl,
(unsigned long)handle_tlbl_end);
local_flush_icache_range((unsigned long)handle_tlbs,
(unsigned long)handle_tlbs_end);
local_flush_icache_range((unsigned long)handle_tlbm,
(unsigned long)handle_tlbm_end);
#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
local_flush_icache_range((unsigned long)tlbmiss_handler_setup_pgd,
(unsigned long)tlbmiss_handler_setup_pgd_end);
#endif
}
void __cpuinit build_tlb_refill_handler(void) void __cpuinit build_tlb_refill_handler(void)
{ {
/* /*
...@@ -2202,6 +2242,7 @@ void __cpuinit build_tlb_refill_handler(void) ...@@ -2202,6 +2242,7 @@ void __cpuinit build_tlb_refill_handler(void)
build_r3000_tlb_load_handler(); build_r3000_tlb_load_handler();
build_r3000_tlb_store_handler(); build_r3000_tlb_store_handler();
build_r3000_tlb_modify_handler(); build_r3000_tlb_modify_handler();
flush_tlb_handlers();
run_once++; run_once++;
} }
#else #else
...@@ -2229,23 +2270,10 @@ void __cpuinit build_tlb_refill_handler(void) ...@@ -2229,23 +2270,10 @@ void __cpuinit build_tlb_refill_handler(void)
build_r4000_tlb_modify_handler(); build_r4000_tlb_modify_handler();
if (!cpu_has_local_ebase) if (!cpu_has_local_ebase)
build_r4000_tlb_refill_handler(); build_r4000_tlb_refill_handler();
flush_tlb_handlers();
run_once++; run_once++;
} }
if (cpu_has_local_ebase) if (cpu_has_local_ebase)
build_r4000_tlb_refill_handler(); build_r4000_tlb_refill_handler();
} }
} }
void __cpuinit flush_tlb_handlers(void)
{
local_flush_icache_range((unsigned long)handle_tlbl,
(unsigned long)handle_tlbl_end);
local_flush_icache_range((unsigned long)handle_tlbs,
(unsigned long)handle_tlbs_end);
local_flush_icache_range((unsigned long)handle_tlbm,
(unsigned long)handle_tlbm_end);
#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
local_flush_icache_range((unsigned long)tlbmiss_handler_setup_pgd,
(unsigned long)tlbmiss_handler_setup_pgd_end);
#endif
}
/* /*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Carsten Langgaard, carstenl@mips.com * Carsten Langgaard, carstenl@mips.com
* Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
*
* ########################################################################
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* ########################################################################
*
* Reset the MIPS boards.
*
*/ */
#include <linux/init.h> #include <linux/io.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <asm/io.h>
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/mips-boards/generic.h>
#define SOFTRES_REG 0x1f000500
#define GORESET 0x42
static void mips_machine_restart(char *command) static void mips_machine_restart(char *command)
{ {
...@@ -45,7 +30,6 @@ static void mips_machine_halt(void) ...@@ -45,7 +30,6 @@ static void mips_machine_halt(void)
__raw_writel(GORESET, softres_reg); __raw_writel(GORESET, softres_reg);
} }
static int __init mips_reboot_setup(void) static int __init mips_reboot_setup(void)
{ {
_machine_restart = mips_machine_restart; _machine_restart = mips_machine_restart;
...@@ -54,5 +38,4 @@ static int __init mips_reboot_setup(void) ...@@ -54,5 +38,4 @@ static int __init mips_reboot_setup(void)
return 0; return 0;
} }
arch_initcall(mips_reboot_setup); arch_initcall(mips_reboot_setup);
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/mips-boards/generic.h>
#define SOFTRES_REG 0x1f000050
#define GORESET 0x4d
static void mips_machine_restart(char *command) static void mips_machine_restart(char *command)
{ {
...@@ -35,5 +37,4 @@ static int __init mips_reboot_setup(void) ...@@ -35,5 +37,4 @@ static int __init mips_reboot_setup(void)
return 0; return 0;
} }
arch_initcall(mips_reboot_setup); arch_initcall(mips_reboot_setup);
...@@ -217,6 +217,7 @@ static void pci_fixup_ioc3(struct pci_dev *d) ...@@ -217,6 +217,7 @@ static void pci_fixup_ioc3(struct pci_dev *d)
pci_disable_swapping(d); pci_disable_swapping(d);
} }
#ifdef CONFIG_NUMA
int pcibus_to_node(struct pci_bus *bus) int pcibus_to_node(struct pci_bus *bus)
{ {
struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
...@@ -224,6 +225,7 @@ int pcibus_to_node(struct pci_bus *bus) ...@@ -224,6 +225,7 @@ int pcibus_to_node(struct pci_bus *bus)
return bc->nasid; return bc->nasid;
} }
EXPORT_SYMBOL(pcibus_to_node); EXPORT_SYMBOL(pcibus_to_node);
#endif /* CONFIG_NUMA */
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3, DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
pci_fixup_ioc3); pci_fixup_ioc3);
...@@ -7,4 +7,5 @@ obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \ ...@@ -7,4 +7,5 @@ obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
ip27-xtalk.o ip27-xtalk.o
obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
obj-$(CONFIG_PCI) += ip27-irq-pci.o
obj-$(CONFIG_SMP) += ip27-smp.o obj-$(CONFIG_SMP) += ip27-smp.o
/*
* ip27-irq.c: Highlevel interrupt handling for IP27 architecture.
*
* Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
* Copyright (C) 1999 - 2001 Kanoj Sarcar
*/
#undef DEBUG
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/timex.h>
#include <linux/smp.h>
#include <linux/random.h>
#include <linux/kernel.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h>
#include <linux/bitops.h>
#include <asm/bootinfo.h>
#include <asm/io.h>
#include <asm/mipsregs.h>
#include <asm/processor.h>
#include <asm/pci/bridge.h>
#include <asm/sn/addrs.h>
#include <asm/sn/agent.h>
#include <asm/sn/arch.h>
#include <asm/sn/hub.h>
#include <asm/sn/intr.h>
/*
* Linux has a controller-independent x86 interrupt architecture.
* every controller has a 'controller-template', that is used
* by the main code to do the right thing. Each driver-visible
* interrupt source is transparently wired to the appropriate
* controller. Thus drivers need not be aware of the
* interrupt-controller.
*
* Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC,
* PIIX4's internal 8259 PIC and SGI's Visual Workstation Cobalt (IO-)APIC.
* (IO-APICs assumed to be messaging to Pentium local-APICs)
*
* the code is designed to be easily extended with new/different
* interrupt controllers, without having to do assembly magic.
*/
extern struct bridge_controller *irq_to_bridge[];
extern int irq_to_slot[];
/*
* use these macros to get the encoded nasid and widget id
* from the irq value
*/
#define IRQ_TO_BRIDGE(i) irq_to_bridge[(i)]
#define SLOT_FROM_PCI_IRQ(i) irq_to_slot[i]
static inline int alloc_level(int cpu, int irq)
{
struct hub_data *hub = hub_data(cpu_to_node(cpu));
struct slice_data *si = cpu_data[cpu].data;
int level;
level = find_first_zero_bit(hub->irq_alloc_mask, LEVELS_PER_SLICE);
if (level >= LEVELS_PER_SLICE)
panic("Cpu %d flooded with devices", cpu);
__set_bit(level, hub->irq_alloc_mask);
si->level_to_irq[level] = irq;
return level;
}
static inline int find_level(cpuid_t *cpunum, int irq)
{
int cpu, i;
for_each_online_cpu(cpu) {
struct slice_data *si = cpu_data[cpu].data;
for (i = BASE_PCI_IRQ; i < LEVELS_PER_SLICE; i++)
if (si->level_to_irq[i] == irq) {
*cpunum = cpu;
return i;
}
}
panic("Could not identify cpu/level for irq %d", irq);
}
static int intr_connect_level(int cpu, int bit)
{
nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
struct slice_data *si = cpu_data[cpu].data;
set_bit(bit, si->irq_enable_mask);
if (!cputoslice(cpu)) {
REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
} else {
REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
}
return 0;
}
static int intr_disconnect_level(int cpu, int bit)
{
nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
struct slice_data *si = cpu_data[cpu].data;
clear_bit(bit, si->irq_enable_mask);
if (!cputoslice(cpu)) {
REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
} else {
REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
}
return 0;
}
/* Startup one of the (PCI ...) IRQs routes over a bridge. */
static unsigned int startup_bridge_irq(struct irq_data *d)
{
struct bridge_controller *bc;
bridgereg_t device;
bridge_t *bridge;
int pin, swlevel;
cpuid_t cpu;
pin = SLOT_FROM_PCI_IRQ(d->irq);
bc = IRQ_TO_BRIDGE(d->irq);
bridge = bc->base;
pr_debug("bridge_startup(): irq= 0x%x pin=%d\n", d->irq, pin);
/*
* "map" irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
swlevel = find_level(&cpu, d->irq);
bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8));
bridge->b_int_enable |= (1 << pin);
bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */
/*
* Enable sending of an interrupt clear packt to the hub on a high to
* low transition of the interrupt pin.
*
* IRIX sets additional bits in the address which are documented as
* reserved in the bridge docs.
*/
bridge->b_int_mode |= (1UL << pin);
/*
* We assume the bridge to have a 1:1 mapping between devices
* (slots) and intr pins.
*/
device = bridge->b_int_device;
device &= ~(7 << (pin*3));
device |= (pin << (pin*3));
bridge->b_int_device = device;
bridge->b_wid_tflush;
intr_connect_level(cpu, swlevel);
return 0; /* Never anything pending. */
}
/* Shutdown one of the (PCI ...) IRQs routes over a bridge. */
static void shutdown_bridge_irq(struct irq_data *d)
{
struct bridge_controller *bc = IRQ_TO_BRIDGE(d->irq);
bridge_t *bridge = bc->base;
int pin, swlevel;
cpuid_t cpu;
pr_debug("bridge_shutdown: irq 0x%x\n", d->irq);
pin = SLOT_FROM_PCI_IRQ(d->irq);
/*
* map irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
swlevel = find_level(&cpu, d->irq);
intr_disconnect_level(cpu, swlevel);
bridge->b_int_enable &= ~(1 << pin);
bridge->b_wid_tflush;
}
static inline void enable_bridge_irq(struct irq_data *d)
{
cpuid_t cpu;
int swlevel;
swlevel = find_level(&cpu, d->irq); /* Criminal offence */
intr_connect_level(cpu, swlevel);
}
static inline void disable_bridge_irq(struct irq_data *d)
{
cpuid_t cpu;
int swlevel;
swlevel = find_level(&cpu, d->irq); /* Criminal offence */
intr_disconnect_level(cpu, swlevel);
}
static struct irq_chip bridge_irq_type = {
.name = "bridge",
.irq_startup = startup_bridge_irq,
.irq_shutdown = shutdown_bridge_irq,
.irq_mask = disable_bridge_irq,
.irq_unmask = enable_bridge_irq,
};
void register_bridge_irq(unsigned int irq)
{
irq_set_chip_and_handler(irq, &bridge_irq_type, handle_level_irq);
}
int request_bridge_irq(struct bridge_controller *bc)
{
int irq = allocate_irqno();
int swlevel, cpu;
nasid_t nasid;
if (irq < 0)
return irq;
/*
* "map" irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
cpu = bc->irq_cpu;
swlevel = alloc_level(cpu, irq);
if (unlikely(swlevel < 0)) {
free_irqno(irq);
return -EAGAIN;
}
/* Make sure it's not already pending when we connect it. */
nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
REMOTE_HUB_CLR_INTR(nasid, swlevel);
intr_connect_level(cpu, swlevel);
register_bridge_irq(irq);
return irq;
}
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <asm/mipsregs.h> #include <asm/mipsregs.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/pci/bridge.h>
#include <asm/sn/addrs.h> #include <asm/sn/addrs.h>
#include <asm/sn/agent.h> #include <asm/sn/agent.h>
#include <asm/sn/arch.h> #include <asm/sn/arch.h>
...@@ -54,50 +53,6 @@ ...@@ -54,50 +53,6 @@
extern asmlinkage void ip27_irq(void); extern asmlinkage void ip27_irq(void);
extern struct bridge_controller *irq_to_bridge[];
extern int irq_to_slot[];
/*
* use these macros to get the encoded nasid and widget id
* from the irq value
*/
#define IRQ_TO_BRIDGE(i) irq_to_bridge[(i)]
#define SLOT_FROM_PCI_IRQ(i) irq_to_slot[i]
static inline int alloc_level(int cpu, int irq)
{
struct hub_data *hub = hub_data(cpu_to_node(cpu));
struct slice_data *si = cpu_data[cpu].data;
int level;
level = find_first_zero_bit(hub->irq_alloc_mask, LEVELS_PER_SLICE);
if (level >= LEVELS_PER_SLICE)
panic("Cpu %d flooded with devices", cpu);
__set_bit(level, hub->irq_alloc_mask);
si->level_to_irq[level] = irq;
return level;
}
static inline int find_level(cpuid_t *cpunum, int irq)
{
int cpu, i;
for_each_online_cpu(cpu) {
struct slice_data *si = cpu_data[cpu].data;
for (i = BASE_PCI_IRQ; i < LEVELS_PER_SLICE; i++)
if (si->level_to_irq[i] == irq) {
*cpunum = cpu;
return i;
}
}
panic("Could not identify cpu/level for irq %d", irq);
}
/* /*
* Find first bit set * Find first bit set
*/ */
...@@ -204,175 +159,6 @@ static void ip27_hub_error(void) ...@@ -204,175 +159,6 @@ static void ip27_hub_error(void)
panic("CPU %d got a hub error interrupt", smp_processor_id()); panic("CPU %d got a hub error interrupt", smp_processor_id());
} }
static int intr_connect_level(int cpu, int bit)
{
nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
struct slice_data *si = cpu_data[cpu].data;
set_bit(bit, si->irq_enable_mask);
if (!cputoslice(cpu)) {
REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
} else {
REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
}
return 0;
}
static int intr_disconnect_level(int cpu, int bit)
{
nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
struct slice_data *si = cpu_data[cpu].data;
clear_bit(bit, si->irq_enable_mask);
if (!cputoslice(cpu)) {
REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
} else {
REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
}
return 0;
}
/* Startup one of the (PCI ...) IRQs routes over a bridge. */
static unsigned int startup_bridge_irq(struct irq_data *d)
{
struct bridge_controller *bc;
bridgereg_t device;
bridge_t *bridge;
int pin, swlevel;
cpuid_t cpu;
pin = SLOT_FROM_PCI_IRQ(d->irq);
bc = IRQ_TO_BRIDGE(d->irq);
bridge = bc->base;
pr_debug("bridge_startup(): irq= 0x%x pin=%d\n", d->irq, pin);
/*
* "map" irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
swlevel = find_level(&cpu, d->irq);
bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8));
bridge->b_int_enable |= (1 << pin);
bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */
/*
* Enable sending of an interrupt clear packt to the hub on a high to
* low transition of the interrupt pin.
*
* IRIX sets additional bits in the address which are documented as
* reserved in the bridge docs.
*/
bridge->b_int_mode |= (1UL << pin);
/*
* We assume the bridge to have a 1:1 mapping between devices
* (slots) and intr pins.
*/
device = bridge->b_int_device;
device &= ~(7 << (pin*3));
device |= (pin << (pin*3));
bridge->b_int_device = device;
bridge->b_wid_tflush;
intr_connect_level(cpu, swlevel);
return 0; /* Never anything pending. */
}
/* Shutdown one of the (PCI ...) IRQs routes over a bridge. */
static void shutdown_bridge_irq(struct irq_data *d)
{
struct bridge_controller *bc = IRQ_TO_BRIDGE(d->irq);
bridge_t *bridge = bc->base;
int pin, swlevel;
cpuid_t cpu;
pr_debug("bridge_shutdown: irq 0x%x\n", d->irq);
pin = SLOT_FROM_PCI_IRQ(d->irq);
/*
* map irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
swlevel = find_level(&cpu, d->irq);
intr_disconnect_level(cpu, swlevel);
bridge->b_int_enable &= ~(1 << pin);
bridge->b_wid_tflush;
}
static inline void enable_bridge_irq(struct irq_data *d)
{
cpuid_t cpu;
int swlevel;
swlevel = find_level(&cpu, d->irq); /* Criminal offence */
intr_connect_level(cpu, swlevel);
}
static inline void disable_bridge_irq(struct irq_data *d)
{
cpuid_t cpu;
int swlevel;
swlevel = find_level(&cpu, d->irq); /* Criminal offence */
intr_disconnect_level(cpu, swlevel);
}
static struct irq_chip bridge_irq_type = {
.name = "bridge",
.irq_startup = startup_bridge_irq,
.irq_shutdown = shutdown_bridge_irq,
.irq_mask = disable_bridge_irq,
.irq_unmask = enable_bridge_irq,
};
void register_bridge_irq(unsigned int irq)
{
irq_set_chip_and_handler(irq, &bridge_irq_type, handle_level_irq);
}
int request_bridge_irq(struct bridge_controller *bc)
{
int irq = allocate_irqno();
int swlevel, cpu;
nasid_t nasid;
if (irq < 0)
return irq;
/*
* "map" irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
cpu = bc->irq_cpu;
swlevel = alloc_level(cpu, irq);
if (unlikely(swlevel < 0)) {
free_irqno(irq);
return -EAGAIN;
}
/* Make sure it's not already pending when we connect it. */
nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
REMOTE_HUB_CLR_INTR(nasid, swlevel);
intr_connect_level(cpu, swlevel);
register_bridge_irq(irq);
return irq;
}
asmlinkage void plat_irq_dispatch(void) asmlinkage void plat_irq_dispatch(void)
{ {
unsigned long pending = read_c0_cause() & read_c0_status(); unsigned long pending = read_c0_cause() & read_c0_status();
......
...@@ -147,7 +147,8 @@ config SIBYTE_CFE_CONSOLE ...@@ -147,7 +147,8 @@ config SIBYTE_CFE_CONSOLE
config SIBYTE_BUS_WATCHER config SIBYTE_BUS_WATCHER
bool "Support for Bus Watcher statistics" bool "Support for Bus Watcher statistics"
depends on SIBYTE_SB1xxx_SOC depends on SIBYTE_SB1xxx_SOC && \
(SIBYTE_BCM112X || SIBYTE_SB1250)
help help
Handle and keep statistics on the bus error interrupts (COR_ECC, Handle and keep statistics on the bus error interrupts (COR_ECC,
BAD_ECC, IO_BUS). BAD_ECC, IO_BUS).
......
...@@ -41,3 +41,4 @@ load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000 ...@@ -41,3 +41,4 @@ load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000
load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000 load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000
load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000 load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000 load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000
load-$(CONFIG_SIBYTE_LITTLESUR) := 0xffffffff80100000
obj-y := cfe.o obj-y := cfe.o
obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o
obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include <asm/sibyte/sb1250_regs.h> #include <asm/sibyte/sb1250_regs.h>
#include <asm/sibyte/sb1250_int.h> #include <asm/sibyte/sb1250_int.h>
#include <asm/sibyte/sb1250_scd.h> #include <asm/sibyte/sb1250_scd.h>
#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
#include <asm/sibyte/bcm1480_regs.h>
#endif
struct bw_stats_struct { struct bw_stats_struct {
...@@ -81,9 +84,15 @@ void check_bus_watcher(void) ...@@ -81,9 +84,15 @@ void check_bus_watcher(void)
#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
/* Destructive read, clears register and interrupt */ /* Destructive read, clears register and interrupt */
status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS)); status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS));
#else #elif defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250)
/* Use non-destructive register */ /* Use non-destructive register */
status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG)); status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG));
#elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
/* Use non-destructive register */
/* Same as 1250 except BUS_ERR_STATUS_DEBUG is in a different place. */
status = csr_in32(IOADDR(A_BCM1480_BUS_ERR_STATUS_DEBUG));
#else
#error bus watcher being built for unknown Sibyte SOC!
#endif #endif
if (!(status & 0x7fffffff)) { if (!(status & 0x7fffffff)) {
printk("Using last values reaped by bus watcher driver\n"); printk("Using last values reaped by bus watcher driver\n");
...@@ -175,9 +184,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data) ...@@ -175,9 +184,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)
#ifdef CONFIG_SIBYTE_BW_TRACE #ifdef CONFIG_SIBYTE_BW_TRACE
int i; int i;
#endif #endif
#ifndef CONFIG_PROC_FS
char bw_buf[1024];
#endif
#ifdef CONFIG_SIBYTE_BW_TRACE #ifdef CONFIG_SIBYTE_BW_TRACE
csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG)); csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/errno.h> #include <linux/errno.h>
......
obj-y := setup.o irq.o time.o obj-y := setup.o irq.o time.o
obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
...@@ -185,6 +185,7 @@ static void __init sni_pcimt_resource_init(void) ...@@ -185,6 +185,7 @@ static void __init sni_pcimt_resource_init(void)
extern struct pci_ops sni_pcimt_ops; extern struct pci_ops sni_pcimt_ops;
#ifdef CONFIG_PCI
static struct pci_controller sni_controller = { static struct pci_controller sni_controller = {
.pci_ops = &sni_pcimt_ops, .pci_ops = &sni_pcimt_ops,
.mem_resource = &sni_mem_resource, .mem_resource = &sni_mem_resource,
...@@ -193,6 +194,7 @@ static struct pci_controller sni_controller = { ...@@ -193,6 +194,7 @@ static struct pci_controller sni_controller = {
.io_offset = 0x00000000UL, .io_offset = 0x00000000UL,
.io_map_base = SNI_PORT_BASE .io_map_base = SNI_PORT_BASE
}; };
#endif
static void enable_pcimt_irq(struct irq_data *d) static void enable_pcimt_irq(struct irq_data *d)
{ {
......
...@@ -128,13 +128,6 @@ static struct resource pcit_io_resources[] = { ...@@ -128,13 +128,6 @@ static struct resource pcit_io_resources[] = {
} }
}; };
static struct resource sni_mem_resource = {
.start = 0x18000000UL,
.end = 0x1fbfffffUL,
.name = "PCIT PCI MEM",
.flags = IORESOURCE_MEM
};
static void __init sni_pcit_resource_init(void) static void __init sni_pcit_resource_init(void)
{ {
int i; int i;
...@@ -147,6 +140,14 @@ static void __init sni_pcit_resource_init(void) ...@@ -147,6 +140,14 @@ static void __init sni_pcit_resource_init(void)
extern struct pci_ops sni_pcit_ops; extern struct pci_ops sni_pcit_ops;
#ifdef CONFIG_PCI
static struct resource sni_mem_resource = {
.start = 0x18000000UL,
.end = 0x1fbfffffUL,
.name = "PCIT PCI MEM",
.flags = IORESOURCE_MEM
};
static struct pci_controller sni_pcit_controller = { static struct pci_controller sni_pcit_controller = {
.pci_ops = &sni_pcit_ops, .pci_ops = &sni_pcit_ops,
.mem_resource = &sni_mem_resource, .mem_resource = &sni_mem_resource,
...@@ -155,6 +156,7 @@ static struct pci_controller sni_pcit_controller = { ...@@ -155,6 +156,7 @@ static struct pci_controller sni_pcit_controller = {
.io_offset = 0x00000000UL, .io_offset = 0x00000000UL,
.io_map_base = SNI_PORT_BASE .io_map_base = SNI_PORT_BASE
}; };
#endif /* CONFIG_PCI */
static void enable_pcit_irq(struct irq_data *d) static void enable_pcit_irq(struct irq_data *d)
{ {
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <linux/rio_drv.h> #include <linux/rio_drv.h>
#include <linux/rio_ids.h> #include <linux/rio_ids.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/page.h>
#include "../rio.h" #include "../rio.h"
#define LOCAL_RTE_CONF_DESTID_SEL 0x010070 #define LOCAL_RTE_CONF_DESTID_SEL 0x010070
......
...@@ -208,7 +208,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, ...@@ -208,7 +208,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
* get the remaining count from the ... count register * get the remaining count from the ... count register
* which is 1*8 before the config register * which is 1*8 before the config register
*/ */
ret = put_user(__raw_readq(user_dog - 8) / 1000000, p); ret = put_user((u32)__raw_readq(user_dog - 8) / 1000000, p);
break; break;
} }
return ret; return ret;
......
...@@ -1272,7 +1272,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER ...@@ -1272,7 +1272,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER
depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
depends on !X86_64 depends on !X86_64
select STACKTRACE select STACKTRACE
select FRAME_POINTER if !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND
help help
Provide stacktrace filter for fault-injection capabilities Provide stacktrace filter for fault-injection capabilities
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment