core_t2.h

来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 629 行 · 第 1/2 页

H
629
字号
 * Note there are 4 memory slots on sable (see t2.h) */struct el_t2_frame_mcheck {	struct el_t2_frame_header elfmc_header;	/* ID$P-FRAME_MCHECK */	struct el_t2_logout_header elfmc_hdr;	struct el_t2_procdata_mcheck elfmc_procdata;	struct el_t2_sysdata_mcheck elfmc_sysdata;	struct el_t2_data_t2 elfmc_t2data;	struct el_t2_data_memory elfmc_memdata[4];	struct el_t2_frame_header elfmc_footer;	/* empty */};/* * Sable error log data structures on memory errors */struct el_t2_frame_corrected {	struct el_t2_frame_header elfcc_header;	/* ID$P-BC-COR */	struct el_t2_logout_header elfcc_hdr;	struct el_t2_data_corrected elfcc_procdata;/*	struct el_t2_data_t2 elfcc_t2data;		*//*	struct el_t2_data_memory elfcc_memdata[4];	*/	struct el_t2_frame_header elfcc_footer;	/* empty */};#ifdef __KERNEL__#ifndef __EXTERN_INLINE#define __EXTERN_INLINE extern inline#define __IO_EXTERN_INLINE#endif/* * I/O functions: * * T2 (the core logic PCI/memory support chipset for the SABLE * series of processors uses a sparse address mapping scheme to * get at PCI memory and I/O. */#define vip	volatile int *#define vuip	volatile unsigned int *static inline u8 t2_inb(unsigned long addr){	long result = *(vip) ((addr << 5) + T2_IO + 0x00);	return __kernel_extbl(result, addr & 3);}static inline void t2_outb(u8 b, unsigned long addr){	unsigned long w;	w = __kernel_insbl(b, addr & 3);	*(vuip) ((addr << 5) + T2_IO + 0x00) = w;	mb();}static inline u16 t2_inw(unsigned long addr){	long result = *(vip) ((addr << 5) + T2_IO + 0x08);	return __kernel_extwl(result, addr & 3);}static inline void t2_outw(u16 b, unsigned long addr){	unsigned long w;	w = __kernel_inswl(b, addr & 3);	*(vuip) ((addr << 5) + T2_IO + 0x08) = w;	mb();}static inline u32 t2_inl(unsigned long addr){	return *(vuip) ((addr << 5) + T2_IO + 0x18);}static inline void t2_outl(u32 b, unsigned long addr){	*(vuip) ((addr << 5) + T2_IO + 0x18) = b;	mb();}/* * Memory functions. * * For reading and writing 8 and 16 bit quantities we need to * go through one of the three sparse address mapping regions * and use the HAE_MEM CSR to provide some bits of the address. * The following few routines use only sparse address region 1 * which gives 1Gbyte of accessible space which relates exactly * to the amount of PCI memory mapping *into* system address space. * See p 6-17 of the specification but it looks something like this: * * 21164 Address: * *          3         2         1 * 9876543210987654321098765432109876543210 * 1ZZZZ0.PCI.QW.Address............BBLL * * ZZ = SBZ * BB = Byte offset * LL = Transfer length * * PCI Address: * * 3         2         1 * 10987654321098765432109876543210 * HHH....PCI.QW.Address........ 00 * * HHH = 31:29 HAE_MEM CSR * */#define t2_set_hae { \	msb = addr  >> 27; \	addr &= T2_MEM_R1_MASK; \	set_hae(msb); \}static spinlock_t t2_hae_lock = SPIN_LOCK_UNLOCKED;__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long result, msb;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00);	spin_unlock_irqrestore(&t2_hae_lock, flags);	return __kernel_extbl(result, addr & 3);}__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long result, msb;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08);	spin_unlock_irqrestore(&t2_hae_lock, flags);	return __kernel_extwl(result, addr & 3);}/* * On SABLE with T2, we must use SPARSE memory even for 32-bit access, * because we cannot access all of DENSE without changing its HAE. */__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long result, msb;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18);	spin_unlock_irqrestore(&t2_hae_lock, flags);	return result & 0xffffffffUL;}__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long r0, r1, work, msb;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	work = (addr << 5) + T2_SPARSE_MEM + 0x18;	r0 = *(vuip)(work);	r1 = *(vuip)(work + (4 << 5));	spin_unlock_irqrestore(&t2_hae_lock, flags);	return r1 << 32 | r0;}__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long msb, w;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	w = __kernel_insbl(b, addr & 3);	*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w;	spin_unlock_irqrestore(&t2_hae_lock, flags);}__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long msb, w;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	w = __kernel_inswl(b, addr & 3);	*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w;	spin_unlock_irqrestore(&t2_hae_lock, flags);}/* * On SABLE with T2, we must use SPARSE memory even for 32-bit access, * because we cannot access all of DENSE without changing its HAE. */__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long msb;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b;	spin_unlock_irqrestore(&t2_hae_lock, flags);}__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr){	unsigned long addr = (unsigned long) xaddr;	unsigned long msb, work;	unsigned long flags;	spin_lock_irqsave(&t2_hae_lock, flags);	t2_set_hae;	work = (addr << 5) + T2_SPARSE_MEM + 0x18;	*(vuip)work = b;	*(vuip)(work + (4 << 5)) = b >> 32;	spin_unlock_irqrestore(&t2_hae_lock, flags);}__EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr){	return (void __iomem *)(addr + T2_IO);}__EXTERN_INLINE void __iomem *t2_ioremap(unsigned long addr, 					 unsigned long size){	return (void __iomem *)(addr + T2_DENSE_MEM);}__EXTERN_INLINE int t2_is_ioaddr(unsigned long addr){	return (long)addr >= 0;}__EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr){	return (unsigned long)addr >= T2_DENSE_MEM;}/* New-style ioread interface.  The mmio routines are so ugly for T2 that   it doesn't make sense to merge the pio and mmio routines.  */#define IOPORT(OS, NS)							\__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr)		\{									\	if (t2_is_mmio(xaddr))						\		return t2_read##OS(xaddr - T2_DENSE_MEM);		\	else								\		return t2_in##OS((unsigned long)xaddr - T2_IO);		\}									\__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr)	\{									\	if (t2_is_mmio(xaddr))						\		t2_write##OS(b, xaddr - T2_DENSE_MEM);			\	else								\		t2_out##OS(b, (unsigned long)xaddr - T2_IO);		\}IOPORT(b, 8)IOPORT(w, 16)IOPORT(l, 32)#undef IOPORT#undef vip#undef vuip#undef __IO_PREFIX#define __IO_PREFIX		t2#define t2_trivial_rw_bw	0#define t2_trivial_rw_lq	0#define t2_trivial_io_bw	0#define t2_trivial_io_lq	0#define t2_trivial_iounmap	1#include <asm/io_trivial.h>#ifdef __IO_EXTERN_INLINE#undef __EXTERN_INLINE#undef __IO_EXTERN_INLINE#endif#endif /* __KERNEL__ */#endif /* __ALPHA_T2__H__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?