diff options
Diffstat (limited to 'include')
176 files changed, 3593 insertions, 1403 deletions
diff --git a/include/asm-alpha/console.h b/include/asm-alpha/console.h index 89f39911f..8a7d1d1fc 100644 --- a/include/asm-alpha/console.h +++ b/include/asm-alpha/console.h @@ -22,6 +22,9 @@ #define CCB_GET_ENV 0x22 #define CCB_SAVE_ENV 0x23 +#define CCB_PSWITCH 0x30 +#define CCB_BIOS_EMUL 0x32 + /* * Environment variable numbers */ @@ -36,20 +39,30 @@ #define ENV_BOOT_RESET 0x09 #define ENV_DUMP_DEV 0x0A #define ENV_ENABLE_AUDIT 0x0B -#define ENV_LICENCE 0x0C +#define ENV_LICENSE 0x0C #define ENV_CHAR_SET 0x0D #define ENV_LANGUAGE 0x0E #define ENV_TTY_DEV 0x0F #ifdef __KERNEL__ -extern long srm_dispatch(long code, ...); -extern void srm_puts(const char *); +#ifndef __ASSEMBLY__ +extern long callback_puts(long unit, const char *s, long length); +extern long callback_open(const char *device, long length); +extern long callback_close(long unit); +extern long callback_read(long channel, long count, const char *buf, long lbn); +extern long callback_getenv(long id, const char *buf, unsigned long buf_size); + +extern int srm_fixup(unsigned long new_callback_addr, + unsigned long new_hwrpb_addr); +extern long srm_puts(const char *, long); extern long srm_printk(const char *, ...) __attribute__ ((format (printf, 1, 2))); struct crb_struct; struct hwrpb_struct; -extern long srm_fixup(struct crb_struct *, struct hwrpb_struct *); +extern int callback_init_done; +extern void * callback_init(void *); +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* __AXP_CONSOLE_H */ diff --git a/include/asm-alpha/core_titan.h b/include/asm-alpha/core_titan.h new file mode 100644 index 000000000..04338b46d --- /dev/null +++ b/include/asm-alpha/core_titan.h @@ -0,0 +1,525 @@ +#ifndef __ALPHA_TITAN__H__ +#define __ALPHA_TITAN__H__ + +#include <linux/types.h> +#include <asm/compiler.h> + +/* + * TITAN is the internal names for a core logic chipset which provides + * memory controller and PCI/AGP access for 21264 based systems. + * + * This file is based on: + * + * Titan Chipset Engineering Specification + * Revision 0.12 + * 13 July 1999 + * + */ + +/* XXX: Do we need to conditionalize on this? */ +#ifdef USE_48_BIT_KSEG +#define TI_BIAS 0x80000000000UL +#else +#define TI_BIAS 0x10000000000UL +#endif + +/* + * CChip, DChip, and PChip registers + */ + +typedef struct { + volatile unsigned long csr __attribute__((aligned(64))); +} titan_64; + +typedef struct { + titan_64 csc; + titan_64 mtr; + titan_64 misc; + titan_64 mpd; + titan_64 aar0; + titan_64 aar1; + titan_64 aar2; + titan_64 aar3; + titan_64 dim0; + titan_64 dim1; + titan_64 dir0; + titan_64 dir1; + titan_64 drir; + titan_64 prben; + titan_64 iic0; + titan_64 iic1; + titan_64 mpr0; + titan_64 mpr1; + titan_64 mpr2; + titan_64 mpr3; + titan_64 rsvd[2]; + titan_64 ttr; + titan_64 tdr; + titan_64 dim2; + titan_64 dim3; + titan_64 dir2; + titan_64 dir3; + titan_64 iic2; + titan_64 iic3; + titan_64 pwr; + titan_64 reserved[17]; + titan_64 cmonctla; + titan_64 cmonctlb; + titan_64 cmoncnt01; + titan_64 cmoncnt23; + titan_64 cpen; +} titan_cchip; + +typedef struct { + titan_64 dsc; + titan_64 str; + titan_64 drev; + titan_64 dsc2; +} titan_dchip; + +typedef struct { + titan_64 wsba[4]; + titan_64 wsm[4]; + titan_64 tba[4]; + titan_64 pctl; + titan_64 plat; + titan_64 reserved0[2]; + union { + struct { + titan_64 serror; + titan_64 serren; + titan_64 serrset; + titan_64 reserved0; + titan_64 gperror; + titan_64 gperren; + titan_64 gperrset; + titan_64 reserved1; + titan_64 gtlbiv; + titan_64 gtlbia; + titan_64 reserved2[2]; + titan_64 sctl; + titan_64 reserved3[3]; + } g; + struct { + titan_64 agperror; + titan_64 agperren; + titan_64 agperrset; + titan_64 agplastwr; + titan_64 aperror; + titan_64 aperren; + titan_64 aperrset; + titan_64 reserved0; + titan_64 atlbiv; + titan_64 atlbia; + titan_64 reserved1[6]; + } a; + } port_specific; + titan_64 sprst; + titan_64 reserved1[31]; +} titan_pachip_port; + +typedef struct { + titan_pachip_port g_port; + titan_pachip_port a_port; +} titan_pachip; + +#define TITAN_cchip ((titan_cchip *)(IDENT_ADDR+TI_BIAS+0x1A0000000UL)) +#define TITAN_dchip ((titan_dchip *)(IDENT_ADDR+TI_BIAS+0x1B0000800UL)) +#define TITAN_pachip0 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x180000000UL)) +#define TITAN_pachip1 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x380000000UL)) +extern unsigned TITAN_agp; +extern int TITAN_bootcpu; + +/* + * TITAN PA-chip Window Space Base Address register. + * (WSBA[0-2]) + */ +#define wsba_m_ena 0x1 +#define wsba_m_sg 0x2 +#define wsba_m_addr 0xFFF00000 +#define wmask_k_sz1gb 0x3FF00000 +union TPAchipWSBA { + struct { + unsigned wsba_v_ena : 1; + unsigned wsba_v_sg : 1; + unsigned wsba_v_rsvd1 : 18; + unsigned wsba_v_addr : 12; + unsigned wsba_v_rsvd2 : 32; + } wsba_r_bits; + int wsba_q_whole [2]; +}; + +/* + * TITAN PA-chip Control Register + * This definition covers both the G-Port GPCTL and the A-PORT APCTL. + * Bits <51:0> are the same in both cases. APCTL<63:52> are only + * applicable to AGP. + */ +#define pctl_m_fbtb 0x00000001 +#define pctl_m_thdis 0x00000002 +#define pctl_m_chaindis 0x00000004 +#define pctl_m_tgtlat 0x00000018 +#define pctl_m_hole 0x00000020 +#define pctl_m_mwin 0x00000040 +#define pctl_m_arbena 0x00000080 +#define pctl_m_prigrp 0x0000FF00 +#define pctl_m_ppri 0x00010000 +#define pctl_m_pcispd66 0x00020000 +#define pctl_m_cngstlt 0x003C0000 +#define pctl_m_ptpdesten 0x3FC00000 +#define pctl_m_dpcen 0x40000000 +#define pctl_m_apcen 0x0000000080000000UL +#define pctl_m_dcrtv 0x0000000300000000UL +#define pctl_m_en_stepping 0x0000000400000000UL +#define apctl_m_rsvd1 0x000FFFF800000000UL +#define apctl_m_agp_rate 0x0030000000000000UL +#define apctl_m_agp_sba_en 0x0040000000000000UL +#define apctl_m_agp_en 0x0080000000000000UL +#define apctl_m_rsvd2 0x0100000000000000UL +#define apctl_m_agp_present 0x0200000000000000UL +#define apctl_agp_hp_rd 0x1C00000000000000UL +#define apctl_agp_lp_rd 0xE000000000000000UL +#define gpctl_m_rsvd 0xFFFFFFF800000000UL +union TPAchipPCTL { + struct { + unsigned pctl_v_fbtb : 1; /* A/G [0] */ + unsigned pctl_v_thdis : 1; /* A/G [1] */ + unsigned pctl_v_chaindis : 1; /* A/G [2] */ + unsigned pctl_v_tgtlat : 2; /* A/G [4:3] */ + unsigned pctl_v_hole : 1; /* A/G [5] */ + unsigned pctl_v_mwin : 1; /* A/G [6] */ + unsigned pctl_v_arbena : 1; /* A/G [7] */ + unsigned pctl_v_prigrp : 8; /* A/G [15:8] */ + unsigned pctl_v_ppri : 1; /* A/G [16] */ + unsigned pctl_v_pcispd66 : 1; /* A/G [17] */ + unsigned pctl_v_cngstlt : 4; /* A/G [21:18] */ + unsigned pctl_v_ptpdesten : 8; /* A/G [29:22] */ + unsigned pctl_v_dpcen : 1; /* A/G [30] */ + unsigned pctl_v_apcen : 1; /* A/G [31] */ + unsigned pctl_v_dcrtv : 2; /* A/G [33:32] */ + unsigned pctl_v_en_stepping :1; /* A/G [34] */ + unsigned apctl_v_rsvd1 : 17; /* A [51:35] */ + unsigned apctl_v_agp_rate : 2; /* A [53:52] */ + unsigned apctl_v_agp_sba_en : 1; /* A [54] */ + unsigned apctl_v_agp_en : 1; /* A [55] */ + unsigned apctl_v_rsvd2 : 1; /* A [56] */ + unsigned apctl_v_agp_present : 1; /* A [57] */ + unsigned apctl_v_agp_hp_rd : 3; /* A [60:58] */ + unsigned apctl_v_agp_lp_rd : 3; /* A [63:61] */ + } pctl_r_bits; + unsigned int pctl_l_whole [2]; + unsigned long pctl_q_whole; +}; + +/* + * SERROR / SERREN / SERRSET + */ +union TPAchipSERR { + struct { + unsigned serr_v_lost_uecc : 1; /* [0] */ + unsigned serr_v_uecc : 1; /* [1] */ + unsigned serr_v_cre : 1; /* [2] */ + unsigned serr_v_nxio : 1; /* [3] */ + unsigned serr_v_lost_cre : 1; /* [4] */ + unsigned serr_v_rsvd0 : 10; /* [14:5] */ + unsigned serr_v_addr : 32; /* [46:15] */ + unsigned serr_v_rsvd1 : 5; /* [51:47] */ + unsigned serr_v_source : 2; /* [53:52] */ + unsigned serr_v_cmd : 2; /* [55:54] */ + unsigned serr_v_syn : 8; /* [63:56] */ + } serr_r_bits; + unsigned int serr_l_whole[2]; + unsigned long serr_q_whole; +}; + +/* + * GPERROR / APERROR / GPERREN / APERREN / GPERRSET / APERRSET + */ +union TPAchipPERR { + struct { + unsigned long perr_v_lost : 1; /* [0] */ + unsigned long perr_v_serr : 1; /* [1] */ + unsigned long perr_v_perr : 1; /* [2] */ + unsigned long perr_v_dcrto : 1; /* [3] */ + unsigned long perr_v_sge : 1; /* [4] */ + unsigned long perr_v_ape : 1; /* [5] */ + unsigned long perr_v_ta : 1; /* [6] */ + unsigned long perr_v_dpe : 1; /* [7] */ + unsigned long perr_v_nds : 1; /* [8] */ + unsigned long perr_v_iptpr : 1; /* [9] */ + unsigned long perr_v_iptpw : 1; /* [10] */ + unsigned long perr_v_rsvd0 : 3; /* [13:11] */ + unsigned long perr_v_addr : 33; /* [46:14] */ + unsigned long perr_v_dac : 1; /* [47] */ + unsigned long perr_v_mwin : 1; /* [48] */ + unsigned long perr_v_rsvd1 : 3; /* [51:49] */ + unsigned long perr_v_cmd : 4; /* [55:52] */ + unsigned long perr_v_rsvd2 : 8; /* [63:56] */ + } perr_r_bits; + unsigned int perr_l_whole[2]; + unsigned long perr_q_whole; +}; + +/* + * AGPERROR / AGPERREN / AGPERRSET + */ +union TPAchipAGPERR { + struct { + unsigned agperr_v_lost : 1; /* [0] */ + unsigned agperr_v_lpqfull : 1; /* [1] */ + unsigned apgerr_v_hpqfull : 1; /* [2] */ + unsigned agperr_v_rescmd : 1; /* [3] */ + unsigned agperr_v_ipte : 1; /* [4] */ + unsigned agperr_v_ptp : 1; /* [5] */ + unsigned agperr_v_nowindow : 1; /* [6] */ + unsigned agperr_v_rsvd0 : 8; /* [14:7] */ + unsigned agperr_v_addr : 32; /* [46:15] */ + unsigned agperr_v_rsvd1 : 1; /* [47] */ + unsigned agperr_v_dac : 1; /* [48] */ + unsigned agperr_v_mwin : 1; /* [49] */ + unsigned agperr_v_cmd : 3; /* [52:50] */ + unsigned agperr_v_length : 6; /* [58:53] */ + unsigned agperr_v_fence : 1; /* [59] */ + unsigned agperr_v_rsvd2 : 4; /* [63:60] */ + } agperr_r_bits; + unsigned int agperr_l_whole[2]; + unsigned long agperr_q_whole; +}; +/* + * Memory spaces: + * Hose numbers are assigned as follows: + * 0 - pachip 0 / G Port + * 1 - pachip 1 / G Port + * 2 - pachip 0 / A Port + * 3 - pachip 1 / A Port + */ +#define TITAN_HOSE(h) (((unsigned long)(h)) << 33) +#define TITAN_BASE (IDENT_ADDR + TI_BIAS) +#define TITAN_MEM(h) (TITAN_BASE+TITAN_HOSE(h)+0x000000000UL) +#define _TITAN_IACK_SC(h) (TITAN_BASE+TITAN_HOSE(h)+0x1F8000000UL) +#define TITAN_IO(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FC000000UL) +#define TITAN_CONF(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FE000000UL) + +#define TITAN_IACK_SC _TITAN_IACK_SC(0) /* hack! */ + +/* + * The canonical non-remaped I/O and MEM addresses have these values + * subtracted out. This is arranged so that folks manipulating ISA + * devices can use their familiar numbers and have them map to bus 0. + */ + +#define TITAN_IO_BIAS TITAN_IO(0) +#define TITAN_MEM_BIAS TITAN_MEM(0) + +/* The IO address space is larger than 0xffff */ +#define TITAN_IO_SPACE (TITAN_CONF(0) - TITAN_IO(0)) + +/* TIG Space */ +#define TITAN_TIG_SPACE (TITAN_BASE + 0x100000000UL) + +/* + * Data structure for handling TITAN machine checks: + */ +#define SCB_Q_SYSERR 0x620 +#define SCB_Q_PROCERR 0x630 +#define SCB_Q_SYSMCHK 0x660 +#define SCB_Q_PROCMCHK 0x670 +#define SCB_Q_SYSEVENT 0x680 /* environmental / system management */ +struct el_TITAN_sysdata_mcheck { + u64 summary; /* 0x00 */ + u64 c_dirx; /* 0x08 */ + u64 c_misc; /* 0x10 */ + u64 p0_serror; /* 0x18 */ + u64 p0_gperror; /* 0x20 */ + u64 p0_aperror; /* 0x28 */ + u64 p0_agperror;/* 0x30 */ + u64 p1_serror; /* 0x38 */ + u64 p1_gperror; /* 0x40 */ + u64 p1_aperror; /* 0x48 */ + u64 p1_agperror;/* 0x50 */ +}; + +/* + * System area for a privateer 680 environmental/system management mcheck + */ +struct el_PRIVATEER_envdata_mcheck { + u64 summary; /* 0x00 */ + u64 c_dirx; /* 0x08 */ + u64 smir; /* 0x10 */ + u64 cpuir; /* 0x18 */ + u64 psir; /* 0x20 */ + u64 fault; /* 0x28 */ + u64 sys_doors; /* 0x30 */ + u64 temp_warn; /* 0x38 */ + u64 fan_ctrl; /* 0x40 */ + u64 code; /* 0x48 */ + u64 reserved; /* 0x50 */ +}; + +#ifdef __KERNEL__ + +#ifndef __EXTERN_INLINE +#define __EXTERN_INLINE extern inline +#define __IO_EXTERN_INLINE +#endif + +/* + * I/O functions: + * + * TITAN, a 21??? PCI/memory support chipset for the EV6 (21264) + * can only use linear accesses to get at PCI/AGP memory and I/O spaces. + */ + +#define vucp volatile unsigned char * +#define vusp volatile unsigned short * +#define vuip volatile unsigned int * +#define vulp volatile unsigned long * + +__EXTERN_INLINE unsigned int titan_inb(unsigned long addr) +{ + /* ??? I wish I could get rid of this. But there's no ioremap + equivalent for I/O space. PCI I/O can be forced into the + correct hose's I/O region, but that doesn't take care of + legacy ISA crap. */ + + addr += TITAN_IO_BIAS; + return __kernel_ldbu(*(vucp)addr); +} + +__EXTERN_INLINE void titan_outb(unsigned char b, unsigned long addr) +{ + addr += TITAN_IO_BIAS; + __kernel_stb(b, *(vucp)addr); + mb(); +} + +__EXTERN_INLINE unsigned int titan_inw(unsigned long addr) +{ + addr += TITAN_IO_BIAS; + return __kernel_ldwu(*(vusp)addr); +} + +__EXTERN_INLINE void titan_outw(unsigned short b, unsigned long addr) +{ + addr += TITAN_IO_BIAS; + __kernel_stw(b, *(vusp)addr); + mb(); +} + +__EXTERN_INLINE unsigned int titan_inl(unsigned long addr) +{ + addr += TITAN_IO_BIAS; + return *(vuip)addr; +} + +__EXTERN_INLINE void titan_outl(unsigned int b, unsigned long addr) +{ + addr += TITAN_IO_BIAS; + *(vuip)addr = b; + mb(); +} + +/* + * Memory functions. all accesses are done through linear space. + */ + +__EXTERN_INLINE unsigned long titan_ioremap(unsigned long addr) +{ + return addr + TITAN_MEM_BIAS; +} + +__EXTERN_INLINE int titan_is_ioaddr(unsigned long addr) +{ + return addr >= TITAN_BASE; +} + +__EXTERN_INLINE unsigned long titan_readb(unsigned long addr) +{ + return __kernel_ldbu(*(vucp)addr); +} + +__EXTERN_INLINE unsigned long titan_readw(unsigned long addr) +{ + return __kernel_ldwu(*(vusp)addr); +} + +__EXTERN_INLINE unsigned long titan_readl(unsigned long addr) +{ + return *(vuip)addr; +} + +__EXTERN_INLINE unsigned long titan_readq(unsigned long addr) +{ + return *(vulp)addr; +} + +__EXTERN_INLINE void titan_writeb(unsigned char b, unsigned long addr) +{ + __kernel_stb(b, *(vucp)addr); +} + +__EXTERN_INLINE void titan_writew(unsigned short b, unsigned long addr) +{ + __kernel_stw(b, *(vusp)addr); +} + +__EXTERN_INLINE void titan_writel(unsigned int b, unsigned long addr) +{ + *(vuip)addr = b; +} + +__EXTERN_INLINE void titan_writeq(unsigned long b, unsigned long addr) +{ + *(vulp)addr = b; +} + +#undef vucp +#undef vusp +#undef vuip +#undef vulp + +#ifdef __WANT_IO_DEF + +#define __inb titan_inb +#define __inw titan_inw +#define __inl titan_inl +#define __outb titan_outb +#define __outw titan_outw +#define __outl titan_outl +#define __readb titan_readb +#define __readw titan_readw +#define __writeb titan_writeb +#define __writew titan_writew +#define __readl titan_readl +#define __readq titan_readq +#define __writel titan_writel +#define __writeq titan_writeq +#define __ioremap titan_ioremap +#define __is_ioaddr titan_is_ioaddr + +#define inb(port) __inb((port)) +#define inw(port) __inw((port)) +#define inl(port) __inl((port)) +#define outb(v, port) __outb((v),(port)) +#define outw(v, port) __outw((v),(port)) +#define outl(v, port) __outl((v),(port)) + +#define __raw_readb(a) __readb((unsigned long)(a)) +#define __raw_readw(a) __readw((unsigned long)(a)) +#define __raw_readl(a) __readl((unsigned long)(a)) +#define __raw_readq(a) __readq((unsigned long)(a)) +#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a)) +#define __raw_writew(v,a) __writew((v),(unsigned long)(a)) +#define __raw_writel(v,a) __writel((v),(unsigned long)(a)) +#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a)) + +#endif /* __WANT_IO_DEF */ + +#ifdef __IO_EXTERN_INLINE +#undef __EXTERN_INLINE +#undef __IO_EXTERN_INLINE +#endif + +#endif /* __KERNEL__ */ + +#endif /* __ALPHA_TITAN__H__ */ diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h index 5d0d7cf7a..00d20922b 100644 --- a/include/asm-alpha/core_tsunami.h +++ b/include/asm-alpha/core_tsunami.h @@ -52,6 +52,7 @@ typedef struct { tsunami_64 mpr2; tsunami_64 mpr3; tsunami_64 mctl; + tsunami_64 __pad1; tsunami_64 ttr; tsunami_64 tdr; tsunami_64 dim2; diff --git a/include/asm-alpha/core_wildfire.h b/include/asm-alpha/core_wildfire.h new file mode 100644 index 000000000..33666c02d --- /dev/null +++ b/include/asm-alpha/core_wildfire.h @@ -0,0 +1,427 @@ +#ifndef __ALPHA_WILDFIRE__H__ +#define __ALPHA_WILDFIRE__H__ + +#include <linux/types.h> +#include <asm/compiler.h> + +#define WILDFIRE_MAX_QBB 8 /* more than 8 requires other mods */ +#define WILDFIRE_PCA_PER_QBB 4 +#define WILDFIRE_IRQ_PER_PCA 64 + +#define WILDFIRE_NR_IRQS \ + (WILDFIRE_MAX_QBB * WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA) + +extern unsigned char wildfire_hard_qbb_map[WILDFIRE_MAX_QBB]; +extern unsigned char wildfire_soft_qbb_map[WILDFIRE_MAX_QBB]; +#define QBB_MAP_EMPTY 0xff + +extern unsigned long wildfire_hard_qbb_mask; +extern unsigned long wildfire_soft_qbb_mask; +extern unsigned long wildfire_gp_mask; +extern unsigned long wildfire_hs_mask; +extern unsigned long wildfire_iop_mask; +extern unsigned long wildfire_ior_mask; +extern unsigned long wildfire_pca_mask; +extern unsigned long wildfire_cpu_mask; +extern unsigned long wildfire_mem_mask; + +#define WILDFIRE_QBB_EXISTS(qbbno) (wildfire_soft_qbb_mask & (1 << (qbbno))) + +#define WILDFIRE_MEM_EXISTS(qbbno) (wildfire_mem_mask & (0xf << ((qbbno) << 2))) + +#define WILDFIRE_PCA_EXISTS(qbbno, pcano) \ + (wildfire_pca_mask & (1 << (((qbbno) << 2) + (pcano)))) + +typedef struct { + volatile unsigned long csr __attribute__((aligned(64))); +} wildfire_64; + +typedef struct { + volatile unsigned long csr __attribute__((aligned(256))); +} wildfire_256; + +typedef struct { + volatile unsigned long csr __attribute__((aligned(2048))); +} wildfire_2k; + +typedef struct { + wildfire_64 qsd_whami; + wildfire_64 qsd_rev; + wildfire_64 qsd_port_present; + wildfire_64 qsd_port_active; + wildfire_64 qsd_fault_ena; + wildfire_64 qsd_cpu_int_ena; + wildfire_64 qsd_mem_config; + wildfire_64 qsd_err_sum; + wildfire_64 ce_sum[4]; + wildfire_64 dev_init[4]; + wildfire_64 it_int[4]; + wildfire_64 ip_int[4]; + wildfire_64 uce_sum[4]; + wildfire_64 se_sum__non_dev_int[4]; + wildfire_64 scratch[4]; + wildfire_64 qsd_timer; + wildfire_64 qsd_diag; +} wildfire_qsd; + +typedef struct { + wildfire_256 qsd_whami; + wildfire_256 __pad1; + wildfire_256 ce_sum; + wildfire_256 dev_init; + wildfire_256 it_int; + wildfire_256 ip_int; + wildfire_256 uce_sum; + wildfire_256 se_sum; +} wildfire_fast_qsd; + +typedef struct { + wildfire_2k qsa_qbb_id; + wildfire_2k __pad1; + wildfire_2k qsa_port_ena; + wildfire_2k qsa_scratch; + wildfire_2k qsa_config[5]; + wildfire_2k qsa_ref_int; + wildfire_2k qsa_qbb_pop[2]; + wildfire_2k qsa_dtag_fc; + wildfire_2k __pad2[3]; + wildfire_2k qsa_diag; + wildfire_2k qsa_diag_lock[4]; + wildfire_2k __pad3[11]; + wildfire_2k qsa_cpu_err_sum; + wildfire_2k qsa_misc_err_sum; + wildfire_2k qsa_tmo_err_sum; + wildfire_2k qsa_err_ena; + wildfire_2k qsa_tmo_config; + wildfire_2k qsa_ill_cmd_err_sum; + wildfire_2k __pad4[26]; + wildfire_2k qsa_busy_mask; + wildfire_2k qsa_arr_valid; + wildfire_2k __pad5[2]; + wildfire_2k qsa_port_map[4]; + wildfire_2k qsa_arr_addr[8]; + wildfire_2k qsa_arr_mask[8]; +} wildfire_qsa; + +typedef struct { + wildfire_64 ioa_config; + wildfire_64 iod_config; + wildfire_64 iop_switch_credits; + wildfire_64 __pad1; + wildfire_64 iop_hose_credits; + wildfire_64 __pad2[11]; + struct { + wildfire_64 __pad3; + wildfire_64 init; + } iop_hose[4]; + wildfire_64 ioa_hose_0_ctrl; + wildfire_64 iod_hose_0_ctrl; + wildfire_64 ioa_hose_1_ctrl; + wildfire_64 iod_hose_1_ctrl; + wildfire_64 ioa_hose_2_ctrl; + wildfire_64 iod_hose_2_ctrl; + wildfire_64 ioa_hose_3_ctrl; + wildfire_64 iod_hose_3_ctrl; + struct { + wildfire_64 target; + wildfire_64 __pad4; + } iop_dev_int[4]; + + wildfire_64 iop_err_int_target; + wildfire_64 __pad5[7]; + wildfire_64 iop_qbb_err_sum; + wildfire_64 __pad6; + wildfire_64 iop_qbb_se_sum; + wildfire_64 __pad7; + wildfire_64 ioa_err_sum; + wildfire_64 iod_err_sum; + wildfire_64 __pad8[4]; + wildfire_64 ioa_diag_force_err; + wildfire_64 iod_diag_force_err; + wildfire_64 __pad9[4]; + wildfire_64 iop_diag_send_err_int; + wildfire_64 __pad10[15]; + wildfire_64 ioa_scratch; + wildfire_64 iod_scratch; +} wildfire_iop; + +typedef struct { + wildfire_2k gpa_qbb_map[4]; + wildfire_2k gpa_mem_pop_map; + wildfire_2k gpa_scratch; + wildfire_2k gpa_diag; + wildfire_2k gpa_config_0; + wildfire_2k __pad1; + wildfire_2k gpa_init_id; + wildfire_2k gpa_config_2; + /* not complete */ +} wildfire_gp; + +typedef struct { + wildfire_64 pca_what_am_i; + wildfire_64 pca_err_sum; + wildfire_64 pca_diag_force_err; + wildfire_64 pca_diag_send_err_int; + wildfire_64 pca_hose_credits; + wildfire_64 pca_scratch; + wildfire_64 pca_micro_addr; + wildfire_64 pca_micro_data; + wildfire_64 pca_pend_int; + wildfire_64 pca_sent_int; + wildfire_64 __pad1; + wildfire_64 pca_stdio_edge_level; + wildfire_64 __pad2[52]; + struct { + wildfire_64 target; + wildfire_64 enable; + } pca_int[4]; + wildfire_64 __pad3[56]; + wildfire_64 pca_alt_sent_int[32]; +} wildfire_pca; + +typedef struct { + wildfire_64 ne_what_am_i; + /* not complete */ +} wildfire_ne; + +typedef struct { + wildfire_64 fe_what_am_i; + /* not complete */ +} wildfire_fe; + +typedef struct { + wildfire_64 pci_io_addr_ext; + wildfire_64 pci_ctrl; + wildfire_64 pci_err_sum; + wildfire_64 pci_err_addr; + wildfire_64 pci_stall_cnt; + wildfire_64 pci_iack_special; + wildfire_64 __pad1[2]; + wildfire_64 pci_pend_int; + wildfire_64 pci_sent_int; + wildfire_64 __pad2[54]; + struct { + wildfire_64 wbase; + wildfire_64 wmask; + wildfire_64 tbase; + } pci_window[4]; + wildfire_64 pci_flush_tlb; + wildfire_64 pci_perf_mon; +} wildfire_pci; + +#define WILDFIRE_ENTITY_SHIFT 18 + +#define WILDFIRE_GP_ENTITY (0x10UL << WILDFIRE_ENTITY_SHIFT) +#define WILDFIRE_IOP_ENTITY (0x08UL << WILDFIRE_ENTITY_SHIFT) +#define WILDFIRE_QSA_ENTITY (0x04UL << WILDFIRE_ENTITY_SHIFT) +#define WILDFIRE_QSD_ENTITY_SLOW (0x05UL << WILDFIRE_ENTITY_SHIFT) +#define WILDFIRE_QSD_ENTITY_FAST (0x01UL << WILDFIRE_ENTITY_SHIFT) + +#define WILDFIRE_PCA_ENTITY(pca) ((0xc|(pca))<<WILDFIRE_ENTITY_SHIFT) + +#define WILDFIRE_BASE (IDENT_ADDR | (1UL << 40)) + +#define WILDFIRE_QBB_MASK 0x0fUL /* for now, only 4 bits/16 QBBs */ + +#define WILDFIRE_QBB(q) ((~((long)(q)) & WILDFIRE_QBB_MASK) << 36) +#define WILDFIRE_HOSE(h) ((long)(h) << 33) + +#define WILDFIRE_QBB_IO(q) (WILDFIRE_BASE | WILDFIRE_QBB(q)) +#define WILDFIRE_QBB_HOSE(q,h) (WILDFIRE_QBB_IO(q) | WILDFIRE_HOSE(h)) + +#define WILDFIRE_MEM(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x000000000UL) +#define WILDFIRE_CONF(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FE000000UL) +#define WILDFIRE_IO(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FF000000UL) + +#define WILDFIRE_qsd(q) \ + ((wildfire_qsd *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSD_ENTITY_SLOW|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_fast_qsd() \ + ((wildfire_fast_qsd *)(WILDFIRE_QBB_IO(0)|WILDFIRE_QSD_ENTITY_FAST|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_qsa(q) \ + ((wildfire_qsa *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSA_ENTITY|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_iop(q) \ + ((wildfire_iop *)(WILDFIRE_QBB_IO(q)|WILDFIRE_IOP_ENTITY|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_gp(q) \ + ((wildfire_gp *)(WILDFIRE_QBB_IO(q)|WILDFIRE_GP_ENTITY|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_pca(q,pca) \ + ((wildfire_pca *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_ne(q,pca) \ + ((wildfire_ne *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(1UL<<16))) + +#define WILDFIRE_fe(q,pca) \ + ((wildfire_fe *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(3UL<<15))) + +#define WILDFIRE_pci(q,h) \ + ((wildfire_pci *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(((h)&6)>>1)|((((h)&1)|2)<<16)|(((1UL<<13)-1)<<23))) + +#define WILDFIRE_IO_BIAS WILDFIRE_IO(0,0) +#define WILDFIRE_MEM_BIAS WILDFIRE_MEM(0,0) /* ??? */ + +/* The IO address space is larger than 0xffff */ +#define WILDFIRE_IO_SPACE (8UL*1024*1024) + +#ifdef __KERNEL__ + +#ifndef __EXTERN_INLINE +#define __EXTERN_INLINE extern inline +#define __IO_EXTERN_INLINE +#endif + +#define vucp volatile unsigned char * +#define vusp volatile unsigned short * +#define vuip volatile unsigned int * +#define vulp volatile unsigned long * + +__EXTERN_INLINE unsigned int wildfire_inb(unsigned long addr) +{ + /* ??? I wish I could get rid of this. But there's no ioremap + equivalent for I/O space. PCI I/O can be forced into the + correct hose's I/O region, but that doesn't take care of + legacy ISA crap. */ + + addr += WILDFIRE_IO_BIAS; + return __kernel_ldbu(*(vucp)addr); +} + +__EXTERN_INLINE void wildfire_outb(unsigned char b, unsigned long addr) +{ + addr += WILDFIRE_IO_BIAS; + __kernel_stb(b, *(vucp)addr); + mb(); +} + +__EXTERN_INLINE unsigned int wildfire_inw(unsigned long addr) +{ + addr += WILDFIRE_IO_BIAS; + return __kernel_ldwu(*(vusp)addr); +} + +__EXTERN_INLINE void wildfire_outw(unsigned short b, unsigned long addr) +{ + addr += WILDFIRE_IO_BIAS; + __kernel_stw(b, *(vusp)addr); + mb(); +} + +__EXTERN_INLINE unsigned int wildfire_inl(unsigned long addr) +{ + addr += WILDFIRE_IO_BIAS; + return *(vuip)addr; +} + +__EXTERN_INLINE void wildfire_outl(unsigned int b, unsigned long addr) +{ + addr += WILDFIRE_IO_BIAS; + *(vuip)addr = b; + mb(); +} + +/* + * Memory functions. all accesses are done through linear space. + */ + +__EXTERN_INLINE unsigned long wildfire_ioremap(unsigned long addr) +{ + return addr + WILDFIRE_MEM_BIAS; +} + +__EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr) +{ + return addr >= WILDFIRE_BASE; +} + +__EXTERN_INLINE unsigned long wildfire_readb(unsigned long addr) +{ + return __kernel_ldbu(*(vucp)addr); +} + +__EXTERN_INLINE unsigned long wildfire_readw(unsigned long addr) +{ + return __kernel_ldwu(*(vusp)addr); +} + +__EXTERN_INLINE unsigned long wildfire_readl(unsigned long addr) +{ + return *(vuip)addr; +} + +__EXTERN_INLINE unsigned long wildfire_readq(unsigned long addr) +{ + return *(vulp)addr; +} + +__EXTERN_INLINE void wildfire_writeb(unsigned char b, unsigned long addr) +{ + __kernel_stb(b, *(vucp)addr); +} + +__EXTERN_INLINE void wildfire_writew(unsigned short b, unsigned long addr) +{ + __kernel_stw(b, *(vusp)addr); +} + +__EXTERN_INLINE void wildfire_writel(unsigned int b, unsigned long addr) +{ + *(vuip)addr = b; +} + +__EXTERN_INLINE void wildfire_writeq(unsigned long b, unsigned long addr) +{ + *(vulp)addr = b; +} + +#undef vucp +#undef vusp +#undef vuip +#undef vulp + +#ifdef __WANT_IO_DEF + +#define __inb(p) wildfire_inb((unsigned long)(p)) +#define __inw(p) wildfire_inw((unsigned long)(p)) +#define __inl(p) wildfire_inl((unsigned long)(p)) +#define __outb(x,p) wildfire_outb((x),(unsigned long)(p)) +#define __outw(x,p) wildfire_outw((x),(unsigned long)(p)) +#define __outl(x,p) wildfire_outl((x),(unsigned long)(p)) +#define __readb(a) wildfire_readb((unsigned long)(a)) +#define __readw(a) wildfire_readw((unsigned long)(a)) +#define __readl(a) wildfire_readl((unsigned long)(a)) +#define __readq(a) wildfire_readq((unsigned long)(a)) +#define __writeb(x,a) wildfire_writeb((x),(unsigned long)(a)) +#define __writew(x,a) wildfire_writew((x),(unsigned long)(a)) +#define __writel(x,a) wildfire_writel((x),(unsigned long)(a)) +#define __writeq(x,a) wildfire_writeq((x),(unsigned long)(a)) +#define __ioremap(a) wildfire_ioremap((unsigned long)(a)) +#define __is_ioaddr(a) wildfire_is_ioaddr((unsigned long)(a)) + +#define inb(p) __inb(p) +#define inw(p) __inw(p) +#define inl(p) __inl(p) +#define outb(x,p) __outb((x),(p)) +#define outw(x,p) __outw((x),(p)) +#define outl(x,p) __outl((x),(p)) +#define __raw_readb(a) __readb(a) +#define __raw_readw(a) __readw(a) +#define __raw_readl(a) __readl(a) +#define __raw_readq(a) __readq(a) +#define __raw_writeb(v,a) __writeb((v),(a)) +#define __raw_writew(v,a) __writew((v),(a)) +#define __raw_writel(v,a) __writel((v),(a)) +#define __raw_writeq(v,a) __writeq((v),(a)) + +#endif /* __WANT_IO_DEF */ + +#ifdef __IO_EXTERN_INLINE +#undef __EXTERN_INLINE +#undef __IO_EXTERN_INLINE +#endif + +#endif /* __KERNEL__ */ + +#endif /* __ALPHA_WILDFIRE__H__ */ diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h index a08aa973c..92c213b27 100644 --- a/include/asm-alpha/floppy.h +++ b/include/asm-alpha/floppy.h @@ -31,6 +31,51 @@ "floppy", NULL) #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); +#ifdef CONFIG_PCI + +#include <linux/pci.h> + +#define fd_dma_setup(addr,size,mode,io) alpha_fd_dma_setup(addr,size,mode,io) + +static __inline__ int +alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io) +{ + static unsigned long prev_size; + static dma_addr_t bus_addr = 0; + static char *prev_addr; + static int prev_dir; + int dir; + + dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE; + + if (bus_addr + && (addr != prev_addr || size != prev_size || dir != prev_dir)) { + /* different from last time -- unmap prev */ + pci_unmap_single(NULL, bus_addr, prev_size, prev_dir); + bus_addr = 0; + } + + if (!bus_addr) /* need to map it */ + bus_addr = pci_map_single(NULL, addr, size, dir); + + /* remember this one as prev */ + prev_addr = addr; + prev_size = size; + prev_dir = dir; + + fd_clear_dma_ff(); + fd_cacheflush(addr, size); + fd_set_dma_mode(mode); + set_dma_addr(FLOPPY_DMA, bus_addr); + fd_set_dma_count(size); + virtual_dma_port = io; + fd_enable_dma(); + + return 0; +} + +#endif /* CONFIG_PCI */ + __inline__ void virtual_dma_init(void) { /* Nothing to do on an Alpha */ diff --git a/include/asm-alpha/hwrpb.h b/include/asm-alpha/hwrpb.h index 39d84de1b..1e8f35fe7 100644 --- a/include/asm-alpha/hwrpb.h +++ b/include/asm-alpha/hwrpb.h @@ -14,9 +14,10 @@ #define EV5_CPU 5 /* EV5 (21164) */ #define EV45_CPU 6 /* EV4.5 (21064/xxx) */ #define EV56_CPU 7 /* EV5.6 (21164) */ -#define EV6_CPU 8 /* EV6 (21164) */ +#define EV6_CPU 8 /* EV6 (21264) */ #define PCA56_CPU 9 /* PCA56 (21164PC) */ #define PCA57_CPU 10 /* PCA57 (notyet) */ +#define EV67_CPU 11 /* EV67 (21264A) */ /* * DEC system types for Alpha systems. Found in HWRPB. @@ -56,6 +57,7 @@ #define ST_DEC_WILDFIRE 35 /* Wildfire systype */ #define ST_DEC_CUSCO 36 /* CUSCO systype */ #define ST_DEC_EIGER 37 /* Eiger systype */ +#define ST_DEC_TITAN 38 /* Titan systype */ /* UNOFFICIAL!!! */ #define ST_UNOFFICIAL_BIAS 100 diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 0e532f6e5..35a9dafc3 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -170,6 +170,10 @@ extern void _sethae (unsigned long addr); /* cached version */ # include <asm/core_t2.h> #elif defined(CONFIG_ALPHA_TSUNAMI) # include <asm/core_tsunami.h> +#elif defined(CONFIG_ALPHA_TITAN) +# include <asm/core_titan.h> +#elif defined(CONFIG_ALPHA_WILDFIRE) +# include <asm/core_wildfire.h> #else #error "What system is this?" #endif diff --git a/include/asm-alpha/irq.h b/include/asm-alpha/irq.h index f9b4d9f12..254d8f17f 100644 --- a/include/asm-alpha/irq.h +++ b/include/asm-alpha/irq.h @@ -16,7 +16,7 @@ many places throughout the kernel to size static arrays. That's ok, we'll use alpha_mv.nr_irqs when we want the real thing. */ -# define NR_IRQS 128 +# define NR_IRQS 2048 /* enuff for WILDFIRE with 8 QBBs */ #elif defined(CONFIG_ALPHA_CABRIOLET) || \ defined(CONFIG_ALPHA_EB66P) || \ @@ -46,10 +46,16 @@ defined(CONFIG_ALPHA_EIGER) # define NR_IRQS 64 +#elif defined(CONFIG_ALPHA_TITAN) +#define NR_IRQS 80 + #elif defined(CONFIG_ALPHA_RAWHIDE) || \ defined(CONFIG_ALPHA_TAKARA) # define NR_IRQS 128 +#elif defined(CONFIG_ALPHA_WILDFIRE) +# define NR_IRQS 2048 /* enuff for 8 QBBs */ + #else /* everyone else */ # define NR_IRQS 16 #endif diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index ef04b09ba..2614e8189 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -45,7 +45,8 @@ /* Number of pointers that fit on a page: this will go away. */ #define PTRS_PER_PAGE (1UL << (PAGE_SHIFT-3)) -#define VMALLOC_START 0xFFFFFE0000000000 +#define CONSOLE_REMAP_START 0xFFFFFE0000000000 +#define VMALLOC_START (CONSOLE_REMAP_START + PMD_SIZE) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (~0UL) diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h index 2b9cf9438..a7cf9557d 100644 --- a/include/asm-alpha/string.h +++ b/include/asm-alpha/string.h @@ -18,7 +18,7 @@ extern void * memmove(void *, const void *, size_t); /* For backward compatibility with modules. Unused otherwise. */ extern void * __memcpy(void *, const void *, size_t); -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) #define memcpy __builtin_memcpy #endif @@ -27,7 +27,7 @@ extern void * __constant_c_memset(void *, unsigned long, size_t); extern void * __memset(void *, int, size_t); extern void * memset(void *, int, size_t); -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) #define memset(s, c, n) \ (__builtin_constant_p(c) \ ? (__builtin_constant_p(n) && (c) == 0 \ diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 919d2b751..4c2f70170 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -22,14 +22,17 @@ /* Remove when official MILO sources have ELF support: */ #define BOOT_SIZE (16*1024) -#define KERNEL_START (PAGE_OFFSET+0x300000) -#define SWAPPER_PGD (PAGE_OFFSET+0x300000) -#define INIT_STACK (PAGE_OFFSET+0x302000) -#define EMPTY_PGT (PAGE_OFFSET+0x304000) -#define EMPTY_PGE (PAGE_OFFSET+0x308000) -#define ZERO_PGE (PAGE_OFFSET+0x30A000) -#define START_ADDR (PAGE_OFFSET+0x310000) +#define KERNEL_START_PHYS 0x800000 /* Wildfire has a huge console */ + +#define KERNEL_START (PAGE_OFFSET+KERNEL_START_PHYS) +#define SWAPPER_PGD KERNEL_START +#define INIT_STACK (PAGE_OFFSET+KERNEL_START_PHYS+0x02000) +#define EMPTY_PGT (PAGE_OFFSET+KERNEL_START_PHYS+0x04000) +#define EMPTY_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x08000) +#define ZERO_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x0A000) + +#define START_ADDR (PAGE_OFFSET+KERNEL_START_PHYS+0x10000) #ifndef __ASSEMBLY__ @@ -111,6 +114,7 @@ struct el_common_EV6_mcheck { }; extern void halt(void) __attribute__((noreturn)); +#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt)) #define prepare_to_switch() do { } while(0) #define switch_to(prev,next,last) \ diff --git a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h index adba04b1f..98c446942 100644 --- a/include/asm-alpha/uaccess.h +++ b/include/asm-alpha/uaccess.h @@ -530,7 +530,7 @@ struct exception_table_entry }; /* Returns 0 if exception not found and fixup.unit otherwise. */ -extern unsigned search_exception_table(unsigned long); +extern unsigned search_exception_table(unsigned long, unsigned long); /* Returns the new pc */ #define fixup_exception(map_reg, fixup_unit, pc) \ diff --git a/include/asm-alpha/unaligned.h b/include/asm-alpha/unaligned.h index 8017f6bfa..cd268017e 100644 --- a/include/asm-alpha/unaligned.h +++ b/include/asm-alpha/unaligned.h @@ -31,7 +31,7 @@ struct __una_u16 { __u16 x __attribute__((packed)); }; extern inline unsigned long __uldq(const unsigned long * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) const struct __una_u64 *ptr = (const struct __una_u64 *) r11; return ptr->x; #else @@ -50,7 +50,7 @@ extern inline unsigned long __uldq(const unsigned long * r11) extern inline unsigned long __uldl(const unsigned int * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) const struct __una_u32 *ptr = (const struct __una_u32 *) r11; return ptr->x; #else @@ -69,7 +69,7 @@ extern inline unsigned long __uldl(const unsigned int * r11) extern inline unsigned long __uldw(const unsigned short * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) const struct __una_u16 *ptr = (const struct __una_u16 *) r11; return ptr->x; #else @@ -92,7 +92,7 @@ extern inline unsigned long __uldw(const unsigned short * r11) extern inline void __ustq(unsigned long r5, unsigned long * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) struct __una_u64 *ptr = (struct __una_u64 *) r11; ptr->x = r5; #else @@ -117,7 +117,7 @@ extern inline void __ustq(unsigned long r5, unsigned long * r11) extern inline void __ustl(unsigned long r5, unsigned int * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) struct __una_u32 *ptr = (struct __una_u32 *) r11; ptr->x = r5; #else @@ -142,7 +142,7 @@ extern inline void __ustl(unsigned long r5, unsigned int * r11) extern inline void __ustw(unsigned long r5, unsigned short * r11) { -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) struct __una_u16 *ptr = (struct __una_u16 *) r11; ptr->x = r5; #else diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index b71c3a708..75453ddfd 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h @@ -315,7 +315,7 @@ #define __NR_mincore 375 #define __NR_pciconfig_iobase 376 -#if defined(__LIBRARY__) && defined(__GNUC__) +#if defined(__GNUC__) #define _syscall_return(type) \ return (_sc_err ? errno = _sc_ret, _sc_ret = -1L : 0), (type) _sc_ret diff --git a/include/asm-arm/arch-arc/hardware.h b/include/asm-arm/arch-arc/hardware.h index 9a9313fa4..294c18b57 100644 --- a/include/asm-arm/arch-arc/hardware.h +++ b/include/asm-arm/arch-arc/hardware.h @@ -25,11 +25,6 @@ #include <asm/memc.h> #define HAS_VIDC -/* - * Optional hardware - */ -#define HAS_EXPMASK - /* Hardware addresses of major areas. * *_START is the physical address * *_SIZE is the size of the region @@ -100,7 +95,6 @@ #endif -#ifdef HAS_EXPMASK #ifndef __ASSEMBLY__ #define __EXPMASK(offset) (((volatile unsigned char *)EXPMASK_BASE)[offset]) #else @@ -111,5 +105,3 @@ #define EXPMASK_ENABLE __EXPMASK(0x04) #endif - -#endif diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h index b3c1f2931..142a2ddbc 100644 --- a/include/asm-arm/arch-ebsa285/hardware.h +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -11,7 +11,7 @@ #include <linux/config.h> #include <asm/arch/memory.h> -#ifdef CONFIG_HOST_FOOTBRIDGE +#ifdef CONFIG_FOOTBRIDGE_HOST /* Virtual Physical Size * 0xff800000 0x40000000 1MB X-Bus * 0xff000000 0x7c000000 1MB PCI I/O space diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index 134729f34..b6f2639b5 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -10,8 +10,6 @@ * 26-Jan-1999 PJB Don't use IACK on CATS * 16-Mar-1999 RMK Added autodetect of ISA PICs */ -/* no need for config.h - arch/arm/kernel/irq.c does this for us */ -#include <linux/config.h> #include <asm/hardware.h> #include <asm/dec21285.h> #include <asm/irq.h> @@ -36,29 +34,31 @@ static int dc21285_irq_mask[] = { IRQ_MASK_PCI, /* 12 */ IRQ_MASK_SDRAMPARITY, /* 13 */ IRQ_MASK_I2OINPOST, /* 14 */ - IRQ_MASK_PCI_ERR /* 15 */ + IRQ_MASK_PCI_ABORT, /* 15 */ + IRQ_MASK_PCI_SERR, /* 16 */ + IRQ_MASK_DISCARD_TIMER, /* 17 */ + IRQ_MASK_PCI_DPERR, /* 18 */ + IRQ_MASK_PCI_PERR, /* 19 */ }; static int isa_irq = -1; static inline int fixup_irq(unsigned int irq) { -#ifdef CONFIG_HOST_FOOTBRIDGE if (irq == isa_irq) irq = *(unsigned char *)PCIIACK_BASE; -#endif return irq; } static void dc21285_mask_irq(unsigned int irq) { - *CSR_IRQ_DISABLE = dc21285_irq_mask[irq & 15]; + *CSR_IRQ_DISABLE = dc21285_irq_mask[_DC21285_INR(irq)]; } static void dc21285_unmask_irq(unsigned int irq) { - *CSR_IRQ_ENABLE = dc21285_irq_mask[irq & 15]; + *CSR_IRQ_ENABLE = dc21285_irq_mask[_DC21285_INR(irq)]; } static void isa_mask_pic_lo_irq(unsigned int irq) @@ -124,7 +124,7 @@ static __inline__ void irq_init_irq(void) *CSR_IRQ_DISABLE = -1; *CSR_FIQ_DISABLE = -1; - for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(16); irq++) { + for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(20); irq++) { irq_desc[irq].valid = 1; irq_desc[irq].probe_ok = 1; irq_desc[irq].mask_ack = dc21285_mask_irq; @@ -138,19 +138,21 @@ static __inline__ void irq_init_irq(void) */ isa_irq = -1; - if (machine_is_ebsa285()) - /* The following is dependent on which slot - * you plug the Southbridge card into. We - * currently assume that you plug it into - * the right-hand most slot. - */ - isa_irq = IRQ_PCI; + if (footbridge_cfn_mode()) { + if (machine_is_ebsa285()) + /* The following is dependent on which slot + * you plug the Southbridge card into. We + * currently assume that you plug it into + * the right-hand most slot. + */ + isa_irq = IRQ_PCI; - if (machine_is_cats()) - isa_irq = IRQ_IN2; + if (machine_is_cats()) + isa_irq = IRQ_IN2; - if (machine_is_netwinder()) - isa_irq = IRQ_IN3; + if (machine_is_netwinder()) + isa_irq = IRQ_IN3; + } if (isa_irq != -1) { /* diff --git a/include/asm-arm/arch-ebsa285/irqs.h b/include/asm-arm/arch-ebsa285/irqs.h index afb2e379d..9ad99a458 100644 --- a/include/asm-arm/arch-ebsa285/irqs.h +++ b/include/asm-arm/arch-ebsa285/irqs.h @@ -9,11 +9,13 @@ * 01-Feb-1999 PJB ISA IRQs start at 0 not 16 */ -#define NR_IRQS 32 +#define NR_IRQS 36 #define NR_DC21285_IRQS 16 #define _ISA_IRQ(x) (0 + (x)) +#define _ISA_INR(x) ((x) - 0) #define _DC21285_IRQ(x) (16 + (x)) +#define _DC21285_INR(x) ((x) - 16) /* * This is a list of all interrupts that the 21285 @@ -34,7 +36,11 @@ #define IRQ_PCI _DC21285_IRQ(12) #define IRQ_SDRAMPARITY _DC21285_IRQ(13) #define IRQ_I2OINPOST _DC21285_IRQ(14) -#define IRQ_PCI_ERR _DC21285_IRQ(15) +#define IRQ_PCI_ABORT _DC21285_IRQ(15) +#define IRQ_PCI_SERR _DC21285_IRQ(16) +#define IRQ_DISCARD_TIMER _DC21285_IRQ(17) +#define IRQ_PCI_DPERR _DC21285_IRQ(18) +#define IRQ_PCI_PERR _DC21285_IRQ(19) #define IRQ_ISA_TIMER _ISA_IRQ(0) #define IRQ_ISA_KEYBOARD _ISA_IRQ(1) @@ -64,7 +70,11 @@ #define IRQ_MASK_PCI (1 << 18) #define IRQ_MASK_SDRAMPARITY (1 << 24) #define IRQ_MASK_I2OINPOST (1 << 25) -#define IRQ_MASK_PCI_ERR ((1 <<23) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30) | (1 << 31)) +#define IRQ_MASK_PCI_ABORT ((1 << 29) | (1 << 30)) +#define IRQ_MASK_PCI_SERR (1 << 23) +#define IRQ_MASK_DISCARD_TIMER (1 << 27) +#define IRQ_MASK_PCI_DPERR (1 << 28) +#define IRQ_MASK_PCI_PERR (1 << 31) /* * Netwinder interrupt allocations diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h index 14ba9d4fd..18d7dacb0 100644 --- a/include/asm-arm/arch-ebsa285/memory.h +++ b/include/asm-arm/arch-ebsa285/memory.h @@ -17,7 +17,7 @@ #include <linux/config.h> -#if defined(CONFIG_HOST_FOOTBRIDGE) +#if defined(CONFIG_FOOTBRIDGE_HOST) /* * Task size: 3GB @@ -36,7 +36,7 @@ #define __bus_to_virt__is_a_macro #define __bus_to_virt(x) ((x) + 0xe0000000) -#elif defined(CONFIG_ADDIN_FOOTBRIDGE) +#elif defined(CONFIG_FOOTBRIDGE_ADDIN) #if defined(CONFIG_ARCH_CO285) diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h index 222419960..ab7183140 100644 --- a/include/asm-arm/arch-rpc/hardware.h +++ b/include/asm-arm/arch-rpc/hardware.h @@ -93,7 +93,6 @@ #endif -#ifdef HAS_EXPMASK #ifndef __ASSEMBLY__ #define __EXPMASK(offset) (((volatile unsigned char *)EXPMASK_BASE)[offset]) #else @@ -104,5 +103,3 @@ #define EXPMASK_ENABLE __EXPMASK(0x04) #endif - -#endif diff --git a/include/asm-arm/arch-sa1100/assabet.h b/include/asm-arm/arch-sa1100/assabet.h new file mode 100644 index 000000000..75bd395a5 --- /dev/null +++ b/include/asm-arm/arch-sa1100/assabet.h @@ -0,0 +1,154 @@ +/* + * linux/include/asm-arm/arch-sa1100/assabet.h + * + * Created 2000/06/05 by Nicolas Pitre <nico@cam.org> + * + * This file contains the hardware specific definitions for Assabet + * + * 2000/05/23 John Dorsey <john+@cs.cmu.edu> + * Definitions for Neponset added. + */ + +#ifndef __ASM_ARCH_HARDWARE_H +#error "include <asm/hardware.h> instead" +#endif + + +/* System Configuration Register flags */ + +#define SCR_SDRAM_LOW (1<<2) /* SDRAM size (low bit) */ +#define SCR_SDRAM_HIGH (1<<3) /* SDRAM size (high bit) */ +#define SCR_FLASH_LOW (1<<4) /* Flash size (low bit) */ +#define SCR_FLASH_HIGH (1<<5) /* Flash size (high bit) */ +#define SCR_GFX (1<<8) /* Graphics Accelerator (0 = present) */ +#define SCR_SA1111 (1<<9) /* Neponset (0 = present) */ + +#define SCR_INIT -1 + + +/* Board Control Register */ + +#define BCR_BASE 0xdc000000 +#define BCR (*(volatile unsigned int *)(BCR_BASE)) + +#define BCR_DB1110 (0x00A07410) +#define BCR_DB1111 (0x00A07462) + +#define BCR_CF_PWR (1<<0) /* Compact Flash Power (1 = 3.3v, 0 = off) */ +#define BCR_CF_RST (1<<1) /* Compact Flash Reset (1 = power up reset) */ +#define BCR_GFX_RST (1<<1) /* Graphics Accelerator Reset (0 = hold reset) */ +#define BCR_CODEC_RST (1<<2) /* 0 = Holds UCB1300, ADI7171, and UDA1341 in reset */ +#define BCR_IRDA_FSEL (1<<3) /* IRDA Frequency select (0 = SIR, 1 = MIR/ FIR) */ +#define BCR_IRDA_MD0 (1<<4) /* Range/Power select */ +#define BCR_IRDA_MD1 (1<<5) /* Range/Power select */ +#define BCR_STEREO_LB (1<<6) /* Stereo Loopback */ +#define BCR_CF_BUS_OFF (1<<7) /* Compact Flash bus (0 = on, 1 = off (float)) */ +#define BCR_AUDIO_ON (1<<8) /* Audio power on */ +#define BCR_LIGHT_ON (1<<9) /* Backlight */ +#define BCR_LCD_12RGB (1<<10) /* 0 = 16RGB, 1 = 12RGB */ +#define BCR_LCD_ON (1<<11) /* LCD power on */ +#define BCR_RS232EN (1<<12) /* RS232 transceiver enable */ +#define BCR_LED_RED (1<<13) /* D9 (0 = on, 1 = off) */ +#define BCR_LED_GREEN (1<<14) /* D8 (0 = on, 1 = off) */ +#define BCR_VIB_ON (1<<15) /* Vibration motor (quiet alert) */ +#define BCR_COM_DTR (1<<16) /* COMport Data Terminal Ready */ +#define BCR_COM_RTS (1<<17) /* COMport Request To Send */ +#define BCR_RAD_WU (1<<18) /* Radio wake up interrupt */ +#define BCR_SMB_EN (1<<19) /* System management bus enable */ +#define BCR_TV_IR_DEC (1<<20) /* TV IR Decode Enable */ +#define BCR_QMUTE (1<<21) /* Quick Mute */ +#define BCR_RAD_ON (1<<22) /* Radio Power On */ +#define BCR_SPK_OFF (1<<23) /* 1 = Speaker amplifier power off */ + +#ifndef __ASSEMBLY__ +extern unsigned long SCR_value; +extern unsigned long BCR_value; +#define BCR_set( x ) BCR = (BCR_value |= (x)) +#define BCR_clear( x ) BCR = (BCR_value &= ~(x)) +#endif + + +/* GPIOs for which the generic definition doesn't say much */ +#define GPIO_RADIO_IRQ GPIO_GPIO (14) /* Radio interrupt request */ +#define GPIO_L3_I2C_SDA GPIO_GPIO (15) /* L3 and SMB control ports */ +#define GPIO_PS_MODE_SYNC GPIO_GPIO (16) /* Power supply mode/sync */ +#define GPIO_L3_MODE GPIO_GPIO (17) /* L3 mode signal with LED */ +#define GPIO_L3_I2C_SCL GPIO_GPIO (18) /* L3 and I2C control ports */ +#define GPIO_STEREO_64FS_CLK GPIO_GPIO (19) /* SSP UDA1341 clock input */ +#define GPIO_CF_IRQ GPIO_GPIO (21) /* CF IRQ */ +#define GPIO_MBGNT GPIO_GPIO (21) /* 1111 MBGNT */ +#define GPIO_CF_CD GPIO_GPIO (22) /* CF CD */ +#define GPIO_MBREQ GPIO_GPIO (22) /* 1111 MBREQ */ +#define GPIO_UCB1300_IRQ GPIO_GPIO (23) /* UCB GPIO and touchscreen */ +#define GPIO_CF_BVD2 GPIO_GPIO (24) /* CF BVD */ +#define GPIO_GFX_IRQ GPIO_GPIO (24) /* Graphics IRQ */ +#define GPIO_CF_BVD1 GPIO_GPIO (25) /* CF BVD */ +#define GPIO_NEP_IRQ GPIO_GPIO (25) /* Neponset IRQ */ +#define GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */ +#define GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */ + +#define IRQ_GPIO_CF_IRQ IRQ_GPIO21 +#define IRQ_GPIO_CF_CD IRQ_GPIO22 +#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO23 +#define IRQ_GPIO_CF_BVD2 IRQ_GPIO24 +#define IRQ_GPIO_CF_BVD1 IRQ_GPIO25 +#define IRQ_GPIO_NEP_IRQ IRQ_GPIO25 + + +/* + * Neponset definitions: + */ + +#define SA1111_BASE (0x40000000) + +#define NEPONSET_ETHERNET_IRQ MISC_IRQ0 +#define NEPONSET_USAR_IRQ MISC_IRQ1 + +#define NEPONSET_CPLD_BASE (0x10000000) +#define Nep_p2v( x ) ((x) - NEPONSET_CPLD_BASE + 0xd4000000) +#define Nep_v2p( x ) ((x) - 0xd4000000 + NEPONSET_CPLD_BASE) + +#define _IRR 0x10000024 /* Interrupt Reason Register */ +#define _AUD_CTL 0x100000c0 /* Audio controls (RW) */ +#define _MDM_CTL_0 0x100000b0 /* Modem control 0 (RW) */ +#define _MDM_CTL_1 0x100000b4 /* Modem control 1 (RW) */ +#define _NCR_0 0x100000a0 /* Control Register (RW) */ +#define _KP_X_OUT 0x10000090 /* Keypad row write (RW) */ +#define _KP_Y_IN 0x10000080 /* Keypad column read (RO) */ +#define _SWPK 0x10000020 /* Switch pack (RO) */ +#define _WHOAMI 0x10000000 /* System ID Register (RO) */ + +#define _LEDS 0x10000010 /* LEDs [31:0] (WO) */ + +#ifndef __ASSEMBLY__ + +#define IRR (*((volatile u_char *) Nep_p2v(_IRR))) +#define AUD_CTL (*((volatile u_char *) Nep_p2v(_AUD_CTL))) +#define MDM_CTL_0 (*((volatile u_char *) Nep_p2v(_MDM_CTL_0))) +#define MDM_CTL_1 (*((volatile u_char *) Nep_p2v(_MDM_CTL_1))) +#define NCR_0 (*((volatile u_char *) Nep_p2v(_NCR_0))) +#define KP_X_OUT (*((volatile u_char *) Nep_p2v(_KP_X_OUT))) +#define KP_Y_IN (*((volatile u_char *) Nep_p2v(_KP_Y_IN))) +#define SWPK (*((volatile u_char *) Nep_p2v(_SWPK))) +#define WHOAMI (*((volatile u_char *) Nep_p2v(_WHOAMI))) + +#define LEDS (*((volatile Word *) Nep_p2v(_LEDS))) + +#endif + +#define IRR_ETHERNET (1<<0) +#define IRR_USAR (1<<1) +#define IRR_SA1111 (1<<2) + +#define NCR_GP01_OFF (1<<0) +#define NCR_TP_PWR_EN (1<<1) +#define NCR_MS_PWR_EN (1<<2) +#define NCR_ENET_OSC_EN (1<<3) +#define NCR_SPI_KB_WK_UP (1<<4) +#define NCR_A0VPP (1<<5) +#define NCR_A1VPP (1<<6) + +#ifndef __ASSEMBLY__ +#define machine_has_neponset() ((SCR_value & SCR_SA1111) == 0) +#endif + diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h index e93cbe7d9..b0b959413 100644 --- a/include/asm-arm/arch-sa1100/hardware.h +++ b/include/asm-arm/arch-sa1100/hardware.h @@ -1,26 +1,112 @@ /* - * linux/include/asm-arm/arch-brutus/hardware.h + * linux/include/asm-arm/arch-sa1100/hardware.h * * Copyright (C) 1998 Nicolas Pitre <nico@cam.org> * * This file contains the hardware definitions for SA1100 architecture + * + * 2000/05/23 John Dorsey <john+@cs.cmu.edu> + * Definitions for SA1111 added. */ #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H + /* Flushing areas */ #define FLUSH_BASE_PHYS 0xe0000000 /* SA1100 zero bank */ #define FLUSH_BASE 0xdf000000 #define FLUSH_BASE_MINICACHE 0xdf800000 #define UNCACHEABLE_ADDR 0xfa050000 + +/* + * We requires absolute addresses i.e. (0xe00000 + 0x3f8) for in*()/out*() + * macros to be useful for all cases. + */ +#define PCIO_BASE 0 + + +/* + * SA1100 internal I/O mappings + * + * We have the following mapping: + * phys virt + * 80000000 f8000000 + * 90000000 fa000000 + * a0000000 fc000000 + * b0000000 fe000000 + * + * Nb: PCMCIA is mapped from 0xe0000000 to f7ffffff in mm-sa1100.c + */ + +#define VIO_BASE 0xf8000000 /* virtual start of IO space */ +#define VIO_SHIFT 3 /* x = IO space shrink power */ +#define PIO_START 0x80000000 /* physical start of IO space */ + +#define io_p2v( x ) \ + ( (((x)&0x00ffffff) | (((x)&0x30000000)>>VIO_SHIFT)) + VIO_BASE ) +#define io_v2p( x ) \ + ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START ) + +#include "SA-1100.h" + + +/* + * SA1100 GPIO edge detection for IRQs: + * IRQs are generated on Falling-Edge, Rising-Edge, or both. + * This must be called *before* the corresponding IRQ is registered. + * Use this instead of directly setting GRER/GFER. + */ +#define GPIO_FALLING_EDGE 1 +#define GPIO_RISING_EDGE 2 +#define GPIO_BOTH_EDGES 3 +#ifndef __ASSEMBLY__ +extern void set_GPIO_IRQ_edge( int gpio_mask, int edge_mask ); +#endif + + +/* + * Implementation specifics + */ + +#ifdef CONFIG_SA1100_ASSABET +#include "assabet.h" +#else +#define machine_has_neponset() (0) +#endif + +#ifdef CONFIG_SA1100_EMPEG +#include "empeg.h" +#endif + +#if defined(CONFIG_SA1100_GRAPHICSCLIENT) || defined(CONFIG_SA1100_THINCLIENT) +#include "thinclient.h" +#endif + + +#ifdef CONFIG_SA1101 + /* - * PCMCIA IO is mapped to 0xe0000000. We are likely to use in*()/out*() - * IO macros for what might appear there... - * The SA1100 PCMCIA interface can be seen like a PC ISA bus for IO. + * We have mapped the sa1101 depending on the value of SA1101_BASE. + * It then appears from 0xdc000000. */ -#define PCIO_BASE 0xe0000000 /* PCMCIA0 IO space */ + +#define SA1101_p2v( x ) ((x) - SA1101_BASE + 0xdc000000) +#define SA1101_v2p( x ) ((x) - 0xdc000000 + SA1101_BASE) + +#include "SA-1101.h" + +#endif + + +#ifdef CONFIG_SA1111 + +#define SA1111_p2v( x ) ((x) - SA1111_BASE + 0xd8000000) +#define SA1111_v2p( x ) ((x) - 0xd8000000 + SA1111_BASE) + +#include "SA-1111.h" #endif +#endif /* _ASM_ARCH_HARDWARE_H */ diff --git a/include/asm-arm/arch-sa1100/irq.h b/include/asm-arm/arch-sa1100/irq.h index 3289801ac..6f447f497 100644 --- a/include/asm-arm/arch-sa1100/irq.h +++ b/include/asm-arm/arch-sa1100/irq.h @@ -11,106 +11,296 @@ * 17-02-1999 NP empeg henry ugly hacks now in a separate file ;) * 11-08-1999 PD SA1101 support added * 25-09-1999 RMK Merged into main ARM tree, cleaned up + * 12-05-2000 NP IRQ dispatcher handler for GPIO 11 to 27. + * 26-05-2000 JD SA-1111 support added */ #include <linux/config.h> -static inline unsigned int fixup_irq(unsigned int irq) +#define fixup_irq(x) (x) + +/* + * We don't need to ACK IRQs on the SA1100 unless they're GPIOs + * this is for internal IRQs i.e. from 11 to 31. + */ + +static void sa1100_mask_irq(unsigned int irq) { -#ifdef CONFIG_SA1101 - if (irq == SA1101_IRQ) { - unsigned long mask; - mask = INTSTATCLR0 & INTENABLE0; - irq = 32; - if (!mask) { - mask = IRQSTATCLR1 & INTENABLE1; - irq = 64; - } - if (mask) - while ((mask & 1) == 0) { - mask >>= 1; - irq += 1; - } - } -#endif - return irq; + ICMR &= ~(1 << irq); +} + +static void sa1100_unmask_irq(unsigned int irq) +{ + ICMR |= (1 << irq); } -/* We don't need to ACK IRQs on the SA1100 unless they're <= 10, - * ie, an edge-detect. +/* + * SA1100 GPIO edge detection for IRQs. */ -static void sa1100_mask_and_ack_irq(unsigned int irq) +extern int GPIO_IRQ_rising_edge; +extern int GPIO_IRQ_falling_edge; + +/* + * GPIO IRQs must be acknoledged. This is for IRQs from 0 to 10. + */ + +static void sa1100_mask_and_ack_GPIO0_10_irq(unsigned int irq) { ICMR &= ~(1 << irq); - if (irq <= 10) - GEDR = 1 << irq; + GEDR = (1 << irq); } -static void sa1100_mask_irq(unsigned int irq) +static void sa1100_mask_GPIO0_10_irq(unsigned int irq) { ICMR &= ~(1 << irq); } -static void sa1100_unmask_irq(unsigned int irq) +static void sa1100_unmask_GPIO0_10_irq(unsigned int irq) +{ + GRER = (GRER & ~(1 << irq)) | (GPIO_IRQ_rising_edge & (1 << irq)); + GFER = (GFER & ~(1 << irq)) | (GPIO_IRQ_falling_edge & (1 << irq)); + ICMR |= (1 << irq); +} + +/* + * Install handler for GPIO 11-27 edge detect interrupts + */ + +void do_IRQ(int irq, struct pt_regs * regs); + +static int GPIO_11_27_enabled; /* enabled i.e. unmasked GPIO IRQs */ +static int GPIO_11_27_spurious; /* GPIOs that triggered when masked */ + +static void sa1100_GPIO11_27_demux(int irq, void *dev_id, + struct pt_regs *regs) +{ + int i, irq, spurious; + + while( (irq = (GEDR & 0xfffff800)) ){ + /* + * We don't want to clear GRER/GFER when the corresponding + * IRQ is masked because we could miss a level transition + * i.e. an IRQ which need servicing as soon as it is + * unmasked. However, such situation should happen only + * during the loop below. Thus all IRQs which aren't + * enabled at this point are considered spurious. Those + * are cleared but only de-activated if they happened twice. + */ + spurious = irq & ~GPIO_11_27_enabled; + if (spurious) { + GEDR = spurious; + GRER &= ~(spurious & GPIO_11_27_spurious); + GFER &= ~(spurious & GPIO_11_27_spurious); + GPIO_11_27_spurious |= spurious; + irq ^= spurious; + if (!irq) continue; + } + + for (i = 11; i <= 27; ++i) { + if (irq & (1<<i)) { + do_IRQ( IRQ_GPIO_11_27(i), regs ); + } + } + } +} + +static struct irqaction GPIO11_27_irq = { + name: "GPIO 11-27", + handler: sa1100_GPIO11_27_demux, + flags: SA_INTERRUPT +}; + +static void sa1100_mask_and_ack_GPIO11_27_irq(unsigned int irq) +{ + int mask = (1 << GPIO_11_27_IRQ(irq)); + GPIO_11_27_enabled &= ~mask; + GEDR = mask; +} + +static void sa1100_mask_GPIO11_27_irq(unsigned int irq) +{ + GPIO_11_27_enabled &= ~(1 << GPIO_11_27_IRQ(irq)); +} + +static void sa1100_unmask_GPIO11_27_irq(unsigned int irq) { - ICMR |= 1 << irq; + int mask = (1 << GPIO_11_27_IRQ(irq)); + GPIO_11_27_enabled |= mask; + GPIO_11_27_spurious &= ~mask; + GRER = (GRER & ~mask) | (GPIO_IRQ_rising_edge & mask); + GFER = (GFER & ~mask) | (GPIO_IRQ_falling_edge & mask); } -#ifdef CONFIG_SA1101 -static void sa1101_mask_and_ack_lowirq(unsigned int irq) +#if defined(CONFIG_SA1111) + +/* + * Install handler for SA1111 IRQ handler. + */ + +static void sa1111_IRQ_demux( int irq, void *dev_id, struct pt_regs *regs ) { - unsigned int mask = 1 << (irq & 31); + int i; + unsigned long stat0, stat1; + + while( (stat0 = INTSTATCLR0) && (stat1 = INTSTATCLR1) ){ + if( stat0 ) + for( i = 0; i < 32; i++ ) + if( stat0 & (1<<i) ) + do_IRQ( SA1111_IRQ(i), regs ); - INTENABLE0 &= ~mask; - GEDR = 1 << SA1101_IRQ; + if( stat1 ) + for( i = 32; i < 55; i++ ) + if( stat1 & (1<<(i-32)) ) + do_IRQ( SA1111_IRQ(i), regs ); + } +} + +static struct irqaction sa1111_irq = { + name: "SA1111", + handler: sa1111_IRQ_demux, + flags: SA_INTERRUPT +}; + +static void sa1111_mask_and_ack_lowirq(unsigned int irq) +{ + unsigned int mask = 1 << (irq - SA1111_IRQ(0)); + + //INTEN0 &= ~mask; INTSTATCLR0 = mask; } -static void sa1101_mask_and_ack_highirq(unsigned int irq) +static void sa1111_mask_and_ack_highirq(unsigned int irq) { - unsigned int mask = 1 << (irq & 31); + unsigned int mask = 1 << (irq - SA1111_IRQ(32)); - INTENABLE1 &= ~mask; - GEDR = 1 << SA1101_IRQ; + //INTEN1 &= ~mask; INTSTATCLR1 = mask; } -static void sa1101_mask_lowirq(unsigned int irq) +static void sa1111_mask_lowirq(unsigned int irq) { - unsigned int mask = 1 << (irq & 31); + //INTEN0 &= ~(1 << (irq - SA1111_IRQ(0))); +} - INTENABLE0 &= ~mask; +static void sa1111_mask_highirq(unsigned int irq) +{ + //INTEN1 &= ~(1 << (irq - SA1111_IRQ(32))); } -static void sa1101_mask_highirq(unsigned int irq) +static void sa1111_unmask_lowirq(unsigned int irq) +{ + INTEN0 |= 1 << (irq - SA1111_IRQ(0)); +} + +static void sa1111_unmask_highirq(unsigned int irq) +{ + INTEN1 |= 1 << ((irq - SA1111_IRQ(32))); +} + +#endif /* CONFIG_SA1111 */ + + +#ifdef CONFIG_ASSABET_NEPONSET + +/* + * Install handler for Neponset IRQ. Yes, yes... we are way down the IRQ + * cascade which is not good for IRQ latency, but the hardware has been + * designed that way... + */ + +static void neponset_IRQ_demux( int irq, void *dev_id, struct pt_regs *regs ) { - unsigned int mask = 1 << (irq & 31); + int irr; - INTENABLE1 &= ~mask; + for(;;){ + irr = IRR & (IRR_ETHERNET | IRR_USAR | IRR_SA1111); + /* Let's have all active IRQ bits high. + * Note: there is a typo in the Neponset user's guide + * for the SA1111 IRR level. + */ + irr ^= (IRR_ETHERNET | IRR_USAR); + if (!irr) break; + + if( irr & IRR_ETHERNET ) + do_IRQ(NEPONSET_ETHERNET_IRQ, regs); + + if( irr & IRR_USAR ) + do_IRQ(NEPONSET_USAR_IRQ, regs); + + if( irr & IRR_SA1111 ) + sa1111_IRQ_demux(irq, dev_id, regs); + } } +static struct irqaction neponset_irq = { + name: "Neponset", + handler: neponset_IRQ_demux, + flags: SA_INTERRUPT +}; + +#endif + + +#if defined(CONFIG_SA1100_GRAPHICSCLIENT) || defined(CONFIG_SA1100_THINCLIENT) + /* - * unmasking an IRq with the wrong polarity can be - * fatal, but there is no need to check this in the - * interrupt code - it will be spotted anyway ;-) + * IRQ handler for the ThinClient/GraphicsClient external IRQ controller */ -static void sa1101_unmask_lowirq(unsigned int irq) + +static void ADS_IRQ_demux( int irq, void *dev_id, struct pt_regs *regs ) { - unsigned int mask = 1 << (irq & 31); + int irq, i; - INTENABLE0 |= mask; - ICMR |= 1 << SA1101_IRQ; + while( (irq = ADS_INT_ST1 | (ADS_INT_ST2 << 8)) ){ + for( i = 0; i < 16; i++ ) + if( irq & (1<<i) ) + do_IRQ( ADS_EXT_IRQ(i), regs ); + } } -static void sa1101_unmask_highirq(unsigned int irq) +static struct irqaction ADS_ext_irq = { + name: "ADS_ext_IRQ", + handler: ADS_IRQ_demux, + flags: SA_INTERRUPT +}; + +static void ADS_mask_and_ack_irq0(unsigned int irq) { - unsigned int mask = 1 << (irq & 31); + int mask = (1 << (irq - ADS_EXT_IRQ(0))); + ADS_INT_EN1 &= ~mask; + ADS_INT_ST1 = mask; +} + +static void ADS_mask_irq0(unsigned int irq) +{ + ADS_INT_ST1 = (1 << (irq - ADS_EXT_IRQ(0))); +} - INTENABLE1 |= mask; - ICMR |= 1 << SA1101_IRQ; +static void ADS_unmask_irq0(unsigned int irq) +{ + ADS_INT_EN1 |= (1 << (irq - ADS_EXT_IRQ(0))); +} + +static void ADS_mask_and_ack_irq1(unsigned int irq) +{ + int mask = (1 << (irq - ADS_EXT_IRQ(8))); + ADS_INT_EN2 &= ~mask; + ADS_INT_ST2 = mask; } + +static void ADS_mask_irq1(unsigned int irq) +{ + ADS_INT_ST2 = (1 << (irq - ADS_EXT_IRQ(8))); +} + +static void ADS_unmask_irq1(unsigned int irq) +{ + ADS_INT_EN2 |= (1 << (irq - ADS_EXT_IRQ(8))); +} + #endif + static __inline__ void irq_init_irq(void) { int irq; @@ -122,64 +312,116 @@ static __inline__ void irq_init_irq(void) ICLR = 0; /* clear all GPIO edge detects */ + GFER = 0; + GRER = 0; GEDR = -1; -#ifdef CONFIG_SA1101 - /* turn on interrupt controller */ - SKPCR |= 4; - - /* disable all IRQs */ - INTENABLE0 = 0; - INTENABLE1 = 0; - - /* detect on rising edge */ - INTPOL0 = 0; - INTPOL1 = 0; - - /* clear all IRQs */ - INTSTATCLR0 = -1; - INTSTATCLR1 = -1; - - /* SA1101 generates a rising edge */ - GRER |= 1 << SA1101_IRQ; - GPER &= ~(1 << SA1101_IRQ); -#endif - /* * Whatever the doc says, this has to be set for the wait-on-irq * instruction to work... on a SA1100 rev 9 at least. */ ICCR = 1; -#ifndef CONFIG_SA1101 - for (irq = 0; irq < NR_IRQS; irq++) { + for (irq = 0; irq <= 10; irq++) { irq_desc[irq].valid = 1; irq_desc[irq].probe_ok = 1; - irq_desc[irq].mask_ack = sa1100_mask_and_ack_irq; - irq_desc[irq].mask = sa1100_mask_irq; - irq_desc[irq].unmask = sa1100_unmask_irq; + irq_desc[irq].mask_ack = sa1100_mask_and_ack_GPIO0_10_irq; + irq_desc[irq].mask = sa1100_mask_GPIO0_10_irq; + irq_desc[irq].unmask = sa1100_unmask_GPIO0_10_irq; } -#else - for (irq = 0; irq < 31; irq++) { + + for (irq = 11; irq <= 31; irq++) { irq_desc[irq].valid = 1; - irq_desc[irq].probe_ok = 1; - irq_desc[irq].mask_ack = sa1100_mask_and_ack_irq; + irq_desc[irq].probe_ok = 0; + irq_desc[irq].mask_ack = sa1100_mask_irq; irq_desc[irq].mask = sa1100_mask_irq; irq_desc[irq].unmask = sa1100_unmask_irq; } - for (irq = 32; irq < 63; irq++) { + + for (irq = 32; irq <= 48; irq++) { irq_desc[irq].valid = 1; irq_desc[irq].probe_ok = 1; - irq_desc[irq].mask_ack = sa1101_mask_and_ack_lowirq; - irq_desc[irq].mask = sa1101_mask_lowirq; - irq_desc[irq].unmask = sa1101_unmask_lowirq; + irq_desc[irq].mask_ack = sa1100_mask_and_ack_GPIO11_27_irq; + irq_desc[irq].mask = sa1100_mask_GPIO11_27_irq; + irq_desc[irq].unmask = sa1100_unmask_GPIO11_27_irq; } - for (irq = 64; irq < NR_IRQS; irq++) { - irq_desc[irq].valid = 1; - irq_desc[irq].probe_ok = 1; - irq_desc[irq].mask_ack = sa1101_mask_and_ack_highirq; - irq_desc[irq].mask = sa1101_mask_highirq; - irq_desc[irq].unmask = sa1101_unmask_highirq; + setup_arm_irq( IRQ_GPIO11_27, &GPIO11_27_irq ); + +#ifdef CONFIG_SA1111 + if( machine_is_assabet() && machine_has_neponset() ){ + + /* disable all IRQs */ + INTEN0 = 0; + INTEN1 = 0; + + /* detect on rising edge */ + INTPOL0 = 0; + INTPOL1 = 0; + + /* clear all IRQs */ + INTSTATCLR0 = -1; + INTSTATCLR1 = -1; + + for (irq = SA1111_IRQ(0); irq <= SA1111_IRQ(26); irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = sa1111_mask_and_ack_lowirq; + irq_desc[irq].mask = sa1111_mask_lowirq; + irq_desc[irq].unmask = sa1111_unmask_lowirq; + } + for (irq = SA1111_IRQ(32); irq <= SA1111_IRQ(54); irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = sa1111_mask_and_ack_highirq; + irq_desc[irq].mask = sa1111_mask_highirq; + irq_desc[irq].unmask = sa1111_unmask_highirq; + } + + if( machine_has_neponset() ){ + /* setup extra Neponset IRQs */ + irq = NEPONSET_ETHERNET_IRQ; + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq = NEPONSET_USAR_IRQ; + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + set_GPIO_IRQ_edge( GPIO_NEP_IRQ, GPIO_RISING_EDGE ); + setup_arm_irq( IRQ_GPIO_NEP_IRQ, &neponset_irq ); + }else{ + /* for pure SA1111 designs to come (currently unused) */ + set_GPIO_IRQ_edge( 0, GPIO_RISING_EDGE ); + setup_arm_irq( -1, &sa1111_irq ); + } } #endif + +#if defined(CONFIG_SA1100_GRAPHICSCLIENT) || defined(CONFIG_SA1100_THINCLIENT) + if( machine_is_graphicsclient() || machine_is_thinclient() ){ + /* disable all IRQs */ + ADS_INT_EN1 = 0; + ADS_INT_EN2 = 0; + /* clear all IRQs */ + ADS_INT_ST1 = 0xff; + ADS_INT_ST2 = 0xff; + + for (irq = ADS_EXT_IRQ(0); irq <= ADS_EXT_IRQ(7); irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = ADS_mask_and_ack_irq0; + irq_desc[irq].mask = ADS_mask_irq0; + irq_desc[irq].unmask = ADS_unmask_irq0; + } + for (irq = ADS_EXT_IRQ(8); irq <= ADS_EXT_IRQ(15); irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = ADS_mask_and_ack_irq1; + irq_desc[irq].mask = ADS_mask_irq1; + irq_desc[irq].unmask = ADS_unmask_irq1; + } + GPDR &= ~GPIO_GPIO0; + set_GPIO_IRQ_edge(GPIO_GPIO0, GPIO_FALLING_EDGE); + setup_arm_irq( IRQ_GPIO0, &ADS_ext_irq ); + } +#endif + } diff --git a/include/asm-arm/arch-sa1100/irqs.h b/include/asm-arm/arch-sa1100/irqs.h index 246ad9344..909247f72 100644 --- a/include/asm-arm/arch-sa1100/irqs.h +++ b/include/asm-arm/arch-sa1100/irqs.h @@ -3,110 +3,151 @@ * * Copyright (C) 1996 Russell King * Copyright (C) 1998 Deborah Wallach (updates for SA1100/Brutus). + * Copyright (C) 1999 Nicolas Pitre (full GPIO irq isolation) */ + #include <linux/config.h> -#ifdef CONFIG_SA1101 -#define NR_IRQS 95 - -#define GPAIN0 32 -#define GPAIN1 33 -#define GPAIN2 34 -#define GPAIN3 35 -#define GPAIN4 36 -#define GPAIN5 37 -#define GPAIN6 38 -#define GPAIN7 39 -#define GPBIN0 40 -#define GPBIN1 41 -#define GPBIN2 42 -#define GPBIN3 43 -#define GPBIN4 44 -#define GPBIN5 45 -#define GPBIN6 46 -#define RESERVED 47 -#define KPXIN0 48 -#define KPXIN1 49 -#define KPXIN2 50 -#define KPXIN3 51 -#define KPXIN4 52 -#define KPXIN5 53 -#define KPXIN6 54 -#define KPXIN7 55 -#define KPYIN0 56 -#define KPYIN1 57 -#define KPYIN2 58 -#define KPYIN3 59 -#define KPYIN4 60 -#define KPYIN5 61 -#define KPYIN6 62 -#define KPYIN7 63 -#define KPYIN8 64 -#define KPYIN9 65 -#define KPYIN10 66 -#define KPYIN11 67 -#define KPYIN12 68 -#define KPYIN13 69 -#define KPYIN14 70 -#define KPYIN15 71 -#define MSTXINT 72 -#define MSRXINT 73 -#define TPTXINT 74 -#define TPRXINT 75 -#define INTREQTRC 76 -#define INTREQTIM 77 -#define INTREQRAV 78 -#define INTREQINT 79 -#define INTREQEMP 80 -#define INTREQDAT 81 -#define VIDEOINT 82 -#define FIFOINT 83 -#define NIRQHCIM 84 -#define IRQHCIBUFFACC 85 -#define IRQHCIRMTWKP 86 -#define NHCIMFCLIR 87 -#define USBERROR 88 -#define S0_READY_NIREQ 89 -#define S1_READY_NIREQ 90 -#define S0_CDVALID 91 -#define S1_CDVALID 92 -#define S0_BVD1_STSCHG 93 -#define S1_BVD1_STSCHG 94 -#define USB_PORT_RESUME 95 - -#else -#define NR_IRQS 32 +#define SA1100_IRQ(x) (0 + (x)) + +#define IRQ_GPIO0 SA1100_IRQ(0) +#define IRQ_GPIO1 SA1100_IRQ(1) +#define IRQ_GPIO2 SA1100_IRQ(2) +#define IRQ_GPIO3 SA1100_IRQ(3) +#define IRQ_GPIO4 SA1100_IRQ(4) +#define IRQ_GPIO5 SA1100_IRQ(5) +#define IRQ_GPIO6 SA1100_IRQ(6) +#define IRQ_GPIO7 SA1100_IRQ(7) +#define IRQ_GPIO8 SA1100_IRQ(8) +#define IRQ_GPIO9 SA1100_IRQ(9) +#define IRQ_GPIO10 SA1100_IRQ(10) +#define IRQ_GPIO11_27 SA1100_IRQ(11) +#define IRQ_LCD SA1100_IRQ(12) /* LCD controller */ +#define IRQ_Ser0UDC SA1100_IRQ(13) /* Ser. port 0 UDC */ +#define IRQ_Ser1SDLC SA1100_IRQ(14) /* Ser. port 1 SDLC */ +#define IRQ_Ser1UART SA1100_IRQ(15) /* Ser. port 1 UART */ +#define IRQ_Ser2ICP SA1100_IRQ(16) /* Ser. port 2 ICP */ +#define IRQ_Ser3UART SA1100_IRQ(17) /* Ser. port 3 UART */ +#define IRQ_Ser4MCP SA1100_IRQ(18) /* Ser. port 4 MCP */ +#define IRQ_Ser4SSP SA1100_IRQ(19) /* Ser. port 4 SSP */ +#define IRQ_DMA0 SA1100_IRQ(20) /* DMA controller channel 0 */ +#define IRQ_DMA1 SA1100_IRQ(21) /* DMA controller channel 1 */ +#define IRQ_DMA2 SA1100_IRQ(22) /* DMA controller channel 2 */ +#define IRQ_DMA3 SA1100_IRQ(23) /* DMA controller channel 3 */ +#define IRQ_DMA4 SA1100_IRQ(24) /* DMA controller channel 4 */ +#define IRQ_DMA5 SA1100_IRQ(25) /* DMA controller channel 5 */ +#define IRQ_OST0 SA1100_IRQ(26) /* OS Timer match 0 */ +#define IRQ_OST1 SA1100_IRQ(27) /* OS Timer match 1 */ +#define IRQ_OST2 SA1100_IRQ(28) /* OS Timer match 2 */ +#define IRQ_OST3 SA1100_IRQ(29) /* OS Timer match 3 */ +#define IRQ_RTC1Hz SA1100_IRQ(30) /* RTC 1 Hz clock */ +#define IRQ_RTCAlrm SA1100_IRQ(31) /* RTC Alarm */ + +#define IRQ_GPIO_11_27(x) (32 + (x) - 11) + +#define IRQ_GPIO11 IRQ_GPIO_11_27(11) +#define IRQ_GPIO12 IRQ_GPIO_11_27(12) +#define IRQ_GPIO13 IRQ_GPIO_11_27(13) +#define IRQ_GPIO14 IRQ_GPIO_11_27(14) +#define IRQ_GPIO15 IRQ_GPIO_11_27(15) +#define IRQ_GPIO16 IRQ_GPIO_11_27(16) +#define IRQ_GPIO17 IRQ_GPIO_11_27(17) +#define IRQ_GPIO18 IRQ_GPIO_11_27(18) +#define IRQ_GPIO19 IRQ_GPIO_11_27(19) +#define IRQ_GPIO20 IRQ_GPIO_11_27(20) +#define IRQ_GPIO21 IRQ_GPIO_11_27(21) +#define IRQ_GPIO22 IRQ_GPIO_11_27(22) +#define IRQ_GPIO23 IRQ_GPIO_11_27(23) +#define IRQ_GPIO24 IRQ_GPIO_11_27(24) +#define IRQ_GPIO25 IRQ_GPIO_11_27(25) +#define IRQ_GPIO26 IRQ_GPIO_11_27(26) +#define IRQ_GPIO27 IRQ_GPIO_11_27(27) + +#define SA1100_GPIO_TO_IRQ(i) (((i) < 11) ? SA1100_IRQ(i) : IRQ_GPIO_11_27(i)) + +/* To get the GPIO number from an IRQ number */ +#define GPIO_11_27_IRQ(i) (11 + (i) - 32) +#define SA1100_IRQ_TO_GPIO(i) (((i) < 11) ? (i) : GPIO_11_27_IRQ(i)) + +#define NR_IRQS (IRQ_GPIO27 + 1) + + +#if defined(CONFIG_SA1100_GRAPHICSCLIENT) || defined(CONFIG_SA1100_THINCLIENT) +#define ADS_EXT_IRQ(x) (IRQ_GPIO27 + 1 + (x)) +#undef NR_IRQS +#define NR_IRQS (ADS_EXT_IRQ(15) + 1) #endif -#define IRQ_GPIO0 0 -#define IRQ_GPIO1 1 -#define IRQ_GPIO2 2 -#define IRQ_GPIO3 3 -#define IRQ_GPIO4 4 -#define IRQ_GPIO5 5 -#define IRQ_GPIO6 6 -#define IRQ_GPIO7 7 -#define IRQ_GPIO8 8 -#define IRQ_GPIO9 9 -#define IRQ_GPIO10 10 -#define IRQ_GPIO11_27 11 -#define IRQ_LCD 12 /* LCD controller */ -#define IRQ_Ser0UDC 13 /* Ser. port 0 UDC */ -#define IRQ_Ser1SDLC 14 /* Ser. port 1 SDLC */ -#define IRQ_Ser1UART 15 /* Ser. port 1 UART */ -#define IRQ_Ser2ICP 16 /* Ser. port 2 ICP */ -#define IRQ_Ser3UART 17 /* Ser. port 3 UART */ -#define IRQ_Ser4MCP 18 /* Ser. port 4 MCP */ -#define IRQ_Ser4SSP 19 /* Ser. port 4 SSP */ -#define IRQ_DMA0 20 /* DMA controller channel 0 */ -#define IRQ_DMA1 21 /* DMA controller channel 1 */ -#define IRQ_DMA2 22 /* DMA controller channel 2 */ -#define IRQ_DMA3 23 /* DMA controller channel 3 */ -#define IRQ_DMA4 24 /* DMA controller channel 4 */ -#define IRQ_DMA5 25 /* DMA controller channel 5 */ -#define IRQ_OST0 26 /* OS Timer match 0 */ -#define IRQ_OST1 27 /* OS Timer match 1 */ -#define IRQ_OST2 28 /* OS Timer match 2 */ -#define IRQ_OST3 29 /* OS Timer match 3 */ -#define IRQ_RTC1Hz 30 /* RTC 1 Hz clock */ -#define IRQ_RTCAlrm 31 /* RTC Alarm */ + +#if defined(CONFIG_SA1111) + +#define SA1111_IRQ(x) (IRQ_GPIO27 + 1 + (x)) + +#define GPAIN0 SA1111_IRQ(0) +#define GPAIN1 SA1111_IRQ(1) +#define GPAIN2 SA1111_IRQ(2) +#define GPAIN3 SA1111_IRQ(3) +#define GPBIN0 SA1111_IRQ(4) +#define GPBIN1 SA1111_IRQ(5) +#define GPBIN2 SA1111_IRQ(6) +#define GPBIN3 SA1111_IRQ(7) +#define GPBIN4 SA1111_IRQ(8) +#define GPBIN5 SA1111_IRQ(9) +#define GPCIN0 SA1111_IRQ(10) +#define GPCIN1 SA1111_IRQ(11) +#define GPCIN2 SA1111_IRQ(12) +#define GPCIN3 SA1111_IRQ(13) +#define GPCIN4 SA1111_IRQ(14) +#define GPCIN5 SA1111_IRQ(15) +#define GPCIN6 SA1111_IRQ(16) +#define GPCIN7 SA1111_IRQ(17) +#define MSTXINT SA1111_IRQ(18) +#define MSRXINT SA1111_IRQ(19) +#define MSSTOPERRINT SA1111_IRQ(20) +#define TPTXINT SA1111_IRQ(21) +#define TPRXINT SA1111_IRQ(22) +#define TPSTOPERRINT SA1111_IRQ(23) +#define SSPXMTINT SA1111_IRQ(24) +#define SSPRCVINT SA1111_IRQ(25) +#define SSPROR SA1111_IRQ(26) +#define AUDXMTDMADONEA SA1111_IRQ(32) +#define AUDRCVDMADONEA SA1111_IRQ(33) +#define AUDXMTDMADONEB SA1111_IRQ(34) +#define AUDRCVDMADONEB SA1111_IRQ(35) +#define AUDTFSR SA1111_IRQ(36) +#define AUDRFSR SA1111_IRQ(37) +#define AUDTUR SA1111_IRQ(38) +#define AUDROR SA1111_IRQ(39) +#define AUDDTS SA1111_IRQ(40) +#define AUDRDD SA1111_IRQ(41) +#define AUDSTO SA1111_IRQ(42) +#define USBPWR SA1111_IRQ(43) +#define NIRQHCIM SA1111_IRQ(44) +#define IRQHCIBUFFACC SA1111_IRQ(45) +#define IRQHCIRMTWKP SA1111_IRQ(46) +#define NHCIMFCIR SA1111_IRQ(47) +#define USB_PORT_RESUME SA1111_IRQ(48) +#define S0_READY_NINT SA1111_IRQ(49) +#define S1_READY_NINT SA1111_IRQ(50) +#define S0_CD_VALID SA1111_IRQ(51) +#define S1_CD_VALID SA1111_IRQ(52) +#define S0_BVD1_STSCHG SA1111_IRQ(53) +#define S1_BVD1_STSCHG SA1111_IRQ(54) + +#define SA1111_IRQ_MAX SA1111_IRQ(54) + +#undef NR_IRQS +#define NR_IRQS (SA1111_IRQ_MAX + 1) + + +#ifdef CONFIG_ASSABET_NEPONSET + +#define MISC_IRQ0 SA1111_IRQ(55) +#define MISC_IRQ1 SA1111_IRQ(56) + +#undef NR_IRQS +#define NR_IRQS (SA1111_IRQ_MAX + 3) + +#endif /* CONFIG_ASSABET_NEPONSET */ + +#endif /* CONFIG_SA1111 */ diff --git a/include/asm-arm/arch-sa1100/mmzone.h b/include/asm-arm/arch-sa1100/mmzone.h new file mode 100644 index 000000000..b7abea6f7 --- /dev/null +++ b/include/asm-arm/arch-sa1100/mmzone.h @@ -0,0 +1,81 @@ +/* + * linux/include/asm-arm/arch-sa1100/mmzone.h + * + * (C) 1999-2000, Nicolas Pitre <nico@cam.org> + * (inspired by Kanoj Sarcar's code) + * + * Because of the wide memory address space between physical RAM banks on the + * SA1100, it's much convenient to use Linux's NUMA support to implement our + * memory map representation. Assuming all memory nodes have equal access + * characteristics, we then have generic discontigous memory support. + * + * Of course, all this isn't mandatory for SA1100 implementations with only + * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM. + */ + + +/* + * Currently defined in arch/arm/mm/mm-sa1100.c + */ +extern pg_data_t sa1100_node_data[]; + +/* + * 32MB max in each bank, must fit with __virt_to_phys() & __phys_to_virt() + */ +#define NODE_MAX_MEM_SHIFT 25 +#define NODE_MAX_MEM_SIZE (1<<NODE_MAX_MEM_SHIFT) + +/* + * Given a kernel address, find the home node of the underlying memory. + */ +#define KVADDR_TO_NID(addr) \ + (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MAX_MEM_SHIFT) + +/* + * Return a pointer to the node data for node n. + */ +#define NODE_DATA(nid) (&sa1100_node_data[nid]) + +/* + * NODE_MEM_MAP gives the kaddr for the mem_map of the node. + */ +#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) + +/* + * Given a mem_map_t, LOCAL_MAP_BASE finds the owning node for the + * physical page and returns the kaddr for the mem_map of that node. + */ +#define LOCAL_MAP_BASE(page) \ + NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(page))) + +/* + * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory + * and returns the the mem_map of that node. + */ +#define ADDR_TO_MAPBASE(kaddr) \ + NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr))) + +/* + * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory + * and returns the kaddr corresponding to first physical page in the + * node's mem_map. + */ +#define LOCAL_BASE_ADDR(kaddr) ((unsigned long)(kaddr) & ~(NODE_MAX_MEM_SIZE-1)) + +/* + * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory + * and returns the index corresponding to the appropriate page in the + * node's mem_map. + */ +#define LOCAL_MAP_NR(kvaddr) \ + (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR((kvaddr))) >> PAGE_SHIFT) + +/* + * With discontigmem, the conceptual mem_map array starts from PAGE_OFFSET. + * Given a kaddr, MAP_NR returns the appropriate global mem_map index so + * it matches the corresponding node's local mem_map. + */ +#define MAP_NR(kaddr) (LOCAL_MAP_NR((kaddr)) + \ + (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \ + sizeof(mem_map_t))) + diff --git a/include/asm-arm/arch-sa1100/time.h b/include/asm-arm/arch-sa1100/time.h index 205a317a0..4adca2455 100644 --- a/include/asm-arm/arch-sa1100/time.h +++ b/include/asm-arm/arch-sa1100/time.h @@ -9,9 +9,6 @@ * */ -#include <asm/arch/hardware.h> -#include <asm/arch/irqs.h> - /* IRQs are disabled before entering here from do_gettimeofday() */ static unsigned long sa1100_gettimeoffset (void) @@ -33,16 +30,22 @@ static unsigned long sa1100_gettimeoffset (void) static void sa1100_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { + long flags; int next_match; /* Loop until we get ahead of the free running timer. * This ensures an exact clock tick count and time acuracy. - * Should be IRQ race free. + * IRQs are disabled inside the loop to ensure coherence between + * lost_ticks (updated in do_timer()) and the match reg value, so we + * can use do_gettimeofday() from interrupt handlers. */ do { + do_leds(); + save_flags_cli( flags ); do_timer(regs); OSSR = OSSR_M0; /* Clear match on timer 0 */ next_match = (OSMR0 += LATCH); + restore_flags( flags ); } while( (signed long)(next_match - OSCR) <= 0 ); } diff --git a/include/asm-arm/arch-sa1100/uncompress.h b/include/asm-arm/arch-sa1100/uncompress.h index 33ced71ba..69b3140d3 100644 --- a/include/asm-arm/arch-sa1100/uncompress.h +++ b/include/asm-arm/arch-sa1100/uncompress.h @@ -2,58 +2,51 @@ * linux/include/asm-arm/arch-brutus/uncompress.h * * (C) 1999 Nicolas Pitre <nico@cam.org> + * + * Reorganised to use machine_is_*() macros. */ -#include <linux/config.h> - -#if defined(CONFIG_SA1100_EMPEG) || \ - defined(CONFIG_SA1100_VICTOR) || \ - defined(CONFIG_SA1100_LART) -#define SERBASE _Ser3UTCR0; -#elif defined(CONFIG_SA1100_BRUTUS) -#define SERBASE _Ser1UTCR0; -#endif - - -#ifdef SERBASE - #include "hardware.h" #include "serial_reg.h" -static volatile unsigned long* serial_port = (unsigned long*)SERBASE; - /* * The following code assumes the serial port has already been * initialized by the bootloader or such... */ - static void puts( const char *s ) { - int i; - - for (i = 0; *s; i++, s++) { - /* wait for space in the UART's transmiter */ - while( !(serial_port[UTSR1] & UTSR1_TNF) ); - - /* send the character out. */ - serial_port[UART_TX] = *s; - - /* if a LF, also do CR... */ - if (*s == 10) { - while( !(serial_port[UTSR1] & UTSR1_TNF) ); - serial_port[UART_TX] = 13; + volatile unsigned long *serial_port; + + if (machine_is_assabet()) { + if (0/*SA1111 connected*/) + serial_port = (unsigned long *)_Ser3UTCR0; + else + serial_port = (unsigned long *)_Ser1UTCR0; + } else if (machine_is_brutus()) + serial_port = (unsigned long *)_Ser1UTCR0; + else if (machine_is_empeg() || machine_is_bitsy() || + machine_is_victor() || machine_is_lart()) + serial_port = (unsigned long *)_Ser3UTCR0; + else + return; + + for (; *s; s++) { + /* wait for space in the UART's transmiter */ + while (!(serial_port[UTSR1] & UTSR1_TNF)); + + /* send the character out. */ + serial_port[UART_TX] = *s; + + /* if a LF, also do CR... */ + if (*s == 10) { + while (!(serial_port[UTSR1] & UTSR1_TNF)); + serial_port[UART_TX] = 13; + } } - } } -#else - -static inline void puts( const char *s ) {} - -#endif - - -/* Nothing to do for these */ +/* + * Nothing to do for these + */ #define arch_decomp_setup() #define arch_decomp_wdog() - diff --git a/include/asm-arm/arch-shark/time.h b/include/asm-arm/arch-shark/time.h index 32f9d7593..5bfc2cf06 100644 --- a/include/asm-arm/arch-shark/time.h +++ b/include/asm-arm/arch-shark/time.h @@ -13,7 +13,6 @@ * Copyright (c) 1996,1997,1998 Russell King. */ -#include <linux/config.h> #include <asm/leds.h> #include <linux/mc146818rtc.h> @@ -28,15 +27,7 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) CMOS_READ(RTC_INTR_FLAGS); -#ifdef CONFIG_LEDS - { - static int count = 50; - if (--count == 0) { - count = 50; - leds_event(led_timer); - } - } -#endif + do_leds(); { #ifdef DIVISOR diff --git a/include/asm-arm/dec21285.h b/include/asm-arm/dec21285.h index c86e2c851..39184ef9a 100644 --- a/include/asm-arm/dec21285.h +++ b/include/asm-arm/dec21285.h @@ -14,6 +14,7 @@ #define DC21285_PCI_IO 0x7c000000 #define DC21285_PCI_MEM 0x80000000 +#include <linux/config.h> #ifndef __ASSEMBLY__ #include <asm/arch/hardware.h> #define DC21285_IO(x) ((volatile unsigned long *)(ARMCSR_BASE+(x))) @@ -80,6 +81,31 @@ #define SA110_CNTL_XCSDIR(x) ((x)<<28) #define SA110_CNTL_PCICFN (1 << 31) +/* + * footbridge_cfn_mode() is used when we want + * to check whether we are the central function + */ +#define __footbridge_cfn_mode() (*CSR_SA110_CNTL & SA110_CNTL_PCICFN) +#if defined(CONFIG_FOOTBRIDGE_HOST) && defined(CONFIG_FOOTBRIDGE_ADDIN) +#define footbridge_cfn_mode() __footbridge_cfn_mode() +#elif defined(CONFIG_FOOTBRIDGE_HOST) +#define footbridge_cfn_mode() (1) +#else +#define footbridge_cfn_mode() (0) +#endif + +/* + * footbridge_cfn_mode() is used when we want + * to check whether we are the central function + */ +#if defined(CONFIG_FOOTBRIDGE_HOST) && defined(CONFIG_FOOTBRIDGE_ADDIN) +#define footbridge_cfn_mode() (*CSR_SA110_CNTL & SA110_CNTL_PCICFN) +#elif defined(CONFIG_FOOTBRIDGE_HOST) +#define footbridge_cfn_mode() (1) +#else +#define footbridge_cfn_mode() (0) +#endif + #define CSR_PCIADDR_EXTN DC21285_IO(0x0140) #define CSR_PREFETCHMEMRANGE DC21285_IO(0x0144) #define CSR_XBUS_CYCLE DC21285_IO(0x0148) diff --git a/include/asm-arm/mmzone.h b/include/asm-arm/mmzone.h new file mode 100644 index 000000000..97ddd9718 --- /dev/null +++ b/include/asm-arm/mmzone.h @@ -0,0 +1,12 @@ +/* + * linux/include/asm-arm/mmzone.h + * + * 1999-12-29 Nicolas Pitre Created + */ + +#ifndef __ASM_MMZONE_H +#define __ASM_MMZONE_H + +#include <asm/arch/mmzone.h> + +#endif diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index e1de021c4..10f470048 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -84,11 +84,15 @@ extern __inline__ int get_order(unsigned long size) #endif /* !__ASSEMBLY__ */ +#include <linux/config.h> #include <asm/arch/memory.h> #define __pa(x) __virt_to_phys((unsigned long)(x)) #define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) + +#ifndef CONFIG_DISCONTIGMEM #define MAP_NR(addr) ((__pa(addr) - PHYS_OFFSET) >> PAGE_SHIFT) +#endif #endif diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index 5a05e2ef2..b18e572d0 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h @@ -4,6 +4,7 @@ #ifndef _ASMARM_PGTABLE_H #define _ASMARM_PGTABLE_H +#include <linux/config.h> #include <asm/arch/memory.h> #include <asm/proc-fns.h> #include <asm/system.h> @@ -77,7 +78,18 @@ extern void __handle_bad_pmd_kernel(pmd_t *pmd); #define pte_none(pte) (!pte_val(pte)) #define pte_clear(ptep) set_pte((ptep), __pte(0)) + +#ifndef CONFIG_DISCONTIGMEM #define pte_pagenr(pte) ((unsigned long)(((pte_val(pte) - PHYS_OFFSET) >> PAGE_SHIFT))) +#else +/* + * I'm not happy with this - we needlessly convert a physical address + * to a virtual one, and then immediately back to a physical address, + * which, if __va and __pa are expensive causes twice the expense for + * zero gain. --rmk + */ +#define pte_pagenr(pte) MAP_NR(__va(pte_val(pte))) +#endif #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_clear(pmdp) set_pmd(pmdp, __pmd(0)) diff --git a/include/asm-arm/proc-armv/assembler.h b/include/asm-arm/proc-armv/assembler.h index 128dd1982..788a22b87 100644 --- a/include/asm-arm/proc-armv/assembler.h +++ b/include/asm-arm/proc-armv/assembler.h @@ -1,10 +1,10 @@ /* * linux/asm-arm/proc-armv/assembler.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-2000 Russell King * - * This file contains arm architecture specific defines - * for the different processors + * This file contains ARM processor specifics for + * the ARM6 and better processors. */ #ifndef __ASSEMBLY__ #error "Only include this from assembly code" @@ -19,68 +19,36 @@ /* * LOADREGS - ldm with PC in register list (eg, ldmfd sp!, {pc}) - * RETINSTR - return instruction (eg, mov pc, lr) */ #ifdef __STDC__ #define LOADREGS(cond, base, reglist...)\ ldm##cond base,reglist - -#define RETINSTR(instr, regs...)\ - instr regs #else #define LOADREGS(cond, base, reglist...)\ ldm/**/cond base,reglist - -#define RETINSTR(instr, regs...)\ - instr regs #endif /* - * No nop required after mode change - */ -#define MODENOP - -/* - * Change to `mode' - */ -#define MODE(savereg,tmpreg,mode) \ - mrs savereg, cpsr; \ - bic tmpreg, savereg, $0x1f; \ - orr tmpreg, tmpreg, $mode; \ - msr cpsr, tmpreg - -/* - * Restore mode + * Build a return instruction for this processor type. */ -#define RESTOREMODE(savereg) \ - msr cpsr, savereg - -/* - * save interrupt state (uses stack) - */ -#define SAVEIRQS(tmpreg)\ - mrs tmpreg, cpsr; \ - str tmpreg, [sp, $-4]! - -/* - * restore interrupt state (uses stack) - */ -#define RESTOREIRQS(tmpreg)\ - ldr tmpreg, [sp], $4; \ - msr cpsr, tmpreg +#define RETINSTR(instr, regs...)\ + instr regs /* - * disable IRQs + * Save the current IRQ state and disable IRQs + * Note that this macro assumes FIQs are enabled, and + * that the processor is in SVC mode. */ -#define DISABLEIRQS(tmpreg)\ - mrs tmpreg , cpsr; \ - orr tmpreg , tmpreg , $I_BIT; \ - msr cpsr, tmpreg + .macro save_and_disable_irqs, oldcpsr, temp + mrs \oldcpsr, cpsr + mov \temp, #I_BIT | MODE_SVC + msr cpsr_c, \temp + .endm /* - * enable IRQs + * Restore interrupt state previously stored in + * a register */ -#define ENABLEIRQS(tmpreg)\ - mrs tmpreg , cpsr; \ - bic tmpreg , tmpreg , $I_BIT; \ - msr cpsr, tmpreg + .macro restore_irqs, oldcpsr + msr cpsr_c, \oldcpsr + .endm diff --git a/include/asm-arm/proc-armv/locks.h b/include/asm-arm/proc-armv/locks.h index 0a0391fae..047f0ce16 100644 --- a/include/asm-arm/proc-armv/locks.h +++ b/include/asm-arm/proc-armv/locks.h @@ -72,7 +72,8 @@ * BIAS once per CPU will result in the long remaining * negative. */ -#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" #define __down_op_write(ptr,fail) \ ({ \ diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h index 90e7f6efe..f50c2f4e7 100644 --- a/include/asm-arm/setup.h +++ b/include/asm-arm/setup.h @@ -74,6 +74,7 @@ struct meminfo { struct { unsigned long start; unsigned long size; + int node; } bank[NR_BANKS]; }; diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 0283a7f23..b75a88411 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -46,6 +46,7 @@ extern unsigned int __machine_arch_type; #define MACH_TYPE_LART 27 #define MACH_TYPE_RANGER 28 #define MACH_TYPE_GRAPHICSCLIENT 29 +#define MACH_TYPE_XP860 30 /* * Sort out a definition for machine_arch_type @@ -280,6 +281,32 @@ extern unsigned int __machine_arch_type; # define machine_is_lart() (0) #endif +#ifdef CONFIG_SA1100_GRAPHICSCLIENT +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_GRAPHICSCLIENT +# endif +# define machine_is_grpahicsclient() \ + (machine_arch_type == MACH_TYPE_GRAPHICSCLIENT) +#else +# define machine_is_graphicsclient() \ + (0) +#endif + +#ifdef CONFIG_SA1100_XP860 +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_XP860 +# endif +# define machine_is_xp860() (machine_arch_type == MACH_TYPE_XP860) +#else +# define machine_is_xp860() (0) +#endif + /* * The following are currently unregistered */ diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 9755af1ab..241cb03a8 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -116,7 +116,7 @@ #define __NR_lstat (__NR_SYSCALL_BASE+107) #define __NR_fstat (__NR_SYSCALL_BASE+108) -#define __NR_iopl (__NR_SYSCALL_BASE+110) + #define __NR_vhangup (__NR_SYSCALL_BASE+111) #define __NR_idle (__NR_SYSCALL_BASE+112) #define __NR_syscall (__NR_SYSCALL_BASE+113) /* syscall to call a syscall! */ diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index 34df19c05..80ba0d2e4 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -8,6 +8,9 @@ * <rreilova@ececs.uc.edu> * - Channing Corn (tests & fixes), * - Andrew D. Balsa (code cleanup). + * + * Pentium III FXSR, SSE support + * Gareth Hughes <gareth@valinux.com>, May 2000 */ /* @@ -46,7 +49,7 @@ static int __init no_387(char *s) __setup("no387", no_387); -static char __initdata fpu_error = 0; +static char fpu_error __initdata = 0; static void __init copro_timeout(void) { @@ -59,8 +62,13 @@ static void __init copro_timeout(void) outb_p(0,0xf0); } -static double __initdata x = 4195835.0; -static double __initdata y = 3145727.0; +static double x __initdata = 4195835.0; +static double y __initdata = 3145727.0; + +#ifdef CONFIG_X86_XMM +static float zero[4] __initdata = { 0.0, 0.0, 0.0, 0.0 }; +static float one[4] __initdata = { 1.0, 1.0, 1.0, 1.0 }; +#endif static void __init check_fpu(void) { @@ -139,6 +147,37 @@ static void __init check_fpu(void) printk("OK, FPU using exception 16 error reporting.\n"); else printk("Hmm, FPU using exception 16 error reporting with FDIV bug.\n"); + +#ifdef CONFIG_X86_FXSR + /* + * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned. + */ + if (offsetof(struct task_struct, thread.i387.hard.fxsr_space[0]) & 15) + panic("Kernel compiled for PII/PIII+ with FXSR, data not 16-byte aligned!"); + + if (cpu_has_fxsr) { + printk(KERN_INFO "Enabling fast FPU save and restore... "); + set_in_cr4(X86_CR4_OSFXSR); + printk("done.\n"); + } +#endif +#ifdef CONFIG_X86_XMM + if (cpu_has_xmm) { + printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... "); + set_in_cr4(X86_CR4_OSXMMEXCPT); + printk("done.\n"); + + /* Check if exception 19 works okay. */ + set_fpu_mxcsr(XMM_UNMASKED_MXCSR); + printk(KERN_INFO "Checking SIMD FPU exceptions... "); + __asm__("movups %0,%%xmm0\n\t" + "movups %1,%%xmm1\n\t" + "divps %%xmm0,%%xmm1\n\t" + : : "m" (*&zero), "m" (*&one)); + printk("OK, SIMD FPU using exception 19 error reporting.\n"); + set_fpu_mxcsr(XMM_DEFAULT_MXCSR); + } +#endif } static void __init check_hlt(void) @@ -424,6 +463,14 @@ static void __init check_config(void) && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11)) panic("Kernel compiled for PPro+, assumes a local APIC without the read-before-write bug!"); #endif + +/* + * If we configured ourselves for FXSR, we'd better have it. + */ +#ifdef CONFIG_X86_FXSR + if (!cpu_has_fxsr) + panic("Kernel compiled for PII/PIII+, requires FXSR feature!"); +#endif } static void __init check_bugs(void) diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 729c11e77..76fd66fd8 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -2,6 +2,9 @@ * include/asm-i386/processor.h * * Copyright (C) 1994 Linus Torvalds + * + * Pentium III FXSR, SSE support + * Gareth Hughes <gareth@valinux.com>, May 2000 */ #ifndef __ASM_I386_PROCESSOR_H @@ -90,17 +93,15 @@ struct cpuinfo_x86 { #define X86_FEATURE_20 0x00100000 #define X86_FEATURE_21 0x00200000 #define X86_FEATURE_22 0x00400000 -#define X86_FEATURE_MMX 0x00800000 /* multimedia extensions */ +#define X86_FEATURE_MMX 0x00800000 /* Multimedia Extensions */ #define X86_FEATURE_FXSR 0x01000000 /* FXSAVE and FXRSTOR instructions (fast save and restore of FPU context), and CR4.OSFXSR (OS uses these instructions) available */ -#define X86_FEATURE_XMM 0x02000000 /* Intel MMX2 instruction set */ +#define X86_FEATURE_XMM 0x02000000 /* Streaming SIMD Extensions */ #define X86_FEATURE_26 0x04000000 #define X86_FEATURE_27 0x08000000 #define X86_FEATURE_28 0x10000000 #define X86_FEATURE_29 0x20000000 #define X86_FEATURE_30 0x40000000 #define X86_FEATURE_AMD3D 0x80000000 -#define X86_CR4_OSFXSR 0x0200 /* fast FPU save/restore */ -#define X86_CR4_OSXMMEXCPT 0x0400 /* KNI (MMX2) unmasked exception 16 */ extern struct cpuinfo_x86 boot_cpu_data; extern struct tss_struct init_tss[NR_CPUS]; @@ -125,6 +126,10 @@ extern struct cpuinfo_x86 cpu_data[]; (boot_cpu_data.x86_capability & X86_FEATURE_DE) #define cpu_has_vme \ (boot_cpu_data.x86_capability & X86_FEATURE_VME) +#define cpu_has_fxsr \ + (boot_cpu_data.x86_capability & X86_FEATURE_FXSR) +#define cpu_has_xmm \ + (boot_cpu_data.x86_capability & X86_FEATURE_XMM) extern char ignore_irq13; @@ -142,23 +147,24 @@ extern inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) "=b" (*ebx), "=c" (*ecx), "=d" (*edx) - : "a" (op) - : "cc"); + : "a" (op)); } /* * Intel CPU features in CR4 */ -#define X86_CR4_VME 0x0001 /* enable vm86 extensions */ -#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */ -#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */ -#define X86_CR4_DE 0x0008 /* enable debugging extensions */ -#define X86_CR4_PSE 0x0010 /* enable page size extensions */ -#define X86_CR4_PAE 0x0020 /* enable physical address extensions */ -#define X86_CR4_MCE 0x0040 /* Machine check enable */ -#define X86_CR4_PGE 0x0080 /* enable global pages */ -#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */ +#define X86_CR4_VME 0x0001 /* enable vm86 extensions */ +#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */ +#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */ +#define X86_CR4_DE 0x0008 /* enable debugging extensions */ +#define X86_CR4_PSE 0x0010 /* enable page size extensions */ +#define X86_CR4_PAE 0x0020 /* enable physical address extensions */ +#define X86_CR4_MCE 0x0040 /* Machine check enable */ +#define X86_CR4_PGE 0x0080 /* enable global pages */ +#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */ +#define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */ +#define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */ /* * Save the cr4 feature set we're using (ie @@ -244,21 +250,7 @@ extern unsigned int mca_pentium_flag; #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap) #define INVALID_IO_BITMAP_OFFSET 0x8000 -#ifndef CONFIG_X86_FX - -#define i387_save_hard(x) \ - __asm__("fnsave %0\n\tfwait": :"m" (x)) -#define i387_restore_hard(x) \ - __asm__("frstor %0": :"m" (x)) - -#define i387_hard_to_user(uaddr, x) \ - __copy_to_user((uaddr), (x), sizeof(struct i387_hard_struct)) -#define i387_user_to_hard(x, uaddr) \ - __copy_from_user((x), (uaddr), sizeof(struct i387_hard_struct)) - -#define i387_set_cwd(x,v) do { (x).cwd = 0xffff0000 | (v); } while (0) -#define i387_set_swd(x,v) do { (x).swd = 0xffff0000 | (v); } while (0) -#define i387_set_twd(x,v) do { (x).twd = 0xffff0000 | (v); } while (0) +#ifndef CONFIG_X86_FXSR struct i387_hard_struct { long cwd; @@ -274,65 +266,29 @@ struct i387_hard_struct { #else -/* - * has to be 128-bit aligned - */ +/* It doesn't matter if the CPU writes only part of this struct; it gets + * copied by do_fork, so the unimplemented area never changes from what + * init_task.i387 is initialized to (all zeroes). */ + struct i387_hard_struct { - unsigned short cwd; - unsigned short swd; - unsigned short twd; - unsigned short fopcode; - unsigned int fip; - unsigned short fcs; - unsigned short __reserved_01; - unsigned int fdp; - unsigned short fds; - unsigned short __reserved_02; - unsigned int mxcsr; - unsigned int __reserved_03; - unsigned int st_space[32]; /* 8*16 bytes for each FP/MMX-reg = 128 bytes */ - unsigned int xmm_space[22*4]; /* 22 cachelines for MMX2 registers */ - unsigned long status; + long cwd; + long swd; + long twd; + long fip; + long fcs; + long foo; + long fos; + long status; /* software status information */ + long fxsr_space[6]; /* FXSR FPU environment must not be used */ + long mxcsr; + long reserved; + long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ + long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ + long padding[56]; } __attribute__ ((aligned (16))); -/* - * tag word conversion (thanks to Gabriel Paubert for noticing the - * subtle format difference and implementing these functions) - * - * there are several erratas wrt. the tag word in the i387, thus - * any software relying on it's value is questionable, but we - * definitely want to be as close as possible. - */ -static inline unsigned short fputag_KNIto387(unsigned char tb) { - unsigned short tw = tb; - tw = ((tw<<4) | tw) &0x0f0f; /* zzzz7654zzzz3210 */ - tw = ((tw<<2) | tw) &0x3333; /* zz76zz54zz32zz10 */ - tw = ((tw<<1) | tw) &0x5555; /* z7z6z5z4z3z2z1z0 */ - return ~(tw*3); -} - -static inline unsigned char fputag_387toKNI(unsigned short tw) { - tw = ~tw; - tw = (tw | (tw>>1)) & 0x5555; /* z7z6z5z4z3z2z1z0 */ - tw = (tw | (tw>>1)) & 0x3333; /* zz76zz54zz32zz10 */ - tw = (tw | (tw>>3)) & 0x0f0f; /* zzzz7654zzzz3210 */ - return (tw|(tw>>4)) & 0x00ff; /* zzzzzzzz76543210 */ -} - -#define i387_set_cwd(x,v) do { (x).cwd = (short)(v); } while (0) -#define i387_set_swd(x,v) do { (x).swd = (short)(v); } while (0) -#define i387_set_twd(x,v) do { (x).twd = fputag_387toKNI(v); } while (0) - -#define i387_save_hard(x) \ - { __asm__ __volatile__(".byte 0x0f, 0xae, 0x06": :"S" (&(x))); } while (0) - -#define i387_restore_hard(x) \ -do { __asm__ __volatile__(".byte 0x0f, 0xae, 0x4f, 0x00": :"D" (&(x))); } while(0) - -extern int i387_hard_to_user ( struct _fpstate * user, - struct i387_hard_struct * hard); -extern int i387_user_to_hard (struct i387_hard_struct * hard, - struct _fpstate * user); +#define X86_FXSR_MAGIC 0x0000 +#define X86_FXSR_SIZE 512 #endif struct i387_soft_struct { @@ -469,12 +425,48 @@ extern void forget_segments(void); /* * FPU lazy state save handling.. */ +#ifndef CONFIG_X86_FXSR + +#define save_fpu(tsk) do { \ + asm volatile("fnsave %0 ; fwait" \ + : "=m" (tsk->thread.i387.hard)); \ + tsk->flags &= ~PF_USEDFPU; \ + stts(); \ +} while (0) + +#define save_init_fpu(tsk) save_fpu(tsk) + +#define restore_fpu(tsk) do { \ + asm volatile("frstor %0" \ + : : "m" (tsk->thread.i387.hard)); \ +} while (0) + +#else /* CONFIG_X86_FXSR */ + #define save_fpu(tsk) do { \ - i387_save_hard(tsk->thread.i387); \ + asm volatile("fnstenv %0 ; fxsave %1 ; fwait" \ + : "=m" (tsk->thread.i387.hard), \ + "=m" (tsk->thread.i387.hard.fxsr_space[0])); \ + tsk->flags &= ~PF_USEDFPU; \ + stts(); \ +} while (0) + +#define save_init_fpu(tsk) do { \ + asm volatile("fnstenv %0 ; fxsave %1 ; fnclex" \ + : "=m" (tsk->thread.i387.hard), \ + "=m" (tsk->thread.i387.hard.fxsr_space[0])); \ tsk->flags &= ~PF_USEDFPU; \ stts(); \ } while (0) +#define restore_fpu(tsk) do { \ + asm volatile("fxrstor %0 ; fldenv %1" \ + : : "m" (tsk->thread.i387.hard.fxsr_space[0]), \ + "m" (tsk->thread.i387.hard)); \ +} while (0) + +#endif /* CONFIG_X86_FXSR */ + #define unlazy_fpu(tsk) do { \ if (tsk->flags & PF_USEDFPU) \ save_fpu(tsk); \ @@ -487,6 +479,18 @@ extern void forget_segments(void); } \ } while (0) +#ifdef CONFIG_X86_XMM +#define XMM_DEFAULT_MXCSR 0x1f80 +#define XMM_UNMASKED_MXCSR 0x0000 + +#define set_fpu_mxcsr(val) do { \ + if (cpu_has_xmm) { \ + unsigned long __mxcsr = ((unsigned long)(val) & 0xffff); \ + asm volatile("ldmxcsr %0" : : "m" (__mxcsr)); \ + } \ +} while (0) +#endif + /* * Return saved PC of a blocked thread. */ @@ -519,4 +523,6 @@ struct microcode { unsigned int bits[500]; }; +#define MICROCODE_IOCFREE _IO('6',0) /* because it is for P6 */ + #endif /* __ASM_I386_PROCESSOR_H */ diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index 985d28829..05189f6f3 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h @@ -46,6 +46,8 @@ struct pt_regs { #define PTRACE_SETREGS 13 #define PTRACE_GETFPREGS 14 #define PTRACE_SETFPREGS 15 +#define PTRACE_GETXFPREGS 25 +#define PTRACE_SETXFPREGS 26 #ifdef __KERNEL__ #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs)) diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index 827c53192..9088efe2c 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h @@ -3,6 +3,8 @@ #include <linux/linkage.h> +#ifdef __KERNEL__ + /* * SMP- and interrupt-safe semaphores.. * @@ -373,3 +375,4 @@ extern inline void up_write(struct rw_semaphore *sem) } #endif +#endif diff --git a/include/asm-i386/sigcontext.h b/include/asm-i386/sigcontext.h index bb66dbe49..77ef66680 100644 --- a/include/asm-i386/sigcontext.h +++ b/include/asm-i386/sigcontext.h @@ -1,34 +1,55 @@ #ifndef _ASMi386_SIGCONTEXT_H #define _ASMi386_SIGCONTEXT_H -#include <linux/config.h> /* * As documented in the iBCS2 standard.. * - * The first part of "struct _fpstate" is just the - * normal i387 hardware setup, the extra "status" - * word is used to save the coprocessor status word - * before entering the handler. + * The first part of "struct _fpstate" is just the normal i387 + * hardware setup, the extra "status" word is used to save the + * coprocessor status word before entering the handler. + * + * Pentium III FXSR, SSE support + * Gareth Hughes <gareth@valinux.com>, May 2000 + * + * The FPU state data structure has had to grow to accomodate the + * extended FPU state required by the Streaming SIMD Extensions. + * There is no documented standard to accomplish this at the moment. */ struct _fpreg { unsigned short significand[4]; unsigned short exponent; }; +struct _fpxreg { + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg { + unsigned long element[4]; +}; + struct _fpstate { - unsigned long cw, - sw, - tag, - ipoff, - cssel, - dataoff, - datasel; + /* Regular FPU environment */ + unsigned long cw; + unsigned long sw; + unsigned long tag; + unsigned long ipoff; + unsigned long cssel; + unsigned long dataoff; + unsigned long datasel; struct _fpreg _st[8]; - unsigned long status; -#ifdef CONFIG_X86_FX + unsigned short status; + unsigned short magic; /* 0xffff = regular FPU data only */ + + /* FXSR FPU environment */ + unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */ unsigned long mxcsr; - unsigned long _xmm[4*22]; -#endif + unsigned long reserved; + struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ + struct _xmmreg _xmm[8]; + unsigned long padding[56]; }; struct sigcontext { diff --git a/include/asm-i386/user.h b/include/asm-i386/user.h index 2d0849738..e034118f3 100644 --- a/include/asm-i386/user.h +++ b/include/asm-i386/user.h @@ -30,17 +30,46 @@ The minimum core file size is 3 pages, or 12288 bytes. */ +/* + * Pentium III FXSR, SSE support + * Gareth Hughes <gareth@valinux.com>, May 2000 + * + * Provide support for the GDB 5.0 PTRACE_*XFPREGS requests for interacting + * with the FXSR-format floating point environment. Floating point data + * can be accessed in the regular FSAVE format in the usual manner, and the + * XMM register/control data can be accessed via the new ptrace requests. + * Note that the floating point environment contained in the FXSR format + * is ignored and any changes to these fields will be lost. + */ + struct user_i387_struct { long cwd; long swd; long twd; long fip; long fcs; - long fdp; - long fds; + long foo; + long fos; long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ }; +struct user_xfpregs_struct { + long cwd; + long swd; + long twd; + long fip; + long fcs; + long foo; + long fos; + long __reserved_00; + long fxsr_space[6]; /* FXSR FPU environment must not be used */ + long mxcsr; + long __reserved_01; + long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ + long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ + long __reserved_02[56]; +}; + /* * This is the old layout of "struct pt_regs", and * is still the layout used by user mode (the new diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h index 53ce7e674..35bc3e18e 100644 --- a/include/asm-m68k/amigaints.h +++ b/include/asm-m68k/amigaints.h @@ -113,6 +113,8 @@ struct irq_server { extern void amiga_do_irq(int irq, struct pt_regs *fp); extern void amiga_do_irq_list(int irq, struct pt_regs *fp, struct irq_server *server); +extern unsigned short amiga_intena_vals[]; + /* CIA interrupt control register bits */ #define CIA_ICR_TA 0x01 diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h index a7fa5e56f..98fe1ec3d 100644 --- a/include/asm-mips/delay.h +++ b/include/asm-mips/delay.h @@ -12,8 +12,6 @@ #include <linux/config.h> -#include <linux/config.h> - extern __inline__ void __delay(unsigned long loops) { diff --git a/include/asm-mips/floppy.h b/include/asm-mips/floppy.h index 67d8051a8..6e5c5c43a 100644 --- a/include/asm-mips/floppy.h +++ b/include/asm-mips/floppy.h @@ -1,12 +1,11 @@ -/* $Id: floppy.h,v 1.6 1999/01/04 16:09:21 ralf Exp $ - * +/* * Architecture specific parts of the Floppy driver * * 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) 1995, 1996, 1997, 1998 Ralf Baechle + * Copyright (C) 1995 - 2000 Ralf Baechle */ #ifndef _ASM_FLOPPY_H #define _ASM_FLOPPY_H @@ -41,30 +40,30 @@ struct fd_ops { extern struct fd_ops *fd_ops; -#define fd_inb(port) fd_ops->fd_inb(port) -#define fd_outb(value,port) fd_ops->fd_outb(value,port) +#define fd_inb(port) fd_ops->fd_inb(port) +#define fd_outb(value,port) fd_ops->fd_outb(value,port) -#define fd_enable_dma(channel) fd_ops->fd_enable_dma(channel) -#define fd_disable_dma(channel) fd_ops->fd_disable_dma(channel) -#define fd_request_dma(channel) fd_ops->fd_request_dma(channel) -#define fd_free_dma(channel) fd_ops->fd_free_dma(channel) -#define fd_clear_dma_ff(channel) fd_ops->fd_clear_dma_ff(channel) -#define fd_set_dma_mode(channel, mode) fd_ops->fd_set_dma_mode(channel, mode) -#define fd_set_dma_addr(channel, addr) fd_ops->fd_set_dma_addr(channel, \ - virt_to_bus(addr)) -#define fd_set_dma_count(channel,count) fd_ops->fd_set_dma_count(channel,count) -#define fd_get_dma_residue(channel) fd_ops->fd_get_dma_residue(channel) +#define fd_enable_dma() fd_ops->fd_enable_dma(FLOPPY_DMA) +#define fd_disable_dma() fd_ops->fd_disable_dma(FLOPPY_DMA) +#define fd_request_dma() fd_ops->fd_request_dma(FLOPPY_DMA) +#define fd_free_dma() fd_ops->fd_free_dma(FLOPPY_DMA) +#define fd_clear_dma_ff() fd_ops->fd_clear_dma_ff(FLOPPY_DMA) +#define fd_set_dma_mode(mode) fd_ops->fd_set_dma_mode(FLOPPY_DMA, mode) +#define fd_set_dma_addr(addr) fd_ops->fd_set_dma_addr(FLOPPY_DMA, \ + virt_to_bus(addr)) +#define fd_set_dma_count(count) fd_ops->fd_set_dma_count(FLOPPY_DMA,count) +#define fd_get_dma_residue() fd_ops->fd_get_dma_residue(FLOPPY_DMA) -#define fd_enable_irq(irq) fd_ops->fd_enable_irq(irq) -#define fd_disable_irq(irq) fd_ops->fd_disable_irq(irq) -#define fd_request_irq(irq) request_irq(irq, floppy_interrupt, \ - SA_INTERRUPT \ - | SA_SAMPLE_RANDOM, \ - "floppy", NULL) -#define fd_free_irq(irq) free_irq(irq, NULL); -#define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size) +#define fd_enable_irq() fd_ops->fd_enable_irq(FLOPPY_IRQ) +#define fd_disable_irq() fd_ops->fd_disable_irq(FLOPPY_IRQ) +#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ + SA_INTERRUPT | SA_SAMPLE_RANDOM, \ + "floppy", NULL) +#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); +#define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size) #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size) -#define fd_drive_type(n) fd_ops->fd_drive_type(n) +#define fd_drive_type(n) fd_ops->fd_drive_type(n) +#define fd_cacheflush(addr,size) dma_cache_wback_inv(addr,size) #define MAX_BUFFER_SECTORS 24 diff --git a/include/asm-mips/hardirq.h b/include/asm-mips/hardirq.h index 59d6681de..cba4ccf0d 100644 --- a/include/asm-mips/hardirq.h +++ b/include/asm-mips/hardirq.h @@ -11,8 +11,6 @@ #define _ASM_HARDIRQ_H #include <linux/config.h> - -#include <linux/config.h> #include <linux/threads.h> #include <linux/irq.h> diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h index a91913bcc..c9600661e 100644 --- a/include/asm-mips/pgalloc.h +++ b/include/asm-mips/pgalloc.h @@ -12,8 +12,6 @@ #include <linux/config.h> -#include <linux/config.h> - /* TLB flushing: * * - flush_tlb_all() flushes all processes TLB entries diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h index ab996d0b2..d6fb7526d 100644 --- a/include/asm-mips/processor.h +++ b/include/asm-mips/processor.h @@ -16,8 +16,6 @@ #include <asm/isadep.h> -#include <linux/config.h> - /* * Default implementation of macro that returns current * instruction pointer ("program counter"). diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h index c39e0d294..72592c8fc 100644 --- a/include/asm-mips/socket.h +++ b/include/asm-mips/socket.h @@ -1,6 +1,3 @@ -/* - * $Id: socket.h,v 1.6 2000/02/25 21:52:09 ralf Exp $ - */ #ifndef _ASM_SOCKET_H #define _ASM_SOCKET_H diff --git a/include/asm-mips64/floppy.h b/include/asm-mips64/floppy.h index 3e1439758..6e5c5c43a 100644 --- a/include/asm-mips64/floppy.h +++ b/include/asm-mips64/floppy.h @@ -1,17 +1,18 @@ -/* $Id$ - * +/* * Architecture specific parts of the Floppy driver * * 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) 1995, 1996, 1997, 1998, 1999 Ralf Baechle + * Copyright (C) 1995 - 2000 Ralf Baechle */ #ifndef _ASM_FLOPPY_H #define _ASM_FLOPPY_H #include <asm/bootinfo.h> +#include <asm/jazz.h> +#include <asm/jazzdma.h> struct fd_ops { unsigned char (*fd_inb)(unsigned int port); @@ -39,30 +40,30 @@ struct fd_ops { extern struct fd_ops *fd_ops; -#define fd_inb(port) fd_ops->fd_inb(port) -#define fd_outb(value,port) fd_ops->fd_outb(value,port) +#define fd_inb(port) fd_ops->fd_inb(port) +#define fd_outb(value,port) fd_ops->fd_outb(value,port) -#define fd_enable_dma(channel) fd_ops->fd_enable_dma(channel) -#define fd_disable_dma(channel) fd_ops->fd_disable_dma(channel) -#define fd_request_dma(channel) fd_ops->fd_request_dma(channel) -#define fd_free_dma(channel) fd_ops->fd_free_dma(channel) -#define fd_clear_dma_ff(channel) fd_ops->fd_clear_dma_ff(channel) -#define fd_set_dma_mode(channel, mode) fd_ops->fd_set_dma_mode(channel, mode) -#define fd_set_dma_addr(channel, addr) fd_ops->fd_set_dma_addr(channel, \ - virt_to_bus(addr)) -#define fd_set_dma_count(channel,count) fd_ops->fd_set_dma_count(channel,count) -#define fd_get_dma_residue(channel) fd_ops->fd_get_dma_residue(channel) +#define fd_enable_dma() fd_ops->fd_enable_dma(FLOPPY_DMA) +#define fd_disable_dma() fd_ops->fd_disable_dma(FLOPPY_DMA) +#define fd_request_dma() fd_ops->fd_request_dma(FLOPPY_DMA) +#define fd_free_dma() fd_ops->fd_free_dma(FLOPPY_DMA) +#define fd_clear_dma_ff() fd_ops->fd_clear_dma_ff(FLOPPY_DMA) +#define fd_set_dma_mode(mode) fd_ops->fd_set_dma_mode(FLOPPY_DMA, mode) +#define fd_set_dma_addr(addr) fd_ops->fd_set_dma_addr(FLOPPY_DMA, \ + virt_to_bus(addr)) +#define fd_set_dma_count(count) fd_ops->fd_set_dma_count(FLOPPY_DMA,count) +#define fd_get_dma_residue() fd_ops->fd_get_dma_residue(FLOPPY_DMA) -#define fd_enable_irq(irq) fd_ops->fd_enable_irq(irq) -#define fd_disable_irq(irq) fd_ops->fd_disable_irq(irq) -#define fd_request_irq(irq) request_irq(irq, floppy_interrupt, \ - SA_INTERRUPT \ - | SA_SAMPLE_RANDOM, \ - "floppy", NULL) -#define fd_free_irq(irq) free_irq(irq, NULL); -#define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size) +#define fd_enable_irq() fd_ops->fd_enable_irq(FLOPPY_IRQ) +#define fd_disable_irq() fd_ops->fd_disable_irq(FLOPPY_IRQ) +#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ + SA_INTERRUPT | SA_SAMPLE_RANDOM, \ + "floppy", NULL) +#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); +#define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size) #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size) -#define fd_drive_type(n) fd_ops->fd_drive_type(n) +#define fd_drive_type(n) fd_ops->fd_drive_type(n) +#define fd_cacheflush(addr,size) dma_cache_wback_inv(addr,size) #define MAX_BUFFER_SECTORS 24 @@ -77,7 +78,7 @@ extern struct fd_ops *fd_ops; #define FLOPPY1_TYPE fd_drive_type(1) #define FDC1 fd_ops->fd_getfdaddr1(); -static int __attribute__((__unused__)) FDC2=-1; +static int FDC2=-1; #define N_FDC 1 /* do you *really* want a second controller? */ #define N_DRIVE 8 diff --git a/include/asm-ppc/bitops.h b/include/asm-ppc/bitops.h index f62ad151f..7f6f12155 100644 --- a/include/asm-ppc/bitops.h +++ b/include/asm-ppc/bitops.h @@ -29,67 +29,121 @@ extern int test_and_change_bit(int nr, volatile void *addr); #define SMP_MB #endif /* CONFIG_SMP */ +#define __INLINE_BITOPS 1 + +#if __INLINE_BITOPS /* - * These are if'd out here because using : "cc" as a constraint - * results in errors from gcc. -- Cort - * Besides, they need to be changed so we have both set_bit - * and test_and_set_bit, etc. + * These used to be if'd out here because using : "cc" as a constraint + * resulted in errors from egcs. Things may be OK with gcc-2.95. */ -#if 0 -extern __inline__ int set_bit(int nr, void * addr) +extern __inline__ void set_bit(int nr, volatile void * addr) { - unsigned long old, t; + unsigned long old; unsigned long mask = 1 << (nr & 0x1f); unsigned long *p = ((unsigned long *)addr) + (nr >> 5); - __asm__ __volatile__( - "1:lwarx %0,0,%3 \n\t" - "or %1,%0,%2 \n\t" - "stwcx. %1,0,%3 \n\t" - "bne 1b \n\t" - : "=&r" (old), "=&r" (t) /*, "=m" (*p)*/ - : "r" (mask), "r" (p) - /*: "cc" */); - - return (old & mask) != 0; + __asm__ __volatile__(SMP_WMB "\ +1: lwarx %0,0,%3 + or %0,%0,%2 + stwcx. %0,0,%3 + bne 1b" + SMP_MB + : "=&r" (old), "=m" (*p) + : "r" (mask), "r" (p), "m" (*p) + : "cc" ); } -extern __inline__ unsigned long clear_bit(unsigned long nr, void *addr) +extern __inline__ void clear_bit(int nr, volatile void *addr) { - unsigned long old, t; + unsigned long old; unsigned long mask = 1 << (nr & 0x1f); unsigned long *p = ((unsigned long *)addr) + (nr >> 5); - __asm__ __volatile__("\n\ + __asm__ __volatile__(SMP_WMB "\ 1: lwarx %0,0,%3 - andc %1,%0,%2 - stwcx. %1,0,%3 + andc %0,%0,%2 + stwcx. %0,0,%3 bne 1b" - : "=&r" (old), "=&r" (t) /*, "=m" (*p)*/ - : "r" (mask), "r" (p) - /*: "cc"*/); - - return (old & mask) != 0; + SMP_MB + : "=&r" (old), "=m" (*p) + : "r" (mask), "r" (p), "m" (*p) + : "cc"); } -extern __inline__ unsigned long change_bit(unsigned long nr, void *addr) +extern __inline__ void change_bit(int nr, volatile void *addr) { - unsigned long old, t; + unsigned long old; unsigned long mask = 1 << (nr & 0x1f); unsigned long *p = ((unsigned long *)addr) + (nr >> 5); - __asm__ __volatile__("\n\ + __asm__ __volatile__(SMP_WMB "\ 1: lwarx %0,0,%3 - xor %1,%0,%2 - stwcx. %1,0,%3 + xor %0,%0,%2 + stwcx. %0,0,%3 + bne 1b" + SMP_MB + : "=&r" (old), "=m" (*p) + : "r" (mask), "r" (p), "m" (*p) + : "cc"); +} + +extern __inline__ int test_and_set_bit(int nr, volatile void *addr) +{ + unsigned int old, t; + unsigned int mask = 1 << (nr & 0x1f); + volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5); + + __asm__ __volatile__(SMP_WMB "\ +1: lwarx %0,0,%4 + or %1,%0,%3 + stwcx. %1,0,%4 + bne 1b" + SMP_MB + : "=&r" (old), "=&r" (t), "=m" (*p) + : "r" (mask), "r" (p), "m" (*p) + : "cc"); + + return (old & mask) != 0; +} + +extern __inline__ int test_and_clear_bit(int nr, volatile void *addr) +{ + unsigned int old, t; + unsigned int mask = 1 << (nr & 0x1f); + volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5); + + __asm__ __volatile__(SMP_WMB "\ +1: lwarx %0,0,%4 + andc %1,%0,%3 + stwcx. %1,0,%4 + bne 1b" + SMP_MB + : "=&r" (old), "=&r" (t), "=m" (*p) + : "r" (mask), "r" (p), "m" (*p) + : "cc"); + + return (old & mask) != 0; +} + +extern __inline__ int test_and_change_bit(int nr, volatile void *addr) +{ + unsigned int old, t; + unsigned int mask = 1 << (nr & 0x1f); + volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5); + + __asm__ __volatile__(SMP_WMB "\ +1: lwarx %0,0,%4 + xor %1,%0,%3 + stwcx. %1,0,%4 bne 1b" - : "=&r" (old), "=&r" (t) /*, "=m" (*p)*/ - : "r" (mask), "r" (p) - /*: "cc"*/); + SMP_MB + : "=&r" (old), "=&r" (t), "=m" (*p) + : "r" (mask), "r" (p), "m" (*p) + : "cc"); return (old & mask) != 0; } -#endif +#endif /* __INLINE_BITOPS */ extern __inline__ int test_bit(int nr, __const__ volatile void *addr) { @@ -277,4 +331,3 @@ found_middle: #define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size) #endif /* _PPC_BITOPS_H */ - diff --git a/include/asm-ppc/byteorder.h b/include/asm-ppc/byteorder.h index 453c846d2..c45dba13b 100644 --- a/include/asm-ppc/byteorder.h +++ b/include/asm-ppc/byteorder.h @@ -9,7 +9,7 @@ #ifdef __GNUC__ -extern __inline__ unsigned ld_le16(volatile unsigned short *addr) +extern __inline__ unsigned ld_le16(const volatile unsigned short *addr) { unsigned val; @@ -17,12 +17,12 @@ extern __inline__ unsigned ld_le16(volatile unsigned short *addr) return val; } -extern __inline__ void st_le16(volatile unsigned short *addr, unsigned val) +extern __inline__ void st_le16(volatile unsigned short *addr, const unsigned val) { __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); } -extern __inline__ unsigned ld_le32(volatile unsigned *addr) +extern __inline__ unsigned ld_le32(const volatile unsigned *addr) { unsigned val; @@ -30,7 +30,7 @@ extern __inline__ unsigned ld_le32(volatile unsigned *addr) return val; } -extern __inline__ void st_le32(volatile unsigned *addr, unsigned val) +extern __inline__ void st_le32(volatile unsigned *addr, const unsigned val) { __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); } @@ -38,7 +38,7 @@ extern __inline__ void st_le32(volatile unsigned *addr, unsigned val) /* alas, egcs sounds like it has a bug in this code that doesn't use the inline asm correctly, and can cause file corruption. Until I hear that it's fixed, I can live without the extra speed. I hope. */ -#if !(__GNUC__ >= 2 && __GNUC_MINOR__ >= 90) +#if !((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 90)) #if 0 # define __arch_swab16(x) ld_le16(&x) # define __arch_swab32(x) ld_le32(&x) diff --git a/include/asm-ppc/cache.h b/include/asm-ppc/cache.h index 069ad9707..c45fd8409 100644 --- a/include/asm-ppc/cache.h +++ b/include/asm-ppc/cache.h @@ -9,7 +9,11 @@ /* bytes per L1 cache line */ #if !defined(CONFIG_8xx) || defined(CONFIG_8260) +#if defined(CONFIG_PPC64BRIDGE) +#define L1_CACHE_BYTES 128 +#else #define L1_CACHE_BYTES 32 +#endif /* PPC64 */ #else #define L1_CACHE_BYTES 16 #endif /* !8xx || 8260 */ diff --git a/include/asm-ppc/est8260.h b/include/asm-ppc/est8260.h index 201286ab4..99337e790 100644 --- a/include/asm-ppc/est8260.h +++ b/include/asm-ppc/est8260.h @@ -1,4 +1,10 @@ +/* Board information for the EST8260, which should be generic for + * all 8260 boards. The IMMR is now given to us so the hard define + * will soon be removed. All of the clock values are computed from + * the configuration SCMR and the Power-On-Reset word. + */ + #define IMAP_ADDR ((uint)0xf0000000) @@ -12,8 +18,10 @@ typedef struct bd_info { unsigned int bi_busfreq; /* Bus Freq, in MHz */ unsigned int bi_cpmfreq; /* CPM Freq, in MHz */ unsigned int bi_brgfreq; /* BRG Freq, in MHz */ + unsigned int bi_vco; /* VCO Out from PLL */ + unsigned int bi_baudrate; /* Default console baud rate */ + unsigned int bi_immr; /* IMMR when called from boot rom */ unsigned char bi_enetaddr[6]; - unsigned int bi_baudrate; } bd_t; extern bd_t m8xx_board_info; diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index a4be6b7e2..6e5a57ad6 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -161,6 +161,20 @@ extern inline void * bus_to_virt(unsigned long address) } /* + * The PCI bus bridge can translate addresses issued by the processor(s) + * into a different address on the PCI bus. On 32-bit cpus, we assume + * this mapping is 1-1, but on 64-bit systems it often isn't. + */ +#ifndef CONFIG_PPC64BRIDGE +#define phys_to_bus(x) (x) +#define bus_to_phys(x) (x) + +#else +extern unsigned long phys_to_bus(unsigned long pa); +extern unsigned long bus_to_phys(unsigned int ba, int busnr); +#endif /* CONFIG_PPC64BRIDGE */ + +/* * Change virtual addresses to physical addresses and vv, for * addresses in the area where the kernel has the RAM mapped. */ diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index 55f185d91..4a3a42f26 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h @@ -10,20 +10,20 @@ #ifndef __ASSEMBLY__ /* Hardware Page Table Entry */ typedef struct _PTE { -#ifdef CONFIG_PPC64 +#ifdef CONFIG_PPC64BRIDGE unsigned long long vsid:52; unsigned long api:5; unsigned long :5; unsigned long h:1; unsigned long v:1; unsigned long long rpn:52; -#else /* CONFIG_PPC64 */ +#else /* CONFIG_PPC64BRIDGE */ unsigned long v:1; /* Entry is valid */ unsigned long vsid:24; /* Virtual segment identifier */ unsigned long h:1; /* Hash algorithm indicator */ unsigned long api:6; /* Abbreviated page index */ unsigned long rpn:20; /* Real (physical) page number */ -#endif /* CONFIG_PPC64 */ +#endif /* CONFIG_PPC64BRIDGE */ unsigned long :3; /* Unused */ unsigned long r:1; /* Referenced */ unsigned long c:1; /* Changed */ @@ -64,11 +64,11 @@ typedef struct _P601_BATU { /* Upper part of BAT for 601 processor */ } P601_BATU; typedef struct _BATU { /* Upper part of BAT (all except 601) */ -#ifdef CONFIG_PPC64 +#ifdef CONFIG_PPC64BRIDGE unsigned long long bepi:47; -#else /* CONFIG_PPC64 */ +#else /* CONFIG_PPC64BRIDGE */ unsigned long bepi:15; /* Effective page index (virtual address) */ -#endif /* CONFIG_PPC64 */ +#endif /* CONFIG_PPC64BRIDGE */ unsigned long :4; /* Unused */ unsigned long bl:11; /* Block size mask */ unsigned long vs:1; /* Supervisor valid */ @@ -83,11 +83,11 @@ typedef struct _P601_BATL { /* Lower part of BAT for 601 processor */ } P601_BATL; typedef struct _BATL { /* Lower part of BAT (all except 601) */ -#ifdef CONFIG_PPC64 +#ifdef CONFIG_PPC64BRIDGE unsigned long long brpn:47; -#else /* CONFIG_PPC64 */ +#else /* CONFIG_PPC64BRIDGE */ unsigned long brpn:15; /* Real page index (physical address) */ -#endif /* CONFIG_PPC64 */ +#endif /* CONFIG_PPC64BRIDGE */ unsigned long :10; /* Unused */ unsigned long w:1; /* Write-thru cache */ unsigned long i:1; /* Cache inhibit */ @@ -135,12 +135,7 @@ typedef struct _MMU_context { pte **pmap; /* Two-level page-map structure */ } MMU_context; -/* invalidate a TLB entry */ -extern inline void _tlbie(unsigned long va) -{ - asm volatile ("tlbie %0" : : "r"(va)); -} - +extern void _tlbie(unsigned long va); /* invalidate a TLB entry */ extern void _tlbia(void); /* invalidate all TLB entries */ #endif /* __ASSEMBLY__ */ diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h index 88d6970a5..bdb1447ed 100644 --- a/include/asm-ppc/mmu_context.h +++ b/include/asm-ppc/mmu_context.h @@ -48,8 +48,12 @@ extern void mmu_context_overflow(void); * Set the current MMU context. * On 32-bit PowerPCs (other than the 8xx embedded chips), this is done by * loading up the segment registers for the user part of the address space. + * + * On the 8xx parts, the context currently includes the page directory, + * and once I implement a real TLB context manager this will disappear. + * The PGD is ignored on other processors. - Dan */ -extern void set_context(int context); +extern void set_context(int context, void *pgd); #ifdef CONFIG_8xx extern inline void mmu_context_overflow(void) @@ -85,7 +89,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, { tsk->thread.pgdir = next->pgd; get_mmu_context(next); - set_context(next->context); + set_context(next->context, next->pgd); } /* @@ -96,7 +100,7 @@ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm { current->thread.pgdir = mm->pgd; get_mmu_context(mm); - set_context(mm->context); + set_context(mm->context, mm->pgd); } /* diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 5c4e39902..505f0c5b6 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -72,7 +72,7 @@ extern void __flush_page_to_ram(unsigned long page_va); #define flush_page_to_ram(page) __flush_page_to_ram(page_address(page)) extern unsigned long va_to_phys(unsigned long address); -extern pte_t *va_to_pte(struct task_struct *tsk, unsigned long address); +extern pte_t *va_to_pte(unsigned long address); extern unsigned long ioremap_bot, ioremap_base; #endif /* __ASSEMBLY__ */ diff --git a/include/asm-ppc/posix_types.h b/include/asm-ppc/posix_types.h index 47539d3a7..2d8f38fd5 100644 --- a/include/asm-ppc/posix_types.h +++ b/include/asm-ppc/posix_types.h @@ -1,8 +1,6 @@ #ifndef _PPC_POSIX_TYPES_H #define _PPC_POSIX_TYPES_H -#include <linux/config.h> /* for CONFIG_PPC64 */ - /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -17,17 +15,8 @@ typedef long __kernel_off_t; typedef int __kernel_pid_t; typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; - -/* Grrr... gcc thinks size_t is unsigned int, so we either - have to have this nonsense or use -fno-builtin. - paulus */ -#ifdef CONFIG_PPC64 -typedef unsigned long __kernel_size_t; -typedef long __kernel_ssize_t; -#else typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; -#endif /* CONFIG_PPC64 */ - typedef long __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_suseconds_t; diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index 3088dd279..86a086e79 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -15,10 +15,10 @@ /* Machine State Register (MSR) Fields */ -#ifdef CONFIG_PPC64 +#ifdef CONFIG_PPC64BRIDGE #define MSR_SF (1<<63) #define MSR_ISF (1<<61) -#endif /* CONFIG_PPC64 */ +#endif /* CONFIG_PPC64BRIDGE */ #define MSR_VEC (1<<25) /* Enable AltiVec */ #define MSR_POW (1<<18) /* Enable Power Management */ #define MSR_WE (1<<18) /* Wait State Enable */ diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h index 66eaedda5..70ff81302 100644 --- a/include/asm-ppc/prom.h +++ b/include/asm-ppc/prom.h @@ -4,6 +4,8 @@ * * Copyright (C) 1996 Paul Mackerras. */ +#ifndef _PPC_PROM_H +#define _PPC_PROM_H typedef void *phandle; typedef void *ihandle; @@ -86,3 +88,5 @@ extern int call_rtas(const char *service, int nargs, int nret, extern void prom_drawstring(const char *c); extern void prom_drawhex(unsigned long v); extern void prom_drawchar(char c); + +#endif /* _PPC_PROM_H */ diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 448f0b274..f95656dd2 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h @@ -20,7 +20,7 @@ #include <linux/config.h> #ifndef __ASSEMBLY__ -#ifdef CONFIG_PPC64 +#ifdef CONFIG_PPC64BRIDGE #define PPC_REG unsigned long /*long*/ #else #define PPC_REG unsigned long diff --git a/include/asm-ppc/rpxclassic.h b/include/asm-ppc/rpxclassic.h index 74be56085..b84a20d12 100644 --- a/include/asm-ppc/rpxclassic.h +++ b/include/asm-ppc/rpxclassic.h @@ -8,6 +8,8 @@ #ifndef __MACH_RPX_DEFS #define __MACH_RPX_DEFS +#include <linux/config.h> + /* A Board Information structure that is given to a program when * prom starts it up. */ @@ -26,8 +28,6 @@ extern bd_t m8xx_board_info; * We just map a few things we need. The CSR is actually 4 byte-wide * registers that can be accessed as 8-, 16-, or 32-bit values. */ -#define PCMCIA_MEM_ADDR ((uint)0x04000000) -#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) #define PCI_ISA_IO_ADDR ((unsigned)0x80000000) #define PCI_ISA_IO_SIZE ((uint)(512 * 1024 * 1024)) #define PCI_ISA_MEM_ADDR ((unsigned)0xc0000000) @@ -38,6 +38,12 @@ extern bd_t m8xx_board_info; #define IMAP_SIZE ((uint)(64 * 1024)) #define PCI_CSR_ADDR ((uint)0x80000000) #define PCI_CSR_SIZE ((uint)(64 * 1024)) +#define PCMCIA_MEM_ADDR ((uint)0xe0000000) +#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) +#define PCMCIA_IO_ADDR ((uint)0xe4000000) +#define PCMCIA_IO_SIZE ((uint)(4 * 1024)) +#define PCMCIA_ATTRB_ADDR ((uint)0xe8000000) +#define PCMCIA_ATTRB_SIZE ((uint)(4 * 1024)) /* Things of interest in the CSR. */ @@ -49,8 +55,19 @@ extern bd_t m8xx_board_info; #define BCSR0_FLASH_SEL ((uint)0x02000000) #define BCSR0_ENMONXCVR ((uint)0x01000000) +#define BCSR0_PCMCIAVOLT ((uint)0x000f0000) /* CLLF */ +#define BCSR0_PCMCIA3VOLT ((uint)0x000a0000) /* CLLF */ +#define BCSR0_PCMCIA5VOLT ((uint)0x00060000) /* CLLF */ + #define BCSR2_EN232XCVR ((uint)0x00008000) #define BCSR2_QSPACESEL ((uint)0x00004000) +#define BCSR2_FETHLEDMODE ((uint)0x00000800) /* CLLF */ + +#if defined(CONFIG_RPXLCD) || defined(CONFIG_HTDMSOUND) +/* HIOX Expansion card. +*/ +#include <asm/rpx_hiox.h> +#endif /* Interrupt level assignments. */ diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index af62f7b5a..aec727670 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h @@ -37,9 +37,11 @@ void smp_send_tlb_invalidate(int); #define cpu_number_map(x) (x) extern volatile unsigned long cpu_callin_map[NR_CPUS]; -#define hard_smp_processor_id() (0) #define smp_processor_id() (current->processor) +extern int smp_hw_index[NR_CPUS]; +#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()]) + struct klock_info_struct { unsigned long kernel_flag; unsigned char akp; diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index fa9bc9944..162a09a1d 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -8,7 +8,6 @@ #include <linux/config.h> #include <linux/kdev_t.h> -#include <linux/bitops.h> #include <asm/processor.h> #include <asm/atomic.h> diff --git a/include/asm-ppc/uaccess.h b/include/asm-ppc/uaccess.h index c2a9c91e5..3eafdbd91 100644 --- a/include/asm-ppc/uaccess.h +++ b/include/asm-ppc/uaccess.h @@ -211,16 +211,28 @@ extern int __copy_tofrom_user(void *to, const void *from, unsigned long size); extern inline unsigned long copy_from_user(void *to, const void *from, unsigned long n) { + unsigned long over; + if (access_ok(VERIFY_READ, from, n)) return __copy_tofrom_user(to, from, n); + if ((unsigned long)from < TASK_SIZE) { + over = (unsigned long)from + n - TASK_SIZE; + return __copy_tofrom_user(to, from, n - over) + over; + } return n; } extern inline unsigned long copy_to_user(void *to, const void *from, unsigned long n) { + unsigned long over; + if (access_ok(VERIFY_WRITE, to, n)) return __copy_tofrom_user(to, from, n); + if ((unsigned long)to < TASK_SIZE) { + over = (unsigned long)to + n - TASK_SIZE; + return __copy_tofrom_user(to, from, n - over) + over; + } return n; } diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index f5f854749..bca251d93 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h @@ -270,6 +270,7 @@ do { \ extern inline int pte_none(pte_t pte) { return ((pte_val(pte) & (_PAGE_INVALID | _PAGE_RO)) == _PAGE_INVALID); } extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } extern inline void pte_clear(pte_t *ptep) { pte_val(*ptep) = _PAGE_INVALID; } +#define PTE_INIT(x) pte_clear(x) extern inline int pte_pagenr(pte_t pte) { return ((unsigned long)((pte_val(pte) >> PAGE_SHIFT))); } extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } diff --git a/include/asm-sh/hd64461.h b/include/asm-sh/hd64461.h new file mode 100644 index 000000000..67110806d --- /dev/null +++ b/include/asm-sh/hd64461.h @@ -0,0 +1,37 @@ +#ifndef __ASM_SH_HD64461 +#define __ASM_SH_HD64461 +/* + * $Id: hd64461.h,v 1.1 2000/06/10 21:45:48 yaegashi Exp $ + * Copyright (C) 2000 YAEGASHI Takeshi + * Hitachi HD64461 companion chip support + */ + +#define HD64461_CPTWAR 0x1030 +#define HD64461_CPTWDR 0x1032 +#define HD64461_CPTRAR 0x1034 +#define HD64461_CPTRDR 0x1036 + +#define HD64461_PCC0ISR 0x2000 +#define HD64461_PCC0GCR 0x2002 +#define HD64461_PCC0CSCR 0x2004 +#define HD64461_PCC0CSCIER 0x2006 +#define HD64461_PCC0SCR 0x2008 +#define HD64461_PCC1ISR 0x2010 +#define HD64461_PCC1GCR 0x2012 +#define HD64461_PCC1CSCR 0x2014 +#define HD64461_PCC1CSCIER 0x2016 +#define HD64461_PCC1SCR 0x2018 +#define HD64461_P0OCR 0x202a +#define HD64461_P1OCR 0x202c +#define HD64461_PGCR 0x202e + +#define HD64461_NIRR 0x5000 +#define HD64461_NIMR 0x5002 + +#ifndef CONFIG_HD64461_IOBASE +#define CONFIG_HD64461_IOBASE 0xb0000000 +#endif + +#define HD64461_IRQBASE 64 + +#endif diff --git a/include/asm-sh/hitachi_se.h b/include/asm-sh/hitachi_se.h index 282bbce8f..05b701e1f 100644 --- a/include/asm-sh/hitachi_se.h +++ b/include/asm-sh/hitachi_se.h @@ -39,6 +39,22 @@ #define PA_BCR 0xb1400000 /* FPGA */ #define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controler */ +#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */ +#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */ +#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */ +#define MRSHPC_OPTION (PA_MRSHPC + 6) +#define MRSHPC_CSR (PA_MRSHPC + 8) +#define MRSHPC_ISR (PA_MRSHPC + 10) +#define MRSHPC_ICR (PA_MRSHPC + 12) +#define MRSHPC_CPWCR (PA_MRSHPC + 14) +#define MRSHPC_MW0CR1 (PA_MRSHPC + 16) +#define MRSHPC_MW1CR1 (PA_MRSHPC + 18) +#define MRSHPC_IOWCR1 (PA_MRSHPC + 20) +#define MRSHPC_MW0CR2 (PA_MRSHPC + 22) +#define MRSHPC_MW1CR2 (PA_MRSHPC + 24) +#define MRSHPC_IOWCR2 (PA_MRSHPC + 26) +#define MRSHPC_CDCR (PA_MRSHPC + 28) +#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30) #define BCR_ILCRA (PA_BCR + 0) #define BCR_ILCRB (PA_BCR + 2) diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h index cc30fac03..1112ea36c 100644 --- a/include/asm-sh/ide.h +++ b/include/asm-sh/ide.h @@ -17,7 +17,7 @@ #include <linux/config.h> #ifndef MAX_HWIFS -#define MAX_HWIFS 1 /* XXX: For my board -- gniibe */ +#define MAX_HWIFS 1 #endif #define ide__sti() __sti() @@ -25,8 +25,13 @@ static __inline__ int ide_default_irq(ide_ioreg_t base) { switch (base) { - case 0xba0001f0: return 14; - case 0xba000170: return 14; +#ifdef CONFIG_SH_HP600 + case 0x201f0: return 77; + case 0x20170: return 77; +#else + case 0x01f0: return 14; + case 0x0170: return 15; +#endif default: return 0; } @@ -35,10 +40,17 @@ static __inline__ int ide_default_irq(ide_ioreg_t base) static __inline__ ide_ioreg_t ide_default_io_base(int index) { switch (index) { +#ifdef CONFIG_SH_HP600 + case 0: + return 0x201f0; + case 1: + return 0x20170; +#else case 0: - return 0xba0001f0; + return 0x1f0; case 1: - return 0xba000170; + return 0x170; +#endif default: return 0; } diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index c6de2a42a..0d516620c 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h @@ -85,9 +85,6 @@ extern unsigned long sh_isa_slot(unsigned long offset); #define isa_memcpy_toio(a,b,c) \ memcpy((void *)(sh_isa_slot((unsigned long)(a))),(b),(c)) -#define ctrl_in(addr) *(addr) -#define ctrl_out(data,addr) *(addr) = (data) - extern __inline__ unsigned long ctrl_inb(unsigned long addr) { return *(volatile unsigned char*)addr; diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index d013f35fc..951ad2e9f 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h @@ -43,8 +43,12 @@ #elif defined(CONFIG_CPU_SUBTYPE_SH7708) #define NR_IRQS 32 #elif defined(CONFIG_CPU_SUBTYPE_SH7709) +#ifdef CONFIG_HD64461 +#define NR_IRQS 80 /* HD64461_IRQBASE+16, see hd64461.h */ +#else #define NR_IRQS 61 #endif +#endif extern void disable_irq(unsigned int); extern void disable_irq_nosync(unsigned int); diff --git a/include/asm-sh/keyboard.h b/include/asm-sh/keyboard.h new file mode 100644 index 000000000..3a3f56940 --- /dev/null +++ b/include/asm-sh/keyboard.h @@ -0,0 +1,43 @@ +#ifndef __ASM_SH_KEYBOARD_H +#define __ASM_SH_KEYBOARD_H +/* + * $Id: keyboard.h,v 1.1 2000/06/10 21:45:48 yaegashi Exp $ + */ + +static __inline__ int kbd_setkeycode(unsigned int scancode, + unsigned int keycode) +{ + return -EOPNOTSUPP; +} + +static __inline__ int kbd_getkeycode(unsigned int scancode) +{ + return scancode > 127 ? -EINVAL : scancode; +} + +static __inline__ int kbd_translate(unsigned char scancode, + unsigned char *keycode, char raw_mode) +{ + *keycode = scancode; + return 1; +} + +static __inline__ char kbd_unexpected_up(unsigned char keycode) +{ + return 0200; +} + +static __inline__ void kbd_leds(unsigned char leds) +{ +} + +#ifdef CONFIG_SH_HP600 +void __init hp600_kbd_init_hw(void); +#define kbd_init_hw hp600_kbd_init_hw +#else +static __inline__ void kbd_init_hw(void) +{ +} +#endif + +#endif diff --git a/include/asm-sh/linux_logo.h b/include/asm-sh/linux_logo.h new file mode 100644 index 000000000..b7d11eddb --- /dev/null +++ b/include/asm-sh/linux_logo.h @@ -0,0 +1,48 @@ +/* $Id: linux_logo.h,v 1.1 2000/06/10 21:45:48 yaegashi Exp $ + * include/asm-sh/linux_logo.h: This is a linux logo + * to be displayed on boot. + * + * Copyright (C) 1996 Larry Ewing (lewing@isc.tamu.edu) + * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * + * You can put anything here, but: + * LINUX_LOGO_COLORS has to be less than 224 + * image size has to be 80x80 + * values have to start from 0x20 + * (i.e. RGB(linux_logo_red[0], + * linux_logo_green[0], + * linux_logo_blue[0]) is color 0x20) + * BW image has to be 80x80 as well, with MS bit + * on the left + * Serial_console ascii image can be any size, + * but should contain %s to display the version + */ + +#include <linux/init.h> +#include <linux/version.h> + +#define linux_logo_banner "Linux/SuperH version " UTS_RELEASE + +#define LINUX_LOGO_COLORS 214 + +#ifdef INCLUDE_LINUX_LOGO_DATA + +#define INCLUDE_LINUX_LOGOBW +#define INCLUDE_LINUX_LOGO16 + +#include <linux/linux_logo.h> + +#else + +/* prototypes only */ +extern unsigned char linux_logo_red[]; +extern unsigned char linux_logo_green[]; +extern unsigned char linux_logo_blue[]; +extern unsigned char linux_logo[]; +extern unsigned char linux_logo_bw[]; +extern unsigned char linux_logo16_red[]; +extern unsigned char linux_logo16_green[]; +extern unsigned char linux_logo16_blue[]; +extern unsigned char linux_logo16[]; + +#endif diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index f39d88aaa..31920c13b 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -89,26 +89,26 @@ extern unsigned long empty_zero_page[1024]; #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END P4SEG -#define _PAGE_READ 0x001 /* software: read access allowed */ +#define _PAGE_PRESENT 0x001 /* software: page is present */ #define _PAGE_ACCESSED 0x002 /* software: page referenced */ #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ -/* 0x010 */ +/* 0x010 SZ-bit : size of page */ #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ #define _PAGE_PROTNONE 0x080 /* software: if not present */ -#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ +/* 0x100 V-bit : page is valid */ #if defined(__sh3__) /* Mask which drop software flags */ -#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff16c +#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff06c /* Flags defalult: SZ=1 (4k-byte), C=0 (non-cachable), SH=0 (not shared) */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000010 +#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000110 #elif defined(__SH4__) /* Mask which drops software flags */ -#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff16c +#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff06c /* Flags defalult: SZ=01 (4k-byte), C=0 (non-cachable), SH=0 (not shared), WT=0 */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000010 +#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000110 #endif #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index 1fcfb1300..cf59dbb88 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h @@ -36,6 +36,7 @@ struct sh_cpuinfo { unsigned long *pgd_quick; unsigned long *pte_quick; unsigned long pgtable_cache_sz; + unsigned int cpu_clock, master_clock, bus_clock, module_clock; }; extern struct sh_cpuinfo boot_cpu_data; diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h index a61cd3aba..e716331ee 100644 --- a/include/asm-sh/ptrace.h +++ b/include/asm-sh/ptrace.h @@ -92,11 +92,11 @@ extern void show_regs(struct pt_regs *); #define BAMR_ASID (1 << 2) #define BAMR_NONE 0 -#define BAMR_10 0x1 -#define BAMR_12 0x2 +#define BAMR_10 0x1 +#define BAMR_12 0x2 #define BAMR_ALL 0x3 -#define BAMR_16 0x8 -#define BAMR_20 0x9 +#define BAMR_16 0x8 +#define BAMR_20 0x9 #define BBR_INST (1 << 4) #define BBR_DATA (2 << 4) diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index 65ed58fd8..2237d34a4 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h @@ -209,6 +209,7 @@ __asm__ __volatile__( \ extern void __put_user_unknown(void); /* Generic arbitrary sized copy. */ +/* Return the number of bytes NOT copied */ /* XXX: should be such that: 4byte and the rest. */ extern __inline__ __kernel_size_t __copy_user(void *__to, const void *__from, __kernel_size_t __n) @@ -216,6 +217,7 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n) unsigned long __dummy, _f, _t; __kernel_size_t res; + if ((res = __n)) __asm__ __volatile__( "9:\n\t" "mov.b @%2+, %1\n\t" @@ -229,17 +231,17 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n) "3:\n\t" "mov.l 5f, %1\n\t" "jmp @%1\n\t" - " mov %7, %0\n\t" + " add #1, %0\n\t" ".balign 4\n" "5: .long 2b\n" ".previous\n" ".section __ex_table,\"a\"\n" " .balign 4\n" - " .long 9b,3b\n" - " .long 1b,2b\n" + " .long 9b,2b\n" + " .long 1b,3b\n" ".previous" : "=r" (res), "=&z" (__dummy), "=r" (_f), "=r" (_t) - : "2" (__from), "3" (__to), "0" (__n), "i" (-EFAULT) + : "2" (__from), "3" (__to), "0" (res) : "memory"); return res; diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h index b0f06a0bc..f781635d6 100644 --- a/include/asm-sparc/head.h +++ b/include/asm-sparc/head.h @@ -1,4 +1,4 @@ -/* $Id: head.h,v 1.38 1999/12/01 23:52:04 davem Exp $ */ +/* $Id: head.h,v 1.39 2000/05/26 22:18:45 ecd Exp $ */ #ifndef __SPARC_HEAD_H #define __SPARC_HEAD_H @@ -95,7 +95,7 @@ /* The Get PSR software trap for userland. */ #define GETPSR_TRAP \ - mov %psr, %o0; jmpl %l2, %g0; rett %l2 + 4; nop; + mov %psr, %i0; jmp %l2; rett %l2 + 4; nop; /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and * gets handled with another macro. diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h index aa0bcbfdb..d4254fa1e 100644 --- a/include/asm-sparc/ide.h +++ b/include/asm-sparc/ide.h @@ -1,4 +1,4 @@ -/* $Id: ide.h,v 1.5 2000/05/22 07:29:43 davem Exp $ +/* $Id: ide.h,v 1.6 2000/05/27 00:49:37 davem Exp $ * ide.h: SPARC PCI specific IDE glue. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h index 8a0fdfd51..3ea491663 100644 --- a/include/asm-sparc/kdebug.h +++ b/include/asm-sparc/kdebug.h @@ -1,4 +1,4 @@ -/* $Id: kdebug.h,v 1.10 1997/12/14 23:24:40 ecd Exp $ +/* $Id: kdebug.h,v 1.11 2000/06/04 06:23:53 anton Exp $ * kdebug.h: Defines and definitions for debugging the Linux kernel * under various kernel debuggers. * @@ -8,13 +8,7 @@ #define _SPARC_KDEBUG_H #include <asm/openprom.h> - -/* The debugger lives in 1MB of virtual address space right underneath - * the boot prom. - */ - -#define DEBUG_FIRSTVADDR 0xffc00000 -#define DEBUG_LASTVADDR LINUX_OPPROM_BEGVM +#include <asm/vaddrs.h> /* Breakpoints are enter through trap table entry 126. So in sparc assembly * if you want to drop into the debugger you do: diff --git a/include/asm-sparc/mc146818rtc.h b/include/asm-sparc/mc146818rtc.h new file mode 100644 index 000000000..9431df163 --- /dev/null +++ b/include/asm-sparc/mc146818rtc.h @@ -0,0 +1,27 @@ +/* + * Machine dependent access functions for RTC registers. + */ +#ifndef __ASM_SPARC_MC146818RTC_H +#define __ASM_SPARC_MC146818RTC_H + +#include <asm/io.h> + +#ifndef RTC_PORT +#define RTC_PORT(x) (0x70 + (x)) +#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ +#endif + +/* + * The yet supported machines all access the RTC index register via + * an ISA port access but the way to access the date register differs ... + */ +#define CMOS_READ(addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +inb_p(RTC_PORT(1)); \ +}) +#define CMOS_WRITE(val, addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +outb_p((val),RTC_PORT(1)); \ +}) + +#endif /* __ASM_SPARC_MC146818RTC_H */ diff --git a/include/asm-sparc/openprom.h b/include/asm-sparc/openprom.h index c88dc02a1..12929a20f 100644 --- a/include/asm-sparc/openprom.h +++ b/include/asm-sparc/openprom.h @@ -1,4 +1,4 @@ -/* $Id: openprom.h,v 1.23 1998/09/21 05:07:26 jj Exp $ */ +/* $Id: openprom.h,v 1.24 2000/06/04 06:23:53 anton Exp $ */ #ifndef __SPARC_OPENPROM_H #define __SPARC_OPENPROM_H @@ -8,10 +8,9 @@ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ +#include <asm/vaddrs.h> + /* Empirical constants... */ -#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */ -#define LINUX_OPPROM_BEGVM 0xffd00000 -#define LINUX_OPPROM_ENDVM 0xfff00000 #define LINUX_OPPROM_MAGIC 0x10010407 #ifndef __ASSEMBLY__ diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 379c8cc97..c727c06d8 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.52 2000/03/28 06:07:25 anton Exp $ +/* $Id: page.h,v 1.53 2000/06/04 08:36:33 anton Exp $ * page.h: Various defines and such for MMU operations on the Sparc for * the Linux kernel. * @@ -32,7 +32,13 @@ #ifndef __ASSEMBLY__ -#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +/* + * XXX I am hitting compiler bugs with __builtin_trap. This has + * hit me before and rusty was blaming his netfilter bugs on + * this so lets disable it. - Anton + */ +#if 0 +/* #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) */ /* We need the mb()'s so we don't trigger a compiler bug - Anton */ #define BUG() do { \ mb(); \ diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h index c0850c9a9..71a03dc02 100644 --- a/include/asm-sparc/pgalloc.h +++ b/include/asm-sparc/pgalloc.h @@ -1,4 +1,4 @@ -/* $Id: pgalloc.h,v 1.4 2000/05/09 17:40:15 davem Exp $ */ +/* $Id: pgalloc.h,v 1.5 2000/06/04 06:23:53 anton Exp $ */ #ifndef _SPARC_PGALLOC_H #define _SPARC_PGALLOC_H @@ -103,23 +103,7 @@ extern struct pgtable_cache_struct { #define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz) #define pgd_cache_size (pgt_quicklists.pgd_cache_sz) -BTFIXUPDEF_CALL(pte_t *, get_pte_fast, void) -BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void) -BTFIXUPDEF_CALL(void, free_pte_slow, pte_t *) -BTFIXUPDEF_CALL(void, free_pgd_slow, pgd_t *) BTFIXUPDEF_CALL(int, do_check_pgt_cache, int, int) - -#define get_pte_fast() BTFIXUP_CALL(get_pte_fast)() -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} -#define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)() -#define free_pte_slow(pte) BTFIXUP_CALL(free_pte_slow)(pte) -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ -} -#define free_pgd_slow(pgd) BTFIXUP_CALL(free_pgd_slow)(pgd) #define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high) /* diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 04b34e5e9..a4a1ef3ce 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.94 2000/03/28 06:07:25 anton Exp $ */ +/* $Id: pgtable.h,v 1.96 2000/06/05 06:08:46 anton Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -52,19 +52,14 @@ BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct s /* * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep. - * mmu_flush/inval belong to CPU. Valid on IIep. */ BTFIXUPDEF_CALL(void, mmu_map_dma_area, unsigned long va, __u32 addr, int len) BTFIXUPDEF_CALL(unsigned long /*phys*/, mmu_translate_dvma, unsigned long busa) BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long busa, int len) -BTFIXUPDEF_CALL(void, mmu_inval_dma_area, unsigned long virt, int len) -BTFIXUPDEF_CALL(void, mmu_flush_dma_area, unsigned long virt, int len) #define mmu_map_dma_area(va, ba,len) BTFIXUP_CALL(mmu_map_dma_area)(va,ba,len) #define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len) #define mmu_translate_dvma(ba) BTFIXUP_CALL(mmu_translate_dvma)(ba) -#define mmu_inval_dma_area(va,len) BTFIXUP_CALL(mmu_inval_dma_area)(va,len) -#define mmu_flush_dma_area(va,len) BTFIXUP_CALL(mmu_flush_dma_area)(va,len) BTFIXUPDEF_SIMM13(pmd_shift) BTFIXUPDEF_SETHI(pmd_size) @@ -92,9 +87,6 @@ BTFIXUPDEF_SIMM13(ptrs_per_pgd) BTFIXUPDEF_SIMM13(user_ptrs_per_pgd) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -/* This is the same accross all platforms */ -#define VMALLOC_START (0xfe300000) -#define VMALLOC_END ~0x0UL #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) #define pte_ERROR(e) __builtin_trap() diff --git a/include/asm-sparc/pgtsrmmu.h b/include/asm-sparc/pgtsrmmu.h index fc569dcaf..d8f68c3fb 100644 --- a/include/asm-sparc/pgtsrmmu.h +++ b/include/asm-sparc/pgtsrmmu.h @@ -1,4 +1,4 @@ -/* $Id: pgtsrmmu.h,v 1.29 1998/07/26 03:05:42 davem Exp $ +/* $Id: pgtsrmmu.h,v 1.30 2000/06/05 06:08:46 anton Exp $ * pgtsrmmu.h: SRMMU page table defines and code. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -29,9 +29,6 @@ #define SRMMU_PMD_TABLE_SIZE 0x100 /* 64 entries, 4 bytes a piece */ #define SRMMU_PGD_TABLE_SIZE 0x400 /* 256 entries, 4 bytes a piece */ -#define SRMMU_VMALLOC_START (0xfe300000) -#define SRMMU_VMALLOC_END ~0x0UL - /* Definition of the values in the ET field of PTD's and PTE's */ #define SRMMU_ET_MASK 0x3 #define SRMMU_ET_INVALID 0x0 diff --git a/include/asm-sparc/pgtsun4.h b/include/asm-sparc/pgtsun4.h index d9d8afaa2..1c6efda33 100644 --- a/include/asm-sparc/pgtsun4.h +++ b/include/asm-sparc/pgtsun4.h @@ -1,4 +1,4 @@ -/* $Id: pgtsun4.h,v 1.4 1998/07/26 03:05:42 davem Exp $ +/* $Id: pgtsun4.h,v 1.5 2000/06/05 06:08:46 anton Exp $ * pgtsun4.h: Sun4 specific pgtable.h defines and code. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -43,13 +43,6 @@ #define SUN4C_PTRS_PER_PMD 1 #define SUN4C_PTRS_PER_PGD 1024 -/* On the sun4 the physical ram limit is 128MB. We set up our I/O - * translations at KERNBASE + 128MB for 1MB, then we begin the VMALLOC - * area, makes sense. This works out to the value below. - */ -#define SUN4C_VMALLOC_START (0xfe300000) -#define SUN4C_VMALLOC_END ~0x0UL - /* * Sparc SUN4C pte fields. */ diff --git a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h index 197f4afca..0cc124655 100644 --- a/include/asm-sparc/pgtsun4c.h +++ b/include/asm-sparc/pgtsun4c.h @@ -1,4 +1,4 @@ -/* $Id: pgtsun4c.h,v 1.36 1998/07/26 03:05:44 davem Exp $ +/* $Id: pgtsun4c.h,v 1.37 2000/06/05 06:08:46 anton Exp $ * pgtsun4c.h: Sun4c specific pgtable.h defines and code. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -42,13 +42,6 @@ #define SUN4C_PTRS_PER_PMD 1 #define SUN4C_PTRS_PER_PGD 1024 -/* On the sun4c the physical ram limit is 128MB. We set up our I/O - * translations at KERNBASE + 128MB for 1MB, then we begin the VMALLOC - * area, makes sense. This works out to the value below. - */ -#define SUN4C_VMALLOC_START (0xfe300000) -#define SUN4C_VMALLOC_END ~0x0UL - /* * Sparc SUN4C pte fields. */ diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h index d8d3a4c27..61e4ef22f 100644 --- a/include/asm-sparc/siginfo.h +++ b/include/asm-sparc/siginfo.h @@ -1,4 +1,4 @@ -/* $Id: siginfo.h,v 1.7 2000/01/29 07:41:51 davem Exp $ +/* $Id: siginfo.h,v 1.8 2000/05/27 00:49:37 davem Exp $ * siginfo.c: */ diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h index ab723d99c..cbcebff57 100644 --- a/include/asm-sparc/socket.h +++ b/include/asm-sparc/socket.h @@ -1,4 +1,4 @@ -/* $Id: socket.h,v 1.13 2000/02/27 19:47:43 davem Exp $ */ +/* $Id: socket.h,v 1.14 2000/06/09 07:35:28 davem Exp $ */ #ifndef _ASM_SOCKET_H #define _ASM_SOCKET_H diff --git a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h index 1c76a9b9d..5cbec8210 100644 --- a/include/asm-sparc/vaddrs.h +++ b/include/asm-sparc/vaddrs.h @@ -1,38 +1,27 @@ -/* $Id: vaddrs.h,v 1.23 2000/03/12 04:10:46 davem Exp $ */ +/* $Id: vaddrs.h,v 1.25 2000/06/05 06:08:46 anton Exp $ */ #ifndef _SPARC_VADDRS_H #define _SPARC_VADDRS_H #include <asm/head.h> -/* asm-sparc/vaddrs.h: Here will be define the virtual addresses at - * which important I/O addresses will be mapped. - * For instance the timer register virtual address - * is defined here. +/* + * asm-sparc/vaddrs.h: Here we define the virtual addresses at + * which important things will be mapped. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com) */ -/* I can see only one reason why we should have statically defined - * mappings for devices and is the speedup improvements of not loading - * a pointer and then the value in the assembly code - */ -#define IOBASE_VADDR 0xfe000000 /* Base for mapping pages */ -#define IOBASE_LEN 0x00300000 /* Length of the IO area */ -#define IOBASE_END 0xfe300000 -#define DVMA_VADDR 0xfff00000 /* Base area of the DVMA on suns */ -#define DVMA_LEN 0x000c0000 /* Size of the DVMA address space */ -#define DVMA_END 0xfffc0000 +#define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */ +#define IOBASE_VADDR 0xfe000000 +#define IOBASE_END 0xfe300000 -/* IOMMU Mapping area, must be on a 16MB boundary! Note this - * doesn't count the DVMA areas, the prom lives between the - * iommu mapping area (for scsi transfer buffers) and the - * dvma upper range (for lance packet ring buffers). - */ -#define IOMMU_VADDR 0xff000000 -#define IOMMU_LEN 0x00c00000 -#define IOMMU_END 0xffc00000 /* KADB debugger vm starts here */ +#define VMALLOC_START 0xfe300000 +/* XXX Alter this when I get around to fixing sun4c - Anton */ +#define VMALLOC_END 0xffc00000 -/* On the sun4/4c we don't need an IOMMU area, but we need a place +/* + * On the sun4/4c we need a place * to reliably map locked down kernel data. This includes the * task_struct and kernel stack pages of each process plus the * scsi buffers during dvma IO transfers, also the floppy buffers @@ -44,22 +33,18 @@ * careful if you change NR_TASKS or else there won't be enough * room for it all. */ -#define SUN4C_LOCK_VADDR 0xff000000 -#define SUN4C_LOCK_LEN 0x00c00000 -#define SUN4C_LOCK_END 0xffc00000 +#define SUN4C_LOCK_VADDR 0xff000000 +#define SUN4C_LOCK_END 0xffc00000 -/* On sun4m machines we need per-cpu virtual areas */ -#define PERCPU_VADDR 0xffc00000 /* Base for per-cpu virtual mappings */ -#define PERCPU_ENTSIZE 0x00100000 -#define PERCPU_LEN ((PERCPU_ENTSIZE*SUN4M_NCPUS)) +#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */ +#define KADB_DEBUGGER_ENDVM 0xffd00000 +#define DEBUG_FIRSTVADDR KADB_DEBUGGER_BEGVM +#define DEBUG_LASTVADDR KADB_DEBUGGER_ENDVM -/* per-cpu offsets */ -#define PERCPU_TBR_OFFSET 0x00000 /* %tbr, mainly used for identification. */ -#define PERCPU_KSTACK_OFFSET 0x01000 /* Beginning of kernel stack for this cpu */ -#define PERCPU_MBOX_OFFSET 0x03000 /* Prom SMP Mailbox */ -#define PERCPU_CPUID_OFFSET 0x04000 /* Per-cpu ID number. */ -#define PERCPU_ISALIVE_OFFSET 0x04004 /* Has CPU been initted yet? */ -#define PERCPU_ISIDLING_OFFSET 0x04008 /* Is CPU in idle loop spinning? */ +#define LINUX_OPPROM_BEGVM 0xffd00000 +#define LINUX_OPPROM_ENDVM 0xfff00000 -#endif /* !(_SPARC_VADDRS_H) */ +#define DVMA_VADDR 0xfff00000 /* Base area of the DVMA on suns */ +#define DVMA_END 0xfffc0000 +#endif /* !(_SPARC_VADDRS_H) */ diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index 71bfa67ca..4f621f2cb 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h @@ -1,4 +1,4 @@ -/* $Id: ide.h,v 1.18 2000/05/22 07:29:43 davem Exp $ +/* $Id: ide.h,v 1.19 2000/05/27 00:49:37 davem Exp $ * ide.h: Ultra/PCI specific IDE glue. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) diff --git a/include/asm-sparc64/mc146818rtc.h b/include/asm-sparc64/mc146818rtc.h new file mode 100644 index 000000000..05c8ffd97 --- /dev/null +++ b/include/asm-sparc64/mc146818rtc.h @@ -0,0 +1,27 @@ +/* + * Machine dependent access functions for RTC registers. + */ +#ifndef __ASM_SPARC64_MC146818RTC_H +#define __ASM_SPARC64_MC146818RTC_H + +#include <asm/io.h> + +#ifndef RTC_PORT +#define RTC_PORT(x) (0x70 + (x)) +#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ +#endif + +/* + * The yet supported machines all access the RTC index register via + * an ISA port access but the way to access the date register differs ... + */ +#define CMOS_READ(addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +inb_p(RTC_PORT(1)); \ +}) +#define CMOS_WRITE(val, addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +outb_p((val),RTC_PORT(1)); \ +}) + +#endif /* __ASM_SPARC64_MC146818RTC_H */ diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h index f88030301..387ee1774 100644 --- a/include/asm-sparc64/socket.h +++ b/include/asm-sparc64/socket.h @@ -1,4 +1,4 @@ -/* $Id: socket.h,v 1.6 2000/02/27 19:47:58 davem Exp $ */ +/* $Id: socket.h,v 1.7 2000/06/09 07:35:28 davem Exp $ */ #ifndef _ASM_SOCKET_H #define _ASM_SOCKET_H diff --git a/include/asm-sparc64/string.h b/include/asm-sparc64/string.h index 31bbf32e7..4f1d49d2a 100644 --- a/include/asm-sparc64/string.h +++ b/include/asm-sparc64/string.h @@ -111,7 +111,7 @@ static inline void *__constant_memset(void *s, int c, __kernel_size_t count) extern __kernel_size_t __strlen(const char *); -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) extern __kernel_size_t strlen(const char *); #else /* !EGCS */ /* Ugly but it works around a bug in our original sparc64-linux-gcc. */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 00303c239..257bca48d 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.59 2000/05/09 17:40:15 davem Exp $ */ +/* $Id: system.h,v 1.60 2000/05/29 05:34:02 davem Exp $ */ #ifndef __SPARC64_SYSTEM_H #define __SPARC64_SYSTEM_H @@ -269,7 +269,8 @@ extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noret extern __inline__ unsigned long __cmpxchg_u32(volatile int *m, int old, int new) { - __asm__ __volatile__("cas [%2], %3, %0" + __asm__ __volatile__("cas [%2], %3, %0\n\t" + "membar #StoreStore | #StoreLoad" : "=&r" (new) : "0" (new), "r" (m), "r" (old) : "memory"); @@ -280,7 +281,8 @@ __cmpxchg_u32(volatile int *m, int old, int new) extern __inline__ unsigned long __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) { - __asm__ __volatile__("casx [%2], %3, %0" + __asm__ __volatile__("casx [%2], %3, %0\n\t" + "membar #StoreStore | #StoreLoad" : "=&r" (new) : "0" (new), "r" (m), "r" (old) : "memory"); diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h index 81f463cd5..f4468611e 100644 --- a/include/linux/ac97_codec.h +++ b/include/linux/ac97_codec.h @@ -32,7 +32,7 @@ #define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */ #define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */ #define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */ -#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */ +#define AC97_PCM_LR_DAC_RATE 0x0032 /* PCM LR DAC Rate */ #define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ #define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ #define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ @@ -133,7 +133,7 @@ SOUND_MASK_LINE1| SOUND_MASK_LINE|\ SOUND_MASK_PHONEIN) -#define supported_mixer(CODEC,FOO) ( CODEC->supported_mixers & (1<<FOO) ) +#define supported_mixer(CODEC,FOO) ((CODEC)->supported_mixers & (1<<FOO) ) struct ac97_codec { /* AC97 controller connected with */ @@ -150,6 +150,9 @@ struct ac97_codec { u16 (*codec_read) (struct ac97_codec *codec, u8 reg); void (*codec_write) (struct ac97_codec *codec, u8 reg, u16 val); + /* Wait for codec-ready. Ok to sleep here. */ + void (*codec_wait) (struct ac97_codec *codec); + /* OSS mixer masks */ int modcnt; int supported_mixers; diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h index 60af0d40c..8a09cd72d 100644 --- a/include/linux/affs_fs.h +++ b/include/linux/affs_fs.h @@ -84,7 +84,7 @@ extern int affs_add_entry(struct inode *dir, struct inode *link, extern void affs_put_inode(struct inode *inode); extern void affs_delete_inode(struct inode *inode); extern void affs_read_inode(struct inode *inode); -extern void affs_write_inode(struct inode *inode); +extern void affs_write_inode(struct inode *inode, int); /* super.c */ diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h index 3c8c7e01f..698a6f262 100644 --- a/include/linux/agp_backend.h +++ b/include/linux/agp_backend.h @@ -45,6 +45,7 @@ enum chipset_type { INTEL_BX, INTEL_GX, INTEL_I810, + INTEL_I840, VIA_GENERIC, VIA_VP3, VIA_MVP3, diff --git a/include/linux/awe_voice.h b/include/linux/awe_voice.h index 9ca80334f..da0e27de7 100644 --- a/include/linux/awe_voice.h +++ b/include/linux/awe_voice.h @@ -173,10 +173,10 @@ typedef struct _awe_voice_info { short root; /* midi root key */ short tune; /* pitch tuning (in cents) */ - char low, high; /* key note range */ - char vellow, velhigh; /* velocity range */ - char fixkey, fixvel; /* fixed key, velocity */ - char pan, fixpan; /* panning, fixed panning */ + signed char low, high; /* key note range */ + signed char vellow, velhigh; /* velocity range */ + signed char fixkey, fixvel; /* fixed key, velocity */ + signed char pan, fixpan; /* panning, fixed panning */ short exclusiveClass; /* exclusive class (0 = none) */ unsigned char amplitude; /* sample volume (127 max) */ unsigned char attenuation; /* attenuation (0.375dB) */ diff --git a/include/linux/bitops.h b/include/linux/bitops.h index ddb84dd62..b155b7796 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -8,7 +8,7 @@ * differs in spirit from the above ffz (man ffs). */ -extern __inline__ int generic_ffs(int x) +static inline int generic_ffs(int x) { int r = 1; @@ -42,7 +42,7 @@ extern __inline__ int generic_ffs(int x) * of bits set) of a N-bit word */ -extern __inline__ unsigned int generic_hweight32(unsigned int w) +static inline unsigned int generic_hweight32(unsigned int w) { unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); @@ -51,7 +51,7 @@ extern __inline__ unsigned int generic_hweight32(unsigned int w) return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); } -extern __inline__ unsigned int generic_hweight16(unsigned int w) +static inline unsigned int generic_hweight16(unsigned int w) { unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555); res = (res & 0x3333) + ((res >> 2) & 0x3333); @@ -59,7 +59,7 @@ extern __inline__ unsigned int generic_hweight16(unsigned int w) return (res & 0x00FF) + ((res >> 8) & 0x00FF); } -extern __inline__ unsigned int generic_hweight8(unsigned int w) +static inline unsigned int generic_hweight8(unsigned int w) { unsigned int res = (w & 0x55) + ((w >> 1) & 0x55); res = (res & 0x33) + ((res >> 2) & 0x33); diff --git a/include/linux/capability.h b/include/linux/capability.h index 394c96bfa..a1e9dc3d4 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -4,6 +4,10 @@ * Andrew G. Morgan <morgan@transmeta.com> * Alexander Kjeldaas <astor@guardian.no> * with help from Aleph1, Roland Buresund and Andrew Main. + * + * See here for the libcap library ("POSIX draft" compliance): + * + * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.2/ */ #ifndef _LINUX_CAPABILITY_H @@ -170,8 +174,8 @@ typedef __u32 kernel_cap_t; #define CAP_IPC_OWNER 15 -/* Insert and remove kernel modules */ - +/* Insert and remove kernel modules - modify kernel without limit */ +/* Modify cap_bset */ #define CAP_SYS_MODULE 16 /* Allow ioperm/iopl access */ @@ -294,12 +298,12 @@ extern kernel_cap_t cap_bset; #define CAP_EMPTY_SET to_cap_t(0) #define CAP_FULL_SET to_cap_t(~0) #define CAP_INIT_EFF_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP)) -#define CAP_INIT_INH_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP)) +#define CAP_INIT_INH_SET to_cap_t(0) #define CAP_TO_MASK(x) (1 << (x)) #define cap_raise(c, flag) (cap_t(c) |= CAP_TO_MASK(flag)) #define cap_lower(c, flag) (cap_t(c) &= ~CAP_TO_MASK(flag)) -#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag) & cap_bset) +#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag)) static inline kernel_cap_t cap_combine(kernel_cap_t a, kernel_cap_t b) { diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 00c3df0cc..77808a7a3 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -437,6 +437,7 @@ struct cdrom_generic_command #define GPCMD_PAUSE_RESUME 0x4b #define GPCMD_PLAY_AUDIO_10 0x45 #define GPCMD_PLAY_AUDIO_MSF 0x47 +#define GPCMD_PLAY_AUDIO_TI 0x48 #define GPCMD_PLAY_CD 0xbc #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e #define GPCMD_READ_10 0x28 @@ -477,16 +478,11 @@ struct cdrom_generic_command /* This seems to be a SCSI specific CD-ROM opcode * to play data at track/index */ #define GPCMD_PLAYAUDIO_TI 0x48 - -/* Is this really used by anything? I couldn't find these...*/ -#if 0 -/* MMC2/MTFuji Opcodes */ -#define ERASE 0x2c -#define READ_BUFFER 0x3c -#endif - - - +/* + * From MS Media Status Notification Support Specification. For + * older drives only. + */ +#define GPCMD_GET_MEDIA_STATUS 0xda /* Mode page codes for mode sense/set */ #define GPMODE_R_W_ERROR_PAGE 0x01 @@ -998,6 +994,40 @@ typedef struct { __u8 subhdr3; } __attribute__((packed)) write_param_page; +struct modesel_head +{ + __u8 reserved1; + __u8 medium; + __u8 reserved2; + __u8 block_desc_length; + __u8 density; + __u8 number_of_blocks_hi; + __u8 number_of_blocks_med; + __u8 number_of_blocks_lo; + __u8 reserved3; + __u8 block_length_hi; + __u8 block_length_med; + __u8 block_length_lo; +}; + +typedef struct { + __u16 report_key_length; + __u8 reserved1; + __u8 reserved2; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 type_code : 2; + __u8 vra : 3; + __u8 ucca : 3; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ucca : 3; + __u8 vra : 3; + __u8 type_code : 2; +#endif + __u8 region_mask; + __u8 rpc_scheme; + __u8 reserved3; +} rpc_state_t; + #endif /* End of kernel only stuff */ #endif /* _LINUX_CDROM_H */ diff --git a/include/linux/coda.h b/include/linux/coda.h index cbd042242..a08558628 100644 --- a/include/linux/coda.h +++ b/include/linux/coda.h @@ -331,9 +331,8 @@ struct coda_statfs { #if 0 #define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */ #define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */ -#define CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */ #endif -#define CODA_KERNEL_VERSION 3 /* added CODA_MAKE_CINODE downcall */ +#define CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */ /* * Venus <-> Coda RPC arguments diff --git a/include/linux/coda_cache.h b/include/linux/coda_cache.h index e549b02e7..fe3b2f40c 100644 --- a/include/linux/coda_cache.h +++ b/include/linux/coda_cache.h @@ -29,49 +29,6 @@ void coda_cache_clear_cred(struct super_block *sb, struct coda_cred *cred); int coda_cache_check(struct inode *inode, int mask); /* for downcalls and attributes and lookups */ -void coda_flag_inode(struct inode *inode, int flag); void coda_flag_inode_children(struct inode *inode, int flag); - -/* - * Structure to contain statistics on the cache usage - */ - -struct cfsnc_statistics { - unsigned hits; - unsigned misses; - unsigned enters; - unsigned dbl_enters; - unsigned long_name_enters; - unsigned long_name_lookups; - unsigned long_remove; - unsigned lru_rm; - unsigned zapPfids; - unsigned zapFids; - unsigned zapFile; - unsigned zapUsers; - unsigned Flushes; - unsigned Sum_bucket_len; - unsigned Sum2_bucket_len; - unsigned Max_bucket_len; - unsigned Num_zero_len; - unsigned Search_len; -}; - - -#define CFSNC_FIND ((u_long) 1) -#define CFSNC_REMOVE ((u_long) 2) -#define CFSNC_INIT ((u_long) 3) -#define CFSNC_ENTER ((u_long) 4) -#define CFSNC_LOOKUP ((u_long) 5) -#define CFSNC_ZAPPFID ((u_long) 6) -#define CFSNC_ZAPFID ((u_long) 7) -#define CFSNC_ZAPVNODE ((u_long) 8) -#define CFSNC_ZAPFILE ((u_long) 9) -#define CFSNC_PURGEUSER ((u_long) 10) -#define CFSNC_FLUSH ((u_long) 11) -#define CFSNC_PRINTCFSNC ((u_long) 12) -#define CFSNC_PRINTSTATS ((u_long) 13) -#define CFSNC_REPLACE ((u_long) 14) - #endif _CFSNC_HEADER_ diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h index 302a715b9..ac14c8e7f 100644 --- a/include/linux/coda_fs_i.h +++ b/include/linux/coda_fs_i.h @@ -13,8 +13,6 @@ #include <linux/list.h> #include <linux/coda.h> - - #define CODA_CNODE_MAGIC 0x47114711 /* * coda fs inode data @@ -22,10 +20,6 @@ struct coda_inode_info { struct ViceFid c_fid; /* Coda identifier */ u_short c_flags; /* flags (see below) */ - u_short c_ocount; /* count of openers */ - u_short c_owrite; /* count of open for write */ - u_short c_mmcount; /* count of mmappers */ - struct inode *c_ovp; /* open inode pointer */ struct list_head c_cnhead; /* head of cache entries */ struct list_head c_volrootlist; /* list of volroot cnoddes */ struct inode *c_vnode; /* inode associated with cnode */ @@ -34,14 +28,10 @@ struct coda_inode_info { /* flags */ #define C_VATTR 0x1 /* Validity of vattr in inode */ -#define C_PURGE 0x8 -#define C_ZAPDIR 0x10 -#define C_DYING 0x4 /* from venus (which died) */ -#define C_INITED 0x20 #define C_FLUSH 0x2 /* used after a flush */ +#define C_DYING 0x4 /* from venus (which died) */ +#define C_PURGE 0x8 -struct inode *coda_iget(struct super_block * sb, ViceFid * fid, - struct coda_vattr * attr); int coda_cnode_make(struct inode **, struct ViceFid *, struct super_block *); int coda_cnode_makectl(struct inode **inode, struct super_block *sb); struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb); diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h index 08ccef4c4..556d1b60e 100644 --- a/include/linux/coda_linux.h +++ b/include/linux/coda_linux.h @@ -48,6 +48,8 @@ extern int coda_access_cache; /* this file: heloers */ static __inline__ struct ViceFid *coda_i2f(struct inode *); +static __inline__ char *coda_i2s(struct inode *); +static __inline__ void coda_flag_inode(struct inode *, int flag); char *coda_f2s(ViceFid *f); char *coda_f2s2(ViceFid *f); int coda_isroot(struct inode *i); @@ -56,7 +58,6 @@ int coda_fid_is_weird(struct ViceFid *fid); int coda_iscontrol(const char *name, size_t length); void coda_load_creds(struct coda_cred *cred); -int coda_mycred(struct coda_cred *); void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); unsigned short coda_flags_to_cflags(unsigned short); @@ -64,16 +65,6 @@ void print_vattr( struct coda_vattr *attr ); int coda_cred_ok(struct coda_cred *cred); int coda_cred_eq(struct coda_cred *cred1, struct coda_cred *cred2); -/* defined in file.c */ -void coda_prepare_openfile(struct inode *coda_inode, struct file *coda_file, - struct inode *open_inode, struct file *open_file, - struct dentry *open_dentry); -void coda_restore_codafile(struct inode *coda_inode, struct file *coda_file, - struct inode *open_inode, struct file *open_file); -int coda_inode_grab(dev_t dev, ino_t ino, struct inode **ind); - -#define NB_SFS_SIZ 0x895440 - /* cache.c */ void coda_purge_children(struct inode *, int); void coda_purge_dentries(struct inode *); @@ -110,8 +101,6 @@ void coda_sysctl_clean(void); #define EXIT \ if(coda_print_entry) printk("Process %d leaving %s\n",current->pid,__FUNCTION__) -#define CHECK_CNODE(c) do { } while (0); - #define CODA_ALLOC(ptr, cast, size) \ do { \ if (size < 3000) { \ @@ -129,18 +118,24 @@ do { \ #define CODA_FREE(ptr,size) do {if (size < 3000) { kfree_s((ptr), (size)); CDEBUG(D_MALLOC, "kfreed: %lx at %p.\n", (long) size, ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %lx at %p.\n", (long) size, ptr);} } while (0) -/* inode to cnode */ +/* inode to cnode access functions */ static __inline__ struct ViceFid *coda_i2f(struct inode *inode) { return &(inode->u.coda_i.c_fid); } -#define ITOC(inode) (&((inode)->u.coda_i)) - - - +static __inline__ char *coda_i2s(struct inode *inode) +{ + return coda_f2s(&(inode->u.coda_i.c_fid)); +} +/* this will not zap the inode away */ +static __inline__ void coda_flag_inode(struct inode *inode, int flag) +{ + inode->u.coda_i.c_flags |= flag; +} +#define ITOC(inode) (&((inode)->u.coda_i)) #endif diff --git a/include/linux/coda_opstats.h b/include/linux/coda_opstats.h deleted file mode 100644 index fdf3fac42..000000000 --- a/include/linux/coda_opstats.h +++ /dev/null @@ -1,94 +0,0 @@ - -/* - * Operation statistics for Coda. - * Copyright (C) 1997 Carnegie Mellon University - * - * Carnegie Mellon University encourages users of this software - * to contribute improvements to the Coda project. Contact Peter Braam - * <coda@coda.cs.cmu.edu>. - */ - - - -#define CFS_MOUNT_STATS 0 -#define CFS_UMOUNT_STATS 1 -#define CFS_ROOT_STATS 2 -#define CFS_STATFS_STATS 3 -#define CFS_SYNC_STATS 4 -#define CFS_VGET_STATS 5 -#define CFS_VFSOPS_SIZE 6 - -/* vnodeops: - * open: all to venus - * close: all to venus - * rdrw: bogus. Maybe redirected to UFS. - * May call open/close for internal opens/closes - * (Does exec not call open?) - * ioctl: causes a lookupname - * passes through - * select: can't get there from here. - * getattr: can be satsified by cache - * setattr: all go through - * access: can be satisfied by cache - * readlink: can be satisfied by cache - * fsync: passes through - * inactive: passes through - * lookup: can be satisfied by cache - * create: passes through - * remove: passes through - * link: passes through - * rename: passes through - * mkdir: passes through - * rmdir: passes through - * symlink: passes through - * readdir: may be redirected to UFS - * may cause an "internal" open/close - */ - -#define CFS_OPEN_STATS 0 -#define CFS_CLOSE_STATS 1 -#define CFS_RDWR_STATS 2 -#define CFS_IOCTL_STATS 3 -#define CFS_SELECT_STATS 4 -#define CFS_GETATTR_STATS 5 -#define CFS_SETATTR_STATS 6 -#define CFS_ACCESS_STATS 7 -#define CFS_READLINK_STATS 8 -#define CFS_FSYNC_STATS 9 -#define CFS_INACTIVE_STATS 10 -#define CFS_LOOKUP_STATS 11 -#define CFS_CREATE_STATS 12 -#define CFS_REMOVE_STATS 13 -#define CFS_LINK_STATS 14 -#define CFS_RENAME_STATS 15 -#define CFS_MKDIR_STATS 16 -#define CFS_RMDIR_STATS 17 -#define CFS_SYMLINK_STATS 18 -#define CFS_READDIR_STATS 19 -#define CFS_VNODEOPS_SIZE 20 - - -/* - * I propose the following structres: - */ - - -struct cfs_op_stats { - int opcode; /* vfs opcode */ - long entries; /* number of times call attempted */ - long sat_intrn; /* number of times call satisfied by cache */ - long unsat_intrn; /* number of times call failed in cache, but - was not bounced to venus proper. */ - long gen_intrn; /* number of times call generated internally */ - /* (do we need that?) */ -}; - - -/* - * With each call to the minicache, we'll bump the counters whenver - * a call is satisfied internally (through the cache or through a - * redirect), and whenever an operation is caused internally. - * Then, we can add the total operations caught by the minicache - * to the world-wide totals, and leave a caveat for the specific - * graphs later. - */ diff --git a/include/linux/coda_proc.h b/include/linux/coda_proc.h index 99cee973f..37dfad86a 100644 --- a/include/linux/coda_proc.h +++ b/include/linux/coda_proc.h @@ -39,9 +39,6 @@ void coda_upcall_stats(int opcode, unsigned long jiffies); struct coda_vfs_stats { /* file operations */ - int file_read; - int file_write; - int file_mmap; int open; int release; int fsync; @@ -59,7 +56,6 @@ struct coda_vfs_stats int rmdir; int rename; int permission; - int readpage; /* symlink operatoins*/ int follow_link; diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 88d3770b9..988862534 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -32,7 +32,7 @@ struct elevator_s \ 128, /* read_latency */ \ 8192, /* write_latency */ \ - 4, /* max_bomb_segments */ \ + 32, /* max_bomb_segments */ \ \ 0, /* nr_segments */ \ 0, /* read_pendings */ \ diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 25178b66b..4bd6a5d72 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -548,7 +548,9 @@ extern int ext2_read (struct inode *, struct file *, char *, int); extern int ext2_write (struct inode *, struct file *, char *, int); /* fsync.c */ -extern int ext2_sync_file (struct file *, struct dentry *); +extern int ext2_fsync_file (struct file *, struct dentry *, int); +extern int ext2_fsync_inode (struct inode *, int); +extern int ext2_osync_inode (struct inode *, int); /* ialloc.c */ extern struct inode * ext2_new_inode (const struct inode *, int, int *); @@ -562,7 +564,7 @@ extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *); extern struct buffer_head * ext2_bread (struct inode *, int, int, int *); extern void ext2_read_inode (struct inode *); -extern void ext2_write_inode (struct inode *); +extern void ext2_write_inode (struct inode *, int); extern void ext2_put_inode (struct inode *); extern void ext2_delete_inode (struct inode *); extern int ext2_sync_inode (struct inode *); diff --git a/include/linux/fb.h b/include/linux/fb.h index 733f7fb00..4147f05ad 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -260,6 +260,7 @@ struct file; struct fb_ops { /* open/release and usage marking */ + struct module *owner; int (*fb_open)(struct fb_info *info, int user); int (*fb_release)(struct fb_info *info, int user); /* get non settable parameters */ diff --git a/include/linux/file.h b/include/linux/file.h index 8ac96f574..268fd27a1 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -74,6 +74,24 @@ static inline void fput(struct file * file) } extern void put_filp(struct file *); +extern int get_unused_fd(void); + +static inline void __put_unused_fd(struct files_struct *files, unsigned int fd) +{ + FD_CLR(fd, files->open_fds); + if (fd < files->next_fd) + files->next_fd = fd; +} + +static inline void put_unused_fd(unsigned int fd) +{ + struct files_struct *files = current->files; + + write_lock(&files->file_lock); + __put_unused_fd(files, fd); + write_unlock(&files->file_lock); +} + /* * Install a file pointer in the fd array. * diff --git a/include/linux/fs.h b/include/linux/fs.h index e40c8fe2d..3eafb9a55 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -47,7 +47,12 @@ struct poll_table_struct; #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) /* And dynamically-tunable limits and defaults: */ -extern int max_files, nr_files, nr_free_files; +struct files_stat_struct { + int nr_files; /* read only */ + int nr_free_files; /* read only */ + int max_files; /* tunable */ +}; +extern struct files_stat_struct files_stat; extern int max_super_blocks, nr_super_blocks; #define NR_FILE 8192 /* this can well be larger on a larger system */ @@ -236,6 +241,9 @@ struct buffer_head { unsigned long b_rsector; /* Real buffer location on disk */ wait_queue_head_t b_wait; struct kiobuf * b_kiobuf; /* kiobuf which owns this IO */ + + struct inode * b_inode; + struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */ }; typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); @@ -375,8 +383,10 @@ struct inode { struct list_head i_list; struct list_head i_dentry; + struct list_head i_dirty_buffers; + unsigned long i_ino; - unsigned int i_count; + atomic_t i_count; kdev_t i_dev; umode_t i_mode; nlink_t i_nlink; @@ -441,16 +451,24 @@ struct inode { }; /* Inode state bits.. */ -#define I_DIRTY 1 -#define I_LOCK 2 -#define I_FREEING 4 -#define I_CLEAR 8 +#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */ +#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */ +#define I_LOCK 4 +#define I_FREEING 8 +#define I_CLEAR 16 + +#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC) -extern void __mark_inode_dirty(struct inode *); +extern void __mark_inode_dirty(struct inode *, int); static inline void mark_inode_dirty(struct inode *inode) { - if (!(inode->i_state & I_DIRTY)) - __mark_inode_dirty(inode); + if ((inode->i_state & I_DIRTY) != I_DIRTY) + __mark_inode_dirty(inode, I_DIRTY); +} +static inline void mark_inode_dirty_sync(struct inode *inode) +{ + if (!(inode->i_state & I_DIRTY_SYNC)) + __mark_inode_dirty(inode, I_DIRTY_SYNC); } struct fown_struct { @@ -504,10 +522,8 @@ typedef struct files_struct *fl_owner_t; struct file_lock { struct file_lock *fl_next; /* singly linked list for this inode */ - struct file_lock *fl_nextlink; /* doubly linked list of all locks */ - struct file_lock *fl_prevlink; /* used to simplify lock removal */ - struct file_lock *fl_nextblock; /* circular list of blocked processes */ - struct file_lock *fl_prevblock; + struct list_head fl_link; /* doubly linked list of all locks */ + struct list_head fl_block; /* circular list of blocked processes */ fl_owner_t fl_owner; unsigned int fl_pid; wait_queue_head_t fl_wait; @@ -532,7 +548,7 @@ struct file_lock { #define OFFSET_MAX INT_LIMIT(loff_t) #endif -extern struct file_lock *file_lock_table; +extern struct list_head file_lock_list; #include <linux/fcntl.h> @@ -554,6 +570,15 @@ struct fasync_struct { struct file *fa_file; }; +#define FASYNC_MAGIC 0x4601 + +/* SMP safe fasync helpers: */ +extern int fasync_helper(int, struct file *, int, struct fasync_struct **); +/* can be called from interrupts */ +extern void kill_fasync(struct fasync_struct **, int, int); +/* only for net: no internal synchronization */ +extern void __kill_fasync(struct fasync_struct *, int, int); + struct nameidata { struct dentry *dentry; struct vfsmount *mnt; @@ -562,10 +587,6 @@ struct nameidata { int last_type; }; -#define FASYNC_MAGIC 0x4601 - -extern int fasync_helper(int, struct file *, int, struct fasync_struct **); - #define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ #define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ @@ -705,6 +726,7 @@ struct block_device_operations { * without the big kernel lock held in all filesystems. */ struct file_operations { + struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char *, size_t, loff_t *); ssize_t (*write) (struct file *, const char *, size_t, loff_t *); @@ -715,7 +737,7 @@ struct file_operations { int (*open) (struct inode *, struct file *); int (*flush) (struct file *); int (*release) (struct inode *, struct file *); - int (*fsync) (struct file *, struct dentry *); + int (*fsync) (struct file *, struct dentry *, int datasync); int (*fasync) (int, struct file *, int); int (*lock) (struct file *, int, struct file_lock *); ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); @@ -748,7 +770,7 @@ struct inode_operations { */ struct super_operations { void (*read_inode) (struct inode *); - void (*write_inode) (struct inode *); + void (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*delete_inode) (struct inode *); void (*put_super) (struct super_block *); @@ -789,6 +811,18 @@ struct file_system_type var = { \ #define DECLARE_FSTYPE_DEV(var,type,read) \ DECLARE_FSTYPE(var,type,read,FS_REQUIRES_DEV) +/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ +#define fops_get(fops) \ + (((fops) && (fops)->owner) \ + ? __MOD_INC_USE_COUNT((fops)->owner), (fops) \ + : (fops)) + +#define fops_put(fops) \ +do { \ + if ((fops) && (fops)->owner) \ + __MOD_DEC_USE_COUNT((fops)->owner); \ +} while(0) + extern int register_filesystem(struct file_system_type *); extern int unregister_filesystem(struct file_system_type *); extern struct vfsmount *kern_mount(struct file_system_type *); @@ -841,8 +875,8 @@ static inline int locks_verify_truncate(struct inode *inode, return locks_mandatory_area( FLOCK_VERIFY_WRITE, inode, filp, size < inode->i_size ? size : inode->i_size, - abs(inode->i_size - size) - ); + size < inode->i_size ? inode->i_size - size + : size - inode->i_size); return 0; } @@ -853,9 +887,6 @@ asmlinkage long sys_open(const char *, int, int); asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */ extern int do_close(unsigned int, int); /* yes, it's really unsigned */ extern int do_truncate(struct dentry *, loff_t start); -extern int get_unused_fd(void); -extern void __put_unused_fd(struct files_struct *, unsigned int); /* locked outside */ -extern void put_unused_fd(unsigned int); /* locked inside */ extern struct file *filp_open(const char *, int, int); extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); @@ -865,7 +896,6 @@ extern char * getname(const char *); #define putname(name) free_page((unsigned long)(name)) enum {BDEV_FILE, BDEV_SWAP, BDEV_FS, BDEV_RAW}; -extern void kill_fasync(struct fasync_struct *, int, int); extern int register_blkdev(unsigned int, const char *, struct block_device_operations *); extern int unregister_blkdev(unsigned int, const char *); extern struct block_device *bdget(dev_t); @@ -967,23 +997,44 @@ static inline void buffer_IO_error(struct buffer_head * bh) bh->b_end_io(bh, 0); } +extern void buffer_insert_inode_queue(struct buffer_head *, struct inode *); +static inline void mark_buffer_dirty_inode(struct buffer_head *bh, int flag, struct inode *inode) +{ + mark_buffer_dirty(bh, flag); + buffer_insert_inode_queue(bh, inode); +} + extern void balance_dirty(kdev_t); extern int check_disk_change(kdev_t); extern int invalidate_inodes(struct super_block *); extern void invalidate_inode_pages(struct inode *); +extern void invalidate_inode_buffers(struct inode *); #define invalidate_buffers(dev) __invalidate_buffers((dev), 0) #define destroy_buffers(dev) __invalidate_buffers((dev), 1) extern void __invalidate_buffers(kdev_t dev, int); extern void sync_inodes(kdev_t); -extern void write_inode_now(struct inode *); +extern void write_inode_now(struct inode *, int); extern void sync_dev(kdev_t); extern int fsync_dev(kdev_t); +extern int fsync_inode_buffers(struct inode *); +extern int osync_inode_buffers(struct inode *); +extern int generic_osync_inode(struct inode *, int); +extern int inode_has_buffers(struct inode *); extern void sync_supers(kdev_t); extern int bmap(struct inode *, int); extern int notify_change(struct dentry *, struct iattr *); extern int permission(struct inode *, int); extern int get_write_access(struct inode *); -extern void put_write_access(struct inode *); +extern int deny_write_access(struct file *); +static inline void put_write_access(struct inode * inode) +{ + atomic_dec(&inode->i_writecount); +} +static inline void allow_write_access(struct file *file) +{ + if (file) + atomic_inc(&file->f_dentry->d_inode->i_writecount); +} extern int do_pipe(int *); extern int open_namei(const char *, int, int, struct nameidata *); @@ -1058,6 +1109,7 @@ extern struct dentry * lookup_hash(struct qstr *, struct dentry *); #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd) extern void iput(struct inode *); +extern void force_delete(struct inode *); extern struct inode * igrab(struct inode *); extern ino_t iunique(struct super_block *, ino_t); @@ -1104,6 +1156,7 @@ typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int); /* Generic buffer handling for block filesystems.. */ extern int block_flushpage(struct page *, unsigned long); +extern void block_destroy_buffers(struct page *); extern int block_symlink(struct inode *, const char *, int); extern int block_write_full_page(struct page*, get_block_t*); extern int block_read_full_page(struct page*, get_block_t*); @@ -1157,7 +1210,7 @@ extern int read_ahead[]; extern ssize_t char_write(struct file *, const char *, size_t, loff_t *); extern ssize_t block_write(struct file *, const char *, size_t, loff_t *); -extern int file_fsync(struct file *, struct dentry *); +extern int file_fsync(struct file *, struct dentry *, int); extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx, unsigned long end_idx); extern int inode_change_ok(struct inode *, struct iattr *); @@ -1171,20 +1224,6 @@ extern void inode_setattr(struct inode *, struct iattr *); */ /* - * We need to do a check-parent every time - * after we have locked the parent - to verify - * that the parent is still our parent and - * that we are still hashed onto it.. - * - * This is required in case two processes race - * on removing (or moving) the same entry: the - * parent lock will serialize them, but the - * other process will be too late.. - */ -#define check_parent(dir, dentry) \ - ((dir) == (dentry)->d_parent && !d_unhashed(dentry)) - -/* * Locking the parent is needed to: * - serialize directory operations * - make sure the parent doesn't change from diff --git a/include/linux/genhd.h b/include/linux/genhd.h index c07a473d1..c0f69dbb4 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -50,7 +50,6 @@ struct partition { struct hd_struct { long start_sect; long nr_sects; - int type; /* currently RAID or normal */ devfs_handle_t de; /* primary (master) devfs entry */ }; diff --git a/include/linux/ide.h b/include/linux/ide.h index 8804c9777..13876daf5 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -58,6 +58,10 @@ void cmd640_dump_regs (void); #endif #endif /* CONFIG_BLK_DEV_CMD640 */ +#ifndef DISABLE_IRQ_NOSYNC +#define DISABLE_IRQ_NOSYNC 0 +#endif + /* * IDE_DRIVE_CMD is used to implement many features of the hdparm utility */ @@ -181,6 +185,32 @@ typedef unsigned char byte; /* used everywhere */ OUT_BYTE((drive)->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); \ } +#define SELECT_INTERRUPT(hwif,drive) \ +{ \ + if (hwif->intrproc) \ + hwif->intrproc(drive); \ + else \ + OUT_BYTE((drive)->ctl|2, hwif->io_ports[IDE_CONTROL_OFFSET]); \ +} + +#define SELECT_MASK(hwif,drive,mask) \ +{ \ + if (hwif->maskproc) \ + hwif->maskproc(drive,mask); \ +} + +#define SELECT_READ_WRITE(hwif,drive,func) \ +{ \ + if (hwif->rwproc) \ + hwif->rwproc(drive,func); \ +} + +#define QUIRK_LIST(hwif,drive) \ +{ \ + if (hwif->quirkproc) \ + (drive)->quirk_list = hwif->quirkproc(drive); \ +} + /* * Check for an interrupt and acknowledge the interrupt status */ @@ -309,6 +339,8 @@ typedef struct ide_drive_s { int last_lun; /* last logical unit */ int forced_lun; /* if hdxlun was given at boot */ int lun; /* logical unit */ + int crc_count; /* crc counter to reduce drive speed */ + byte quirk_list; /* drive is considered quirky if set for a specific host */ byte init_speed; /* transfer rate set at boot */ byte current_speed; /* current transfer rate set */ byte dn; /* now wide spread use */ @@ -354,6 +386,10 @@ typedef int (ide_speedproc_t) (ide_drive_t *, byte); */ typedef void (ide_selectproc_t) (ide_drive_t *); typedef void (ide_resetproc_t) (ide_drive_t *); +typedef int (ide_quirkproc_t) (ide_drive_t *); +typedef void (ide_intrproc_t) (ide_drive_t *); +typedef void (ide_maskproc_t) (ide_drive_t *, int); +typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t); /* * hwif_chipset_t is used to keep track of the specific hardware @@ -388,6 +424,10 @@ typedef struct hwif_s { ide_speedproc_t *speedproc; /* routine to retune DMA modes for drives */ ide_selectproc_t *selectproc; /* tweaks hardware to select drive */ ide_resetproc_t *resetproc; /* routine to reset controller after a disk reset */ + ide_intrproc_t *intrproc; /* special interrupt handling for shared pci interrupts */ + ide_maskproc_t *maskproc; /* special host masking for drive selection */ + ide_quirkproc_t *quirkproc; /* check host's drive quirk list */ + ide_rw_proc_t *rwproc; /* adjust timing based upon rq->cmd direction */ ide_dmaproc_t *dmaproc; /* dma read/write/abort routine */ unsigned int *dmatable_cpu; /* dma physical region descriptor table (cpu view) */ dma_addr_t dmatable_dma; /* dma physical region descriptor table (dma view) */ @@ -424,6 +464,7 @@ typedef struct hwif_s { void *hwif_data; /* extra hwif data */ } ide_hwif_t; + /* * Status returned from various ide_ functions */ @@ -614,12 +655,14 @@ void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup); /* * This is used for (nearly) all data transfers from/to the IDE interface + * FIXME for 2.5, to a pointer pass verses memcpy........ */ void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount); void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount); /* * This is used for (nearly) all ATAPI data transfers from/to the IDE interface + * FIXME for 2.5, to a pointer pass verses memcpy........ */ void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount); void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount); @@ -750,6 +793,7 @@ byte ide_auto_reduce_xfer (ide_drive_t *drive); int ide_driveid_update (ide_drive_t *drive); int ide_ata66_check (ide_drive_t *drive, byte cmd, byte nsect, byte feature); int ide_config_drive_speed (ide_drive_t *drive, byte speed); +byte eighty_ninty_three (ide_drive_t *drive); int set_transfer (ide_drive_t *drive, byte cmd, byte nsect, byte feature); /* diff --git a/include/linux/input.h b/include/linux/input.h index d43d1e5a7..6d19fc2a9 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -2,9 +2,9 @@ #define _INPUT_H /* - * input.h Version 0.1 + * $Id: input.h,v 1.13 2000/05/29 10:54:53 vojtech Exp $ * - * Copyright (c) 1999 Vojtech Pavlik + * Copyright (c) 1999-2000 Vojtech Pavlik * * Sponsored by SuSE */ @@ -33,6 +33,7 @@ #include <linux/time.h> #else #include <sys/time.h> +#include <sys/ioctl.h> #endif /* @@ -47,16 +48,6 @@ struct input_event { }; /* - * The device ID structure; - */ - -struct input_id { - __u16 bus; - __u16 vendor; - __u16 product; -}; - -/* * Protocol version. */ @@ -66,14 +57,17 @@ struct input_id { * IOCTLs (0x00 - 0x7f) */ -#define EVIOCGVERSION _IOR('E', 0x01, __u32) /* get driver version */ -#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ +#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ +#define EVIOCGID _IOR('E', 0x02, short[4]) /* get device ID */ #define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ #define EVIOCSREP _IOW('E', 0x03, int[2]) /* get repeat settings */ -#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x03, len) /* get device name */ +#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ +#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ +#define EVIOCGKEY _IOR('E', 0x05, int[2]) /* get key value */ +#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ + #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ -#define EVIOCGABSLIM(num) _IOR('E', 0x40 + num, int[4]) /* get abs event limits */ -#define EVIOCGABS(num) _IOR('E', 0x80 + num, int) /* get abs value */ +#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, int[5]) /* get abs value/limits */ /* * Event types @@ -308,6 +302,7 @@ struct input_id { #define BTN_BASE3 0x128 #define BTN_BASE4 0x129 #define BTN_BASE5 0x12a +#define BTN_BASE6 0x12b #define BTN_GAMEPAD 0x130 #define BTN_A 0x130 @@ -364,6 +359,8 @@ struct input_id { #define ABS_RZ 0x05 #define ABS_THROTTLE 0x06 #define ABS_RUDDER 0x07 +#define ABS_TL 0x08 +#define ABS_TR 0x09 #define ABS_HAT0X 0x10 #define ABS_HAT0Y 0x11 #define ABS_HAT1X 0x12 @@ -406,6 +403,27 @@ struct input_id { #define SND_BELL 0x01 #define SND_MAX 0x07 +/* + * IDs. + */ + +#define ID_BUS 0 +#define ID_VENDOR 1 +#define ID_PRODUCT 2 +#define ID_VERSION 3 + +#define BUS_PCI 0x01 +#define BUS_ISAPNP 0x02 +#define BUS_USB 0x03 + +#define BUS_ISA 0x10 +#define BUS_I8042 0x11 +#define BUS_XTKBD 0x12 +#define BUS_RS232 0x13 +#define BUS_GAMEPORT 0x14 +#define BUS_PARPORT 0x15 +#define BUS_AMIGA 0x16 + #ifdef __KERNEL__ /* @@ -425,7 +443,10 @@ struct input_dev { int number; char *name; - struct input_id id; + unsigned short idbus; + unsigned short idvendor; + unsigned short idproduct; + unsigned short idversion; unsigned long evbit[NBITS(EV_MAX)]; unsigned long keybit[NBITS(KEY_MAX)]; @@ -434,7 +455,10 @@ struct input_dev { unsigned long ledbit[NBITS(LED_MAX)]; unsigned long sndbit[NBITS(SND_MAX)]; - unsigned char *keycode; + unsigned int keycodemax; + unsigned int keycodesize; + void *keycode; + unsigned int repeat_key; struct timer_list timer; @@ -500,8 +524,7 @@ void input_unregister_minor(devfs_handle_t handle); void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); -#define input_report_key(a,b,c) input_event(a, EV_KEY, b, c) -#define input_report_btn(a,b,c) input_event(a, EV_KEY, b, !!(c)) +#define input_report_key(a,b,c) input_event(a, EV_KEY, b, !!(c)) #define input_report_rel(a,b,c) input_event(a, EV_REL, b, c) #define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 2995d563d..8eb171810 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -85,14 +85,14 @@ struct softirq_action asmlinkage void do_softirq(void); extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); -extern __inline__ void __cpu_raise_softirq(int cpu, int nr) +static inline void __cpu_raise_softirq(int cpu, int nr) { softirq_state[cpu].active |= (1<<nr); } /* I do not want to use atomic variables now, so that cli/sti */ -extern __inline__ void raise_softirq(int nr) +static inline void raise_softirq(int nr) { unsigned long flags; @@ -165,7 +165,7 @@ extern struct tasklet_head tasklet_hi_vec[NR_CPUS]; #define tasklet_unlock(t) do { } while (0) #endif -extern __inline__ void tasklet_schedule(struct tasklet_struct *t) +static inline void tasklet_schedule(struct tasklet_struct *t) { if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) { int cpu = smp_processor_id(); @@ -179,7 +179,7 @@ extern __inline__ void tasklet_schedule(struct tasklet_struct *t) } } -extern __inline__ void tasklet_hi_schedule(struct tasklet_struct *t) +static inline void tasklet_hi_schedule(struct tasklet_struct *t) { if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) { int cpu = smp_processor_id(); @@ -194,18 +194,18 @@ extern __inline__ void tasklet_hi_schedule(struct tasklet_struct *t) } -extern __inline__ void tasklet_disable_nosync(struct tasklet_struct *t) +static inline void tasklet_disable_nosync(struct tasklet_struct *t) { atomic_inc(&t->count); } -extern __inline__ void tasklet_disable(struct tasklet_struct *t) +static inline void tasklet_disable(struct tasklet_struct *t) { tasklet_disable_nosync(t); tasklet_unlock_wait(t); } -extern __inline__ void tasklet_enable(struct tasklet_struct *t) +static inline void tasklet_enable(struct tasklet_struct *t) { atomic_dec(&t->count); } @@ -240,7 +240,7 @@ extern struct tasklet_struct bh_task_vec[]; /* It is exported _ONLY_ for wait_on_irq(). */ extern spinlock_t global_bh_lock; -extern __inline__ void mark_bh(int nr) +static inline void mark_bh(int nr) { tasklet_hi_schedule(bh_task_vec+nr); } diff --git a/include/linux/joystick.h b/include/linux/joystick.h index 8cd5cbccb..c0e148171 100644 --- a/include/linux/joystick.h +++ b/include/linux/joystick.h @@ -219,6 +219,7 @@ struct js_dev { int num_buttons; char *name; devfs_handle_t devfs_handle; + struct module *owner; }; struct js_list { @@ -251,7 +252,7 @@ extern struct js_port *js_register_port(struct js_port *port, void *info, extern struct js_port *js_unregister_port(struct js_port *port); extern int js_register_device(struct js_port *port, int number, int axes, - int buttons, char *name, js_ops_func open, js_ops_func close); + int buttons, char *name, struct module *owner, js_ops_func open, js_ops_func close); extern void js_unregister_device(struct js_dev *dev); /* diff --git a/include/linux/kernel.h b/include/linux/kernel.h index a8d79a50e..ac6f029b9 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -55,6 +55,7 @@ extern int sprintf(char * buf, const char * fmt, ...); extern int vsprintf(char *buf, const char *, va_list); extern int get_option(char **str, int *pint); extern char *get_options(char *str, int nints, int *ints); +extern unsigned long memparse(char *ptr, char **retptr); extern int session_of_pgrp(int pgrp); diff --git a/include/linux/linkage.h b/include/linux/linkage.h index aaf6edf02..d1f1c2861 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -9,7 +9,7 @@ #define CPP_ASMLINKAGE #endif -#if defined __i386__ && (__GNUC__ > 2 || __GNUC_MINOR__ > 7) +#if defined __i386__ && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 7) #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) #elif defined __ia64__ #define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage)) diff --git a/include/linux/list.h b/include/linux/list.h index a3900e53c..4fbe523ab 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -42,16 +42,26 @@ static __inline__ void __list_add(struct list_head * new, prev->next = new; } -/* - * Insert a new entry after the specified head.. +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. */ static __inline__ void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } -/* - * Insert a new entry before the specified head.. +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. */ static __inline__ void list_add_tail(struct list_head *new, struct list_head *head) { @@ -72,18 +82,28 @@ static __inline__ void __list_del(struct list_head * prev, prev->next = next; } +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + */ static __inline__ void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); } +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ static __inline__ int list_empty(struct list_head *head) { return head->next == head; } -/* - * Splice in "list" into "head" +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. */ static __inline__ void list_splice(struct list_head *list, struct list_head *head) { @@ -101,9 +121,20 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea } } +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ #define list_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ #define list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) diff --git a/include/linux/major.h b/include/linux/major.h index 0a6e120d6..17a421ab8 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -67,6 +67,8 @@ #define CM206_CDROM_MAJOR 32 #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 +#define XPRAM_MAJOR 35 /* expanded storage on S/390 = "slow ram" */ + /* proposed by Peter */ #define NETLINK_MAJOR 36 #define PS2ESDI_MAJOR 36 #define IDETAPE_MAJOR 37 diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h index 1eca767b4..99cd63717 100644 --- a/include/linux/minix_fs.h +++ b/include/linux/minix_fs.h @@ -101,7 +101,7 @@ extern struct buffer_head * minix_bread(struct inode *, int, int); extern void minix_truncate(struct inode *); extern int minix_sync_inode(struct inode *); -extern int minix_sync_file(struct file *, struct dentry *); +extern int minix_sync_file(struct file *, struct dentry *, int); extern struct address_space_operations minix_aops; extern struct inode_operations minix_file_inode_operations; diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 9cf4b9a14..f2bc32f72 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -20,6 +20,7 @@ #define SUN_OPENPROM_MINOR 139 #define NVRAM_MINOR 144 #define I2O_MINOR 166 +#define MICROCODE_MINOR 184 #define MISC_DYNAMIC_MINOR 255 #define SGI_GRAPHICS_MINOR 146 diff --git a/include/linux/mm.h b/include/linux/mm.h index 337ff6182..5875fa8bf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -153,6 +153,7 @@ typedef struct page { struct buffer_head * buffers; unsigned long virtual; /* nonzero if kmapped */ struct zone_struct *zone; + unsigned int age; } mem_map_t; #define get_page(p) atomic_inc(&(p)->count) @@ -169,7 +170,7 @@ typedef struct page { #define PG_dirty 4 #define PG_decr_after 5 #define PG_unused_01 6 -#define PG__unused_02 7 +#define PG_active 7 #define PG_slab 8 #define PG_swap_cache 9 #define PG_skip 10 @@ -185,6 +186,7 @@ typedef struct page { #define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) #define PageDirty(page) test_bit(PG_dirty, &(page)->flags) #define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) +#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags) #define PageLocked(page) test_bit(PG_locked, &(page)->flags) #define LockPage(page) set_bit(PG_locked, &(page)->flags) #define TryLockPage(page) test_and_set_bit(PG_locked, &(page)->flags) @@ -192,11 +194,15 @@ typedef struct page { clear_bit(PG_locked, &(page)->flags); \ wake_up(&page->wait); \ } while (0) +#define PageActive(page) test_bit(PG_active, &(page)->flags) +#define SetPageActive(page) set_bit(PG_active, &(page)->flags) +#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) #define PageError(page) test_bit(PG_error, &(page)->flags) #define SetPageError(page) set_bit(PG_error, &(page)->flags) #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) #define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) #define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags) +#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags) #define PageTestandClearReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) #define PageDecrAfter(page) test_bit(PG_decr_after, &(page)->flags) #define SetPageDecrAfter(page) set_bit(PG_decr_after, &(page)->flags) @@ -457,6 +463,7 @@ extern void remove_inode_page(struct page *); extern unsigned long page_unuse(struct page *); extern int shrink_mmap(int, int); extern void truncate_inode_pages(struct address_space *, loff_t); +extern void truncate_all_inode_pages(struct address_space *); /* generic vm_area_ops exported for stackable file systems */ extern int filemap_swapout(struct page * page, struct file *file); @@ -480,7 +487,6 @@ extern struct page *filemap_nopage(struct vm_area_struct * area, #define __GFP_HIGHMEM 0x0 /* noop */ #endif -#define __GFP_UNCACHED 0x20 #define GFP_BUFFER (__GFP_HIGH | __GFP_WAIT) #define GFP_ATOMIC (__GFP_HIGH) @@ -490,14 +496,6 @@ extern struct page *filemap_nopage(struct vm_area_struct * area, #define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO) #define GFP_KSWAPD (__GFP_IO) -/* Flag - indicates that the buffer should be allocated uncached as for an - architecture where the caches don't snoop DMA access. This is a even - stricter requirement than GFP_DMA as GFP_DMA allocated buffers might be - writeback cacheable and not be suitable for use with devices like - networks cards which manipulate objects smaller than a cacheline. */ - -#define GFP_UNCACHED __GFP_UNCACHED - /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some platforms, used as appropriate on others */ diff --git a/include/linux/module.h b/include/linux/module.h index 39d3e5560..a561f805f 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -144,6 +144,7 @@ struct module_info /* Find a symbol exported by the kernel or another module */ extern unsigned long get_module_symbol(char *, char *); +extern void put_module_symbol(unsigned long); extern int try_inc_mod_count(struct module *mod); diff --git a/include/linux/mount.h b/include/linux/mount.h index 61ab19b1f..adb571de2 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -26,7 +26,6 @@ struct vfsmount atomic_t mnt_count; char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ - char *mnt_dirname; /* Name of directory mounted on */ struct list_head mnt_list; uid_t mnt_owner; }; diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index f2f822b12..cbbf78528 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -69,7 +69,7 @@ #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ -#define MSDOS_FAT12 4078 /* maximum number of clusters in a 12 bit FAT */ +#define MSDOS_FAT12 4084 /* maximum number of clusters in a 12 bit FAT */ #define EOF_FAT12 0xFF8 /* standard EOF */ #define EOF_FAT16 0xFFF8 @@ -248,7 +248,7 @@ extern struct inode *fat_build_inode(struct super_block*,struct msdos_dir_entry* extern struct super_block *fat_read_super(struct super_block *s, void *data, int silent, struct inode_operations *dir_ops); extern void msdos_put_super(struct super_block *sb); extern int fat_statfs(struct super_block *sb,struct statfs *buf); -extern void fat_write_inode(struct inode *inode); +extern void fat_write_inode(struct inode *inode, int); /* dir.c */ extern struct file_operations fat_dir_operations; diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h index 96728bcdd..ffdf49f4c 100644 --- a/include/linux/ncp_fs_i.h +++ b/include/linux/ncp_fs_i.h @@ -19,7 +19,8 @@ struct ncp_inode_info { __u32 DosDirNum __attribute__((packed)); __u32 volNumber __attribute__((packed)); __u32 nwattr; - int opened; + struct semaphore open_sem; + atomic_t opened; int access; __u32 server_file_handle __attribute__((packed)); __u8 open_create_action __attribute__((packed)); diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b2e1ac568..ee129f8c5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -13,6 +13,7 @@ * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> * Alan Cox, <Alan.Cox@linux.org> * Bjorn Ekwall. <bj0rn@blox.se> + * Pekka Riikonen <priikone@poseidon.pspt.fi> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -193,6 +194,17 @@ enum netdev_state_t /* + * This structure holds at boot time configured netdevice settings. They + * are then used in the device probing. + */ +struct netdev_boot_setup { + char name[IFNAMSIZ]; + struct ifmap map; +}; +#define NETDEV_BOOT_SETUP_MAX 8 + + +/* * The DEVICE structure. * Actually, this whole structure is a big mistake. It mixes I/O * data with strictly "high-level" data, and it has to know about @@ -389,8 +401,11 @@ struct packet_type extern struct net_device loopback_dev; /* The loopback */ extern struct net_device *dev_base; /* All devices */ -extern rwlock_t dev_base_lock; /* Device list lock */ +extern rwlock_t dev_base_lock; /* Device list lock */ +extern struct netdev_boot_setup dev_boot_setup[]; +extern int netdev_boot_setup_add(char *name, struct ifmap *map); +extern int netdev_boot_setup_check(struct net_device *dev); extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); extern void dev_add_pack(struct packet_type *pt); extern void dev_remove_pack(struct packet_type *pt); @@ -414,7 +429,7 @@ extern int dev_restart(struct net_device *dev); typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len); extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); -extern __inline__ int unregister_gifconf(unsigned int family) +static inline int unregister_gifconf(unsigned int family) { return register_gifconf(family, 0); } @@ -437,7 +452,7 @@ extern struct softnet_data softnet_data[NR_CPUS]; #define HAVE_NETIF_QUEUE -extern __inline__ void __netif_schedule(struct net_device *dev) +static inline void __netif_schedule(struct net_device *dev) { if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) { unsigned long flags; @@ -451,34 +466,34 @@ extern __inline__ void __netif_schedule(struct net_device *dev) } } -extern __inline__ void netif_schedule(struct net_device *dev) +static inline void netif_schedule(struct net_device *dev) { if (!test_bit(__LINK_STATE_XOFF, &dev->state)) __netif_schedule(dev); } -extern __inline__ void netif_start_queue(struct net_device *dev) +static inline void netif_start_queue(struct net_device *dev) { clear_bit(__LINK_STATE_XOFF, &dev->state); } -extern __inline__ void netif_wake_queue(struct net_device *dev) +static inline void netif_wake_queue(struct net_device *dev) { if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) __netif_schedule(dev); } -extern __inline__ void netif_stop_queue(struct net_device *dev) +static inline void netif_stop_queue(struct net_device *dev) { set_bit(__LINK_STATE_XOFF, &dev->state); } -extern __inline__ int netif_queue_stopped(struct net_device *dev) +static inline int netif_queue_stopped(struct net_device *dev) { return test_bit(__LINK_STATE_XOFF, &dev->state); } -extern __inline__ int netif_running(struct net_device *dev) +static inline int netif_running(struct net_device *dev) { return test_bit(__LINK_STATE_START, &dev->state); } @@ -486,7 +501,7 @@ extern __inline__ int netif_running(struct net_device *dev) /* Use this variant when it is known for sure that it * is executing from interrupt context. */ -extern __inline__ void dev_kfree_skb_irq(struct sk_buff *skb) +static inline void dev_kfree_skb_irq(struct sk_buff *skb) { if (atomic_dec_and_test(&skb->users)) { int cpu =smp_processor_id(); @@ -503,7 +518,7 @@ extern __inline__ void dev_kfree_skb_irq(struct sk_buff *skb) /* Use this variant in places where it could be invoked * either from interrupt or non-interrupt context. */ -extern __inline__ void dev_kfree_skb_any(struct sk_buff *skb) +static inline void dev_kfree_skb_any(struct sk_buff *skb) { if (in_irq()) dev_kfree_skb_irq(skb); @@ -522,14 +537,14 @@ extern void dev_init(void); extern int netdev_nit; -extern __inline__ void dev_init_buffers(struct net_device *dev) +static inline void dev_init_buffers(struct net_device *dev) { /* DO NOTHING */ } extern int netdev_finish_unregister(struct net_device *dev); -extern __inline__ void dev_put(struct net_device *dev) +static inline void dev_put(struct net_device *dev) { if (atomic_dec_and_test(&dev->refcnt)) netdev_finish_unregister(dev); @@ -543,32 +558,32 @@ extern __inline__ void dev_put(struct net_device *dev) * who is responsible for serialization of these calls. */ -extern __inline__ int netif_carrier_ok(struct net_device *dev) +static inline int netif_carrier_ok(struct net_device *dev) { return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); } extern void __netdev_watchdog_up(struct net_device *dev); -extern __inline__ void netif_carrier_on(struct net_device *dev) +static inline void netif_carrier_on(struct net_device *dev) { clear_bit(__LINK_STATE_NOCARRIER, &dev->state); if (netif_running(dev)) __netdev_watchdog_up(dev); } -extern __inline__ void netif_carrier_off(struct net_device *dev) +static inline void netif_carrier_off(struct net_device *dev) { set_bit(__LINK_STATE_NOCARRIER, &dev->state); } /* Hot-plugging. */ -extern __inline__ int netif_device_present(struct net_device *dev) +static inline int netif_device_present(struct net_device *dev) { return test_bit(__LINK_STATE_PRESENT, &dev->state); } -extern __inline__ void netif_device_detach(struct net_device *dev) +static inline void netif_device_detach(struct net_device *dev) { if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) && netif_running(dev)) { @@ -576,7 +591,7 @@ extern __inline__ void netif_device_detach(struct net_device *dev) } } -extern __inline__ void netif_device_attach(struct net_device *dev) +static inline void netif_device_attach(struct net_device *dev) { if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && netif_running(dev)) { diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h index 4631db1ee..bcf300c51 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h @@ -22,7 +22,8 @@ extern struct list_head protocol_list; /* Returns conntrack if it dealt with ICMP, and filled in skb->nfct */ extern struct ip_conntrack *icmp_error_track(struct sk_buff *skb, - enum ip_conntrack_info *ctinfo); + enum ip_conntrack_info *ctinfo, + unsigned int hooknum); extern int get_tuple(const struct iphdr *iph, size_t len, struct ip_conntrack_tuple *tuple, struct ip_conntrack_protocol *protocol); diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index c0a845caf..0218e940b 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h @@ -31,7 +31,6 @@ struct ip_conntrack_manip { u_int32_t ip; union ip_conntrack_manip_proto u; - u_int16_t pad; /* Must be set to 0 for memcmp. */ }; /* This contains the information to distinguish a connection. */ @@ -78,7 +77,7 @@ DEBUGP("tuple %p: %u %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n", \ IP_PARTS((tp)->src.ip), ntohs((tp)->src.u.all), \ IP_PARTS((tp)->dst.ip), ntohs((tp)->dst.u.all)) -#define CTINFO2DIR(ctinfo) ((ctinfo) == IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) +#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) /* If we're the first tuple, it's the original dir. */ #define DIRECTION(h) ((enum ip_conntrack_dir)(&(h)->ctrack->tuplehash[1] == (h))) @@ -90,6 +89,27 @@ enum ip_conntrack_dir IP_CT_DIR_MAX }; +extern inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1, + const struct ip_conntrack_tuple *t2) +{ + return t1->src.ip == t2->src.ip + && t1->src.u.all == t2->src.u.all; +} + +extern inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1, + const struct ip_conntrack_tuple *t2) +{ + return t1->dst.ip == t2->dst.ip + && t1->dst.u.all == t2->dst.u.all + && t1->dst.protonum == t2->dst.protonum; +} + +extern inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1, + const struct ip_conntrack_tuple *t2) +{ + return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2); +} + /* Connections have two entries in the hash table: one for each way */ struct ip_conntrack_tuple_hash { diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h new file mode 100644 index 000000000..0646a1077 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_LOG.h @@ -0,0 +1,15 @@ +#ifndef _IP6T_LOG_H +#define _IP6T_LOG_H + +#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ +#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ +#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ +#define IP6T_LOG_MASK 0x07 + +struct ip6t_log_info { + unsigned char level; + unsigned char logflags; + char prefix[30]; +}; + +#endif /*_IPT_LOG_H*/ diff --git a/include/linux/netfilter_ipv6/ip6t_MARK.h b/include/linux/netfilter_ipv6/ip6t_MARK.h new file mode 100644 index 000000000..7ade8d8f5 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_MARK.h @@ -0,0 +1,8 @@ +#ifndef _IP6T_MARK_H_target +#define _IP6T_MARK_H_target + +struct ip6t_mark_target_info { + unsigned long mark; +}; + +#endif /*_IPT_MARK_H_target*/ diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h new file mode 100644 index 000000000..d1d72d0e9 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h @@ -0,0 +1,16 @@ +#ifndef _IP6T_REJECT_H +#define _IP6T_REJECT_H + +enum ip6t_reject_with { + IP6T_ICMP_NET_UNREACHABLE, + IP6T_ICMP_HOST_UNREACHABLE, + IP6T_ICMP_PROT_UNREACHABLE, + IP6T_ICMP_PORT_UNREACHABLE, + IP6T_ICMP_ECHOREPLY +}; + +struct ip6t_reject_info { + enum ip6t_reject_with with; /* reject type */ +}; + +#endif /*_IPT_REJECT_H*/ diff --git a/include/linux/netfilter_ipv6/ip6t_limit.h b/include/linux/netfilter_ipv6/ip6t_limit.h new file mode 100644 index 000000000..f2866e50f --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_limit.h @@ -0,0 +1,21 @@ +#ifndef _IP6T_RATE_H +#define _IP6T_RATE_H + +/* timings are in milliseconds. */ +#define IP6T_LIMIT_SCALE 10000 + +/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 + seconds, or one every 59 hours. */ +struct ip6t_rateinfo { + u_int32_t avg; /* Average secs between packets * scale */ + u_int32_t burst; /* Period multiplier for upper limit. */ + + /* Used internally by the kernel */ + unsigned long prev; + u_int32_t credit; + u_int32_t credit_cap, cost; + + /* Ugly, ugly fucker. */ + struct ip6t_rateinfo *master; +}; +#endif /*_IPT_RATE_H*/ diff --git a/include/linux/netfilter_ipv6/ip6t_mac.h b/include/linux/netfilter_ipv6/ip6t_mac.h new file mode 100644 index 000000000..87c088c21 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_mac.h @@ -0,0 +1,8 @@ +#ifndef _IP6T_MAC_H +#define _IP6T_MAC_H + +struct ip6t_mac_info { + unsigned char srcaddr[ETH_ALEN]; + int invert; +}; +#endif /*_IPT_MAC_H*/ diff --git a/include/linux/netfilter_ipv6/ip6t_mark.h b/include/linux/netfilter_ipv6/ip6t_mark.h new file mode 100644 index 000000000..a734441e1 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_mark.h @@ -0,0 +1,9 @@ +#ifndef _IP6T_MARK_H +#define _IP6T_MARK_H + +struct ip6t_mark_info { + unsigned long mark, mask; + u_int8_t invert; +}; + +#endif /*_IPT_MARK_H*/ diff --git a/include/linux/netfilter_ipv6/ip6t_multiport.h b/include/linux/netfilter_ipv6/ip6t_multiport.h new file mode 100644 index 000000000..efe4954a8 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_multiport.h @@ -0,0 +1,21 @@ +#ifndef _IP6T_MULTIPORT_H +#define _IP6T_MULTIPORT_H +#include <linux/netfilter_ipv6/ip6_tables.h> + +enum ip6t_multiport_flags +{ + IP6T_MULTIPORT_SOURCE, + IP6T_MULTIPORT_DESTINATION, + IP6T_MULTIPORT_EITHER +}; + +#define IP6T_MULTI_PORTS 15 + +/* Must fit inside union ip6t_matchinfo: 16 bytes */ +struct ip6t_multiport +{ + u_int8_t flags; /* Type of comparison */ + u_int8_t count; /* Number of ports */ + u_int16_t ports[IP6T_MULTI_PORTS]; /* Ports */ +}; +#endif /*_IPT_MULTIPORT_H*/ diff --git a/include/linux/netfilter_ipv6/ip6t_owner.h b/include/linux/netfilter_ipv6/ip6t_owner.h new file mode 100644 index 000000000..19937da3d --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_owner.h @@ -0,0 +1,18 @@ +#ifndef _IP6T_OWNER_H +#define _IP6T_OWNER_H + +/* match and invert flags */ +#define IP6T_OWNER_UID 0x01 +#define IP6T_OWNER_GID 0x02 +#define IP6T_OWNER_PID 0x04 +#define IP6T_OWNER_SID 0x08 + +struct ip6t_owner_info { + uid_t uid; + gid_t gid; + pid_t pid; + pid_t sid; + u_int8_t match, invert; /* flags */ +}; + +#endif /*_IPT_OWNER_H*/ diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 42faceaa0..562049465 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -21,62 +21,15 @@ struct notifier_block #ifdef __KERNEL__ +extern int notifier_chain_register(struct notifier_block **list, struct notifier_block *n); +extern int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n); +extern int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v); + #define NOTIFY_DONE 0x0000 /* Don't care */ #define NOTIFY_OK 0x0001 /* Suits me */ #define NOTIFY_STOP_MASK 0x8000 /* Don't call further */ #define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002) /* Bad/Veto action */ -extern __inline__ int notifier_chain_register(struct notifier_block **list, struct notifier_block *n) -{ - while(*list) - { - if(n->priority > (*list)->priority) - break; - list= &((*list)->next); - } - n->next = *list; - *list=n; - return 0; -} - -/* - * Warning to any non GPL module writers out there.. these functions are - * GPL'd - */ - -extern __inline__ int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n) -{ - while((*nl)!=NULL) - { - if((*nl)==n) - { - *nl=n->next; - return 0; - } - nl=&((*nl)->next); - } - return -ENOENT; -} - -/* - * This is one of these things that is generally shorter inline - */ - -extern __inline__ int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v) -{ - int ret=NOTIFY_DONE; - struct notifier_block *nb = *n; - while(nb) - { - ret=nb->notifier_call(nb,val,v); - if(ret&NOTIFY_STOP_MASK) - return ret; - nb=nb->next; - } - return ret; -} - - /* * Declared notifiers so far. I can imagine quite a few more chains * over time (eg laptop power reset chains, reboot chain (to clean @@ -105,11 +58,5 @@ extern __inline__ int notifier_call_chain(struct notifier_block **n, unsigned lo #define SYS_HALT 0x0002 /* Notify of system halt */ #define SYS_POWER_OFF 0x0003 /* Notify of system power off */ -/* - * Publically visible notifier objects - */ - -extern struct notifier_block *boot_notifier_list; - -#endif -#endif +#endif /* __KERNEL__ */ +#endif /* _LINUX_NOTIFIER_H */ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 888b5df13..42a85261f 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -190,6 +190,8 @@ #define PCI_VENDOR_ID_NS 0x100b #define PCI_DEVICE_ID_NS_87415 0x0002 +#define PCI_DEVICE_ID_NS_87560_LIO 0x000e +#define PCI_DEVICE_ID_NS_87560_USB 0x0012 #define PCI_DEVICE_ID_NS_87410 0xd001 #define PCI_VENDOR_ID_TSENG 0x100c @@ -259,7 +261,10 @@ #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 #define PCI_DEVICE_ID_AMD_SCSI 0x2020 #define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006 -#define PCI_DEVICE_ID_AMD_VIPER_7403 0x7403 +#define PCI_DEVICE_ID_AMD_COBRA_7400 0x7400 +#define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401 +#define PCI_DEVICE_ID_AMD_COBRA_7403 0x7403 +#define PCI_DEVICE_ID_AMD_COBRA_7404 0x7404 #define PCI_DEVICE_ID_AMD_VIPER_7408 0x7408 #define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409 #define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B @@ -412,6 +417,7 @@ #define PCI_DEVICE_ID_MOTOROLA_CPX8216 0x4806 #define PCI_VENDOR_ID_PROMISE 0x105a +#define PCI_DEVICE_ID_PROMISE_20267 0x4d30 #define PCI_DEVICE_ID_PROMISE_20246 0x4d33 #define PCI_DEVICE_ID_PROMISE_20262 0x4d38 #define PCI_DEVICE_ID_PROMISE_5300 0x5300 @@ -515,6 +521,7 @@ #define PCI_DEVICE_ID_CMD_646 0x0646 #define PCI_DEVICE_ID_CMD_647 0x0647 #define PCI_DEVICE_ID_CMD_648 0x0648 +#define PCI_DEVICE_ID_CMD_649 0x0649 #define PCI_DEVICE_ID_CMD_670 0x0670 #define PCI_VENDOR_ID_VISION 0x1098 @@ -546,6 +553,8 @@ #define PCI_DEVICE_ID_DATABOOK_87144 0xb106 #define PCI_VENDOR_ID_PLX 0x10b5 +#define PCI_VENDOR_ID_PLX_ROMULUS 0x106a +#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076 #define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 #define PCI_DEVICE_ID_PLX_9050 0x9050 #define PCI_DEVICE_ID_PLX_9060 0x9060 @@ -1075,6 +1084,9 @@ #define PCI_VENDOR_ID_AFAVLAB 0x14db #define PCI_DEVICE_ID_AFAVLAB_TK9902 0x2120 +#define PCI_VENDOR_ID_MORETON 0x15aa +#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 + #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 @@ -1173,6 +1185,13 @@ #define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425 #define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426 #define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428 +#define PCI_DEVICE_ID_INTEL_82820FW_0 0x2440 +#define PCI_DEVICE_ID_INTEL_82820FW_1 0x2442 +#define PCI_DEVICE_ID_INTEL_82820FW_2 0x2443 +#define PCI_DEVICE_ID_INTEL_82820FW_3 0x2444 +#define PCI_DEVICE_ID_INTEL_82820FW_4 0x2449 +#define PCI_DEVICE_ID_INTEL_82820FW_5 0x244b +#define PCI_DEVICE_ID_INTEL_82820FW_6 0x244e #define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120 #define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121 #define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122 diff --git a/include/linux/poll.h b/include/linux/poll.h index b56cdcf4c..b83e62d74 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -20,6 +20,7 @@ struct poll_table_entry { typedef struct poll_table_struct { struct poll_table_struct * next; unsigned int nr; + int err; struct poll_table_entry * entry; } poll_table; diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index d0487c3df..28bf3daa0 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -127,7 +127,7 @@ extern void proc_tty_unregister_driver(struct tty_driver *driver); extern void proc_device_tree_init(void); extern struct proc_dir_entry *proc_symlink(const char *, - struct proc_dir_entry *,char *); + struct proc_dir_entry *, const char *); extern struct proc_dir_entry *proc_mknod(const char *,mode_t, struct proc_dir_entry *,kdev_t); extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h index ad5ca5543..dd9b7cb6e 100644 --- a/include/linux/qnx4_fs.h +++ b/include/linux/qnx4_fs.h @@ -116,7 +116,7 @@ extern void qnx4_truncate(struct inode *inode); extern void qnx4_free_inode(struct inode *inode); extern int qnx4_unlink(struct inode *dir, struct dentry *dentry); extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry); -extern int qnx4_sync_file(struct file *file, struct dentry *dentry); +extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int); extern int qnx4_sync_inode(struct inode *inode); extern int qnx4_get_block(struct inode *inode, long iblock, struct buffer_head *bh, int create); diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index c2cabe19b..152fb359b 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h @@ -78,7 +78,6 @@ extern int md_do_sync(mddev_t *mddev, mdp_disk_t *spare); extern void md_done_sync(mddev_t *mddev, int blocks, int ok); extern void md_recover_arrays (void); extern int md_check_ordering (mddev_t *mddev); -extern void autodetect_raid(void); extern struct gendisk * find_gendisk (kdev_t dev); extern int md_notify_reboot(struct notifier_block *this, unsigned long code, void *x); diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index b62d63750..9f722b49e 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -199,15 +199,16 @@ struct mddev_s int sb_dirty; mdu_param_t param; int ro; - unsigned long curr_resync; - unsigned long resync_start; + unsigned long curr_resync; /* blocks scheduled */ + unsigned long resync_mark; /* a recent timestamp */ + unsigned long resync_mark_cnt;/* blocks written at resync_mark */ char *name; int recovery_running; struct semaphore reconfig_sem; struct semaphore recovery_sem; struct semaphore resync_sem; - atomic_t recovery_active; + atomic_t recovery_active; /* blocks scheduled, but not written */ md_wait_queue_head_t recovery_wait; struct md_list_head all_mddevs; @@ -218,11 +219,9 @@ struct mdk_personality_s { char *name; int (*make_request)(request_queue_t *q, mddev_t *mddev, int rw, struct buffer_head * bh); - void (*end_request)(struct buffer_head * bh, int uptodate); int (*run)(mddev_t *mddev); int (*stop)(mddev_t *mddev); int (*status)(char *page, mddev_t *mddev); - int max_invalid_dev; int (*error_handler)(mddev_t *mddev, kdev_t dev); /* @@ -337,7 +336,8 @@ typedef struct mdk_thread_s { typedef struct dev_name_s { struct md_list_head list; kdev_t dev; - char name [MAX_DISKNAME_LEN]; + char namebuf [MAX_DISKNAME_LEN]; + char *name; } dev_name_t; diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 1016bdaa4..ffa65d20d 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h @@ -9,6 +9,7 @@ struct mirror_info { kdev_t dev; int next; int sect_limit; + int head_position; /* * State bits: @@ -34,6 +35,18 @@ struct raid1_private_data { struct mirror_info *spare; md_spinlock_t device_lock; + /* buffer pool */ + /* buffer_heads that we have pre-allocated have b_pprev -> &freebh + * and are linked into a stack using b_next + * raid1_bh that are pre-allocated have R1BH_PreAlloc set. + * All these variable are protected by device_lock + */ + struct buffer_head *freebh; + int freebh_cnt; /* how many are on the list */ + struct raid1_bh *freer1; + struct raid1_bh *freebuf; /* each bh_req has a page allocated */ + md_wait_queue_head_t wait_buffer; + /* for use when syncing mirrors: */ int start_active, start_ready, start_pending, start_future; @@ -68,12 +81,12 @@ struct raid1_bh { unsigned long state; mddev_t *mddev; struct buffer_head *master_bh; - struct buffer_head *mirror_bh [MD_SB_DISKS]; + struct buffer_head *mirror_bh_list; struct buffer_head bh_req; - struct buffer_head *next_retry; + struct raid1_bh *next_r1; /* next for retry or in free list */ }; /* bits for raid1_bh.state */ #define R1BH_Uptodate 1 #define R1BH_SyncPhase 2 - +#define R1BH_PreAlloc 3 /* this was pre-allocated, add to free list */ #endif diff --git a/include/linux/raid1.h b/include/linux/raid1.h deleted file mode 100644 index 4b031e682..000000000 --- a/include/linux/raid1.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _RAID1_H -#define _RAID1_H - -#include <linux/md.h> - -struct mirror_info { - int number; - int raid_disk; - kdev_t dev; - int next; - int sect_limit; - - /* - * State bits: - */ - int operational; - int write_only; - int spare; -}; - -struct raid1_data { - struct md_dev *mddev; - struct mirror_info mirrors[MD_SB_DISKS]; /* RAID1 devices, 2 to MD_SB_DISKS */ - int raid_disks; - int working_disks; /* Number of working disks */ - int last_used; - unsigned long next_sect; - int sect_count; - int resync_running; -}; - -/* - * this is our 'private' 'collective' RAID1 buffer head. - * it contains information about what kind of IO operations were started - * for this RAID5 operation, and about their status: - */ - -struct raid1_bh { - unsigned int remaining; - int cmd; - unsigned long state; - struct md_dev *mddev; - struct buffer_head *master_bh; - struct buffer_head *mirror_bh [MD_SB_DISKS]; - struct buffer_head bh_req; - struct buffer_head *next_retry; -}; - -#endif diff --git a/include/linux/raid5.h b/include/linux/raid5.h deleted file mode 100644 index 655d41d54..000000000 --- a/include/linux/raid5.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef _RAID5_H -#define _RAID5_H - -#ifdef __KERNEL__ -#include <linux/md.h> -#include <asm/atomic.h> - -struct disk_info { - kdev_t dev; - int operational; - int number; - int raid_disk; - int write_only; - int spare; -}; - -struct stripe_head { - struct stripe_head *hash_next, **hash_pprev; /* hash pointers */ - struct stripe_head *free_next; /* pool of free sh's */ - struct buffer_head *buffer_pool; /* pool of free buffers */ - struct buffer_head *bh_pool; /* pool of free bh's */ - struct raid5_data *raid_conf; - struct buffer_head *bh_old[MD_SB_DISKS]; /* disk image */ - struct buffer_head *bh_new[MD_SB_DISKS]; /* buffers of the MD device (present in buffer cache) */ - struct buffer_head *bh_copy[MD_SB_DISKS]; /* copy on write of bh_new (bh_new can change from under us) */ - struct buffer_head *bh_req[MD_SB_DISKS]; /* copy of bh_new (only the buffer heads), queued to the lower levels */ - int cmd_new[MD_SB_DISKS]; /* READ/WRITE for new */ - int new[MD_SB_DISKS]; /* buffer added since the last handle_stripe() */ - unsigned long sector; /* sector of this row */ - int size; /* buffers size */ - int pd_idx; /* parity disk index */ - int nr_pending; /* nr of pending cmds */ - unsigned long state; /* state flags */ - int cmd; /* stripe cmd */ - int count; /* nr of waiters */ - int write_method; /* reconstruct-write / read-modify-write */ - int phase; /* PHASE_BEGIN, ..., PHASE_COMPLETE */ - wait_queue_head_t wait; /* processes waiting for this stripe */ -}; - -/* - * Phase - */ -#define PHASE_BEGIN 0 -#define PHASE_READ_OLD 1 -#define PHASE_WRITE 2 -#define PHASE_READ 3 -#define PHASE_COMPLETE 4 - -/* - * Write method - */ -#define METHOD_NONE 0 -#define RECONSTRUCT_WRITE 1 -#define READ_MODIFY_WRITE 2 - -/* - * Stripe state - */ -#define STRIPE_LOCKED 0 -#define STRIPE_ERROR 1 - -/* - * Stripe commands - */ -#define STRIPE_NONE 0 -#define STRIPE_WRITE 1 -#define STRIPE_READ 2 - -struct raid5_data { - struct stripe_head **stripe_hashtbl; - struct md_dev *mddev; - struct md_thread *thread, *resync_thread; - struct disk_info disks[MD_SB_DISKS]; - struct disk_info *spare; - int buffer_size; - int chunk_size, level, algorithm; - int raid_disks, working_disks, failed_disks; - int sector_count; - unsigned long next_sector; - atomic_t nr_handle; - struct stripe_head *next_free_stripe; - int nr_stripes; - int resync_parity; - int max_nr_stripes; - int clock; - int nr_hashed_stripes; - int nr_locked_stripes; - int nr_pending_stripes; - int nr_cached_stripes; - - /* - * Free stripes pool - */ - int nr_free_sh; - struct stripe_head *free_sh_list; - wait_queue_head_t wait_for_stripe; -}; - -#endif - -/* - * Our supported algorithms - */ -#define ALGORITHM_LEFT_ASYMMETRIC 0 -#define ALGORITHM_RIGHT_ASYMMETRIC 1 -#define ALGORITHM_LEFT_SYMMETRIC 2 -#define ALGORITHM_RIGHT_SYMMETRIC 3 - -#endif diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 463350f5c..5f128a952 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -34,7 +34,6 @@ #include <linux/notifier.h> -extern struct notifier_block *reboot_notifier_list; extern int register_reboot_notifier(struct notifier_block *); extern int unregister_reboot_notifier(struct notifier_block *); diff --git a/include/linux/sched.h b/include/linux/sched.h index 2bfe015dd..e32e56cf1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -269,6 +269,7 @@ struct task_struct { struct mm_struct *mm, *active_mm; int has_cpu; int processor; + unsigned long ptrace; struct list_head run_list; struct task_struct *next_task, *prev_task; int last_processor; @@ -356,8 +357,6 @@ struct task_struct { /* Not implemented yet, only for 486*/ #define PF_STARTING 0x00000002 /* being created */ #define PF_EXITING 0x00000004 /* getting shut down */ -#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called */ -#define PF_TRACESYS 0x00000020 /* tracing system calls */ #define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ #define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ #define PF_DUMPCORE 0x00000200 /* dumped core */ @@ -366,7 +365,14 @@ struct task_struct { #define PF_VFORK 0x00001000 /* Wake up parent in mm_release */ #define PF_USEDFPU 0x00100000 /* task used FPU this quantum (SMP) */ -#define PF_DTRACE 0x00200000 /* delayed trace (used on m68k, i386) */ + +/* + * Ptrace flags + */ + +#define PT_PTRACED 0x00000001 +#define PT_TRACESYS 0x00000002 +#define PT_DTRACE 0x00000004 /* delayed trace (used on m68k, i386) */ /* * Limit the stack by to some sane default: root can always diff --git a/include/linux/serial.h b/include/linux/serial.h index da10e19ed..ce404ca1a 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -10,6 +10,7 @@ #ifndef _LINUX_SERIAL_H #define _LINUX_SERIAL_H +#ifdef __KERNEL__ #include <asm/page.h> /* @@ -27,10 +28,12 @@ struct async_icount { */ #define SERIAL_XMIT_SIZE PAGE_SIZE +#endif + struct serial_struct { int type; int line; - unsigned long port; + unsigned int port; int irq; int flags; int xmit_fifo_size; @@ -44,7 +47,8 @@ struct serial_struct { unsigned short closing_wait2; /* no longer used... */ unsigned char *iomem_base; unsigned short iomem_reg_shift; - int reserved[2]; + unsigned int port_high; + int reserved[1]; }; /* @@ -70,7 +74,8 @@ struct serial_struct { #define PORT_16C950 10 /* Oxford Semiconductor */ #define PORT_16654 11 #define PORT_16850 12 -#define PORT_MAX 12 +#define PORT_RSA 13 /* RSA-DV II/S card */ +#define PORT_MAX 13 #define SERIAL_IO_PORT 0 #define SERIAL_IO_HUB6 1 @@ -115,7 +120,10 @@ struct serial_uart_config { #define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */ -#define ASYNC_FLAGS 0x3FFF /* Possible legal async flags */ +#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety + * checks. Note: can be dangerous! */ + +#define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */ #define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged * users can set or reset */ @@ -127,7 +135,9 @@ struct serial_uart_config { #define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ #define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ #define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ -#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards */ +#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards + --- no longer used */ +#define ASYNC_AUTOPROBE 0x00800000 /* Port was autoprobed */ #define ASYNC_INTERNAL_FLAGS 0xFF000000 /* Internal flags */ diff --git a/include/linux/serialP.h b/include/linux/serialP.h index 8329b4580..d1f901262 100644 --- a/include/linux/serialP.h +++ b/include/linux/serialP.h @@ -24,6 +24,11 @@ #include <linux/tqueue.h> #include <linux/circ_buf.h> #include <linux/wait.h> +#if (LINUX_VERSION_CODE < 0x020300) +/* Unfortunate, but Linux 2.2 needs async_icount defined here and + * it got moved in 2.3 */ +#include <linux/serial.h> +#endif struct serial_state { int magic; @@ -190,6 +195,9 @@ struct pci_board_inst { /* Do not use irq sharing for this device */ #define SPCI_FL_NO_SHIRQ 0x1000 -#define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE) +/* This is a PNP device */ +#define SPCI_FL_ISPNP 0x2000 + +#define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE|SPCI_FL_ISPNP) #endif /* _LINUX_SERIAL_H */ diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h index 1787be41f..09feb9501 100644 --- a/include/linux/serial_reg.h +++ b/include/linux/serial_reg.h @@ -229,5 +229,54 @@ #define UART_TRG_120 0x78 #define UART_TRG_128 0x80 +/* + * These definitions are for the RSA-DV II/S card, from + * + * Kiyokazu SUTO <suto@ks-and-ks.ne.jp> + */ + +#define UART_RSA_BASE (-8) + +#define UART_RSA_MSR ((UART_RSA_BASE) + 0) /* I/O: Mode Select Register */ + +#define UART_RSA_MSR_SWAP (1 << 0) /* Swap low/high 8 bytes in I/O port addr */ +#define UART_RSA_MSR_FIFO (1 << 2) /* Enable the external FIFO */ +#define UART_RSA_MSR_FLOW (1 << 3) /* Enable the auto RTS/CTS flow control */ +#define UART_RSA_MSR_ITYP (1 << 4) /* Level (1) / Edge triger (0) */ + +#define UART_RSA_IER ((UART_RSA_BASE) + 1) /* I/O: Interrupt Enable Register */ + +#define UART_RSA_IER_Rx_FIFO_H (1 << 0) /* Enable Rx FIFO half full int. */ +#define UART_RSA_IER_Tx_FIFO_H (1 << 1) /* Enable Tx FIFO half full int. */ +#define UART_RSA_IER_Tx_FIFO_E (1 << 2) /* Enable Tx FIFO empty int. */ +#define UART_RSA_IER_Rx_TOUT (1 << 3) /* Enable char receive timeout int */ +#define UART_RSA_IER_TIMER (1 << 4) /* Enable timer interrupt */ + +#define UART_RSA_SRR ((UART_RSA_BASE) + 2) /* IN: Status Read Register */ + +#define UART_RSA_SRR_Tx_FIFO_NEMP (1 << 0) /* Tx FIFO is not empty (1) */ +#define UART_RSA_SRR_Tx_FIFO_NHFL (1 << 1) /* Tx FIFO is not half full (1) */ +#define UART_RSA_SRR_Tx_FIFO_NFUL (1 << 2) /* Tx FIFO is not full (1) */ +#define UART_RSA_SRR_Rx_FIFO_NEMP (1 << 3) /* Rx FIFO is not empty (1) */ +#define UART_RSA_SRR_Rx_FIFO_NHFL (1 << 4) /* Rx FIFO is not half full (1) */ +#define UART_RSA_SRR_Rx_FIFO_NFUL (1 << 5) /* Rx FIFO is not full (1) */ +#define UART_RSA_SRR_Rx_TOUT (1 << 6) /* Character reception timeout occured (1) */ +#define UART_RSA_SRR_TIMER (1 << 7) /* Timer interrupt occured */ + +#define UART_RSA_FRR ((UART_RSA_BASE) + 2) /* OUT: FIFO Reset Register */ + +#define UART_RSA_TIVSR ((UART_RSA_BASE) + 3) /* I/O: Timer Interval Value Set Register */ + +#define UART_RSA_TCR ((UART_RSA_BASE) + 4) /* OUT: Timer Control Register */ + +#define UART_RSA_TCR_SWITCH (1 << 0) /* Timer on */ + +/* + * The RSA DSV/II board has two fixed clock frequencies. One is the + * standard rate, and the other is 8 times faster. + */ +#define SERIAL_RSA_BAUD_BASE (921600) +#define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) + #endif /* _LINUX_SERIAL_REG_H */ diff --git a/include/linux/shm.h b/include/linux/shm.h index bc56c5e20..e1b335cbe 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -2,7 +2,7 @@ #define _LINUX_SHM_H_ #include <linux/ipc.h> -#include <linux/mm.h> +#include <asm/page.h> /* * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 20029fd67..71f8772cd 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -168,17 +168,8 @@ struct sk_buff { #include <asm/system.h> extern void __kfree_skb(struct sk_buff *skb); -extern void skb_queue_head_init(struct sk_buff_head *list); -extern void skb_queue_head(struct sk_buff_head *list,struct sk_buff *buf); -extern void skb_queue_tail(struct sk_buff_head *list,struct sk_buff *buf); -extern struct sk_buff * skb_dequeue(struct sk_buff_head *list); -extern void skb_insert(struct sk_buff *old,struct sk_buff *newsk); -extern void skb_append(struct sk_buff *old,struct sk_buff *newsk); -extern void skb_unlink(struct sk_buff *buf); -extern __u32 skb_queue_len(struct sk_buff_head *list); extern struct sk_buff * skb_peek_copy(struct sk_buff_head *list); extern struct sk_buff * alloc_skb(unsigned int size, int priority); -extern struct sk_buff * dev_alloc_skb(unsigned int size); extern void kfree_skbmem(struct sk_buff *skb); extern struct sk_buff * skb_clone(struct sk_buff *skb, int priority); extern struct sk_buff * skb_copy(const struct sk_buff *skb, int priority); @@ -187,13 +178,6 @@ extern struct sk_buff * skb_copy_expand(const struct sk_buff *skb, int newtailroom, int priority); #define dev_kfree_skb(a) kfree_skb(a) -extern unsigned char * skb_put(struct sk_buff *skb, unsigned int len); -extern unsigned char * skb_push(struct sk_buff *skb, unsigned int len); -extern unsigned char * skb_pull(struct sk_buff *skb, unsigned int len); -extern int skb_headroom(const struct sk_buff *skb); -extern int skb_tailroom(const struct sk_buff *skb); -extern void skb_reserve(struct sk_buff *skb, unsigned int len); -extern void skb_trim(struct sk_buff *skb, unsigned int len); extern void skb_over_panic(struct sk_buff *skb, int len, void *here); extern void skb_under_panic(struct sk_buff *skb, int len, void *here); @@ -201,7 +185,7 @@ extern void skb_under_panic(struct sk_buff *skb, int len, void *here); #define skb_realloc_headroom(skb, nhr) skb_copy_expand(skb, nhr, skb_tailroom(skb), GFP_ATOMIC) /* Internal */ -extern __inline__ atomic_t *skb_datarefp(struct sk_buff *skb) +static inline atomic_t *skb_datarefp(struct sk_buff *skb) { return (atomic_t *)(skb->end); } @@ -213,7 +197,7 @@ extern __inline__ atomic_t *skb_datarefp(struct sk_buff *skb) * Returns true if the queue is empty, false otherwise. */ -extern __inline__ int skb_queue_empty(struct sk_buff_head *list) +static inline int skb_queue_empty(struct sk_buff_head *list) { return (list->next == (struct sk_buff *) list); } @@ -226,7 +210,7 @@ extern __inline__ int skb_queue_empty(struct sk_buff_head *list) * to the buffer. */ -extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb) +static inline struct sk_buff *skb_get(struct sk_buff *skb) { atomic_inc(&skb->users); return skb; @@ -245,14 +229,14 @@ extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb) * hit zero. */ -extern __inline__ void kfree_skb(struct sk_buff *skb) +static inline void kfree_skb(struct sk_buff *skb) { if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) __kfree_skb(skb); } /* Use this if you didn't touch the skb state [for fast switching] */ -extern __inline__ void kfree_skb_fast(struct sk_buff *skb) +static inline void kfree_skb_fast(struct sk_buff *skb) { if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) kfree_skbmem(skb); @@ -267,7 +251,7 @@ extern __inline__ void kfree_skb_fast(struct sk_buff *skb) * shared data so must not be written to under normal circumstances. */ -extern __inline__ int skb_cloned(struct sk_buff *skb) +static inline int skb_cloned(struct sk_buff *skb) { return skb->cloned && atomic_read(skb_datarefp(skb)) != 1; } @@ -280,7 +264,7 @@ extern __inline__ int skb_cloned(struct sk_buff *skb) * buffer. */ -extern __inline__ int skb_shared(struct sk_buff *skb) +static inline int skb_shared(struct sk_buff *skb) { return (atomic_read(&skb->users) != 1); } @@ -299,7 +283,7 @@ extern __inline__ int skb_shared(struct sk_buff *skb) * NULL is returned on a memory allocation failure. */ -extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) +static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) { if (skb_shared(skb)) { struct sk_buff *nskb; @@ -332,7 +316,7 @@ extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) * %NULL is returned on a memory allocation failure. */ -extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) +static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) { struct sk_buff *nskb; if(!skb_cloned(skb)) @@ -356,7 +340,7 @@ extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) * volatile. Use with caution. */ -extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) +static inline struct sk_buff *skb_peek(struct sk_buff_head *list_) { struct sk_buff *list = ((struct sk_buff *)list_)->next; if (list == (struct sk_buff *)list_) @@ -378,7 +362,7 @@ extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) * volatile. Use with caution. */ -extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) +static inline struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) { struct sk_buff *list = ((struct sk_buff *)list_)->prev; if (list == (struct sk_buff *)list_) @@ -393,12 +377,12 @@ extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) * Return the length of an &sk_buff queue. */ -extern __inline__ __u32 skb_queue_len(struct sk_buff_head *list_) +static inline __u32 skb_queue_len(struct sk_buff_head *list_) { return(list_->qlen); } -extern __inline__ void skb_queue_head_init(struct sk_buff_head *list) +static inline void skb_queue_head_init(struct sk_buff_head *list) { spin_lock_init(&list->lock); list->prev = (struct sk_buff *)list; @@ -424,7 +408,7 @@ extern __inline__ void skb_queue_head_init(struct sk_buff_head *list) * A buffer cannot be placed on two lists at the same time. */ -extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) +static inline void __skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { struct sk_buff *prev, *next; @@ -451,7 +435,7 @@ extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buf * A buffer cannot be placed on two lists at the same time. */ -extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) +static inline void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; @@ -472,7 +456,7 @@ extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff */ -extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) +static inline void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { struct sk_buff *prev, *next; @@ -498,7 +482,7 @@ extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buf * A buffer cannot be placed on two lists at the same time. */ -extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) +static inline void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; @@ -516,7 +500,7 @@ extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff * returned or %NULL if the list is empty. */ -extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) +static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) { struct sk_buff *next, *prev, *result; @@ -545,7 +529,7 @@ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) * returned or %NULL if the list is empty. */ -extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list) +static inline struct sk_buff *skb_dequeue(struct sk_buff_head *list) { long flags; struct sk_buff *result; @@ -560,7 +544,7 @@ extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list) * Insert a packet on a list. */ -extern __inline__ void __skb_insert(struct sk_buff *newsk, +static inline void __skb_insert(struct sk_buff *newsk, struct sk_buff * prev, struct sk_buff *next, struct sk_buff_head * list) { @@ -582,7 +566,7 @@ extern __inline__ void __skb_insert(struct sk_buff *newsk, * A buffer cannot be placed on two lists at the same time. */ -extern __inline__ void skb_insert(struct sk_buff *old, struct sk_buff *newsk) +static inline void skb_insert(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -595,7 +579,7 @@ extern __inline__ void skb_insert(struct sk_buff *old, struct sk_buff *newsk) * Place a packet after a given packet in a list. */ -extern __inline__ void __skb_append(struct sk_buff *old, struct sk_buff *newsk) +static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk) { __skb_insert(newsk, old, old->next, old->list); } @@ -611,7 +595,7 @@ extern __inline__ void __skb_append(struct sk_buff *old, struct sk_buff *newsk) */ -extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) +static inline void skb_append(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -625,7 +609,7 @@ extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) * the list known.. */ -extern __inline__ void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) +static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) { struct sk_buff * next, * prev; @@ -652,7 +636,7 @@ extern __inline__ void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *li * destroyed. */ -extern __inline__ void skb_unlink(struct sk_buff *skb) +static inline void skb_unlink(struct sk_buff *skb) { struct sk_buff_head *list = skb->list; @@ -677,7 +661,7 @@ extern __inline__ void skb_unlink(struct sk_buff *skb) * returned or %NULL if the list is empty. */ -extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) +static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) { struct sk_buff *skb = skb_peek_tail(list); if (skb) @@ -694,7 +678,7 @@ extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) * returned or %NULL if the list is empty. */ -extern __inline__ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list) +static inline struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list) { long flags; struct sk_buff *result; @@ -709,7 +693,7 @@ extern __inline__ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list) * Add data to an sk_buff */ -extern __inline__ unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) +static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp=skb->tail; skb->tail+=len; @@ -727,7 +711,7 @@ extern __inline__ unsigned char *__skb_put(struct sk_buff *skb, unsigned int len * first byte of the extra data is returned. */ -extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) +static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp=skb->tail; skb->tail+=len; @@ -738,7 +722,7 @@ extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) return tmp; } -extern __inline__ unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) +static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) { skb->data-=len; skb->len+=len; @@ -755,7 +739,7 @@ extern __inline__ unsigned char *__skb_push(struct sk_buff *skb, unsigned int le * panic. A pointer to the first byte of the extra data is returned. */ -extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) +static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len) { skb->data-=len; skb->len+=len; @@ -765,7 +749,7 @@ extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) return skb->data; } -extern __inline__ char *__skb_pull(struct sk_buff *skb, unsigned int len) +static inline char *__skb_pull(struct sk_buff *skb, unsigned int len) { skb->len-=len; return skb->data+=len; @@ -782,7 +766,7 @@ extern __inline__ char *__skb_pull(struct sk_buff *skb, unsigned int len) * the old data. */ -extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) +static inline unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) { if (len > skb->len) return NULL; @@ -796,7 +780,7 @@ extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len * Return the number of bytes of free space at the head of an &sk_buff. */ -extern __inline__ int skb_headroom(const struct sk_buff *skb) +static inline int skb_headroom(const struct sk_buff *skb) { return skb->data-skb->head; } @@ -808,7 +792,7 @@ extern __inline__ int skb_headroom(const struct sk_buff *skb) * Return the number of bytes of free space at the tail of an sk_buff */ -extern __inline__ int skb_tailroom(const struct sk_buff *skb) +static inline int skb_tailroom(const struct sk_buff *skb) { return skb->end-skb->tail; } @@ -822,14 +806,14 @@ extern __inline__ int skb_tailroom(const struct sk_buff *skb) * room. This is only allowed for an empty buffer. */ -extern __inline__ void skb_reserve(struct sk_buff *skb, unsigned int len) +static inline void skb_reserve(struct sk_buff *skb, unsigned int len) { skb->data+=len; skb->tail+=len; } -extern __inline__ void __skb_trim(struct sk_buff *skb, unsigned int len) +static inline void __skb_trim(struct sk_buff *skb, unsigned int len) { skb->len = len; skb->tail = skb->data+len; @@ -844,7 +828,7 @@ extern __inline__ void __skb_trim(struct sk_buff *skb, unsigned int len) * the buffer is already under the length specified it is not modified. */ -extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) +static inline void skb_trim(struct sk_buff *skb, unsigned int len) { if (skb->len > len) { __skb_trim(skb, len); @@ -861,7 +845,7 @@ extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) */ -extern __inline__ void skb_orphan(struct sk_buff *skb) +static inline void skb_orphan(struct sk_buff *skb) { if (skb->destructor) skb->destructor(skb); @@ -879,7 +863,7 @@ extern __inline__ void skb_orphan(struct sk_buff *skb) */ -extern __inline__ void skb_queue_purge(struct sk_buff_head *list) +static inline void skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; while ((skb=skb_dequeue(list))!=NULL) @@ -896,7 +880,7 @@ extern __inline__ void skb_queue_purge(struct sk_buff_head *list) */ -extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) +static inline void __skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; while ((skb=__skb_dequeue(list))!=NULL) @@ -916,7 +900,7 @@ extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) * allocates memory it can be called from an interrupt. */ -extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) +static inline struct sk_buff *dev_alloc_skb(unsigned int length) { struct sk_buff *skb; @@ -942,7 +926,7 @@ extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) */ -extern __inline__ struct sk_buff * +static inline struct sk_buff * skb_cow(struct sk_buff *skb, unsigned int headroom) { headroom = (headroom+15)&~15; @@ -965,13 +949,13 @@ extern void skb_init(void); extern void skb_add_mtu(int mtu); #ifdef CONFIG_NETFILTER -extern __inline__ void +static inline void nf_conntrack_put(struct nf_ct_info *nfct) { if (nfct && atomic_dec_and_test(&nfct->master->use)) nfct->master->destroy(nfct->master); } -extern __inline__ void +static inline void nf_conntrack_get(struct nf_ct_info *nfct) { if (nfct) diff --git a/include/linux/socket.h b/include/linux/socket.h index 3401ce5df..6c590a531 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -190,10 +190,10 @@ struct ucred { /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 -/* Flags we can use with send/ and recv. +/* Flags we can use with send/ and recv. Added those for 1003.1g not all are supported yet */ - + #define MSG_OOB 1 #define MSG_PEEK 2 #define MSG_DONTROUTE 4 diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 0d09eb48a..4cc0f16ad 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -30,7 +30,7 @@ struct rpc_portmap { * The high-level client handle */ struct rpc_clnt { - unsigned int cl_users; /* number of references */ + atomic_t cl_users; /* number of references */ struct rpc_xprt * cl_xprt; /* transport */ struct rpc_procinfo * cl_procinfo; /* procedure info */ u32 cl_maxproc; /* max procedure number */ diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index c82289283..eb55e776c 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h @@ -9,13 +9,17 @@ #ifndef _LINUX_SUNRPC_DEBUG_H_ #define _LINUX_SUNRPC_DEBUG_H_ +#include <linux/config.h> + #include <linux/timer.h> #include <linux/tqueue.h> /* * Enable RPC debugging/profiling. */ +#ifdef CONFIG_SYSCTL #define RPC_DEBUG +#endif /* #define RPC_PROFILE */ /* diff --git a/include/linux/swap.h b/include/linux/swap.h index 9226ce0a5..5ee3b7b77 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -161,6 +161,16 @@ static inline int is_page_shared(struct page *page) extern spinlock_t pagemap_lru_lock; /* + * Magic constants for page aging. If the system is programmed + * right, tweaking these should have almost no effect... + * The 2.4 code, however, is mostly simple and stable ;) + */ +#define PG_AGE_MAX 64 +#define PG_AGE_START 2 +#define PG_AGE_ADV 3 +#define PG_AGE_DECL 1 + +/* * Helper macros for lru_pages handling. */ #define lru_cache_add(page) \ @@ -168,12 +178,16 @@ do { \ spin_lock(&pagemap_lru_lock); \ list_add(&(page)->lru, &lru_cache); \ nr_lru_pages++; \ + page->age = PG_AGE_START; \ + ClearPageReferenced(page); \ + SetPageActive(page); \ spin_unlock(&pagemap_lru_lock); \ } while (0) #define __lru_cache_del(page) \ do { \ list_del(&(page)->lru); \ + ClearPageActive(page); \ nr_lru_pages--; \ } while (0) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 923a7a111..b374bb9c6 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -545,8 +545,11 @@ enum { /* /proc/sys/dev/parport/parport n */ enum { DEV_PARPORT_SPINTIME=1, - DEV_PARPORT_HARDWARE=2, - DEV_PARPORT_DEVICES=3, + DEV_PARPORT_BASE_ADDR=2, + DEV_PARPORT_IRQ=3, + DEV_PARPORT_DMA=4, + DEV_PARPORT_MODES=5, + DEV_PARPORT_DEVICES=6, DEV_PARPORT_AUTOPROBE=16 }; diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index d9c2557e5..4cff4260c 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -377,9 +377,9 @@ extern unsigned long sysv_count_free_blocks(struct super_block *sb); extern struct buffer_head * sysv_file_bread(struct inode *, int, int); extern void sysv_truncate(struct inode *); -extern void sysv_write_inode(struct inode *); +extern void sysv_write_inode(struct inode *, int); extern int sysv_sync_inode(struct inode *); -extern int sysv_sync_file(struct file *, struct dentry *); +extern int sysv_sync_file(struct file *, struct dentry *, int); extern int sysv_notify_change(struct dentry *, struct iattr *); extern struct inode_operations sysv_file_inode_operations; diff --git a/include/linux/timer.h b/include/linux/timer.h index 2de8050ea..45887372a 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -1,6 +1,8 @@ #ifndef _LINUX_TIMER_H #define _LINUX_TIMER_H +#ifdef __KERNEL__ + #include <linux/config.h> #include <linux/list.h> @@ -91,9 +93,11 @@ extern int del_timer_sync(struct timer_list * timer); #define timer_set_running(t) (void)(t) #define timer_is_running(t) (0) #define timer_synchronize(t) do { (void)(t); barrier(); } while(0) -#define del_timer_sync(t) del_timer(t) +#define del_timer_sync del_timer #endif +#define del_timer_async del_timer + /* * These inlines deal with timer wrapping correctly. You are * strongly encouraged to use them @@ -112,3 +116,4 @@ extern int del_timer_sync(struct timer_list * timer); #define time_before_eq(a,b) time_after_eq(b,a) #endif +#endif diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index 934850f26..85517135d 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -80,7 +80,7 @@ extern spinlock_t tqueue_lock; /* * queue_task */ -extern __inline__ void queue_task(struct tq_struct *bh_pointer, +static inline void queue_task(struct tq_struct *bh_pointer, task_queue *bh_list) { if (!test_and_set_bit(0,&bh_pointer->sync)) { @@ -95,7 +95,7 @@ extern __inline__ void queue_task(struct tq_struct *bh_pointer, /* * Call all "bottom halfs" on a given list. */ -extern __inline__ void run_task_queue(task_queue *list) +static inline void run_task_queue(task_queue *list) { if (*list) { unsigned long flags; diff --git a/include/linux/types.h b/include/linux/types.h index 196c5f4e0..df4808fcd 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -1,7 +1,10 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +#ifdef __KERNEL__ #include <linux/config.h> +#endif + #include <linux/posix_types.h> #include <asm/types.h> diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index 96cb38e67..3c8f1d415 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -560,9 +560,8 @@ extern struct inode * ufs_new_inode (const struct inode *, int, int *); extern int ufs_frag_map (struct inode *, int); extern void ufs_read_inode (struct inode *); extern void ufs_put_inode (struct inode *); -extern void ufs_write_inode (struct inode *); +extern void ufs_write_inode (struct inode *, int); extern int ufs_sync_inode (struct inode *); -extern void ufs_write_inode (struct inode *); extern void ufs_delete_inode (struct inode *); extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *); extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); diff --git a/include/linux/umsdos_fs.p b/include/linux/umsdos_fs.p index 76436a479..677bee22e 100644 --- a/include/linux/umsdos_fs.p +++ b/include/linux/umsdos_fs.p @@ -48,7 +48,7 @@ int umsdos_isempty (struct dentry *); /* inode.c 12/06/95 09.49.40 */ void fill_new_filp (struct file *filp, struct dentry *dentry); void UMSDOS_read_inode (struct inode *); -void UMSDOS_write_inode (struct inode *); +void UMSDOS_write_inode (struct inode *, int); int UMSDOS_notify_change (struct dentry *, struct iattr *attr); int umsdos_notify_change_locked(struct dentry *, struct iattr *attr); void UMSDOS_put_inode (struct inode *); diff --git a/include/linux/usb.h b/include/linux/usb.h index a7c8fb324..1b1d3f902 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -307,6 +307,10 @@ struct usb_driver { struct file_operations *fops; int minor; + + struct semaphore serialize; + + int (*ioctl)(struct usb_device *dev, unsigned int code, void *buf); }; /* @@ -331,6 +335,9 @@ typedef int (*usb_device_irq)(int, void *, int, void *); * New USB Structures * *----------------------------------------------------------------------------*/ +/* + * urb->transfer_flags: + */ #define USB_DISABLE_SPD 0x0001 #define USB_ISO_ASAP 0x0002 #define USB_URB_EARLY_COMPLETE 0x0004 @@ -362,10 +369,11 @@ typedef struct urb void *transfer_buffer; // associated data buffer int transfer_buffer_length; // data buffer length int actual_length; // actual data buffer length + int bandwidth; // bandwidth for this transfer request (INT or ISO) unsigned char *setup_packet; // setup packet (control only) // int start_frame; // start frame (iso/irq only) - int number_of_packets; // number of packets in this request (iso/irq only) + int number_of_packets; // number of packets in this request (iso) int interval; // polling interval (irq only) int error_count; // number of errors in this transfer (iso only) int timeout; // timeout (in jiffies) @@ -483,7 +491,7 @@ struct usb_bus { struct list_head bus_list; void *hcpriv; /* Host Controller private data */ - unsigned int bandwidth_allocated; /* on this Host Controller; */ + int bandwidth_allocated; /* on this Host Controller; */ /* applies to Int. and Isoc. pipes; */ /* measured in microseconds/frame; */ /* range is 0..900, where 900 = */ @@ -492,7 +500,7 @@ struct usb_bus { int bandwidth_isoc_reqs; /* number of Isoc. requesters */ /* usbdevfs inode list */ - struct list_head inodes; + struct list_head inodes; }; #define USB_MAXCHILDREN (8) /* This is arbitrary */ @@ -506,7 +514,6 @@ struct usb_device { unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */ unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; */ /* [0] = IN, [1] = OUT */ - struct usb_config_descriptor *actconfig;/* the active configuration */ int epmaxpacketin[16]; /* INput endpoint specific maximums */ int epmaxpacketout[16]; /* OUTput endpoint specific maximums */ @@ -515,6 +522,9 @@ struct usb_device { struct usb_device_descriptor descriptor;/* Descriptor */ struct usb_config_descriptor *config; /* All of the configs */ + struct usb_config_descriptor *actconfig;/* the active configuration */ + + char **rawdescriptors; /* Raw descriptors for each config */ int have_langid; /* whether string_langid is valid yet */ int string_langid; /* language ID for strings */ @@ -522,8 +532,8 @@ struct usb_device { void *hcpriv; /* Host Controller private data */ /* usbdevfs inode list */ - struct list_head inodes; - struct list_head filelist; + struct list_head inodes; + struct list_head filelist; /* * Child devices - these can be either new devices @@ -537,6 +547,8 @@ struct usb_device { struct usb_device *children[USB_MAXCHILDREN]; }; +extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum); + extern int usb_register(struct usb_driver *); extern void usb_deregister(struct usb_driver *); @@ -554,7 +566,10 @@ extern struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bu extern void usb_free_dev(struct usb_device *); extern void usb_inc_dev_use(struct usb_device *); #define usb_dec_dev_use usb_free_dev -extern void usb_release_bandwidth(struct usb_device *, int); + +extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); +extern void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime, int isoc); +extern void usb_release_bandwidth(struct usb_device *dev, struct urb *urb, int isoc); extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout); @@ -671,6 +686,7 @@ int usb_get_class_descriptor(struct usb_device *dev, int ifnum, unsigned char de int usb_get_device_descriptor(struct usb_device *dev); int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type, void **ptr); int usb_get_status(struct usb_device *dev, int type, int target, void *data); +int usb_get_configuration(struct usb_device *dev); int usb_get_protocol(struct usb_device *dev, int ifnum); int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol); int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); @@ -682,6 +698,7 @@ int usb_set_report(struct usb_device *dev, int ifnum, unsigned char type, unsigned char id, void *buf, int size); int usb_string(struct usb_device *dev, int index, char *buf, size_t size); int usb_clear_halt(struct usb_device *dev, int pipe); +void usb_set_maxpacket(struct usb_device *dev); #define usb_get_extra_descriptor(ifpoint,type,ptr)\ __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,type,(void**)ptr) diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 7fa98fcb5..0bf8d3087 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -66,6 +66,18 @@ struct usbdevfs_disconnectsignal { void *context; }; +#define USBDEVFS_MAXDRIVERNAME 255 + +struct usbdevfs_getdriver { + unsigned int interface; + char driver[USBDEVFS_MAXDRIVERNAME + 1]; +}; + +struct usbdevfs_connectinfo { + unsigned int devnum; + unsigned char slow; +}; + #define USBDEVFS_URB_DISABLE_SPD 1 #define USBDEVFS_URB_ISO_ASAP 2 @@ -96,11 +108,27 @@ struct usbdevfs_urb { struct usbdevfs_iso_packet_desc iso_frame_desc[0]; }; +/* ioctls for talking to drivers in the usbcore module: */ +struct usbdevfs_ioctl { + int ifno; /* interface 0..N ; negative numbers reserved */ + int ioctl_code; /* MUST encode size + direction of data so the + * macros in <asm/ioctl.h> give correct values */ + void *data; /* param buffer (in, or out) */ +}; + +/* You can do most things with hubs just through control messages, + * except find out what device connects to what port. */ +struct usbdevfs_hub_portinfo { + char nports; /* number of downstream ports in this hub */ + char port [127]; /* e.g. port 3 connects to device 27 */ +}; + #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) +#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) #define USBDEVFS_DISCARDURB _IO('U', 11) #define USBDEVFS_REAPURB _IOW('U', 12, void *) @@ -108,6 +136,10 @@ struct usbdevfs_urb { #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) +#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) +#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) +#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) +#define USBDEVFS_RESET _IO('U', 20) /* --------------------------------------------------------------------- */ @@ -165,7 +197,6 @@ extern struct inode_operations usbdevfs_bus_inode_operations; extern struct file_operations usbdevfs_bus_file_operations; extern void usbdevfs_conn_disc_event(void); - #endif /* __KERNEL__ */ /* --------------------------------------------------------------------- */ diff --git a/include/linux/wrapper.h b/include/linux/wrapper.h index bcfaff073..36d80ef1e 100644 --- a/include/linux/wrapper.h +++ b/include/linux/wrapper.h @@ -19,9 +19,6 @@ #define module_unregister_blkdev unregister_blkdev #define inode_get_rdev(i) i->i_rdev -#define inode_get_count(i) i->i_count -#define inode_inc_count(i) i->i_count++ -#define inode_dec_count(i) i->i_count-- #define file_get_flags(f) f->f_flags diff --git a/include/net/tcp.h b/include/net/tcp.h index 65fb19289..7df845895 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -337,16 +337,24 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) so that we select tick to get range about 4 seconds. */ -#if HZ == 20 +#if HZ <= 16 || HZ > 4096 +# error Unsupported: HZ <= 16 or HZ > 4096 +#elif HZ <= 32 # define TCP_TW_RECYCLE_TICK (5+2-TCP_TW_RECYCLE_SLOTS_LOG) -#elif HZ == 64 +#elif HZ <= 64 # define TCP_TW_RECYCLE_TICK (6+2-TCP_TW_RECYCLE_SLOTS_LOG) -#elif HZ == 100 || HZ == 128 +#elif HZ <= 128 # define TCP_TW_RECYCLE_TICK (7+2-TCP_TW_RECYCLE_SLOTS_LOG) -#elif HZ == 1024 || HZ == 1000 +#elif HZ <= 256 +# define TCP_TW_RECYCLE_TICK (8+2-TCP_TW_RECYCLE_SLOTS_LOG) +#elif HZ <= 512 +# define TCP_TW_RECYCLE_TICK (9+2-TCP_TW_RECYCLE_SLOTS_LOG) +#elif HZ <= 1024 # define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG) +#elif HZ <= 2048 +# define TCP_TW_RECYCLE_TICK (11+2-TCP_TW_RECYCLE_SLOTS_LOG) #else -# error HZ != 20 && HZ != 64 && HZ != 100 && HZ != 1000 && HZ != 1024 +# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) #endif /* diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 283e81695..680069a44 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -11,9 +11,18 @@ Original driver (sg.h): Version 2 and 3 extensions to driver: * Copyright (C) 1998 - 2000 Douglas Gilbert - Version: 3.1.13 (20000323) + Version: 3.1.15 (20000528) This version is for 2.3/2.4 series kernels. + Changes since 3.1.14 (20000503) + - fix aha1542 odd length buffer problem + - make multiple readers on same fd safe + Changes since 3.1.13 (20000324) + - revert change so sg_header interface doesn't send _UNKNOWN + - "discon" and "tq" in /proc/scsi/sg/devices replaced with + "bopens" and "busy"; correct duration output in procfs + - provision for SG_RESET + - lock file descriptor and request lists Changes since 3.1.12 (20000222) - make sg_header interface use SCSI_DATA_UNKNOWN - add SG_DXFER_UNKNOWN define to sg interface @@ -49,10 +58,9 @@ Map of SG verions to the Linux kernels in which they appear: 2.1.31 2.2.6 and 2.2.7 2.1.32 2.2.8 and 2.2.9 2.1.34 2.2.10 to 2.2.13 - 2.1.36 2.2.14 - 2.3.35 2.3.x development series kernels (starting 2.3.20) + 2.1.36 2.2.14 and 2.2.15 3.0.x optional version 3 sg driver for 2.2 series - 3.1.x candidate version 3 sg driver for 2.3 series + 3.1.x first appeared in lk 2.3.43 Major new features in SG 3.x driver (cf SG 2.x drivers) - SG_IO ioctl() combines function if write() and read() @@ -100,10 +108,10 @@ Major features in SG 2.x driver (cf original SG driver) The main documents are still based on 2.x versions: http://www.torque.net/sg/p/scsi-generic.txt http://www.torque.net/sg/p/scsi-generic_long.txt - The first document can also be found in the kernel source tree, probably at: - /usr/src/linux/Documentation/scsi-generic.txt . Documentation on the changes and additions in 3.x version of the sg driver can be found at: http://www.torque.net/sg/p/scsi-generic_v3.txt + This document can also be found in the kernel source tree, probably at: + /usr/src/linux/Documentation/scsi-generic.txt . Utility and test programs are also available at that web site. */ |