diff options
Diffstat (limited to 'arch/sparc/include/asm')
215 files changed, 3213 insertions, 8825 deletions
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild index 3c93f08ce18..a4582181800 100644 --- a/arch/sparc/include/asm/Kbuild +++ b/arch/sparc/include/asm/Kbuild @@ -1,18 +1,21 @@  # User exported sparc header files -include include/asm-generic/Kbuild.asm -header-y += apc.h -header-y += asi.h -header-y += display7seg.h -header-y += envctrl.h -header-y += fbio.h -header-y += jsflash.h -header-y += openpromio.h -header-y += perfctr.h -header-y += psrcompat.h -header-y += psr.h -header-y += pstate.h -header-y += traps.h -header-y += uctx.h -header-y += utrap.h -header-y += watchdog.h + +generic-y += clkdev.h +generic-y += cputime.h +generic-y += div64.h +generic-y += emergency-restart.h +generic-y += exec.h +generic-y += hash.h +generic-y += irq_regs.h +generic-y += linkage.h +generic-y += local.h +generic-y += local64.h +generic-y += mcs_spinlock.h +generic-y += module.h +generic-y += mutex.h +generic-y += preempt.h +generic-y += serial.h +generic-y += trace_clock.h +generic-y += types.h +generic-y += word-at-a-time.h diff --git a/arch/sparc/include/asm/apc.h b/arch/sparc/include/asm/apc.h deleted file mode 100644 index 24e9a7d4d97..00000000000 --- a/arch/sparc/include/asm/apc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* apc - Driver definitions for power management functions - * of Aurora Personality Chip (APC) on SPARCstation-4/5 and  - * derivatives - * - * Copyright (c) 2001 Eric Brower (ebrower@usa.net) - * - */ - -#ifndef _SPARC_APC_H -#define _SPARC_APC_H - -#include <linux/ioctl.h> - -#define APC_IOC	'A' - -#define APCIOCGFANCTL _IOR(APC_IOC, 0x00, int)	/* Get fan speed	*/ -#define APCIOCSFANCTL _IOW(APC_IOC, 0x01, int)	/* Set fan speed	*/ - -#define APCIOCGCPWR   _IOR(APC_IOC, 0x02, int)	/* Get CPOWER state	*/ -#define APCIOCSCPWR   _IOW(APC_IOC, 0x03, int)	/* Set CPOWER state	*/ - -#define APCIOCGBPORT   _IOR(APC_IOC, 0x04, int)	/* Get BPORT state 	*/ -#define APCIOCSBPORT   _IOW(APC_IOC, 0x05, int)	/* Set BPORT state	*/ - -/* - * Register offsets - */ -#define APC_IDLE_REG	0x00 -#define APC_FANCTL_REG	0x20 -#define APC_CPOWER_REG	0x24 -#define APC_BPORT_REG	0x30 - -#define APC_REGMASK		0x01 -#define APC_BPMASK		0x03 - -/* - * IDLE - CPU standby values (set to initiate standby) - */ -#define APC_IDLE_ON		0x01 - -/* - * FANCTL - Fan speed control state values - */ -#define APC_FANCTL_HI	0x00	/* Fan speed high	*/ -#define APC_FANCTL_LO	0x01	/* Fan speed low	*/ - -/* - * CPWR - Convenience power outlet state values  - */ -#define APC_CPOWER_ON	0x00	/* Conv power on	*/ -#define APC_CPOWER_OFF	0x01	/* Conv power off	*/ - -/* - * BPA/BPB - Read-Write "Bit Ports" state values (reset to 0 at power-on) - * - * WARNING: Internal usage of bit ports is platform dependent-- - * don't modify BPORT settings unless you know what you are doing. - *  - * On SS5 BPA seems to toggle onboard ethernet loopback... -E - */ -#define APC_BPORT_A		0x01	/* Bit Port A		*/ -#define APC_BPORT_B		0x02	/* Bit Port B		*/ - -#endif /* !(_SPARC_APC_H) */ diff --git a/arch/sparc/include/asm/asi.h b/arch/sparc/include/asm/asi.h deleted file mode 100644 index b2e3db63a64..00000000000 --- a/arch/sparc/include/asm/asi.h +++ /dev/null @@ -1,266 +0,0 @@ -#ifndef _SPARC_ASI_H -#define _SPARC_ASI_H - -/* asi.h:  Address Space Identifier values for the sparc. - * - * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu) - * - * Pioneer work for sun4m: Paul Hatchman (paul@sfe.com.au) - * Joint edition for sun4c+sun4m: Pete A. Zaitcev <zaitcev@ipmce.su> - */ - -/* The first batch are for the sun4c. */ - -#define ASI_NULL1           0x00 -#define ASI_NULL2           0x01 - -/* sun4c and sun4 control registers and mmu/vac ops */ -#define ASI_CONTROL         0x02 -#define ASI_SEGMAP          0x03 -#define ASI_PTE             0x04 -#define ASI_HWFLUSHSEG      0x05 -#define ASI_HWFLUSHPAGE     0x06 -#define ASI_REGMAP          0x06 -#define ASI_HWFLUSHCONTEXT  0x07 - -#define ASI_USERTXT         0x08 -#define ASI_KERNELTXT       0x09 -#define ASI_USERDATA        0x0a -#define ASI_KERNELDATA      0x0b - -/* VAC Cache flushing on sun4c and sun4 */ -#define ASI_FLUSHSEG        0x0c -#define ASI_FLUSHPG         0x0d -#define ASI_FLUSHCTX        0x0e - -/* SPARCstation-5: only 6 bits are decoded. */ -/* wo = Write Only, rw = Read Write;        */ -/* ss = Single Size, as = All Sizes;        */ -#define ASI_M_RES00         0x00   /* Don't touch... */ -#define ASI_M_UNA01         0x01   /* Same here... */ -#define ASI_M_MXCC          0x02   /* Access to TI VIKING MXCC registers */ -#define ASI_M_FLUSH_PROBE   0x03   /* Reference MMU Flush/Probe; rw, ss */ -#ifndef CONFIG_SPARC_LEON -#define ASI_M_MMUREGS       0x04   /* MMU Registers; rw, ss */ -#else -#define ASI_M_MMUREGS       0x19 -#endif /* CONFIG_SPARC_LEON */ -#define ASI_M_TLBDIAG       0x05   /* MMU TLB only Diagnostics */ -#define ASI_M_DIAGS         0x06   /* Reference MMU Diagnostics */ -#define ASI_M_IODIAG        0x07   /* MMU I/O TLB only Diagnostics */ -#define ASI_M_USERTXT       0x08   /* Same as ASI_USERTXT; rw, as */ -#define ASI_M_KERNELTXT     0x09   /* Same as ASI_KERNELTXT; rw, as */ -#define ASI_M_USERDATA      0x0A   /* Same as ASI_USERDATA; rw, as */ -#define ASI_M_KERNELDATA    0x0B   /* Same as ASI_KERNELDATA; rw, as */ -#define ASI_M_TXTC_TAG      0x0C   /* Instruction Cache Tag; rw, ss */ -#define ASI_M_TXTC_DATA     0x0D   /* Instruction Cache Data; rw, ss */ -#define ASI_M_DATAC_TAG     0x0E   /* Data Cache Tag; rw, ss */ -#define ASI_M_DATAC_DATA    0x0F   /* Data Cache Data; rw, ss */ - -/* The following cache flushing ASIs work only with the 'sta' - * instruction. Results are unpredictable for 'swap' and 'ldstuba', - * so don't do it. - */ - -/* These ASI flushes affect external caches too. */ -#define ASI_M_FLUSH_PAGE    0x10   /* Flush I&D Cache Line (page); wo, ss */ -#define ASI_M_FLUSH_SEG     0x11   /* Flush I&D Cache Line (seg); wo, ss */ -#define ASI_M_FLUSH_REGION  0x12   /* Flush I&D Cache Line (region); wo, ss */ -#define ASI_M_FLUSH_CTX     0x13   /* Flush I&D Cache Line (context); wo, ss */ -#define ASI_M_FLUSH_USER    0x14   /* Flush I&D Cache Line (user); wo, ss */ - -/* Block-copy operations are available only on certain V8 cpus. */ -#define ASI_M_BCOPY         0x17   /* Block copy */ - -/* These affect only the ICACHE and are Ross HyperSparc and TurboSparc specific. */ -#define ASI_M_IFLUSH_PAGE   0x18   /* Flush I Cache Line (page); wo, ss */ -#define ASI_M_IFLUSH_SEG    0x19   /* Flush I Cache Line (seg); wo, ss */ -#define ASI_M_IFLUSH_REGION 0x1A   /* Flush I Cache Line (region); wo, ss */ -#define ASI_M_IFLUSH_CTX    0x1B   /* Flush I Cache Line (context); wo, ss */ -#define ASI_M_IFLUSH_USER   0x1C   /* Flush I Cache Line (user); wo, ss */ - -/* Block-fill operations are available on certain V8 cpus */ -#define ASI_M_BFILL         0x1F - -/* This allows direct access to main memory, actually 0x20 to 0x2f are - * the available ASI's for physical ram pass-through, but I don't have - * any idea what the other ones do.... - */ - -#define ASI_M_BYPASS       0x20   /* Reference MMU bypass; rw, as */ -#define ASI_M_FBMEM        0x29   /* Graphics card frame buffer access */ -#define ASI_M_VMEUS        0x2A   /* VME user 16-bit access */ -#define ASI_M_VMEPS        0x2B   /* VME priv 16-bit access */ -#define ASI_M_VMEUT        0x2C   /* VME user 32-bit access */ -#define ASI_M_VMEPT        0x2D   /* VME priv 32-bit access */ -#define ASI_M_SBUS         0x2E   /* Direct SBus access */ -#define ASI_M_CTL          0x2F   /* Control Space (ECC and MXCC are here) */ - - -/* This is ROSS HyperSparc only. */ -#define ASI_M_FLUSH_IWHOLE 0x31   /* Flush entire ICACHE; wo, ss */ - -/* Tsunami/Viking/TurboSparc i/d cache flash clear. */ -#define ASI_M_IC_FLCLEAR   0x36 -#define ASI_M_DC_FLCLEAR   0x37 - -#define ASI_M_DCDR         0x39   /* Data Cache Diagnostics Register rw, ss */ - -#define ASI_M_VIKING_TMP1  0x40	  /* Emulation temporary 1 on Viking */ -/* only available on SuperSparc I */ -/* #define ASI_M_VIKING_TMP2  0x41 */  /* Emulation temporary 2 on Viking */ - -#define ASI_M_ACTION       0x4c   /* Breakpoint Action Register (GNU/Viking) */ - -/* V9 Architecture mandary ASIs. */ -#define ASI_N			0x04 /* Nucleus				*/ -#define ASI_NL			0x0c /* Nucleus, little endian		*/ -#define ASI_AIUP		0x10 /* Primary, user			*/ -#define ASI_AIUS		0x11 /* Secondary, user			*/ -#define ASI_AIUPL		0x18 /* Primary, user, little endian	*/ -#define ASI_AIUSL		0x19 /* Secondary, user, little endian	*/ -#define ASI_P			0x80 /* Primary, implicit		*/ -#define ASI_S			0x81 /* Secondary, implicit		*/ -#define ASI_PNF			0x82 /* Primary, no fault		*/ -#define ASI_SNF			0x83 /* Secondary, no fault		*/ -#define ASI_PL			0x88 /* Primary, implicit, l-endian	*/ -#define ASI_SL			0x89 /* Secondary, implicit, l-endian	*/ -#define ASI_PNFL		0x8a /* Primary, no fault, l-endian	*/ -#define ASI_SNFL		0x8b /* Secondary, no fault, l-endian	*/ - -/* SpitFire and later extended ASIs.  The "(III)" marker designates - * UltraSparc-III and later specific ASIs.  The "(CMT)" marker designates - * Chip Multi Threading specific ASIs.  "(NG)" designates Niagara specific - * ASIs, "(4V)" designates SUN4V specific ASIs. - */ -#define ASI_PHYS_USE_EC		0x14 /* PADDR, E-cachable		*/ -#define ASI_PHYS_BYPASS_EC_E	0x15 /* PADDR, E-bit			*/ -#define ASI_BLK_AIUP_4V		0x16 /* (4V) Prim, user, block ld/st	*/ -#define ASI_BLK_AIUS_4V		0x17 /* (4V) Sec, user, block ld/st	*/ -#define ASI_PHYS_USE_EC_L	0x1c /* PADDR, E-cachable, little endian*/ -#define ASI_PHYS_BYPASS_EC_E_L	0x1d /* PADDR, E-bit, little endian	*/ -#define ASI_BLK_AIUP_L_4V	0x1e /* (4V) Prim, user, block, l-endian*/ -#define ASI_BLK_AIUS_L_4V	0x1f /* (4V) Sec, user, block, l-endian	*/ -#define ASI_SCRATCHPAD		0x20 /* (4V) Scratch Pad Registers	*/ -#define ASI_MMU			0x21 /* (4V) MMU Context Registers	*/ -#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23 /* (NG) init-store, twin load, -					 * secondary, user -					 */ -#define ASI_NUCLEUS_QUAD_LDD	0x24 /* Cachable, qword load		*/ -#define ASI_QUEUE		0x25 /* (4V) Interrupt Queue Registers	*/ -#define ASI_QUAD_LDD_PHYS_4V	0x26 /* (4V) Physical, qword load	*/ -#define ASI_NUCLEUS_QUAD_LDD_L	0x2c /* Cachable, qword load, l-endian 	*/ -#define ASI_QUAD_LDD_PHYS_L_4V	0x2e /* (4V) Phys, qword load, l-endian	*/ -#define ASI_PCACHE_DATA_STATUS	0x30 /* (III) PCache data stat RAM diag	*/ -#define ASI_PCACHE_DATA		0x31 /* (III) PCache data RAM diag	*/ -#define ASI_PCACHE_TAG		0x32 /* (III) PCache tag RAM diag	*/ -#define ASI_PCACHE_SNOOP_TAG	0x33 /* (III) PCache snoop tag RAM diag	*/ -#define ASI_QUAD_LDD_PHYS	0x34 /* (III+) PADDR, qword load	*/ -#define ASI_WCACHE_VALID_BITS	0x38 /* (III) WCache Valid Bits diag	*/ -#define ASI_WCACHE_DATA		0x39 /* (III) WCache data RAM diag	*/ -#define ASI_WCACHE_TAG		0x3a /* (III) WCache tag RAM diag	*/ -#define ASI_WCACHE_SNOOP_TAG	0x3b /* (III) WCache snoop tag RAM diag	*/ -#define ASI_QUAD_LDD_PHYS_L	0x3c /* (III+) PADDR, qw-load, l-endian	*/ -#define ASI_SRAM_FAST_INIT	0x40 /* (III+) Fast SRAM init		*/ -#define ASI_CORE_AVAILABLE	0x41 /* (CMT) LP Available		*/ -#define ASI_CORE_ENABLE_STAT	0x41 /* (CMT) LP Enable Status		*/ -#define ASI_CORE_ENABLE		0x41 /* (CMT) LP Enable RW		*/ -#define ASI_XIR_STEERING	0x41 /* (CMT) XIR Steering RW		*/ -#define ASI_CORE_RUNNING_RW	0x41 /* (CMT) LP Running RW		*/ -#define ASI_CORE_RUNNING_W1S	0x41 /* (CMT) LP Running Write-One Set	*/ -#define ASI_CORE_RUNNING_W1C	0x41 /* (CMT) LP Running Write-One Clr	*/ -#define ASI_CORE_RUNNING_STAT	0x41 /* (CMT) LP Running Status		*/ -#define ASI_CMT_ERROR_STEERING	0x41 /* (CMT) Error Steering RW		*/ -#define ASI_DCACHE_INVALIDATE	0x42 /* (III) DCache Invalidate diag	*/ -#define ASI_DCACHE_UTAG		0x43 /* (III) DCache uTag diag		*/ -#define ASI_DCACHE_SNOOP_TAG	0x44 /* (III) DCache snoop tag RAM diag	*/ -#define ASI_LSU_CONTROL		0x45 /* Load-store control unit		*/ -#define ASI_DCU_CONTROL_REG	0x45 /* (III) DCache Unit Control reg	*/ -#define ASI_DCACHE_DATA		0x46 /* DCache data-ram diag access	*/ -#define ASI_DCACHE_TAG		0x47 /* Dcache tag/valid ram diag access*/ -#define ASI_INTR_DISPATCH_STAT	0x48 /* IRQ vector dispatch status	*/ -#define ASI_INTR_RECEIVE	0x49 /* IRQ vector receive status	*/ -#define ASI_UPA_CONFIG		0x4a /* UPA config space		*/ -#define ASI_JBUS_CONFIG		0x4a /* (IIIi) JBUS Config Register	*/ -#define ASI_SAFARI_CONFIG	0x4a /* (III) Safari Config Register	*/ -#define ASI_SAFARI_ADDRESS	0x4a /* (III) Safari Address Register	*/ -#define ASI_ESTATE_ERROR_EN	0x4b /* E-cache error enable space	*/ -#define ASI_AFSR		0x4c /* Async fault status register	*/ -#define ASI_AFAR		0x4d /* Async fault address register	*/ -#define ASI_EC_TAG_DATA		0x4e /* E-cache tag/valid ram diag acc	*/ -#define ASI_IMMU		0x50 /* Insn-MMU main register space	*/ -#define ASI_IMMU_TSB_8KB_PTR	0x51 /* Insn-MMU 8KB TSB pointer reg	*/ -#define ASI_IMMU_TSB_64KB_PTR	0x52 /* Insn-MMU 64KB TSB pointer reg	*/ -#define ASI_ITLB_DATA_IN	0x54 /* Insn-MMU TLB data in reg	*/ -#define ASI_ITLB_DATA_ACCESS	0x55 /* Insn-MMU TLB data access reg	*/ -#define ASI_ITLB_TAG_READ	0x56 /* Insn-MMU TLB tag read reg	*/ -#define ASI_IMMU_DEMAP		0x57 /* Insn-MMU TLB demap		*/ -#define ASI_DMMU		0x58 /* Data-MMU main register space	*/ -#define ASI_DMMU_TSB_8KB_PTR	0x59 /* Data-MMU 8KB TSB pointer reg	*/ -#define ASI_DMMU_TSB_64KB_PTR	0x5a /* Data-MMU 16KB TSB pointer reg	*/ -#define ASI_DMMU_TSB_DIRECT_PTR	0x5b /* Data-MMU TSB direct pointer reg	*/ -#define ASI_DTLB_DATA_IN	0x5c /* Data-MMU TLB data in reg	*/ -#define ASI_DTLB_DATA_ACCESS	0x5d /* Data-MMU TLB data access reg	*/ -#define ASI_DTLB_TAG_READ	0x5e /* Data-MMU TLB tag read reg	*/ -#define ASI_DMMU_DEMAP		0x5f /* Data-MMU TLB demap		*/ -#define ASI_IIU_INST_TRAP	0x60 /* (III) Instruction Breakpoint	*/ -#define ASI_INTR_ID		0x63 /* (CMT) Interrupt ID register	*/ -#define ASI_CORE_ID		0x63 /* (CMT) LP ID register		*/ -#define ASI_CESR_ID		0x63 /* (CMT) CESR ID register		*/ -#define ASI_IC_INSTR		0x66 /* Insn cache instrucion ram diag	*/ -#define ASI_IC_TAG		0x67 /* Insn cache tag/valid ram diag 	*/ -#define ASI_IC_STAG		0x68 /* (III) Insn cache snoop tag ram	*/ -#define ASI_IC_PRE_DECODE	0x6e /* Insn cache pre-decode ram diag	*/ -#define ASI_IC_NEXT_FIELD	0x6f /* Insn cache next-field ram diag	*/ -#define ASI_BRPRED_ARRAY	0x6f /* (III) Branch Prediction RAM diag*/ -#define ASI_BLK_AIUP		0x70 /* Primary, user, block load/store	*/ -#define ASI_BLK_AIUS		0x71 /* Secondary, user, block ld/st	*/ -#define ASI_MCU_CTRL_REG	0x72 /* (III) Memory controller regs	*/ -#define ASI_EC_DATA		0x74 /* (III) E-cache data staging reg	*/ -#define ASI_EC_CTRL		0x75 /* (III) E-cache control reg	*/ -#define ASI_EC_W		0x76 /* E-cache diag write access	*/ -#define ASI_UDB_ERROR_W		0x77 /* External UDB error regs W	*/ -#define ASI_UDB_CONTROL_W	0x77 /* External UDB control regs W	*/ -#define ASI_INTR_W		0x77 /* IRQ vector dispatch write	*/ -#define ASI_INTR_DATAN_W	0x77 /* (III) Out irq vector data reg N	*/ -#define ASI_INTR_DISPATCH_W	0x77 /* (III) Interrupt vector dispatch	*/ -#define ASI_BLK_AIUPL		0x78 /* Primary, user, little, blk ld/st*/ -#define ASI_BLK_AIUSL		0x79 /* Secondary, user, little, blk ld/st*/ -#define ASI_EC_R		0x7e /* E-cache diag read access	*/ -#define ASI_UDBH_ERROR_R	0x7f /* External UDB error regs rd hi	*/ -#define ASI_UDBL_ERROR_R	0x7f /* External UDB error regs rd low	*/ -#define ASI_UDBH_CONTROL_R	0x7f /* External UDB control regs rd hi	*/ -#define ASI_UDBL_CONTROL_R	0x7f /* External UDB control regs rd low*/ -#define ASI_INTR_R		0x7f /* IRQ vector dispatch read	*/ -#define ASI_INTR_DATAN_R	0x7f /* (III) In irq vector data reg N	*/ -#define ASI_PST8_P		0xc0 /* Primary, 8 8-bit, partial	*/ -#define ASI_PST8_S		0xc1 /* Secondary, 8 8-bit, partial	*/ -#define ASI_PST16_P		0xc2 /* Primary, 4 16-bit, partial	*/ -#define ASI_PST16_S		0xc3 /* Secondary, 4 16-bit, partial	*/ -#define ASI_PST32_P		0xc4 /* Primary, 2 32-bit, partial	*/ -#define ASI_PST32_S		0xc5 /* Secondary, 2 32-bit, partial	*/ -#define ASI_PST8_PL		0xc8 /* Primary, 8 8-bit, partial, L	*/ -#define ASI_PST8_SL		0xc9 /* Secondary, 8 8-bit, partial, L	*/ -#define ASI_PST16_PL		0xca /* Primary, 4 16-bit, partial, L	*/ -#define ASI_PST16_SL		0xcb /* Secondary, 4 16-bit, partial, L	*/ -#define ASI_PST32_PL		0xcc /* Primary, 2 32-bit, partial, L	*/ -#define ASI_PST32_SL		0xcd /* Secondary, 2 32-bit, partial, L	*/ -#define ASI_FL8_P		0xd0 /* Primary, 1 8-bit, fpu ld/st	*/ -#define ASI_FL8_S		0xd1 /* Secondary, 1 8-bit, fpu ld/st	*/ -#define ASI_FL16_P		0xd2 /* Primary, 1 16-bit, fpu ld/st	*/ -#define ASI_FL16_S		0xd3 /* Secondary, 1 16-bit, fpu ld/st	*/ -#define ASI_FL8_PL		0xd8 /* Primary, 1 8-bit, fpu ld/st, L	*/ -#define ASI_FL8_SL		0xd9 /* Secondary, 1 8-bit, fpu ld/st, L*/ -#define ASI_FL16_PL		0xda /* Primary, 1 16-bit, fpu ld/st, L	*/ -#define ASI_FL16_SL		0xdb /* Secondary, 1 16-bit, fpu ld/st,L*/ -#define ASI_BLK_COMMIT_P	0xe0 /* Primary, blk store commit	*/ -#define ASI_BLK_COMMIT_S	0xe1 /* Secondary, blk store commit	*/ -#define ASI_BLK_INIT_QUAD_LDD_P	0xe2 /* (NG) init-store, twin load, -				      * primary, implicit -				      */ -#define ASI_BLK_P		0xf0 /* Primary, blk ld/st		*/ -#define ASI_BLK_S		0xf1 /* Secondary, blk ld/st		*/ -#define ASI_BLK_PL		0xf8 /* Primary, blk ld/st, little	*/ -#define ASI_BLK_SL		0xf9 /* Secondary, blk ld/st, little	*/ - -#endif /* _SPARC_ASI_H */ diff --git a/arch/sparc/include/asm/asmmacro.h b/arch/sparc/include/asm/asmmacro.h index a995bf8aba3..a0e28ef0255 100644 --- a/arch/sparc/include/asm/asmmacro.h +++ b/arch/sparc/include/asm/asmmacro.h @@ -6,17 +6,6 @@  #ifndef _SPARC_ASMMACRO_H  #define _SPARC_ASMMACRO_H -#include <asm/btfixup.h> -#include <asm/asi.h> - -#define GET_PROCESSOR4M_ID(reg) \ -	rd	%tbr, %reg; \ -	srl	%reg, 12, %reg; \ -	and	%reg, 3, %reg; - -#define GET_PROCESSOR4D_ID(reg) \ -	lda	[%g0] ASI_M_VIKING_TMP1, %reg; -  /* All trap entry points _must_ begin with this macro or else you   * lose.  It makes sure the kernel has a proper window so that   * c-code can be called. @@ -31,10 +20,26 @@  /* All traps low-level code here must end with this macro. */  #define RESTORE_ALL b ret_trap_entry; clr %l6; -/* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+ -   likes byte accesses. These are to avoid ifdef mania. */ - -#define lduXa	lduba -#define stXa	stba +/* Support for run-time patching of single instructions. + * This is used to handle the differences in the ASI for + * MMUREGS for LEON and SUN. + * + * Sample: + * LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0 + * SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0 + * PI == Patch Instruction + * + * For LEON we will use the first variant, + * and for all other we will use the SUN variant. + * The order is important. + */ +#define LEON_PI(...)				\ +662:	__VA_ARGS__ + +#define SUN_PI_(...)				\ +	.section .leon_1insn_patch, "ax";	\ +	.word 662b;				\ +	__VA_ARGS__;				\ +	.previous  #endif /* !(_SPARC_ASMMACRO_H) */ diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 7ae128b19d3..7aed2be45b4 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h @@ -13,17 +13,18 @@  #include <linux/types.h> -#ifdef __KERNEL__ +#include <asm/cmpxchg.h> +#include <asm/barrier.h> +#include <asm-generic/atomic64.h> -#include <asm/system.h>  #define ATOMIC_INIT(i)  { (i) } -extern int __atomic_add_return(int, atomic_t *); -extern int atomic_cmpxchg(atomic_t *, int, int); +int __atomic_add_return(int, atomic_t *); +int atomic_cmpxchg(atomic_t *, int, int);  #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) -extern int atomic_add_unless(atomic_t *, int, int); -extern void atomic_set(atomic_t *, int); +int __atomic_add_unless(atomic_t *, int, int); +void atomic_set(atomic_t *, int);  #define atomic_read(v)          (*(volatile int *)&(v)->counter) @@ -52,114 +53,4 @@ extern void atomic_set(atomic_t *, int);  #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)  #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) - -/* This is the old 24-bit implementation.  It's still used internally - * by some sparc-specific code, notably the semaphore implementation. - */ -typedef struct { volatile int counter; } atomic24_t; - -#ifndef CONFIG_SMP - -#define ATOMIC24_INIT(i)  { (i) } -#define atomic24_read(v)          ((v)->counter) -#define atomic24_set(v, i)        (((v)->counter) = i) - -#else -/* We do the bulk of the actual work out of line in two common - * routines in assembler, see arch/sparc/lib/atomic.S for the - * "fun" details. - * - * For SMP the trick is you embed the spin lock byte within - * the word, use the low byte so signedness is easily retained - * via a quick arithmetic shift.  It looks like this: - * - *	---------------------------------------- - *	| signed 24-bit counter value |  lock  |  atomic_t - *	---------------------------------------- - *	 31                          8 7      0 - */ - -#define ATOMIC24_INIT(i)	{ ((i) << 8) } - -static inline int atomic24_read(const atomic24_t *v) -{ -	int ret = v->counter; - -	while(ret & 0xff) -		ret = v->counter; - -	return ret >> 8; -} - -#define atomic24_set(v, i)	(((v)->counter) = ((i) << 8)) -#endif - -static inline int __atomic24_add(int i, atomic24_t *v) -{ -	register volatile int *ptr asm("g1"); -	register int increment asm("g2"); -	register int tmp1 asm("g3"); -	register int tmp2 asm("g4"); -	register int tmp3 asm("g7"); - -	ptr = &v->counter; -	increment = i; - -	__asm__ __volatile__( -	"mov	%%o7, %%g4\n\t" -	"call	___atomic24_add\n\t" -	" add	%%o7, 8, %%o7\n" -	: "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3) -	: "0" (increment), "r" (ptr) -	: "memory", "cc"); - -	return increment; -} - -static inline int __atomic24_sub(int i, atomic24_t *v) -{ -	register volatile int *ptr asm("g1"); -	register int increment asm("g2"); -	register int tmp1 asm("g3"); -	register int tmp2 asm("g4"); -	register int tmp3 asm("g7"); - -	ptr = &v->counter; -	increment = i; - -	__asm__ __volatile__( -	"mov	%%o7, %%g4\n\t" -	"call	___atomic24_sub\n\t" -	" add	%%o7, 8, %%o7\n" -	: "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3) -	: "0" (increment), "r" (ptr) -	: "memory", "cc"); - -	return increment; -} - -#define atomic24_add(i, v) ((void)__atomic24_add((i), (v))) -#define atomic24_sub(i, v) ((void)__atomic24_sub((i), (v))) - -#define atomic24_dec_return(v) __atomic24_sub(1, (v)) -#define atomic24_inc_return(v) __atomic24_add(1, (v)) - -#define atomic24_sub_and_test(i, v) (__atomic24_sub((i), (v)) == 0) -#define atomic24_dec_and_test(v) (__atomic24_sub(1, (v)) == 0) - -#define atomic24_inc(v) ((void)__atomic24_add(1, (v))) -#define atomic24_dec(v) ((void)__atomic24_sub(1, (v))) - -#define atomic24_add_negative(i, v) (__atomic24_add((i), (v)) < 0) - -/* Atomic operations are already serializing */ -#define smp_mb__before_atomic_dec()	barrier() -#define smp_mb__after_atomic_dec()	barrier() -#define smp_mb__before_atomic_inc()	barrier() -#define smp_mb__after_atomic_inc()	barrier() - -#endif /* !(__KERNEL__) */ - -#include <asm-generic/atomic-long.h>  #endif /* !(__ARCH_SPARC_ATOMIC__) */ diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index bdb2ff880bd..bb894c8bec5 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h @@ -1,14 +1,15 @@  /* atomic.h: Thankfully the V9 is at least reasonable for this   *           stuff.   * - * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com) + * Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)   */  #ifndef __ARCH_SPARC64_ATOMIC__  #define __ARCH_SPARC64_ATOMIC__  #include <linux/types.h> -#include <asm/system.h> +#include <asm/cmpxchg.h> +#include <asm/barrier.h>  #define ATOMIC_INIT(i)		{ (i) }  #define ATOMIC64_INIT(i)	{ (i) } @@ -19,15 +20,15 @@  #define atomic_set(v, i)	(((v)->counter) = i)  #define atomic64_set(v, i)	(((v)->counter) = i) -extern void atomic_add(int, atomic_t *); -extern void atomic64_add(long, atomic64_t *); -extern void atomic_sub(int, atomic_t *); -extern void atomic64_sub(long, atomic64_t *); +void atomic_add(int, atomic_t *); +void atomic64_add(long, atomic64_t *); +void atomic_sub(int, atomic_t *); +void atomic64_sub(long, atomic64_t *); -extern int atomic_add_ret(int, atomic_t *); -extern long atomic64_add_ret(long, atomic64_t *); -extern int atomic_sub_ret(int, atomic_t *); -extern long atomic64_sub_ret(long, atomic64_t *); +int atomic_add_ret(int, atomic_t *); +long atomic64_add_ret(long, atomic64_t *); +int atomic_sub_ret(int, atomic_t *); +long atomic64_sub_ret(long, atomic64_t *);  #define atomic_dec_return(v) atomic_sub_ret(1, v)  #define atomic64_dec_return(v) atomic64_sub_ret(1, v) @@ -70,7 +71,7 @@ extern long atomic64_sub_ret(long, atomic64_t *);  #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))  #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) -static inline int atomic_add_unless(atomic_t *v, int a, int u) +static inline int __atomic_add_unless(atomic_t *v, int a, int u)  {  	int c, old;  	c = atomic_read(v); @@ -82,11 +83,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)  			break;  		c = old;  	} -	return c != (u); +	return c;  } -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) -  #define atomic64_cmpxchg(v, o, n) \  	((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))  #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) @@ -108,11 +107,6 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)  #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) -/* Atomic operations are already serializing */ -#define smp_mb__before_atomic_dec()	barrier() -#define smp_mb__after_atomic_dec()	barrier() -#define smp_mb__before_atomic_inc()	barrier() -#define smp_mb__after_atomic_inc()	barrier() +long atomic64_dec_if_positive(atomic64_t *v); -#include <asm-generic/atomic-long.h>  #endif /* !(__ARCH_SPARC64_ATOMIC__) */ diff --git a/arch/sparc/include/asm/auxio.h b/arch/sparc/include/asm/auxio.h index 13dc67f0301..3e09a07b77e 100644 --- a/arch/sparc/include/asm/auxio.h +++ b/arch/sparc/include/asm/auxio.h @@ -1,5 +1,12 @@  #ifndef ___ASM_SPARC_AUXIO_H  #define ___ASM_SPARC_AUXIO_H + +#ifndef __ASSEMBLY__ + +extern void __iomem *auxio_register; + +#endif /* ifndef __ASSEMBLY__ */ +  #if defined(__sparc__) && defined(__arch64__)  #include <asm/auxio_64.h>  #else diff --git a/arch/sparc/include/asm/auxio_32.h b/arch/sparc/include/asm/auxio_32.h index e03e088be95..5d685df427b 100644 --- a/arch/sparc/include/asm/auxio_32.h +++ b/arch/sparc/include/asm/auxio_32.h @@ -6,7 +6,6 @@  #ifndef _SPARC_AUXIO_H  #define _SPARC_AUXIO_H -#include <asm/system.h>  #include <asm/vaddrs.h>  /* This register is an unsigned char in IO space.  It does two things. @@ -35,8 +34,8 @@   * NOTE: these routines are implementation dependent--   * understand the hardware you are querying!   */ -extern void set_auxio(unsigned char bits_on, unsigned char bits_off); -extern unsigned char get_auxio(void); /* .../asm/floppy.h */ +void set_auxio(unsigned char bits_on, unsigned char bits_off); +unsigned char get_auxio(void); /* .../asm/floppy.h */  /*   * The following routines are provided for driver-compatibility @@ -79,7 +78,7 @@ do { \  /* AUXIO2 (Power Off Control) */ -extern __volatile__ unsigned char * auxio_power_register; +extern volatile u8 __iomem *auxio_power_register;  #define	AUXIO_POWER_DETECT_FAILURE	32  #define	AUXIO_POWER_CLEAR_FAILURE	2 diff --git a/arch/sparc/include/asm/auxio_64.h b/arch/sparc/include/asm/auxio_64.h index f61cd1e3e39..6079e59a7ad 100644 --- a/arch/sparc/include/asm/auxio_64.h +++ b/arch/sparc/include/asm/auxio_64.h @@ -75,8 +75,6 @@  #ifndef __ASSEMBLY__ -extern void __iomem *auxio_register; -  #define AUXIO_LTE_ON	1  #define AUXIO_LTE_OFF	0 @@ -84,7 +82,7 @@ extern void __iomem *auxio_register;   *   * on - AUXIO_LTE_ON or AUXIO_LTE_OFF   */ -extern void auxio_set_lte(int on); +void auxio_set_lte(int on);  #define AUXIO_LED_ON	1  #define AUXIO_LED_OFF	0 @@ -93,7 +91,7 @@ extern void auxio_set_lte(int on);   *   * on - AUXIO_LED_ON or AUXIO_LED_OFF   */ -extern void auxio_set_led(int on); +void auxio_set_led(int on);  #endif /* ifndef __ASSEMBLY__ */ diff --git a/arch/sparc/include/asm/auxvec.h b/arch/sparc/include/asm/auxvec.h deleted file mode 100644 index ad6f360261f..00000000000 --- a/arch/sparc/include/asm/auxvec.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __ASMSPARC_AUXVEC_H -#define __ASMSPARC_AUXVEC_H - -#endif /* !(__ASMSPARC_AUXVEC_H) */ diff --git a/arch/sparc/include/asm/backoff.h b/arch/sparc/include/asm/backoff.h index db3af0d30fb..4e02086b839 100644 --- a/arch/sparc/include/asm/backoff.h +++ b/arch/sparc/include/asm/backoff.h @@ -1,6 +1,46 @@  #ifndef _SPARC64_BACKOFF_H  #define _SPARC64_BACKOFF_H +/* The macros in this file implement an exponential backoff facility + * for atomic operations. + * + * When multiple threads compete on an atomic operation, it is + * possible for one thread to be continually denied a successful + * completion of the compare-and-swap instruction.  Heavily + * threaded cpu implementations like Niagara can compound this + * problem even further. + * + * When an atomic operation fails and needs to be retried, we spin a + * certain number of times.  At each subsequent failure of the same + * operation we double the spin count, realizing an exponential + * backoff. + * + * When we spin, we try to use an operation that will cause the + * current cpu strand to block, and therefore make the core fully + * available to any other other runnable strands.  There are two + * options, based upon cpu capabilities. + * + * On all cpus prior to SPARC-T4 we do three dummy reads of the + * condition code register.  Each read blocks the strand for something + * between 40 and 50 cpu cycles. + * + * For SPARC-T4 and later we have a special "pause" instruction + * available.  This is implemented using writes to register %asr27. + * The cpu will block the number of cycles written into the register, + * unless a disrupting trap happens first.  SPARC-T4 specifically + * implements pause with a granularity of 8 cycles.  Each strand has + * an internal pause counter which decrements every 8 cycles.  So the + * chip shifts the %asr27 value down by 3 bits, and writes the result + * into the pause counter.  If a value smaller than 8 is written, the + * chip blocks for 1 cycle. + * + * To achieve the same amount of backoff as the three %ccr reads give + * on earlier chips, we shift the backoff value up by 7 bits.  (Three + * %ccr reads block for about 128 cycles, 1 << 7 == 128) We write the + * whole amount we want to block into the pause register, rather than + * loop writing 128 each time. + */ +  #define BACKOFF_LIMIT	(4 * 1024)  #ifdef CONFIG_SMP @@ -11,16 +51,25 @@  #define BACKOFF_LABEL(spin_label, continue_label) \  	spin_label -#define BACKOFF_SPIN(reg, tmp, label)	\ -	mov	reg, tmp; \ -88:	brnz,pt	tmp, 88b; \ -	 sub	tmp, 1, tmp; \ -	set	BACKOFF_LIMIT, tmp; \ -	cmp	reg, tmp; \ -	bg,pn	%xcc, label; \ -	 nop; \ -	ba,pt	%xcc, label; \ -	 sllx	reg, 1, reg; +#define BACKOFF_SPIN(reg, tmp, label)		\ +	mov		reg, tmp;		\ +88:	rd		%ccr, %g0;		\ +	rd		%ccr, %g0;		\ +	rd		%ccr, %g0;		\ +	.section	.pause_3insn_patch,"ax";\ +	.word		88b;			\ +	sllx		tmp, 7, tmp;		\ +	wr		tmp, 0, %asr27;		\ +	clr		tmp;			\ +	.previous;				\ +	brnz,pt		tmp, 88b;		\ +	 sub		tmp, 1, tmp;		\ +	set		BACKOFF_LIMIT, tmp;	\ +	cmp		reg, tmp;		\ +	bg,pn		%xcc, label;		\ +	 nop;					\ +	ba,pt		%xcc, label;		\ +	 sllx		reg, 1, reg;  #else diff --git a/arch/sparc/include/asm/barrier.h b/arch/sparc/include/asm/barrier.h new file mode 100644 index 00000000000..b25f02a029e --- /dev/null +++ b/arch/sparc/include/asm/barrier.h @@ -0,0 +1,8 @@ +#ifndef ___ASM_SPARC_BARRIER_H +#define ___ASM_SPARC_BARRIER_H +#if defined(__sparc__) && defined(__arch64__) +#include <asm/barrier_64.h> +#else +#include <asm/barrier_32.h> +#endif +#endif diff --git a/arch/sparc/include/asm/barrier_32.h b/arch/sparc/include/asm/barrier_32.h new file mode 100644 index 00000000000..ae69eda288f --- /dev/null +++ b/arch/sparc/include/asm/barrier_32.h @@ -0,0 +1,7 @@ +#ifndef __SPARC_BARRIER_H +#define __SPARC_BARRIER_H + +#include <asm/processor.h> /* for nop() */ +#include <asm-generic/barrier.h> + +#endif /* !(__SPARC_BARRIER_H) */ diff --git a/arch/sparc/include/asm/barrier_64.h b/arch/sparc/include/asm/barrier_64.h new file mode 100644 index 00000000000..305dcc3dc72 --- /dev/null +++ b/arch/sparc/include/asm/barrier_64.h @@ -0,0 +1,74 @@ +#ifndef __SPARC64_BARRIER_H +#define __SPARC64_BARRIER_H + +/* These are here in an effort to more fully work around Spitfire Errata + * #51.  Essentially, if a memory barrier occurs soon after a mispredicted + * branch, the chip can stop executing instructions until a trap occurs. + * Therefore, if interrupts are disabled, the chip can hang forever. + * + * It used to be believed that the memory barrier had to be right in the + * delay slot, but a case has been traced recently wherein the memory barrier + * was one instruction after the branch delay slot and the chip still hung. + * The offending sequence was the following in sym_wakeup_done() of the + * sym53c8xx_2 driver: + * + *	call	sym_ccb_from_dsa, 0 + *	 movge	%icc, 0, %l0 + *	brz,pn	%o0, .LL1303 + *	 mov	%o0, %l2 + *	membar	#LoadLoad + * + * The branch has to be mispredicted for the bug to occur.  Therefore, we put + * the memory barrier explicitly into a "branch always, predicted taken" + * delay slot to avoid the problem case. + */ +#define membar_safe(type) \ +do {	__asm__ __volatile__("ba,pt	%%xcc, 1f\n\t" \ +			     " membar	" type "\n" \ +			     "1:\n" \ +			     : : : "memory"); \ +} while (0) + +/* The kernel always executes in TSO memory model these days, + * and furthermore most sparc64 chips implement more stringent + * memory ordering than required by the specifications. + */ +#define mb()	membar_safe("#StoreLoad") +#define rmb()	__asm__ __volatile__("":::"memory") +#define wmb()	__asm__ __volatile__("":::"memory") + +#define read_barrier_depends()		do { } while(0) +#define set_mb(__var, __value) \ +	do { __var = __value; membar_safe("#StoreLoad"); } while(0) + +#ifdef CONFIG_SMP +#define smp_mb()	mb() +#define smp_rmb()	rmb() +#define smp_wmb()	wmb() +#else +#define smp_mb()	__asm__ __volatile__("":::"memory") +#define smp_rmb()	__asm__ __volatile__("":::"memory") +#define smp_wmb()	__asm__ __volatile__("":::"memory") +#endif + +#define smp_read_barrier_depends()	do { } while(0) + +#define smp_store_release(p, v)						\ +do {									\ +	compiletime_assert_atomic_type(*p);				\ +	barrier();							\ +	ACCESS_ONCE(*p) = (v);						\ +} while (0) + +#define smp_load_acquire(p)						\ +({									\ +	typeof(*p) ___p1 = ACCESS_ONCE(*p);				\ +	compiletime_assert_atomic_type(*p);				\ +	barrier();							\ +	___p1;								\ +}) + +#define smp_mb__before_atomic()	barrier() +#define smp_mb__after_atomic()	barrier() + +#endif /* !(__SPARC64_BARRIER_H) */ diff --git a/arch/sparc/include/asm/bitext.h b/arch/sparc/include/asm/bitext.h index 297b2f2fcb4..9c988bf3adb 100644 --- a/arch/sparc/include/asm/bitext.h +++ b/arch/sparc/include/asm/bitext.h @@ -20,8 +20,8 @@ struct bit_map {  	int num_colors;  }; -extern int bit_map_string_get(struct bit_map *t, int len, int align); -extern void bit_map_clear(struct bit_map *t, int offset, int len); -extern void bit_map_init(struct bit_map *t, unsigned long *map, int size); +int bit_map_string_get(struct bit_map *t, int len, int align); +void bit_map_clear(struct bit_map *t, int offset, int len); +void bit_map_init(struct bit_map *t, unsigned long *map, int size);  #endif /* defined(_SPARC_BITEXT_H) */ diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h index 9cf4ae0cd7b..600ed1d9c8c 100644 --- a/arch/sparc/include/asm/bitops_32.h +++ b/arch/sparc/include/asm/bitops_32.h @@ -18,9 +18,9 @@  #error only <linux/bitops.h> can be included directly  #endif -extern unsigned long ___set_bit(unsigned long *addr, unsigned long mask); -extern unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); -extern unsigned long ___change_bit(unsigned long *addr, unsigned long mask); +unsigned long ___set_bit(unsigned long *addr, unsigned long mask); +unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); +unsigned long ___change_bit(unsigned long *addr, unsigned long mask);  /*   * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' @@ -90,9 +90,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)  #include <asm-generic/bitops/non-atomic.h> -#define smp_mb__before_clear_bit()	do { } while(0) -#define smp_mb__after_clear_bit()	do { } while(0) -  #include <asm-generic/bitops/ffz.h>  #include <asm-generic/bitops/__ffs.h>  #include <asm-generic/bitops/sched.h> @@ -103,9 +100,8 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)  #include <asm-generic/bitops/hweight.h>  #include <asm-generic/bitops/lock.h>  #include <asm-generic/bitops/find.h> -#include <asm-generic/bitops/ext2-non-atomic.h> +#include <asm-generic/bitops/le.h>  #include <asm-generic/bitops/ext2-atomic.h> -#include <asm-generic/bitops/minix.h>  #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index 766121a67a2..2d522402a93 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h @@ -13,74 +13,39 @@  #include <linux/compiler.h>  #include <asm/byteorder.h> +#include <asm/barrier.h> -extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); -extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); -extern int test_and_change_bit(unsigned long nr, volatile unsigned long *addr); -extern void set_bit(unsigned long nr, volatile unsigned long *addr); -extern void clear_bit(unsigned long nr, volatile unsigned long *addr); -extern void change_bit(unsigned long nr, volatile unsigned long *addr); +int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); +int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); +int test_and_change_bit(unsigned long nr, volatile unsigned long *addr); +void set_bit(unsigned long nr, volatile unsigned long *addr); +void clear_bit(unsigned long nr, volatile unsigned long *addr); +void change_bit(unsigned long nr, volatile unsigned long *addr);  #include <asm-generic/bitops/non-atomic.h> -#define smp_mb__before_clear_bit()	barrier() -#define smp_mb__after_clear_bit()	barrier() - -#include <asm-generic/bitops/ffz.h> -#include <asm-generic/bitops/__ffs.h>  #include <asm-generic/bitops/fls.h>  #include <asm-generic/bitops/__fls.h>  #include <asm-generic/bitops/fls64.h>  #ifdef __KERNEL__ +int ffs(int x); +unsigned long __ffs(unsigned long); + +#include <asm-generic/bitops/ffz.h>  #include <asm-generic/bitops/sched.h> -#include <asm-generic/bitops/ffs.h>  /*   * hweightN: returns the hamming weight (i.e. the number   * of bits set) of a N-bit word   */ -#ifdef ULTRA_HAS_POPULATION_COUNT - -static inline unsigned int __arch_hweight64(unsigned long w) -{ -	unsigned int res; - -	__asm__ ("popc %1,%0" : "=r" (res) : "r" (w)); -	return res; -} - -static inline unsigned int __arch_hweight32(unsigned int w) -{ -	unsigned int res; - -	__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff)); -	return res; -} +unsigned long __arch_hweight64(__u64 w); +unsigned int __arch_hweight32(unsigned int w); +unsigned int __arch_hweight16(unsigned int w); +unsigned int __arch_hweight8(unsigned int w); -static inline unsigned int __arch_hweight16(unsigned int w) -{ -	unsigned int res; - -	__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff)); -	return res; -} - -static inline unsigned int __arch_hweight8(unsigned int w) -{ -	unsigned int res; - -	__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff)); -	return res; -} - -#else - -#include <asm-generic/bitops/arch_hweight.h> - -#endif  #include <asm-generic/bitops/const_hweight.h>  #include <asm-generic/bitops/lock.h>  #endif /* __KERNEL__ */ @@ -89,14 +54,9 @@ static inline unsigned int __arch_hweight8(unsigned int w)  #ifdef __KERNEL__ -#include <asm-generic/bitops/ext2-non-atomic.h> - -#define ext2_set_bit_atomic(lock,nr,addr) \ -	test_and_set_bit((nr) ^ 0x38,(unsigned long *)(addr)) -#define ext2_clear_bit_atomic(lock,nr,addr) \ -	test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr)) +#include <asm-generic/bitops/le.h> -#include <asm-generic/bitops/minix.h> +#include <asm-generic/bitops/ext2-atomic-setbit.h>  #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/bitsperlong.h b/arch/sparc/include/asm/bitsperlong.h deleted file mode 100644 index 40dcaa3aaa5..00000000000 --- a/arch/sparc/include/asm/bitsperlong.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __ASM_ALPHA_BITSPERLONG_H -#define __ASM_ALPHA_BITSPERLONG_H - -#if defined(__sparc__) && defined(__arch64__) -#define __BITS_PER_LONG 64 -#else -#define __BITS_PER_LONG 32 -#endif - -#include <asm-generic/bitsperlong.h> - -#endif /* __ASM_ALPHA_BITSPERLONG_H */ - diff --git a/arch/sparc/include/asm/btext.h b/arch/sparc/include/asm/btext.h index 9b2bc6b6ed0..75a32b109e1 100644 --- a/arch/sparc/include/asm/btext.h +++ b/arch/sparc/include/asm/btext.h @@ -1,6 +1,6 @@  #ifndef _SPARC_BTEXT_H  #define _SPARC_BTEXT_H -extern int btext_find_display(void); +int btext_find_display(void);  #endif /* _SPARC_BTEXT_H */ diff --git a/arch/sparc/include/asm/btfixup.h b/arch/sparc/include/asm/btfixup.h deleted file mode 100644 index 797722cf69f..00000000000 --- a/arch/sparc/include/asm/btfixup.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - *  asm/btfixup.h:    Macros for boot time linking. - * - *  Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ -  -#ifndef _SPARC_BTFIXUP_H -#define _SPARC_BTFIXUP_H - -#include <linux/init.h> - -#ifndef __ASSEMBLY__ - -#ifdef MODULE -extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void); -extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void); -extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void); -extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); - -#define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module() -#define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module() -#define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module() -#define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module() -#define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module - -#else - -#define BTFIXUP_SIMM13(__name) ___sf_##__name() -#define BTFIXUP_HALF(__name) ___af_##__name() -#define BTFIXUP_SETHI(__name) ___hf_##__name() -#define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name) -/* This must be written in assembly and present in a sethi */ -#define BTFIXUP_BLACKBOX(__name) ___b_##__name -#endif /* MODULE */ - -/* Fixup call xx */ - -#define BTFIXUPDEF_CALL(__type, __name, __args...) 					\ -	extern __type ___f_##__name(__args);						\ -	extern unsigned ___fs_##__name[3]; -#define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) 				\ -	extern __type ___f_##__name(__args) __attribute_const__;			\ -	extern unsigned ___fs_##__name[3]; -#define BTFIXUP_CALL(__name) ___f_##__name - -#define BTFIXUPDEF_BLACKBOX(__name)							\ -	extern unsigned ___bs_##__name[2]; - -/* Put bottom 13bits into some register variable */ - -#define BTFIXUPDEF_SIMM13(__name)							\ -	static inline unsigned int ___sf_##__name(void) __attribute_const__;		\ -	extern unsigned ___ss_##__name[2];						\ -	static inline unsigned int ___sf_##__name(void) {				\ -		unsigned int ret;							\ -		__asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret));			\ -		return ret;								\ -	} -#define BTFIXUPDEF_SIMM13_INIT(__name,__val)						\ -	static inline unsigned int ___sf_##__name(void) __attribute_const__;		\ -	extern unsigned ___ss_##__name[2];						\ -	static inline unsigned int ___sf_##__name(void) {				\ -		unsigned int ret;							\ -		__asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ -		return ret;								\ -	} - -/* Put either bottom 13 bits, or upper 22 bits into some register variable - * (depending on the value, this will lead into sethi FIX, reg; or - * mov FIX, reg; ) - */ - -#define BTFIXUPDEF_HALF(__name)								\ -	static inline unsigned int ___af_##__name(void) __attribute_const__;		\ -	extern unsigned ___as_##__name[2];						\ -	static inline unsigned int ___af_##__name(void) {				\ -		unsigned int ret;							\ -		__asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret));			\ -		return ret;								\ -	} -#define BTFIXUPDEF_HALF_INIT(__name,__val)						\ -	static inline unsigned int ___af_##__name(void) __attribute_const__;		\ -	extern unsigned ___as_##__name[2];						\ -	static inline unsigned int ___af_##__name(void) {				\ -		unsigned int ret;							\ -		__asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ -		return ret;								\ -	} - -/* Put upper 22 bits into some register variable */ - -#define BTFIXUPDEF_SETHI(__name)							\ -	static inline unsigned int ___hf_##__name(void) __attribute_const__;		\ -	extern unsigned ___hs_##__name[2];						\ -	static inline unsigned int ___hf_##__name(void) {				\ -		unsigned int ret;							\ -		__asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret));		\ -		return ret;								\ -	} -#define BTFIXUPDEF_SETHI_INIT(__name,__val)						\ -	static inline unsigned int ___hf_##__name(void) __attribute_const__;		\ -	extern unsigned ___hs_##__name[2];						\ -	static inline unsigned int ___hf_##__name(void) {				\ -		unsigned int ret;							\ -		__asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : 	\ -			 "=r"(ret));							\ -		return ret;								\ -	} - -/* Put a full 32bit integer into some register variable */ - -#define BTFIXUPDEF_INT(__name)								\ -	extern unsigned char ___i_##__name;						\ -	extern unsigned ___is_##__name[2]; - -#define BTFIXUPCALL_NORM	0x00000000			/* Always call */ -#define BTFIXUPCALL_NOP		0x01000000			/* Possibly optimize to nop */ -#define BTFIXUPCALL_RETINT(i)	(0x90102000|((i) & 0x1fff))	/* Possibly optimize to mov i, %o0 */ -#define BTFIXUPCALL_ORINT(i)	(0x90122000|((i) & 0x1fff))	/* Possibly optimize to or %o0, i, %o0 */ -#define BTFIXUPCALL_RETO0	0x01000000			/* Return first parameter, actually a nop */ -#define BTFIXUPCALL_ANDNINT(i)	(0x902a2000|((i) & 0x1fff))	/* Possibly optimize to andn %o0, i, %o0 */ -#define BTFIXUPCALL_SWAPO0O1	0xd27a0000			/* Possibly optimize to swap [%o0],%o1 */ -#define BTFIXUPCALL_SWAPO0G0	0xc07a0000			/* Possibly optimize to swap [%o0],%g0 */ -#define BTFIXUPCALL_SWAPG1G2	0xc4784000			/* Possibly optimize to swap [%g1],%g2 */ -#define BTFIXUPCALL_STG0O0	0xc0220000			/* Possibly optimize to st %g0,[%o0] */ -#define BTFIXUPCALL_STO1O0	0xd2220000			/* Possibly optimize to st %o1,[%o0] */ - -#define BTFIXUPSET_CALL(__name, __addr, __insn)						\ -	do {										\ -		___fs_##__name[0] |= 1;							\ -		___fs_##__name[1] = (unsigned long)__addr;				\ -		___fs_##__name[2] = __insn;						\ -	} while (0) -	 -#define BTFIXUPSET_BLACKBOX(__name, __func)						\ -	do {										\ -		___bs_##__name[0] |= 1;							\ -		___bs_##__name[1] = (unsigned long)__func;				\ -	} while (0) -	 -#define BTFIXUPCOPY_CALL(__name, __from)						\ -	do {										\ -		___fs_##__name[0] |= 1;							\ -		___fs_##__name[1] = ___fs_##__from[1];					\ -		___fs_##__name[2] = ___fs_##__from[2];					\ -	} while (0) -		 -#define BTFIXUPSET_SIMM13(__name, __val)						\ -	do {										\ -		___ss_##__name[0] |= 1;							\ -		___ss_##__name[1] = (unsigned)__val;					\ -	} while (0) -	 -#define BTFIXUPCOPY_SIMM13(__name, __from)						\ -	do {										\ -		___ss_##__name[0] |= 1;							\ -		___ss_##__name[1] = ___ss_##__from[1];					\ -	} while (0) -		 -#define BTFIXUPSET_HALF(__name, __val)							\ -	do {										\ -		___as_##__name[0] |= 1;							\ -		___as_##__name[1] = (unsigned)__val;					\ -	} while (0) -	 -#define BTFIXUPCOPY_HALF(__name, __from)						\ -	do {										\ -		___as_##__name[0] |= 1;							\ -		___as_##__name[1] = ___as_##__from[1];					\ -	} while (0) -		 -#define BTFIXUPSET_SETHI(__name, __val)							\ -	do {										\ -		___hs_##__name[0] |= 1;							\ -		___hs_##__name[1] = (unsigned)__val;					\ -	} while (0) -	 -#define BTFIXUPCOPY_SETHI(__name, __from)						\ -	do {										\ -		___hs_##__name[0] |= 1;							\ -		___hs_##__name[1] = ___hs_##__from[1];					\ -	} while (0) -		 -#define BTFIXUPSET_INT(__name, __val)							\ -	do {										\ -		___is_##__name[0] |= 1;							\ -		___is_##__name[1] = (unsigned)__val;					\ -	} while (0) -	 -#define BTFIXUPCOPY_INT(__name, __from)							\ -	do {										\ -		___is_##__name[0] |= 1;							\ -		___is_##__name[1] = ___is_##__from[1];					\ -	} while (0) -	 -#define BTFIXUPVAL_CALL(__name)								\ -	((unsigned long)___fs_##__name[1]) -	 -extern void btfixup(void); - -#else /* __ASSEMBLY__ */ - -#define BTFIXUP_SETHI(__name)			%hi(___h_ ## __name) -#define BTFIXUP_SETHI_INIT(__name,__val)	%hi(___h_ ## __name ## __btset_ ## __val) - -#endif /* __ASSEMBLY__ */ -	 -#endif /* !(_SPARC_BTFIXUP_H) */ diff --git a/arch/sparc/include/asm/bug.h b/arch/sparc/include/asm/bug.h index 8a59e5a8c21..eaa8f8d3812 100644 --- a/arch/sparc/include/asm/bug.h +++ b/arch/sparc/include/asm/bug.h @@ -5,7 +5,7 @@  #include <linux/compiler.h>  #ifdef CONFIG_DEBUG_BUGVERBOSE -extern void do_BUG(const char *file, int line); +void do_BUG(const char *file, int line);  #define BUG() do {					\  	do_BUG(__FILE__, __LINE__);			\  	__builtin_trap();				\ @@ -19,4 +19,7 @@ extern void do_BUG(const char *file, int line);  #include <asm-generic/bug.h> +struct pt_regs; +void __noreturn die_if_kernel(char *str, struct pt_regs *regs); +  #endif diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h deleted file mode 100644 index ccc1b6b7de6..00000000000 --- a/arch/sparc/include/asm/byteorder.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SPARC_BYTEORDER_H -#define _SPARC_BYTEORDER_H - -#include <linux/byteorder/big_endian.h> - -#endif /* _SPARC_BYTEORDER_H */ diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h index 69358b590c9..5bb6991b485 100644 --- a/arch/sparc/include/asm/cache.h +++ b/arch/sparc/include/asm/cache.h @@ -22,118 +22,4 @@  #define __read_mostly __attribute__((__section__(".data..read_mostly"))) -#ifdef CONFIG_SPARC32 -#include <asm/asi.h> - -/* Direct access to the instruction cache is provided through and - * alternate address space.  The IDC bit must be off in the ICCR on - * HyperSparcs for these accesses to work.  The code below does not do - * any checking, the caller must do so.  These routines are for - * diagnostics only, but could end up being useful.  Use with care. - * Also, you are asking for trouble if you execute these in one of the - * three instructions following a %asr/%psr access or modification. - */ - -/* First, cache-tag access. */ -static inline unsigned int get_icache_tag(int setnum, int tagnum) -{ -	unsigned int vaddr, retval; - -	vaddr = ((setnum&1) << 12) | ((tagnum&0x7f) << 5); -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (retval) : -			     "r" (vaddr), "i" (ASI_M_TXTC_TAG)); -	return retval; -} - -static inline void put_icache_tag(int setnum, int tagnum, unsigned int entry) -{ -	unsigned int vaddr; - -	vaddr = ((setnum&1) << 12) | ((tagnum&0x7f) << 5); -	__asm__ __volatile__("sta %0, [%1] %2\n\t" : : -			     "r" (entry), "r" (vaddr), "i" (ASI_M_TXTC_TAG) : -			     "memory"); -} - -/* Second cache-data access.  The data is returned two-32bit quantities - * at a time. - */ -static inline void get_icache_data(int setnum, int tagnum, int subblock, -				       unsigned int *data) -{ -	unsigned int value1, value2, vaddr; - -	vaddr = ((setnum&0x1) << 12) | ((tagnum&0x7f) << 5) | -		((subblock&0x3) << 3); -	__asm__ __volatile__("ldda [%2] %3, %%g2\n\t" -			     "or %%g0, %%g2, %0\n\t" -			     "or %%g0, %%g3, %1\n\t" : -			     "=r" (value1), "=r" (value2) : -			     "r" (vaddr), "i" (ASI_M_TXTC_DATA) : -			     "g2", "g3"); -	data[0] = value1; data[1] = value2; -} - -static inline void put_icache_data(int setnum, int tagnum, int subblock, -				       unsigned int *data) -{ -	unsigned int value1, value2, vaddr; - -	vaddr = ((setnum&0x1) << 12) | ((tagnum&0x7f) << 5) | -		((subblock&0x3) << 3); -	value1 = data[0]; value2 = data[1]; -	__asm__ __volatile__("or %%g0, %0, %%g2\n\t" -			     "or %%g0, %1, %%g3\n\t" -			     "stda %%g2, [%2] %3\n\t" : : -			     "r" (value1), "r" (value2),  -			     "r" (vaddr), "i" (ASI_M_TXTC_DATA) : -			     "g2", "g3", "memory" /* no joke */); -} - -/* Different types of flushes with the ICACHE.  Some of the flushes - * affect both the ICACHE and the external cache.  Others only clear - * the ICACHE entries on the cpu itself.  V8's (most) allow - * granularity of flushes on the packet (element in line), whole line, - * and entire cache (ie. all lines) level.  The ICACHE only flushes are - * ROSS HyperSparc specific and are in ross.h - */ - -/* Flushes which clear out both the on-chip and external caches */ -static inline void flush_ei_page(unsigned int addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_PAGE) : -			     "memory"); -} - -static inline void flush_ei_seg(unsigned int addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_SEG) : -			     "memory"); -} - -static inline void flush_ei_region(unsigned int addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_REGION) : -			     "memory"); -} - -static inline void flush_ei_ctx(unsigned int addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_CTX) : -			     "memory"); -} - -static inline void flush_ei_user(unsigned int addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_USER) : -			     "memory"); -} -#endif /* CONFIG_SPARC32 */ -  #endif /* !(_SPARC_CACHE_H) */ diff --git a/arch/sparc/include/asm/cacheflush.h b/arch/sparc/include/asm/cacheflush.h index 049168087b1..f6c4839b838 100644 --- a/arch/sparc/include/asm/cacheflush.h +++ b/arch/sparc/include/asm/cacheflush.h @@ -1,5 +1,9 @@  #ifndef ___ASM_SPARC_CACHEFLUSH_H  #define ___ASM_SPARC_CACHEFLUSH_H + +/* flush addr - to allow use of self-modifying code */ +#define flushi(addr)	__asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") +  #if defined(__sparc__) && defined(__arch64__)  #include <asm/cacheflush_64.h>  #else diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h index 2e468773f25..12164006181 100644 --- a/arch/sparc/include/asm/cacheflush_32.h +++ b/arch/sparc/include/asm/cacheflush_32.h @@ -1,56 +1,18 @@  #ifndef _SPARC_CACHEFLUSH_H  #define _SPARC_CACHEFLUSH_H -#include <linux/mm.h>		/* Common for other includes */ -// #include <linux/kernel.h> from pgalloc.h -// #include <linux/sched.h>  from pgalloc.h - -// #include <asm/page.h> -#include <asm/btfixup.h> - -/* - * Fine grained cache flushing. - */ -#ifdef CONFIG_SMP - -BTFIXUPDEF_CALL(void, local_flush_cache_all, void) -BTFIXUPDEF_CALL(void, local_flush_cache_mm, struct mm_struct *) -BTFIXUPDEF_CALL(void, local_flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long) -BTFIXUPDEF_CALL(void, local_flush_cache_page, struct vm_area_struct *, unsigned long) - -#define local_flush_cache_all() BTFIXUP_CALL(local_flush_cache_all)() -#define local_flush_cache_mm(mm) BTFIXUP_CALL(local_flush_cache_mm)(mm) -#define local_flush_cache_range(vma,start,end) BTFIXUP_CALL(local_flush_cache_range)(vma,start,end) -#define local_flush_cache_page(vma,addr) BTFIXUP_CALL(local_flush_cache_page)(vma,addr) - -BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long) -BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long) - -#define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr) -#define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr) - -extern void smp_flush_cache_all(void); -extern void smp_flush_cache_mm(struct mm_struct *mm); -extern void smp_flush_cache_range(struct vm_area_struct *vma, -				  unsigned long start, -				  unsigned long end); -extern void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page); - -extern void smp_flush_page_to_ram(unsigned long page); -extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr); - -#endif /* CONFIG_SMP */ - -BTFIXUPDEF_CALL(void, flush_cache_all, void) -BTFIXUPDEF_CALL(void, flush_cache_mm, struct mm_struct *) -BTFIXUPDEF_CALL(void, flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long) -BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long) - -#define flush_cache_all() BTFIXUP_CALL(flush_cache_all)() -#define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm) -#define flush_cache_dup_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm) -#define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end) -#define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr) +#include <asm/cachetlb_32.h> + +#define flush_cache_all() \ +	sparc32_cachetlb_ops->cache_all() +#define flush_cache_mm(mm) \ +	sparc32_cachetlb_ops->cache_mm(mm) +#define flush_cache_dup_mm(mm) \ +	sparc32_cachetlb_ops->cache_mm(mm) +#define flush_cache_range(vma,start,end) \ +	sparc32_cachetlb_ops->cache_range(vma, start, end) +#define flush_cache_page(vma,addr,pfn) \ +	sparc32_cachetlb_ops->cache_page(vma, addr)  #define flush_icache_range(start, end)		do { } while (0)  #define flush_icache_page(vma, pg)		do { } while (0) @@ -67,13 +29,14 @@ BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long)  		memcpy(dst, src, len);				\  	} while (0) -BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long) -BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) +#define __flush_page_to_ram(addr) \ +	sparc32_cachetlb_ops->page_to_ram(addr) +#define flush_sig_insns(mm,insn_addr) \ +	sparc32_cachetlb_ops->sig_insns(mm, insn_addr) +#define flush_page_for_dma(addr) \ +	sparc32_cachetlb_ops->page_for_dma(addr) -#define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr) -#define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr) - -extern void sparc_flush_page_to_ram(struct page *page); +void sparc_flush_page_to_ram(struct page *page);  #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1  #define flush_dcache_page(page)			sparc_flush_page_to_ram(page) @@ -83,4 +46,13 @@ extern void sparc_flush_page_to_ram(struct page *page);  #define flush_cache_vmap(start, end)		flush_cache_all()  #define flush_cache_vunmap(start, end)		flush_cache_all() +/* When a context switch happens we must flush all user windows so that + * the windows of the current process are flushed onto its stack. This + * way the windows are all clean for the next process and the stack + * frames are up to date. + */ +void flush_user_windows(void); +void kill_user_windows(void); +void flushw_all(void); +  #endif /* _SPARC_CACHEFLUSH_H */ diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h index b95384033e8..38965379e35 100644 --- a/arch/sparc/include/asm/cacheflush_64.h +++ b/arch/sparc/include/asm/cacheflush_64.h @@ -8,6 +8,13 @@  #include <linux/mm.h>  /* Cache flush operations. */ +#define flushw_all()	__asm__ __volatile__("flushw") + +void __flushw_user(void); +#define flushw_user() __flushw_user() + +#define flush_user_windows flushw_user +#define flush_register_windows flushw_all  /* These are the same regardless of whether this is an SMP kernel or not. */  #define flush_cache_mm(__mm) \ @@ -23,29 +30,29 @@   * use block commit stores (which invalidate icache lines) during   * module load, so we need this.   */ -extern void flush_icache_range(unsigned long start, unsigned long end); -extern void __flush_icache_page(unsigned long); +void flush_icache_range(unsigned long start, unsigned long end); +void __flush_icache_page(unsigned long); -extern void __flush_dcache_page(void *addr, int flush_icache); -extern void flush_dcache_page_impl(struct page *page); +void __flush_dcache_page(void *addr, int flush_icache); +void flush_dcache_page_impl(struct page *page);  #ifdef CONFIG_SMP -extern void smp_flush_dcache_page_impl(struct page *page, int cpu); -extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page); +void smp_flush_dcache_page_impl(struct page *page, int cpu); +void flush_dcache_page_all(struct mm_struct *mm, struct page *page);  #else  #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)  #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)  #endif -extern void __flush_dcache_range(unsigned long start, unsigned long end); +void __flush_dcache_range(unsigned long start, unsigned long end);  #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 -extern void flush_dcache_page(struct page *page); +void flush_dcache_page(struct page *page);  #define flush_icache_page(vma, pg)	do { } while(0)  #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0) -extern void flush_ptrace_access(struct vm_area_struct *, struct page *, -				unsigned long uaddr, void *kaddr, -				unsigned long len, int write); +void flush_ptrace_access(struct vm_area_struct *, struct page *, +			 unsigned long uaddr, void *kaddr, +			 unsigned long len, int write);  #define copy_to_user_page(vma, page, vaddr, dst, src, len)		\  	do {								\ diff --git a/arch/sparc/include/asm/cachetlb_32.h b/arch/sparc/include/asm/cachetlb_32.h new file mode 100644 index 00000000000..efb19889a08 --- /dev/null +++ b/arch/sparc/include/asm/cachetlb_32.h @@ -0,0 +1,29 @@ +#ifndef _SPARC_CACHETLB_H +#define _SPARC_CACHETLB_H + +struct mm_struct; +struct vm_area_struct; + +struct sparc32_cachetlb_ops { +	void (*cache_all)(void); +	void (*cache_mm)(struct mm_struct *); +	void (*cache_range)(struct vm_area_struct *, unsigned long, +			    unsigned long); +	void (*cache_page)(struct vm_area_struct *, unsigned long); + +	void (*tlb_all)(void); +	void (*tlb_mm)(struct mm_struct *); +	void (*tlb_range)(struct vm_area_struct *, unsigned long, +			  unsigned long); +	void (*tlb_page)(struct vm_area_struct *, unsigned long); + +	void (*page_to_ram)(unsigned long); +	void (*sig_insns)(struct mm_struct *, unsigned long); +	void (*page_for_dma)(unsigned long); +}; +extern const struct sparc32_cachetlb_ops *sparc32_cachetlb_ops; +#ifdef CONFIG_SMP +extern const struct sparc32_cachetlb_ops *local_ops; +#endif + +#endif /* SPARC_CACHETLB_H */ diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h index bdbda1453aa..426b2389a1c 100644 --- a/arch/sparc/include/asm/checksum_32.h +++ b/arch/sparc/include/asm/checksum_32.h @@ -29,7 +29,7 @@   *   * it's best to have buff aligned on a 32-bit boundary   */ -extern __wsum csum_partial(const void *buff, int len, __wsum sum); +__wsum csum_partial(const void *buff, int len, __wsum sum);  /* the same as csum_partial, but copies from fs:src while it   * checksums @@ -38,7 +38,7 @@ extern __wsum csum_partial(const void *buff, int len, __wsum sum);   * better 64-bit) boundary   */ -extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); +unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *);  static inline __wsum  csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) @@ -238,4 +238,16 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)  	return csum_fold(csum_partial(buff, len, 0));  } +#define HAVE_ARCH_CSUM_ADD +static inline __wsum csum_add(__wsum csum, __wsum addend) +{ +	__asm__ __volatile__( +		"addcc   %0, %1, %0\n" +		"addx    %0, %%g0, %0" +		: "=r" (csum) +		: "r" (addend), "0" (csum)); + +	return csum; +} +  #endif /* !(__SPARC_CHECKSUM_H) */ diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h index 019b9615e43..b8779a6a591 100644 --- a/arch/sparc/include/asm/checksum_64.h +++ b/arch/sparc/include/asm/checksum_64.h @@ -29,7 +29,7 @@   *   * it's best to have buff aligned on a 32-bit boundary   */ -extern __wsum csum_partial(const void * buff, int len, __wsum sum); +__wsum csum_partial(const void * buff, int len, __wsum sum);  /* the same as csum_partial, but copies from user space while it   * checksums @@ -37,12 +37,12 @@ extern __wsum csum_partial(const void * buff, int len, __wsum sum);   * here even more important to align src and dst on a 32-bit (or even   * better 64-bit) boundary   */ -extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, -					      int len, __wsum sum); +__wsum csum_partial_copy_nocheck(const void *src, void *dst, +				 int len, __wsum sum); -extern long __csum_partial_copy_from_user(const void __user *src, -					  void *dst, int len, -					  __wsum sum); +long __csum_partial_copy_from_user(const void __user *src, +				   void *dst, int len, +				   __wsum sum);  static inline __wsum  csum_partial_copy_from_user(const void __user *src, @@ -59,9 +59,9 @@ csum_partial_copy_from_user(const void __user *src,   *	Copy and checksum to user   */  #define HAVE_CSUM_COPY_USER -extern long __csum_partial_copy_to_user(const void *src, -					void __user *dst, int len, -					  __wsum sum); +long __csum_partial_copy_to_user(const void *src, +				 void __user *dst, int len, +				 __wsum sum);  static inline __wsum  csum_and_copy_to_user(const void *src, @@ -77,7 +77,7 @@ csum_and_copy_to_user(const void *src,  /* ihl is always 5 or greater, almost always is 5, and iph is word aligned   * the majority of the time.   */ -extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); +__sum16 ip_fast_csum(const void *iph, unsigned int ihl);  /* Fold a partial checksum without adding pseudo headers. */  static inline __sum16 csum_fold(__wsum sum) @@ -96,9 +96,9 @@ static inline __sum16 csum_fold(__wsum sum)  }  static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, -					       unsigned int len, -					       unsigned short proto, -					       __wsum sum) +					unsigned int len, +					unsigned short proto, +					__wsum sum)  {  	__asm__ __volatile__(  "	addcc		%1, %0, %0\n" @@ -116,9 +116,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,   * returns a 16-bit checksum, already complemented   */  static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, -						   unsigned short len, -						   unsigned short proto, -						   __wsum sum) +					unsigned short len, +					unsigned short proto, +					__wsum sum)  {  	return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));  } @@ -164,4 +164,16 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)  	return csum_fold(csum_partial(buff, len, 0));  } +#define HAVE_ARCH_CSUM_ADD +static inline __wsum csum_add(__wsum csum, __wsum addend) +{ +	__asm__ __volatile__( +		"addcc   %0, %1, %0\n" +		"addx    %0, %%g0, %0" +		: "=r" (csum) +		: "r" (addend), "0" (csum)); + +	return csum; +} +  #endif /* !(__SPARC64_CHECKSUM_H) */ diff --git a/arch/sparc/include/asm/cmpxchg.h b/arch/sparc/include/asm/cmpxchg.h new file mode 100644 index 00000000000..9355893efa5 --- /dev/null +++ b/arch/sparc/include/asm/cmpxchg.h @@ -0,0 +1,8 @@ +#ifndef ___ASM_SPARC_CMPXCHG_H +#define ___ASM_SPARC_CMPXCHG_H +#if defined(__sparc__) && defined(__arch64__) +#include <asm/cmpxchg_64.h> +#else +#include <asm/cmpxchg_32.h> +#endif +#endif diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h new file mode 100644 index 00000000000..32c29a133f9 --- /dev/null +++ b/arch/sparc/include/asm/cmpxchg_32.h @@ -0,0 +1,85 @@ +/* 32-bit atomic xchg() and cmpxchg() definitions. + * + * Copyright (C) 1996 David S. Miller (davem@davemloft.net) + * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au) + * Copyright (C) 2007 Kyle McMartin (kyle@parisc-linux.org) + * + * Additions by Keith M Wesolowski (wesolows@foobazco.org) based + * on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>. + */ + +#ifndef __ARCH_SPARC_CMPXCHG__ +#define __ARCH_SPARC_CMPXCHG__ + +static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) +{ +	__asm__ __volatile__("swap [%2], %0" +			     : "=&r" (val) +			     : "0" (val), "r" (m) +			     : "memory"); +	return val; +} + +void __xchg_called_with_bad_pointer(void); + +static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) +{ +	switch (size) { +	case 4: +		return xchg_u32(ptr, x); +	} +	__xchg_called_with_bad_pointer(); +	return x; +} + +#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) + +/* Emulate cmpxchg() the same way we emulate atomics, + * by hashing the object address and indexing into an array + * of spinlocks to get a bit of performance... + * + * See arch/sparc/lib/atomic32.c for implementation. + * + * Cribbed from <asm-parisc/atomic.h> + */ +#define __HAVE_ARCH_CMPXCHG	1 + +/* bug catcher for when unsupported size is used - won't link */ +void __cmpxchg_called_with_bad_pointer(void); +/* we only need to support cmpxchg of a u32 on sparc */ +unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); + +/* don't worry...optimizer will get rid of most of this */ +static inline unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) +{ +	switch (size) { +	case 4: +		return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_); +	default: +		__cmpxchg_called_with_bad_pointer(); +		break; +	} +	return old; +} + +#define cmpxchg(ptr, o, n)						\ +({									\ +	__typeof__(*(ptr)) _o_ = (o);					\ +	__typeof__(*(ptr)) _n_ = (n);					\ +	(__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,	\ +			(unsigned long)_n_, sizeof(*(ptr)));		\ +}) + +#include <asm-generic/cmpxchg-local.h> + +/* + * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make + * them available. + */ +#define cmpxchg_local(ptr, o, n)				  	       \ +	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ +			(unsigned long)(n), sizeof(*(ptr)))) +#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) + +#endif /* __ARCH_SPARC_CMPXCHG__ */ diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h new file mode 100644 index 00000000000..0e1ed6cfbf6 --- /dev/null +++ b/arch/sparc/include/asm/cmpxchg_64.h @@ -0,0 +1,146 @@ +/* 64-bit atomic xchg() and cmpxchg() definitions. + * + * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com) + */ + +#ifndef __ARCH_SPARC64_CMPXCHG__ +#define __ARCH_SPARC64_CMPXCHG__ + +static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) +{ +	unsigned long tmp1, tmp2; + +	__asm__ __volatile__( +"	mov		%0, %1\n" +"1:	lduw		[%4], %2\n" +"	cas		[%4], %2, %0\n" +"	cmp		%2, %0\n" +"	bne,a,pn	%%icc, 1b\n" +"	 mov		%1, %0\n" +	: "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) +	: "0" (val), "r" (m) +	: "cc", "memory"); +	return val; +} + +static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long val) +{ +	unsigned long tmp1, tmp2; + +	__asm__ __volatile__( +"	mov		%0, %1\n" +"1:	ldx		[%4], %2\n" +"	casx		[%4], %2, %0\n" +"	cmp		%2, %0\n" +"	bne,a,pn	%%xcc, 1b\n" +"	 mov		%1, %0\n" +	: "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) +	: "0" (val), "r" (m) +	: "cc", "memory"); +	return val; +} + +#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) + +void __xchg_called_with_bad_pointer(void); + +static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, +				       int size) +{ +	switch (size) { +	case 4: +		return xchg32(ptr, x); +	case 8: +		return xchg64(ptr, x); +	} +	__xchg_called_with_bad_pointer(); +	return x; +} + +/* + * Atomic compare and exchange.  Compare OLD with MEM, if identical, + * store NEW in MEM.  Return the initial value in MEM.  Success is + * indicated by comparing RETURN with OLD. + */ + +#include <asm-generic/cmpxchg-local.h> + +#define __HAVE_ARCH_CMPXCHG 1 + +static inline unsigned long +__cmpxchg_u32(volatile int *m, int old, int new) +{ +	__asm__ __volatile__("cas [%2], %3, %0" +			     : "=&r" (new) +			     : "0" (new), "r" (m), "r" (old) +			     : "memory"); + +	return new; +} + +static inline unsigned long +__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) +{ +	__asm__ __volatile__("casx [%2], %3, %0" +			     : "=&r" (new) +			     : "0" (new), "r" (m), "r" (old) +			     : "memory"); + +	return new; +} + +/* This function doesn't exist, so you'll get a linker error +   if something tries to do an invalid cmpxchg().  */ +void __cmpxchg_called_with_bad_pointer(void); + +static inline unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ +	switch (size) { +		case 4: +			return __cmpxchg_u32(ptr, old, new); +		case 8: +			return __cmpxchg_u64(ptr, old, new); +	} +	__cmpxchg_called_with_bad_pointer(); +	return old; +} + +#define cmpxchg(ptr,o,n)						 \ +  ({									 \ +     __typeof__(*(ptr)) _o_ = (o);					 \ +     __typeof__(*(ptr)) _n_ = (n);					 \ +     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \ +				    (unsigned long)_n_, sizeof(*(ptr))); \ +  }) + +/* + * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make + * them available. + */ + +static inline unsigned long __cmpxchg_local(volatile void *ptr, +				      unsigned long old, +				      unsigned long new, int size) +{ +	switch (size) { +	case 4: +	case 8:	return __cmpxchg(ptr, old, new, size); +	default: +		return __cmpxchg_local_generic(ptr, old, new, size); +	} + +	return old; +} + +#define cmpxchg_local(ptr, o, n)				  	\ +	((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o),	\ +			(unsigned long)(n), sizeof(*(ptr)))) +#define cmpxchg64_local(ptr, o, n)					\ +  ({									\ +	BUILD_BUG_ON(sizeof(*(ptr)) != 8);				\ +	cmpxchg_local((ptr), (o), (n));					\ +  }) +#define cmpxchg64(ptr, o, n)	cmpxchg64_local((ptr), (o), (n)) + +#endif /* __ARCH_SPARC64_CMPXCHG__ */ diff --git a/arch/sparc/include/asm/cmt.h b/arch/sparc/include/asm/cmt.h deleted file mode 100644 index 870db592857..00000000000 --- a/arch/sparc/include/asm/cmt.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef _SPARC64_CMT_H -#define _SPARC64_CMT_H - -/* cmt.h: Chip Multi-Threading register definitions - * - * Copyright (C) 2004 David S. Miller (davem@redhat.com) - */ - -/* ASI_CORE_ID - private */ -#define LP_ID		0x0000000000000010UL -#define  LP_ID_MAX	0x00000000003f0000UL -#define  LP_ID_ID	0x000000000000003fUL - -/* ASI_INTR_ID - private */ -#define LP_INTR_ID	0x0000000000000000UL -#define  LP_INTR_ID_ID	0x00000000000003ffUL - -/* ASI_CESR_ID - private */ -#define CESR_ID		0x0000000000000040UL -#define  CESR_ID_ID	0x00000000000000ffUL - -/* ASI_CORE_AVAILABLE - shared */ -#define LP_AVAIL	0x0000000000000000UL -#define  LP_AVAIL_1	0x0000000000000002UL -#define  LP_AVAIL_0	0x0000000000000001UL - -/* ASI_CORE_ENABLE_STATUS - shared */ -#define LP_ENAB_STAT	0x0000000000000010UL -#define  LP_ENAB_STAT_1	0x0000000000000002UL -#define  LP_ENAB_STAT_0	0x0000000000000001UL - -/* ASI_CORE_ENABLE - shared */ -#define LP_ENAB		0x0000000000000020UL -#define  LP_ENAB_1	0x0000000000000002UL -#define  LP_ENAB_0	0x0000000000000001UL - -/* ASI_CORE_RUNNING - shared */ -#define LP_RUNNING_RW	0x0000000000000050UL -#define LP_RUNNING_W1S	0x0000000000000060UL -#define LP_RUNNING_W1C	0x0000000000000068UL -#define  LP_RUNNING_1	0x0000000000000002UL -#define  LP_RUNNING_0	0x0000000000000001UL - -/* ASI_CORE_RUNNING_STAT - shared */ -#define LP_RUN_STAT	0x0000000000000058UL -#define  LP_RUN_STAT_1	0x0000000000000002UL -#define  LP_RUN_STAT_0	0x0000000000000001UL - -/* ASI_XIR_STEERING - shared */ -#define LP_XIR_STEER	0x0000000000000030UL -#define  LP_XIR_STEER_1	0x0000000000000002UL -#define  LP_XIR_STEER_0	0x0000000000000001UL - -/* ASI_CMT_ERROR_STEERING - shared */ -#define CMT_ER_STEER	0x0000000000000040UL -#define  CMT_ER_STEER_1	0x0000000000000002UL -#define  CMT_ER_STEER_0	0x0000000000000001UL - -#endif /* _SPARC64_CMT_H */ diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 6f57325bb88..830502fe62b 100644 --- a/arch/sparc/include/asm/compat.h +++ b/arch/sparc/include/asm/compat.h @@ -36,6 +36,7 @@ typedef s64		compat_s64;  typedef u32		compat_uint_t;  typedef u32		compat_ulong_t;  typedef u64		compat_u64; +typedef u32		compat_uptr_t;  struct compat_timespec {  	compat_time_t	tv_sec; @@ -134,7 +135,8 @@ struct compat_statfs {  	compat_fsid_t	f_fsid;  	int		f_namelen;	/* SunOS ignores this field. */  	int		f_frsize; -	int		f_spare[5]; +	int		f_flags; +	int		f_spare[4];  };  #define COMPAT_RLIM_INFINITY 0x7fffffff @@ -146,6 +148,65 @@ typedef u32		compat_old_sigset_t;  typedef u32		compat_sigset_word; +typedef union compat_sigval { +	compat_int_t	sival_int; +	compat_uptr_t	sival_ptr; +} compat_sigval_t; + +#define SI_PAD_SIZE32	(128/sizeof(int) - 3) + +typedef struct compat_siginfo { +	int si_signo; +	int si_errno; +	int si_code; + +	union { +		int _pad[SI_PAD_SIZE32]; + +		/* kill() */ +		struct { +			compat_pid_t _pid;		/* sender's pid */ +			unsigned int _uid;		/* sender's uid */ +		} _kill; + +		/* POSIX.1b timers */ +		struct { +			compat_timer_t _tid;		/* timer id */ +			int _overrun;			/* overrun count */ +			compat_sigval_t _sigval;	/* same as below */ +			int _sys_private;	/* not to be passed to user */ +		} _timer; + +		/* POSIX.1b signals */ +		struct { +			compat_pid_t _pid;		/* sender's pid */ +			unsigned int _uid;		/* sender's uid */ +			compat_sigval_t _sigval; +		} _rt; + +		/* SIGCHLD */ +		struct { +			compat_pid_t _pid;		/* which child */ +			unsigned int _uid;		/* sender's uid */ +			int _status;			/* exit code */ +			compat_clock_t _utime; +			compat_clock_t _stime; +		} _sigchld; + +		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ +		struct { +			u32 _addr; /* faulting insn/memory ref. */ +			int _trapno; +		} _sigfault; + +		/* SIGPOLL */ +		struct { +			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */ +			int _fd; +		} _sigpoll; +	} _sifields; +} compat_siginfo_t; +  #define COMPAT_OFF_T_MAX	0x7fffffff  #define COMPAT_LOFF_T_MAX	0x7fffffffffffffffL @@ -155,7 +216,6 @@ typedef u32		compat_sigset_word;   * as pointers because the syscall entry code will have   * appropriately converted them already.   */ -typedef	u32		compat_uptr_t;  static inline void __user *compat_ptr(compat_uptr_t uptr)  { @@ -172,9 +232,10 @@ static inline void __user *arch_compat_alloc_user_space(long len)  	struct pt_regs *regs = current_thread_info()->kregs;  	unsigned long usp = regs->u_regs[UREG_I6]; -	if (!(test_thread_flag(TIF_32BIT))) +	if (test_thread_64bit_stack(usp))  		usp += STACK_BIAS; -	else + +	if (test_thread_flag(TIF_32BIT))  		usp &= 0xffffffffUL;  	usp -= len; diff --git a/arch/sparc/include/asm/compat_signal.h b/arch/sparc/include/asm/compat_signal.h index b759eab9b51..9ed1f128b4d 100644 --- a/arch/sparc/include/asm/compat_signal.h +++ b/arch/sparc/include/asm/compat_signal.h @@ -18,12 +18,6 @@ struct __old_sigaction32 {  	unsigned int    	sa_flags;  	unsigned		sa_restorer;     /* not used by Linux/SPARC yet */  }; - -typedef struct sigaltstack32 { -	u32			ss_sp; -	int			ss_flags; -	compat_size_t		ss_size; -} stack_t32;  #endif  #endif /* !(_COMPAT_SIGNAL_H) */ diff --git a/arch/sparc/include/asm/contregs.h b/arch/sparc/include/asm/contregs.h index 48fa8a4ef35..b8abdfcf555 100644 --- a/arch/sparc/include/asm/contregs.h +++ b/arch/sparc/include/asm/contregs.h @@ -7,28 +7,6 @@   * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)   */ -/* 3=sun3 -   4=sun4 (as in sun4 sysmaint student book) -   c=sun4c (according to davem) */ - -#define AC_IDPROM     0x00000000    /* 34  ID PROM, R/O, byte, 32 bytes      */ -#define AC_PAGEMAP    0x10000000    /* 3   Pagemap R/W, long                 */ -#define AC_SEGMAP     0x20000000    /* 3   Segment map, byte                 */ -#define AC_CONTEXT    0x30000000    /* 34c current mmu-context               */ -#define AC_SENABLE    0x40000000    /* 34c system dvma/cache/reset enable reg*/ -#define AC_UDVMA_ENB  0x50000000    /* 34  Not used on Sun boards, byte      */ -#define AC_BUS_ERROR  0x60000000    /* 34  Not cleared on read, byte.        */ -#define AC_SYNC_ERR   0x60000000    /*  c fault type                         */ -#define AC_SYNC_VA    0x60000004    /*  c fault virtual address              */ -#define AC_ASYNC_ERR  0x60000008    /*  c asynchronous fault type            */ -#define AC_ASYNC_VA   0x6000000c    /*  c async fault virtual address        */ -#define AC_LEDS       0x70000000    /* 34  Zero turns on LEDs, byte          */ -#define AC_CACHETAGS  0x80000000    /* 34c direct access to the VAC tags     */ -#define AC_CACHEDDATA 0x90000000    /* 3 c direct access to the VAC data     */ -#define AC_UDVMA_MAP  0xD0000000    /* 4  Not used on Sun boards, byte       */ -#define AC_VME_VECTOR 0xE0000000    /* 4  For non-Autovector VME, byte       */ -#define AC_BOOT_SCC   0xF0000000    /* 34  bypass to access Zilog 8530. byte.*/ -  /* s=Swift, h=Ross_HyperSPARC, v=TI_Viking, t=Tsunami, r=Ross_Cypress        */  #define AC_M_PCR      0x0000        /* shv Processor Control Reg             */  #define AC_M_CTPR     0x0100        /* shv Context Table Pointer Reg         */ diff --git a/arch/sparc/include/asm/cpu_type.h b/arch/sparc/include/asm/cpu_type.h new file mode 100644 index 00000000000..84d7d83b808 --- /dev/null +++ b/arch/sparc/include/asm/cpu_type.h @@ -0,0 +1,28 @@ +#ifndef __ASM_CPU_TYPE_H +#define __ASM_CPU_TYPE_H + +/* + * Sparc (general) CPU types + */ +enum sparc_cpu { +  sun4m       = 0x00, +  sun4d       = 0x01, +  sun4e       = 0x02, +  sun4u       = 0x03, /* V8 ploos ploos */ +  sun_unknown = 0x04, +  ap1000      = 0x05, /* almost a sun4m */ +  sparc_leon  = 0x06, /* Leon SoC */ +}; + +#ifdef CONFIG_SPARC32 +extern enum sparc_cpu sparc_cpu_model; + +#define SUN4M_NCPUS            4              /* Architectural limit of sun4m. */ + +#else + +#define sparc_cpu_model sun4u + +#endif + +#endif /* __ASM_CPU_TYPE_H */ diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h index b5976de7cac..128b56b0867 100644 --- a/arch/sparc/include/asm/cpudata.h +++ b/arch/sparc/include/asm/cpudata.h @@ -1,5 +1,15 @@  #ifndef ___ASM_SPARC_CPUDATA_H  #define ___ASM_SPARC_CPUDATA_H + +#ifndef __ASSEMBLY__ + +#include <linux/threads.h> +#include <linux/percpu.h> + +extern const struct seq_operations cpuinfo_op; + +#endif /* !(__ASSEMBLY__) */ +  #if defined(__sparc__) && defined(__arch64__)  #include <asm/cpudata_64.h>  #else diff --git a/arch/sparc/include/asm/cpudata_32.h b/arch/sparc/include/asm/cpudata_32.h index 31d48a0e32c..0300d94c25b 100644 --- a/arch/sparc/include/asm/cpudata_32.h +++ b/arch/sparc/include/asm/cpudata_32.h @@ -14,8 +14,11 @@  typedef struct {  	unsigned long udelay_val;  	unsigned long clock_tick; -	unsigned int multiplier;  	unsigned int counter; +#ifdef CONFIG_SMP +	unsigned int irq_resched_count; +	unsigned int irq_call_count; +#endif  	int prom_node;  	int mid;  	int next; @@ -23,5 +26,6 @@ typedef struct {  DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);  #define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) +#define local_cpu_data() __get_cpu_var(__cpu_data)  #endif /* _SPARC_CPUDATA_H */ diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h index 050ef35b9dc..0e594076912 100644 --- a/arch/sparc/include/asm/cpudata_64.h +++ b/arch/sparc/include/asm/cpudata_64.h @@ -8,9 +8,6 @@  #ifndef __ASSEMBLY__ -#include <linux/percpu.h> -#include <linux/threads.h> -  typedef struct {  	/* Dcache line 1 */  	unsigned int	__softirq_pending; /* must be 1st, see rtrap.S */ @@ -35,8 +32,6 @@ DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);  #define cpu_data(__cpu)		per_cpu(__cpu_data, (__cpu))  #define local_cpu_data()	__get_cpu_var(__cpu_data) -extern const struct seq_operations cpuinfo_op; -  #endif /* !(__ASSEMBLY__) */  #include <asm/trap_block.h> diff --git a/arch/sparc/include/asm/cputime.h b/arch/sparc/include/asm/cputime.h deleted file mode 100644 index 1a642b81e01..00000000000 --- a/arch/sparc/include/asm/cputime.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __SPARC_CPUTIME_H -#define __SPARC_CPUTIME_H - -#include <asm-generic/cputime.h> - -#endif /* __SPARC_CPUTIME_H */ diff --git a/arch/sparc/include/asm/cypress.h b/arch/sparc/include/asm/cypress.h deleted file mode 100644 index 95e9772ea39..00000000000 --- a/arch/sparc/include/asm/cypress.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * cypress.h: Cypress module specific definitions and defines. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef _SPARC_CYPRESS_H -#define _SPARC_CYPRESS_H - -/* Cypress chips have %psr 'impl' of '0001' and 'vers' of '0001'. */ - -/* The MMU control register fields on the Sparc Cypress 604/605 MMU's. - * - * --------------------------------------------------------------- - * |implvers| MCA | MCM |MV| MID |BM| C|RSV|MR|CM|CL|CE|RSV|NF|ME| - * --------------------------------------------------------------- - *  31    24 23-22 21-20 19 18-15 14 13  12 11 10  9  8 7-2  1  0 - * - * MCA: MultiChip Access -- Used for configuration of multiple - *      CY7C604/605 cache units. - * MCM: MultiChip Mask -- Again, for multiple cache unit config. - * MV: MultiChip Valid -- Indicates MCM and MCA have valid settings. - * MID: ModuleID -- Unique processor ID for MBus transactions. (605 only) - * BM: Boot Mode -- 0 = not in boot mode, 1 = in boot mode - * C: Cacheable -- Indicates whether accesses are cacheable while - *    the MMU is off.  0=no 1=yes - * MR: MemoryReflection -- Indicates whether the bus attached to the - *     MBus supports memory reflection. 0=no 1=yes (605 only) - * CM: CacheMode -- Indicates whether the cache is operating in write - *     through or copy-back mode. 0=write-through 1=copy-back - * CL: CacheLock -- Indicates if the entire cache is locked or not. - *     0=not-locked 1=locked  (604 only) - * CE: CacheEnable -- Is the virtual cache on? 0=no 1=yes - * NF: NoFault -- Do faults generate traps? 0=yes 1=no - * ME: MmuEnable -- Is the MMU doing translations? 0=no 1=yes - */ - -#define CYPRESS_MCA       0x00c00000 -#define CYPRESS_MCM       0x00300000 -#define CYPRESS_MVALID    0x00080000 -#define CYPRESS_MIDMASK   0x00078000   /* Only on 605 */ -#define CYPRESS_BMODE     0x00004000 -#define CYPRESS_ACENABLE  0x00002000 -#define CYPRESS_MRFLCT    0x00000800   /* Only on 605 */ -#define CYPRESS_CMODE     0x00000400 -#define CYPRESS_CLOCK     0x00000200   /* Only on 604 */ -#define CYPRESS_CENABLE   0x00000100 -#define CYPRESS_NFAULT    0x00000002 -#define CYPRESS_MENABLE   0x00000001 - -static inline void cypress_flush_page(unsigned long page) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (page), "i" (ASI_M_FLUSH_PAGE)); -} - -static inline void cypress_flush_segment(unsigned long addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_SEG)); -} - -static inline void cypress_flush_region(unsigned long addr) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : -			     "r" (addr), "i" (ASI_M_FLUSH_REGION)); -} - -static inline void cypress_flush_context(void) -{ -	__asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : : -			     "i" (ASI_M_FLUSH_CTX)); -} - -/* XXX Displacement flushes for buggy chips and initial testing - * XXX go here. - */ - -#endif /* !(_SPARC_CYPRESS_H) */ diff --git a/arch/sparc/include/asm/delay_32.h b/arch/sparc/include/asm/delay_32.h index bc9aba2bead..3fb8ca144b4 100644 --- a/arch/sparc/include/asm/delay_32.h +++ b/arch/sparc/include/asm/delay_32.h @@ -20,8 +20,8 @@ static inline void __delay(unsigned long loops)  }  /* This is too messy with inline asm on the Sparc. */ -extern void __udelay(unsigned long usecs, unsigned long lpj); -extern void __ndelay(unsigned long nsecs, unsigned long lpj); +void __udelay(unsigned long usecs, unsigned long lpj); +void __ndelay(unsigned long nsecs, unsigned long lpj);  #ifdef CONFIG_SMP  #define __udelay_val	cpu_data(smp_processor_id()).udelay_val diff --git a/arch/sparc/include/asm/delay_64.h b/arch/sparc/include/asm/delay_64.h index a77aa622d76..0ba5424856d 100644 --- a/arch/sparc/include/asm/delay_64.h +++ b/arch/sparc/include/asm/delay_64.h @@ -8,8 +8,8 @@  #ifndef __ASSEMBLY__ -extern void __delay(unsigned long loops); -extern void udelay(unsigned long usecs); +void __delay(unsigned long loops); +void udelay(unsigned long usecs);  #define mdelay(n)	udelay((n) * 1000)  #endif /* !__ASSEMBLY__ */ diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h index daa6a8a5e9c..bb3f0b0c675 100644 --- a/arch/sparc/include/asm/device.h +++ b/arch/sparc/include/asm/device.h @@ -19,7 +19,7 @@ struct dev_archdata {  	int			numa_node;  }; -extern void of_propagate_archdata(struct platform_device *bus); +void of_propagate_archdata(struct platform_device *bus);  struct pdev_archdata {  	struct resource		resource[PROMREG_MAX]; diff --git a/arch/sparc/include/asm/display7seg.h b/arch/sparc/include/asm/display7seg.h deleted file mode 100644 index 86d4a901df2..00000000000 --- a/arch/sparc/include/asm/display7seg.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * display7seg - Driver interface for the 7-segment display - * present on Sun Microsystems CP1400 and CP1500 - * - * Copyright (c) 2000 Eric Brower <ebrower@usa.net> - * - */ - -#ifndef __display7seg_h__ -#define __display7seg_h__ - -#define D7S_IOC	'p' - -#define D7SIOCRD _IOR(D7S_IOC, 0x45, int)	/* Read device state	*/ -#define D7SIOCWR _IOW(D7S_IOC, 0x46, int)	/* Write device state	*/ -#define D7SIOCTM _IO (D7S_IOC, 0x47)		/* Translate mode (FLIP)*/ - -/* - * ioctl flag definitions - * - * POINT	- Toggle decimal point	(0=absent 1=present) - * ALARM	- Toggle alarm LED 		(0=green  1=red) - * FLIP		- Toggle inverted mode 	(0=normal 1=flipped) - * bits 0-4	- Character displayed	(see definitions below) - * - * Display segments are defined as follows, - * subject to D7S_FLIP register state: - * - *    a - *   --- - * f|   |b - *   -g- - * e|   |c - *   --- - *    d - */ - -#define D7S_POINT	(1 << 7)	/* Decimal point*/ -#define D7S_ALARM	(1 << 6)	/* Alarm LED 	*/ -#define D7S_FLIP	(1 << 5)	/* Flip display */ - -#define D7S_0		0x00		/* Numerals 0-9 */ -#define D7S_1		0x01 -#define D7S_2		0x02 -#define D7S_3		0x03 -#define D7S_4		0x04 -#define D7S_5		0x05 -#define D7S_6		0x06 -#define D7S_7		0x07 -#define D7S_8		0x08 -#define D7S_9		0x09 -#define D7S_A		0x0A		/* Letters A-F, H, L, P */ -#define D7S_B		0x0B -#define D7S_C		0x0C -#define D7S_D		0x0D -#define D7S_E		0x0E -#define D7S_F		0x0F -#define D7S_H		0x10 -#define D7S_E2		0x11 -#define D7S_L		0x12 -#define D7S_P		0x13 -#define D7S_SEGA	0x14		/* Individual segments */ -#define D7S_SEGB	0x15 -#define D7S_SEGC	0x16 -#define D7S_SEGD	0x17 -#define D7S_SEGE	0x18 -#define D7S_SEGF	0x19 -#define D7S_SEGG	0x1A -#define D7S_SEGABFG 0x1B		/* Segment groupings */ -#define D7S_SEGCDEG	0x1C -#define D7S_SEGBCEF 0x1D -#define D7S_SEGADG	0x1E -#define D7S_BLANK	0x1F		/* Clear all segments */ - -#define D7S_MIN_VAL	0x0 -#define D7S_MAX_VAL	0x1F - -#endif /* ifndef __display7seg_h__ */ diff --git a/arch/sparc/include/asm/div64.h b/arch/sparc/include/asm/div64.h deleted file mode 100644 index 6cd978cefb2..00000000000 --- a/arch/sparc/include/asm/div64.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/div64.h> diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 8c0e4f7bb20..1ee02710b2d 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h @@ -7,18 +7,23 @@  #define DMA_ERROR_CODE	(~(dma_addr_t)0x0) -extern int dma_supported(struct device *dev, u64 mask); +int dma_supported(struct device *dev, u64 mask);  #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)  #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) -extern struct dma_map_ops *dma_ops, pci32_dma_ops; +extern struct dma_map_ops *dma_ops; +extern struct dma_map_ops *leon_dma_ops; +extern struct dma_map_ops pci32_dma_ops; +  extern struct bus_type pci_bus_type;  static inline struct dma_map_ops *get_dma_ops(struct device *dev)  {  #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) -	if (dev->bus == &pci_bus_type) +	if (sparc_cpu_model == sparc_leon) +		return leon_dma_ops; +	else if (dev->bus == &pci_bus_type)  		return &pci32_dma_ops;  #endif  	return dma_ops; @@ -26,28 +31,35 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)  #include <asm-generic/dma-mapping-common.h> -static inline void *dma_alloc_coherent(struct device *dev, size_t size, -				       dma_addr_t *dma_handle, gfp_t flag) +#define dma_alloc_coherent(d,s,h,f)	dma_alloc_attrs(d,s,h,f,NULL) + +static inline void *dma_alloc_attrs(struct device *dev, size_t size, +				    dma_addr_t *dma_handle, gfp_t flag, +				    struct dma_attrs *attrs)  {  	struct dma_map_ops *ops = get_dma_ops(dev);  	void *cpu_addr; -	cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag); +	cpu_addr = ops->alloc(dev, size, dma_handle, flag, attrs);  	debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);  	return cpu_addr;  } -static inline void dma_free_coherent(struct device *dev, size_t size, -				     void *cpu_addr, dma_addr_t dma_handle) +#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) + +static inline void dma_free_attrs(struct device *dev, size_t size, +				  void *cpu_addr, dma_addr_t dma_handle, +				  struct dma_attrs *attrs)  {  	struct dma_map_ops *ops = get_dma_ops(dev);  	debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); -	ops->free_coherent(dev, size, cpu_addr, dma_handle); +	ops->free(dev, size, cpu_addr, dma_handle, attrs);  }  static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)  { +	debug_dma_mapping_error(dev, dma_addr);  	return (dma_addr == DMA_ERROR_CODE);  } diff --git a/arch/sparc/include/asm/dma.h b/arch/sparc/include/asm/dma.h index b554927bbaf..3d434ef5eae 100644 --- a/arch/sparc/include/asm/dma.h +++ b/arch/sparc/include/asm/dma.h @@ -92,27 +92,31 @@ extern int isa_dma_bridge_buggy;  #ifdef CONFIG_SPARC32  /* Routines for data transfer buffers. */ -BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long) -BTFIXUPDEF_CALL(void,   mmu_unlockarea, char *, unsigned long) - -#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len) -#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len) - -struct page;  struct device;  struct scatterlist; -/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */ -BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, struct device *, char *, unsigned long) -BTFIXUPDEF_CALL(void,  mmu_get_scsi_sgl, struct device *, struct scatterlist *, int) -BTFIXUPDEF_CALL(void,  mmu_release_scsi_one, struct device *, __u32, unsigned long) -BTFIXUPDEF_CALL(void,  mmu_release_scsi_sgl, struct device *, struct scatterlist *, int) - -#define mmu_get_scsi_one(dev,vaddr,len) BTFIXUP_CALL(mmu_get_scsi_one)(dev,vaddr,len) -#define mmu_get_scsi_sgl(dev,sg,sz) BTFIXUP_CALL(mmu_get_scsi_sgl)(dev,sg,sz) -#define mmu_release_scsi_one(dev,vaddr,len) BTFIXUP_CALL(mmu_release_scsi_one)(dev,vaddr,len) -#define mmu_release_scsi_sgl(dev,sg,sz) BTFIXUP_CALL(mmu_release_scsi_sgl)(dev,sg,sz) - +struct sparc32_dma_ops { +	__u32 (*get_scsi_one)(struct device *, char *, unsigned long); +	void (*get_scsi_sgl)(struct device *, struct scatterlist *, int); +	void (*release_scsi_one)(struct device *, __u32, unsigned long); +	void (*release_scsi_sgl)(struct device *, struct scatterlist *,int); +#ifdef CONFIG_SBUS +	int (*map_dma_area)(struct device *, dma_addr_t *, unsigned long, unsigned long, int); +	void (*unmap_dma_area)(struct device *, unsigned long, int); +#endif +}; +extern const struct sparc32_dma_ops *sparc32_dma_ops; + +#define mmu_get_scsi_one(dev,vaddr,len) \ +	sparc32_dma_ops->get_scsi_one(dev, vaddr, len) +#define mmu_get_scsi_sgl(dev,sg,sz) \ +	sparc32_dma_ops->get_scsi_sgl(dev, sg, sz) +#define mmu_release_scsi_one(dev,vaddr,len) \ +	sparc32_dma_ops->release_scsi_one(dev, vaddr,len) +#define mmu_release_scsi_sgl(dev,sg,sz) \ +	sparc32_dma_ops->release_scsi_sgl(dev, sg, sz) + +#ifdef CONFIG_SBUS  /*   * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep.   * @@ -123,17 +127,17 @@ BTFIXUPDEF_CALL(void,  mmu_release_scsi_sgl, struct device *, struct scatterlist   * Second mapping is for device visible address, or "bus" address.   * The bus address is returned at '*pba'.   * - * These functions seem distinct, but are hard to split. On sun4c, - * at least for now, 'a' is equal to bus address, and retured in *pba. + * These functions seem distinct, but are hard to split.   * On sun4m, page attributes depend on the CPU type, so we have to   * know if we are mapping RAM or I/O, so it has to be an additional argument   * to a separate mapping function for CPU visible mappings.   */ -BTFIXUPDEF_CALL(int, mmu_map_dma_area, struct device *, dma_addr_t *, unsigned long, unsigned long, int len) -BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, struct device *, unsigned long busa, int len) +#define sbus_map_dma_area(dev,pba,va,a,len) \ +	sparc32_dma_ops->map_dma_area(dev, pba, va, a, len) +#define sbus_unmap_dma_area(dev,ba,len) \ +	sparc32_dma_ops->unmap_dma_area(dev, ba, len) +#endif /* CONFIG_SBUS */ -#define mmu_map_dma_area(dev,pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(dev,pba,va,a,len) -#define mmu_unmap_dma_area(dev,ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(dev,ba,len)  #endif  #endif /* !(_ASM_SPARC_DMA_H) */ diff --git a/arch/sparc/include/asm/ebus_dma.h b/arch/sparc/include/asm/ebus_dma.h index f07a5b541c9..fcfb4948147 100644 --- a/arch/sparc/include/asm/ebus_dma.h +++ b/arch/sparc/include/asm/ebus_dma.h @@ -22,14 +22,14 @@ struct ebus_dma_info {  	unsigned char	name[64];  }; -extern int ebus_dma_register(struct ebus_dma_info *p); -extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on); -extern void ebus_dma_unregister(struct ebus_dma_info *p); -extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, +int ebus_dma_register(struct ebus_dma_info *p); +int ebus_dma_irq_enable(struct ebus_dma_info *p, int on); +void ebus_dma_unregister(struct ebus_dma_info *p); +int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,  			    size_t len); -extern void ebus_dma_prepare(struct ebus_dma_info *p, int write); -extern unsigned int ebus_dma_residue(struct ebus_dma_info *p); -extern unsigned int ebus_dma_addr(struct ebus_dma_info *p); -extern void ebus_dma_enable(struct ebus_dma_info *p, int on); +void ebus_dma_prepare(struct ebus_dma_info *p, int write); +unsigned int ebus_dma_residue(struct ebus_dma_info *p); +unsigned int ebus_dma_addr(struct ebus_dma_info *p); +void ebus_dma_enable(struct ebus_dma_info *p, int on);  #endif /* __ASM_SPARC_EBUS_DMA_H */ diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h index 4269ca6ad18..a24e41fcdde 100644 --- a/arch/sparc/include/asm/elf_32.h +++ b/arch/sparc/include/asm/elf_32.h @@ -118,16 +118,9 @@ typedef struct {     instruction set this cpu supports.  This can NOT be done in userspace     on Sparc.  */ -/* Sun4c has none of the capabilities, most sun4m's have them all. - * XXX This is gross, set some global variable at boot time. -DaveM - */ -#define ELF_HWCAP	((ARCH_SUN4C) ? 0 : \ -			 (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ -			  HWCAP_SPARC_SWAP | \ -			  ((srmmu_modtype != Cypress && \ -			    srmmu_modtype != Cypress_vE && \ -			    srmmu_modtype != Cypress_vD) ? \ -			   HWCAP_SPARC_MULDIV : 0))) +/* Most sun4m's have them all.  */ +#define ELF_HWCAP	(HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ +			 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV)  /* This yields a string that ld.so will use to load implementation     specific libraries for optimization.  This is more specific in @@ -135,6 +128,4 @@ typedef struct {  #define ELF_PLATFORM	(NULL) -#define SET_PERSONALITY(ex) set_personality(PER_LINUX) -  #endif /* !(__ASMSPARC_ELF_H) */ diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h index e67880381b8..370ca1e71ff 100644 --- a/arch/sparc/include/asm/elf_64.h +++ b/arch/sparc/include/asm/elf_64.h @@ -59,15 +59,42 @@  #define R_SPARC_6		45  /* Bits present in AT_HWCAP, primarily for Sparc32.  */ - -#define HWCAP_SPARC_FLUSH       1    /* CPU supports flush instruction. */ -#define HWCAP_SPARC_STBAR       2 -#define HWCAP_SPARC_SWAP        4 -#define HWCAP_SPARC_MULDIV      8 -#define HWCAP_SPARC_V9		16 -#define HWCAP_SPARC_ULTRA3	32 -#define HWCAP_SPARC_BLKINIT	64 -#define HWCAP_SPARC_N2		128 +#define HWCAP_SPARC_FLUSH       0x00000001 +#define HWCAP_SPARC_STBAR       0x00000002 +#define HWCAP_SPARC_SWAP        0x00000004 +#define HWCAP_SPARC_MULDIV      0x00000008 +#define HWCAP_SPARC_V9		0x00000010 +#define HWCAP_SPARC_ULTRA3	0x00000020 +#define HWCAP_SPARC_BLKINIT	0x00000040 +#define HWCAP_SPARC_N2		0x00000080 + +/* Solaris compatible AT_HWCAP bits. */ +#define AV_SPARC_MUL32		0x00000100 /* 32x32 multiply is efficient */ +#define AV_SPARC_DIV32		0x00000200 /* 32x32 divide is efficient */ +#define AV_SPARC_FSMULD		0x00000400 /* 'fsmuld' is efficient */ +#define AV_SPARC_V8PLUS		0x00000800 /* v9 insn available to 32bit */ +#define AV_SPARC_POPC		0x00001000 /* 'popc' is efficient */ +#define AV_SPARC_VIS		0x00002000 /* VIS insns available */ +#define AV_SPARC_VIS2		0x00004000 /* VIS2 insns available */ +#define AV_SPARC_ASI_BLK_INIT	0x00008000 /* block init ASIs available */ +#define AV_SPARC_FMAF		0x00010000 /* fused multiply-add */ +#define AV_SPARC_VIS3		0x00020000 /* VIS3 insns available */ +#define AV_SPARC_HPC		0x00040000 /* HPC insns available */ +#define AV_SPARC_RANDOM		0x00080000 /* 'random' insn available */ +#define AV_SPARC_TRANS		0x00100000 /* transaction insns available */ +#define AV_SPARC_FJFMAU		0x00200000 /* unfused multiply-add */ +#define AV_SPARC_IMA		0x00400000 /* integer multiply-add */ +#define AV_SPARC_ASI_CACHE_SPARING \ +				0x00800000 /* cache sparing ASIs available */ +#define AV_SPARC_PAUSE		0x01000000 /* PAUSE available */ +#define AV_SPARC_CBCOND		0x02000000 /* CBCOND insns available */ + +/* Solaris decided to enumerate every single crypto instruction type + * in the AT_HWCAP bits.  This is wasteful, since if crypto is present, + * you still need to look in the CFR register to see if the opcode is + * really available.  So we simply advertise only "crypto" support. + */ +#define HWCAP_SPARC_CRYPTO	0x04000000 /* CRYPTO insns available */  #define CORE_DUMP_USE_REGSET @@ -162,31 +189,8 @@ typedef struct {  #define ELF_ET_DYN_BASE		0x0000010000000000UL  #define COMPAT_ELF_ET_DYN_BASE	0x0000000070000000UL - -/* This yields a mask that user programs can use to figure out what -   instruction set this cpu supports.  */ - -/* On Ultra, we support all of the v8 capabilities. */ -static inline unsigned int sparc64_elf_hwcap(void) -{ -	unsigned int cap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | -			    HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | -			    HWCAP_SPARC_V9); - -	if (tlb_type == cheetah || tlb_type == cheetah_plus) -		cap |= HWCAP_SPARC_ULTRA3; -	else if (tlb_type == hypervisor) { -		if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || -		    sun4v_chip_type == SUN4V_CHIP_NIAGARA2) -			cap |= HWCAP_SPARC_BLKINIT; -		if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2) -			cap |= HWCAP_SPARC_N2; -	} - -	return cap; -} - -#define ELF_HWCAP	sparc64_elf_hwcap(); +extern unsigned long sparc64_elf_hwcap; +#define ELF_HWCAP	sparc64_elf_hwcap  /* This yields a string that ld.so will use to load implementation     specific libraries for optimization.  This is more specific in diff --git a/arch/sparc/include/asm/emergency-restart.h b/arch/sparc/include/asm/emergency-restart.h deleted file mode 100644 index 108d8c48e42..00000000000 --- a/arch/sparc/include/asm/emergency-restart.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - -#include <asm-generic/emergency-restart.h> - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/arch/sparc/include/asm/envctrl.h b/arch/sparc/include/asm/envctrl.h deleted file mode 100644 index 624fa7e2da8..00000000000 --- a/arch/sparc/include/asm/envctrl.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * envctrl.h: Definitions for access to the i2c environment - *            monitoring on Ultrasparc systems. - * - * Copyright (C) 1998  Eddie C. Dost  (ecd@skynet.be) - * Copyright (C) 2000  Vinh Truong  (vinh.truong@eng.sun.com) - * VT - Add all ioctl commands and environment status definitions - * VT - Add application note - */ -#ifndef _SPARC64_ENVCTRL_H -#define _SPARC64_ENVCTRL_H 1 - -#include <linux/ioctl.h> - -/* Application note: - * - * The driver supports 4 operations: open(), close(), ioctl(), read() - * The device name is /dev/envctrl. - * Below is sample usage: - * - *	fd = open("/dev/envtrl", O_RDONLY); - *	if (ioctl(fd, ENVCTRL_READ_SHUTDOWN_TEMPERATURE, 0) < 0) - *		printf("error\n"); - *	ret = read(fd, buf, 10); - *	close(fd); - * - * Notice in the case of cpu voltage and temperature, the default is - * cpu0.  If we need to know the info of cpu1, cpu2, cpu3, we need to - * pass in cpu number in ioctl() last parameter.  For example, to - * get the voltage of cpu2: - * - *	ioctlbuf[0] = 2; - *	if (ioctl(fd, ENVCTRL_READ_CPU_VOLTAGE, ioctlbuf) < 0) - *		printf("error\n"); - *	ret = read(fd, buf, 10); - * - * All the return values are in ascii.  So check read return value - * and do appropriate conversions in your application. - */ - -/* IOCTL commands */ - -/* Note: these commands reflect possible monitor features. - * Some boards choose to support some of the features only. - */ -#define ENVCTRL_RD_CPU_TEMPERATURE	_IOR('p', 0x40, int) -#define ENVCTRL_RD_CPU_VOLTAGE		_IOR('p', 0x41, int) -#define ENVCTRL_RD_FAN_STATUS		_IOR('p', 0x42, int) -#define ENVCTRL_RD_WARNING_TEMPERATURE	_IOR('p', 0x43, int) -#define ENVCTRL_RD_SHUTDOWN_TEMPERATURE	_IOR('p', 0x44, int) -#define ENVCTRL_RD_VOLTAGE_STATUS	_IOR('p', 0x45, int) -#define ENVCTRL_RD_SCSI_TEMPERATURE	_IOR('p', 0x46, int) -#define ENVCTRL_RD_ETHERNET_TEMPERATURE	_IOR('p', 0x47, int) -#define ENVCTRL_RD_MTHRBD_TEMPERATURE	_IOR('p', 0x48, int) - -#define ENVCTRL_RD_GLOBALADDRESS	_IOR('p', 0x49, int) - -/* Read return values for a voltage status request. */ -#define ENVCTRL_VOLTAGE_POWERSUPPLY_GOOD	0x01 -#define ENVCTRL_VOLTAGE_BAD			0x02 -#define ENVCTRL_POWERSUPPLY_BAD			0x03 -#define ENVCTRL_VOLTAGE_POWERSUPPLY_BAD		0x04 - -/* Read return values for a fan status request. - * A failure match means either the fan fails or - * the fan is not connected.  Some boards have optional - * connectors to connect extra fans. - * - * There are maximum 8 monitor fans.  Some are cpu fans - * some are system fans.  The mask below only indicates - * fan by order number. - * Below is a sample application: - * - *	if (ioctl(fd, ENVCTRL_READ_FAN_STATUS, 0) < 0) { - *		printf("ioctl fan failed\n"); - *	} - *	if (read(fd, rslt, 1) <= 0) { - *		printf("error or fan not monitored\n"); - *	} else { - *		if (rslt[0] == ENVCTRL_ALL_FANS_GOOD) { - *			printf("all fans good\n"); - *	} else if (rslt[0] == ENVCTRL_ALL_FANS_BAD) { - *		printf("all fans bad\n"); - *	} else { - *		if (rslt[0] & ENVCTRL_FAN0_FAILURE_MASK) { - *			printf("fan 0 failed or not connected\n"); - *	} - *	...... - */ - -#define ENVCTRL_ALL_FANS_GOOD			0x00 -#define ENVCTRL_FAN0_FAILURE_MASK		0x01 -#define ENVCTRL_FAN1_FAILURE_MASK		0x02 -#define ENVCTRL_FAN2_FAILURE_MASK		0x04 -#define ENVCTRL_FAN3_FAILURE_MASK		0x08 -#define ENVCTRL_FAN4_FAILURE_MASK		0x10 -#define ENVCTRL_FAN5_FAILURE_MASK		0x20 -#define ENVCTRL_FAN6_FAILURE_MASK		0x40 -#define ENVCTRL_FAN7_FAILURE_MASK		0x80 -#define ENVCTRL_ALL_FANS_BAD 			0xFF - -#endif /* !(_SPARC64_ENVCTRL_H) */ diff --git a/arch/sparc/include/asm/errno.h b/arch/sparc/include/asm/errno.h deleted file mode 100644 index 4e2bc490d71..00000000000 --- a/arch/sparc/include/asm/errno.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef _SPARC_ERRNO_H -#define _SPARC_ERRNO_H - -/* These match the SunOS error numbering scheme. */ - -#include <asm-generic/errno-base.h> - -#define	EWOULDBLOCK	EAGAIN	/* Operation would block */ -#define	EINPROGRESS	36	/* Operation now in progress */ -#define	EALREADY	37	/* Operation already in progress */ -#define	ENOTSOCK	38	/* Socket operation on non-socket */ -#define	EDESTADDRREQ	39	/* Destination address required */ -#define	EMSGSIZE	40	/* Message too long */ -#define	EPROTOTYPE	41	/* Protocol wrong type for socket */ -#define	ENOPROTOOPT	42	/* Protocol not available */ -#define	EPROTONOSUPPORT	43	/* Protocol not supported */ -#define	ESOCKTNOSUPPORT	44	/* Socket type not supported */ -#define	EOPNOTSUPP	45	/* Op not supported on transport endpoint */ -#define	EPFNOSUPPORT	46	/* Protocol family not supported */ -#define	EAFNOSUPPORT	47	/* Address family not supported by protocol */ -#define	EADDRINUSE	48	/* Address already in use */ -#define	EADDRNOTAVAIL	49	/* Cannot assign requested address */ -#define	ENETDOWN	50	/* Network is down */ -#define	ENETUNREACH	51	/* Network is unreachable */ -#define	ENETRESET	52	/* Net dropped connection because of reset */ -#define	ECONNABORTED	53	/* Software caused connection abort */ -#define	ECONNRESET	54	/* Connection reset by peer */ -#define	ENOBUFS		55	/* No buffer space available */ -#define	EISCONN		56	/* Transport endpoint is already connected */ -#define	ENOTCONN	57	/* Transport endpoint is not connected */ -#define	ESHUTDOWN	58	/* No send after transport endpoint shutdown */ -#define	ETOOMANYREFS	59	/* Too many references: cannot splice */ -#define	ETIMEDOUT	60	/* Connection timed out */ -#define	ECONNREFUSED	61	/* Connection refused */ -#define	ELOOP		62	/* Too many symbolic links encountered */ -#define	ENAMETOOLONG	63	/* File name too long */ -#define	EHOSTDOWN	64	/* Host is down */ -#define	EHOSTUNREACH	65	/* No route to host */ -#define	ENOTEMPTY	66	/* Directory not empty */ -#define EPROCLIM        67      /* SUNOS: Too many processes */ -#define	EUSERS		68	/* Too many users */ -#define	EDQUOT		69	/* Quota exceeded */ -#define	ESTALE		70	/* Stale NFS file handle */ -#define	EREMOTE		71	/* Object is remote */ -#define	ENOSTR		72	/* Device not a stream */ -#define	ETIME		73	/* Timer expired */ -#define	ENOSR		74	/* Out of streams resources */ -#define	ENOMSG		75	/* No message of desired type */ -#define	EBADMSG		76	/* Not a data message */ -#define	EIDRM		77	/* Identifier removed */ -#define	EDEADLK		78	/* Resource deadlock would occur */ -#define	ENOLCK		79	/* No record locks available */ -#define	ENONET		80	/* Machine is not on the network */ -#define ERREMOTE        81      /* SunOS: Too many lvls of remote in path */ -#define	ENOLINK		82	/* Link has been severed */ -#define	EADV		83	/* Advertise error */ -#define	ESRMNT		84	/* Srmount error */ -#define	ECOMM		85      /* Communication error on send */ -#define	EPROTO		86	/* Protocol error */ -#define	EMULTIHOP	87	/* Multihop attempted */ -#define	EDOTDOT		88	/* RFS specific error */ -#define	EREMCHG		89	/* Remote address changed */ -#define	ENOSYS		90	/* Function not implemented */ - -/* The rest have no SunOS equivalent. */ -#define	ESTRPIPE	91	/* Streams pipe error */ -#define	EOVERFLOW	92	/* Value too large for defined data type */ -#define	EBADFD		93	/* File descriptor in bad state */ -#define	ECHRNG		94	/* Channel number out of range */ -#define	EL2NSYNC	95	/* Level 2 not synchronized */ -#define	EL3HLT		96	/* Level 3 halted */ -#define	EL3RST		97	/* Level 3 reset */ -#define	ELNRNG		98	/* Link number out of range */ -#define	EUNATCH		99	/* Protocol driver not attached */ -#define	ENOCSI		100	/* No CSI structure available */ -#define	EL2HLT		101	/* Level 2 halted */ -#define	EBADE		102	/* Invalid exchange */ -#define	EBADR		103	/* Invalid request descriptor */ -#define	EXFULL		104	/* Exchange full */ -#define	ENOANO		105	/* No anode */ -#define	EBADRQC		106	/* Invalid request code */ -#define	EBADSLT		107	/* Invalid slot */ -#define	EDEADLOCK	108	/* File locking deadlock error */ -#define	EBFONT		109	/* Bad font file format */ -#define	ELIBEXEC	110	/* Cannot exec a shared library directly */ -#define	ENODATA		111	/* No data available */ -#define	ELIBBAD		112	/* Accessing a corrupted shared library */ -#define	ENOPKG		113	/* Package not installed */ -#define	ELIBACC		114	/* Can not access a needed shared library */ -#define	ENOTUNIQ	115	/* Name not unique on network */ -#define	ERESTART	116	/* Interrupted syscall should be restarted */ -#define	EUCLEAN		117	/* Structure needs cleaning */ -#define	ENOTNAM		118	/* Not a XENIX named type file */ -#define	ENAVAIL		119	/* No XENIX semaphores available */ -#define	EISNAM		120	/* Is a named type file */ -#define	EREMOTEIO	121	/* Remote I/O error */ -#define	EILSEQ		122	/* Illegal byte sequence */ -#define	ELIBMAX		123	/* Atmpt to link in too many shared libs */ -#define	ELIBSCN		124	/* .lib section in a.out corrupted */ - -#define	ENOMEDIUM	125	/* No medium found */ -#define	EMEDIUMTYPE	126	/* Wrong medium type */ -#define	ECANCELED	127	/* Operation Cancelled */ -#define	ENOKEY		128	/* Required key not available */ -#define	EKEYEXPIRED	129	/* Key has expired */ -#define	EKEYREVOKED	130	/* Key has been revoked */ -#define	EKEYREJECTED	131	/* Key was rejected by service */ - -/* for robust mutexes */ -#define	EOWNERDEAD	132	/* Owner died */ -#define	ENOTRECOVERABLE	133	/* State not recoverable */ - -#define	ERFKILL		134	/* Operation not possible due to RF-kill */ - -#endif diff --git a/arch/sparc/include/asm/fbio.h b/arch/sparc/include/asm/fbio.h index 0a21da87f7d..1d9afe277e9 100644 --- a/arch/sparc/include/asm/fbio.h +++ b/arch/sparc/include/asm/fbio.h @@ -1,225 +1,10 @@  #ifndef __LINUX_FBIO_H  #define __LINUX_FBIO_H -#include <linux/compiler.h> -#include <linux/types.h> +#include <uapi/asm/fbio.h> -/* Constants used for fbio SunOS compatibility */ -/* (C) 1996 Miguel de Icaza */ - -/* Frame buffer types */ -#define FBTYPE_NOTYPE           -1 -#define FBTYPE_SUN1BW           0   /* mono */ -#define FBTYPE_SUN1COLOR        1  -#define FBTYPE_SUN2BW           2  -#define FBTYPE_SUN2COLOR        3  -#define FBTYPE_SUN2GP           4  -#define FBTYPE_SUN5COLOR        5  -#define FBTYPE_SUN3COLOR        6  -#define FBTYPE_MEMCOLOR         7  -#define FBTYPE_SUN4COLOR        8  -  -#define FBTYPE_NOTSUN1          9  -#define FBTYPE_NOTSUN2          10 -#define FBTYPE_NOTSUN3          11 -  -#define FBTYPE_SUNFAST_COLOR    12  /* cg6 */ -#define FBTYPE_SUNROP_COLOR     13 -#define FBTYPE_SUNFB_VIDEO      14 -#define FBTYPE_SUNGIFB          15 -#define FBTYPE_SUNGPLAS         16 -#define FBTYPE_SUNGP3           17 -#define FBTYPE_SUNGT            18 -#define FBTYPE_SUNLEO           19      /* zx Leo card */ -#define FBTYPE_MDICOLOR         20      /* cg14 */ -#define FBTYPE_TCXCOLOR		21	/* SUNW,tcx card */ - -#define FBTYPE_LASTPLUSONE      21	/* This is not last + 1 in fact... */ - -/* Does not seem to be listed in the Sun file either */ -#define FBTYPE_CREATOR          22 -#define FBTYPE_PCI_IGA1682	23 -#define FBTYPE_P9100COLOR	24 - -#define FBTYPE_PCI_GENERIC	1000 -#define FBTYPE_PCI_MACH64	1001 - -/* fbio ioctls */ -/* Returned by FBIOGTYPE */ -struct  fbtype { -        int     fb_type;        /* fb type, see above */ -        int     fb_height;      /* pixels */ -        int     fb_width;       /* pixels */ -        int     fb_depth; -        int     fb_cmsize;      /* color map entries */ -        int     fb_size;        /* fb size in bytes */ -}; -#define FBIOGTYPE _IOR('F', 0, struct fbtype) - -struct  fbcmap { -        int             index;          /* first element (0 origin) */ -        int             count; -        unsigned char   __user *red; -        unsigned char   __user *green; -        unsigned char   __user *blue; -}; - -#ifdef __KERNEL__  #define FBIOPUTCMAP_SPARC _IOW('F', 3, struct fbcmap)  #define FBIOGETCMAP_SPARC _IOW('F', 4, struct fbcmap) -#else -#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap) -#define FBIOGETCMAP _IOW('F', 4, struct fbcmap) -#endif - -/* # of device specific values */ -#define FB_ATTR_NDEVSPECIFIC    8 -/* # of possible emulations */ -#define FB_ATTR_NEMUTYPES       4 -  -struct fbsattr { -        int     flags; -        int     emu_type;	/* -1 if none */ -        int     dev_specific[FB_ATTR_NDEVSPECIFIC]; -}; -  -struct fbgattr { -        int     real_type;	/* real frame buffer type */ -        int     owner;		/* unknown */ -        struct fbtype fbtype;	/* real frame buffer fbtype */ -        struct fbsattr sattr;    -        int     emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */ -}; -#define FBIOSATTR  _IOW('F', 5, struct fbgattr) /* Unsupported: */ -#define FBIOGATTR  _IOR('F', 6, struct fbgattr)	/* supported */ - -#define FBIOSVIDEO _IOW('F', 7, int) -#define FBIOGVIDEO _IOR('F', 8, int) - -struct fbcursor { -        short set;              /* what to set, choose from the list above */ -        short enable;           /* cursor on/off */ -        struct fbcurpos pos;    /* cursor position */ -        struct fbcurpos hot;    /* cursor hot spot */ -        struct fbcmap cmap;     /* color map info */ -        struct fbcurpos size;   /* cursor bit map size */ -        char __user *image;     /* cursor image bits */ -        char __user *mask;      /* cursor mask bits */ -}; - -/* set/get cursor attributes/shape */ -#define FBIOSCURSOR     _IOW('F', 24, struct fbcursor) -#define FBIOGCURSOR     _IOWR('F', 25, struct fbcursor) -  -/* set/get cursor position */ -#define FBIOSCURPOS     _IOW('F', 26, struct fbcurpos) -#define FBIOGCURPOS     _IOW('F', 27, struct fbcurpos) -  -/* get max cursor size */ -#define FBIOGCURMAX     _IOR('F', 28, struct fbcurpos) - -/* wid manipulation */ -struct fb_wid_alloc { -#define FB_WID_SHARED_8		0 -#define FB_WID_SHARED_24	1 -#define FB_WID_DBL_8		2 -#define FB_WID_DBL_24		3 -	__u32	wa_type; -	__s32	wa_index;	/* Set on return */ -	__u32	wa_count;	 -}; -struct fb_wid_item { -	__u32	wi_type; -	__s32	wi_index; -	__u32	wi_attrs; -	__u32	wi_values[32]; -}; -struct fb_wid_list { -	__u32	wl_flags; -	__u32	wl_count; -	struct fb_wid_item	*wl_list; -}; - -#define FBIO_WID_ALLOC	_IOWR('F', 30, struct fb_wid_alloc) -#define FBIO_WID_FREE	_IOW('F', 31, struct fb_wid_alloc) -#define FBIO_WID_PUT	_IOW('F', 32, struct fb_wid_list) -#define FBIO_WID_GET	_IOWR('F', 33, struct fb_wid_list) - -/* Creator ioctls */ -#define FFB_IOCTL	('F'<<8) -#define FFB_SYS_INFO		(FFB_IOCTL|80) -#define FFB_CLUTREAD		(FFB_IOCTL|81) -#define FFB_CLUTPOST		(FFB_IOCTL|82) -#define FFB_SETDIAGMODE		(FFB_IOCTL|83) -#define FFB_GETMONITORID	(FFB_IOCTL|84) -#define FFB_GETVIDEOMODE	(FFB_IOCTL|85) -#define FFB_SETVIDEOMODE	(FFB_IOCTL|86) -#define FFB_SETSERVER		(FFB_IOCTL|87) -#define FFB_SETOVCTL		(FFB_IOCTL|88) -#define FFB_GETOVCTL		(FFB_IOCTL|89) -#define FFB_GETSAXNUM		(FFB_IOCTL|90) -#define FFB_FBDEBUG		(FFB_IOCTL|91) - -/* Cg14 ioctls */ -#define MDI_IOCTL          ('M'<<8) -#define MDI_RESET          (MDI_IOCTL|1) -#define MDI_GET_CFGINFO    (MDI_IOCTL|2) -#define MDI_SET_PIXELMODE  (MDI_IOCTL|3) -#    define MDI_32_PIX     32 -#    define MDI_16_PIX     16 -#    define MDI_8_PIX      8 - -struct mdi_cfginfo { -	int     mdi_ncluts;     /* Number of implemented CLUTs in this MDI */ -        int     mdi_type;       /* FBTYPE name */ -        int     mdi_height;     /* height */ -        int     mdi_width;      /* width */ -        int     mdi_size;       /* available ram */ -        int     mdi_mode;       /* 8bpp, 16bpp or 32bpp */ -        int     mdi_pixfreq;    /* pixel clock (from PROM) */ -}; - -/* SparcLinux specific ioctl for the MDI, should be replaced for - * the SET_XLUT/SET_CLUTn ioctls instead - */ -#define MDI_CLEAR_XLUT       (MDI_IOCTL|9) - -/* leo & ffb ioctls */ -struct fb_clut_alloc { -	__u32	clutid;	/* Set on return */ - 	__u32	flag; - 	__u32	index; -}; - -struct fb_clut { -#define FB_CLUT_WAIT	0x00000001	/* Not yet implemented */ - 	__u32	flag; - 	__u32	clutid; - 	__u32	offset; - 	__u32	count; - 	char *	red; - 	char *	green; - 	char *	blue; -}; - -struct fb_clut32 { - 	__u32	flag; - 	__u32	clutid; - 	__u32	offset; - 	__u32	count; - 	__u32	red; - 	__u32	green; - 	__u32	blue; -}; - -#define LEO_CLUTALLOC	_IOWR('L', 53, struct fb_clut_alloc) -#define LEO_CLUTFREE	_IOW('L', 54, struct fb_clut_alloc) -#define LEO_CLUTREAD	_IOW('L', 55, struct fb_clut) -#define LEO_CLUTPOST	_IOW('L', 56, struct fb_clut) -#define LEO_SETGAMMA	_IOW('L', 68, int) /* Not yet implemented */ -#define LEO_GETGAMMA	_IOR('L', 69, int) /* Not yet implemented */ - -#ifdef __KERNEL__  /* Addresses on the fd of a cgsix that are mappable */  #define CG6_FBC    0x70000000  #define CG6_TEC    0x70001000 @@ -260,47 +45,6 @@ struct fb_clut32 {  #define CG14_CLUT3       0x6000  /* Color Look Up Table */  #define CG14_AUTO	 0xf000 -#endif /* KERNEL */ - -/* These are exported to userland for applications to use */ -/* Mappable offsets for the cg14: control registers */ -#define MDI_DIRECT_MAP 0x10000000 -#define MDI_CTLREG_MAP 0x20000000 -#define MDI_CURSOR_MAP 0x30000000 -#define MDI_SHDW_VRT_MAP 0x40000000 - -/* Mappable offsets for the cg14: frame buffer resolutions */ -/* 32 bits */ -#define MDI_CHUNKY_XBGR_MAP 0x50000000 -#define MDI_CHUNKY_BGR_MAP 0x60000000 - -/* 16 bits */ -#define MDI_PLANAR_X16_MAP 0x70000000 -#define MDI_PLANAR_C16_MAP 0x80000000 - -/* 8 bit is done as CG3 MMAP offset */ -/* 32 bits, planar */ -#define MDI_PLANAR_X32_MAP 0x90000000 -#define MDI_PLANAR_B32_MAP 0xa0000000 -#define MDI_PLANAR_G32_MAP 0xb0000000 -#define MDI_PLANAR_R32_MAP 0xc0000000 - -/* Mappable offsets on leo */ -#define LEO_SS0_MAP            0x00000000 -#define LEO_LC_SS0_USR_MAP     0x00800000 -#define LEO_LD_SS0_MAP         0x00801000 -#define LEO_LX_CURSOR_MAP      0x00802000 -#define LEO_SS1_MAP            0x00803000 -#define LEO_LC_SS1_USR_MAP     0x01003000 -#define LEO_LD_SS1_MAP         0x01004000 -#define LEO_UNK_MAP            0x01005000 -#define LEO_LX_KRN_MAP         0x01006000 -#define LEO_LC_SS0_KRN_MAP     0x01007000 -#define LEO_LC_SS1_KRN_MAP     0x01008000 -#define LEO_LD_GBL_MAP         0x01009000 -#define LEO_UNK2_MAP           0x0100a000 - -#ifdef __KERNEL__  struct  fbcmap32 {  	int             index;          /* first element (0 origin) */  	int             count; @@ -325,6 +69,4 @@ struct fbcursor32 {  #define FBIOSCURSOR32	_IOW('F', 24, struct fbcursor32)  #define FBIOGCURSOR32	_IOW('F', 25, struct fbcursor32) -#endif -  #endif /* __LINUX_FBIO_H */ diff --git a/arch/sparc/include/asm/fcntl.h b/arch/sparc/include/asm/fcntl.h deleted file mode 100644 index 38f37b333cc..00000000000 --- a/arch/sparc/include/asm/fcntl.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _SPARC_FCNTL_H -#define _SPARC_FCNTL_H - -#define O_APPEND	0x0008 -#define FASYNC		0x0040	/* fcntl, for BSD compatibility */ -#define O_CREAT		0x0200	/* not fcntl */ -#define O_TRUNC		0x0400	/* not fcntl */ -#define O_EXCL		0x0800	/* not fcntl */ -#define O_DSYNC		0x2000	/* used to be O_SYNC, see below */ -#define O_NONBLOCK	0x4000 -#if defined(__sparc__) && defined(__arch64__) -#define O_NDELAY	0x0004 -#else -#define O_NDELAY	(0x0004 | O_NONBLOCK) -#endif -#define O_NOCTTY	0x8000	/* not fcntl */ -#define O_LARGEFILE	0x40000 -#define O_DIRECT        0x100000 /* direct disk access hint */ -#define O_NOATIME	0x200000 -#define O_CLOEXEC	0x400000 -/* - * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using - * the O_SYNC flag.  We continue to use the existing numerical value - * for O_DSYNC semantics now, but using the correct symbolic name for it. - * This new value is used to request true Posix O_SYNC semantics.  It is - * defined in this strange way to make sure applications compiled against - * new headers get at least O_DSYNC semantics on older kernels. - * - * This has the nice side-effect that we can simply test for O_DSYNC - * wherever we do not care if O_DSYNC or O_SYNC is used. - * - * Note: __O_SYNC must never be used directly. - */ -#define __O_SYNC	0x800000 -#define O_SYNC		(__O_SYNC|O_DSYNC) - -#define F_GETOWN	5	/*  for sockets. */ -#define F_SETOWN	6	/*  for sockets. */ -#define F_GETLK		7 -#define F_SETLK		8 -#define F_SETLKW	9 - -/* for posix fcntl() and lockf() */ -#define F_RDLCK		1 -#define F_WRLCK		2 -#define F_UNLCK		3 - -#define __ARCH_FLOCK_PAD	short __unused; -#define __ARCH_FLOCK64_PAD	short __unused; - -#include <asm-generic/fcntl.h> - -#endif diff --git a/arch/sparc/include/asm/fixmap.h b/arch/sparc/include/asm/fixmap.h deleted file mode 100644 index f18fc0755ad..00000000000 --- a/arch/sparc/include/asm/fixmap.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * fixmap.h: compile-time virtual memory allocation - * - * 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) 1998 Ingo Molnar - * - * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 - */ - -#ifndef _ASM_FIXMAP_H -#define _ASM_FIXMAP_H - -#include <linux/kernel.h> -#include <asm/page.h> -#ifdef CONFIG_HIGHMEM -#include <linux/threads.h> -#include <asm/kmap_types.h> -#endif - -/* - * Here we define all the compile-time 'special' virtual - * addresses. The point is to have a constant address at - * compile time, but to set the physical address only - * in the boot process. We allocate these special  addresses - * from the top of unused virtual memory (0xfd000000 - 1 page) backwards. - * Also this lets us do fail-safe vmalloc(), we - * can guarantee that these special addresses and - * vmalloc()-ed addresses never overlap. - * - * these 'compile-time allocated' memory buffers are - * fixed-size 4k pages. (or larger if used with an increment - * highger than 1) use fixmap_set(idx,phys) to associate - * physical memory with fixmap indices. - * - * TLB entries of such buffers will not be flushed across - * task switches. - */ - -/* - * on UP currently we will have no trace of the fixmap mechanism, - * no page table allocations, etc. This might change in the - * future, say framebuffers for the console driver(s) could be - * fix-mapped? - */ -enum fixed_addresses { -	FIX_HOLE, -#ifdef CONFIG_HIGHMEM -	FIX_KMAP_BEGIN, -	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, -#endif -	__end_of_fixed_addresses -}; - -extern void __set_fixmap (enum fixed_addresses idx, -					unsigned long phys, pgprot_t flags); - -#define set_fixmap(idx, phys) \ -		__set_fixmap(idx, phys, PAGE_KERNEL) -/* - * Some hardware wants to get fixmapped without caching. - */ -#define set_fixmap_nocache(idx, phys) \ -		__set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) -/* - * used by vmalloc.c. - * - * Leave one empty page between IO pages at 0xfd000000 and - * the start of the fixmap. - */ -#define FIXADDR_TOP	(0xfcfff000UL) -#define FIXADDR_SIZE	((__end_of_fixed_addresses) << PAGE_SHIFT) -#define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE) - -#define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist(void); - -/* - * 'index to address' translation. If anyone tries to use the idx - * directly without tranlation, we catch the bug with a NULL-deference - * kernel oops. Illegal ranges of incoming indices are caught too. - */ -static inline unsigned long fix_to_virt(const unsigned int idx) -{ -	/* -	 * this branch gets completely eliminated after inlining, -	 * except when someone tries to use fixaddr indices in an -	 * illegal way. (such as mixing up address types or using -	 * out-of-range indices). -	 * -	 * If it doesn't get removed, the linker will complain -	 * loudly with a reasonably clear error message.. -	 */ -	if (idx >= __end_of_fixed_addresses) -		__this_fixmap_does_not_exist(); - -        return __fix_to_virt(idx); -} - -static inline unsigned long virt_to_fix(const unsigned long vaddr) -{ -	BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); -	return __virt_to_fix(vaddr); -} - -#endif diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h index 86666f70322..071b83e52f1 100644 --- a/arch/sparc/include/asm/floppy_32.h +++ b/arch/sparc/include/asm/floppy_32.h @@ -9,13 +9,12 @@  #include <linux/of.h>  #include <linux/of_device.h> -#include <asm/page.h>  #include <asm/pgtable.h> -#include <asm/system.h>  #include <asm/idprom.h> -#include <asm/machines.h>  #include <asm/oplib.h>  #include <asm/auxio.h> +#include <asm/setup.h> +#include <asm/page.h>  #include <asm/irq.h>  /* We don't need no stinkin' I/O port allocation crap. */ @@ -51,7 +50,6 @@ struct sun_flpy_controller {  /* You'll only ever find one controller on a SparcStation anyways. */  static struct sun_flpy_controller *sun_fdc = NULL; -extern volatile unsigned char *fdc_status;  struct sun_floppy_ops {  	unsigned char (*fd_inb)(int port); @@ -104,25 +102,13 @@ static struct sun_floppy_ops sun_fdops;  /* Routines unique to each controller type on a Sun. */  static void sun_set_dor(unsigned char value, int fdc_82077)  { -	if (sparc_cpu_model == sun4c) { -		unsigned int bits = 0; -		if (value & 0x10) -			bits |= AUXIO_FLPY_DSEL; -		if ((value & 0x80) == 0) -			bits |= AUXIO_FLPY_EJCT; -		set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT)); -	} -	if (fdc_82077) { +	if (fdc_82077)  		sun_fdc->dor_82077 = value; -	}  }  static unsigned char sun_read_dir(void)  { -	if (sparc_cpu_model == sun4c) -		return (get_auxio() & AUXIO_FLPY_DCHG) ? 0x80 : 0; -	else -		return sun_fdc->dir_82077; +	return sun_fdc->dir_82077;  }  static unsigned char sun_82072_fd_inb(int port) @@ -138,7 +124,7 @@ static unsigned char sun_82072_fd_inb(int port)  		return sun_fdc->data_82072;  	case 7: /* FD_DIR */  		return sun_read_dir(); -	}; +	}  	panic("sun_82072_fd_inb: How did I get here?");  } @@ -161,7 +147,7 @@ static void sun_82072_fd_outb(unsigned char value, int port)  	case 4: /* FD_STATUS */  		sun_fdc->status_82072 = value;  		break; -	}; +	}  	return;  } @@ -186,7 +172,7 @@ static unsigned char sun_82077_fd_inb(int port)  		return sun_fdc->data_82077;  	case 7: /* FD_DIR */  		return sun_read_dir(); -	}; +	}  	panic("sun_82077_fd_inb: How did I get here?");  } @@ -212,7 +198,7 @@ static void sun_82077_fd_outb(unsigned char value, int port)  	case 3: /* FD_TDR */  		sun_fdc->tapectl_82077 = value;  		break; -	}; +	}  	return;  } @@ -226,13 +212,6 @@ static void sun_82077_fd_outb(unsigned char value, int port)   * underruns.  If non-zero, doing_pdma encodes the direction of   * the transfer for debugging.  1=read 2=write   */ -extern char *pdma_vaddr; -extern unsigned long pdma_size; -extern volatile int doing_pdma; - -/* This is software state */ -extern char *pdma_base; -extern unsigned long pdma_areasize;  /* Common routines to all controller types on the Sparc. */  static inline void virtual_dma_init(void) @@ -243,10 +222,7 @@ static inline void virtual_dma_init(void)  static inline void sun_fd_disable_dma(void)  {  	doing_pdma = 0; -	if (pdma_base) { -		mmu_unlockarea(pdma_base, pdma_areasize); -		pdma_base = NULL; -	} +	pdma_base = NULL;  }  static inline void sun_fd_set_dma_mode(int mode) @@ -276,66 +252,60 @@ static inline void sun_fd_set_dma_count(int length)  static inline void sun_fd_enable_dma(void)  { -	pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);  	pdma_base = pdma_vaddr;  	pdma_areasize = pdma_size;  } -/* Our low-level entry point in arch/sparc/kernel/entry.S */ -extern int sparc_floppy_request_irq(int irq, unsigned long flags, -				    irq_handler_t irq_handler); +int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler);  static int sun_fd_request_irq(void)  {  	static int once = 0; -	int error; -	if(!once) { +	if (!once) {  		once = 1; -		error = sparc_floppy_request_irq(FLOPPY_IRQ, -						 IRQF_DISABLED, -						 floppy_interrupt); -		return ((error == 0) ? 0 : -1); -	} else return 0; +		return sparc_floppy_request_irq(FLOPPY_IRQ, floppy_interrupt); +	} else { +		return 0; +	}  }  static struct linux_prom_registers fd_regs[2];  static int sun_floppy_init(void)  { +	struct platform_device *op; +	struct device_node *dp; +	struct resource r;  	char state[128]; -	phandle tnode, fd_node; +	phandle fd_node; +	phandle tnode;  	int num_regs; -	struct resource r;  	use_virtual_dma = 1; -	FLOPPY_IRQ = 11;  	/* Forget it if we aren't on a machine that could possibly  	 * ever have a floppy drive.  	 */ -	if((sparc_cpu_model != sun4c && sparc_cpu_model != sun4m) || -	   ((idprom->id_machtype == (SM_SUN4C | SM_4C_SLC)) || -	    (idprom->id_machtype == (SM_SUN4C | SM_4C_ELC)))) { +	if (sparc_cpu_model != sun4m) {  		/* We certainly don't have a floppy controller. */  		goto no_sun_fdc;  	}  	/* Well, try to find one. */  	tnode = prom_getchild(prom_root_node);  	fd_node = prom_searchsiblings(tnode, "obio"); -	if(fd_node != 0) { +	if (fd_node != 0) {  		tnode = prom_getchild(fd_node);  		fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo");  	} else {  		fd_node = prom_searchsiblings(tnode, "fd");  	} -	if(fd_node == 0) { +	if (fd_node == 0) {  		goto no_sun_fdc;  	}  	/* The sun4m lets us know if the controller is actually usable. */ -	if(sparc_cpu_model == sun4m && -	   prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) { +	if (prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {  		if(!strcmp(state, "disabled")) {  			goto no_sun_fdc;  		} @@ -346,11 +316,31 @@ static int sun_floppy_init(void)  	memset(&r, 0, sizeof(r));  	r.flags = fd_regs[0].which_io;  	r.start = fd_regs[0].phys_addr; -	sun_fdc = (struct sun_flpy_controller *) -	    of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy"); +	sun_fdc = of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy"); + +	/* Look up irq in platform_device. +	 * We try "SUNW,fdtwo" and "fd" +	 */ +	op = NULL; +	for_each_node_by_name(dp, "SUNW,fdtwo") { +		op = of_find_device_by_node(dp); +		if (op) +			break; +	} +	if (!op) { +		for_each_node_by_name(dp, "fd") { +			op = of_find_device_by_node(dp); +			if (op) +				break; +		} +	} +	if (!op) +		goto no_sun_fdc; + +	FLOPPY_IRQ = op->archdata.irqs[0];  	/* Last minute sanity check... */ -	if(sun_fdc->status_82072 == 0xff) { +	if (sun_fdc->status_82072 == 0xff) {  		sun_fdc = NULL;  		goto no_sun_fdc;  	} diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h index 6597ce874d7..625756406a7 100644 --- a/arch/sparc/include/asm/floppy_64.h +++ b/arch/sparc/include/asm/floppy_64.h @@ -111,7 +111,7 @@ static unsigned char sun_82077_fd_inb(unsigned long port)  	case 7: /* FD_DIR */  		/* XXX: Is DCL on 0x80 in sun4m? */  		return sbus_readb(&sun_fdc->dir_82077); -	}; +	}  	panic("sun_82072_fd_inb: How did I get here?");  } @@ -135,7 +135,7 @@ static void sun_82077_fd_outb(unsigned char value, unsigned long port)  	case 4: /* FD_STATUS */  		sbus_writeb(value, &sun_fdc->status_82077);  		break; -	}; +	}  	return;  } @@ -161,10 +161,7 @@ unsigned long pdma_areasize;  static void sun_fd_disable_dma(void)  {  	doing_pdma = 0; -	if (pdma_base) { -		mmu_unlockarea(pdma_base, pdma_areasize); -		pdma_base = NULL; -	} +	pdma_base = NULL;  }  static void sun_fd_set_dma_mode(int mode) @@ -194,7 +191,6 @@ static void sun_fd_set_dma_count(int length)  static void sun_fd_enable_dma(void)  { -	pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);  	pdma_base = pdma_vaddr;  	pdma_areasize = pdma_size;  } @@ -258,7 +254,7 @@ static int sun_fd_request_irq(void)  		once = 1;  		error = request_irq(FLOPPY_IRQ, sparc_floppy_irq, -				    IRQF_DISABLED, "floppy", NULL); +				    0, "floppy", NULL);  		return ((error == 0) ? 0 : -1);  	} @@ -300,7 +296,7 @@ struct sun_pci_dma_op {  static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL};  static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL}; -extern irqreturn_t floppy_interrupt(int irq, void *dev_id); +irqreturn_t floppy_interrupt(int irq, void *dev_id);  static unsigned char sun_pci_fd_inb(unsigned long port)  { diff --git a/arch/sparc/include/asm/ftrace.h b/arch/sparc/include/asm/ftrace.h index b0f18e9893d..9ec94ad116f 100644 --- a/arch/sparc/include/asm/ftrace.h +++ b/arch/sparc/include/asm/ftrace.h @@ -6,7 +6,7 @@  #define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */  #ifndef __ASSEMBLY__ -extern void _mcount(void); +void _mcount(void);  #endif  #endif @@ -22,4 +22,8 @@ struct dyn_arch_ftrace {  };  #endif /*  CONFIG_DYNAMIC_FTRACE */ +unsigned long prepare_ftrace_return(unsigned long parent, +				    unsigned long self_addr, +				    unsigned long frame_pointer); +  #endif /* _ASM_SPARC64_FTRACE */ diff --git a/arch/sparc/include/asm/futex_64.h b/arch/sparc/include/asm/futex_64.h index 47f95839dc6..4e899b0dabf 100644 --- a/arch/sparc/include/asm/futex_64.h +++ b/arch/sparc/include/asm/futex_64.h @@ -4,7 +4,6 @@  #include <linux/futex.h>  #include <linux/uaccess.h>  #include <asm/errno.h> -#include <asm/system.h>  #define __futex_cas_op(insn, ret, oldval, uaddr, oparg)	\  	__asm__ __volatile__(				\ @@ -30,7 +29,7 @@  	: "r" (uaddr), "r" (oparg), "i" (-EFAULT)	\  	: "memory") -static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) +static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)  {  	int op = (encoded_op >> 28) & 7;  	int cmp = (encoded_op >> 24) & 15; @@ -38,7 +37,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)  	int cmparg = (encoded_op << 20) >> 20;  	int oldval = 0, ret, tem; -	if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))) +	if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))))  		return -EFAULT;  	if (unlikely((((unsigned long) uaddr) & 0x3UL)))  		return -EINVAL; @@ -85,26 +84,30 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)  }  static inline int -futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) +futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, +			      u32 oldval, u32 newval)  { +	int ret = 0; +  	__asm__ __volatile__( -	"\n1:	casa	[%3] %%asi, %2, %0\n" +	"\n1:	casa	[%4] %%asi, %3, %1\n"  	"2:\n"  	"	.section .fixup,#alloc,#execinstr\n"  	"	.align	4\n"  	"3:	sethi	%%hi(2b), %0\n"  	"	jmpl	%0 + %%lo(2b), %%g0\n" -	"	 mov	%4, %0\n" +	"	mov	%5, %0\n"  	"	.previous\n"  	"	.section __ex_table,\"a\"\n"  	"	.align	4\n"  	"	.word	1b, 3b\n"  	"	.previous\n" -	: "=r" (newval) -	: "0" (newval), "r" (oldval), "r" (uaddr), "i" (-EFAULT) +	: "+r" (ret), "=r" (newval) +	: "1" (newval), "r" (oldval), "r" (uaddr), "i" (-EFAULT)  	: "memory"); -	return newval; +	*uval = newval; +	return ret;  }  #endif /* !(_SPARC64_FUTEX_H) */ diff --git a/arch/sparc/include/asm/gpio.h b/arch/sparc/include/asm/gpio.h index a0e3ac0af59..b3799d88ffc 100644 --- a/arch/sparc/include/asm/gpio.h +++ b/arch/sparc/include/asm/gpio.h @@ -1,36 +1,4 @@ -#ifndef __ASM_SPARC_GPIO_H -#define __ASM_SPARC_GPIO_H - -#include <linux/errno.h> -#include <asm-generic/gpio.h> - -#ifdef CONFIG_GPIOLIB - -static inline int gpio_get_value(unsigned int gpio) -{ -	return __gpio_get_value(gpio); -} - -static inline void gpio_set_value(unsigned int gpio, int value) -{ -	__gpio_set_value(gpio, value); -} - -static inline int gpio_cansleep(unsigned int gpio) -{ -	return __gpio_cansleep(gpio); -} - -static inline int gpio_to_irq(unsigned int gpio) -{ -	return -ENOSYS; -} - -static inline int irq_to_gpio(unsigned int irq) -{ -	return -EINVAL; -} - -#endif /* CONFIG_GPIOLIB */ - -#endif /* __ASM_SPARC_GPIO_H */ +#ifndef __LINUX_GPIO_H +#warning Include linux/gpio.h instead of asm/gpio.h +#include <linux/gpio.h> +#endif diff --git a/arch/sparc/include/asm/hardirq_32.h b/arch/sparc/include/asm/hardirq_32.h index 162007643cd..ee93923b7f8 100644 --- a/arch/sparc/include/asm/hardirq_32.h +++ b/arch/sparc/include/asm/hardirq_32.h @@ -7,7 +7,6 @@  #ifndef __SPARC_HARDIRQ_H  #define __SPARC_HARDIRQ_H -#define HARDIRQ_BITS    8  #include <asm-generic/hardirq.h>  #endif /* __SPARC_HARDIRQ_H */ diff --git a/arch/sparc/include/asm/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h index 7c29fd1a87a..f478ff1ddd0 100644 --- a/arch/sparc/include/asm/hardirq_64.h +++ b/arch/sparc/include/asm/hardirq_64.h @@ -14,6 +14,4 @@  void ack_bad_irq(unsigned int irq); -#define HARDIRQ_BITS	8 -  #endif /* !(__SPARC64_HARDIRQ_H) */ diff --git a/arch/sparc/include/asm/head_32.h b/arch/sparc/include/asm/head_32.h index 7c35491a8b5..5f1dbe315bc 100644 --- a/arch/sparc/include/asm/head_32.h +++ b/arch/sparc/include/asm/head_32.h @@ -2,15 +2,8 @@  #define __SPARC_HEAD_H  #define KERNBASE        0xf0000000  /* First address the kernel will eventually be */ -#define LOAD_ADDR       0x4000      /* prom jumps to us here unless this is elf /boot */ -#define SUN4C_SEGSZ     (1 << 18) -#define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2)  /* Used in boot remapping. */ -#define INTS_ENAB        0x01           /* entry.S uses this. */ - -#define SUN4_PROM_VECTOR 0xFFE81000     /* SUN4 PROM needs to be hardwired */  #define WRITE_PAUSE      nop; nop; nop; /* Have to do this after %wim/%psr chg */ -#define NOP_INSN         0x01000000     /* Used to patch sparc_save_state */  /* Here are some trap goodies */ @@ -18,9 +11,7 @@  #define TRAP_ENTRY(type, label) \  	rd %psr, %l0; b label; rd %wim, %l3; nop; -/* Data/text faults. Defaults to sun4c version at boot time. */ -#define SPARC_TFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 1, %l7; -#define SPARC_DFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 0, %l7; +/* Data/text faults */  #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7;  #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7; @@ -64,15 +55,15 @@  /* The Get Condition Codes software trap for userland. */  #define GETCC_TRAP \ -        b getcc_trap_handler; mov %psr, %l0; nop; nop; +        b getcc_trap_handler; rd %psr, %l0; nop; nop;  /* The Set Condition Codes software trap for userland. */  #define SETCC_TRAP \ -        b setcc_trap_handler; mov %psr, %l0; nop; nop; +        b setcc_trap_handler; rd %psr, %l0; nop; nop;  /* The Get PSR software trap for userland. */  #define GETPSR_TRAP \ -	mov %psr, %i0; jmp %l2; rett %l2 + 4; nop; +	rd %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. @@ -80,16 +71,6 @@  #define TRAP_ENTRY_INTERRUPT(int_level) \          mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3; -/* NMI's (Non Maskable Interrupts) are special, you can't keep them - * from coming in, and basically if you get one, the shows over. ;( - * On the sun4c they are usually asynchronous memory errors, on the - * the sun4m they could be either due to mem errors or a software - * initiated interrupt from the prom/kern on an SMP box saying "I - * command you to do CPU tricks, read your mailbox for more info." - */ -#define NMI_TRAP \ -        rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop; -  /* Window overflows/underflows are special and we need to try to be as   * efficient as possible here....   */ diff --git a/arch/sparc/include/asm/hibernate.h b/arch/sparc/include/asm/hibernate.h new file mode 100644 index 00000000000..2ec34f84224 --- /dev/null +++ b/arch/sparc/include/asm/hibernate.h @@ -0,0 +1,23 @@ +/* + * hibernate.h:  Hibernaton support specific for sparc64. + * + * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru) + */ + +#ifndef ___SPARC_HIBERNATE_H +#define ___SPARC_HIBERNATE_H + +struct saved_context { +	unsigned long fp; +	unsigned long cwp; +	unsigned long wstate; + +	unsigned long tick; +	unsigned long pstate; + +	unsigned long g4; +	unsigned long g5; +	unsigned long g6; +}; + +#endif diff --git a/arch/sparc/include/asm/highmem.h b/arch/sparc/include/asm/highmem.h index 3d7afbb7f4b..92ded294a4e 100644 --- a/arch/sparc/include/asm/highmem.h +++ b/arch/sparc/include/asm/highmem.h @@ -21,7 +21,6 @@  #ifdef __KERNEL__  #include <linux/interrupt.h> -#include <asm/fixmap.h>  #include <asm/vaddrs.h>  #include <asm/kmap_types.h>  #include <asm/pgtable.h> @@ -29,11 +28,10 @@  /* declarations for highmem.c */  extern unsigned long highstart_pfn, highend_pfn; -extern pte_t *kmap_pte;  extern pgprot_t kmap_prot;  extern pte_t *pkmap_page_table; -extern void kmap_init(void) __init; +void kmap_init(void) __init;  /*   * Right now we initialize only a single pte table. It can be extended @@ -51,8 +49,8 @@ extern void kmap_init(void) __init;  #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP)) -extern void *kmap_high(struct page *page); -extern void kunmap_high(struct page *page); +void *kmap_high(struct page *page); +void kunmap_high(struct page *page);  static inline void *kmap(struct page *page)  { @@ -70,9 +68,8 @@ static inline void kunmap(struct page *page)  	kunmap_high(page);  } -extern void *__kmap_atomic(struct page *page); -extern void __kunmap_atomic(void *kvaddr); -extern struct page *kmap_atomic_to_page(void *vaddr); +void *kmap_atomic(struct page *page); +void __kunmap_atomic(void *kvaddr);  #define flush_cache_kmaps()	flush_cache_all() diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 177061064ee..e4cab465b81 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -2,6 +2,7 @@  #define _ASM_SPARC64_HUGETLB_H  #include <asm/page.h> +#include <asm-generic/hugetlb.h>  void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, @@ -10,7 +11,9 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,  pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,  			      pte_t *ptep); -void hugetlb_prefault_arch_hook(struct mm_struct *mm); +static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) +{ +}  static inline int is_hugepage_only_range(struct mm_struct *mm,  					 unsigned long addr, @@ -58,14 +61,20 @@ static inline pte_t huge_pte_wrprotect(pte_t pte)  static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,  					   unsigned long addr, pte_t *ptep)  { -	ptep_set_wrprotect(mm, addr, ptep); +	pte_t old_pte = *ptep; +	set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));  }  static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,  					     unsigned long addr, pte_t *ptep,  					     pte_t pte, int dirty)  { -	return ptep_set_access_flags(vma, addr, ptep, pte, dirty); +	int changed = !pte_same(*ptep, pte); +	if (changed) { +		set_huge_pte_at(vma->vm_mm, addr, ptep, pte); +		flush_tlb_page(vma, addr); +	} +	return changed;  }  static inline pte_t huge_ptep_get(pte_t *ptep) @@ -82,4 +91,8 @@ static inline void arch_release_hugepage(struct page *page)  {  } +static inline void arch_clear_hugepage_flags(struct page *page) +{ +} +  #endif /* _ASM_SPARC64_HUGETLB_H */ diff --git a/arch/sparc/include/asm/hvtramp.h b/arch/sparc/include/asm/hvtramp.h index b2b9b947b3a..04b56f862bb 100644 --- a/arch/sparc/include/asm/hvtramp.h +++ b/arch/sparc/include/asm/hvtramp.h @@ -19,7 +19,7 @@ struct hvtramp_descr {  	struct hvtramp_mapping	maps[1];  }; -extern void hv_cpu_startup(unsigned long hvdescr_pa); +void hv_cpu_startup(unsigned long hvdescr_pa);  #endif diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index bafe5a631b6..94b39caea3e 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h @@ -98,7 +98,7 @@  #define HV_FAST_MACH_EXIT		0x00  #ifndef __ASSEMBLY__ -extern void sun4v_mach_exit(unsigned long exit_code); +void sun4v_mach_exit(unsigned long exit_code);  #endif  /* Domain services.  */ @@ -127,9 +127,9 @@ extern void sun4v_mach_exit(unsigned long exit_code);  #define HV_FAST_MACH_DESC		0x01  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, -				     unsigned long buf_len, -				     unsigned long *real_buf_len); +unsigned long sun4v_mach_desc(unsigned long buffer_pa, +			      unsigned long buf_len, +			      unsigned long *real_buf_len);  #endif  /* mach_sir() @@ -148,7 +148,7 @@ extern unsigned long sun4v_mach_desc(unsigned long buffer_pa,  #define HV_FAST_MACH_SIR		0x02  #ifndef __ASSEMBLY__ -extern void sun4v_mach_sir(void); +void sun4v_mach_sir(void);  #endif  /* mach_set_watchdog() @@ -204,8 +204,8 @@ extern void sun4v_mach_sir(void);  #define HV_FAST_MACH_SET_WATCHDOG	0x05  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout, -					     unsigned long *orig_timeout); +unsigned long sun4v_mach_set_watchdog(unsigned long timeout, +				      unsigned long *orig_timeout);  #endif  /* CPU services. @@ -250,10 +250,10 @@ extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout,  #define HV_FAST_CPU_START		0x10  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_cpu_start(unsigned long cpuid, -				     unsigned long pc, -				     unsigned long rtba, -				     unsigned long arg0); +unsigned long sun4v_cpu_start(unsigned long cpuid, +			      unsigned long pc, +			      unsigned long rtba, +			      unsigned long arg0);  #endif  /* cpu_stop() @@ -278,7 +278,7 @@ extern unsigned long sun4v_cpu_start(unsigned long cpuid,  #define HV_FAST_CPU_STOP		0x11  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_cpu_stop(unsigned long cpuid); +unsigned long sun4v_cpu_stop(unsigned long cpuid);  #endif  /* cpu_yield() @@ -295,7 +295,7 @@ extern unsigned long sun4v_cpu_stop(unsigned long cpuid);  #define HV_FAST_CPU_YIELD		0x12  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_cpu_yield(void); +unsigned long sun4v_cpu_yield(void);  #endif  /* cpu_qconf() @@ -341,9 +341,9 @@ extern unsigned long sun4v_cpu_yield(void);  #define  HV_CPU_QUEUE_NONRES_ERROR	 0x3f  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_cpu_qconf(unsigned long type, -				     unsigned long queue_paddr, -				     unsigned long num_queue_entries); +unsigned long sun4v_cpu_qconf(unsigned long type, +			      unsigned long queue_paddr, +			      unsigned long num_queue_entries);  #endif  /* cpu_qinfo() @@ -394,7 +394,9 @@ extern unsigned long sun4v_cpu_qconf(unsigned long type,  #define HV_FAST_CPU_MONDO_SEND		0x42  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long cpu_list_pa, unsigned long mondo_block_pa); +unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, +				   unsigned long cpu_list_pa, +				   unsigned long mondo_block_pa);  #endif  /* cpu_myid() @@ -425,7 +427,7 @@ extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long  #define  HV_CPU_STATE_ERROR		 0x03  #ifndef __ASSEMBLY__ -extern long sun4v_cpu_state(unsigned long cpuid); +long sun4v_cpu_state(unsigned long cpuid);  #endif  /* cpu_set_rtba() @@ -625,8 +627,8 @@ struct hv_fault_status {  #define HV_FAST_MMU_TSB_CTX0		0x20  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, -					unsigned long tsb_desc_ra); +unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, +				 unsigned long tsb_desc_ra);  #endif  /* mmu_tsb_ctxnon0() @@ -654,7 +656,7 @@ extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,   * ARG3:	mmu context   * ARG4:	flags (HV_MMU_{IMMU,DMMU})   * RET0:	status - * ERRORS:	EINVAL			Invalid virutal address, context, or + * ERRORS:	EINVAL			Invalid virtual address, context, or   *					flags value   *		ENOTSUPPORTED		ARG0 or ARG1 is non-zero   * @@ -710,7 +712,7 @@ extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,  #define HV_FAST_MMU_DEMAP_ALL		0x24  #ifndef __ASSEMBLY__ -extern void sun4v_mmu_demap_all(void); +void sun4v_mmu_demap_all(void);  #endif  /* mmu_map_perm_addr() @@ -721,7 +723,7 @@ extern void sun4v_mmu_demap_all(void);   * ARG2:	TTE   * ARG3:	flags (HV_MMU_{IMMU,DMMU})   * RET0:	status - * ERRORS:	EINVAL			Invalid virutal address or flags value + * ERRORS:	EINVAL			Invalid virtual address or flags value   *		EBADPGSZ		Invalid page size value   *		ENORADDR		Invalid real address in TTE   *		ETOOMANY		Too many mappings (max of 8 reached) @@ -740,10 +742,10 @@ extern void sun4v_mmu_demap_all(void);  #define HV_FAST_MMU_MAP_PERM_ADDR	0x25  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, -					     unsigned long set_to_zero, -					     unsigned long tte, -					     unsigned long flags); +unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, +				      unsigned long set_to_zero, +				      unsigned long tte, +				      unsigned long flags);  #endif  /* mmu_fault_area_conf() @@ -800,7 +802,7 @@ extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr,   * ARG1:	reserved, must be zero   * ARG2:	flags (HV_MMU_{IMMU,DMMU})   * RET0:	status - * ERRORS:	EINVAL			Invalid virutal address or flags value + * ERRORS:	EINVAL			Invalid virtual address or flags value   *		ENOMAP			Specified mapping was not found   *   * Demaps any permanent page mapping (established via @@ -945,7 +947,7 @@ extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr,  #define HV_FAST_TOD_GET			0x50  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_tod_get(unsigned long *time); +unsigned long sun4v_tod_get(unsigned long *time);  #endif  /* tod_set() @@ -962,7 +964,7 @@ extern unsigned long sun4v_tod_get(unsigned long *time);  #define HV_FAST_TOD_SET			0x51  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_tod_set(unsigned long time); +unsigned long sun4v_tod_set(unsigned long time);  #endif  /* Console services */ @@ -1038,14 +1040,14 @@ extern unsigned long sun4v_tod_set(unsigned long time);  #define HV_FAST_CONS_WRITE		0x63  #ifndef __ASSEMBLY__ -extern long sun4v_con_getchar(long *status); -extern long sun4v_con_putchar(long c); -extern long sun4v_con_read(unsigned long buffer, -			   unsigned long size, -			   unsigned long *bytes_read); -extern unsigned long sun4v_con_write(unsigned long buffer, -				     unsigned long size, -				     unsigned long *bytes_written); +long sun4v_con_getchar(long *status); +long sun4v_con_putchar(long c); +long sun4v_con_read(unsigned long buffer, +		    unsigned long size, +		    unsigned long *bytes_read); +unsigned long sun4v_con_write(unsigned long buffer, +			      unsigned long size, +			      unsigned long *bytes_written);  #endif  /* mach_set_soft_state() @@ -1080,8 +1082,8 @@ extern unsigned long sun4v_con_write(unsigned long buffer,  #define  HV_SOFT_STATE_TRANSITION	 0x02  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, -					       unsigned long msg_string_ra); +unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, +				        unsigned long msg_string_ra);  #endif  /* mach_get_soft_state() @@ -1159,20 +1161,20 @@ extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state,  #define HV_FAST_SVC_CLRSTATUS		0x84  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_svc_send(unsigned long svc_id, -				    unsigned long buffer, -				    unsigned long buffer_size, -				    unsigned long *sent_bytes); -extern unsigned long sun4v_svc_recv(unsigned long svc_id, -				    unsigned long buffer, -				    unsigned long buffer_size, -				    unsigned long *recv_bytes); -extern unsigned long sun4v_svc_getstatus(unsigned long svc_id, -					 unsigned long *status_bits); -extern unsigned long sun4v_svc_setstatus(unsigned long svc_id, -					 unsigned long status_bits); -extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id, -					 unsigned long status_bits); +unsigned long sun4v_svc_send(unsigned long svc_id, +			     unsigned long buffer, +			     unsigned long buffer_size, +			     unsigned long *sent_bytes); +unsigned long sun4v_svc_recv(unsigned long svc_id, +			     unsigned long buffer, +			     unsigned long buffer_size, +			     unsigned long *recv_bytes); +unsigned long sun4v_svc_getstatus(unsigned long svc_id, +				  unsigned long *status_bits); +unsigned long sun4v_svc_setstatus(unsigned long svc_id, +				  unsigned long status_bits); +unsigned long sun4v_svc_clrstatus(unsigned long svc_id, +				  unsigned long status_bits);  #endif  /* Trap trace services. @@ -1205,7 +1207,7 @@ struct hv_trap_trace_control {   * structure contents.  Attempts to do so will result in undefined   * behavior for the guest.   * - * Each trap trace buffer entry is layed out as follows: + * Each trap trace buffer entry is laid out as follows:   */  #ifndef __ASSEMBLY__  struct hv_trap_trace_entry { @@ -1300,7 +1302,7 @@ struct hv_trap_trace_entry {   * state in RET1.  Future systems may define various flags for the   * enable argument (ARG0), for the moment a guest should pass   * "(uint64_t) -1" to enable, and "(uint64_t) 0" to disable all - * tracing - which will ensure future compatability. + * tracing - which will ensure future compatibility.   */  #define HV_FAST_TTRACE_ENABLE		0x92 @@ -1458,8 +1460,8 @@ struct hv_trap_trace_entry {  #define HV_FAST_INTR_DEVINO2SYSINO	0xa0  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle, -					    unsigned long devino); +unsigned long sun4v_devino_to_sysino(unsigned long devhandle, +				     unsigned long devino);  #endif  /* intr_getenabled() @@ -1476,7 +1478,7 @@ extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle,  #define HV_FAST_INTR_GETENABLED		0xa1  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_intr_getenabled(unsigned long sysino); +unsigned long sun4v_intr_getenabled(unsigned long sysino);  #endif  /* intr_setenabled() @@ -1492,7 +1494,8 @@ extern unsigned long sun4v_intr_getenabled(unsigned long sysino);  #define HV_FAST_INTR_SETENABLED		0xa2  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long intr_enabled); +unsigned long sun4v_intr_setenabled(unsigned long sysino, +				    unsigned long intr_enabled);  #endif  /* intr_getstate() @@ -1508,7 +1511,7 @@ extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long i  #define HV_FAST_INTR_GETSTATE		0xa3  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_intr_getstate(unsigned long sysino); +unsigned long sun4v_intr_getstate(unsigned long sysino);  #endif  /* intr_setstate() @@ -1528,7 +1531,7 @@ extern unsigned long sun4v_intr_getstate(unsigned long sysino);  #define HV_FAST_INTR_SETSTATE		0xa4  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state); +unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state);  #endif  /* intr_gettarget() @@ -1546,7 +1549,7 @@ extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long int  #define HV_FAST_INTR_GETTARGET		0xa5  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_intr_gettarget(unsigned long sysino); +unsigned long sun4v_intr_gettarget(unsigned long sysino);  #endif  /* intr_settarget() @@ -1563,7 +1566,7 @@ extern unsigned long sun4v_intr_gettarget(unsigned long sysino);  #define HV_FAST_INTR_SETTARGET		0xa6  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); +unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid);  #endif  /* vintr_get_cookie() @@ -1647,30 +1650,30 @@ extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cp  #define HV_FAST_VINTR_SET_TARGET	0xae  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, -					    unsigned long dev_ino, -					    unsigned long *cookie); -extern unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, -					    unsigned long dev_ino, -					    unsigned long cookie); -extern unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, -					   unsigned long dev_ino, -					   unsigned long *valid); -extern unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, -					   unsigned long dev_ino, -					   unsigned long valid); -extern unsigned long sun4v_vintr_get_state(unsigned long dev_handle, -					   unsigned long dev_ino, -					   unsigned long *state); -extern unsigned long sun4v_vintr_set_state(unsigned long dev_handle, -					   unsigned long dev_ino, -					   unsigned long state); -extern unsigned long sun4v_vintr_get_target(unsigned long dev_handle, -					    unsigned long dev_ino, -					    unsigned long *cpuid); -extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle, -					    unsigned long dev_ino, -					    unsigned long cpuid); +unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, +				     unsigned long dev_ino, +				     unsigned long *cookie); +unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, +				     unsigned long dev_ino, +				     unsigned long cookie); +unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, +				    unsigned long dev_ino, +				    unsigned long *valid); +unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, +				    unsigned long dev_ino, +				    unsigned long valid); +unsigned long sun4v_vintr_get_state(unsigned long dev_handle, +				    unsigned long dev_ino, +				    unsigned long *state); +unsigned long sun4v_vintr_set_state(unsigned long dev_handle, +				    unsigned long dev_ino, +				    unsigned long state); +unsigned long sun4v_vintr_get_target(unsigned long dev_handle, +				     unsigned long dev_ino, +				     unsigned long *cpuid); +unsigned long sun4v_vintr_set_target(unsigned long dev_handle, +				     unsigned long dev_ino, +				     unsigned long cpuid);  #endif  /* PCI IO services. @@ -1880,7 +1883,7 @@ extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle,   * pci_device, at pci_config_offset from the beginning of the device's   * configuration space.  If there was no error, RET1 is set to zero and   * RET2 is set to the data read.  Insignificant bits in RET2 are not - * guarenteed to have any specific value and therefore must be ignored. + * guaranteed to have any specific value and therefore must be ignored.   *   * The data returned in RET2 is size based byte swapped.   * @@ -1941,9 +1944,9 @@ extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle,   * and return the actual data read in RET2.  The data returned is size based   * byte swapped.   * - * Non-significant bits in RET2 are not guarenteed to have any specific value + * Non-significant bits in RET2 are not guaranteed to have any specific value   * and therefore must be ignored.  If RET1 is returned as non-zero, the data - * value is not guarenteed to have any specific value and should be ignored. + * value is not guaranteed to have any specific value and should be ignored.   *   * The caller must have permission to read from the given devhandle, real   * address, which must be an IO address.  The argument real address must be a @@ -2456,9 +2459,9 @@ extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle,   *   * As receive queue configuration causes a reset of the queue's head and   * tail pointers there is no way for a gues to determine how many entries - * have been received between a preceeding ldc_get_rx_state() API call + * have been received between a preceding ldc_get_rx_state() API call   * and the completion of the configuration operation.  It should be noted - * that datagram delivery is not guarenteed via domain channels anyway, + * that datagram delivery is not guaranteed via domain channels anyway,   * and therefore any higher protocol should be resilient to datagram   * loss if necessary.  However, to overcome this specific race potential   * it is recommended, for example, that a higher level protocol be employed @@ -2627,50 +2630,50 @@ struct ldc_mtable_entry {  #define HV_FAST_LDC_REVOKE		0xef  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_ldc_tx_qconf(unsigned long channel, -					unsigned long ra, -					unsigned long num_entries); -extern unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, -					unsigned long *ra, -					unsigned long *num_entries); -extern unsigned long sun4v_ldc_tx_get_state(unsigned long channel, -					    unsigned long *head_off, -					    unsigned long *tail_off, -					    unsigned long *chan_state); -extern unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, -					    unsigned long tail_off); -extern unsigned long sun4v_ldc_rx_qconf(unsigned long channel, -					unsigned long ra, -					unsigned long num_entries); -extern unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, -					unsigned long *ra, -					unsigned long *num_entries); -extern unsigned long sun4v_ldc_rx_get_state(unsigned long channel, -					    unsigned long *head_off, -					    unsigned long *tail_off, -					    unsigned long *chan_state); -extern unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, -					    unsigned long head_off); -extern unsigned long sun4v_ldc_set_map_table(unsigned long channel, -					     unsigned long ra, -					     unsigned long num_entries); -extern unsigned long sun4v_ldc_get_map_table(unsigned long channel, -					     unsigned long *ra, -					     unsigned long *num_entries); -extern unsigned long sun4v_ldc_copy(unsigned long channel, -				    unsigned long dir_code, -				    unsigned long tgt_raddr, -				    unsigned long lcl_raddr, -				    unsigned long len, -				    unsigned long *actual_len); -extern unsigned long sun4v_ldc_mapin(unsigned long channel, -				     unsigned long cookie, -				     unsigned long *ra, -				     unsigned long *perm); -extern unsigned long sun4v_ldc_unmap(unsigned long ra); -extern unsigned long sun4v_ldc_revoke(unsigned long channel, -				      unsigned long cookie, -				      unsigned long mte_cookie); +unsigned long sun4v_ldc_tx_qconf(unsigned long channel, +				 unsigned long ra, +				 unsigned long num_entries); +unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, +				 unsigned long *ra, +				 unsigned long *num_entries); +unsigned long sun4v_ldc_tx_get_state(unsigned long channel, +				     unsigned long *head_off, +				     unsigned long *tail_off, +				     unsigned long *chan_state); +unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, +				     unsigned long tail_off); +unsigned long sun4v_ldc_rx_qconf(unsigned long channel, +				 unsigned long ra, +				 unsigned long num_entries); +unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, +				 unsigned long *ra, +				 unsigned long *num_entries); +unsigned long sun4v_ldc_rx_get_state(unsigned long channel, +				     unsigned long *head_off, +				     unsigned long *tail_off, +				     unsigned long *chan_state); +unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, +				     unsigned long head_off); +unsigned long sun4v_ldc_set_map_table(unsigned long channel, +				      unsigned long ra, +				      unsigned long num_entries); +unsigned long sun4v_ldc_get_map_table(unsigned long channel, +				      unsigned long *ra, +				      unsigned long *num_entries); +unsigned long sun4v_ldc_copy(unsigned long channel, +			     unsigned long dir_code, +			     unsigned long tgt_raddr, +			     unsigned long lcl_raddr, +			     unsigned long len, +			     unsigned long *actual_len); +unsigned long sun4v_ldc_mapin(unsigned long channel, +			      unsigned long cookie, +			      unsigned long *ra, +			      unsigned long *perm); +unsigned long sun4v_ldc_unmap(unsigned long ra); +unsigned long sun4v_ldc_revoke(unsigned long channel, +			       unsigned long cookie, +			       unsigned long mte_cookie);  #endif  /* Performance counter services.  */ @@ -2727,14 +2730,14 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel,  #define HV_FAST_N2_SET_PERFREG		0x105  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_niagara_getperf(unsigned long reg, -					   unsigned long *val); -extern unsigned long sun4v_niagara_setperf(unsigned long reg, -					   unsigned long val); -extern unsigned long sun4v_niagara2_getperf(unsigned long reg, -					    unsigned long *val); -extern unsigned long sun4v_niagara2_setperf(unsigned long reg, -					    unsigned long val); +unsigned long sun4v_niagara_getperf(unsigned long reg, +				    unsigned long *val); +unsigned long sun4v_niagara_setperf(unsigned long reg, +				    unsigned long val); +unsigned long sun4v_niagara2_getperf(unsigned long reg, +				     unsigned long *val); +unsigned long sun4v_niagara2_setperf(unsigned long reg, +				     unsigned long val);  #endif  /* MMU statistics services. @@ -2829,8 +2832,8 @@ struct hv_mmu_statistics {  #define HV_FAST_MMUSTAT_INFO		0x103  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra); -extern unsigned long sun4v_mmustat_info(unsigned long *ra); +unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra); +unsigned long sun4v_mmustat_info(unsigned long *ra);  #endif  /* NCS crypto services  */ @@ -2919,14 +2922,31 @@ struct hv_ncs_qtail_update_arg {  #define HV_FAST_NCS_REQUEST		0x110  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_ncs_request(unsigned long request, -				       unsigned long arg_ra, -				       unsigned long arg_size); +unsigned long sun4v_ncs_request(unsigned long request, +			        unsigned long arg_ra, +			        unsigned long arg_size);  #endif  #define HV_FAST_FIRE_GET_PERFREG	0x120  #define HV_FAST_FIRE_SET_PERFREG	0x121 +#define HV_FAST_REBOOT_DATA_SET		0x172 + +#ifndef __ASSEMBLY__ +unsigned long sun4v_reboot_data_set(unsigned long ra, +				    unsigned long len); +#endif + +#define HV_FAST_VT_GET_PERFREG		0x184 +#define HV_FAST_VT_SET_PERFREG		0x185 + +#ifndef __ASSEMBLY__ +unsigned long sun4v_vt_get_perfreg(unsigned long reg_num, +				   unsigned long *reg_val); +unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, +				   unsigned long reg_val); +#endif +  /* Function numbers for HV_CORE_TRAP.  */  #define HV_CORE_SET_VER			0x00  #define HV_CORE_PUTCHAR			0x01 @@ -2940,34 +2960,42 @@ extern unsigned long sun4v_ncs_request(unsigned long request,  #define HV_GRP_CORE			0x0001  #define HV_GRP_INTR			0x0002  #define HV_GRP_SOFT_STATE		0x0003 +#define HV_GRP_TM			0x0080  #define HV_GRP_PCI			0x0100  #define HV_GRP_LDOM			0x0101  #define HV_GRP_SVC_CHAN			0x0102  #define HV_GRP_NCS			0x0103  #define HV_GRP_RNG			0x0104 +#define HV_GRP_PBOOT			0x0105 +#define HV_GRP_TPM			0x0107 +#define HV_GRP_SDIO			0x0108 +#define HV_GRP_SDIO_ERR			0x0109 +#define HV_GRP_REBOOT_DATA		0x0110  #define HV_GRP_NIAG_PERF		0x0200  #define HV_GRP_FIRE_PERF		0x0201  #define HV_GRP_N2_CPU			0x0202  #define HV_GRP_NIU			0x0204  #define HV_GRP_VF_CPU			0x0205 +#define HV_GRP_KT_CPU			0x0209 +#define HV_GRP_VT_CPU			0x020c  #define HV_GRP_DIAG			0x0300  #ifndef __ASSEMBLY__ -extern unsigned long sun4v_get_version(unsigned long group, -				       unsigned long *major, -				       unsigned long *minor); -extern unsigned long sun4v_set_version(unsigned long group, -				       unsigned long major, -				       unsigned long minor, -				       unsigned long *actual_minor); - -extern int sun4v_hvapi_register(unsigned long group, unsigned long major, -				unsigned long *minor); -extern void sun4v_hvapi_unregister(unsigned long group); -extern int sun4v_hvapi_get(unsigned long group, -			   unsigned long *major, -			   unsigned long *minor); -extern void sun4v_hvapi_init(void); +unsigned long sun4v_get_version(unsigned long group, +			        unsigned long *major, +			        unsigned long *minor); +unsigned long sun4v_set_version(unsigned long group, +			        unsigned long major, +			        unsigned long minor, +			        unsigned long *actual_minor); + +int sun4v_hvapi_register(unsigned long group, unsigned long major, +			 unsigned long *minor); +void sun4v_hvapi_unregister(unsigned long group); +int sun4v_hvapi_get(unsigned long group, +		    unsigned long *major, +		    unsigned long *minor); +void sun4v_hvapi_init(void);  #endif  #endif /* !(_SPARC64_HYPERVISOR_H) */ diff --git a/arch/sparc/include/asm/idprom.h b/arch/sparc/include/asm/idprom.h index 6976aa2439c..3793f7f91c4 100644 --- a/arch/sparc/include/asm/idprom.h +++ b/arch/sparc/include/asm/idprom.h @@ -20,6 +20,6 @@ struct idprom {  };  extern struct idprom *idprom; -extern void idprom_init(void); +void idprom_init(void);  #endif /* !(_SPARC_IDPROM_H) */ diff --git a/arch/sparc/include/asm/io-unit.h b/arch/sparc/include/asm/io-unit.h index 01ab2f613e9..04a9701e720 100644 --- a/arch/sparc/include/asm/io-unit.h +++ b/arch/sparc/include/asm/io-unit.h @@ -43,7 +43,7 @@  struct iounit_struct {  	unsigned long		bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)];  	spinlock_t		lock; -	iopte_t			*page_table; +	iopte_t __iomem		*page_table;  	unsigned long		rotor[3];  	unsigned long		limit[4];  }; diff --git a/arch/sparc/include/asm/io.h b/arch/sparc/include/asm/io.h index a34b2994937..f6902cf3cbe 100644 --- a/arch/sparc/include/asm/io.h +++ b/arch/sparc/include/asm/io.h @@ -5,4 +5,17 @@  #else  #include <asm/io_32.h>  #endif + +/* + * Defines used for both SPARC32 and SPARC64 + */ + +/* Big endian versions of memory read/write routines */ +#define readb_be(__addr)	__raw_readb(__addr) +#define readw_be(__addr)	__raw_readw(__addr) +#define readl_be(__addr)	__raw_readl(__addr) +#define writeb_be(__b, __addr)	__raw_writeb(__b, __addr) +#define writel_be(__w, __addr)	__raw_writel(__w, __addr) +#define writew_be(__l, __addr)	__raw_writew(__l, __addr) +  #endif diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h index c2ced21c9dc..9f532902627 100644 --- a/arch/sparc/include/asm/io_32.h +++ b/arch/sparc/include/asm/io_32.h @@ -2,191 +2,94 @@  #define __SPARC_IO_H  #include <linux/kernel.h> -#include <linux/types.h>  #include <linux/ioport.h>  /* struct resource */ -#include <asm/page.h>      /* IO address mapping routines need this */ -#include <asm/system.h> - -#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT) - -static inline u32 flip_dword (u32 l) -{ -	return ((l&0xff)<<24) | (((l>>8)&0xff)<<16) | (((l>>16)&0xff)<<8)| ((l>>24)&0xff); -} - -static inline u16 flip_word (u16 w) -{ -	return ((w&0xff) << 8) | ((w>>8)&0xff); -} - -#define mmiowb() - -/* - * Memory mapped I/O to PCI - */ - -static inline u8 __raw_readb(const volatile void __iomem *addr) -{ -	return *(__force volatile u8 *)addr; -} - -static inline u16 __raw_readw(const volatile void __iomem *addr) -{ -	return *(__force volatile u16 *)addr; -} - -static inline u32 __raw_readl(const volatile void __iomem *addr) -{ -	return *(__force volatile u32 *)addr; -} +#define readb_relaxed(__addr)	readb(__addr) +#define readw_relaxed(__addr)	readw(__addr) +#define readl_relaxed(__addr)	readl(__addr) -static inline void __raw_writeb(u8 b, volatile void __iomem *addr) -{ -	*(__force volatile u8 *)addr = b; -} +#define IO_SPACE_LIMIT 0xffffffff -static inline void __raw_writew(u16 w, volatile void __iomem *addr) -{ -	*(__force volatile u16 *)addr = w; -} +#define memset_io(d,c,sz)     _memset_io(d,c,sz) +#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) +#define memcpy_toio(d,s,sz)   _memcpy_toio(d,s,sz) -static inline void __raw_writel(u32 l, volatile void __iomem *addr) -{ -	*(__force volatile u32 *)addr = l; -} +#include <asm-generic/io.h> -static inline u8 __readb(const volatile void __iomem *addr) +static inline void _memset_io(volatile void __iomem *dst, +                              int c, __kernel_size_t n)  { -	return *(__force volatile u8 *)addr; -} +	volatile void __iomem *d = dst; -static inline u16 __readw(const volatile void __iomem *addr) -{ -	return flip_word(*(__force volatile u16 *)addr); +	while (n--) { +		writeb(c, d); +		d++; +	}  } -static inline u32 __readl(const volatile void __iomem *addr) +static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src, +                                  __kernel_size_t n)  { -	return flip_dword(*(__force volatile u32 *)addr); -} +	char *d = dst; -static inline void __writeb(u8 b, volatile void __iomem *addr) -{ -	*(__force volatile u8 *)addr = b; +	while (n--) { +		char tmp = readb(src); +		*d++ = tmp; +		src++; +	}  } -static inline void __writew(u16 w, volatile void __iomem *addr) +static inline void _memcpy_toio(volatile void __iomem *dst, const void *src, +                                __kernel_size_t n)  { -	*(__force volatile u16 *)addr = flip_word(w); -} +	const char *s = src; +	volatile void __iomem *d = dst; -static inline void __writel(u32 l, volatile void __iomem *addr) -{ -	*(__force volatile u32 *)addr = flip_dword(l); +	while (n--) { +		char tmp = *s++; +		writeb(tmp, d); +		d++; +	}  } -#define readb(__addr)		__readb(__addr) -#define readw(__addr)		__readw(__addr) -#define readl(__addr)		__readl(__addr) -#define readb_relaxed(__addr)	readb(__addr) -#define readw_relaxed(__addr)	readw(__addr) -#define readl_relaxed(__addr)	readl(__addr) - -#define writeb(__b, __addr)	__writeb((__b),(__addr)) -#define writew(__w, __addr)	__writew((__w),(__addr)) -#define writel(__l, __addr)	__writel((__l),(__addr)) - -/* - * I/O space operations - * - * Arrangement on a Sun is somewhat complicated. - * - * First of all, we want to use standard Linux drivers - * for keyboard, PC serial, etc. These drivers think - * they access I/O space and use inb/outb. - * On the other hand, EBus bridge accepts PCI *memory* - * cycles and converts them into ISA *I/O* cycles. - * Ergo, we want inb & outb to generate PCI memory cycles. - * - * If we want to issue PCI *I/O* cycles, we do this - * with a low 64K fixed window in PCIC. This window gets - * mapped somewhere into virtual kernel space and we - * can use inb/outb again. - */ -#define inb_local(__addr)	__readb((void __iomem *)(unsigned long)(__addr)) -#define inb(__addr)		__readb((void __iomem *)(unsigned long)(__addr)) -#define inw(__addr)		__readw((void __iomem *)(unsigned long)(__addr)) -#define inl(__addr)		__readl((void __iomem *)(unsigned long)(__addr)) - -#define outb_local(__b, __addr)	__writeb(__b, (void __iomem *)(unsigned long)(__addr)) -#define outb(__b, __addr)	__writeb(__b, (void __iomem *)(unsigned long)(__addr)) -#define outw(__w, __addr)	__writew(__w, (void __iomem *)(unsigned long)(__addr)) -#define outl(__l, __addr)	__writel(__l, (void __iomem *)(unsigned long)(__addr)) - -#define inb_p(__addr)		inb(__addr) -#define outb_p(__b, __addr)	outb(__b, __addr) -#define inw_p(__addr)		inw(__addr) -#define outw_p(__w, __addr)	outw(__w, __addr) -#define inl_p(__addr)		inl(__addr) -#define outl_p(__l, __addr)	outl(__l, __addr) - -void outsb(unsigned long addr, const void *src, unsigned long cnt); -void outsw(unsigned long addr, const void *src, unsigned long cnt); -void outsl(unsigned long addr, const void *src, unsigned long cnt); -void insb(unsigned long addr, void *dst, unsigned long count); -void insw(unsigned long addr, void *dst, unsigned long count); -void insl(unsigned long addr, void *dst, unsigned long count); - -#define IO_SPACE_LIMIT 0xffffffff -  /*   * SBus accessors.   *   * SBus has only one, memory mapped, I/O space.   * We do not need to flip bytes for SBus of course.   */ -static inline u8 _sbus_readb(const volatile void __iomem *addr) +static inline u8 sbus_readb(const volatile void __iomem *addr)  {  	return *(__force volatile u8 *)addr;  } -static inline u16 _sbus_readw(const volatile void __iomem *addr) +static inline u16 sbus_readw(const volatile void __iomem *addr)  {  	return *(__force volatile u16 *)addr;  } -static inline u32 _sbus_readl(const volatile void __iomem *addr) +static inline u32 sbus_readl(const volatile void __iomem *addr)  {  	return *(__force volatile u32 *)addr;  } -static inline void _sbus_writeb(u8 b, volatile void __iomem *addr) +static inline void sbus_writeb(u8 b, volatile void __iomem *addr)  {  	*(__force volatile u8 *)addr = b;  } -static inline void _sbus_writew(u16 w, volatile void __iomem *addr) +static inline void sbus_writew(u16 w, volatile void __iomem *addr)  {  	*(__force volatile u16 *)addr = w;  } -static inline void _sbus_writel(u32 l, volatile void __iomem *addr) +static inline void sbus_writel(u32 l, volatile void __iomem *addr)  {  	*(__force volatile u32 *)addr = l;  } -/* - * The only reason for #define's is to hide casts to unsigned long. - */ -#define sbus_readb(__addr)		_sbus_readb(__addr) -#define sbus_readw(__addr)		_sbus_readw(__addr) -#define sbus_readl(__addr)		_sbus_readl(__addr) -#define sbus_writeb(__b, __addr)	_sbus_writeb(__b, __addr) -#define sbus_writew(__w, __addr)	_sbus_writew(__w, __addr) -#define sbus_writel(__l, __addr)	_sbus_writel(__l, __addr) - -static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_size_t n) +static inline void sbus_memset_io(volatile void __iomem *__dst, int c, +                                  __kernel_size_t n)  {  	while(n--) {  		sbus_writeb(c, __dst); @@ -194,22 +97,9 @@ static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_  	}  } -static inline void -_memset_io(volatile void __iomem *dst, int c, __kernel_size_t n) -{ -	volatile void __iomem *d = dst; - -	while (n--) { -		writeb(c, d); -		d++; -	} -} - -#define memset_io(d,c,sz)	_memset_io(d,c,sz) - -static inline void -_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src, -		    __kernel_size_t n) +static inline void sbus_memcpy_fromio(void *dst, +                                      const volatile void __iomem *src, +                                      __kernel_size_t n)  {  	char *d = dst; @@ -220,25 +110,9 @@ _sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,  	}  } -#define sbus_memcpy_fromio(d, s, sz)	_sbus_memcpy_fromio(d, s, sz) - -static inline void -_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n) -{ -	char *d = dst; - -	while (n--) { -		char tmp = readb(src); -		*d++ = tmp; -		src++; -	} -} - -#define memcpy_fromio(d,s,sz)	_memcpy_fromio(d,s,sz) - -static inline void -_sbus_memcpy_toio(volatile void __iomem *dst, const void *src, -		  __kernel_size_t n) +static inline void sbus_memcpy_toio(volatile void __iomem *dst, +                                    const void *src, +                                    __kernel_size_t n)  {  	const char *s = src;  	volatile void __iomem *d = dst; @@ -250,82 +124,26 @@ _sbus_memcpy_toio(volatile void __iomem *dst, const void *src,  	}  } -#define sbus_memcpy_toio(d, s, sz)	_sbus_memcpy_toio(d, s, sz) - -static inline void -_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n) -{ -	const char *s = src; -	volatile void __iomem *d = dst; - -	while (n--) { -		char tmp = *s++; -		writeb(tmp, d); -		d++; -	} -} - -#define memcpy_toio(d,s,sz)	_memcpy_toio(d,s,sz) -  #ifdef __KERNEL__  /*   * Bus number may be embedded in the higher bits of the physical address.   * This is why we have no bus number argument to ioremap().   */ -extern void __iomem *ioremap(unsigned long offset, unsigned long size); +void __iomem *ioremap(unsigned long offset, unsigned long size);  #define ioremap_nocache(X,Y)	ioremap((X),(Y))  #define ioremap_wc(X,Y)		ioremap((X),(Y)) -extern void iounmap(volatile void __iomem *addr); - -#define ioread8(X)			readb(X) -#define ioread16(X)			readw(X) -#define ioread16be(X)			__raw_readw(X) -#define ioread32(X)			readl(X) -#define ioread32be(X)			__raw_readl(X) -#define iowrite8(val,X)			writeb(val,X) -#define iowrite16(val,X)		writew(val,X) -#define iowrite16be(val,X)		__raw_writew(val,X) -#define iowrite32(val,X)		writel(val,X) -#define iowrite32be(val,X)		__raw_writel(val,X) - -static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) -{ -	insb((unsigned long __force)port, buf, count); -} -static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count) -{ -	insw((unsigned long __force)port, buf, count); -} - -static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count) -{ -	insl((unsigned long __force)port, buf, count); -} - -static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count) -{ -	outsb((unsigned long __force)port, buf, count); -} - -static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count) -{ -	outsw((unsigned long __force)port, buf, count); -} - -static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count) -{ -	outsl((unsigned long __force)port, buf, count); -} +void iounmap(volatile void __iomem *addr);  /* Create a virtual mapping cookie for an IO port range */ -extern void __iomem *ioport_map(unsigned long port, unsigned int nr); -extern void ioport_unmap(void __iomem *); +void __iomem *ioport_map(unsigned long port, unsigned int nr); +void ioport_unmap(void __iomem *);  /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */  struct pci_dev; -extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); -extern void pci_iounmap(struct pci_dev *dev, void __iomem *); +void pci_iounmap(struct pci_dev *dev, void __iomem *); + +  /*   * At the moment, we do not use CMOS_READ anywhere outside of rtc.c, @@ -344,21 +162,11 @@ static inline int sbus_can_burst64(void)  	return 0; /* actually, sparc_cpu_model==sun4d */  }  struct device; -extern void sbus_set_sbus64(struct device *, int); +void sbus_set_sbus64(struct device *, int);  #endif  #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED		1 -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p)	__va(p) - -/* - * Convert a virtual cached pointer to an uncached pointer - */ -#define xlate_dev_kmem_ptr(p)	p  #endif /* !(__SPARC_IO_H) */ diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h index 9c8965415f0..05381c3a422 100644 --- a/arch/sparc/include/asm/io_64.h +++ b/arch/sparc/include/asm/io_64.h @@ -6,8 +6,8 @@  #include <linux/types.h>  #include <asm/page.h>      /* IO address mapping routines need this */ -#include <asm/system.h>  #include <asm/asi.h> +#include <asm-generic/pci_iomap.h>  /* PC crapola... */  #define __SLOW_DOWN_IO	do { } while (0) @@ -15,7 +15,6 @@  /* BIO layer definitions. */  extern unsigned long kern_base, kern_size; -#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)  static inline u8 _inb(unsigned long addr)  { @@ -91,12 +90,12 @@ static inline void _outl(u32 l, unsigned long addr)  #define inl_p(__addr)		inl(__addr)  #define outl_p(__l, __addr)	outl(__l, __addr) -extern void outsb(unsigned long, const void *, unsigned long); -extern void outsw(unsigned long, const void *, unsigned long); -extern void outsl(unsigned long, const void *, unsigned long); -extern void insb(unsigned long, void *, unsigned long); -extern void insw(unsigned long, void *, unsigned long); -extern void insl(unsigned long, void *, unsigned long); +void outsb(unsigned long, const void *, unsigned long); +void outsw(unsigned long, const void *, unsigned long); +void outsl(unsigned long, const void *, unsigned long); +void insb(unsigned long, void *, unsigned long); +void insw(unsigned long, void *, unsigned long); +void insl(unsigned long, void *, unsigned long);  static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)  { @@ -509,13 +508,12 @@ static inline void iounmap(volatile void __iomem *addr)  #define iowrite32be(val,X)		__raw_writel(val,X)  /* Create a virtual mapping cookie for an IO port range */ -extern void __iomem *ioport_map(unsigned long port, unsigned int nr); -extern void ioport_unmap(void __iomem *); +void __iomem *ioport_map(unsigned long port, unsigned int nr); +void ioport_unmap(void __iomem *);  /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */  struct pci_dev; -extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); -extern void pci_iounmap(struct pci_dev *dev, void __iomem *); +void pci_iounmap(struct pci_dev *dev, void __iomem *);  static inline int sbus_can_dma_64bit(void)  { @@ -526,7 +524,7 @@ static inline int sbus_can_burst64(void)  	return 1;  }  struct device; -extern void sbus_set_sbus64(struct device *, int); +void sbus_set_sbus64(struct device *, int);  /*   * Convert a physical pointer to a virtual kernel pointer for /dev/mem diff --git a/arch/sparc/include/asm/ioctl.h b/arch/sparc/include/asm/ioctl.h deleted file mode 100644 index 7d6bd51321b..00000000000 --- a/arch/sparc/include/asm/ioctl.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _SPARC_IOCTL_H -#define _SPARC_IOCTL_H - -/* - * Our DIR and SIZE overlap in order to simulteneously provide - * a non-zero _IOC_NONE (for binary compatibility) and - * 14 bits of size as on i386. Here's the layout: - * - *   0xE0000000   DIR - *   0x80000000     DIR = WRITE - *   0x40000000     DIR = READ - *   0x20000000     DIR = NONE - *   0x3FFF0000   SIZE (overlaps NONE bit) - *   0x0000FF00   TYPE - *   0x000000FF   NR (CMD) - */ - -#define _IOC_NRBITS      8 -#define _IOC_TYPEBITS    8 -#define _IOC_SIZEBITS   13	/* Actually 14, see below. */ -#define _IOC_DIRBITS     3 - -#define _IOC_NRMASK      ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK    ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK    ((1 << _IOC_SIZEBITS)-1) -#define _IOC_XSIZEMASK   ((1 << (_IOC_SIZEBITS+1))-1) -#define _IOC_DIRMASK     ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT     0 -#define _IOC_TYPESHIFT   (_IOC_NRSHIFT + _IOC_NRBITS) -#define _IOC_SIZESHIFT   (_IOC_TYPESHIFT + _IOC_TYPEBITS) -#define _IOC_DIRSHIFT    (_IOC_SIZESHIFT + _IOC_SIZEBITS) - -#define _IOC_NONE        1U -#define _IOC_READ        2U -#define _IOC_WRITE       4U - -#define _IOC(dir,type,nr,size) \ -        (((dir)  << _IOC_DIRSHIFT) | \ -         ((type) << _IOC_TYPESHIFT) | \ -         ((nr)   << _IOC_NRSHIFT) | \ -         ((size) << _IOC_SIZESHIFT)) - -#define _IO(type,nr)        _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size)  _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* Used to decode ioctl numbers in drivers despite the leading underscore... */ -#define _IOC_DIR(nr)    \ - ( (((((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) & (_IOC_WRITE|_IOC_READ)) != 0)?   \ -                            (((nr) >> _IOC_DIRSHIFT) & (_IOC_WRITE|_IOC_READ)):  \ -                            (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) ) -#define _IOC_TYPE(nr)       (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr)         (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr)   \ - ((((((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) & (_IOC_WRITE|_IOC_READ)) == 0)?    \ -                         0: (((nr) >> _IOC_SIZESHIFT) & _IOC_XSIZEMASK)) - -/* ...and for the PCMCIA and sound. */ -#define IOC_IN          (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT         (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT       ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK    (_IOC_XSIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT   (_IOC_SIZESHIFT) - -#endif /* !(_SPARC_IOCTL_H) */ diff --git a/arch/sparc/include/asm/ioctls.h b/arch/sparc/include/asm/ioctls.h index 53f4ee009bd..77413b7e3a1 100644 --- a/arch/sparc/include/asm/ioctls.h +++ b/arch/sparc/include/asm/ioctls.h @@ -1,121 +1,8 @@  #ifndef _ASM_SPARC_IOCTLS_H  #define _ASM_SPARC_IOCTLS_H -#include <asm/ioctl.h> +#include <uapi/asm/ioctls.h> -/* Big T */ -#define TCGETA		_IOR('T', 1, struct termio) -#define TCSETA		_IOW('T', 2, struct termio) -#define TCSETAW		_IOW('T', 3, struct termio) -#define TCSETAF		_IOW('T', 4, struct termio) -#define TCSBRK		_IO('T', 5) -#define TCXONC		_IO('T', 6) -#define TCFLSH		_IO('T', 7) -#define TCGETS		_IOR('T', 8, struct termios) -#define TCSETS		_IOW('T', 9, struct termios) -#define TCSETSW		_IOW('T', 10, struct termios) -#define TCSETSF		_IOW('T', 11, struct termios) -#define TCGETS2		_IOR('T', 12, struct termios2) -#define TCSETS2		_IOW('T', 13, struct termios2) -#define TCSETSW2	_IOW('T', 14, struct termios2) -#define TCSETSF2	_IOW('T', 15, struct termios2) - -/* Note that all the ioctls that are not available in Linux have a  - * double underscore on the front to: a) avoid some programs to - * think we support some ioctls under Linux (autoconfiguration stuff) - */ -/* Little t */ -#define TIOCGETD	_IOR('t', 0, int) -#define TIOCSETD	_IOW('t', 1, int) -#define __TIOCHPCL        _IO('t', 2) /* SunOS Specific */ -#define __TIOCMODG        _IOR('t', 3, int) /* SunOS Specific */ -#define __TIOCMODS        _IOW('t', 4, int) /* SunOS Specific */ -#define __TIOCGETP        _IOR('t', 8, struct sgttyb) /* SunOS Specific */ -#define __TIOCSETP        _IOW('t', 9, struct sgttyb) /* SunOS Specific */ -#define __TIOCSETN        _IOW('t', 10, struct sgttyb) /* SunOS Specific */ -#define TIOCEXCL	_IO('t', 13) -#define TIOCNXCL	_IO('t', 14) -#define __TIOCFLUSH       _IOW('t', 16, int) /* SunOS Specific */ -#define __TIOCSETC        _IOW('t', 17, struct tchars) /* SunOS Specific */ -#define __TIOCGETC        _IOR('t', 18, struct tchars) /* SunOS Specific */ -#define __TIOCTCNTL       _IOW('t', 32, int) /* SunOS Specific */ -#define __TIOCSIGNAL      _IOW('t', 33, int) /* SunOS Specific */ -#define __TIOCSETX        _IOW('t', 34, int) /* SunOS Specific */ -#define __TIOCGETX        _IOR('t', 35, int) /* SunOS Specific */ -#define TIOCCONS	_IO('t', 36) -#define TIOCGSOFTCAR	_IOR('t', 100, int) -#define TIOCSSOFTCAR	_IOW('t', 101, int) -#define __TIOCUCNTL       _IOW('t', 102, int) /* SunOS Specific */ -#define TIOCSWINSZ	_IOW('t', 103, struct winsize) -#define TIOCGWINSZ	_IOR('t', 104, struct winsize) -#define __TIOCREMOTE      _IOW('t', 105, int) /* SunOS Specific */ -#define TIOCMGET	_IOR('t', 106, int) -#define TIOCMBIC	_IOW('t', 107, int) -#define TIOCMBIS	_IOW('t', 108, int) -#define TIOCMSET	_IOW('t', 109, int) -#define TIOCSTART       _IO('t', 110) -#define TIOCSTOP        _IO('t', 111) -#define TIOCPKT		_IOW('t', 112, int) -#define TIOCNOTTY	_IO('t', 113) -#define TIOCSTI		_IOW('t', 114, char) -#define TIOCOUTQ	_IOR('t', 115, int) -#define __TIOCGLTC        _IOR('t', 116, struct ltchars) /* SunOS Specific */ -#define __TIOCSLTC        _IOW('t', 117, struct ltchars) /* SunOS Specific */ -/* 118 is the non-posix setpgrp tty ioctl */ -/* 119 is the non-posix getpgrp tty ioctl */ -#define __TIOCCDTR        _IO('t', 120) /* SunOS Specific */ -#define __TIOCSDTR        _IO('t', 121) /* SunOS Specific */ -#define TIOCCBRK        _IO('t', 122) -#define TIOCSBRK        _IO('t', 123) -#define __TIOCLGET        _IOW('t', 124, int) /* SunOS Specific */ -#define __TIOCLSET        _IOW('t', 125, int) /* SunOS Specific */ -#define __TIOCLBIC        _IOW('t', 126, int) /* SunOS Specific */ -#define __TIOCLBIS        _IOW('t', 127, int) /* SunOS Specific */ -#define __TIOCISPACE      _IOR('t', 128, int) /* SunOS Specific */ -#define __TIOCISIZE       _IOR('t', 129, int) /* SunOS Specific */ -#define TIOCSPGRP	_IOW('t', 130, int) -#define TIOCGPGRP	_IOR('t', 131, int) -#define TIOCSCTTY	_IO('t', 132) -#define TIOCGSID	_IOR('t', 133, int) -/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ -#define TIOCGPTN	_IOR('t', 134, unsigned int) /* Get Pty Number */ -#define TIOCSPTLCK	_IOW('t', 135, int) /* Lock/unlock PTY */ -#define TIOCSIG		_IOW('t', 136, int) /* Generate signal on Pty slave */ - -/* Little f */ -#define FIOCLEX		_IO('f', 1) -#define FIONCLEX	_IO('f', 2) -#define FIOASYNC	_IOW('f', 125, int) -#define FIONBIO		_IOW('f', 126, int) -#define FIONREAD	_IOR('f', 127, int) -#define TIOCINQ		FIONREAD -#define FIOQSIZE	_IOR('f', 128, loff_t) - -/* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it - * someday.  This is completely bogus, I know... - */ -#define __TCGETSTAT       _IO('T', 200) /* Rutgers specific */ -#define __TCSETSTAT       _IO('T', 201) /* Rutgers specific */ - -/* Linux specific, no SunOS equivalent. */ -#define TIOCLINUX	0x541C -#define TIOCGSERIAL	0x541E -#define TIOCSSERIAL	0x541F -#define TCSBRKP		0x5425 -#define TIOCSERCONFIG	0x5453 -#define TIOCSERGWILD	0x5454 -#define TIOCSERSWILD	0x5455 -#define TIOCGLCKTRMIOS	0x5456 -#define TIOCSLCKTRMIOS	0x5457 -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */ -#define TIOCSERGETLSR   0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ -#define TIOCMIWAIT	0x545C /* Wait for change on serial input line(s) */ -#define TIOCGICOUNT	0x545D /* Read serial port inline interrupt counts */ - -/* Kernel definitions */ -#ifdef __KERNEL__  #define TIOCGETC __TIOCGETC  #define TIOCGETP __TIOCGETP  #define TIOCGLTC __TIOCGLTC @@ -123,16 +10,4 @@  #define TIOCSETP __TIOCSETP  #define TIOCSETN __TIOCSETN  #define TIOCSETC __TIOCSETC -#endif - -/* Used for packet mode */ -#define TIOCPKT_DATA		 0 -#define TIOCPKT_FLUSHREAD	 1 -#define TIOCPKT_FLUSHWRITE	 2 -#define TIOCPKT_STOP		 4 -#define TIOCPKT_START		 8 -#define TIOCPKT_NOSTOP		16 -#define TIOCPKT_DOSTOP		32 -#define TIOCPKT_IOCTL		64 -  #endif /* !(_ASM_SPARC_IOCTLS_H) */ diff --git a/arch/sparc/include/asm/iommu_32.h b/arch/sparc/include/asm/iommu_32.h index 70c589c05a1..f6c066b52fd 100644 --- a/arch/sparc/include/asm/iommu_32.h +++ b/arch/sparc/include/asm/iommu_32.h @@ -99,7 +99,7 @@ struct iommu_regs {  #define IOPTE_WAZ           0x00000001 /* Write as zeros */  struct iommu_struct { -	struct iommu_regs *regs; +	struct iommu_regs __iomem *regs;  	iopte_t *page_table;  	/* For convenience */  	unsigned long start; /* First managed virtual address */ @@ -108,14 +108,14 @@ struct iommu_struct {  	struct bit_map usemap;  }; -static inline void iommu_invalidate(struct iommu_regs *regs) +static inline void iommu_invalidate(struct iommu_regs __iomem *regs)  { -	regs->tlbflush = 0; +	sbus_writel(0, ®s->tlbflush);  } -static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) +static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba)  { -	regs->pageflush = (ba & PAGE_MASK); +	sbus_writel(ba & PAGE_MASK, ®s->pageflush);  }  #endif /* !(_SPARC_IOMMU_H) */ diff --git a/arch/sparc/include/asm/iommu_64.h b/arch/sparc/include/asm/iommu_64.h index caf798b5619..2b9321ab064 100644 --- a/arch/sparc/include/asm/iommu_64.h +++ b/arch/sparc/include/asm/iommu_64.h @@ -58,8 +58,8 @@ struct strbuf {  	volatile unsigned long	__flushflag_buf[(64+(64-1)) / sizeof(long)];  }; -extern int iommu_table_init(struct iommu *iommu, int tsbsize, -			    u32 dma_offset, u32 dma_addr_mask, -			    int numa_node); +int iommu_table_init(struct iommu *iommu, int tsbsize, +		     u32 dma_offset, u32 dma_addr_mask, +		     int numa_node);  #endif /* !(_SPARC64_IOMMU_H) */ diff --git a/arch/sparc/include/asm/ipcbuf.h b/arch/sparc/include/asm/ipcbuf.h deleted file mode 100644 index 66013b4fe10..00000000000 --- a/arch/sparc/include/asm/ipcbuf.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __SPARC_IPCBUF_H -#define __SPARC_IPCBUF_H - -/* - * The ipc64_perm structure for sparc/sparc64 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit seq - * - on sparc for 32 bit mode (it is 32 bit on sparc64) - * - 2 miscellaneous 64-bit values - */ - -struct ipc64_perm -{ -	__kernel_key_t	key; -	__kernel_uid_t	uid; -	__kernel_gid_t	gid; -	__kernel_uid_t	cuid; -	__kernel_gid_t	cgid; -#ifndef __arch64__ -	unsigned short	__pad0; -#endif -	__kernel_mode_t	mode; -	unsigned short	__pad1; -	unsigned short	seq; -	unsigned long long __unused1; -	unsigned long long __unused2; -}; - -#endif /* __SPARC_IPCBUF_H */ diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h index cbf4801deaa..eecd3d8442c 100644 --- a/arch/sparc/include/asm/irq_32.h +++ b/arch/sparc/include/asm/irq_32.h @@ -6,11 +6,19 @@  #ifndef _SPARC_IRQ_H  #define _SPARC_IRQ_H -#define NR_IRQS    16 +/* Allocated number of logical irq numbers. + * sun4d boxes (ss2000e) should be OK with ~32. + * Be on the safe side and make room for 64 + */ +#define NR_IRQS    64  #include <linux/interrupt.h>  #define irq_canonicalize(irq)	(irq) -extern void __init init_IRQ(void); +void __init init_IRQ(void); +void __init sun4d_init_sbi_irq(void); + +#define NO_IRQ		0xffffffff +  #endif diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index a0b443cb3c1..91d21938130 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h @@ -33,38 +33,38 @@  /* The largest number of unique interrupt sources we support.   * If this needs to ever be larger than 255, you need to change - * the type of ino_bucket->virt_irq as appropriate. + * the type of ino_bucket->irq as appropriate.   * - * ino_bucket->virt_irq allocation is made during {sun4v_,}build_irq(). + * ino_bucket->irq allocation is made during {sun4v_,}build_irq().   */  #define NR_IRQS    255 -extern void irq_install_pre_handler(int virt_irq, -				    void (*func)(unsigned int, void *, void *), -				    void *arg1, void *arg2); +void irq_install_pre_handler(int irq, +			     void (*func)(unsigned int, void *, void *), +			     void *arg1, void *arg2);  #define irq_canonicalize(irq)	(irq) -extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); -extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); -extern unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino); -extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, -				    unsigned int msi_devino_start, -				    unsigned int msi_devino_end); -extern void sun4v_destroy_msi(unsigned int virt_irq); -extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p, -				    unsigned int msi_devino_start, -				    unsigned int msi_devino_end, -				    unsigned long imap_base, -				    unsigned long iclr_base); -extern void sun4u_destroy_msi(unsigned int virt_irq); - -extern unsigned char virt_irq_alloc(unsigned int dev_handle, -				    unsigned int dev_ino); +unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); +unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); +unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino); +unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p, +			     unsigned int msi_devino_start, +			     unsigned int msi_devino_end); +void sun4v_destroy_msi(unsigned int irq); +unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, +			     unsigned int msi_devino_start, +			     unsigned int msi_devino_end, +			     unsigned long imap_base, +			     unsigned long iclr_base); +void sun4u_destroy_msi(unsigned int irq); + +unsigned char irq_alloc(unsigned int dev_handle, +			unsigned int dev_ino);  #ifdef CONFIG_PCI_MSI -extern void virt_irq_free(unsigned int virt_irq); +void irq_free(unsigned int irq);  #endif -extern void __init init_IRQ(void); -extern void fixup_irqs(void); +void __init init_IRQ(void); +void fixup_irqs(void);  static inline void set_softint(unsigned long bits)  { @@ -89,12 +89,13 @@ static inline unsigned long get_softint(void)  	return retval;  } -void arch_trigger_all_cpu_backtrace(void); +void arch_trigger_all_cpu_backtrace(bool);  #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace  extern void *hardirq_stack[NR_CPUS];  extern void *softirq_stack[NR_CPUS];  #define __ARCH_HAS_DO_SOFTIRQ -#define ARCH_HAS_NMI_WATCHDOG + +#define NO_IRQ		0xffffffff  #endif diff --git a/arch/sparc/include/asm/irq_regs.h b/arch/sparc/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b7027..00000000000 --- a/arch/sparc/include/asm/irq_regs.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/irq_regs.h> diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h index d4d0711de0f..71cc284f55c 100644 --- a/arch/sparc/include/asm/irqflags_32.h +++ b/arch/sparc/include/asm/irqflags_32.h @@ -13,12 +13,13 @@  #ifndef __ASSEMBLY__  #include <linux/types.h> +#include <asm/psr.h> -extern void arch_local_irq_restore(unsigned long); -extern unsigned long arch_local_irq_save(void); -extern void arch_local_irq_enable(void); +void arch_local_irq_restore(unsigned long); +unsigned long arch_local_irq_save(void); +void arch_local_irq_enable(void); -static inline unsigned long arch_local_save_flags(void) +static inline notrace unsigned long arch_local_save_flags(void)  {  	unsigned long flags; @@ -26,17 +27,17 @@ static inline unsigned long arch_local_save_flags(void)  	return flags;  } -static inline void arch_local_irq_disable(void) +static inline notrace void arch_local_irq_disable(void)  {  	arch_local_irq_save();  } -static inline bool arch_irqs_disabled_flags(unsigned long flags) +static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)  {  	return (flags & PSR_PIL) != 0;  } -static inline bool arch_irqs_disabled(void) +static inline notrace bool arch_irqs_disabled(void)  {  	return arch_irqs_disabled_flags(arch_local_save_flags());  } diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h index aab969c82c2..23cd27f6beb 100644 --- a/arch/sparc/include/asm/irqflags_64.h +++ b/arch/sparc/include/asm/irqflags_64.h @@ -14,7 +14,7 @@  #ifndef __ASSEMBLY__ -static inline unsigned long arch_local_save_flags(void) +static inline notrace unsigned long arch_local_save_flags(void)  {  	unsigned long flags; @@ -26,7 +26,7 @@ static inline unsigned long arch_local_save_flags(void)  	return flags;  } -static inline void arch_local_irq_restore(unsigned long flags) +static inline notrace void arch_local_irq_restore(unsigned long flags)  {  	__asm__ __volatile__(  		"wrpr	%0, %%pil" @@ -36,7 +36,7 @@ static inline void arch_local_irq_restore(unsigned long flags)  	);  } -static inline void arch_local_irq_disable(void) +static inline notrace void arch_local_irq_disable(void)  {  	__asm__ __volatile__(  		"wrpr	%0, %%pil" @@ -46,7 +46,7 @@ static inline void arch_local_irq_disable(void)  	);  } -static inline void arch_local_irq_enable(void) +static inline notrace void arch_local_irq_enable(void)  {  	__asm__ __volatile__(  		"wrpr	0, %%pil" @@ -56,17 +56,17 @@ static inline void arch_local_irq_enable(void)  	);  } -static inline int arch_irqs_disabled_flags(unsigned long flags) +static inline notrace int arch_irqs_disabled_flags(unsigned long flags)  {  	return (flags > 0);  } -static inline int arch_irqs_disabled(void) +static inline notrace int arch_irqs_disabled(void)  {  	return arch_irqs_disabled_flags(arch_local_save_flags());  } -static inline unsigned long arch_local_irq_save(void) +static inline notrace unsigned long arch_local_irq_save(void)  {  	unsigned long flags, tmp; diff --git a/arch/sparc/include/asm/jsflash.h b/arch/sparc/include/asm/jsflash.h deleted file mode 100644 index 0717d9e39d2..00000000000 --- a/arch/sparc/include/asm/jsflash.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * jsflash.h: OS Flash SIMM support for JavaStations. - * - * Copyright (C) 1999  Pete Zaitcev - */ - -#ifndef _SPARC_JSFLASH_H -#define _SPARC_JSFLASH_H - -#ifndef _SPARC_TYPES_H -#include <linux/types.h> -#endif - -/* - * Semantics of the offset is a full address. - * Hardcode it or get it from probe ioctl. - * - * We use full bus address, so that we would be - * automatically compatible with possible future systems. - */ - -#define JSFLASH_IDENT   (('F'<<8)|54) -struct jsflash_ident_arg { -	__u64 off;                /* 0x20000000 is included */ -	__u32 size; -	char name[32];		/* With trailing zero */ -}; - -#define JSFLASH_ERASE   (('F'<<8)|55) -/* Put 0 as argument, may be flags or sector number... */ - -#define JSFLASH_PROGRAM (('F'<<8)|56) -struct jsflash_program_arg { -	__u64 data;		/* char* for sparc and sparc64 */ -	__u64 off; -	__u32 size; -}; - -#endif /* _SPARC_JSFLASH_H */ diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h index 427d4684e0d..ec2e2e2aba7 100644 --- a/arch/sparc/include/asm/jump_label.h +++ b/arch/sparc/include/asm/jump_label.h @@ -7,17 +7,20 @@  #define JUMP_LABEL_NOP_SIZE 4 -#define JUMP_LABEL(key, label)					\ -	do {							\ -		asm goto("1:\n\t"				\ -			 "nop\n\t"				\ -			 "nop\n\t"				\ -			 ".pushsection __jump_table,  \"a\"\n\t"\ -			 ".align 4\n\t"				\ -			 ".word 1b, %l[" #label "], %c0\n\t"	\ -			 ".popsection \n\t"			\ -			 : :  "i" (key) :  : label);\ -	} while (0) +static __always_inline bool arch_static_branch(struct static_key *key) +{ +		asm_volatile_goto("1:\n\t" +			 "nop\n\t" +			 "nop\n\t" +			 ".pushsection __jump_table,  \"aw\"\n\t" +			 ".align 4\n\t" +			 ".word 1b, %l[l_yes], %c0\n\t" +			 ".popsection \n\t" +			 : :  "i" (key) : : l_yes); +	return false; +l_yes: +	return true; +}  #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h index feb3578e12c..04465de8f3b 100644 --- a/arch/sparc/include/asm/kdebug_64.h +++ b/arch/sparc/include/asm/kdebug_64.h @@ -3,7 +3,7 @@  struct pt_regs; -extern void bad_trap(struct pt_regs *, long); +void bad_trap(struct pt_regs *, long);  /* Grossly misnamed. */  enum die_val { diff --git a/arch/sparc/include/asm/kgdb.h b/arch/sparc/include/asm/kgdb.h index b6ef301d05b..47366af7a58 100644 --- a/arch/sparc/include/asm/kgdb.h +++ b/arch/sparc/include/asm/kgdb.h @@ -28,9 +28,12 @@ enum regnames {  #define NUMREGBYTES		((GDB_CSR + 1) * 4)  #else  #define NUMREGBYTES		((GDB_Y + 1) * 8) + +struct pt_regs; +asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs);  #endif -extern void arch_kgdb_breakpoint(void); +void arch_kgdb_breakpoint(void);  #define BREAK_INSTR_SIZE	4  #define CACHE_FLUSH_IS_SAFE	1 diff --git a/arch/sparc/include/asm/kprobes.h b/arch/sparc/include/asm/kprobes.h index 5879d71afda..a145d798e11 100644 --- a/arch/sparc/include/asm/kprobes.h +++ b/arch/sparc/include/asm/kprobes.h @@ -43,7 +43,9 @@ struct kprobe_ctlblk {  	struct prev_kprobe prev_kprobe;  }; -extern int kprobe_exceptions_notify(struct notifier_block *self, -				    unsigned long val, void *data); -extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); +int kprobe_exceptions_notify(struct notifier_block *self, +			     unsigned long val, void *data); +int kprobe_fault_handler(struct pt_regs *regs, int trapnr); +asmlinkage void __kprobes kprobe_trap(unsigned long trap_level, +				      struct pt_regs *regs);  #endif /* _SPARC64_KPROBES_H */ diff --git a/arch/sparc/include/asm/ldc.h b/arch/sparc/include/asm/ldc.h index bdb524a7b81..c8c67f621f4 100644 --- a/arch/sparc/include/asm/ldc.h +++ b/arch/sparc/include/asm/ldc.h @@ -4,9 +4,9 @@  #include <asm/hypervisor.h>  extern int ldom_domaining_enabled; -extern void ldom_set_var(const char *var, const char *value); -extern void ldom_reboot(const char *boot_command); -extern void ldom_power_off(void); +void ldom_set_var(const char *var, const char *value); +void ldom_reboot(const char *boot_command); +void ldom_power_off(void);  /* The event handler will be evoked when link state changes   * or data becomes available on the receive side. @@ -51,30 +51,30 @@ struct ldc_channel_config {  struct ldc_channel;  /* Allocate state for a channel.  */ -extern struct ldc_channel *ldc_alloc(unsigned long id, -				     const struct ldc_channel_config *cfgp, -				     void *event_arg); +struct ldc_channel *ldc_alloc(unsigned long id, +			      const struct ldc_channel_config *cfgp, +			      void *event_arg);  /* Shut down and free state for a channel.  */ -extern void ldc_free(struct ldc_channel *lp); +void ldc_free(struct ldc_channel *lp);  /* Register TX and RX queues of the link with the hypervisor.  */ -extern int ldc_bind(struct ldc_channel *lp, const char *name); +int ldc_bind(struct ldc_channel *lp, const char *name);  /* For non-RAW protocols we need to complete a handshake before   * communication can proceed.  ldc_connect() does that, if the   * handshake completes successfully, an LDC_EVENT_UP event will   * be sent up to the driver.   */ -extern int ldc_connect(struct ldc_channel *lp); -extern int ldc_disconnect(struct ldc_channel *lp); +int ldc_connect(struct ldc_channel *lp); +int ldc_disconnect(struct ldc_channel *lp); -extern int ldc_state(struct ldc_channel *lp); +int ldc_state(struct ldc_channel *lp);  /* Read and write operations.  Only valid when the link is up.  */ -extern int ldc_write(struct ldc_channel *lp, const void *buf, -		     unsigned int size); -extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size); +int ldc_write(struct ldc_channel *lp, const void *buf, +	      unsigned int size); +int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);  #define LDC_MAP_SHADOW	0x01  #define LDC_MAP_DIRECT	0x02 @@ -92,22 +92,22 @@ struct ldc_trans_cookie {  };  struct scatterlist; -extern int ldc_map_sg(struct ldc_channel *lp, -		      struct scatterlist *sg, int num_sg, -		      struct ldc_trans_cookie *cookies, int ncookies, -		      unsigned int map_perm); +int ldc_map_sg(struct ldc_channel *lp, +	       struct scatterlist *sg, int num_sg, +	       struct ldc_trans_cookie *cookies, int ncookies, +	       unsigned int map_perm); -extern int ldc_map_single(struct ldc_channel *lp, -			  void *buf, unsigned int len, -			  struct ldc_trans_cookie *cookies, int ncookies, -			  unsigned int map_perm); +int ldc_map_single(struct ldc_channel *lp, +		   void *buf, unsigned int len, +		   struct ldc_trans_cookie *cookies, int ncookies, +		   unsigned int map_perm); -extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies, -		      int ncookies); +void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies, +	       int ncookies); -extern int ldc_copy(struct ldc_channel *lp, int copy_dir, -		    void *buf, unsigned int len, unsigned long offset, -		    struct ldc_trans_cookie *cookies, int ncookies); +int ldc_copy(struct ldc_channel *lp, int copy_dir, +	     void *buf, unsigned int len, unsigned long offset, +	     struct ldc_trans_cookie *cookies, int ncookies);  static inline int ldc_get_dring_entry(struct ldc_channel *lp,  				      void *buf, unsigned int len, @@ -127,12 +127,12 @@ static inline int ldc_put_dring_entry(struct ldc_channel *lp,  	return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);  } -extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, -				 struct ldc_trans_cookie *cookies, -				 int *ncookies, unsigned int map_perm); +void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, +			  struct ldc_trans_cookie *cookies, +			  int *ncookies, unsigned int map_perm); -extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf, -			       unsigned int len, -			       struct ldc_trans_cookie *cookies, int ncookies); +void ldc_free_exp_dring(struct ldc_channel *lp, void *buf, +		        unsigned int len, +		        struct ldc_trans_cookie *cookies, int ncookies);  #endif /* _SPARC64_LDC_H */ diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h index 3ea5964c43b..204771cd74a 100644 --- a/arch/sparc/include/asm/leon.h +++ b/arch/sparc/include/asm/leon.h @@ -8,21 +8,6 @@  #ifndef LEON_H_INCLUDE  #define LEON_H_INCLUDE -#ifdef CONFIG_SPARC_LEON - -#define ASI_LEON_NOCACHE	0x01 - -#define ASI_LEON_DCACHE_MISS	0x1 - -#define ASI_LEON_CACHEREGS	0x02 -#define ASI_LEON_IFLUSH		0x10 -#define ASI_LEON_DFLUSH		0x11 - -#define ASI_LEON_MMUFLUSH	0x18 -#define ASI_LEON_MMUREGS	0x19 -#define ASI_LEON_BYPASS		0x1c -#define ASI_LEON_FLUSH_PAGE	0x10 -  /* mmu register access, ASI_LEON_MMUREGS */  #define LEON_CNR_CTRL		0x000  #define LEON_CNR_CTXP		0x100 @@ -52,57 +37,11 @@  #define LEON_DIAGF_VALID	0x2000  #define LEON_DIAGF_VALID_SHIFT	13 -/* - *  Interrupt Sources - * - *  The interrupt source numbers directly map to the trap type and to - *  the bits used in the Interrupt Clear, Interrupt Force, Interrupt Mask, - *  and the Interrupt Pending Registers. - */ -#define LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR	1 -#define LEON_INTERRUPT_UART_1_RX_TX		2 -#define LEON_INTERRUPT_UART_0_RX_TX		3 -#define LEON_INTERRUPT_EXTERNAL_0		4 -#define LEON_INTERRUPT_EXTERNAL_1		5 -#define LEON_INTERRUPT_EXTERNAL_2		6 -#define LEON_INTERRUPT_EXTERNAL_3		7 -#define LEON_INTERRUPT_TIMER1			8 -#define LEON_INTERRUPT_TIMER2			9 -#define LEON_INTERRUPT_EMPTY1			10 -#define LEON_INTERRUPT_EMPTY2			11 -#define LEON_INTERRUPT_OPEN_ETH			12 -#define LEON_INTERRUPT_EMPTY4			13 -#define LEON_INTERRUPT_EMPTY5			14 -#define LEON_INTERRUPT_EMPTY6			15 -  /* irq masks */  #define LEON_HARD_INT(x)	(1 << (x))	/* irq 0-15 */  #define LEON_IRQMASK_R		0x0000fffe	/* bit 15- 1 of lregs.irqmask */  #define LEON_IRQPRIO_R		0xfffe0000	/* bit 31-17 of lregs.irqmask */ -/* leon uart register definitions */ -#define LEON_OFF_UDATA	0x0 -#define LEON_OFF_USTAT	0x4 -#define LEON_OFF_UCTRL	0x8 -#define LEON_OFF_USCAL	0xc - -#define LEON_UCTRL_RE	0x01 -#define LEON_UCTRL_TE	0x02 -#define LEON_UCTRL_RI	0x04 -#define LEON_UCTRL_TI	0x08 -#define LEON_UCTRL_PS	0x10 -#define LEON_UCTRL_PE	0x20 -#define LEON_UCTRL_FL	0x40 -#define LEON_UCTRL_LB	0x80 - -#define LEON_USTAT_DR	0x01 -#define LEON_USTAT_TS	0x02 -#define LEON_USTAT_TH	0x04 -#define LEON_USTAT_BR	0x08 -#define LEON_USTAT_OV	0x10 -#define LEON_USTAT_PE	0x20 -#define LEON_USTAT_FE	0x40 -  #define LEON_MCFG2_SRAMDIS		0x00002000  #define LEON_MCFG2_SDRAMEN		0x00004000  #define LEON_MCFG2_SRAMBANKSZ		0x00001e00	/* [12-9] */ @@ -112,8 +51,6 @@  #define LEON_TCNT0_MASK	0x7fffff -#define LEON_USTAT_ERROR (LEON_USTAT_OV | LEON_USTAT_PE | LEON_USTAT_FE) -/* no break yet */  #define ASI_LEON3_SYSCTRL		0x02  #define ASI_LEON3_SYSCTRL_ICFG		0x08 @@ -123,15 +60,6 @@  #ifndef __ASSEMBLY__ -/* do a virtual address read without cache */ -static inline unsigned long leon_readnobuffer_reg(unsigned long paddr) -{ -	unsigned long retval; -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r"(retval) : "r"(paddr), "i"(ASI_LEON_NOCACHE)); -	return retval; -} -  /* do a physical address bypass write, i.e. for 0x80000000 */  static inline void leon_store_reg(unsigned long paddr, unsigned long value)  { @@ -148,47 +76,14 @@ static inline unsigned long leon_load_reg(unsigned long paddr)  	return retval;  } -static inline void leon_srmmu_disabletlb(void) -{ -	unsigned int retval; -	__asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), -			     "i"(ASI_LEON_MMUREGS)); -	retval |= LEON_CNR_CTRL_TLBDIS; -	__asm__ __volatile__("sta %0, [%%g0] %2\n\t" : : "r"(retval), "r"(0), -			     "i"(ASI_LEON_MMUREGS) : "memory"); -} - -static inline void leon_srmmu_enabletlb(void) -{ -	unsigned int retval; -	__asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), -			     "i"(ASI_LEON_MMUREGS)); -	retval = retval & ~LEON_CNR_CTRL_TLBDIS; -	__asm__ __volatile__("sta %0, [%%g0] %2\n\t" : : "r"(retval), "r"(0), -			     "i"(ASI_LEON_MMUREGS) : "memory"); -} -  /* macro access for leon_load_reg() and leon_store_reg() */  #define LEON3_BYPASS_LOAD_PA(x)	    (leon_load_reg((unsigned long)(x)))  #define LEON3_BYPASS_STORE_PA(x, v) (leon_store_reg((unsigned long)(x), (unsigned long)(v))) -#define LEON3_BYPASS_ANDIN_PA(x, v) LEON3_BYPASS_STORE_PA(x, LEON3_BYPASS_LOAD_PA(x) & v) -#define LEON3_BYPASS_ORIN_PA(x, v)  LEON3_BYPASS_STORE_PA(x, LEON3_BYPASS_LOAD_PA(x) | v)  #define LEON_BYPASS_LOAD_PA(x)      leon_load_reg((unsigned long)(x))  #define LEON_BYPASS_STORE_PA(x, v)  leon_store_reg((unsigned long)(x), (unsigned long)(v)) -#define LEON_REGLOAD_PA(x)          leon_load_reg((unsigned long)(x)+LEON_PREGS) -#define LEON_REGSTORE_PA(x, v)      leon_store_reg((unsigned long)(x)+LEON_PREGS, (unsigned long)(v)) -#define LEON_REGSTORE_OR_PA(x, v)   LEON_REGSTORE_PA(x, LEON_REGLOAD_PA(x) | (unsigned long)(v)) -#define LEON_REGSTORE_AND_PA(x, v)  LEON_REGSTORE_PA(x, LEON_REGLOAD_PA(x) & (unsigned long)(v)) - -/* macro access for leon_readnobuffer_reg() */ -#define LEON_BYPASSCACHE_LOAD_VA(x) leon_readnobuffer_reg((unsigned long)(x)) - -extern void sparc_leon_eirq_register(int eirq); -extern void leon_init(void); -extern void leon_switch_mm(void); -extern void leon_init_IRQ(void); -extern unsigned long last_valid_pfn; +void leon_switch_mm(void); +void leon_init_IRQ(void);  static inline unsigned long sparc_leon3_get_dcachecfg(void)  { @@ -213,7 +108,7 @@ static inline int sparc_leon3_snooping_enabled(void)  {  	u32 cctrl;  	__asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl)); -        return (cctrl >> 23) & 1; +	return ((cctrl >> 23) & 1) && ((cctrl >> 17) & 1);  };  static inline void sparc_leon3_disable_cache(void) @@ -224,11 +119,23 @@ static inline void sparc_leon3_disable_cache(void)  			  "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2");  }; +static inline unsigned long sparc_leon3_asr17(void) +{ +	u32 asr17; +	__asm__ __volatile__ ("rd %%asr17, %0\n\t" : "=r"(asr17)); +	return asr17; +}; + +static inline int sparc_leon3_cpuid(void) +{ +	return sparc_leon3_asr17() >> 28; +} +  #endif /*!__ASSEMBLY__*/  #ifdef CONFIG_SMP -# define LEON3_IRQ_RESCHEDULE		13 -# define LEON3_IRQ_TICKER		(leon_percpu_timer_dev[0].irq) +# define LEON3_IRQ_IPI_DEFAULT		13 +# define LEON3_IRQ_TICKER		(leon3_gptimer_irq)  # define LEON3_IRQ_CROSS_CALL		15  #endif @@ -280,9 +187,6 @@ static inline void sparc_leon3_disable_cache(void)  #error cannot determine LEON_PAGE_SIZE_LEON  #endif -#define PAGE_MIN_SHIFT   (12) -#define PAGE_MIN_SIZE    (1UL << PAGE_MIN_SHIFT) -  #define LEON3_XCCR_SETS_MASK  0x07000000UL  #define LEON3_XCCR_SSIZE_MASK 0x00f00000UL @@ -290,23 +194,16 @@ static inline void sparc_leon3_disable_cache(void)  #define LEON2_CFG_SSIZE_MASK 0x00007000UL  #ifndef __ASSEMBLY__ -extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr); -extern void leon_flush_icache_all(void); -extern void leon_flush_dcache_all(void); -extern void leon_flush_cache_all(void); -extern void leon_flush_tlb_all(void); -extern int leon_flush_during_switch; -extern int leon_flush_needed(void); -  struct vm_area_struct; -extern void leon_flush_icache_all(void); -extern void leon_flush_dcache_all(void); -extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); -extern void leon_flush_cache_all(void); -extern void leon_flush_tlb_all(void); + +unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr); +void leon_flush_icache_all(void); +void leon_flush_dcache_all(void); +void leon_flush_cache_all(void); +void leon_flush_tlb_all(void);  extern int leon_flush_during_switch; -extern int leon_flush_needed(void); -extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); +int leon_flush_needed(void); +void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page);  /* struct that hold LEON3 cache configuration registers */  struct leon3_cacheregs { @@ -315,64 +212,41 @@ struct leon3_cacheregs {  	unsigned long dccr;	/* 0x0c - Data Cache Configuration Register */  }; -/* struct that hold LEON2 cache configuration register - * & configuration register - */ -struct leon2_cacheregs { -	unsigned long ccr, cfg; -}; - -#ifdef __KERNEL__ - +#include <linux/irq.h>  #include <linux/interrupt.h>  struct device_node; -extern int sparc_leon_eirq_get(int eirq, int cpu); -extern irqreturn_t sparc_leon_eirq_isr(int dummy, void *dev_id); -extern void sparc_leon_eirq_register(int eirq); -extern void leon_clear_clock_irq(void); -extern void leon_load_profile_irq(int cpu, unsigned int limit); -extern void leon_init_timers(irq_handler_t counter_fn); -extern void leon_clear_clock_irq(void); -extern void leon_load_profile_irq(int cpu, unsigned int limit); -extern void leon_trans_init(struct device_node *dp); -extern void leon_node_init(struct device_node *dp, struct device_node ***nextp); -extern void leon_init_IRQ(void); -extern void leon_init(void); -extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr); -extern void init_leon(void); -extern void poke_leonsparc(void); -extern void leon3_getCacheRegs(struct leon3_cacheregs *regs); -extern int leon_flush_needed(void); -extern void leon_switch_mm(void); -extern int srmmu_swprobe_trace; +struct task_struct; +unsigned int leon_build_device_irq(unsigned int real_irq, +				   irq_flow_handler_t flow_handler, +				   const char *name, int do_ack); +void leon_update_virq_handling(unsigned int virq, +			       irq_flow_handler_t flow_handler, +			       const char *name, int do_ack); +void leon_init_timers(void); +void leon_trans_init(struct device_node *dp); +void leon_node_init(struct device_node *dp, struct device_node ***nextp); +void init_leon(void); +void poke_leonsparc(void); +void leon3_getCacheRegs(struct leon3_cacheregs *regs); +extern int leon3_ticker_irq;  #ifdef CONFIG_SMP -extern int leon_smp_nrcpus(void); -extern void leon_clear_profile_irq(int cpu); -extern void leon_smp_done(void); -extern void leon_boot_cpus(void); -extern int leon_boot_one_cpu(int i); +int leon_smp_nrcpus(void); +void leon_clear_profile_irq(int cpu); +void leon_smp_done(void); +void leon_boot_cpus(void); +int leon_boot_one_cpu(int i, struct task_struct *);  void leon_init_smp(void); -extern void cpu_probe(void); -extern void cpu_idle(void); -extern void init_IRQ(void); -extern void cpu_panic(void); -extern int __leon_processor_id(void);  void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); +irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused); -extern unsigned int real_irq_entry[], smpleon_ticker[]; -extern unsigned int patchme_maybe_smp_msg[]; -extern unsigned long trapbase_cpu1[]; -extern unsigned long trapbase_cpu2[]; -extern unsigned long trapbase_cpu3[]; -extern unsigned int t_nmi[], linux_trap_ipi15_leon[]; -extern unsigned int linux_trap_ipi15_sun4m[]; +extern unsigned int smpleon_ipi[]; +extern unsigned int linux_trap_ipi15_leon[]; +extern int leon_ipi_irq;  #endif /* CONFIG_SMP */ -#endif /* __KERNEL__ */ -  #endif /* __ASSEMBLY__ */  /* macros used in leon_mm.c */ @@ -380,18 +254,4 @@ extern unsigned int linux_trap_ipi15_sun4m[];  #define _pfn_valid(pfn)	 ((pfn < last_valid_pfn) && (pfn >= PFN(phys_base)))  #define _SRMMU_PTE_PMASK_LEON 0xffffffff -#else /* defined(CONFIG_SPARC_LEON) */ - -/* nop definitions for !LEON case */ -#define leon_init() do {} while (0) -#define leon_switch_mm() do {} while (0) -#define leon_init_IRQ() do {} while (0) -#define init_leon() do {} while (0) -#define leon_smp_done() do {} while (0) -#define leon_boot_cpus() do {} while (0) -#define leon_boot_one_cpu(i) 1 -#define leon_init_smp() do {} while (0) - -#endif /* !defined(CONFIG_SPARC_LEON) */ -  #endif diff --git a/arch/sparc/include/asm/leon_amba.h b/arch/sparc/include/asm/leon_amba.h index 618e8882179..24ec48c3ff9 100644 --- a/arch/sparc/include/asm/leon_amba.h +++ b/arch/sparc/include/asm/leon_amba.h @@ -47,6 +47,7 @@ struct amba_prom_registers {  #define LEON3_GPTIMER_LD 4  #define LEON3_GPTIMER_IRQEN 8  #define LEON3_GPTIMER_SEPIRQ 8 +#define LEON3_GPTIMER_TIMERS 0x7  #define LEON23_REG_TIMER_CONTROL_EN    0x00000001 /* 1 = enable counting */  /* 0 = hold scalar and counter */ @@ -87,8 +88,6 @@ struct amba_prom_registers {  #define LEON3_GPTIMER_CONFIG_NRTIMERS(c) ((c)->config & 0x7)  #define LEON3_GPTIMER_CTRL_ISPENDING(r)  (((r)&LEON3_GPTIMER_CTRL_PENDING) ? 1 : 0) -#ifdef CONFIG_SPARC_LEON -  #ifndef __ASSEMBLY__  struct leon3_irqctrl_regs_map { @@ -100,9 +99,8 @@ struct leon3_irqctrl_regs_map {  	u32 mpbroadcast;  	u32 notused02;  	u32 notused03; -	u32 notused10; -	u32 notused11; -	u32 notused12; +	u32 ampctrl; +	u32 icsel[2];  	u32 notused13;  	u32 notused20;  	u32 notused21; @@ -112,6 +110,7 @@ struct leon3_irqctrl_regs_map {  	u32 force[16];  	/* Extended IRQ registers */  	u32 intid[16];	/* 0xc0 */ +	u32 unused[(0x1000-0x100)/4];  };  struct leon3_apbuart_regs_map { @@ -180,6 +179,7 @@ struct amba_ahb_device {  struct device_node;  void _amba_init(struct device_node *dp, struct device_node ***nextp); +extern unsigned long amba_system_id;  extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs;  extern struct leon3_gptimer_regs_map *leon3_gptimer_regs;  extern struct amba_apb_device leon_percpu_timer_dev[16]; @@ -254,10 +254,13 @@ extern unsigned int sparc_leon_eirq;  #define GAISLER_L2C      0xffe	/* internal device: leon2compat */  #define GAISLER_PLUGPLAY 0xfff	/* internal device: plug & play configarea */ +/* Chip IDs */ +#define AEROFLEX_UT699    0x0699 +#define LEON4_NEXTREME1   0x0102 +#define GAISLER_GR712RC   0x0712 +  #define amba_vendor(x) (((x) >> 24) & 0xff)  #define amba_device(x) (((x) >> 12) & 0xfff) -#endif /* !defined(CONFIG_SPARC_LEON) */ -  #endif diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h new file mode 100644 index 00000000000..049d067ed8b --- /dev/null +++ b/arch/sparc/include/asm/leon_pci.h @@ -0,0 +1,22 @@ +/* + * asm/leon_pci.h + * + * Copyright (C) 2011 Aeroflex Gaisler AB, Daniel Hellstrom + */ + +#ifndef _ASM_LEON_PCI_H_ +#define _ASM_LEON_PCI_H_ + +/* PCI related definitions */ +struct leon_pci_info { +	struct pci_ops *ops; +	struct resource	io_space; +	struct resource	mem_space; +	struct resource	busn; +	int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); +}; + +void leon_pci_init(struct platform_device *ofdev, +		   struct leon_pci_info *info); + +#endif /* _ASM_LEON_PCI_H_ */ diff --git a/arch/sparc/include/asm/linkage.h b/arch/sparc/include/asm/linkage.h deleted file mode 100644 index 291c2d01c44..00000000000 --- a/arch/sparc/include/asm/linkage.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -/* Nothing to see here... */ - -#endif diff --git a/arch/sparc/include/asm/local.h b/arch/sparc/include/asm/local.h deleted file mode 100644 index bc80815a435..00000000000 --- a/arch/sparc/include/asm/local.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SPARC_LOCAL_H -#define _SPARC_LOCAL_H - -#include <asm-generic/local.h> - -#endif diff --git a/arch/sparc/include/asm/local64.h b/arch/sparc/include/asm/local64.h deleted file mode 100644 index 36c93b5cc23..00000000000 --- a/arch/sparc/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm-generic/local64.h> diff --git a/arch/sparc/include/asm/machines.h b/arch/sparc/include/asm/machines.h index cd9c099567e..fd6ddb05d1b 100644 --- a/arch/sparc/include/asm/machines.h +++ b/arch/sparc/include/asm/machines.h @@ -12,11 +12,6 @@ struct Sun_Machine_Models {  	unsigned char id_machtype;  }; -/* Current number of machines we know about that has an IDPROM - * machtype entry including one entry for the 0x80 OBP machines. - */ -#define NUM_SUN_MACHINES   16 -  /* The machine type in the idprom area looks like this:   *   * --------------- @@ -24,36 +19,20 @@ struct Sun_Machine_Models {   * ---------------   *  7    4 3    0   * - * The ARCH field determines the architecture line (sun4, sun4c, etc). + * The ARCH field determines the architecture line (sun4m, etc).   * The MACH field determines the machine make within that architecture.   */  #define SM_ARCH_MASK  0xf0 -#define SM_SUN4       0x20  #define  M_LEON       0x30 -#define SM_SUN4C      0x50  #define SM_SUN4M      0x70  #define SM_SUN4M_OBP  0x80  #define SM_TYP_MASK   0x0f -/* Sun4 machines */ -#define SM_4_260      0x01    /* Sun 4/200 series */ -#define SM_4_110      0x02    /* Sun 4/100 series */ -#define SM_4_330      0x03    /* Sun 4/300 series */ -#define SM_4_470      0x04    /* Sun 4/400 series */  /* Leon machines */  #define M_LEON3_SOC   0x02    /* Leon3 SoC */ -/* Sun4c machines                Full Name              - PROM NAME */ -#define SM_4C_SS1     0x01    /* Sun4c SparcStation 1   - Sun 4/60  */ -#define SM_4C_IPC     0x02    /* Sun4c SparcStation IPC - Sun 4/40  */ -#define SM_4C_SS1PLUS 0x03    /* Sun4c SparcStation 1+  - Sun 4/65  */ -#define SM_4C_SLC     0x04    /* Sun4c SparcStation SLC - Sun 4/20  */ -#define SM_4C_SS2     0x05    /* Sun4c SparcStation 2   - Sun 4/75  */ -#define SM_4C_ELC     0x06    /* Sun4c SparcStation ELC - Sun 4/25  */ -#define SM_4C_IPX     0x07    /* Sun4c SparcStation IPX - Sun 4/50  */ -  /* Sun4m machines, these predate the OpenBoot.  These values only mean   * something if the value in the ARCH field is SM_SUN4M, if it is   * SM_SUN4M_OBP then you have the following situation: diff --git a/arch/sparc/include/asm/mbus.h b/arch/sparc/include/asm/mbus.h index 69f07a022ee..14128bcc582 100644 --- a/arch/sparc/include/asm/mbus.h +++ b/arch/sparc/include/asm/mbus.h @@ -8,14 +8,10 @@  #define _SPARC_MBUS_H  #include <asm/ross.h>    /* HyperSparc stuff */ -#include <asm/cypress.h> /* Cypress Chips */  #include <asm/viking.h>  /* Ugh, bug city... */  enum mbus_module {  	HyperSparc        = 0, -	Cypress           = 1, -	Cypress_vE        = 2, -	Cypress_vD        = 3,  	Swift_ok          = 4,  	Swift_bad_c       = 5,  	Swift_lots_o_bugs = 6, diff --git a/arch/sparc/include/asm/mc146818rtc.h b/arch/sparc/include/asm/mc146818rtc.h index 67ed9e3a023..d8e72f37dc4 100644 --- a/arch/sparc/include/asm/mc146818rtc.h +++ b/arch/sparc/include/asm/mc146818rtc.h @@ -1,5 +1,10 @@  #ifndef ___ASM_SPARC_MC146818RTC_H  #define ___ASM_SPARC_MC146818RTC_H + +#include <linux/spinlock.h> + +extern spinlock_t rtc_lock; +  #if defined(__sparc__) && defined(__arch64__)  #include <asm/mc146818rtc_64.h>  #else diff --git a/arch/sparc/include/asm/mdesc.h b/arch/sparc/include/asm/mdesc.h index 9faa046713f..aebeb88f70d 100644 --- a/arch/sparc/include/asm/mdesc.h +++ b/arch/sparc/include/asm/mdesc.h @@ -12,13 +12,13 @@ struct mdesc_handle;   * the first argument to all of the operational calls that work   * on mdescs.   */ -extern struct mdesc_handle *mdesc_grab(void); -extern void mdesc_release(struct mdesc_handle *); +struct mdesc_handle *mdesc_grab(void); +void mdesc_release(struct mdesc_handle *);  #define MDESC_NODE_NULL		(~(u64)0) -extern u64 mdesc_node_by_name(struct mdesc_handle *handle, -			      u64 from_node, const char *name); +u64 mdesc_node_by_name(struct mdesc_handle *handle, +		       u64 from_node, const char *name);  #define mdesc_for_each_node_by_name(__hdl, __node, __name) \  	for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \  	     (__node) != MDESC_NODE_NULL; \ @@ -34,9 +34,9 @@ extern u64 mdesc_node_by_name(struct mdesc_handle *handle,   *   * These same rules apply to mdesc_node_name().   */ -extern const void *mdesc_get_property(struct mdesc_handle *handle, -				      u64 node, const char *name, int *lenp); -extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); +const void *mdesc_get_property(struct mdesc_handle *handle, +			       u64 node, const char *name, int *lenp); +const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);  /* MD arc iteration, the standard sequence is:   * @@ -50,16 +50,16 @@ extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);  #define MDESC_ARC_TYPE_FWD	"fwd"  #define MDESC_ARC_TYPE_BACK	"back" -extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, -			  const char *arc_type); +u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, +		   const char *arc_type);  #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \  	for (__arc = mdesc_next_arc(__hdl, __node, __type); \  	     (__arc) != MDESC_NODE_NULL; \  	     __arc = mdesc_next_arc(__hdl, __arc, __type)) -extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); +u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); -extern void mdesc_update(void); +void mdesc_update(void);  struct mdesc_notifier_client {  	void (*add)(struct mdesc_handle *handle, u64 node); @@ -69,11 +69,12 @@ struct mdesc_notifier_client {  	struct mdesc_notifier_client	*next;  }; -extern void mdesc_register_notifier(struct mdesc_notifier_client *client); +void mdesc_register_notifier(struct mdesc_notifier_client *client); -extern void mdesc_fill_in_cpu_data(cpumask_t *mask); -extern void mdesc_populate_present_mask(cpumask_t *mask); +void mdesc_fill_in_cpu_data(cpumask_t *mask); +void mdesc_populate_present_mask(cpumask_t *mask); +void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask); -extern void sun4v_mdesc_init(void); +void sun4v_mdesc_init(void);  #endif diff --git a/arch/sparc/include/asm/memblock.h b/arch/sparc/include/asm/memblock.h deleted file mode 100644 index c67b047ef85..00000000000 --- a/arch/sparc/include/asm/memblock.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SPARC64_MEMBLOCK_H -#define _SPARC64_MEMBLOCK_H - -#include <asm/oplib.h> - -#define MEMBLOCK_DBG(fmt...) prom_printf(fmt) - -#endif /* !(_SPARC64_MEMBLOCK_H) */ diff --git a/arch/sparc/include/asm/memreg.h b/arch/sparc/include/asm/memreg.h deleted file mode 100644 index 845ad2b3918..00000000000 --- a/arch/sparc/include/asm/memreg.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _SPARC_MEMREG_H -#define _SPARC_MEMREG_H -/* memreg.h:  Definitions of the values found in the synchronous - *            and asynchronous memory error registers when a fault - *            occurs on the sun4c. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -/* First the synchronous error codes, these are usually just - * normal page faults. - */ - -#define SUN4C_SYNC_WDRESET   0x0001  /* watchdog reset */ -#define SUN4C_SYNC_SIZE      0x0002  /* bad access size? whuz this? */ -#define SUN4C_SYNC_PARITY    0x0008  /* bad ram chips caused a parity error */ -#define SUN4C_SYNC_SBUS      0x0010  /* the SBUS had some problems... */ -#define SUN4C_SYNC_NOMEM     0x0020  /* translation to non-existent ram */ -#define SUN4C_SYNC_PROT      0x0040  /* access violated pte protections */ -#define SUN4C_SYNC_NPRESENT  0x0080  /* pte said that page was not present */ -#define SUN4C_SYNC_BADWRITE  0x8000  /* while writing something went bogus */ - -#define SUN4C_SYNC_BOLIXED  \ -        (SUN4C_SYNC_WDRESET | SUN4C_SYNC_SIZE | SUN4C_SYNC_SBUS | \ -         SUN4C_SYNC_NOMEM | SUN4C_SYNC_PARITY) - -/* Now the asynchronous error codes, these are almost always produced - * by the cache writing things back to memory and getting a bad translation. - * Bad DVMA transactions can cause these faults too. - */ - -#define SUN4C_ASYNC_BADDVMA 0x0010  /* error during DVMA access */ -#define SUN4C_ASYNC_NOMEM   0x0020  /* write back pointed to bad phys addr */ -#define SUN4C_ASYNC_BADWB   0x0080  /* write back points to non-present page */ - -/* Memory parity error register with associated bit constants. */ -#ifndef __ASSEMBLY__ -extern __volatile__ unsigned long __iomem *sun4c_memerr_reg; -#endif - -#define	SUN4C_MPE_ERROR	0x80	/* Parity error detected. (ro) */ -#define	SUN4C_MPE_MULTI	0x40	/* Multiple parity errors detected. (ro) */ -#define	SUN4C_MPE_TEST	0x20	/* Write inverse parity. (rw) */ -#define	SUN4C_MPE_CHECK	0x10	/* Enable parity checking. (rw) */ -#define	SUN4C_MPE_ERR00	0x08	/* Parity error in bits 0-7. (ro) */ -#define	SUN4C_MPE_ERR08	0x04	/* Parity error in bits 8-15. (ro) */ -#define	SUN4C_MPE_ERR16	0x02	/* Parity error in bits 16-23. (ro) */ -#define	SUN4C_MPE_ERR24	0x01	/* Parity error in bits 24-31. (ro) */ -#define	SUN4C_MPE_ERRS	0x0F	/* Bit mask for the error bits. (ro) */ - -#endif /* !(_SPARC_MEMREG_H) */ diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h index c3029ad6619..59bb5938d85 100644 --- a/arch/sparc/include/asm/mman.h +++ b/arch/sparc/include/asm/mman.h @@ -1,33 +1,10 @@  #ifndef __SPARC_MMAN_H__  #define __SPARC_MMAN_H__ -#include <asm-generic/mman-common.h> +#include <uapi/asm/mman.h> -/* SunOS'ified... */ - -#define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */ -#define MAP_NORESERVE   0x40            /* don't reserve swap pages */ -#define MAP_INHERIT     0x80            /* SunOS doesn't do this, but... */ -#define MAP_LOCKED      0x100           /* lock the mapping */ -#define _MAP_NEW        0x80000000      /* Binary compatibility is fun... */ - -#define MAP_GROWSDOWN	0x0200		/* stack-like segment */ -#define MAP_DENYWRITE	0x0800		/* ETXTBSY */ -#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */ - -#define MCL_CURRENT     0x2000          /* lock all currently mapped pages */ -#define MCL_FUTURE      0x4000          /* lock all additions to address space */ - -#define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */ -#define MAP_NONBLOCK	0x10000		/* do not block on IO */ -#define MAP_STACK	0x20000		/* give out an address that is best suited for process/thread stacks */ -#define MAP_HUGETLB	0x40000		/* create a huge page mapping */ - -#ifdef __KERNEL__  #ifndef __ASSEMBLY__  #define arch_mmap_check(addr,len,flags)	sparc_mmap_check(addr,len)  int sparc_mmap_check(unsigned long addr, unsigned long len);  #endif -#endif -  #endif /* __SPARC_MMAN_H__ */ diff --git a/arch/sparc/include/asm/mmu_32.h b/arch/sparc/include/asm/mmu_32.h index ccd36d26615..6f056e535cf 100644 --- a/arch/sparc/include/asm/mmu_32.h +++ b/arch/sparc/include/asm/mmu_32.h @@ -4,4 +4,7 @@  /* Default "unsigned long" context */  typedef unsigned long mm_context_t; +/* mm/srmmu.c */ +extern ctxd_t *srmmu_ctx_table_phys; +  #endif diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h index 9067dc50053..70067ce184b 100644 --- a/arch/sparc/include/asm/mmu_64.h +++ b/arch/sparc/include/asm/mmu_64.h @@ -30,22 +30,8 @@  #define CTX_PGSZ_MASK		((CTX_PGSZ_BITS << CTX_PGSZ0_SHIFT) | \  				 (CTX_PGSZ_BITS << CTX_PGSZ1_SHIFT)) -#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)  #define CTX_PGSZ_BASE	CTX_PGSZ_8KB -#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB) -#define CTX_PGSZ_BASE	CTX_PGSZ_64KB -#else -#error No page size specified in kernel configuration -#endif - -#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) -#define CTX_PGSZ_HUGE		CTX_PGSZ_4MB -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) -#define CTX_PGSZ_HUGE		CTX_PGSZ_512KB -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) -#define CTX_PGSZ_HUGE		CTX_PGSZ_64KB -#endif - +#define CTX_PGSZ_HUGE	CTX_PGSZ_4MB  #define CTX_PGSZ_KERN	CTX_PGSZ_4MB  /* Thus, when running on UltraSPARC-III+ and later, we use the following @@ -81,9 +67,9 @@ struct tsb {  	unsigned long pte;  } __attribute__((aligned(TSB_ENTRY_ALIGNMENT))); -extern void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte); -extern void tsb_flush(unsigned long ent, unsigned long tag); -extern void tsb_init(struct tsb *tsb, unsigned long size); +void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte); +void tsb_flush(unsigned long ent, unsigned long tag); +void tsb_init(struct tsb *tsb, unsigned long size);  struct tsb_config {  	struct tsb		*tsb; @@ -96,7 +82,7 @@ struct tsb_config {  #define MM_TSB_BASE	0 -#ifdef CONFIG_HUGETLB_PAGE +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)  #define MM_TSB_HUGE	1  #define MM_NUM_TSBS	2  #else diff --git a/arch/sparc/include/asm/mmu_context_32.h b/arch/sparc/include/asm/mmu_context_32.h index 671a997b9e6..2df2a9be8f6 100644 --- a/arch/sparc/include/asm/mmu_context_32.h +++ b/arch/sparc/include/asm/mmu_context_32.h @@ -1,8 +1,6 @@  #ifndef __SPARC_MMU_CONTEXT_H  #define __SPARC_MMU_CONTEXT_H -#include <asm/btfixup.h> -  #ifndef __ASSEMBLY__  #include <asm-generic/mm_hooks.h> @@ -11,26 +9,21 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)  {  } -/* - * Initialize a new mmu context.  This is invoked when a new +/* Initialize a new mmu context.  This is invoked when a new   * address space instance (unique or shared) is instantiated.   */ -#define init_new_context(tsk, mm) (((mm)->context = NO_CONTEXT), 0) +int init_new_context(struct task_struct *tsk, struct mm_struct *mm); -/* - * Destroy a dead context.  This occurs when mmput drops the +/* Destroy a dead context.  This occurs when mmput drops the   * mm_users count to zero, the mmaps have been released, and   * all the page tables have been flushed.  Our job is to destroy   * any remaining processor-specific state.   */ -BTFIXUPDEF_CALL(void, destroy_context, struct mm_struct *) - -#define destroy_context(mm) BTFIXUP_CALL(destroy_context)(mm) +void destroy_context(struct mm_struct *mm);  /* Switch the current MM context. */ -BTFIXUPDEF_CALL(void, switch_mm, struct mm_struct *, struct mm_struct *, struct task_struct *) - -#define switch_mm(old_mm, mm, tsk) BTFIXUP_CALL(switch_mm)(old_mm, mm, tsk) +void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, +	       struct task_struct *tsk);  #define deactivate_mm(tsk,mm)	do { } while (0) diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h index 666a73fef28..b84be675e50 100644 --- a/arch/sparc/include/asm/mmu_context_64.h +++ b/arch/sparc/include/asm/mmu_context_64.h @@ -6,7 +6,6 @@  #ifndef __ASSEMBLY__  #include <linux/spinlock.h> -#include <asm/system.h>  #include <asm/spitfire.h>  #include <asm-generic/mm_hooks.h> @@ -18,26 +17,26 @@ extern spinlock_t ctx_alloc_lock;  extern unsigned long tlb_context_cache;  extern unsigned long mmu_context_bmap[]; -extern void get_new_mmu_context(struct mm_struct *mm); +void get_new_mmu_context(struct mm_struct *mm);  #ifdef CONFIG_SMP -extern void smp_new_mmu_context_version(void); +void smp_new_mmu_context_version(void);  #else  #define smp_new_mmu_context_version() do { } while (0)  #endif -extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); -extern void destroy_context(struct mm_struct *mm); +int init_new_context(struct task_struct *tsk, struct mm_struct *mm); +void destroy_context(struct mm_struct *mm); -extern void __tsb_context_switch(unsigned long pgd_pa, -				 struct tsb_config *tsb_base, -				 struct tsb_config *tsb_huge, -				 unsigned long tsb_descr_pa); +void __tsb_context_switch(unsigned long pgd_pa, +			  struct tsb_config *tsb_base, +			  struct tsb_config *tsb_huge, +			  unsigned long tsb_descr_pa);  static inline void tsb_context_switch(struct mm_struct *mm)  {  	__tsb_context_switch(__pa(mm->pgd),  			     &mm->context.tsb_block[0], -#ifdef CONFIG_HUGETLB_PAGE +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)  			     (mm->context.tsb_block[1].tsb ?  			      &mm->context.tsb_block[1] :  			      NULL) @@ -47,9 +46,11 @@ static inline void tsb_context_switch(struct mm_struct *mm)  			     , __pa(&mm->context.tsb_descr[0]));  } -extern void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long mm_rss); +void tsb_grow(struct mm_struct *mm, +	      unsigned long tsb_index, +	      unsigned long mm_rss);  #ifdef CONFIG_SMP -extern void smp_tsb_sync(struct mm_struct *mm); +void smp_tsb_sync(struct mm_struct *mm);  #else  #define smp_tsb_sync(__mm) do { } while (0)  #endif @@ -67,9 +68,9 @@ extern void smp_tsb_sync(struct mm_struct *mm);  	: "r" (CTX_HWBITS((__mm)->context)), \  	  "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU)) -extern void __flush_tlb_mm(unsigned long, unsigned long); +void __flush_tlb_mm(unsigned long, unsigned long); -/* Switch the current MM context.  Interrupts are disabled.  */ +/* Switch the current MM context. */  static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)  {  	unsigned long ctx_valid, flags; diff --git a/arch/sparc/include/asm/mmzone.h b/arch/sparc/include/asm/mmzone.h index e8c648741ed..99d9b9f577b 100644 --- a/arch/sparc/include/asm/mmzone.h +++ b/arch/sparc/include/asm/mmzone.h @@ -8,8 +8,6 @@  extern struct pglist_data *node_data[];  #define NODE_DATA(nid)		(node_data[nid]) -#define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn) -#define node_end_pfn(nid)	(NODE_DATA(nid)->node_end_pfn)  extern int numa_cpu_lookup_table[];  extern cpumask_t numa_cpumask_lookup_table[]; diff --git a/arch/sparc/include/asm/module.h b/arch/sparc/include/asm/module.h deleted file mode 100644 index ff8e02d8033..00000000000 --- a/arch/sparc/include/asm/module.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __SPARC_MODULE_H -#define __SPARC_MODULE_H -struct mod_arch_specific { }; - -/* - * Use some preprocessor magic to define the correct symbol - * for sparc32 and sparc64. - * Elf_Addr becomes Elf32_Addr for sparc32 and Elf64_Addr for sparc64 - */ -#define ___ELF(a, b, c) a##b##c -#define __ELF(a, b, c)  ___ELF(a, b, c) -#define  _Elf(t)        __ELF(Elf, CONFIG_BITS, t) -#define  _ELF(t)        __ELF(ELF, CONFIG_BITS, t) - -#define Elf_Shdr     _Elf(_Shdr) -#define Elf_Sym      _Elf(_Sym) -#define Elf_Ehdr     _Elf(_Ehdr) -#define Elf_Rela     _Elf(_Rela) -#define Elf_Addr     _Elf(_Addr) - -#define ELF_R_SYM    _ELF(_R_SYM) -#define ELF_R_TYPE   _ELF(_R_TYPE) - -#endif /* __SPARC_MODULE_H */ diff --git a/arch/sparc/include/asm/mpmbox.h b/arch/sparc/include/asm/mpmbox.h deleted file mode 100644 index f8423039b24..00000000000 --- a/arch/sparc/include/asm/mpmbox.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * mpmbox.h:  Interface and defines for the OpenProm mailbox - *               facilities for MP machines under Linux. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef _SPARC_MPMBOX_H -#define _SPARC_MPMBOX_H - -/* The prom allocates, for each CPU on the machine an unsigned - * byte in physical ram.  You probe the device tree prom nodes - * for these values.  The purpose of this byte is to be able to - * pass messages from one cpu to another. - */ - -/* These are the main message types we have to look for in our - * Cpu mailboxes, based upon these values we decide what course - * of action to take. - */ - -/* The CPU is executing code in the kernel. */ -#define MAILBOX_ISRUNNING     0xf0 - -/* Another CPU called romvec->pv_exit(), you should call - * prom_stopcpu() when you see this in your mailbox. - */ -#define MAILBOX_EXIT          0xfb - -/* Another CPU called romvec->pv_enter(), you should call - * prom_cpuidle() when this is seen. - */ -#define MAILBOX_GOSPIN        0xfc - -/* Another CPU has hit a breakpoint either into kadb or the prom - * itself.  Just like MAILBOX_GOSPIN, you should call prom_cpuidle() - * at this point. - */ -#define MAILBOX_BPT_SPIN      0xfd - -/* Oh geese, some other nitwit got a damn watchdog reset.  The party's - * over so go call prom_stopcpu(). - */ -#define MAILBOX_WDOG_STOP     0xfe - -#ifndef __ASSEMBLY__ - -/* Handy macro's to determine a cpu's state. */ - -/* Is the cpu still in Power On Self Test? */ -#define MBOX_POST_P(letter)  ((letter) >= 0x00 && (letter) <= 0x7f) - -/* Is the cpu at the 'ok' prompt of the PROM? */ -#define MBOX_PROMPROMPT_P(letter) ((letter) >= 0x80 && (letter) <= 0x8f) - -/* Is the cpu spinning in the PROM? */ -#define MBOX_PROMSPIN_P(letter) ((letter) >= 0x90 && (letter) <= 0xef) - -/* Sanity check... This is junk mail, throw it out. */ -#define MBOX_BOGON_P(letter) ((letter) >= 0xf1 && (letter) <= 0xfa) - -/* Is the cpu actively running an application/kernel-code? */ -#define MBOX_RUNNING_P(letter) ((letter) == MAILBOX_ISRUNNING) - -#endif /* !(__ASSEMBLY__) */ - -#endif /* !(_SPARC_MPMBOX_H) */ diff --git a/arch/sparc/include/asm/msgbuf.h b/arch/sparc/include/asm/msgbuf.h deleted file mode 100644 index efc7cbe9788..00000000000 --- a/arch/sparc/include/asm/msgbuf.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _SPARC_MSGBUF_H -#define _SPARC_MSGBUF_H - -/* - * The msqid64_ds structure for sparc64 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -#if defined(__sparc__) && defined(__arch64__) -# define PADDING(x) -#else -# define PADDING(x) unsigned int x; -#endif - - -struct msqid64_ds { -	struct ipc64_perm msg_perm; -	PADDING(__pad1) -	__kernel_time_t msg_stime;	/* last msgsnd time */ -	PADDING(__pad2) -	__kernel_time_t msg_rtime;	/* last msgrcv time */ -	PADDING(__pad3) -	__kernel_time_t msg_ctime;	/* last change time */ -	unsigned long  msg_cbytes;	/* current number of bytes on queue */ -	unsigned long  msg_qnum;	/* number of messages in queue */ -	unsigned long  msg_qbytes;	/* max number of bytes on queue */ -	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */ -	__kernel_pid_t msg_lrpid;	/* last receive pid */ -	unsigned long  __unused1; -	unsigned long  __unused2; -}; -#undef PADDING -#endif /* _SPARC_MSGBUF_H */ diff --git a/arch/sparc/include/asm/mutex.h b/arch/sparc/include/asm/mutex.h deleted file mode 100644 index 458c1f7fbc1..00000000000 --- a/arch/sparc/include/asm/mutex.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Pull in the generic implementation for the mutex fastpath. - * - * TODO: implement optimized primitives instead, or leave the generic - * implementation in place, or pick the atomic_xchg() based generic - * implementation. (see asm-generic/mutex-xchg.h for details) - */ - -#include <asm-generic/mutex-dec.h> diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h index 72e6500e7ab..26ad2b2607c 100644 --- a/arch/sparc/include/asm/nmi.h +++ b/arch/sparc/include/asm/nmi.h @@ -1,13 +1,13 @@  #ifndef __NMI_H  #define __NMI_H -extern int __init nmi_init(void); -extern void perfctr_irq(int irq, struct pt_regs *regs); -extern void nmi_adjust_hz(unsigned int new_hz); +int __init nmi_init(void); +void perfctr_irq(int irq, struct pt_regs *regs); +void nmi_adjust_hz(unsigned int new_hz);  extern atomic_t nmi_active; -extern void start_nmi_watchdog(void *unused); -extern void stop_nmi_watchdog(void *unused); +void start_nmi_watchdog(void *unused); +void stop_nmi_watchdog(void *unused);  #endif /* __NMI_H */ diff --git a/arch/sparc/include/asm/ns87303.h b/arch/sparc/include/asm/ns87303.h index 686defe6aaa..6b947ee0f6a 100644 --- a/arch/sparc/include/asm/ns87303.h +++ b/arch/sparc/include/asm/ns87303.h @@ -37,7 +37,7 @@  /* Power and Test Register (PTR) bits */  #define PTR_LPTB_IRQ7	0x08  #define PTR_LEVEL_IRQ	0x80	/* When not ECP/EPP: Use level IRQ           */ -#define PTR_LPT_REG_DIR	0x80	/* When ECP/EPP: LPT CTR controlls direction */ +#define PTR_LPT_REG_DIR	0x80	/* When ECP/EPP: LPT CTR controls direction */  				/*               of the parallel port	     */  /* Function Control Register (FCR) bits */ @@ -79,7 +79,6 @@  #include <linux/spinlock.h> -#include <asm/system.h>  #include <asm/io.h>  extern spinlock_t ns87303_lock; diff --git a/arch/sparc/include/asm/obio.h b/arch/sparc/include/asm/obio.h index 4ade0c8a2c7..910c1d9af1f 100644 --- a/arch/sparc/include/asm/obio.h +++ b/arch/sparc/include/asm/obio.h @@ -220,19 +220,6 @@ static inline void cc_set_igen(unsigned gen)  			      "i" (ASI_M_MXCC));  } -/* +-------+-------------+-----------+------------------------------------+ - * | bcast |  devid      |   sid     |              levels mask           | - * +-------+-------------+-----------+------------------------------------+ - *  31      30         23 22       15 14                                 0 - */ -#define IGEN_MESSAGE(bcast, devid, sid, levels) \ -	(((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels)) -             -static inline void sun4d_send_ipi(int cpu, int level) -{ -	cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1))); -} -  #endif /* !__ASSEMBLY__ */  #endif /* !(_SPARC_OBIO_H) */ diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h index 81cd43432dc..47eaafad15c 100644 --- a/arch/sparc/include/asm/openprom.h +++ b/arch/sparc/include/asm/openprom.h @@ -39,7 +39,7 @@ struct linux_dev_v2_funcs {  	int (*v2_dev_open)(char *devpath);  	void (*v2_dev_close)(int d);  	int (*v2_dev_read)(int d, char *buf, int nbytes); -	int (*v2_dev_write)(int d, char *buf, int nbytes); +	int (*v2_dev_write)(int d, const char *buf, int nbytes);  	int (*v2_dev_seek)(int d, int hi, int lo);  	/* Never issued (multistage load support) */ diff --git a/arch/sparc/include/asm/openpromio.h b/arch/sparc/include/asm/openpromio.h deleted file mode 100644 index 917fb8e9c63..00000000000 --- a/arch/sparc/include/asm/openpromio.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef	_SPARC_OPENPROMIO_H -#define	_SPARC_OPENPROMIO_H - -#include <linux/compiler.h> -#include <linux/ioctl.h> -#include <linux/types.h> - -/* - * SunOS and Solaris /dev/openprom definitions. The ioctl values - * were chosen to be exactly equal to the SunOS equivalents. - */ - -struct openpromio -{ -	u_int	oprom_size;		/* Actual size of the oprom_array. */ -	char	oprom_array[1];		/* Holds property names and values. */ -}; - -#define	OPROMMAXPARAM	4096		/* Maximum size of oprom_array. */ - -#define	OPROMGETOPT		0x20004F01 -#define	OPROMSETOPT		0x20004F02 -#define	OPROMNXTOPT		0x20004F03 -#define	OPROMSETOPT2		0x20004F04 -#define	OPROMNEXT		0x20004F05 -#define	OPROMCHILD		0x20004F06 -#define	OPROMGETPROP		0x20004F07 -#define	OPROMNXTPROP		0x20004F08 -#define	OPROMU2P		0x20004F09 -#define	OPROMGETCONS		0x20004F0A -#define	OPROMGETFBNAME		0x20004F0B -#define	OPROMGETBOOTARGS	0x20004F0C -/* Linux extensions */				/* Arguments in oprom_array: */ -#define OPROMSETCUR		0x20004FF0	/* int node - Sets current node */ -#define OPROMPCI2NODE		0x20004FF1	/* int pci_bus, pci_devfn - Sets current node to PCI device's node */ -#define OPROMPATH2NODE		0x20004FF2	/* char path[] - Set current node from fully qualified PROM path */ - -/* - * Return values from OPROMGETCONS: - */ - -#define OPROMCONS_NOT_WSCONS    0 -#define OPROMCONS_STDIN_IS_KBD  0x1     /* stdin device is kbd */ -#define OPROMCONS_STDOUT_IS_FB  0x2     /* stdout is a framebuffer */ -#define OPROMCONS_OPENPROM      0x4     /* supports openboot */ - - -/* - *  NetBSD/OpenBSD /dev/openprom definitions. - */ - -struct opiocdesc -{ -	int	op_nodeid;		/* PROM Node ID (value-result) */ -	int	op_namelen;		/* Length of op_name. */ -	char	__user *op_name;	/* Pointer to the property name. */ -	int	op_buflen;		/* Length of op_buf (value-result) */ -	char	__user *op_buf;		/* Pointer to buffer. */ -}; - -#define	OPIOCGET	_IOWR('O', 1, struct opiocdesc) -#define	OPIOCSET	_IOW('O', 2, struct opiocdesc) -#define	OPIOCNEXTPROP	_IOWR('O', 3, struct opiocdesc) -#define	OPIOCGETOPTNODE	_IOR('O', 4, int) -#define	OPIOCGETNEXT	_IOWR('O', 5, int) -#define	OPIOCGETCHILD	_IOWR('O', 6, int) - -#endif /* _SPARC_OPENPROMIO_H */ - diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h index 51296a6f500..56a09b9d7b1 100644 --- a/arch/sparc/include/asm/oplib_32.h +++ b/arch/sparc/include/asm/oplib_32.h @@ -43,59 +43,28 @@ extern struct linux_nodeops *prom_nodeops;  /* You must call prom_init() before using any of the library services,   * preferably as early as possible.  Pass it the romvec pointer.   */ -extern void prom_init(struct linux_romvec *rom_ptr); +void prom_init(struct linux_romvec *rom_ptr);  /* Boot argument acquisition, returns the boot command line string. */ -extern char *prom_getbootargs(void); - -/* Device utilities. */ - -/* Map and unmap devices in IO space at virtual addresses. Note that the - * virtual address you pass is a request and the prom may put your mappings - * somewhere else, so check your return value as that is where your new - * mappings really are! - * - * Another note, these are only available on V2 or higher proms! - */ -extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); -extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); - -/* Device operations. */ - -/* Open the device described by the passed string.  Note, that the format - * of the string is different on V0 vs. V2->higher proms.  The caller must - * know what he/she is doing!  Returns the device descriptor, an int. - */ -extern int prom_devopen(char *device_string); - -/* Close a previously opened device described by the passed integer - * descriptor. - */ -extern int prom_devclose(int device_handle); - -/* Do a seek operation on the device described by the passed integer - * descriptor. - */ -extern void prom_seek(int device_handle, unsigned int seek_hival, -		      unsigned int seek_lowval); +char *prom_getbootargs(void);  /* Miscellaneous routines, don't really fit in any category per se. */  /* Reboot the machine with the command line passed. */ -extern void prom_reboot(char *boot_command); +void prom_reboot(char *boot_command);  /* Evaluate the forth string passed. */ -extern void prom_feval(char *forth_string); +void prom_feval(char *forth_string);  /* Enter the prom, with possibility of continuation with the 'go'   * command in newer proms.   */ -extern void prom_cmdline(void); +void prom_cmdline(void);  /* Enter the prom, with no chance of continuation for the stand-alone   * which calls this.   */ -extern void prom_halt(void) __attribute__ ((noreturn)); +void __noreturn prom_halt(void);  /* Set the PROM 'sync' callback function to the passed function pointer.   * When the user gives the 'sync' command at the prom prompt while the @@ -104,151 +73,105 @@ extern void prom_halt(void) __attribute__ ((noreturn));   * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX   */  typedef void (*sync_func_t)(void); -extern void prom_setsync(sync_func_t func_ptr); +void prom_setsync(sync_func_t func_ptr);  /* Acquire the IDPROM of the root node in the prom device tree.  This   * gets passed a buffer where you would like it stuffed.  The return value   * is the format type of this idprom or 0xff on error.   */ -extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); +unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);  /* Get the prom major version. */ -extern int prom_version(void); +int prom_version(void);  /* Get the prom plugin revision. */ -extern int prom_getrev(void); +int prom_getrev(void);  /* Get the prom firmware revision. */ -extern int prom_getprev(void); - -/* Character operations to/from the console.... */ - -/* Non-blocking get character from console. */ -extern int prom_nbgetchar(void); - -/* Non-blocking put character to console. */ -extern int prom_nbputchar(char character); - -/* Blocking get character from console. */ -extern char prom_getchar(void); +int prom_getprev(void); -/* Blocking put character to console. */ -extern void prom_putchar(char character); +/* Write a buffer of characters to the console. */ +void prom_console_write_buf(const char *buf, int len);  /* Prom's internal routines, don't use in kernel/boot code. */ -extern void prom_printf(const char *fmt, ...); -extern void prom_write(const char *buf, unsigned int len); +__printf(1, 2) void prom_printf(const char *fmt, ...); +void prom_write(const char *buf, unsigned int len);  /* Multiprocessor operations... */  /* Start the CPU with the given device tree node, context table, and context   * at the passed program counter.   */ -extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, -			 int context, char *program_counter); - -/* Stop the CPU with the passed device tree node. */ -extern int prom_stopcpu(int cpunode); - -/* Idle the CPU with the passed device tree node. */ -extern int prom_idlecpu(int cpunode); - -/* Re-Start the CPU with the passed device tree node. */ -extern int prom_restartcpu(int cpunode); - -/* PROM memory allocation facilities... */ - -/* Allocated at possibly the given virtual address a chunk of the - * indicated size. - */ -extern char *prom_alloc(char *virt_hint, unsigned int size); - -/* Free a previously allocated chunk. */ -extern void prom_free(char *virt_addr, unsigned int size); - -/* Sun4/sun4c specific memory-management startup hook. */ - -/* Map the passed segment in the given context at the passed - * virtual address. - */ -extern void prom_putsegment(int context, unsigned long virt_addr, -			    int physical_segment); +int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, +		  int context, char *program_counter); +/* Initialize the memory lists based upon the prom version. */ +void prom_meminit(void);  /* PROM device tree traversal functions... */  /* Get the child node of the given node, or zero if no child exists. */ -extern phandle prom_getchild(phandle parent_node); +phandle prom_getchild(phandle parent_node);  /* Get the next sibling node of the given node, or zero if no further   * siblings exist.   */ -extern phandle prom_getsibling(phandle node); +phandle prom_getsibling(phandle node);  /* Get the length, at the passed node, of the given property type.   * Returns -1 on error (ie. no such property at this node).   */ -extern int prom_getproplen(phandle thisnode, const char *property); +int prom_getproplen(phandle thisnode, const char *property);  /* Fetch the requested property using the given buffer.  Returns   * the number of bytes the prom put into your buffer or -1 on error.   */ -extern int __must_check prom_getproperty(phandle thisnode, const char *property, -					 char *prop_buffer, int propbuf_size); +int __must_check prom_getproperty(phandle thisnode, const char *property, +				  char *prop_buffer, int propbuf_size);  /* Acquire an integer property. */ -extern int prom_getint(phandle node, char *property); +int prom_getint(phandle node, char *property);  /* Acquire an integer property, with a default value. */ -extern int prom_getintdefault(phandle node, char *property, int defval); +int prom_getintdefault(phandle node, char *property, int defval);  /* Acquire a boolean property, 0=FALSE 1=TRUE. */ -extern int prom_getbool(phandle node, char *prop); +int prom_getbool(phandle node, char *prop);  /* Acquire a string property, null string on error. */ -extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize); - -/* Does the passed node have the given "name"? YES=1 NO=0 */ -extern int prom_nodematch(phandle thisnode, char *name); +void prom_getstring(phandle node, char *prop, char *buf, int bufsize);  /* Search all siblings starting at the passed node for "name" matching   * the given string.  Returns the node on success, zero on failure.   */ -extern phandle prom_searchsiblings(phandle node_start, char *name); - -/* Return the first property type, as a string, for the given node. - * Returns a null string on error. - */ -extern char *prom_firstprop(phandle node, char *buffer); +phandle prom_searchsiblings(phandle node_start, char *name);  /* Returns the next property after the passed property for the given   * node.  Returns null string on failure.   */ -extern char *prom_nextprop(phandle node, char *prev_property, char *buffer); +char *prom_nextprop(phandle node, char *prev_property, char *buffer);  /* Returns phandle of the path specified */ -extern phandle prom_finddevice(char *name); - -/* Returns 1 if the specified node has given property. */ -extern int prom_node_has_property(phandle node, char *property); +phandle prom_finddevice(char *name);  /* Set the indicated property at the given node with the passed value.   * Returns the number of bytes of your value that the prom took.   */ -extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, -			int value_size); +int prom_setprop(phandle node, const char *prop_name, char *prop_value, +		 int value_size); -extern phandle prom_pathtoinode(char *path); -extern phandle prom_inst2pkg(int); +phandle prom_inst2pkg(int);  /* Dorking with Bus ranges... */  /* Apply promlib probes OBIO ranges to registers. */ -extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); +void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);  /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ -extern void prom_apply_generic_ranges(phandle node, phandle parent, -				      struct linux_prom_registers *sbusregs, int nregs); +void prom_apply_generic_ranges(phandle node, phandle parent, +			       struct linux_prom_registers *sbusregs, int nregs); + +void prom_ranges_init(void);  /* CPU probing helpers.  */  int cpu_find_by_instance(int instance, phandle *prom_node, int *mid); diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h index c9cc078e3e3..f34682430fc 100644 --- a/arch/sparc/include/asm/oplib_64.h +++ b/arch/sparc/include/asm/oplib_64.h @@ -18,8 +18,8 @@ extern char prom_version[];   */  extern phandle prom_root_node; -/* PROM stdin and stdout */ -extern int prom_stdin, prom_stdout; +/* PROM stdout */ +extern int prom_stdout;  /* /chosen node of the prom device tree, this stays constant after   * initialization is complete. @@ -62,140 +62,100 @@ struct linux_mem_p1275 {  /* You must call prom_init() before using any of the library services,   * preferably as early as possible.  Pass it the romvec pointer.   */ -extern void prom_init(void *cif_handler, void *cif_stack); +void prom_init(void *cif_handler, void *cif_stack);  /* Boot argument acquisition, returns the boot command line string. */ -extern char *prom_getbootargs(void); - -/* Device utilities. */ - -/* Device operations. */ - -/* Open the device described by the passed string.  Note, that the format - * of the string is different on V0 vs. V2->higher proms.  The caller must - * know what he/she is doing!  Returns the device descriptor, an int. - */ -extern int prom_devopen(const char *device_string); - -/* Close a previously opened device described by the passed integer - * descriptor. - */ -extern int prom_devclose(int device_handle); - -/* Do a seek operation on the device described by the passed integer - * descriptor. - */ -extern void prom_seek(int device_handle, unsigned int seek_hival, -		      unsigned int seek_lowval); +char *prom_getbootargs(void);  /* Miscellaneous routines, don't really fit in any category per se. */  /* Reboot the machine with the command line passed. */ -extern void prom_reboot(const char *boot_command); +void prom_reboot(const char *boot_command);  /* Evaluate the forth string passed. */ -extern void prom_feval(const char *forth_string); +void prom_feval(const char *forth_string);  /* Enter the prom, with possibility of continuation with the 'go'   * command in newer proms.   */ -extern void prom_cmdline(void); +void prom_cmdline(void);  /* Enter the prom, with no chance of continuation for the stand-alone   * which calls this.   */ -extern void prom_halt(void) __attribute__ ((noreturn)); +void prom_halt(void) __attribute__ ((noreturn));  /* Halt and power-off the machine. */ -extern void prom_halt_power_off(void) __attribute__ ((noreturn)); - -/* Set the PROM 'sync' callback function to the passed function pointer. - * When the user gives the 'sync' command at the prom prompt while the - * kernel is still active, the prom will call this routine. - * - */ -typedef int (*callback_func_t)(long *cmd); -extern void prom_setcallback(callback_func_t func_ptr); +void prom_halt_power_off(void) __attribute__ ((noreturn));  /* Acquire the IDPROM of the root node in the prom device tree.  This   * gets passed a buffer where you would like it stuffed.  The return value   * is the format type of this idprom or 0xff on error.   */ -extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); - -/* Character operations to/from the console.... */ - -/* Non-blocking get character from console. */ -extern int prom_nbgetchar(void); - -/* Non-blocking put character to console. */ -extern int prom_nbputchar(char character); - -/* Blocking get character from console. */ -extern char prom_getchar(void); +unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); -/* Blocking put character to console. */ -extern void prom_putchar(char character); +/* Write a buffer of characters to the console. */ +void prom_console_write_buf(const char *buf, int len);  /* Prom's internal routines, don't use in kernel/boot code. */ -extern void prom_printf(const char *fmt, ...); -extern void prom_write(const char *buf, unsigned int len); +__printf(1, 2) void prom_printf(const char *fmt, ...); +void prom_write(const char *buf, unsigned int len);  /* Multiprocessor operations... */  #ifdef CONFIG_SMP  /* Start the CPU with the given device tree node at the passed program   * counter with the given arg passed in via register %o0.   */ -extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg); +void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg);  /* Start the CPU with the given cpu ID at the passed program   * counter with the given arg passed in via register %o0.   */ -extern void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg); +void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg);  /* Stop the CPU with the given cpu ID.  */ -extern void prom_stopcpu_cpuid(int cpuid); +void prom_stopcpu_cpuid(int cpuid);  /* Stop the current CPU. */ -extern void prom_stopself(void); +void prom_stopself(void);  /* Idle the current CPU. */ -extern void prom_idleself(void); +void prom_idleself(void);  /* Resume the CPU with the passed device tree node. */ -extern void prom_resumecpu(int cpunode); +void prom_resumecpu(int cpunode);  #endif  /* Power management interfaces. */  /* Put the current CPU to sleep. */ -extern void prom_sleepself(void); +void prom_sleepself(void);  /* Put the entire system to sleep. */ -extern int prom_sleepsystem(void); +int prom_sleepsystem(void);  /* Initiate a wakeup event. */ -extern int prom_wakeupsystem(void); +int prom_wakeupsystem(void);  /* MMU and memory related OBP interfaces. */  /* Get unique string identifying SIMM at given physical address. */ -extern int prom_getunumber(int syndrome_code, -			   unsigned long phys_addr, -			   char *buf, int buflen); +int prom_getunumber(int syndrome_code, +		    unsigned long phys_addr, +		    char *buf, int buflen);  /* Retain physical memory to the caller across soft resets. */ -extern int prom_retain(const char *name, unsigned long size, -		       unsigned long align, unsigned long *paddr); +int prom_retain(const char *name, unsigned long size, +		unsigned long align, unsigned long *paddr);  /* Load explicit I/D TLB entries into the calling processor. */ -extern long prom_itlb_load(unsigned long index, -			   unsigned long tte_data, -			   unsigned long vaddr); +long prom_itlb_load(unsigned long index, +		    unsigned long tte_data, +		    unsigned long vaddr); -extern long prom_dtlb_load(unsigned long index, -			   unsigned long tte_data, -			   unsigned long vaddr); +long prom_dtlb_load(unsigned long index, +		    unsigned long tte_data, +		    unsigned long vaddr);  /* Map/Unmap client program address ranges.  First the format of   * the mapping mode argument. @@ -210,83 +170,81 @@ extern long prom_dtlb_load(unsigned long index,  #define PROM_MAP_IE	0x0100 /* Invert-Endianness */  #define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED) -extern int prom_map(int mode, unsigned long size, -		    unsigned long vaddr, unsigned long paddr); -extern void prom_unmap(unsigned long size, unsigned long vaddr); +int prom_map(int mode, unsigned long size, +	     unsigned long vaddr, unsigned long paddr); +void prom_unmap(unsigned long size, unsigned long vaddr);  /* PROM device tree traversal functions... */  /* Get the child node of the given node, or zero if no child exists. */ -extern phandle prom_getchild(phandle parent_node); +phandle prom_getchild(phandle parent_node);  /* Get the next sibling node of the given node, or zero if no further   * siblings exist.   */ -extern phandle prom_getsibling(phandle node); +phandle prom_getsibling(phandle node);  /* Get the length, at the passed node, of the given property type.   * Returns -1 on error (ie. no such property at this node).   */ -extern int prom_getproplen(phandle thisnode, const char *property); +int prom_getproplen(phandle thisnode, const char *property);  /* Fetch the requested property using the given buffer.  Returns   * the number of bytes the prom put into your buffer or -1 on error.   */ -extern int prom_getproperty(phandle thisnode, const char *property, -			    char *prop_buffer, int propbuf_size); +int prom_getproperty(phandle thisnode, const char *property, +		     char *prop_buffer, int propbuf_size);  /* Acquire an integer property. */ -extern int prom_getint(phandle node, const char *property); +int prom_getint(phandle node, const char *property);  /* Acquire an integer property, with a default value. */ -extern int prom_getintdefault(phandle node, const char *property, int defval); +int prom_getintdefault(phandle node, const char *property, int defval);  /* Acquire a boolean property, 0=FALSE 1=TRUE. */ -extern int prom_getbool(phandle node, const char *prop); +int prom_getbool(phandle node, const char *prop);  /* Acquire a string property, null string on error. */ -extern void prom_getstring(phandle node, const char *prop, char *buf, -			   int bufsize); +void prom_getstring(phandle node, const char *prop, char *buf, +		    int bufsize);  /* Does the passed node have the given "name"? YES=1 NO=0 */ -extern int prom_nodematch(phandle thisnode, const char *name); +int prom_nodematch(phandle thisnode, const char *name);  /* Search all siblings starting at the passed node for "name" matching   * the given string.  Returns the node on success, zero on failure.   */ -extern phandle prom_searchsiblings(phandle node_start, const char *name); +phandle prom_searchsiblings(phandle node_start, const char *name);  /* Return the first property type, as a string, for the given node.   * Returns a null string on error. Buffer should be at least 32B long.   */ -extern char *prom_firstprop(phandle node, char *buffer); +char *prom_firstprop(phandle node, char *buffer);  /* Returns the next property after the passed property for the given   * node.  Returns null string on failure. Buffer should be at least 32B long.   */ -extern char *prom_nextprop(phandle node, const char *prev_property, char *buf); +char *prom_nextprop(phandle node, const char *prev_property, char *buf);  /* Returns 1 if the specified node has given property. */ -extern int prom_node_has_property(phandle node, const char *property); +int prom_node_has_property(phandle node, const char *property);  /* Returns phandle of the path specified */ -extern phandle prom_finddevice(const char *name); +phandle prom_finddevice(const char *name);  /* Set the indicated property at the given node with the passed value.   * Returns the number of bytes of your value that the prom took.   */ -extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, -			int value_size); +int prom_setprop(phandle node, const char *prop_name, char *prop_value, +		 int value_size); -extern phandle prom_pathtoinode(const char *path); -extern phandle prom_inst2pkg(int); -extern int prom_service_exists(const char *service_name); -extern void prom_sun4v_guest_soft_state(void); +phandle prom_inst2pkg(int); +void prom_sun4v_guest_soft_state(void); -extern int prom_ihandle2path(int handle, char *buffer, int bufsize); +int prom_ihandle2path(int handle, char *buffer, int bufsize);  /* Client interface level routines. */ -extern void p1275_cmd_direct(unsigned long *); +void p1275_cmd_direct(unsigned long *);  #endif /* !(__SPARC64_OPLIB_H) */ diff --git a/arch/sparc/include/asm/page.h b/arch/sparc/include/asm/page.h index f21de034902..1be2fdec626 100644 --- a/arch/sparc/include/asm/page.h +++ b/arch/sparc/include/asm/page.h @@ -1,5 +1,8 @@  #ifndef ___ASM_SPARC_PAGE_H  #define ___ASM_SPARC_PAGE_H + +#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT) +  #if defined(__sparc__) && defined(__arch64__)  #include <asm/page_64.h>  #else diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h index 156707b0f18..f82a1f36b65 100644 --- a/arch/sparc/include/asm/page_32.h +++ b/arch/sparc/include/asm/page_32.h @@ -8,18 +8,12 @@  #ifndef _SPARC_PAGE_H  #define _SPARC_PAGE_H -#define PAGE_SHIFT   12 +#include <linux/const.h> -#ifndef __ASSEMBLY__ -/* I have my suspicions... -DaveM */ -#define PAGE_SIZE    (1UL << PAGE_SHIFT) -#else -#define PAGE_SIZE    (1 << PAGE_SHIFT) -#endif +#define PAGE_SHIFT   12 +#define PAGE_SIZE    (_AC(1, UL) << PAGE_SHIFT)  #define PAGE_MASK    (~(PAGE_SIZE-1)) -#include <asm/btfixup.h> -  #ifndef __ASSEMBLY__  #define clear_page(page)	 memset((void *)(page), 0, PAGE_SIZE) @@ -49,12 +43,6 @@ struct sparc_phys_banks {  extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1]; -/* Cache alias structure.  Entry is valid if context != -1. */ -struct cache_palias { -	unsigned long vaddr; -	int context; -}; -  /* passing structs on the Sparc slow us down tremendously... */  /* #define STRICT_MM_TYPECHECKS */ @@ -119,11 +107,7 @@ typedef unsigned long iopgprot_t;  typedef struct page *pgtable_t; -extern unsigned long sparc_unmapped_base; - -BTFIXUPDEF_SETHI(sparc_unmapped_base) - -#define TASK_UNMAPPED_BASE	BTFIXUP_SETHI(sparc_unmapped_base) +#define TASK_UNMAPPED_BASE	0x50000000  #else /* !(__ASSEMBLY__) */ diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h index f0d09b40103..bf109984a03 100644 --- a/arch/sparc/include/asm/page_64.h +++ b/arch/sparc/include/asm/page_64.h @@ -3,13 +3,7 @@  #include <linux/const.h> -#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)  #define PAGE_SHIFT   13 -#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB) -#define PAGE_SHIFT   16 -#else -#error No page size specified in kernel configuration -#endif  #define PAGE_SIZE    (_AC(1,UL) << PAGE_SHIFT)  #define PAGE_MASK    (~(PAGE_SIZE-1)) @@ -21,15 +15,12 @@  #define DCACHE_ALIASING_POSSIBLE  #endif -#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) -#define HPAGE_SHIFT		22 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) -#define HPAGE_SHIFT		19 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) -#define HPAGE_SHIFT		16 -#endif +#define HPAGE_SHIFT		23 +#define REAL_HPAGE_SHIFT	22 + +#define REAL_HPAGE_SIZE		(_AC(1,UL) << REAL_HPAGE_SHIFT) -#ifdef CONFIG_HUGETLB_PAGE +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)  #define HPAGE_SIZE		(_AC(1,UL) << HPAGE_SHIFT)  #define HPAGE_MASK		(~(HPAGE_SIZE - 1UL))  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT) @@ -38,14 +29,19 @@  #ifndef __ASSEMBLY__ +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) +struct pt_regs; +void hugetlb_setup(struct pt_regs *regs); +#endif +  #define WANT_PAGE_VIRTUAL -extern void _clear_page(void *page); +void _clear_page(void *page);  #define clear_page(X)	_clear_page((void *)(X))  struct page; -extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); +void clear_user_page(void *addr, unsigned long vaddr, struct page *page);  #define copy_page(X,Y)	memcpy((void *)(X), (void *)(Y), PAGE_SIZE) -extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage); +void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);  /* Unlike sparc32, sparc64's parameter passing API is more   * sane in that structures which as small enough are passed @@ -60,8 +56,8 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag  /* These are used to make use of C type-checking.. */  typedef struct { unsigned long pte; } pte_t;  typedef struct { unsigned long iopte; } iopte_t; -typedef struct { unsigned int pmd; } pmd_t; -typedef struct { unsigned int pgd; } pgd_t; +typedef struct { unsigned long pmd; } pmd_t; +typedef struct { unsigned long pgd; } pgd_t;  typedef struct { unsigned long pgprot; } pgprot_t;  #define pte_val(x)	((x).pte) @@ -80,8 +76,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;  /* .. while these make it easier on the compiler */  typedef unsigned long pte_t;  typedef unsigned long iopte_t; -typedef unsigned int pmd_t; -typedef unsigned int pgd_t; +typedef unsigned long pmd_t; +typedef unsigned long pgd_t;  typedef unsigned long pgprot_t;  #define pte_val(x)	(x) @@ -98,20 +94,46 @@ typedef unsigned long pgprot_t;  #endif /* (STRICT_MM_TYPECHECKS) */ -typedef struct page *pgtable_t; +typedef pte_t *pgtable_t; + +/* These two values define the virtual address space range in which we + * must forbid 64-bit user processes from making mappings.  It used to + * represent precisely the virtual address space hole present in most + * early sparc64 chips including UltraSPARC-I.  But now it also is + * further constrained by the limits of our page tables, which is + * 43-bits of virtual address. + */ +#define SPARC64_VA_HOLE_TOP	_AC(0xfffffc0000000000,UL) +#define SPARC64_VA_HOLE_BOTTOM	_AC(0x0000040000000000,UL) + +/* The next two defines specify the actual exclusion region we + * enforce, wherein we use a 4GB red zone on each side of the VA hole. + */ +#define VA_EXCLUDE_START (SPARC64_VA_HOLE_BOTTOM - (1UL << 32UL)) +#define VA_EXCLUDE_END   (SPARC64_VA_HOLE_TOP + (1UL << 32UL))  #define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_32BIT) ? \ -				 (_AC(0x0000000070000000,UL)) : \ -				 (_AC(0xfffff80000000000,UL) + (1UL << 32UL))) +				 _AC(0x0000000070000000,UL) : \ +				 VA_EXCLUDE_END)  #include <asm-generic/memory_model.h> +#define PAGE_OFFSET_BY_BITS(X)	(-(_AC(1,UL) << (X))) +extern unsigned long PAGE_OFFSET; +  #endif /* !(__ASSEMBLY__) */ -/* We used to stick this into a hard-coded global register (%g4) - * but that does not make sense anymore. +/* The maximum number of physical memory address bits we support, this + * is used to size various tables used to manage kernel TLB misses and + * also the sparsemem code. + */ +#define MAX_PHYS_ADDRESS_BITS	47 + +/* These two shift counts are used when indexing sparc64_valid_addr_bitmap + * and kpte_linear_bitmap.   */ -#define PAGE_OFFSET		_AC(0xFFFFF80000000000,UL) +#define ILOG2_4MB		22 +#define ILOG2_256MB		28  #ifndef __ASSEMBLY__ diff --git a/arch/sparc/include/asm/param.h b/arch/sparc/include/asm/param.h deleted file mode 100644 index 0bc356bf8c5..00000000000 --- a/arch/sparc/include/asm/param.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _ASMSPARC_PARAM_H -#define _ASMSPARC_PARAM_H - -#define EXEC_PAGESIZE	8192    /* Thanks for sun4's we carry baggage... */ -#include <asm-generic/param.h> - -#endif /* _ASMSPARC_PARAM_H */ diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h index aa4c82648d8..c55291e5b83 100644 --- a/arch/sparc/include/asm/parport.h +++ b/arch/sparc/include/asm/parport.h @@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr)  	return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);  } -static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match) +static int ecpp_probe(struct platform_device *op)  {  	unsigned long base = op->resource[0].start;  	unsigned long config = op->resource[1].start; @@ -192,7 +192,7 @@ out_err:  	return err;  } -static int __devexit ecpp_remove(struct platform_device *op) +static int ecpp_remove(struct platform_device *op)  {  	struct parport *p = dev_get_drvdata(&op->dev);  	int slot = p->dma; @@ -235,19 +235,19 @@ static const struct of_device_id ecpp_match[] = {  	{},  }; -static struct of_platform_driver ecpp_driver = { +static struct platform_driver ecpp_driver = {  	.driver = {  		.name = "ecpp",  		.owner = THIS_MODULE,  		.of_match_table = ecpp_match,  	},  	.probe			= ecpp_probe, -	.remove			= __devexit_p(ecpp_remove), +	.remove			= ecpp_remove,  };  static int parport_pc_find_nonpci_ports(int autoirq, int autodma)  { -	return of_register_platform_driver(&ecpp_driver); +	return platform_driver_register(&ecpp_driver);  }  #endif /* !(_ASM_SPARC64_PARPORT_H */ diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h index 332ac9ab36b..53e9b4987db 100644 --- a/arch/sparc/include/asm/pci_32.h +++ b/arch/sparc/include/asm/pci_32.h @@ -16,16 +16,6 @@  #define PCI_IRQ_NONE		0xffffffff -static inline void pcibios_set_master(struct pci_dev *dev) -{ -	/* No special bus mastering setup handling */ -} - -static inline void pcibios_penalize_isa_irq(int irq, int active) -{ -	/* We don't do dynamic PCI IRQ allocation */ -} -  /* Dynamic DMA mapping stuff.   */  #define PCI_DMA_BUS_IS_PHYS	(0) @@ -42,12 +32,25 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,  }  #endif -struct device_node; -extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); -  #endif /* __KERNEL__ */ +#ifndef CONFIG_LEON_PCI  /* generic pci stuff */  #include <asm-generic/pci.h> +#else +/* + * On LEON PCI Memory space is mapped 1:1 with physical address space. + * + * I/O space is located at low 64Kbytes in PCI I/O space. The I/O addresses + * are converted into CPU addresses to virtual addresses that are mapped with + * MMU to the PCI Host PCI I/O space window which are translated to the low + * 64Kbytes by the Host controller. + */ + +static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) +{ +	return PCI_IRQ_NONE; +} +#endif  #endif /* __SPARC_PCI_H */ diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h index 948b686ec08..bd00a622616 100644 --- a/arch/sparc/include/asm/pci_64.h +++ b/arch/sparc/include/asm/pci_64.h @@ -16,16 +16,6 @@  #define PCI_IRQ_NONE		0xffffffff -static inline void pcibios_set_master(struct pci_dev *dev) -{ -	/* No special bus mastering setup handling */ -} - -static inline void pcibios_penalize_isa_irq(int irq, int active) -{ -	/* We don't do dynamic PCI IRQ allocation */ -} -  /* The PCI address space does not equal the physical memory   * address space.  The networking and block device layers use   * this boolean for bounce buffer decisions. @@ -62,7 +52,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,  /* Return the index of the PCI controller for device PDEV. */ -extern int pci_domain_nr(struct pci_bus *bus); +int pci_domain_nr(struct pci_bus *bus);  static inline int pci_proc_domain(struct pci_bus *bus)  {  	return 1; @@ -74,30 +64,19 @@ static inline int pci_proc_domain(struct pci_bus *bus)  #define HAVE_ARCH_PCI_GET_UNMAPPED_AREA  #define get_pci_unmapped_area get_fb_unmapped_area -extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, -			       enum pci_mmap_state mmap_state, -			       int write_combine); - -extern void -pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, -			struct resource *res); - -extern void -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, -			struct pci_bus_region *region); +int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, +			enum pci_mmap_state mmap_state, +			int write_combine);  static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)  {  	return PCI_IRQ_NONE;  } -struct device_node; -extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); -  #define HAVE_ARCH_PCI_RESOURCE_TO_USER -extern void pci_resource_to_user(const struct pci_dev *dev, int bar, -				 const struct resource *rsrc, -				 resource_size_t *start, resource_size_t *end); +void pci_resource_to_user(const struct pci_dev *dev, int bar, +			  const struct resource *rsrc, +			  resource_size_t *start, resource_size_t *end);  #endif /* __KERNEL__ */  #endif /* __SPARC64_PCI_H */ diff --git a/arch/sparc/include/asm/pcic.h b/arch/sparc/include/asm/pcic.h index f20ef562b26..f4170679259 100644 --- a/arch/sparc/include/asm/pcic.h +++ b/arch/sparc/include/asm/pcic.h @@ -29,11 +29,17 @@ struct linux_pcic {  	int			pcic_imdim;  }; -extern int pcic_probe(void); -/* Erm... MJ redefined pcibios_present() so that it does not work early. */ -extern int pcic_present(void); -extern void sun4m_pci_init_IRQ(void); - +#ifdef CONFIG_PCIC_PCI +int pcic_present(void); +int pcic_probe(void); +void pci_time_init(void); +void sun4m_pci_init_IRQ(void); +#else +static inline int pcic_present(void) { return 0; } +static inline int pcic_probe(void) { return 0; } +static inline void pci_time_init(void) {} +static inline void sun4m_pci_init_IRQ(void) {} +#endif  #endif  /* Size of PCI I/O space which we relocate. */ diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h index a2f5c61f924..cdf800c3326 100644 --- a/arch/sparc/include/asm/pcr.h +++ b/arch/sparc/include/asm/pcr.h @@ -2,13 +2,18 @@  #define __PCR_H  struct pcr_ops { -	u64 (*read)(void); -	void (*write)(u64); +	u64 (*read_pcr)(unsigned long); +	void (*write_pcr)(unsigned long, u64); +	u64 (*read_pic)(unsigned long); +	void (*write_pic)(unsigned long, u64); +	u64 (*nmi_picl_value)(unsigned int nmi_hz); +	u64 pcr_nmi_enable; +	u64 pcr_nmi_disable;  };  extern const struct pcr_ops *pcr_ops; -extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs); -extern void schedule_deferred_pcr_work(void); +void deferred_pcr_work_irq(int irq, struct pt_regs *regs); +void schedule_deferred_pcr_work(void);  #define PCR_PIC_PRIV		0x00000001 /* PIC access is privileged */  #define PCR_STRACE		0x00000002 /* Trace supervisor events  */ @@ -27,20 +32,19 @@ extern void schedule_deferred_pcr_work(void);  #define PCR_N2_SL1_SHIFT	27  #define PCR_N2_OV1		0x80000000 -extern unsigned int picl_shift; - -/* In order to commonize as much of the implementation as - * possible, we use PICH as our counter.  Mostly this is - * to accomodate Niagara-1 which can only count insn cycles - * in PICH. - */ -static inline u64 picl_value(unsigned int nmi_hz) -{ -	u32 delta = local_cpu_data().clock_tick / (nmi_hz << picl_shift); - -	return ((u64)((0 - delta) & 0xffffffff)) << 32; -} - -extern u64 pcr_enable; +#define PCR_N4_OV		0x00000001 /* PIC overflow             */ +#define PCR_N4_TOE		0x00000002 /* Trap On Event            */ +#define PCR_N4_UTRACE		0x00000004 /* Trace user events        */ +#define PCR_N4_STRACE		0x00000008 /* Trace supervisor events  */ +#define PCR_N4_HTRACE		0x00000010 /* Trace hypervisor events  */ +#define PCR_N4_MASK		0x000007e0 /* Event mask               */ +#define PCR_N4_MASK_SHIFT	5 +#define PCR_N4_SL		0x0000f800 /* Event Select             */ +#define PCR_N4_SL_SHIFT		11 +#define PCR_N4_PICNPT		0x00010000 /* PIC non-privileged trap  */ +#define PCR_N4_PICNHT		0x00020000 /* PIC non-hypervisor trap  */ +#define PCR_N4_NTC		0x00040000 /* Next-To-Commit wrap      */ + +int pcr_arch_init(void);  #endif /* __PCR_H */ diff --git a/arch/sparc/include/asm/perf_event.h b/arch/sparc/include/asm/perf_event.h index 6e8bfa1786d..4d3dbe3703e 100644 --- a/arch/sparc/include/asm/perf_event.h +++ b/arch/sparc/include/asm/perf_event.h @@ -4,8 +4,6 @@  #ifdef CONFIG_PERF_EVENTS  #include <asm/ptrace.h> -extern void init_hw_perf_events(void); -  #define perf_arch_fetch_caller_regs(regs, ip)		\  do {							\  	unsigned long _pstate, _asi, _pil, _i7, _fp;	\ @@ -26,8 +24,6 @@ do {							\  	(regs)->u_regs[UREG_I6] = _fp;			\  	(regs)->u_regs[UREG_I7] = _i7;			\  } while (0) -#else -static inline void init_hw_perf_events(void)	{ }  #endif  #endif diff --git a/arch/sparc/include/asm/perfctr.h b/arch/sparc/include/asm/perfctr.h deleted file mode 100644 index 8d8720a8770..00000000000 --- a/arch/sparc/include/asm/perfctr.h +++ /dev/null @@ -1,173 +0,0 @@ -/*---------------------------------------- -  PERFORMANCE INSTRUMENTATION   -  Guillaume Thouvenin           08/10/98 -  David S. Miller               10/06/98 -  ---------------------------------------*/ -#ifndef PERF_COUNTER_API -#define PERF_COUNTER_API - -/* sys_perfctr() interface.  First arg is operation code - * from enumeration below.  The meaning of further arguments - * are determined by the operation code. - * - * NOTE: This system call is no longer provided, use the perf_events - *       infrastructure. - * - * Pointers which are passed by the user are pointers to 64-bit - * integers. - * - * Once enabled, performance counter state is retained until the - * process either exits or performs an exec.  That is, performance - * counters remain enabled for fork/clone children. - */ -enum perfctr_opcode { -	/* Enable UltraSparc performance counters, ARG0 is pointer -	 * to 64-bit accumulator for D0 counter in PIC, ARG1 is pointer -	 * to 64-bit accumulator for D1 counter.  ARG2 is a pointer to -	 * the initial PCR register value to use. -	 */ -	PERFCTR_ON, - -	/* Disable UltraSparc performance counters.  The PCR is written -	 * with zero and the user counter accumulator pointers and -	 * working PCR register value are forgotten. -	 */ -	PERFCTR_OFF, - -	/* Add current D0 and D1 PIC values into user pointers given -	 * in PERFCTR_ON operation.  The PIC is cleared before returning. -	 */ -	PERFCTR_READ, - -	/* Clear the PIC register. */ -	PERFCTR_CLRPIC, - -	/* Begin using a new PCR value, the pointer to which is passed -	 * in ARG0.  The PIC is also cleared after the new PCR value is -	 * written. -	 */ -	PERFCTR_SETPCR, - -	/* Store in pointer given in ARG0 the current PCR register value -	 * being used. -	 */ -	PERFCTR_GETPCR -}; - -/* I don't want the kernel's namespace to be polluted with this - * stuff when this file is included.  --DaveM - */ -#ifndef __KERNEL__ - -#define  PRIV 0x00000001 -#define  SYS  0x00000002 -#define  USR  0x00000004 - -/* Pic.S0 Selection Bit Field Encoding, Ultra-I/II  */ -#define  CYCLE_CNT            0x00000000 -#define  INSTR_CNT            0x00000010 -#define  DISPATCH0_IC_MISS    0x00000020 -#define  DISPATCH0_STOREBUF   0x00000030 -#define  IC_REF               0x00000080 -#define  DC_RD                0x00000090 -#define  DC_WR                0x000000A0 -#define  LOAD_USE             0x000000B0 -#define  EC_REF               0x000000C0 -#define  EC_WRITE_HIT_RDO     0x000000D0 -#define  EC_SNOOP_INV         0x000000E0 -#define  EC_RD_HIT            0x000000F0 - -/* Pic.S0 Selection Bit Field Encoding, Ultra-III  */ -#define  US3_CYCLE_CNT	      	0x00000000 -#define  US3_INSTR_CNT	      	0x00000010 -#define  US3_DISPATCH0_IC_MISS	0x00000020 -#define  US3_DISPATCH0_BR_TGT	0x00000030 -#define  US3_DISPATCH0_2ND_BR	0x00000040 -#define  US3_RSTALL_STOREQ	0x00000050 -#define  US3_RSTALL_IU_USE	0x00000060 -#define  US3_IC_REF		0x00000080 -#define  US3_DC_RD		0x00000090 -#define  US3_DC_WR		0x000000a0 -#define  US3_EC_REF		0x000000c0 -#define  US3_EC_WR_HIT_RTO	0x000000d0 -#define  US3_EC_SNOOP_INV	0x000000e0 -#define  US3_EC_RD_MISS		0x000000f0 -#define  US3_PC_PORT0_RD	0x00000100 -#define  US3_SI_SNOOP		0x00000110 -#define  US3_SI_CIQ_FLOW	0x00000120 -#define  US3_SI_OWNED		0x00000130 -#define  US3_SW_COUNT_0		0x00000140 -#define  US3_IU_BR_MISS_TAKEN	0x00000150 -#define  US3_IU_BR_COUNT_TAKEN	0x00000160 -#define  US3_DISP_RS_MISPRED	0x00000170 -#define  US3_FA_PIPE_COMPL	0x00000180 -#define  US3_MC_READS_0		0x00000200 -#define  US3_MC_READS_1		0x00000210 -#define  US3_MC_READS_2		0x00000220 -#define  US3_MC_READS_3		0x00000230 -#define  US3_MC_STALLS_0	0x00000240 -#define  US3_MC_STALLS_2	0x00000250 - -/* Pic.S1 Selection Bit Field Encoding, Ultra-I/II  */ -#define  CYCLE_CNT_D1         0x00000000 -#define  INSTR_CNT_D1         0x00000800 -#define  DISPATCH0_IC_MISPRED 0x00001000 -#define  DISPATCH0_FP_USE     0x00001800 -#define  IC_HIT               0x00004000 -#define  DC_RD_HIT            0x00004800 -#define  DC_WR_HIT            0x00005000 -#define  LOAD_USE_RAW         0x00005800 -#define  EC_HIT               0x00006000 -#define  EC_WB                0x00006800 -#define  EC_SNOOP_CB          0x00007000 -#define  EC_IT_HIT            0x00007800 - -/* Pic.S1 Selection Bit Field Encoding, Ultra-III  */ -#define  US3_CYCLE_CNT_D1	0x00000000 -#define  US3_INSTR_CNT_D1	0x00000800 -#define  US3_DISPATCH0_MISPRED	0x00001000 -#define  US3_IC_MISS_CANCELLED	0x00001800 -#define  US3_RE_ENDIAN_MISS	0x00002000 -#define  US3_RE_FPU_BYPASS	0x00002800 -#define  US3_RE_DC_MISS		0x00003000 -#define  US3_RE_EC_MISS		0x00003800 -#define  US3_IC_MISS		0x00004000 -#define  US3_DC_RD_MISS		0x00004800 -#define  US3_DC_WR_MISS		0x00005000 -#define  US3_RSTALL_FP_USE	0x00005800 -#define  US3_EC_MISSES		0x00006000 -#define  US3_EC_WB		0x00006800 -#define  US3_EC_SNOOP_CB	0x00007000 -#define  US3_EC_IC_MISS		0x00007800 -#define  US3_RE_PC_MISS		0x00008000 -#define  US3_ITLB_MISS		0x00008800 -#define  US3_DTLB_MISS		0x00009000 -#define  US3_WC_MISS		0x00009800 -#define  US3_WC_SNOOP_CB	0x0000a000 -#define  US3_WC_SCRUBBED	0x0000a800 -#define  US3_WC_WB_WO_READ	0x0000b000 -#define  US3_PC_SOFT_HIT	0x0000c000 -#define  US3_PC_SNOOP_INV	0x0000c800 -#define  US3_PC_HARD_HIT	0x0000d000 -#define  US3_PC_PORT1_RD	0x0000d800 -#define  US3_SW_COUNT_1		0x0000e000 -#define  US3_IU_STAT_BR_MIS_UNTAKEN	0x0000e800 -#define  US3_IU_STAT_BR_COUNT_UNTAKEN	0x0000f000 -#define  US3_PC_MS_MISSES	0x0000f800 -#define  US3_MC_WRITES_0	0x00010800 -#define  US3_MC_WRITES_1	0x00011000 -#define  US3_MC_WRITES_2	0x00011800 -#define  US3_MC_WRITES_3	0x00012000 -#define  US3_MC_STALLS_1	0x00012800 -#define  US3_MC_STALLS_3	0x00013000 -#define  US3_RE_RAW_MISS	0x00013800 -#define  US3_FM_PIPE_COMPLETION	0x00014000 - -struct vcounter_struct { -  unsigned long long vcnt0; -  unsigned long long vcnt1; -}; - -#endif /* !(__KERNEL__) */ - -#endif /* !(PERF_COUNTER_API) */ diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h index ca2b34456c4..a3890da9442 100644 --- a/arch/sparc/include/asm/pgalloc_32.h +++ b/arch/sparc/include/asm/pgalloc_32.h @@ -4,65 +4,76 @@  #include <linux/kernel.h>  #include <linux/sched.h> +#include <asm/pgtsrmmu.h> +#include <asm/pgtable.h> +#include <asm/vaddrs.h>  #include <asm/page.h> -#include <asm/btfixup.h>  struct page; -extern struct pgtable_cache_struct { -	unsigned long *pgd_cache; -	unsigned long *pte_cache; -	unsigned long pgtable_cache_sz; -	unsigned long pgd_cache_sz; -} pgt_quicklists; -#define pgd_quicklist           (pgt_quicklists.pgd_cache) -#define pmd_quicklist           ((unsigned long *)0) -#define pte_quicklist           (pgt_quicklists.pte_cache) -#define pgtable_cache_size      (pgt_quicklists.pgtable_cache_sz) -#define pgd_cache_size		(pgt_quicklists.pgd_cache_sz) +void *srmmu_get_nocache(int size, int align); +void srmmu_free_nocache(void *addr, int size); -extern void check_pgt_cache(void); -BTFIXUPDEF_CALL(void,	 do_check_pgt_cache, int, int) -#define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high) +extern struct resource sparc_iomap; -BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void) -#define get_pgd_fast()		BTFIXUP_CALL(get_pgd_fast)() +#define check_pgt_cache()	do { } while (0) -BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) -#define free_pgd_fast(pgd)	BTFIXUP_CALL(free_pgd_fast)(pgd) +pgd_t *get_pgd_fast(void); +static inline void free_pgd_fast(pgd_t *pgd) +{ +	srmmu_free_nocache(pgd, SRMMU_PGD_TABLE_SIZE); +}  #define pgd_free(mm, pgd)	free_pgd_fast(pgd)  #define pgd_alloc(mm)	get_pgd_fast() -BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) -#define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp) +static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) +{ +	unsigned long pa = __nocache_pa((unsigned long)pmdp); + +	set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (pa >> 4))); +} +  #define pgd_populate(MM, PGD, PMD)      pgd_set(PGD, PMD) -BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long) -#define pmd_alloc_one(mm, address)	BTFIXUP_CALL(pmd_alloc_one)(mm, address) +static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, +				   unsigned long address) +{ +	return srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, +				 SRMMU_PMD_TABLE_SIZE); +} -BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *) -#define free_pmd_fast(pmd)	BTFIXUP_CALL(free_pmd_fast)(pmd) +static inline void free_pmd_fast(pmd_t * pmd) +{ +	srmmu_free_nocache(pmd, SRMMU_PMD_TABLE_SIZE); +}  #define pmd_free(mm, pmd)		free_pmd_fast(pmd)  #define __pmd_free_tlb(tlb, pmd, addr)	pmd_free((tlb)->mm, pmd) -BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *) -#define pmd_populate(MM, PMD, PTE)        BTFIXUP_CALL(pmd_populate)(PMD, PTE) +void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep);  #define pmd_pgtable(pmd) pmd_page(pmd) -BTFIXUPDEF_CALL(void, pmd_set, pmd_t *, pte_t *) -#define pmd_populate_kernel(MM, PMD, PTE) BTFIXUP_CALL(pmd_set)(PMD, PTE) -BTFIXUPDEF_CALL(pgtable_t , pte_alloc_one, struct mm_struct *, unsigned long) -#define pte_alloc_one(mm, address)	BTFIXUP_CALL(pte_alloc_one)(mm, address) -BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long) -#define pte_alloc_one_kernel(mm, addr)	BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr) +void pmd_set(pmd_t *pmdp, pte_t *ptep); +#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE) + +pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address); + +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, +					  unsigned long address) +{ +	return srmmu_get_nocache(PTE_SIZE, PTE_SIZE); +} + + +static inline void free_pte_fast(pte_t *pte) +{ +	srmmu_free_nocache(pte, PTE_SIZE); +} -BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *) -#define pte_free_kernel(mm, pte)	BTFIXUP_CALL(free_pte_fast)(pte) +#define pte_free_kernel(mm, pte)	free_pte_fast(pte) -BTFIXUPDEF_CALL(void, pte_free, pgtable_t ) -#define pte_free(mm, pte)		BTFIXUP_CALL(pte_free)(pte) +void pte_free(struct mm_struct * mm, pgtable_t pte);  #define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, pte)  #endif /* _SPARC_PGALLOC_H */ diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h index 5bdfa2c6e40..39a7ac49b00 100644 --- a/arch/sparc/include/asm/pgalloc_64.h +++ b/arch/sparc/include/asm/pgalloc_64.h @@ -5,7 +5,6 @@  #include <linux/sched.h>  #include <linux/mm.h>  #include <linux/slab.h> -#include <linux/quicklist.h>  #include <asm/spitfire.h>  #include <asm/cpudata.h> @@ -14,68 +13,82 @@  /* Page table allocation/freeing. */ +extern struct kmem_cache *pgtable_cache; +  static inline pgd_t *pgd_alloc(struct mm_struct *mm)  { -	return quicklist_alloc(0, GFP_KERNEL, NULL); +	return kmem_cache_alloc(pgtable_cache, GFP_KERNEL);  }  static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)  { -	quicklist_free(0, NULL, pgd); +	kmem_cache_free(pgtable_cache, pgd);  }  #define pud_populate(MM, PUD, PMD)	pud_set(PUD, PMD)  static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)  { -	return quicklist_alloc(0, GFP_KERNEL, NULL); +	return kmem_cache_alloc(pgtable_cache, +				GFP_KERNEL|__GFP_REPEAT);  }  static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)  { -	quicklist_free(0, NULL, pmd); +	kmem_cache_free(pgtable_cache, pmd);  } -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, -					  unsigned long address) -{ -	return quicklist_alloc(0, GFP_KERNEL, NULL); -} +pte_t *pte_alloc_one_kernel(struct mm_struct *mm, +			    unsigned long address); +pgtable_t pte_alloc_one(struct mm_struct *mm, +			unsigned long address); +void pte_free_kernel(struct mm_struct *mm, pte_t *pte); +void pte_free(struct mm_struct *mm, pgtable_t ptepage); + +#define pmd_populate_kernel(MM, PMD, PTE)	pmd_set(MM, PMD, PTE) +#define pmd_populate(MM, PMD, PTE)		pmd_set(MM, PMD, PTE) +#define pmd_pgtable(PMD)			((pte_t *)__pmd_page(PMD)) + +#define check_pgt_cache()	do { } while (0) + +void pgtable_free(void *table, bool is_page); + +#ifdef CONFIG_SMP -static inline pgtable_t pte_alloc_one(struct mm_struct *mm, -					unsigned long address) +struct mmu_gather; +void tlb_remove_table(struct mmu_gather *, void *); + +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page)  { -	struct page *page; -	void *pg; - -	pg = quicklist_alloc(0, GFP_KERNEL, NULL); -	if (!pg) -		return NULL; -	page = virt_to_page(pg); -	pgtable_page_ctor(page); -	return page; +	unsigned long pgf = (unsigned long)table; +	if (is_page) +		pgf |= 0x1UL; +	tlb_remove_table(tlb, (void *)pgf);  } -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) +static inline void __tlb_remove_table(void *_table)  { -	quicklist_free(0, NULL, pte); -} +	void *table = (void *)((unsigned long)_table & ~0x1UL); +	bool is_page = false; -static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) +	if ((unsigned long)_table & 0x1UL) +		is_page = true; +	pgtable_free(table, is_page); +} +#else /* CONFIG_SMP */ +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page)  { -	pgtable_page_dtor(ptepage); -	quicklist_free_page(0, NULL, ptepage); +	pgtable_free(table, is_page);  } +#endif /* !CONFIG_SMP */ - -#define pmd_populate_kernel(MM, PMD, PTE)	pmd_set(PMD, PTE) -#define pmd_populate(MM,PMD,PTE_PAGE)		\ -	pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE)) -#define pmd_pgtable(pmd) pmd_page(pmd) - -static inline void check_pgt_cache(void) +static inline void __pte_free_tlb(struct mmu_gather *tlb, pte_t *pte, +				  unsigned long address)  { -	quicklist_trim(0, NULL, 25, 16); +	pgtable_free_tlb(tlb, pte, true);  } +#define __pmd_free_tlb(tlb, pmd, addr)		      \ +	pgtable_free_tlb(tlb, pmd, false) +  #endif /* _SPARC64_PGALLOC_H */ diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 303bd4dc829..b9b91ae19fe 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -8,109 +8,77 @@   *  Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)   */ +#include <linux/const.h> +  #ifndef __ASSEMBLY__  #include <asm-generic/4level-fixup.h>  #include <linux/spinlock.h>  #include <linux/swap.h>  #include <asm/types.h> -#include <asm/pgtsun4c.h>  #include <asm/pgtsrmmu.h> -#include <asm/vac-ops.h> +#include <asm/vaddrs.h>  #include <asm/oplib.h> -#include <asm/btfixup.h> -#include <asm/system.h> +#include <asm/cpu_type.h>  struct vm_area_struct;  struct page; -extern void load_mmu(void); -extern unsigned long calc_highpages(void); - -BTFIXUPDEF_SIMM13(pgdir_shift) -BTFIXUPDEF_SETHI(pgdir_size) -BTFIXUPDEF_SETHI(pgdir_mask) - -BTFIXUPDEF_SIMM13(ptrs_per_pmd) -BTFIXUPDEF_SIMM13(ptrs_per_pgd) -BTFIXUPDEF_SIMM13(user_ptrs_per_pgd) +void load_mmu(void); +unsigned long calc_highpages(void); +unsigned long __init bootmem_init(unsigned long *pages_avail);  #define pte_ERROR(e)   __builtin_trap()  #define pmd_ERROR(e)   __builtin_trap()  #define pgd_ERROR(e)   __builtin_trap() -BTFIXUPDEF_INT(page_none) -BTFIXUPDEF_INT(page_copy) -BTFIXUPDEF_INT(page_readonly) -BTFIXUPDEF_INT(page_kernel) - -#define PMD_SHIFT		SUN4C_PMD_SHIFT +#define PMD_SHIFT		22  #define PMD_SIZE        	(1UL << PMD_SHIFT)  #define PMD_MASK        	(~(PMD_SIZE-1))  #define PMD_ALIGN(__addr) 	(((__addr) + ~PMD_MASK) & PMD_MASK) -#define PGDIR_SHIFT     	BTFIXUP_SIMM13(pgdir_shift) -#define PGDIR_SIZE      	BTFIXUP_SETHI(pgdir_size) -#define PGDIR_MASK      	BTFIXUP_SETHI(pgdir_mask) +#define PGDIR_SHIFT     	SRMMU_PGDIR_SHIFT +#define PGDIR_SIZE      	SRMMU_PGDIR_SIZE +#define PGDIR_MASK      	SRMMU_PGDIR_MASK  #define PTRS_PER_PTE    	1024 -#define PTRS_PER_PMD    	BTFIXUP_SIMM13(ptrs_per_pmd) -#define PTRS_PER_PGD    	BTFIXUP_SIMM13(ptrs_per_pgd) -#define USER_PTRS_PER_PGD	BTFIXUP_SIMM13(user_ptrs_per_pgd) +#define PTRS_PER_PMD    	SRMMU_PTRS_PER_PMD +#define PTRS_PER_PGD    	SRMMU_PTRS_PER_PGD +#define USER_PTRS_PER_PGD	PAGE_OFFSET / SRMMU_PGDIR_SIZE  #define FIRST_USER_ADDRESS	0  #define PTE_SIZE		(PTRS_PER_PTE*4) -#define PAGE_NONE      __pgprot(BTFIXUP_INT(page_none)) -extern pgprot_t PAGE_SHARED; -#define PAGE_COPY      __pgprot(BTFIXUP_INT(page_copy)) -#define PAGE_READONLY  __pgprot(BTFIXUP_INT(page_readonly)) +#define PAGE_NONE	SRMMU_PAGE_NONE +#define PAGE_SHARED	SRMMU_PAGE_SHARED +#define PAGE_COPY	SRMMU_PAGE_COPY +#define PAGE_READONLY	SRMMU_PAGE_RDONLY +#define PAGE_KERNEL	SRMMU_PAGE_KERNEL -extern unsigned long page_kernel; +/* Top-level page directory - dummy used by init-mm. + * srmmu.c will assign the real one (which is dynamically sized) */ +#define swapper_pg_dir NULL -#ifdef MODULE -#define PAGE_KERNEL	page_kernel -#else -#define PAGE_KERNEL    __pgprot(BTFIXUP_INT(page_kernel)) -#endif - -/* Top-level page directory */ -extern pgd_t swapper_pg_dir[1024]; - -extern void paging_init(void); - -/* Page table for 0-4MB for everybody, on the Sparc this - * holds the same as on the i386. - */ -extern pte_t pg0[1024]; -extern pte_t pg1[1024]; -extern pte_t pg2[1024]; -extern pte_t pg3[1024]; +void paging_init(void);  extern unsigned long ptr_in_current_pgd; -/* Here is a trick, since mmap.c need the initializer elements for - * protection_map[] to be constant at compile time, I set the following - * to all zeros.  I set it to the real values after I link in the - * appropriate MMU page table routines at boot time. - */ -#define __P000  __pgprot(0) -#define __P001  __pgprot(0) -#define __P010  __pgprot(0) -#define __P011  __pgprot(0) -#define __P100  __pgprot(0) -#define __P101  __pgprot(0) -#define __P110  __pgprot(0) -#define __P111  __pgprot(0) - -#define __S000	__pgprot(0) -#define __S001	__pgprot(0) -#define __S010	__pgprot(0) -#define __S011	__pgprot(0) -#define __S100	__pgprot(0) -#define __S101	__pgprot(0) -#define __S110	__pgprot(0) -#define __S111	__pgprot(0) - -extern int num_contexts; +/*         xwr */ +#define __P000  PAGE_NONE +#define __P001  PAGE_READONLY +#define __P010  PAGE_COPY +#define __P011  PAGE_COPY +#define __P100  PAGE_READONLY +#define __P101  PAGE_READONLY +#define __P110  PAGE_COPY +#define __P111  PAGE_COPY + +#define __S000	PAGE_NONE +#define __S001	PAGE_READONLY +#define __S010	PAGE_SHARED +#define __S011	PAGE_SHARED +#define __S100	PAGE_READONLY +#define __S101	PAGE_READONLY +#define __S110	PAGE_SHARED +#define __S111	PAGE_SHARED  /* First physical page can be anywhere, the following is needed so that   * va-->pa and vice versa conversions work properly without performance @@ -120,97 +88,145 @@ extern unsigned long phys_base;  extern unsigned long pfn_base;  /* - * BAD_PAGETABLE is used when we need a bogus page-table, while - * BAD_PAGE is used for a bogus page. - *   * ZERO_PAGE is a global shared page that is always zero: used   * for zero-mapped memory areas etc..   */ -extern pte_t * __bad_pagetable(void); -extern pte_t __bad_page(void);  extern unsigned long empty_zero_page; -#define BAD_PAGETABLE __bad_pagetable() -#define BAD_PAGE __bad_page()  #define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page))  /* + * In general all page table modifications should use the V8 atomic + * swap instruction.  This insures the mmu and the cpu are in sync + * with respect to ref/mod bits in the page tables.   */ -BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) -BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t) +static inline unsigned long srmmu_swap(unsigned long *addr, unsigned long value) +{ +	__asm__ __volatile__("swap [%2], %0" : "=&r" (value) : "0" (value), "r" (addr)); +	return value; +} -#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) -#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd) +/* Certain architectures need to do special things when pte's + * within a page table are directly modified.  Thus, the following + * hook is made available. + */ + +static inline void set_pte(pte_t *ptep, pte_t pteval) +{ +	srmmu_swap((unsigned long *)ptep, pte_val(pteval)); +} + +#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) + +static inline int srmmu_device_memory(unsigned long x) +{ +	return ((x & 0xF0000000) != 0); +} + +static inline struct page *pmd_page(pmd_t pmd) +{ +	if (srmmu_device_memory(pmd_val(pmd))) +		BUG(); +	return pfn_to_page((pmd_val(pmd) & SRMMU_PTD_PMASK) >> (PAGE_SHIFT-4)); +} + +static inline unsigned long pgd_page_vaddr(pgd_t pgd) +{ +	if (srmmu_device_memory(pgd_val(pgd))) { +		return ~0; +	} else { +		unsigned long v = pgd_val(pgd) & SRMMU_PTD_PMASK; +		return (unsigned long)__nocache_va(v << 4); +	} +} -BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) -BTFIXUPDEF_CALL(void, pte_clear, pte_t *) +static inline int pte_present(pte_t pte) +{ +	return ((pte_val(pte) & SRMMU_ET_MASK) == SRMMU_ET_PTE); +}  static inline int pte_none(pte_t pte)  {  	return !pte_val(pte);  } -#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) -#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte) +static inline void __pte_clear(pte_t *ptep) +{ +	set_pte(ptep, __pte(0)); +} + +static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +{ +	__pte_clear(ptep); +} + +static inline int pmd_bad(pmd_t pmd) +{ +	return (pmd_val(pmd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; +} -BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) -BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) -BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *) +static inline int pmd_present(pmd_t pmd) +{ +	return ((pmd_val(pmd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); +}  static inline int pmd_none(pmd_t pmd)  {  	return !pmd_val(pmd);  } -#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd) -#define pmd_present(pmd) BTFIXUP_CALL(pmd_present)(pmd) -#define pmd_clear(pmd) BTFIXUP_CALL(pmd_clear)(pmd) +static inline void pmd_clear(pmd_t *pmdp) +{ +	int i; +	for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) +		set_pte((pte_t *)&pmdp->pmdv[i], __pte(0)); +} -BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t) -BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t) -BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t) -BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *) +static inline int pgd_none(pgd_t pgd)           +{ +	return !(pgd_val(pgd) & 0xFFFFFFF); +} -#define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd) -#define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd) -#define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd) -#define pgd_clear(pgd) BTFIXUP_CALL(pgd_clear)(pgd) +static inline int pgd_bad(pgd_t pgd) +{ +	return (pgd_val(pgd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; +} + +static inline int pgd_present(pgd_t pgd) +{ +	return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); +} + +static inline void pgd_clear(pgd_t *pgdp) +{ +	set_pte((pte_t *)pgdp, __pte(0)); +}  /*   * The following only work if pte_present() is true.   * Undefined behaviour if not..   */ -BTFIXUPDEF_HALF(pte_writei) -BTFIXUPDEF_HALF(pte_dirtyi) -BTFIXUPDEF_HALF(pte_youngi) - -static int pte_write(pte_t pte) __attribute_const__;  static inline int pte_write(pte_t pte)  { -	return pte_val(pte) & BTFIXUP_HALF(pte_writei); +	return pte_val(pte) & SRMMU_WRITE;  } -static int pte_dirty(pte_t pte) __attribute_const__;  static inline int pte_dirty(pte_t pte)  { -	return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi); +	return pte_val(pte) & SRMMU_DIRTY;  } -static int pte_young(pte_t pte) __attribute_const__;  static inline int pte_young(pte_t pte)  { -	return pte_val(pte) & BTFIXUP_HALF(pte_youngi); +	return pte_val(pte) & SRMMU_REF;  }  /*   * The following only work if pte_present() is not true.   */ -BTFIXUPDEF_HALF(pte_filei) - -static int pte_file(pte_t pte) __attribute_const__;  static inline int pte_file(pte_t pte)  { -	return pte_val(pte) & BTFIXUP_HALF(pte_filei); +	return pte_val(pte) & SRMMU_FILE;  }  static inline int pte_special(pte_t pte) @@ -218,68 +234,85 @@ static inline int pte_special(pte_t pte)  	return 0;  } -/* - */ -BTFIXUPDEF_HALF(pte_wrprotecti) -BTFIXUPDEF_HALF(pte_mkcleani) -BTFIXUPDEF_HALF(pte_mkoldi) - -static pte_t pte_wrprotect(pte_t pte) __attribute_const__;  static inline pte_t pte_wrprotect(pte_t pte)  { -	return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti)); +	return __pte(pte_val(pte) & ~SRMMU_WRITE);  } -static pte_t pte_mkclean(pte_t pte) __attribute_const__;  static inline pte_t pte_mkclean(pte_t pte)  { -	return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani)); +	return __pte(pte_val(pte) & ~SRMMU_DIRTY);  } -static pte_t pte_mkold(pte_t pte) __attribute_const__;  static inline pte_t pte_mkold(pte_t pte)  { -	return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi)); +	return __pte(pte_val(pte) & ~SRMMU_REF);  } -BTFIXUPDEF_CALL_CONST(pte_t, pte_mkwrite, pte_t) -BTFIXUPDEF_CALL_CONST(pte_t, pte_mkdirty, pte_t) -BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t) +static inline pte_t pte_mkwrite(pte_t pte) +{ +	return __pte(pte_val(pte) | SRMMU_WRITE); +} -#define pte_mkwrite(pte) BTFIXUP_CALL(pte_mkwrite)(pte) -#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte) -#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte) +static inline pte_t pte_mkdirty(pte_t pte) +{ +	return __pte(pte_val(pte) | SRMMU_DIRTY); +} + +static inline pte_t pte_mkyoung(pte_t pte) +{ +	return __pte(pte_val(pte) | SRMMU_REF); +}  #define pte_mkspecial(pte)    (pte)  #define pfn_pte(pfn, prot)		mk_pte(pfn_to_page(pfn), prot) -BTFIXUPDEF_CALL(unsigned long,	 pte_pfn, pte_t) -#define pte_pfn(pte) BTFIXUP_CALL(pte_pfn)(pte) +static inline unsigned long pte_pfn(pte_t pte) +{ +	if (srmmu_device_memory(pte_val(pte))) { +		/* Just return something that will cause +		 * pfn_valid() to return false.  This makes +		 * copy_one_pte() to just directly copy to +		 * PTE over. +		 */ +		return ~0UL; +	} +	return (pte_val(pte) & SRMMU_PTE_PMASK) >> (PAGE_SHIFT-4); +} +  #define pte_page(pte)	pfn_to_page(pte_pfn(pte))  /*   * Conversion functions: convert a page and protection to a page entry,   * and a page entry and page directory to the page they refer to.   */ -BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t) - -BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t) -BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int) -BTFIXUPDEF_CALL_CONST(pgprot_t, pgprot_noncached, pgprot_t) +static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) +{ +	return __pte((page_to_pfn(page) << (PAGE_SHIFT-4)) | pgprot_val(pgprot)); +} -#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot) -#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot) -#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space) +static inline pte_t mk_pte_phys(unsigned long page, pgprot_t pgprot) +{ +	return __pte(((page) >> 4) | pgprot_val(pgprot)); +} -#define pgprot_noncached(pgprot) BTFIXUP_CALL(pgprot_noncached)(pgprot) +static inline pte_t mk_pte_io(unsigned long page, pgprot_t pgprot, int space) +{ +	return __pte(((page) >> 4) | (space << 28) | pgprot_val(pgprot)); +} -BTFIXUPDEF_INT(pte_modify_mask) +#define pgprot_noncached pgprot_noncached +static inline pgprot_t pgprot_noncached(pgprot_t prot) +{ +	prot &= ~__pgprot(SRMMU_CACHE); +	return prot; +}  static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__;  static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)  { -	return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) | +	return __pte((pte_val(pte) & SRMMU_CHG_MASK) |  		pgprot_val(newprot));  } @@ -292,114 +325,76 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)  #define pgd_offset_k(address) pgd_offset(&init_mm, address)  /* Find an entry in the second-level page table.. */ -BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd_t *, unsigned long) -#define pmd_offset(dir,addr) BTFIXUP_CALL(pmd_offset)(dir,addr) +static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) +{ +	return (pmd_t *) pgd_page_vaddr(*dir) + +		((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1)); +}  /* Find an entry in the third-level page table.. */ -BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long) -#define pte_offset_kernel(dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr) +pte_t *pte_offset_kernel(pmd_t * dir, unsigned long address);  /* - * This shortcut works on sun4m (and sun4d) because the nocache area is static, - * and sun4c is guaranteed to have no highmem anyway. + * This shortcut works on sun4m (and sun4d) because the nocache area is static.   */  #define pte_offset_map(d, a)		pte_offset_kernel(d,a)  #define pte_unmap(pte)		do{}while(0) -/* Certain architectures need to do special things when pte's - * within a page table are directly modified.  Thus, the following - * hook is made available. - */ - -BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t) - -#define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval) -#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) -  struct seq_file; -BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *) - -#define mmu_info(p) BTFIXUP_CALL(mmu_info)(p) +void mmu_info(struct seq_file *m);  /* Fault handler stuff... */  #define FAULT_CODE_PROT     0x1  #define FAULT_CODE_WRITE    0x2  #define FAULT_CODE_USER     0x4 -BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t *) - -#define update_mmu_cache(vma,addr,ptep) BTFIXUP_CALL(update_mmu_cache)(vma,addr,ptep) - -BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long, -    unsigned long, unsigned int) -BTFIXUPDEF_CALL(void, sparc_unmapiorange, unsigned long, unsigned int) -#define sparc_mapiorange(bus,pa,va,len) BTFIXUP_CALL(sparc_mapiorange)(bus,pa,va,len) -#define sparc_unmapiorange(va,len) BTFIXUP_CALL(sparc_unmapiorange)(va,len) +#define update_mmu_cache(vma, address, ptep) do { } while (0) -extern int invalid_segment; +void srmmu_mapiorange(unsigned int bus, unsigned long xpa, +                      unsigned long xva, unsigned int len); +void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len);  /* Encode and de-code a swap entry */ -BTFIXUPDEF_CALL(unsigned long, __swp_type, swp_entry_t) -BTFIXUPDEF_CALL(unsigned long, __swp_offset, swp_entry_t) -BTFIXUPDEF_CALL(swp_entry_t, __swp_entry, unsigned long, unsigned long) +static inline unsigned long __swp_type(swp_entry_t entry) +{ +	return (entry.val >> SRMMU_SWP_TYPE_SHIFT) & SRMMU_SWP_TYPE_MASK; +} + +static inline unsigned long __swp_offset(swp_entry_t entry) +{ +	return (entry.val >> SRMMU_SWP_OFF_SHIFT) & SRMMU_SWP_OFF_MASK; +} -#define __swp_type(__x)			BTFIXUP_CALL(__swp_type)(__x) -#define __swp_offset(__x)		BTFIXUP_CALL(__swp_offset)(__x) -#define __swp_entry(__type,__off)	BTFIXUP_CALL(__swp_entry)(__type,__off) +static inline swp_entry_t __swp_entry(unsigned long type, unsigned long offset) +{ +	return (swp_entry_t) { +		(type & SRMMU_SWP_TYPE_MASK) << SRMMU_SWP_TYPE_SHIFT +		| (offset & SRMMU_SWP_OFF_MASK) << SRMMU_SWP_OFF_SHIFT }; +}  #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val(pte) })  #define __swp_entry_to_pte(x)		((pte_t) { (x).val })  /* file-offset-in-pte helpers */ -BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte); -BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff); +static inline unsigned long pte_to_pgoff(pte_t pte) +{ +	return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT; +} -#define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte) -#define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off) +static inline pte_t pgoff_to_pte(unsigned long pgoff) +{ +	return __pte((pgoff << SRMMU_PTE_FILE_SHIFT) | SRMMU_FILE); +}  /*   * This is made a constant because mm/fremap.c required a constant. - * Note that layout of these bits is different between sun4c.c and srmmu.c.   */  #define PTE_FILE_MAX_BITS 24 -/* - */ -struct ctx_list { -	struct ctx_list *next; -	struct ctx_list *prev; -	unsigned int ctx_number; -	struct mm_struct *ctx_mm; -}; - -extern struct ctx_list *ctx_list_pool;  /* Dynamically allocated */ -extern struct ctx_list ctx_free;        /* Head of free list */ -extern struct ctx_list ctx_used;        /* Head of used contexts list */ - -#define NO_CONTEXT     -1 - -static inline void remove_from_ctx_list(struct ctx_list *entry) -{ -	entry->next->prev = entry->prev; -	entry->prev->next = entry->next; -} - -static inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry) -{ -	entry->next = head; -	(entry->prev = head->prev)->next = entry; -	head->prev = entry; -} -#define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry) -#define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry) -  static inline unsigned long  __get_phys (unsigned long addr)  {  	switch (sparc_cpu_model){ -	case sun4: -	case sun4c: -		return sun4c_get_pte (addr) << PAGE_SHIFT;  	case sun4m:  	case sun4d:  		return ((srmmu_get_pte (addr) & 0xffffff00) << 4); @@ -412,9 +407,6 @@ static inline int  __get_iospace (unsigned long addr)  {  	switch (sparc_cpu_model){ -	case sun4: -	case sun4c: -		return -1; /* Don't check iospace on sun4c */  	case sun4m:  	case sun4d:  		return (srmmu_get_pte (addr) >> 28); @@ -429,10 +421,6 @@ extern unsigned long *sparc_valid_addr_bitmap;  #define kern_addr_valid(addr) \  	(test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) -extern int io_remap_pfn_range(struct vm_area_struct *vma, -			      unsigned long from, unsigned long pfn, -			      unsigned long size, pgprot_t prot); -  /*   * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in   * its high 4 bits.  These macros/functions put it there or get it from there. @@ -441,6 +429,23 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma,  #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))  #define GET_PFN(pfn)			(pfn & 0x0fffffffUL) +int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, +		    unsigned long, pgprot_t); + +static inline int io_remap_pfn_range(struct vm_area_struct *vma, +				     unsigned long from, unsigned long pfn, +				     unsigned long size, pgprot_t prot) +{ +	unsigned long long offset, space, phys_base; + +	offset = ((unsigned long long) GET_PFN(pfn)) << PAGE_SHIFT; +	space = GET_IOSPACE(pfn); +	phys_base = offset | (space << 32ULL); + +	return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); +} +#define io_remap_pfn_range io_remap_pfn_range  +  #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS  #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \  ({									  \ @@ -449,17 +454,15 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma,  		set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \  		flush_tlb_page(__vma, __address);			  \  	}								  \ -	(sparc_cpu_model == sun4c) || __changed;			  \ +	__changed;							  \  })  #include <asm-generic/pgtable.h>  #endif /* !(__ASSEMBLY__) */ -#define VMALLOC_START           0xfe600000 -/* XXX Alter this when I get around to fixing sun4c - Anton */ -#define VMALLOC_END             0xffc00000 - +#define VMALLOC_START           _AC(0xfe600000,UL) +#define VMALLOC_END             _AC(0xffc00000,UL)  /* We provide our own get_unmapped_area to cope with VA holes for userland */  #define HAVE_ARCH_UNMAPPED_AREA diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index f8dddb7045b..3770bf5c6e1 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -12,20 +12,20 @@   * the SpitFire page tables.   */ -#include <asm-generic/pgtable-nopud.h> -  #include <linux/compiler.h>  #include <linux/const.h>  #include <asm/types.h>  #include <asm/spitfire.h>  #include <asm/asi.h> -#include <asm/system.h>  #include <asm/page.h>  #include <asm/processor.h> +#include <asm-generic/pgtable-nopud.h> +  /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB).   * The page copy blockops can use 0x6000000 to 0x8000000. - * The TSB is mapped in the 0x8000000 to 0xa000000 range. + * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range. + * The 4M TSB is mapped in the 0x8400000 to 0x8800000 range.   * The PROM resides in an area spanning 0xf0000000 to 0x100000000.   * The vmalloc area spans 0x100000000 to 0x200000000.   * Since modules need to be in the lowest 32-bits of the address space, @@ -34,7 +34,8 @@   * 0x400000000.   */  #define	TLBTEMP_BASE		_AC(0x0000000006000000,UL) -#define	TSBMAP_BASE		_AC(0x0000000008000000,UL) +#define	TSBMAP_8K_BASE		_AC(0x0000000008000000,UL) +#define	TSBMAP_4M_BASE		_AC(0x0000000008400000,UL)  #define MODULES_VADDR		_AC(0x0000000010000000,UL)  #define MODULES_LEN		_AC(0x00000000e0000000,UL)  #define MODULES_END		_AC(0x00000000f0000000,UL) @@ -46,38 +47,49 @@  #define vmemmap			((struct page *)VMEMMAP_BASE) -/* XXX All of this needs to be rethought so we can take advantage - * XXX cheetah's full 64-bit virtual address space, ie. no more hole - * XXX in the middle like on spitfire. -DaveM - */ -/* - * Given a virtual address, the lowest PAGE_SHIFT bits determine offset - * into the page; the next higher PAGE_SHIFT-3 bits determine the pte# - * in the proper pagetable (the -3 is from the 8 byte ptes, and each page - * table is a single page long). The next higher PMD_BITS determine pmd# - * in the proper pmdtable (where we must have PMD_BITS <= (PAGE_SHIFT-2) - * since the pmd entries are 4 bytes, and each pmd page is a single page - * long). Finally, the higher few bits determine pgde#. - */ -  /* PMD_SHIFT determines the size of the area a second-level page   * table can map   */  #define PMD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3))  #define PMD_SIZE	(_AC(1,UL) << PMD_SHIFT)  #define PMD_MASK	(~(PMD_SIZE-1)) -#define PMD_BITS	(PAGE_SHIFT - 2) +#define PMD_BITS	(PAGE_SHIFT - 3)  /* PGDIR_SHIFT determines what a third-level page table entry can map */  #define PGDIR_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)  #define PGDIR_SIZE	(_AC(1,UL) << PGDIR_SHIFT)  #define PGDIR_MASK	(~(PGDIR_SIZE-1)) -#define PGDIR_BITS	(PAGE_SHIFT - 2) +#define PGDIR_BITS	(PAGE_SHIFT - 3) + +#if (PGDIR_SHIFT + PGDIR_BITS) != 43 +#error Page table parameters do not cover virtual address space properly. +#endif + +#if (PMD_SHIFT != HPAGE_SHIFT) +#error PMD_SHIFT must equal HPAGE_SHIFT for transparent huge pages. +#endif  #ifndef __ASSEMBLY__  #include <linux/sched.h> +extern unsigned long sparc64_valid_addr_bitmap[]; + +/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ +static inline bool __kern_addr_valid(unsigned long paddr) +{ +	if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL) +		return false; +	return test_bit(paddr >> ILOG2_4MB, sparc64_valid_addr_bitmap); +} + +static inline bool kern_addr_valid(unsigned long addr) +{ +	unsigned long paddr = __pa(addr); + +	return __kern_addr_valid(paddr); +} +  /* Entries per page directory level. */  #define PTRS_PER_PTE	(1UL << (PAGE_SHIFT-3))  #define PTRS_PER_PMD	(1UL << PMD_BITS) @@ -86,15 +98,23 @@  /* Kernel has a separate 44bit address space. */  #define FIRST_USER_ADDRESS	0 -#define pte_ERROR(e)	__builtin_trap() -#define pmd_ERROR(e)	__builtin_trap() -#define pgd_ERROR(e)	__builtin_trap() +#define pmd_ERROR(e)							\ +	pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n",		\ +	       __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0)) +#define pgd_ERROR(e)							\ +	pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n",		\ +	       __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0))  #endif /* !(__ASSEMBLY__) */  /* PTE bits which are the same in SUN4U and SUN4V format.  */  #define _PAGE_VALID	  _AC(0x8000000000000000,UL) /* Valid TTE            */  #define _PAGE_R	  	  _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/ +#define _PAGE_SPECIAL     _AC(0x0200000000000000,UL) /* Special page         */ +#define _PAGE_PMD_HUGE    _AC(0x0100000000000000,UL) /* Huge page            */ + +/* Advertise support for _PAGE_SPECIAL */ +#define __HAVE_ARCH_PTE_SPECIAL  /* SUN4U pte bits... */  #define _PAGE_SZ4MB_4U	  _AC(0x6000000000000000,UL) /* 4MB Page             */ @@ -104,6 +124,8 @@  #define _PAGE_NFO_4U	  _AC(0x1000000000000000,UL) /* No Fault Only        */  #define _PAGE_IE_4U	  _AC(0x0800000000000000,UL) /* Invert Endianness    */  #define _PAGE_SOFT2_4U	  _AC(0x07FC000000000000,UL) /* Software bits, set 2 */ +#define _PAGE_SPECIAL_4U  _AC(0x0200000000000000,UL) /* Special page         */ +#define _PAGE_PMD_HUGE_4U _AC(0x0100000000000000,UL) /* Huge page            */  #define _PAGE_RES1_4U	  _AC(0x0002000000000000,UL) /* Reserved             */  #define _PAGE_SZ32MB_4U	  _AC(0x0001000000000000,UL) /* (Panther) 32MB page  */  #define _PAGE_SZ256MB_4U  _AC(0x2001000000000000,UL) /* (Panther) 256MB page */ @@ -133,6 +155,8 @@  #define _PAGE_ACCESSED_4V _AC(0x1000000000000000,UL) /* Accessed (ref'd)     */  #define _PAGE_READ_4V	  _AC(0x0800000000000000,UL) /* Readable SW Bit      */  #define _PAGE_WRITE_4V	  _AC(0x0400000000000000,UL) /* Writable SW Bit      */ +#define _PAGE_SPECIAL_4V  _AC(0x0200000000000000,UL) /* Special page         */ +#define _PAGE_PMD_HUGE_4V _AC(0x0100000000000000,UL) /* Huge page            */  #define _PAGE_PADDR_4V	  _AC(0x00FFFFFFFFFFE000,UL) /* paddr[55:13]         */  #define _PAGE_IE_4V	  _AC(0x0000000000001000,UL) /* Invert Endianness    */  #define _PAGE_E_4V	  _AC(0x0000000000000800,UL) /* side-Effect          */ @@ -155,26 +179,15 @@  #define _PAGE_SZ8K_4V	  _AC(0x0000000000000000,UL) /* 8K Page              */  #define _PAGE_SZALL_4V	  _AC(0x0000000000000007,UL) /* All pgsz bits        */ -#if PAGE_SHIFT == 13  #define _PAGE_SZBITS_4U	_PAGE_SZ8K_4U  #define _PAGE_SZBITS_4V	_PAGE_SZ8K_4V -#elif PAGE_SHIFT == 16 -#define _PAGE_SZBITS_4U	_PAGE_SZ64K_4U -#define _PAGE_SZBITS_4V	_PAGE_SZ64K_4V -#else -#error Wrong PAGE_SHIFT specified + +#if REAL_HPAGE_SHIFT != 22 +#error REAL_HPAGE_SHIFT and _PAGE_SZHUGE_foo must match up  #endif -#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)  #define _PAGE_SZHUGE_4U	_PAGE_SZ4MB_4U  #define _PAGE_SZHUGE_4V	_PAGE_SZ4MB_4V -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) -#define _PAGE_SZHUGE_4U	_PAGE_SZ512K_4U -#define _PAGE_SZHUGE_4V	_PAGE_SZ512K_4V -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) -#define _PAGE_SZHUGE_4U	_PAGE_SZ64K_4U -#define _PAGE_SZHUGE_4V	_PAGE_SZ64K_4V -#endif  /* These are actually filled in at boot time by sun4{u,v}_pgprot_init() */  #define __P000	__pgprot(0) @@ -197,9 +210,9 @@  #ifndef __ASSEMBLY__ -extern pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); +pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); -extern unsigned long pte_sz_bits(unsigned long size); +unsigned long pte_sz_bits(unsigned long size);  extern pgprot_t PAGE_KERNEL;  extern pgprot_t PAGE_KERNEL_LOCKED; @@ -213,7 +226,6 @@ extern unsigned long _PAGE_CACHE;  extern unsigned long pg_iobits;  extern unsigned long _PAGE_ALL_SZ_BITS; -extern unsigned long _PAGE_SZBITS;  extern struct page *mem_map_zero;  #define ZERO_PAGE(vaddr)	(mem_map_zero) @@ -226,25 +238,22 @@ extern struct page *mem_map_zero;  static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)  {  	unsigned long paddr = pfn << PAGE_SHIFT; -	unsigned long sz_bits; - -	sz_bits = 0UL; -	if (_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL) { -		__asm__ __volatile__( -		"\n661:	sethi		%%uhi(%1), %0\n" -		"	sllx		%0, 32, %0\n" -		"	.section	.sun4v_2insn_patch, \"ax\"\n" -		"	.word		661b\n" -		"	mov		%2, %0\n" -		"	nop\n" -		"	.previous\n" -		: "=r" (sz_bits) -		: "i" (_PAGE_SZBITS_4U), "i" (_PAGE_SZBITS_4V)); -	} -	return __pte(paddr | sz_bits | pgprot_val(prot)); + +	BUILD_BUG_ON(_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL); +	return __pte(paddr | pgprot_val(prot));  }  #define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot)) +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) +{ +	pte_t pte = pfn_pte(page_nr, pgprot); + +	return __pmd(pte_val(pte)); +} +#define mk_pmd(page, pgprot)	pfn_pmd(page_to_pfn(page), (pgprot)) +#endif +  /* This one can be done with two shifts.  */  static inline unsigned long pte_pfn(pte_t pte)  { @@ -271,8 +280,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)  {  	unsigned long mask, tmp; -	/* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347) -	 * SUN4V: 0x30ffffffffffee17 (negated == 0xcf000000000011e8) +	/* SUN4U: 0x630107ffffffec38 (negated == 0x9cfef800000013c7) +	 * SUN4V: 0x33ffffffffffee07 (negated == 0xcc000000000011f8)  	 *  	 * Even if we use negation tricks the result is still a 6  	 * instruction sequence, so don't try to play fancy and just @@ -281,6 +290,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)  	 * Note: We encode this into 3 sun4v 2-insn patch sequences.  	 */ +	BUILD_BUG_ON(_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL);  	__asm__ __volatile__(  	"\n661:	sethi		%%uhi(%2), %1\n"  	"	sethi		%%hi(%2), %0\n" @@ -301,15 +311,26 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)  	"	.previous\n"  	: "=r" (mask), "=r" (tmp)  	: "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | -	       _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U | -	       _PAGE_SZBITS_4U), +	       _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | +	       _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U),  	  "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | -	       _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V | -	       _PAGE_SZBITS_4V)); +	       _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | +	       _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V));  	return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));  } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_modify(pte, newprot); + +	return __pmd(pte_val(pte)); +} +#endif +  static inline pte_t pgoff_to_pte(unsigned long off)  {  	off <<= PAGE_SHIFT; @@ -350,7 +371,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot)   */  #define pgprot_noncached pgprot_noncached -#ifdef CONFIG_HUGETLB_PAGE +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)  static inline pte_t pte_mkhuge(pte_t pte)  {  	unsigned long mask; @@ -368,6 +389,17 @@ static inline pte_t pte_mkhuge(pte_t pte)  	return __pte(pte_val(pte) | mask);  } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline pmd_t pmd_mkhuge(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_mkhuge(pte); +	pte_val(pte) |= _PAGE_PMD_HUGE; + +	return __pmd(pte_val(pte)); +} +#endif  #endif  static inline pte_t pte_mkdirty(pte_t pte) @@ -502,6 +534,7 @@ static inline pte_t pte_mkyoung(pte_t pte)  static inline pte_t pte_mkspecial(pte_t pte)  { +	pte_val(pte) |= _PAGE_SPECIAL;  	return pte;  } @@ -607,29 +640,181 @@ static inline unsigned long pte_present(pte_t pte)  	return val;  } -static inline int pte_special(pte_t pte) +#define pte_accessible pte_accessible +static inline unsigned long pte_accessible(struct mm_struct *mm, pte_t a) +{ +	return pte_val(a) & _PAGE_VALID; +} + +static inline unsigned long pte_special(pte_t pte) +{ +	return pte_val(pte) & _PAGE_SPECIAL; +} + +static inline unsigned long pmd_large(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	return pte_val(pte) & _PAGE_PMD_HUGE; +} + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline unsigned long pmd_young(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	return pte_young(pte); +} + +static inline unsigned long pmd_write(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	return pte_write(pte); +} + +static inline unsigned long pmd_pfn(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	return pte_pfn(pte); +} + +static inline unsigned long pmd_trans_huge(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	return pte_val(pte) & _PAGE_PMD_HUGE; +} + +static inline unsigned long pmd_trans_splitting(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	return pmd_trans_huge(pmd) && pte_special(pte); +} + +#define has_transparent_hugepage() 1 + +static inline pmd_t pmd_mkold(pmd_t pmd)  { -	return 0; +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_mkold(pte); + +	return __pmd(pte_val(pte)); +} + +static inline pmd_t pmd_wrprotect(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_wrprotect(pte); + +	return __pmd(pte_val(pte)); +} + +static inline pmd_t pmd_mkdirty(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_mkdirty(pte); + +	return __pmd(pte_val(pte)); +} + +static inline pmd_t pmd_mkyoung(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_mkyoung(pte); + +	return __pmd(pte_val(pte)); +} + +static inline pmd_t pmd_mkwrite(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_mkwrite(pte); + +	return __pmd(pte_val(pte)); +} + +static inline pmd_t pmd_mksplitting(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); + +	pte = pte_mkspecial(pte); + +	return __pmd(pte_val(pte)); +} + +static inline pgprot_t pmd_pgprot(pmd_t entry) +{ +	unsigned long val = pmd_val(entry); + +	return __pgprot(val); +} +#endif + +static inline int pmd_present(pmd_t pmd) +{ +	return pmd_val(pmd) != 0UL; +} + +#define pmd_none(pmd)			(!pmd_val(pmd)) + +/* pmd_bad() is only called on non-trans-huge PMDs.  Our encoding is + * very simple, it's just the physical address.  PTE tables are of + * size PAGE_SIZE so make sure the sub-PAGE_SIZE bits are clear and + * the top bits outside of the range of any physical address size we + * support are clear as well.  We also validate the physical itself. + */ +#define pmd_bad(pmd)			((pmd_val(pmd) & ~PAGE_MASK) || \ +					 !__kern_addr_valid(pmd_val(pmd))) + +#define pud_none(pud)			(!pud_val(pud)) + +#define pud_bad(pud)			((pud_val(pud) & ~PAGE_MASK) || \ +					 !__kern_addr_valid(pud_val(pud))) + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +void set_pmd_at(struct mm_struct *mm, unsigned long addr, +		pmd_t *pmdp, pmd_t pmd); +#else +static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, +			      pmd_t *pmdp, pmd_t pmd) +{ +	*pmdp = pmd; +} +#endif + +static inline void pmd_set(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) +{ +	unsigned long val = __pa((unsigned long) (ptep)); + +	pmd_val(*pmdp) = val;  } -#define pmd_set(pmdp, ptep)	\ -	(pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL))  #define pud_set(pudp, pmdp)	\ -	(pud_val(*(pudp)) = (__pa((unsigned long) (pmdp)) >> 11UL)) -#define __pmd_page(pmd)		\ -	((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) +	(pud_val(*(pudp)) = (__pa((unsigned long) (pmdp)))) +static inline unsigned long __pmd_page(pmd_t pmd) +{ +	pte_t pte = __pte(pmd_val(pmd)); +	unsigned long pfn; + +	pfn = pte_pfn(pte); + +	return ((unsigned long) __va(pfn << PAGE_SHIFT)); +}  #define pmd_page(pmd) 			virt_to_page((void *)__pmd_page(pmd))  #define pud_page_vaddr(pud)		\ -	((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) +	((unsigned long) __va(pud_val(pud)))  #define pud_page(pud) 			virt_to_page((void *)pud_page_vaddr(pud)) -#define pmd_none(pmd)			(!pmd_val(pmd)) -#define pmd_bad(pmd)			(0) -#define pmd_present(pmd)		(pmd_val(pmd) != 0U) -#define pmd_clear(pmdp)			(pmd_val(*(pmdp)) = 0U) -#define pud_none(pud)			(!pud_val(pud)) -#define pud_bad(pud)			(0) +#define pmd_clear(pmdp)			(pmd_val(*(pmdp)) = 0UL)  #define pud_present(pud)		(pud_val(pud) != 0U) -#define pud_clear(pudp)			(pud_val(*(pudp)) = 0U) +#define pud_clear(pudp)			(pud_val(*(pudp)) = 0UL)  /* Same in both SUN4V and SUN4U.  */  #define pte_none(pte) 			(!pte_val(pte)) @@ -655,9 +840,21 @@ static inline int pte_special(pte_t pte)  #define pte_unmap(pte)			do { } while (0)  /* Actual page table PTE updates.  */ -extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, pte_t *ptep, pte_t orig); +void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, +		   pte_t *ptep, pte_t orig, int fullmm); + +#define __HAVE_ARCH_PMDP_GET_AND_CLEAR +static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, +				       unsigned long addr, +				       pmd_t *pmdp) +{ +	pmd_t pmd = *pmdp; +	set_pmd_at(mm, addr, pmdp, __pmd(0UL)); +	return pmd; +} -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) +static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, +			     pte_t *ptep, pte_t pte, int fullmm)  {  	pte_t orig = *ptep; @@ -669,13 +866,20 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p  	 * SUN4V NOTE: _PAGE_VALID is the same value in both the SUN4U  	 *             and SUN4V pte layout, so this inline test is fine.  	 */ -	if (likely(mm != &init_mm) && (pte_val(orig) & _PAGE_VALID)) -		tlb_batch_add(mm, addr, ptep, orig); +	if (likely(mm != &init_mm) && pte_accessible(mm, orig)) +		tlb_batch_add(mm, addr, ptep, orig, fullmm);  } +#define set_pte_at(mm,addr,ptep,pte)	\ +	__set_pte_at((mm), (addr), (ptep), (pte), 0) +  #define pte_clear(mm,addr,ptep)		\  	set_pte_at((mm), (addr), (ptep), __pte(0UL)) +#define __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL +#define pte_clear_not_present_full(mm,addr,ptep,fullmm)	\ +	__set_pte_at((mm), (addr), (ptep), __pte(0UL), (fullmm)) +  #ifdef DCACHE_ALIASING_POSSIBLE  #define __HAVE_ARCH_MOVE_PTE  #define move_pte(pte, prot, old_addr, new_addr)				\ @@ -693,18 +897,32 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p  })  #endif -extern pgd_t swapper_pg_dir[2048]; -extern pmd_t swapper_low_pmd_dir[2048]; +extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; +extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD]; -extern void paging_init(void); -extern unsigned long find_ecache_flush_span(unsigned long size); +void paging_init(void); +unsigned long find_ecache_flush_span(unsigned long size); -/* These do nothing with the way I have things setup. */ -#define mmu_lockarea(vaddr, len)		(vaddr) -#define mmu_unlockarea(vaddr, len)		do { } while(0) +struct seq_file; +void mmu_info(struct seq_file *);  struct vm_area_struct; -extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); +void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, +			  pmd_t *pmd); + +#define __HAVE_ARCH_PMDP_INVALIDATE +extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, +			    pmd_t *pmdp); + +#define __HAVE_ARCH_PGTABLE_DEPOSIT +void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, +				pgtable_t pgtable); + +#define __HAVE_ARCH_PGTABLE_WITHDRAW +pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); +#endif  /* Encode and de-code a swap entry */  #define __swp_type(entry)	(((entry).val >> PAGE_SHIFT) & 0xffUL) @@ -719,28 +937,12 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);  #define __swp_entry_to_pte(x)		((pte_t) { (x).val })  /* File offset in PTE support. */ -extern unsigned long pte_file(pte_t); +unsigned long pte_file(pte_t);  #define pte_to_pgoff(pte)	(pte_val(pte) >> PAGE_SHIFT) -extern pte_t pgoff_to_pte(unsigned long); +pte_t pgoff_to_pte(unsigned long);  #define PTE_FILE_MAX_BITS	(64UL - PAGE_SHIFT - 1UL) -extern unsigned long sparc64_valid_addr_bitmap[]; - -/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ -static inline bool kern_addr_valid(unsigned long addr) -{ -	unsigned long paddr = __pa(addr); - -	if ((paddr >> 41UL) != 0UL) -		return false; -	return test_bit(paddr >> 22, sparc64_valid_addr_bitmap); -} - -extern int page_in_phys_avail(unsigned long paddr); - -extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, -			       unsigned long pfn, -			       unsigned long size, pgprot_t prot); +int page_in_phys_avail(unsigned long paddr);  /*   * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in @@ -750,6 +952,24 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,  #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))  #define GET_PFN(pfn)			(pfn & 0x0fffffffffffffffUL) +int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, +		    unsigned long, pgprot_t); + +static inline int io_remap_pfn_range(struct vm_area_struct *vma, +				     unsigned long from, unsigned long pfn, +				     unsigned long size, pgprot_t prot) +{ +	unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; +	int space = GET_IOSPACE(pfn); +	unsigned long phys_base; + +	phys_base = offset | (((unsigned long) space) << 32UL); + +	return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); +} +#define io_remap_pfn_range io_remap_pfn_range  + +#include <asm/tlbflush.h>  #include <asm-generic/pgtable.h>  /* We provide our own get_unmapped_area to cope with VA holes and @@ -761,20 +981,20 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,  /* We provide a special get_unmapped_area for framebuffer mmaps to try and use   * the largest alignment possible such that larget PTEs can be used.   */ -extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, -					  unsigned long, unsigned long, -					  unsigned long); +unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, +				   unsigned long, unsigned long, +				   unsigned long);  #define HAVE_ARCH_FB_UNMAPPED_AREA -extern void pgtable_cache_init(void); -extern void sun4v_register_fault_status(void); -extern void sun4v_ktsb_register(void); -extern void __init cheetah_ecache_flush_init(void); -extern void sun4v_patch_tlb_handlers(void); +void pgtable_cache_init(void); +void sun4v_register_fault_status(void); +void sun4v_ktsb_register(void); +void __init cheetah_ecache_flush_init(void); +void sun4v_patch_tlb_handlers(void);  extern unsigned long cmdline_memory_size; -extern asmlinkage void do_sparc64_fault(struct pt_regs *regs); +asmlinkage void do_sparc64_fault(struct pt_regs *regs);  #endif /* !(__ASSEMBLY__) */ diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h index 1407c07bdad..79da17866fa 100644 --- a/arch/sparc/include/asm/pgtsrmmu.h +++ b/arch/sparc/include/asm/pgtsrmmu.h @@ -139,6 +139,7 @@  	 restore %g0, %g0, %g0;  #ifndef __ASSEMBLY__ +extern unsigned long last_valid_pfn;  /* This makes sense. Honest it does - Anton */  /* XXX Yes but it's ugly as sin.  FIXME. -KMW */ @@ -148,78 +149,13 @@ extern void *srmmu_nocache_pool;  #define __nocache_fix(VADDR) __va(__nocache_pa(VADDR))  /* Accessing the MMU control register. */ -static inline unsigned int srmmu_get_mmureg(void) -{ -        unsigned int retval; -	__asm__ __volatile__("lda [%%g0] %1, %0\n\t" : -			     "=r" (retval) : -			     "i" (ASI_M_MMUREGS)); -	return retval; -} - -static inline void srmmu_set_mmureg(unsigned long regval) -{ -	__asm__ __volatile__("sta %0, [%%g0] %1\n\t" : : -			     "r" (regval), "i" (ASI_M_MMUREGS) : "memory"); - -} - -static inline void srmmu_set_ctable_ptr(unsigned long paddr) -{ -	paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); -	__asm__ __volatile__("sta %0, [%1] %2\n\t" : : -			     "r" (paddr), "r" (SRMMU_CTXTBL_PTR), -			     "i" (ASI_M_MMUREGS) : -			     "memory"); -} - -static inline unsigned long srmmu_get_ctable_ptr(void) -{ -	unsigned int retval; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (retval) : -			     "r" (SRMMU_CTXTBL_PTR), -			     "i" (ASI_M_MMUREGS)); -	return (retval & SRMMU_CTX_PMASK) << 4; -} - -static inline void srmmu_set_context(int context) -{ -	__asm__ __volatile__("sta %0, [%1] %2\n\t" : : -			     "r" (context), "r" (SRMMU_CTX_REG), -			     "i" (ASI_M_MMUREGS) : "memory"); -} - -static inline int srmmu_get_context(void) -{ -	register int retval; -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (retval) : -			     "r" (SRMMU_CTX_REG), -			     "i" (ASI_M_MMUREGS)); -	return retval; -} - -static inline unsigned int srmmu_get_fstatus(void) -{ -	unsigned int retval; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (retval) : -			     "r" (SRMMU_FAULT_STATUS), "i" (ASI_M_MMUREGS)); -	return retval; -} - -static inline unsigned int srmmu_get_faddr(void) -{ -	unsigned int retval; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (retval) : -			     "r" (SRMMU_FAULT_ADDR), "i" (ASI_M_MMUREGS)); -	return retval; -} +unsigned int srmmu_get_mmureg(void); +void srmmu_set_mmureg(unsigned long regval); +void srmmu_set_ctable_ptr(unsigned long paddr); +void srmmu_set_context(int context); +int srmmu_get_context(void); +unsigned int srmmu_get_fstatus(void); +unsigned int srmmu_get_faddr(void);  /* This is guaranteed on all SRMMU's. */  static inline void srmmu_flush_whole_tlb(void) @@ -230,59 +166,6 @@ static inline void srmmu_flush_whole_tlb(void)  } -/* These flush types are not available on all chips... */ -static inline void srmmu_flush_tlb_ctx(void) -{ -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": : -			     "r" (0x300),        /* Flush TLB ctx.. */ -			     "i" (ASI_M_FLUSH_PROBE) : "memory"); - -} - -static inline void srmmu_flush_tlb_region(unsigned long addr) -{ -	addr &= SRMMU_PGDIR_MASK; -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": : -			     "r" (addr | 0x200), /* Flush TLB region.. */ -			     "i" (ASI_M_FLUSH_PROBE) : "memory"); - -} - - -static inline void srmmu_flush_tlb_segment(unsigned long addr) -{ -	addr &= SRMMU_REAL_PMD_MASK; -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": : -			     "r" (addr | 0x100), /* Flush TLB segment.. */ -			     "i" (ASI_M_FLUSH_PROBE) : "memory"); - -} - -static inline void srmmu_flush_tlb_page(unsigned long page) -{ -	page &= PAGE_MASK; -	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": : -			     "r" (page),        /* Flush TLB page.. */ -			     "i" (ASI_M_FLUSH_PROBE) : "memory"); - -} - -#ifndef CONFIG_SPARC_LEON -static inline unsigned long srmmu_hwprobe(unsigned long vaddr) -{ -	unsigned long retval; - -	vaddr &= PAGE_MASK; -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (retval) : -			     "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); - -	return retval; -} -#else -#define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK) -#endif -  static inline int  srmmu_get_pte (unsigned long addr)  { @@ -294,9 +177,6 @@ srmmu_get_pte (unsigned long addr)  	return entry;  } -extern unsigned long (*srmmu_read_physical)(unsigned long paddr); -extern void (*srmmu_write_physical)(unsigned long paddr, unsigned long word); -  #endif /* !(__ASSEMBLY__) */  #endif /* !(_SPARC_PGTSRMMU_H) */ diff --git a/arch/sparc/include/asm/pgtsun4.h b/arch/sparc/include/asm/pgtsun4.h deleted file mode 100644 index 5a0d661fb82..00000000000 --- a/arch/sparc/include/asm/pgtsun4.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * pgtsun4.h:  Sun4 specific pgtable.h defines and code. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ -#ifndef _SPARC_PGTSUN4C_H -#define _SPARC_PGTSUN4C_H - -#include <asm/contregs.h> - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ -#define SUN4C_PMD_SHIFT       23 - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define SUN4C_PGDIR_SHIFT       23 -#define SUN4C_PGDIR_SIZE        (1UL << SUN4C_PGDIR_SHIFT) -#define SUN4C_PGDIR_MASK        (~(SUN4C_PGDIR_SIZE-1)) -#define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK) - -/* To represent how the sun4c mmu really lays things out. */ -#define SUN4C_REAL_PGDIR_SHIFT       18 -#define SUN4C_REAL_PGDIR_SIZE        (1UL << SUN4C_REAL_PGDIR_SHIFT) -#define SUN4C_REAL_PGDIR_MASK        (~(SUN4C_REAL_PGDIR_SIZE-1)) -#define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) - -/* 19 bit PFN on sun4 */ -#define SUN4C_PFN_MASK 0x7ffff -  -/* Don't increase these unless the structures in sun4c.c are fixed */ -#define SUN4C_MAX_SEGMAPS 256 -#define SUN4C_MAX_CONTEXTS 16 - -/* - * To be efficient, and not have to worry about allocating such - * a huge pgd, we make the kernel sun4c tables each hold 1024 - * entries and the pgd similarly just like the i386 tables. - */ -#define SUN4C_PTRS_PER_PTE    1024 -#define SUN4C_PTRS_PER_PMD    1 -#define SUN4C_PTRS_PER_PGD    1024 - -/* - * Sparc SUN4C pte fields. - */ -#define _SUN4C_PAGE_VALID        0x80000000 -#define _SUN4C_PAGE_SILENT_READ  0x80000000   /* synonym */ -#define _SUN4C_PAGE_DIRTY        0x40000000 -#define _SUN4C_PAGE_SILENT_WRITE 0x40000000   /* synonym */ -#define _SUN4C_PAGE_PRIV         0x20000000   /* privileged page */ -#define _SUN4C_PAGE_NOCACHE      0x10000000   /* non-cacheable page */ -#define _SUN4C_PAGE_PRESENT      0x08000000   /* implemented in software */ -#define _SUN4C_PAGE_IO           0x04000000   /* I/O page */ -#define _SUN4C_PAGE_FILE         0x02000000   /* implemented in software */ -#define _SUN4C_PAGE_READ         0x00800000   /* implemented in software */ -#define _SUN4C_PAGE_WRITE        0x00400000   /* implemented in software */ -#define _SUN4C_PAGE_ACCESSED     0x00200000   /* implemented in software */ -#define _SUN4C_PAGE_MODIFIED     0x00100000   /* implemented in software */ - -#define _SUN4C_READABLE		(_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\ -				 _SUN4C_PAGE_ACCESSED) -#define _SUN4C_WRITEABLE	(_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\ -				 _SUN4C_PAGE_MODIFIED) - -#define _SUN4C_PAGE_CHG_MASK	(0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED) - -#define SUN4C_PAGE_NONE		__pgprot(_SUN4C_PAGE_PRESENT) -#define SUN4C_PAGE_SHARED	__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\ -					 _SUN4C_PAGE_WRITE) -#define SUN4C_PAGE_COPY		__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) -#define SUN4C_PAGE_READONLY	__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) -#define SUN4C_PAGE_KERNEL	__pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\ -					 _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV) - -/* SUN4C swap entry encoding - * - * We use 5 bits for the type and 19 for the offset.  This gives us - * 32 swapfiles of 4GB each.  Encoding looks like: - * - * RRRRRRRRooooooooooooooooooottttt - * fedcba9876543210fedcba9876543210 - * - * The top 8 bits are reserved for protection and status bits, especially - * FILE and PRESENT. - */ -#define SUN4C_SWP_TYPE_MASK	0x1f -#define SUN4C_SWP_OFF_MASK	0x7ffff -#define SUN4C_SWP_OFF_SHIFT	5 - -#ifndef __ASSEMBLY__ - -static inline unsigned long sun4c_get_synchronous_error(void) -{ -	unsigned long sync_err; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (sync_err) : -			     "r" (AC_SYNC_ERR), "i" (ASI_CONTROL)); -	return sync_err; -} - -static inline unsigned long sun4c_get_synchronous_address(void) -{ -	unsigned long sync_addr; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (sync_addr) : -			     "r" (AC_SYNC_VA), "i" (ASI_CONTROL)); -	return sync_addr; -} - -/* SUN4 pte, segmap, and context manipulation */ -static inline unsigned long sun4c_get_segmap(unsigned long addr) -{ -  register unsigned long entry; - -  __asm__ __volatile__("\n\tlduha [%1] %2, %0\n\t" :  -		       "=r" (entry) : -		       "r" (addr), "i" (ASI_SEGMAP)); -  return entry; -} - -static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry) -{ -  __asm__ __volatile__("\n\tstha %1, [%0] %2; nop; nop; nop;\n\t" : : -		       "r" (addr), "r" (entry), -		       "i" (ASI_SEGMAP) -		       : "memory"); -} - -static inline unsigned long sun4c_get_pte(unsigned long addr) -{ -  register unsigned long entry; - -  __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :  -		       "=r" (entry) : -		       "r" (addr), "i" (ASI_PTE)); -  return entry; -} - -static inline void sun4c_put_pte(unsigned long addr, unsigned long entry) -{ -  __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : -		       "r" (addr),  -		       "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE) -		       : "memory"); -} - -static inline int sun4c_get_context(void) -{ -  register int ctx; - -  __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : -		       "=r" (ctx) : -		       "r" (AC_CONTEXT), "i" (ASI_CONTROL)); - -  return ctx; -} - -static inline int sun4c_set_context(int ctx) -{ -  __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : -		       "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL) -		       : "memory"); - -  return ctx; -} - -#endif /* !(__ASSEMBLY__) */ - -#endif /* !(_SPARC_PGTSUN4_H) */ diff --git a/arch/sparc/include/asm/pgtsun4c.h b/arch/sparc/include/asm/pgtsun4c.h deleted file mode 100644 index aeb25e91217..00000000000 --- a/arch/sparc/include/asm/pgtsun4c.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * pgtsun4c.h:  Sun4c specific pgtable.h defines and code. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ -#ifndef _SPARC_PGTSUN4C_H -#define _SPARC_PGTSUN4C_H - -#include <asm/contregs.h> - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ -#define SUN4C_PMD_SHIFT       22 - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define SUN4C_PGDIR_SHIFT       22 -#define SUN4C_PGDIR_SIZE        (1UL << SUN4C_PGDIR_SHIFT) -#define SUN4C_PGDIR_MASK        (~(SUN4C_PGDIR_SIZE-1)) -#define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK) - -/* To represent how the sun4c mmu really lays things out. */ -#define SUN4C_REAL_PGDIR_SHIFT       18 -#define SUN4C_REAL_PGDIR_SIZE        (1UL << SUN4C_REAL_PGDIR_SHIFT) -#define SUN4C_REAL_PGDIR_MASK        (~(SUN4C_REAL_PGDIR_SIZE-1)) -#define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) - -/* 16 bit PFN on sun4c */ -#define SUN4C_PFN_MASK 0xffff - -/* Don't increase these unless the structures in sun4c.c are fixed */ -#define SUN4C_MAX_SEGMAPS 256 -#define SUN4C_MAX_CONTEXTS 16 - -/* - * To be efficient, and not have to worry about allocating such - * a huge pgd, we make the kernel sun4c tables each hold 1024 - * entries and the pgd similarly just like the i386 tables. - */ -#define SUN4C_PTRS_PER_PTE    1024 -#define SUN4C_PTRS_PER_PMD    1 -#define SUN4C_PTRS_PER_PGD    1024 - -/* - * Sparc SUN4C pte fields. - */ -#define _SUN4C_PAGE_VALID        0x80000000 -#define _SUN4C_PAGE_SILENT_READ  0x80000000   /* synonym */ -#define _SUN4C_PAGE_DIRTY        0x40000000 -#define _SUN4C_PAGE_SILENT_WRITE 0x40000000   /* synonym */ -#define _SUN4C_PAGE_PRIV         0x20000000   /* privileged page */ -#define _SUN4C_PAGE_NOCACHE      0x10000000   /* non-cacheable page */ -#define _SUN4C_PAGE_PRESENT      0x08000000   /* implemented in software */ -#define _SUN4C_PAGE_IO           0x04000000   /* I/O page */ -#define _SUN4C_PAGE_FILE         0x02000000   /* implemented in software */ -#define _SUN4C_PAGE_READ         0x00800000   /* implemented in software */ -#define _SUN4C_PAGE_WRITE        0x00400000   /* implemented in software */ -#define _SUN4C_PAGE_ACCESSED     0x00200000   /* implemented in software */ -#define _SUN4C_PAGE_MODIFIED     0x00100000   /* implemented in software */ - -#define _SUN4C_READABLE		(_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\ -				 _SUN4C_PAGE_ACCESSED) -#define _SUN4C_WRITEABLE	(_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\ -				 _SUN4C_PAGE_MODIFIED) - -#define _SUN4C_PAGE_CHG_MASK	(0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED) - -#define SUN4C_PAGE_NONE		__pgprot(_SUN4C_PAGE_PRESENT) -#define SUN4C_PAGE_SHARED	__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\ -					 _SUN4C_PAGE_WRITE) -#define SUN4C_PAGE_COPY		__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) -#define SUN4C_PAGE_READONLY	__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) -#define SUN4C_PAGE_KERNEL	__pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\ -					 _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV) - -/* SUN4C swap entry encoding - * - * We use 5 bits for the type and 19 for the offset.  This gives us - * 32 swapfiles of 4GB each.  Encoding looks like: - * - * RRRRRRRRooooooooooooooooooottttt - * fedcba9876543210fedcba9876543210 - * - * The top 8 bits are reserved for protection and status bits, especially - * FILE and PRESENT. - */ -#define SUN4C_SWP_TYPE_MASK	0x1f -#define SUN4C_SWP_OFF_MASK	0x7ffff -#define SUN4C_SWP_OFF_SHIFT	5 - -#ifndef __ASSEMBLY__ - -static inline unsigned long sun4c_get_synchronous_error(void) -{ -	unsigned long sync_err; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (sync_err) : -			     "r" (AC_SYNC_ERR), "i" (ASI_CONTROL)); -	return sync_err; -} - -static inline unsigned long sun4c_get_synchronous_address(void) -{ -	unsigned long sync_addr; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (sync_addr) : -			     "r" (AC_SYNC_VA), "i" (ASI_CONTROL)); -	return sync_addr; -} - -/* SUN4C pte, segmap, and context manipulation */ -static inline unsigned long sun4c_get_segmap(unsigned long addr) -{ -  register unsigned long entry; - -  __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :  -		       "=r" (entry) : -		       "r" (addr), "i" (ASI_SEGMAP)); - -  return entry; -} - -static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry) -{ - -  __asm__ __volatile__("\n\tstba %1, [%0] %2; nop; nop; nop;\n\t" : : -		       "r" (addr), "r" (entry), -		       "i" (ASI_SEGMAP) -		       : "memory"); -} - -static inline unsigned long sun4c_get_pte(unsigned long addr) -{ -  register unsigned long entry; - -  __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :  -		       "=r" (entry) : -		       "r" (addr), "i" (ASI_PTE)); -  return entry; -} - -static inline void sun4c_put_pte(unsigned long addr, unsigned long entry) -{ -  __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : -		       "r" (addr),  -		       "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE) -		       : "memory"); -} - -static inline int sun4c_get_context(void) -{ -  register int ctx; - -  __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : -		       "=r" (ctx) : -		       "r" (AC_CONTEXT), "i" (ASI_CONTROL)); - -  return ctx; -} - -static inline int sun4c_set_context(int ctx) -{ -  __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : -		       "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL) -		       : "memory"); - -  return ctx; -} - -#endif /* !(__ASSEMBLY__) */ - -#endif /* !(_SPARC_PGTSUN4C_H) */ diff --git a/arch/sparc/include/asm/poll.h b/arch/sparc/include/asm/poll.h deleted file mode 100644 index 091d3ad2e83..00000000000 --- a/arch/sparc/include/asm/poll.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __SPARC_POLL_H -#define __SPARC_POLL_H - -#define POLLWRNORM	POLLOUT -#define POLLWRBAND	256 -#define POLLMSG		512 -#define POLLREMOVE	1024 -#define POLLRDHUP       2048 - -#include <asm-generic/poll.h> - -#endif diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h deleted file mode 100644 index 98d6ebb922f..00000000000 --- a/arch/sparc/include/asm/posix_types.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * This file is generally used by user-level software, so you need to - * be a little careful about namespace pollution etc.  Also, we cannot - * assume GCC is being used. - */ - -#ifndef __SPARC_POSIX_TYPES_H -#define __SPARC_POSIX_TYPES_H - -#if defined(__sparc__) && defined(__arch64__) -/* sparc 64 bit */ -typedef unsigned long          __kernel_size_t; -typedef long                   __kernel_ssize_t; -typedef long                   __kernel_ptrdiff_t; -typedef long                   __kernel_time_t; -typedef long                   __kernel_clock_t; -typedef int                    __kernel_pid_t; -typedef int                    __kernel_ipc_pid_t; -typedef unsigned int           __kernel_uid_t; -typedef unsigned int           __kernel_gid_t; -typedef unsigned long          __kernel_ino_t; -typedef unsigned int           __kernel_mode_t; -typedef unsigned short         __kernel_umode_t; -typedef unsigned int           __kernel_nlink_t; -typedef int                    __kernel_daddr_t; -typedef long                   __kernel_off_t; -typedef char *                 __kernel_caddr_t; -typedef unsigned short	       __kernel_uid16_t; -typedef unsigned short	       __kernel_gid16_t; -typedef int                    __kernel_clockid_t; -typedef int                    __kernel_timer_t; - -typedef unsigned short 	       __kernel_old_uid_t; -typedef unsigned short         __kernel_old_gid_t; -typedef __kernel_uid_t	       __kernel_uid32_t; -typedef __kernel_gid_t	       __kernel_gid32_t; - -typedef unsigned int	       __kernel_old_dev_t; - -/* Note this piece of asymmetry from the v9 ABI.  */ -typedef int		       __kernel_suseconds_t; - -#else -/* sparc 32 bit */ - -typedef unsigned int           __kernel_size_t; -typedef int                    __kernel_ssize_t; -typedef long int               __kernel_ptrdiff_t; -typedef long                   __kernel_time_t; -typedef long		       __kernel_suseconds_t; -typedef long                   __kernel_clock_t; -typedef int                    __kernel_pid_t; -typedef unsigned short         __kernel_ipc_pid_t; -typedef unsigned short         __kernel_uid_t; -typedef unsigned short         __kernel_gid_t; -typedef unsigned long          __kernel_ino_t; -typedef unsigned short         __kernel_mode_t; -typedef unsigned short         __kernel_umode_t; -typedef short                  __kernel_nlink_t; -typedef long                   __kernel_daddr_t; -typedef long                   __kernel_off_t; -typedef char *                 __kernel_caddr_t; -typedef unsigned short	       __kernel_uid16_t; -typedef unsigned short	       __kernel_gid16_t; -typedef unsigned int	       __kernel_uid32_t; -typedef unsigned int	       __kernel_gid32_t; -typedef unsigned short	       __kernel_old_uid_t; -typedef unsigned short	       __kernel_old_gid_t; -typedef unsigned short	       __kernel_old_dev_t; -typedef int                    __kernel_clockid_t; -typedef int                    __kernel_timer_t; - -#endif /* defined(__sparc__) && defined(__arch64__) */ - -#ifdef __GNUC__ -typedef long long              __kernel_loff_t; -#endif - -typedef struct { -	int	val[2]; -} __kernel_fsid_t; - -#ifdef __KERNEL__ - -#undef __FD_SET -static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) -{ -	unsigned long _tmp = fd / __NFDBITS; -	unsigned long _rem = fd % __NFDBITS; -	fdsetp->fds_bits[_tmp] |= (1UL<<_rem); -} - -#undef __FD_CLR -static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) -{ -	unsigned long _tmp = fd / __NFDBITS; -	unsigned long _rem = fd % __NFDBITS; -	fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); -} - -#undef __FD_ISSET -static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p) -{ -	unsigned long _tmp = fd / __NFDBITS; -	unsigned long _rem = fd % __NFDBITS; -	return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; -} - -/* - * This will unroll the loop for the normal constant cases (8 or 32 longs, - * for 256 and 1024-bit fd_sets respectively) - */ -#undef __FD_ZERO -static inline void __FD_ZERO(__kernel_fd_set *p) -{ -	unsigned long *tmp = p->fds_bits; -	int i; - -	if (__builtin_constant_p(__FDSET_LONGS)) { -		switch (__FDSET_LONGS) { -			case 32: -			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; -			  tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; -			  tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; -			  tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; -			  tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0; -			  tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0; -			  tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0; -			  tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0; -			  return; -			case 16: -			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; -			  tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; -			  tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; -			  tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; -			  return; -			case 8: -			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; -			  tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; -			  return; -			case 4: -			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; -			  return; -		} -	} -	i = __FDSET_LONGS; -	while (i) { -		i--; -		*tmp = 0; -		tmp++; -	} -} - -#endif /* __KERNEL__ */ -#endif /* __SPARC_POSIX_TYPES_H */ diff --git a/arch/sparc/include/asm/processor.h b/arch/sparc/include/asm/processor.h index 9da9646bf6c..2fe99e66e76 100644 --- a/arch/sparc/include/asm/processor.h +++ b/arch/sparc/include/asm/processor.h @@ -5,4 +5,7 @@  #else  #include <asm/processor_32.h>  #endif + +#define nop() 		__asm__ __volatile__ ("nop") +  #endif diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h index 09521c6a5ed..a564817bbc2 100644 --- a/arch/sparc/include/asm/processor_32.h +++ b/arch/sparc/include/asm/processor_32.h @@ -16,7 +16,6 @@  #include <asm/ptrace.h>  #include <asm/head.h>  #include <asm/signal.h> -#include <asm/btfixup.h>  #include <asm/page.h>  /* @@ -75,7 +74,7 @@ struct thread_struct {  }  /* Return saved PC of a blocked thread. */ -extern unsigned long thread_saved_pc(struct task_struct *t); +unsigned long thread_saved_pc(struct task_struct *t);  /* Do necessary setup to start up a newly executed thread. */  static inline void start_thread(struct pt_regs * regs, unsigned long pc, @@ -107,12 +106,8 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,  /* Free all resources held by a thread. */  #define release_thread(tsk)		do { } while(0) -extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -/* Prepare to copy thread state - unlazy all lazy status */ -#define prepare_to_copy(tsk)	do { } while (0) - -extern unsigned long get_wchan(struct task_struct *); +unsigned long get_wchan(struct task_struct *);  #define task_pt_regs(tsk) ((tsk)->thread.kregs)  #define KSTK_EIP(tsk)  ((tsk)->thread.kregs->pc) @@ -121,8 +116,10 @@ extern unsigned long get_wchan(struct task_struct *);  #ifdef __KERNEL__  extern struct task_struct *last_task_used_math; +int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);  #define cpu_relax()	barrier() +extern void (*sparc_idle)(void);  #endif diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h index 59fcebb8f44..7028fe1a7c0 100644 --- a/arch/sparc/include/asm/processor_64.h +++ b/arch/sparc/include/asm/processor_64.h @@ -39,7 +39,9 @@  #define TASK_SIZE_OF(tsk) \  	(test_tsk_thread_flag(tsk,TIF_32BIT) ? \  	 (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) -#define TASK_SIZE	TASK_SIZE_OF(current) +#define TASK_SIZE \ +	(test_thread_flag(TIF_32BIT) ? \ +	 (1UL << 32UL) : ((unsigned long)-VPTE_SIZE))  #ifdef __KERNEL__  #define STACK_TOP32	((1UL << 32UL) - PAGE_SIZE) @@ -89,10 +91,11 @@ struct thread_struct {  #ifndef __ASSEMBLY__  #include <linux/types.h> +#include <asm/fpumacro.h>  /* Return saved PC of a blocked thread. */  struct task_struct; -extern unsigned long thread_saved_pc(struct task_struct *); +unsigned long thread_saved_pc(struct task_struct *);  /* On Uniprocessor, even in RMO processes see TSO semantics */  #ifdef CONFIG_SMP @@ -138,6 +141,10 @@ do { \  	: \  	: "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \  	  "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \ +	fprs_write(0);	\ +	current_thread_info()->xfsr[0] = 0;	\ +	current_thread_info()->fpsaved[0] = 0;	\ +	regs->tstate &= ~TSTATE_PEF;	\  } while (0)  #define start_thread32(regs, pc, sp) \ @@ -178,23 +185,37 @@ do { \  	: \  	: "r" (regs), "r" (sp - sizeof(struct reg_window32)), \  	  "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \ +	fprs_write(0);	\ +	current_thread_info()->xfsr[0] = 0;	\ +	current_thread_info()->fpsaved[0] = 0;	\ +	regs->tstate &= ~TSTATE_PEF;	\  } while (0)  /* Free all resources held by a thread. */  #define release_thread(tsk)		do { } while (0) -/* Prepare to copy thread state - unlazy all lazy status */ -#define prepare_to_copy(tsk)	do { } while (0) - -extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); - -extern unsigned long get_wchan(struct task_struct *task); +unsigned long get_wchan(struct task_struct *task);  #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)  #define KSTK_EIP(tsk)  (task_pt_regs(tsk)->tpc)  #define KSTK_ESP(tsk)  (task_pt_regs(tsk)->u_regs[UREG_FP]) -#define cpu_relax()	barrier() +/* Please see the commentary in asm/backoff.h for a description of + * what these instructions are doing and how they have been choosen. + * To make a long story short, we are trying to yield the current cpu + * strand during busy loops. + */ +#define cpu_relax()	asm volatile("\n99:\n\t"			\ +				     "rd	%%ccr, %%g0\n\t"	\ +				     "rd	%%ccr, %%g0\n\t"	\ +				     "rd	%%ccr, %%g0\n\t"	\ +				     ".section	.pause_3insn_patch,\"ax\"\n\t"\ +				     ".word	99b\n\t"		\ +				     "wr	%%g0, 128, %%asr27\n\t"	\ +				     "nop\n\t"				\ +				     "nop\n\t"				\ +				     ".previous"			\ +				     ::: "memory")  /* Prefetch support.  This is tuned for UltraSPARC-III and later.   * UltraSPARC-I will treat these as nops, and UltraSPARC-II has @@ -232,6 +253,8 @@ static inline void prefetchw(const void *x)  #define HAVE_ARCH_PICK_MMAP_LAYOUT +int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap); +  #endif /* !(__ASSEMBLY__) */  #endif /* !(__ASM_SPARC64_PROCESSOR_H) */ diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index 56bbaadef64..d955c8df62d 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h @@ -21,7 +21,8 @@  #include <linux/of_pdt.h>  #include <linux/proc_fs.h>  #include <linux/mutex.h> -#include <asm/atomic.h> +#include <linux/atomic.h> +#include <linux/irqdomain.h>  #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	2  #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1 @@ -35,41 +36,28 @@ struct of_irq_controller {  	void		*data;  }; -extern struct device_node *of_find_node_by_cpuid(int cpuid); -extern int of_set_property(struct device_node *node, const char *name, void *val, int len); +struct device_node *of_find_node_by_cpuid(int cpuid); +int of_set_property(struct device_node *node, const char *name, void *val, int len);  extern struct mutex of_set_property_mutex; -extern int of_getintprop_default(struct device_node *np, -				 const char *name, +int of_getintprop_default(struct device_node *np, +			  const char *name,  				 int def); -extern int of_find_in_proplist(const char *list, const char *match, int len); -#ifdef CONFIG_NUMA -extern int of_node_to_nid(struct device_node *dp); -#define of_node_to_nid of_node_to_nid -#endif +int of_find_in_proplist(const char *list, const char *match, int len); -extern void prom_build_devicetree(void); -extern void of_populate_present_mask(void); -extern void of_fill_in_cpu_data(void); +void prom_build_devicetree(void); +void of_populate_present_mask(void); +void of_fill_in_cpu_data(void);  struct resource; -extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); -extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); - -/* These routines are here to provide compatibility with how powerpc - * handles IRQ mapping for OF device nodes.  We precompute and permanently - * register them in the platform_device objects, whereas powerpc computes them - * on request. - */ -static inline void irq_dispose_mapping(unsigned int virq) -{ -} +void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); +void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);  extern struct device_node *of_console_device;  extern char *of_console_path;  extern char *of_console_options; -extern void irq_trans_init(struct device_node *dp); -extern char *build_path_component(struct device_node *dp); +void irq_trans_init(struct device_node *dp); +char *build_path_component(struct device_node *dp);  #endif /* __KERNEL__ */  #endif /* _SPARC_PROM_H */ diff --git a/arch/sparc/include/asm/psr.h b/arch/sparc/include/asm/psr.h index b8c0e5f0a66..e71eb57945e 100644 --- a/arch/sparc/include/asm/psr.h +++ b/arch/sparc/include/asm/psr.h @@ -7,35 +7,11 @@   *   * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)   */ -  #ifndef __LINUX_SPARC_PSR_H  #define __LINUX_SPARC_PSR_H -/* The Sparc PSR fields are laid out as the following: - * - *  ------------------------------------------------------------------------ - *  | impl  | vers  | icc   | resv  | EC | EF | PIL  | S | PS | ET |  CWP  | - *  | 31-28 | 27-24 | 23-20 | 19-14 | 13 | 12 | 11-8 | 7 | 6  | 5  |  4-0  | - *  ------------------------------------------------------------------------ - */ -#define PSR_CWP     0x0000001f         /* current window pointer     */ -#define PSR_ET      0x00000020         /* enable traps field         */ -#define PSR_PS      0x00000040         /* previous privilege level   */ -#define PSR_S       0x00000080         /* current privilege level    */ -#define PSR_PIL     0x00000f00         /* processor interrupt level  */ -#define PSR_EF      0x00001000         /* enable floating point      */ -#define PSR_EC      0x00002000         /* enable co-processor        */ -#define PSR_SYSCALL 0x00004000         /* inside of a syscall        */ -#define PSR_LE      0x00008000         /* SuperSparcII little-endian */ -#define PSR_ICC     0x00f00000         /* integer condition codes    */ -#define PSR_C       0x00100000         /* carry bit                  */ -#define PSR_V       0x00200000         /* overflow bit               */ -#define PSR_Z       0x00400000         /* zero bit                   */ -#define PSR_N       0x00800000         /* negative bit               */ -#define PSR_VERS    0x0f000000         /* cpu-version field          */ -#define PSR_IMPL    0xf0000000         /* cpu-implementation field   */ +#include <uapi/asm/psr.h> -#ifdef __KERNEL__  #ifndef __ASSEMBLY__  /* Get the %psr register. */ @@ -88,6 +64,4 @@ static inline unsigned int get_fsr(void)  #endif /* !(__ASSEMBLY__) */ -#endif /* (__KERNEL__) */ -  #endif /* !(__LINUX_SPARC_PSR_H) */ diff --git a/arch/sparc/include/asm/psrcompat.h b/arch/sparc/include/asm/psrcompat.h deleted file mode 100644 index 44b6327dbbf..00000000000 --- a/arch/sparc/include/asm/psrcompat.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _SPARC64_PSRCOMPAT_H -#define _SPARC64_PSRCOMPAT_H - -#include <asm/pstate.h> - -/* Old 32-bit PSR fields for the compatibility conversion code. */ -#define PSR_CWP     0x0000001f         /* current window pointer     */ -#define PSR_ET      0x00000020         /* enable traps field         */ -#define PSR_PS      0x00000040         /* previous privilege level   */ -#define PSR_S       0x00000080         /* current privilege level    */ -#define PSR_PIL     0x00000f00         /* processor interrupt level  */ -#define PSR_EF      0x00001000         /* enable floating point      */ -#define PSR_EC      0x00002000         /* enable co-processor        */ -#define PSR_SYSCALL 0x00004000         /* inside of a syscall        */ -#define PSR_LE      0x00008000         /* SuperSparcII little-endian */ -#define PSR_ICC     0x00f00000         /* integer condition codes    */ -#define PSR_C       0x00100000         /* carry bit                  */ -#define PSR_V       0x00200000         /* overflow bit               */ -#define PSR_Z       0x00400000         /* zero bit                   */ -#define PSR_N       0x00800000         /* negative bit               */ -#define PSR_VERS    0x0f000000         /* cpu-version field          */ -#define PSR_IMPL    0xf0000000         /* cpu-implementation field   */ - -#define PSR_V8PLUS  0xff000000         /* fake impl/ver, meaning a 64bit CPU is present */ -#define PSR_XCC	    0x000f0000         /* if PSR_V8PLUS, this is %xcc */ - -static inline unsigned int tstate_to_psr(unsigned long tstate) -{ -	return ((tstate & TSTATE_CWP)			| -		PSR_S					| -		((tstate & TSTATE_ICC) >> 12)		| -		((tstate & TSTATE_XCC) >> 20)		| -		((tstate & TSTATE_SYSCALL) ? PSR_SYSCALL : 0) | -		PSR_V8PLUS); -} - -static inline unsigned long psr_to_tstate_icc(unsigned int psr) -{ -	unsigned long tstate = ((unsigned long)(psr & PSR_ICC)) << 12; -	if ((psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS) -		tstate |= ((unsigned long)(psr & PSR_XCC)) << 20; -	return tstate; -} - -#endif /* !(_SPARC64_PSRCOMPAT_H) */ diff --git a/arch/sparc/include/asm/pstate.h b/arch/sparc/include/asm/pstate.h deleted file mode 100644 index a26a53777bb..00000000000 --- a/arch/sparc/include/asm/pstate.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _SPARC64_PSTATE_H -#define _SPARC64_PSTATE_H - -#include <linux/const.h> - -/* The V9 PSTATE Register (with SpitFire extensions). - * - * ----------------------------------------------------------------------- - * | Resv | IG | MG | CLE | TLE |  MM  | RED | PEF | AM | PRIV | IE | AG | - * ----------------------------------------------------------------------- - *  63  12  11   10    9     8    7   6   5     4     3     2     1    0 - */ -#define PSTATE_IG   _AC(0x0000000000000800,UL) /* Interrupt Globals.	*/ -#define PSTATE_MG   _AC(0x0000000000000400,UL) /* MMU Globals.		*/ -#define PSTATE_CLE  _AC(0x0000000000000200,UL) /* Current Little Endian.*/ -#define PSTATE_TLE  _AC(0x0000000000000100,UL) /* Trap Little Endian.	*/ -#define PSTATE_MM   _AC(0x00000000000000c0,UL) /* Memory Model.		*/ -#define PSTATE_TSO  _AC(0x0000000000000000,UL) /* MM: TotalStoreOrder	*/ -#define PSTATE_PSO  _AC(0x0000000000000040,UL) /* MM: PartialStoreOrder	*/ -#define PSTATE_RMO  _AC(0x0000000000000080,UL) /* MM: RelaxedMemoryOrder*/ -#define PSTATE_RED  _AC(0x0000000000000020,UL) /* Reset Error Debug.	*/ -#define PSTATE_PEF  _AC(0x0000000000000010,UL) /* Floating Point Enable.*/ -#define PSTATE_AM   _AC(0x0000000000000008,UL) /* Address Mask.		*/ -#define PSTATE_PRIV _AC(0x0000000000000004,UL) /* Privilege.		*/ -#define PSTATE_IE   _AC(0x0000000000000002,UL) /* Interrupt Enable.	*/ -#define PSTATE_AG   _AC(0x0000000000000001,UL) /* Alternate Globals.	*/ - -/* The V9 TSTATE Register (with SpitFire and Linux extensions). - * - * --------------------------------------------------------------------- - * |  Resv |  GL  |  CCR  |  ASI  |  %pil  |  PSTATE  |  Resv  |  CWP  | - * --------------------------------------------------------------------- - *  63   43 42  40 39   32 31   24 23    20 19       8 7      5 4     0 - */ -#define TSTATE_GL	_AC(0x0000070000000000,UL) /* Global reg level  */ -#define TSTATE_CCR	_AC(0x000000ff00000000,UL) /* Condition Codes.	*/ -#define TSTATE_XCC	_AC(0x000000f000000000,UL) /* Condition Codes.	*/ -#define TSTATE_XNEG	_AC(0x0000008000000000,UL) /* %xcc Negative.	*/ -#define TSTATE_XZERO	_AC(0x0000004000000000,UL) /* %xcc Zero.	*/ -#define TSTATE_XOVFL	_AC(0x0000002000000000,UL) /* %xcc Overflow.	*/ -#define TSTATE_XCARRY	_AC(0x0000001000000000,UL) /* %xcc Carry.	*/ -#define TSTATE_ICC	_AC(0x0000000f00000000,UL) /* Condition Codes.	*/ -#define TSTATE_INEG	_AC(0x0000000800000000,UL) /* %icc Negative.	*/ -#define TSTATE_IZERO	_AC(0x0000000400000000,UL) /* %icc Zero.	*/ -#define TSTATE_IOVFL	_AC(0x0000000200000000,UL) /* %icc Overflow.	*/ -#define TSTATE_ICARRY	_AC(0x0000000100000000,UL) /* %icc Carry.	*/ -#define TSTATE_ASI	_AC(0x00000000ff000000,UL) /* AddrSpace ID.	*/ -#define TSTATE_PIL	_AC(0x0000000000f00000,UL) /* %pil (Linux traps)*/ -#define TSTATE_PSTATE	_AC(0x00000000000fff00,UL) /* PSTATE.		*/ -#define TSTATE_IG	_AC(0x0000000000080000,UL) /* Interrupt Globals.*/ -#define TSTATE_MG	_AC(0x0000000000040000,UL) /* MMU Globals.	*/ -#define TSTATE_CLE	_AC(0x0000000000020000,UL) /* CurrLittleEndian.	*/ -#define TSTATE_TLE	_AC(0x0000000000010000,UL) /* TrapLittleEndian.	*/ -#define TSTATE_MM	_AC(0x000000000000c000,UL) /* Memory Model.	*/ -#define TSTATE_TSO	_AC(0x0000000000000000,UL) /* MM: TSO		*/ -#define TSTATE_PSO	_AC(0x0000000000004000,UL) /* MM: PSO		*/ -#define TSTATE_RMO	_AC(0x0000000000008000,UL) /* MM: RMO		*/ -#define TSTATE_RED	_AC(0x0000000000002000,UL) /* Reset Error Debug.*/ -#define TSTATE_PEF	_AC(0x0000000000001000,UL) /* FPU Enable.	*/ -#define TSTATE_AM	_AC(0x0000000000000800,UL) /* Address Mask.	*/ -#define TSTATE_PRIV	_AC(0x0000000000000400,UL) /* Privilege.	*/ -#define TSTATE_IE	_AC(0x0000000000000200,UL) /* Interrupt Enable.	*/ -#define TSTATE_AG	_AC(0x0000000000000100,UL) /* Alternate Globals.*/ -#define TSTATE_SYSCALL	_AC(0x0000000000000020,UL) /* in syscall trap   */ -#define TSTATE_CWP	_AC(0x000000000000001f,UL) /* Curr Win-Pointer.	*/ - -/* Floating-Point Registers State Register. - * - * -------------------------------- - * |  Resv  |  FEF  |  DU  |  DL  | - * -------------------------------- - *  63     3    2       1      0 - */ -#define FPRS_FEF	_AC(0x0000000000000004,UL) /* FPU Enable.	*/ -#define FPRS_DU		_AC(0x0000000000000002,UL) /* Dirty Upper.	*/ -#define FPRS_DL		_AC(0x0000000000000001,UL) /* Dirty Lower.	*/ - -/* Version Register. - * - * ------------------------------------------------------ - * | MANUF | IMPL | MASK | Resv | MAXTL | Resv | MAXWIN | - * ------------------------------------------------------ - *  63   48 47  32 31  24 23  16 15    8 7    5 4      0 - */ -#define VERS_MANUF	_AC(0xffff000000000000,UL) /* Manufacturer.	*/ -#define VERS_IMPL	_AC(0x0000ffff00000000,UL) /* Implementation.	*/ -#define VERS_MASK	_AC(0x00000000ff000000,UL) /* Mask Set Revision.*/ -#define VERS_MAXTL	_AC(0x000000000000ff00,UL) /* Max Trap Level.	*/ -#define VERS_MAXWIN	_AC(0x000000000000001f,UL) /* Max RegWindow Idx.*/ - -#endif /* !(_SPARC64_PSTATE_H) */ diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h index 30b0b797dc0..bac6a946ee0 100644 --- a/arch/sparc/include/asm/ptrace.h +++ b/arch/sparc/include/asm/ptrace.h @@ -1,169 +1,13 @@  #ifndef __SPARC_PTRACE_H  #define __SPARC_PTRACE_H -#if defined(__sparc__) && defined(__arch64__) -/* 64 bit sparc */ -#include <asm/pstate.h> - -/* This struct defines the way the registers are stored on the - * stack during a system call and basically all traps. - */ - -/* This magic value must have the low 9 bits clear, - * as that is where we encode the %tt value, see below. - */ -#define PT_REGS_MAGIC 0x57ac6c00 - -#ifndef __ASSEMBLY__ - -#include <linux/types.h> - -struct pt_regs { -	unsigned long u_regs[16]; /* globals and ins */ -	unsigned long tstate; -	unsigned long tpc; -	unsigned long tnpc; -	unsigned int y; - -	/* We encode a magic number, PT_REGS_MAGIC, along -	 * with the %tt (trap type) register value at trap -	 * entry time.  The magic number allows us to identify -	 * accurately a trap stack frame in the stack -	 * unwinder, and the %tt value allows us to test -	 * things like "in a system call" etc. for an arbitray -	 * process. -	 * -	 * The PT_REGS_MAGIC is choosen such that it can be -	 * loaded completely using just a sethi instruction. -	 */ -	unsigned int magic; -}; - -struct pt_regs32 { -	unsigned int psr; -	unsigned int pc; -	unsigned int npc; -	unsigned int y; -	unsigned int u_regs[16]; /* globals and ins */ -}; - -/* A V9 register window */ -struct reg_window { -	unsigned long locals[8]; -	unsigned long ins[8]; -}; - -/* A 32-bit register window. */ -struct reg_window32 { -	unsigned int locals[8]; -	unsigned int ins[8]; -}; - -/* A V9 Sparc stack frame */ -struct sparc_stackf { -	unsigned long locals[8]; -        unsigned long ins[6]; -	struct sparc_stackf *fp; -	unsigned long callers_pc; -	char *structptr; -	unsigned long xargs[6]; -	unsigned long xxargs[1]; -}; - -/* A 32-bit Sparc stack frame */ -struct sparc_stackf32 { -	unsigned int locals[8]; -        unsigned int ins[6]; -	unsigned int fp; -	unsigned int callers_pc; -	unsigned int structptr; -	unsigned int xargs[6]; -	unsigned int xxargs[1]; -}; - -struct sparc_trapf { -	unsigned long locals[8]; -	unsigned long ins[8]; -	unsigned long _unused; -	struct pt_regs *regs; -}; -#endif /* (!__ASSEMBLY__) */ -#else -/* 32 bit sparc */ - -#include <asm/psr.h> - -/* This struct defines the way the registers are stored on the - * stack during a system call and basically all traps. - */ -#ifndef __ASSEMBLY__ - -struct pt_regs { -	unsigned long psr; -	unsigned long pc; -	unsigned long npc; -	unsigned long y; -	unsigned long u_regs[16]; /* globals and ins */ -}; - -/* A 32-bit register window. */ -struct reg_window32 { -	unsigned long locals[8]; -	unsigned long ins[8]; -}; - -/* A Sparc stack frame */ -struct sparc_stackf { -	unsigned long locals[8]; -        unsigned long ins[6]; -	struct sparc_stackf *fp; -	unsigned long callers_pc; -	char *structptr; -	unsigned long xargs[6]; -	unsigned long xxargs[1]; -}; -#endif /* (!__ASSEMBLY__) */ - -#endif /* (defined(__sparc__) && defined(__arch64__))*/ - -#ifndef __ASSEMBLY__ - -#define TRACEREG_SZ	sizeof(struct pt_regs) -#define STACKFRAME_SZ	sizeof(struct sparc_stackf) - -#define TRACEREG32_SZ	sizeof(struct pt_regs32) -#define STACKFRAME32_SZ	sizeof(struct sparc_stackf32) - -#endif /* (!__ASSEMBLY__) */ - -#define UREG_G0        0 -#define UREG_G1        1 -#define UREG_G2        2 -#define UREG_G3        3 -#define UREG_G4        4 -#define UREG_G5        5 -#define UREG_G6        6 -#define UREG_G7        7 -#define UREG_I0        8 -#define UREG_I1        9 -#define UREG_I2        10 -#define UREG_I3        11 -#define UREG_I4        12 -#define UREG_I5        13 -#define UREG_I6        14 -#define UREG_I7        15 -#define UREG_FP        UREG_I6 -#define UREG_RETPC     UREG_I7 +#include <uapi/asm/ptrace.h>  #if defined(__sparc__) && defined(__arch64__) -/* 64 bit sparc */ -  #ifndef __ASSEMBLY__ -#ifdef __KERNEL__ -  #include <linux/threads.h> -#include <asm/system.h> +#include <asm/switch_to.h>  static inline int pt_regs_trap_type(struct pt_regs *regs)  { @@ -188,6 +32,9 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)  #define arch_ptrace_stop(exit_code, info) \  	synchronize_user_stack() +#define current_pt_regs() \ +	((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1) +  struct global_reg_snapshot {  	unsigned long		tstate;  	unsigned long		tpc; @@ -198,41 +45,43 @@ struct global_reg_snapshot {  	struct thread_info	*thread;  	unsigned long		pad1;  }; -extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; -#define force_successful_syscall_return()	    \ -do {	current_thread_info()->syscall_noerror = 1; \ -} while (0) +struct global_pmu_snapshot { +	unsigned long		pcr[4]; +	unsigned long		pic[4]; +}; + +union global_cpu_snapshot { +	struct global_reg_snapshot	reg; +	struct global_pmu_snapshot	pmu; +}; + +extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS]; + +#define force_successful_syscall_return() set_thread_noerror(1)  #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))  #define instruction_pointer(regs) ((regs)->tpc) +#define instruction_pointer_set(regs, val) ((regs)->tpc = (val))  #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) -#define regs_return_value(regs) ((regs)->u_regs[UREG_I0]) +static inline int is_syscall_success(struct pt_regs *regs) +{ +	return !(regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY)); +} + +static inline long regs_return_value(struct pt_regs *regs) +{ +	return regs->u_regs[UREG_I0]; +}  #ifdef CONFIG_SMP -extern unsigned long profile_pc(struct pt_regs *); +unsigned long profile_pc(struct pt_regs *);  #else  #define profile_pc(regs) instruction_pointer(regs)  #endif -extern void show_regs(struct pt_regs *); -#endif /* (__KERNEL__) */ -  #else /* __ASSEMBLY__ */ -/* For assembly code. */ -#define TRACEREG_SZ		0xa0 -#define STACKFRAME_SZ		0xc0 - -#define TRACEREG32_SZ		0x50 -#define STACKFRAME32_SZ		0x60  #endif /* __ASSEMBLY__ */ -  #else /* (defined(__sparc__) && defined(__arch64__)) */ - -/* 32 bit sparc */ -  #ifndef __ASSEMBLY__ - -#ifdef __KERNEL__ - -#include <asm/system.h> +#include <asm/switch_to.h>  static inline bool pt_regs_is_syscall(struct pt_regs *regs)  { @@ -252,163 +101,17 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)  #define arch_ptrace_stop(exit_code, info) \  	synchronize_user_stack() +#define current_pt_regs() \ +	((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1) +  #define user_mode(regs) (!((regs)->psr & PSR_PS))  #define instruction_pointer(regs) ((regs)->pc)  #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])  unsigned long profile_pc(struct pt_regs *); -extern void show_regs(struct pt_regs *); -#endif /* (__KERNEL__) */ -  #else /* (!__ASSEMBLY__) */ -/* For assembly code. */ -#define TRACEREG_SZ       0x50 -#define STACKFRAME_SZ     0x60  #endif /* (!__ASSEMBLY__) */ -  #endif /* (defined(__sparc__) && defined(__arch64__)) */ - -#ifdef __KERNEL__  #define STACK_BIAS		2047 -#endif - -/* These are for pt_regs. */ -#define PT_V9_G0     0x00 -#define PT_V9_G1     0x08 -#define PT_V9_G2     0x10 -#define PT_V9_G3     0x18 -#define PT_V9_G4     0x20 -#define PT_V9_G5     0x28 -#define PT_V9_G6     0x30 -#define PT_V9_G7     0x38 -#define PT_V9_I0     0x40 -#define PT_V9_I1     0x48 -#define PT_V9_I2     0x50 -#define PT_V9_I3     0x58 -#define PT_V9_I4     0x60 -#define PT_V9_I5     0x68 -#define PT_V9_I6     0x70 -#define PT_V9_FP     PT_V9_I6 -#define PT_V9_I7     0x78 -#define PT_V9_TSTATE 0x80 -#define PT_V9_TPC    0x88 -#define PT_V9_TNPC   0x90 -#define PT_V9_Y      0x98 -#define PT_V9_MAGIC  0x9c -#define PT_TSTATE	PT_V9_TSTATE -#define PT_TPC		PT_V9_TPC -#define PT_TNPC		PT_V9_TNPC - -/* These for pt_regs32. */ -#define PT_PSR    0x0 -#define PT_PC     0x4 -#define PT_NPC    0x8 -#define PT_Y      0xc -#define PT_G0     0x10 -#define PT_WIM    PT_G0 -#define PT_G1     0x14 -#define PT_G2     0x18 -#define PT_G3     0x1c -#define PT_G4     0x20 -#define PT_G5     0x24 -#define PT_G6     0x28 -#define PT_G7     0x2c -#define PT_I0     0x30 -#define PT_I1     0x34 -#define PT_I2     0x38 -#define PT_I3     0x3c -#define PT_I4     0x40 -#define PT_I5     0x44 -#define PT_I6     0x48 -#define PT_FP     PT_I6 -#define PT_I7     0x4c - -/* Reg_window offsets */ -#define RW_V9_L0     0x00 -#define RW_V9_L1     0x08 -#define RW_V9_L2     0x10 -#define RW_V9_L3     0x18 -#define RW_V9_L4     0x20 -#define RW_V9_L5     0x28 -#define RW_V9_L6     0x30 -#define RW_V9_L7     0x38 -#define RW_V9_I0     0x40 -#define RW_V9_I1     0x48 -#define RW_V9_I2     0x50 -#define RW_V9_I3     0x58 -#define RW_V9_I4     0x60 -#define RW_V9_I5     0x68 -#define RW_V9_I6     0x70 -#define RW_V9_I7     0x78 - -#define RW_L0     0x00 -#define RW_L1     0x04 -#define RW_L2     0x08 -#define RW_L3     0x0c -#define RW_L4     0x10 -#define RW_L5     0x14 -#define RW_L6     0x18 -#define RW_L7     0x1c -#define RW_I0     0x20 -#define RW_I1     0x24 -#define RW_I2     0x28 -#define RW_I3     0x2c -#define RW_I4     0x30 -#define RW_I5     0x34 -#define RW_I6     0x38 -#define RW_I7     0x3c - -/* Stack_frame offsets */ -#define SF_V9_L0     0x00 -#define SF_V9_L1     0x08 -#define SF_V9_L2     0x10 -#define SF_V9_L3     0x18 -#define SF_V9_L4     0x20 -#define SF_V9_L5     0x28 -#define SF_V9_L6     0x30 -#define SF_V9_L7     0x38 -#define SF_V9_I0     0x40 -#define SF_V9_I1     0x48 -#define SF_V9_I2     0x50 -#define SF_V9_I3     0x58 -#define SF_V9_I4     0x60 -#define SF_V9_I5     0x68 -#define SF_V9_FP     0x70 -#define SF_V9_PC     0x78 -#define SF_V9_RETP   0x80 -#define SF_V9_XARG0  0x88 -#define SF_V9_XARG1  0x90 -#define SF_V9_XARG2  0x98 -#define SF_V9_XARG3  0xa0 -#define SF_V9_XARG4  0xa8 -#define SF_V9_XARG5  0xb0 -#define SF_V9_XXARG  0xb8 - -#define SF_L0     0x00 -#define SF_L1     0x04 -#define SF_L2     0x08 -#define SF_L3     0x0c -#define SF_L4     0x10 -#define SF_L5     0x14 -#define SF_L6     0x18 -#define SF_L7     0x1c -#define SF_I0     0x20 -#define SF_I1     0x24 -#define SF_I2     0x28 -#define SF_I3     0x2c -#define SF_I4     0x30 -#define SF_I5     0x34 -#define SF_FP     0x38 -#define SF_PC     0x3c -#define SF_RETP   0x40 -#define SF_XARG0  0x44 -#define SF_XARG1  0x48 -#define SF_XARG2  0x4c -#define SF_XARG3  0x50 -#define SF_XARG4  0x54 -#define SF_XARG5  0x58 -#define SF_XXARG  0x5c - -#ifdef __KERNEL__  /* global_reg_snapshot offsets */  #define GR_SNAP_TSTATE	0x00 @@ -420,29 +123,4 @@ extern void show_regs(struct pt_regs *);  #define GR_SNAP_THREAD	0x30  #define GR_SNAP_PAD1	0x38 -#endif  /*  __KERNEL__  */ - -/* Stuff for the ptrace system call */ -#define PTRACE_SPARC_DETACH       11 -#define PTRACE_GETREGS            12 -#define PTRACE_SETREGS            13 -#define PTRACE_GETFPREGS          14 -#define PTRACE_SETFPREGS          15 -#define PTRACE_READDATA           16 -#define PTRACE_WRITEDATA          17 -#define PTRACE_READTEXT           18 -#define PTRACE_WRITETEXT          19 -#define PTRACE_GETFPAREGS         20 -#define PTRACE_SETFPAREGS         21 - -/* There are for debugging 64-bit processes, either from a 32 or 64 bit - * parent.  Thus their complements are for debugging 32-bit processes only. - */ - -#define PTRACE_GETREGS64	  22 -#define PTRACE_SETREGS64	  23 -/* PTRACE_SYSCALL is 24 */ -#define PTRACE_GETFPREGS64	  25 -#define PTRACE_SETFPREGS64	  26 -  #endif /* !(__SPARC_PTRACE_H) */ diff --git a/arch/sparc/include/asm/resource.h b/arch/sparc/include/asm/resource.h deleted file mode 100644 index fe163cafb4c..00000000000 --- a/arch/sparc/include/asm/resource.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * resource.h: Resource definitions. - * - * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef _SPARC_RESOURCE_H -#define _SPARC_RESOURCE_H - -/* - * These two resource limit IDs have a Sparc/Linux-specific ordering, - * the rest comes from the generic header: - */ -#define RLIMIT_NOFILE		6	/* max number of open files */ -#define RLIMIT_NPROC		7	/* max number of processes */ - -#if defined(__sparc__) && defined(__arch64__) -/* Use generic version */ -#else -/* - * SuS says limits have to be unsigned. - * We make this unsigned, but keep the - * old value for compatibility: - */ -#define RLIM_INFINITY		0x7fffffff -#endif - -#include <asm-generic/resource.h> - -#endif /* !(_SPARC_RESOURCE_H) */ diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h index a2b4302869b..069bf4d663a 100644 --- a/arch/sparc/include/asm/rwsem.h +++ b/arch/sparc/include/asm/rwsem.h @@ -13,53 +13,12 @@  #ifdef __KERNEL__ -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter; - -struct rw_semaphore { -	signed long			count;  #define RWSEM_UNLOCKED_VALUE		0x00000000L  #define RWSEM_ACTIVE_BIAS		0x00000001L  #define RWSEM_ACTIVE_MASK		0xffffffffL  #define RWSEM_WAITING_BIAS		(-RWSEM_ACTIVE_MASK-1)  #define RWSEM_ACTIVE_READ_BIAS		RWSEM_ACTIVE_BIAS  #define RWSEM_ACTIVE_WRITE_BIAS		(RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -	spinlock_t			wait_lock; -	struct list_head		wait_list; -#ifdef CONFIG_DEBUG_LOCK_ALLOC -	struct lockdep_map		dep_map; -#endif -}; - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } -#else -# define __RWSEM_DEP_MAP_INIT(lockname) -#endif - -#define __RWSEM_INITIALIZER(name) \ -{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ -  LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM(name) \ -	struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); - -extern void __init_rwsem(struct rw_semaphore *sem, const char *name, -			 struct lock_class_key *key); - -#define init_rwsem(sem)						\ -do {								\ -	static struct lock_class_key __key;			\ -								\ -	__init_rwsem((sem), #sem, &__key);			\ -} while (0)  /*   * lock for reading @@ -160,11 +119,6 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)  	return atomic64_add_return(delta, (atomic64_t *)(&sem->count));  } -static inline int rwsem_is_locked(struct rw_semaphore *sem) -{ -	return (sem->count != 0); -} -  #endif /* __KERNEL__ */  #endif /* _SPARC64_RWSEM_H */ diff --git a/arch/sparc/include/asm/sections.h b/arch/sparc/include/asm/sections.h index 0b0553bbd8a..f300d1a9b2b 100644 --- a/arch/sparc/include/asm/sections.h +++ b/arch/sparc/include/asm/sections.h @@ -7,4 +7,7 @@  /* sparc entry point */  extern char _start[]; +extern char __leon_1insn_patch[]; +extern char __leon_1insn_patch_end[]; +  #endif diff --git a/arch/sparc/include/asm/sembuf.h b/arch/sparc/include/asm/sembuf.h deleted file mode 100644 index faee1be08d6..00000000000 --- a/arch/sparc/include/asm/sembuf.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _SPARC_SEMBUF_H -#define _SPARC_SEMBUF_H - -/* - * The semid64_ds structure for sparc architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ -#if defined(__sparc__) && defined(__arch64__) -# define PADDING(x) -#else -# define PADDING(x) unsigned int x; -#endif - -struct semid64_ds { -	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */ -	PADDING(__pad1) -	__kernel_time_t	sem_otime;		/* last semop time */ -	PADDING(__pad2) -	__kernel_time_t	sem_ctime;		/* last change time */ -	unsigned long	sem_nsems;		/* no. of semaphores in array */ -	unsigned long	__unused1; -	unsigned long	__unused2; -}; -#undef PADDING - -#endif /* _SPARC64_SEMBUF_H */ diff --git a/arch/sparc/include/asm/serial.h b/arch/sparc/include/asm/serial.h deleted file mode 100644 index f90d61c2805..00000000000 --- a/arch/sparc/include/asm/serial.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __SPARC_SERIAL_H -#define __SPARC_SERIAL_H - -#define BASE_BAUD ( 1843200 / 16 ) - -#endif /* __SPARC_SERIAL_H */ diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h index 2643c62f4ac..f5fffd84d0d 100644 --- a/arch/sparc/include/asm/setup.h +++ b/arch/sparc/include/asm/setup.h @@ -1,14 +1,66 @@  /*   *	Just a place holder.    */ -  #ifndef _SPARC_SETUP_H  #define _SPARC_SETUP_H -#if defined(__sparc__) && defined(__arch64__) -# define COMMAND_LINE_SIZE 2048 -#else -# define COMMAND_LINE_SIZE 256 +#include <linux/interrupt.h> + +#include <uapi/asm/setup.h> + +extern char reboot_command[]; + +#ifdef CONFIG_SPARC32 +/* The CPU that was used for booting + * Only sun4d + leon may have boot_cpu_id != 0 + */ +extern unsigned char boot_cpu_id; + +extern unsigned long empty_zero_page; + +extern int serial_console; +static inline int con_is_present(void) +{ +	return serial_console ? 0 : 1; +} + +/* from irq_32.c */ +extern volatile unsigned char *fdc_status; +extern char *pdma_vaddr; +extern unsigned long pdma_size; +extern volatile int doing_pdma; + +/* This is software state */ +extern char *pdma_base; +extern unsigned long pdma_areasize; + +int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler); + +/* setup_32.c */ +extern unsigned long cmdline_memory_size; + +/* devices.c */ +void __init device_scan(void); + +/* unaligned_32.c */ +unsigned long safe_compute_effective_address(struct pt_regs *, unsigned int); +  #endif +#ifdef CONFIG_SPARC64 +/* unaligned_64.c */ +int handle_ldf_stq(u32 insn, struct pt_regs *regs); +void handle_ld_nf(u32 insn, struct pt_regs *regs); + +/* init_64.c */ +extern atomic_t dcpage_flushes; +extern atomic_t dcpage_flushes_xcall; + +extern int sysctl_tsb_ratio; +#endif + +void sun_do_break(void); +extern int stop_a_enabled; +extern int scons_pwroff; +  #endif /* _SPARC_SETUP_H */ diff --git a/arch/sparc/include/asm/sfp-machine_32.h b/arch/sparc/include/asm/sfp-machine_32.h index 01d9c3b5a73..838c9d58f3b 100644 --- a/arch/sparc/include/asm/sfp-machine_32.h +++ b/arch/sparc/include/asm/sfp-machine_32.h @@ -79,9 +79,9 @@    __asm__ ("addcc %r7,%8,%2\n\t"					\  	   "addxcc %r5,%6,%1\n\t"					\  	   "addx %r3,%4,%0\n"						\ -	   : "=r" ((USItype)(r2)),					\ -	     "=&r" ((USItype)(r1)),					\ -	     "=&r" ((USItype)(r0))					\ +	   : "=r" (r2),							\ +	     "=&r" (r1),						\ +	     "=&r" (r0)							\  	   : "%rJ" ((USItype)(x2)),					\  	     "rI" ((USItype)(y2)),					\  	     "%rJ" ((USItype)(x1)),					\ @@ -94,9 +94,9 @@    __asm__ ("subcc %r7,%8,%2\n\t"					\  	    "subxcc %r5,%6,%1\n\t"					\  	    "subx %r3,%4,%0\n"						\ -	   : "=r" ((USItype)(r2)),					\ -	     "=&r" ((USItype)(r1)),					\ -	     "=&r" ((USItype)(r0))					\ +	   : "=r" (r2),							\ +	     "=&r" (r1),						\ +	     "=&r" (r0)							\  	   : "%rJ" ((USItype)(x2)),					\  	     "rI" ((USItype)(y2)),					\  	     "%rJ" ((USItype)(x1)),					\ @@ -115,8 +115,8 @@  	    "addxcc %r6,%7,%0\n\t"					\  	    "addxcc %r4,%5,%%g2\n\t"					\  	    "addx %r2,%3,%%g1\n\t"					\ -	   : "=&r" ((USItype)(r1)),					\ -	     "=&r" ((USItype)(r0))					\ +	   : "=&r" (r1),						\ +	     "=&r" (r0)							\  	   : "%rJ" ((USItype)(x3)),					\  	     "rI" ((USItype)(y3)),					\  	     "%rJ" ((USItype)(x2)),					\ @@ -140,8 +140,8 @@  	    "subxcc %r6,%7,%0\n\t"					\  	    "subxcc %r4,%5,%%g2\n\t"					\  	    "subx %r2,%3,%%g1\n\t"					\ -	   : "=&r" ((USItype)(r1)),					\ -	     "=&r" ((USItype)(r0))					\ +	   : "=&r" (r1),						\ +	     "=&r" (r0)							\  	   : "%rJ" ((USItype)(x3)),					\  	     "rI" ((USItype)(y3)),					\  	     "%rJ" ((USItype)(x2)),					\ @@ -164,10 +164,10 @@  	   "addxcc %2,%%g0,%2\n\t"					\  	   "addxcc %1,%%g0,%1\n\t"					\  	   "addx %0,%%g0,%0\n\t"					\ -	   : "=&r" ((USItype)(x3)),					\ -	     "=&r" ((USItype)(x2)),					\ -	     "=&r" ((USItype)(x1)),					\ -	     "=&r" ((USItype)(x0))					\ +	   : "=&r" (x3),						\ +	     "=&r" (x2),						\ +	     "=&r" (x1),						\ +	     "=&r" (x0)							\  	   : "rI" ((USItype)(i)),					\  	     "0" ((USItype)(x3)),					\  	     "1" ((USItype)(x2)),					\ diff --git a/arch/sparc/include/asm/shmbuf.h b/arch/sparc/include/asm/shmbuf.h deleted file mode 100644 index 83a16055363..00000000000 --- a/arch/sparc/include/asm/shmbuf.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _SPARC_SHMBUF_H -#define _SPARC_SHMBUF_H - -/*  - * The shmid64_ds structure for sparc architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -#if defined(__sparc__) && defined(__arch64__) -# define PADDING(x) -#else -# define PADDING(x) unsigned int x; -#endif - -struct shmid64_ds { -	struct ipc64_perm	shm_perm;	/* operation perms */ -	PADDING(__pad1) -	__kernel_time_t		shm_atime;	/* last attach time */ -	PADDING(__pad2) -	__kernel_time_t		shm_dtime;	/* last detach time */ -	PADDING(__pad3) -	__kernel_time_t		shm_ctime;	/* last change time */ -	size_t			shm_segsz;	/* size of segment (bytes) */ -	__kernel_pid_t		shm_cpid;	/* pid of creator */ -	__kernel_pid_t		shm_lpid;	/* pid of last operator */ -	unsigned long		shm_nattch;	/* no. of current attaches */ -	unsigned long		__unused1; -	unsigned long		__unused2; -}; - -struct shminfo64 { -	unsigned long	shmmax; -	unsigned long	shmmin; -	unsigned long	shmmni; -	unsigned long	shmseg; -	unsigned long	shmall; -	unsigned long	__unused1; -	unsigned long	__unused2; -	unsigned long	__unused3; -	unsigned long	__unused4; -}; - -#undef PADDING - -#endif /* _SPARC_SHMBUF_H */ diff --git a/arch/sparc/include/asm/shmparam_32.h b/arch/sparc/include/asm/shmparam_32.h index 59a1243c12f..142825c8d3a 100644 --- a/arch/sparc/include/asm/shmparam_32.h +++ b/arch/sparc/include/asm/shmparam_32.h @@ -4,8 +4,6 @@  #define __ARCH_FORCE_SHMLBA 	1  extern int vac_cache_size; -#define SHMLBA (vac_cache_size ? vac_cache_size : \ -		(sparc_cpu_model == sun4c ? (64 * 1024) : \ -		 (sparc_cpu_model == sun4 ? (128 * 1024) : PAGE_SIZE))) +#define SHMLBA (vac_cache_size ? vac_cache_size : PAGE_SIZE)  #endif /* _ASMSPARC_SHMPARAM_H */ diff --git a/arch/sparc/include/asm/sigcontext.h b/arch/sparc/include/asm/sigcontext.h index a1607d18035..fc2df1e892c 100644 --- a/arch/sparc/include/asm/sigcontext.h +++ b/arch/sparc/include/asm/sigcontext.h @@ -1,8 +1,8 @@  #ifndef __SPARC_SIGCONTEXT_H  #define __SPARC_SIGCONTEXT_H -#ifdef __KERNEL__  #include <asm/ptrace.h> +#include <uapi/asm/sigcontext.h>  #ifndef __ASSEMBLY__ @@ -45,6 +45,19 @@ typedef struct {  	int			si_mask;  } __siginfo32_t; +#define __SIGC_MAXWIN	7 + +typedef struct { +	unsigned long locals[8]; +	unsigned long ins[8]; +} __siginfo_reg_window; + +typedef struct { +	int			wsaved; +	__siginfo_reg_window	reg_window[__SIGC_MAXWIN]; +	unsigned long		rwbuf_stkptrs[__SIGC_MAXWIN]; +} __siginfo_rwin_t; +  #ifdef CONFIG_SPARC64  typedef struct {  	unsigned   int si_float_regs [64]; @@ -73,6 +86,7 @@ struct sigcontext {  		unsigned long	ss_size;  	}			sigc_stack;  	unsigned long		sigc_mask; +	__siginfo_rwin_t *	sigc_rwin_save;  };  #else @@ -91,6 +105,4 @@ typedef struct {  #endif /* !(__ASSEMBLY__) */ -#endif /* (__KERNEL__) */ -  #endif /* !(__SPARC_SIGCONTEXT_H) */ diff --git a/arch/sparc/include/asm/siginfo.h b/arch/sparc/include/asm/siginfo.h index 988e5d8ed11..48c34c19f81 100644 --- a/arch/sparc/include/asm/siginfo.h +++ b/arch/sparc/include/asm/siginfo.h @@ -1,22 +1,8 @@  #ifndef __SPARC_SIGINFO_H  #define __SPARC_SIGINFO_H -#if defined(__sparc__) && defined(__arch64__) +#include <uapi/asm/siginfo.h> -#define SI_PAD_SIZE32	((SI_MAX_SIZE/sizeof(int)) - 3) -#define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int)) -#define __ARCH_SI_BAND_T int - -#endif /* defined(__sparc__) && defined(__arch64__) */ - - -#define __ARCH_SI_TRAPNO - -#include <asm-generic/siginfo.h> - -#ifdef __KERNEL__ - -#include <linux/compat.h>  #ifdef CONFIG_COMPAT @@ -24,14 +10,4 @@ struct compat_siginfo;  #endif /* CONFIG_COMPAT */ -#endif /* __KERNEL__ */ - -#define SI_NOINFO	32767		/* no information in siginfo_t */ - -/* - * SIGEMT si_codes - */ -#define EMT_TAGOVF	(__SI_FAULT|1)	/* tag overflow */ -#define NSIGEMT		1 -  #endif /* !(__SPARC_SIGINFO_H) */ diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h index e49b828a247..c33ce3f2ba8 100644 --- a/arch/sparc/include/asm/signal.h +++ b/arch/sparc/include/asm/signal.h @@ -1,167 +1,13 @@  #ifndef __SPARC_SIGNAL_H  #define __SPARC_SIGNAL_H -#include <asm/sigcontext.h> -#include <linux/compiler.h> - -#ifdef __KERNEL__  #ifndef __ASSEMBLY__  #include <linux/personality.h>  #include <linux/types.h>  #endif -#endif - -/* On the Sparc the signal handlers get passed a 'sub-signal' code - * for certain signal types, which we document here. - */ -#define SIGHUP		 1 -#define SIGINT		 2 -#define SIGQUIT		 3 -#define SIGILL		 4 -#define    SUBSIG_STACK       0 -#define    SUBSIG_ILLINST     2 -#define    SUBSIG_PRIVINST    3 -#define    SUBSIG_BADTRAP(t)  (0x80 + (t)) - -#define SIGTRAP		 5 -#define SIGABRT		 6 -#define SIGIOT		 6 - -#define SIGEMT           7 -#define    SUBSIG_TAG    10 - -#define SIGFPE		 8 -#define    SUBSIG_FPDISABLED     0x400 -#define    SUBSIG_FPERROR        0x404 -#define    SUBSIG_FPINTOVFL      0x001 -#define    SUBSIG_FPSTSIG        0x002 -#define    SUBSIG_IDIVZERO       0x014 -#define    SUBSIG_FPINEXACT      0x0c4 -#define    SUBSIG_FPDIVZERO      0x0c8 -#define    SUBSIG_FPUNFLOW       0x0cc -#define    SUBSIG_FPOPERROR      0x0d0 -#define    SUBSIG_FPOVFLOW       0x0d4 - -#define SIGKILL		 9 -#define SIGBUS          10 -#define    SUBSIG_BUSTIMEOUT    1 -#define    SUBSIG_ALIGNMENT     2 -#define    SUBSIG_MISCERROR     5 - -#define SIGSEGV		11 -#define    SUBSIG_NOMAPPING     3 -#define    SUBSIG_PROTECTION    4 -#define    SUBSIG_SEGERROR      5 - -#define SIGSYS		12 - -#define SIGPIPE		13 -#define SIGALRM		14 -#define SIGTERM		15 -#define SIGURG          16 - -/* SunOS values which deviate from the Linux/i386 ones */ -#define SIGSTOP		17 -#define SIGTSTP		18 -#define SIGCONT		19 -#define SIGCHLD		20 -#define SIGTTIN		21 -#define SIGTTOU		22 -#define SIGIO		23 -#define SIGPOLL		SIGIO   /* SysV name for SIGIO */ -#define SIGXCPU		24 -#define SIGXFSZ		25 -#define SIGVTALRM	26 -#define SIGPROF		27 -#define SIGWINCH	28 -#define SIGLOST		29 -#define SIGPWR		SIGLOST -#define SIGUSR1		30 -#define SIGUSR2		31 - -/* Most things should be clean enough to redefine this at will, if care -   is taken to make libc match.  */ - -#define __OLD_NSIG	32 -#define __NEW_NSIG      64 -#ifdef __arch64__ -#define _NSIG_BPW       64 -#else -#define _NSIG_BPW       32 -#endif -#define _NSIG_WORDS     (__NEW_NSIG / _NSIG_BPW) - -#define SIGRTMIN       32 -#define SIGRTMAX       __NEW_NSIG - -#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) -#define _NSIG			__NEW_NSIG -#define __new_sigset_t		sigset_t -#define __new_sigaction		sigaction -#define __new_sigaction32	sigaction32 -#define __old_sigset_t		old_sigset_t -#define __old_sigaction		old_sigaction -#define __old_sigaction32	old_sigaction32 -#else -#define _NSIG			__OLD_NSIG -#define NSIG			_NSIG -#define __old_sigset_t		sigset_t -#define __old_sigaction		sigaction -#define __old_sigaction32	sigaction32 -#endif +#include <uapi/asm/signal.h>  #ifndef __ASSEMBLY__ - -typedef unsigned long __old_sigset_t;            /* at least 32 bits */ - -typedef struct { -       unsigned long sig[_NSIG_WORDS]; -} __new_sigset_t; - -/* A SunOS sigstack */ -struct sigstack { -	/* XXX 32-bit pointers pinhead XXX */ -	char *the_stack; -	int   cur_status; -}; - -/* Sigvec flags */ -#define _SV_SSTACK    1u    /* This signal handler should use sig-stack */ -#define _SV_INTR      2u    /* Sig return should not restart system call */ -#define _SV_RESET     4u    /* Set handler to SIG_DFL upon taken signal */ -#define _SV_IGNCHILD  8u    /* Do not send SIGCHLD */ - -/* - * sa_flags values: SA_STACK is not currently supported, but will allow the - * usage of signal stacks by using the (now obsolete) sa_restorer field in - * the sigaction structure as a stack pointer. This is now possible due to - * the changes in signal handling. LBT 010493. - * SA_RESTART flag to get restarting signals (which were the default long ago) - */ -#define SA_NOCLDSTOP	_SV_IGNCHILD -#define SA_STACK	_SV_SSTACK -#define SA_ONSTACK	_SV_SSTACK -#define SA_RESTART	_SV_INTR -#define SA_ONESHOT	_SV_RESET -#define SA_NOMASK	0x20u -#define SA_NOCLDWAIT    0x100u -#define SA_SIGINFO      0x200u - - -#define SIG_BLOCK          0x01	/* for blocking signals */ -#define SIG_UNBLOCK        0x02	/* for unblocking signals */ -#define SIG_SETMASK        0x04	/* for setting the signal mask */ - -/* - * sigaltstack controls - */ -#define SS_ONSTACK	1 -#define SS_DISABLE	2 - -#define MINSIGSTKSZ	4096 -#define SIGSTKSZ	16384 - -#ifdef __KERNEL__  /*   * DJHR   * SA_STATIC_ALLOC is used for the sparc32 system to indicate that this @@ -174,41 +20,9 @@ struct sigstack {   *   */  #define SA_STATIC_ALLOC         0x8000 -#endif - -#include <asm-generic/signal-defs.h> - -struct __new_sigaction { -	__sighandler_t		sa_handler; -	unsigned long		sa_flags; -	__sigrestore_t		sa_restorer;  /* not used by Linux/SPARC yet */ -	__new_sigset_t		sa_mask; -}; - -struct __old_sigaction { -	__sighandler_t		sa_handler; -	__old_sigset_t		sa_mask; -	unsigned long		sa_flags; -	void			(*sa_restorer)(void);  /* not used by Linux/SPARC yet */ -}; -typedef struct sigaltstack { -	void			__user *ss_sp; -	int			ss_flags; -	size_t			ss_size; -} stack_t; - -#ifdef __KERNEL__ - -struct k_sigaction { -	struct			__new_sigaction sa; -	void			__user *ka_restorer; -}; - -#define ptrace_signal_deliver(regs, cookie) do { } while (0) - -#endif /* !(__KERNEL__) */ +#define __ARCH_HAS_KA_RESTORER +#define __ARCH_HAS_SA_RESTORER  #endif /* !(__ASSEMBLY__) */ -  #endif /* !(__SPARC_SIGNAL_H) */ diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h index 841905c1021..7c24e08a88d 100644 --- a/arch/sparc/include/asm/smp_32.h +++ b/arch/sparc/include/asm/smp_32.h @@ -8,7 +8,6 @@  #include <linux/threads.h>  #include <asm/head.h> -#include <asm/btfixup.h>  #ifndef __ASSEMBLY__ @@ -22,17 +21,22 @@  #include <asm/ptrace.h>  #include <asm/asi.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  /*   *	Private routines/data   */  extern unsigned char boot_cpu_id; +extern volatile unsigned long cpu_callin_map[NR_CPUS]; +extern cpumask_t smp_commenced_mask; +extern struct linux_prom_registers smp_penguin_ctable;  typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long,  		       unsigned long, unsigned long); +void cpu_panic(void); +  /*   *	General functions that each host system must provide.   */ @@ -41,120 +45,66 @@ void sun4m_init_smp(void);  void sun4d_init_smp(void);  void smp_callin(void); -void smp_boot_cpus(void);  void smp_store_cpu_info(int); +void smp_resched_interrupt(void); +void smp_call_function_single_interrupt(void); +void smp_call_function_interrupt(void); +  struct seq_file;  void smp_bogo(struct seq_file *);  void smp_info(struct seq_file *); -BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, cpumask_t, unsigned long, unsigned long, unsigned long, unsigned long) -BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void) -BTFIXUPDEF_BLACKBOX(hard_smp_processor_id) -BTFIXUPDEF_BLACKBOX(load_current) - -#define smp_cross_call(func,mask,arg1,arg2,arg3,arg4) BTFIXUP_CALL(smp_cross_call)(func,mask,arg1,arg2,arg3,arg4) - -static inline void xc0(smpfunc_t func) { smp_cross_call(func, cpu_online_map, 0, 0, 0, 0); } -static inline void xc1(smpfunc_t func, unsigned long arg1) -{ smp_cross_call(func, cpu_online_map, arg1, 0, 0, 0); } -static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) -{ smp_cross_call(func, cpu_online_map, arg1, arg2, 0, 0); } -static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, -			   unsigned long arg3) -{ smp_cross_call(func, cpu_online_map, arg1, arg2, arg3, 0); } -static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, -			   unsigned long arg3, unsigned long arg4) -{ smp_cross_call(func, cpu_online_map, arg1, arg2, arg3, arg4); } - -static inline int smp_call_function(void (*func)(void *info), void *info, int wait) +struct sparc32_ipi_ops { +	void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1, +			   unsigned long arg2, unsigned long arg3, +			   unsigned long arg4); +	void (*resched)(int cpu); +	void (*single)(int cpu); +	void (*mask_one)(int cpu); +}; +extern const struct sparc32_ipi_ops *sparc32_ipi_ops; + +static inline void xc0(smpfunc_t func)  { -	xc1((smpfunc_t)func, (unsigned long)info); -	return 0; +	sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);  } -static inline int smp_call_function_single(int cpuid, void (*func) (void *info), -					   void *info, int wait) +static inline void xc1(smpfunc_t func, unsigned long arg1)  { -	smp_cross_call((smpfunc_t)func, cpumask_of_cpu(cpuid), -		       (unsigned long) info, 0, 0, 0); -	return 0; +	sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);  } - -static inline int cpu_logical_map(int cpu) +static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)  { -	return cpu; +	sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);  } -static inline int hard_smp4m_processor_id(void) +static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, +		       unsigned long arg3)  { -	int cpuid; - -	__asm__ __volatile__("rd %%tbr, %0\n\t" -			     "srl %0, 12, %0\n\t" -			     "and %0, 3, %0\n\t" : -			     "=&r" (cpuid)); -	return cpuid; +	sparc32_ipi_ops->cross_call(func, *cpu_online_mask, +				    arg1, arg2, arg3, 0);  } -static inline int hard_smp4d_processor_id(void) +static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, +		       unsigned long arg3, unsigned long arg4)  { -	int cpuid; - -	__asm__ __volatile__("lda [%%g0] %1, %0\n\t" : -			     "=&r" (cpuid) : "i" (ASI_M_VIKING_TMP1)); -	return cpuid; +	sparc32_ipi_ops->cross_call(func, *cpu_online_mask, +				    arg1, arg2, arg3, arg4);  } -extern inline int hard_smpleon_processor_id(void) -{ -	int cpuid; -	__asm__ __volatile__("rd     %%asr17,%0\n\t" -			     "srl    %0,28,%0" : -			     "=&r" (cpuid) : ); -	return cpuid; -} +void arch_send_call_function_single_ipi(int cpu); +void arch_send_call_function_ipi_mask(const struct cpumask *mask); -#ifndef MODULE -static inline int hard_smp_processor_id(void) +static inline int cpu_logical_map(int cpu)  { -	int cpuid; - -	/* Black box - sun4m -		__asm__ __volatile__("rd %%tbr, %0\n\t" -				     "srl %0, 12, %0\n\t" -				     "and %0, 3, %0\n\t" : -				     "=&r" (cpuid)); -	             - sun4d -		__asm__ __volatile__("lda [%g0] ASI_M_VIKING_TMP1, %0\n\t" -				     "nop; nop" : -				     "=&r" (cpuid)); -	   See btfixup.h and btfixupprep.c to understand how a blackbox works. -	 */ -	__asm__ __volatile__("sethi %%hi(___b_hard_smp_processor_id), %0\n\t" -			     "sethi %%hi(boot_cpu_id), %0\n\t" -			     "ldub [%0 + %%lo(boot_cpu_id)], %0\n\t" : -			     "=&r" (cpuid)); -	return cpuid; +	return cpu;  } -#else -static inline int hard_smp_processor_id(void) -{ -	int cpuid; -	__asm__ __volatile__("mov %%o7, %%g1\n\t" -			     "call ___f___hard_smp_processor_id\n\t" -			     " nop\n\t" -			     "mov %%g2, %0\n\t" : "=r"(cpuid) : : "g1", "g2"); -	return cpuid; -} -#endif +int hard_smp_processor_id(void);  #define raw_smp_processor_id()		(current_thread_info()->cpu) -#define prof_multiplier(__cpu)		cpu_data(__cpu).multiplier -#define prof_counter(__cpu)		cpu_data(__cpu).counter -  void smp_setup_cpu_possible_map(void);  #endif /* !(__ASSEMBLY__) */ diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h index f49e11cd4de..26d9e772686 100644 --- a/arch/sparc/include/asm/smp_64.h +++ b/arch/sparc/include/asm/smp_64.h @@ -27,31 +27,41 @@   */  #include <linux/bitops.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/percpu.h>  DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);  extern cpumask_t cpu_core_map[NR_CPUS]; -extern int sparc64_multi_core; -extern void arch_send_call_function_single_ipi(int cpu); -extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); +void arch_send_call_function_single_ipi(int cpu); +void arch_send_call_function_ipi_mask(const struct cpumask *mask);  /*   *	General functions that each host system must provide.   */ -extern int hard_smp_processor_id(void); +int hard_smp_processor_id(void);  #define raw_smp_processor_id() (current_thread_info()->cpu) -extern void smp_fill_in_sib_core_maps(void); -extern void cpu_play_dead(void); +void smp_fill_in_sib_core_maps(void); +void cpu_play_dead(void); -extern void smp_fetch_global_regs(void); +void smp_fetch_global_regs(void); +void smp_fetch_global_pmu(void); + +struct seq_file; +void smp_bogo(struct seq_file *); +void smp_info(struct seq_file *); + +void smp_callin(void); +void cpu_panic(void); +void smp_synchronize_tick_client(void); +void smp_capture(void); +void smp_release(void);  #ifdef CONFIG_HOTPLUG_CPU -extern int __cpu_disable(void); -extern void __cpu_die(unsigned int cpu); +int __cpu_disable(void); +void __cpu_die(unsigned int cpu);  #endif  #endif /* !(__ASSEMBLY__) */ @@ -61,6 +71,7 @@ extern void __cpu_die(unsigned int cpu);  #define hard_smp_processor_id()		0  #define smp_fill_in_sib_core_maps() do { } while (0)  #define smp_fetch_global_regs() do { } while (0) +#define smp_fetch_global_pmu() do { } while (0)  #endif /* !(CONFIG_SMP) */ diff --git a/arch/sparc/include/asm/smpprim.h b/arch/sparc/include/asm/smpprim.h deleted file mode 100644 index eb849d862c6..00000000000 --- a/arch/sparc/include/asm/smpprim.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - *  smpprim.h:  SMP locking primitives on the Sparc - * - *  God knows we won't be actually using this code for some time - *  but I thought I'd write it since I knew how. - * - *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef __SPARC_SMPPRIM_H -#define __SPARC_SMPPRIM_H - -/* Test and set the unsigned byte at ADDR to 1.  Returns the previous - * value.  On the Sparc we use the ldstub instruction since it is - * atomic. - */ - -static inline __volatile__ char test_and_set(void *addr) -{ -	char state = 0; - -	__asm__ __volatile__("ldstub [%0], %1         ! test_and_set\n\t" -			     "=r" (addr), "=r" (state) : -			     "0" (addr), "1" (state) : "memory"); - -	return state; -} - -/* Initialize a spin-lock. */ -static inline __volatile__ smp_initlock(void *spinlock) -{ -	/* Unset the lock. */ -	*((unsigned char *) spinlock) = 0; - -	return; -} - -/* This routine spins until it acquires the lock at ADDR. */ -static inline __volatile__ smp_lock(void *addr) -{ -	while(test_and_set(addr) == 0xff) -		; - -	/* We now have the lock */ -	return; -} - -/* This routine releases the lock at ADDR. */ -static inline __volatile__ smp_unlock(void *addr) -{ -	*((unsigned char *) addr) = 0; -} - -#endif /* !(__SPARC_SMPPRIM_H) */ diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h deleted file mode 100644 index 9d3fefcff2f..00000000000 --- a/arch/sparc/include/asm/socket.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef _ASM_SOCKET_H -#define _ASM_SOCKET_H - -#include <asm/sockios.h> - -/* For setsockopt(2) */ -#define SOL_SOCKET	0xffff - -#define SO_DEBUG	0x0001 -#define SO_PASSCRED	0x0002 -#define SO_REUSEADDR	0x0004 -#define SO_KEEPALIVE	0x0008 -#define SO_DONTROUTE	0x0010 -#define SO_BROADCAST	0x0020 -#define SO_PEERCRED	0x0040 -#define SO_LINGER	0x0080 -#define SO_OOBINLINE	0x0100 -/* To add :#define SO_REUSEPORT 0x0200 */ -#define SO_BSDCOMPAT    0x0400 -#define SO_RCVLOWAT     0x0800 -#define SO_SNDLOWAT     0x1000 -#define SO_RCVTIMEO     0x2000 -#define SO_SNDTIMEO     0x4000 -#define SO_ACCEPTCONN	0x8000 - -#define SO_SNDBUF	0x1001 -#define SO_RCVBUF	0x1002 -#define SO_SNDBUFFORCE	0x100a -#define SO_RCVBUFFORCE	0x100b -#define SO_ERROR	0x1007 -#define SO_TYPE		0x1008 -#define SO_PROTOCOL	0x1028 -#define SO_DOMAIN	0x1029 - - -/* Linux specific, keep the same. */ -#define SO_NO_CHECK	0x000b -#define SO_PRIORITY	0x000c - -#define SO_BINDTODEVICE 0x000d - -#define SO_ATTACH_FILTER	0x001a -#define SO_DETACH_FILTER        0x001b - -#define SO_PEERNAME		0x001c -#define SO_TIMESTAMP		0x001d -#define SCM_TIMESTAMP		SO_TIMESTAMP - -#define SO_PEERSEC		0x001e -#define SO_PASSSEC		0x001f -#define SO_TIMESTAMPNS		0x0021 -#define SCM_TIMESTAMPNS		SO_TIMESTAMPNS - -#define SO_MARK			0x0022 - -#define SO_TIMESTAMPING		0x0023 -#define SCM_TIMESTAMPING	SO_TIMESTAMPING - -#define SO_RXQ_OVFL             0x0024 - -/* Security levels - as per NRL IPv6 - don't actually do anything */ -#define SO_SECURITY_AUTHENTICATION		0x5001 -#define SO_SECURITY_ENCRYPTION_TRANSPORT	0x5002 -#define SO_SECURITY_ENCRYPTION_NETWORK		0x5004 - -#endif /* _ASM_SOCKET_H */ diff --git a/arch/sparc/include/asm/sockios.h b/arch/sparc/include/asm/sockios.h deleted file mode 100644 index 990ea746486..00000000000 --- a/arch/sparc/include/asm/sockios.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _ASM_SPARC_SOCKIOS_H -#define _ASM_SPARC_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 	0x8901 -#define SIOCSPGRP	0x8902 -#define FIOGETOWN	0x8903 -#define SIOCGPGRP	0x8904 -#define SIOCATMARK	0x8905 -#define SIOCGSTAMP	0x8906		/* Get stamp (timeval) */ -#define SIOCGSTAMPNS	0x8907		/* Get stamp (timespec) */ - -#endif /* !(_ASM_SPARC_SOCKIOS_H) */ - diff --git a/arch/sparc/include/asm/sparsemem.h b/arch/sparc/include/asm/sparsemem.h index b99d4e4b6d2..e5e1752d5d7 100644 --- a/arch/sparc/include/asm/sparsemem.h +++ b/arch/sparc/include/asm/sparsemem.h @@ -3,9 +3,11 @@  #ifdef __KERNEL__ +#include <asm/page.h> +  #define SECTION_SIZE_BITS       30 -#define MAX_PHYSADDR_BITS       42 -#define MAX_PHYSMEM_BITS        42 +#define MAX_PHYSADDR_BITS       MAX_PHYS_ADDRESS_BITS +#define MAX_PHYSMEM_BITS        MAX_PHYS_ADDRESS_BITS  #endif /* !(__KERNEL__) */ diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h index 7f9b9dba38a..bcc98fc3528 100644 --- a/arch/sparc/include/asm/spinlock_32.h +++ b/arch/sparc/include/asm/spinlock_32.h @@ -9,6 +9,7 @@  #ifndef __ASSEMBLY__  #include <asm/psr.h> +#include <asm/processor.h> /* for cpu_relax */  #define arch_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) @@ -130,6 +131,15 @@ static inline void arch_write_lock(arch_rwlock_t *rw)  	*(volatile __u32 *)&lp->lock = ~0U;  } +static void inline arch_write_unlock(arch_rwlock_t *lock) +{ +	__asm__ __volatile__( +"	st		%%g0, [%0]" +	: /* no outputs */ +	: "r" (lock) +	: "memory"); +} +  static inline int arch_write_trylock(arch_rwlock_t *rw)  {  	unsigned int val; @@ -174,8 +184,6 @@ static inline int __arch_read_trylock(arch_rwlock_t *rw)  	res; \  }) -#define arch_write_unlock(rw)	do { (rw)->lock = 0; } while(0) -  #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)  #define arch_read_lock_flags(rw, flags)   arch_read_lock(rw)  #define arch_write_lock_flags(rw, flags)  arch_write_lock(rw) diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h index 073936a8b27..96891769497 100644 --- a/arch/sparc/include/asm/spinlock_64.h +++ b/arch/sparc/include/asm/spinlock_64.h @@ -210,14 +210,8 @@ static int inline arch_write_trylock(arch_rwlock_t *lock)  	return result;  } -#define arch_read_lock(p)	arch_read_lock(p)  #define arch_read_lock_flags(p, f) arch_read_lock(p) -#define arch_read_trylock(p)	arch_read_trylock(p) -#define arch_read_unlock(p)	arch_read_unlock(p) -#define arch_write_lock(p)	arch_write_lock(p)  #define arch_write_lock_flags(p, f) arch_write_lock(p) -#define arch_write_unlock(p)	arch_write_unlock(p) -#define arch_write_trylock(p)	arch_write_trylock(p)  #define arch_read_can_lock(rw)		(!((rw)->lock & 0x80000000UL))  #define arch_write_can_lock(rw)	(!(rw)->lock) diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h index f0d0c40c44d..3fc58691dbd 100644 --- a/arch/sparc/include/asm/spitfire.h +++ b/arch/sparc/include/asm/spitfire.h @@ -42,6 +42,10 @@  #define SUN4V_CHIP_INVALID	0x00  #define SUN4V_CHIP_NIAGARA1	0x01  #define SUN4V_CHIP_NIAGARA2	0x02 +#define SUN4V_CHIP_NIAGARA3	0x03 +#define SUN4V_CHIP_NIAGARA4	0x04 +#define SUN4V_CHIP_NIAGARA5	0x05 +#define SUN4V_CHIP_SPARC64X	0x8a  #define SUN4V_CHIP_UNKNOWN	0xff  #ifndef __ASSEMBLY__ @@ -58,7 +62,7 @@ extern enum ultra_tlb_layout tlb_type;  extern int sun4v_chip_type;  extern int cheetah_pcache_forced_on; -extern void cheetah_enable_pcache(void); +void cheetah_enable_pcache(void);  #define sparc64_highest_locked_tlbent()	\  	(tlb_type == spitfire ? \ diff --git a/arch/sparc/include/asm/stacktrace.h b/arch/sparc/include/asm/stacktrace.h index 6cee39adf6d..c30d066f304 100644 --- a/arch/sparc/include/asm/stacktrace.h +++ b/arch/sparc/include/asm/stacktrace.h @@ -1,6 +1,6 @@  #ifndef _SPARC64_STACKTRACE_H  #define _SPARC64_STACKTRACE_H -extern void stack_trace_flush(void); +void stack_trace_flush(void);  #endif /* _SPARC64_STACKTRACE_H */ diff --git a/arch/sparc/include/asm/starfire.h b/arch/sparc/include/asm/starfire.h index d56ce60a599..c100dc27a0a 100644 --- a/arch/sparc/include/asm/starfire.h +++ b/arch/sparc/include/asm/starfire.h @@ -11,10 +11,10 @@  extern int this_is_starfire; -extern void check_if_starfire(void); -extern int starfire_hard_smp_processor_id(void); -extern void starfire_hookup(int); -extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid); +void check_if_starfire(void); +int starfire_hard_smp_processor_id(void); +void starfire_hookup(int); +unsigned int starfire_translate(unsigned long imap, unsigned int upaid);  #endif  #endif diff --git a/arch/sparc/include/asm/stat.h b/arch/sparc/include/asm/stat.h deleted file mode 100644 index a232e9e1f4e..00000000000 --- a/arch/sparc/include/asm/stat.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef __SPARC_STAT_H -#define __SPARC_STAT_H - -#include <linux/types.h> - -#if defined(__sparc__) && defined(__arch64__) -/* 64 bit sparc */ -struct stat { -	unsigned   st_dev; -	ino_t   st_ino; -	mode_t  st_mode; -	short   st_nlink; -	uid_t   st_uid; -	gid_t   st_gid; -	unsigned   st_rdev; -	off_t   st_size; -	time_t  st_atime; -	time_t  st_mtime; -	time_t  st_ctime; -	off_t   st_blksize; -	off_t   st_blocks; -	unsigned long  __unused4[2]; -}; - -struct stat64 { -	unsigned long	st_dev; -	unsigned long	st_ino; -	unsigned long	st_nlink; - -	unsigned int	st_mode; -	unsigned int	st_uid; -	unsigned int	st_gid; -	unsigned int	__pad0; - -	unsigned long	st_rdev; -	long		st_size; -	long		st_blksize; -	long		st_blocks; - -	unsigned long	st_atime; -	unsigned long	st_atime_nsec; -	unsigned long	st_mtime; -	unsigned long	st_mtime_nsec; -	unsigned long	st_ctime; -	unsigned long	st_ctime_nsec; -	long		__unused[3]; -}; - -#else -/* 32 bit sparc */ -struct stat { -	unsigned short	st_dev; -	ino_t		st_ino; -	mode_t		st_mode; -	short		st_nlink; -	unsigned short	st_uid; -	unsigned short	st_gid; -	unsigned short	st_rdev; -	off_t		st_size; -	time_t		st_atime; -	unsigned long	st_atime_nsec; -	time_t		st_mtime; -	unsigned long	st_mtime_nsec; -	time_t		st_ctime; -	unsigned long	st_ctime_nsec; -	off_t		st_blksize; -	off_t		st_blocks; -	unsigned long	__unused4[2]; -}; - -#define STAT_HAVE_NSEC 1 - -struct stat64 { -	unsigned long long st_dev; - -	unsigned long long st_ino; - -	unsigned int	st_mode; -	unsigned int	st_nlink; - -	unsigned int	st_uid; -	unsigned int	st_gid; - -	unsigned long long st_rdev; - -	unsigned char	__pad3[8]; - -	long long	st_size; -	unsigned int	st_blksize; - -	unsigned char	__pad4[8]; -	unsigned int	st_blocks; - -	unsigned int	st_atime; -	unsigned int	st_atime_nsec; - -	unsigned int	st_mtime; -	unsigned int	st_mtime_nsec; - -	unsigned int	st_ctime; -	unsigned int	st_ctime_nsec; - -	unsigned int	__unused4; -	unsigned int	__unused5; -}; -#endif /* defined(__sparc__) && defined(__arch64__) */ -#endif /* __SPARC_STAT_H */ diff --git a/arch/sparc/include/asm/statfs.h b/arch/sparc/include/asm/statfs.h deleted file mode 100644 index 55e607ad461..00000000000 --- a/arch/sparc/include/asm/statfs.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ___ASM_SPARC_STATFS_H -#define ___ASM_SPARC_STATFS_H - -#include <asm-generic/statfs.h> - -#endif diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h index edf196ee4ef..69974e92461 100644 --- a/arch/sparc/include/asm/string_32.h +++ b/arch/sparc/include/asm/string_32.h @@ -15,7 +15,7 @@  #ifdef __KERNEL__ -extern void __memmove(void *,const void *,__kernel_size_t); +void __memmove(void *,const void *,__kernel_size_t);  #ifndef EXPORT_SYMTAB_STROPS @@ -40,8 +40,8 @@ extern void __memmove(void *,const void *,__kernel_size_t);  #undef memscan  #define memscan(__arg0, __char, __arg2)						\  ({										\ -	extern void *__memscan_zero(void *, size_t);				\ -	extern void *__memscan_generic(void *, int, size_t);			\ +	void *__memscan_zero(void *, size_t);					\ +	void *__memscan_generic(void *, int, size_t);				\  	void *__retval, *__addr = (__arg0);					\  	size_t __size = (__arg2);						\  										\ @@ -54,75 +54,14 @@ extern void __memmove(void *,const void *,__kernel_size_t);  })  #define __HAVE_ARCH_MEMCMP -extern int memcmp(const void *,const void *,__kernel_size_t); +int memcmp(const void *,const void *,__kernel_size_t);  /* Now the str*() stuff... */  #define __HAVE_ARCH_STRLEN -extern __kernel_size_t strlen(const char *); +__kernel_size_t strlen(const char *);  #define __HAVE_ARCH_STRNCMP - -extern int __strncmp(const char *, const char *, __kernel_size_t); - -static inline int __constant_strncmp(const char *src, const char *dest, __kernel_size_t count) -{ -	register int retval; -	switch(count) { -	case 0: return 0; -	case 1: return (src[0] - dest[0]); -	case 2: retval = (src[0] - dest[0]); -		if(!retval && src[0]) -		  retval = (src[1] - dest[1]); -		return retval; -	case 3: retval = (src[0] - dest[0]); -		if(!retval && src[0]) { -		  retval = (src[1] - dest[1]); -		  if(!retval && src[1]) -		    retval = (src[2] - dest[2]); -		} -		return retval; -	case 4: retval = (src[0] - dest[0]); -		if(!retval && src[0]) { -		  retval = (src[1] - dest[1]); -		  if(!retval && src[1]) { -		    retval = (src[2] - dest[2]); -		    if (!retval && src[2]) -		      retval = (src[3] - dest[3]); -		  } -		} -		return retval; -	case 5: retval = (src[0] - dest[0]); -		if(!retval && src[0]) { -		  retval = (src[1] - dest[1]); -		  if(!retval && src[1]) { -		    retval = (src[2] - dest[2]); -		    if (!retval && src[2]) { -		      retval = (src[3] - dest[3]); -		      if (!retval && src[3]) -		        retval = (src[4] - dest[4]); -		    } -		  } -		} -		return retval; -	default: -		retval = (src[0] - dest[0]); -		if(!retval && src[0]) { -		  retval = (src[1] - dest[1]); -		  if(!retval && src[1]) { -		    retval = (src[2] - dest[2]); -		    if(!retval && src[2]) -		      retval = __strncmp(src+3,dest+3,count-3); -		  } -		} -		return retval; -	} -} - -#undef strncmp -#define strncmp(__arg0, __arg1, __arg2)	\ -(__builtin_constant_p(__arg2) ?	\ - __constant_strncmp(__arg0, __arg1, __arg2) : \ - __strncmp(__arg0, __arg1, __arg2)) +int strncmp(const char *, const char *, __kernel_size_t);  #endif /* !EXPORT_SYMTAB_STROPS */ diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h index 9623bc21315..5936b8ff3c0 100644 --- a/arch/sparc/include/asm/string_64.h +++ b/arch/sparc/include/asm/string_64.h @@ -19,7 +19,7 @@  /* First the mem*() things. */  #define __HAVE_ARCH_MEMMOVE -extern void *memmove(void *, const void *, __kernel_size_t); +void *memmove(void *, const void *, __kernel_size_t);  #define __HAVE_ARCH_MEMCPY  #define memcpy(t, f, n) __builtin_memcpy(t, f, n) @@ -32,8 +32,8 @@ extern void *memmove(void *, const void *, __kernel_size_t);  #undef memscan  #define memscan(__arg0, __char, __arg2)					\  ({									\ -	extern void *__memscan_zero(void *, size_t);			\ -	extern void *__memscan_generic(void *, int, size_t);		\ +	void *__memscan_zero(void *, size_t);				\ +	void *__memscan_generic(void *, int, size_t);			\  	void *__retval, *__addr = (__arg0);				\  	size_t __size = (__arg2);					\  									\ @@ -46,14 +46,14 @@ extern void *memmove(void *, const void *, __kernel_size_t);  })  #define __HAVE_ARCH_MEMCMP -extern int memcmp(const void *,const void *,__kernel_size_t); +int memcmp(const void *,const void *,__kernel_size_t);  /* Now the str*() stuff... */  #define __HAVE_ARCH_STRLEN -extern __kernel_size_t strlen(const char *); +__kernel_size_t strlen(const char *);  #define __HAVE_ARCH_STRNCMP -extern int strncmp(const char *, const char *, __kernel_size_t); +int strncmp(const char *, const char *, __kernel_size_t);  #endif /* !EXPORT_SYMTAB_STROPS */ diff --git a/arch/sparc/include/asm/swab.h b/arch/sparc/include/asm/swab.h deleted file mode 100644 index a34ad079487..00000000000 --- a/arch/sparc/include/asm/swab.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _SPARC_SWAB_H -#define _SPARC_SWAB_H - -#include <linux/types.h> -#include <asm/asi.h> - -#if defined(__sparc__) && defined(__arch64__) -static inline __u16 __arch_swab16p(const __u16 *addr) -{ -	__u16 ret; - -	__asm__ __volatile__ ("lduha [%1] %2, %0" -			      : "=r" (ret) -			      : "r" (addr), "i" (ASI_PL)); -	return ret; -} -#define __arch_swab16p __arch_swab16p - -static inline __u32 __arch_swab32p(const __u32 *addr) -{ -	__u32 ret; - -	__asm__ __volatile__ ("lduwa [%1] %2, %0" -			      : "=r" (ret) -			      : "r" (addr), "i" (ASI_PL)); -	return ret; -} -#define __arch_swab32p __arch_swab32p - -static inline __u64 __arch_swab64p(const __u64 *addr) -{ -	__u64 ret; - -	__asm__ __volatile__ ("ldxa [%1] %2, %0" -			      : "=r" (ret) -			      : "r" (addr), "i" (ASI_PL)); -	return ret; -} -#define __arch_swab64p __arch_swab64p - -#else -#define __SWAB_64_THRU_32__ -#endif /* defined(__sparc__) && defined(__arch64__) */ - -#endif /* _SPARC_SWAB_H */ diff --git a/arch/sparc/include/asm/switch_to.h b/arch/sparc/include/asm/switch_to.h new file mode 100644 index 00000000000..2dc4fa5c6f8 --- /dev/null +++ b/arch/sparc/include/asm/switch_to.h @@ -0,0 +1,8 @@ +#ifndef ___ASM_SPARC_SWITCH_TO_H +#define ___ASM_SPARC_SWITCH_TO_H +#if defined(__sparc__) && defined(__arch64__) +#include <asm/switch_to_64.h> +#else +#include <asm/switch_to_32.h> +#endif +#endif diff --git a/arch/sparc/include/asm/switch_to_32.h b/arch/sparc/include/asm/switch_to_32.h new file mode 100644 index 00000000000..16f10374feb --- /dev/null +++ b/arch/sparc/include/asm/switch_to_32.h @@ -0,0 +1,106 @@ +#ifndef __SPARC_SWITCH_TO_H +#define __SPARC_SWITCH_TO_H + +#include <asm/smp.h> + +extern struct thread_info *current_set[NR_CPUS]; + +/* + * Flush windows so that the VM switch which follows + * would not pull the stack from under us. + * + * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) + * XXX WTF is the above comment? Found in late teen 2.4.x. + */ +#ifdef CONFIG_SMP +#define SWITCH_ENTER(prv) \ +	do {			\ +	if (test_tsk_thread_flag(prv, TIF_USEDFPU)) { \ +		put_psr(get_psr() | PSR_EF); \ +		fpsave(&(prv)->thread.float_regs[0], &(prv)->thread.fsr, \ +		       &(prv)->thread.fpqueue[0], &(prv)->thread.fpqdepth); \ +		clear_tsk_thread_flag(prv, TIF_USEDFPU); \ +		(prv)->thread.kregs->psr &= ~PSR_EF; \ +	} \ +	} while(0) + +#define SWITCH_DO_LAZY_FPU(next)	/* */ +#else +#define SWITCH_ENTER(prv)		/* */ +#define SWITCH_DO_LAZY_FPU(nxt)	\ +	do {			\ +	if (last_task_used_math != (nxt))		\ +		(nxt)->thread.kregs->psr&=~PSR_EF;	\ +	} while(0) +#endif + +#define prepare_arch_switch(next) do { \ +	__asm__ __volatile__( \ +	".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ +	"save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ +	"save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ +	"save %sp, -0x40, %sp\n\t" \ +	"restore; restore; restore; restore; restore; restore; restore"); \ +} while(0) + +	/* Much care has gone into this code, do not touch it. +	 * +	 * We need to loadup regs l0/l1 for the newly forked child +	 * case because the trap return path relies on those registers +	 * holding certain values, gcc is told that they are clobbered. +	 * Gcc needs registers for 3 values in and 1 value out, so we +	 * clobber every non-fixed-usage register besides l2/l3/o4/o5.  -DaveM +	 * +	 * Hey Dave, that do not touch sign is too much of an incentive +	 * - Anton & Pete +	 */ +#define switch_to(prev, next, last) do {						\ +	SWITCH_ENTER(prev);								\ +	SWITCH_DO_LAZY_FPU(next);							\ +	cpumask_set_cpu(smp_processor_id(), mm_cpumask(next->active_mm));		\ +	__asm__ __volatile__(								\ +	"sethi	%%hi(here - 0x8), %%o7\n\t"						\ +	"mov	%%g6, %%g3\n\t"								\ +	"or	%%o7, %%lo(here - 0x8), %%o7\n\t"					\ +	"rd	%%psr, %%g4\n\t"							\ +	"std	%%sp, [%%g6 + %4]\n\t"							\ +	"rd	%%wim, %%g5\n\t"							\ +	"wr	%%g4, 0x20, %%psr\n\t"							\ +	"nop\n\t"									\ +	"std	%%g4, [%%g6 + %3]\n\t"							\ +	"ldd	[%2 + %3], %%g4\n\t"							\ +	"mov	%2, %%g6\n\t"								\ +	".globl	patchme_store_new_current\n"						\ +"patchme_store_new_current:\n\t"							\ +	"st	%2, [%1]\n\t"								\ +	"wr	%%g4, 0x20, %%psr\n\t"							\ +	"nop\n\t"									\ +	"nop\n\t"									\ +	"nop\n\t"	/* LEON needs all 3 nops: load to %sp depends on CWP. */		\ +	"ldd	[%%g6 + %4], %%sp\n\t"							\ +	"wr	%%g5, 0x0, %%wim\n\t"							\ +	"ldd	[%%sp + 0x00], %%l0\n\t"						\ +	"ldd	[%%sp + 0x38], %%i6\n\t"						\ +	"wr	%%g4, 0x0, %%psr\n\t"							\ +	"nop\n\t"									\ +	"nop\n\t"									\ +	"jmpl	%%o7 + 0x8, %%g0\n\t"							\ +	" ld	[%%g3 + %5], %0\n\t"							\ +	"here:\n"									\ +        : "=&r" (last)									\ +        : "r" (&(current_set[hard_smp_processor_id()])),	\ +	  "r" (task_thread_info(next)),				\ +	  "i" (TI_KPSR),					\ +	  "i" (TI_KSP),						\ +	  "i" (TI_TASK)						\ +	:       "g1", "g2", "g3", "g4", "g5",       "g7",	\ +	  "l0", "l1",       "l3", "l4", "l5", "l6", "l7",	\ +	  "i0", "i1", "i2", "i3", "i4", "i5",			\ +	  "o0", "o1", "o2", "o3",                   "o7");	\ +	} while(0) + +void fpsave(unsigned long *fpregs, unsigned long *fsr, +	    void *fpqueue, unsigned long *fpqdepth); +void synchronize_user_stack(void); + +#endif /* __SPARC_SWITCH_TO_H */ diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h new file mode 100644 index 00000000000..10e76332dc9 --- /dev/null +++ b/arch/sparc/include/asm/switch_to_64.h @@ -0,0 +1,71 @@ +#ifndef __SPARC64_SWITCH_TO_64_H +#define __SPARC64_SWITCH_TO_64_H + +#include <asm/visasm.h> + +#define prepare_arch_switch(next)		\ +do {						\ +	flushw_all();				\ +} while (0) + +	/* See what happens when you design the chip correctly? +	 * +	 * We tell gcc we clobber all non-fixed-usage registers except +	 * for l0/l1.  It will use one for 'next' and the other to hold +	 * the output value of 'last'.  'next' is not referenced again +	 * past the invocation of switch_to in the scheduler, so we need +	 * not preserve it's value.  Hairy, but it lets us remove 2 loads +	 * and 2 stores in this critical code path.  -DaveM +	 */ +#define switch_to(prev, next, last)					\ +do {	save_and_clear_fpu();						\ +	/* If you are tempted to conditionalize the following */	\ +	/* so that ASI is only written if it changes, think again. */	\ +	__asm__ __volatile__("wr %%g0, %0, %%asi"			\ +	: : "r" (task_thread_info(next)->current_ds));\ +	trap_block[current_thread_info()->cpu].thread =			\ +		task_thread_info(next);					\ +	__asm__ __volatile__(						\ +	"mov	%%g4, %%g7\n\t"						\ +	"stx	%%i6, [%%sp + 2047 + 0x70]\n\t"				\ +	"stx	%%i7, [%%sp + 2047 + 0x78]\n\t"				\ +	"rdpr	%%wstate, %%o5\n\t"					\ +	"stx	%%o6, [%%g6 + %6]\n\t"					\ +	"stb	%%o5, [%%g6 + %5]\n\t"					\ +	"rdpr	%%cwp, %%o5\n\t"					\ +	"stb	%%o5, [%%g6 + %8]\n\t"					\ +	"wrpr	%%g0, 15, %%pil\n\t"					\ +	"mov	%4, %%g6\n\t"						\ +	"ldub	[%4 + %8], %%g1\n\t"					\ +	"wrpr	%%g1, %%cwp\n\t"					\ +	"ldx	[%%g6 + %6], %%o6\n\t"					\ +	"ldub	[%%g6 + %5], %%o5\n\t"					\ +	"ldub	[%%g6 + %7], %%o7\n\t"					\ +	"wrpr	%%o5, 0x0, %%wstate\n\t"				\ +	"ldx	[%%sp + 2047 + 0x70], %%i6\n\t"				\ +	"ldx	[%%sp + 2047 + 0x78], %%i7\n\t"				\ +	"ldx	[%%g6 + %9], %%g4\n\t"					\ +	"wrpr	%%g0, 14, %%pil\n\t"					\ +	"brz,pt %%o7, switch_to_pc\n\t"					\ +	" mov	%%g7, %0\n\t"						\ +	"sethi	%%hi(ret_from_fork), %%g1\n\t"				\ +	"jmpl	%%g1 + %%lo(ret_from_fork), %%g0\n\t"			\ +	" nop\n\t"							\ +	".globl switch_to_pc\n\t"					\ +	"switch_to_pc:\n\t"						\ +	: "=&r" (last), "=r" (current), "=r" (current_thread_info_reg),	\ +	  "=r" (__local_per_cpu_offset)					\ +	: "0" (task_thread_info(next)),					\ +	  "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD),            \ +	  "i" (TI_CWP), "i" (TI_TASK)					\ +	: "cc",								\ +	        "g1", "g2", "g3",                   "g7",		\ +	        "l1", "l2", "l3", "l4", "l5", "l6", "l7",		\ +	  "i0", "i1", "i2", "i3", "i4", "i5",				\ +	  "o0", "o1", "o2", "o3", "o4", "o5",       "o7");		\ +} while(0) + +void synchronize_user_stack(void); +void fault_in_user_windows(void); + +#endif /* __SPARC64_SWITCH_TO_64_H */ diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h index 45a43f637a1..b0a0db8ea61 100644 --- a/arch/sparc/include/asm/syscalls.h +++ b/arch/sparc/include/asm/syscalls.h @@ -3,11 +3,9 @@  struct pt_regs; -extern asmlinkage long sparc_do_fork(unsigned long clone_flags, -				     unsigned long stack_start, -				     struct pt_regs *regs, -				     unsigned long stack_size); - -extern asmlinkage int sparc_execve(struct pt_regs *regs); +asmlinkage long sparc_do_fork(unsigned long clone_flags, +			      unsigned long stack_start, +			      struct pt_regs *regs, +			      unsigned long stack_size);  #endif /* _SPARC64_SYSCALLS_H */ diff --git a/arch/sparc/include/asm/sysen.h b/arch/sparc/include/asm/sysen.h deleted file mode 100644 index 6af34abde6e..00000000000 --- a/arch/sparc/include/asm/sysen.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * sysen.h:  Bit fields within the "System Enable" register accessed via - *           the ASI_CONTROL address space at address AC_SYSENABLE. - * - * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef _SPARC_SYSEN_H -#define _SPARC_SYSEN_H - -#define SENABLE_DVMA   0x20   /* enable dvma transfers */ -#define SENABLE_CACHE  0x10   /* enable VAC cache */ -#define SENABLE_RESET  0x04   /* reset whole machine, danger Will Robinson */ - -#endif /* _SPARC_SYSEN_H */ diff --git a/arch/sparc/include/asm/system.h b/arch/sparc/include/asm/system.h deleted file mode 100644 index 7944a7cfc99..00000000000 --- a/arch/sparc/include/asm/system.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef ___ASM_SPARC_SYSTEM_H -#define ___ASM_SPARC_SYSTEM_H -#if defined(__sparc__) && defined(__arch64__) -#include <asm/system_64.h> -#else -#include <asm/system_32.h> -#endif -#endif diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h deleted file mode 100644 index 890036b3689..00000000000 --- a/arch/sparc/include/asm/system_32.h +++ /dev/null @@ -1,289 +0,0 @@ -#ifndef __SPARC_SYSTEM_H -#define __SPARC_SYSTEM_H - -#include <linux/kernel.h> -#include <linux/threads.h>	/* NR_CPUS */ -#include <linux/thread_info.h> - -#include <asm/page.h> -#include <asm/psr.h> -#include <asm/ptrace.h> -#include <asm/btfixup.h> -#include <asm/smp.h> - -#ifndef __ASSEMBLY__ - -#include <linux/irqflags.h> - -static inline unsigned int probe_irq_mask(unsigned long val) -{ -	return 0; -} - -/* - * Sparc (general) CPU types - */ -enum sparc_cpu { -  sun4        = 0x00, -  sun4c       = 0x01, -  sun4m       = 0x02, -  sun4d       = 0x03, -  sun4e       = 0x04, -  sun4u       = 0x05, /* V8 ploos ploos */ -  sun_unknown = 0x06, -  ap1000      = 0x07, /* almost a sun4m */ -  sparc_leon  = 0x08, /* Leon SoC */ -}; - -/* Really, userland should not be looking at any of this... */ -#ifdef __KERNEL__ - -extern enum sparc_cpu sparc_cpu_model; - -#define ARCH_SUN4C (sparc_cpu_model==sun4c) - -#define SUN4M_NCPUS            4              /* Architectural limit of sun4m. */ - -extern char reboot_command[]; - -extern struct thread_info *current_set[NR_CPUS]; - -extern unsigned long empty_bad_page; -extern unsigned long empty_bad_page_table; -extern unsigned long empty_zero_page; - -extern void sun_do_break(void); -extern int serial_console; -extern int stop_a_enabled; -extern int scons_pwroff; - -static inline int con_is_present(void) -{ -	return serial_console ? 0 : 1; -} - -/* When a context switch happens we must flush all user windows so that - * the windows of the current process are flushed onto its stack. This - * way the windows are all clean for the next process and the stack - * frames are up to date. - */ -extern void flush_user_windows(void); -extern void kill_user_windows(void); -extern void synchronize_user_stack(void); -extern void fpsave(unsigned long *fpregs, unsigned long *fsr, -		   void *fpqueue, unsigned long *fpqdepth); - -#ifdef CONFIG_SMP -#define SWITCH_ENTER(prv) \ -	do {			\ -	if (test_tsk_thread_flag(prv, TIF_USEDFPU)) { \ -		put_psr(get_psr() | PSR_EF); \ -		fpsave(&(prv)->thread.float_regs[0], &(prv)->thread.fsr, \ -		       &(prv)->thread.fpqueue[0], &(prv)->thread.fpqdepth); \ -		clear_tsk_thread_flag(prv, TIF_USEDFPU); \ -		(prv)->thread.kregs->psr &= ~PSR_EF; \ -	} \ -	} while(0) - -#define SWITCH_DO_LAZY_FPU(next)	/* */ -#else -#define SWITCH_ENTER(prv)		/* */ -#define SWITCH_DO_LAZY_FPU(nxt)	\ -	do {			\ -	if (last_task_used_math != (nxt))		\ -		(nxt)->thread.kregs->psr&=~PSR_EF;	\ -	} while(0) -#endif - -extern void flushw_all(void); - -/* - * Flush windows so that the VM switch which follows - * would not pull the stack from under us. - * - * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) - * XXX WTF is the above comment? Found in late teen 2.4.x. - */ -#define prepare_arch_switch(next) do { \ -	__asm__ __volatile__( \ -	".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ -	"save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ -	"save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ -	"save %sp, -0x40, %sp\n\t" \ -	"restore; restore; restore; restore; restore; restore; restore"); \ -} while(0) - -	/* Much care has gone into this code, do not touch it. -	 * -	 * We need to loadup regs l0/l1 for the newly forked child -	 * case because the trap return path relies on those registers -	 * holding certain values, gcc is told that they are clobbered. -	 * Gcc needs registers for 3 values in and 1 value out, so we -	 * clobber every non-fixed-usage register besides l2/l3/o4/o5.  -DaveM -	 * -	 * Hey Dave, that do not touch sign is too much of an incentive -	 * - Anton & Pete -	 */ -#define switch_to(prev, next, last) do {						\ -	SWITCH_ENTER(prev);								\ -	SWITCH_DO_LAZY_FPU(next);							\ -	cpumask_set_cpu(smp_processor_id(), mm_cpumask(next->active_mm));		\ -	__asm__ __volatile__(								\ -	"sethi	%%hi(here - 0x8), %%o7\n\t"						\ -	"mov	%%g6, %%g3\n\t"								\ -	"or	%%o7, %%lo(here - 0x8), %%o7\n\t"					\ -	"rd	%%psr, %%g4\n\t"							\ -	"std	%%sp, [%%g6 + %4]\n\t"							\ -	"rd	%%wim, %%g5\n\t"							\ -	"wr	%%g4, 0x20, %%psr\n\t"							\ -	"nop\n\t"									\ -	"std	%%g4, [%%g6 + %3]\n\t"							\ -	"ldd	[%2 + %3], %%g4\n\t"							\ -	"mov	%2, %%g6\n\t"								\ -	".globl	patchme_store_new_current\n"						\ -"patchme_store_new_current:\n\t"							\ -	"st	%2, [%1]\n\t"								\ -	"wr	%%g4, 0x20, %%psr\n\t"							\ -	"nop\n\t"									\ -	"nop\n\t"									\ -	"nop\n\t"	/* LEON needs all 3 nops: load to %sp depends on CWP. */		\ -	"ldd	[%%g6 + %4], %%sp\n\t"							\ -	"wr	%%g5, 0x0, %%wim\n\t"							\ -	"ldd	[%%sp + 0x00], %%l0\n\t"						\ -	"ldd	[%%sp + 0x38], %%i6\n\t"						\ -	"wr	%%g4, 0x0, %%psr\n\t"							\ -	"nop\n\t"									\ -	"nop\n\t"									\ -	"jmpl	%%o7 + 0x8, %%g0\n\t"							\ -	" ld	[%%g3 + %5], %0\n\t"							\ -	"here:\n"									\ -        : "=&r" (last)									\ -        : "r" (&(current_set[hard_smp_processor_id()])),	\ -	  "r" (task_thread_info(next)),				\ -	  "i" (TI_KPSR),					\ -	  "i" (TI_KSP),						\ -	  "i" (TI_TASK)						\ -	:       "g1", "g2", "g3", "g4", "g5",       "g7",	\ -	  "l0", "l1",       "l3", "l4", "l5", "l6", "l7",	\ -	  "i0", "i1", "i2", "i3", "i4", "i5",			\ -	  "o0", "o1", "o2", "o3",                   "o7");	\ -	} while(0) - -/* XXX Change this if we ever use a PSO mode kernel. */ -#define mb()	__asm__ __volatile__ ("" : : : "memory") -#define rmb()	mb() -#define wmb()	mb() -#define read_barrier_depends()	do { } while(0) -#define set_mb(__var, __value)  do { __var = __value; mb(); } while(0) -#define smp_mb()	__asm__ __volatile__("":::"memory") -#define smp_rmb()	__asm__ __volatile__("":::"memory") -#define smp_wmb()	__asm__ __volatile__("":::"memory") -#define smp_read_barrier_depends()	do { } while(0) - -#define nop() __asm__ __volatile__ ("nop") - -/* This has special calling conventions */ -#ifndef CONFIG_SMP -BTFIXUPDEF_CALL(void, ___xchg32, void) -#endif - -static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) -{ -#ifdef CONFIG_SMP -	__asm__ __volatile__("swap [%2], %0" -			     : "=&r" (val) -			     : "0" (val), "r" (m) -			     : "memory"); -	return val; -#else -	register unsigned long *ptr asm("g1"); -	register unsigned long ret asm("g2"); - -	ptr = (unsigned long *) m; -	ret = val; - -	/* Note: this is magic and the nop there is -	   really needed. */ -	__asm__ __volatile__( -	"mov	%%o7, %%g4\n\t" -	"call	___f____xchg32\n\t" -	" nop\n\t" -	: "=&r" (ret) -	: "0" (ret), "r" (ptr) -	: "g3", "g4", "g7", "memory", "cc"); - -	return ret; -#endif -} - -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) - -extern void __xchg_called_with_bad_pointer(void); - -static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) -{ -	switch (size) { -	case 4: -		return xchg_u32(ptr, x); -	}; -	__xchg_called_with_bad_pointer(); -	return x; -} - -/* Emulate cmpxchg() the same way we emulate atomics, - * by hashing the object address and indexing into an array - * of spinlocks to get a bit of performance... - * - * See arch/sparc/lib/atomic32.c for implementation. - * - * Cribbed from <asm-parisc/atomic.h> - */ -#define __HAVE_ARCH_CMPXCHG	1 - -/* bug catcher for when unsupported size is used - won't link */ -extern void __cmpxchg_called_with_bad_pointer(void); -/* we only need to support cmpxchg of a u32 on sparc */ -extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); - -/* don't worry...optimizer will get rid of most of this */ -static inline unsigned long -__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) -{ -	switch (size) { -	case 4: -		return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_); -	default: -		__cmpxchg_called_with_bad_pointer(); -		break; -	} -	return old; -} - -#define cmpxchg(ptr, o, n)						\ -({									\ -	__typeof__(*(ptr)) _o_ = (o);					\ -	__typeof__(*(ptr)) _n_ = (n);					\ -	(__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,	\ -			(unsigned long)_n_, sizeof(*(ptr)));		\ -}) - -#include <asm-generic/cmpxchg-local.h> - -/* - * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make - * them available. - */ -#define cmpxchg_local(ptr, o, n)				  	       \ -	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ -			(unsigned long)(n), sizeof(*(ptr)))) -#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) - -extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); - -#endif /* __KERNEL__ */ - -#endif /* __ASSEMBLY__ */ - -#define arch_align_stack(x) (x) - -#endif /* !(__SPARC_SYSTEM_H) */ diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h deleted file mode 100644 index e3b65d8cf41..00000000000 --- a/arch/sparc/include/asm/system_64.h +++ /dev/null @@ -1,335 +0,0 @@ -#ifndef __SPARC64_SYSTEM_H -#define __SPARC64_SYSTEM_H - -#include <asm/ptrace.h> -#include <asm/processor.h> -#include <asm/visasm.h> - -#ifndef __ASSEMBLY__ - -#include <linux/irqflags.h> -#include <asm-generic/cmpxchg-local.h> - -/* - * Sparc (general) CPU types - */ -enum sparc_cpu { -  sun4        = 0x00, -  sun4c       = 0x01, -  sun4m       = 0x02, -  sun4d       = 0x03, -  sun4e       = 0x04, -  sun4u       = 0x05, /* V8 ploos ploos */ -  sun_unknown = 0x06, -  ap1000      = 0x07, /* almost a sun4m */ -}; - -#define sparc_cpu_model sun4u - -/* This cannot ever be a sun4c :) That's just history. */ -#define ARCH_SUN4C 0 - -extern const char *sparc_cpu_type; -extern const char *sparc_fpu_type; -extern const char *sparc_pmu_type; - -extern char reboot_command[]; - -/* These are here in an effort to more fully work around Spitfire Errata - * #51.  Essentially, if a memory barrier occurs soon after a mispredicted - * branch, the chip can stop executing instructions until a trap occurs. - * Therefore, if interrupts are disabled, the chip can hang forever. - * - * It used to be believed that the memory barrier had to be right in the - * delay slot, but a case has been traced recently wherein the memory barrier - * was one instruction after the branch delay slot and the chip still hung. - * The offending sequence was the following in sym_wakeup_done() of the - * sym53c8xx_2 driver: - * - *	call	sym_ccb_from_dsa, 0 - *	 movge	%icc, 0, %l0 - *	brz,pn	%o0, .LL1303 - *	 mov	%o0, %l2 - *	membar	#LoadLoad - * - * The branch has to be mispredicted for the bug to occur.  Therefore, we put - * the memory barrier explicitly into a "branch always, predicted taken" - * delay slot to avoid the problem case. - */ -#define membar_safe(type) \ -do {	__asm__ __volatile__("ba,pt	%%xcc, 1f\n\t" \ -			     " membar	" type "\n" \ -			     "1:\n" \ -			     : : : "memory"); \ -} while (0) - -/* The kernel always executes in TSO memory model these days, - * and furthermore most sparc64 chips implement more stringent - * memory ordering than required by the specifications. - */ -#define mb()	membar_safe("#StoreLoad") -#define rmb()	__asm__ __volatile__("":::"memory") -#define wmb()	__asm__ __volatile__("":::"memory") - -#endif - -#define nop() 		__asm__ __volatile__ ("nop") - -#define read_barrier_depends()		do { } while(0) -#define set_mb(__var, __value) \ -	do { __var = __value; membar_safe("#StoreLoad"); } while(0) - -#ifdef CONFIG_SMP -#define smp_mb()	mb() -#define smp_rmb()	rmb() -#define smp_wmb()	wmb() -#else -#define smp_mb()	__asm__ __volatile__("":::"memory") -#define smp_rmb()	__asm__ __volatile__("":::"memory") -#define smp_wmb()	__asm__ __volatile__("":::"memory") -#endif - -#define smp_read_barrier_depends()	do { } while(0) - -#define flushi(addr)	__asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") - -#define flushw_all()	__asm__ __volatile__("flushw") - -/* Performance counter register access. */ -#define read_pcr(__p)  __asm__ __volatile__("rd	%%pcr, %0" : "=r" (__p)) -#define write_pcr(__p) __asm__ __volatile__("wr	%0, 0x0, %%pcr" : : "r" (__p)) -#define read_pic(__p)  __asm__ __volatile__("rd %%pic, %0" : "=r" (__p)) - -/* Blackbird errata workaround.  See commentary in - * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt() - * for more information. - */ -#define write_pic(__p)  					\ -	__asm__ __volatile__("ba,pt	%%xcc, 99f\n\t"		\ -			     " nop\n\t"				\ -			     ".align	64\n"			\ -			  "99:wr	%0, 0x0, %%pic\n\t"	\ -			     "rd	%%pic, %%g0" : : "r" (__p)) -#define reset_pic()	write_pic(0) - -#ifndef __ASSEMBLY__ - -extern void sun_do_break(void); -extern int stop_a_enabled; -extern int scons_pwroff; - -extern void fault_in_user_windows(void); -extern void synchronize_user_stack(void); - -extern void __flushw_user(void); -#define flushw_user() __flushw_user() - -#define flush_user_windows flushw_user -#define flush_register_windows flushw_all - -/* Don't hold the runqueue lock over context switch */ -#define __ARCH_WANT_UNLOCKED_CTXSW -#define prepare_arch_switch(next)		\ -do {						\ -	flushw_all();				\ -} while (0) - -	/* See what happens when you design the chip correctly? -	 * -	 * We tell gcc we clobber all non-fixed-usage registers except -	 * for l0/l1.  It will use one for 'next' and the other to hold -	 * the output value of 'last'.  'next' is not referenced again -	 * past the invocation of switch_to in the scheduler, so we need -	 * not preserve it's value.  Hairy, but it lets us remove 2 loads -	 * and 2 stores in this critical code path.  -DaveM -	 */ -#define switch_to(prev, next, last)					\ -do {	flush_tlb_pending();						\ -	save_and_clear_fpu();						\ -	/* If you are tempted to conditionalize the following */	\ -	/* so that ASI is only written if it changes, think again. */	\ -	__asm__ __volatile__("wr %%g0, %0, %%asi"			\ -	: : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ -	trap_block[current_thread_info()->cpu].thread =			\ -		task_thread_info(next);					\ -	__asm__ __volatile__(						\ -	"mov	%%g4, %%g7\n\t"						\ -	"stx	%%i6, [%%sp + 2047 + 0x70]\n\t"				\ -	"stx	%%i7, [%%sp + 2047 + 0x78]\n\t"				\ -	"rdpr	%%wstate, %%o5\n\t"					\ -	"stx	%%o6, [%%g6 + %6]\n\t"					\ -	"stb	%%o5, [%%g6 + %5]\n\t"					\ -	"rdpr	%%cwp, %%o5\n\t"					\ -	"stb	%%o5, [%%g6 + %8]\n\t"					\ -	"wrpr	%%g0, 15, %%pil\n\t"					\ -	"mov	%4, %%g6\n\t"						\ -	"ldub	[%4 + %8], %%g1\n\t"					\ -	"wrpr	%%g1, %%cwp\n\t"					\ -	"ldx	[%%g6 + %6], %%o6\n\t"					\ -	"ldub	[%%g6 + %5], %%o5\n\t"					\ -	"ldub	[%%g6 + %7], %%o7\n\t"					\ -	"wrpr	%%o5, 0x0, %%wstate\n\t"				\ -	"ldx	[%%sp + 2047 + 0x70], %%i6\n\t"				\ -	"ldx	[%%sp + 2047 + 0x78], %%i7\n\t"				\ -	"ldx	[%%g6 + %9], %%g4\n\t"					\ -	"wrpr	%%g0, 14, %%pil\n\t"					\ -	"brz,pt %%o7, switch_to_pc\n\t"					\ -	" mov	%%g7, %0\n\t"						\ -	"sethi	%%hi(ret_from_syscall), %%g1\n\t"			\ -	"jmpl	%%g1 + %%lo(ret_from_syscall), %%g0\n\t"		\ -	" nop\n\t"							\ -	".globl switch_to_pc\n\t"					\ -	"switch_to_pc:\n\t"						\ -	: "=&r" (last), "=r" (current), "=r" (current_thread_info_reg),	\ -	  "=r" (__local_per_cpu_offset)					\ -	: "0" (task_thread_info(next)),					\ -	  "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD),            \ -	  "i" (TI_CWP), "i" (TI_TASK)					\ -	: "cc",								\ -	        "g1", "g2", "g3",                   "g7",		\ -	        "l1", "l2", "l3", "l4", "l5", "l6", "l7",		\ -	  "i0", "i1", "i2", "i3", "i4", "i5",				\ -	  "o0", "o1", "o2", "o3", "o4", "o5",       "o7");		\ -} while(0) - -static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) -{ -	unsigned long tmp1, tmp2; - -	__asm__ __volatile__( -"	mov		%0, %1\n" -"1:	lduw		[%4], %2\n" -"	cas		[%4], %2, %0\n" -"	cmp		%2, %0\n" -"	bne,a,pn	%%icc, 1b\n" -"	 mov		%1, %0\n" -	: "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) -	: "0" (val), "r" (m) -	: "cc", "memory"); -	return val; -} - -static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long val) -{ -	unsigned long tmp1, tmp2; - -	__asm__ __volatile__( -"	mov		%0, %1\n" -"1:	ldx		[%4], %2\n" -"	casx		[%4], %2, %0\n" -"	cmp		%2, %0\n" -"	bne,a,pn	%%xcc, 1b\n" -"	 mov		%1, %0\n" -	: "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) -	: "0" (val), "r" (m) -	: "cc", "memory"); -	return val; -} - -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) - -extern void __xchg_called_with_bad_pointer(void); - -static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, -				       int size) -{ -	switch (size) { -	case 4: -		return xchg32(ptr, x); -	case 8: -		return xchg64(ptr, x); -	}; -	__xchg_called_with_bad_pointer(); -	return x; -} - -extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); - -/* - * Atomic compare and exchange.  Compare OLD with MEM, if identical, - * store NEW in MEM.  Return the initial value in MEM.  Success is - * indicated by comparing RETURN with OLD. - */ - -#define __HAVE_ARCH_CMPXCHG 1 - -static inline unsigned long -__cmpxchg_u32(volatile int *m, int old, int new) -{ -	__asm__ __volatile__("cas [%2], %3, %0" -			     : "=&r" (new) -			     : "0" (new), "r" (m), "r" (old) -			     : "memory"); - -	return new; -} - -static inline unsigned long -__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) -{ -	__asm__ __volatile__("casx [%2], %3, %0" -			     : "=&r" (new) -			     : "0" (new), "r" (m), "r" (old) -			     : "memory"); - -	return new; -} - -/* This function doesn't exist, so you'll get a linker error -   if something tries to do an invalid cmpxchg().  */ -extern void __cmpxchg_called_with_bad_pointer(void); - -static inline unsigned long -__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) -{ -	switch (size) { -		case 4: -			return __cmpxchg_u32(ptr, old, new); -		case 8: -			return __cmpxchg_u64(ptr, old, new); -	} -	__cmpxchg_called_with_bad_pointer(); -	return old; -} - -#define cmpxchg(ptr,o,n)						 \ -  ({									 \ -     __typeof__(*(ptr)) _o_ = (o);					 \ -     __typeof__(*(ptr)) _n_ = (n);					 \ -     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \ -				    (unsigned long)_n_, sizeof(*(ptr))); \ -  }) - -/* - * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make - * them available. - */ - -static inline unsigned long __cmpxchg_local(volatile void *ptr, -				      unsigned long old, -				      unsigned long new, int size) -{ -	switch (size) { -	case 4: -	case 8:	return __cmpxchg(ptr, old, new, size); -	default: -		return __cmpxchg_local_generic(ptr, old, new, size); -	} - -	return old; -} - -#define cmpxchg_local(ptr, o, n)				  	\ -	((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o),	\ -			(unsigned long)(n), sizeof(*(ptr)))) -#define cmpxchg64_local(ptr, o, n)					\ -  ({									\ -	BUILD_BUG_ON(sizeof(*(ptr)) != 8);				\ -	cmpxchg_local((ptr), (o), (n));					\ -  }) - -#endif /* !(__ASSEMBLY__) */ - -#define arch_align_stack(x) (x) - -#endif /* !(__SPARC64_SYSTEM_H) */ diff --git a/arch/sparc/include/asm/termbits.h b/arch/sparc/include/asm/termbits.h index 23b10ff08df..948067065ac 100644 --- a/arch/sparc/include/asm/termbits.h +++ b/arch/sparc/include/asm/termbits.h @@ -1,266 +1,8 @@  #ifndef _SPARC_TERMBITS_H  #define _SPARC_TERMBITS_H -#include <linux/posix_types.h> +#include <uapi/asm/termbits.h> -typedef unsigned char   cc_t; -typedef unsigned int    speed_t; - -#if defined(__sparc__) && defined(__arch64__) -typedef unsigned int    tcflag_t; -#else -typedef unsigned long   tcflag_t; -#endif - -#define NCC 8 -struct termio { -	unsigned short c_iflag;		/* input mode flags */ -	unsigned short c_oflag;		/* output mode flags */ -	unsigned short c_cflag;		/* control mode flags */ -	unsigned short c_lflag;		/* local mode flags */ -	unsigned char c_line;		/* line discipline */ -	unsigned char c_cc[NCC];	/* control characters */ -}; - -#define NCCS 17 -struct termios { -	tcflag_t c_iflag;		/* input mode flags */ -	tcflag_t c_oflag;		/* output mode flags */ -	tcflag_t c_cflag;		/* control mode flags */ -	tcflag_t c_lflag;		/* local mode flags */ -	cc_t c_line;			/* line discipline */ -#ifndef __KERNEL__ -	cc_t c_cc[NCCS];		/* control characters */ -#else -	cc_t c_cc[NCCS+2];	/* kernel needs 2 more to hold vmin/vtime */ -#define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t)) -#endif -}; - -struct termios2 { -	tcflag_t c_iflag;		/* input mode flags */ -	tcflag_t c_oflag;		/* output mode flags */ -	tcflag_t c_cflag;		/* control mode flags */ -	tcflag_t c_lflag;		/* local mode flags */ -	cc_t c_line;			/* line discipline */ -	cc_t c_cc[NCCS+2];		/* control characters */ -	speed_t c_ispeed;		/* input speed */ -	speed_t c_ospeed;		/* output speed */ -}; - -struct ktermios { -	tcflag_t c_iflag;		/* input mode flags */ -	tcflag_t c_oflag;		/* output mode flags */ -	tcflag_t c_cflag;		/* control mode flags */ -	tcflag_t c_lflag;		/* local mode flags */ -	cc_t c_line;			/* line discipline */ -	cc_t c_cc[NCCS+2];		/* control characters */ -	speed_t c_ispeed;		/* input speed */ -	speed_t c_ospeed;		/* output speed */ -}; - -/* c_cc characters */ -#define VINTR    0 -#define VQUIT    1 -#define VERASE   2 -#define VKILL    3 -#define VEOF     4 -#define VEOL     5 -#define VEOL2    6 -#define VSWTC    7 -#define VSTART   8 -#define VSTOP    9 - - - -#define VSUSP    10 -#define VDSUSP   11  /* SunOS POSIX nicety I do believe... */ -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE  14 -#define VLNEXT   15 - -/* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is - * shared with eof/eol - */ -#ifdef __KERNEL__  #define VMIN     16  #define VTIME    17 -#else -#define VMIN     VEOF -#define VTIME    VEOL -#endif - -/* c_iflag bits */ -#define IGNBRK	0x00000001 -#define BRKINT	0x00000002 -#define IGNPAR	0x00000004 -#define PARMRK	0x00000008 -#define INPCK	0x00000010 -#define ISTRIP	0x00000020 -#define INLCR	0x00000040 -#define IGNCR	0x00000080 -#define ICRNL	0x00000100 -#define IUCLC	0x00000200 -#define IXON	0x00000400 -#define IXANY	0x00000800 -#define IXOFF	0x00001000 -#define IMAXBEL	0x00002000 -#define IUTF8   0x00004000 - -/* c_oflag bits */ -#define OPOST	0x00000001 -#define OLCUC	0x00000002 -#define ONLCR	0x00000004 -#define OCRNL	0x00000008 -#define ONOCR	0x00000010 -#define ONLRET	0x00000020 -#define OFILL	0x00000040 -#define OFDEL	0x00000080 -#define NLDLY	0x00000100 -#define   NL0	0x00000000 -#define   NL1	0x00000100 -#define CRDLY	0x00000600 -#define   CR0	0x00000000 -#define   CR1	0x00000200 -#define   CR2	0x00000400 -#define   CR3	0x00000600 -#define TABDLY	0x00001800 -#define   TAB0	0x00000000 -#define   TAB1	0x00000800 -#define   TAB2	0x00001000 -#define   TAB3	0x00001800 -#define   XTABS	0x00001800 -#define BSDLY	0x00002000 -#define   BS0	0x00000000 -#define   BS1	0x00002000 -#define VTDLY	0x00004000 -#define   VT0	0x00000000 -#define   VT1	0x00004000 -#define FFDLY	0x00008000 -#define   FF0	0x00000000 -#define   FF1	0x00008000 -#define PAGEOUT 0x00010000  /* SUNOS specific */ -#define WRAP    0x00020000  /* SUNOS specific */ - -/* c_cflag bit meaning */ -#define CBAUD	  0x0000100f -#define  B0	  0x00000000   /* hang up */ -#define  B50	  0x00000001 -#define  B75	  0x00000002 -#define  B110	  0x00000003 -#define  B134	  0x00000004 -#define  B150	  0x00000005 -#define  B200	  0x00000006 -#define  B300	  0x00000007 -#define  B600	  0x00000008 -#define  B1200	  0x00000009 -#define  B1800	  0x0000000a -#define  B2400	  0x0000000b -#define  B4800	  0x0000000c -#define  B9600	  0x0000000d -#define  B19200	  0x0000000e -#define  B38400	  0x0000000f -#define EXTA      B19200 -#define EXTB      B38400 -#define  CSIZE    0x00000030 -#define   CS5	  0x00000000 -#define   CS6	  0x00000010 -#define   CS7	  0x00000020 -#define   CS8	  0x00000030 -#define CSTOPB	  0x00000040 -#define CREAD	  0x00000080 -#define PARENB	  0x00000100 -#define PARODD	  0x00000200 -#define HUPCL	  0x00000400 -#define CLOCAL	  0x00000800 -#define CBAUDEX   0x00001000 -/* We'll never see these speeds with the Zilogs, but for completeness... */ -#define  BOTHER   0x00001000 -#define  B57600   0x00001001 -#define  B115200  0x00001002 -#define  B230400  0x00001003 -#define  B460800  0x00001004 -/* This is what we can do with the Zilogs. */ -#define  B76800   0x00001005 -/* This is what we can do with the SAB82532. */ -#define  B153600  0x00001006 -#define  B307200  0x00001007 -#define  B614400  0x00001008 -#define  B921600  0x00001009 -/* And these are the rest... */ -#define  B500000  0x0000100a -#define  B576000  0x0000100b -#define B1000000  0x0000100c -#define B1152000  0x0000100d -#define B1500000  0x0000100e -#define B2000000  0x0000100f -/* These have totally bogus values and nobody uses them -   so far. Later on we'd have to use say 0x10000x and -   adjust CBAUD constant and drivers accordingly. -#define B2500000  0x00001010 -#define B3000000  0x00001011 -#define B3500000  0x00001012 -#define B4000000  0x00001013  */ -#define CIBAUD	  0x100f0000  /* input baud rate (not used) */ -#define CMSPAR	  0x40000000  /* mark or space (stick) parity */ -#define CRTSCTS	  0x80000000  /* flow control */ - -#define IBSHIFT	  16		/* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG	0x00000001 -#define ICANON	0x00000002 -#define XCASE	0x00000004 -#define ECHO	0x00000008 -#define ECHOE	0x00000010 -#define ECHOK	0x00000020 -#define ECHONL	0x00000040 -#define NOFLSH	0x00000080 -#define TOSTOP	0x00000100 -#define ECHOCTL	0x00000200 -#define ECHOPRT	0x00000400 -#define ECHOKE	0x00000800 -#define DEFECHO 0x00001000  /* SUNOS thing, what is it? */ -#define FLUSHO	0x00002000 -#define PENDIN	0x00004000 -#define IEXTEN	0x00008000 -#define EXTPROC	0x00010000 - -/* modem lines */ -#define TIOCM_LE	0x001 -#define TIOCM_DTR	0x002 -#define TIOCM_RTS	0x004 -#define TIOCM_ST	0x008 -#define TIOCM_SR	0x010 -#define TIOCM_CTS	0x020 -#define TIOCM_CAR	0x040 -#define TIOCM_RNG	0x080 -#define TIOCM_DSR	0x100 -#define TIOCM_CD	TIOCM_CAR -#define TIOCM_RI	TIOCM_RNG -#define TIOCM_OUT1	0x2000 -#define TIOCM_OUT2	0x4000 -#define TIOCM_LOOP	0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */ - - -/* tcflow() and TCXONC use these */ -#define	TCOOFF		0 -#define	TCOON		1 -#define	TCIOFF		2 -#define	TCION		3 - -/* tcflush() and TCFLSH use these */ -#define	TCIFLUSH	0 -#define	TCOFLUSH	1 -#define	TCIOFLUSH	2 - -/* tcsetattr uses these */ -#define	TCSANOW		0 -#define	TCSADRAIN	1 -#define	TCSAFLUSH	2 -  #endif /* !(_SPARC_TERMBITS_H) */ diff --git a/arch/sparc/include/asm/termios.h b/arch/sparc/include/asm/termios.h index e8ba9539964..0c2414ddd52 100644 --- a/arch/sparc/include/asm/termios.h +++ b/arch/sparc/include/asm/termios.h @@ -1,46 +1,8 @@  #ifndef _SPARC_TERMIOS_H  #define _SPARC_TERMIOS_H -#include <asm/ioctls.h> -#include <asm/termbits.h> +#include <uapi/asm/termios.h> -#if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS) -struct sgttyb { -	char	sg_ispeed; -	char	sg_ospeed; -	char	sg_erase; -	char	sg_kill; -	short	sg_flags; -}; - -struct tchars { -	char	t_intrc; -	char	t_quitc; -	char	t_startc; -	char	t_stopc; -	char	t_eofc; -	char	t_brkc; -}; - -struct ltchars { -	char	t_suspc; -	char	t_dsuspc; -	char	t_rprntc; -	char	t_flushc; -	char	t_werasc; -	char	t_lnextc; -}; -#endif /* __KERNEL__ */ - -struct winsize { -	unsigned short ws_row; -	unsigned short ws_col; -	unsigned short ws_xpixel; -	unsigned short ws_ypixel; -}; - -#ifdef __KERNEL__ -#include <linux/module.h>  /*   * c_cc characters in the termio structure.  Oh, how I love being @@ -181,6 +143,4 @@ struct winsize {  	err; \  }) -#endif	/* __KERNEL__ */ -  #endif /* _SPARC_TERMIOS_H */ diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index 9dd0318d3dd..96efa7adc22 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h @@ -15,7 +15,6 @@  #ifndef __ASSEMBLY__ -#include <asm/btfixup.h>  #include <asm/ptrace.h>  #include <asm/page.h> @@ -78,24 +77,12 @@ register struct thread_info *current_thread_info_reg asm("g6");  /*   * thread information allocation   */ -#define THREAD_INFO_ORDER  1 - -#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR - -BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void) -#define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)() - -BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) -#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti) +#define THREAD_SIZE_ORDER  1  #endif /* __ASSEMBLY__ */ -/* - * Size of kernel stack for each process. - * Observe the order of get_free_pages() in alloc_thread_info(). - * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste. - */ -#define THREAD_SIZE		8192 +/* Size of kernel stack for each process */ +#define THREAD_SIZE		(2 * PAGE_SIZE)  /*   * Offsets in thread_info structure, used in assembly code @@ -118,8 +105,6 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)  #define TI_W_SAVED	0x250  /* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */ -#define PREEMPT_ACTIVE		0x4000000 -  /*   * thread information flag bit numbers   */ @@ -133,21 +118,17 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)  #define TIF_POLLING_NRFLAG	9	/* true if poll_idle() is polling  					 * TIF_NEED_RESCHED */  #define TIF_MEMDIE		10	/* is terminating due to OOM killer */ -#define TIF_FREEZE		11	/* is freezing for suspend */  /* as above, but as bit values */  #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)  #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)  #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)  #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED) -#define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)  #define _TIF_USEDFPU		(1<<TIF_USEDFPU)  #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)  #define _TIF_DO_NOTIFY_RESUME_MASK	(_TIF_NOTIFY_RESUME | \ -					 _TIF_SIGPENDING | \ -					 _TIF_RESTORE_SIGMASK) -#define _TIF_FREEZE		(1<<TIF_FREEZE) +					 _TIF_SIGPENDING)  #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index fb2ea7705a4..a5f01ac6d0f 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h @@ -14,12 +14,12 @@  #define TI_FLAG_FAULT_CODE_SHIFT	56  #define TI_FLAG_BYTE_WSTATE		1  #define TI_FLAG_WSTATE_SHIFT		48 -#define TI_FLAG_BYTE_CWP		2 -#define TI_FLAG_CWP_SHIFT		40 -#define TI_FLAG_BYTE_CURRENT_DS		3 -#define TI_FLAG_CURRENT_DS_SHIFT	32 -#define TI_FLAG_BYTE_FPDEPTH		4 -#define TI_FLAG_FPDEPTH_SHIFT		24 +#define TI_FLAG_BYTE_NOERROR		2 +#define TI_FLAG_BYTE_NOERROR_SHIFT	40 +#define TI_FLAG_BYTE_FPDEPTH		3 +#define TI_FLAG_FPDEPTH_SHIFT		32 +#define TI_FLAG_BYTE_CWP		4 +#define TI_FLAG_CWP_SHIFT		24  #define TI_FLAG_BYTE_WSAVED		5  #define TI_FLAG_WSAVED_SHIFT		16 @@ -47,7 +47,7 @@ struct thread_info {  	struct exec_domain	*exec_domain;  	int			preempt_count;	/* 0 => preemptable, <0 => BUG */  	__u8			new_child; -	__u8			syscall_noerror; +	__u8			current_ds;  	__u16			cpu;  	unsigned long		*utraps; @@ -74,9 +74,9 @@ struct thread_info {  #define TI_FAULT_CODE	(TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE)  #define TI_WSTATE	(TI_FLAGS + TI_FLAG_BYTE_WSTATE)  #define TI_CWP		(TI_FLAGS + TI_FLAG_BYTE_CWP) -#define TI_CURRENT_DS	(TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS)  #define TI_FPDEPTH	(TI_FLAGS + TI_FLAG_BYTE_FPDEPTH)  #define TI_WSAVED	(TI_FLAGS + TI_FLAG_BYTE_WSAVED) +#define TI_SYS_NOERROR	(TI_FLAGS + TI_FLAG_BYTE_NOERROR)  #define TI_FPSAVED	0x00000010  #define TI_KSP		0x00000018  #define TI_FAULT_ADDR	0x00000020 @@ -84,7 +84,7 @@ struct thread_info {  #define TI_EXEC_DOMAIN	0x00000030  #define TI_PRE_COUNT	0x00000038  #define TI_NEW_CHILD	0x0000003c -#define TI_SYS_NOERROR	0x0000003d +#define TI_CURRENT_DS	0x0000003d  #define TI_CPU		0x0000003e  #define TI_UTRAPS	0x00000040  #define TI_REG_WINDOW	0x00000048 @@ -111,8 +111,6 @@ struct thread_info {  #define THREAD_SHIFT PAGE_SHIFT  #endif /* PAGE_SHIFT == 13 */ -#define PREEMPT_ACTIVE		0x10000000 -  /*   * macros/functions for gaining access to the thread information structure   */ @@ -121,7 +119,7 @@ struct thread_info {  #define INIT_THREAD_INFO(tsk)				\  {							\  	.task		=	&tsk,			\ -	.flags		= ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT,	\ +	.current_ds	=	ASI_P,			\  	.exec_domain	=	&default_exec_domain,	\  	.preempt_count	=	INIT_PREEMPT_COUNT,	\  	.restart_block	= {				\ @@ -138,32 +136,11 @@ register struct thread_info *current_thread_info_reg asm("g6");  /* thread information allocation */  #if PAGE_SHIFT == 13 -#define __THREAD_INFO_ORDER	1 +#define THREAD_SIZE_ORDER	1  #else /* PAGE_SHIFT == 13 */ -#define __THREAD_INFO_ORDER	0 +#define THREAD_SIZE_ORDER	0  #endif /* PAGE_SHIFT == 13 */ -#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR - -#ifdef CONFIG_DEBUG_STACK_USAGE -#define alloc_thread_info(tsk)					\ -({								\ -	struct thread_info *ret;				\ -								\ -	ret = (struct thread_info *)				\ -	  __get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER);	\ -	if (ret)						\ -		memset(ret, 0, PAGE_SIZE<<__THREAD_INFO_ORDER);	\ -	ret;							\ -}) -#else -#define alloc_thread_info(tsk) \ -	((struct thread_info *)__get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER)) -#endif - -#define free_thread_info(ti) \ -	free_pages((unsigned long)(ti),__THREAD_INFO_ORDER) -  #define __thread_flag_byte_ptr(ti)	\  	((unsigned char *)(&((ti)->flags)))  #define __cur_thread_flag_byte_ptr	__thread_flag_byte_ptr(current_thread_info()) @@ -174,13 +151,12 @@ register struct thread_info *current_thread_info_reg asm("g6");  #define set_thread_wstate(val)		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val))  #define get_thread_cwp()		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP])  #define set_thread_cwp(val)		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val)) -#define get_thread_current_ds()		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS]) -#define set_thread_current_ds(val)	(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val)) +#define get_thread_noerror()		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR]) +#define set_thread_noerror(val)		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_NOERROR] = (val))  #define get_thread_fpdepth()		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH])  #define set_thread_fpdepth(val)		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val))  #define get_thread_wsaved()		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED])  #define set_thread_wsaved(val)		(__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val)) -  #endif /* !(__ASSEMBLY__) */  /* @@ -214,7 +190,7 @@ register struct thread_info *current_thread_info_reg asm("g6");  #define TIF_UNALIGNED		5	/* allowed to do unaligned accesses */  /* flag bit 6 is available */  #define TIF_32BIT		7	/* 32-bit binary */ -/* flag bit 8 is available */ +#define TIF_NOHZ		8	/* in adaptive nohz mode */  #define TIF_SECCOMP		9	/* secure computing */  #define TIF_SYSCALL_AUDIT	10	/* syscall auditing active */  #define TIF_SYSCALL_TRACEPOINT	11	/* syscall tracepoint instrumentation */ @@ -225,7 +201,6 @@ register struct thread_info *current_thread_info_reg asm("g6");  /* flag bit 12 is available */  #define TIF_MEMDIE		13	/* is terminating due to OOM killer */  #define TIF_POLLING_NRFLAG	14 -#define TIF_FREEZE		15	/* is freezing for suspend */  #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)  #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME) @@ -233,11 +208,11 @@ register struct thread_info *current_thread_info_reg asm("g6");  #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)  #define _TIF_UNALIGNED		(1<<TIF_UNALIGNED)  #define _TIF_32BIT		(1<<TIF_32BIT) +#define _TIF_NOHZ		(1<<TIF_NOHZ)  #define _TIF_SECCOMP		(1<<TIF_SECCOMP)  #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)  #define _TIF_SYSCALL_TRACEPOINT	(1<<TIF_SYSCALL_TRACEPOINT)  #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG) -#define _TIF_FREEZE		(1<<TIF_FREEZE)  #define _TIF_USER_WORK_MASK	((0xff << TI_FLAG_WSAVED_SHIFT) | \  				 _TIF_DO_NOTIFY_RESUME_MASK | \ @@ -261,8 +236,30 @@ static inline void set_restore_sigmask(void)  {  	struct thread_info *ti = current_thread_info();  	ti->status |= TS_RESTORE_SIGMASK; -	set_bit(TIF_SIGPENDING, &ti->flags); +	WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags)); +} +static inline void clear_restore_sigmask(void) +{ +	current_thread_info()->status &= ~TS_RESTORE_SIGMASK; +} +static inline bool test_restore_sigmask(void) +{ +	return current_thread_info()->status & TS_RESTORE_SIGMASK; +} +static inline bool test_and_clear_restore_sigmask(void) +{ +	struct thread_info *ti = current_thread_info(); +	if (!(ti->status & TS_RESTORE_SIGMASK)) +		return false; +	ti->status &= ~TS_RESTORE_SIGMASK; +	return true;  } + +#define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0) +#define test_thread_64bit_stack(__SP) \ +	((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \ +	 false : true) +  #endif	/* !__ASSEMBLY__ */  #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h index 2ec030ef381..f8e708a0aa5 100644 --- a/arch/sparc/include/asm/timer_32.h +++ b/arch/sparc/include/asm/timer_32.h @@ -8,13 +8,37 @@  #ifndef _SPARC_TIMER_H  #define _SPARC_TIMER_H -#include <asm/system.h>  /* For SUN4M_NCPUS */ -#include <asm/btfixup.h> +#include <linux/clocksource.h> +#include <linux/irqreturn.h> -extern __volatile__ unsigned int *master_l10_counter; +#include <asm-generic/percpu.h> -/* FIXME: Make do_[gs]ettimeofday btfixup calls */ -BTFIXUPDEF_CALL(int, bus_do_settimeofday, struct timespec *tv) -#define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv) +#include <asm/cpu_type.h>  /* For SUN4M_NCPUS */ + +#define SBUS_CLOCK_RATE   2000000 /* 2MHz */ +#define TIMER_VALUE_SHIFT 9 +#define TIMER_VALUE_MASK  0x3fffff +#define TIMER_LIMIT_BIT   (1 << 31)  /* Bit 31 in Counter-Timer register */ + +/* The counter timer register has the value offset by 9 bits. + * From sun4m manual: + * When a counter reaches the value in the corresponding limit register, + * the Limit bit is set and the counter is set to 500 nS (i.e. 0x00000200). + * + * To compensate for this add one to the value. + */ +static inline unsigned int timer_value(unsigned int value) +{ +	return (value + 1) << TIMER_VALUE_SHIFT; +} + +extern volatile u32 __iomem *master_l10_counter; + +irqreturn_t notrace timer_interrupt(int dummy, void *dev_id); + +#ifdef CONFIG_SMP +DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent); +void register_percpu_ce(int cpu); +#endif  #endif /* !(_SPARC_TIMER_H) */ diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h index ef3c3682deb..fce41503400 100644 --- a/arch/sparc/include/asm/timer_64.h +++ b/arch/sparc/include/asm/timer_64.h @@ -23,8 +23,8 @@ struct sparc64_tick_ops {  extern struct sparc64_tick_ops *tick_ops; -extern unsigned long sparc64_get_clock_tick(unsigned int cpu); -extern void __devinit setup_sparc64_timer(void); -extern void __init time_init(void); +unsigned long sparc64_get_clock_tick(unsigned int cpu); +void setup_sparc64_timer(void); +void __init time_init(void);  #endif /* _SPARC64_TIMER_H */ diff --git a/arch/sparc/include/asm/timex_32.h b/arch/sparc/include/asm/timex_32.h index a254750e4c0..b6ccdb0d6f7 100644 --- a/arch/sparc/include/asm/timex_32.h +++ b/arch/sparc/include/asm/timex_32.h @@ -12,5 +12,4 @@  typedef unsigned long cycles_t;  #define get_cycles()	(0) -extern u32 (*do_arch_gettimeoffset)(void);  #endif diff --git a/arch/sparc/include/asm/tlb_64.h b/arch/sparc/include/asm/tlb_64.h index dca406b9b6f..4cb392f75d2 100644 --- a/arch/sparc/include/asm/tlb_64.h +++ b/arch/sparc/include/asm/tlb_64.h @@ -7,105 +7,26 @@  #include <asm/tlbflush.h>  #include <asm/mmu_context.h> -#define TLB_BATCH_NR	192 - -/* - * For UP we don't need to worry about TLB flush - * and page free order so much.. - */  #ifdef CONFIG_SMP -  #define FREE_PTE_NR	506 -  #define tlb_fast_mode(bp) ((bp)->pages_nr == ~0U) -#else -  #define FREE_PTE_NR	1 -  #define tlb_fast_mode(bp) 1 -#endif - -struct mmu_gather { -	struct mm_struct *mm; -	unsigned int pages_nr; -	unsigned int need_flush; -	unsigned int fullmm; -	unsigned int tlb_nr; -	unsigned long vaddrs[TLB_BATCH_NR]; -	struct page *pages[FREE_PTE_NR]; -}; - -DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); - -#ifdef CONFIG_SMP -extern void smp_flush_tlb_pending(struct mm_struct *, +void smp_flush_tlb_pending(struct mm_struct *,  				  unsigned long, unsigned long *);  #endif -extern void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *); -extern void flush_tlb_pending(void); - -static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) -{ -	struct mmu_gather *mp = &get_cpu_var(mmu_gathers); - -	BUG_ON(mp->tlb_nr); - -	mp->mm = mm; -	mp->pages_nr = num_online_cpus() > 1 ? 0U : ~0U; -	mp->fullmm = full_mm_flush; - -	return mp; -} - - -static inline void tlb_flush_mmu(struct mmu_gather *mp) -{ -	if (!mp->fullmm) -		flush_tlb_pending(); -	if (mp->need_flush) { -		free_pages_and_swap_cache(mp->pages, mp->pages_nr); -		mp->pages_nr = 0; -		mp->need_flush = 0; -	} - -} -  #ifdef CONFIG_SMP -extern void smp_flush_tlb_mm(struct mm_struct *mm); +void smp_flush_tlb_mm(struct mm_struct *mm);  #define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm)  #else  #define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT)  #endif -static inline void tlb_finish_mmu(struct mmu_gather *mp, unsigned long start, unsigned long end) -{ -	tlb_flush_mmu(mp); - -	if (mp->fullmm) -		mp->fullmm = 0; +void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *); +void flush_tlb_pending(void); -	/* keep the page table cache within bounds */ -	check_pgt_cache(); - -	put_cpu_var(mmu_gathers); -} - -static inline void tlb_remove_page(struct mmu_gather *mp, struct page *page) -{ -	if (tlb_fast_mode(mp)) { -		free_page_and_swap_cache(page); -		return; -	} -	mp->need_flush = 1; -	mp->pages[mp->pages_nr++] = page; -	if (mp->pages_nr >= FREE_PTE_NR) -		tlb_flush_mmu(mp); -} - -#define tlb_remove_tlb_entry(mp,ptep,addr) do { } while (0) -#define pte_free_tlb(mp, ptepage, addr) pte_free((mp)->mm, ptepage) -#define pmd_free_tlb(mp, pmdp, addr) pmd_free((mp)->mm, pmdp) -#define pud_free_tlb(tlb,pudp, addr) __pud_free_tlb(tlb,pudp,addr) - -#define tlb_migrate_finish(mm)	do { } while (0)  #define tlb_start_vma(tlb, vma) do { } while (0)  #define tlb_end_vma(tlb, vma)	do { } while (0) +#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) +#define tlb_flush(tlb)	flush_tlb_pending() + +#include <asm-generic/tlb.h>  #endif /* _SPARC64_TLB_H */ diff --git a/arch/sparc/include/asm/tlbflush_32.h b/arch/sparc/include/asm/tlbflush_32.h index fe0a71abc9b..a5c4142130f 100644 --- a/arch/sparc/include/asm/tlbflush_32.h +++ b/arch/sparc/include/asm/tlbflush_32.h @@ -1,52 +1,16 @@  #ifndef _SPARC_TLBFLUSH_H  #define _SPARC_TLBFLUSH_H -#include <linux/mm.h> -// #include <asm/processor.h> - -/* - * TLB flushing: - * - *  - flush_tlb() flushes the current mm struct TLBs	XXX Exists? - *  - flush_tlb_all() flushes all processes TLBs - *  - flush_tlb_mm(mm) flushes the specified mm context TLB's - *  - flush_tlb_page(vma, vmaddr) flushes one page - *  - flush_tlb_range(vma, start, end) flushes a range of pages - *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages - */ - -#ifdef CONFIG_SMP - -BTFIXUPDEF_CALL(void, local_flush_tlb_all, void) -BTFIXUPDEF_CALL(void, local_flush_tlb_mm, struct mm_struct *) -BTFIXUPDEF_CALL(void, local_flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long) -BTFIXUPDEF_CALL(void, local_flush_tlb_page, struct vm_area_struct *, unsigned long) - -#define local_flush_tlb_all() BTFIXUP_CALL(local_flush_tlb_all)() -#define local_flush_tlb_mm(mm) BTFIXUP_CALL(local_flush_tlb_mm)(mm) -#define local_flush_tlb_range(vma,start,end) BTFIXUP_CALL(local_flush_tlb_range)(vma,start,end) -#define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr) - -extern void smp_flush_tlb_all(void); -extern void smp_flush_tlb_mm(struct mm_struct *mm); -extern void smp_flush_tlb_range(struct vm_area_struct *vma, -				  unsigned long start, -				  unsigned long end); -extern void smp_flush_tlb_page(struct vm_area_struct *mm, unsigned long page); - -#endif /* CONFIG_SMP */ - -BTFIXUPDEF_CALL(void, flush_tlb_all, void) -BTFIXUPDEF_CALL(void, flush_tlb_mm, struct mm_struct *) -BTFIXUPDEF_CALL(void, flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long) -BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long) - -#define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)() -#define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm) -#define flush_tlb_range(vma,start,end) BTFIXUP_CALL(flush_tlb_range)(vma,start,end) -#define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr) - -// #define flush_tlb() flush_tlb_mm(current->active_mm)	/* XXX Sure? */ +#include <asm/cachetlb_32.h> + +#define flush_tlb_all() \ +	sparc32_cachetlb_ops->tlb_all() +#define flush_tlb_mm(mm) \ +	sparc32_cachetlb_ops->tlb_mm(mm) +#define flush_tlb_range(vma, start, end) \ +	sparc32_cachetlb_ops->tlb_range(vma, start, end) +#define flush_tlb_page(vma, addr) \ +	sparc32_cachetlb_ops->tlb_page(vma, addr)  /*   * This is a kludge, until I know better. --zaitcev XXX diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h index fbb675dbe0c..816d8202fa0 100644 --- a/arch/sparc/include/asm/tlbflush_64.h +++ b/arch/sparc/include/asm/tlbflush_64.h @@ -1,27 +1,50 @@  #ifndef _SPARC64_TLBFLUSH_H  #define _SPARC64_TLBFLUSH_H -#include <linux/mm.h>  #include <asm/mmu_context.h>  /* TSB flush operations. */ -struct mmu_gather; -extern void flush_tsb_kernel_range(unsigned long start, unsigned long end); -extern void flush_tsb_user(struct mmu_gather *mp); + +#define TLB_BATCH_NR	192 + +struct tlb_batch { +	struct mm_struct *mm; +	unsigned long tlb_nr; +	unsigned long active; +	unsigned long vaddrs[TLB_BATCH_NR]; +}; + +void flush_tsb_kernel_range(unsigned long start, unsigned long end); +void flush_tsb_user(struct tlb_batch *tb); +void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr);  /* TLB flush operations. */ -extern void flush_tlb_pending(void); +static inline void flush_tlb_mm(struct mm_struct *mm) +{ +} -#define flush_tlb_range(vma,start,end)	\ -	do { (void)(start); flush_tlb_pending(); } while (0) -#define flush_tlb_page(vma,addr)	flush_tlb_pending() -#define flush_tlb_mm(mm)		flush_tlb_pending() +static inline void flush_tlb_page(struct vm_area_struct *vma, +				  unsigned long vmaddr) +{ +} -/* Local cpu only.  */ -extern void __flush_tlb_all(void); +static inline void flush_tlb_range(struct vm_area_struct *vma, +				   unsigned long start, unsigned long end) +{ +} + +#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE -extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); +void flush_tlb_pending(void); +void arch_enter_lazy_mmu_mode(void); +void arch_leave_lazy_mmu_mode(void); +#define arch_flush_lazy_mmu_mode()      do {} while (0) + +/* Local cpu only.  */ +void __flush_tlb_all(void); +void __flush_tlb_page(unsigned long context, unsigned long vaddr); +void __flush_tlb_kernel_range(unsigned long start, unsigned long end);  #ifndef CONFIG_SMP @@ -30,15 +53,24 @@ do {	flush_tsb_kernel_range(start,end); \  	__flush_tlb_kernel_range(start,end); \  } while (0) +static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr) +{ +	__flush_tlb_page(CTX_HWBITS(mm->context), vaddr); +} +  #else /* CONFIG_SMP */ -extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); +void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); +void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr);  #define flush_tlb_kernel_range(start, end) \  do {	flush_tsb_kernel_range(start,end); \  	smp_flush_tlb_kernel_range(start, end); \  } while (0) +#define global_flush_tlb_page(mm, vaddr) \ +	smp_flush_tlb_page(mm, vaddr) +  #endif /* ! CONFIG_SMP */  #endif /* _SPARC64_TLBFLUSH_H */ diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h index 1c79f32734a..ed8f071132e 100644 --- a/arch/sparc/include/asm/topology_64.h +++ b/arch/sparc/include/asm/topology_64.h @@ -18,7 +18,7 @@ static inline int cpu_to_node(int cpu)  struct pci_bus;  #ifdef CONFIG_PCI -extern int pcibus_to_node(struct pci_bus *pbus); +int pcibus_to_node(struct pci_bus *pbus);  #else  static inline int pcibus_to_node(struct pci_bus *pbus)  { @@ -31,25 +31,6 @@ static inline int pcibus_to_node(struct pci_bus *pbus)  	 cpu_all_mask : \  	 cpumask_of_node(pcibus_to_node(bus))) -#define SD_NODE_INIT (struct sched_domain) {		\ -	.min_interval		= 8,			\ -	.max_interval		= 32,			\ -	.busy_factor		= 32,			\ -	.imbalance_pct		= 125,			\ -	.cache_nice_tries	= 2,			\ -	.busy_idx		= 3,			\ -	.idle_idx		= 2,			\ -	.newidle_idx		= 0, 			\ -	.wake_idx		= 0,			\ -	.forkexec_idx		= 0,			\ -	.flags			= SD_LOAD_BALANCE	\ -				| SD_BALANCE_FORK	\ -				| SD_BALANCE_EXEC	\ -				| SD_SERIALIZE,		\ -	.last_balance		= jiffies,		\ -	.balance_interval	= 1,			\ -} -  #else /* CONFIG_NUMA */  #include <asm-generic/topology.h> @@ -61,10 +42,12 @@ static inline int pcibus_to_node(struct pci_bus *pbus)  #define topology_core_id(cpu)			(cpu_data(cpu).core_id)  #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])  #define topology_thread_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu)) -#define mc_capable()				(sparc64_multi_core) -#define smt_capable()				(sparc64_multi_core)  #endif /* CONFIG_SMP */ -#define cpu_coregroup_mask(cpu)			(&cpu_core_map[cpu]) +extern cpumask_t cpu_core_map[NR_CPUS]; +static inline const struct cpumask *cpu_coregroup_mask(int cpu) +{ +        return &cpu_core_map[cpu]; +}  #endif /* _ASM_SPARC64_TOPOLOGY_H */ diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h index 7e26b2db621..6fd4436d32f 100644 --- a/arch/sparc/include/asm/trap_block.h +++ b/arch/sparc/include/asm/trap_block.h @@ -51,11 +51,11 @@ struct trap_per_cpu {  	unsigned long		__per_cpu_base;  } __attribute__((aligned(64)));  extern struct trap_per_cpu trap_block[NR_CPUS]; -extern void init_cur_cpu_trap(struct thread_info *); -extern void setup_tba(void); +void init_cur_cpu_trap(struct thread_info *); +void setup_tba(void);  extern int ncpus_probed; -extern unsigned long real_hard_smp_processor_id(void); +unsigned long real_hard_smp_processor_id(void);  struct cpuid_patch_entry {  	unsigned int	addr; diff --git a/arch/sparc/include/asm/traps.h b/arch/sparc/include/asm/traps.h index 3aa62dde343..51abcb1f9b3 100644 --- a/arch/sparc/include/asm/traps.h +++ b/arch/sparc/include/asm/traps.h @@ -3,14 +3,12 @@   *   * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)   */ -  #ifndef _SPARC_TRAPS_H  #define _SPARC_TRAPS_H -#define NUM_SPARC_TRAPS  255 +#include <uapi/asm/traps.h>  #ifndef __ASSEMBLY__ -#ifdef __KERNEL__  /* This is for V8 compliant Sparc CPUS */  struct tt_entry {  	unsigned long inst_one; @@ -22,112 +20,5 @@ struct tt_entry {  /* We set this to _start in system setup. */  extern struct tt_entry *sparc_ttable; -#endif /* (__KERNEL__) */  #endif /* !(__ASSEMBLY__) */ - -/* For patching the trap table at boot time, we need to know how to - * form various common Sparc instructions.  Thus these macros... - */ - -#define SPARC_MOV_CONST_L3(const) (0xa6102000 | (const&0xfff)) - -/* The following assumes that the branch lies before the place we - * are branching to.  This is the case for a trap vector... - * You have been warned. - */ -#define SPARC_BRANCH(dest_addr, inst_addr) \ -          (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff)) - -#define SPARC_RD_PSR_L0  (0xa1480000) -#define SPARC_RD_WIM_L3  (0xa7500000) -#define SPARC_NOP (0x01000000) - -/* Various interesting trap levels. */ -/* First, hardware traps. */ -#define SP_TRAP_TFLT    0x1          /* Text fault */ -#define SP_TRAP_II      0x2          /* Illegal Instruction */ -#define SP_TRAP_PI      0x3          /* Privileged Instruction */ -#define SP_TRAP_FPD     0x4          /* Floating Point Disabled */ -#define SP_TRAP_WOVF    0x5          /* Window Overflow */ -#define SP_TRAP_WUNF    0x6          /* Window Underflow */ -#define SP_TRAP_MNA     0x7          /* Memory Address Unaligned */ -#define SP_TRAP_FPE     0x8          /* Floating Point Exception */ -#define SP_TRAP_DFLT    0x9          /* Data Fault */ -#define SP_TRAP_TOF     0xa          /* Tag Overflow */ -#define SP_TRAP_WDOG    0xb          /* Watchpoint Detected */ -#define SP_TRAP_IRQ1    0x11         /* IRQ level 1 */ -#define SP_TRAP_IRQ2    0x12         /* IRQ level 2 */ -#define SP_TRAP_IRQ3    0x13         /* IRQ level 3 */ -#define SP_TRAP_IRQ4    0x14         /* IRQ level 4 */ -#define SP_TRAP_IRQ5    0x15         /* IRQ level 5 */ -#define SP_TRAP_IRQ6    0x16         /* IRQ level 6 */ -#define SP_TRAP_IRQ7    0x17         /* IRQ level 7 */ -#define SP_TRAP_IRQ8    0x18         /* IRQ level 8 */ -#define SP_TRAP_IRQ9    0x19         /* IRQ level 9 */ -#define SP_TRAP_IRQ10   0x1a         /* IRQ level 10 */ -#define SP_TRAP_IRQ11   0x1b         /* IRQ level 11 */ -#define SP_TRAP_IRQ12   0x1c         /* IRQ level 12 */ -#define SP_TRAP_IRQ13   0x1d         /* IRQ level 13 */ -#define SP_TRAP_IRQ14   0x1e         /* IRQ level 14 */ -#define SP_TRAP_IRQ15   0x1f         /* IRQ level 15 Non-maskable */ -#define SP_TRAP_RACC    0x20         /* Register Access Error ??? */ -#define SP_TRAP_IACC    0x21         /* Instruction Access Error */ -#define SP_TRAP_CPDIS   0x24         /* Co-Processor Disabled */ -#define SP_TRAP_BADFL   0x25         /* Unimplemented Flush Instruction */ -#define SP_TRAP_CPEXP   0x28         /* Co-Processor Exception */ -#define SP_TRAP_DACC    0x29         /* Data Access Error */ -#define SP_TRAP_DIVZ    0x2a         /* Divide By Zero */ -#define SP_TRAP_DSTORE  0x2b         /* Data Store Error ??? */ -#define SP_TRAP_DMM     0x2c         /* Data Access MMU Miss ??? */ -#define SP_TRAP_IMM     0x3c         /* Instruction Access MMU Miss ??? */ - -/* Now the Software Traps... */ -#define SP_TRAP_SUNOS   0x80         /* SunOS System Call */ -#define SP_TRAP_SBPT    0x81         /* Software Breakpoint */ -#define SP_TRAP_SDIVZ   0x82         /* Software Divide-by-Zero trap */ -#define SP_TRAP_FWIN    0x83         /* Flush Windows */ -#define SP_TRAP_CWIN    0x84         /* Clean Windows */ -#define SP_TRAP_RCHK    0x85         /* Range Check */ -#define SP_TRAP_FUNA    0x86         /* Fix Unaligned Access */ -#define SP_TRAP_IOWFL   0x87         /* Integer Overflow */ -#define SP_TRAP_SOLARIS 0x88         /* Solaris System Call */ -#define SP_TRAP_NETBSD  0x89         /* NetBSD System Call */ -#define SP_TRAP_LINUX   0x90         /* Linux System Call */ - -/* Names used for compatibility with SunOS */ -#define ST_SYSCALL              0x00 -#define ST_BREAKPOINT           0x01 -#define ST_DIV0                 0x02 -#define ST_FLUSH_WINDOWS        0x03 -#define ST_CLEAN_WINDOWS        0x04 -#define ST_RANGE_CHECK          0x05 -#define ST_FIX_ALIGN            0x06 -#define ST_INT_OVERFLOW         0x07 - -/* Special traps... */ -#define SP_TRAP_KBPT1   0xfe         /* KADB/PROM Breakpoint one */ -#define SP_TRAP_KBPT2   0xff         /* KADB/PROM Breakpoint two */ - -/* Handy Macros */ -/* Is this a trap we never expect to get? */ -#define BAD_TRAP_P(level) \ -        ((level > SP_TRAP_WDOG && level < SP_TRAP_IRQ1) || \ -	 (level > SP_TRAP_IACC && level < SP_TRAP_CPDIS) || \ -	 (level > SP_TRAP_BADFL && level < SP_TRAP_CPEXP) || \ -	 (level > SP_TRAP_DMM && level < SP_TRAP_IMM) || \ -	 (level > SP_TRAP_IMM && level < SP_TRAP_SUNOS) || \ -	 (level > SP_TRAP_LINUX && level < SP_TRAP_KBPT1)) - -/* Is this a Hardware trap? */ -#define HW_TRAP_P(level) ((level > 0) && (level < SP_TRAP_SUNOS)) - -/* Is this a Software trap? */ -#define SW_TRAP_P(level) ((level >= SP_TRAP_SUNOS) && (level <= SP_TRAP_KBPT2)) - -/* Is this a system call for some OS we know about? */ -#define SCALL_TRAP_P(level) ((level == SP_TRAP_SUNOS) || \ -			     (level == SP_TRAP_SOLARIS) || \ -			     (level == SP_TRAP_NETBSD) || \ -			     (level == SP_TRAP_LINUX)) -  #endif /* !(_SPARC_TRAPS_H) */ diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h index 83c571d8c8a..90916f955ca 100644 --- a/arch/sparc/include/asm/tsb.h +++ b/arch/sparc/include/asm/tsb.h @@ -133,29 +133,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;  	sub	TSB, 0x8, TSB;   \  	TSB_STORE(TSB, TAG); -#define KTSB_LOAD_QUAD(TSB, REG) \ -	ldda		[TSB] ASI_NUCLEUS_QUAD_LDD, REG; - -#define KTSB_STORE(ADDR, VAL) \ -	stxa		VAL, [ADDR] ASI_N; - -#define KTSB_LOCK_TAG(TSB, REG1, REG2)	\ -99:	lduwa	[TSB] ASI_N, REG1;	\ -	sethi	%hi(TSB_TAG_LOCK_HIGH), REG2;\ -	andcc	REG1, REG2, %g0;	\ -	bne,pn	%icc, 99b;		\ -	 nop;				\ -	casa	[TSB] ASI_N, REG1, REG2;\ -	cmp	REG1, REG2;		\ -	bne,pn	%icc, 99b;		\ -	 nop;				\ - -#define KTSB_WRITE(TSB, TTE, TAG) \ -	add	TSB, 0x8, TSB;   \ -	stxa	TTE, [TSB] ASI_N;     \ -	sub	TSB, 0x8, TSB;   \ -	stxa	TAG, [TSB] ASI_N; -  	/* Do a kernel page table walk.  Leaves physical PTE pointer in  	 * REG1.  Jumps to FAIL_LABEL on early page table walk termination.  	 * VADDR will not be clobbered, but REG2 will. @@ -165,45 +142,75 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;  	or		REG1, %lo(swapper_pg_dir), REG1; \  	sllx		VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \  	srlx		REG2, 64 - PAGE_SHIFT, REG2; \ -	andn		REG2, 0x3, REG2; \ -	lduw		[REG1 + REG2], REG1; \ +	andn		REG2, 0x7, REG2; \ +	ldx		[REG1 + REG2], REG1; \  	brz,pn		REG1, FAIL_LABEL; \  	 sllx		VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \  	srlx		REG2, 64 - PAGE_SHIFT, REG2; \ -	sllx		REG1, 11, REG1; \ -	andn		REG2, 0x3, REG2; \ -	lduwa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ +	andn		REG2, 0x7, REG2; \ +	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \  	brz,pn		REG1, FAIL_LABEL; \  	 sllx		VADDR, 64 - PMD_SHIFT, REG2; \  	srlx		REG2, 64 - PAGE_SHIFT, REG2; \ -	sllx		REG1, 11, REG1; \  	andn		REG2, 0x7, REG2; \  	add		REG1, REG2, REG1; -	/* Do a user page table walk in MMU globals.  Leaves physical PTE -	 * pointer in REG1.  Jumps to FAIL_LABEL on early page table walk -	 * termination.  Physical base of page tables is in PHYS_PGD which -	 * will not be modified. +	/* PMD has been loaded into REG1, interpret the value, seeing +	 * if it is a HUGE PMD or a normal one.  If it is not valid +	 * then jump to FAIL_LABEL.  If it is a HUGE PMD, and it +	 * translates to a valid PTE, branch to PTE_LABEL. +	 * +	 * We have to propagate the 4MB bit of the virtual address +	 * because we are fabricating 8MB pages using 4MB hw pages. +	 */ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \ +	brz,pn		REG1, FAIL_LABEL;		\ +	 sethi		%uhi(_PAGE_PMD_HUGE), REG2;	\ +	sllx		REG2, 32, REG2;			\ +	andcc		REG1, REG2, %g0;		\ +	be,pt		%xcc, 700f;			\ +	 sethi		%hi(4 * 1024 * 1024), REG2;	\ +	brgez,pn	REG1, FAIL_LABEL;		\ +	 andn		REG1, REG2, REG1;		\ +	and		VADDR, REG2, REG2;		\ +	brlz,pt		REG1, PTE_LABEL;		\ +	 or		REG1, REG2, REG1;		\ +700: +#else +#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \ +	brz,pn		REG1, FAIL_LABEL; \ +	 nop; +#endif + +	/* Do a user page table walk in MMU globals.  Leaves final, +	 * valid, PTE value in REG1.  Jumps to FAIL_LABEL on early +	 * page table walk termination or if the PTE is not valid. +	 * +	 * Physical base of page tables is in PHYS_PGD which will not +	 * be modified.  	 *  	 * VADDR will not be clobbered, but REG1 and REG2 will.  	 */  #define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL)	\  	sllx		VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \  	srlx		REG2, 64 - PAGE_SHIFT, REG2; \ -	andn		REG2, 0x3, REG2; \ -	lduwa		[PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \ +	andn		REG2, 0x7, REG2; \ +	ldxa		[PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \  	brz,pn		REG1, FAIL_LABEL; \  	 sllx		VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \  	srlx		REG2, 64 - PAGE_SHIFT, REG2; \ -	sllx		REG1, 11, REG1; \ -	andn		REG2, 0x3, REG2; \ -	lduwa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ -	brz,pn		REG1, FAIL_LABEL; \ -	 sllx		VADDR, 64 - PMD_SHIFT, REG2; \ +	andn		REG2, 0x7, REG2; \ +	ldxa		[REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ +	USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, 800f) \ +	sllx		VADDR, 64 - PMD_SHIFT, REG2; \  	srlx		REG2, 64 - PAGE_SHIFT, REG2; \ -	sllx		REG1, 11, REG1; \  	andn		REG2, 0x7, REG2; \ -	add		REG1, REG2, REG1; +	add		REG1, REG2, REG1; \ +	ldxa		[REG1] ASI_PHYS_USE_EC, REG1; \ +	brgez,pn	REG1, FAIL_LABEL; \ +	 nop; \ +800:  /* Lookup a OBP mapping on VADDR in the prom_trans[] table at TL>0.   * If no entry is found, FAIL_LABEL will be branched to.  On success @@ -239,6 +246,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;  	(KERNEL_TSB_SIZE_BYTES / 16)  #define KERNEL_TSB4M_NENTRIES	4096 +#define KTSB_PHYS_SHIFT		15 +  	/* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL  	 * on TSB hit.  REG1, REG2, REG3, and REG4 are used as temporaries  	 * and the found TTE will be left in REG1.  REG3 and REG4 must @@ -247,13 +256,22 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;  	 * VADDR and TAG will be preserved and not clobbered by this macro.  	 */  #define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ -	sethi		%hi(swapper_tsb), REG1; \ +661:	sethi		%hi(swapper_tsb), REG1;			\  	or		REG1, %lo(swapper_tsb), REG1; \ +	.section	.swapper_tsb_phys_patch, "ax"; \ +	.word		661b; \ +	.previous; \ +661:	nop; \ +	.section	.tsb_ldquad_phys_patch, "ax"; \ +	.word		661b; \ +	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \ +	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \ +	.previous; \  	srlx		VADDR, PAGE_SHIFT, REG2; \  	and		REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \  	sllx		REG2, 4, REG2; \  	add		REG1, REG2, REG2; \ -	KTSB_LOAD_QUAD(REG2, REG3); \ +	TSB_LOAD_QUAD(REG2, REG3); \  	cmp		REG3, TAG; \  	be,a,pt		%xcc, OK_LABEL; \  	 mov		REG4, REG1; @@ -263,12 +281,21 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;  	 * we can make use of that for the index computation.  	 */  #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ -	sethi		%hi(swapper_4m_tsb), REG1; \ +661:	sethi		%hi(swapper_4m_tsb), REG1;	     \  	or		REG1, %lo(swapper_4m_tsb), REG1; \ +	.section	.swapper_4m_tsb_phys_patch, "ax"; \ +	.word		661b; \ +	.previous; \ +661:	nop; \ +	.section	.tsb_ldquad_phys_patch, "ax"; \ +	.word		661b; \ +	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \ +	sllx		REG1, KTSB_PHYS_SHIFT, REG1; \ +	.previous; \  	and		TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \  	sllx		REG2, 4, REG2; \  	add		REG1, REG2, REG2; \ -	KTSB_LOAD_QUAD(REG2, REG3); \ +	TSB_LOAD_QUAD(REG2, REG3); \  	cmp		REG3, TAG; \  	be,a,pt		%xcc, OK_LABEL; \  	 mov		REG4, REG1; diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h index 48f2807d326..71b5a67522a 100644 --- a/arch/sparc/include/asm/ttable.h +++ b/arch/sparc/include/asm/ttable.h @@ -372,7 +372,9 @@ etrap_spill_fixup_64bit:				\  /* Normal 32bit spill */  #define SPILL_2_GENERIC(ASI)				\ -	srl	%sp, 0, %sp;				\ +	and	%sp, 1, %g3;				\ +	brnz,pn	%g3, (. - (128 + 4));			\ +	 srl	%sp, 0, %sp;				\  	stwa	%l0, [%sp + %g0] ASI;			\  	mov	0x04, %g3;				\  	stwa	%l1, [%sp + %g3] ASI;			\ @@ -398,14 +400,16 @@ etrap_spill_fixup_64bit:				\  	stwa	%i6, [%g1 + %g0] ASI;			\  	stwa	%i7, [%g1 + %g3] ASI;			\  	saved;						\ -        retry; nop; nop;				\ +        retry;						\  	b,a,pt	%xcc, spill_fixup_dax;			\  	b,a,pt	%xcc, spill_fixup_mna;			\  	b,a,pt	%xcc, spill_fixup;  #define SPILL_2_GENERIC_ETRAP		\  etrap_user_spill_32bit:			\ -	srl	%sp, 0, %sp;		\ +	and	%sp, 1, %g3;		\ +	brnz,pn	%g3, etrap_user_spill_64bit;	\ +	 srl	%sp, 0, %sp;		\  	stwa	%l0, [%sp + 0x00] %asi;	\  	stwa	%l1, [%sp + 0x04] %asi;	\  	stwa	%l2, [%sp + 0x08] %asi;	\ @@ -427,7 +431,7 @@ etrap_user_spill_32bit:			\  	ba,pt	%xcc, etrap_save;	\  	 wrpr	%g1, %cwp;		\  	nop; nop; nop; nop;		\ -	nop; nop; nop; nop;		\ +	nop; nop;			\  	ba,a,pt	%xcc, etrap_spill_fixup_32bit; \  	ba,a,pt	%xcc, etrap_spill_fixup_32bit; \  	ba,a,pt	%xcc, etrap_spill_fixup_32bit; @@ -592,7 +596,9 @@ user_rtt_fill_64bit:					\  /* Normal 32bit fill */  #define FILL_2_GENERIC(ASI)				\ -	srl	%sp, 0, %sp;				\ +	and	%sp, 1, %g3;				\ +	brnz,pn	%g3, (. - (128 + 4));			\ +	 srl	%sp, 0, %sp;				\  	lduwa	[%sp + %g0] ASI, %l0;			\  	mov	0x04, %g2;				\  	mov	0x08, %g3;				\ @@ -616,14 +622,16 @@ user_rtt_fill_64bit:					\  	lduwa	[%g1 + %g3] ASI, %i6;			\  	lduwa	[%g1 + %g5] ASI, %i7;			\  	restored;					\ -	retry; nop; nop; nop; nop;			\ +	retry; nop; nop;				\  	b,a,pt	%xcc, fill_fixup_dax;			\  	b,a,pt	%xcc, fill_fixup_mna;			\  	b,a,pt	%xcc, fill_fixup;  #define FILL_2_GENERIC_RTRAP				\  user_rtt_fill_32bit:					\ -	srl	%sp, 0, %sp;				\ +	and	%sp, 1, %g3;				\ +	brnz,pn	%g3, user_rtt_fill_64bit;		\ +	 srl	%sp, 0, %sp;				\  	lduwa	[%sp + 0x00] %asi, %l0;			\  	lduwa	[%sp + 0x04] %asi, %l1;			\  	lduwa	[%sp + 0x08] %asi, %l2;			\ @@ -643,7 +651,7 @@ user_rtt_fill_32bit:					\  	ba,pt	%xcc, user_rtt_pre_restore;		\  	 restored;					\  	nop; nop; nop; nop; nop;			\ -	nop; nop; nop; nop; nop;			\ +	nop; nop; nop;					\  	ba,a,pt	%xcc, user_rtt_fill_fixup;		\  	ba,a,pt	%xcc, user_rtt_fill_fixup;		\  	ba,a,pt	%xcc, user_rtt_fill_fixup; diff --git a/arch/sparc/include/asm/types.h b/arch/sparc/include/asm/types.h deleted file mode 100644 index 09c79a9c851..00000000000 --- a/arch/sparc/include/asm/types.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _SPARC_TYPES_H -#define _SPARC_TYPES_H -/* - * This file is never included by application software unless - * explicitly requested (e.g., via linux/types.h) in which case the - * application is Linux specific so (user-) name space pollution is - * not a major issue.  However, for interoperability, libraries still - * need to be careful to avoid a name clashes. - */ - -#if defined(__sparc__) - -#include <asm-generic/int-ll64.h> - -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t; - -#endif /* __ASSEMBLY__ */ - -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ - -/* Dma addresses come in generic and 64-bit flavours.  */ - -typedef u32 dma_addr_t; - -#if defined(__arch64__) - -/*** SPARC 64 bit ***/ -typedef u64 dma64_addr_t; -#else -/*** SPARC 32 bit ***/ -typedef u32 dma64_addr_t; - -#endif /* defined(__arch64__) */ - -#endif /* __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ - -#endif /* defined(__sparc__) */ - -#endif /* defined(_SPARC_TYPES_H) */ diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h index e88fbe5c045..bd56c28fff9 100644 --- a/arch/sparc/include/asm/uaccess.h +++ b/arch/sparc/include/asm/uaccess.h @@ -5,4 +5,10 @@  #else  #include <asm/uaccess_32.h>  #endif + +#define user_addr_max() \ +	(segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) + +long strncpy_from_user(char *dest, const char __user *src, long count); +  #endif diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index 8303ac48103..9634d086fc5 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h @@ -12,11 +12,12 @@  #include <linux/sched.h>  #include <linux/string.h>  #include <linux/errno.h> -#include <asm/vac-ops.h>  #endif  #ifndef __ASSEMBLY__ +#include <asm/processor.h> +  #define ARCH_HAS_SORT_EXTABLE  #define ARCH_HAS_SEARCH_EXTABLE @@ -77,9 +78,9 @@ struct exception_table_entry  };  /* Returns 0 if exception not found and fixup otherwise.  */ -extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2); +unsigned long search_extables_range(unsigned long addr, unsigned long *g2); -extern void __ret_efault(void); +void __ret_efault(void);  /* Uh, these should become the main single-value transfer routines..   * They automatically use the right size if we just have the right @@ -151,7 +152,7 @@ __asm__ __volatile__(							\         : "=&r" (ret) : "r" (x), "m" (*__m(addr)),			\  	 "i" (-EFAULT)) -extern int __put_user_bad(void); +int __put_user_bad(void);  #define __get_user_check(x,addr,size,type) ({ \  register int __gu_ret; \ @@ -243,9 +244,9 @@ __asm__ __volatile__(							\  	".previous\n\t"							\         : "=&r" (x) : "m" (*__m(addr)), "i" (retval)) -extern int __get_user_bad(void); +int __get_user_bad(void); -extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); +unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);  static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)  { @@ -305,34 +306,8 @@ static inline unsigned long clear_user(void __user *addr, unsigned long n)  		return n;  } -extern long __strncpy_from_user(char *dest, const char __user *src, long count); - -static inline long strncpy_from_user(char *dest, const char __user *src, long count) -{ -	if (__access_ok((unsigned long) src, count)) -		return __strncpy_from_user(dest, src, count); -	else -		return -EFAULT; -} - -extern long __strlen_user(const char __user *); -extern long __strnlen_user(const char __user *, long len); - -static inline long strlen_user(const char __user *str) -{ -	if (!access_ok(VERIFY_READ, str, 0)) -		return 0; -	else -		return __strlen_user(str); -} - -static inline long strnlen_user(const char __user *str, long len) -{ -	if (!access_ok(VERIFY_READ, str, 0)) -		return 0; -	else -		return __strnlen_user(str, len); -} +__must_check long strlen_user(const char __user *str); +__must_check long strnlen_user(const char __user *str, long n);  #endif  /* __ASSEMBLY__ */ diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index 3e1449f0779..c990a5e577f 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h @@ -11,13 +11,14 @@  #include <linux/string.h>  #include <linux/thread_info.h>  #include <asm/asi.h> -#include <asm/system.h>  #include <asm/spitfire.h>  #include <asm-generic/uaccess-unaligned.h>  #endif  #ifndef __ASSEMBLY__ +#include <asm/processor.h> +  /*   * Sparc64 is segmented, though more like the M68K than the I386.   * We use the secondary ASI to address user memory, which references a @@ -37,14 +38,14 @@  #define VERIFY_READ	0  #define VERIFY_WRITE	1 -#define get_fs() ((mm_segment_t) { get_thread_current_ds() }) +#define get_fs() ((mm_segment_t){(current_thread_info()->current_ds)})  #define get_ds() (KERNEL_DS)  #define segment_eq(a,b)  ((a).seg == (b).seg)  #define set_fs(val)								\  do {										\ -	set_thread_current_ds((val).seg);					\ +	current_thread_info()->current_ds =(val).seg;				\  	__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg));	\  } while(0) @@ -75,8 +76,8 @@ struct exception_table_entry {          unsigned int insn, fixup;  }; -extern void __ret_efault(void); -extern void __retl_efault(void); +void __ret_efault(void); +void __retl_efault(void);  /* Uh, these should become the main single-value transfer routines..   * They automatically use the right size if we just have the right @@ -133,7 +134,7 @@ __asm__ __volatile__(							\         : "=r" (ret) : "r" (x), "r" (__m(addr)),				\  	 "i" (-EFAULT)) -extern int __put_user_bad(void); +int __put_user_bad(void);  #define __get_user_nocheck(data,addr,size,type) ({ \  register int __gu_ret; \ @@ -203,13 +204,13 @@ __asm__ __volatile__(							\  	".previous\n\t"							\         : "=r" (x) : "r" (__m(addr)), "i" (retval)) -extern int __get_user_bad(void); +int __get_user_bad(void); -extern unsigned long __must_check ___copy_from_user(void *to, -						    const void __user *from, -						    unsigned long size); -extern unsigned long copy_from_user_fixup(void *to, const void __user *from, -					  unsigned long size); +unsigned long __must_check ___copy_from_user(void *to, +					     const void __user *from, +					     unsigned long size); +unsigned long copy_from_user_fixup(void *to, const void __user *from, +				   unsigned long size);  static inline unsigned long __must_check  copy_from_user(void *to, const void __user *from, unsigned long size)  { @@ -222,11 +223,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size)  }  #define __copy_from_user copy_from_user -extern unsigned long __must_check ___copy_to_user(void __user *to, -						  const void *from, -						  unsigned long size); -extern unsigned long copy_to_user_fixup(void __user *to, const void *from, -					unsigned long size); +unsigned long __must_check ___copy_to_user(void __user *to, +					   const void *from, +					   unsigned long size); +unsigned long copy_to_user_fixup(void __user *to, const void *from, +				 unsigned long size);  static inline unsigned long __must_check  copy_to_user(void __user *to, const void *from, unsigned long size)  { @@ -238,11 +239,11 @@ copy_to_user(void __user *to, const void *from, unsigned long size)  }  #define __copy_to_user copy_to_user -extern unsigned long __must_check ___copy_in_user(void __user *to, -						  const void __user *from, -						  unsigned long size); -extern unsigned long copy_in_user_fixup(void __user *to, void __user *from, -					unsigned long size); +unsigned long __must_check ___copy_in_user(void __user *to, +					   const void __user *from, +					   unsigned long size); +unsigned long copy_in_user_fixup(void __user *to, void __user *from, +				 unsigned long size);  static inline unsigned long __must_check  copy_in_user(void __user *to, void __user *from, unsigned long size)  { @@ -254,21 +255,20 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)  }  #define __copy_in_user copy_in_user -extern unsigned long __must_check __clear_user(void __user *, unsigned long); +unsigned long __must_check __clear_user(void __user *, unsigned long);  #define clear_user __clear_user -extern long __must_check __strncpy_from_user(char *dest, const char __user *src, long count); - -#define strncpy_from_user __strncpy_from_user +__must_check long strlen_user(const char __user *str); +__must_check long strnlen_user(const char __user *str, long n); -extern long __strlen_user(const char __user *); -extern long __strnlen_user(const char __user *, long len); +#define __copy_to_user_inatomic __copy_to_user +#define __copy_from_user_inatomic __copy_from_user -#define strlen_user __strlen_user -#define strnlen_user __strnlen_user -#define __copy_to_user_inatomic ___copy_to_user -#define __copy_from_user_inatomic ___copy_from_user +struct pt_regs; +unsigned long compute_effective_address(struct pt_regs *, +					unsigned int insn, +					unsigned int rd);  #endif  /* __ASSEMBLY__ */ diff --git a/arch/sparc/include/asm/uctx.h b/arch/sparc/include/asm/uctx.h deleted file mode 100644 index dc937c75ffd..00000000000 --- a/arch/sparc/include/asm/uctx.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * uctx.h: Sparc64 {set,get}context() register state layouts. - * - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef __SPARC64_UCTX_H -#define __SPARC64_UCTX_H - -#define MC_TSTATE	0 -#define MC_PC		1 -#define MC_NPC		2 -#define MC_Y		3 -#define MC_G1		4 -#define MC_G2		5 -#define MC_G3		6 -#define MC_G4		7 -#define MC_G5		8 -#define MC_G6		9 -#define MC_G7		10 -#define MC_O0		11 -#define MC_O1		12 -#define MC_O2		13 -#define MC_O3		14 -#define MC_O4		15 -#define MC_O5		16 -#define MC_O6		17 -#define MC_O7		18 -#define MC_NGREG	19 - -typedef unsigned long mc_greg_t; -typedef mc_greg_t mc_gregset_t[MC_NGREG]; - -#define MC_MAXFPQ	16 -struct mc_fq { -	unsigned long	*mcfq_addr; -	unsigned int	mcfq_insn; -}; - -struct mc_fpu { -	union { -		unsigned int	sregs[32]; -		unsigned long	dregs[32]; -		long double	qregs[16]; -	} mcfpu_fregs; -	unsigned long	mcfpu_fsr; -	unsigned long	mcfpu_fprs; -	unsigned long	mcfpu_gsr; -	struct mc_fq	*mcfpu_fq; -	unsigned char	mcfpu_qcnt; -	unsigned char	mcfpu_qentsz; -	unsigned char	mcfpu_enab; -}; -typedef struct mc_fpu mc_fpu_t; - -typedef struct { -	mc_gregset_t	mc_gregs; -	mc_greg_t	mc_fp; -	mc_greg_t	mc_i7; -	mc_fpu_t	mc_fpregs; -} mcontext_t; - -struct ucontext { -	struct ucontext		*uc_link; -	unsigned long		uc_flags; -	sigset_t		uc_sigmask; -	mcontext_t		uc_mcontext; -}; -typedef struct ucontext ucontext_t; - -#endif /* __SPARC64_UCTX_H */ diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 03eb5a8f6f9..0aac1e8f296 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h @@ -1,6 +1,3 @@ -#ifndef _SPARC_UNISTD_H -#define _SPARC_UNISTD_H -  /*   * System calls under the Sparc.   * @@ -14,414 +11,20 @@   *   * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)   */ -#ifndef __32bit_syscall_numbers__ -#ifndef __arch64__ -#define __32bit_syscall_numbers__ -#endif -#endif +#ifndef _SPARC_UNISTD_H +#define _SPARC_UNISTD_H + +#include <uapi/asm/unistd.h> -#define __NR_restart_syscall      0 /* Linux Specific				   */ -#define __NR_exit                 1 /* Common                                      */ -#define __NR_fork                 2 /* Common                                      */ -#define __NR_read                 3 /* Common                                      */ -#define __NR_write                4 /* Common                                      */ -#define __NR_open                 5 /* Common                                      */ -#define __NR_close                6 /* Common                                      */ -#define __NR_wait4                7 /* Common                                      */ -#define __NR_creat                8 /* Common                                      */ -#define __NR_link                 9 /* Common                                      */ -#define __NR_unlink              10 /* Common                                      */ -#define __NR_execv               11 /* SunOS Specific                              */ -#define __NR_chdir               12 /* Common                                      */ -#define __NR_chown		 13 /* Common					   */ -#define __NR_mknod               14 /* Common                                      */ -#define __NR_chmod               15 /* Common                                      */ -#define __NR_lchown              16 /* Common                                      */ -#define __NR_brk                 17 /* Common                                      */ -#define __NR_perfctr             18 /* Performance counter operations              */ -#define __NR_lseek               19 /* Common                                      */ -#define __NR_getpid              20 /* Common                                      */ -#define __NR_capget		 21 /* Linux Specific				   */ -#define __NR_capset		 22 /* Linux Specific				   */ -#define __NR_setuid              23 /* Implemented via setreuid in SunOS           */ -#define __NR_getuid              24 /* Common                                      */ -#define __NR_vmsplice	         25 /* ENOSYS under SunOS			   */ -#define __NR_ptrace              26 /* Common                                      */ -#define __NR_alarm               27 /* Implemented via setitimer in SunOS          */ -#define __NR_sigaltstack	 28 /* Common					   */ -#define __NR_pause               29 /* Is sigblock(0)->sigpause() in SunOS         */ -#define __NR_utime               30 /* Implemented via utimes() under SunOS        */ -#ifdef __32bit_syscall_numbers__ -#define __NR_lchown32            31 /* Linux sparc32 specific                      */ -#define __NR_fchown32            32 /* Linux sparc32 specific                      */ -#endif -#define __NR_access              33 /* Common                                      */ -#define __NR_nice                34 /* Implemented via get/setpriority() in SunOS  */ -#ifdef __32bit_syscall_numbers__ -#define __NR_chown32             35 /* Linux sparc32 specific                      */ -#endif -#define __NR_sync                36 /* Common                                      */ -#define __NR_kill                37 /* Common                                      */ -#define __NR_stat                38 /* Common                                      */ -#define __NR_sendfile		 39 /* Linux Specific				   */ -#define __NR_lstat               40 /* Common                                      */ -#define __NR_dup                 41 /* Common                                      */ -#define __NR_pipe                42 /* Common                                      */ -#define __NR_times               43 /* Implemented via getrusage() in SunOS        */ -#ifdef __32bit_syscall_numbers__ -#define __NR_getuid32            44 /* Linux sparc32 specific                      */ -#endif -#define __NR_umount2             45 /* Linux Specific                              */ -#define __NR_setgid              46 /* Implemented via setregid() in SunOS         */ -#define __NR_getgid              47 /* Common                                      */ -#define __NR_signal              48 /* Implemented via sigvec() in SunOS           */ -#define __NR_geteuid             49 /* SunOS calls getuid()                        */ -#define __NR_getegid             50 /* SunOS calls getgid()                        */ -#define __NR_acct                51 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_getgid32            53 /* Linux sparc32 specific                      */ -#else -#define __NR_memory_ordering	 52 /* Linux Specific				   */ -#endif -#define __NR_ioctl               54 /* Common                                      */ -#define __NR_reboot              55 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_mmap2		 56 /* Linux sparc32 Specific			   */ -#endif -#define __NR_symlink             57 /* Common                                      */ -#define __NR_readlink            58 /* Common                                      */ -#define __NR_execve              59 /* Common                                      */ -#define __NR_umask               60 /* Common                                      */ -#define __NR_chroot              61 /* Common                                      */ -#define __NR_fstat               62 /* Common                                      */ -#define __NR_fstat64		 63 /* Linux Specific			           */ -#define __NR_getpagesize         64 /* Common                                      */ -#define __NR_msync               65 /* Common in newer 1.3.x revs...               */ -#define __NR_vfork               66 /* Common                                      */ -#define __NR_pread64             67 /* Linux Specific                              */ -#define __NR_pwrite64            68 /* Linux Specific                              */ -#ifdef __32bit_syscall_numbers__ -#define __NR_geteuid32           69 /* Linux sparc32, sbrk under SunOS             */ -#define __NR_getegid32           70 /* Linux sparc32, sstk under SunOS             */ -#endif -#define __NR_mmap                71 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setreuid32          72 /* Linux sparc32, vadvise under SunOS          */ -#endif -#define __NR_munmap              73 /* Common                                      */ -#define __NR_mprotect            74 /* Common                                      */ -#define __NR_madvise             75 /* Common                                      */ -#define __NR_vhangup             76 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_truncate64		 77 /* Linux sparc32 Specific			   */ -#endif -#define __NR_mincore             78 /* Common                                      */ -#define __NR_getgroups           79 /* Common                                      */ -#define __NR_setgroups           80 /* Common                                      */ -#define __NR_getpgrp             81 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setgroups32         82 /* Linux sparc32, setpgrp under SunOS          */ -#endif -#define __NR_setitimer           83 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_ftruncate64	 84 /* Linux sparc32 Specific			   */ -#endif -#define __NR_swapon              85 /* Common                                      */ -#define __NR_getitimer           86 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setuid32            87 /* Linux sparc32, gethostname under SunOS      */ -#endif -#define __NR_sethostname         88 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setgid32            89 /* Linux sparc32, getdtablesize under SunOS    */ -#endif -#define __NR_dup2                90 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setfsuid32          91 /* Linux sparc32, getdopt under SunOS          */ -#endif -#define __NR_fcntl               92 /* Common                                      */ -#define __NR_select              93 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setfsgid32          94 /* Linux sparc32, setdopt under SunOS          */ -#endif -#define __NR_fsync               95 /* Common                                      */ -#define __NR_setpriority         96 /* Common                                      */ -#define __NR_socket              97 /* Common                                      */ -#define __NR_connect             98 /* Common                                      */ -#define __NR_accept              99 /* Common                                      */ -#define __NR_getpriority        100 /* Common                                      */ -#define __NR_rt_sigreturn       101 /* Linux Specific                              */ -#define __NR_rt_sigaction       102 /* Linux Specific                              */ -#define __NR_rt_sigprocmask     103 /* Linux Specific                              */ -#define __NR_rt_sigpending      104 /* Linux Specific                              */ -#define __NR_rt_sigtimedwait    105 /* Linux Specific                              */ -#define __NR_rt_sigqueueinfo    106 /* Linux Specific                              */ -#define __NR_rt_sigsuspend      107 /* Linux Specific                              */ -#ifdef __32bit_syscall_numbers__ -#define __NR_setresuid32        108 /* Linux Specific, sigvec under SunOS	   */ -#define __NR_getresuid32        109 /* Linux Specific, sigblock under SunOS	   */ -#define __NR_setresgid32        110 /* Linux Specific, sigsetmask under SunOS	   */ -#define __NR_getresgid32        111 /* Linux Specific, sigpause under SunOS	   */ -#define __NR_setregid32         112 /* Linux sparc32, sigstack under SunOS         */ -#else -#define __NR_setresuid          108 /* Linux Specific, sigvec under SunOS	   */ -#define __NR_getresuid          109 /* Linux Specific, sigblock under SunOS	   */ -#define __NR_setresgid          110 /* Linux Specific, sigsetmask under SunOS	   */ -#define __NR_getresgid          111 /* Linux Specific, sigpause under SunOS	   */ -#endif -#define __NR_recvmsg            113 /* Common                                      */ -#define __NR_sendmsg            114 /* Common                                      */ -#ifdef __32bit_syscall_numbers__ -#define __NR_getgroups32        115 /* Linux sparc32, vtrace under SunOS           */ -#endif -#define __NR_gettimeofday       116 /* Common                                      */ -#define __NR_getrusage          117 /* Common                                      */ -#define __NR_getsockopt         118 /* Common                                      */ -#define __NR_getcwd		119 /* Linux Specific				   */ -#define __NR_readv              120 /* Common                                      */ -#define __NR_writev             121 /* Common                                      */ -#define __NR_settimeofday       122 /* Common                                      */ -#define __NR_fchown             123 /* Common                                      */ -#define __NR_fchmod             124 /* Common                                      */ -#define __NR_recvfrom           125 /* Common                                      */ -#define __NR_setreuid           126 /* Common                                      */ -#define __NR_setregid           127 /* Common                                      */ -#define __NR_rename             128 /* Common                                      */ -#define __NR_truncate           129 /* Common                                      */ -#define __NR_ftruncate          130 /* Common                                      */ -#define __NR_flock              131 /* Common                                      */ -#define __NR_lstat64		132 /* Linux Specific			           */ -#define __NR_sendto             133 /* Common                                      */ -#define __NR_shutdown           134 /* Common                                      */ -#define __NR_socketpair         135 /* Common                                      */ -#define __NR_mkdir              136 /* Common                                      */ -#define __NR_rmdir              137 /* Common                                      */ -#define __NR_utimes             138 /* SunOS Specific                              */ -#define __NR_stat64		139 /* Linux Specific			           */ -#define __NR_sendfile64         140 /* adjtime under SunOS                         */ -#define __NR_getpeername        141 /* Common                                      */ -#define __NR_futex              142 /* gethostid under SunOS                       */ -#define __NR_gettid             143 /* ENOSYS under SunOS                          */ -#define __NR_getrlimit		144 /* Common                                      */ -#define __NR_setrlimit          145 /* Common                                      */ -#define __NR_pivot_root		146 /* Linux Specific, killpg under SunOS          */ -#define __NR_prctl		147 /* ENOSYS under SunOS                          */ -#define __NR_pciconfig_read	148 /* ENOSYS under SunOS                          */ -#define __NR_pciconfig_write	149 /* ENOSYS under SunOS                          */ -#define __NR_getsockname        150 /* Common                                      */ -#define __NR_inotify_init       151 /* Linux specific                              */ -#define __NR_inotify_add_watch  152 /* Linux specific                              */ -#define __NR_poll               153 /* Common                                      */ -#define __NR_getdents64		154 /* Linux specific				   */ -#ifdef __32bit_syscall_numbers__ -#define __NR_fcntl64		155 /* Linux sparc32 Specific                      */ -#endif -#define __NR_inotify_rm_watch   156 /* Linux specific				   */ -#define __NR_statfs             157 /* Common                                      */ -#define __NR_fstatfs            158 /* Common                                      */ -#define __NR_umount             159 /* Common                                      */ -#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS    */ -#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS           */ -#define __NR_getdomainname      162 /* SunOS Specific                              */ -#define __NR_setdomainname      163 /* Common                                      */ -#ifndef __32bit_syscall_numbers__ -#define __NR_utrap_install	164 /* SYSV ABI/v9 required			   */ -#endif -#define __NR_quotactl           165 /* Common                                      */ -#define __NR_set_tid_address    166 /* Linux specific, exportfs under SunOS        */ -#define __NR_mount              167 /* Common                                      */ -#define __NR_ustat              168 /* Common                                      */ -#define __NR_setxattr           169 /* SunOS: semsys                               */ -#define __NR_lsetxattr          170 /* SunOS: msgsys                               */ -#define __NR_fsetxattr          171 /* SunOS: shmsys                               */ -#define __NR_getxattr           172 /* SunOS: auditsys                             */ -#define __NR_lgetxattr          173 /* SunOS: rfssys                               */ -#define __NR_getdents           174 /* Common                                      */ -#define __NR_setsid             175 /* Common                                      */ -#define __NR_fchdir             176 /* Common                                      */ -#define __NR_fgetxattr          177 /* SunOS: fchroot                              */ -#define __NR_listxattr          178 /* SunOS: vpixsys                              */ -#define __NR_llistxattr         179 /* SunOS: aioread                              */ -#define __NR_flistxattr         180 /* SunOS: aiowrite                             */ -#define __NR_removexattr        181 /* SunOS: aiowait                              */ -#define __NR_lremovexattr       182 /* SunOS: aiocancel                            */ -#define __NR_sigpending         183 /* Common                                      */ -#define __NR_query_module	184 /* Linux Specific				   */ -#define __NR_setpgid            185 /* Common                                      */ -#define __NR_fremovexattr       186 /* SunOS: pathconf                             */ -#define __NR_tkill              187 /* SunOS: fpathconf                            */ -#define __NR_exit_group		188 /* Linux specific, sysconf undef SunOS         */ -#define __NR_uname              189 /* Linux Specific                              */ -#define __NR_init_module        190 /* Linux Specific                              */ -#define __NR_personality        191 /* Linux Specific                              */ -#define __NR_remap_file_pages   192 /* Linux Specific                              */ -#define __NR_epoll_create       193 /* Linux Specific                              */ -#define __NR_epoll_ctl          194 /* Linux Specific                              */ -#define __NR_epoll_wait         195 /* Linux Specific                              */ -#define __NR_ioprio_set         196 /* Linux Specific                              */ -#define __NR_getppid            197 /* Linux Specific                              */ -#define __NR_sigaction          198 /* Linux Specific                              */ -#define __NR_sgetmask           199 /* Linux Specific                              */ -#define __NR_ssetmask           200 /* Linux Specific                              */ -#define __NR_sigsuspend         201 /* Linux Specific                              */ -#define __NR_oldlstat           202 /* Linux Specific                              */ -#define __NR_uselib             203 /* Linux Specific                              */ -#define __NR_readdir            204 /* Linux Specific                              */ -#define __NR_readahead          205 /* Linux Specific                              */ -#define __NR_socketcall         206 /* Linux Specific                              */ -#define __NR_syslog             207 /* Linux Specific                              */ -#define __NR_lookup_dcookie     208 /* Linux Specific                              */ -#define __NR_fadvise64          209 /* Linux Specific                              */ -#define __NR_fadvise64_64       210 /* Linux Specific                              */ -#define __NR_tgkill             211 /* Linux Specific                              */ -#define __NR_waitpid            212 /* Linux Specific                              */ -#define __NR_swapoff            213 /* Linux Specific                              */ -#define __NR_sysinfo            214 /* Linux Specific                              */ -#define __NR_ipc                215 /* Linux Specific                              */ -#define __NR_sigreturn          216 /* Linux Specific                              */ -#define __NR_clone              217 /* Linux Specific                              */ -#define __NR_ioprio_get         218 /* Linux Specific                              */ -#define __NR_adjtimex           219 /* Linux Specific                              */ -#define __NR_sigprocmask        220 /* Linux Specific                              */ -#define __NR_create_module      221 /* Linux Specific                              */ -#define __NR_delete_module      222 /* Linux Specific                              */ -#define __NR_get_kernel_syms    223 /* Linux Specific                              */ -#define __NR_getpgid            224 /* Linux Specific                              */ -#define __NR_bdflush            225 /* Linux Specific                              */ -#define __NR_sysfs              226 /* Linux Specific                              */ -#define __NR_afs_syscall        227 /* Linux Specific                              */ -#define __NR_setfsuid           228 /* Linux Specific                              */ -#define __NR_setfsgid           229 /* Linux Specific                              */ -#define __NR__newselect         230 /* Linux Specific                              */  #ifdef __32bit_syscall_numbers__ -#define __NR_time               231 /* Linux Specific                              */  #else -#ifdef __KERNEL__  #define __NR_time		231 /* Linux sparc32                               */  #endif -#endif -#define __NR_splice             232 /* Linux Specific                              */ -#define __NR_stime              233 /* Linux Specific                              */ -#define __NR_statfs64           234 /* Linux Specific                              */ -#define __NR_fstatfs64          235 /* Linux Specific                              */ -#define __NR__llseek            236 /* Linux Specific                              */ -#define __NR_mlock              237 -#define __NR_munlock            238 -#define __NR_mlockall           239 -#define __NR_munlockall         240 -#define __NR_sched_setparam     241 -#define __NR_sched_getparam     242 -#define __NR_sched_setscheduler 243 -#define __NR_sched_getscheduler 244 -#define __NR_sched_yield        245 -#define __NR_sched_get_priority_max 246 -#define __NR_sched_get_priority_min 247 -#define __NR_sched_rr_get_interval  248 -#define __NR_nanosleep          249 -#define __NR_mremap             250 -#define __NR__sysctl            251 -#define __NR_getsid             252 -#define __NR_fdatasync          253 -#define __NR_nfsservctl         254 -#define __NR_sync_file_range	255 -#define __NR_clock_settime	256 -#define __NR_clock_gettime	257 -#define __NR_clock_getres	258 -#define __NR_clock_nanosleep	259 -#define __NR_sched_getaffinity	260 -#define __NR_sched_setaffinity	261 -#define __NR_timer_settime	262 -#define __NR_timer_gettime	263 -#define __NR_timer_getoverrun	264 -#define __NR_timer_delete	265 -#define __NR_timer_create	266 -/* #define __NR_vserver		267 Reserved for VSERVER */ -#define __NR_io_setup		268 -#define __NR_io_destroy		269 -#define __NR_io_submit		270 -#define __NR_io_cancel		271 -#define __NR_io_getevents	272 -#define __NR_mq_open		273 -#define __NR_mq_unlink		274 -#define __NR_mq_timedsend	275 -#define __NR_mq_timedreceive	276 -#define __NR_mq_notify		277 -#define __NR_mq_getsetattr	278 -#define __NR_waitid		279 -#define __NR_tee		280 -#define __NR_add_key		281 -#define __NR_request_key	282 -#define __NR_keyctl		283 -#define __NR_openat		284 -#define __NR_mkdirat		285 -#define __NR_mknodat		286 -#define __NR_fchownat		287 -#define __NR_futimesat		288 -#define __NR_fstatat64		289 -#define __NR_unlinkat		290 -#define __NR_renameat		291 -#define __NR_linkat		292 -#define __NR_symlinkat		293 -#define __NR_readlinkat		294 -#define __NR_fchmodat		295 -#define __NR_faccessat		296 -#define __NR_pselect6		297 -#define __NR_ppoll		298 -#define __NR_unshare		299 -#define __NR_set_robust_list	300 -#define __NR_get_robust_list	301 -#define __NR_migrate_pages	302 -#define __NR_mbind		303 -#define __NR_get_mempolicy	304 -#define __NR_set_mempolicy	305 -#define __NR_kexec_load		306 -#define __NR_move_pages		307 -#define __NR_getcpu		308 -#define __NR_epoll_pwait	309 -#define __NR_utimensat		310 -#define __NR_signalfd		311 -#define __NR_timerfd_create	312 -#define __NR_eventfd		313 -#define __NR_fallocate		314 -#define __NR_timerfd_settime	315 -#define __NR_timerfd_gettime	316 -#define __NR_signalfd4		317 -#define __NR_eventfd2		318 -#define __NR_epoll_create1	319 -#define __NR_dup3		320 -#define __NR_pipe2		321 -#define __NR_inotify_init1	322 -#define __NR_accept4		323 -#define __NR_preadv		324 -#define __NR_pwritev		325 -#define __NR_rt_tgsigqueueinfo	326 -#define __NR_perf_event_open	327 -#define __NR_recvmmsg		328 -#define __NR_fanotify_init	329 -#define __NR_fanotify_mark	330 -#define __NR_prlimit64		331 - -#define NR_syscalls		332 - -#ifdef __32bit_syscall_numbers__ -/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, - * it never had the plain ones and there is no value to adding those - * old versions into the syscall table. - */ -#define __IGNORE_setresuid -#define __IGNORE_getresuid -#define __IGNORE_setresgid -#define __IGNORE_getresgid -#endif - -#ifdef __KERNEL__ -#define __ARCH_WANT_IPC_PARSE_VERSION  #define __ARCH_WANT_OLD_READDIR  #define __ARCH_WANT_STAT64  #define __ARCH_WANT_SYS_ALARM  #define __ARCH_WANT_SYS_GETHOSTNAME  #define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_SGETMASK  #define __ARCH_WANT_SYS_SIGNAL  #define __ARCH_WANT_SYS_TIME  #define __ARCH_WANT_SYS_UTIME @@ -434,21 +37,11 @@  #define __ARCH_WANT_SYS_OLDUMOUNT  #define __ARCH_WANT_SYS_SIGPENDING  #define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_SYS_RT_SIGSUSPEND  #ifdef __32bit_syscall_numbers__  #define __ARCH_WANT_SYS_IPC  #else  #define __ARCH_WANT_COMPAT_SYS_TIME -#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND +#define __ARCH_WANT_COMPAT_SYS_SENDFILE  #endif -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") - -#endif /* __KERNEL__ */  #endif /* _SPARC_UNISTD_H */ diff --git a/arch/sparc/include/asm/utrap.h b/arch/sparc/include/asm/utrap.h deleted file mode 100644 index b10e527c22d..00000000000 --- a/arch/sparc/include/asm/utrap.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * include/asm/utrap.h - * - * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ - -#ifndef __ASM_SPARC64_UTRAP_H -#define __ASM_SPARC64_UTRAP_H - -#define UT_INSTRUCTION_EXCEPTION		1 -#define UT_INSTRUCTION_ERROR			2 -#define UT_INSTRUCTION_PROTECTION		3 -#define UT_ILLTRAP_INSTRUCTION			4 -#define UT_ILLEGAL_INSTRUCTION			5 -#define UT_PRIVILEGED_OPCODE			6 -#define UT_FP_DISABLED				7 -#define UT_FP_EXCEPTION_IEEE_754		8 -#define UT_FP_EXCEPTION_OTHER			9 -#define UT_TAG_OVERVIEW				10 -#define UT_DIVISION_BY_ZERO			11 -#define UT_DATA_EXCEPTION			12 -#define UT_DATA_ERROR				13 -#define UT_DATA_PROTECTION			14 -#define UT_MEM_ADDRESS_NOT_ALIGNED		15 -#define UT_PRIVILEGED_ACTION			16 -#define UT_ASYNC_DATA_ERROR			17 -#define UT_TRAP_INSTRUCTION_16			18 -#define UT_TRAP_INSTRUCTION_17			19 -#define UT_TRAP_INSTRUCTION_18			20 -#define UT_TRAP_INSTRUCTION_19			21 -#define UT_TRAP_INSTRUCTION_20			22 -#define UT_TRAP_INSTRUCTION_21			23 -#define UT_TRAP_INSTRUCTION_22			24 -#define UT_TRAP_INSTRUCTION_23			25 -#define UT_TRAP_INSTRUCTION_24			26 -#define UT_TRAP_INSTRUCTION_25			27 -#define UT_TRAP_INSTRUCTION_26			28 -#define UT_TRAP_INSTRUCTION_27			29 -#define UT_TRAP_INSTRUCTION_28			30 -#define UT_TRAP_INSTRUCTION_29			31 -#define UT_TRAP_INSTRUCTION_30			32 -#define UT_TRAP_INSTRUCTION_31			33 - -#define	UTH_NOCHANGE				(-1) - -#ifndef __ASSEMBLY__ -typedef int utrap_entry_t; -typedef void *utrap_handler_t; -#endif /* __ASSEMBLY__ */ - -#endif /* !(__ASM_SPARC64_PROCESSOR_H) */ diff --git a/arch/sparc/include/asm/vac-ops.h b/arch/sparc/include/asm/vac-ops.h deleted file mode 100644 index a63e88ef042..00000000000 --- a/arch/sparc/include/asm/vac-ops.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef _SPARC_VAC_OPS_H -#define _SPARC_VAC_OPS_H - -/* vac-ops.h: Inline assembly routines to do operations on the Sparc - *            VAC (virtual address cache) for the sun4c. - * - * Copyright (C) 1994, David S. Miller (davem@caip.rutgers.edu) - */ - -#include <asm/sysen.h> -#include <asm/contregs.h> -#include <asm/asi.h> - -/* The SUN4C models have a virtually addressed write-through - * cache. - * - * The cache tags are directly accessible through an ASI and - * each have the form: - * - * ------------------------------------------------------------ - * | MBZ | CONTEXT | WRITE | PRIV | VALID | MBZ | TagID | MBZ | - * ------------------------------------------------------------ - *  31 25  24   22     21     20     19    18 16  15   2  1  0 - * - * MBZ: These bits are either unused and/or reserved and should - *      be written as zeroes. - * - * CONTEXT: Records the context to which this cache line belongs. - * - * WRITE: A copy of the writable bit from the mmu pte access bits. - * - * PRIV: A copy of the privileged bit from the pte access bits. - * - * VALID: If set, this line is valid, else invalid. - * - * TagID: Fourteen bits of tag ID. - * - * Every virtual address is seen by the cache like this: - * - * ---------------------------------------- - * |  RESV  | TagID | LINE | BYTE-in-LINE | - * ---------------------------------------- - *  31    30 29   16 15   4 3            0 - * - * RESV: Unused/reserved. - * - * TagID: Used to match the Tag-ID in that vac tags. - * - * LINE: Which line within the cache - * - * BYTE-in-LINE: Which byte within the cache line. - */ - -/* Sun4c VAC Tags */ -#define S4CVACTAG_CID      0x01c00000 -#define S4CVACTAG_W        0x00200000 -#define S4CVACTAG_P        0x00100000 -#define S4CVACTAG_V        0x00080000 -#define S4CVACTAG_TID      0x0000fffc - -/* Sun4c VAC Virtual Address */ -/* These aren't used, why bother? (Anton) */ -#if 0 -#define S4CVACVA_TID       0x3fff0000 -#define S4CVACVA_LINE      0x0000fff0 -#define S4CVACVA_BIL       0x0000000f -#endif - -/* The indexing of cache lines creates a problem.  Because the line - * field of a virtual address extends past the page offset within - * the virtual address it is possible to have what are called - * 'bad aliases' which will create inconsistencies.  So we must make - * sure that within a context that if a physical page is mapped - * more than once, that 'extra' line bits are the same.  If this is - * not the case, and thus is a 'bad alias' we must turn off the - * cacheable bit in the pte's of all such pages. - */ - -#define S4CVAC_BADBITS    0x0000f000 - -/* The following is true if vaddr1 and vaddr2 would cause - * a 'bad alias'. - */ -#define S4CVAC_BADALIAS(vaddr1, vaddr2) \ -        ((((unsigned long) (vaddr1)) ^ ((unsigned long) (vaddr2))) & \ -	 (S4CVAC_BADBITS)) - -/* The following structure describes the characteristics of a sun4c - * VAC as probed from the prom during boot time. - */ -struct sun4c_vac_props { -	unsigned int num_bytes;     /* Size of the cache */ -	unsigned int do_hwflushes;  /* Hardware flushing available? */ -	unsigned int linesize;      /* Size of each line in bytes */ -	unsigned int log2lsize;     /* log2(linesize) */ -	unsigned int on;            /* VAC is enabled */ -}; - -extern struct sun4c_vac_props sun4c_vacinfo; - -/* sun4c_enable_vac() enables the sun4c virtual address cache. */ -static inline void sun4c_enable_vac(void) -{ -	__asm__ __volatile__("lduba [%0] %1, %%g1\n\t" -			     "or    %%g1, %2, %%g1\n\t" -			     "stba  %%g1, [%0] %1\n\t" -			     : /* no outputs */ -			     : "r" ((unsigned int) AC_SENABLE), -			     "i" (ASI_CONTROL), "i" (SENABLE_CACHE) -			     : "g1", "memory"); -	sun4c_vacinfo.on = 1; -} - -/* sun4c_disable_vac() disables the virtual address cache. */ -static inline void sun4c_disable_vac(void) -{ -	__asm__ __volatile__("lduba [%0] %1, %%g1\n\t" -			     "andn  %%g1, %2, %%g1\n\t" -			     "stba  %%g1, [%0] %1\n\t" -			     : /* no outputs */ -			     : "r" ((unsigned int) AC_SENABLE), -			     "i" (ASI_CONTROL), "i" (SENABLE_CACHE) -			     : "g1", "memory"); -	sun4c_vacinfo.on = 0; -} - -#endif /* !(_SPARC_VAC_OPS_H) */ diff --git a/arch/sparc/include/asm/vaddrs.h b/arch/sparc/include/asm/vaddrs.h index 541e13755ce..c3dbcf90203 100644 --- a/arch/sparc/include/asm/vaddrs.h +++ b/arch/sparc/include/asm/vaddrs.h @@ -30,26 +30,32 @@   */  #define SRMMU_NOCACHE_ALCRATIO	64	/* 256 pages per 64MB of system RAM */ +#ifndef __ASSEMBLY__ +#include <asm/kmap_types.h> + +enum fixed_addresses { +	FIX_HOLE, +#ifdef CONFIG_HIGHMEM +	FIX_KMAP_BEGIN, +	FIX_KMAP_END = (KM_TYPE_NR * NR_CPUS), +#endif +	__end_of_fixed_addresses +}; +#endif + +/* Leave one empty page between IO pages at 0xfd000000 and + * the top of the fixmap. + */ +#define FIXADDR_TOP		(0xfcfff000UL) +#define FIXADDR_SIZE		((FIX_KMAP_END + 1) << PAGE_SHIFT) +#define FIXADDR_START		(FIXADDR_TOP - FIXADDR_SIZE) + +#define __fix_to_virt(x)        (FIXADDR_TOP - ((x) << PAGE_SHIFT)) +  #define SUN4M_IOBASE_VADDR	0xfd000000 /* Base for mapping pages */  #define IOBASE_VADDR		0xfe000000  #define IOBASE_END		0xfe600000 -/* - * 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 - * during pseudo dma which runs with traps off (no faults allowed). - * Some quick calculations yield: - *       NR_TASKS <512> * (3 * PAGE_SIZE) == 0x600000 - * Subtract this from 0xc00000 and you get 0x927C0 of vm left - * over to map SCSI dvma + floppy pseudo-dma buffers.  So be - * 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_END		0xffc00000 -  #define KADB_DEBUGGER_BEGVM	0xffc00000 /* Where kern debugger is in virt-mem */  #define KADB_DEBUGGER_ENDVM	0xffd00000  #define DEBUG_FIRSTVADDR	KADB_DEBUGGER_BEGVM diff --git a/arch/sparc/include/asm/vga.h b/arch/sparc/include/asm/vga.h index c69d5b2ba19..ec0e9967d93 100644 --- a/arch/sparc/include/asm/vga.h +++ b/arch/sparc/include/asm/vga.h @@ -7,6 +7,7 @@  #ifndef _LINUX_ASM_VGA_H_  #define _LINUX_ASM_VGA_H_ +#include <linux/bug.h>  #include <asm/types.h>  #define VT_BUF_HAVE_RW diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h index 9d83d3bcb49..e0f6c399f1d 100644 --- a/arch/sparc/include/asm/vio.h +++ b/arch/sparc/include/asm/vio.h @@ -284,6 +284,7 @@ struct vio_dev {  };  struct vio_driver { +	const char			*name;  	struct list_head		node;  	const struct vio_device_id	*id_table;  	int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); @@ -371,8 +372,14 @@ do {	if (vio->debug & VIO_DEBUG_##TYPE) \  		       vio->vdev->channel_id, ## a); \  } while (0) -extern int vio_register_driver(struct vio_driver *drv); -extern void vio_unregister_driver(struct vio_driver *drv); +int __vio_register_driver(struct vio_driver *drv, struct module *owner, +				 const char *mod_name); +/* + * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded + */ +#define vio_register_driver(driver)		\ +	__vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) +void vio_unregister_driver(struct vio_driver *drv);  static inline struct vio_driver *to_vio_driver(struct device_driver *drv)  { @@ -384,21 +391,21 @@ static inline struct vio_dev *to_vio_dev(struct device *dev)  	return container_of(dev, struct vio_dev, dev);  } -extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); -extern void vio_link_state_change(struct vio_driver_state *vio, int event); -extern void vio_conn_reset(struct vio_driver_state *vio); -extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt); -extern int vio_validate_sid(struct vio_driver_state *vio, -			    struct vio_msg_tag *tp); -extern u32 vio_send_sid(struct vio_driver_state *vio); -extern int vio_ldc_alloc(struct vio_driver_state *vio, -			 struct ldc_channel_config *base_cfg, void *event_arg); -extern void vio_ldc_free(struct vio_driver_state *vio); -extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, -			   u8 dev_class, struct vio_version *ver_table, -			   int ver_table_size, struct vio_driver_ops *ops, -			   char *name); - -extern void vio_port_up(struct vio_driver_state *vio); +int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); +void vio_link_state_change(struct vio_driver_state *vio, int event); +void vio_conn_reset(struct vio_driver_state *vio); +int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt); +int vio_validate_sid(struct vio_driver_state *vio, +		     struct vio_msg_tag *tp); +u32 vio_send_sid(struct vio_driver_state *vio); +int vio_ldc_alloc(struct vio_driver_state *vio, +		  struct ldc_channel_config *base_cfg, void *event_arg); +void vio_ldc_free(struct vio_driver_state *vio); +int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, +		    u8 dev_class, struct vio_version *ver_table, +		    int ver_table_size, struct vio_driver_ops *ops, +		    char *name); + +void vio_port_up(struct vio_driver_state *vio);  #endif /* _SPARC64_VIO_H */ diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h index 39ca301920d..b2667375928 100644 --- a/arch/sparc/include/asm/visasm.h +++ b/arch/sparc/include/asm/visasm.h @@ -57,7 +57,8 @@ static inline void save_and_clear_fpu(void) {  "		" : : "i" (FPRS_FEF|FPRS_DU) :  		"o5", "g1", "g2", "g3", "g7", "cc");  } -extern int vis_emul(struct pt_regs *, unsigned int); + +int vis_emul(struct pt_regs *, unsigned int);  #endif  #endif /* _SPARC64_ASI_H */ diff --git a/arch/sparc/include/asm/watchdog.h b/arch/sparc/include/asm/watchdog.h deleted file mode 100644 index 5baf2d3919c..00000000000 --- a/arch/sparc/include/asm/watchdog.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * watchdog - Driver interface for the hardware watchdog timers - * present on Sun Microsystems boardsets - * - * Copyright (c) 2000 Eric Brower <ebrower@usa.net> - * - */ - -#ifndef _SPARC64_WATCHDOG_H -#define _SPARC64_WATCHDOG_H - -#include <linux/watchdog.h> - -/* Solaris compatibility ioctls-- - * Ref. <linux/watchdog.h> for standard linux watchdog ioctls - */ -#define WIOCSTART _IO (WATCHDOG_IOCTL_BASE, 10)		/* Start Timer		*/ -#define WIOCSTOP  _IO (WATCHDOG_IOCTL_BASE, 11)		/* Stop Timer		*/ -#define WIOCGSTAT _IOR(WATCHDOG_IOCTL_BASE, 12, int)/* Get Timer Status	*/ - -/* Status flags from WIOCGSTAT ioctl - */ -#define WD_FREERUN	0x01	/* timer is running, interrupts disabled	*/ -#define WD_EXPIRED	0x02	/* timer has expired						*/ -#define WD_RUNNING	0x04	/* timer is running, interrupts enabled		*/ -#define WD_STOPPED	0x08	/* timer has not been started				*/ -#define WD_SERVICED 0x10	/* timer interrupt was serviced				*/ - -#endif /* ifndef _SPARC64_WATCHDOG_H */ - diff --git a/arch/sparc/include/asm/winmacro.h b/arch/sparc/include/asm/winmacro.h index 5b0a06dc3bc..9b7b21764cd 100644 --- a/arch/sparc/include/asm/winmacro.h +++ b/arch/sparc/include/asm/winmacro.h @@ -103,28 +103,24 @@          st       %scratch, [%cur_reg + TI_W_SAVED];  #ifdef CONFIG_SMP -#define LOAD_CURRENT4M(dest_reg, idreg) \ -        rd       %tbr, %idreg; \ -	sethi    %hi(current_set), %dest_reg; \ -        srl      %idreg, 10, %idreg; \ -	or       %dest_reg, %lo(current_set), %dest_reg; \ -	and      %idreg, 0xc, %idreg; \ -	ld       [%idreg + %dest_reg], %dest_reg; - -#define LOAD_CURRENT4D(dest_reg, idreg) \ -	lda	 [%g0] ASI_M_VIKING_TMP1, %idreg; \ -	sethi	%hi(C_LABEL(current_set)), %dest_reg; \ -	sll	%idreg, 2, %idreg; \ -	or	%dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \ -	ld	[%idreg + %dest_reg], %dest_reg; - -/* Blackbox - take care with this... - check smp4m and smp4d before changing this. */ -#define LOAD_CURRENT(dest_reg, idreg) 					\ -	sethi	 %hi(___b_load_current), %idreg;			\ -	sethi    %hi(current_set), %dest_reg; 			\ -	sethi    %hi(boot_cpu_id4), %idreg; 			\ -	or       %dest_reg, %lo(current_set), %dest_reg; 	\ -	ldub	 [%idreg + %lo(boot_cpu_id4)], %idreg;		\ +#define LOAD_CURRENT(dest_reg, idreg) 			\ +661:	rd	%tbr, %idreg;				\ +	srl	%idreg, 10, %idreg;			\ +	and	%idreg, 0xc, %idreg;			\ +	.section	.cpuid_patch, "ax";		\ +	/* Instruction location. */			\ +	.word		661b;				\ +	/* SUN4D implementation. */			\ +	lda	 [%g0] ASI_M_VIKING_TMP1, %idreg;	\ +	sll	 %idreg, 2, %idreg;			\ +	nop;						\ +	/* LEON implementation. */			\ +	rd 	%asr17, %idreg;				\ +	srl	%idreg, 0x1c, %idreg;			\ +	sll	%idreg, 0x02, %idreg;			\ +	.previous;					\ +	sethi    %hi(current_set), %dest_reg; 		\ +	or       %dest_reg, %lo(current_set), %dest_reg;\  	ld       [%idreg + %dest_reg], %dest_reg;  #else  #define LOAD_CURRENT(dest_reg, idreg) \ diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h index bee4bf4be3a..50c88285603 100644 --- a/arch/sparc/include/asm/xor_64.h +++ b/arch/sparc/include/asm/xor_64.h @@ -20,13 +20,13 @@  #include <asm/spitfire.h> -extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); -extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, -		      unsigned long *); -extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *, -		      unsigned long *, unsigned long *); -extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *, -		      unsigned long *, unsigned long *, unsigned long *); +void xor_vis_2(unsigned long, unsigned long *, unsigned long *); +void xor_vis_3(unsigned long, unsigned long *, unsigned long *, +	       unsigned long *); +void xor_vis_4(unsigned long, unsigned long *, unsigned long *, +	       unsigned long *, unsigned long *); +void xor_vis_5(unsigned long, unsigned long *, unsigned long *, +	       unsigned long *, unsigned long *, unsigned long *);  /* XXX Ugh, write cheetah versions... -DaveM */ @@ -38,13 +38,13 @@ static struct xor_block_template xor_block_VIS = {          .do_5	= xor_vis_5,  }; -extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *); -extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *, -			  unsigned long *); -extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *, -			  unsigned long *, unsigned long *); -extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *, -			  unsigned long *, unsigned long *, unsigned long *); +void xor_niagara_2(unsigned long, unsigned long *, unsigned long *); +void xor_niagara_3(unsigned long, unsigned long *, unsigned long *, +		   unsigned long *); +void xor_niagara_4(unsigned long, unsigned long *, unsigned long *, +		   unsigned long *, unsigned long *); +void xor_niagara_5(unsigned long, unsigned long *, unsigned long *, +		   unsigned long *, unsigned long *, unsigned long *);  static struct xor_block_template xor_block_niagara = {          .name	= "Niagara", @@ -65,6 +65,9 @@ static struct xor_block_template xor_block_niagara = {  #define XOR_SELECT_TEMPLATE(FASTEST) \  	((tlb_type == hypervisor && \  	  (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \ -	   sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \ +	   sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \ +	   sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \ +	   sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \ +	   sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \  	 &xor_block_niagara : \  	 &xor_block_VIS)  | 
