sparc, sparc64: use arch/sparc/include
The majority of this patch was created by the following script: *** ASM=arch/sparc/include/asm mkdir -p $ASM git mv include/asm-sparc64/ftrace.h $ASM git rm include/asm-sparc64/* git mv include/asm-sparc/* $ASM sed -ie 's/asm-sparc64/asm/g' $ASM/* sed -ie 's/asm-sparc/asm/g' $ASM/* *** The rest was an update of the top-level Makefile to use sparc for header files when sparc64 is being build. And a small fixlet to pick up the correct unistd.h from sparc64 code. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
1
arch/sparc/include/asm/Kbuild
Normal file
1
arch/sparc/include/asm/Kbuild
Normal file
@@ -0,0 +1 @@
|
||||
# dummy file to avoid breaking make headers_install
|
20
arch/sparc/include/asm/agp.h
Normal file
20
arch/sparc/include/asm/agp.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef AGP_H
|
||||
#define AGP_H 1
|
||||
|
||||
/* dummy for now */
|
||||
|
||||
#define map_page_into_agp(page)
|
||||
#define unmap_page_from_agp(page)
|
||||
#define flush_agp_cache() mb()
|
||||
|
||||
/* Convert a physical address to an address suitable for the GART. */
|
||||
#define phys_to_gart(x) (x)
|
||||
#define gart_to_phys(x) (x)
|
||||
|
||||
/* GATT allocation. Returns/accepts GATT kernel virtual address. */
|
||||
#define alloc_gatt_pages(order) \
|
||||
((char *)__get_free_pages(GFP_KERNEL, (order)))
|
||||
#define free_gatt_pages(table, order) \
|
||||
free_pages((unsigned long)(table), (order))
|
||||
|
||||
#endif
|
36
arch/sparc/include/asm/apb.h
Normal file
36
arch/sparc/include/asm/apb.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* apb.h: Advanced PCI Bridge Configuration Registers and Bits
|
||||
*
|
||||
* Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_APB_H
|
||||
#define _SPARC64_APB_H
|
||||
|
||||
#define APB_TICK_REGISTER 0xb0
|
||||
#define APB_INT_ACK 0xb8
|
||||
#define APB_PRIMARY_MASTER_RETRY_LIMIT 0xc0
|
||||
#define APB_DMA_ASFR 0xc8
|
||||
#define APB_DMA_AFAR 0xd0
|
||||
#define APB_PIO_TARGET_RETRY_LIMIT 0xd8
|
||||
#define APB_PIO_TARGET_LATENCY_TIMER 0xd9
|
||||
#define APB_DMA_TARGET_RETRY_LIMIT 0xda
|
||||
#define APB_DMA_TARGET_LATENCY_TIMER 0xdb
|
||||
#define APB_SECONDARY_MASTER_RETRY_LIMIT 0xdc
|
||||
#define APB_SECONDARY_CONTROL 0xdd
|
||||
#define APB_IO_ADDRESS_MAP 0xde
|
||||
#define APB_MEM_ADDRESS_MAP 0xdf
|
||||
|
||||
#define APB_PCI_CONTROL_LOW 0xe0
|
||||
# define APB_PCI_CTL_LOW_ARB_PARK (1 << 21)
|
||||
# define APB_PCI_CTL_LOW_ERRINT_EN (1 << 8)
|
||||
|
||||
#define APB_PCI_CONTROL_HIGH 0xe4
|
||||
# define APB_PCI_CTL_HIGH_SERR (1 << 2)
|
||||
# define APB_PCI_CTL_HIGH_ARBITER_EN (1 << 0)
|
||||
|
||||
#define APB_PIO_ASFR 0xe8
|
||||
#define APB_PIO_AFAR 0xf0
|
||||
#define APB_DIAG_REGISTER 0xf8
|
||||
|
||||
#endif /* !(_SPARC64_APB_H) */
|
64
arch/sparc/include/asm/apc.h
Normal file
64
arch/sparc/include/asm/apc.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* 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) */
|
262
arch/sparc/include/asm/asi.h
Normal file
262
arch/sparc/include/asm/asi.h
Normal file
@@ -0,0 +1,262 @@
|
||||
#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 */
|
||||
#define ASI_M_MMUREGS 0x04 /* MMU Registers; rw, ss */
|
||||
#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 */
|
45
arch/sparc/include/asm/asmmacro.h
Normal file
45
arch/sparc/include/asm/asmmacro.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* asmmacro.h: Assembler macros.
|
||||
*
|
||||
* Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
|
||||
*/
|
||||
|
||||
#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.
|
||||
*/
|
||||
#define SAVE_ALL_HEAD \
|
||||
sethi %hi(trap_setup), %l4; \
|
||||
jmpl %l4 + %lo(trap_setup), %l6;
|
||||
#define SAVE_ALL \
|
||||
SAVE_ALL_HEAD \
|
||||
nop;
|
||||
|
||||
/* 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. */
|
||||
|
||||
#ifdef CONFIG_SUN4
|
||||
#define lduXa lduha
|
||||
#define stXa stha
|
||||
#else
|
||||
#define lduXa lduba
|
||||
#define stXa stba
|
||||
#endif
|
||||
|
||||
#endif /* !(_SPARC_ASMMACRO_H) */
|
8
arch/sparc/include/asm/atomic.h
Normal file
8
arch/sparc/include/asm/atomic.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_ATOMIC_H
|
||||
#define ___ASM_SPARC_ATOMIC_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/atomic_64.h>
|
||||
#else
|
||||
#include <asm/atomic_32.h>
|
||||
#endif
|
||||
#endif
|
165
arch/sparc/include/asm/atomic_32.h
Normal file
165
arch/sparc/include/asm/atomic_32.h
Normal file
@@ -0,0 +1,165 @@
|
||||
/* atomic.h: These still suck, but the I-cache hit rate is higher.
|
||||
*
|
||||
* 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_ATOMIC__
|
||||
#define __ARCH_SPARC_ATOMIC__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef struct { volatile int counter; } atomic_t;
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define ATOMIC_INIT(i) { (i) }
|
||||
|
||||
extern int __atomic_add_return(int, atomic_t *);
|
||||
extern 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);
|
||||
|
||||
#define atomic_read(v) ((v)->counter)
|
||||
|
||||
#define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v)))
|
||||
#define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v)))
|
||||
#define atomic_inc(v) ((void)__atomic_add_return( 1, (v)))
|
||||
#define atomic_dec(v) ((void)__atomic_add_return( -1, (v)))
|
||||
|
||||
#define atomic_add_return(i, v) (__atomic_add_return( (int)(i), (v)))
|
||||
#define atomic_sub_return(i, v) (__atomic_add_return(-(int)(i), (v)))
|
||||
#define atomic_inc_return(v) (__atomic_add_return( 1, (v)))
|
||||
#define atomic_dec_return(v) (__atomic_add_return( -1, (v)))
|
||||
|
||||
#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
|
||||
|
||||
/*
|
||||
* atomic_inc_and_test - increment and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1
|
||||
* and returns true if the result is zero, or false for all
|
||||
* other cases.
|
||||
*/
|
||||
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
|
||||
|
||||
#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.h>
|
||||
#endif /* !(__ARCH_SPARC_ATOMIC__) */
|
128
arch/sparc/include/asm/atomic_64.h
Normal file
128
arch/sparc/include/asm/atomic_64.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* atomic.h: Thankfully the V9 is at least reasonable for this
|
||||
* stuff.
|
||||
*
|
||||
* Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_SPARC64_ATOMIC__
|
||||
#define __ARCH_SPARC64_ATOMIC__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
typedef struct { volatile int counter; } atomic_t;
|
||||
typedef struct { volatile __s64 counter; } atomic64_t;
|
||||
|
||||
#define ATOMIC_INIT(i) { (i) }
|
||||
#define ATOMIC64_INIT(i) { (i) }
|
||||
|
||||
#define atomic_read(v) ((v)->counter)
|
||||
#define atomic64_read(v) ((v)->counter)
|
||||
|
||||
#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(int, atomic64_t *);
|
||||
extern void atomic_sub(int, atomic_t *);
|
||||
extern void atomic64_sub(int, atomic64_t *);
|
||||
|
||||
extern int atomic_add_ret(int, atomic_t *);
|
||||
extern int atomic64_add_ret(int, atomic64_t *);
|
||||
extern int atomic_sub_ret(int, atomic_t *);
|
||||
extern int atomic64_sub_ret(int, atomic64_t *);
|
||||
|
||||
#define atomic_dec_return(v) atomic_sub_ret(1, v)
|
||||
#define atomic64_dec_return(v) atomic64_sub_ret(1, v)
|
||||
|
||||
#define atomic_inc_return(v) atomic_add_ret(1, v)
|
||||
#define atomic64_inc_return(v) atomic64_add_ret(1, v)
|
||||
|
||||
#define atomic_sub_return(i, v) atomic_sub_ret(i, v)
|
||||
#define atomic64_sub_return(i, v) atomic64_sub_ret(i, v)
|
||||
|
||||
#define atomic_add_return(i, v) atomic_add_ret(i, v)
|
||||
#define atomic64_add_return(i, v) atomic64_add_ret(i, v)
|
||||
|
||||
/*
|
||||
* atomic_inc_and_test - increment and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1
|
||||
* and returns true if the result is zero, or false for all
|
||||
* other cases.
|
||||
*/
|
||||
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
|
||||
#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
|
||||
|
||||
#define atomic_sub_and_test(i, v) (atomic_sub_ret(i, v) == 0)
|
||||
#define atomic64_sub_and_test(i, v) (atomic64_sub_ret(i, v) == 0)
|
||||
|
||||
#define atomic_dec_and_test(v) (atomic_sub_ret(1, v) == 0)
|
||||
#define atomic64_dec_and_test(v) (atomic64_sub_ret(1, v) == 0)
|
||||
|
||||
#define atomic_inc(v) atomic_add(1, v)
|
||||
#define atomic64_inc(v) atomic64_add(1, v)
|
||||
|
||||
#define atomic_dec(v) atomic_sub(1, v)
|
||||
#define atomic64_dec(v) atomic64_sub(1, v)
|
||||
|
||||
#define atomic_add_negative(i, v) (atomic_add_ret(i, v) < 0)
|
||||
#define atomic64_add_negative(i, v) (atomic64_add_ret(i, v) < 0)
|
||||
|
||||
#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)
|
||||
{
|
||||
int c, old;
|
||||
c = atomic_read(v);
|
||||
for (;;) {
|
||||
if (unlikely(c == (u)))
|
||||
break;
|
||||
old = atomic_cmpxchg((v), c, c + (a));
|
||||
if (likely(old == c))
|
||||
break;
|
||||
c = old;
|
||||
}
|
||||
return c != (u);
|
||||
}
|
||||
|
||||
#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))
|
||||
|
||||
static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
|
||||
{
|
||||
long c, old;
|
||||
c = atomic64_read(v);
|
||||
for (;;) {
|
||||
if (unlikely(c == (u)))
|
||||
break;
|
||||
old = atomic64_cmpxchg((v), c, c + (a));
|
||||
if (likely(old == c))
|
||||
break;
|
||||
c = old;
|
||||
}
|
||||
return c != (u);
|
||||
}
|
||||
|
||||
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
|
||||
|
||||
/* Atomic operations are already serializing */
|
||||
#ifdef CONFIG_SMP
|
||||
#define smp_mb__before_atomic_dec() membar_storeload_loadload();
|
||||
#define smp_mb__after_atomic_dec() membar_storeload_storestore();
|
||||
#define smp_mb__before_atomic_inc() membar_storeload_loadload();
|
||||
#define smp_mb__after_atomic_inc() membar_storeload_storestore();
|
||||
#else
|
||||
#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
|
||||
|
||||
#include <asm-generic/atomic.h>
|
||||
#endif /* !(__ARCH_SPARC64_ATOMIC__) */
|
8
arch/sparc/include/asm/auxio.h
Normal file
8
arch/sparc/include/asm/auxio.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_AUXIO_H
|
||||
#define ___ASM_SPARC_AUXIO_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/auxio_64.h>
|
||||
#else
|
||||
#include <asm/auxio_32.h>
|
||||
#endif
|
||||
#endif
|
89
arch/sparc/include/asm/auxio_32.h
Normal file
89
arch/sparc/include/asm/auxio_32.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* auxio.h: Definitions and code for the Auxiliary I/O register.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
#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.
|
||||
* First, it is used to control the front panel LED light on machines
|
||||
* that have it (good for testing entry points to trap handlers and irq's)
|
||||
* Secondly, it controls various floppy drive parameters.
|
||||
*/
|
||||
#define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */
|
||||
#define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */
|
||||
#define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */
|
||||
#define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */
|
||||
#define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */
|
||||
#define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */
|
||||
#define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */
|
||||
|
||||
/* Set the following to one, then zero, after doing a pseudo DMA transfer. */
|
||||
#define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */
|
||||
|
||||
/* Set the following to zero to eject the floppy. */
|
||||
#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
|
||||
#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
* The following routines are provided for driver-compatibility
|
||||
* with sparc64 (primarily sunlance.c)
|
||||
*/
|
||||
|
||||
#define AUXIO_LTE_ON 1
|
||||
#define AUXIO_LTE_OFF 0
|
||||
|
||||
/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
|
||||
*
|
||||
* on - AUXIO_LTE_ON or AUXIO_LTE_OFF
|
||||
*/
|
||||
#define auxio_set_lte(on) \
|
||||
do { \
|
||||
if(on) { \
|
||||
set_auxio(AUXIO_LINK_TEST, 0); \
|
||||
} else { \
|
||||
set_auxio(0, AUXIO_LINK_TEST); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define AUXIO_LED_ON 1
|
||||
#define AUXIO_LED_OFF 0
|
||||
|
||||
/* auxio_set_led - Set system front panel LED
|
||||
*
|
||||
* on - AUXIO_LED_ON or AUXIO_LED_OFF
|
||||
*/
|
||||
#define auxio_set_led(on) \
|
||||
do { \
|
||||
if(on) { \
|
||||
set_auxio(AUXIO_LED, 0); \
|
||||
} else { \
|
||||
set_auxio(0, AUXIO_LED); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* !(__ASSEMBLY__) */
|
||||
|
||||
|
||||
/* AUXIO2 (Power Off Control) */
|
||||
extern __volatile__ unsigned char * auxio_power_register;
|
||||
|
||||
#define AUXIO_POWER_DETECT_FAILURE 32
|
||||
#define AUXIO_POWER_CLEAR_FAILURE 2
|
||||
#define AUXIO_POWER_OFF 1
|
||||
|
||||
|
||||
#endif /* !(_SPARC_AUXIO_H) */
|
100
arch/sparc/include/asm/auxio_64.h
Normal file
100
arch/sparc/include/asm/auxio_64.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* auxio.h: Definitions and code for the Auxiliary I/O registers.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*
|
||||
* Refactoring for unified NCR/PCIO support 2002 Eric Brower (ebrower@usa.net)
|
||||
*/
|
||||
#ifndef _SPARC64_AUXIO_H
|
||||
#define _SPARC64_AUXIO_H
|
||||
|
||||
/* AUXIO implementations:
|
||||
* sbus-based NCR89C105 "Slavio"
|
||||
* LED/Floppy (AUX1) register
|
||||
* Power (AUX2) register
|
||||
*
|
||||
* ebus-based auxio on PCIO
|
||||
* LED Auxio Register
|
||||
* Power Auxio Register
|
||||
*
|
||||
* Register definitions from NCR _NCR89C105 Chip Specification_
|
||||
*
|
||||
* SLAVIO AUX1 @ 0x1900000
|
||||
* -------------------------------------------------
|
||||
* | (R) | (R) | D | (R) | E | M | T | L |
|
||||
* -------------------------------------------------
|
||||
* (R) - bit 7:6,4 are reserved and should be masked in s/w
|
||||
* D - Floppy Density Sense (1=high density) R/O
|
||||
* E - Link Test Enable, directly reflected on AT&T 7213 LTE pin
|
||||
* M - Monitor/Mouse Mux, directly reflected on MON_MSE_MUX pin
|
||||
* T - Terminal Count: sends TC pulse to 82077 floppy controller
|
||||
* L - System LED on front panel (0=off, 1=on)
|
||||
*/
|
||||
#define AUXIO_AUX1_MASK 0xc0 /* Mask bits */
|
||||
#define AUXIO_AUX1_FDENS 0x20 /* Floppy Density Sense */
|
||||
#define AUXIO_AUX1_LTE 0x08 /* Link Test Enable */
|
||||
#define AUXIO_AUX1_MMUX 0x04 /* Monitor/Mouse Mux */
|
||||
#define AUXIO_AUX1_FTCNT 0x02 /* Terminal Count, */
|
||||
#define AUXIO_AUX1_LED 0x01 /* System LED */
|
||||
|
||||
/* SLAVIO AUX2 @ 0x1910000
|
||||
* -------------------------------------------------
|
||||
* | (R) | (R) | D | (R) | (R) | (R) | C | F |
|
||||
* -------------------------------------------------
|
||||
* (R) - bits 7:6,4:2 are reserved and should be masked in s/w
|
||||
* D - Power Failure Detect (1=power fail)
|
||||
* C - Clear Power Failure Detect Int (1=clear)
|
||||
* F - Power Off (1=power off)
|
||||
*/
|
||||
#define AUXIO_AUX2_MASK 0xdc /* Mask Bits */
|
||||
#define AUXIO_AUX2_PFAILDET 0x20 /* Power Fail Detect */
|
||||
#define AUXIO_AUX2_PFAILCLR 0x02 /* Clear Pwr Fail Det Intr */
|
||||
#define AUXIO_AUX2_PWR_OFF 0x01 /* Power Off */
|
||||
|
||||
/* Register definitions from Sun Microsystems _PCIO_ p/n 802-7837
|
||||
*
|
||||
* PCIO LED Auxio @ 0x726000
|
||||
* -------------------------------------------------
|
||||
* | 31:1 Unused | LED |
|
||||
* -------------------------------------------------
|
||||
* Bits 31:1 unused
|
||||
* LED - System LED on front panel (0=off, 1=on)
|
||||
*/
|
||||
#define AUXIO_PCIO_LED 0x01 /* System LED */
|
||||
|
||||
/* PCIO Power Auxio @ 0x724000
|
||||
* -------------------------------------------------
|
||||
* | 31:2 Unused | CPO | SPO |
|
||||
* -------------------------------------------------
|
||||
* Bits 31:2 unused
|
||||
* CPO - Courtesy Power Off (1=off)
|
||||
* SPO - System Power Off (1=off)
|
||||
*/
|
||||
#define AUXIO_PCIO_CPWR_OFF 0x02 /* Courtesy Power Off */
|
||||
#define AUXIO_PCIO_SPWR_OFF 0x01 /* System Power Off */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
extern void __iomem *auxio_register;
|
||||
|
||||
#define AUXIO_LTE_ON 1
|
||||
#define AUXIO_LTE_OFF 0
|
||||
|
||||
/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
|
||||
*
|
||||
* on - AUXIO_LTE_ON or AUXIO_LTE_OFF
|
||||
*/
|
||||
extern void auxio_set_lte(int on);
|
||||
|
||||
#define AUXIO_LED_ON 1
|
||||
#define AUXIO_LED_OFF 0
|
||||
|
||||
/* auxio_set_led - Set system front panel LED
|
||||
*
|
||||
* on - AUXIO_LED_ON or AUXIO_LED_OFF
|
||||
*/
|
||||
extern void auxio_set_led(int on);
|
||||
|
||||
#endif /* ifndef __ASSEMBLY__ */
|
||||
|
||||
#endif /* !(_SPARC64_AUXIO_H) */
|
4
arch/sparc/include/asm/auxvec.h
Normal file
4
arch/sparc/include/asm/auxvec.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef __ASMSPARC_AUXVEC_H
|
||||
#define __ASMSPARC_AUXVEC_H
|
||||
|
||||
#endif /* !(__ASMSPARC_AUXVEC_H) */
|
31
arch/sparc/include/asm/backoff.h
Normal file
31
arch/sparc/include/asm/backoff.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _SPARC64_BACKOFF_H
|
||||
#define _SPARC64_BACKOFF_H
|
||||
|
||||
#define BACKOFF_LIMIT (4 * 1024)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#define BACKOFF_SETUP(reg) \
|
||||
mov 1, reg
|
||||
|
||||
#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;
|
||||
|
||||
#else
|
||||
|
||||
#define BACKOFF_SETUP(reg)
|
||||
#define BACKOFF_SPIN(reg, tmp, label) \
|
||||
ba,pt %xcc, label; \
|
||||
nop;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SPARC64_BACKOFF_H */
|
225
arch/sparc/include/asm/bbc.h
Normal file
225
arch/sparc/include/asm/bbc.h
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* bbc.h: Defines for BootBus Controller found on UltraSPARC-III
|
||||
* systems.
|
||||
*
|
||||
* Copyright (C) 2000 David S. Miller (davem@redhat.com)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_BBC_H
|
||||
#define _SPARC64_BBC_H
|
||||
|
||||
/* Register sizes are indicated by "B" (Byte, 1-byte),
|
||||
* "H" (Half-word, 2 bytes), "W" (Word, 4 bytes) or
|
||||
* "Q" (Quad, 8 bytes) inside brackets.
|
||||
*/
|
||||
|
||||
#define BBC_AID 0x00 /* [B] Agent ID */
|
||||
#define BBC_DEVP 0x01 /* [B] Device Present */
|
||||
#define BBC_ARB 0x02 /* [B] Arbitration */
|
||||
#define BBC_QUIESCE 0x03 /* [B] Quiesce */
|
||||
#define BBC_WDACTION 0x04 /* [B] Watchdog Action */
|
||||
#define BBC_SPG 0x06 /* [B] Soft POR Gen */
|
||||
#define BBC_SXG 0x07 /* [B] Soft XIR Gen */
|
||||
#define BBC_PSRC 0x08 /* [W] POR Source */
|
||||
#define BBC_XSRC 0x0c /* [B] XIR Source */
|
||||
#define BBC_CSC 0x0d /* [B] Clock Synthesizers Control*/
|
||||
#define BBC_ES_CTRL 0x0e /* [H] Energy Star Control */
|
||||
#define BBC_ES_ACT 0x10 /* [W] E* Assert Change Time */
|
||||
#define BBC_ES_DACT 0x14 /* [B] E* De-Assert Change Time */
|
||||
#define BBC_ES_DABT 0x15 /* [B] E* De-Assert Bypass Time */
|
||||
#define BBC_ES_ABT 0x16 /* [H] E* Assert Bypass Time */
|
||||
#define BBC_ES_PST 0x18 /* [W] E* PLL Settle Time */
|
||||
#define BBC_ES_FSL 0x1c /* [W] E* Frequency Switch Latency*/
|
||||
#define BBC_EBUST 0x20 /* [Q] EBUS Timing */
|
||||
#define BBC_JTAG_CMD 0x28 /* [W] JTAG+ Command */
|
||||
#define BBC_JTAG_CTRL 0x2c /* [B] JTAG+ Control */
|
||||
#define BBC_I2C_SEL 0x2d /* [B] I2C Selection */
|
||||
#define BBC_I2C_0_S1 0x2e /* [B] I2C ctrlr-0 reg S1 */
|
||||
#define BBC_I2C_0_S0 0x2f /* [B] I2C ctrlr-0 regs S0,S0',S2,S3*/
|
||||
#define BBC_I2C_1_S1 0x30 /* [B] I2C ctrlr-1 reg S1 */
|
||||
#define BBC_I2C_1_S0 0x31 /* [B] I2C ctrlr-1 regs S0,S0',S2,S3*/
|
||||
#define BBC_KBD_BEEP 0x32 /* [B] Keyboard Beep */
|
||||
#define BBC_KBD_BCNT 0x34 /* [W] Keyboard Beep Counter */
|
||||
|
||||
#define BBC_REGS_SIZE 0x40
|
||||
|
||||
/* There is a 2K scratch ram area at offset 0x80000 but I doubt
|
||||
* we will use it for anything.
|
||||
*/
|
||||
|
||||
/* Agent ID register. This register shows the Safari Agent ID
|
||||
* for the processors. The value returned depends upon which
|
||||
* cpu is reading the register.
|
||||
*/
|
||||
#define BBC_AID_ID 0x07 /* Safari ID */
|
||||
#define BBC_AID_RESV 0xf8 /* Reserved */
|
||||
|
||||
/* Device Present register. One can determine which cpus are actually
|
||||
* present in the machine by interrogating this register.
|
||||
*/
|
||||
#define BBC_DEVP_CPU0 0x01 /* Processor 0 present */
|
||||
#define BBC_DEVP_CPU1 0x02 /* Processor 1 present */
|
||||
#define BBC_DEVP_CPU2 0x04 /* Processor 2 present */
|
||||
#define BBC_DEVP_CPU3 0x08 /* Processor 3 present */
|
||||
#define BBC_DEVP_RESV 0xf0 /* Reserved */
|
||||
|
||||
/* Arbitration register. This register is used to block access to
|
||||
* the BBC from a particular cpu.
|
||||
*/
|
||||
#define BBC_ARB_CPU0 0x01 /* Enable cpu 0 BBC arbitratrion */
|
||||
#define BBC_ARB_CPU1 0x02 /* Enable cpu 1 BBC arbitratrion */
|
||||
#define BBC_ARB_CPU2 0x04 /* Enable cpu 2 BBC arbitratrion */
|
||||
#define BBC_ARB_CPU3 0x08 /* Enable cpu 3 BBC arbitratrion */
|
||||
#define BBC_ARB_RESV 0xf0 /* Reserved */
|
||||
|
||||
/* Quiesce register. Bus and BBC segments for cpus can be disabled
|
||||
* with this register, ie. for hot plugging.
|
||||
*/
|
||||
#define BBC_QUIESCE_S02 0x01 /* Quiesce Safari segment for cpu 0 and 2 */
|
||||
#define BBC_QUIESCE_S13 0x02 /* Quiesce Safari segment for cpu 1 and 3 */
|
||||
#define BBC_QUIESCE_B02 0x04 /* Quiesce BBC segment for cpu 0 and 2 */
|
||||
#define BBC_QUIESCE_B13 0x08 /* Quiesce BBC segment for cpu 1 and 3 */
|
||||
#define BBC_QUIESCE_FD0 0x10 /* Disable Fatal_Error[0] reporting */
|
||||
#define BBC_QUIESCE_FD1 0x20 /* Disable Fatal_Error[1] reporting */
|
||||
#define BBC_QUIESCE_FD2 0x40 /* Disable Fatal_Error[2] reporting */
|
||||
#define BBC_QUIESCE_FD3 0x80 /* Disable Fatal_Error[3] reporting */
|
||||
|
||||
/* Watchdog Action register. When the watchdog device timer expires
|
||||
* a line is enabled to the BBC. The action BBC takes when this line
|
||||
* is asserted can be controlled by this regiser.
|
||||
*/
|
||||
#define BBC_WDACTION_RST 0x01 /* When set, watchdog causes system reset.
|
||||
* When clear, BBC ignores watchdog signal.
|
||||
*/
|
||||
#define BBC_WDACTION_RESV 0xfe /* Reserved */
|
||||
|
||||
/* Soft_POR_GEN register. The POR (Power On Reset) signal may be asserted
|
||||
* for specific processors or all processors via this register.
|
||||
*/
|
||||
#define BBC_SPG_CPU0 0x01 /* Assert POR for processor 0 */
|
||||
#define BBC_SPG_CPU1 0x02 /* Assert POR for processor 1 */
|
||||
#define BBC_SPG_CPU2 0x04 /* Assert POR for processor 2 */
|
||||
#define BBC_SPG_CPU3 0x08 /* Assert POR for processor 3 */
|
||||
#define BBC_SPG_CPUALL 0x10 /* Reset all processors and reset
|
||||
* the entire system.
|
||||
*/
|
||||
#define BBC_SPG_RESV 0xe0 /* Reserved */
|
||||
|
||||
/* Soft_XIR_GEN register. The XIR (eXternally Initiated Reset) signal
|
||||
* may be asserted to specific processors via this register.
|
||||
*/
|
||||
#define BBC_SXG_CPU0 0x01 /* Assert XIR for processor 0 */
|
||||
#define BBC_SXG_CPU1 0x02 /* Assert XIR for processor 1 */
|
||||
#define BBC_SXG_CPU2 0x04 /* Assert XIR for processor 2 */
|
||||
#define BBC_SXG_CPU3 0x08 /* Assert XIR for processor 3 */
|
||||
#define BBC_SXG_RESV 0xf0 /* Reserved */
|
||||
|
||||
/* POR Source register. One may identify the cause of the most recent
|
||||
* reset by reading this register.
|
||||
*/
|
||||
#define BBC_PSRC_SPG0 0x0001 /* CPU 0 reset via BBC_SPG register */
|
||||
#define BBC_PSRC_SPG1 0x0002 /* CPU 1 reset via BBC_SPG register */
|
||||
#define BBC_PSRC_SPG2 0x0004 /* CPU 2 reset via BBC_SPG register */
|
||||
#define BBC_PSRC_SPG3 0x0008 /* CPU 3 reset via BBC_SPG register */
|
||||
#define BBC_PSRC_SPGSYS 0x0010 /* System reset via BBC_SPG register */
|
||||
#define BBC_PSRC_JTAG 0x0020 /* System reset via JTAG+ */
|
||||
#define BBC_PSRC_BUTTON 0x0040 /* System reset via push-button dongle */
|
||||
#define BBC_PSRC_PWRUP 0x0080 /* System reset via power-up */
|
||||
#define BBC_PSRC_FE0 0x0100 /* CPU 0 reported Fatal_Error */
|
||||
#define BBC_PSRC_FE1 0x0200 /* CPU 1 reported Fatal_Error */
|
||||
#define BBC_PSRC_FE2 0x0400 /* CPU 2 reported Fatal_Error */
|
||||
#define BBC_PSRC_FE3 0x0800 /* CPU 3 reported Fatal_Error */
|
||||
#define BBC_PSRC_FE4 0x1000 /* Schizo reported Fatal_Error */
|
||||
#define BBC_PSRC_FE5 0x2000 /* Safari device 5 reported Fatal_Error */
|
||||
#define BBC_PSRC_FE6 0x4000 /* CPMS reported Fatal_Error */
|
||||
#define BBC_PSRC_SYNTH 0x8000 /* System reset when on-board clock synthesizers
|
||||
* were updated.
|
||||
*/
|
||||
#define BBC_PSRC_WDT 0x10000 /* System reset via Super I/O watchdog */
|
||||
#define BBC_PSRC_RSC 0x20000 /* System reset via RSC remote monitoring
|
||||
* device
|
||||
*/
|
||||
|
||||
/* XIR Source register. The source of an XIR event sent to a processor may
|
||||
* be determined via this register.
|
||||
*/
|
||||
#define BBC_XSRC_SXG0 0x01 /* CPU 0 received XIR via Soft_XIR_GEN reg */
|
||||
#define BBC_XSRC_SXG1 0x02 /* CPU 1 received XIR via Soft_XIR_GEN reg */
|
||||
#define BBC_XSRC_SXG2 0x04 /* CPU 2 received XIR via Soft_XIR_GEN reg */
|
||||
#define BBC_XSRC_SXG3 0x08 /* CPU 3 received XIR via Soft_XIR_GEN reg */
|
||||
#define BBC_XSRC_JTAG 0x10 /* All CPUs received XIR via JTAG+ */
|
||||
#define BBC_XSRC_W_OR_B 0x20 /* All CPUs received XIR either because:
|
||||
* a) Super I/O watchdog fired, or
|
||||
* b) XIR push button was activated
|
||||
*/
|
||||
#define BBC_XSRC_RESV 0xc0 /* Reserved */
|
||||
|
||||
/* Clock Synthesizers Control register. This register provides the big-bang
|
||||
* programming interface to the two clock synthesizers of the machine.
|
||||
*/
|
||||
#define BBC_CSC_SLOAD 0x01 /* Directly connected to S_LOAD pins */
|
||||
#define BBC_CSC_SDATA 0x02 /* Directly connected to S_DATA pins */
|
||||
#define BBC_CSC_SCLOCK 0x04 /* Directly connected to S_CLOCK pins */
|
||||
#define BBC_CSC_RESV 0x78 /* Reserved */
|
||||
#define BBC_CSC_RST 0x80 /* Generate system reset when S_LOAD==1 */
|
||||
|
||||
/* Energy Star Control register. This register is used to generate the
|
||||
* clock frequency change trigger to the main system devices (Schizo and
|
||||
* the processors). The transition occurs when bits in this register
|
||||
* go from 0 to 1, only one bit must be set at once else no action
|
||||
* occurs. Basically the sequence of events is:
|
||||
* a) Choose new frequency: full, 1/2 or 1/32
|
||||
* b) Program this desired frequency into the cpus and Schizo.
|
||||
* c) Set the same value in this register.
|
||||
* d) 16 system clocks later, clear this register.
|
||||
*/
|
||||
#define BBC_ES_CTRL_1_1 0x01 /* Full frequency */
|
||||
#define BBC_ES_CTRL_1_2 0x02 /* 1/2 frequency */
|
||||
#define BBC_ES_CTRL_1_32 0x20 /* 1/32 frequency */
|
||||
#define BBC_ES_RESV 0xdc /* Reserved */
|
||||
|
||||
/* Energy Star Assert Change Time register. This determines the number
|
||||
* of BBC clock cycles (which is half the system frequency) between
|
||||
* the detection of FREEZE_ACK being asserted and the assertion of
|
||||
* the CLK_CHANGE_L[2:0] signals.
|
||||
*/
|
||||
#define BBC_ES_ACT_VAL 0xff
|
||||
|
||||
/* Energy Star Assert Bypass Time register. This determines the number
|
||||
* of BBC clock cycles (which is half the system frequency) between
|
||||
* the assertion of the CLK_CHANGE_L[2:0] signals and the assertion of
|
||||
* the ESTAR_PLL_BYPASS signal.
|
||||
*/
|
||||
#define BBC_ES_ABT_VAL 0xffff
|
||||
|
||||
/* Energy Star PLL Settle Time register. This determines the number of
|
||||
* BBC clock cycles (which is half the system frequency) between the
|
||||
* de-assertion of CLK_CHANGE_L[2:0] and the de-assertion of the FREEZE_L
|
||||
* signal.
|
||||
*/
|
||||
#define BBC_ES_PST_VAL 0xffffffff
|
||||
|
||||
/* Energy Star Frequency Switch Latency register. This is the number of
|
||||
* BBC clocks between the de-assertion of CLK_CHANGE_L[2:0] and the first
|
||||
* edge of the Safari clock at the new frequency.
|
||||
*/
|
||||
#define BBC_ES_FSL_VAL 0xffffffff
|
||||
|
||||
/* Keyboard Beep control register. This is a simple enabler for the audio
|
||||
* beep sound.
|
||||
*/
|
||||
#define BBC_KBD_BEEP_ENABLE 0x01 /* Enable beep */
|
||||
#define BBC_KBD_BEEP_RESV 0xfe /* Reserved */
|
||||
|
||||
/* Keyboard Beep Counter register. There is a free-running counter inside
|
||||
* the BBC which runs at half the system clock. The bit set in this register
|
||||
* determines when the audio sound is generated. So for example if bit
|
||||
* 10 is set, the audio beep will oscillate at 1/(2**12). The keyboard beep
|
||||
* generator automatically selects a different bit to use if the system clock
|
||||
* is changed via Energy Star.
|
||||
*/
|
||||
#define BBC_KBD_BCNT_BITS 0x0007fc00
|
||||
#define BBC_KBC_BCNT_RESV 0xfff803ff
|
||||
|
||||
#endif /* _SPARC64_BBC_H */
|
||||
|
27
arch/sparc/include/asm/bitext.h
Normal file
27
arch/sparc/include/asm/bitext.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* bitext.h: Bit string operations on the sparc, specific to architecture.
|
||||
*
|
||||
* Copyright 2002 Pete Zaitcev <zaitcev@yahoo.com>
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_BITEXT_H
|
||||
#define _SPARC_BITEXT_H
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
struct bit_map {
|
||||
spinlock_t lock;
|
||||
unsigned long *map;
|
||||
int size;
|
||||
int used;
|
||||
int last_off;
|
||||
int last_size;
|
||||
int first_free;
|
||||
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);
|
||||
|
||||
#endif /* defined(_SPARC_BITEXT_H) */
|
8
arch/sparc/include/asm/bitops.h
Normal file
8
arch/sparc/include/asm/bitops.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_BITOPS_H
|
||||
#define ___ASM_SPARC_BITOPS_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/bitops_64.h>
|
||||
#else
|
||||
#include <asm/bitops_32.h>
|
||||
#endif
|
||||
#endif
|
111
arch/sparc/include/asm/bitops_32.h
Normal file
111
arch/sparc/include/asm/bitops_32.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* bitops.h: Bit string operations on the Sparc.
|
||||
*
|
||||
* Copyright 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
* Copyright 1996 Eddie C. Dost (ecd@skynet.be)
|
||||
* Copyright 2001 Anton Blanchard (anton@samba.org)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_BITOPS_H
|
||||
#define _SPARC_BITOPS_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifndef _LINUX_BITOPS_H
|
||||
#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);
|
||||
|
||||
/*
|
||||
* Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0'
|
||||
* is in the highest of the four bytes and bit '31' is the high bit
|
||||
* within the first byte. Sparc is BIG-Endian. Unless noted otherwise
|
||||
* all bit-ops return 0 if bit was previously clear and != 0 otherwise.
|
||||
*/
|
||||
static inline int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *ADDR, mask;
|
||||
|
||||
ADDR = ((unsigned long *) addr) + (nr >> 5);
|
||||
mask = 1 << (nr & 31);
|
||||
|
||||
return ___set_bit(ADDR, mask) != 0;
|
||||
}
|
||||
|
||||
static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *ADDR, mask;
|
||||
|
||||
ADDR = ((unsigned long *) addr) + (nr >> 5);
|
||||
mask = 1 << (nr & 31);
|
||||
|
||||
(void) ___set_bit(ADDR, mask);
|
||||
}
|
||||
|
||||
static inline int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *ADDR, mask;
|
||||
|
||||
ADDR = ((unsigned long *) addr) + (nr >> 5);
|
||||
mask = 1 << (nr & 31);
|
||||
|
||||
return ___clear_bit(ADDR, mask) != 0;
|
||||
}
|
||||
|
||||
static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *ADDR, mask;
|
||||
|
||||
ADDR = ((unsigned long *) addr) + (nr >> 5);
|
||||
mask = 1 << (nr & 31);
|
||||
|
||||
(void) ___clear_bit(ADDR, mask);
|
||||
}
|
||||
|
||||
static inline int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *ADDR, mask;
|
||||
|
||||
ADDR = ((unsigned long *) addr) + (nr >> 5);
|
||||
mask = 1 << (nr & 31);
|
||||
|
||||
return ___change_bit(ADDR, mask) != 0;
|
||||
}
|
||||
|
||||
static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *ADDR, mask;
|
||||
|
||||
ADDR = ((unsigned long *) addr) + (nr >> 5);
|
||||
mask = 1 << (nr & 31);
|
||||
|
||||
(void) ___change_bit(ADDR, mask);
|
||||
}
|
||||
|
||||
#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>
|
||||
#include <asm-generic/bitops/ffs.h>
|
||||
#include <asm-generic/bitops/fls.h>
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
#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/ext2-atomic.h>
|
||||
#include <asm-generic/bitops/minix.h>
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* defined(_SPARC_BITOPS_H) */
|
107
arch/sparc/include/asm/bitops_64.h
Normal file
107
arch/sparc/include/asm/bitops_64.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* bitops.h: Bit string operations on the V9.
|
||||
*
|
||||
* Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_BITOPS_H
|
||||
#define _SPARC64_BITOPS_H
|
||||
|
||||
#ifndef _LINUX_BITOPS_H
|
||||
#error only <linux/bitops.h> can be included directly
|
||||
#endif
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/byteorder.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);
|
||||
|
||||
#include <asm-generic/bitops/non-atomic.h>
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#define smp_mb__before_clear_bit() membar_storeload_loadload()
|
||||
#define smp_mb__after_clear_bit() membar_storeload_storestore()
|
||||
#else
|
||||
#define smp_mb__before_clear_bit() barrier()
|
||||
#define smp_mb__after_clear_bit() barrier()
|
||||
#endif
|
||||
|
||||
#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__
|
||||
|
||||
#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 hweight64(unsigned long w)
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w));
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline unsigned int hweight32(unsigned int w)
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff));
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline unsigned int hweight16(unsigned int w)
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff));
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline unsigned int hweight8(unsigned int w)
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff));
|
||||
return res;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <asm-generic/bitops/hweight.h>
|
||||
|
||||
#endif
|
||||
#include <asm-generic/bitops/lock.h>
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#include <asm-generic/bitops/find.h>
|
||||
|
||||
#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/minix.h>
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* defined(_SPARC64_BITOPS_H) */
|
73
arch/sparc/include/asm/bpp.h
Normal file
73
arch/sparc/include/asm/bpp.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#ifndef _SPARC_BPP_H
|
||||
#define _SPARC_BPP_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Picture Elements
|
||||
* Stephen Williams
|
||||
* Gus Baldauf
|
||||
*
|
||||
* Linux/SPARC port by Peter Zaitcev.
|
||||
* Integration into SPARC tree by Tom Dyas.
|
||||
*/
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
/*
|
||||
* This is a driver that supports IEEE Std 1284-1994 communications
|
||||
* with compliant or compatible devices. It will use whatever features
|
||||
* the device supports, prefering those that are typically faster.
|
||||
*
|
||||
* When the device is opened, it is left in COMPATIBILITY mode, and
|
||||
* writes work like any printer device. The driver only attempt to
|
||||
* negotiate 1284 modes when needed so that plugs can be pulled,
|
||||
* switch boxes switched, etc., without disrupting things. It will
|
||||
* also leave the device in compatibility mode when closed.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This driver also supplies ioctls to manually manipulate the
|
||||
* pins. This is great for testing devices, or writing code to deal
|
||||
* with bizzarro-mode of the ACME Special TurboThingy Plus.
|
||||
*
|
||||
* NOTE: These ioctl currently do not interact well with
|
||||
* read/write. Caveat emptor.
|
||||
*
|
||||
* PUT_PINS allows us to assign the sense of all the pins, including
|
||||
* the data pins if being driven by the host. The GET_PINS returns the
|
||||
* pins that the peripheral drives, including data if appropriate.
|
||||
*/
|
||||
|
||||
# define BPP_PUT_PINS _IOW('B', 1, int)
|
||||
# define BPP_GET_PINS _IOR('B', 2, char) /* that's bogus - should've been _IO */
|
||||
# define BPP_PUT_DATA _IOW('B', 3, int)
|
||||
# define BPP_GET_DATA _IOR('B', 4, char) /* ditto */
|
||||
|
||||
/*
|
||||
* Set the data bus to input mode. Disengage the data bin driver and
|
||||
* be prepared to read values from the peripheral. If the arg is 0,
|
||||
* then revert the bus to output mode.
|
||||
*/
|
||||
# define BPP_SET_INPUT _IOW('B', 5, int)
|
||||
|
||||
/*
|
||||
* These bits apply to the PUT operation...
|
||||
*/
|
||||
# define BPP_PP_nStrobe 0x0001
|
||||
# define BPP_PP_nAutoFd 0x0002
|
||||
# define BPP_PP_nInit 0x0004
|
||||
# define BPP_PP_nSelectIn 0x0008
|
||||
|
||||
/*
|
||||
* These apply to the GET operation, which also reads the current value
|
||||
* of the previously put values. A bit mask of these will be returned
|
||||
* as a bit mask in the return code of the ioctl().
|
||||
*/
|
||||
# define BPP_GP_nAck 0x0100
|
||||
# define BPP_GP_Busy 0x0200
|
||||
# define BPP_GP_PError 0x0400
|
||||
# define BPP_GP_Select 0x0800
|
||||
# define BPP_GP_nFault 0x1000
|
||||
|
||||
#endif
|
208
arch/sparc/include/asm/btfixup.h
Normal file
208
arch/sparc/include/asm/btfixup.h
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* 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) */
|
22
arch/sparc/include/asm/bug.h
Normal file
22
arch/sparc/include/asm/bug.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef _SPARC_BUG_H
|
||||
#define _SPARC_BUG_H
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
||||
extern void do_BUG(const char *file, int line);
|
||||
#define BUG() do { \
|
||||
do_BUG(__FILE__, __LINE__); \
|
||||
__builtin_trap(); \
|
||||
} while (0)
|
||||
#else
|
||||
#define BUG() __builtin_trap()
|
||||
#endif
|
||||
|
||||
#define HAVE_ARCH_BUG
|
||||
#endif
|
||||
|
||||
#include <asm-generic/bug.h>
|
||||
|
||||
#endif
|
24
arch/sparc/include/asm/bugs.h
Normal file
24
arch/sparc/include/asm/bugs.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* include/asm/bugs.h: Sparc probes for various bugs.
|
||||
*
|
||||
* Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SPARC32
|
||||
#include <asm/cpudata.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPARC64
|
||||
#include <asm/sstate.h>
|
||||
#endif
|
||||
|
||||
extern unsigned long loops_per_jiffy;
|
||||
|
||||
static void __init check_bugs(void)
|
||||
{
|
||||
#if defined(CONFIG_SPARC32) && !defined(CONFIG_SMP)
|
||||
cpu_data(0).udelay_val = loops_per_jiffy;
|
||||
#endif
|
||||
#ifdef CONFIG_SPARC64
|
||||
sstate_running();
|
||||
#endif
|
||||
}
|
57
arch/sparc/include/asm/byteorder.h
Normal file
57
arch/sparc/include/asm/byteorder.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef _SPARC_BYTEORDER_H
|
||||
#define _SPARC_BYTEORDER_H
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/asi.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#ifdef CONFIG_SPARC32
|
||||
#define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPARC64
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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__swab16p(x) ___arch__swab16p(x)
|
||||
#define __arch__swab32p(x) ___arch__swab32p(x)
|
||||
#define __arch__swab64p(x) ___arch__swab64p(x)
|
||||
|
||||
#endif /* CONFIG_SPARC64 */
|
||||
|
||||
#define __BYTEORDER_HAS_U64__
|
||||
|
||||
#endif
|
||||
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
|
||||
#endif /* _SPARC_BYTEORDER_H */
|
138
arch/sparc/include/asm/cache.h
Normal file
138
arch/sparc/include/asm/cache.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* cache.h: Cache specific code for the Sparc. These include flushing
|
||||
* and direct tag/data line access.
|
||||
*
|
||||
* Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_CACHE_H
|
||||
#define _SPARC_CACHE_H
|
||||
|
||||
#define L1_CACHE_SHIFT 5
|
||||
#define L1_CACHE_BYTES 32
|
||||
#define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)))
|
||||
|
||||
#ifdef CONFIG_SPARC32
|
||||
#define SMP_CACHE_BYTES_SHIFT 5
|
||||
#else
|
||||
#define SMP_CACHE_BYTES_SHIFT 6
|
||||
#endif
|
||||
|
||||
#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
|
||||
|
||||
#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) */
|
8
arch/sparc/include/asm/cacheflush.h
Normal file
8
arch/sparc/include/asm/cacheflush.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_CACHEFLUSH_H
|
||||
#define ___ASM_SPARC_CACHEFLUSH_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/cacheflush_64.h>
|
||||
#else
|
||||
#include <asm/cacheflush_32.h>
|
||||
#endif
|
||||
#endif
|
85
arch/sparc/include/asm/cacheflush_32.h
Normal file
85
arch/sparc/include/asm/cacheflush_32.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#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)
|
||||
#define flush_icache_range(start, end) do { } while (0)
|
||||
#define flush_icache_page(vma, pg) do { } while (0)
|
||||
|
||||
#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
|
||||
|
||||
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
|
||||
do { \
|
||||
flush_cache_page(vma, vaddr, page_to_pfn(page));\
|
||||
memcpy(dst, src, len); \
|
||||
} while (0)
|
||||
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
|
||||
do { \
|
||||
flush_cache_page(vma, vaddr, page_to_pfn(page));\
|
||||
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) 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);
|
||||
|
||||
#define flush_dcache_page(page) sparc_flush_page_to_ram(page)
|
||||
#define flush_dcache_mmap_lock(mapping) do { } while (0)
|
||||
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
|
||||
|
||||
#define flush_cache_vmap(start, end) flush_cache_all()
|
||||
#define flush_cache_vunmap(start, end) flush_cache_all()
|
||||
|
||||
#endif /* _SPARC_CACHEFLUSH_H */
|
76
arch/sparc/include/asm/cacheflush_64.h
Normal file
76
arch/sparc/include/asm/cacheflush_64.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef _SPARC64_CACHEFLUSH_H
|
||||
#define _SPARC64_CACHEFLUSH_H
|
||||
|
||||
#include <asm/page.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/mm.h>
|
||||
|
||||
/* Cache flush operations. */
|
||||
|
||||
/* These are the same regardless of whether this is an SMP kernel or not. */
|
||||
#define flush_cache_mm(__mm) \
|
||||
do { if ((__mm) == current->mm) flushw_user(); } while(0)
|
||||
#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
|
||||
#define flush_cache_range(vma, start, end) \
|
||||
flush_cache_mm((vma)->vm_mm)
|
||||
#define flush_cache_page(vma, page, pfn) \
|
||||
flush_cache_mm((vma)->vm_mm)
|
||||
|
||||
/*
|
||||
* On spitfire, the icache doesn't snoop local stores and we don't
|
||||
* 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);
|
||||
|
||||
extern void __flush_dcache_page(void *addr, int flush_icache);
|
||||
extern 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);
|
||||
#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);
|
||||
extern 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);
|
||||
|
||||
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
|
||||
do { \
|
||||
flush_cache_page(vma, vaddr, page_to_pfn(page)); \
|
||||
memcpy(dst, src, len); \
|
||||
flush_ptrace_access(vma, page, vaddr, src, len, 0); \
|
||||
} while (0)
|
||||
|
||||
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
|
||||
do { \
|
||||
flush_cache_page(vma, vaddr, page_to_pfn(page)); \
|
||||
memcpy(dst, src, len); \
|
||||
flush_ptrace_access(vma, page, vaddr, dst, len, 1); \
|
||||
} while (0)
|
||||
|
||||
#define flush_dcache_mmap_lock(mapping) do { } while (0)
|
||||
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
|
||||
|
||||
#define flush_cache_vmap(start, end) do { } while (0)
|
||||
#define flush_cache_vunmap(start, end) do { } while (0)
|
||||
|
||||
#ifdef CONFIG_DEBUG_PAGEALLOC
|
||||
/* internal debugging function */
|
||||
void kernel_map_pages(struct page *page, int numpages, int enable);
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _SPARC64_CACHEFLUSH_H */
|
241
arch/sparc/include/asm/chafsr.h
Normal file
241
arch/sparc/include/asm/chafsr.h
Normal file
@@ -0,0 +1,241 @@
|
||||
#ifndef _SPARC64_CHAFSR_H
|
||||
#define _SPARC64_CHAFSR_H
|
||||
|
||||
/* Cheetah Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */
|
||||
|
||||
/* Comments indicate which processor variants on which the bit definition
|
||||
* is valid. Codes are:
|
||||
* ch --> cheetah
|
||||
* ch+ --> cheetah plus
|
||||
* jp --> jalapeno
|
||||
*/
|
||||
|
||||
/* All bits of this register except M_SYNDROME and E_SYNDROME are
|
||||
* read, write 1 to clear. M_SYNDROME and E_SYNDROME are read-only.
|
||||
*/
|
||||
|
||||
/* Software bit set by linux trap handlers to indicate that the trap was
|
||||
* signalled at %tl >= 1.
|
||||
*/
|
||||
#define CHAFSR_TL1 (1UL << 63UL) /* n/a */
|
||||
|
||||
/* Unmapped error from system bus for prefetch queue or
|
||||
* store queue read operation
|
||||
*/
|
||||
#define CHPAFSR_DTO (1UL << 59UL) /* ch+ */
|
||||
|
||||
/* Bus error from system bus for prefetch queue or store queue
|
||||
* read operation
|
||||
*/
|
||||
#define CHPAFSR_DBERR (1UL << 58UL) /* ch+ */
|
||||
|
||||
/* Hardware corrected E-cache Tag ECC error */
|
||||
#define CHPAFSR_THCE (1UL << 57UL) /* ch+ */
|
||||
/* System interface protocol error, hw timeout caused */
|
||||
#define JPAFSR_JETO (1UL << 57UL) /* jp */
|
||||
|
||||
/* SW handled correctable E-cache Tag ECC error */
|
||||
#define CHPAFSR_TSCE (1UL << 56UL) /* ch+ */
|
||||
/* Parity error on system snoop results */
|
||||
#define JPAFSR_SCE (1UL << 56UL) /* jp */
|
||||
|
||||
/* Uncorrectable E-cache Tag ECC error */
|
||||
#define CHPAFSR_TUE (1UL << 55UL) /* ch+ */
|
||||
/* System interface protocol error, illegal command detected */
|
||||
#define JPAFSR_JEIC (1UL << 55UL) /* jp */
|
||||
|
||||
/* Uncorrectable system bus data ECC error due to prefetch
|
||||
* or store fill request
|
||||
*/
|
||||
#define CHPAFSR_DUE (1UL << 54UL) /* ch+ */
|
||||
/* System interface protocol error, illegal ADTYPE detected */
|
||||
#define JPAFSR_JEIT (1UL << 54UL) /* jp */
|
||||
|
||||
/* Multiple errors of the same type have occurred. This bit is set when
|
||||
* an uncorrectable error or a SW correctable error occurs and the status
|
||||
* bit to report that error is already set. When multiple errors of
|
||||
* different types are indicated by setting multiple status bits.
|
||||
*
|
||||
* This bit is not set if multiple HW corrected errors with the same
|
||||
* status bit occur, only uncorrectable and SW correctable ones have
|
||||
* this behavior.
|
||||
*
|
||||
* This bit is not set when multiple ECC errors happen within a single
|
||||
* 64-byte system bus transaction. Only the first ECC error in a 16-byte
|
||||
* subunit will be logged. All errors in subsequent 16-byte subunits
|
||||
* from the same 64-byte transaction are ignored.
|
||||
*/
|
||||
#define CHAFSR_ME (1UL << 53UL) /* ch,ch+,jp */
|
||||
|
||||
/* Privileged state error has occurred. This is a capture of PSTATE.PRIV
|
||||
* at the time the error is detected.
|
||||
*/
|
||||
#define CHAFSR_PRIV (1UL << 52UL) /* ch,ch+,jp */
|
||||
|
||||
/* The following bits 51 (CHAFSR_PERR) to 33 (CHAFSR_CE) are sticky error
|
||||
* bits and record the most recently detected errors. Bits accumulate
|
||||
* errors that have been detected since the last write to clear the bit.
|
||||
*/
|
||||
|
||||
/* System interface protocol error. The processor asserts its' ERROR
|
||||
* pin when this event occurs and it also logs a specific cause code
|
||||
* into a JTAG scannable flop.
|
||||
*/
|
||||
#define CHAFSR_PERR (1UL << 51UL) /* ch,ch+,jp */
|
||||
|
||||
/* Internal processor error. The processor asserts its' ERROR
|
||||
* pin when this event occurs and it also logs a specific cause code
|
||||
* into a JTAG scannable flop.
|
||||
*/
|
||||
#define CHAFSR_IERR (1UL << 50UL) /* ch,ch+,jp */
|
||||
|
||||
/* System request parity error on incoming address */
|
||||
#define CHAFSR_ISAP (1UL << 49UL) /* ch,ch+,jp */
|
||||
|
||||
/* HW Corrected system bus MTAG ECC error */
|
||||
#define CHAFSR_EMC (1UL << 48UL) /* ch,ch+ */
|
||||
/* Parity error on L2 cache tag SRAM */
|
||||
#define JPAFSR_ETP (1UL << 48UL) /* jp */
|
||||
|
||||
/* Uncorrectable system bus MTAG ECC error */
|
||||
#define CHAFSR_EMU (1UL << 47UL) /* ch,ch+ */
|
||||
/* Out of range memory error has occurred */
|
||||
#define JPAFSR_OM (1UL << 47UL) /* jp */
|
||||
|
||||
/* HW Corrected system bus data ECC error for read of interrupt vector */
|
||||
#define CHAFSR_IVC (1UL << 46UL) /* ch,ch+ */
|
||||
/* Error due to unsupported store */
|
||||
#define JPAFSR_UMS (1UL << 46UL) /* jp */
|
||||
|
||||
/* Uncorrectable system bus data ECC error for read of interrupt vector */
|
||||
#define CHAFSR_IVU (1UL << 45UL) /* ch,ch+,jp */
|
||||
|
||||
/* Unmapped error from system bus */
|
||||
#define CHAFSR_TO (1UL << 44UL) /* ch,ch+,jp */
|
||||
|
||||
/* Bus error response from system bus */
|
||||
#define CHAFSR_BERR (1UL << 43UL) /* ch,ch+,jp */
|
||||
|
||||
/* SW Correctable E-cache ECC error for instruction fetch or data access
|
||||
* other than block load.
|
||||
*/
|
||||
#define CHAFSR_UCC (1UL << 42UL) /* ch,ch+,jp */
|
||||
|
||||
/* Uncorrectable E-cache ECC error for instruction fetch or data access
|
||||
* other than block load.
|
||||
*/
|
||||
#define CHAFSR_UCU (1UL << 41UL) /* ch,ch+,jp */
|
||||
|
||||
/* Copyout HW Corrected ECC error */
|
||||
#define CHAFSR_CPC (1UL << 40UL) /* ch,ch+,jp */
|
||||
|
||||
/* Copyout Uncorrectable ECC error */
|
||||
#define CHAFSR_CPU (1UL << 39UL) /* ch,ch+,jp */
|
||||
|
||||
/* HW Corrected ECC error from E-cache for writeback */
|
||||
#define CHAFSR_WDC (1UL << 38UL) /* ch,ch+,jp */
|
||||
|
||||
/* Uncorrectable ECC error from E-cache for writeback */
|
||||
#define CHAFSR_WDU (1UL << 37UL) /* ch,ch+,jp */
|
||||
|
||||
/* HW Corrected ECC error from E-cache for store merge or block load */
|
||||
#define CHAFSR_EDC (1UL << 36UL) /* ch,ch+,jp */
|
||||
|
||||
/* Uncorrectable ECC error from E-cache for store merge or block load */
|
||||
#define CHAFSR_EDU (1UL << 35UL) /* ch,ch+,jp */
|
||||
|
||||
/* Uncorrectable system bus data ECC error for read of memory or I/O */
|
||||
#define CHAFSR_UE (1UL << 34UL) /* ch,ch+,jp */
|
||||
|
||||
/* HW Corrected system bus data ECC error for read of memory or I/O */
|
||||
#define CHAFSR_CE (1UL << 33UL) /* ch,ch+,jp */
|
||||
|
||||
/* Uncorrectable ECC error from remote cache/memory */
|
||||
#define JPAFSR_RUE (1UL << 32UL) /* jp */
|
||||
|
||||
/* Correctable ECC error from remote cache/memory */
|
||||
#define JPAFSR_RCE (1UL << 31UL) /* jp */
|
||||
|
||||
/* JBUS parity error on returned read data */
|
||||
#define JPAFSR_BP (1UL << 30UL) /* jp */
|
||||
|
||||
/* JBUS parity error on data for writeback or block store */
|
||||
#define JPAFSR_WBP (1UL << 29UL) /* jp */
|
||||
|
||||
/* Foreign read to DRAM incurring correctable ECC error */
|
||||
#define JPAFSR_FRC (1UL << 28UL) /* jp */
|
||||
|
||||
/* Foreign read to DRAM incurring uncorrectable ECC error */
|
||||
#define JPAFSR_FRU (1UL << 27UL) /* jp */
|
||||
|
||||
#define CHAFSR_ERRORS (CHAFSR_PERR | CHAFSR_IERR | CHAFSR_ISAP | CHAFSR_EMC | \
|
||||
CHAFSR_EMU | CHAFSR_IVC | CHAFSR_IVU | CHAFSR_TO | \
|
||||
CHAFSR_BERR | CHAFSR_UCC | CHAFSR_UCU | CHAFSR_CPC | \
|
||||
CHAFSR_CPU | CHAFSR_WDC | CHAFSR_WDU | CHAFSR_EDC | \
|
||||
CHAFSR_EDU | CHAFSR_UE | CHAFSR_CE)
|
||||
#define CHPAFSR_ERRORS (CHPAFSR_DTO | CHPAFSR_DBERR | CHPAFSR_THCE | \
|
||||
CHPAFSR_TSCE | CHPAFSR_TUE | CHPAFSR_DUE | \
|
||||
CHAFSR_PERR | CHAFSR_IERR | CHAFSR_ISAP | CHAFSR_EMC | \
|
||||
CHAFSR_EMU | CHAFSR_IVC | CHAFSR_IVU | CHAFSR_TO | \
|
||||
CHAFSR_BERR | CHAFSR_UCC | CHAFSR_UCU | CHAFSR_CPC | \
|
||||
CHAFSR_CPU | CHAFSR_WDC | CHAFSR_WDU | CHAFSR_EDC | \
|
||||
CHAFSR_EDU | CHAFSR_UE | CHAFSR_CE)
|
||||
#define JPAFSR_ERRORS (JPAFSR_JETO | JPAFSR_SCE | JPAFSR_JEIC | \
|
||||
JPAFSR_JEIT | CHAFSR_PERR | CHAFSR_IERR | \
|
||||
CHAFSR_ISAP | JPAFSR_ETP | JPAFSR_OM | \
|
||||
JPAFSR_UMS | CHAFSR_IVU | CHAFSR_TO | \
|
||||
CHAFSR_BERR | CHAFSR_UCC | CHAFSR_UCU | \
|
||||
CHAFSR_CPC | CHAFSR_CPU | CHAFSR_WDC | \
|
||||
CHAFSR_WDU | CHAFSR_EDC | CHAFSR_EDU | \
|
||||
CHAFSR_UE | CHAFSR_CE | JPAFSR_RUE | \
|
||||
JPAFSR_RCE | JPAFSR_BP | JPAFSR_WBP | \
|
||||
JPAFSR_FRC | JPAFSR_FRU)
|
||||
|
||||
/* Active JBUS request signal when error occurred */
|
||||
#define JPAFSR_JBREQ (0x7UL << 24UL) /* jp */
|
||||
#define JPAFSR_JBREQ_SHIFT 24UL
|
||||
|
||||
/* L2 cache way information */
|
||||
#define JPAFSR_ETW (0x3UL << 22UL) /* jp */
|
||||
#define JPAFSR_ETW_SHIFT 22UL
|
||||
|
||||
/* System bus MTAG ECC syndrome. This field captures the status of the
|
||||
* first occurrence of the highest-priority error according to the M_SYND
|
||||
* overwrite policy. After the AFSR sticky bit, corresponding to the error
|
||||
* for which the M_SYND is reported, is cleared, the contents of the M_SYND
|
||||
* field will be unchanged by will be unfrozen for further error capture.
|
||||
*/
|
||||
#define CHAFSR_M_SYNDROME (0xfUL << 16UL) /* ch,ch+,jp */
|
||||
#define CHAFSR_M_SYNDROME_SHIFT 16UL
|
||||
|
||||
/* Agenid Id of the foreign device causing the UE/CE errors */
|
||||
#define JPAFSR_AID (0x1fUL << 9UL) /* jp */
|
||||
#define JPAFSR_AID_SHIFT 9UL
|
||||
|
||||
/* System bus or E-cache data ECC syndrome. This field captures the status
|
||||
* of the first occurrence of the highest-priority error according to the
|
||||
* E_SYND overwrite policy. After the AFSR sticky bit, corresponding to the
|
||||
* error for which the E_SYND is reported, is cleare, the contents of the E_SYND
|
||||
* field will be unchanged but will be unfrozen for further error capture.
|
||||
*/
|
||||
#define CHAFSR_E_SYNDROME (0x1ffUL << 0UL) /* ch,ch+,jp */
|
||||
#define CHAFSR_E_SYNDROME_SHIFT 0UL
|
||||
|
||||
/* The AFSR must be explicitly cleared by software, it is not cleared automatically
|
||||
* by a read. Writes to bits <51:33> with bits set will clear the corresponding
|
||||
* bits in the AFSR. Bits associated with disrupting traps must be cleared before
|
||||
* interrupts are re-enabled to prevent multiple traps for the same error. I.e.
|
||||
* PSTATE.IE and AFSR bits control delivery of disrupting traps.
|
||||
*
|
||||
* Since there is only one AFAR, when multiple events have been logged by the
|
||||
* bits in the AFSR, at most one of these events will have its status captured
|
||||
* in the AFAR. The highest priority of those event bits will get AFAR logging.
|
||||
* The AFAR will be unlocked and available to capture the address of another event
|
||||
* as soon as the one bit in AFSR that corresponds to the event logged in AFAR is
|
||||
* cleared. For example, if AFSR.CE is detected, then AFSR.UE (which overwrites
|
||||
* the AFAR), and AFSR.UE is cleared by not AFSR.CE, then the AFAR will be unlocked
|
||||
* and ready for another event, even though AFSR.CE is still set. The same rules
|
||||
* also apply to the M_SYNDROME and E_SYNDROME fields of the AFSR.
|
||||
*/
|
||||
|
||||
#endif /* _SPARC64_CHAFSR_H */
|
8
arch/sparc/include/asm/checksum.h
Normal file
8
arch/sparc/include/asm/checksum.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_CHECKSUM_H
|
||||
#define ___ASM_SPARC_CHECKSUM_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/checksum_64.h>
|
||||
#else
|
||||
#include <asm/checksum_32.h>
|
||||
#endif
|
||||
#endif
|
241
arch/sparc/include/asm/checksum_32.h
Normal file
241
arch/sparc/include/asm/checksum_32.h
Normal file
@@ -0,0 +1,241 @@
|
||||
#ifndef __SPARC_CHECKSUM_H
|
||||
#define __SPARC_CHECKSUM_H
|
||||
|
||||
/* checksum.h: IP/UDP/TCP checksum routines on the Sparc.
|
||||
*
|
||||
* Copyright(C) 1995 Linus Torvalds
|
||||
* Copyright(C) 1995 Miguel de Icaza
|
||||
* Copyright(C) 1996 David S. Miller
|
||||
* Copyright(C) 1996 Eddie C. Dost
|
||||
* Copyright(C) 1997 Jakub Jelinek
|
||||
*
|
||||
* derived from:
|
||||
* Alpha checksum c-code
|
||||
* ix86 inline assembly
|
||||
* RFC1071 Computing the Internet Checksum
|
||||
*/
|
||||
|
||||
#include <linux/in6.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/* computes the checksum of a memory block at buff, length len,
|
||||
* and adds in "sum" (32-bit)
|
||||
*
|
||||
* returns a 32-bit number suitable for feeding into itself
|
||||
* or csum_tcpudp_magic
|
||||
*
|
||||
* this function must be called with even lengths, except
|
||||
* for the last fragment, which may be odd
|
||||
*
|
||||
* it's best to have buff aligned on a 32-bit boundary
|
||||
*/
|
||||
extern __wsum csum_partial(const void *buff, int len, __wsum sum);
|
||||
|
||||
/* the same as csum_partial, but copies from fs:src while it
|
||||
* checksums
|
||||
*
|
||||
* here even more important to align src and dst on a 32-bit (or even
|
||||
* better 64-bit) boundary
|
||||
*/
|
||||
|
||||
extern 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)
|
||||
{
|
||||
register unsigned int ret asm("o0") = (unsigned int)src;
|
||||
register char *d asm("o1") = dst;
|
||||
register int l asm("g1") = len;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"call __csum_partial_copy_sparc_generic\n\t"
|
||||
" mov %6, %%g7\n"
|
||||
: "=&r" (ret), "=&r" (d), "=&r" (l)
|
||||
: "0" (ret), "1" (d), "2" (l), "r" (sum)
|
||||
: "o2", "o3", "o4", "o5", "o7",
|
||||
"g2", "g3", "g4", "g5", "g7",
|
||||
"memory", "cc");
|
||||
return (__force __wsum)ret;
|
||||
}
|
||||
|
||||
static inline __wsum
|
||||
csum_partial_copy_from_user(const void __user *src, void *dst, int len,
|
||||
__wsum sum, int *err)
|
||||
{
|
||||
register unsigned long ret asm("o0") = (unsigned long)src;
|
||||
register char *d asm("o1") = dst;
|
||||
register int l asm("g1") = len;
|
||||
register __wsum s asm("g7") = sum;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
".section __ex_table,#alloc\n\t"
|
||||
".align 4\n\t"
|
||||
".word 1f,2\n\t"
|
||||
".previous\n"
|
||||
"1:\n\t"
|
||||
"call __csum_partial_copy_sparc_generic\n\t"
|
||||
" st %8, [%%sp + 64]\n"
|
||||
: "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s)
|
||||
: "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err)
|
||||
: "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5",
|
||||
"cc", "memory");
|
||||
return (__force __wsum)ret;
|
||||
}
|
||||
|
||||
static inline __wsum
|
||||
csum_partial_copy_to_user(const void *src, void __user *dst, int len,
|
||||
__wsum sum, int *err)
|
||||
{
|
||||
if (!access_ok (VERIFY_WRITE, dst, len)) {
|
||||
*err = -EFAULT;
|
||||
return sum;
|
||||
} else {
|
||||
register unsigned long ret asm("o0") = (unsigned long)src;
|
||||
register char __user *d asm("o1") = dst;
|
||||
register int l asm("g1") = len;
|
||||
register __wsum s asm("g7") = sum;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
".section __ex_table,#alloc\n\t"
|
||||
".align 4\n\t"
|
||||
".word 1f,1\n\t"
|
||||
".previous\n"
|
||||
"1:\n\t"
|
||||
"call __csum_partial_copy_sparc_generic\n\t"
|
||||
" st %8, [%%sp + 64]\n"
|
||||
: "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s)
|
||||
: "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err)
|
||||
: "o2", "o3", "o4", "o5", "o7",
|
||||
"g2", "g3", "g4", "g5",
|
||||
"cc", "memory");
|
||||
return (__force __wsum)ret;
|
||||
}
|
||||
}
|
||||
|
||||
#define HAVE_CSUM_COPY_USER
|
||||
#define csum_and_copy_to_user csum_partial_copy_to_user
|
||||
|
||||
/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
|
||||
* the majority of the time.
|
||||
*/
|
||||
static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
|
||||
{
|
||||
__sum16 sum;
|
||||
|
||||
/* Note: We must read %2 before we touch %0 for the first time,
|
||||
* because GCC can legitimately use the same register for
|
||||
* both operands.
|
||||
*/
|
||||
__asm__ __volatile__("sub\t%2, 4, %%g4\n\t"
|
||||
"ld\t[%1 + 0x00], %0\n\t"
|
||||
"ld\t[%1 + 0x04], %%g2\n\t"
|
||||
"ld\t[%1 + 0x08], %%g3\n\t"
|
||||
"addcc\t%%g2, %0, %0\n\t"
|
||||
"addxcc\t%%g3, %0, %0\n\t"
|
||||
"ld\t[%1 + 0x0c], %%g2\n\t"
|
||||
"ld\t[%1 + 0x10], %%g3\n\t"
|
||||
"addxcc\t%%g2, %0, %0\n\t"
|
||||
"addx\t%0, %%g0, %0\n"
|
||||
"1:\taddcc\t%%g3, %0, %0\n\t"
|
||||
"add\t%1, 4, %1\n\t"
|
||||
"addxcc\t%0, %%g0, %0\n\t"
|
||||
"subcc\t%%g4, 1, %%g4\n\t"
|
||||
"be,a\t2f\n\t"
|
||||
"sll\t%0, 16, %%g2\n\t"
|
||||
"b\t1b\n\t"
|
||||
"ld\t[%1 + 0x10], %%g3\n"
|
||||
"2:\taddcc\t%0, %%g2, %%g2\n\t"
|
||||
"srl\t%%g2, 16, %0\n\t"
|
||||
"addx\t%0, %%g0, %0\n\t"
|
||||
"xnor\t%%g0, %0, %0"
|
||||
: "=r" (sum), "=&r" (iph)
|
||||
: "r" (ihl), "1" (iph)
|
||||
: "g2", "g3", "g4", "cc", "memory");
|
||||
return sum;
|
||||
}
|
||||
|
||||
/* Fold a partial checksum without adding pseudo headers. */
|
||||
static inline __sum16 csum_fold(__wsum sum)
|
||||
{
|
||||
unsigned int tmp;
|
||||
|
||||
__asm__ __volatile__("addcc\t%0, %1, %1\n\t"
|
||||
"srl\t%1, 16, %1\n\t"
|
||||
"addx\t%1, %%g0, %1\n\t"
|
||||
"xnor\t%%g0, %1, %0"
|
||||
: "=&r" (sum), "=r" (tmp)
|
||||
: "0" (sum), "1" ((__force u32)sum<<16)
|
||||
: "cc");
|
||||
return (__force __sum16)sum;
|
||||
}
|
||||
|
||||
static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
|
||||
unsigned short len,
|
||||
unsigned short proto,
|
||||
__wsum sum)
|
||||
{
|
||||
__asm__ __volatile__("addcc\t%1, %0, %0\n\t"
|
||||
"addxcc\t%2, %0, %0\n\t"
|
||||
"addxcc\t%3, %0, %0\n\t"
|
||||
"addx\t%0, %%g0, %0\n\t"
|
||||
: "=r" (sum), "=r" (saddr)
|
||||
: "r" (daddr), "r" (proto + len), "0" (sum),
|
||||
"1" (saddr)
|
||||
: "cc");
|
||||
return sum;
|
||||
}
|
||||
|
||||
/*
|
||||
* computes the checksum of the TCP/UDP pseudo-header
|
||||
* 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)
|
||||
{
|
||||
return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
|
||||
}
|
||||
|
||||
#define _HAVE_ARCH_IPV6_CSUM
|
||||
|
||||
static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr,
|
||||
__u32 len, unsigned short proto,
|
||||
__wsum sum)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"addcc %3, %4, %%g4\n\t"
|
||||
"addxcc %5, %%g4, %%g4\n\t"
|
||||
"ld [%2 + 0x0c], %%g2\n\t"
|
||||
"ld [%2 + 0x08], %%g3\n\t"
|
||||
"addxcc %%g2, %%g4, %%g4\n\t"
|
||||
"ld [%2 + 0x04], %%g2\n\t"
|
||||
"addxcc %%g3, %%g4, %%g4\n\t"
|
||||
"ld [%2 + 0x00], %%g3\n\t"
|
||||
"addxcc %%g2, %%g4, %%g4\n\t"
|
||||
"ld [%1 + 0x0c], %%g2\n\t"
|
||||
"addxcc %%g3, %%g4, %%g4\n\t"
|
||||
"ld [%1 + 0x08], %%g3\n\t"
|
||||
"addxcc %%g2, %%g4, %%g4\n\t"
|
||||
"ld [%1 + 0x04], %%g2\n\t"
|
||||
"addxcc %%g3, %%g4, %%g4\n\t"
|
||||
"ld [%1 + 0x00], %%g3\n\t"
|
||||
"addxcc %%g2, %%g4, %%g4\n\t"
|
||||
"addxcc %%g3, %%g4, %0\n\t"
|
||||
"addx 0, %0, %0\n"
|
||||
: "=&r" (sum)
|
||||
: "r" (saddr), "r" (daddr),
|
||||
"r"(htonl(len)), "r"(htonl(proto)), "r"(sum)
|
||||
: "g2", "g3", "g4", "cc");
|
||||
|
||||
return csum_fold(sum);
|
||||
}
|
||||
|
||||
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
|
||||
static inline __sum16 ip_compute_csum(const void *buff, int len)
|
||||
{
|
||||
return csum_fold(csum_partial(buff, len, 0));
|
||||
}
|
||||
|
||||
#endif /* !(__SPARC_CHECKSUM_H) */
|
167
arch/sparc/include/asm/checksum_64.h
Normal file
167
arch/sparc/include/asm/checksum_64.h
Normal file
@@ -0,0 +1,167 @@
|
||||
#ifndef __SPARC64_CHECKSUM_H
|
||||
#define __SPARC64_CHECKSUM_H
|
||||
|
||||
/* checksum.h: IP/UDP/TCP checksum routines on the V9.
|
||||
*
|
||||
* Copyright(C) 1995 Linus Torvalds
|
||||
* Copyright(C) 1995 Miguel de Icaza
|
||||
* Copyright(C) 1996 David S. Miller
|
||||
* Copyright(C) 1996 Eddie C. Dost
|
||||
* Copyright(C) 1997 Jakub Jelinek
|
||||
*
|
||||
* derived from:
|
||||
* Alpha checksum c-code
|
||||
* ix86 inline assembly
|
||||
* RFC1071 Computing the Internet Checksum
|
||||
*/
|
||||
|
||||
#include <linux/in6.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/* computes the checksum of a memory block at buff, length len,
|
||||
* and adds in "sum" (32-bit)
|
||||
*
|
||||
* returns a 32-bit number suitable for feeding into itself
|
||||
* or csum_tcpudp_magic
|
||||
*
|
||||
* this function must be called with even lengths, except
|
||||
* for the last fragment, which may be odd
|
||||
*
|
||||
* it's best to have buff aligned on a 32-bit boundary
|
||||
*/
|
||||
extern __wsum csum_partial(const void * buff, int len, __wsum sum);
|
||||
|
||||
/* the same as csum_partial, but copies from user space while it
|
||||
* checksums
|
||||
*
|
||||
* 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);
|
||||
|
||||
extern 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,
|
||||
void *dst, int len,
|
||||
__wsum sum, int *err)
|
||||
{
|
||||
long ret = __csum_partial_copy_from_user(src, dst, len, sum);
|
||||
if (ret < 0)
|
||||
*err = -EFAULT;
|
||||
return (__force __wsum) ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
static inline __wsum
|
||||
csum_and_copy_to_user(const void *src,
|
||||
void __user *dst, int len,
|
||||
__wsum sum, int *err)
|
||||
{
|
||||
long ret = __csum_partial_copy_to_user(src, dst, len, sum);
|
||||
if (ret < 0)
|
||||
*err = -EFAULT;
|
||||
return (__force __wsum) ret;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Fold a partial checksum without adding pseudo headers. */
|
||||
static inline __sum16 csum_fold(__wsum sum)
|
||||
{
|
||||
unsigned int tmp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" addcc %0, %1, %1\n"
|
||||
" srl %1, 16, %1\n"
|
||||
" addc %1, %%g0, %1\n"
|
||||
" xnor %%g0, %1, %0\n"
|
||||
: "=&r" (sum), "=r" (tmp)
|
||||
: "0" (sum), "1" ((__force u32)sum<<16)
|
||||
: "cc");
|
||||
return (__force __sum16)sum;
|
||||
}
|
||||
|
||||
static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
|
||||
unsigned int len,
|
||||
unsigned short proto,
|
||||
__wsum sum)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
" addcc %1, %0, %0\n"
|
||||
" addccc %2, %0, %0\n"
|
||||
" addccc %3, %0, %0\n"
|
||||
" addc %0, %%g0, %0\n"
|
||||
: "=r" (sum), "=r" (saddr)
|
||||
: "r" (daddr), "r" (proto + len), "0" (sum), "1" (saddr)
|
||||
: "cc");
|
||||
return sum;
|
||||
}
|
||||
|
||||
/*
|
||||
* computes the checksum of the TCP/UDP pseudo-header
|
||||
* 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)
|
||||
{
|
||||
return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
|
||||
}
|
||||
|
||||
#define _HAVE_ARCH_IPV6_CSUM
|
||||
|
||||
static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr,
|
||||
__u32 len, unsigned short proto,
|
||||
__wsum sum)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
" addcc %3, %4, %%g7\n"
|
||||
" addccc %5, %%g7, %%g7\n"
|
||||
" lduw [%2 + 0x0c], %%g2\n"
|
||||
" lduw [%2 + 0x08], %%g3\n"
|
||||
" addccc %%g2, %%g7, %%g7\n"
|
||||
" lduw [%2 + 0x04], %%g2\n"
|
||||
" addccc %%g3, %%g7, %%g7\n"
|
||||
" lduw [%2 + 0x00], %%g3\n"
|
||||
" addccc %%g2, %%g7, %%g7\n"
|
||||
" lduw [%1 + 0x0c], %%g2\n"
|
||||
" addccc %%g3, %%g7, %%g7\n"
|
||||
" lduw [%1 + 0x08], %%g3\n"
|
||||
" addccc %%g2, %%g7, %%g7\n"
|
||||
" lduw [%1 + 0x04], %%g2\n"
|
||||
" addccc %%g3, %%g7, %%g7\n"
|
||||
" lduw [%1 + 0x00], %%g3\n"
|
||||
" addccc %%g2, %%g7, %%g7\n"
|
||||
" addccc %%g3, %%g7, %0\n"
|
||||
" addc 0, %0, %0\n"
|
||||
: "=&r" (sum)
|
||||
: "r" (saddr), "r" (daddr), "r"(htonl(len)),
|
||||
"r"(htonl(proto)), "r"(sum)
|
||||
: "g2", "g3", "g7", "cc");
|
||||
|
||||
return csum_fold(sum);
|
||||
}
|
||||
|
||||
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
|
||||
static inline __sum16 ip_compute_csum(const void *buff, int len)
|
||||
{
|
||||
return csum_fold(csum_partial(buff, len, 0));
|
||||
}
|
||||
|
||||
#endif /* !(__SPARC64_CHECKSUM_H) */
|
183
arch/sparc/include/asm/chmctrl.h
Normal file
183
arch/sparc/include/asm/chmctrl.h
Normal file
@@ -0,0 +1,183 @@
|
||||
#ifndef _SPARC64_CHMCTRL_H
|
||||
#define _SPARC64_CHMCTRL_H
|
||||
|
||||
/* Cheetah memory controller programmable registers. */
|
||||
#define CHMCTRL_TCTRL1 0x00 /* Memory Timing Control I */
|
||||
#define CHMCTRL_TCTRL2 0x08 /* Memory Timing Control II */
|
||||
#define CHMCTRL_TCTRL3 0x38 /* Memory Timing Control III */
|
||||
#define CHMCTRL_TCTRL4 0x40 /* Memory Timing Control IV */
|
||||
#define CHMCTRL_DECODE1 0x10 /* Memory Address Decode I */
|
||||
#define CHMCTRL_DECODE2 0x18 /* Memory Address Decode II */
|
||||
#define CHMCTRL_DECODE3 0x20 /* Memory Address Decode III */
|
||||
#define CHMCTRL_DECODE4 0x28 /* Memory Address Decode IV */
|
||||
#define CHMCTRL_MACTRL 0x30 /* Memory Address Control */
|
||||
|
||||
/* Memory Timing Control I */
|
||||
#define TCTRL1_SDRAMCTL_DLY 0xf000000000000000UL
|
||||
#define TCTRL1_SDRAMCTL_DLY_SHIFT 60
|
||||
#define TCTRL1_SDRAMCLK_DLY 0x0e00000000000000UL
|
||||
#define TCTRL1_SDRAMCLK_DLY_SHIFT 57
|
||||
#define TCTRL1_R 0x0100000000000000UL
|
||||
#define TCTRL1_R_SHIFT 56
|
||||
#define TCTRL1_AUTORFR_CYCLE 0x00fe000000000000UL
|
||||
#define TCTRL1_AUTORFR_CYCLE_SHIFT 49
|
||||
#define TCTRL1_RD_WAIT 0x0001f00000000000UL
|
||||
#define TCTRL1_RD_WAIT_SHIFT 44
|
||||
#define TCTRL1_PC_CYCLE 0x00000fc000000000UL
|
||||
#define TCTRL1_PC_CYCLE_SHIFT 38
|
||||
#define TCTRL1_WR_MORE_RAS_PW 0x0000003f00000000UL
|
||||
#define TCTRL1_WR_MORE_RAS_PW_SHIFT 32
|
||||
#define TCTRL1_RD_MORE_RAW_PW 0x00000000fc000000UL
|
||||
#define TCTRL1_RD_MORE_RAS_PW_SHIFT 26
|
||||
#define TCTRL1_ACT_WR_DLY 0x0000000003f00000UL
|
||||
#define TCTRL1_ACT_WR_DLY_SHIFT 20
|
||||
#define TCTRL1_ACT_RD_DLY 0x00000000000fc000UL
|
||||
#define TCTRL1_ACT_RD_DLY_SHIFT 14
|
||||
#define TCTRL1_BANK_PRESENT 0x0000000000003000UL
|
||||
#define TCTRL1_BANK_PRESENT_SHIFT 12
|
||||
#define TCTRL1_RFR_INT 0x0000000000000ff8UL
|
||||
#define TCTRL1_RFR_INT_SHIFT 3
|
||||
#define TCTRL1_SET_MODE_REG 0x0000000000000004UL
|
||||
#define TCTRL1_SET_MODE_REG_SHIFT 2
|
||||
#define TCTRL1_RFR_ENABLE 0x0000000000000002UL
|
||||
#define TCTRL1_RFR_ENABLE_SHIFT 1
|
||||
#define TCTRL1_PRECHG_ALL 0x0000000000000001UL
|
||||
#define TCTRL1_PRECHG_ALL_SHIFT 0
|
||||
|
||||
/* Memory Timing Control II */
|
||||
#define TCTRL2_WR_MSEL_DLY 0xfc00000000000000UL
|
||||
#define TCTRL2_WR_MSEL_DLY_SHIFT 58
|
||||
#define TCTRL2_RD_MSEL_DLY 0x03f0000000000000UL
|
||||
#define TCTRL2_RD_MSEL_DLY_SHIFT 52
|
||||
#define TCTRL2_WRDATA_THLD 0x000c000000000000UL
|
||||
#define TCTRL2_WRDATA_THLD_SHIFT 50
|
||||
#define TCTRL2_RDWR_RD_TI_DLY 0x0003f00000000000UL
|
||||
#define TCTRL2_RDWR_RD_TI_DLY_SHIFT 44
|
||||
#define TCTRL2_AUTOPRECHG_ENBL 0x0000080000000000UL
|
||||
#define TCTRL2_AUTOPRECHG_ENBL_SHIFT 43
|
||||
#define TCTRL2_RDWR_PI_MORE_DLY 0x000007c000000000UL
|
||||
#define TCTRL2_RDWR_PI_MORE_DLY_SHIFT 38
|
||||
#define TCTRL2_RDWR_1_DLY 0x0000003f00000000UL
|
||||
#define TCTRL2_RDWR_1_DLY_SHIFT 32
|
||||
#define TCTRL2_WRWR_PI_MORE_DLY 0x00000000f8000000UL
|
||||
#define TCTRL2_WRWR_PI_MORE_DLY_SHIFT 27
|
||||
#define TCTRL2_WRWR_1_DLY 0x0000000007e00000UL
|
||||
#define TCTRL2_WRWR_1_DLY_SHIFT 21
|
||||
#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000UL
|
||||
#define TCTRL2_RDWR_RD_PI_MORE_DLY_SHIFT 16
|
||||
#define TCTRL2_R 0x0000000000008000UL
|
||||
#define TCTRL2_R_SHIFT 15
|
||||
#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
|
||||
#define TCTRL2_SDRAM_MODE_REG_DATA_SHIFT 0
|
||||
|
||||
/* Memory Timing Control III */
|
||||
#define TCTRL3_SDRAM_CTL_DLY 0xf000000000000000UL
|
||||
#define TCTRL3_SDRAM_CTL_DLY_SHIFT 60
|
||||
#define TCTRL3_SDRAM_CLK_DLY 0x0e00000000000000UL
|
||||
#define TCTRL3_SDRAM_CLK_DLY_SHIFT 57
|
||||
#define TCTRL3_R 0x0100000000000000UL
|
||||
#define TCTRL3_R_SHIFT 56
|
||||
#define TCTRL3_AUTO_RFR_CYCLE 0x00fe000000000000UL
|
||||
#define TCTRL3_AUTO_RFR_CYCLE_SHIFT 49
|
||||
#define TCTRL3_RD_WAIT 0x0001f00000000000UL
|
||||
#define TCTRL3_RD_WAIT_SHIFT 44
|
||||
#define TCTRL3_PC_CYCLE 0x00000fc000000000UL
|
||||
#define TCTRL3_PC_CYCLE_SHIFT 38
|
||||
#define TCTRL3_WR_MORE_RAW_PW 0x0000003f00000000UL
|
||||
#define TCTRL3_WR_MORE_RAW_PW_SHIFT 32
|
||||
#define TCTRL3_RD_MORE_RAW_PW 0x00000000fc000000UL
|
||||
#define TCTRL3_RD_MORE_RAW_PW_SHIFT 26
|
||||
#define TCTRL3_ACT_WR_DLY 0x0000000003f00000UL
|
||||
#define TCTRL3_ACT_WR_DLY_SHIFT 20
|
||||
#define TCTRL3_ACT_RD_DLY 0x00000000000fc000UL
|
||||
#define TCTRL3_ACT_RD_DLY_SHIFT 14
|
||||
#define TCTRL3_BANK_PRESENT 0x0000000000003000UL
|
||||
#define TCTRL3_BANK_PRESENT_SHIFT 12
|
||||
#define TCTRL3_RFR_INT 0x0000000000000ff8UL
|
||||
#define TCTRL3_RFR_INT_SHIFT 3
|
||||
#define TCTRL3_SET_MODE_REG 0x0000000000000004UL
|
||||
#define TCTRL3_SET_MODE_REG_SHIFT 2
|
||||
#define TCTRL3_RFR_ENABLE 0x0000000000000002UL
|
||||
#define TCTRL3_RFR_ENABLE_SHIFT 1
|
||||
#define TCTRL3_PRECHG_ALL 0x0000000000000001UL
|
||||
#define TCTRL3_PRECHG_ALL_SHIFT 0
|
||||
|
||||
/* Memory Timing Control IV */
|
||||
#define TCTRL4_WR_MSEL_DLY 0xfc00000000000000UL
|
||||
#define TCTRL4_WR_MSEL_DLY_SHIFT 58
|
||||
#define TCTRL4_RD_MSEL_DLY 0x03f0000000000000UL
|
||||
#define TCTRL4_RD_MSEL_DLY_SHIFT 52
|
||||
#define TCTRL4_WRDATA_THLD 0x000c000000000000UL
|
||||
#define TCTRL4_WRDATA_THLD_SHIFT 50
|
||||
#define TCTRL4_RDWR_RD_RI_DLY 0x0003f00000000000UL
|
||||
#define TCTRL4_RDWR_RD_RI_DLY_SHIFT 44
|
||||
#define TCTRL4_AUTO_PRECHG_ENBL 0x0000080000000000UL
|
||||
#define TCTRL4_AUTO_PRECHG_ENBL_SHIFT 43
|
||||
#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000UL
|
||||
#define TCTRL4_RD_WR_PI_MORE_DLY_SHIFT 38
|
||||
#define TCTRL4_RD_WR_TI_DLY 0x0000003f00000000UL
|
||||
#define TCTRL4_RD_WR_TI_DLY_SHIFT 32
|
||||
#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000UL
|
||||
#define TCTRL4_WR_WR_PI_MORE_DLY_SHIFT 27
|
||||
#define TCTRL4_WR_WR_TI_DLY 0x0000000007e00000UL
|
||||
#define TCTRL4_WR_WR_TI_DLY_SHIFT 21
|
||||
#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f000UL0
|
||||
#define TCTRL4_RDWR_RD_PI_MORE_DLY_SHIFT 16
|
||||
#define TCTRL4_R 0x0000000000008000UL
|
||||
#define TCTRL4_R_SHIFT 15
|
||||
#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
|
||||
#define TCTRL4_SDRAM_MODE_REG_DATA_SHIFT 0
|
||||
|
||||
/* All 4 memory address decoding registers have the
|
||||
* same layout.
|
||||
*/
|
||||
#define MEM_DECODE_VALID 0x8000000000000000UL /* Valid */
|
||||
#define MEM_DECODE_VALID_SHIFT 63
|
||||
#define MEM_DECODE_UK 0x001ffe0000000000UL /* Upper mask */
|
||||
#define MEM_DECODE_UK_SHIFT 41
|
||||
#define MEM_DECODE_UM 0x0000001ffff00000UL /* Upper match */
|
||||
#define MEM_DECODE_UM_SHIFT 20
|
||||
#define MEM_DECODE_LK 0x000000000003c000UL /* Lower mask */
|
||||
#define MEM_DECODE_LK_SHIFT 14
|
||||
#define MEM_DECODE_LM 0x0000000000000f00UL /* Lower match */
|
||||
#define MEM_DECODE_LM_SHIFT 8
|
||||
|
||||
#define PA_UPPER_BITS 0x000007fffc000000UL
|
||||
#define PA_UPPER_BITS_SHIFT 26
|
||||
#define PA_LOWER_BITS 0x00000000000003c0UL
|
||||
#define PA_LOWER_BITS_SHIFT 6
|
||||
|
||||
#define MACTRL_R0 0x8000000000000000UL
|
||||
#define MACTRL_R0_SHIFT 63
|
||||
#define MACTRL_ADDR_LE_PW 0x7000000000000000UL
|
||||
#define MACTRL_ADDR_LE_PW_SHIFT 60
|
||||
#define MACTRL_CMD_PW 0x0f00000000000000UL
|
||||
#define MACTRL_CMD_PW_SHIFT 56
|
||||
#define MACTRL_HALF_MODE_WR_MSEL_DLY 0x00fc000000000000UL
|
||||
#define MACTRL_HALF_MODE_WR_MSEL_DLY_SHIFT 50
|
||||
#define MACTRL_HALF_MODE_RD_MSEL_DLY 0x0003f00000000000UL
|
||||
#define MACTRL_HALF_MODE_RD_MSEL_DLY_SHIFT 44
|
||||
#define MACTRL_HALF_MODE_SDRAM_CTL_DLY 0x00000f0000000000UL
|
||||
#define MACTRL_HALF_MODE_SDRAM_CTL_DLY_SHIFT 40
|
||||
#define MACTRL_HALF_MODE_SDRAM_CLK_DLY 0x000000e000000000UL
|
||||
#define MACTRL_HALF_MODE_SDRAM_CLK_DLY_SHIFT 37
|
||||
#define MACTRL_R1 0x0000001000000000UL
|
||||
#define MACTRL_R1_SHIFT 36
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000UL
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3_SHIFT 32
|
||||
#define MACTRL_ENC_INTLV_B3 0x00000000f8000000UL
|
||||
#define MACTRL_ENC_INTLV_B3_SHIFT 27
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000UL
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2_SHIFT 23
|
||||
#define MACTRL_ENC_INTLV_B2 0x00000000007c0000UL
|
||||
#define MACTRL_ENC_INTLV_B2_SHIFT 18
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000UL
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1_SHIFT 14
|
||||
#define MACTRL_ENC_INTLV_B1 0x0000000000003e00UL
|
||||
#define MACTRL_ENC_INTLV_B1_SHIFT 9
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0UL
|
||||
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0_SHIFT 5
|
||||
#define MACTRL_ENC_INTLV_B0 0x000000000000001fUL
|
||||
#define MACTRL_ENC_INTLV_B0_SHIFT 0
|
||||
|
||||
#endif /* _SPARC64_CHMCTRL_H */
|
11
arch/sparc/include/asm/clock.h
Normal file
11
arch/sparc/include/asm/clock.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* clock.h: Definitions for clock operations on the Sparc.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
#ifndef _SPARC_CLOCK_H
|
||||
#define _SPARC_CLOCK_H
|
||||
|
||||
/* Foo for now. */
|
||||
|
||||
#endif /* !(_SPARC_CLOCK_H) */
|
59
arch/sparc/include/asm/cmt.h
Normal file
59
arch/sparc/include/asm/cmt.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#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 */
|
243
arch/sparc/include/asm/compat.h
Normal file
243
arch/sparc/include/asm/compat.h
Normal file
@@ -0,0 +1,243 @@
|
||||
#ifndef _ASM_SPARC64_COMPAT_H
|
||||
#define _ASM_SPARC64_COMPAT_H
|
||||
/*
|
||||
* Architecture specific compatibility types
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
|
||||
#define COMPAT_USER_HZ 100
|
||||
|
||||
typedef u32 compat_size_t;
|
||||
typedef s32 compat_ssize_t;
|
||||
typedef s32 compat_time_t;
|
||||
typedef s32 compat_clock_t;
|
||||
typedef s32 compat_pid_t;
|
||||
typedef u16 __compat_uid_t;
|
||||
typedef u16 __compat_gid_t;
|
||||
typedef u32 __compat_uid32_t;
|
||||
typedef u32 __compat_gid32_t;
|
||||
typedef u16 compat_mode_t;
|
||||
typedef u32 compat_ino_t;
|
||||
typedef u16 compat_dev_t;
|
||||
typedef s32 compat_off_t;
|
||||
typedef s64 compat_loff_t;
|
||||
typedef s16 compat_nlink_t;
|
||||
typedef u16 compat_ipc_pid_t;
|
||||
typedef s32 compat_daddr_t;
|
||||
typedef u32 compat_caddr_t;
|
||||
typedef __kernel_fsid_t compat_fsid_t;
|
||||
typedef s32 compat_key_t;
|
||||
typedef s32 compat_timer_t;
|
||||
|
||||
typedef s32 compat_int_t;
|
||||
typedef s32 compat_long_t;
|
||||
typedef s64 compat_s64;
|
||||
typedef u32 compat_uint_t;
|
||||
typedef u32 compat_ulong_t;
|
||||
typedef u64 compat_u64;
|
||||
|
||||
struct compat_timespec {
|
||||
compat_time_t tv_sec;
|
||||
s32 tv_nsec;
|
||||
};
|
||||
|
||||
struct compat_timeval {
|
||||
compat_time_t tv_sec;
|
||||
s32 tv_usec;
|
||||
};
|
||||
|
||||
struct compat_stat {
|
||||
compat_dev_t st_dev;
|
||||
compat_ino_t st_ino;
|
||||
compat_mode_t st_mode;
|
||||
compat_nlink_t st_nlink;
|
||||
__compat_uid_t st_uid;
|
||||
__compat_gid_t st_gid;
|
||||
compat_dev_t st_rdev;
|
||||
compat_off_t st_size;
|
||||
compat_time_t st_atime;
|
||||
compat_ulong_t st_atime_nsec;
|
||||
compat_time_t st_mtime;
|
||||
compat_ulong_t st_mtime_nsec;
|
||||
compat_time_t st_ctime;
|
||||
compat_ulong_t st_ctime_nsec;
|
||||
compat_off_t st_blksize;
|
||||
compat_off_t st_blocks;
|
||||
u32 __unused4[2];
|
||||
};
|
||||
|
||||
struct compat_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;
|
||||
};
|
||||
|
||||
struct compat_flock {
|
||||
short l_type;
|
||||
short l_whence;
|
||||
compat_off_t l_start;
|
||||
compat_off_t l_len;
|
||||
compat_pid_t l_pid;
|
||||
short __unused;
|
||||
};
|
||||
|
||||
#define F_GETLK64 12
|
||||
#define F_SETLK64 13
|
||||
#define F_SETLKW64 14
|
||||
|
||||
struct compat_flock64 {
|
||||
short l_type;
|
||||
short l_whence;
|
||||
compat_loff_t l_start;
|
||||
compat_loff_t l_len;
|
||||
compat_pid_t l_pid;
|
||||
short __unused;
|
||||
};
|
||||
|
||||
struct compat_statfs {
|
||||
int f_type;
|
||||
int f_bsize;
|
||||
int f_blocks;
|
||||
int f_bfree;
|
||||
int f_bavail;
|
||||
int f_files;
|
||||
int f_ffree;
|
||||
compat_fsid_t f_fsid;
|
||||
int f_namelen; /* SunOS ignores this field. */
|
||||
int f_frsize;
|
||||
int f_spare[5];
|
||||
};
|
||||
|
||||
#define COMPAT_RLIM_INFINITY 0x7fffffff
|
||||
|
||||
typedef u32 compat_old_sigset_t;
|
||||
|
||||
#define _COMPAT_NSIG 64
|
||||
#define _COMPAT_NSIG_BPW 32
|
||||
|
||||
typedef u32 compat_sigset_word;
|
||||
|
||||
#define COMPAT_OFF_T_MAX 0x7fffffff
|
||||
#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
|
||||
|
||||
/*
|
||||
* A pointer passed in from user mode. This should not
|
||||
* be used for syscall parameters, just declare them
|
||||
* 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)
|
||||
{
|
||||
return (void __user *)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
{
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
static inline void __user *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)))
|
||||
usp += STACK_BIAS;
|
||||
else
|
||||
usp &= 0xffffffffUL;
|
||||
|
||||
usp -= len;
|
||||
usp &= ~0x7UL;
|
||||
|
||||
return (void __user *) usp;
|
||||
}
|
||||
|
||||
struct compat_ipc64_perm {
|
||||
compat_key_t key;
|
||||
__compat_uid32_t uid;
|
||||
__compat_gid32_t gid;
|
||||
__compat_uid32_t cuid;
|
||||
__compat_gid32_t cgid;
|
||||
unsigned short __pad1;
|
||||
compat_mode_t mode;
|
||||
unsigned short __pad2;
|
||||
unsigned short seq;
|
||||
unsigned long __unused1; /* yes they really are 64bit pads */
|
||||
unsigned long __unused2;
|
||||
};
|
||||
|
||||
struct compat_semid64_ds {
|
||||
struct compat_ipc64_perm sem_perm;
|
||||
unsigned int __pad1;
|
||||
compat_time_t sem_otime;
|
||||
unsigned int __pad2;
|
||||
compat_time_t sem_ctime;
|
||||
u32 sem_nsems;
|
||||
u32 __unused1;
|
||||
u32 __unused2;
|
||||
};
|
||||
|
||||
struct compat_msqid64_ds {
|
||||
struct compat_ipc64_perm msg_perm;
|
||||
unsigned int __pad1;
|
||||
compat_time_t msg_stime;
|
||||
unsigned int __pad2;
|
||||
compat_time_t msg_rtime;
|
||||
unsigned int __pad3;
|
||||
compat_time_t msg_ctime;
|
||||
unsigned int msg_cbytes;
|
||||
unsigned int msg_qnum;
|
||||
unsigned int msg_qbytes;
|
||||
compat_pid_t msg_lspid;
|
||||
compat_pid_t msg_lrpid;
|
||||
unsigned int __unused1;
|
||||
unsigned int __unused2;
|
||||
};
|
||||
|
||||
struct compat_shmid64_ds {
|
||||
struct compat_ipc64_perm shm_perm;
|
||||
unsigned int __pad1;
|
||||
compat_time_t shm_atime;
|
||||
unsigned int __pad2;
|
||||
compat_time_t shm_dtime;
|
||||
unsigned int __pad3;
|
||||
compat_time_t shm_ctime;
|
||||
compat_size_t shm_segsz;
|
||||
compat_pid_t shm_cpid;
|
||||
compat_pid_t shm_lpid;
|
||||
unsigned int shm_nattch;
|
||||
unsigned int __unused1;
|
||||
unsigned int __unused2;
|
||||
};
|
||||
|
||||
#endif /* _ASM_SPARC64_COMPAT_H */
|
29
arch/sparc/include/asm/compat_signal.h
Normal file
29
arch/sparc/include/asm/compat_signal.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _COMPAT_SIGNAL_H
|
||||
#define _COMPAT_SIGNAL_H
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <asm/signal.h>
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
struct __new_sigaction32 {
|
||||
unsigned sa_handler;
|
||||
unsigned int sa_flags;
|
||||
unsigned sa_restorer; /* not used by Linux/SPARC yet */
|
||||
compat_sigset_t sa_mask;
|
||||
};
|
||||
|
||||
struct __old_sigaction32 {
|
||||
unsigned sa_handler;
|
||||
compat_old_sigset_t sa_mask;
|
||||
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) */
|
53
arch/sparc/include/asm/contregs.h
Normal file
53
arch/sparc/include/asm/contregs.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef _SPARC_CONTREGS_H
|
||||
#define _SPARC_CONTREGS_H
|
||||
|
||||
/* contregs.h: Addresses of registers in the ASI_CONTROL alternate address
|
||||
* space. These are for the mmu's context register, etc.
|
||||
*
|
||||
* 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 */
|
||||
#define AC_M_CXR 0x0200 /* shv Context Register */
|
||||
#define AC_M_SFSR 0x0300 /* shv Synchronous Fault Status Reg */
|
||||
#define AC_M_SFAR 0x0400 /* shv Synchronous Fault Address Reg */
|
||||
#define AC_M_AFSR 0x0500 /* hv Asynchronous Fault Status Reg */
|
||||
#define AC_M_AFAR 0x0600 /* hv Asynchronous Fault Address Reg */
|
||||
#define AC_M_RESET 0x0700 /* hv Reset Reg */
|
||||
#define AC_M_RPR 0x1000 /* hv Root Pointer Reg */
|
||||
#define AC_M_TSUTRCR 0x1000 /* s TLB Replacement Ctrl Reg */
|
||||
#define AC_M_IAPTP 0x1100 /* hv Instruction Access PTP */
|
||||
#define AC_M_DAPTP 0x1200 /* hv Data Access PTP */
|
||||
#define AC_M_ITR 0x1300 /* hv Index Tag Register */
|
||||
#define AC_M_TRCR 0x1400 /* hv TLB Replacement Control Reg */
|
||||
#define AC_M_SFSRX 0x1300 /* s Synch Fault Status Reg prim */
|
||||
#define AC_M_SFARX 0x1400 /* s Synch Fault Address Reg prim */
|
||||
#define AC_M_RPR1 0x1500 /* h Root Pointer Reg (entry 2) */
|
||||
#define AC_M_IAPTP1 0x1600 /* h Instruction Access PTP (entry 2) */
|
||||
#define AC_M_DAPTP1 0x1700 /* h Data Access PTP (entry 2) */
|
||||
|
||||
#endif /* _SPARC_CONTREGS_H */
|
8
arch/sparc/include/asm/cpudata.h
Normal file
8
arch/sparc/include/asm/cpudata.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_CPUDATA_H
|
||||
#define ___ASM_SPARC_CPUDATA_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/cpudata_64.h>
|
||||
#else
|
||||
#include <asm/cpudata_32.h>
|
||||
#endif
|
||||
#endif
|
27
arch/sparc/include/asm/cpudata_32.h
Normal file
27
arch/sparc/include/asm/cpudata_32.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/* cpudata.h: Per-cpu parameters.
|
||||
*
|
||||
* Copyright (C) 2004 Keith M Wesolowski (wesolows@foobazco.org)
|
||||
*
|
||||
* Based on include/asm/cpudata.h and Linux 2.4 smp.h
|
||||
* both (C) David S. Miller.
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_CPUDATA_H
|
||||
#define _SPARC_CPUDATA_H
|
||||
|
||||
#include <linux/percpu.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned long udelay_val;
|
||||
unsigned long clock_tick;
|
||||
unsigned int multiplier;
|
||||
unsigned int counter;
|
||||
int prom_node;
|
||||
int mid;
|
||||
int next;
|
||||
} cpuinfo_sparc;
|
||||
|
||||
DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
|
||||
#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
|
||||
|
||||
#endif /* _SPARC_CPUDATA_H */
|
240
arch/sparc/include/asm/cpudata_64.h
Normal file
240
arch/sparc/include/asm/cpudata_64.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/* cpudata.h: Per-cpu parameters.
|
||||
*
|
||||
* Copyright (C) 2003, 2005, 2006 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_CPUDATA_H
|
||||
#define _SPARC64_CPUDATA_H
|
||||
|
||||
#include <asm/hypervisor.h>
|
||||
#include <asm/asi.h>
|
||||
|
||||
#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 */
|
||||
unsigned int __pad0;
|
||||
unsigned long clock_tick; /* %tick's per second */
|
||||
unsigned long __pad;
|
||||
unsigned int __pad1;
|
||||
unsigned int __pad2;
|
||||
|
||||
/* Dcache line 2, rarely used */
|
||||
unsigned int dcache_size;
|
||||
unsigned int dcache_line_size;
|
||||
unsigned int icache_size;
|
||||
unsigned int icache_line_size;
|
||||
unsigned int ecache_size;
|
||||
unsigned int ecache_line_size;
|
||||
int core_id;
|
||||
int proc_id;
|
||||
} cpuinfo_sparc;
|
||||
|
||||
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)
|
||||
|
||||
/* Trap handling code needs to get at a few critical values upon
|
||||
* trap entry and to process TSB misses. These cannot be in the
|
||||
* per_cpu() area as we really need to lock them into the TLB and
|
||||
* thus make them part of the main kernel image. As a result we
|
||||
* try to make this as small as possible.
|
||||
*
|
||||
* This is padded out and aligned to 64-bytes to avoid false sharing
|
||||
* on SMP.
|
||||
*/
|
||||
|
||||
/* If you modify the size of this structure, please update
|
||||
* TRAP_BLOCK_SZ_SHIFT below.
|
||||
*/
|
||||
struct thread_info;
|
||||
struct trap_per_cpu {
|
||||
/* D-cache line 1: Basic thread information, cpu and device mondo queues */
|
||||
struct thread_info *thread;
|
||||
unsigned long pgd_paddr;
|
||||
unsigned long cpu_mondo_pa;
|
||||
unsigned long dev_mondo_pa;
|
||||
|
||||
/* D-cache line 2: Error Mondo Queue and kernel buffer pointers */
|
||||
unsigned long resum_mondo_pa;
|
||||
unsigned long resum_kernel_buf_pa;
|
||||
unsigned long nonresum_mondo_pa;
|
||||
unsigned long nonresum_kernel_buf_pa;
|
||||
|
||||
/* Dcache lines 3, 4, 5, and 6: Hypervisor Fault Status */
|
||||
struct hv_fault_status fault_info;
|
||||
|
||||
/* Dcache line 7: Physical addresses of CPU send mondo block and CPU list. */
|
||||
unsigned long cpu_mondo_block_pa;
|
||||
unsigned long cpu_list_pa;
|
||||
unsigned long tsb_huge;
|
||||
unsigned long tsb_huge_temp;
|
||||
|
||||
/* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */
|
||||
unsigned long irq_worklist_pa;
|
||||
unsigned int cpu_mondo_qmask;
|
||||
unsigned int dev_mondo_qmask;
|
||||
unsigned int resum_qmask;
|
||||
unsigned int nonresum_qmask;
|
||||
void *hdesc;
|
||||
} __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);
|
||||
extern int ncpus_probed;
|
||||
extern void __init cpu_probe(void);
|
||||
extern const struct seq_operations cpuinfo_op;
|
||||
|
||||
extern unsigned long real_hard_smp_processor_id(void);
|
||||
|
||||
struct cpuid_patch_entry {
|
||||
unsigned int addr;
|
||||
unsigned int cheetah_safari[4];
|
||||
unsigned int cheetah_jbus[4];
|
||||
unsigned int starfire[4];
|
||||
unsigned int sun4v[4];
|
||||
};
|
||||
extern struct cpuid_patch_entry __cpuid_patch, __cpuid_patch_end;
|
||||
|
||||
struct sun4v_1insn_patch_entry {
|
||||
unsigned int addr;
|
||||
unsigned int insn;
|
||||
};
|
||||
extern struct sun4v_1insn_patch_entry __sun4v_1insn_patch,
|
||||
__sun4v_1insn_patch_end;
|
||||
|
||||
struct sun4v_2insn_patch_entry {
|
||||
unsigned int addr;
|
||||
unsigned int insns[2];
|
||||
};
|
||||
extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
|
||||
__sun4v_2insn_patch_end;
|
||||
|
||||
#endif /* !(__ASSEMBLY__) */
|
||||
|
||||
#define TRAP_PER_CPU_THREAD 0x00
|
||||
#define TRAP_PER_CPU_PGD_PADDR 0x08
|
||||
#define TRAP_PER_CPU_CPU_MONDO_PA 0x10
|
||||
#define TRAP_PER_CPU_DEV_MONDO_PA 0x18
|
||||
#define TRAP_PER_CPU_RESUM_MONDO_PA 0x20
|
||||
#define TRAP_PER_CPU_RESUM_KBUF_PA 0x28
|
||||
#define TRAP_PER_CPU_NONRESUM_MONDO_PA 0x30
|
||||
#define TRAP_PER_CPU_NONRESUM_KBUF_PA 0x38
|
||||
#define TRAP_PER_CPU_FAULT_INFO 0x40
|
||||
#define TRAP_PER_CPU_CPU_MONDO_BLOCK_PA 0xc0
|
||||
#define TRAP_PER_CPU_CPU_LIST_PA 0xc8
|
||||
#define TRAP_PER_CPU_TSB_HUGE 0xd0
|
||||
#define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8
|
||||
#define TRAP_PER_CPU_IRQ_WORKLIST_PA 0xe0
|
||||
#define TRAP_PER_CPU_CPU_MONDO_QMASK 0xe8
|
||||
#define TRAP_PER_CPU_DEV_MONDO_QMASK 0xec
|
||||
#define TRAP_PER_CPU_RESUM_QMASK 0xf0
|
||||
#define TRAP_PER_CPU_NONRESUM_QMASK 0xf4
|
||||
|
||||
#define TRAP_BLOCK_SZ_SHIFT 8
|
||||
|
||||
#include <asm/scratchpad.h>
|
||||
|
||||
#define __GET_CPUID(REG) \
|
||||
/* Spitfire implementation (default). */ \
|
||||
661: ldxa [%g0] ASI_UPA_CONFIG, REG; \
|
||||
srlx REG, 17, REG; \
|
||||
and REG, 0x1f, REG; \
|
||||
nop; \
|
||||
.section .cpuid_patch, "ax"; \
|
||||
/* Instruction location. */ \
|
||||
.word 661b; \
|
||||
/* Cheetah Safari implementation. */ \
|
||||
ldxa [%g0] ASI_SAFARI_CONFIG, REG; \
|
||||
srlx REG, 17, REG; \
|
||||
and REG, 0x3ff, REG; \
|
||||
nop; \
|
||||
/* Cheetah JBUS implementation. */ \
|
||||
ldxa [%g0] ASI_JBUS_CONFIG, REG; \
|
||||
srlx REG, 17, REG; \
|
||||
and REG, 0x1f, REG; \
|
||||
nop; \
|
||||
/* Starfire implementation. */ \
|
||||
sethi %hi(0x1fff40000d0 >> 9), REG; \
|
||||
sllx REG, 9, REG; \
|
||||
or REG, 0xd0, REG; \
|
||||
lduwa [REG] ASI_PHYS_BYPASS_EC_E, REG;\
|
||||
/* sun4v implementation. */ \
|
||||
mov SCRATCHPAD_CPUID, REG; \
|
||||
ldxa [REG] ASI_SCRATCHPAD, REG; \
|
||||
nop; \
|
||||
nop; \
|
||||
.previous;
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#define TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
__GET_CPUID(TMP) \
|
||||
sethi %hi(trap_block), DEST; \
|
||||
sllx TMP, TRAP_BLOCK_SZ_SHIFT, TMP; \
|
||||
or DEST, %lo(trap_block), DEST; \
|
||||
add DEST, TMP, DEST; \
|
||||
|
||||
/* Clobbers TMP, current address space PGD phys address into DEST. */
|
||||
#define TRAP_LOAD_PGD_PHYS(DEST, TMP) \
|
||||
TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
|
||||
|
||||
/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
|
||||
#define TRAP_LOAD_IRQ_WORK_PA(DEST, TMP) \
|
||||
TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
add DEST, TRAP_PER_CPU_IRQ_WORKLIST_PA, DEST;
|
||||
|
||||
/* Clobbers TMP, loads DEST with current thread info pointer. */
|
||||
#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
|
||||
TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
ldx [DEST + TRAP_PER_CPU_THREAD], DEST;
|
||||
|
||||
/* Given the current thread info pointer in THR, load the per-cpu
|
||||
* area base of the current processor into DEST. REG1, REG2, and REG3 are
|
||||
* clobbered.
|
||||
*
|
||||
* You absolutely cannot use DEST as a temporary in this code. The
|
||||
* reason is that traps can happen during execution, and return from
|
||||
* trap will load the fully resolved DEST per-cpu base. This can corrupt
|
||||
* the calculations done by the macro mid-stream.
|
||||
*/
|
||||
#define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3) \
|
||||
lduh [THR + TI_CPU], REG1; \
|
||||
sethi %hi(__per_cpu_shift), REG3; \
|
||||
sethi %hi(__per_cpu_base), REG2; \
|
||||
ldx [REG3 + %lo(__per_cpu_shift)], REG3; \
|
||||
ldx [REG2 + %lo(__per_cpu_base)], REG2; \
|
||||
sllx REG1, REG3, REG3; \
|
||||
add REG3, REG2, DEST;
|
||||
|
||||
#else
|
||||
|
||||
#define TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
sethi %hi(trap_block), DEST; \
|
||||
or DEST, %lo(trap_block), DEST; \
|
||||
|
||||
/* Uniprocessor versions, we know the cpuid is zero. */
|
||||
#define TRAP_LOAD_PGD_PHYS(DEST, TMP) \
|
||||
TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
|
||||
|
||||
/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
|
||||
#define TRAP_LOAD_IRQ_WORK_PA(DEST, TMP) \
|
||||
TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
add DEST, TRAP_PER_CPU_IRQ_WORKLIST_PA, DEST;
|
||||
|
||||
#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
|
||||
TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
|
||||
ldx [DEST + TRAP_PER_CPU_THREAD], DEST;
|
||||
|
||||
/* No per-cpu areas on uniprocessor, so no need to load DEST. */
|
||||
#define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3)
|
||||
|
||||
#endif /* !(CONFIG_SMP) */
|
||||
|
||||
#endif /* _SPARC64_CPUDATA_H */
|
6
arch/sparc/include/asm/cputime.h
Normal file
6
arch/sparc/include/asm/cputime.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __SPARC_CPUTIME_H
|
||||
#define __SPARC_CPUTIME_H
|
||||
|
||||
#include <asm-generic/cputime.h>
|
||||
|
||||
#endif /* __SPARC_CPUTIME_H */
|
34
arch/sparc/include/asm/current.h
Normal file
34
arch/sparc/include/asm/current.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* include/asm/current.h
|
||||
*
|
||||
* Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
|
||||
* Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com)
|
||||
* Copyright (C) 2007 David S. Miller (davem@davemloft.net)
|
||||
*
|
||||
* Derived from "include/asm-s390/current.h" by
|
||||
* Martin Schwidefsky (schwidefsky@de.ibm.com)
|
||||
* Derived from "include/asm-i386/current.h"
|
||||
*/
|
||||
#ifndef _SPARC_CURRENT_H
|
||||
#define _SPARC_CURRENT_H
|
||||
|
||||
#include <linux/thread_info.h>
|
||||
|
||||
#ifdef CONFIG_SPARC64
|
||||
register struct task_struct *current asm("g4");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPARC32
|
||||
/* We might want to consider using %g4 like sparc64 to shave a few cycles.
|
||||
*
|
||||
* Two stage process (inline + #define) for type-checking.
|
||||
* We also obfuscate get_current() to check if anyone used that by mistake.
|
||||
*/
|
||||
struct task_struct;
|
||||
static inline struct task_struct *__get_current(void)
|
||||
{
|
||||
return current_thread_info()->task;
|
||||
}
|
||||
#define current __get_current()
|
||||
#endif
|
||||
|
||||
#endif /* !(_SPARC_CURRENT_H) */
|
79
arch/sparc/include/asm/cypress.h
Normal file
79
arch/sparc/include/asm/cypress.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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) */
|
14
arch/sparc/include/asm/dcr.h
Normal file
14
arch/sparc/include/asm/dcr.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _SPARC64_DCR_H
|
||||
#define _SPARC64_DCR_H
|
||||
|
||||
/* UltraSparc-III/III+ Dispatch Control Register, ASR 0x12 */
|
||||
#define DCR_DPE 0x0000000000001000 /* III+: D$ Parity Error Enable */
|
||||
#define DCR_OBS 0x0000000000000fc0 /* Observability Bus Controls */
|
||||
#define DCR_BPE 0x0000000000000020 /* Branch Predict Enable */
|
||||
#define DCR_RPE 0x0000000000000010 /* Return Address Prediction Enable */
|
||||
#define DCR_SI 0x0000000000000008 /* Single Instruction Disable */
|
||||
#define DCR_IPE 0x0000000000000004 /* III+: I$ Parity Error Enable */
|
||||
#define DCR_IFPOE 0x0000000000000002 /* IRQ FP Operation Enable */
|
||||
#define DCR_MS 0x0000000000000001 /* Multi-Scalar dispatch */
|
||||
|
||||
#endif /* _SPARC64_DCR_H */
|
27
arch/sparc/include/asm/dcu.h
Normal file
27
arch/sparc/include/asm/dcu.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef _SPARC64_DCU_H
|
||||
#define _SPARC64_DCU_H
|
||||
|
||||
#include <linux/const.h>
|
||||
|
||||
/* UltraSparc-III Data Cache Unit Control Register */
|
||||
#define DCU_CP _AC(0x0002000000000000,UL) /* Phys Cache Enable w/o mmu */
|
||||
#define DCU_CV _AC(0x0001000000000000,UL) /* Virt Cache Enable w/o mmu */
|
||||
#define DCU_ME _AC(0x0000800000000000,UL) /* NC-store Merging Enable */
|
||||
#define DCU_RE _AC(0x0000400000000000,UL) /* RAW bypass Enable */
|
||||
#define DCU_PE _AC(0x0000200000000000,UL) /* PCache Enable */
|
||||
#define DCU_HPE _AC(0x0000100000000000,UL) /* HW prefetch Enable */
|
||||
#define DCU_SPE _AC(0x0000080000000000,UL) /* SW prefetch Enable */
|
||||
#define DCU_SL _AC(0x0000040000000000,UL) /* Secondary ld-steering Enab*/
|
||||
#define DCU_WE _AC(0x0000020000000000,UL) /* WCache enable */
|
||||
#define DCU_PM _AC(0x000001fe00000000,UL) /* PA Watchpoint Byte Mask */
|
||||
#define DCU_VM _AC(0x00000001fe000000,UL) /* VA Watchpoint Byte Mask */
|
||||
#define DCU_PR _AC(0x0000000001000000,UL) /* PA Watchpoint Read Enable */
|
||||
#define DCU_PW _AC(0x0000000000800000,UL) /* PA Watchpoint Write Enable*/
|
||||
#define DCU_VR _AC(0x0000000000400000,UL) /* VA Watchpoint Read Enable */
|
||||
#define DCU_VW _AC(0x0000000000200000,UL) /* VA Watchpoint Write Enable*/
|
||||
#define DCU_DM _AC(0x0000000000000008,UL) /* DMMU Enable */
|
||||
#define DCU_IM _AC(0x0000000000000004,UL) /* IMMU Enable */
|
||||
#define DCU_DC _AC(0x0000000000000002,UL) /* Data Cache Enable */
|
||||
#define DCU_IC _AC(0x0000000000000001,UL) /* Instruction Cache Enable */
|
||||
|
||||
#endif /* _SPARC64_DCU_H */
|
8
arch/sparc/include/asm/delay.h
Normal file
8
arch/sparc/include/asm/delay.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_DELAY_H
|
||||
#define ___ASM_SPARC_DELAY_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/delay_64.h>
|
||||
#else
|
||||
#include <asm/delay_32.h>
|
||||
#endif
|
||||
#endif
|
34
arch/sparc/include/asm/delay_32.h
Normal file
34
arch/sparc/include/asm/delay_32.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* delay.h: Linux delay routines on the Sparc.
|
||||
*
|
||||
* Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu).
|
||||
*/
|
||||
|
||||
#ifndef __SPARC_DELAY_H
|
||||
#define __SPARC_DELAY_H
|
||||
|
||||
#include <asm/cpudata.h>
|
||||
|
||||
static inline void __delay(unsigned long loops)
|
||||
{
|
||||
__asm__ __volatile__("cmp %0, 0\n\t"
|
||||
"1: bne 1b\n\t"
|
||||
"subcc %0, 1, %0\n" :
|
||||
"=&r" (loops) :
|
||||
"0" (loops) :
|
||||
"cc");
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#define __udelay_val cpu_data(smp_processor_id()).udelay_val
|
||||
#else /* SMP */
|
||||
#define __udelay_val loops_per_jiffy
|
||||
#endif /* SMP */
|
||||
#define udelay(__usecs) __udelay(__usecs, __udelay_val)
|
||||
#define ndelay(__nsecs) __ndelay(__nsecs, __udelay_val)
|
||||
|
||||
#endif /* defined(__SPARC_DELAY_H) */
|
17
arch/sparc/include/asm/delay_64.h
Normal file
17
arch/sparc/include/asm/delay_64.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/* delay.h: Linux delay routines on sparc64.
|
||||
*
|
||||
* Copyright (C) 1996, 2004, 2007 David S. Miller (davem@davemloft.net).
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_DELAY_H
|
||||
#define _SPARC64_DELAY_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
extern void __delay(unsigned long loops);
|
||||
extern void udelay(unsigned long usecs);
|
||||
#define mdelay(n) udelay((n) * 1000)
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _SPARC64_DELAY_H */
|
23
arch/sparc/include/asm/device.h
Normal file
23
arch/sparc/include/asm/device.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Arch specific extensions to struct device
|
||||
*
|
||||
* This file is released under the GPLv2
|
||||
*/
|
||||
#ifndef _ASM_SPARC_DEVICE_H
|
||||
#define _ASM_SPARC_DEVICE_H
|
||||
|
||||
struct device_node;
|
||||
struct of_device;
|
||||
|
||||
struct dev_archdata {
|
||||
void *iommu;
|
||||
void *stc;
|
||||
void *host_controller;
|
||||
|
||||
struct device_node *prom_node;
|
||||
struct of_device *op;
|
||||
|
||||
int numa_node;
|
||||
};
|
||||
|
||||
#endif /* _ASM_SPARC_DEVICE_H */
|
79
arch/sparc/include/asm/display7seg.h
Normal file
79
arch/sparc/include/asm/display7seg.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
*
|
||||
* 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__ */
|
1
arch/sparc/include/asm/div64.h
Normal file
1
arch/sparc/include/asm/div64.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <asm-generic/div64.h>
|
8
arch/sparc/include/asm/dma-mapping.h
Normal file
8
arch/sparc/include/asm/dma-mapping.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_DMA_MAPPING_H
|
||||
#define ___ASM_SPARC_DMA_MAPPING_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/dma-mapping_64.h>
|
||||
#else
|
||||
#include <asm/dma-mapping_32.h>
|
||||
#endif
|
||||
#endif
|
11
arch/sparc/include/asm/dma-mapping_32.h
Normal file
11
arch/sparc/include/asm/dma-mapping_32.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _ASM_SPARC_DMA_MAPPING_H
|
||||
#define _ASM_SPARC_DMA_MAPPING_H
|
||||
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
#include <asm-generic/dma-mapping.h>
|
||||
#else
|
||||
#include <asm-generic/dma-mapping-broken.h>
|
||||
#endif /* PCI */
|
||||
|
||||
#endif /* _ASM_SPARC_DMA_MAPPING_H */
|
154
arch/sparc/include/asm/dma-mapping_64.h
Normal file
154
arch/sparc/include/asm/dma-mapping_64.h
Normal file
@@ -0,0 +1,154 @@
|
||||
#ifndef _ASM_SPARC64_DMA_MAPPING_H
|
||||
#define _ASM_SPARC64_DMA_MAPPING_H
|
||||
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
|
||||
|
||||
struct dma_ops {
|
||||
void *(*alloc_coherent)(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t flag);
|
||||
void (*free_coherent)(struct device *dev, size_t size,
|
||||
void *cpu_addr, dma_addr_t dma_handle);
|
||||
dma_addr_t (*map_single)(struct device *dev, void *cpu_addr,
|
||||
size_t size,
|
||||
enum dma_data_direction direction);
|
||||
void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
|
||||
size_t size,
|
||||
enum dma_data_direction direction);
|
||||
int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents,
|
||||
enum dma_data_direction direction);
|
||||
void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
|
||||
int nhwentries,
|
||||
enum dma_data_direction direction);
|
||||
void (*sync_single_for_cpu)(struct device *dev,
|
||||
dma_addr_t dma_handle, size_t size,
|
||||
enum dma_data_direction direction);
|
||||
void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
|
||||
int nelems,
|
||||
enum dma_data_direction direction);
|
||||
};
|
||||
extern const struct dma_ops *dma_ops;
|
||||
|
||||
extern int dma_supported(struct device *dev, u64 mask);
|
||||
extern int dma_set_mask(struct device *dev, u64 dma_mask);
|
||||
|
||||
static inline void *dma_alloc_coherent(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t flag)
|
||||
{
|
||||
return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
|
||||
}
|
||||
|
||||
static inline void dma_free_coherent(struct device *dev, size_t size,
|
||||
void *cpu_addr, dma_addr_t dma_handle)
|
||||
{
|
||||
dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
|
||||
}
|
||||
|
||||
static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
|
||||
size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
return dma_ops->map_single(dev, cpu_addr, size, direction);
|
||||
}
|
||||
|
||||
static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
|
||||
size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
dma_ops->unmap_single(dev, dma_addr, size, direction);
|
||||
}
|
||||
|
||||
static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
return dma_ops->map_single(dev, page_address(page) + offset,
|
||||
size, direction);
|
||||
}
|
||||
|
||||
static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
|
||||
size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
dma_ops->unmap_single(dev, dma_address, size, direction);
|
||||
}
|
||||
|
||||
static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
|
||||
int nents, enum dma_data_direction direction)
|
||||
{
|
||||
return dma_ops->map_sg(dev, sg, nents, direction);
|
||||
}
|
||||
|
||||
static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
|
||||
int nents, enum dma_data_direction direction)
|
||||
{
|
||||
dma_ops->unmap_sg(dev, sg, nents, direction);
|
||||
}
|
||||
|
||||
static inline void dma_sync_single_for_cpu(struct device *dev,
|
||||
dma_addr_t dma_handle, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
dma_ops->sync_single_for_cpu(dev, dma_handle, size, direction);
|
||||
}
|
||||
|
||||
static inline void dma_sync_single_for_device(struct device *dev,
|
||||
dma_addr_t dma_handle,
|
||||
size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
/* No flushing needed to sync cpu writes to the device. */
|
||||
}
|
||||
|
||||
static inline void dma_sync_single_range_for_cpu(struct device *dev,
|
||||
dma_addr_t dma_handle,
|
||||
unsigned long offset,
|
||||
size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
|
||||
}
|
||||
|
||||
static inline void dma_sync_single_range_for_device(struct device *dev,
|
||||
dma_addr_t dma_handle,
|
||||
unsigned long offset,
|
||||
size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
/* No flushing needed to sync cpu writes to the device. */
|
||||
}
|
||||
|
||||
|
||||
static inline void dma_sync_sg_for_cpu(struct device *dev,
|
||||
struct scatterlist *sg, int nelems,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction);
|
||||
}
|
||||
|
||||
static inline void dma_sync_sg_for_device(struct device *dev,
|
||||
struct scatterlist *sg, int nelems,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
/* No flushing needed to sync cpu writes to the device. */
|
||||
}
|
||||
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
return (dma_addr == DMA_ERROR_CODE);
|
||||
}
|
||||
|
||||
static inline int dma_get_cache_alignment(void)
|
||||
{
|
||||
/* no easy way to get cache size on all processors, so return
|
||||
* the maximum possible, to be safe */
|
||||
return (1 << INTERNODE_CACHE_SHIFT);
|
||||
}
|
||||
|
||||
#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)
|
||||
#define dma_is_consistent(d, h) (1)
|
||||
|
||||
#endif /* _ASM_SPARC64_DMA_MAPPING_H */
|
8
arch/sparc/include/asm/dma.h
Normal file
8
arch/sparc/include/asm/dma.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_DMA_H
|
||||
#define ___ASM_SPARC_DMA_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/dma_64.h>
|
||||
#else
|
||||
#include <asm/dma_32.h>
|
||||
#endif
|
||||
#endif
|
288
arch/sparc/include/asm/dma_32.h
Normal file
288
arch/sparc/include/asm/dma_32.h
Normal file
@@ -0,0 +1,288 @@
|
||||
/* include/asm/dma.h
|
||||
*
|
||||
* Copyright 1995 (C) David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
|
||||
#ifndef _ASM_SPARC_DMA_H
|
||||
#define _ASM_SPARC_DMA_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <asm/vac-ops.h> /* for invalidate's, etc. */
|
||||
#include <asm/sbus.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
struct page;
|
||||
extern spinlock_t dma_spin_lock;
|
||||
|
||||
static inline unsigned long claim_dma_lock(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&dma_spin_lock, flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline void release_dma_lock(unsigned long flags)
|
||||
{
|
||||
spin_unlock_irqrestore(&dma_spin_lock, flags);
|
||||
}
|
||||
|
||||
/* These are irrelevant for Sparc DMA, but we leave it in so that
|
||||
* things can compile.
|
||||
*/
|
||||
#define MAX_DMA_CHANNELS 8
|
||||
#define MAX_DMA_ADDRESS (~0UL)
|
||||
#define DMA_MODE_READ 1
|
||||
#define DMA_MODE_WRITE 2
|
||||
|
||||
/* Useful constants */
|
||||
#define SIZE_16MB (16*1024*1024)
|
||||
#define SIZE_64K (64*1024)
|
||||
|
||||
/* SBUS DMA controller reg offsets */
|
||||
#define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */
|
||||
#define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */
|
||||
#define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */
|
||||
#define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */
|
||||
|
||||
/* DVMA chip revisions */
|
||||
enum dvma_rev {
|
||||
dvmarev0,
|
||||
dvmaesc1,
|
||||
dvmarev1,
|
||||
dvmarev2,
|
||||
dvmarev3,
|
||||
dvmarevplus,
|
||||
dvmahme
|
||||
};
|
||||
|
||||
#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1)
|
||||
|
||||
/* Linux DMA information structure, filled during probe. */
|
||||
struct sbus_dma {
|
||||
struct sbus_dma *next;
|
||||
struct sbus_dev *sdev;
|
||||
void __iomem *regs;
|
||||
|
||||
/* Status, misc info */
|
||||
int node; /* Prom node for this DMA device */
|
||||
int running; /* Are we doing DMA now? */
|
||||
int allocated; /* Are we "owned" by anyone yet? */
|
||||
|
||||
/* Transfer information. */
|
||||
unsigned long addr; /* Start address of current transfer */
|
||||
int nbytes; /* Size of current transfer */
|
||||
int realbytes; /* For splitting up large transfers, etc. */
|
||||
|
||||
/* DMA revision */
|
||||
enum dvma_rev revision;
|
||||
};
|
||||
|
||||
extern struct sbus_dma *dma_chain;
|
||||
|
||||
/* Broken hardware... */
|
||||
#ifdef CONFIG_SUN4
|
||||
/* Have to sort this out. Does rev0 work fine on sun4[cmd] without isbroken?
|
||||
* Or is rev0 present only on sun4 boxes? -jj */
|
||||
#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev0 || (dma)->revision == dvmarev1)
|
||||
#else
|
||||
#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1)
|
||||
#endif
|
||||
#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1)
|
||||
|
||||
/* Main routines in dma.c */
|
||||
extern void dvma_init(struct sbus_bus *);
|
||||
|
||||
/* Fields in the cond_reg register */
|
||||
/* First, the version identification bits */
|
||||
#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */
|
||||
#define DMA_VERS0 0x00000000 /* Sunray DMA version */
|
||||
#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */
|
||||
#define DMA_VERS1 0x80000000 /* DMA rev 1 */
|
||||
#define DMA_VERS2 0xa0000000 /* DMA rev 2 */
|
||||
#define DMA_VERHME 0xb0000000 /* DMA hme gate array */
|
||||
#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */
|
||||
|
||||
#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */
|
||||
#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */
|
||||
#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */
|
||||
#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */
|
||||
#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */
|
||||
#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */
|
||||
#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
|
||||
#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
|
||||
#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
|
||||
#define DMA_RST_BPP DMA_RST_SCSI /* Reset the BPP controller */
|
||||
#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
|
||||
#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
|
||||
#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
|
||||
#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */
|
||||
#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */
|
||||
#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */
|
||||
#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */
|
||||
#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */
|
||||
#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */
|
||||
#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */
|
||||
#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */
|
||||
#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */
|
||||
#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */
|
||||
#define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */
|
||||
#define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */
|
||||
#define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */
|
||||
#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
|
||||
#define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
|
||||
#define DMA_BRST32 0x00040000 /* SCSI/BPP: 32byte bursts */
|
||||
#define DMA_BRST16 0x00000000 /* SCSI/BPP: 16byte bursts */
|
||||
#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
|
||||
#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
|
||||
#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
|
||||
#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */
|
||||
#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */
|
||||
#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
|
||||
#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
|
||||
#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
|
||||
#define DMA_BPP_ON DMA_SCSI_ON /* Enable BPP dma */
|
||||
#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
|
||||
#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
|
||||
#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
|
||||
#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */
|
||||
|
||||
/* Values describing the burst-size property from the PROM */
|
||||
#define DMA_BURST1 0x01
|
||||
#define DMA_BURST2 0x02
|
||||
#define DMA_BURST4 0x04
|
||||
#define DMA_BURST8 0x08
|
||||
#define DMA_BURST16 0x10
|
||||
#define DMA_BURST32 0x20
|
||||
#define DMA_BURST64 0x40
|
||||
#define DMA_BURSTBITS 0x7f
|
||||
|
||||
/* Determine highest possible final transfer address given a base */
|
||||
#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL))
|
||||
|
||||
/* Yes, I hack a lot of elisp in my spare time... */
|
||||
#define DMA_ERROR_P(regs) ((((regs)->cond_reg) & DMA_HNDL_ERROR))
|
||||
#define DMA_IRQ_P(regs) ((((regs)->cond_reg) & (DMA_HNDL_INTR | DMA_HNDL_ERROR)))
|
||||
#define DMA_WRITE_P(regs) ((((regs)->cond_reg) & DMA_ST_WRITE))
|
||||
#define DMA_OFF(regs) ((((regs)->cond_reg) &= (~DMA_ENABLE)))
|
||||
#define DMA_INTSOFF(regs) ((((regs)->cond_reg) &= (~DMA_INT_ENAB)))
|
||||
#define DMA_INTSON(regs) ((((regs)->cond_reg) |= (DMA_INT_ENAB)))
|
||||
#define DMA_PUNTFIFO(regs) ((((regs)->cond_reg) |= DMA_FIFO_INV))
|
||||
#define DMA_SETSTART(regs, addr) ((((regs)->st_addr) = (char *) addr))
|
||||
#define DMA_BEGINDMA_W(regs) \
|
||||
((((regs)->cond_reg |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB))))
|
||||
#define DMA_BEGINDMA_R(regs) \
|
||||
((((regs)->cond_reg |= ((DMA_ENABLE|DMA_INT_ENAB)&(~DMA_ST_WRITE)))))
|
||||
|
||||
/* For certain DMA chips, we need to disable ints upon irq entry
|
||||
* and turn them back on when we are done. So in any ESP interrupt
|
||||
* handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT
|
||||
* when leaving the handler. You have been warned...
|
||||
*/
|
||||
#define DMA_IRQ_ENTRY(dma, dregs) do { \
|
||||
if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \
|
||||
} while (0)
|
||||
|
||||
#define DMA_IRQ_EXIT(dma, dregs) do { \
|
||||
if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \
|
||||
} while(0)
|
||||
|
||||
#if 0 /* P3 this stuff is inline in ledma.c:init_restart_ledma() */
|
||||
/* Pause until counter runs out or BIT isn't set in the DMA condition
|
||||
* register.
|
||||
*/
|
||||
static inline void sparc_dma_pause(struct sparc_dma_registers *regs,
|
||||
unsigned long bit)
|
||||
{
|
||||
int ctr = 50000; /* Let's find some bugs ;) */
|
||||
|
||||
/* Busy wait until the bit is not set any more */
|
||||
while((regs->cond_reg&bit) && (ctr>0)) {
|
||||
ctr--;
|
||||
__delay(5);
|
||||
}
|
||||
|
||||
/* Check for bogus outcome. */
|
||||
if(!ctr)
|
||||
panic("DMA timeout");
|
||||
}
|
||||
|
||||
/* Reset the friggin' thing... */
|
||||
#define DMA_RESET(dma) do { \
|
||||
struct sparc_dma_registers *regs = dma->regs; \
|
||||
/* Let the current FIFO drain itself */ \
|
||||
sparc_dma_pause(regs, (DMA_FIFO_ISDRAIN)); \
|
||||
/* Reset the logic */ \
|
||||
regs->cond_reg |= (DMA_RST_SCSI); /* assert */ \
|
||||
__delay(400); /* let the bits set ;) */ \
|
||||
regs->cond_reg &= ~(DMA_RST_SCSI); /* de-assert */ \
|
||||
sparc_dma_enable_interrupts(regs); /* Re-enable interrupts */ \
|
||||
/* Enable FAST transfers if available */ \
|
||||
if(dma->revision>dvmarev1) regs->cond_reg |= DMA_3CLKS; \
|
||||
dma->running = 0; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#define for_each_dvma(dma) \
|
||||
for((dma) = dma_chain; (dma); (dma) = (dma)->next)
|
||||
|
||||
extern int get_dma_list(char *);
|
||||
extern int request_dma(unsigned int, __const__ char *);
|
||||
extern void free_dma(unsigned int);
|
||||
|
||||
/* From PCI */
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
extern int isa_dma_bridge_buggy;
|
||||
#else
|
||||
#define isa_dma_bridge_buggy (0)
|
||||
#endif
|
||||
|
||||
/* 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)
|
||||
|
||||
/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */
|
||||
BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct sbus_bus *sbus)
|
||||
BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
|
||||
BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct sbus_bus *sbus)
|
||||
BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
|
||||
|
||||
#define mmu_get_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus)
|
||||
#define mmu_get_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus)
|
||||
#define mmu_release_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus)
|
||||
#define mmu_release_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus)
|
||||
|
||||
/*
|
||||
* mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep.
|
||||
*
|
||||
* The mmu_map_dma_area establishes two mappings in one go.
|
||||
* These mappings point to pages normally mapped at 'va' (linear address).
|
||||
* First mapping is for CPU visible address at 'a', uncached.
|
||||
* This is an alias, but it works because it is an uncached mapping.
|
||||
* 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.
|
||||
* 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, dma_addr_t *, unsigned long, unsigned long, int len)
|
||||
BTFIXUPDEF_CALL(struct page *, mmu_translate_dvma, unsigned long busa)
|
||||
BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long busa, int len)
|
||||
|
||||
#define mmu_map_dma_area(pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(pba,va,a,len)
|
||||
#define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len)
|
||||
#define mmu_translate_dvma(ba) BTFIXUP_CALL(mmu_translate_dvma)(ba)
|
||||
|
||||
#endif /* !(_ASM_SPARC_DMA_H) */
|
205
arch/sparc/include/asm/dma_64.h
Normal file
205
arch/sparc/include/asm/dma_64.h
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* include/asm/dma.h
|
||||
*
|
||||
* Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#ifndef _ASM_SPARC64_DMA_H
|
||||
#define _ASM_SPARC64_DMA_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include <asm/sbus.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/oplib.h>
|
||||
|
||||
/* These are irrelevant for Sparc DMA, but we leave it in so that
|
||||
* things can compile.
|
||||
*/
|
||||
#define MAX_DMA_CHANNELS 8
|
||||
#define DMA_MODE_READ 1
|
||||
#define DMA_MODE_WRITE 2
|
||||
#define MAX_DMA_ADDRESS (~0UL)
|
||||
|
||||
/* Useful constants */
|
||||
#define SIZE_16MB (16*1024*1024)
|
||||
#define SIZE_64K (64*1024)
|
||||
|
||||
/* SBUS DMA controller reg offsets */
|
||||
#define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */
|
||||
#define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */
|
||||
#define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */
|
||||
#define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */
|
||||
|
||||
/* DVMA chip revisions */
|
||||
enum dvma_rev {
|
||||
dvmarev0,
|
||||
dvmaesc1,
|
||||
dvmarev1,
|
||||
dvmarev2,
|
||||
dvmarev3,
|
||||
dvmarevplus,
|
||||
dvmahme
|
||||
};
|
||||
|
||||
#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1)
|
||||
|
||||
/* Linux DMA information structure, filled during probe. */
|
||||
struct sbus_dma {
|
||||
struct sbus_dma *next;
|
||||
struct sbus_dev *sdev;
|
||||
void __iomem *regs;
|
||||
|
||||
/* Status, misc info */
|
||||
int node; /* Prom node for this DMA device */
|
||||
int running; /* Are we doing DMA now? */
|
||||
int allocated; /* Are we "owned" by anyone yet? */
|
||||
|
||||
/* Transfer information. */
|
||||
u32 addr; /* Start address of current transfer */
|
||||
int nbytes; /* Size of current transfer */
|
||||
int realbytes; /* For splitting up large transfers, etc. */
|
||||
|
||||
/* DMA revision */
|
||||
enum dvma_rev revision;
|
||||
};
|
||||
|
||||
extern struct sbus_dma *dma_chain;
|
||||
|
||||
/* Broken hardware... */
|
||||
#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1)
|
||||
#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1)
|
||||
|
||||
/* Main routines in dma.c */
|
||||
extern void dvma_init(struct sbus_bus *);
|
||||
|
||||
/* Fields in the cond_reg register */
|
||||
/* First, the version identification bits */
|
||||
#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */
|
||||
#define DMA_VERS0 0x00000000 /* Sunray DMA version */
|
||||
#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */
|
||||
#define DMA_VERS1 0x80000000 /* DMA rev 1 */
|
||||
#define DMA_VERS2 0xa0000000 /* DMA rev 2 */
|
||||
#define DMA_VERHME 0xb0000000 /* DMA hme gate array */
|
||||
#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */
|
||||
|
||||
#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */
|
||||
#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */
|
||||
#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */
|
||||
#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */
|
||||
#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */
|
||||
#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */
|
||||
#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
|
||||
#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
|
||||
#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
|
||||
#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
|
||||
#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
|
||||
#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
|
||||
#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */
|
||||
#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */
|
||||
#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */
|
||||
#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */
|
||||
#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */
|
||||
#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */
|
||||
#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */
|
||||
#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */
|
||||
#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */
|
||||
#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */
|
||||
#define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */
|
||||
#define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */
|
||||
#define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */
|
||||
#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
|
||||
#define DMA_BRST64 0x000c0000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
|
||||
#define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */
|
||||
#define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */
|
||||
#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
|
||||
#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
|
||||
#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
|
||||
#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */
|
||||
#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */
|
||||
#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
|
||||
#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
|
||||
#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
|
||||
#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
|
||||
#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
|
||||
#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
|
||||
#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */
|
||||
|
||||
/* Values describing the burst-size property from the PROM */
|
||||
#define DMA_BURST1 0x01
|
||||
#define DMA_BURST2 0x02
|
||||
#define DMA_BURST4 0x04
|
||||
#define DMA_BURST8 0x08
|
||||
#define DMA_BURST16 0x10
|
||||
#define DMA_BURST32 0x20
|
||||
#define DMA_BURST64 0x40
|
||||
#define DMA_BURSTBITS 0x7f
|
||||
|
||||
/* Determine highest possible final transfer address given a base */
|
||||
#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL))
|
||||
|
||||
/* Yes, I hack a lot of elisp in my spare time... */
|
||||
#define DMA_ERROR_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_HNDL_ERROR))
|
||||
#define DMA_IRQ_P(regs) ((sbus_readl((regs) + DMA_CSR)) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))
|
||||
#define DMA_WRITE_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_ST_WRITE))
|
||||
#define DMA_OFF(__regs) \
|
||||
do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
|
||||
tmp &= ~DMA_ENABLE; \
|
||||
sbus_writel(tmp, (__regs) + DMA_CSR); \
|
||||
} while(0)
|
||||
#define DMA_INTSOFF(__regs) \
|
||||
do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
|
||||
tmp &= ~DMA_INT_ENAB; \
|
||||
sbus_writel(tmp, (__regs) + DMA_CSR); \
|
||||
} while(0)
|
||||
#define DMA_INTSON(__regs) \
|
||||
do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
|
||||
tmp |= DMA_INT_ENAB; \
|
||||
sbus_writel(tmp, (__regs) + DMA_CSR); \
|
||||
} while(0)
|
||||
#define DMA_PUNTFIFO(__regs) \
|
||||
do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
|
||||
tmp |= DMA_FIFO_INV; \
|
||||
sbus_writel(tmp, (__regs) + DMA_CSR); \
|
||||
} while(0)
|
||||
#define DMA_SETSTART(__regs, __addr) \
|
||||
sbus_writel((u32)(__addr), (__regs) + DMA_ADDR);
|
||||
#define DMA_BEGINDMA_W(__regs) \
|
||||
do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
|
||||
tmp |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB); \
|
||||
sbus_writel(tmp, (__regs) + DMA_CSR); \
|
||||
} while(0)
|
||||
#define DMA_BEGINDMA_R(__regs) \
|
||||
do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
|
||||
tmp |= (DMA_ENABLE|DMA_INT_ENAB); \
|
||||
tmp &= ~DMA_ST_WRITE; \
|
||||
sbus_writel(tmp, (__regs) + DMA_CSR); \
|
||||
} while(0)
|
||||
|
||||
/* For certain DMA chips, we need to disable ints upon irq entry
|
||||
* and turn them back on when we are done. So in any ESP interrupt
|
||||
* handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT
|
||||
* when leaving the handler. You have been warned...
|
||||
*/
|
||||
#define DMA_IRQ_ENTRY(dma, dregs) do { \
|
||||
if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \
|
||||
} while (0)
|
||||
|
||||
#define DMA_IRQ_EXIT(dma, dregs) do { \
|
||||
if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \
|
||||
} while(0)
|
||||
|
||||
#define for_each_dvma(dma) \
|
||||
for((dma) = dma_chain; (dma); (dma) = (dma)->next)
|
||||
|
||||
/* From PCI */
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
extern int isa_dma_bridge_buggy;
|
||||
#else
|
||||
#define isa_dma_bridge_buggy (0)
|
||||
#endif
|
||||
|
||||
#endif /* !(_ASM_SPARC64_DMA_H) */
|
8
arch/sparc/include/asm/ebus.h
Normal file
8
arch/sparc/include/asm/ebus.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_EBUS_H
|
||||
#define ___ASM_SPARC_EBUS_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/ebus_64.h>
|
||||
#else
|
||||
#include <asm/ebus_32.h>
|
||||
#endif
|
||||
#endif
|
99
arch/sparc/include/asm/ebus_32.h
Normal file
99
arch/sparc/include/asm/ebus_32.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* ebus.h: PCI to Ebus pseudo driver software state.
|
||||
*
|
||||
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
|
||||
*
|
||||
* Adopted for sparc by V. Roganov and G. Raiko.
|
||||
*/
|
||||
|
||||
#ifndef __SPARC_EBUS_H
|
||||
#define __SPARC_EBUS_H
|
||||
|
||||
#ifndef _LINUX_IOPORT_H
|
||||
#include <linux/ioport.h>
|
||||
#endif
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/of_device.h>
|
||||
|
||||
struct linux_ebus_child {
|
||||
struct linux_ebus_child *next;
|
||||
struct linux_ebus_device *parent;
|
||||
struct linux_ebus *bus;
|
||||
struct device_node *prom_node;
|
||||
struct resource resource[PROMREG_MAX];
|
||||
int num_addrs;
|
||||
unsigned int irqs[PROMINTR_MAX];
|
||||
int num_irqs;
|
||||
};
|
||||
|
||||
struct linux_ebus_device {
|
||||
struct of_device ofdev;
|
||||
struct linux_ebus_device *next;
|
||||
struct linux_ebus_child *children;
|
||||
struct linux_ebus *bus;
|
||||
struct device_node *prom_node;
|
||||
struct resource resource[PROMREG_MAX];
|
||||
int num_addrs;
|
||||
unsigned int irqs[PROMINTR_MAX];
|
||||
int num_irqs;
|
||||
};
|
||||
#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
|
||||
|
||||
struct linux_ebus {
|
||||
struct of_device ofdev;
|
||||
struct linux_ebus *next;
|
||||
struct linux_ebus_device *devices;
|
||||
struct linux_pbm_info *parent;
|
||||
struct pci_dev *self;
|
||||
struct device_node *prom_node;
|
||||
};
|
||||
#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
|
||||
|
||||
struct linux_ebus_dma {
|
||||
unsigned int dcsr;
|
||||
unsigned int dacr;
|
||||
unsigned int dbcr;
|
||||
};
|
||||
|
||||
#define EBUS_DCSR_INT_PEND 0x00000001
|
||||
#define EBUS_DCSR_ERR_PEND 0x00000002
|
||||
#define EBUS_DCSR_DRAIN 0x00000004
|
||||
#define EBUS_DCSR_INT_EN 0x00000010
|
||||
#define EBUS_DCSR_RESET 0x00000080
|
||||
#define EBUS_DCSR_WRITE 0x00000100
|
||||
#define EBUS_DCSR_EN_DMA 0x00000200
|
||||
#define EBUS_DCSR_CYC_PEND 0x00000400
|
||||
#define EBUS_DCSR_DIAG_RD_DONE 0x00000800
|
||||
#define EBUS_DCSR_DIAG_WR_DONE 0x00001000
|
||||
#define EBUS_DCSR_EN_CNT 0x00002000
|
||||
#define EBUS_DCSR_TC 0x00004000
|
||||
#define EBUS_DCSR_DIS_CSR_DRN 0x00010000
|
||||
#define EBUS_DCSR_BURST_SZ_MASK 0x000c0000
|
||||
#define EBUS_DCSR_BURST_SZ_1 0x00080000
|
||||
#define EBUS_DCSR_BURST_SZ_4 0x00000000
|
||||
#define EBUS_DCSR_BURST_SZ_8 0x00040000
|
||||
#define EBUS_DCSR_BURST_SZ_16 0x000c0000
|
||||
#define EBUS_DCSR_DIAG_EN 0x00100000
|
||||
#define EBUS_DCSR_DIS_ERR_PEND 0x00400000
|
||||
#define EBUS_DCSR_TCI_DIS 0x00800000
|
||||
#define EBUS_DCSR_EN_NEXT 0x01000000
|
||||
#define EBUS_DCSR_DMA_ON 0x02000000
|
||||
#define EBUS_DCSR_A_LOADED 0x04000000
|
||||
#define EBUS_DCSR_NA_LOADED 0x08000000
|
||||
#define EBUS_DCSR_DEV_ID_MASK 0xf0000000
|
||||
|
||||
extern struct linux_ebus *ebus_chain;
|
||||
|
||||
extern void ebus_init(void);
|
||||
|
||||
#define for_each_ebus(bus) \
|
||||
for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
|
||||
|
||||
#define for_each_ebusdev(dev, bus) \
|
||||
for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
|
||||
|
||||
#define for_each_edevchild(dev, child) \
|
||||
for((child) = (dev)->children; (child); (child) = (child)->next)
|
||||
|
||||
#endif /* !(__SPARC_EBUS_H) */
|
94
arch/sparc/include/asm/ebus_64.h
Normal file
94
arch/sparc/include/asm/ebus_64.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* ebus.h: PCI to Ebus pseudo driver software state.
|
||||
*
|
||||
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
|
||||
* Copyright (C) 1999 David S. Miller (davem@redhat.com)
|
||||
*/
|
||||
|
||||
#ifndef __SPARC64_EBUS_H
|
||||
#define __SPARC64_EBUS_H
|
||||
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/of_device.h>
|
||||
|
||||
struct linux_ebus_child {
|
||||
struct linux_ebus_child *next;
|
||||
struct linux_ebus_device *parent;
|
||||
struct linux_ebus *bus;
|
||||
struct device_node *prom_node;
|
||||
struct resource resource[PROMREG_MAX];
|
||||
int num_addrs;
|
||||
unsigned int irqs[PROMINTR_MAX];
|
||||
int num_irqs;
|
||||
};
|
||||
|
||||
struct linux_ebus_device {
|
||||
struct of_device ofdev;
|
||||
struct linux_ebus_device *next;
|
||||
struct linux_ebus_child *children;
|
||||
struct linux_ebus *bus;
|
||||
struct device_node *prom_node;
|
||||
struct resource resource[PROMREG_MAX];
|
||||
int num_addrs;
|
||||
unsigned int irqs[PROMINTR_MAX];
|
||||
int num_irqs;
|
||||
};
|
||||
#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
|
||||
|
||||
struct linux_ebus {
|
||||
struct of_device ofdev;
|
||||
struct linux_ebus *next;
|
||||
struct linux_ebus_device *devices;
|
||||
struct pci_dev *self;
|
||||
int index;
|
||||
int is_rio;
|
||||
struct device_node *prom_node;
|
||||
};
|
||||
#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
|
||||
|
||||
struct ebus_dma_info {
|
||||
spinlock_t lock;
|
||||
void __iomem *regs;
|
||||
|
||||
unsigned int flags;
|
||||
#define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001
|
||||
#define EBUS_DMA_FLAG_TCI_DISABLE 0x00000002
|
||||
|
||||
/* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
|
||||
* set.
|
||||
*/
|
||||
void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
|
||||
void *client_cookie;
|
||||
unsigned int irq;
|
||||
#define EBUS_DMA_EVENT_ERROR 1
|
||||
#define EBUS_DMA_EVENT_DMA 2
|
||||
#define EBUS_DMA_EVENT_DEVICE 4
|
||||
|
||||
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,
|
||||
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);
|
||||
|
||||
extern struct linux_ebus *ebus_chain;
|
||||
|
||||
extern void ebus_init(void);
|
||||
|
||||
#define for_each_ebus(bus) \
|
||||
for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
|
||||
|
||||
#define for_each_ebusdev(dev, bus) \
|
||||
for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
|
||||
|
||||
#define for_each_edevchild(dev, child) \
|
||||
for((child) = (dev)->children; (child); (child) = (child)->next)
|
||||
|
||||
#endif /* !(__SPARC64_EBUS_H) */
|
122
arch/sparc/include/asm/ecc.h
Normal file
122
arch/sparc/include/asm/ecc.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* ecc.h: Definitions and defines for the external cache/memory
|
||||
* controller on the sun4m.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_ECC_H
|
||||
#define _SPARC_ECC_H
|
||||
|
||||
/* These registers are accessed through the SRMMU passthrough ASI 0x20 */
|
||||
#define ECC_ENABLE 0x00000000 /* ECC enable register */
|
||||
#define ECC_FSTATUS 0x00000008 /* ECC fault status register */
|
||||
#define ECC_FADDR 0x00000010 /* ECC fault address register */
|
||||
#define ECC_DIGNOSTIC 0x00000018 /* ECC diagnostics register */
|
||||
#define ECC_MBAENAB 0x00000020 /* MBus arbiter enable register */
|
||||
#define ECC_DMESG 0x00001000 /* Diagnostic message passing area */
|
||||
|
||||
/* ECC MBus Arbiter Enable register:
|
||||
*
|
||||
* ----------------------------------------
|
||||
* | |SBUS|MOD3|MOD2|MOD1|RSV|
|
||||
* ----------------------------------------
|
||||
* 31 5 4 3 2 1 0
|
||||
*
|
||||
* SBUS: Enable MBus Arbiter on the SBus 0=off 1=on
|
||||
* MOD3: Enable MBus Arbiter on MBus module 3 0=off 1=on
|
||||
* MOD2: Enable MBus Arbiter on MBus module 2 0=off 1=on
|
||||
* MOD1: Enable MBus Arbiter on MBus module 1 0=off 1=on
|
||||
*/
|
||||
|
||||
#define ECC_MBAE_SBUS 0x00000010
|
||||
#define ECC_MBAE_MOD3 0x00000008
|
||||
#define ECC_MBAE_MOD2 0x00000004
|
||||
#define ECC_MBAE_MOD1 0x00000002
|
||||
|
||||
/* ECC Fault Control Register layout:
|
||||
*
|
||||
* -----------------------------
|
||||
* | RESV | ECHECK | EINT |
|
||||
* -----------------------------
|
||||
* 31 2 1 0
|
||||
*
|
||||
* ECHECK: Enable ECC checking. 0=off 1=on
|
||||
* EINT: Enable Interrupts for correctable errors. 0=off 1=on
|
||||
*/
|
||||
#define ECC_FCR_CHECK 0x00000002
|
||||
#define ECC_FCR_INTENAB 0x00000001
|
||||
|
||||
/* ECC Fault Address Register Zero layout:
|
||||
*
|
||||
* -----------------------------------------------------
|
||||
* | MID | S | RSV | VA | BM |AT| C| SZ |TYP| PADDR |
|
||||
* -----------------------------------------------------
|
||||
* 31-28 27 26-22 21-14 13 12 11 10-8 7-4 3-0
|
||||
*
|
||||
* MID: ModuleID of the faulting processor. ie. who did it?
|
||||
* S: Supervisor/Privileged access? 0=no 1=yes
|
||||
* VA: Bits 19-12 of the virtual faulting address, these are the
|
||||
* superset bits in the virtual cache and can be used for
|
||||
* a flush operation if necessary.
|
||||
* BM: Boot mode? 0=no 1=yes This is just like the SRMMU boot
|
||||
* mode bit.
|
||||
* AT: Did this fault happen during an atomic instruction? 0=no
|
||||
* 1=yes. This means either an 'ldstub' or 'swap' instruction
|
||||
* was in progress (but not finished) when this fault happened.
|
||||
* This indicated whether the bus was locked when the fault
|
||||
* occurred.
|
||||
* C: Did the pte for this access indicate that it was cacheable?
|
||||
* 0=no 1=yes
|
||||
* SZ: The size of the transaction.
|
||||
* TYP: The transaction type.
|
||||
* PADDR: Bits 35-32 of the physical address for the fault.
|
||||
*/
|
||||
#define ECC_FADDR0_MIDMASK 0xf0000000
|
||||
#define ECC_FADDR0_S 0x08000000
|
||||
#define ECC_FADDR0_VADDR 0x003fc000
|
||||
#define ECC_FADDR0_BMODE 0x00002000
|
||||
#define ECC_FADDR0_ATOMIC 0x00001000
|
||||
#define ECC_FADDR0_CACHE 0x00000800
|
||||
#define ECC_FADDR0_SIZE 0x00000700
|
||||
#define ECC_FADDR0_TYPE 0x000000f0
|
||||
#define ECC_FADDR0_PADDR 0x0000000f
|
||||
|
||||
/* ECC Fault Address Register One layout:
|
||||
*
|
||||
* -------------------------------------
|
||||
* | Physical Address 31-0 |
|
||||
* -------------------------------------
|
||||
* 31 0
|
||||
*
|
||||
* You get the upper 4 bits of the physical address from the
|
||||
* PADDR field in ECC Fault Address Zero register.
|
||||
*/
|
||||
|
||||
/* ECC Fault Status Register layout:
|
||||
*
|
||||
* ----------------------------------------------
|
||||
* | RESV|C2E|MULT|SYNDROME|DWORD|UNC|TIMEO|BS|C|
|
||||
* ----------------------------------------------
|
||||
* 31-18 17 16 15-8 7-4 3 2 1 0
|
||||
*
|
||||
* C2E: A C2 graphics error occurred. 0=no 1=yes (SS10 only)
|
||||
* MULT: Multiple errors occurred ;-O 0=no 1=prom_panic(yes)
|
||||
* SYNDROME: Controller is mentally unstable.
|
||||
* DWORD:
|
||||
* UNC: Uncorrectable error. 0=no 1=yes
|
||||
* TIMEO: Timeout occurred. 0=no 1=yes
|
||||
* BS: C2 graphics bad slot access. 0=no 1=yes (SS10 only)
|
||||
* C: Correctable error? 0=no 1=yes
|
||||
*/
|
||||
|
||||
#define ECC_FSR_C2ERR 0x00020000
|
||||
#define ECC_FSR_MULT 0x00010000
|
||||
#define ECC_FSR_SYND 0x0000ff00
|
||||
#define ECC_FSR_DWORD 0x000000f0
|
||||
#define ECC_FSR_UNC 0x00000008
|
||||
#define ECC_FSR_TIMEO 0x00000004
|
||||
#define ECC_FSR_BADSLOT 0x00000002
|
||||
#define ECC_FSR_C 0x00000001
|
||||
|
||||
#endif /* !(_SPARC_ECC_H) */
|
9
arch/sparc/include/asm/eeprom.h
Normal file
9
arch/sparc/include/asm/eeprom.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* eeprom.h: Definitions for the Sun eeprom.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
/* The EEPROM and the Mostek Mk48t02 use the same IO address space
|
||||
* for their registers/data areas. The IDPROM lives here too.
|
||||
*/
|
8
arch/sparc/include/asm/elf.h
Normal file
8
arch/sparc/include/asm/elf.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_ELF_H
|
||||
#define ___ASM_SPARC_ELF_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/elf_64.h>
|
||||
#else
|
||||
#include <asm/elf_32.h>
|
||||
#endif
|
||||
#endif
|
145
arch/sparc/include/asm/elf_32.h
Normal file
145
arch/sparc/include/asm/elf_32.h
Normal file
@@ -0,0 +1,145 @@
|
||||
#ifndef __ASMSPARC_ELF_H
|
||||
#define __ASMSPARC_ELF_H
|
||||
|
||||
/*
|
||||
* ELF register definitions..
|
||||
*/
|
||||
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
/*
|
||||
* Sparc section types
|
||||
*/
|
||||
#define STT_REGISTER 13
|
||||
|
||||
/*
|
||||
* Sparc ELF relocation types
|
||||
*/
|
||||
#define R_SPARC_NONE 0
|
||||
#define R_SPARC_8 1
|
||||
#define R_SPARC_16 2
|
||||
#define R_SPARC_32 3
|
||||
#define R_SPARC_DISP8 4
|
||||
#define R_SPARC_DISP16 5
|
||||
#define R_SPARC_DISP32 6
|
||||
#define R_SPARC_WDISP30 7
|
||||
#define R_SPARC_WDISP22 8
|
||||
#define R_SPARC_HI22 9
|
||||
#define R_SPARC_22 10
|
||||
#define R_SPARC_13 11
|
||||
#define R_SPARC_LO10 12
|
||||
#define R_SPARC_GOT10 13
|
||||
#define R_SPARC_GOT13 14
|
||||
#define R_SPARC_GOT22 15
|
||||
#define R_SPARC_PC10 16
|
||||
#define R_SPARC_PC22 17
|
||||
#define R_SPARC_WPLT30 18
|
||||
#define R_SPARC_COPY 19
|
||||
#define R_SPARC_GLOB_DAT 20
|
||||
#define R_SPARC_JMP_SLOT 21
|
||||
#define R_SPARC_RELATIVE 22
|
||||
#define R_SPARC_UA32 23
|
||||
#define R_SPARC_PLT32 24
|
||||
#define R_SPARC_HIPLT22 25
|
||||
#define R_SPARC_LOPLT10 26
|
||||
#define R_SPARC_PCPLT32 27
|
||||
#define R_SPARC_PCPLT22 28
|
||||
#define R_SPARC_PCPLT10 29
|
||||
#define R_SPARC_10 30
|
||||
#define R_SPARC_11 31
|
||||
#define R_SPARC_64 32
|
||||
#define R_SPARC_OLO10 33
|
||||
#define R_SPARC_WDISP16 40
|
||||
#define R_SPARC_WDISP19 41
|
||||
#define R_SPARC_7 43
|
||||
#define R_SPARC_5 44
|
||||
#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 CORE_DUMP_USE_REGSET
|
||||
|
||||
/* Format is:
|
||||
* G0 --> G7
|
||||
* O0 --> O7
|
||||
* L0 --> L7
|
||||
* I0 --> I7
|
||||
* PSR, PC, nPC, Y, WIM, TBR
|
||||
*/
|
||||
typedef unsigned long elf_greg_t;
|
||||
#define ELF_NGREG 38
|
||||
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
unsigned long pr_regs[32];
|
||||
double pr_dregs[16];
|
||||
} pr_fr;
|
||||
unsigned long __unused;
|
||||
unsigned long pr_fsr;
|
||||
unsigned char pr_qcnt;
|
||||
unsigned char pr_q_entrysize;
|
||||
unsigned char pr_en;
|
||||
unsigned int pr_q[64];
|
||||
} elf_fpregset_t;
|
||||
|
||||
#include <asm/mbus.h>
|
||||
|
||||
/*
|
||||
* This is used to ensure we don't load something for the wrong architecture.
|
||||
*/
|
||||
#define elf_check_arch(x) ((x)->e_machine == EM_SPARC)
|
||||
|
||||
/*
|
||||
* These are used to set parameters in the core dumps.
|
||||
*/
|
||||
#define ELF_ARCH EM_SPARC
|
||||
#define ELF_CLASS ELFCLASS32
|
||||
#define ELF_DATA ELFDATA2MSB
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
#ifndef CONFIG_SUN4
|
||||
#define ELF_EXEC_PAGESIZE 4096
|
||||
#else
|
||||
#define ELF_EXEC_PAGESIZE 8192
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
|
||||
use of this is to invoke "./ld.so someprog" to test out a new version of
|
||||
the loader. We need to make sure that it is out of the way of the program
|
||||
that it will "exec", and that there is sufficient room for the brk. */
|
||||
|
||||
#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE)
|
||||
|
||||
/* This yields a mask that user programs can use to figure out what
|
||||
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_SUN4) ? 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)))
|
||||
|
||||
/* This yields a string that ld.so will use to load implementation
|
||||
specific libraries for optimization. This is more specific in
|
||||
intent than poking at uname or /proc/cpuinfo. */
|
||||
|
||||
#define ELF_PLATFORM (NULL)
|
||||
|
||||
#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
|
||||
|
||||
#endif /* !(__ASMSPARC_ELF_H) */
|
217
arch/sparc/include/asm/elf_64.h
Normal file
217
arch/sparc/include/asm/elf_64.h
Normal file
@@ -0,0 +1,217 @@
|
||||
#ifndef __ASM_SPARC64_ELF_H
|
||||
#define __ASM_SPARC64_ELF_H
|
||||
|
||||
/*
|
||||
* ELF register definitions..
|
||||
*/
|
||||
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/spitfire.h>
|
||||
|
||||
/*
|
||||
* Sparc section types
|
||||
*/
|
||||
#define STT_REGISTER 13
|
||||
|
||||
/*
|
||||
* Sparc ELF relocation types
|
||||
*/
|
||||
#define R_SPARC_NONE 0
|
||||
#define R_SPARC_8 1
|
||||
#define R_SPARC_16 2
|
||||
#define R_SPARC_32 3
|
||||
#define R_SPARC_DISP8 4
|
||||
#define R_SPARC_DISP16 5
|
||||
#define R_SPARC_DISP32 6
|
||||
#define R_SPARC_WDISP30 7
|
||||
#define R_SPARC_WDISP22 8
|
||||
#define R_SPARC_HI22 9
|
||||
#define R_SPARC_22 10
|
||||
#define R_SPARC_13 11
|
||||
#define R_SPARC_LO10 12
|
||||
#define R_SPARC_GOT10 13
|
||||
#define R_SPARC_GOT13 14
|
||||
#define R_SPARC_GOT22 15
|
||||
#define R_SPARC_PC10 16
|
||||
#define R_SPARC_PC22 17
|
||||
#define R_SPARC_WPLT30 18
|
||||
#define R_SPARC_COPY 19
|
||||
#define R_SPARC_GLOB_DAT 20
|
||||
#define R_SPARC_JMP_SLOT 21
|
||||
#define R_SPARC_RELATIVE 22
|
||||
#define R_SPARC_UA32 23
|
||||
#define R_SPARC_PLT32 24
|
||||
#define R_SPARC_HIPLT22 25
|
||||
#define R_SPARC_LOPLT10 26
|
||||
#define R_SPARC_PCPLT32 27
|
||||
#define R_SPARC_PCPLT22 28
|
||||
#define R_SPARC_PCPLT10 29
|
||||
#define R_SPARC_10 30
|
||||
#define R_SPARC_11 31
|
||||
#define R_SPARC_64 32
|
||||
#define R_SPARC_OLO10 33
|
||||
#define R_SPARC_WDISP16 40
|
||||
#define R_SPARC_WDISP19 41
|
||||
#define R_SPARC_7 43
|
||||
#define R_SPARC_5 44
|
||||
#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 CORE_DUMP_USE_REGSET
|
||||
|
||||
/*
|
||||
* These are used to set parameters in the core dumps.
|
||||
*/
|
||||
#define ELF_ARCH EM_SPARCV9
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#define ELF_DATA ELFDATA2MSB
|
||||
|
||||
/* Format of 64-bit elf_gregset_t is:
|
||||
* G0 --> G7
|
||||
* O0 --> O7
|
||||
* L0 --> L7
|
||||
* I0 --> I7
|
||||
* TSTATE
|
||||
* TPC
|
||||
* TNPC
|
||||
* Y
|
||||
*/
|
||||
typedef unsigned long elf_greg_t;
|
||||
#define ELF_NGREG 36
|
||||
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
|
||||
|
||||
typedef struct {
|
||||
unsigned long pr_regs[32];
|
||||
unsigned long pr_fsr;
|
||||
unsigned long pr_gsr;
|
||||
unsigned long pr_fprs;
|
||||
} elf_fpregset_t;
|
||||
|
||||
/* Format of 32-bit elf_gregset_t is:
|
||||
* G0 --> G7
|
||||
* O0 --> O7
|
||||
* L0 --> L7
|
||||
* I0 --> I7
|
||||
* PSR, PC, nPC, Y, WIM, TBR
|
||||
*/
|
||||
typedef unsigned int compat_elf_greg_t;
|
||||
#define COMPAT_ELF_NGREG 38
|
||||
typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
unsigned int pr_regs[32];
|
||||
unsigned long pr_dregs[16];
|
||||
} pr_fr;
|
||||
unsigned int __unused;
|
||||
unsigned int pr_fsr;
|
||||
unsigned char pr_qcnt;
|
||||
unsigned char pr_q_entrysize;
|
||||
unsigned char pr_en;
|
||||
unsigned int pr_q[64];
|
||||
} compat_elf_fpregset_t;
|
||||
|
||||
/* UltraSparc extensions. Still unused, but will be eventually. */
|
||||
typedef struct {
|
||||
unsigned int pr_type;
|
||||
unsigned int pr_align;
|
||||
union {
|
||||
struct {
|
||||
union {
|
||||
unsigned int pr_regs[32];
|
||||
unsigned long pr_dregs[16];
|
||||
long double pr_qregs[8];
|
||||
} pr_xfr;
|
||||
} pr_v8p;
|
||||
unsigned int pr_xfsr;
|
||||
unsigned int pr_fprs;
|
||||
unsigned int pr_xg[8];
|
||||
unsigned int pr_xo[8];
|
||||
unsigned long pr_tstate;
|
||||
unsigned int pr_filler[8];
|
||||
} pr_un;
|
||||
} elf_xregset_t;
|
||||
|
||||
/*
|
||||
* This is used to ensure we don't load something for the wrong architecture.
|
||||
*/
|
||||
#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
|
||||
#define compat_elf_check_arch(x) ((x)->e_machine == EM_SPARC || \
|
||||
(x)->e_machine == EM_SPARC32PLUS)
|
||||
#define compat_start_thread start_thread32
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
#define ELF_EXEC_PAGESIZE PAGE_SIZE
|
||||
|
||||
/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
|
||||
use of this is to invoke "./ld.so someprog" to test out a new version of
|
||||
the loader. We need to make sure that it is out of the way of the program
|
||||
that it will "exec", and that there is sufficient room for the brk. */
|
||||
|
||||
#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();
|
||||
|
||||
/* This yields a string that ld.so will use to load implementation
|
||||
specific libraries for optimization. This is more specific in
|
||||
intent than poking at uname or /proc/cpuinfo. */
|
||||
|
||||
#define ELF_PLATFORM (NULL)
|
||||
|
||||
#define SET_PERSONALITY(ex, ibcs2) \
|
||||
do { unsigned long new_flags = current_thread_info()->flags; \
|
||||
new_flags &= _TIF_32BIT; \
|
||||
if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
|
||||
new_flags |= _TIF_32BIT; \
|
||||
else \
|
||||
new_flags &= ~_TIF_32BIT; \
|
||||
if ((current_thread_info()->flags & _TIF_32BIT) \
|
||||
!= new_flags) \
|
||||
set_thread_flag(TIF_ABI_PENDING); \
|
||||
else \
|
||||
clear_thread_flag(TIF_ABI_PENDING); \
|
||||
/* flush_thread will update pgd cache */ \
|
||||
if (ibcs2) \
|
||||
set_personality(PER_SVR4); \
|
||||
else if (current->personality != PER_LINUX32) \
|
||||
set_personality(PER_LINUX); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !(__ASM_SPARC64_ELF_H) */
|
6
arch/sparc/include/asm/emergency-restart.h
Normal file
6
arch/sparc/include/asm/emergency-restart.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _ASM_EMERGENCY_RESTART_H
|
||||
#define _ASM_EMERGENCY_RESTART_H
|
||||
|
||||
#include <asm-generic/emergency-restart.h>
|
||||
|
||||
#endif /* _ASM_EMERGENCY_RESTART_H */
|
103
arch/sparc/include/asm/envctrl.h
Normal file
103
arch/sparc/include/asm/envctrl.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
*
|
||||
* 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) */
|
113
arch/sparc/include/asm/errno.h
Normal file
113
arch/sparc/include/asm/errno.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#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 */
|
||||
|
||||
#endif
|
49
arch/sparc/include/asm/estate.h
Normal file
49
arch/sparc/include/asm/estate.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _SPARC64_ESTATE_H
|
||||
#define _SPARC64_ESTATE_H
|
||||
|
||||
/* UltraSPARC-III E-cache Error Enable */
|
||||
#define ESTATE_ERROR_FMT 0x0000000000040000 /* Force MTAG ECC */
|
||||
#define ESTATE_ERROR_FMESS 0x000000000003c000 /* Forced MTAG ECC val */
|
||||
#define ESTATE_ERROR_FMD 0x0000000000002000 /* Force DATA ECC */
|
||||
#define ESTATE_ERROR_FDECC 0x0000000000001ff0 /* Forced DATA ECC val */
|
||||
#define ESTATE_ERROR_UCEEN 0x0000000000000008 /* See below */
|
||||
#define ESTATE_ERROR_NCEEN 0x0000000000000002 /* See below */
|
||||
#define ESTATE_ERROR_CEEN 0x0000000000000001 /* See below */
|
||||
|
||||
/* UCEEN enables the fast_ECC_error trap for: 1) software correctable E-cache
|
||||
* errors 2) uncorrectable E-cache errors. Such events only occur on reads
|
||||
* of the E-cache by the local processor for: 1) data loads 2) instruction
|
||||
* fetches 3) atomic operations. Such events _cannot_ occur for: 1) merge
|
||||
* 2) writeback 2) copyout. The AFSR bits associated with these traps are
|
||||
* UCC and UCU.
|
||||
*/
|
||||
|
||||
/* NCEEN enables instruction_access_error, data_access_error, and ECC_error traps
|
||||
* for uncorrectable ECC errors and system errors.
|
||||
*
|
||||
* Uncorrectable system bus data error or MTAG ECC error, system bus TimeOUT,
|
||||
* or system bus BusERR:
|
||||
* 1) As the result of an instruction fetch, will generate instruction_access_error
|
||||
* 2) As the result of a load etc. will generate data_access_error.
|
||||
* 3) As the result of store merge completion, writeback, or copyout will
|
||||
* generate a disrupting ECC_error trap.
|
||||
* 4) As the result of such errors on instruction vector fetch can generate any
|
||||
* of the 3 trap types.
|
||||
*
|
||||
* The AFSR bits associated with these traps are EMU, EDU, WDU, CPU, IVU, UE,
|
||||
* BERR, and TO.
|
||||
*/
|
||||
|
||||
/* CEEN enables the ECC_error trap for hardware corrected ECC errors. System bus
|
||||
* reads resulting in a hardware corrected data or MTAG ECC error will generate an
|
||||
* ECC_error disrupting trap with this bit enabled.
|
||||
*
|
||||
* This same trap will also be generated when a hardware corrected ECC error results
|
||||
* during store merge, writeback, and copyout operations.
|
||||
*/
|
||||
|
||||
/* In general, if the trap enable bits above are disabled the AFSR bits will still
|
||||
* log the events even though the trap will not be generated by the processor.
|
||||
*/
|
||||
|
||||
#endif /* _SPARC64_ESTATE_H */
|
29
arch/sparc/include/asm/fb.h
Normal file
29
arch/sparc/include/asm/fb.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _SPARC_FB_H_
|
||||
#define _SPARC_FB_H_
|
||||
#include <linux/fb.h>
|
||||
#include <linux/fs.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/prom.h>
|
||||
|
||||
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
|
||||
unsigned long off)
|
||||
{
|
||||
#ifdef CONFIG_SPARC64
|
||||
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int fb_is_primary_device(struct fb_info *info)
|
||||
{
|
||||
struct device *dev = info->device;
|
||||
struct device_node *node;
|
||||
|
||||
node = dev->archdata.prom_node;
|
||||
if (node &&
|
||||
node == of_console_device)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _SPARC_FB_H_ */
|
330
arch/sparc/include/asm/fbio.h
Normal file
330
arch/sparc/include/asm/fbio.h
Normal file
@@ -0,0 +1,330 @@
|
||||
#ifndef __LINUX_FBIO_H
|
||||
#define __LINUX_FBIO_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.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; /* widht */
|
||||
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
|
||||
#define CG6_BTREGS 0x70002000
|
||||
#define CG6_FHC 0x70004000
|
||||
#define CG6_THC 0x70005000
|
||||
#define CG6_ROM 0x70006000
|
||||
#define CG6_RAM 0x70016000
|
||||
#define CG6_DHC 0x80000000
|
||||
|
||||
#define CG3_MMAP_OFFSET 0x4000000
|
||||
|
||||
/* Addresses on the fd of a tcx that are mappable */
|
||||
#define TCX_RAM8BIT 0x00000000
|
||||
#define TCX_RAM24BIT 0x01000000
|
||||
#define TCX_UNK3 0x10000000
|
||||
#define TCX_UNK4 0x20000000
|
||||
#define TCX_CONTROLPLANE 0x28000000
|
||||
#define TCX_UNK6 0x30000000
|
||||
#define TCX_UNK7 0x38000000
|
||||
#define TCX_TEC 0x70000000
|
||||
#define TCX_BTREGS 0x70002000
|
||||
#define TCX_THC 0x70004000
|
||||
#define TCX_DHC 0x70008000
|
||||
#define TCX_ALT 0x7000a000
|
||||
#define TCX_SYNC 0x7000e000
|
||||
#define TCX_UNK2 0x70010000
|
||||
|
||||
/* CG14 definitions */
|
||||
|
||||
/* Offsets into the OBIO space: */
|
||||
#define CG14_REGS 0 /* registers */
|
||||
#define CG14_CURSORREGS 0x1000 /* cursor registers */
|
||||
#define CG14_DACREGS 0x2000 /* DAC registers */
|
||||
#define CG14_XLUT 0x3000 /* X Look Up Table -- ??? */
|
||||
#define CG14_CLUT1 0x4000 /* Color Look Up Table */
|
||||
#define CG14_CLUT2 0x5000 /* Color Look Up Table */
|
||||
#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;
|
||||
u32 red;
|
||||
u32 green;
|
||||
u32 blue;
|
||||
};
|
||||
|
||||
#define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
|
||||
#define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
|
||||
|
||||
struct fbcursor32 {
|
||||
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 fbcmap32 cmap; /* color map info */
|
||||
struct fbcurpos size; /* cursor bit map size */
|
||||
u32 image; /* cursor image bits */
|
||||
u32 mask; /* cursor mask bits */
|
||||
};
|
||||
|
||||
#define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
|
||||
#define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_FBIO_H */
|
40
arch/sparc/include/asm/fcntl.h
Normal file
40
arch/sparc/include/asm/fcntl.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef _SPARC_FCNTL_H
|
||||
#define _SPARC_FCNTL_H
|
||||
|
||||
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
|
||||
located on an ext2 file system */
|
||||
#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_SYNC 0x2000
|
||||
#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
|
||||
|
||||
#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
|
121
arch/sparc/include/asm/fhc.h
Normal file
121
arch/sparc/include/asm/fhc.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* fhc.h: Structures for central/fhc pseudo driver on Sunfire/Starfire/Wildfire.
|
||||
*
|
||||
* Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_FHC_H
|
||||
#define _SPARC64_FHC_H
|
||||
|
||||
#include <linux/timer.h>
|
||||
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/upa.h>
|
||||
|
||||
struct linux_fhc;
|
||||
|
||||
/* Clock board register offsets. */
|
||||
#define CLOCK_CTRL 0x00UL /* Main control */
|
||||
#define CLOCK_STAT1 0x10UL /* Status one */
|
||||
#define CLOCK_STAT2 0x20UL /* Status two */
|
||||
#define CLOCK_PWRSTAT 0x30UL /* Power status */
|
||||
#define CLOCK_PWRPRES 0x40UL /* Power presence */
|
||||
#define CLOCK_TEMP 0x50UL /* Temperature */
|
||||
#define CLOCK_IRQDIAG 0x60UL /* IRQ diagnostics */
|
||||
#define CLOCK_PWRSTAT2 0x70UL /* Power status two */
|
||||
|
||||
#define CLOCK_CTRL_LLED 0x04 /* Left LED, 0 == on */
|
||||
#define CLOCK_CTRL_MLED 0x02 /* Mid LED, 1 == on */
|
||||
#define CLOCK_CTRL_RLED 0x01 /* RIght LED, 1 == on */
|
||||
|
||||
struct linux_central {
|
||||
struct linux_fhc *child;
|
||||
unsigned long cfreg;
|
||||
unsigned long clkregs;
|
||||
unsigned long clkver;
|
||||
int slots;
|
||||
struct device_node *prom_node;
|
||||
|
||||
struct linux_prom_ranges central_ranges[PROMREG_MAX];
|
||||
int num_central_ranges;
|
||||
};
|
||||
|
||||
/* Firehose controller register offsets */
|
||||
struct fhc_regs {
|
||||
unsigned long pregs; /* FHC internal regs */
|
||||
#define FHC_PREGS_ID 0x00UL /* FHC ID */
|
||||
#define FHC_ID_VERS 0xf0000000 /* Version of this FHC */
|
||||
#define FHC_ID_PARTID 0x0ffff000 /* Part ID code (0x0f9f == FHC) */
|
||||
#define FHC_ID_MANUF 0x0000007e /* Manufacturer (0x3e == SUN's JEDEC)*/
|
||||
#define FHC_ID_RESV 0x00000001 /* Read as one */
|
||||
#define FHC_PREGS_RCS 0x10UL /* FHC Reset Control/Status Register */
|
||||
#define FHC_RCS_POR 0x80000000 /* Last reset was a power cycle */
|
||||
#define FHC_RCS_SPOR 0x40000000 /* Last reset was sw power on reset */
|
||||
#define FHC_RCS_SXIR 0x20000000 /* Last reset was sw XIR reset */
|
||||
#define FHC_RCS_BPOR 0x10000000 /* Last reset was due to POR button */
|
||||
#define FHC_RCS_BXIR 0x08000000 /* Last reset was due to XIR button */
|
||||
#define FHC_RCS_WEVENT 0x04000000 /* CPU reset was due to wakeup event */
|
||||
#define FHC_RCS_CFATAL 0x02000000 /* Centerplane Fatal Error signalled */
|
||||
#define FHC_RCS_FENAB 0x01000000 /* Fatal errors elicit system reset */
|
||||
#define FHC_PREGS_CTRL 0x20UL /* FHC Control Register */
|
||||
#define FHC_CONTROL_ICS 0x00100000 /* Ignore Centerplane Signals */
|
||||
#define FHC_CONTROL_FRST 0x00080000 /* Fatal Error Reset Enable */
|
||||
#define FHC_CONTROL_LFAT 0x00040000 /* AC/DC signalled a local error */
|
||||
#define FHC_CONTROL_SLINE 0x00010000 /* Firmware Synchronization Line */
|
||||
#define FHC_CONTROL_DCD 0x00008000 /* DC-->DC Converter Disable */
|
||||
#define FHC_CONTROL_POFF 0x00004000 /* AC/DC Controller PLL Disable */
|
||||
#define FHC_CONTROL_FOFF 0x00002000 /* FHC Controller PLL Disable */
|
||||
#define FHC_CONTROL_AOFF 0x00001000 /* CPU A SRAM/SBD Low Power Mode */
|
||||
#define FHC_CONTROL_BOFF 0x00000800 /* CPU B SRAM/SBD Low Power Mode */
|
||||
#define FHC_CONTROL_PSOFF 0x00000400 /* Turns off this FHC's power supply */
|
||||
#define FHC_CONTROL_IXIST 0x00000200 /* 0=FHC tells clock board it exists */
|
||||
#define FHC_CONTROL_XMSTR 0x00000100 /* 1=Causes this FHC to be XIR master*/
|
||||
#define FHC_CONTROL_LLED 0x00000040 /* 0=Left LED ON */
|
||||
#define FHC_CONTROL_MLED 0x00000020 /* 1=Middle LED ON */
|
||||
#define FHC_CONTROL_RLED 0x00000010 /* 1=Right LED */
|
||||
#define FHC_CONTROL_BPINS 0x00000003 /* Spare Bidirectional Pins */
|
||||
#define FHC_PREGS_BSR 0x30UL /* FHC Board Status Register */
|
||||
#define FHC_BSR_DA64 0x00040000 /* Port A: 0=128bit 1=64bit data path */
|
||||
#define FHC_BSR_DB64 0x00020000 /* Port B: 0=128bit 1=64bit data path */
|
||||
#define FHC_BSR_BID 0x0001e000 /* Board ID */
|
||||
#define FHC_BSR_SA 0x00001c00 /* Port A UPA Speed (from the pins) */
|
||||
#define FHC_BSR_SB 0x00000380 /* Port B UPA Speed (from the pins) */
|
||||
#define FHC_BSR_NDIAG 0x00000040 /* Not in Diag Mode */
|
||||
#define FHC_BSR_NTBED 0x00000020 /* Not in TestBED Mode */
|
||||
#define FHC_BSR_NIA 0x0000001c /* Jumper, bit 18 in PROM space */
|
||||
#define FHC_BSR_SI 0x00000001 /* Spare input pin value */
|
||||
#define FHC_PREGS_ECC 0x40UL /* FHC ECC Control Register (16 bits) */
|
||||
#define FHC_PREGS_JCTRL 0xf0UL /* FHC JTAG Control Register */
|
||||
#define FHC_JTAG_CTRL_MENAB 0x80000000 /* Indicates this is JTAG Master */
|
||||
#define FHC_JTAG_CTRL_MNONE 0x40000000 /* Indicates no JTAG Master present */
|
||||
#define FHC_PREGS_JCMD 0x100UL /* FHC JTAG Command Register */
|
||||
unsigned long ireg; /* FHC IGN reg */
|
||||
#define FHC_IREG_IGN 0x00UL /* This FHC's IGN */
|
||||
unsigned long ffregs; /* FHC fanfail regs */
|
||||
#define FHC_FFREGS_IMAP 0x00UL /* FHC Fanfail IMAP */
|
||||
#define FHC_FFREGS_ICLR 0x10UL /* FHC Fanfail ICLR */
|
||||
unsigned long sregs; /* FHC system regs */
|
||||
#define FHC_SREGS_IMAP 0x00UL /* FHC System IMAP */
|
||||
#define FHC_SREGS_ICLR 0x10UL /* FHC System ICLR */
|
||||
unsigned long uregs; /* FHC uart regs */
|
||||
#define FHC_UREGS_IMAP 0x00UL /* FHC Uart IMAP */
|
||||
#define FHC_UREGS_ICLR 0x10UL /* FHC Uart ICLR */
|
||||
unsigned long tregs; /* FHC TOD regs */
|
||||
#define FHC_TREGS_IMAP 0x00UL /* FHC TOD IMAP */
|
||||
#define FHC_TREGS_ICLR 0x10UL /* FHC TOD ICLR */
|
||||
};
|
||||
|
||||
struct linux_fhc {
|
||||
struct linux_fhc *next;
|
||||
struct linux_central *parent; /* NULL if not central FHC */
|
||||
struct fhc_regs fhc_regs;
|
||||
int board;
|
||||
int jtag_master;
|
||||
struct device_node *prom_node;
|
||||
|
||||
struct linux_prom_ranges fhc_ranges[PROMREG_MAX];
|
||||
int num_fhc_ranges;
|
||||
};
|
||||
|
||||
#endif /* !(_SPARC64_FHC_H) */
|
110
arch/sparc/include/asm/fixmap.h
Normal file
110
arch/sparc/include/asm/fixmap.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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
|
8
arch/sparc/include/asm/floppy.h
Normal file
8
arch/sparc/include/asm/floppy.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_FLOPPY_H
|
||||
#define ___ASM_SPARC_FLOPPY_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/floppy_64.h>
|
||||
#else
|
||||
#include <asm/floppy_32.h>
|
||||
#endif
|
||||
#endif
|
388
arch/sparc/include/asm/floppy_32.h
Normal file
388
arch/sparc/include/asm/floppy_32.h
Normal file
@@ -0,0 +1,388 @@
|
||||
/* asm/floppy.h: Sparc specific parts of the Floppy driver.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
|
||||
#ifndef __ASM_SPARC_FLOPPY_H
|
||||
#define __ASM_SPARC_FLOPPY_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/irq.h>
|
||||
|
||||
/* We don't need no stinkin' I/O port allocation crap. */
|
||||
#undef release_region
|
||||
#undef request_region
|
||||
#define release_region(X, Y) do { } while(0)
|
||||
#define request_region(X, Y, Z) (1)
|
||||
|
||||
/* References:
|
||||
* 1) Netbsd Sun floppy driver.
|
||||
* 2) NCR 82077 controller manual
|
||||
* 3) Intel 82077 controller manual
|
||||
*/
|
||||
struct sun_flpy_controller {
|
||||
volatile unsigned char status_82072; /* Main Status reg. */
|
||||
#define dcr_82072 status_82072 /* Digital Control reg. */
|
||||
#define status1_82077 status_82072 /* Auxiliary Status reg. 1 */
|
||||
|
||||
volatile unsigned char data_82072; /* Data fifo. */
|
||||
#define status2_82077 data_82072 /* Auxiliary Status reg. 2 */
|
||||
|
||||
volatile unsigned char dor_82077; /* Digital Output reg. */
|
||||
volatile unsigned char tapectl_82077; /* What the? Tape control reg? */
|
||||
|
||||
volatile unsigned char status_82077; /* Main Status Register. */
|
||||
#define drs_82077 status_82077 /* Digital Rate Select reg. */
|
||||
|
||||
volatile unsigned char data_82077; /* Data fifo. */
|
||||
volatile unsigned char ___unused;
|
||||
volatile unsigned char dir_82077; /* Digital Input reg. */
|
||||
#define dcr_82077 dir_82077 /* Config Control reg. */
|
||||
};
|
||||
|
||||
/* 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);
|
||||
void (*fd_outb)(unsigned char value, int port);
|
||||
};
|
||||
|
||||
static struct sun_floppy_ops sun_fdops;
|
||||
|
||||
#define fd_inb(port) sun_fdops.fd_inb(port)
|
||||
#define fd_outb(value,port) sun_fdops.fd_outb(value,port)
|
||||
#define fd_enable_dma() sun_fd_enable_dma()
|
||||
#define fd_disable_dma() sun_fd_disable_dma()
|
||||
#define fd_request_dma() (0) /* nothing... */
|
||||
#define fd_free_dma() /* nothing... */
|
||||
#define fd_clear_dma_ff() /* nothing... */
|
||||
#define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode)
|
||||
#define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr)
|
||||
#define fd_set_dma_count(count) sun_fd_set_dma_count(count)
|
||||
#define fd_enable_irq() /* nothing... */
|
||||
#define fd_disable_irq() /* nothing... */
|
||||
#define fd_cacheflush(addr, size) /* nothing... */
|
||||
#define fd_request_irq() sun_fd_request_irq()
|
||||
#define fd_free_irq() /* nothing... */
|
||||
#if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */
|
||||
#define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size))
|
||||
#define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
|
||||
#endif
|
||||
|
||||
/* XXX This isn't really correct. XXX */
|
||||
#define get_dma_residue(x) (0)
|
||||
|
||||
#define FLOPPY0_TYPE 4
|
||||
#define FLOPPY1_TYPE 0
|
||||
|
||||
/* Super paranoid... */
|
||||
#undef HAVE_DISABLE_HLT
|
||||
|
||||
/* Here is where we catch the floppy driver trying to initialize,
|
||||
* therefore this is where we call the PROM device tree probing
|
||||
* routine etc. on the Sparc.
|
||||
*/
|
||||
#define FDC1 sun_floppy_init()
|
||||
|
||||
#define N_FDC 1
|
||||
#define N_DRIVE 8
|
||||
|
||||
/* No 64k boundary crossing problems on the Sparc. */
|
||||
#define CROSS_64KB(a,s) (0)
|
||||
|
||||
/* 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) {
|
||||
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;
|
||||
}
|
||||
|
||||
static unsigned char sun_82072_fd_inb(int port)
|
||||
{
|
||||
udelay(5);
|
||||
switch(port & 7) {
|
||||
default:
|
||||
printk("floppy: Asked to read unknown port %d\n", port);
|
||||
panic("floppy: Port bolixed.");
|
||||
case 4: /* FD_STATUS */
|
||||
return sun_fdc->status_82072 & ~STATUS_DMA;
|
||||
case 5: /* FD_DATA */
|
||||
return sun_fdc->data_82072;
|
||||
case 7: /* FD_DIR */
|
||||
return sun_read_dir();
|
||||
};
|
||||
panic("sun_82072_fd_inb: How did I get here?");
|
||||
}
|
||||
|
||||
static void sun_82072_fd_outb(unsigned char value, int port)
|
||||
{
|
||||
udelay(5);
|
||||
switch(port & 7) {
|
||||
default:
|
||||
printk("floppy: Asked to write to unknown port %d\n", port);
|
||||
panic("floppy: Port bolixed.");
|
||||
case 2: /* FD_DOR */
|
||||
sun_set_dor(value, 0);
|
||||
break;
|
||||
case 5: /* FD_DATA */
|
||||
sun_fdc->data_82072 = value;
|
||||
break;
|
||||
case 7: /* FD_DCR */
|
||||
sun_fdc->dcr_82072 = value;
|
||||
break;
|
||||
case 4: /* FD_STATUS */
|
||||
sun_fdc->status_82072 = value;
|
||||
break;
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned char sun_82077_fd_inb(int port)
|
||||
{
|
||||
udelay(5);
|
||||
switch(port & 7) {
|
||||
default:
|
||||
printk("floppy: Asked to read unknown port %d\n", port);
|
||||
panic("floppy: Port bolixed.");
|
||||
case 0: /* FD_STATUS_0 */
|
||||
return sun_fdc->status1_82077;
|
||||
case 1: /* FD_STATUS_1 */
|
||||
return sun_fdc->status2_82077;
|
||||
case 2: /* FD_DOR */
|
||||
return sun_fdc->dor_82077;
|
||||
case 3: /* FD_TDR */
|
||||
return sun_fdc->tapectl_82077;
|
||||
case 4: /* FD_STATUS */
|
||||
return sun_fdc->status_82077 & ~STATUS_DMA;
|
||||
case 5: /* FD_DATA */
|
||||
return sun_fdc->data_82077;
|
||||
case 7: /* FD_DIR */
|
||||
return sun_read_dir();
|
||||
};
|
||||
panic("sun_82077_fd_inb: How did I get here?");
|
||||
}
|
||||
|
||||
static void sun_82077_fd_outb(unsigned char value, int port)
|
||||
{
|
||||
udelay(5);
|
||||
switch(port & 7) {
|
||||
default:
|
||||
printk("floppy: Asked to write to unknown port %d\n", port);
|
||||
panic("floppy: Port bolixed.");
|
||||
case 2: /* FD_DOR */
|
||||
sun_set_dor(value, 1);
|
||||
break;
|
||||
case 5: /* FD_DATA */
|
||||
sun_fdc->data_82077 = value;
|
||||
break;
|
||||
case 7: /* FD_DCR */
|
||||
sun_fdc->dcr_82077 = value;
|
||||
break;
|
||||
case 4: /* FD_STATUS */
|
||||
sun_fdc->status_82077 = value;
|
||||
break;
|
||||
case 3: /* FD_TDR */
|
||||
sun_fdc->tapectl_82077 = value;
|
||||
break;
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
/* For pseudo-dma (Sun floppy drives have no real DMA available to
|
||||
* them so we must eat the data fifo bytes directly ourselves) we have
|
||||
* three state variables. doing_pdma tells our inline low-level
|
||||
* assembly floppy interrupt entry point whether it should sit and eat
|
||||
* bytes from the fifo or just transfer control up to the higher level
|
||||
* floppy interrupt c-code. I tried very hard but I could not get the
|
||||
* pseudo-dma to work in c-code without getting many overruns and
|
||||
* 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)
|
||||
{
|
||||
/* nothing... */
|
||||
}
|
||||
|
||||
static inline void sun_fd_disable_dma(void)
|
||||
{
|
||||
doing_pdma = 0;
|
||||
if (pdma_base) {
|
||||
mmu_unlockarea(pdma_base, pdma_areasize);
|
||||
pdma_base = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void sun_fd_set_dma_mode(int mode)
|
||||
{
|
||||
switch(mode) {
|
||||
case DMA_MODE_READ:
|
||||
doing_pdma = 1;
|
||||
break;
|
||||
case DMA_MODE_WRITE:
|
||||
doing_pdma = 2;
|
||||
break;
|
||||
default:
|
||||
printk("Unknown dma mode %d\n", mode);
|
||||
panic("floppy: Giving up...");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void sun_fd_set_dma_addr(char *buffer)
|
||||
{
|
||||
pdma_vaddr = buffer;
|
||||
}
|
||||
|
||||
static inline void sun_fd_set_dma_count(int length)
|
||||
{
|
||||
pdma_size = 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);
|
||||
|
||||
static int sun_fd_request_irq(void)
|
||||
{
|
||||
static int once = 0;
|
||||
int error;
|
||||
|
||||
if(!once) {
|
||||
once = 1;
|
||||
error = sparc_floppy_request_irq(FLOPPY_IRQ,
|
||||
IRQF_DISABLED,
|
||||
floppy_interrupt);
|
||||
return ((error == 0) ? 0 : -1);
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
static struct linux_prom_registers fd_regs[2];
|
||||
|
||||
static int sun_floppy_init(void)
|
||||
{
|
||||
char state[128];
|
||||
int tnode, fd_node, 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)))) {
|
||||
/* 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) {
|
||||
tnode = prom_getchild(fd_node);
|
||||
fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo");
|
||||
} else {
|
||||
fd_node = prom_searchsiblings(tnode, "fd");
|
||||
}
|
||||
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(!strcmp(state, "disabled")) {
|
||||
goto no_sun_fdc;
|
||||
}
|
||||
}
|
||||
num_regs = prom_getproperty(fd_node, "reg", (char *) fd_regs, sizeof(fd_regs));
|
||||
num_regs = (num_regs / sizeof(fd_regs[0]));
|
||||
prom_apply_obio_ranges(fd_regs, num_regs);
|
||||
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 *)
|
||||
sbus_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
|
||||
|
||||
/* Last minute sanity check... */
|
||||
if(sun_fdc->status_82072 == 0xff) {
|
||||
sun_fdc = NULL;
|
||||
goto no_sun_fdc;
|
||||
}
|
||||
|
||||
sun_fdops.fd_inb = sun_82077_fd_inb;
|
||||
sun_fdops.fd_outb = sun_82077_fd_outb;
|
||||
fdc_status = &sun_fdc->status_82077;
|
||||
|
||||
if (sun_fdc->dor_82077 == 0x80) {
|
||||
sun_fdc->dor_82077 = 0x02;
|
||||
if (sun_fdc->dor_82077 == 0x80) {
|
||||
sun_fdops.fd_inb = sun_82072_fd_inb;
|
||||
sun_fdops.fd_outb = sun_82072_fd_outb;
|
||||
fdc_status = &sun_fdc->status_82072;
|
||||
}
|
||||
}
|
||||
|
||||
/* Success... */
|
||||
allowed_drive_mask = 0x01;
|
||||
return (int) sun_fdc;
|
||||
|
||||
no_sun_fdc:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int sparc_eject(void)
|
||||
{
|
||||
set_dor(0x00, 0xff, 0x90);
|
||||
udelay(500);
|
||||
set_dor(0x00, 0x6f, 0x00);
|
||||
udelay(500);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define fd_eject(drive) sparc_eject()
|
||||
|
||||
#define EXTRA_FLOPPY_PARAMS
|
||||
|
||||
#endif /* !(__ASM_SPARC_FLOPPY_H) */
|
782
arch/sparc/include/asm/floppy_64.h
Normal file
782
arch/sparc/include/asm/floppy_64.h
Normal file
@@ -0,0 +1,782 @@
|
||||
/* floppy.h: Sparc specific parts of the Floppy driver.
|
||||
*
|
||||
* Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
|
||||
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
|
||||
*
|
||||
* Ultra/PCI support added: Sep 1997 Eddie C. Dost (ecd@skynet.be)
|
||||
*/
|
||||
|
||||
#ifndef __ASM_SPARC64_FLOPPY_H
|
||||
#define __ASM_SPARC64_FLOPPY_H
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/idprom.h>
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/auxio.h>
|
||||
#include <asm/sbus.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
|
||||
/*
|
||||
* Define this to enable exchanging drive 0 and 1 if only drive 1 is
|
||||
* probed on PCI machines.
|
||||
*/
|
||||
#undef PCI_FDC_SWAP_DRIVES
|
||||
|
||||
|
||||
/* References:
|
||||
* 1) Netbsd Sun floppy driver.
|
||||
* 2) NCR 82077 controller manual
|
||||
* 3) Intel 82077 controller manual
|
||||
*/
|
||||
struct sun_flpy_controller {
|
||||
volatile unsigned char status1_82077; /* Auxiliary Status reg. 1 */
|
||||
volatile unsigned char status2_82077; /* Auxiliary Status reg. 2 */
|
||||
volatile unsigned char dor_82077; /* Digital Output reg. */
|
||||
volatile unsigned char tapectl_82077; /* Tape Control reg */
|
||||
volatile unsigned char status_82077; /* Main Status Register. */
|
||||
#define drs_82077 status_82077 /* Digital Rate Select reg. */
|
||||
volatile unsigned char data_82077; /* Data fifo. */
|
||||
volatile unsigned char ___unused;
|
||||
volatile unsigned char dir_82077; /* Digital Input reg. */
|
||||
#define dcr_82077 dir_82077 /* Config Control reg. */
|
||||
};
|
||||
|
||||
/* You'll only ever find one controller on an Ultra anyways. */
|
||||
static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
|
||||
unsigned long fdc_status;
|
||||
static struct sbus_dev *floppy_sdev = NULL;
|
||||
|
||||
struct sun_floppy_ops {
|
||||
unsigned char (*fd_inb) (unsigned long port);
|
||||
void (*fd_outb) (unsigned char value, unsigned long port);
|
||||
void (*fd_enable_dma) (void);
|
||||
void (*fd_disable_dma) (void);
|
||||
void (*fd_set_dma_mode) (int);
|
||||
void (*fd_set_dma_addr) (char *);
|
||||
void (*fd_set_dma_count) (int);
|
||||
unsigned int (*get_dma_residue) (void);
|
||||
int (*fd_request_irq) (void);
|
||||
void (*fd_free_irq) (void);
|
||||
int (*fd_eject) (int);
|
||||
};
|
||||
|
||||
static struct sun_floppy_ops sun_fdops;
|
||||
|
||||
#define fd_inb(port) sun_fdops.fd_inb(port)
|
||||
#define fd_outb(value,port) sun_fdops.fd_outb(value,port)
|
||||
#define fd_enable_dma() sun_fdops.fd_enable_dma()
|
||||
#define fd_disable_dma() sun_fdops.fd_disable_dma()
|
||||
#define fd_request_dma() (0) /* nothing... */
|
||||
#define fd_free_dma() /* nothing... */
|
||||
#define fd_clear_dma_ff() /* nothing... */
|
||||
#define fd_set_dma_mode(mode) sun_fdops.fd_set_dma_mode(mode)
|
||||
#define fd_set_dma_addr(addr) sun_fdops.fd_set_dma_addr(addr)
|
||||
#define fd_set_dma_count(count) sun_fdops.fd_set_dma_count(count)
|
||||
#define get_dma_residue(x) sun_fdops.get_dma_residue()
|
||||
#define fd_cacheflush(addr, size) /* nothing... */
|
||||
#define fd_request_irq() sun_fdops.fd_request_irq()
|
||||
#define fd_free_irq() sun_fdops.fd_free_irq()
|
||||
#define fd_eject(drive) sun_fdops.fd_eject(drive)
|
||||
|
||||
/* Super paranoid... */
|
||||
#undef HAVE_DISABLE_HLT
|
||||
|
||||
static int sun_floppy_types[2] = { 0, 0 };
|
||||
|
||||
/* Here is where we catch the floppy driver trying to initialize,
|
||||
* therefore this is where we call the PROM device tree probing
|
||||
* routine etc. on the Sparc.
|
||||
*/
|
||||
#define FLOPPY0_TYPE sun_floppy_init()
|
||||
#define FLOPPY1_TYPE sun_floppy_types[1]
|
||||
|
||||
#define FDC1 ((unsigned long)sun_fdc)
|
||||
|
||||
#define N_FDC 1
|
||||
#define N_DRIVE 8
|
||||
|
||||
/* No 64k boundary crossing problems on the Sparc. */
|
||||
#define CROSS_64KB(a,s) (0)
|
||||
|
||||
static unsigned char sun_82077_fd_inb(unsigned long port)
|
||||
{
|
||||
udelay(5);
|
||||
switch(port & 7) {
|
||||
default:
|
||||
printk("floppy: Asked to read unknown port %lx\n", port);
|
||||
panic("floppy: Port bolixed.");
|
||||
case 4: /* FD_STATUS */
|
||||
return sbus_readb(&sun_fdc->status_82077) & ~STATUS_DMA;
|
||||
case 5: /* FD_DATA */
|
||||
return sbus_readb(&sun_fdc->data_82077);
|
||||
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?");
|
||||
}
|
||||
|
||||
static void sun_82077_fd_outb(unsigned char value, unsigned long port)
|
||||
{
|
||||
udelay(5);
|
||||
switch(port & 7) {
|
||||
default:
|
||||
printk("floppy: Asked to write to unknown port %lx\n", port);
|
||||
panic("floppy: Port bolixed.");
|
||||
case 2: /* FD_DOR */
|
||||
/* Happily, the 82077 has a real DOR register. */
|
||||
sbus_writeb(value, &sun_fdc->dor_82077);
|
||||
break;
|
||||
case 5: /* FD_DATA */
|
||||
sbus_writeb(value, &sun_fdc->data_82077);
|
||||
break;
|
||||
case 7: /* FD_DCR */
|
||||
sbus_writeb(value, &sun_fdc->dcr_82077);
|
||||
break;
|
||||
case 4: /* FD_STATUS */
|
||||
sbus_writeb(value, &sun_fdc->status_82077);
|
||||
break;
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
/* For pseudo-dma (Sun floppy drives have no real DMA available to
|
||||
* them so we must eat the data fifo bytes directly ourselves) we have
|
||||
* three state variables. doing_pdma tells our inline low-level
|
||||
* assembly floppy interrupt entry point whether it should sit and eat
|
||||
* bytes from the fifo or just transfer control up to the higher level
|
||||
* floppy interrupt c-code. I tried very hard but I could not get the
|
||||
* pseudo-dma to work in c-code without getting many overruns and
|
||||
* underruns. If non-zero, doing_pdma encodes the direction of
|
||||
* the transfer for debugging. 1=read 2=write
|
||||
*/
|
||||
unsigned char *pdma_vaddr;
|
||||
unsigned long pdma_size;
|
||||
volatile int doing_pdma = 0;
|
||||
|
||||
/* This is software state */
|
||||
char *pdma_base = NULL;
|
||||
unsigned long pdma_areasize;
|
||||
|
||||
/* Common routines to all controller types on the Sparc. */
|
||||
static void sun_fd_disable_dma(void)
|
||||
{
|
||||
doing_pdma = 0;
|
||||
if (pdma_base) {
|
||||
mmu_unlockarea(pdma_base, pdma_areasize);
|
||||
pdma_base = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void sun_fd_set_dma_mode(int mode)
|
||||
{
|
||||
switch(mode) {
|
||||
case DMA_MODE_READ:
|
||||
doing_pdma = 1;
|
||||
break;
|
||||
case DMA_MODE_WRITE:
|
||||
doing_pdma = 2;
|
||||
break;
|
||||
default:
|
||||
printk("Unknown dma mode %d\n", mode);
|
||||
panic("floppy: Giving up...");
|
||||
}
|
||||
}
|
||||
|
||||
static void sun_fd_set_dma_addr(char *buffer)
|
||||
{
|
||||
pdma_vaddr = buffer;
|
||||
}
|
||||
|
||||
static void sun_fd_set_dma_count(int length)
|
||||
{
|
||||
pdma_size = length;
|
||||
}
|
||||
|
||||
static void sun_fd_enable_dma(void)
|
||||
{
|
||||
pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);
|
||||
pdma_base = pdma_vaddr;
|
||||
pdma_areasize = pdma_size;
|
||||
}
|
||||
|
||||
irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie)
|
||||
{
|
||||
if (likely(doing_pdma)) {
|
||||
void __iomem *stat = (void __iomem *) fdc_status;
|
||||
unsigned char *vaddr = pdma_vaddr;
|
||||
unsigned long size = pdma_size;
|
||||
u8 val;
|
||||
|
||||
while (size) {
|
||||
val = readb(stat);
|
||||
if (unlikely(!(val & 0x80))) {
|
||||
pdma_vaddr = vaddr;
|
||||
pdma_size = size;
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
if (unlikely(!(val & 0x20))) {
|
||||
pdma_vaddr = vaddr;
|
||||
pdma_size = size;
|
||||
doing_pdma = 0;
|
||||
goto main_interrupt;
|
||||
}
|
||||
if (val & 0x40) {
|
||||
/* read */
|
||||
*vaddr++ = readb(stat + 1);
|
||||
} else {
|
||||
unsigned char data = *vaddr++;
|
||||
|
||||
/* write */
|
||||
writeb(data, stat + 1);
|
||||
}
|
||||
size--;
|
||||
}
|
||||
|
||||
pdma_vaddr = vaddr;
|
||||
pdma_size = size;
|
||||
|
||||
/* Send Terminal Count pulse to floppy controller. */
|
||||
val = readb(auxio_register);
|
||||
val |= AUXIO_AUX1_FTCNT;
|
||||
writeb(val, auxio_register);
|
||||
val &= ~AUXIO_AUX1_FTCNT;
|
||||
writeb(val, auxio_register);
|
||||
|
||||
doing_pdma = 0;
|
||||
}
|
||||
|
||||
main_interrupt:
|
||||
return floppy_interrupt(irq, dev_cookie);
|
||||
}
|
||||
|
||||
static int sun_fd_request_irq(void)
|
||||
{
|
||||
static int once = 0;
|
||||
int error;
|
||||
|
||||
if(!once) {
|
||||
once = 1;
|
||||
|
||||
error = request_irq(FLOPPY_IRQ, sparc_floppy_irq,
|
||||
IRQF_DISABLED, "floppy", NULL);
|
||||
|
||||
return ((error == 0) ? 0 : -1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sun_fd_free_irq(void)
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned int sun_get_dma_residue(void)
|
||||
{
|
||||
/* XXX This isn't really correct. XXX */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sun_fd_eject(int drive)
|
||||
{
|
||||
set_dor(0x00, 0xff, 0x90);
|
||||
udelay(500);
|
||||
set_dor(0x00, 0x6f, 0x00);
|
||||
udelay(500);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
#include <asm/ebus.h>
|
||||
#include <asm/ns87303.h>
|
||||
|
||||
static struct ebus_dma_info sun_pci_fd_ebus_dma;
|
||||
static struct pci_dev *sun_pci_ebus_dev;
|
||||
static int sun_pci_broken_drive = -1;
|
||||
|
||||
struct sun_pci_dma_op {
|
||||
unsigned int addr;
|
||||
int len;
|
||||
int direction;
|
||||
char *buf;
|
||||
};
|
||||
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);
|
||||
|
||||
static unsigned char sun_pci_fd_inb(unsigned long port)
|
||||
{
|
||||
udelay(5);
|
||||
return inb(port);
|
||||
}
|
||||
|
||||
static void sun_pci_fd_outb(unsigned char val, unsigned long port)
|
||||
{
|
||||
udelay(5);
|
||||
outb(val, port);
|
||||
}
|
||||
|
||||
static void sun_pci_fd_broken_outb(unsigned char val, unsigned long port)
|
||||
{
|
||||
udelay(5);
|
||||
/*
|
||||
* XXX: Due to SUN's broken floppy connector on AX and AXi
|
||||
* we need to turn on MOTOR_0 also, if the floppy is
|
||||
* jumpered to DS1 (like most PC floppies are). I hope
|
||||
* this does not hurt correct hardware like the AXmp.
|
||||
* (Eddie, Sep 12 1998).
|
||||
*/
|
||||
if (port == ((unsigned long)sun_fdc) + 2) {
|
||||
if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x20)) {
|
||||
val |= 0x10;
|
||||
}
|
||||
}
|
||||
outb(val, port);
|
||||
}
|
||||
|
||||
#ifdef PCI_FDC_SWAP_DRIVES
|
||||
static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long port)
|
||||
{
|
||||
udelay(5);
|
||||
/*
|
||||
* XXX: Due to SUN's broken floppy connector on AX and AXi
|
||||
* we need to turn on MOTOR_0 also, if the floppy is
|
||||
* jumpered to DS1 (like most PC floppies are). I hope
|
||||
* this does not hurt correct hardware like the AXmp.
|
||||
* (Eddie, Sep 12 1998).
|
||||
*/
|
||||
if (port == ((unsigned long)sun_fdc) + 2) {
|
||||
if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x10)) {
|
||||
val &= ~(0x03);
|
||||
val |= 0x21;
|
||||
}
|
||||
}
|
||||
outb(val, port);
|
||||
}
|
||||
#endif /* PCI_FDC_SWAP_DRIVES */
|
||||
|
||||
static void sun_pci_fd_enable_dma(void)
|
||||
{
|
||||
BUG_ON((NULL == sun_pci_dma_pending.buf) ||
|
||||
(0 == sun_pci_dma_pending.len) ||
|
||||
(0 == sun_pci_dma_pending.direction));
|
||||
|
||||
sun_pci_dma_current.buf = sun_pci_dma_pending.buf;
|
||||
sun_pci_dma_current.len = sun_pci_dma_pending.len;
|
||||
sun_pci_dma_current.direction = sun_pci_dma_pending.direction;
|
||||
|
||||
sun_pci_dma_pending.buf = NULL;
|
||||
sun_pci_dma_pending.len = 0;
|
||||
sun_pci_dma_pending.direction = 0;
|
||||
sun_pci_dma_pending.addr = -1U;
|
||||
|
||||
sun_pci_dma_current.addr =
|
||||
pci_map_single(sun_pci_ebus_dev,
|
||||
sun_pci_dma_current.buf,
|
||||
sun_pci_dma_current.len,
|
||||
sun_pci_dma_current.direction);
|
||||
|
||||
ebus_dma_enable(&sun_pci_fd_ebus_dma, 1);
|
||||
|
||||
if (ebus_dma_request(&sun_pci_fd_ebus_dma,
|
||||
sun_pci_dma_current.addr,
|
||||
sun_pci_dma_current.len))
|
||||
BUG();
|
||||
}
|
||||
|
||||
static void sun_pci_fd_disable_dma(void)
|
||||
{
|
||||
ebus_dma_enable(&sun_pci_fd_ebus_dma, 0);
|
||||
if (sun_pci_dma_current.addr != -1U)
|
||||
pci_unmap_single(sun_pci_ebus_dev,
|
||||
sun_pci_dma_current.addr,
|
||||
sun_pci_dma_current.len,
|
||||
sun_pci_dma_current.direction);
|
||||
sun_pci_dma_current.addr = -1U;
|
||||
}
|
||||
|
||||
static void sun_pci_fd_set_dma_mode(int mode)
|
||||
{
|
||||
if (mode == DMA_MODE_WRITE)
|
||||
sun_pci_dma_pending.direction = PCI_DMA_TODEVICE;
|
||||
else
|
||||
sun_pci_dma_pending.direction = PCI_DMA_FROMDEVICE;
|
||||
|
||||
ebus_dma_prepare(&sun_pci_fd_ebus_dma, mode != DMA_MODE_WRITE);
|
||||
}
|
||||
|
||||
static void sun_pci_fd_set_dma_count(int length)
|
||||
{
|
||||
sun_pci_dma_pending.len = length;
|
||||
}
|
||||
|
||||
static void sun_pci_fd_set_dma_addr(char *buffer)
|
||||
{
|
||||
sun_pci_dma_pending.buf = buffer;
|
||||
}
|
||||
|
||||
static unsigned int sun_pci_get_dma_residue(void)
|
||||
{
|
||||
return ebus_dma_residue(&sun_pci_fd_ebus_dma);
|
||||
}
|
||||
|
||||
static int sun_pci_fd_request_irq(void)
|
||||
{
|
||||
return ebus_dma_irq_enable(&sun_pci_fd_ebus_dma, 1);
|
||||
}
|
||||
|
||||
static void sun_pci_fd_free_irq(void)
|
||||
{
|
||||
ebus_dma_irq_enable(&sun_pci_fd_ebus_dma, 0);
|
||||
}
|
||||
|
||||
static int sun_pci_fd_eject(int drive)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void sun_pci_fd_dma_callback(struct ebus_dma_info *p, int event, void *cookie)
|
||||
{
|
||||
floppy_interrupt(0, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Floppy probing, we'd like to use /dev/fd0 for a single Floppy on PCI,
|
||||
* even if this is configured using DS1, thus looks like /dev/fd1 with
|
||||
* the cabling used in Ultras.
|
||||
*/
|
||||
#define DOR (port + 2)
|
||||
#define MSR (port + 4)
|
||||
#define FIFO (port + 5)
|
||||
|
||||
static void sun_pci_fd_out_byte(unsigned long port, unsigned char val,
|
||||
unsigned long reg)
|
||||
{
|
||||
unsigned char status;
|
||||
int timeout = 1000;
|
||||
|
||||
while (!((status = inb(MSR)) & 0x80) && --timeout)
|
||||
udelay(100);
|
||||
outb(val, reg);
|
||||
}
|
||||
|
||||
static unsigned char sun_pci_fd_sensei(unsigned long port)
|
||||
{
|
||||
unsigned char result[2] = { 0x70, 0x00 };
|
||||
unsigned char status;
|
||||
int i = 0;
|
||||
|
||||
sun_pci_fd_out_byte(port, 0x08, FIFO);
|
||||
do {
|
||||
int timeout = 1000;
|
||||
|
||||
while (!((status = inb(MSR)) & 0x80) && --timeout)
|
||||
udelay(100);
|
||||
|
||||
if (!timeout)
|
||||
break;
|
||||
|
||||
if ((status & 0xf0) == 0xd0)
|
||||
result[i++] = inb(FIFO);
|
||||
else
|
||||
break;
|
||||
} while (i < 2);
|
||||
|
||||
return result[0];
|
||||
}
|
||||
|
||||
static void sun_pci_fd_reset(unsigned long port)
|
||||
{
|
||||
unsigned char mask = 0x00;
|
||||
unsigned char status;
|
||||
int timeout = 10000;
|
||||
|
||||
outb(0x80, MSR);
|
||||
do {
|
||||
status = sun_pci_fd_sensei(port);
|
||||
if ((status & 0xc0) == 0xc0)
|
||||
mask |= 1 << (status & 0x03);
|
||||
else
|
||||
udelay(100);
|
||||
} while ((mask != 0x0f) && --timeout);
|
||||
}
|
||||
|
||||
static int sun_pci_fd_test_drive(unsigned long port, int drive)
|
||||
{
|
||||
unsigned char status, data;
|
||||
int timeout = 1000;
|
||||
int ready;
|
||||
|
||||
sun_pci_fd_reset(port);
|
||||
|
||||
data = (0x10 << drive) | 0x0c | drive;
|
||||
sun_pci_fd_out_byte(port, data, DOR);
|
||||
|
||||
sun_pci_fd_out_byte(port, 0x07, FIFO);
|
||||
sun_pci_fd_out_byte(port, drive & 0x03, FIFO);
|
||||
|
||||
do {
|
||||
udelay(100);
|
||||
status = sun_pci_fd_sensei(port);
|
||||
} while (((status & 0xc0) == 0x80) && --timeout);
|
||||
|
||||
if (!timeout)
|
||||
ready = 0;
|
||||
else
|
||||
ready = (status & 0x10) ? 0 : 1;
|
||||
|
||||
sun_pci_fd_reset(port);
|
||||
return ready;
|
||||
}
|
||||
#undef FIFO
|
||||
#undef MSR
|
||||
#undef DOR
|
||||
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
|
||||
{
|
||||
if (!strcmp(edev->prom_node->name, "fdthree"))
|
||||
return 1;
|
||||
if (!strcmp(edev->prom_node->name, "floppy")) {
|
||||
const char *compat;
|
||||
|
||||
compat = of_get_property(edev->prom_node,
|
||||
"compatible", NULL);
|
||||
if (compat && !strcmp(compat, "fdthree"))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned long __init sun_floppy_init(void)
|
||||
{
|
||||
char state[128];
|
||||
struct sbus_bus *bus;
|
||||
struct sbus_dev *sdev = NULL;
|
||||
static int initialized = 0;
|
||||
|
||||
if (initialized)
|
||||
return sun_floppy_types[0];
|
||||
initialized = 1;
|
||||
|
||||
for_all_sbusdev (sdev, bus) {
|
||||
if (!strcmp(sdev->prom_name, "SUNW,fdtwo"))
|
||||
break;
|
||||
}
|
||||
if(sdev) {
|
||||
floppy_sdev = sdev;
|
||||
FLOPPY_IRQ = sdev->irqs[0];
|
||||
} else {
|
||||
#ifdef CONFIG_PCI
|
||||
struct linux_ebus *ebus;
|
||||
struct linux_ebus_device *edev = NULL;
|
||||
unsigned long config = 0;
|
||||
void __iomem *auxio_reg;
|
||||
const char *state_prop;
|
||||
|
||||
for_each_ebus(ebus) {
|
||||
for_each_ebusdev(edev, ebus) {
|
||||
if (ebus_fdthree_p(edev))
|
||||
goto ebus_done;
|
||||
}
|
||||
}
|
||||
ebus_done:
|
||||
if (!edev)
|
||||
return 0;
|
||||
|
||||
state_prop = of_get_property(edev->prom_node, "status", NULL);
|
||||
if (state_prop && !strncmp(state_prop, "disabled", 8))
|
||||
return 0;
|
||||
|
||||
FLOPPY_IRQ = edev->irqs[0];
|
||||
|
||||
/* Make sure the high density bit is set, some systems
|
||||
* (most notably Ultra5/Ultra10) come up with it clear.
|
||||
*/
|
||||
auxio_reg = (void __iomem *) edev->resource[2].start;
|
||||
writel(readl(auxio_reg)|0x2, auxio_reg);
|
||||
|
||||
sun_pci_ebus_dev = ebus->self;
|
||||
|
||||
spin_lock_init(&sun_pci_fd_ebus_dma.lock);
|
||||
|
||||
/* XXX ioremap */
|
||||
sun_pci_fd_ebus_dma.regs = (void __iomem *)
|
||||
edev->resource[1].start;
|
||||
if (!sun_pci_fd_ebus_dma.regs)
|
||||
return 0;
|
||||
|
||||
sun_pci_fd_ebus_dma.flags = (EBUS_DMA_FLAG_USE_EBDMA_HANDLER |
|
||||
EBUS_DMA_FLAG_TCI_DISABLE);
|
||||
sun_pci_fd_ebus_dma.callback = sun_pci_fd_dma_callback;
|
||||
sun_pci_fd_ebus_dma.client_cookie = NULL;
|
||||
sun_pci_fd_ebus_dma.irq = FLOPPY_IRQ;
|
||||
strcpy(sun_pci_fd_ebus_dma.name, "floppy");
|
||||
if (ebus_dma_register(&sun_pci_fd_ebus_dma))
|
||||
return 0;
|
||||
|
||||
/* XXX ioremap */
|
||||
sun_fdc = (struct sun_flpy_controller *)edev->resource[0].start;
|
||||
|
||||
sun_fdops.fd_inb = sun_pci_fd_inb;
|
||||
sun_fdops.fd_outb = sun_pci_fd_outb;
|
||||
|
||||
can_use_virtual_dma = use_virtual_dma = 0;
|
||||
sun_fdops.fd_enable_dma = sun_pci_fd_enable_dma;
|
||||
sun_fdops.fd_disable_dma = sun_pci_fd_disable_dma;
|
||||
sun_fdops.fd_set_dma_mode = sun_pci_fd_set_dma_mode;
|
||||
sun_fdops.fd_set_dma_addr = sun_pci_fd_set_dma_addr;
|
||||
sun_fdops.fd_set_dma_count = sun_pci_fd_set_dma_count;
|
||||
sun_fdops.get_dma_residue = sun_pci_get_dma_residue;
|
||||
|
||||
sun_fdops.fd_request_irq = sun_pci_fd_request_irq;
|
||||
sun_fdops.fd_free_irq = sun_pci_fd_free_irq;
|
||||
|
||||
sun_fdops.fd_eject = sun_pci_fd_eject;
|
||||
|
||||
fdc_status = (unsigned long) &sun_fdc->status_82077;
|
||||
|
||||
/*
|
||||
* XXX: Find out on which machines this is really needed.
|
||||
*/
|
||||
if (1) {
|
||||
sun_pci_broken_drive = 1;
|
||||
sun_fdops.fd_outb = sun_pci_fd_broken_outb;
|
||||
}
|
||||
|
||||
allowed_drive_mask = 0;
|
||||
if (sun_pci_fd_test_drive((unsigned long)sun_fdc, 0))
|
||||
sun_floppy_types[0] = 4;
|
||||
if (sun_pci_fd_test_drive((unsigned long)sun_fdc, 1))
|
||||
sun_floppy_types[1] = 4;
|
||||
|
||||
/*
|
||||
* Find NS87303 SuperIO config registers (through ecpp).
|
||||
*/
|
||||
for_each_ebus(ebus) {
|
||||
for_each_ebusdev(edev, ebus) {
|
||||
if (!strcmp(edev->prom_node->name, "ecpp")) {
|
||||
config = edev->resource[1].start;
|
||||
goto config_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
config_done:
|
||||
|
||||
/*
|
||||
* Sanity check, is this really the NS87303?
|
||||
*/
|
||||
switch (config & 0x3ff) {
|
||||
case 0x02e:
|
||||
case 0x15c:
|
||||
case 0x26e:
|
||||
case 0x398:
|
||||
break;
|
||||
default:
|
||||
config = 0;
|
||||
}
|
||||
|
||||
if (!config)
|
||||
return sun_floppy_types[0];
|
||||
|
||||
/* Enable PC-AT mode. */
|
||||
ns87303_modify(config, ASC, 0, 0xc0);
|
||||
|
||||
#ifdef PCI_FDC_SWAP_DRIVES
|
||||
/*
|
||||
* If only Floppy 1 is present, swap drives.
|
||||
*/
|
||||
if (!sun_floppy_types[0] && sun_floppy_types[1]) {
|
||||
/*
|
||||
* Set the drive exchange bit in FCR on NS87303,
|
||||
* make sure other bits are sane before doing so.
|
||||
*/
|
||||
ns87303_modify(config, FER, FER_EDM, 0);
|
||||
ns87303_modify(config, ASC, ASC_DRV2_SEL, 0);
|
||||
ns87303_modify(config, FCR, 0, FCR_LDE);
|
||||
|
||||
config = sun_floppy_types[0];
|
||||
sun_floppy_types[0] = sun_floppy_types[1];
|
||||
sun_floppy_types[1] = config;
|
||||
|
||||
if (sun_pci_broken_drive != -1) {
|
||||
sun_pci_broken_drive = 1 - sun_pci_broken_drive;
|
||||
sun_fdops.fd_outb = sun_pci_fd_lde_broken_outb;
|
||||
}
|
||||
}
|
||||
#endif /* PCI_FDC_SWAP_DRIVES */
|
||||
|
||||
return sun_floppy_types[0];
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
prom_getproperty(sdev->prom_node, "status", state, sizeof(state));
|
||||
if(!strncmp(state, "disabled", 8))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* We cannot do sbus_ioremap here: it does request_region,
|
||||
* which the generic floppy driver tries to do once again.
|
||||
* But we must use the sdev resource values as they have
|
||||
* had parent ranges applied.
|
||||
*/
|
||||
sun_fdc = (struct sun_flpy_controller *)
|
||||
(sdev->resource[0].start +
|
||||
((sdev->resource[0].flags & 0x1ffUL) << 32UL));
|
||||
|
||||
/* Last minute sanity check... */
|
||||
if(sbus_readb(&sun_fdc->status1_82077) == 0xff) {
|
||||
sun_fdc = (struct sun_flpy_controller *)-1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sun_fdops.fd_inb = sun_82077_fd_inb;
|
||||
sun_fdops.fd_outb = sun_82077_fd_outb;
|
||||
|
||||
can_use_virtual_dma = use_virtual_dma = 1;
|
||||
sun_fdops.fd_enable_dma = sun_fd_enable_dma;
|
||||
sun_fdops.fd_disable_dma = sun_fd_disable_dma;
|
||||
sun_fdops.fd_set_dma_mode = sun_fd_set_dma_mode;
|
||||
sun_fdops.fd_set_dma_addr = sun_fd_set_dma_addr;
|
||||
sun_fdops.fd_set_dma_count = sun_fd_set_dma_count;
|
||||
sun_fdops.get_dma_residue = sun_get_dma_residue;
|
||||
|
||||
sun_fdops.fd_request_irq = sun_fd_request_irq;
|
||||
sun_fdops.fd_free_irq = sun_fd_free_irq;
|
||||
|
||||
sun_fdops.fd_eject = sun_fd_eject;
|
||||
|
||||
fdc_status = (unsigned long) &sun_fdc->status_82077;
|
||||
|
||||
/* Success... */
|
||||
allowed_drive_mask = 0x01;
|
||||
sun_floppy_types[0] = 4;
|
||||
sun_floppy_types[1] = 0;
|
||||
|
||||
return sun_floppy_types[0];
|
||||
}
|
||||
|
||||
#define EXTRA_FLOPPY_PARAMS
|
||||
|
||||
static DEFINE_SPINLOCK(dma_spin_lock);
|
||||
|
||||
#define claim_dma_lock() \
|
||||
({ unsigned long flags; \
|
||||
spin_lock_irqsave(&dma_spin_lock, flags); \
|
||||
flags; \
|
||||
})
|
||||
|
||||
#define release_dma_lock(__flags) \
|
||||
spin_unlock_irqrestore(&dma_spin_lock, __flags);
|
||||
|
||||
#endif /* !(__ASM_SPARC64_FLOPPY_H) */
|
33
arch/sparc/include/asm/fpumacro.h
Normal file
33
arch/sparc/include/asm/fpumacro.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* fpumacro.h: FPU related macros.
|
||||
*
|
||||
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
|
||||
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_FPUMACRO_H
|
||||
#define _SPARC64_FPUMACRO_H
|
||||
|
||||
#include <asm/asi.h>
|
||||
#include <asm/visasm.h>
|
||||
|
||||
struct fpustate {
|
||||
u32 regs[64];
|
||||
};
|
||||
|
||||
#define FPUSTATE (struct fpustate *)(current_thread_info()->fpregs)
|
||||
|
||||
static inline unsigned long fprs_read(void)
|
||||
{
|
||||
unsigned long retval;
|
||||
|
||||
__asm__ __volatile__("rd %%fprs, %0" : "=r" (retval));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline void fprs_write(unsigned long val)
|
||||
{
|
||||
__asm__ __volatile__("wr %0, 0x0, %%fprs" : : "r" (val));
|
||||
}
|
||||
|
||||
#endif /* !(_SPARC64_FPUMACRO_H) */
|
14
arch/sparc/include/asm/ftrace.h
Normal file
14
arch/sparc/include/asm/ftrace.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _ASM_SPARC64_FTRACE
|
||||
#define _ASM_SPARC64_FTRACE
|
||||
|
||||
#ifdef CONFIG_MCOUNT
|
||||
#define MCOUNT_ADDR ((long)(_mcount))
|
||||
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
extern void _mcount(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_SPARC64_FTRACE */
|
8
arch/sparc/include/asm/futex.h
Normal file
8
arch/sparc/include/asm/futex.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_FUTEX_H
|
||||
#define ___ASM_SPARC_FUTEX_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/futex_64.h>
|
||||
#else
|
||||
#include <asm/futex_32.h>
|
||||
#endif
|
||||
#endif
|
6
arch/sparc/include/asm/futex_32.h
Normal file
6
arch/sparc/include/asm/futex_32.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _ASM_FUTEX_H
|
||||
#define _ASM_FUTEX_H
|
||||
|
||||
#include <asm-generic/futex.h>
|
||||
|
||||
#endif
|
110
arch/sparc/include/asm/futex_64.h
Normal file
110
arch/sparc/include/asm/futex_64.h
Normal file
@@ -0,0 +1,110 @@
|
||||
#ifndef _SPARC64_FUTEX_H
|
||||
#define _SPARC64_FUTEX_H
|
||||
|
||||
#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__( \
|
||||
"\n1: lduwa [%3] %%asi, %2\n" \
|
||||
" " insn "\n" \
|
||||
"2: casa [%3] %%asi, %2, %1\n" \
|
||||
" cmp %2, %1\n" \
|
||||
" bne,pn %%icc, 1b\n" \
|
||||
" mov 0, %0\n" \
|
||||
"3:\n" \
|
||||
" .section .fixup,#alloc,#execinstr\n" \
|
||||
" .align 4\n" \
|
||||
"4: sethi %%hi(3b), %0\n" \
|
||||
" jmpl %0 + %%lo(3b), %%g0\n" \
|
||||
" mov %5, %0\n" \
|
||||
" .previous\n" \
|
||||
" .section __ex_table,\"a\"\n" \
|
||||
" .align 4\n" \
|
||||
" .word 1b, 4b\n" \
|
||||
" .word 2b, 4b\n" \
|
||||
" .previous\n" \
|
||||
: "=&r" (ret), "=&r" (oldval), "=&r" (tem) \
|
||||
: "r" (uaddr), "r" (oparg), "i" (-EFAULT) \
|
||||
: "memory")
|
||||
|
||||
static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
|
||||
{
|
||||
int op = (encoded_op >> 28) & 7;
|
||||
int cmp = (encoded_op >> 24) & 15;
|
||||
int oparg = (encoded_op << 8) >> 20;
|
||||
int cmparg = (encoded_op << 20) >> 20;
|
||||
int oldval = 0, ret, tem;
|
||||
|
||||
if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(int))))
|
||||
return -EFAULT;
|
||||
if (unlikely((((unsigned long) uaddr) & 0x3UL)))
|
||||
return -EINVAL;
|
||||
|
||||
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
|
||||
oparg = 1 << oparg;
|
||||
|
||||
pagefault_disable();
|
||||
|
||||
switch (op) {
|
||||
case FUTEX_OP_SET:
|
||||
__futex_cas_op("mov\t%4, %1", ret, oldval, uaddr, oparg);
|
||||
break;
|
||||
case FUTEX_OP_ADD:
|
||||
__futex_cas_op("add\t%2, %4, %1", ret, oldval, uaddr, oparg);
|
||||
break;
|
||||
case FUTEX_OP_OR:
|
||||
__futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg);
|
||||
break;
|
||||
case FUTEX_OP_ANDN:
|
||||
__futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg);
|
||||
break;
|
||||
case FUTEX_OP_XOR:
|
||||
__futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOSYS;
|
||||
}
|
||||
|
||||
pagefault_enable();
|
||||
|
||||
if (!ret) {
|
||||
switch (cmp) {
|
||||
case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
|
||||
case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
|
||||
case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
|
||||
case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
|
||||
case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
|
||||
case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
|
||||
default: ret = -ENOSYS;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"\n1: casa [%3] %%asi, %2, %0\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"
|
||||
" .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)
|
||||
: "memory");
|
||||
|
||||
return newval;
|
||||
}
|
||||
|
||||
#endif /* !(_SPARC64_FUTEX_H) */
|
8
arch/sparc/include/asm/hardirq.h
Normal file
8
arch/sparc/include/asm/hardirq.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_HARDIRQ_H
|
||||
#define ___ASM_SPARC_HARDIRQ_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/hardirq_64.h>
|
||||
#else
|
||||
#include <asm/hardirq_32.h>
|
||||
#endif
|
||||
#endif
|
23
arch/sparc/include/asm/hardirq_32.h
Normal file
23
arch/sparc/include/asm/hardirq_32.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* hardirq.h: 32-bit Sparc hard IRQ support.
|
||||
*
|
||||
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
|
||||
* Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org)
|
||||
*/
|
||||
|
||||
#ifndef __SPARC_HARDIRQ_H
|
||||
#define __SPARC_HARDIRQ_H
|
||||
|
||||
#include <linux/threads.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/cache.h>
|
||||
|
||||
/* entry.S is sensitive to the offsets of these fields */ /* XXX P3 Is it? */
|
||||
typedef struct {
|
||||
unsigned int __softirq_pending;
|
||||
} ____cacheline_aligned irq_cpustat_t;
|
||||
|
||||
#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
|
||||
|
||||
#define HARDIRQ_BITS 8
|
||||
|
||||
#endif /* __SPARC_HARDIRQ_H */
|
19
arch/sparc/include/asm/hardirq_64.h
Normal file
19
arch/sparc/include/asm/hardirq_64.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* hardirq.h: 64-bit Sparc hard IRQ support.
|
||||
*
|
||||
* Copyright (C) 1997, 1998, 2005 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
|
||||
#ifndef __SPARC64_HARDIRQ_H
|
||||
#define __SPARC64_HARDIRQ_H
|
||||
|
||||
#include <asm/cpudata.h>
|
||||
|
||||
#define __ARCH_IRQ_STAT
|
||||
#define local_softirq_pending() \
|
||||
(local_cpu_data().__softirq_pending)
|
||||
|
||||
void ack_bad_irq(unsigned int irq);
|
||||
|
||||
#define HARDIRQ_BITS 8
|
||||
|
||||
#endif /* !(__SPARC64_HARDIRQ_H) */
|
8
arch/sparc/include/asm/head.h
Normal file
8
arch/sparc/include/asm/head.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_HEAD_H
|
||||
#define ___ASM_SPARC_HEAD_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/head_64.h>
|
||||
#else
|
||||
#include <asm/head_32.h>
|
||||
#endif
|
||||
#endif
|
102
arch/sparc/include/asm/head_32.h
Normal file
102
arch/sparc/include/asm/head_32.h
Normal file
@@ -0,0 +1,102 @@
|
||||
#ifndef __SPARC_HEAD_H
|
||||
#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 */
|
||||
|
||||
/* Generic trap entry. */
|
||||
#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;
|
||||
#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;
|
||||
|
||||
/* This is for traps we should NEVER get. */
|
||||
#define BAD_TRAP(num) \
|
||||
rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
|
||||
|
||||
/* This is for traps when we want just skip the instruction which caused it */
|
||||
#define SKIP_TRAP(type, name) \
|
||||
jmpl %l2, %g0; rett %l2 + 4; nop; nop;
|
||||
|
||||
/* Notice that for the system calls we pull a trick. We load up a
|
||||
* different pointer to the system call vector table in %l7, but call
|
||||
* the same generic system call low-level entry point. The trap table
|
||||
* entry sequences are also HyperSparc pipeline friendly ;-)
|
||||
*/
|
||||
|
||||
/* Software trap for Linux system calls. */
|
||||
#define LINUX_SYSCALL_TRAP \
|
||||
sethi %hi(sys_call_table), %l7; \
|
||||
or %l7, %lo(sys_call_table), %l7; \
|
||||
b linux_sparc_syscall; \
|
||||
rd %psr, %l0;
|
||||
|
||||
#define BREAKPOINT_TRAP \
|
||||
b breakpoint_trap; \
|
||||
rd %psr,%l0; \
|
||||
nop; \
|
||||
nop;
|
||||
|
||||
#ifdef CONFIG_KGDB
|
||||
#define KGDB_TRAP(num) \
|
||||
b kgdb_trap_low; \
|
||||
rd %psr,%l0; \
|
||||
nop; \
|
||||
nop;
|
||||
#else
|
||||
#define KGDB_TRAP(num) \
|
||||
BAD_TRAP(num)
|
||||
#endif
|
||||
|
||||
/* The Get Condition Codes software trap for userland. */
|
||||
#define GETCC_TRAP \
|
||||
b getcc_trap_handler; mov %psr, %l0; nop; nop;
|
||||
|
||||
/* The Set Condition Codes software trap for userland. */
|
||||
#define SETCC_TRAP \
|
||||
b setcc_trap_handler; mov %psr, %l0; nop; nop;
|
||||
|
||||
/* The Get PSR software trap for userland. */
|
||||
#define GETPSR_TRAP \
|
||||
mov %psr, %i0; jmp %l2; rett %l2 + 4; nop;
|
||||
|
||||
/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
|
||||
* gets handled with another macro.
|
||||
*/
|
||||
#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....
|
||||
*/
|
||||
#define WINDOW_SPILL \
|
||||
rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
|
||||
|
||||
#define WINDOW_FILL \
|
||||
rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
|
||||
|
||||
#endif /* __SPARC_HEAD_H */
|
76
arch/sparc/include/asm/head_64.h
Normal file
76
arch/sparc/include/asm/head_64.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef _SPARC64_HEAD_H
|
||||
#define _SPARC64_HEAD_H
|
||||
|
||||
#include <asm/pstate.h>
|
||||
|
||||
/* wrpr %g0, val, %gl */
|
||||
#define SET_GL(val) \
|
||||
.word 0xa1902000 | val
|
||||
|
||||
/* rdpr %gl, %gN */
|
||||
#define GET_GL_GLOBAL(N) \
|
||||
.word 0x81540000 | (N << 25)
|
||||
|
||||
#define KERNBASE 0x400000
|
||||
|
||||
#define PTREGS_OFF (STACK_BIAS + STACKFRAME_SZ)
|
||||
|
||||
#define __CHEETAH_ID 0x003e0014
|
||||
#define __JALAPENO_ID 0x003e0016
|
||||
#define __SERRANO_ID 0x003e0022
|
||||
|
||||
#define CHEETAH_MANUF 0x003e
|
||||
#define CHEETAH_IMPL 0x0014 /* Ultra-III */
|
||||
#define CHEETAH_PLUS_IMPL 0x0015 /* Ultra-III+ */
|
||||
#define JALAPENO_IMPL 0x0016 /* Ultra-IIIi */
|
||||
#define JAGUAR_IMPL 0x0018 /* Ultra-IV */
|
||||
#define PANTHER_IMPL 0x0019 /* Ultra-IV+ */
|
||||
#define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */
|
||||
|
||||
#define BRANCH_IF_SUN4V(tmp1,label) \
|
||||
sethi %hi(is_sun4v), %tmp1; \
|
||||
lduw [%tmp1 + %lo(is_sun4v)], %tmp1; \
|
||||
brnz,pn %tmp1, label; \
|
||||
nop
|
||||
|
||||
#define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \
|
||||
rdpr %ver, %tmp1; \
|
||||
sethi %hi(__CHEETAH_ID), %tmp2; \
|
||||
srlx %tmp1, 32, %tmp1; \
|
||||
or %tmp2, %lo(__CHEETAH_ID), %tmp2;\
|
||||
cmp %tmp1, %tmp2; \
|
||||
be,pn %icc, label; \
|
||||
nop;
|
||||
|
||||
#define BRANCH_IF_JALAPENO(tmp1,tmp2,label) \
|
||||
rdpr %ver, %tmp1; \
|
||||
sethi %hi(__JALAPENO_ID), %tmp2; \
|
||||
srlx %tmp1, 32, %tmp1; \
|
||||
or %tmp2, %lo(__JALAPENO_ID), %tmp2;\
|
||||
cmp %tmp1, %tmp2; \
|
||||
be,pn %icc, label; \
|
||||
nop;
|
||||
|
||||
#define BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(tmp1,tmp2,label) \
|
||||
rdpr %ver, %tmp1; \
|
||||
srlx %tmp1, (32 + 16), %tmp2; \
|
||||
cmp %tmp2, CHEETAH_MANUF; \
|
||||
bne,pt %xcc, 99f; \
|
||||
sllx %tmp1, 16, %tmp1; \
|
||||
srlx %tmp1, (32 + 16), %tmp2; \
|
||||
cmp %tmp2, CHEETAH_PLUS_IMPL; \
|
||||
bgeu,pt %xcc, label; \
|
||||
99: nop;
|
||||
|
||||
#define BRANCH_IF_ANY_CHEETAH(tmp1,tmp2,label) \
|
||||
rdpr %ver, %tmp1; \
|
||||
srlx %tmp1, (32 + 16), %tmp2; \
|
||||
cmp %tmp2, CHEETAH_MANUF; \
|
||||
bne,pt %xcc, 99f; \
|
||||
sllx %tmp1, 16, %tmp1; \
|
||||
srlx %tmp1, (32 + 16), %tmp2; \
|
||||
cmp %tmp2, CHEETAH_IMPL; \
|
||||
bgeu,pt %xcc, label; \
|
||||
99: nop;
|
||||
|
||||
#endif /* !(_SPARC64_HEAD_H) */
|
81
arch/sparc/include/asm/highmem.h
Normal file
81
arch/sparc/include/asm/highmem.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* highmem.h: virtual kernel memory mappings for high memory
|
||||
*
|
||||
* Used in CONFIG_HIGHMEM systems for memory pages which
|
||||
* are not addressable by direct kernel virtual addresses.
|
||||
*
|
||||
* Copyright (C) 1999 Gerhard Wichert, Siemens AG
|
||||
* Gerhard.Wichert@pdb.siemens.de
|
||||
*
|
||||
*
|
||||
* Redesigned the x86 32-bit VM architecture to deal with
|
||||
* up to 16 Terrabyte physical memory. With current x86 CPUs
|
||||
* we now support up to 64 Gigabytes physical RAM.
|
||||
*
|
||||
* Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef _ASM_HIGHMEM_H
|
||||
#define _ASM_HIGHMEM_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/fixmap.h>
|
||||
#include <asm/vaddrs.h>
|
||||
#include <asm/kmap_types.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
/* 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;
|
||||
|
||||
/*
|
||||
* Right now we initialize only a single pte table. It can be extended
|
||||
* easily, subsequent pte tables have to be allocated in one physical
|
||||
* chunk of RAM. Currently the simplest way to do this is to align the
|
||||
* pkmap region on a pagetable boundary (4MB).
|
||||
*/
|
||||
#define LAST_PKMAP 1024
|
||||
#define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
|
||||
#define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
|
||||
|
||||
#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
|
||||
#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
|
||||
#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
|
||||
|
||||
#define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
|
||||
|
||||
extern void *kmap_high(struct page *page);
|
||||
extern void kunmap_high(struct page *page);
|
||||
|
||||
static inline void *kmap(struct page *page)
|
||||
{
|
||||
BUG_ON(in_interrupt());
|
||||
if (!PageHighMem(page))
|
||||
return page_address(page);
|
||||
return kmap_high(page);
|
||||
}
|
||||
|
||||
static inline void kunmap(struct page *page)
|
||||
{
|
||||
BUG_ON(in_interrupt());
|
||||
if (!PageHighMem(page))
|
||||
return;
|
||||
kunmap_high(page);
|
||||
}
|
||||
|
||||
extern void *kmap_atomic(struct page *page, enum km_type type);
|
||||
extern void kunmap_atomic(void *kvaddr, enum km_type type);
|
||||
extern struct page *kmap_atomic_to_page(void *vaddr);
|
||||
|
||||
#define flush_cache_kmaps() flush_cache_all()
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_HIGHMEM_H */
|
85
arch/sparc/include/asm/hugetlb.h
Normal file
85
arch/sparc/include/asm/hugetlb.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifndef _ASM_SPARC64_HUGETLB_H
|
||||
#define _ASM_SPARC64_HUGETLB_H
|
||||
|
||||
#include <asm/page.h>
|
||||
|
||||
|
||||
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
|
||||
pte_t *ptep, pte_t pte);
|
||||
|
||||
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 int is_hugepage_only_range(struct mm_struct *mm,
|
||||
unsigned long addr,
|
||||
unsigned long len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the arch doesn't supply something else, assume that hugepage
|
||||
* size aligned regions are ok without further preparation.
|
||||
*/
|
||||
static inline int prepare_hugepage_range(struct file *file,
|
||||
unsigned long addr, unsigned long len)
|
||||
{
|
||||
if (len & ~HPAGE_MASK)
|
||||
return -EINVAL;
|
||||
if (addr & ~HPAGE_MASK)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
|
||||
unsigned long addr, unsigned long end,
|
||||
unsigned long floor,
|
||||
unsigned long ceiling)
|
||||
{
|
||||
free_pgd_range(tlb, addr, end, floor, ceiling);
|
||||
}
|
||||
|
||||
static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
|
||||
unsigned long addr, pte_t *ptep)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int huge_pte_none(pte_t pte)
|
||||
{
|
||||
return pte_none(pte);
|
||||
}
|
||||
|
||||
static inline pte_t huge_pte_wrprotect(pte_t pte)
|
||||
{
|
||||
return pte_wrprotect(pte);
|
||||
}
|
||||
|
||||
static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
|
||||
unsigned long addr, pte_t *ptep)
|
||||
{
|
||||
ptep_set_wrprotect(mm, addr, ptep);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static inline pte_t huge_ptep_get(pte_t *ptep)
|
||||
{
|
||||
return *ptep;
|
||||
}
|
||||
|
||||
static inline int arch_prepare_hugepage(struct page *page)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void arch_release_hugepage(struct page *page)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* _ASM_SPARC64_HUGETLB_H */
|
37
arch/sparc/include/asm/hvtramp.h
Normal file
37
arch/sparc/include/asm/hvtramp.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef _SPARC64_HVTRAP_H
|
||||
#define _SPARC64_HVTRAP_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct hvtramp_mapping {
|
||||
__u64 vaddr;
|
||||
__u64 tte;
|
||||
};
|
||||
|
||||
struct hvtramp_descr {
|
||||
__u32 cpu;
|
||||
__u32 num_mappings;
|
||||
__u64 fault_info_va;
|
||||
__u64 fault_info_pa;
|
||||
__u64 thread_reg;
|
||||
struct hvtramp_mapping maps[1];
|
||||
};
|
||||
|
||||
extern void hv_cpu_startup(unsigned long hvdescr_pa);
|
||||
|
||||
#endif
|
||||
|
||||
#define HVTRAMP_DESCR_CPU 0x00
|
||||
#define HVTRAMP_DESCR_NUM_MAPPINGS 0x04
|
||||
#define HVTRAMP_DESCR_FAULT_INFO_VA 0x08
|
||||
#define HVTRAMP_DESCR_FAULT_INFO_PA 0x10
|
||||
#define HVTRAMP_DESCR_THREAD_REG 0x18
|
||||
#define HVTRAMP_DESCR_MAPS 0x20
|
||||
|
||||
#define HVTRAMP_MAPPING_VADDR 0x00
|
||||
#define HVTRAMP_MAPPING_TTE 0x08
|
||||
#define HVTRAMP_MAPPING_SIZE 0x10
|
||||
|
||||
#endif /* _SPARC64_HVTRAP_H */
|
6
arch/sparc/include/asm/hw_irq.h
Normal file
6
arch/sparc/include/asm/hw_irq.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __ASM_SPARC_HW_IRQ_H
|
||||
#define __ASM_SPARC_HW_IRQ_H
|
||||
|
||||
/* Dummy include. */
|
||||
|
||||
#endif
|
2949
arch/sparc/include/asm/hypervisor.h
Normal file
2949
arch/sparc/include/asm/hypervisor.h
Normal file
File diff suppressed because it is too large
Load Diff
97
arch/sparc/include/asm/ide.h
Normal file
97
arch/sparc/include/asm/ide.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* ide.h: SPARC PCI specific IDE glue.
|
||||
*
|
||||
* Copyright (C) 1997 David S. Miller (davem@davemloft.net)
|
||||
* Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
|
||||
* Adaptation from sparc64 version to sparc by Pete Zaitcev.
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_IDE_H
|
||||
#define _SPARC_IDE_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <asm/io.h>
|
||||
#ifdef CONFIG_SPARC64
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/spitfire.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/page.h>
|
||||
#else
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/psr.h>
|
||||
#endif
|
||||
|
||||
#define __ide_insl(data_reg, buffer, wcount) \
|
||||
__ide_insw(data_reg, buffer, (wcount)<<1)
|
||||
#define __ide_outsl(data_reg, buffer, wcount) \
|
||||
__ide_outsw(data_reg, buffer, (wcount)<<1)
|
||||
|
||||
/* On sparc, I/O ports and MMIO registers are accessed identically. */
|
||||
#define __ide_mm_insw __ide_insw
|
||||
#define __ide_mm_insl __ide_insl
|
||||
#define __ide_mm_outsw __ide_outsw
|
||||
#define __ide_mm_outsl __ide_outsl
|
||||
|
||||
static inline void __ide_insw(void __iomem *port, void *dst, u32 count)
|
||||
{
|
||||
#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
|
||||
unsigned long end = (unsigned long)dst + (count << 1);
|
||||
#endif
|
||||
u16 *ps = dst;
|
||||
u32 *pi;
|
||||
|
||||
if(((unsigned long)ps) & 0x2) {
|
||||
*ps++ = __raw_readw(port);
|
||||
count--;
|
||||
}
|
||||
pi = (u32 *)ps;
|
||||
while(count >= 2) {
|
||||
u32 w;
|
||||
|
||||
w = __raw_readw(port) << 16;
|
||||
w |= __raw_readw(port);
|
||||
*pi++ = w;
|
||||
count -= 2;
|
||||
}
|
||||
ps = (u16 *)pi;
|
||||
if(count)
|
||||
*ps++ = __raw_readw(port);
|
||||
|
||||
#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
|
||||
__flush_dcache_range((unsigned long)dst, end);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void __ide_outsw(void __iomem *port, const void *src, u32 count)
|
||||
{
|
||||
#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
|
||||
unsigned long end = (unsigned long)src + (count << 1);
|
||||
#endif
|
||||
const u16 *ps = src;
|
||||
const u32 *pi;
|
||||
|
||||
if(((unsigned long)src) & 0x2) {
|
||||
__raw_writew(*ps++, port);
|
||||
count--;
|
||||
}
|
||||
pi = (const u32 *)ps;
|
||||
while(count >= 2) {
|
||||
u32 w;
|
||||
|
||||
w = *pi++;
|
||||
__raw_writew((w >> 16), port);
|
||||
__raw_writew(w, port);
|
||||
count -= 2;
|
||||
}
|
||||
ps = (const u16 *)pi;
|
||||
if(count)
|
||||
__raw_writew(*ps, port);
|
||||
|
||||
#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
|
||||
__flush_dcache_range((unsigned long)src, end);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _SPARC_IDE_H */
|
25
arch/sparc/include/asm/idprom.h
Normal file
25
arch/sparc/include/asm/idprom.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* idprom.h: Macros and defines for idprom routines
|
||||
*
|
||||
* Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
#ifndef _SPARC_IDPROM_H
|
||||
#define _SPARC_IDPROM_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct idprom {
|
||||
u8 id_format; /* Format identifier (always 0x01) */
|
||||
u8 id_machtype; /* Machine type */
|
||||
u8 id_ethaddr[6]; /* Hardware ethernet address */
|
||||
s32 id_date; /* Date of manufacture */
|
||||
u32 id_sernum:24; /* Unique serial number */
|
||||
u8 id_cksum; /* Checksum - xor of the data bytes */
|
||||
u8 reserved[16];
|
||||
};
|
||||
|
||||
extern struct idprom *idprom;
|
||||
extern void idprom_init(void);
|
||||
|
||||
#endif /* !(_SPARC_IDPROM_H) */
|
15
arch/sparc/include/asm/intr_queue.h
Normal file
15
arch/sparc/include/asm/intr_queue.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _SPARC64_INTR_QUEUE_H
|
||||
#define _SPARC64_INTR_QUEUE_H
|
||||
|
||||
/* Sun4v interrupt queue registers, accessed via ASI_QUEUE. */
|
||||
|
||||
#define INTRQ_CPU_MONDO_HEAD 0x3c0 /* CPU mondo head */
|
||||
#define INTRQ_CPU_MONDO_TAIL 0x3c8 /* CPU mondo tail */
|
||||
#define INTRQ_DEVICE_MONDO_HEAD 0x3d0 /* Device mondo head */
|
||||
#define INTRQ_DEVICE_MONDO_TAIL 0x3d8 /* Device mondo tail */
|
||||
#define INTRQ_RESUM_MONDO_HEAD 0x3e0 /* Resumable error mondo head */
|
||||
#define INTRQ_RESUM_MONDO_TAIL 0x3e8 /* Resumable error mondo tail */
|
||||
#define INTRQ_NONRESUM_MONDO_HEAD 0x3f0 /* Non-resumable error mondo head */
|
||||
#define INTRQ_NONRESUM_MONDO_TAIL 0x3f8 /* Non-resumable error mondo head */
|
||||
|
||||
#endif /* !(_SPARC64_INTR_QUEUE_H) */
|
62
arch/sparc/include/asm/io-unit.h
Normal file
62
arch/sparc/include/asm/io-unit.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* io-unit.h: Definitions for the sun4d IO-UNIT.
|
||||
*
|
||||
* Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
|
||||
*/
|
||||
#ifndef _SPARC_IO_UNIT_H
|
||||
#define _SPARC_IO_UNIT_H
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
/* The io-unit handles all virtual to physical address translations
|
||||
* that occur between the SBUS and physical memory. Access by
|
||||
* the cpu to IO registers and similar go over the xdbus so are
|
||||
* translated by the on chip SRMMU. The io-unit and the srmmu do
|
||||
* not need to have the same translations at all, in fact most
|
||||
* of the time the translations they handle are a disjunct set.
|
||||
* Basically the io-unit handles all dvma sbus activity.
|
||||
*/
|
||||
|
||||
/* AIEEE, unlike the nice sun4m, these monsters have
|
||||
fixed DMA range 64M */
|
||||
|
||||
#define IOUNIT_DMA_BASE 0xfc000000 /* TOP - 64M */
|
||||
#define IOUNIT_DMA_SIZE 0x04000000 /* 64M */
|
||||
/* We use last 1M for sparc_dvma_malloc */
|
||||
#define IOUNIT_DVMA_SIZE 0x00100000 /* 1M */
|
||||
|
||||
/* The format of an iopte in the external page tables */
|
||||
#define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */
|
||||
#define IOUPTE_CACHE 0x00000080 /* Cached (in Viking/MXCC) */
|
||||
/* XXX Jakub, find out how to program SBUS streaming cache on XDBUS/sun4d.
|
||||
* XXX Actually, all you should need to do is find out where the registers
|
||||
* XXX are and copy over the sparc64 implementation I wrote. There may be
|
||||
* XXX some horrible hwbugs though, so be careful. -DaveM
|
||||
*/
|
||||
#define IOUPTE_STREAM 0x00000040 /* Translation can use streaming cache */
|
||||
#define IOUPTE_INTRA 0x00000008 /* SBUS direct slot->slot transfer */
|
||||
#define IOUPTE_WRITE 0x00000004 /* Writeable */
|
||||
#define IOUPTE_VALID 0x00000002 /* IOPTE is valid */
|
||||
#define IOUPTE_PARITY 0x00000001 /* Parity is checked during DVMA */
|
||||
|
||||
struct iounit_struct {
|
||||
unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)];
|
||||
spinlock_t lock;
|
||||
iopte_t *page_table;
|
||||
unsigned long rotor[3];
|
||||
unsigned long limit[4];
|
||||
};
|
||||
|
||||
#define IOUNIT_BMAP1_START 0x00000000
|
||||
#define IOUNIT_BMAP1_END (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 1))
|
||||
#define IOUNIT_BMAP2_START IOUNIT_BMAP1_END
|
||||
#define IOUNIT_BMAP2_END IOUNIT_BMAP2_START + (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 2))
|
||||
#define IOUNIT_BMAPM_START IOUNIT_BMAP2_END
|
||||
#define IOUNIT_BMAPM_END ((IOUNIT_DMA_SIZE - IOUNIT_DVMA_SIZE) >> PAGE_SHIFT)
|
||||
|
||||
extern __u32 iounit_map_dma_init(struct sbus_bus *, int);
|
||||
#define iounit_map_dma_finish(sbus, addr, len) mmu_release_scsi_one(addr, len, sbus)
|
||||
extern __u32 iounit_map_dma_page(__u32, void *, struct sbus_bus *);
|
||||
|
||||
#endif /* !(_SPARC_IO_UNIT_H) */
|
8
arch/sparc/include/asm/io.h
Normal file
8
arch/sparc/include/asm/io.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef ___ASM_SPARC_IO_H
|
||||
#define ___ASM_SPARC_IO_H
|
||||
#if defined(__sparc__) && defined(__arch64__)
|
||||
#include <asm/io_64.h>
|
||||
#else
|
||||
#include <asm/io_32.h>
|
||||
#endif
|
||||
#endif
|
326
arch/sparc/include/asm/io_32.h
Normal file
326
arch/sparc/include/asm/io_32.h
Normal file
@@ -0,0 +1,326 @@
|
||||
#ifndef __SPARC_IO_H
|
||||
#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) - mem_map) << 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;
|
||||
}
|
||||
|
||||
static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
|
||||
{
|
||||
*(__force volatile u8 *)addr = b;
|
||||
}
|
||||
|
||||
static inline void __raw_writew(u16 w, volatile void __iomem *addr)
|
||||
{
|
||||
*(__force volatile u16 *)addr = w;
|
||||
}
|
||||
|
||||
static inline void __raw_writel(u32 l, volatile void __iomem *addr)
|
||||
{
|
||||
*(__force volatile u32 *)addr = l;
|
||||
}
|
||||
|
||||
static inline u8 __readb(const volatile void __iomem *addr)
|
||||
{
|
||||
return *(__force volatile u8 *)addr;
|
||||
}
|
||||
|
||||
static inline u16 __readw(const volatile void __iomem *addr)
|
||||
{
|
||||
return flip_word(*(__force volatile u16 *)addr);
|
||||
}
|
||||
|
||||
static inline u32 __readl(const volatile void __iomem *addr)
|
||||
{
|
||||
return flip_dword(*(__force volatile u32 *)addr);
|
||||
}
|
||||
|
||||
static inline void __writeb(u8 b, volatile void __iomem *addr)
|
||||
{
|
||||
*(__force volatile u8 *)addr = b;
|
||||
}
|
||||
|
||||
static inline void __writew(u16 w, volatile void __iomem *addr)
|
||||
{
|
||||
*(__force volatile u16 *)addr = flip_word(w);
|
||||
}
|
||||
|
||||
static inline void __writel(u32 l, volatile void __iomem *addr)
|
||||
{
|
||||
*(__force volatile u32 *)addr = flip_dword(l);
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
return *(__force volatile u8 *)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)
|
||||
{
|
||||
return *(__force volatile u32 *)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)
|
||||
{
|
||||
*(__force volatile u16 *)addr = w;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
while(n--) {
|
||||
sbus_writeb(c, __dst);
|
||||
__dst++;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
_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
|
||||
_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);
|
||||
#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 ioread32(X) readl(X)
|
||||
#define iowrite8(val,X) writeb(val,X)
|
||||
#define iowrite16(val,X) writew(val,X)
|
||||
#define iowrite32(val,X) 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);
|
||||
}
|
||||
|
||||
/* 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 *);
|
||||
|
||||
/* 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 *);
|
||||
|
||||
/*
|
||||
* Bus number may be in res->flags... somewhere.
|
||||
*/
|
||||
extern void __iomem *sbus_ioremap(struct resource *res, unsigned long offset,
|
||||
unsigned long size, char *name);
|
||||
extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size);
|
||||
|
||||
|
||||
/*
|
||||
* At the moment, we do not use CMOS_READ anywhere outside of rtc.c,
|
||||
* so rtc_port is static in it. This should not change unless a new
|
||||
* hardware pops up.
|
||||
*/
|
||||
#define RTC_PORT(x) (rtc_port + (x))
|
||||
#define RTC_ALWAYS_BCD 0
|
||||
|
||||
#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) */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user