sparc: copy sparc64 specific files to asm-sparc
Used the following script to copy the files: cd include set -e SPARC64=`ls asm-sparc64` for FILE in ${SPARC64}; do if [ -f asm-sparc/$FILE ]; then echo $FILE exist in asm-sparc else git mv asm-sparc64/$FILE asm-sparc/$FILE printf "#include <asm-sparc/$FILE>\n" > asm-sparc64/$FILE git add asm-sparc64/$FILE fi done Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
bdc3135ac9
commit
a00736e936
|
@ -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
|
|
@ -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) */
|
|
@ -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 */
|
|
@ -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 */
|
||||||
|
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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) */
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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) */
|
|
@ -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) */
|
|
@ -0,0 +1,84 @@
|
||||||
|
#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(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 */
|
|
@ -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 */
|
File diff suppressed because it is too large
Load Diff
|
@ -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) */
|
|
@ -0,0 +1,49 @@
|
||||||
|
#ifndef _SPARC64_KPROBES_H
|
||||||
|
#define _SPARC64_KPROBES_H
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/percpu.h>
|
||||||
|
|
||||||
|
typedef u32 kprobe_opcode_t;
|
||||||
|
|
||||||
|
#define BREAKPOINT_INSTRUCTION 0x91d02070 /* ta 0x70 */
|
||||||
|
#define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */
|
||||||
|
#define MAX_INSN_SIZE 2
|
||||||
|
|
||||||
|
#define kretprobe_blacklist_size 0
|
||||||
|
|
||||||
|
#define arch_remove_kprobe(p) do {} while (0)
|
||||||
|
|
||||||
|
#define flush_insn_slot(p) \
|
||||||
|
do { flushi(&(p)->ainsn.insn[0]); \
|
||||||
|
flushi(&(p)->ainsn.insn[1]); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
void kretprobe_trampoline(void);
|
||||||
|
|
||||||
|
/* Architecture specific copy of original instruction*/
|
||||||
|
struct arch_specific_insn {
|
||||||
|
/* copy of the original instruction */
|
||||||
|
kprobe_opcode_t insn[MAX_INSN_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct prev_kprobe {
|
||||||
|
struct kprobe *kp;
|
||||||
|
unsigned long status;
|
||||||
|
unsigned long orig_tnpc;
|
||||||
|
unsigned long orig_tstate_pil;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* per-cpu kprobe control block */
|
||||||
|
struct kprobe_ctlblk {
|
||||||
|
unsigned long kprobe_status;
|
||||||
|
unsigned long kprobe_orig_tnpc;
|
||||||
|
unsigned long kprobe_orig_tstate_pil;
|
||||||
|
struct pt_regs jprobe_saved_regs;
|
||||||
|
struct prev_kprobe prev_kprobe;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int kprobe_exceptions_notify(struct notifier_block *self,
|
||||||
|
unsigned long val, void *data);
|
||||||
|
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
|
||||||
|
#endif /* _SPARC64_KPROBES_H */
|
|
@ -0,0 +1,138 @@
|
||||||
|
#ifndef _SPARC64_LDC_H
|
||||||
|
#define _SPARC64_LDC_H
|
||||||
|
|
||||||
|
#include <asm/hypervisor.h>
|
||||||
|
|
||||||
|
extern int ldom_domaining_enabled;
|
||||||
|
extern void ldom_set_var(const char *var, const char *value);
|
||||||
|
extern void ldom_reboot(const char *boot_command);
|
||||||
|
extern void ldom_power_off(void);
|
||||||
|
|
||||||
|
/* The event handler will be evoked when link state changes
|
||||||
|
* or data becomes available on the receive side.
|
||||||
|
*
|
||||||
|
* For non-RAW links, if the LDC_EVENT_RESET event arrives the
|
||||||
|
* driver should reset all of it's internal state and reinvoke
|
||||||
|
* ldc_connect() to try and bring the link up again.
|
||||||
|
*
|
||||||
|
* For RAW links, ldc_connect() is not used. Instead the driver
|
||||||
|
* just waits for the LDC_EVENT_UP event.
|
||||||
|
*/
|
||||||
|
struct ldc_channel_config {
|
||||||
|
void (*event)(void *arg, int event);
|
||||||
|
|
||||||
|
u32 mtu;
|
||||||
|
unsigned int rx_irq;
|
||||||
|
unsigned int tx_irq;
|
||||||
|
u8 mode;
|
||||||
|
#define LDC_MODE_RAW 0x00
|
||||||
|
#define LDC_MODE_UNRELIABLE 0x01
|
||||||
|
#define LDC_MODE_RESERVED 0x02
|
||||||
|
#define LDC_MODE_STREAM 0x03
|
||||||
|
|
||||||
|
u8 debug;
|
||||||
|
#define LDC_DEBUG_HS 0x01
|
||||||
|
#define LDC_DEBUG_STATE 0x02
|
||||||
|
#define LDC_DEBUG_RX 0x04
|
||||||
|
#define LDC_DEBUG_TX 0x08
|
||||||
|
#define LDC_DEBUG_DATA 0x10
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LDC_EVENT_RESET 0x01
|
||||||
|
#define LDC_EVENT_UP 0x02
|
||||||
|
#define LDC_EVENT_DATA_READY 0x04
|
||||||
|
|
||||||
|
#define LDC_STATE_INVALID 0x00
|
||||||
|
#define LDC_STATE_INIT 0x01
|
||||||
|
#define LDC_STATE_BOUND 0x02
|
||||||
|
#define LDC_STATE_READY 0x03
|
||||||
|
#define LDC_STATE_CONNECTED 0x04
|
||||||
|
|
||||||
|
struct ldc_channel;
|
||||||
|
|
||||||
|
/* Allocate state for a channel. */
|
||||||
|
extern struct ldc_channel *ldc_alloc(unsigned long id,
|
||||||
|
const struct ldc_channel_config *cfgp,
|
||||||
|
void *event_arg);
|
||||||
|
|
||||||
|
/* Shut down and free state for a channel. */
|
||||||
|
extern void ldc_free(struct ldc_channel *lp);
|
||||||
|
|
||||||
|
/* Register TX and RX queues of the link with the hypervisor. */
|
||||||
|
extern int ldc_bind(struct ldc_channel *lp, const char *name);
|
||||||
|
|
||||||
|
/* For non-RAW protocols we need to complete a handshake before
|
||||||
|
* communication can proceed. ldc_connect() does that, if the
|
||||||
|
* handshake completes successfully, an LDC_EVENT_UP event will
|
||||||
|
* be sent up to the driver.
|
||||||
|
*/
|
||||||
|
extern int ldc_connect(struct ldc_channel *lp);
|
||||||
|
extern int ldc_disconnect(struct ldc_channel *lp);
|
||||||
|
|
||||||
|
extern int ldc_state(struct ldc_channel *lp);
|
||||||
|
|
||||||
|
/* Read and write operations. Only valid when the link is up. */
|
||||||
|
extern int ldc_write(struct ldc_channel *lp, const void *buf,
|
||||||
|
unsigned int size);
|
||||||
|
extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);
|
||||||
|
|
||||||
|
#define LDC_MAP_SHADOW 0x01
|
||||||
|
#define LDC_MAP_DIRECT 0x02
|
||||||
|
#define LDC_MAP_IO 0x04
|
||||||
|
#define LDC_MAP_R 0x08
|
||||||
|
#define LDC_MAP_W 0x10
|
||||||
|
#define LDC_MAP_X 0x20
|
||||||
|
#define LDC_MAP_RW (LDC_MAP_R | LDC_MAP_W)
|
||||||
|
#define LDC_MAP_RWX (LDC_MAP_R | LDC_MAP_W | LDC_MAP_X)
|
||||||
|
#define LDC_MAP_ALL 0x03f
|
||||||
|
|
||||||
|
struct ldc_trans_cookie {
|
||||||
|
u64 cookie_addr;
|
||||||
|
u64 cookie_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct scatterlist;
|
||||||
|
extern int ldc_map_sg(struct ldc_channel *lp,
|
||||||
|
struct scatterlist *sg, int num_sg,
|
||||||
|
struct ldc_trans_cookie *cookies, int ncookies,
|
||||||
|
unsigned int map_perm);
|
||||||
|
|
||||||
|
extern int ldc_map_single(struct ldc_channel *lp,
|
||||||
|
void *buf, unsigned int len,
|
||||||
|
struct ldc_trans_cookie *cookies, int ncookies,
|
||||||
|
unsigned int map_perm);
|
||||||
|
|
||||||
|
extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies,
|
||||||
|
int ncookies);
|
||||||
|
|
||||||
|
extern int ldc_copy(struct ldc_channel *lp, int copy_dir,
|
||||||
|
void *buf, unsigned int len, unsigned long offset,
|
||||||
|
struct ldc_trans_cookie *cookies, int ncookies);
|
||||||
|
|
||||||
|
static inline int ldc_get_dring_entry(struct ldc_channel *lp,
|
||||||
|
void *buf, unsigned int len,
|
||||||
|
unsigned long offset,
|
||||||
|
struct ldc_trans_cookie *cookies,
|
||||||
|
int ncookies)
|
||||||
|
{
|
||||||
|
return ldc_copy(lp, LDC_COPY_IN, buf, len, offset, cookies, ncookies);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ldc_put_dring_entry(struct ldc_channel *lp,
|
||||||
|
void *buf, unsigned int len,
|
||||||
|
unsigned long offset,
|
||||||
|
struct ldc_trans_cookie *cookies,
|
||||||
|
int ncookies)
|
||||||
|
{
|
||||||
|
return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
|
||||||
|
struct ldc_trans_cookie *cookies,
|
||||||
|
int *ncookies, unsigned int map_perm);
|
||||||
|
|
||||||
|
extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf,
|
||||||
|
unsigned int len,
|
||||||
|
struct ldc_trans_cookie *cookies, int ncookies);
|
||||||
|
|
||||||
|
#endif /* _SPARC64_LDC_H */
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _SPARC64_LMB_H
|
||||||
|
#define _SPARC64_LMB_H
|
||||||
|
|
||||||
|
#include <asm/oplib.h>
|
||||||
|
|
||||||
|
#define LMB_DBG(fmt...) prom_printf(fmt)
|
||||||
|
|
||||||
|
#define LMB_REAL_LIMIT 0
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_LMB_H) */
|
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef _SPARC64_LSU_H
|
||||||
|
#define _SPARC64_LSU_H
|
||||||
|
|
||||||
|
#include <linux/const.h>
|
||||||
|
|
||||||
|
/* LSU Control Register */
|
||||||
|
#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/
|
||||||
|
#define LSU_CONTROL_VM _AC(0x00000001fe000000,UL) /* Virt-watchpoint byte mask*/
|
||||||
|
#define LSU_CONTROL_PR _AC(0x0000000001000000,UL) /* Phys-rd watchpoint enable*/
|
||||||
|
#define LSU_CONTROL_PW _AC(0x0000000000800000,UL) /* Phys-wr watchpoint enable*/
|
||||||
|
#define LSU_CONTROL_VR _AC(0x0000000000400000,UL) /* Virt-rd watchpoint enable*/
|
||||||
|
#define LSU_CONTROL_VW _AC(0x0000000000200000,UL) /* Virt-wr watchpoint enable*/
|
||||||
|
#define LSU_CONTROL_FM _AC(0x00000000000ffff0,UL) /* Parity mask enables. */
|
||||||
|
#define LSU_CONTROL_DM _AC(0x0000000000000008,UL) /* Data MMU enable. */
|
||||||
|
#define LSU_CONTROL_IM _AC(0x0000000000000004,UL) /* Instruction MMU enable. */
|
||||||
|
#define LSU_CONTROL_DC _AC(0x0000000000000002,UL) /* Data cache enable. */
|
||||||
|
#define LSU_CONTROL_IC _AC(0x0000000000000001,UL) /* Instruction cache enable.*/
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_LSU_H) */
|
|
@ -0,0 +1,78 @@
|
||||||
|
#ifndef _SPARC64_MDESC_H
|
||||||
|
#define _SPARC64_MDESC_H
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/cpumask.h>
|
||||||
|
#include <asm/prom.h>
|
||||||
|
|
||||||
|
struct mdesc_handle;
|
||||||
|
|
||||||
|
/* Machine description operations are to be surrounded by grab and
|
||||||
|
* release calls. The mdesc_handle returned from the grab is
|
||||||
|
* the first argument to all of the operational calls that work
|
||||||
|
* on mdescs.
|
||||||
|
*/
|
||||||
|
extern struct mdesc_handle *mdesc_grab(void);
|
||||||
|
extern void mdesc_release(struct mdesc_handle *);
|
||||||
|
|
||||||
|
#define MDESC_NODE_NULL (~(u64)0)
|
||||||
|
|
||||||
|
extern u64 mdesc_node_by_name(struct mdesc_handle *handle,
|
||||||
|
u64 from_node, const char *name);
|
||||||
|
#define mdesc_for_each_node_by_name(__hdl, __node, __name) \
|
||||||
|
for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
|
||||||
|
(__node) != MDESC_NODE_NULL; \
|
||||||
|
__node = mdesc_node_by_name(__hdl, __node, __name))
|
||||||
|
|
||||||
|
/* Access to property values returned from mdesc_get_property() are
|
||||||
|
* only valid inside of a mdesc_grab()/mdesc_release() sequence.
|
||||||
|
* Once mdesc_release() is called, the memory backed up by these
|
||||||
|
* pointers may reference freed up memory.
|
||||||
|
*
|
||||||
|
* Therefore callers must make copies of any property values
|
||||||
|
* they need.
|
||||||
|
*
|
||||||
|
* These same rules apply to mdesc_node_name().
|
||||||
|
*/
|
||||||
|
extern const void *mdesc_get_property(struct mdesc_handle *handle,
|
||||||
|
u64 node, const char *name, int *lenp);
|
||||||
|
extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
|
||||||
|
|
||||||
|
/* MD arc iteration, the standard sequence is:
|
||||||
|
*
|
||||||
|
* unsigned long arc;
|
||||||
|
* mdesc_for_each_arc(arc, handle, node, MDESC_ARC_TYPE_{FWD,BACK}) {
|
||||||
|
* unsigned long target = mdesc_arc_target(handle, arc);
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MDESC_ARC_TYPE_FWD "fwd"
|
||||||
|
#define MDESC_ARC_TYPE_BACK "back"
|
||||||
|
|
||||||
|
extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
|
||||||
|
const char *arc_type);
|
||||||
|
#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
|
||||||
|
for (__arc = mdesc_next_arc(__hdl, __node, __type); \
|
||||||
|
(__arc) != MDESC_NODE_NULL; \
|
||||||
|
__arc = mdesc_next_arc(__hdl, __arc, __type))
|
||||||
|
|
||||||
|
extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
|
||||||
|
|
||||||
|
extern void mdesc_update(void);
|
||||||
|
|
||||||
|
struct mdesc_notifier_client {
|
||||||
|
void (*add)(struct mdesc_handle *handle, u64 node);
|
||||||
|
void (*remove)(struct mdesc_handle *handle, u64 node);
|
||||||
|
|
||||||
|
const char *node_name;
|
||||||
|
struct mdesc_notifier_client *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void mdesc_register_notifier(struct mdesc_notifier_client *client);
|
||||||
|
|
||||||
|
extern void mdesc_fill_in_cpu_data(cpumask_t mask);
|
||||||
|
|
||||||
|
extern void sun4v_mdesc_init(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef _SPARC64_MMZONE_H
|
||||||
|
#define _SPARC64_MMZONE_H
|
||||||
|
|
||||||
|
#ifdef CONFIG_NEED_MULTIPLE_NODES
|
||||||
|
|
||||||
|
extern struct pglist_data *node_data[];
|
||||||
|
|
||||||
|
#define NODE_DATA(nid) (node_data[nid])
|
||||||
|
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
|
||||||
|
#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
|
||||||
|
|
||||||
|
extern int numa_cpu_lookup_table[];
|
||||||
|
extern cpumask_t numa_cpumask_lookup_table[];
|
||||||
|
|
||||||
|
#endif /* CONFIG_NEED_MULTIPLE_NODES */
|
||||||
|
|
||||||
|
#endif /* _SPARC64_MMZONE_H */
|
|
@ -0,0 +1,118 @@
|
||||||
|
/* ns87303.h: Configuration Register Description for the
|
||||||
|
* National Semiconductor PC87303 (SuperIO).
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SPARC_NS87303_H
|
||||||
|
#define _SPARC_NS87303_H 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Control Register Index Values
|
||||||
|
*/
|
||||||
|
#define FER 0x00
|
||||||
|
#define FAR 0x01
|
||||||
|
#define PTR 0x02
|
||||||
|
#define FCR 0x03
|
||||||
|
#define PCR 0x04
|
||||||
|
#define KRR 0x05
|
||||||
|
#define PMC 0x06
|
||||||
|
#define TUP 0x07
|
||||||
|
#define SID 0x08
|
||||||
|
#define ASC 0x09
|
||||||
|
#define CS0CF0 0x0a
|
||||||
|
#define CS0CF1 0x0b
|
||||||
|
#define CS1CF0 0x0c
|
||||||
|
#define CS1CF1 0x0d
|
||||||
|
|
||||||
|
/* Function Enable Register (FER) bits */
|
||||||
|
#define FER_EDM 0x10 /* Encoded Drive and Motor pin information */
|
||||||
|
|
||||||
|
/* Function Address Register (FAR) bits */
|
||||||
|
#define FAR_LPT_MASK 0x03
|
||||||
|
#define FAR_LPTB 0x00
|
||||||
|
#define FAR_LPTA 0x01
|
||||||
|
#define FAR_LPTC 0x02
|
||||||
|
|
||||||
|
/* Power and Test Register (PTR) bits */
|
||||||
|
#define PTR_LPTB_IRQ7 0x08
|
||||||
|
#define PTR_LEVEL_IRQ 0x80 /* When not ECP/EPP: Use level IRQ */
|
||||||
|
#define PTR_LPT_REG_DIR 0x80 /* When ECP/EPP: LPT CTR controlls direction */
|
||||||
|
/* of the parallel port */
|
||||||
|
|
||||||
|
/* Function Control Register (FCR) bits */
|
||||||
|
#define FCR_LDE 0x10 /* Logical Drive Exchange */
|
||||||
|
#define FCR_ZWS_ENA 0x20 /* Enable short host read/write in ECP/EPP */
|
||||||
|
|
||||||
|
/* Printer Control Register (PCR) bits */
|
||||||
|
#define PCR_EPP_ENABLE 0x01
|
||||||
|
#define PCR_EPP_IEEE 0x02 /* Enable EPP Version 1.9 (IEEE 1284) */
|
||||||
|
#define PCR_ECP_ENABLE 0x04
|
||||||
|
#define PCR_ECP_CLK_ENA 0x08 /* If 0 ECP Clock is stopped on Power down */
|
||||||
|
#define PCR_IRQ_POLAR 0x20 /* If 0 IRQ is level high or negative pulse, */
|
||||||
|
/* if 1 polarity is inverted */
|
||||||
|
#define PCR_IRQ_ODRAIN 0x40 /* If 1, IRQ is open drain */
|
||||||
|
|
||||||
|
/* Tape UARTs and Parallel Port Config Register (TUP) bits */
|
||||||
|
#define TUP_EPP_TIMO 0x02 /* Enable EPP timeout IRQ */
|
||||||
|
|
||||||
|
/* Advanced SuperIO Config Register (ASC) bits */
|
||||||
|
#define ASC_LPT_IRQ7 0x01 /* Always use IRQ7 for LPT */
|
||||||
|
#define ASC_DRV2_SEL 0x02 /* Logical Drive Exchange controlled by TDR */
|
||||||
|
|
||||||
|
#define FER_RESERVED 0x00
|
||||||
|
#define FAR_RESERVED 0x00
|
||||||
|
#define PTR_RESERVED 0x73
|
||||||
|
#define FCR_RESERVED 0xc4
|
||||||
|
#define PCR_RESERVED 0x10
|
||||||
|
#define KRR_RESERVED 0x00
|
||||||
|
#define PMC_RESERVED 0x98
|
||||||
|
#define TUP_RESERVED 0xfb
|
||||||
|
#define SIP_RESERVED 0x00
|
||||||
|
#define ASC_RESERVED 0x18
|
||||||
|
#define CS0CF0_RESERVED 0x00
|
||||||
|
#define CS0CF1_RESERVED 0x08
|
||||||
|
#define CS1CF0_RESERVED 0x00
|
||||||
|
#define CS1CF1_RESERVED 0x08
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
|
||||||
|
#include <asm/system.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
extern spinlock_t ns87303_lock;
|
||||||
|
|
||||||
|
static inline int ns87303_modify(unsigned long port, unsigned int index,
|
||||||
|
unsigned char clr, unsigned char set)
|
||||||
|
{
|
||||||
|
static unsigned char reserved[] = {
|
||||||
|
FER_RESERVED, FAR_RESERVED, PTR_RESERVED, FCR_RESERVED,
|
||||||
|
PCR_RESERVED, KRR_RESERVED, PMC_RESERVED, TUP_RESERVED,
|
||||||
|
SIP_RESERVED, ASC_RESERVED, CS0CF0_RESERVED, CS0CF1_RESERVED,
|
||||||
|
CS1CF0_RESERVED, CS1CF1_RESERVED
|
||||||
|
};
|
||||||
|
unsigned long flags;
|
||||||
|
unsigned char value;
|
||||||
|
|
||||||
|
if (index > 0x0d)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
spin_lock_irqsave(&ns87303_lock, flags);
|
||||||
|
|
||||||
|
outb(index, port);
|
||||||
|
value = inb(port + 1);
|
||||||
|
value &= ~(reserved[index] | clr);
|
||||||
|
value |= set;
|
||||||
|
outb(value, port + 1);
|
||||||
|
outb(value, port + 1);
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&ns87303_lock, flags);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
#endif /* !(_SPARC_NS87303_H) */
|
|
@ -0,0 +1,246 @@
|
||||||
|
/* parport.h: sparc64 specific parport initialization and dma.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASM_SPARC64_PARPORT_H
|
||||||
|
#define _ASM_SPARC64_PARPORT_H 1
|
||||||
|
|
||||||
|
#include <asm/ebus.h>
|
||||||
|
#include <asm/ns87303.h>
|
||||||
|
#include <asm/of_device.h>
|
||||||
|
#include <asm/prom.h>
|
||||||
|
|
||||||
|
#define PARPORT_PC_MAX_PORTS PARPORT_MAX
|
||||||
|
|
||||||
|
/*
|
||||||
|
* While sparc64 doesn't have an ISA DMA API, we provide something that looks
|
||||||
|
* close enough to make parport_pc happy
|
||||||
|
*/
|
||||||
|
#define HAS_DMA
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
static struct sparc_ebus_info {
|
||||||
|
struct ebus_dma_info info;
|
||||||
|
unsigned int addr;
|
||||||
|
unsigned int count;
|
||||||
|
int lock;
|
||||||
|
|
||||||
|
struct parport *port;
|
||||||
|
} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
|
||||||
|
|
||||||
|
static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS);
|
||||||
|
|
||||||
|
static inline int request_dma(unsigned int dmanr, const char *device_id)
|
||||||
|
{
|
||||||
|
if (dmanr >= PARPORT_PC_MAX_PORTS)
|
||||||
|
return -EINVAL;
|
||||||
|
if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0)
|
||||||
|
return -EBUSY;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void free_dma(unsigned int dmanr)
|
||||||
|
{
|
||||||
|
if (dmanr >= PARPORT_PC_MAX_PORTS) {
|
||||||
|
printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) {
|
||||||
|
printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void enable_dma(unsigned int dmanr)
|
||||||
|
{
|
||||||
|
ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
|
||||||
|
|
||||||
|
if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info,
|
||||||
|
sparc_ebus_dmas[dmanr].addr,
|
||||||
|
sparc_ebus_dmas[dmanr].count))
|
||||||
|
BUG();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void disable_dma(unsigned int dmanr)
|
||||||
|
{
|
||||||
|
ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void clear_dma_ff(unsigned int dmanr)
|
||||||
|
{
|
||||||
|
/* nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_dma_mode(unsigned int dmanr, char mode)
|
||||||
|
{
|
||||||
|
ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_dma_addr(unsigned int dmanr, unsigned int addr)
|
||||||
|
{
|
||||||
|
sparc_ebus_dmas[dmanr].addr = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_dma_count(unsigned int dmanr, unsigned int count)
|
||||||
|
{
|
||||||
|
sparc_ebus_dmas[dmanr].count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned int get_dma_residue(unsigned int dmanr)
|
||||||
|
{
|
||||||
|
return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match)
|
||||||
|
{
|
||||||
|
unsigned long base = op->resource[0].start;
|
||||||
|
unsigned long config = op->resource[1].start;
|
||||||
|
unsigned long d_base = op->resource[2].start;
|
||||||
|
unsigned long d_len;
|
||||||
|
struct device_node *parent;
|
||||||
|
struct parport *p;
|
||||||
|
int slot, err;
|
||||||
|
|
||||||
|
parent = op->node->parent;
|
||||||
|
if (!strcmp(parent->name, "dma")) {
|
||||||
|
p = parport_pc_probe_port(base, base + 0x400,
|
||||||
|
op->irqs[0], PARPORT_DMA_NOFIFO,
|
||||||
|
op->dev.parent->parent);
|
||||||
|
if (!p)
|
||||||
|
return -ENOMEM;
|
||||||
|
dev_set_drvdata(&op->dev, p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) {
|
||||||
|
if (!test_and_set_bit(slot, dma_slot_map))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
err = -ENODEV;
|
||||||
|
if (slot >= PARPORT_PC_MAX_PORTS)
|
||||||
|
goto out_err;
|
||||||
|
|
||||||
|
spin_lock_init(&sparc_ebus_dmas[slot].info.lock);
|
||||||
|
|
||||||
|
d_len = (op->resource[2].end - d_base) + 1UL;
|
||||||
|
sparc_ebus_dmas[slot].info.regs =
|
||||||
|
of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA");
|
||||||
|
|
||||||
|
if (!sparc_ebus_dmas[slot].info.regs)
|
||||||
|
goto out_clear_map;
|
||||||
|
|
||||||
|
sparc_ebus_dmas[slot].info.flags = 0;
|
||||||
|
sparc_ebus_dmas[slot].info.callback = NULL;
|
||||||
|
sparc_ebus_dmas[slot].info.client_cookie = NULL;
|
||||||
|
sparc_ebus_dmas[slot].info.irq = 0xdeadbeef;
|
||||||
|
strcpy(sparc_ebus_dmas[slot].info.name, "parport");
|
||||||
|
if (ebus_dma_register(&sparc_ebus_dmas[slot].info))
|
||||||
|
goto out_unmap_regs;
|
||||||
|
|
||||||
|
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1);
|
||||||
|
|
||||||
|
/* Configure IRQ to Push Pull, Level Low */
|
||||||
|
/* Enable ECP, set bit 2 of the CTR first */
|
||||||
|
outb(0x04, base + 0x02);
|
||||||
|
ns87303_modify(config, PCR,
|
||||||
|
PCR_EPP_ENABLE |
|
||||||
|
PCR_IRQ_ODRAIN,
|
||||||
|
PCR_ECP_ENABLE |
|
||||||
|
PCR_ECP_CLK_ENA |
|
||||||
|
PCR_IRQ_POLAR);
|
||||||
|
|
||||||
|
/* CTR bit 5 controls direction of port */
|
||||||
|
ns87303_modify(config, PTR,
|
||||||
|
0, PTR_LPT_REG_DIR);
|
||||||
|
|
||||||
|
p = parport_pc_probe_port(base, base + 0x400,
|
||||||
|
op->irqs[0],
|
||||||
|
slot,
|
||||||
|
op->dev.parent);
|
||||||
|
err = -ENOMEM;
|
||||||
|
if (!p)
|
||||||
|
goto out_disable_irq;
|
||||||
|
|
||||||
|
dev_set_drvdata(&op->dev, p);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out_disable_irq:
|
||||||
|
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
|
||||||
|
ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
|
||||||
|
|
||||||
|
out_unmap_regs:
|
||||||
|
of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len);
|
||||||
|
|
||||||
|
out_clear_map:
|
||||||
|
clear_bit(slot, dma_slot_map);
|
||||||
|
|
||||||
|
out_err:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __devexit ecpp_remove(struct of_device *op)
|
||||||
|
{
|
||||||
|
struct parport *p = dev_get_drvdata(&op->dev);
|
||||||
|
int slot = p->dma;
|
||||||
|
|
||||||
|
parport_pc_unregister_port(p);
|
||||||
|
|
||||||
|
if (slot != PARPORT_DMA_NOFIFO) {
|
||||||
|
unsigned long d_base = op->resource[2].start;
|
||||||
|
unsigned long d_len;
|
||||||
|
|
||||||
|
d_len = (op->resource[2].end - d_base) + 1UL;
|
||||||
|
|
||||||
|
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
|
||||||
|
ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
|
||||||
|
of_iounmap(&op->resource[2],
|
||||||
|
sparc_ebus_dmas[slot].info.regs,
|
||||||
|
d_len);
|
||||||
|
clear_bit(slot, dma_slot_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct of_device_id ecpp_match[] = {
|
||||||
|
{
|
||||||
|
.name = "ecpp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "parallel",
|
||||||
|
.compatible = "ecpp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "parallel",
|
||||||
|
.compatible = "ns87317-ecpp",
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct of_platform_driver ecpp_driver = {
|
||||||
|
.name = "ecpp",
|
||||||
|
.match_table = ecpp_match,
|
||||||
|
.probe = ecpp_probe,
|
||||||
|
.remove = __devexit_p(ecpp_remove),
|
||||||
|
};
|
||||||
|
|
||||||
|
static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
|
||||||
|
{
|
||||||
|
of_register_driver(&ecpp_driver, &of_bus_type);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !(_ASM_SPARC64_PARPORT_H */
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef _SPARC64_PIL_H
|
||||||
|
#define _SPARC64_PIL_H
|
||||||
|
|
||||||
|
/* To avoid some locking problems, we hard allocate certain PILs
|
||||||
|
* for SMP cross call messages that must do a etrap/rtrap.
|
||||||
|
*
|
||||||
|
* A local_irq_disable() does not block the cross call delivery, so
|
||||||
|
* when SMP locking is an issue we reschedule the event into a PIL
|
||||||
|
* interrupt which is blocked by local_irq_disable().
|
||||||
|
*
|
||||||
|
* In fact any XCALL which has to etrap/rtrap has a problem because
|
||||||
|
* it is difficult to prevent rtrap from running BH's, and that would
|
||||||
|
* need to be done if the XCALL arrived while %pil==15.
|
||||||
|
*/
|
||||||
|
#define PIL_SMP_CALL_FUNC 1
|
||||||
|
#define PIL_SMP_RECEIVE_SIGNAL 2
|
||||||
|
#define PIL_SMP_CAPTURE 3
|
||||||
|
#define PIL_SMP_CTX_NEW_VERSION 4
|
||||||
|
#define PIL_DEVICE_IRQ 5
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_PIL_H) */
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _SPARC64_REBOOT_H
|
||||||
|
#define _SPARC64_REBOOT_H
|
||||||
|
|
||||||
|
extern void machine_alt_power_off(void);
|
||||||
|
|
||||||
|
#endif /* _SPARC64_REBOOT_H */
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* rwsem-const.h: RW semaphore counter constants. */
|
||||||
|
#ifndef _SPARC64_RWSEM_CONST_H
|
||||||
|
#define _SPARC64_RWSEM_CONST_H
|
||||||
|
|
||||||
|
#define RWSEM_UNLOCKED_VALUE 0x00000000
|
||||||
|
#define RWSEM_ACTIVE_BIAS 0x00000001
|
||||||
|
#define RWSEM_ACTIVE_MASK 0x0000ffff
|
||||||
|
#define RWSEM_WAITING_BIAS 0xffff0000
|
||||||
|
#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
|
||||||
|
#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
|
||||||
|
|
||||||
|
#endif /* _SPARC64_RWSEM_CONST_H */
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* rwsem.h: R/W semaphores implemented using CAS
|
||||||
|
*
|
||||||
|
* Written by David S. Miller (davem@redhat.com), 2001.
|
||||||
|
* Derived from asm-i386/rwsem.h
|
||||||
|
*/
|
||||||
|
#ifndef _SPARC64_RWSEM_H
|
||||||
|
#define _SPARC64_RWSEM_H
|
||||||
|
|
||||||
|
#ifndef _LINUX_RWSEM_H
|
||||||
|
#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
|
#include <linux/list.h>
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
#include <asm/rwsem-const.h>
|
||||||
|
|
||||||
|
struct rwsem_waiter;
|
||||||
|
|
||||||
|
struct rw_semaphore {
|
||||||
|
signed int count;
|
||||||
|
spinlock_t wait_lock;
|
||||||
|
struct list_head wait_list;
|
||||||
|
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||||
|
struct lockdep_map dep_map;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||||
|
# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
|
||||||
|
#else
|
||||||
|
# define __RWSEM_DEP_MAP_INIT(lockname)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __RWSEM_INITIALIZER(name) \
|
||||||
|
{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \
|
||||||
|
__RWSEM_DEP_MAP_INIT(name) }
|
||||||
|
|
||||||
|
#define DECLARE_RWSEM(name) \
|
||||||
|
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
|
||||||
|
|
||||||
|
extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
|
||||||
|
struct lock_class_key *key);
|
||||||
|
|
||||||
|
#define init_rwsem(sem) \
|
||||||
|
do { \
|
||||||
|
static struct lock_class_key __key; \
|
||||||
|
\
|
||||||
|
__init_rwsem((sem), #sem, &__key); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
extern void __down_read(struct rw_semaphore *sem);
|
||||||
|
extern int __down_read_trylock(struct rw_semaphore *sem);
|
||||||
|
extern void __down_write(struct rw_semaphore *sem);
|
||||||
|
extern int __down_write_trylock(struct rw_semaphore *sem);
|
||||||
|
extern void __up_read(struct rw_semaphore *sem);
|
||||||
|
extern void __up_write(struct rw_semaphore *sem);
|
||||||
|
extern void __downgrade_write(struct rw_semaphore *sem);
|
||||||
|
|
||||||
|
static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
|
||||||
|
{
|
||||||
|
__down_write(sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
|
||||||
|
{
|
||||||
|
return atomic_add_return(delta, (atomic_t *)(&sem->count));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
|
||||||
|
{
|
||||||
|
atomic_add(delta, (atomic_t *)(&sem->count));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int rwsem_is_locked(struct rw_semaphore *sem)
|
||||||
|
{
|
||||||
|
return (sem->count != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
#endif /* _SPARC64_RWSEM_H */
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef _SPARC64_SCRATCHPAD_H
|
||||||
|
#define _SPARC64_SCRATCHPAD_H
|
||||||
|
|
||||||
|
/* Sun4v scratchpad registers, accessed via ASI_SCRATCHPAD. */
|
||||||
|
|
||||||
|
#define SCRATCHPAD_MMU_MISS 0x00 /* Shared with OBP - set by OBP */
|
||||||
|
#define SCRATCHPAD_CPUID 0x08 /* Shared with OBP - set by hypervisor */
|
||||||
|
#define SCRATCHPAD_UTSBREG1 0x10
|
||||||
|
#define SCRATCHPAD_UTSBREG2 0x18
|
||||||
|
/* 0x20 and 0x28, hypervisor only... */
|
||||||
|
#define SCRATCHPAD_UNUSED1 0x30
|
||||||
|
#define SCRATCHPAD_UNUSED2 0x38 /* Reserved for OBP */
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_SCRATCHPAD_H) */
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef _ASM_SECCOMP_H
|
||||||
|
|
||||||
|
#include <linux/thread_info.h> /* already defines TIF_32BIT */
|
||||||
|
|
||||||
|
#ifndef TIF_32BIT
|
||||||
|
#error "unexpected TIF_32BIT on sparc64"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <linux/unistd.h>
|
||||||
|
|
||||||
|
#define __NR_seccomp_read __NR_read
|
||||||
|
#define __NR_seccomp_write __NR_write
|
||||||
|
#define __NR_seccomp_exit __NR_exit
|
||||||
|
#define __NR_seccomp_sigreturn __NR_rt_sigreturn
|
||||||
|
|
||||||
|
#define __NR_seccomp_read_32 __NR_read
|
||||||
|
#define __NR_seccomp_write_32 __NR_write
|
||||||
|
#define __NR_seccomp_exit_32 __NR_exit
|
||||||
|
#define __NR_seccomp_sigreturn_32 __NR_sigreturn
|
||||||
|
|
||||||
|
#endif /* _ASM_SECCOMP_H */
|
|
@ -0,0 +1,82 @@
|
||||||
|
#ifndef _SPARC64_SFAFSR_H
|
||||||
|
#define _SPARC64_SFAFSR_H
|
||||||
|
|
||||||
|
#include <linux/const.h>
|
||||||
|
|
||||||
|
/* Spitfire Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */
|
||||||
|
|
||||||
|
#define SFAFSR_ME (_AC(1,UL) << SFAFSR_ME_SHIFT)
|
||||||
|
#define SFAFSR_ME_SHIFT 32
|
||||||
|
#define SFAFSR_PRIV (_AC(1,UL) << SFAFSR_PRIV_SHIFT)
|
||||||
|
#define SFAFSR_PRIV_SHIFT 31
|
||||||
|
#define SFAFSR_ISAP (_AC(1,UL) << SFAFSR_ISAP_SHIFT)
|
||||||
|
#define SFAFSR_ISAP_SHIFT 30
|
||||||
|
#define SFAFSR_ETP (_AC(1,UL) << SFAFSR_ETP_SHIFT)
|
||||||
|
#define SFAFSR_ETP_SHIFT 29
|
||||||
|
#define SFAFSR_IVUE (_AC(1,UL) << SFAFSR_IVUE_SHIFT)
|
||||||
|
#define SFAFSR_IVUE_SHIFT 28
|
||||||
|
#define SFAFSR_TO (_AC(1,UL) << SFAFSR_TO_SHIFT)
|
||||||
|
#define SFAFSR_TO_SHIFT 27
|
||||||
|
#define SFAFSR_BERR (_AC(1,UL) << SFAFSR_BERR_SHIFT)
|
||||||
|
#define SFAFSR_BERR_SHIFT 26
|
||||||
|
#define SFAFSR_LDP (_AC(1,UL) << SFAFSR_LDP_SHIFT)
|
||||||
|
#define SFAFSR_LDP_SHIFT 25
|
||||||
|
#define SFAFSR_CP (_AC(1,UL) << SFAFSR_CP_SHIFT)
|
||||||
|
#define SFAFSR_CP_SHIFT 24
|
||||||
|
#define SFAFSR_WP (_AC(1,UL) << SFAFSR_WP_SHIFT)
|
||||||
|
#define SFAFSR_WP_SHIFT 23
|
||||||
|
#define SFAFSR_EDP (_AC(1,UL) << SFAFSR_EDP_SHIFT)
|
||||||
|
#define SFAFSR_EDP_SHIFT 22
|
||||||
|
#define SFAFSR_UE (_AC(1,UL) << SFAFSR_UE_SHIFT)
|
||||||
|
#define SFAFSR_UE_SHIFT 21
|
||||||
|
#define SFAFSR_CE (_AC(1,UL) << SFAFSR_CE_SHIFT)
|
||||||
|
#define SFAFSR_CE_SHIFT 20
|
||||||
|
#define SFAFSR_ETS (_AC(0xf,UL) << SFAFSR_ETS_SHIFT)
|
||||||
|
#define SFAFSR_ETS_SHIFT 16
|
||||||
|
#define SFAFSR_PSYND (_AC(0xffff,UL) << SFAFSR_PSYND_SHIFT)
|
||||||
|
#define SFAFSR_PSYND_SHIFT 0
|
||||||
|
|
||||||
|
/* UDB Error Register, ASI=0x7f VA<63:0>=0x0(High),0x18(Low) for read
|
||||||
|
* ASI=0x77 VA<63:0>=0x0(High),0x18(Low) for write
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define UDBE_UE (_AC(1,UL) << 9)
|
||||||
|
#define UDBE_CE (_AC(1,UL) << 8)
|
||||||
|
#define UDBE_E_SYNDR (_AC(0xff,UL) << 0)
|
||||||
|
|
||||||
|
/* The trap handlers for asynchronous errors encode the AFSR and
|
||||||
|
* other pieces of information into a 64-bit argument for C code
|
||||||
|
* encoded as follows:
|
||||||
|
*
|
||||||
|
* -----------------------------------------------
|
||||||
|
* | UDB_H | UDB_L | TL>1 | TT | AFSR |
|
||||||
|
* -----------------------------------------------
|
||||||
|
* 63 54 53 44 42 41 33 32 0
|
||||||
|
*
|
||||||
|
* The AFAR is passed in unchanged.
|
||||||
|
*/
|
||||||
|
#define SFSTAT_UDBH_MASK (_AC(0x3ff,UL) << SFSTAT_UDBH_SHIFT)
|
||||||
|
#define SFSTAT_UDBH_SHIFT 54
|
||||||
|
#define SFSTAT_UDBL_MASK (_AC(0x3ff,UL) << SFSTAT_UDBH_SHIFT)
|
||||||
|
#define SFSTAT_UDBL_SHIFT 44
|
||||||
|
#define SFSTAT_TL_GT_ONE (_AC(1,UL) << SFSTAT_TL_GT_ONE_SHIFT)
|
||||||
|
#define SFSTAT_TL_GT_ONE_SHIFT 42
|
||||||
|
#define SFSTAT_TRAP_TYPE (_AC(0x1FF,UL) << SFSTAT_TRAP_TYPE_SHIFT)
|
||||||
|
#define SFSTAT_TRAP_TYPE_SHIFT 33
|
||||||
|
#define SFSTAT_AFSR_MASK (_AC(0x1ffffffff,UL) << SFSTAT_AFSR_SHIFT)
|
||||||
|
#define SFSTAT_AFSR_SHIFT 0
|
||||||
|
|
||||||
|
/* ESTATE Error Enable Register, ASI=0x4b VA<63:0>=0x0 */
|
||||||
|
#define ESTATE_ERR_CE 0x1 /* Correctable errors */
|
||||||
|
#define ESTATE_ERR_NCE 0x2 /* TO, BERR, LDP, ETP, EDP, WP, UE, IVUE */
|
||||||
|
#define ESTATE_ERR_ISAP 0x4 /* System address parity error */
|
||||||
|
#define ESTATE_ERR_ALL (ESTATE_ERR_CE | \
|
||||||
|
ESTATE_ERR_NCE | \
|
||||||
|
ESTATE_ERR_ISAP)
|
||||||
|
|
||||||
|
/* The various trap types that report using the above state. */
|
||||||
|
#define TRAP_TYPE_IAE 0x09 /* Instruction Access Error */
|
||||||
|
#define TRAP_TYPE_DAE 0x32 /* Data Access Error */
|
||||||
|
#define TRAP_TYPE_CEE 0x63 /* Correctable ECC Error */
|
||||||
|
|
||||||
|
#endif /* _SPARC64_SFAFSR_H */
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _SPARC64_SPARSEMEM_H
|
||||||
|
#define _SPARC64_SPARSEMEM_H
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
|
#define SECTION_SIZE_BITS 30
|
||||||
|
#define MAX_PHYSADDR_BITS 42
|
||||||
|
#define MAX_PHYSMEM_BITS 42
|
||||||
|
|
||||||
|
#endif /* !(__KERNEL__) */
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_SPARSEMEM_H) */
|
|
@ -0,0 +1,342 @@
|
||||||
|
/* spitfire.h: SpitFire/BlackBird/Cheetah inline MMU operations.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SPARC64_SPITFIRE_H
|
||||||
|
#define _SPARC64_SPITFIRE_H
|
||||||
|
|
||||||
|
#include <asm/asi.h>
|
||||||
|
|
||||||
|
/* The following register addresses are accessible via ASI_DMMU
|
||||||
|
* and ASI_IMMU, that is there is a distinct and unique copy of
|
||||||
|
* each these registers for each TLB.
|
||||||
|
*/
|
||||||
|
#define TSB_TAG_TARGET 0x0000000000000000 /* All chips */
|
||||||
|
#define TLB_SFSR 0x0000000000000018 /* All chips */
|
||||||
|
#define TSB_REG 0x0000000000000028 /* All chips */
|
||||||
|
#define TLB_TAG_ACCESS 0x0000000000000030 /* All chips */
|
||||||
|
#define VIRT_WATCHPOINT 0x0000000000000038 /* All chips */
|
||||||
|
#define PHYS_WATCHPOINT 0x0000000000000040 /* All chips */
|
||||||
|
#define TSB_EXTENSION_P 0x0000000000000048 /* Ultra-III and later */
|
||||||
|
#define TSB_EXTENSION_S 0x0000000000000050 /* Ultra-III and later, D-TLB only */
|
||||||
|
#define TSB_EXTENSION_N 0x0000000000000058 /* Ultra-III and later */
|
||||||
|
#define TLB_TAG_ACCESS_EXT 0x0000000000000060 /* Ultra-III+ and later */
|
||||||
|
|
||||||
|
/* These registers only exist as one entity, and are accessed
|
||||||
|
* via ASI_DMMU only.
|
||||||
|
*/
|
||||||
|
#define PRIMARY_CONTEXT 0x0000000000000008
|
||||||
|
#define SECONDARY_CONTEXT 0x0000000000000010
|
||||||
|
#define DMMU_SFAR 0x0000000000000020
|
||||||
|
#define VIRT_WATCHPOINT 0x0000000000000038
|
||||||
|
#define PHYS_WATCHPOINT 0x0000000000000040
|
||||||
|
|
||||||
|
#define SPITFIRE_HIGHEST_LOCKED_TLBENT (64 - 1)
|
||||||
|
#define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1)
|
||||||
|
|
||||||
|
#define L1DCACHE_SIZE 0x4000
|
||||||
|
|
||||||
|
#define SUN4V_CHIP_INVALID 0x00
|
||||||
|
#define SUN4V_CHIP_NIAGARA1 0x01
|
||||||
|
#define SUN4V_CHIP_NIAGARA2 0x02
|
||||||
|
#define SUN4V_CHIP_UNKNOWN 0xff
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
enum ultra_tlb_layout {
|
||||||
|
spitfire = 0,
|
||||||
|
cheetah = 1,
|
||||||
|
cheetah_plus = 2,
|
||||||
|
hypervisor = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern enum ultra_tlb_layout tlb_type;
|
||||||
|
|
||||||
|
extern int sun4v_chip_type;
|
||||||
|
|
||||||
|
extern int cheetah_pcache_forced_on;
|
||||||
|
extern void cheetah_enable_pcache(void);
|
||||||
|
|
||||||
|
#define sparc64_highest_locked_tlbent() \
|
||||||
|
(tlb_type == spitfire ? \
|
||||||
|
SPITFIRE_HIGHEST_LOCKED_TLBENT : \
|
||||||
|
CHEETAH_HIGHEST_LOCKED_TLBENT)
|
||||||
|
|
||||||
|
extern int num_kernel_image_mappings;
|
||||||
|
|
||||||
|
/* The data cache is write through, so this just invalidates the
|
||||||
|
* specified line.
|
||||||
|
*/
|
||||||
|
static inline void spitfire_put_dcache_tag(unsigned long addr, unsigned long tag)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (tag), "r" (addr), "i" (ASI_DCACHE_TAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The instruction cache lines are flushed with this, but note that
|
||||||
|
* this does not flush the pipeline. It is possible for a line to
|
||||||
|
* get flushed but stale instructions to still be in the pipeline,
|
||||||
|
* a flush instruction (to any address) is sufficient to handle
|
||||||
|
* this issue after the line is invalidated.
|
||||||
|
*/
|
||||||
|
static inline void spitfire_put_icache_tag(unsigned long addr, unsigned long tag)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (tag), "r" (addr), "i" (ASI_IC_TAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long spitfire_get_dtlb_data(int entry)
|
||||||
|
{
|
||||||
|
unsigned long data;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (data)
|
||||||
|
: "r" (entry << 3), "i" (ASI_DTLB_DATA_ACCESS));
|
||||||
|
|
||||||
|
/* Clear TTE diag bits. */
|
||||||
|
data &= ~0x0003fe0000000000UL;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long spitfire_get_dtlb_tag(int entry)
|
||||||
|
{
|
||||||
|
unsigned long tag;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (tag)
|
||||||
|
: "r" (entry << 3), "i" (ASI_DTLB_TAG_READ));
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void spitfire_put_dtlb_data(int entry, unsigned long data)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (data), "r" (entry << 3),
|
||||||
|
"i" (ASI_DTLB_DATA_ACCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long spitfire_get_itlb_data(int entry)
|
||||||
|
{
|
||||||
|
unsigned long data;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (data)
|
||||||
|
: "r" (entry << 3), "i" (ASI_ITLB_DATA_ACCESS));
|
||||||
|
|
||||||
|
/* Clear TTE diag bits. */
|
||||||
|
data &= ~0x0003fe0000000000UL;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long spitfire_get_itlb_tag(int entry)
|
||||||
|
{
|
||||||
|
unsigned long tag;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (tag)
|
||||||
|
: "r" (entry << 3), "i" (ASI_ITLB_TAG_READ));
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void spitfire_put_itlb_data(int entry, unsigned long data)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (data), "r" (entry << 3),
|
||||||
|
"i" (ASI_ITLB_DATA_ACCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void spitfire_flush_dtlb_nucleus_page(unsigned long page)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (page | 0x20), "i" (ASI_DMMU_DEMAP));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void spitfire_flush_itlb_nucleus_page(unsigned long page)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (page | 0x20), "i" (ASI_IMMU_DEMAP));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cheetah has "all non-locked" tlb flushes. */
|
||||||
|
static inline void cheetah_flush_dtlb_all(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (0x80), "i" (ASI_DMMU_DEMAP));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void cheetah_flush_itlb_all(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (0x80), "i" (ASI_IMMU_DEMAP));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cheetah has a 4-tlb layout so direct access is a bit different.
|
||||||
|
* The first two TLBs are fully assosciative, hold 16 entries, and are
|
||||||
|
* used only for locked and >8K sized translations. One exists for
|
||||||
|
* data accesses and one for instruction accesses.
|
||||||
|
*
|
||||||
|
* The third TLB is for data accesses to 8K non-locked translations, is
|
||||||
|
* 2 way assosciative, and holds 512 entries. The fourth TLB is for
|
||||||
|
* instruction accesses to 8K non-locked translations, is 2 way
|
||||||
|
* assosciative, and holds 128 entries.
|
||||||
|
*
|
||||||
|
* Cheetah has some bug where bogus data can be returned from
|
||||||
|
* ASI_{D,I}TLB_DATA_ACCESS loads, doing the load twice fixes
|
||||||
|
* the problem for me. -DaveM
|
||||||
|
*/
|
||||||
|
static inline unsigned long cheetah_get_ldtlb_data(int entry)
|
||||||
|
{
|
||||||
|
unsigned long data;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
||||||
|
"ldxa [%1] %2, %0"
|
||||||
|
: "=r" (data)
|
||||||
|
: "r" ((0 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_DTLB_DATA_ACCESS));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_litlb_data(int entry)
|
||||||
|
{
|
||||||
|
unsigned long data;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
||||||
|
"ldxa [%1] %2, %0"
|
||||||
|
: "=r" (data)
|
||||||
|
: "r" ((0 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_ITLB_DATA_ACCESS));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_ldtlb_tag(int entry)
|
||||||
|
{
|
||||||
|
unsigned long tag;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (tag)
|
||||||
|
: "r" ((0 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_DTLB_TAG_READ));
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_litlb_tag(int entry)
|
||||||
|
{
|
||||||
|
unsigned long tag;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (tag)
|
||||||
|
: "r" ((0 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_ITLB_TAG_READ));
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void cheetah_put_ldtlb_data(int entry, unsigned long data)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (data),
|
||||||
|
"r" ((0 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_DTLB_DATA_ACCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void cheetah_put_litlb_data(int entry, unsigned long data)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (data),
|
||||||
|
"r" ((0 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_ITLB_DATA_ACCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_dtlb_data(int entry, int tlb)
|
||||||
|
{
|
||||||
|
unsigned long data;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
||||||
|
"ldxa [%1] %2, %0"
|
||||||
|
: "=r" (data)
|
||||||
|
: "r" ((tlb << 16) | (entry << 3)), "i" (ASI_DTLB_DATA_ACCESS));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_dtlb_tag(int entry, int tlb)
|
||||||
|
{
|
||||||
|
unsigned long tag;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (tag)
|
||||||
|
: "r" ((tlb << 16) | (entry << 3)), "i" (ASI_DTLB_TAG_READ));
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void cheetah_put_dtlb_data(int entry, unsigned long data, int tlb)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (data),
|
||||||
|
"r" ((tlb << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_DTLB_DATA_ACCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_itlb_data(int entry)
|
||||||
|
{
|
||||||
|
unsigned long data;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
||||||
|
"ldxa [%1] %2, %0"
|
||||||
|
: "=r" (data)
|
||||||
|
: "r" ((2 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_ITLB_DATA_ACCESS));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long cheetah_get_itlb_tag(int entry)
|
||||||
|
{
|
||||||
|
unsigned long tag;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa [%1] %2, %0"
|
||||||
|
: "=r" (tag)
|
||||||
|
: "r" ((2 << 16) | (entry << 3)), "i" (ASI_ITLB_TAG_READ));
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void cheetah_put_itlb_data(int entry, unsigned long data)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
||||||
|
"membar #Sync"
|
||||||
|
: /* No outputs */
|
||||||
|
: "r" (data), "r" ((2 << 16) | (entry << 3)),
|
||||||
|
"i" (ASI_ITLB_DATA_ACCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !(__ASSEMBLY__) */
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_SPITFIRE_H) */
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef _SPARC64_SSTATE_H
|
||||||
|
#define _SPARC64_SSTATE_H
|
||||||
|
|
||||||
|
extern void sstate_booting(void);
|
||||||
|
extern void sstate_running(void);
|
||||||
|
extern void sstate_halt(void);
|
||||||
|
extern void sstate_poweroff(void);
|
||||||
|
extern void sstate_panic(void);
|
||||||
|
extern void sstate_reboot(void);
|
||||||
|
|
||||||
|
extern void sun4v_sstate_init(void);
|
||||||
|
|
||||||
|
#endif /* _SPARC64_SSTATE_H */
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _SPARC64_STACKTRACE_H
|
||||||
|
#define _SPARC64_STACKTRACE_H
|
||||||
|
|
||||||
|
extern void stack_trace_flush(void);
|
||||||
|
|
||||||
|
#endif /* _SPARC64_STACKTRACE_H */
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* starfire.h: Group all starfire specific code together.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000 Anton Blanchard (anton@samba.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SPARC64_STARFIRE_H
|
||||||
|
#define _SPARC64_STARFIRE_H
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
extern int this_is_starfire;
|
||||||
|
|
||||||
|
extern void check_if_starfire(void);
|
||||||
|
extern void starfire_cpu_setup(void);
|
||||||
|
extern int starfire_hard_smp_processor_id(void);
|
||||||
|
extern void starfire_hookup(int);
|
||||||
|
extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef _SPARC64_SYSCALLS_H
|
||||||
|
#define _SPARC64_SYSCALLS_H
|
||||||
|
|
||||||
|
struct pt_regs;
|
||||||
|
|
||||||
|
extern asmlinkage long sparc_do_fork(unsigned long clone_flags,
|
||||||
|
unsigned long stack_start,
|
||||||
|
struct pt_regs *regs,
|
||||||
|
unsigned long stack_size);
|
||||||
|
|
||||||
|
extern asmlinkage int sparc_execve(struct pt_regs *regs);
|
||||||
|
|
||||||
|
#endif /* _SPARC64_SYSCALLS_H */
|
|
@ -0,0 +1,283 @@
|
||||||
|
#ifndef _SPARC64_TSB_H
|
||||||
|
#define _SPARC64_TSB_H
|
||||||
|
|
||||||
|
/* The sparc64 TSB is similar to the powerpc hashtables. It's a
|
||||||
|
* power-of-2 sized table of TAG/PTE pairs. The cpu precomputes
|
||||||
|
* pointers into this table for 8K and 64K page sizes, and also a
|
||||||
|
* comparison TAG based upon the virtual address and context which
|
||||||
|
* faults.
|
||||||
|
*
|
||||||
|
* TLB miss trap handler software does the actual lookup via something
|
||||||
|
* of the form:
|
||||||
|
*
|
||||||
|
* ldxa [%g0] ASI_{D,I}MMU_TSB_8KB_PTR, %g1
|
||||||
|
* ldxa [%g0] ASI_{D,I}MMU, %g6
|
||||||
|
* sllx %g6, 22, %g6
|
||||||
|
* srlx %g6, 22, %g6
|
||||||
|
* ldda [%g1] ASI_NUCLEUS_QUAD_LDD, %g4
|
||||||
|
* cmp %g4, %g6
|
||||||
|
* bne,pn %xcc, tsb_miss_{d,i}tlb
|
||||||
|
* mov FAULT_CODE_{D,I}TLB, %g3
|
||||||
|
* stxa %g5, [%g0] ASI_{D,I}TLB_DATA_IN
|
||||||
|
* retry
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Each 16-byte slot of the TSB is the 8-byte tag and then the 8-byte
|
||||||
|
* PTE. The TAG is of the same layout as the TLB TAG TARGET mmu
|
||||||
|
* register which is:
|
||||||
|
*
|
||||||
|
* -------------------------------------------------
|
||||||
|
* | - | CONTEXT | - | VADDR bits 63:22 |
|
||||||
|
* -------------------------------------------------
|
||||||
|
* 63 61 60 48 47 42 41 0
|
||||||
|
*
|
||||||
|
* But actually, since we use per-mm TSB's, we zero out the CONTEXT
|
||||||
|
* field.
|
||||||
|
*
|
||||||
|
* Like the powerpc hashtables we need to use locking in order to
|
||||||
|
* synchronize while we update the entries. PTE updates need locking
|
||||||
|
* as well.
|
||||||
|
*
|
||||||
|
* We need to carefully choose a lock bits for the TSB entry. We
|
||||||
|
* choose to use bit 47 in the tag. Also, since we never map anything
|
||||||
|
* at page zero in context zero, we use zero as an invalid tag entry.
|
||||||
|
* When the lock bit is set, this forces a tag comparison failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TSB_TAG_LOCK_BIT 47
|
||||||
|
#define TSB_TAG_LOCK_HIGH (1 << (TSB_TAG_LOCK_BIT - 32))
|
||||||
|
|
||||||
|
#define TSB_TAG_INVALID_BIT 46
|
||||||
|
#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32))
|
||||||
|
|
||||||
|
#define TSB_MEMBAR membar #StoreStore
|
||||||
|
|
||||||
|
/* Some cpus support physical address quad loads. We want to use
|
||||||
|
* those if possible so we don't need to hard-lock the TSB mapping
|
||||||
|
* into the TLB. We encode some instruction patching in order to
|
||||||
|
* support this.
|
||||||
|
*
|
||||||
|
* The kernel TSB is locked into the TLB by virtue of being in the
|
||||||
|
* kernel image, so we don't play these games for swapper_tsb access.
|
||||||
|
*/
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
struct tsb_ldquad_phys_patch_entry {
|
||||||
|
unsigned int addr;
|
||||||
|
unsigned int sun4u_insn;
|
||||||
|
unsigned int sun4v_insn;
|
||||||
|
};
|
||||||
|
extern struct tsb_ldquad_phys_patch_entry __tsb_ldquad_phys_patch,
|
||||||
|
__tsb_ldquad_phys_patch_end;
|
||||||
|
|
||||||
|
struct tsb_phys_patch_entry {
|
||||||
|
unsigned int addr;
|
||||||
|
unsigned int insn;
|
||||||
|
};
|
||||||
|
extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
|
||||||
|
#endif
|
||||||
|
#define TSB_LOAD_QUAD(TSB, REG) \
|
||||||
|
661: ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG; \
|
||||||
|
.section .tsb_ldquad_phys_patch, "ax"; \
|
||||||
|
.word 661b; \
|
||||||
|
ldda [TSB] ASI_QUAD_LDD_PHYS, REG; \
|
||||||
|
ldda [TSB] ASI_QUAD_LDD_PHYS_4V, REG; \
|
||||||
|
.previous
|
||||||
|
|
||||||
|
#define TSB_LOAD_TAG_HIGH(TSB, REG) \
|
||||||
|
661: lduwa [TSB] ASI_N, REG; \
|
||||||
|
.section .tsb_phys_patch, "ax"; \
|
||||||
|
.word 661b; \
|
||||||
|
lduwa [TSB] ASI_PHYS_USE_EC, REG; \
|
||||||
|
.previous
|
||||||
|
|
||||||
|
#define TSB_LOAD_TAG(TSB, REG) \
|
||||||
|
661: ldxa [TSB] ASI_N, REG; \
|
||||||
|
.section .tsb_phys_patch, "ax"; \
|
||||||
|
.word 661b; \
|
||||||
|
ldxa [TSB] ASI_PHYS_USE_EC, REG; \
|
||||||
|
.previous
|
||||||
|
|
||||||
|
#define TSB_CAS_TAG_HIGH(TSB, REG1, REG2) \
|
||||||
|
661: casa [TSB] ASI_N, REG1, REG2; \
|
||||||
|
.section .tsb_phys_patch, "ax"; \
|
||||||
|
.word 661b; \
|
||||||
|
casa [TSB] ASI_PHYS_USE_EC, REG1, REG2; \
|
||||||
|
.previous
|
||||||
|
|
||||||
|
#define TSB_CAS_TAG(TSB, REG1, REG2) \
|
||||||
|
661: casxa [TSB] ASI_N, REG1, REG2; \
|
||||||
|
.section .tsb_phys_patch, "ax"; \
|
||||||
|
.word 661b; \
|
||||||
|
casxa [TSB] ASI_PHYS_USE_EC, REG1, REG2; \
|
||||||
|
.previous
|
||||||
|
|
||||||
|
#define TSB_STORE(ADDR, VAL) \
|
||||||
|
661: stxa VAL, [ADDR] ASI_N; \
|
||||||
|
.section .tsb_phys_patch, "ax"; \
|
||||||
|
.word 661b; \
|
||||||
|
stxa VAL, [ADDR] ASI_PHYS_USE_EC; \
|
||||||
|
.previous
|
||||||
|
|
||||||
|
#define TSB_LOCK_TAG(TSB, REG1, REG2) \
|
||||||
|
99: TSB_LOAD_TAG_HIGH(TSB, REG1); \
|
||||||
|
sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
|
||||||
|
andcc REG1, REG2, %g0; \
|
||||||
|
bne,pn %icc, 99b; \
|
||||||
|
nop; \
|
||||||
|
TSB_CAS_TAG_HIGH(TSB, REG1, REG2); \
|
||||||
|
cmp REG1, REG2; \
|
||||||
|
bne,pn %icc, 99b; \
|
||||||
|
nop; \
|
||||||
|
TSB_MEMBAR
|
||||||
|
|
||||||
|
#define TSB_WRITE(TSB, TTE, TAG) \
|
||||||
|
add TSB, 0x8, TSB; \
|
||||||
|
TSB_STORE(TSB, TTE); \
|
||||||
|
sub TSB, 0x8, TSB; \
|
||||||
|
TSB_MEMBAR; \
|
||||||
|
TSB_STORE(TSB, TAG);
|
||||||
|
|
||||||
|
#define KTSB_LOAD_QUAD(TSB, REG) \
|
||||||
|
ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG;
|
||||||
|
|
||||||
|
#define KTSB_STORE(ADDR, VAL) \
|
||||||
|
stxa VAL, [ADDR] ASI_N;
|
||||||
|
|
||||||
|
#define KTSB_LOCK_TAG(TSB, REG1, REG2) \
|
||||||
|
99: lduwa [TSB] ASI_N, REG1; \
|
||||||
|
sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
|
||||||
|
andcc REG1, REG2, %g0; \
|
||||||
|
bne,pn %icc, 99b; \
|
||||||
|
nop; \
|
||||||
|
casa [TSB] ASI_N, REG1, REG2;\
|
||||||
|
cmp REG1, REG2; \
|
||||||
|
bne,pn %icc, 99b; \
|
||||||
|
nop; \
|
||||||
|
TSB_MEMBAR
|
||||||
|
|
||||||
|
#define KTSB_WRITE(TSB, TTE, TAG) \
|
||||||
|
add TSB, 0x8, TSB; \
|
||||||
|
stxa TTE, [TSB] ASI_N; \
|
||||||
|
sub TSB, 0x8, TSB; \
|
||||||
|
TSB_MEMBAR; \
|
||||||
|
stxa TAG, [TSB] ASI_N;
|
||||||
|
|
||||||
|
/* Do a kernel page table walk. Leaves physical PTE pointer in
|
||||||
|
* REG1. Jumps to FAIL_LABEL on early page table walk termination.
|
||||||
|
* VADDR will not be clobbered, but REG2 will.
|
||||||
|
*/
|
||||||
|
#define KERN_PGTABLE_WALK(VADDR, REG1, REG2, FAIL_LABEL) \
|
||||||
|
sethi %hi(swapper_pg_dir), REG1; \
|
||||||
|
or REG1, %lo(swapper_pg_dir), REG1; \
|
||||||
|
sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
|
||||||
|
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
||||||
|
andn REG2, 0x3, REG2; \
|
||||||
|
lduw [REG1 + REG2], REG1; \
|
||||||
|
brz,pn REG1, FAIL_LABEL; \
|
||||||
|
sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
|
||||||
|
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
||||||
|
sllx REG1, 11, REG1; \
|
||||||
|
andn REG2, 0x3, REG2; \
|
||||||
|
lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
|
||||||
|
brz,pn REG1, FAIL_LABEL; \
|
||||||
|
sllx VADDR, 64 - PMD_SHIFT, REG2; \
|
||||||
|
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
||||||
|
sllx REG1, 11, REG1; \
|
||||||
|
andn REG2, 0x7, REG2; \
|
||||||
|
add REG1, REG2, REG1;
|
||||||
|
|
||||||
|
/* Do a user page table walk in MMU globals. Leaves physical PTE
|
||||||
|
* pointer in REG1. Jumps to FAIL_LABEL on early page table walk
|
||||||
|
* termination. Physical base of page tables is in PHYS_PGD which
|
||||||
|
* will not be modified.
|
||||||
|
*
|
||||||
|
* VADDR will not be clobbered, but REG1 and REG2 will.
|
||||||
|
*/
|
||||||
|
#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \
|
||||||
|
sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
|
||||||
|
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
||||||
|
andn REG2, 0x3, REG2; \
|
||||||
|
lduwa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \
|
||||||
|
brz,pn REG1, FAIL_LABEL; \
|
||||||
|
sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
|
||||||
|
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
||||||
|
sllx REG1, 11, REG1; \
|
||||||
|
andn REG2, 0x3, REG2; \
|
||||||
|
lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
|
||||||
|
brz,pn REG1, FAIL_LABEL; \
|
||||||
|
sllx VADDR, 64 - PMD_SHIFT, REG2; \
|
||||||
|
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
||||||
|
sllx REG1, 11, REG1; \
|
||||||
|
andn REG2, 0x7, REG2; \
|
||||||
|
add REG1, REG2, REG1;
|
||||||
|
|
||||||
|
/* Lookup a OBP mapping on VADDR in the prom_trans[] table at TL>0.
|
||||||
|
* If no entry is found, FAIL_LABEL will be branched to. On success
|
||||||
|
* the resulting PTE value will be left in REG1. VADDR is preserved
|
||||||
|
* by this routine.
|
||||||
|
*/
|
||||||
|
#define OBP_TRANS_LOOKUP(VADDR, REG1, REG2, REG3, FAIL_LABEL) \
|
||||||
|
sethi %hi(prom_trans), REG1; \
|
||||||
|
or REG1, %lo(prom_trans), REG1; \
|
||||||
|
97: ldx [REG1 + 0x00], REG2; \
|
||||||
|
brz,pn REG2, FAIL_LABEL; \
|
||||||
|
nop; \
|
||||||
|
ldx [REG1 + 0x08], REG3; \
|
||||||
|
add REG2, REG3, REG3; \
|
||||||
|
cmp REG2, VADDR; \
|
||||||
|
bgu,pt %xcc, 98f; \
|
||||||
|
cmp VADDR, REG3; \
|
||||||
|
bgeu,pt %xcc, 98f; \
|
||||||
|
ldx [REG1 + 0x10], REG3; \
|
||||||
|
sub VADDR, REG2, REG2; \
|
||||||
|
ba,pt %xcc, 99f; \
|
||||||
|
add REG3, REG2, REG1; \
|
||||||
|
98: ba,pt %xcc, 97b; \
|
||||||
|
add REG1, (3 * 8), REG1; \
|
||||||
|
99:
|
||||||
|
|
||||||
|
/* We use a 32K TSB for the whole kernel, this allows to
|
||||||
|
* handle about 16MB of modules and vmalloc mappings without
|
||||||
|
* incurring many hash conflicts.
|
||||||
|
*/
|
||||||
|
#define KERNEL_TSB_SIZE_BYTES (32 * 1024)
|
||||||
|
#define KERNEL_TSB_NENTRIES \
|
||||||
|
(KERNEL_TSB_SIZE_BYTES / 16)
|
||||||
|
#define KERNEL_TSB4M_NENTRIES 4096
|
||||||
|
|
||||||
|
/* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
|
||||||
|
* on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries
|
||||||
|
* and the found TTE will be left in REG1. REG3 and REG4 must
|
||||||
|
* be an even/odd pair of registers.
|
||||||
|
*
|
||||||
|
* VADDR and TAG will be preserved and not clobbered by this macro.
|
||||||
|
*/
|
||||||
|
#define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
|
||||||
|
sethi %hi(swapper_tsb), REG1; \
|
||||||
|
or REG1, %lo(swapper_tsb), REG1; \
|
||||||
|
srlx VADDR, PAGE_SHIFT, REG2; \
|
||||||
|
and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
|
||||||
|
sllx REG2, 4, REG2; \
|
||||||
|
add REG1, REG2, REG2; \
|
||||||
|
KTSB_LOAD_QUAD(REG2, REG3); \
|
||||||
|
cmp REG3, TAG; \
|
||||||
|
be,a,pt %xcc, OK_LABEL; \
|
||||||
|
mov REG4, REG1;
|
||||||
|
|
||||||
|
#ifndef CONFIG_DEBUG_PAGEALLOC
|
||||||
|
/* This version uses a trick, the TAG is already (VADDR >> 22) so
|
||||||
|
* we can make use of that for the index computation.
|
||||||
|
*/
|
||||||
|
#define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
|
||||||
|
sethi %hi(swapper_4m_tsb), REG1; \
|
||||||
|
or REG1, %lo(swapper_4m_tsb), REG1; \
|
||||||
|
and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
|
||||||
|
sllx REG2, 4, REG2; \
|
||||||
|
add REG1, REG2, REG2; \
|
||||||
|
KTSB_LOAD_QUAD(REG2, REG3); \
|
||||||
|
cmp REG3, TAG; \
|
||||||
|
be,a,pt %xcc, OK_LABEL; \
|
||||||
|
mov REG4, REG1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_TSB_H) */
|
|
@ -0,0 +1,658 @@
|
||||||
|
#ifndef _SPARC64_TTABLE_H
|
||||||
|
#define _SPARC64_TTABLE_H
|
||||||
|
|
||||||
|
#include <asm/utrap.h>
|
||||||
|
|
||||||
|
#ifdef __ASSEMBLY__
|
||||||
|
#include <asm/thread_info.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;
|
||||||
|
|
||||||
|
/* We need a "cleaned" instruction... */
|
||||||
|
#define CLEAN_WINDOW \
|
||||||
|
rdpr %cleanwin, %l0; add %l0, 1, %l0; \
|
||||||
|
wrpr %l0, 0x0, %cleanwin; \
|
||||||
|
clr %o0; clr %o1; clr %o2; clr %o3; \
|
||||||
|
clr %o4; clr %o5; clr %o6; clr %o7; \
|
||||||
|
clr %l0; clr %l1; clr %l2; clr %l3; \
|
||||||
|
clr %l4; clr %l5; clr %l6; clr %l7; \
|
||||||
|
retry; \
|
||||||
|
nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
|
||||||
|
|
||||||
|
#define TRAP(routine) \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, etrap; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
call routine; \
|
||||||
|
add %sp, PTREGS_OFF, %o0; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
nop; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define TRAP_7INSNS(routine) \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, etrap; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
call routine; \
|
||||||
|
add %sp, PTREGS_OFF, %o0; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define TRAP_SAVEFPU(routine) \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, do_fptrap; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
call routine; \
|
||||||
|
add %sp, PTREGS_OFF, %o0; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
nop; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define TRAP_NOSAVE(routine) \
|
||||||
|
ba,pt %xcc, routine; \
|
||||||
|
nop; \
|
||||||
|
nop; nop; nop; nop; nop; nop;
|
||||||
|
|
||||||
|
#define TRAP_NOSAVE_7INSNS(routine) \
|
||||||
|
ba,pt %xcc, routine; \
|
||||||
|
nop; \
|
||||||
|
nop; nop; nop; nop; nop;
|
||||||
|
|
||||||
|
#define TRAPTL1(routine) \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, etraptl1; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
call routine; \
|
||||||
|
add %sp, PTREGS_OFF, %o0; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
nop; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define TRAP_ARG(routine, arg) \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, etrap; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
add %sp, PTREGS_OFF, %o0; \
|
||||||
|
call routine; \
|
||||||
|
mov arg, %o1; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define TRAPTL1_ARG(routine, arg) \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, etraptl1; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
add %sp, PTREGS_OFF, %o0; \
|
||||||
|
call routine; \
|
||||||
|
mov arg, %o1; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define SYSCALL_TRAP(routine, systbl) \
|
||||||
|
rdpr %pil, %g2; \
|
||||||
|
mov TSTATE_SYSCALL, %g3; \
|
||||||
|
sethi %hi(109f), %g7; \
|
||||||
|
ba,pt %xcc, etrap_syscall; \
|
||||||
|
109: or %g7, %lo(109b), %g7; \
|
||||||
|
sethi %hi(systbl), %l7; \
|
||||||
|
ba,pt %xcc, routine; \
|
||||||
|
or %l7, %lo(systbl), %l7;
|
||||||
|
|
||||||
|
#define TRAP_UTRAP(handler,lvl) \
|
||||||
|
mov handler, %g3; \
|
||||||
|
ba,pt %xcc, utrap_trap; \
|
||||||
|
mov lvl, %g4; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
#define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)
|
||||||
|
#else
|
||||||
|
#define LINUX_32BIT_SYSCALL_TRAP BTRAP(0x110)
|
||||||
|
#endif
|
||||||
|
#define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)
|
||||||
|
#define GETCC_TRAP TRAP(getcc)
|
||||||
|
#define SETCC_TRAP TRAP(setcc)
|
||||||
|
#define BREAKPOINT_TRAP TRAP(breakpoint_trap)
|
||||||
|
|
||||||
|
#ifdef CONFIG_TRACE_IRQFLAGS
|
||||||
|
|
||||||
|
#define TRAP_IRQ(routine, level) \
|
||||||
|
rdpr %pil, %g2; \
|
||||||
|
wrpr %g0, 15, %pil; \
|
||||||
|
sethi %hi(1f-4), %g7; \
|
||||||
|
ba,pt %xcc, etrap_irq; \
|
||||||
|
or %g7, %lo(1f-4), %g7; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
.subsection 2; \
|
||||||
|
1: call trace_hardirqs_off; \
|
||||||
|
nop; \
|
||||||
|
mov level, %o0; \
|
||||||
|
call routine; \
|
||||||
|
add %sp, PTREGS_OFF, %o1; \
|
||||||
|
ba,a,pt %xcc, rtrap_irq; \
|
||||||
|
.previous;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define TRAP_IRQ(routine, level) \
|
||||||
|
rdpr %pil, %g2; \
|
||||||
|
wrpr %g0, 15, %pil; \
|
||||||
|
ba,pt %xcc, etrap_irq; \
|
||||||
|
rd %pc, %g7; \
|
||||||
|
mov level, %o0; \
|
||||||
|
call routine; \
|
||||||
|
add %sp, PTREGS_OFF, %o1; \
|
||||||
|
ba,a,pt %xcc, rtrap_irq;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
|
||||||
|
|
||||||
|
#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
|
||||||
|
|
||||||
|
#define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)
|
||||||
|
|
||||||
|
#define FLUSH_WINDOW_TRAP \
|
||||||
|
ba,pt %xcc, etrap; \
|
||||||
|
rd %pc, %g7; \
|
||||||
|
flushw; \
|
||||||
|
ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1; \
|
||||||
|
add %l1, 4, %l2; \
|
||||||
|
stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \
|
||||||
|
ba,pt %xcc, rtrap; \
|
||||||
|
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC];
|
||||||
|
|
||||||
|
#ifdef CONFIG_KPROBES
|
||||||
|
#define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)
|
||||||
|
#else
|
||||||
|
#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_KGDB
|
||||||
|
#define KGDB_TRAP(lvl) TRAP_IRQ(kgdb_trap, lvl)
|
||||||
|
#else
|
||||||
|
#define KGDB_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SUN4V_ITSB_MISS \
|
||||||
|
ldxa [%g0] ASI_SCRATCHPAD, %g2; \
|
||||||
|
ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \
|
||||||
|
ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5; \
|
||||||
|
srlx %g4, 22, %g6; \
|
||||||
|
ba,pt %xcc, sun4v_itsb_miss; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
#define SUN4V_DTSB_MISS \
|
||||||
|
ldxa [%g0] ASI_SCRATCHPAD, %g2; \
|
||||||
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \
|
||||||
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \
|
||||||
|
srlx %g4, 22, %g6; \
|
||||||
|
ba,pt %xcc, sun4v_dtsb_miss; \
|
||||||
|
nop; \
|
||||||
|
nop; \
|
||||||
|
nop;
|
||||||
|
|
||||||
|
/* Before touching these macros, you owe it to yourself to go and
|
||||||
|
* see how arch/sparc64/kernel/winfixup.S works... -DaveM
|
||||||
|
*
|
||||||
|
* For the user cases we used to use the %asi register, but
|
||||||
|
* it turns out that the "wr xxx, %asi" costs ~5 cycles, so
|
||||||
|
* now we use immediate ASI loads and stores instead. Kudos
|
||||||
|
* to Greg Onufer for pointing out this performance anomaly.
|
||||||
|
*
|
||||||
|
* Further note that we cannot use the g2, g4, g5, and g7 alternate
|
||||||
|
* globals in the spill routines, check out the save instruction in
|
||||||
|
* arch/sparc64/kernel/etrap.S to see what I mean about g2, and
|
||||||
|
* g4/g5 are the globals which are preserved by etrap processing
|
||||||
|
* for the caller of it. The g7 register is the return pc for
|
||||||
|
* etrap. Finally, g6 is the current thread register so we cannot
|
||||||
|
* us it in the spill handlers either. Most of these rules do not
|
||||||
|
* apply to fill processing, only g6 is not usable.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Normal kernel spill */
|
||||||
|
#define SPILL_0_NORMAL \
|
||||||
|
stx %l0, [%sp + STACK_BIAS + 0x00]; \
|
||||||
|
stx %l1, [%sp + STACK_BIAS + 0x08]; \
|
||||||
|
stx %l2, [%sp + STACK_BIAS + 0x10]; \
|
||||||
|
stx %l3, [%sp + STACK_BIAS + 0x18]; \
|
||||||
|
stx %l4, [%sp + STACK_BIAS + 0x20]; \
|
||||||
|
stx %l5, [%sp + STACK_BIAS + 0x28]; \
|
||||||
|
stx %l6, [%sp + STACK_BIAS + 0x30]; \
|
||||||
|
stx %l7, [%sp + STACK_BIAS + 0x38]; \
|
||||||
|
stx %i0, [%sp + STACK_BIAS + 0x40]; \
|
||||||
|
stx %i1, [%sp + STACK_BIAS + 0x48]; \
|
||||||
|
stx %i2, [%sp + STACK_BIAS + 0x50]; \
|
||||||
|
stx %i3, [%sp + STACK_BIAS + 0x58]; \
|
||||||
|
stx %i4, [%sp + STACK_BIAS + 0x60]; \
|
||||||
|
stx %i5, [%sp + STACK_BIAS + 0x68]; \
|
||||||
|
stx %i6, [%sp + STACK_BIAS + 0x70]; \
|
||||||
|
stx %i7, [%sp + STACK_BIAS + 0x78]; \
|
||||||
|
saved; retry; nop; nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop; nop; nop; nop; nop;
|
||||||
|
|
||||||
|
#define SPILL_0_NORMAL_ETRAP \
|
||||||
|
etrap_kernel_spill: \
|
||||||
|
stx %l0, [%sp + STACK_BIAS + 0x00]; \
|
||||||
|
stx %l1, [%sp + STACK_BIAS + 0x08]; \
|
||||||
|
stx %l2, [%sp + STACK_BIAS + 0x10]; \
|
||||||
|
stx %l3, [%sp + STACK_BIAS + 0x18]; \
|
||||||
|
stx %l4, [%sp + STACK_BIAS + 0x20]; \
|
||||||
|
stx %l5, [%sp + STACK_BIAS + 0x28]; \
|
||||||
|
stx %l6, [%sp + STACK_BIAS + 0x30]; \
|
||||||
|
stx %l7, [%sp + STACK_BIAS + 0x38]; \
|
||||||
|
stx %i0, [%sp + STACK_BIAS + 0x40]; \
|
||||||
|
stx %i1, [%sp + STACK_BIAS + 0x48]; \
|
||||||
|
stx %i2, [%sp + STACK_BIAS + 0x50]; \
|
||||||
|
stx %i3, [%sp + STACK_BIAS + 0x58]; \
|
||||||
|
stx %i4, [%sp + STACK_BIAS + 0x60]; \
|
||||||
|
stx %i5, [%sp + STACK_BIAS + 0x68]; \
|
||||||
|
stx %i6, [%sp + STACK_BIAS + 0x70]; \
|
||||||
|
stx %i7, [%sp + STACK_BIAS + 0x78]; \
|
||||||
|
saved; \
|
||||||
|
sub %g1, 2, %g1; \
|
||||||
|
ba,pt %xcc, etrap_save; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
nop; nop; nop; nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop;
|
||||||
|
|
||||||
|
/* Normal 64bit spill */
|
||||||
|
#define SPILL_1_GENERIC(ASI) \
|
||||||
|
add %sp, STACK_BIAS + 0x00, %g1; \
|
||||||
|
stxa %l0, [%g1 + %g0] ASI; \
|
||||||
|
mov 0x08, %g3; \
|
||||||
|
stxa %l1, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %l2, [%g1 + %g0] ASI; \
|
||||||
|
stxa %l3, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %l4, [%g1 + %g0] ASI; \
|
||||||
|
stxa %l5, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %l6, [%g1 + %g0] ASI; \
|
||||||
|
stxa %l7, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %i0, [%g1 + %g0] ASI; \
|
||||||
|
stxa %i1, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %i2, [%g1 + %g0] ASI; \
|
||||||
|
stxa %i3, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %i4, [%g1 + %g0] ASI; \
|
||||||
|
stxa %i5, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
stxa %i6, [%g1 + %g0] ASI; \
|
||||||
|
stxa %i7, [%g1 + %g3] ASI; \
|
||||||
|
saved; \
|
||||||
|
retry; nop; nop; \
|
||||||
|
b,a,pt %xcc, spill_fixup_dax; \
|
||||||
|
b,a,pt %xcc, spill_fixup_mna; \
|
||||||
|
b,a,pt %xcc, spill_fixup;
|
||||||
|
|
||||||
|
#define SPILL_1_GENERIC_ETRAP \
|
||||||
|
etrap_user_spill_64bit: \
|
||||||
|
stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \
|
||||||
|
stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \
|
||||||
|
stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \
|
||||||
|
stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \
|
||||||
|
stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \
|
||||||
|
stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \
|
||||||
|
stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \
|
||||||
|
stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \
|
||||||
|
stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \
|
||||||
|
stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \
|
||||||
|
stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \
|
||||||
|
stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \
|
||||||
|
stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \
|
||||||
|
stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \
|
||||||
|
stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \
|
||||||
|
stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \
|
||||||
|
saved; \
|
||||||
|
sub %g1, 2, %g1; \
|
||||||
|
ba,pt %xcc, etrap_save; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop; \
|
||||||
|
ba,a,pt %xcc, etrap_spill_fixup_64bit; \
|
||||||
|
ba,a,pt %xcc, etrap_spill_fixup_64bit; \
|
||||||
|
ba,a,pt %xcc, etrap_spill_fixup_64bit;
|
||||||
|
|
||||||
|
#define SPILL_1_GENERIC_ETRAP_FIXUP \
|
||||||
|
etrap_spill_fixup_64bit: \
|
||||||
|
ldub [%g6 + TI_WSAVED], %g1; \
|
||||||
|
sll %g1, 3, %g3; \
|
||||||
|
add %g6, %g3, %g3; \
|
||||||
|
stx %sp, [%g3 + TI_RWIN_SPTRS]; \
|
||||||
|
sll %g1, 7, %g3; \
|
||||||
|
add %g6, %g3, %g3; \
|
||||||
|
stx %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
|
||||||
|
stx %l1, [%g3 + TI_REG_WINDOW + 0x08]; \
|
||||||
|
stx %l2, [%g3 + TI_REG_WINDOW + 0x10]; \
|
||||||
|
stx %l3, [%g3 + TI_REG_WINDOW + 0x18]; \
|
||||||
|
stx %l4, [%g3 + TI_REG_WINDOW + 0x20]; \
|
||||||
|
stx %l5, [%g3 + TI_REG_WINDOW + 0x28]; \
|
||||||
|
stx %l6, [%g3 + TI_REG_WINDOW + 0x30]; \
|
||||||
|
stx %l7, [%g3 + TI_REG_WINDOW + 0x38]; \
|
||||||
|
stx %i0, [%g3 + TI_REG_WINDOW + 0x40]; \
|
||||||
|
stx %i1, [%g3 + TI_REG_WINDOW + 0x48]; \
|
||||||
|
stx %i2, [%g3 + TI_REG_WINDOW + 0x50]; \
|
||||||
|
stx %i3, [%g3 + TI_REG_WINDOW + 0x58]; \
|
||||||
|
stx %i4, [%g3 + TI_REG_WINDOW + 0x60]; \
|
||||||
|
stx %i5, [%g3 + TI_REG_WINDOW + 0x68]; \
|
||||||
|
stx %i6, [%g3 + TI_REG_WINDOW + 0x70]; \
|
||||||
|
stx %i7, [%g3 + TI_REG_WINDOW + 0x78]; \
|
||||||
|
add %g1, 1, %g1; \
|
||||||
|
stb %g1, [%g6 + TI_WSAVED]; \
|
||||||
|
saved; \
|
||||||
|
rdpr %cwp, %g1; \
|
||||||
|
sub %g1, 2, %g1; \
|
||||||
|
ba,pt %xcc, etrap_save; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
nop; nop; nop
|
||||||
|
|
||||||
|
/* Normal 32bit spill */
|
||||||
|
#define SPILL_2_GENERIC(ASI) \
|
||||||
|
srl %sp, 0, %sp; \
|
||||||
|
stwa %l0, [%sp + %g0] ASI; \
|
||||||
|
mov 0x04, %g3; \
|
||||||
|
stwa %l1, [%sp + %g3] ASI; \
|
||||||
|
add %sp, 0x08, %g1; \
|
||||||
|
stwa %l2, [%g1 + %g0] ASI; \
|
||||||
|
stwa %l3, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x08, %g1; \
|
||||||
|
stwa %l4, [%g1 + %g0] ASI; \
|
||||||
|
stwa %l5, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x08, %g1; \
|
||||||
|
stwa %l6, [%g1 + %g0] ASI; \
|
||||||
|
stwa %l7, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x08, %g1; \
|
||||||
|
stwa %i0, [%g1 + %g0] ASI; \
|
||||||
|
stwa %i1, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x08, %g1; \
|
||||||
|
stwa %i2, [%g1 + %g0] ASI; \
|
||||||
|
stwa %i3, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x08, %g1; \
|
||||||
|
stwa %i4, [%g1 + %g0] ASI; \
|
||||||
|
stwa %i5, [%g1 + %g3] ASI; \
|
||||||
|
add %g1, 0x08, %g1; \
|
||||||
|
stwa %i6, [%g1 + %g0] ASI; \
|
||||||
|
stwa %i7, [%g1 + %g3] ASI; \
|
||||||
|
saved; \
|
||||||
|
retry; nop; nop; \
|
||||||
|
b,a,pt %xcc, spill_fixup_dax; \
|
||||||
|
b,a,pt %xcc, spill_fixup_mna; \
|
||||||
|
b,a,pt %xcc, spill_fixup;
|
||||||
|
|
||||||
|
#define SPILL_2_GENERIC_ETRAP \
|
||||||
|
etrap_user_spill_32bit: \
|
||||||
|
srl %sp, 0, %sp; \
|
||||||
|
stwa %l0, [%sp + 0x00] %asi; \
|
||||||
|
stwa %l1, [%sp + 0x04] %asi; \
|
||||||
|
stwa %l2, [%sp + 0x08] %asi; \
|
||||||
|
stwa %l3, [%sp + 0x0c] %asi; \
|
||||||
|
stwa %l4, [%sp + 0x10] %asi; \
|
||||||
|
stwa %l5, [%sp + 0x14] %asi; \
|
||||||
|
stwa %l6, [%sp + 0x18] %asi; \
|
||||||
|
stwa %l7, [%sp + 0x1c] %asi; \
|
||||||
|
stwa %i0, [%sp + 0x20] %asi; \
|
||||||
|
stwa %i1, [%sp + 0x24] %asi; \
|
||||||
|
stwa %i2, [%sp + 0x28] %asi; \
|
||||||
|
stwa %i3, [%sp + 0x2c] %asi; \
|
||||||
|
stwa %i4, [%sp + 0x30] %asi; \
|
||||||
|
stwa %i5, [%sp + 0x34] %asi; \
|
||||||
|
stwa %i6, [%sp + 0x38] %asi; \
|
||||||
|
stwa %i7, [%sp + 0x3c] %asi; \
|
||||||
|
saved; \
|
||||||
|
sub %g1, 2, %g1; \
|
||||||
|
ba,pt %xcc, etrap_save; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop; \
|
||||||
|
ba,a,pt %xcc, etrap_spill_fixup_32bit; \
|
||||||
|
ba,a,pt %xcc, etrap_spill_fixup_32bit; \
|
||||||
|
ba,a,pt %xcc, etrap_spill_fixup_32bit;
|
||||||
|
|
||||||
|
#define SPILL_2_GENERIC_ETRAP_FIXUP \
|
||||||
|
etrap_spill_fixup_32bit: \
|
||||||
|
ldub [%g6 + TI_WSAVED], %g1; \
|
||||||
|
sll %g1, 3, %g3; \
|
||||||
|
add %g6, %g3, %g3; \
|
||||||
|
stx %sp, [%g3 + TI_RWIN_SPTRS]; \
|
||||||
|
sll %g1, 7, %g3; \
|
||||||
|
add %g6, %g3, %g3; \
|
||||||
|
stw %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
|
||||||
|
stw %l1, [%g3 + TI_REG_WINDOW + 0x04]; \
|
||||||
|
stw %l2, [%g3 + TI_REG_WINDOW + 0x08]; \
|
||||||
|
stw %l3, [%g3 + TI_REG_WINDOW + 0x0c]; \
|
||||||
|
stw %l4, [%g3 + TI_REG_WINDOW + 0x10]; \
|
||||||
|
stw %l5, [%g3 + TI_REG_WINDOW + 0x14]; \
|
||||||
|
stw %l6, [%g3 + TI_REG_WINDOW + 0x18]; \
|
||||||
|
stw %l7, [%g3 + TI_REG_WINDOW + 0x1c]; \
|
||||||
|
stw %i0, [%g3 + TI_REG_WINDOW + 0x20]; \
|
||||||
|
stw %i1, [%g3 + TI_REG_WINDOW + 0x24]; \
|
||||||
|
stw %i2, [%g3 + TI_REG_WINDOW + 0x28]; \
|
||||||
|
stw %i3, [%g3 + TI_REG_WINDOW + 0x2c]; \
|
||||||
|
stw %i4, [%g3 + TI_REG_WINDOW + 0x30]; \
|
||||||
|
stw %i5, [%g3 + TI_REG_WINDOW + 0x34]; \
|
||||||
|
stw %i6, [%g3 + TI_REG_WINDOW + 0x38]; \
|
||||||
|
stw %i7, [%g3 + TI_REG_WINDOW + 0x3c]; \
|
||||||
|
add %g1, 1, %g1; \
|
||||||
|
stb %g1, [%g6 + TI_WSAVED]; \
|
||||||
|
saved; \
|
||||||
|
rdpr %cwp, %g1; \
|
||||||
|
sub %g1, 2, %g1; \
|
||||||
|
ba,pt %xcc, etrap_save; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
nop; nop; nop
|
||||||
|
|
||||||
|
#define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
|
||||||
|
#define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
|
||||||
|
#define SPILL_3_NORMAL SPILL_0_NORMAL
|
||||||
|
#define SPILL_4_NORMAL SPILL_0_NORMAL
|
||||||
|
#define SPILL_5_NORMAL SPILL_0_NORMAL
|
||||||
|
#define SPILL_6_NORMAL SPILL_0_NORMAL
|
||||||
|
#define SPILL_7_NORMAL SPILL_0_NORMAL
|
||||||
|
|
||||||
|
#define SPILL_0_OTHER SPILL_0_NORMAL
|
||||||
|
#define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS)
|
||||||
|
#define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS)
|
||||||
|
#define SPILL_3_OTHER SPILL_3_NORMAL
|
||||||
|
#define SPILL_4_OTHER SPILL_4_NORMAL
|
||||||
|
#define SPILL_5_OTHER SPILL_5_NORMAL
|
||||||
|
#define SPILL_6_OTHER SPILL_6_NORMAL
|
||||||
|
#define SPILL_7_OTHER SPILL_7_NORMAL
|
||||||
|
|
||||||
|
/* Normal kernel fill */
|
||||||
|
#define FILL_0_NORMAL \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x00], %l0; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x08], %l1; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x10], %l2; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x18], %l3; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x20], %l4; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x28], %l5; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x30], %l6; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x38], %l7; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x40], %i0; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x48], %i1; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x50], %i2; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x58], %i3; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x60], %i4; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x68], %i5; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x70], %i6; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x78], %i7; \
|
||||||
|
restored; retry; nop; nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop; nop; nop; nop; nop;
|
||||||
|
|
||||||
|
#define FILL_0_NORMAL_RTRAP \
|
||||||
|
kern_rtt_fill: \
|
||||||
|
rdpr %cwp, %g1; \
|
||||||
|
sub %g1, 1, %g1; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x00], %l0; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x08], %l1; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x10], %l2; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x18], %l3; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x20], %l4; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x28], %l5; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x30], %l6; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x38], %l7; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x40], %i0; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x48], %i1; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x50], %i2; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x58], %i3; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x60], %i4; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x68], %i5; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x70], %i6; \
|
||||||
|
ldx [%sp + STACK_BIAS + 0x78], %i7; \
|
||||||
|
restored; \
|
||||||
|
add %g1, 1, %g1; \
|
||||||
|
ba,pt %xcc, kern_rtt_restore; \
|
||||||
|
wrpr %g1, %cwp; \
|
||||||
|
nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop;
|
||||||
|
|
||||||
|
|
||||||
|
/* Normal 64bit fill */
|
||||||
|
#define FILL_1_GENERIC(ASI) \
|
||||||
|
add %sp, STACK_BIAS + 0x00, %g1; \
|
||||||
|
ldxa [%g1 + %g0] ASI, %l0; \
|
||||||
|
mov 0x08, %g2; \
|
||||||
|
mov 0x10, %g3; \
|
||||||
|
ldxa [%g1 + %g2] ASI, %l1; \
|
||||||
|
mov 0x18, %g5; \
|
||||||
|
ldxa [%g1 + %g3] ASI, %l2; \
|
||||||
|
ldxa [%g1 + %g5] ASI, %l3; \
|
||||||
|
add %g1, 0x20, %g1; \
|
||||||
|
ldxa [%g1 + %g0] ASI, %l4; \
|
||||||
|
ldxa [%g1 + %g2] ASI, %l5; \
|
||||||
|
ldxa [%g1 + %g3] ASI, %l6; \
|
||||||
|
ldxa [%g1 + %g5] ASI, %l7; \
|
||||||
|
add %g1, 0x20, %g1; \
|
||||||
|
ldxa [%g1 + %g0] ASI, %i0; \
|
||||||
|
ldxa [%g1 + %g2] ASI, %i1; \
|
||||||
|
ldxa [%g1 + %g3] ASI, %i2; \
|
||||||
|
ldxa [%g1 + %g5] ASI, %i3; \
|
||||||
|
add %g1, 0x20, %g1; \
|
||||||
|
ldxa [%g1 + %g0] ASI, %i4; \
|
||||||
|
ldxa [%g1 + %g2] ASI, %i5; \
|
||||||
|
ldxa [%g1 + %g3] ASI, %i6; \
|
||||||
|
ldxa [%g1 + %g5] ASI, %i7; \
|
||||||
|
restored; \
|
||||||
|
retry; nop; nop; nop; nop; \
|
||||||
|
b,a,pt %xcc, fill_fixup_dax; \
|
||||||
|
b,a,pt %xcc, fill_fixup_mna; \
|
||||||
|
b,a,pt %xcc, fill_fixup;
|
||||||
|
|
||||||
|
#define FILL_1_GENERIC_RTRAP \
|
||||||
|
user_rtt_fill_64bit: \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \
|
||||||
|
ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \
|
||||||
|
ba,pt %xcc, user_rtt_pre_restore; \
|
||||||
|
restored; \
|
||||||
|
nop; nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop; nop; \
|
||||||
|
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
||||||
|
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
||||||
|
ba,a,pt %xcc, user_rtt_fill_fixup;
|
||||||
|
|
||||||
|
|
||||||
|
/* Normal 32bit fill */
|
||||||
|
#define FILL_2_GENERIC(ASI) \
|
||||||
|
srl %sp, 0, %sp; \
|
||||||
|
lduwa [%sp + %g0] ASI, %l0; \
|
||||||
|
mov 0x04, %g2; \
|
||||||
|
mov 0x08, %g3; \
|
||||||
|
lduwa [%sp + %g2] ASI, %l1; \
|
||||||
|
mov 0x0c, %g5; \
|
||||||
|
lduwa [%sp + %g3] ASI, %l2; \
|
||||||
|
lduwa [%sp + %g5] ASI, %l3; \
|
||||||
|
add %sp, 0x10, %g1; \
|
||||||
|
lduwa [%g1 + %g0] ASI, %l4; \
|
||||||
|
lduwa [%g1 + %g2] ASI, %l5; \
|
||||||
|
lduwa [%g1 + %g3] ASI, %l6; \
|
||||||
|
lduwa [%g1 + %g5] ASI, %l7; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
lduwa [%g1 + %g0] ASI, %i0; \
|
||||||
|
lduwa [%g1 + %g2] ASI, %i1; \
|
||||||
|
lduwa [%g1 + %g3] ASI, %i2; \
|
||||||
|
lduwa [%g1 + %g5] ASI, %i3; \
|
||||||
|
add %g1, 0x10, %g1; \
|
||||||
|
lduwa [%g1 + %g0] ASI, %i4; \
|
||||||
|
lduwa [%g1 + %g2] ASI, %i5; \
|
||||||
|
lduwa [%g1 + %g3] ASI, %i6; \
|
||||||
|
lduwa [%g1 + %g5] ASI, %i7; \
|
||||||
|
restored; \
|
||||||
|
retry; nop; nop; nop; nop; \
|
||||||
|
b,a,pt %xcc, fill_fixup_dax; \
|
||||||
|
b,a,pt %xcc, fill_fixup_mna; \
|
||||||
|
b,a,pt %xcc, fill_fixup;
|
||||||
|
|
||||||
|
#define FILL_2_GENERIC_RTRAP \
|
||||||
|
user_rtt_fill_32bit: \
|
||||||
|
srl %sp, 0, %sp; \
|
||||||
|
lduwa [%sp + 0x00] %asi, %l0; \
|
||||||
|
lduwa [%sp + 0x04] %asi, %l1; \
|
||||||
|
lduwa [%sp + 0x08] %asi, %l2; \
|
||||||
|
lduwa [%sp + 0x0c] %asi, %l3; \
|
||||||
|
lduwa [%sp + 0x10] %asi, %l4; \
|
||||||
|
lduwa [%sp + 0x14] %asi, %l5; \
|
||||||
|
lduwa [%sp + 0x18] %asi, %l6; \
|
||||||
|
lduwa [%sp + 0x1c] %asi, %l7; \
|
||||||
|
lduwa [%sp + 0x20] %asi, %i0; \
|
||||||
|
lduwa [%sp + 0x24] %asi, %i1; \
|
||||||
|
lduwa [%sp + 0x28] %asi, %i2; \
|
||||||
|
lduwa [%sp + 0x2c] %asi, %i3; \
|
||||||
|
lduwa [%sp + 0x30] %asi, %i4; \
|
||||||
|
lduwa [%sp + 0x34] %asi, %i5; \
|
||||||
|
lduwa [%sp + 0x38] %asi, %i6; \
|
||||||
|
lduwa [%sp + 0x3c] %asi, %i7; \
|
||||||
|
ba,pt %xcc, user_rtt_pre_restore; \
|
||||||
|
restored; \
|
||||||
|
nop; nop; nop; nop; nop; \
|
||||||
|
nop; nop; nop; nop; nop; \
|
||||||
|
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
||||||
|
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
||||||
|
ba,a,pt %xcc, user_rtt_fill_fixup;
|
||||||
|
|
||||||
|
|
||||||
|
#define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
|
||||||
|
#define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
|
||||||
|
#define FILL_3_NORMAL FILL_0_NORMAL
|
||||||
|
#define FILL_4_NORMAL FILL_0_NORMAL
|
||||||
|
#define FILL_5_NORMAL FILL_0_NORMAL
|
||||||
|
#define FILL_6_NORMAL FILL_0_NORMAL
|
||||||
|
#define FILL_7_NORMAL FILL_0_NORMAL
|
||||||
|
|
||||||
|
#define FILL_0_OTHER FILL_0_NORMAL
|
||||||
|
#define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS)
|
||||||
|
#define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS)
|
||||||
|
#define FILL_3_OTHER FILL_3_NORMAL
|
||||||
|
#define FILL_4_OTHER FILL_4_NORMAL
|
||||||
|
#define FILL_5_OTHER FILL_5_NORMAL
|
||||||
|
#define FILL_6_OTHER FILL_6_NORMAL
|
||||||
|
#define FILL_7_OTHER FILL_7_NORMAL
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_TTABLE_H) */
|
|
@ -0,0 +1,109 @@
|
||||||
|
#ifndef _SPARC64_UPA_H
|
||||||
|
#define _SPARC64_UPA_H
|
||||||
|
|
||||||
|
#include <asm/asi.h>
|
||||||
|
|
||||||
|
/* UPA level registers and defines. */
|
||||||
|
|
||||||
|
/* UPA Config Register */
|
||||||
|
#define UPA_CONFIG_RESV 0xffffffffc0000000 /* Reserved. */
|
||||||
|
#define UPA_CONFIG_PCON 0x000000003fc00000 /* Depth of various sys queues. */
|
||||||
|
#define UPA_CONFIG_MID 0x00000000003e0000 /* Module ID. */
|
||||||
|
#define UPA_CONFIG_PCAP 0x000000000001ffff /* Port Capabilities. */
|
||||||
|
|
||||||
|
/* UPA Port ID Register */
|
||||||
|
#define UPA_PORTID_FNP 0xff00000000000000 /* Hardcoded to 0xfc on ultra. */
|
||||||
|
#define UPA_PORTID_RESV 0x00fffff800000000 /* Reserved. */
|
||||||
|
#define UPA_PORTID_ECCVALID 0x0000000400000000 /* Zero if mod can generate ECC */
|
||||||
|
#define UPA_PORTID_ONEREAD 0x0000000200000000 /* Set if mod generates P_RASB */
|
||||||
|
#define UPA_PORTID_PINTRDQ 0x0000000180000000 /* # outstanding P_INT_REQ's */
|
||||||
|
#define UPA_PORTID_PREQDQ 0x000000007e000000 /* slave-wr's to mod supported */
|
||||||
|
#define UPA_PORTID_PREQRD 0x0000000001e00000 /* # incoming P_REQ's supported */
|
||||||
|
#define UPA_PORTID_UPACAP 0x00000000001f0000 /* UPA capabilities of mod */
|
||||||
|
#define UPA_PORTID_ID 0x000000000000ffff /* Module Identification bits */
|
||||||
|
|
||||||
|
/* UPA I/O space accessors */
|
||||||
|
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
|
||||||
|
static inline unsigned char _upa_readb(unsigned long addr)
|
||||||
|
{
|
||||||
|
unsigned char ret;
|
||||||
|
|
||||||
|
__asm__ __volatile__("lduba\t[%1] %2, %0\t/* upa_readb */"
|
||||||
|
: "=r" (ret)
|
||||||
|
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned short _upa_readw(unsigned long addr)
|
||||||
|
{
|
||||||
|
unsigned short ret;
|
||||||
|
|
||||||
|
__asm__ __volatile__("lduha\t[%1] %2, %0\t/* upa_readw */"
|
||||||
|
: "=r" (ret)
|
||||||
|
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned int _upa_readl(unsigned long addr)
|
||||||
|
{
|
||||||
|
unsigned int ret;
|
||||||
|
|
||||||
|
__asm__ __volatile__("lduwa\t[%1] %2, %0\t/* upa_readl */"
|
||||||
|
: "=r" (ret)
|
||||||
|
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long _upa_readq(unsigned long addr)
|
||||||
|
{
|
||||||
|
unsigned long ret;
|
||||||
|
|
||||||
|
__asm__ __volatile__("ldxa\t[%1] %2, %0\t/* upa_readq */"
|
||||||
|
: "=r" (ret)
|
||||||
|
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void _upa_writeb(unsigned char b, unsigned long addr)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stba\t%0, [%1] %2\t/* upa_writeb */"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void _upa_writew(unsigned short w, unsigned long addr)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stha\t%0, [%1] %2\t/* upa_writew */"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void _upa_writel(unsigned int l, unsigned long addr)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stwa\t%0, [%1] %2\t/* upa_writel */"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void _upa_writeq(unsigned long q, unsigned long addr)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__("stxa\t%0, [%1] %2\t/* upa_writeq */"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define upa_readb(__addr) (_upa_readb((unsigned long)(__addr)))
|
||||||
|
#define upa_readw(__addr) (_upa_readw((unsigned long)(__addr)))
|
||||||
|
#define upa_readl(__addr) (_upa_readl((unsigned long)(__addr)))
|
||||||
|
#define upa_readq(__addr) (_upa_readq((unsigned long)(__addr)))
|
||||||
|
#define upa_writeb(__b, __addr) (_upa_writeb((__b), (unsigned long)(__addr)))
|
||||||
|
#define upa_writew(__w, __addr) (_upa_writew((__w), (unsigned long)(__addr)))
|
||||||
|
#define upa_writel(__l, __addr) (_upa_writel((__l), (unsigned long)(__addr)))
|
||||||
|
#define upa_writeq(__q, __addr) (_upa_writeq((__q), (unsigned long)(__addr)))
|
||||||
|
#endif /* __KERNEL__ && !__ASSEMBLY__ */
|
||||||
|
|
||||||
|
#endif /* !(_SPARC64_UPA_H) */
|
|
@ -0,0 +1,406 @@
|
||||||
|
#ifndef _SPARC64_VIO_H
|
||||||
|
#define _SPARC64_VIO_H
|
||||||
|
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
|
#include <linux/timer.h>
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
#include <linux/completion.h>
|
||||||
|
#include <linux/list.h>
|
||||||
|
#include <linux/log2.h>
|
||||||
|
|
||||||
|
#include <asm/ldc.h>
|
||||||
|
#include <asm/mdesc.h>
|
||||||
|
|
||||||
|
struct vio_msg_tag {
|
||||||
|
u8 type;
|
||||||
|
#define VIO_TYPE_CTRL 0x01
|
||||||
|
#define VIO_TYPE_DATA 0x02
|
||||||
|
#define VIO_TYPE_ERR 0x04
|
||||||
|
|
||||||
|
u8 stype;
|
||||||
|
#define VIO_SUBTYPE_INFO 0x01
|
||||||
|
#define VIO_SUBTYPE_ACK 0x02
|
||||||
|
#define VIO_SUBTYPE_NACK 0x04
|
||||||
|
|
||||||
|
u16 stype_env;
|
||||||
|
#define VIO_VER_INFO 0x0001
|
||||||
|
#define VIO_ATTR_INFO 0x0002
|
||||||
|
#define VIO_DRING_REG 0x0003
|
||||||
|
#define VIO_DRING_UNREG 0x0004
|
||||||
|
#define VIO_RDX 0x0005
|
||||||
|
#define VIO_PKT_DATA 0x0040
|
||||||
|
#define VIO_DESC_DATA 0x0041
|
||||||
|
#define VIO_DRING_DATA 0x0042
|
||||||
|
#define VNET_MCAST_INFO 0x0101
|
||||||
|
|
||||||
|
u32 sid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_rdx {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u64 resv[6];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_ver_info {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u16 major;
|
||||||
|
u16 minor;
|
||||||
|
u8 dev_class;
|
||||||
|
#define VDEV_NETWORK 0x01
|
||||||
|
#define VDEV_NETWORK_SWITCH 0x02
|
||||||
|
#define VDEV_DISK 0x03
|
||||||
|
#define VDEV_DISK_SERVER 0x04
|
||||||
|
|
||||||
|
u8 resv1[3];
|
||||||
|
u64 resv2[5];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_dring_register {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u64 dring_ident;
|
||||||
|
u32 num_descr;
|
||||||
|
u32 descr_size;
|
||||||
|
u16 options;
|
||||||
|
#define VIO_TX_DRING 0x0001
|
||||||
|
#define VIO_RX_DRING 0x0002
|
||||||
|
u16 resv;
|
||||||
|
u32 num_cookies;
|
||||||
|
struct ldc_trans_cookie cookies[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_dring_unregister {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u64 dring_ident;
|
||||||
|
u64 resv[5];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Data transfer modes */
|
||||||
|
#define VIO_PKT_MODE 0x01 /* Packet based transfer */
|
||||||
|
#define VIO_DESC_MODE 0x02 /* In-band descriptors */
|
||||||
|
#define VIO_DRING_MODE 0x03 /* Descriptor rings */
|
||||||
|
|
||||||
|
struct vio_dring_data {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u64 seq;
|
||||||
|
u64 dring_ident;
|
||||||
|
u32 start_idx;
|
||||||
|
u32 end_idx;
|
||||||
|
u8 state;
|
||||||
|
#define VIO_DRING_ACTIVE 0x01
|
||||||
|
#define VIO_DRING_STOPPED 0x02
|
||||||
|
|
||||||
|
u8 __pad1;
|
||||||
|
u16 __pad2;
|
||||||
|
u32 __pad3;
|
||||||
|
u64 __par4[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_dring_hdr {
|
||||||
|
u8 state;
|
||||||
|
#define VIO_DESC_FREE 0x01
|
||||||
|
#define VIO_DESC_READY 0x02
|
||||||
|
#define VIO_DESC_ACCEPTED 0x03
|
||||||
|
#define VIO_DESC_DONE 0x04
|
||||||
|
u8 ack;
|
||||||
|
#define VIO_ACK_ENABLE 0x01
|
||||||
|
#define VIO_ACK_DISABLE 0x00
|
||||||
|
|
||||||
|
u16 __pad1;
|
||||||
|
u32 __pad2;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* VIO disk specific structures and defines */
|
||||||
|
struct vio_disk_attr_info {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u8 xfer_mode;
|
||||||
|
u8 vdisk_type;
|
||||||
|
#define VD_DISK_TYPE_SLICE 0x01 /* Slice in block device */
|
||||||
|
#define VD_DISK_TYPE_DISK 0x02 /* Entire block device */
|
||||||
|
u16 resv1;
|
||||||
|
u32 vdisk_block_size;
|
||||||
|
u64 operations;
|
||||||
|
u64 vdisk_size;
|
||||||
|
u64 max_xfer_size;
|
||||||
|
u64 resv2[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_disk_desc {
|
||||||
|
struct vio_dring_hdr hdr;
|
||||||
|
u64 req_id;
|
||||||
|
u8 operation;
|
||||||
|
#define VD_OP_BREAD 0x01 /* Block read */
|
||||||
|
#define VD_OP_BWRITE 0x02 /* Block write */
|
||||||
|
#define VD_OP_FLUSH 0x03 /* Flush disk contents */
|
||||||
|
#define VD_OP_GET_WCE 0x04 /* Get write-cache status */
|
||||||
|
#define VD_OP_SET_WCE 0x05 /* Enable/disable write-cache */
|
||||||
|
#define VD_OP_GET_VTOC 0x06 /* Get VTOC */
|
||||||
|
#define VD_OP_SET_VTOC 0x07 /* Set VTOC */
|
||||||
|
#define VD_OP_GET_DISKGEOM 0x08 /* Get disk geometry */
|
||||||
|
#define VD_OP_SET_DISKGEOM 0x09 /* Set disk geometry */
|
||||||
|
#define VD_OP_SCSICMD 0x0a /* SCSI control command */
|
||||||
|
#define VD_OP_GET_DEVID 0x0b /* Get device ID */
|
||||||
|
#define VD_OP_GET_EFI 0x0c /* Get EFI */
|
||||||
|
#define VD_OP_SET_EFI 0x0d /* Set EFI */
|
||||||
|
u8 slice;
|
||||||
|
u16 resv1;
|
||||||
|
u32 status;
|
||||||
|
u64 offset;
|
||||||
|
u64 size;
|
||||||
|
u32 ncookies;
|
||||||
|
u32 resv2;
|
||||||
|
struct ldc_trans_cookie cookies[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define VIO_DISK_VNAME_LEN 8
|
||||||
|
#define VIO_DISK_ALABEL_LEN 128
|
||||||
|
#define VIO_DISK_NUM_PART 8
|
||||||
|
|
||||||
|
struct vio_disk_vtoc {
|
||||||
|
u8 volume_name[VIO_DISK_VNAME_LEN];
|
||||||
|
u16 sector_size;
|
||||||
|
u16 num_partitions;
|
||||||
|
u8 ascii_label[VIO_DISK_ALABEL_LEN];
|
||||||
|
struct {
|
||||||
|
u16 id;
|
||||||
|
u16 perm_flags;
|
||||||
|
u32 resv;
|
||||||
|
u64 start_block;
|
||||||
|
u64 num_blocks;
|
||||||
|
} partitions[VIO_DISK_NUM_PART];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_disk_geom {
|
||||||
|
u16 num_cyl; /* Num data cylinders */
|
||||||
|
u16 alt_cyl; /* Num alternate cylinders */
|
||||||
|
u16 beg_cyl; /* Cyl off of fixed head area */
|
||||||
|
u16 num_hd; /* Num heads */
|
||||||
|
u16 num_sec; /* Num sectors */
|
||||||
|
u16 ifact; /* Interleave factor */
|
||||||
|
u16 apc; /* Alts per cylinder (SCSI) */
|
||||||
|
u16 rpm; /* Revolutions per minute */
|
||||||
|
u16 phy_cyl; /* Num physical cylinders */
|
||||||
|
u16 wr_skip; /* Num sects to skip, writes */
|
||||||
|
u16 rd_skip; /* Num sects to skip, writes */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_disk_devid {
|
||||||
|
u16 resv;
|
||||||
|
u16 type;
|
||||||
|
u32 len;
|
||||||
|
char id[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_disk_efi {
|
||||||
|
u64 lba;
|
||||||
|
u64 len;
|
||||||
|
char data[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* VIO net specific structures and defines */
|
||||||
|
struct vio_net_attr_info {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u8 xfer_mode;
|
||||||
|
u8 addr_type;
|
||||||
|
#define VNET_ADDR_ETHERMAC 0x01
|
||||||
|
u16 ack_freq;
|
||||||
|
u32 resv1;
|
||||||
|
u64 addr;
|
||||||
|
u64 mtu;
|
||||||
|
u64 resv2[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define VNET_NUM_MCAST 7
|
||||||
|
|
||||||
|
struct vio_net_mcast_info {
|
||||||
|
struct vio_msg_tag tag;
|
||||||
|
u8 set;
|
||||||
|
u8 count;
|
||||||
|
u8 mcast_addr[VNET_NUM_MCAST * 6];
|
||||||
|
u32 resv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_net_desc {
|
||||||
|
struct vio_dring_hdr hdr;
|
||||||
|
u32 size;
|
||||||
|
u32 ncookies;
|
||||||
|
struct ldc_trans_cookie cookies[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define VIO_MAX_RING_COOKIES 24
|
||||||
|
|
||||||
|
struct vio_dring_state {
|
||||||
|
u64 ident;
|
||||||
|
void *base;
|
||||||
|
u64 snd_nxt;
|
||||||
|
u64 rcv_nxt;
|
||||||
|
u32 entry_size;
|
||||||
|
u32 num_entries;
|
||||||
|
u32 prod;
|
||||||
|
u32 cons;
|
||||||
|
u32 pending;
|
||||||
|
int ncookies;
|
||||||
|
struct ldc_trans_cookie cookies[VIO_MAX_RING_COOKIES];
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void *vio_dring_cur(struct vio_dring_state *dr)
|
||||||
|
{
|
||||||
|
return dr->base + (dr->entry_size * dr->prod);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void *vio_dring_entry(struct vio_dring_state *dr,
|
||||||
|
unsigned int index)
|
||||||
|
{
|
||||||
|
return dr->base + (dr->entry_size * index);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 vio_dring_avail(struct vio_dring_state *dr,
|
||||||
|
unsigned int ring_size)
|
||||||
|
{
|
||||||
|
BUILD_BUG_ON(!is_power_of_2(ring_size));
|
||||||
|
|
||||||
|
return (dr->pending -
|
||||||
|
((dr->prod - dr->cons) & (ring_size - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VIO_MAX_TYPE_LEN 32
|
||||||
|
#define VIO_MAX_COMPAT_LEN 64
|
||||||
|
|
||||||
|
struct vio_dev {
|
||||||
|
u64 mp;
|
||||||
|
struct device_node *dp;
|
||||||
|
|
||||||
|
char type[VIO_MAX_TYPE_LEN];
|
||||||
|
char compat[VIO_MAX_COMPAT_LEN];
|
||||||
|
int compat_len;
|
||||||
|
|
||||||
|
u64 dev_no;
|
||||||
|
|
||||||
|
unsigned long channel_id;
|
||||||
|
|
||||||
|
unsigned int tx_irq;
|
||||||
|
unsigned int rx_irq;
|
||||||
|
|
||||||
|
struct device dev;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_driver {
|
||||||
|
struct list_head node;
|
||||||
|
const struct vio_device_id *id_table;
|
||||||
|
int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
|
||||||
|
int (*remove)(struct vio_dev *dev);
|
||||||
|
void (*shutdown)(struct vio_dev *dev);
|
||||||
|
unsigned long driver_data;
|
||||||
|
struct device_driver driver;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_version {
|
||||||
|
u16 major;
|
||||||
|
u16 minor;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_driver_state;
|
||||||
|
struct vio_driver_ops {
|
||||||
|
int (*send_attr)(struct vio_driver_state *vio);
|
||||||
|
int (*handle_attr)(struct vio_driver_state *vio, void *pkt);
|
||||||
|
void (*handshake_complete)(struct vio_driver_state *vio);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_completion {
|
||||||
|
struct completion com;
|
||||||
|
int err;
|
||||||
|
int waiting_for;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vio_driver_state {
|
||||||
|
/* Protects VIO handshake and, optionally, driver private state. */
|
||||||
|
spinlock_t lock;
|
||||||
|
|
||||||
|
struct ldc_channel *lp;
|
||||||
|
|
||||||
|
u32 _peer_sid;
|
||||||
|
u32 _local_sid;
|
||||||
|
struct vio_dring_state drings[2];
|
||||||
|
#define VIO_DRIVER_TX_RING 0
|
||||||
|
#define VIO_DRIVER_RX_RING 1
|
||||||
|
|
||||||
|
u8 hs_state;
|
||||||
|
#define VIO_HS_INVALID 0x00
|
||||||
|
#define VIO_HS_GOTVERS 0x01
|
||||||
|
#define VIO_HS_GOT_ATTR 0x04
|
||||||
|
#define VIO_HS_SENT_DREG 0x08
|
||||||
|
#define VIO_HS_SENT_RDX 0x10
|
||||||
|
#define VIO_HS_GOT_RDX_ACK 0x20
|
||||||
|
#define VIO_HS_GOT_RDX 0x40
|
||||||
|
#define VIO_HS_SENT_RDX_ACK 0x80
|
||||||
|
#define VIO_HS_COMPLETE (VIO_HS_GOT_RDX_ACK | VIO_HS_SENT_RDX_ACK)
|
||||||
|
|
||||||
|
u8 dev_class;
|
||||||
|
|
||||||
|
u8 dr_state;
|
||||||
|
#define VIO_DR_STATE_TXREG 0x01
|
||||||
|
#define VIO_DR_STATE_RXREG 0x02
|
||||||
|
#define VIO_DR_STATE_TXREQ 0x10
|
||||||
|
#define VIO_DR_STATE_RXREQ 0x20
|
||||||
|
|
||||||
|
u8 debug;
|
||||||
|
#define VIO_DEBUG_HS 0x01
|
||||||
|
#define VIO_DEBUG_DATA 0x02
|
||||||
|
|
||||||
|
void *desc_buf;
|
||||||
|
unsigned int desc_buf_len;
|
||||||
|
|
||||||
|
struct vio_completion *cmp;
|
||||||
|
|
||||||
|
struct vio_dev *vdev;
|
||||||
|
|
||||||
|
struct timer_list timer;
|
||||||
|
|
||||||
|
struct vio_version ver;
|
||||||
|
|
||||||
|
struct vio_version *ver_table;
|
||||||
|
int ver_table_entries;
|
||||||
|
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
struct vio_driver_ops *ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define viodbg(TYPE, f, a...) \
|
||||||
|
do { if (vio->debug & VIO_DEBUG_##TYPE) \
|
||||||
|
printk(KERN_INFO "vio: ID[%lu] " f, \
|
||||||
|
vio->vdev->channel_id, ## a); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
extern int vio_register_driver(struct vio_driver *drv);
|
||||||
|
extern void vio_unregister_driver(struct vio_driver *drv);
|
||||||
|
|
||||||
|
static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
|
||||||
|
{
|
||||||
|
return container_of(drv, struct vio_driver, driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct vio_dev *to_vio_dev(struct device *dev)
|
||||||
|
{
|
||||||
|
return container_of(dev, struct vio_dev, dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len);
|
||||||
|
extern void vio_link_state_change(struct vio_driver_state *vio, int event);
|
||||||
|
extern void vio_conn_reset(struct vio_driver_state *vio);
|
||||||
|
extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt);
|
||||||
|
extern int vio_validate_sid(struct vio_driver_state *vio,
|
||||||
|
struct vio_msg_tag *tp);
|
||||||
|
extern u32 vio_send_sid(struct vio_driver_state *vio);
|
||||||
|
extern int vio_ldc_alloc(struct vio_driver_state *vio,
|
||||||
|
struct ldc_channel_config *base_cfg, void *event_arg);
|
||||||
|
extern void vio_ldc_free(struct vio_driver_state *vio);
|
||||||
|
extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
|
||||||
|
u8 dev_class, struct vio_version *ver_table,
|
||||||
|
int ver_table_size, struct vio_driver_ops *ops,
|
||||||
|
char *name);
|
||||||
|
|
||||||
|
extern void vio_port_up(struct vio_driver_state *vio);
|
||||||
|
|
||||||
|
#endif /* _SPARC64_VIO_H */
|
|
@ -0,0 +1,62 @@
|
||||||
|
#ifndef _SPARC64_VISASM_H
|
||||||
|
#define _SPARC64_VISASM_H
|
||||||
|
|
||||||
|
/* visasm.h: FPU saving macros for VIS routines
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <asm/pstate.h>
|
||||||
|
#include <asm/ptrace.h>
|
||||||
|
|
||||||
|
/* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
|
||||||
|
|
||||||
|
#define VISEntry \
|
||||||
|
rd %fprs, %o5; \
|
||||||
|
andcc %o5, (FPRS_FEF|FPRS_DU), %g0; \
|
||||||
|
be,pt %icc, 297f; \
|
||||||
|
sethi %hi(297f), %g7; \
|
||||||
|
sethi %hi(VISenter), %g1; \
|
||||||
|
jmpl %g1 + %lo(VISenter), %g0; \
|
||||||
|
or %g7, %lo(297f), %g7; \
|
||||||
|
297: wr %g0, FPRS_FEF, %fprs; \
|
||||||
|
|
||||||
|
#define VISExit \
|
||||||
|
wr %g0, 0, %fprs;
|
||||||
|
|
||||||
|
/* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
|
||||||
|
* Must preserve %o5 between VISEntryHalf and VISExitHalf */
|
||||||
|
|
||||||
|
#define VISEntryHalf \
|
||||||
|
rd %fprs, %o5; \
|
||||||
|
andcc %o5, FPRS_FEF, %g0; \
|
||||||
|
be,pt %icc, 297f; \
|
||||||
|
sethi %hi(298f), %g7; \
|
||||||
|
sethi %hi(VISenterhalf), %g1; \
|
||||||
|
jmpl %g1 + %lo(VISenterhalf), %g0; \
|
||||||
|
or %g7, %lo(298f), %g7; \
|
||||||
|
clr %o5; \
|
||||||
|
297: wr %o5, FPRS_FEF, %fprs; \
|
||||||
|
298:
|
||||||
|
|
||||||
|
#define VISExitHalf \
|
||||||
|
wr %o5, 0, %fprs;
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
static inline void save_and_clear_fpu(void) {
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
" rd %%fprs, %%o5\n"
|
||||||
|
" andcc %%o5, %0, %%g0\n"
|
||||||
|
" be,pt %%icc, 299f\n"
|
||||||
|
" sethi %%hi(298f), %%g7\n"
|
||||||
|
" sethi %%hi(VISenter), %%g1\n"
|
||||||
|
" jmpl %%g1 + %%lo(VISenter), %%g0\n"
|
||||||
|
" or %%g7, %%lo(298f), %%g7\n"
|
||||||
|
" 298: wr %%g0, 0, %%fprs\n"
|
||||||
|
" 299:\n"
|
||||||
|
" " : : "i" (FPRS_FEF|FPRS_DU) :
|
||||||
|
"o5", "g1", "g2", "g3", "g7", "cc");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SPARC64_ASI_H */
|
|
@ -1,20 +1 @@
|
||||||
#ifndef AGP_H
|
#include <asm-sparc/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
|
|
||||||
|
|
|
@ -1,36 +1 @@
|
||||||
/*
|
#include <asm-sparc/apb.h>
|
||||||
* 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) */
|
|
||||||
|
|
|
@ -1,31 +1 @@
|
||||||
#ifndef _SPARC64_BACKOFF_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,225 +1 @@
|
||||||
/*
|
#include <asm-sparc/bbc.h>
|
||||||
* 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 */
|
|
||||||
|
|
||||||
|
|
|
@ -1,241 +1 @@
|
||||||
#ifndef _SPARC64_CHAFSR_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,183 +1 @@
|
||||||
#ifndef _SPARC64_CHMCTRL_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,59 +1 @@
|
||||||
#ifndef _SPARC64_CMT_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,243 +1 @@
|
||||||
#ifndef _ASM_SPARC64_COMPAT_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,29 +1 @@
|
||||||
#ifndef _COMPAT_SIGNAL_H
|
#include <asm-sparc/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) */
|
|
||||||
|
|
|
@ -1,14 +1 @@
|
||||||
#ifndef _SPARC64_DCR_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,27 +1 @@
|
||||||
#ifndef _SPARC64_DCU_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,49 +1 @@
|
||||||
#ifndef _SPARC64_ESTATE_H
|
#include <asm-sparc/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 */
|
|
||||||
|
|
|
@ -1,121 +1 @@
|
||||||
/*
|
#include <asm-sparc/fhc.h>
|
||||||
* 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) */
|
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
/* fpumacro.h: FPU related macros.
|
#include <asm-sparc/fpumacro.h>
|
||||||
*
|
|
||||||
* 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) */
|
|
||||||
|
|
|
@ -1,84 +1 @@
|
||||||
#ifndef _ASM_SPARC64_HUGETLB_H
|
#include <asm-sparc/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(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 */
|
|
||||||
|
|
|
@ -1,37 +1 @@
|
||||||
#ifndef _SPARC64_HVTRAP_H
|
#include <asm-sparc/hvtramp.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 */
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +1 @@
|
||||||
#ifndef _SPARC64_INTR_QUEUE_H
|
#include <asm-sparc/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) */
|
|
||||||
|
|
|
@ -1,49 +1 @@
|
||||||
#ifndef _SPARC64_KPROBES_H
|
#include <asm-sparc/kprobes.h>
|
||||||
#define _SPARC64_KPROBES_H
|
|
||||||
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/percpu.h>
|
|
||||||
|
|
||||||
typedef u32 kprobe_opcode_t;
|
|
||||||
|
|
||||||
#define BREAKPOINT_INSTRUCTION 0x91d02070 /* ta 0x70 */
|
|
||||||
#define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */
|
|
||||||
#define MAX_INSN_SIZE 2
|
|
||||||
|
|
||||||
#define kretprobe_blacklist_size 0
|
|
||||||
|
|
||||||
#define arch_remove_kprobe(p) do {} while (0)
|
|
||||||
|
|
||||||
#define flush_insn_slot(p) \
|
|
||||||
do { flushi(&(p)->ainsn.insn[0]); \
|
|
||||||
flushi(&(p)->ainsn.insn[1]); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
void kretprobe_trampoline(void);
|
|
||||||
|
|
||||||
/* Architecture specific copy of original instruction*/
|
|
||||||
struct arch_specific_insn {
|
|
||||||
/* copy of the original instruction */
|
|
||||||
kprobe_opcode_t insn[MAX_INSN_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct prev_kprobe {
|
|
||||||
struct kprobe *kp;
|
|
||||||
unsigned long status;
|
|
||||||
unsigned long orig_tnpc;
|
|
||||||
unsigned long orig_tstate_pil;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* per-cpu kprobe control block */
|
|
||||||
struct kprobe_ctlblk {
|
|
||||||
unsigned long kprobe_status;
|
|
||||||
unsigned long kprobe_orig_tnpc;
|
|
||||||
unsigned long kprobe_orig_tstate_pil;
|
|
||||||
struct pt_regs jprobe_saved_regs;
|
|
||||||
struct prev_kprobe prev_kprobe;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern int kprobe_exceptions_notify(struct notifier_block *self,
|
|
||||||
unsigned long val, void *data);
|
|
||||||
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
|
|
||||||
#endif /* _SPARC64_KPROBES_H */
|
|
||||||
|
|
|
@ -1,138 +1 @@
|
||||||
#ifndef _SPARC64_LDC_H
|
#include <asm-sparc/ldc.h>
|
||||||
#define _SPARC64_LDC_H
|
|
||||||
|
|
||||||
#include <asm/hypervisor.h>
|
|
||||||
|
|
||||||
extern int ldom_domaining_enabled;
|
|
||||||
extern void ldom_set_var(const char *var, const char *value);
|
|
||||||
extern void ldom_reboot(const char *boot_command);
|
|
||||||
extern void ldom_power_off(void);
|
|
||||||
|
|
||||||
/* The event handler will be evoked when link state changes
|
|
||||||
* or data becomes available on the receive side.
|
|
||||||
*
|
|
||||||
* For non-RAW links, if the LDC_EVENT_RESET event arrives the
|
|
||||||
* driver should reset all of it's internal state and reinvoke
|
|
||||||
* ldc_connect() to try and bring the link up again.
|
|
||||||
*
|
|
||||||
* For RAW links, ldc_connect() is not used. Instead the driver
|
|
||||||
* just waits for the LDC_EVENT_UP event.
|
|
||||||
*/
|
|
||||||
struct ldc_channel_config {
|
|
||||||
void (*event)(void *arg, int event);
|
|
||||||
|
|
||||||
u32 mtu;
|
|
||||||
unsigned int rx_irq;
|
|
||||||
unsigned int tx_irq;
|
|
||||||
u8 mode;
|
|
||||||
#define LDC_MODE_RAW 0x00
|
|
||||||
#define LDC_MODE_UNRELIABLE 0x01
|
|
||||||
#define LDC_MODE_RESERVED 0x02
|
|
||||||
#define LDC_MODE_STREAM 0x03
|
|
||||||
|
|
||||||
u8 debug;
|
|
||||||
#define LDC_DEBUG_HS 0x01
|
|
||||||
#define LDC_DEBUG_STATE 0x02
|
|
||||||
#define LDC_DEBUG_RX 0x04
|
|
||||||
#define LDC_DEBUG_TX 0x08
|
|
||||||
#define LDC_DEBUG_DATA 0x10
|
|
||||||
};
|
|
||||||
|
|
||||||
#define LDC_EVENT_RESET 0x01
|
|
||||||
#define LDC_EVENT_UP 0x02
|
|
||||||
#define LDC_EVENT_DATA_READY 0x04
|
|
||||||
|
|
||||||
#define LDC_STATE_INVALID 0x00
|
|
||||||
#define LDC_STATE_INIT 0x01
|
|
||||||
#define LDC_STATE_BOUND 0x02
|
|
||||||
#define LDC_STATE_READY 0x03
|
|
||||||
#define LDC_STATE_CONNECTED 0x04
|
|
||||||
|
|
||||||
struct ldc_channel;
|
|
||||||
|
|
||||||
/* Allocate state for a channel. */
|
|
||||||
extern struct ldc_channel *ldc_alloc(unsigned long id,
|
|
||||||
const struct ldc_channel_config *cfgp,
|
|
||||||
void *event_arg);
|
|
||||||
|
|
||||||
/* Shut down and free state for a channel. */
|
|
||||||
extern void ldc_free(struct ldc_channel *lp);
|
|
||||||
|
|
||||||
/* Register TX and RX queues of the link with the hypervisor. */
|
|
||||||
extern int ldc_bind(struct ldc_channel *lp, const char *name);
|
|
||||||
|
|
||||||
/* For non-RAW protocols we need to complete a handshake before
|
|
||||||
* communication can proceed. ldc_connect() does that, if the
|
|
||||||
* handshake completes successfully, an LDC_EVENT_UP event will
|
|
||||||
* be sent up to the driver.
|
|
||||||
*/
|
|
||||||
extern int ldc_connect(struct ldc_channel *lp);
|
|
||||||
extern int ldc_disconnect(struct ldc_channel *lp);
|
|
||||||
|
|
||||||
extern int ldc_state(struct ldc_channel *lp);
|
|
||||||
|
|
||||||
/* Read and write operations. Only valid when the link is up. */
|
|
||||||
extern int ldc_write(struct ldc_channel *lp, const void *buf,
|
|
||||||
unsigned int size);
|
|
||||||
extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);
|
|
||||||
|
|
||||||
#define LDC_MAP_SHADOW 0x01
|
|
||||||
#define LDC_MAP_DIRECT 0x02
|
|
||||||
#define LDC_MAP_IO 0x04
|
|
||||||
#define LDC_MAP_R 0x08
|
|
||||||
#define LDC_MAP_W 0x10
|
|
||||||
#define LDC_MAP_X 0x20
|
|
||||||
#define LDC_MAP_RW (LDC_MAP_R | LDC_MAP_W)
|
|
||||||
#define LDC_MAP_RWX (LDC_MAP_R | LDC_MAP_W | LDC_MAP_X)
|
|
||||||
#define LDC_MAP_ALL 0x03f
|
|
||||||
|
|
||||||
struct ldc_trans_cookie {
|
|
||||||
u64 cookie_addr;
|
|
||||||
u64 cookie_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct scatterlist;
|
|
||||||
extern int ldc_map_sg(struct ldc_channel *lp,
|
|
||||||
struct scatterlist *sg, int num_sg,
|
|
||||||
struct ldc_trans_cookie *cookies, int ncookies,
|
|
||||||
unsigned int map_perm);
|
|
||||||
|
|
||||||
extern int ldc_map_single(struct ldc_channel *lp,
|
|
||||||
void *buf, unsigned int len,
|
|
||||||
struct ldc_trans_cookie *cookies, int ncookies,
|
|
||||||
unsigned int map_perm);
|
|
||||||
|
|
||||||
extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies,
|
|
||||||
int ncookies);
|
|
||||||
|
|
||||||
extern int ldc_copy(struct ldc_channel *lp, int copy_dir,
|
|
||||||
void *buf, unsigned int len, unsigned long offset,
|
|
||||||
struct ldc_trans_cookie *cookies, int ncookies);
|
|
||||||
|
|
||||||
static inline int ldc_get_dring_entry(struct ldc_channel *lp,
|
|
||||||
void *buf, unsigned int len,
|
|
||||||
unsigned long offset,
|
|
||||||
struct ldc_trans_cookie *cookies,
|
|
||||||
int ncookies)
|
|
||||||
{
|
|
||||||
return ldc_copy(lp, LDC_COPY_IN, buf, len, offset, cookies, ncookies);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int ldc_put_dring_entry(struct ldc_channel *lp,
|
|
||||||
void *buf, unsigned int len,
|
|
||||||
unsigned long offset,
|
|
||||||
struct ldc_trans_cookie *cookies,
|
|
||||||
int ncookies)
|
|
||||||
{
|
|
||||||
return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
|
|
||||||
struct ldc_trans_cookie *cookies,
|
|
||||||
int *ncookies, unsigned int map_perm);
|
|
||||||
|
|
||||||
extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf,
|
|
||||||
unsigned int len,
|
|
||||||
struct ldc_trans_cookie *cookies, int ncookies);
|
|
||||||
|
|
||||||
#endif /* _SPARC64_LDC_H */
|
|
||||||
|
|
|
@ -1,10 +1 @@
|
||||||
#ifndef _SPARC64_LMB_H
|
#include <asm-sparc/lmb.h>
|
||||||
#define _SPARC64_LMB_H
|
|
||||||
|
|
||||||
#include <asm/oplib.h>
|
|
||||||
|
|
||||||
#define LMB_DBG(fmt...) prom_printf(fmt)
|
|
||||||
|
|
||||||
#define LMB_REAL_LIMIT 0
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_LMB_H) */
|
|
||||||
|
|
|
@ -1,19 +1 @@
|
||||||
#ifndef _SPARC64_LSU_H
|
#include <asm-sparc/lsu.h>
|
||||||
#define _SPARC64_LSU_H
|
|
||||||
|
|
||||||
#include <linux/const.h>
|
|
||||||
|
|
||||||
/* LSU Control Register */
|
|
||||||
#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/
|
|
||||||
#define LSU_CONTROL_VM _AC(0x00000001fe000000,UL) /* Virt-watchpoint byte mask*/
|
|
||||||
#define LSU_CONTROL_PR _AC(0x0000000001000000,UL) /* Phys-rd watchpoint enable*/
|
|
||||||
#define LSU_CONTROL_PW _AC(0x0000000000800000,UL) /* Phys-wr watchpoint enable*/
|
|
||||||
#define LSU_CONTROL_VR _AC(0x0000000000400000,UL) /* Virt-rd watchpoint enable*/
|
|
||||||
#define LSU_CONTROL_VW _AC(0x0000000000200000,UL) /* Virt-wr watchpoint enable*/
|
|
||||||
#define LSU_CONTROL_FM _AC(0x00000000000ffff0,UL) /* Parity mask enables. */
|
|
||||||
#define LSU_CONTROL_DM _AC(0x0000000000000008,UL) /* Data MMU enable. */
|
|
||||||
#define LSU_CONTROL_IM _AC(0x0000000000000004,UL) /* Instruction MMU enable. */
|
|
||||||
#define LSU_CONTROL_DC _AC(0x0000000000000002,UL) /* Data cache enable. */
|
|
||||||
#define LSU_CONTROL_IC _AC(0x0000000000000001,UL) /* Instruction cache enable.*/
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_LSU_H) */
|
|
||||||
|
|
|
@ -1,78 +1 @@
|
||||||
#ifndef _SPARC64_MDESC_H
|
#include <asm-sparc/mdesc.h>
|
||||||
#define _SPARC64_MDESC_H
|
|
||||||
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/cpumask.h>
|
|
||||||
#include <asm/prom.h>
|
|
||||||
|
|
||||||
struct mdesc_handle;
|
|
||||||
|
|
||||||
/* Machine description operations are to be surrounded by grab and
|
|
||||||
* release calls. The mdesc_handle returned from the grab is
|
|
||||||
* the first argument to all of the operational calls that work
|
|
||||||
* on mdescs.
|
|
||||||
*/
|
|
||||||
extern struct mdesc_handle *mdesc_grab(void);
|
|
||||||
extern void mdesc_release(struct mdesc_handle *);
|
|
||||||
|
|
||||||
#define MDESC_NODE_NULL (~(u64)0)
|
|
||||||
|
|
||||||
extern u64 mdesc_node_by_name(struct mdesc_handle *handle,
|
|
||||||
u64 from_node, const char *name);
|
|
||||||
#define mdesc_for_each_node_by_name(__hdl, __node, __name) \
|
|
||||||
for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
|
|
||||||
(__node) != MDESC_NODE_NULL; \
|
|
||||||
__node = mdesc_node_by_name(__hdl, __node, __name))
|
|
||||||
|
|
||||||
/* Access to property values returned from mdesc_get_property() are
|
|
||||||
* only valid inside of a mdesc_grab()/mdesc_release() sequence.
|
|
||||||
* Once mdesc_release() is called, the memory backed up by these
|
|
||||||
* pointers may reference freed up memory.
|
|
||||||
*
|
|
||||||
* Therefore callers must make copies of any property values
|
|
||||||
* they need.
|
|
||||||
*
|
|
||||||
* These same rules apply to mdesc_node_name().
|
|
||||||
*/
|
|
||||||
extern const void *mdesc_get_property(struct mdesc_handle *handle,
|
|
||||||
u64 node, const char *name, int *lenp);
|
|
||||||
extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
|
|
||||||
|
|
||||||
/* MD arc iteration, the standard sequence is:
|
|
||||||
*
|
|
||||||
* unsigned long arc;
|
|
||||||
* mdesc_for_each_arc(arc, handle, node, MDESC_ARC_TYPE_{FWD,BACK}) {
|
|
||||||
* unsigned long target = mdesc_arc_target(handle, arc);
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MDESC_ARC_TYPE_FWD "fwd"
|
|
||||||
#define MDESC_ARC_TYPE_BACK "back"
|
|
||||||
|
|
||||||
extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
|
|
||||||
const char *arc_type);
|
|
||||||
#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
|
|
||||||
for (__arc = mdesc_next_arc(__hdl, __node, __type); \
|
|
||||||
(__arc) != MDESC_NODE_NULL; \
|
|
||||||
__arc = mdesc_next_arc(__hdl, __arc, __type))
|
|
||||||
|
|
||||||
extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
|
|
||||||
|
|
||||||
extern void mdesc_update(void);
|
|
||||||
|
|
||||||
struct mdesc_notifier_client {
|
|
||||||
void (*add)(struct mdesc_handle *handle, u64 node);
|
|
||||||
void (*remove)(struct mdesc_handle *handle, u64 node);
|
|
||||||
|
|
||||||
const char *node_name;
|
|
||||||
struct mdesc_notifier_client *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void mdesc_register_notifier(struct mdesc_notifier_client *client);
|
|
||||||
|
|
||||||
extern void mdesc_fill_in_cpu_data(cpumask_t mask);
|
|
||||||
|
|
||||||
extern void sun4v_mdesc_init(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,17 +1 @@
|
||||||
#ifndef _SPARC64_MMZONE_H
|
#include <asm-sparc/mmzone.h>
|
||||||
#define _SPARC64_MMZONE_H
|
|
||||||
|
|
||||||
#ifdef CONFIG_NEED_MULTIPLE_NODES
|
|
||||||
|
|
||||||
extern struct pglist_data *node_data[];
|
|
||||||
|
|
||||||
#define NODE_DATA(nid) (node_data[nid])
|
|
||||||
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
|
|
||||||
#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
|
|
||||||
|
|
||||||
extern int numa_cpu_lookup_table[];
|
|
||||||
extern cpumask_t numa_cpumask_lookup_table[];
|
|
||||||
|
|
||||||
#endif /* CONFIG_NEED_MULTIPLE_NODES */
|
|
||||||
|
|
||||||
#endif /* _SPARC64_MMZONE_H */
|
|
||||||
|
|
|
@ -1,118 +1 @@
|
||||||
/* ns87303.h: Configuration Register Description for the
|
#include <asm-sparc/ns87303.h>
|
||||||
* National Semiconductor PC87303 (SuperIO).
|
|
||||||
*
|
|
||||||
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SPARC_NS87303_H
|
|
||||||
#define _SPARC_NS87303_H 1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Control Register Index Values
|
|
||||||
*/
|
|
||||||
#define FER 0x00
|
|
||||||
#define FAR 0x01
|
|
||||||
#define PTR 0x02
|
|
||||||
#define FCR 0x03
|
|
||||||
#define PCR 0x04
|
|
||||||
#define KRR 0x05
|
|
||||||
#define PMC 0x06
|
|
||||||
#define TUP 0x07
|
|
||||||
#define SID 0x08
|
|
||||||
#define ASC 0x09
|
|
||||||
#define CS0CF0 0x0a
|
|
||||||
#define CS0CF1 0x0b
|
|
||||||
#define CS1CF0 0x0c
|
|
||||||
#define CS1CF1 0x0d
|
|
||||||
|
|
||||||
/* Function Enable Register (FER) bits */
|
|
||||||
#define FER_EDM 0x10 /* Encoded Drive and Motor pin information */
|
|
||||||
|
|
||||||
/* Function Address Register (FAR) bits */
|
|
||||||
#define FAR_LPT_MASK 0x03
|
|
||||||
#define FAR_LPTB 0x00
|
|
||||||
#define FAR_LPTA 0x01
|
|
||||||
#define FAR_LPTC 0x02
|
|
||||||
|
|
||||||
/* Power and Test Register (PTR) bits */
|
|
||||||
#define PTR_LPTB_IRQ7 0x08
|
|
||||||
#define PTR_LEVEL_IRQ 0x80 /* When not ECP/EPP: Use level IRQ */
|
|
||||||
#define PTR_LPT_REG_DIR 0x80 /* When ECP/EPP: LPT CTR controlls direction */
|
|
||||||
/* of the parallel port */
|
|
||||||
|
|
||||||
/* Function Control Register (FCR) bits */
|
|
||||||
#define FCR_LDE 0x10 /* Logical Drive Exchange */
|
|
||||||
#define FCR_ZWS_ENA 0x20 /* Enable short host read/write in ECP/EPP */
|
|
||||||
|
|
||||||
/* Printer Control Register (PCR) bits */
|
|
||||||
#define PCR_EPP_ENABLE 0x01
|
|
||||||
#define PCR_EPP_IEEE 0x02 /* Enable EPP Version 1.9 (IEEE 1284) */
|
|
||||||
#define PCR_ECP_ENABLE 0x04
|
|
||||||
#define PCR_ECP_CLK_ENA 0x08 /* If 0 ECP Clock is stopped on Power down */
|
|
||||||
#define PCR_IRQ_POLAR 0x20 /* If 0 IRQ is level high or negative pulse, */
|
|
||||||
/* if 1 polarity is inverted */
|
|
||||||
#define PCR_IRQ_ODRAIN 0x40 /* If 1, IRQ is open drain */
|
|
||||||
|
|
||||||
/* Tape UARTs and Parallel Port Config Register (TUP) bits */
|
|
||||||
#define TUP_EPP_TIMO 0x02 /* Enable EPP timeout IRQ */
|
|
||||||
|
|
||||||
/* Advanced SuperIO Config Register (ASC) bits */
|
|
||||||
#define ASC_LPT_IRQ7 0x01 /* Always use IRQ7 for LPT */
|
|
||||||
#define ASC_DRV2_SEL 0x02 /* Logical Drive Exchange controlled by TDR */
|
|
||||||
|
|
||||||
#define FER_RESERVED 0x00
|
|
||||||
#define FAR_RESERVED 0x00
|
|
||||||
#define PTR_RESERVED 0x73
|
|
||||||
#define FCR_RESERVED 0xc4
|
|
||||||
#define PCR_RESERVED 0x10
|
|
||||||
#define KRR_RESERVED 0x00
|
|
||||||
#define PMC_RESERVED 0x98
|
|
||||||
#define TUP_RESERVED 0xfb
|
|
||||||
#define SIP_RESERVED 0x00
|
|
||||||
#define ASC_RESERVED 0x18
|
|
||||||
#define CS0CF0_RESERVED 0x00
|
|
||||||
#define CS0CF1_RESERVED 0x08
|
|
||||||
#define CS1CF0_RESERVED 0x00
|
|
||||||
#define CS1CF1_RESERVED 0x08
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
|
|
||||||
#include <asm/system.h>
|
|
||||||
#include <asm/io.h>
|
|
||||||
|
|
||||||
extern spinlock_t ns87303_lock;
|
|
||||||
|
|
||||||
static inline int ns87303_modify(unsigned long port, unsigned int index,
|
|
||||||
unsigned char clr, unsigned char set)
|
|
||||||
{
|
|
||||||
static unsigned char reserved[] = {
|
|
||||||
FER_RESERVED, FAR_RESERVED, PTR_RESERVED, FCR_RESERVED,
|
|
||||||
PCR_RESERVED, KRR_RESERVED, PMC_RESERVED, TUP_RESERVED,
|
|
||||||
SIP_RESERVED, ASC_RESERVED, CS0CF0_RESERVED, CS0CF1_RESERVED,
|
|
||||||
CS1CF0_RESERVED, CS1CF1_RESERVED
|
|
||||||
};
|
|
||||||
unsigned long flags;
|
|
||||||
unsigned char value;
|
|
||||||
|
|
||||||
if (index > 0x0d)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&ns87303_lock, flags);
|
|
||||||
|
|
||||||
outb(index, port);
|
|
||||||
value = inb(port + 1);
|
|
||||||
value &= ~(reserved[index] | clr);
|
|
||||||
value |= set;
|
|
||||||
outb(value, port + 1);
|
|
||||||
outb(value, port + 1);
|
|
||||||
|
|
||||||
spin_unlock_irqrestore(&ns87303_lock, flags);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
|
||||||
|
|
||||||
#endif /* !(_SPARC_NS87303_H) */
|
|
||||||
|
|
|
@ -1,246 +1 @@
|
||||||
/* parport.h: sparc64 specific parport initialization and dma.
|
#include <asm-sparc/parport.h>
|
||||||
*
|
|
||||||
* Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _ASM_SPARC64_PARPORT_H
|
|
||||||
#define _ASM_SPARC64_PARPORT_H 1
|
|
||||||
|
|
||||||
#include <asm/ebus.h>
|
|
||||||
#include <asm/ns87303.h>
|
|
||||||
#include <asm/of_device.h>
|
|
||||||
#include <asm/prom.h>
|
|
||||||
|
|
||||||
#define PARPORT_PC_MAX_PORTS PARPORT_MAX
|
|
||||||
|
|
||||||
/*
|
|
||||||
* While sparc64 doesn't have an ISA DMA API, we provide something that looks
|
|
||||||
* close enough to make parport_pc happy
|
|
||||||
*/
|
|
||||||
#define HAS_DMA
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
static struct sparc_ebus_info {
|
|
||||||
struct ebus_dma_info info;
|
|
||||||
unsigned int addr;
|
|
||||||
unsigned int count;
|
|
||||||
int lock;
|
|
||||||
|
|
||||||
struct parport *port;
|
|
||||||
} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
|
|
||||||
|
|
||||||
static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS);
|
|
||||||
|
|
||||||
static inline int request_dma(unsigned int dmanr, const char *device_id)
|
|
||||||
{
|
|
||||||
if (dmanr >= PARPORT_PC_MAX_PORTS)
|
|
||||||
return -EINVAL;
|
|
||||||
if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0)
|
|
||||||
return -EBUSY;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void free_dma(unsigned int dmanr)
|
|
||||||
{
|
|
||||||
if (dmanr >= PARPORT_PC_MAX_PORTS) {
|
|
||||||
printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) {
|
|
||||||
printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void enable_dma(unsigned int dmanr)
|
|
||||||
{
|
|
||||||
ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
|
|
||||||
|
|
||||||
if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info,
|
|
||||||
sparc_ebus_dmas[dmanr].addr,
|
|
||||||
sparc_ebus_dmas[dmanr].count))
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void disable_dma(unsigned int dmanr)
|
|
||||||
{
|
|
||||||
ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void clear_dma_ff(unsigned int dmanr)
|
|
||||||
{
|
|
||||||
/* nothing */
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set_dma_mode(unsigned int dmanr, char mode)
|
|
||||||
{
|
|
||||||
ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set_dma_addr(unsigned int dmanr, unsigned int addr)
|
|
||||||
{
|
|
||||||
sparc_ebus_dmas[dmanr].addr = addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set_dma_count(unsigned int dmanr, unsigned int count)
|
|
||||||
{
|
|
||||||
sparc_ebus_dmas[dmanr].count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned int get_dma_residue(unsigned int dmanr)
|
|
||||||
{
|
|
||||||
return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match)
|
|
||||||
{
|
|
||||||
unsigned long base = op->resource[0].start;
|
|
||||||
unsigned long config = op->resource[1].start;
|
|
||||||
unsigned long d_base = op->resource[2].start;
|
|
||||||
unsigned long d_len;
|
|
||||||
struct device_node *parent;
|
|
||||||
struct parport *p;
|
|
||||||
int slot, err;
|
|
||||||
|
|
||||||
parent = op->node->parent;
|
|
||||||
if (!strcmp(parent->name, "dma")) {
|
|
||||||
p = parport_pc_probe_port(base, base + 0x400,
|
|
||||||
op->irqs[0], PARPORT_DMA_NOFIFO,
|
|
||||||
op->dev.parent->parent);
|
|
||||||
if (!p)
|
|
||||||
return -ENOMEM;
|
|
||||||
dev_set_drvdata(&op->dev, p);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) {
|
|
||||||
if (!test_and_set_bit(slot, dma_slot_map))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
err = -ENODEV;
|
|
||||||
if (slot >= PARPORT_PC_MAX_PORTS)
|
|
||||||
goto out_err;
|
|
||||||
|
|
||||||
spin_lock_init(&sparc_ebus_dmas[slot].info.lock);
|
|
||||||
|
|
||||||
d_len = (op->resource[2].end - d_base) + 1UL;
|
|
||||||
sparc_ebus_dmas[slot].info.regs =
|
|
||||||
of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA");
|
|
||||||
|
|
||||||
if (!sparc_ebus_dmas[slot].info.regs)
|
|
||||||
goto out_clear_map;
|
|
||||||
|
|
||||||
sparc_ebus_dmas[slot].info.flags = 0;
|
|
||||||
sparc_ebus_dmas[slot].info.callback = NULL;
|
|
||||||
sparc_ebus_dmas[slot].info.client_cookie = NULL;
|
|
||||||
sparc_ebus_dmas[slot].info.irq = 0xdeadbeef;
|
|
||||||
strcpy(sparc_ebus_dmas[slot].info.name, "parport");
|
|
||||||
if (ebus_dma_register(&sparc_ebus_dmas[slot].info))
|
|
||||||
goto out_unmap_regs;
|
|
||||||
|
|
||||||
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1);
|
|
||||||
|
|
||||||
/* Configure IRQ to Push Pull, Level Low */
|
|
||||||
/* Enable ECP, set bit 2 of the CTR first */
|
|
||||||
outb(0x04, base + 0x02);
|
|
||||||
ns87303_modify(config, PCR,
|
|
||||||
PCR_EPP_ENABLE |
|
|
||||||
PCR_IRQ_ODRAIN,
|
|
||||||
PCR_ECP_ENABLE |
|
|
||||||
PCR_ECP_CLK_ENA |
|
|
||||||
PCR_IRQ_POLAR);
|
|
||||||
|
|
||||||
/* CTR bit 5 controls direction of port */
|
|
||||||
ns87303_modify(config, PTR,
|
|
||||||
0, PTR_LPT_REG_DIR);
|
|
||||||
|
|
||||||
p = parport_pc_probe_port(base, base + 0x400,
|
|
||||||
op->irqs[0],
|
|
||||||
slot,
|
|
||||||
op->dev.parent);
|
|
||||||
err = -ENOMEM;
|
|
||||||
if (!p)
|
|
||||||
goto out_disable_irq;
|
|
||||||
|
|
||||||
dev_set_drvdata(&op->dev, p);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
out_disable_irq:
|
|
||||||
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
|
|
||||||
ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
|
|
||||||
|
|
||||||
out_unmap_regs:
|
|
||||||
of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len);
|
|
||||||
|
|
||||||
out_clear_map:
|
|
||||||
clear_bit(slot, dma_slot_map);
|
|
||||||
|
|
||||||
out_err:
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __devexit ecpp_remove(struct of_device *op)
|
|
||||||
{
|
|
||||||
struct parport *p = dev_get_drvdata(&op->dev);
|
|
||||||
int slot = p->dma;
|
|
||||||
|
|
||||||
parport_pc_unregister_port(p);
|
|
||||||
|
|
||||||
if (slot != PARPORT_DMA_NOFIFO) {
|
|
||||||
unsigned long d_base = op->resource[2].start;
|
|
||||||
unsigned long d_len;
|
|
||||||
|
|
||||||
d_len = (op->resource[2].end - d_base) + 1UL;
|
|
||||||
|
|
||||||
ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
|
|
||||||
ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
|
|
||||||
of_iounmap(&op->resource[2],
|
|
||||||
sparc_ebus_dmas[slot].info.regs,
|
|
||||||
d_len);
|
|
||||||
clear_bit(slot, dma_slot_map);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct of_device_id ecpp_match[] = {
|
|
||||||
{
|
|
||||||
.name = "ecpp",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "parallel",
|
|
||||||
.compatible = "ecpp",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "parallel",
|
|
||||||
.compatible = "ns87317-ecpp",
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct of_platform_driver ecpp_driver = {
|
|
||||||
.name = "ecpp",
|
|
||||||
.match_table = ecpp_match,
|
|
||||||
.probe = ecpp_probe,
|
|
||||||
.remove = __devexit_p(ecpp_remove),
|
|
||||||
};
|
|
||||||
|
|
||||||
static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
|
|
||||||
{
|
|
||||||
of_register_driver(&ecpp_driver, &of_bus_type);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !(_ASM_SPARC64_PARPORT_H */
|
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
#ifndef _SPARC64_PIL_H
|
#include <asm-sparc/pil.h>
|
||||||
#define _SPARC64_PIL_H
|
|
||||||
|
|
||||||
/* To avoid some locking problems, we hard allocate certain PILs
|
|
||||||
* for SMP cross call messages that must do a etrap/rtrap.
|
|
||||||
*
|
|
||||||
* A local_irq_disable() does not block the cross call delivery, so
|
|
||||||
* when SMP locking is an issue we reschedule the event into a PIL
|
|
||||||
* interrupt which is blocked by local_irq_disable().
|
|
||||||
*
|
|
||||||
* In fact any XCALL which has to etrap/rtrap has a problem because
|
|
||||||
* it is difficult to prevent rtrap from running BH's, and that would
|
|
||||||
* need to be done if the XCALL arrived while %pil==15.
|
|
||||||
*/
|
|
||||||
#define PIL_SMP_CALL_FUNC 1
|
|
||||||
#define PIL_SMP_RECEIVE_SIGNAL 2
|
|
||||||
#define PIL_SMP_CAPTURE 3
|
|
||||||
#define PIL_SMP_CTX_NEW_VERSION 4
|
|
||||||
#define PIL_DEVICE_IRQ 5
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_PIL_H) */
|
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
#ifndef _SPARC64_REBOOT_H
|
#include <asm-sparc/reboot.h>
|
||||||
#define _SPARC64_REBOOT_H
|
|
||||||
|
|
||||||
extern void machine_alt_power_off(void);
|
|
||||||
|
|
||||||
#endif /* _SPARC64_REBOOT_H */
|
|
||||||
|
|
|
@ -1,12 +1 @@
|
||||||
/* rwsem-const.h: RW semaphore counter constants. */
|
#include <asm-sparc/rwsem-const.h>
|
||||||
#ifndef _SPARC64_RWSEM_CONST_H
|
|
||||||
#define _SPARC64_RWSEM_CONST_H
|
|
||||||
|
|
||||||
#define RWSEM_UNLOCKED_VALUE 0x00000000
|
|
||||||
#define RWSEM_ACTIVE_BIAS 0x00000001
|
|
||||||
#define RWSEM_ACTIVE_MASK 0x0000ffff
|
|
||||||
#define RWSEM_WAITING_BIAS 0xffff0000
|
|
||||||
#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
|
|
||||||
#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
|
|
||||||
|
|
||||||
#endif /* _SPARC64_RWSEM_CONST_H */
|
|
||||||
|
|
|
@ -1,84 +1 @@
|
||||||
/*
|
#include <asm-sparc/rwsem.h>
|
||||||
* rwsem.h: R/W semaphores implemented using CAS
|
|
||||||
*
|
|
||||||
* Written by David S. Miller (davem@redhat.com), 2001.
|
|
||||||
* Derived from asm-i386/rwsem.h
|
|
||||||
*/
|
|
||||||
#ifndef _SPARC64_RWSEM_H
|
|
||||||
#define _SPARC64_RWSEM_H
|
|
||||||
|
|
||||||
#ifndef _LINUX_RWSEM_H
|
|
||||||
#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
|
|
||||||
#include <linux/list.h>
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
#include <asm/rwsem-const.h>
|
|
||||||
|
|
||||||
struct rwsem_waiter;
|
|
||||||
|
|
||||||
struct rw_semaphore {
|
|
||||||
signed int count;
|
|
||||||
spinlock_t wait_lock;
|
|
||||||
struct list_head wait_list;
|
|
||||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
|
||||||
struct lockdep_map dep_map;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
|
||||||
# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
|
|
||||||
#else
|
|
||||||
# define __RWSEM_DEP_MAP_INIT(lockname)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __RWSEM_INITIALIZER(name) \
|
|
||||||
{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \
|
|
||||||
__RWSEM_DEP_MAP_INIT(name) }
|
|
||||||
|
|
||||||
#define DECLARE_RWSEM(name) \
|
|
||||||
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
|
|
||||||
|
|
||||||
extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
|
|
||||||
struct lock_class_key *key);
|
|
||||||
|
|
||||||
#define init_rwsem(sem) \
|
|
||||||
do { \
|
|
||||||
static struct lock_class_key __key; \
|
|
||||||
\
|
|
||||||
__init_rwsem((sem), #sem, &__key); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
extern void __down_read(struct rw_semaphore *sem);
|
|
||||||
extern int __down_read_trylock(struct rw_semaphore *sem);
|
|
||||||
extern void __down_write(struct rw_semaphore *sem);
|
|
||||||
extern int __down_write_trylock(struct rw_semaphore *sem);
|
|
||||||
extern void __up_read(struct rw_semaphore *sem);
|
|
||||||
extern void __up_write(struct rw_semaphore *sem);
|
|
||||||
extern void __downgrade_write(struct rw_semaphore *sem);
|
|
||||||
|
|
||||||
static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
|
|
||||||
{
|
|
||||||
__down_write(sem);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
|
|
||||||
{
|
|
||||||
return atomic_add_return(delta, (atomic_t *)(&sem->count));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
|
|
||||||
{
|
|
||||||
atomic_add(delta, (atomic_t *)(&sem->count));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int rwsem_is_locked(struct rw_semaphore *sem)
|
|
||||||
{
|
|
||||||
return (sem->count != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
|
||||||
|
|
||||||
#endif /* _SPARC64_RWSEM_H */
|
|
||||||
|
|
|
@ -1,14 +1 @@
|
||||||
#ifndef _SPARC64_SCRATCHPAD_H
|
#include <asm-sparc/scratchpad.h>
|
||||||
#define _SPARC64_SCRATCHPAD_H
|
|
||||||
|
|
||||||
/* Sun4v scratchpad registers, accessed via ASI_SCRATCHPAD. */
|
|
||||||
|
|
||||||
#define SCRATCHPAD_MMU_MISS 0x00 /* Shared with OBP - set by OBP */
|
|
||||||
#define SCRATCHPAD_CPUID 0x08 /* Shared with OBP - set by hypervisor */
|
|
||||||
#define SCRATCHPAD_UTSBREG1 0x10
|
|
||||||
#define SCRATCHPAD_UTSBREG2 0x18
|
|
||||||
/* 0x20 and 0x28, hypervisor only... */
|
|
||||||
#define SCRATCHPAD_UNUSED1 0x30
|
|
||||||
#define SCRATCHPAD_UNUSED2 0x38 /* Reserved for OBP */
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_SCRATCHPAD_H) */
|
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
#ifndef _ASM_SECCOMP_H
|
#include <asm-sparc/seccomp.h>
|
||||||
|
|
||||||
#include <linux/thread_info.h> /* already defines TIF_32BIT */
|
|
||||||
|
|
||||||
#ifndef TIF_32BIT
|
|
||||||
#error "unexpected TIF_32BIT on sparc64"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <linux/unistd.h>
|
|
||||||
|
|
||||||
#define __NR_seccomp_read __NR_read
|
|
||||||
#define __NR_seccomp_write __NR_write
|
|
||||||
#define __NR_seccomp_exit __NR_exit
|
|
||||||
#define __NR_seccomp_sigreturn __NR_rt_sigreturn
|
|
||||||
|
|
||||||
#define __NR_seccomp_read_32 __NR_read
|
|
||||||
#define __NR_seccomp_write_32 __NR_write
|
|
||||||
#define __NR_seccomp_exit_32 __NR_exit
|
|
||||||
#define __NR_seccomp_sigreturn_32 __NR_sigreturn
|
|
||||||
|
|
||||||
#endif /* _ASM_SECCOMP_H */
|
|
||||||
|
|
|
@ -1,82 +1 @@
|
||||||
#ifndef _SPARC64_SFAFSR_H
|
#include <asm-sparc/sfafsr.h>
|
||||||
#define _SPARC64_SFAFSR_H
|
|
||||||
|
|
||||||
#include <linux/const.h>
|
|
||||||
|
|
||||||
/* Spitfire Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */
|
|
||||||
|
|
||||||
#define SFAFSR_ME (_AC(1,UL) << SFAFSR_ME_SHIFT)
|
|
||||||
#define SFAFSR_ME_SHIFT 32
|
|
||||||
#define SFAFSR_PRIV (_AC(1,UL) << SFAFSR_PRIV_SHIFT)
|
|
||||||
#define SFAFSR_PRIV_SHIFT 31
|
|
||||||
#define SFAFSR_ISAP (_AC(1,UL) << SFAFSR_ISAP_SHIFT)
|
|
||||||
#define SFAFSR_ISAP_SHIFT 30
|
|
||||||
#define SFAFSR_ETP (_AC(1,UL) << SFAFSR_ETP_SHIFT)
|
|
||||||
#define SFAFSR_ETP_SHIFT 29
|
|
||||||
#define SFAFSR_IVUE (_AC(1,UL) << SFAFSR_IVUE_SHIFT)
|
|
||||||
#define SFAFSR_IVUE_SHIFT 28
|
|
||||||
#define SFAFSR_TO (_AC(1,UL) << SFAFSR_TO_SHIFT)
|
|
||||||
#define SFAFSR_TO_SHIFT 27
|
|
||||||
#define SFAFSR_BERR (_AC(1,UL) << SFAFSR_BERR_SHIFT)
|
|
||||||
#define SFAFSR_BERR_SHIFT 26
|
|
||||||
#define SFAFSR_LDP (_AC(1,UL) << SFAFSR_LDP_SHIFT)
|
|
||||||
#define SFAFSR_LDP_SHIFT 25
|
|
||||||
#define SFAFSR_CP (_AC(1,UL) << SFAFSR_CP_SHIFT)
|
|
||||||
#define SFAFSR_CP_SHIFT 24
|
|
||||||
#define SFAFSR_WP (_AC(1,UL) << SFAFSR_WP_SHIFT)
|
|
||||||
#define SFAFSR_WP_SHIFT 23
|
|
||||||
#define SFAFSR_EDP (_AC(1,UL) << SFAFSR_EDP_SHIFT)
|
|
||||||
#define SFAFSR_EDP_SHIFT 22
|
|
||||||
#define SFAFSR_UE (_AC(1,UL) << SFAFSR_UE_SHIFT)
|
|
||||||
#define SFAFSR_UE_SHIFT 21
|
|
||||||
#define SFAFSR_CE (_AC(1,UL) << SFAFSR_CE_SHIFT)
|
|
||||||
#define SFAFSR_CE_SHIFT 20
|
|
||||||
#define SFAFSR_ETS (_AC(0xf,UL) << SFAFSR_ETS_SHIFT)
|
|
||||||
#define SFAFSR_ETS_SHIFT 16
|
|
||||||
#define SFAFSR_PSYND (_AC(0xffff,UL) << SFAFSR_PSYND_SHIFT)
|
|
||||||
#define SFAFSR_PSYND_SHIFT 0
|
|
||||||
|
|
||||||
/* UDB Error Register, ASI=0x7f VA<63:0>=0x0(High),0x18(Low) for read
|
|
||||||
* ASI=0x77 VA<63:0>=0x0(High),0x18(Low) for write
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define UDBE_UE (_AC(1,UL) << 9)
|
|
||||||
#define UDBE_CE (_AC(1,UL) << 8)
|
|
||||||
#define UDBE_E_SYNDR (_AC(0xff,UL) << 0)
|
|
||||||
|
|
||||||
/* The trap handlers for asynchronous errors encode the AFSR and
|
|
||||||
* other pieces of information into a 64-bit argument for C code
|
|
||||||
* encoded as follows:
|
|
||||||
*
|
|
||||||
* -----------------------------------------------
|
|
||||||
* | UDB_H | UDB_L | TL>1 | TT | AFSR |
|
|
||||||
* -----------------------------------------------
|
|
||||||
* 63 54 53 44 42 41 33 32 0
|
|
||||||
*
|
|
||||||
* The AFAR is passed in unchanged.
|
|
||||||
*/
|
|
||||||
#define SFSTAT_UDBH_MASK (_AC(0x3ff,UL) << SFSTAT_UDBH_SHIFT)
|
|
||||||
#define SFSTAT_UDBH_SHIFT 54
|
|
||||||
#define SFSTAT_UDBL_MASK (_AC(0x3ff,UL) << SFSTAT_UDBH_SHIFT)
|
|
||||||
#define SFSTAT_UDBL_SHIFT 44
|
|
||||||
#define SFSTAT_TL_GT_ONE (_AC(1,UL) << SFSTAT_TL_GT_ONE_SHIFT)
|
|
||||||
#define SFSTAT_TL_GT_ONE_SHIFT 42
|
|
||||||
#define SFSTAT_TRAP_TYPE (_AC(0x1FF,UL) << SFSTAT_TRAP_TYPE_SHIFT)
|
|
||||||
#define SFSTAT_TRAP_TYPE_SHIFT 33
|
|
||||||
#define SFSTAT_AFSR_MASK (_AC(0x1ffffffff,UL) << SFSTAT_AFSR_SHIFT)
|
|
||||||
#define SFSTAT_AFSR_SHIFT 0
|
|
||||||
|
|
||||||
/* ESTATE Error Enable Register, ASI=0x4b VA<63:0>=0x0 */
|
|
||||||
#define ESTATE_ERR_CE 0x1 /* Correctable errors */
|
|
||||||
#define ESTATE_ERR_NCE 0x2 /* TO, BERR, LDP, ETP, EDP, WP, UE, IVUE */
|
|
||||||
#define ESTATE_ERR_ISAP 0x4 /* System address parity error */
|
|
||||||
#define ESTATE_ERR_ALL (ESTATE_ERR_CE | \
|
|
||||||
ESTATE_ERR_NCE | \
|
|
||||||
ESTATE_ERR_ISAP)
|
|
||||||
|
|
||||||
/* The various trap types that report using the above state. */
|
|
||||||
#define TRAP_TYPE_IAE 0x09 /* Instruction Access Error */
|
|
||||||
#define TRAP_TYPE_DAE 0x32 /* Data Access Error */
|
|
||||||
#define TRAP_TYPE_CEE 0x63 /* Correctable ECC Error */
|
|
||||||
|
|
||||||
#endif /* _SPARC64_SFAFSR_H */
|
|
||||||
|
|
|
@ -1,12 +1 @@
|
||||||
#ifndef _SPARC64_SPARSEMEM_H
|
#include <asm-sparc/sparsemem.h>
|
||||||
#define _SPARC64_SPARSEMEM_H
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
|
|
||||||
#define SECTION_SIZE_BITS 30
|
|
||||||
#define MAX_PHYSADDR_BITS 42
|
|
||||||
#define MAX_PHYSMEM_BITS 42
|
|
||||||
|
|
||||||
#endif /* !(__KERNEL__) */
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_SPARSEMEM_H) */
|
|
||||||
|
|
|
@ -1,342 +1 @@
|
||||||
/* spitfire.h: SpitFire/BlackBird/Cheetah inline MMU operations.
|
#include <asm-sparc/spitfire.h>
|
||||||
*
|
|
||||||
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SPARC64_SPITFIRE_H
|
|
||||||
#define _SPARC64_SPITFIRE_H
|
|
||||||
|
|
||||||
#include <asm/asi.h>
|
|
||||||
|
|
||||||
/* The following register addresses are accessible via ASI_DMMU
|
|
||||||
* and ASI_IMMU, that is there is a distinct and unique copy of
|
|
||||||
* each these registers for each TLB.
|
|
||||||
*/
|
|
||||||
#define TSB_TAG_TARGET 0x0000000000000000 /* All chips */
|
|
||||||
#define TLB_SFSR 0x0000000000000018 /* All chips */
|
|
||||||
#define TSB_REG 0x0000000000000028 /* All chips */
|
|
||||||
#define TLB_TAG_ACCESS 0x0000000000000030 /* All chips */
|
|
||||||
#define VIRT_WATCHPOINT 0x0000000000000038 /* All chips */
|
|
||||||
#define PHYS_WATCHPOINT 0x0000000000000040 /* All chips */
|
|
||||||
#define TSB_EXTENSION_P 0x0000000000000048 /* Ultra-III and later */
|
|
||||||
#define TSB_EXTENSION_S 0x0000000000000050 /* Ultra-III and later, D-TLB only */
|
|
||||||
#define TSB_EXTENSION_N 0x0000000000000058 /* Ultra-III and later */
|
|
||||||
#define TLB_TAG_ACCESS_EXT 0x0000000000000060 /* Ultra-III+ and later */
|
|
||||||
|
|
||||||
/* These registers only exist as one entity, and are accessed
|
|
||||||
* via ASI_DMMU only.
|
|
||||||
*/
|
|
||||||
#define PRIMARY_CONTEXT 0x0000000000000008
|
|
||||||
#define SECONDARY_CONTEXT 0x0000000000000010
|
|
||||||
#define DMMU_SFAR 0x0000000000000020
|
|
||||||
#define VIRT_WATCHPOINT 0x0000000000000038
|
|
||||||
#define PHYS_WATCHPOINT 0x0000000000000040
|
|
||||||
|
|
||||||
#define SPITFIRE_HIGHEST_LOCKED_TLBENT (64 - 1)
|
|
||||||
#define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1)
|
|
||||||
|
|
||||||
#define L1DCACHE_SIZE 0x4000
|
|
||||||
|
|
||||||
#define SUN4V_CHIP_INVALID 0x00
|
|
||||||
#define SUN4V_CHIP_NIAGARA1 0x01
|
|
||||||
#define SUN4V_CHIP_NIAGARA2 0x02
|
|
||||||
#define SUN4V_CHIP_UNKNOWN 0xff
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
|
|
||||||
enum ultra_tlb_layout {
|
|
||||||
spitfire = 0,
|
|
||||||
cheetah = 1,
|
|
||||||
cheetah_plus = 2,
|
|
||||||
hypervisor = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern enum ultra_tlb_layout tlb_type;
|
|
||||||
|
|
||||||
extern int sun4v_chip_type;
|
|
||||||
|
|
||||||
extern int cheetah_pcache_forced_on;
|
|
||||||
extern void cheetah_enable_pcache(void);
|
|
||||||
|
|
||||||
#define sparc64_highest_locked_tlbent() \
|
|
||||||
(tlb_type == spitfire ? \
|
|
||||||
SPITFIRE_HIGHEST_LOCKED_TLBENT : \
|
|
||||||
CHEETAH_HIGHEST_LOCKED_TLBENT)
|
|
||||||
|
|
||||||
extern int num_kernel_image_mappings;
|
|
||||||
|
|
||||||
/* The data cache is write through, so this just invalidates the
|
|
||||||
* specified line.
|
|
||||||
*/
|
|
||||||
static inline void spitfire_put_dcache_tag(unsigned long addr, unsigned long tag)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (tag), "r" (addr), "i" (ASI_DCACHE_TAG));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The instruction cache lines are flushed with this, but note that
|
|
||||||
* this does not flush the pipeline. It is possible for a line to
|
|
||||||
* get flushed but stale instructions to still be in the pipeline,
|
|
||||||
* a flush instruction (to any address) is sufficient to handle
|
|
||||||
* this issue after the line is invalidated.
|
|
||||||
*/
|
|
||||||
static inline void spitfire_put_icache_tag(unsigned long addr, unsigned long tag)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (tag), "r" (addr), "i" (ASI_IC_TAG));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long spitfire_get_dtlb_data(int entry)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (data)
|
|
||||||
: "r" (entry << 3), "i" (ASI_DTLB_DATA_ACCESS));
|
|
||||||
|
|
||||||
/* Clear TTE diag bits. */
|
|
||||||
data &= ~0x0003fe0000000000UL;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long spitfire_get_dtlb_tag(int entry)
|
|
||||||
{
|
|
||||||
unsigned long tag;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (tag)
|
|
||||||
: "r" (entry << 3), "i" (ASI_DTLB_TAG_READ));
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void spitfire_put_dtlb_data(int entry, unsigned long data)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (data), "r" (entry << 3),
|
|
||||||
"i" (ASI_DTLB_DATA_ACCESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long spitfire_get_itlb_data(int entry)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (data)
|
|
||||||
: "r" (entry << 3), "i" (ASI_ITLB_DATA_ACCESS));
|
|
||||||
|
|
||||||
/* Clear TTE diag bits. */
|
|
||||||
data &= ~0x0003fe0000000000UL;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long spitfire_get_itlb_tag(int entry)
|
|
||||||
{
|
|
||||||
unsigned long tag;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (tag)
|
|
||||||
: "r" (entry << 3), "i" (ASI_ITLB_TAG_READ));
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void spitfire_put_itlb_data(int entry, unsigned long data)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (data), "r" (entry << 3),
|
|
||||||
"i" (ASI_ITLB_DATA_ACCESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void spitfire_flush_dtlb_nucleus_page(unsigned long page)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (page | 0x20), "i" (ASI_DMMU_DEMAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void spitfire_flush_itlb_nucleus_page(unsigned long page)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (page | 0x20), "i" (ASI_IMMU_DEMAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cheetah has "all non-locked" tlb flushes. */
|
|
||||||
static inline void cheetah_flush_dtlb_all(void)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (0x80), "i" (ASI_DMMU_DEMAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cheetah_flush_itlb_all(void)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (0x80), "i" (ASI_IMMU_DEMAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cheetah has a 4-tlb layout so direct access is a bit different.
|
|
||||||
* The first two TLBs are fully assosciative, hold 16 entries, and are
|
|
||||||
* used only for locked and >8K sized translations. One exists for
|
|
||||||
* data accesses and one for instruction accesses.
|
|
||||||
*
|
|
||||||
* The third TLB is for data accesses to 8K non-locked translations, is
|
|
||||||
* 2 way assosciative, and holds 512 entries. The fourth TLB is for
|
|
||||||
* instruction accesses to 8K non-locked translations, is 2 way
|
|
||||||
* assosciative, and holds 128 entries.
|
|
||||||
*
|
|
||||||
* Cheetah has some bug where bogus data can be returned from
|
|
||||||
* ASI_{D,I}TLB_DATA_ACCESS loads, doing the load twice fixes
|
|
||||||
* the problem for me. -DaveM
|
|
||||||
*/
|
|
||||||
static inline unsigned long cheetah_get_ldtlb_data(int entry)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
|
||||||
"ldxa [%1] %2, %0"
|
|
||||||
: "=r" (data)
|
|
||||||
: "r" ((0 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_DTLB_DATA_ACCESS));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_litlb_data(int entry)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
|
||||||
"ldxa [%1] %2, %0"
|
|
||||||
: "=r" (data)
|
|
||||||
: "r" ((0 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_ITLB_DATA_ACCESS));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_ldtlb_tag(int entry)
|
|
||||||
{
|
|
||||||
unsigned long tag;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (tag)
|
|
||||||
: "r" ((0 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_DTLB_TAG_READ));
|
|
||||||
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_litlb_tag(int entry)
|
|
||||||
{
|
|
||||||
unsigned long tag;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (tag)
|
|
||||||
: "r" ((0 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_ITLB_TAG_READ));
|
|
||||||
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cheetah_put_ldtlb_data(int entry, unsigned long data)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (data),
|
|
||||||
"r" ((0 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_DTLB_DATA_ACCESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cheetah_put_litlb_data(int entry, unsigned long data)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (data),
|
|
||||||
"r" ((0 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_ITLB_DATA_ACCESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_dtlb_data(int entry, int tlb)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
|
||||||
"ldxa [%1] %2, %0"
|
|
||||||
: "=r" (data)
|
|
||||||
: "r" ((tlb << 16) | (entry << 3)), "i" (ASI_DTLB_DATA_ACCESS));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_dtlb_tag(int entry, int tlb)
|
|
||||||
{
|
|
||||||
unsigned long tag;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (tag)
|
|
||||||
: "r" ((tlb << 16) | (entry << 3)), "i" (ASI_DTLB_TAG_READ));
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cheetah_put_dtlb_data(int entry, unsigned long data, int tlb)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (data),
|
|
||||||
"r" ((tlb << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_DTLB_DATA_ACCESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_itlb_data(int entry)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %%g0\n\t"
|
|
||||||
"ldxa [%1] %2, %0"
|
|
||||||
: "=r" (data)
|
|
||||||
: "r" ((2 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_ITLB_DATA_ACCESS));
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long cheetah_get_itlb_tag(int entry)
|
|
||||||
{
|
|
||||||
unsigned long tag;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa [%1] %2, %0"
|
|
||||||
: "=r" (tag)
|
|
||||||
: "r" ((2 << 16) | (entry << 3)), "i" (ASI_ITLB_TAG_READ));
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cheetah_put_itlb_data(int entry, unsigned long data)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
|
|
||||||
"membar #Sync"
|
|
||||||
: /* No outputs */
|
|
||||||
: "r" (data), "r" ((2 << 16) | (entry << 3)),
|
|
||||||
"i" (ASI_ITLB_DATA_ACCESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !(__ASSEMBLY__) */
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_SPITFIRE_H) */
|
|
||||||
|
|
|
@ -1,13 +1 @@
|
||||||
#ifndef _SPARC64_SSTATE_H
|
#include <asm-sparc/sstate.h>
|
||||||
#define _SPARC64_SSTATE_H
|
|
||||||
|
|
||||||
extern void sstate_booting(void);
|
|
||||||
extern void sstate_running(void);
|
|
||||||
extern void sstate_halt(void);
|
|
||||||
extern void sstate_poweroff(void);
|
|
||||||
extern void sstate_panic(void);
|
|
||||||
extern void sstate_reboot(void);
|
|
||||||
|
|
||||||
extern void sun4v_sstate_init(void);
|
|
||||||
|
|
||||||
#endif /* _SPARC64_SSTATE_H */
|
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
#ifndef _SPARC64_STACKTRACE_H
|
#include <asm-sparc/stacktrace.h>
|
||||||
#define _SPARC64_STACKTRACE_H
|
|
||||||
|
|
||||||
extern void stack_trace_flush(void);
|
|
||||||
|
|
||||||
#endif /* _SPARC64_STACKTRACE_H */
|
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
/*
|
#include <asm-sparc/starfire.h>
|
||||||
* starfire.h: Group all starfire specific code together.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2000 Anton Blanchard (anton@samba.org)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SPARC64_STARFIRE_H
|
|
||||||
#define _SPARC64_STARFIRE_H
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
|
|
||||||
extern int this_is_starfire;
|
|
||||||
|
|
||||||
extern void check_if_starfire(void);
|
|
||||||
extern void starfire_cpu_setup(void);
|
|
||||||
extern int starfire_hard_smp_processor_id(void);
|
|
||||||
extern void starfire_hookup(int);
|
|
||||||
extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,13 +1 @@
|
||||||
#ifndef _SPARC64_SYSCALLS_H
|
#include <asm-sparc/syscalls.h>
|
||||||
#define _SPARC64_SYSCALLS_H
|
|
||||||
|
|
||||||
struct pt_regs;
|
|
||||||
|
|
||||||
extern asmlinkage long sparc_do_fork(unsigned long clone_flags,
|
|
||||||
unsigned long stack_start,
|
|
||||||
struct pt_regs *regs,
|
|
||||||
unsigned long stack_size);
|
|
||||||
|
|
||||||
extern asmlinkage int sparc_execve(struct pt_regs *regs);
|
|
||||||
|
|
||||||
#endif /* _SPARC64_SYSCALLS_H */
|
|
||||||
|
|
|
@ -1,283 +1 @@
|
||||||
#ifndef _SPARC64_TSB_H
|
#include <asm-sparc/tsb.h>
|
||||||
#define _SPARC64_TSB_H
|
|
||||||
|
|
||||||
/* The sparc64 TSB is similar to the powerpc hashtables. It's a
|
|
||||||
* power-of-2 sized table of TAG/PTE pairs. The cpu precomputes
|
|
||||||
* pointers into this table for 8K and 64K page sizes, and also a
|
|
||||||
* comparison TAG based upon the virtual address and context which
|
|
||||||
* faults.
|
|
||||||
*
|
|
||||||
* TLB miss trap handler software does the actual lookup via something
|
|
||||||
* of the form:
|
|
||||||
*
|
|
||||||
* ldxa [%g0] ASI_{D,I}MMU_TSB_8KB_PTR, %g1
|
|
||||||
* ldxa [%g0] ASI_{D,I}MMU, %g6
|
|
||||||
* sllx %g6, 22, %g6
|
|
||||||
* srlx %g6, 22, %g6
|
|
||||||
* ldda [%g1] ASI_NUCLEUS_QUAD_LDD, %g4
|
|
||||||
* cmp %g4, %g6
|
|
||||||
* bne,pn %xcc, tsb_miss_{d,i}tlb
|
|
||||||
* mov FAULT_CODE_{D,I}TLB, %g3
|
|
||||||
* stxa %g5, [%g0] ASI_{D,I}TLB_DATA_IN
|
|
||||||
* retry
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Each 16-byte slot of the TSB is the 8-byte tag and then the 8-byte
|
|
||||||
* PTE. The TAG is of the same layout as the TLB TAG TARGET mmu
|
|
||||||
* register which is:
|
|
||||||
*
|
|
||||||
* -------------------------------------------------
|
|
||||||
* | - | CONTEXT | - | VADDR bits 63:22 |
|
|
||||||
* -------------------------------------------------
|
|
||||||
* 63 61 60 48 47 42 41 0
|
|
||||||
*
|
|
||||||
* But actually, since we use per-mm TSB's, we zero out the CONTEXT
|
|
||||||
* field.
|
|
||||||
*
|
|
||||||
* Like the powerpc hashtables we need to use locking in order to
|
|
||||||
* synchronize while we update the entries. PTE updates need locking
|
|
||||||
* as well.
|
|
||||||
*
|
|
||||||
* We need to carefully choose a lock bits for the TSB entry. We
|
|
||||||
* choose to use bit 47 in the tag. Also, since we never map anything
|
|
||||||
* at page zero in context zero, we use zero as an invalid tag entry.
|
|
||||||
* When the lock bit is set, this forces a tag comparison failure.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define TSB_TAG_LOCK_BIT 47
|
|
||||||
#define TSB_TAG_LOCK_HIGH (1 << (TSB_TAG_LOCK_BIT - 32))
|
|
||||||
|
|
||||||
#define TSB_TAG_INVALID_BIT 46
|
|
||||||
#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32))
|
|
||||||
|
|
||||||
#define TSB_MEMBAR membar #StoreStore
|
|
||||||
|
|
||||||
/* Some cpus support physical address quad loads. We want to use
|
|
||||||
* those if possible so we don't need to hard-lock the TSB mapping
|
|
||||||
* into the TLB. We encode some instruction patching in order to
|
|
||||||
* support this.
|
|
||||||
*
|
|
||||||
* The kernel TSB is locked into the TLB by virtue of being in the
|
|
||||||
* kernel image, so we don't play these games for swapper_tsb access.
|
|
||||||
*/
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
struct tsb_ldquad_phys_patch_entry {
|
|
||||||
unsigned int addr;
|
|
||||||
unsigned int sun4u_insn;
|
|
||||||
unsigned int sun4v_insn;
|
|
||||||
};
|
|
||||||
extern struct tsb_ldquad_phys_patch_entry __tsb_ldquad_phys_patch,
|
|
||||||
__tsb_ldquad_phys_patch_end;
|
|
||||||
|
|
||||||
struct tsb_phys_patch_entry {
|
|
||||||
unsigned int addr;
|
|
||||||
unsigned int insn;
|
|
||||||
};
|
|
||||||
extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
|
|
||||||
#endif
|
|
||||||
#define TSB_LOAD_QUAD(TSB, REG) \
|
|
||||||
661: ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG; \
|
|
||||||
.section .tsb_ldquad_phys_patch, "ax"; \
|
|
||||||
.word 661b; \
|
|
||||||
ldda [TSB] ASI_QUAD_LDD_PHYS, REG; \
|
|
||||||
ldda [TSB] ASI_QUAD_LDD_PHYS_4V, REG; \
|
|
||||||
.previous
|
|
||||||
|
|
||||||
#define TSB_LOAD_TAG_HIGH(TSB, REG) \
|
|
||||||
661: lduwa [TSB] ASI_N, REG; \
|
|
||||||
.section .tsb_phys_patch, "ax"; \
|
|
||||||
.word 661b; \
|
|
||||||
lduwa [TSB] ASI_PHYS_USE_EC, REG; \
|
|
||||||
.previous
|
|
||||||
|
|
||||||
#define TSB_LOAD_TAG(TSB, REG) \
|
|
||||||
661: ldxa [TSB] ASI_N, REG; \
|
|
||||||
.section .tsb_phys_patch, "ax"; \
|
|
||||||
.word 661b; \
|
|
||||||
ldxa [TSB] ASI_PHYS_USE_EC, REG; \
|
|
||||||
.previous
|
|
||||||
|
|
||||||
#define TSB_CAS_TAG_HIGH(TSB, REG1, REG2) \
|
|
||||||
661: casa [TSB] ASI_N, REG1, REG2; \
|
|
||||||
.section .tsb_phys_patch, "ax"; \
|
|
||||||
.word 661b; \
|
|
||||||
casa [TSB] ASI_PHYS_USE_EC, REG1, REG2; \
|
|
||||||
.previous
|
|
||||||
|
|
||||||
#define TSB_CAS_TAG(TSB, REG1, REG2) \
|
|
||||||
661: casxa [TSB] ASI_N, REG1, REG2; \
|
|
||||||
.section .tsb_phys_patch, "ax"; \
|
|
||||||
.word 661b; \
|
|
||||||
casxa [TSB] ASI_PHYS_USE_EC, REG1, REG2; \
|
|
||||||
.previous
|
|
||||||
|
|
||||||
#define TSB_STORE(ADDR, VAL) \
|
|
||||||
661: stxa VAL, [ADDR] ASI_N; \
|
|
||||||
.section .tsb_phys_patch, "ax"; \
|
|
||||||
.word 661b; \
|
|
||||||
stxa VAL, [ADDR] ASI_PHYS_USE_EC; \
|
|
||||||
.previous
|
|
||||||
|
|
||||||
#define TSB_LOCK_TAG(TSB, REG1, REG2) \
|
|
||||||
99: TSB_LOAD_TAG_HIGH(TSB, REG1); \
|
|
||||||
sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
|
|
||||||
andcc REG1, REG2, %g0; \
|
|
||||||
bne,pn %icc, 99b; \
|
|
||||||
nop; \
|
|
||||||
TSB_CAS_TAG_HIGH(TSB, REG1, REG2); \
|
|
||||||
cmp REG1, REG2; \
|
|
||||||
bne,pn %icc, 99b; \
|
|
||||||
nop; \
|
|
||||||
TSB_MEMBAR
|
|
||||||
|
|
||||||
#define TSB_WRITE(TSB, TTE, TAG) \
|
|
||||||
add TSB, 0x8, TSB; \
|
|
||||||
TSB_STORE(TSB, TTE); \
|
|
||||||
sub TSB, 0x8, TSB; \
|
|
||||||
TSB_MEMBAR; \
|
|
||||||
TSB_STORE(TSB, TAG);
|
|
||||||
|
|
||||||
#define KTSB_LOAD_QUAD(TSB, REG) \
|
|
||||||
ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG;
|
|
||||||
|
|
||||||
#define KTSB_STORE(ADDR, VAL) \
|
|
||||||
stxa VAL, [ADDR] ASI_N;
|
|
||||||
|
|
||||||
#define KTSB_LOCK_TAG(TSB, REG1, REG2) \
|
|
||||||
99: lduwa [TSB] ASI_N, REG1; \
|
|
||||||
sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
|
|
||||||
andcc REG1, REG2, %g0; \
|
|
||||||
bne,pn %icc, 99b; \
|
|
||||||
nop; \
|
|
||||||
casa [TSB] ASI_N, REG1, REG2;\
|
|
||||||
cmp REG1, REG2; \
|
|
||||||
bne,pn %icc, 99b; \
|
|
||||||
nop; \
|
|
||||||
TSB_MEMBAR
|
|
||||||
|
|
||||||
#define KTSB_WRITE(TSB, TTE, TAG) \
|
|
||||||
add TSB, 0x8, TSB; \
|
|
||||||
stxa TTE, [TSB] ASI_N; \
|
|
||||||
sub TSB, 0x8, TSB; \
|
|
||||||
TSB_MEMBAR; \
|
|
||||||
stxa TAG, [TSB] ASI_N;
|
|
||||||
|
|
||||||
/* Do a kernel page table walk. Leaves physical PTE pointer in
|
|
||||||
* REG1. Jumps to FAIL_LABEL on early page table walk termination.
|
|
||||||
* VADDR will not be clobbered, but REG2 will.
|
|
||||||
*/
|
|
||||||
#define KERN_PGTABLE_WALK(VADDR, REG1, REG2, FAIL_LABEL) \
|
|
||||||
sethi %hi(swapper_pg_dir), REG1; \
|
|
||||||
or REG1, %lo(swapper_pg_dir), REG1; \
|
|
||||||
sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
|
|
||||||
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
|
||||||
andn REG2, 0x3, REG2; \
|
|
||||||
lduw [REG1 + REG2], REG1; \
|
|
||||||
brz,pn REG1, FAIL_LABEL; \
|
|
||||||
sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
|
|
||||||
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
|
||||||
sllx REG1, 11, REG1; \
|
|
||||||
andn REG2, 0x3, REG2; \
|
|
||||||
lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
|
|
||||||
brz,pn REG1, FAIL_LABEL; \
|
|
||||||
sllx VADDR, 64 - PMD_SHIFT, REG2; \
|
|
||||||
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
|
||||||
sllx REG1, 11, REG1; \
|
|
||||||
andn REG2, 0x7, REG2; \
|
|
||||||
add REG1, REG2, REG1;
|
|
||||||
|
|
||||||
/* Do a user page table walk in MMU globals. Leaves physical PTE
|
|
||||||
* pointer in REG1. Jumps to FAIL_LABEL on early page table walk
|
|
||||||
* termination. Physical base of page tables is in PHYS_PGD which
|
|
||||||
* will not be modified.
|
|
||||||
*
|
|
||||||
* VADDR will not be clobbered, but REG1 and REG2 will.
|
|
||||||
*/
|
|
||||||
#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \
|
|
||||||
sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
|
|
||||||
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
|
||||||
andn REG2, 0x3, REG2; \
|
|
||||||
lduwa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \
|
|
||||||
brz,pn REG1, FAIL_LABEL; \
|
|
||||||
sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
|
|
||||||
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
|
||||||
sllx REG1, 11, REG1; \
|
|
||||||
andn REG2, 0x3, REG2; \
|
|
||||||
lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
|
|
||||||
brz,pn REG1, FAIL_LABEL; \
|
|
||||||
sllx VADDR, 64 - PMD_SHIFT, REG2; \
|
|
||||||
srlx REG2, 64 - PAGE_SHIFT, REG2; \
|
|
||||||
sllx REG1, 11, REG1; \
|
|
||||||
andn REG2, 0x7, REG2; \
|
|
||||||
add REG1, REG2, REG1;
|
|
||||||
|
|
||||||
/* Lookup a OBP mapping on VADDR in the prom_trans[] table at TL>0.
|
|
||||||
* If no entry is found, FAIL_LABEL will be branched to. On success
|
|
||||||
* the resulting PTE value will be left in REG1. VADDR is preserved
|
|
||||||
* by this routine.
|
|
||||||
*/
|
|
||||||
#define OBP_TRANS_LOOKUP(VADDR, REG1, REG2, REG3, FAIL_LABEL) \
|
|
||||||
sethi %hi(prom_trans), REG1; \
|
|
||||||
or REG1, %lo(prom_trans), REG1; \
|
|
||||||
97: ldx [REG1 + 0x00], REG2; \
|
|
||||||
brz,pn REG2, FAIL_LABEL; \
|
|
||||||
nop; \
|
|
||||||
ldx [REG1 + 0x08], REG3; \
|
|
||||||
add REG2, REG3, REG3; \
|
|
||||||
cmp REG2, VADDR; \
|
|
||||||
bgu,pt %xcc, 98f; \
|
|
||||||
cmp VADDR, REG3; \
|
|
||||||
bgeu,pt %xcc, 98f; \
|
|
||||||
ldx [REG1 + 0x10], REG3; \
|
|
||||||
sub VADDR, REG2, REG2; \
|
|
||||||
ba,pt %xcc, 99f; \
|
|
||||||
add REG3, REG2, REG1; \
|
|
||||||
98: ba,pt %xcc, 97b; \
|
|
||||||
add REG1, (3 * 8), REG1; \
|
|
||||||
99:
|
|
||||||
|
|
||||||
/* We use a 32K TSB for the whole kernel, this allows to
|
|
||||||
* handle about 16MB of modules and vmalloc mappings without
|
|
||||||
* incurring many hash conflicts.
|
|
||||||
*/
|
|
||||||
#define KERNEL_TSB_SIZE_BYTES (32 * 1024)
|
|
||||||
#define KERNEL_TSB_NENTRIES \
|
|
||||||
(KERNEL_TSB_SIZE_BYTES / 16)
|
|
||||||
#define KERNEL_TSB4M_NENTRIES 4096
|
|
||||||
|
|
||||||
/* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
|
|
||||||
* on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries
|
|
||||||
* and the found TTE will be left in REG1. REG3 and REG4 must
|
|
||||||
* be an even/odd pair of registers.
|
|
||||||
*
|
|
||||||
* VADDR and TAG will be preserved and not clobbered by this macro.
|
|
||||||
*/
|
|
||||||
#define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
|
|
||||||
sethi %hi(swapper_tsb), REG1; \
|
|
||||||
or REG1, %lo(swapper_tsb), REG1; \
|
|
||||||
srlx VADDR, PAGE_SHIFT, REG2; \
|
|
||||||
and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
|
|
||||||
sllx REG2, 4, REG2; \
|
|
||||||
add REG1, REG2, REG2; \
|
|
||||||
KTSB_LOAD_QUAD(REG2, REG3); \
|
|
||||||
cmp REG3, TAG; \
|
|
||||||
be,a,pt %xcc, OK_LABEL; \
|
|
||||||
mov REG4, REG1;
|
|
||||||
|
|
||||||
#ifndef CONFIG_DEBUG_PAGEALLOC
|
|
||||||
/* This version uses a trick, the TAG is already (VADDR >> 22) so
|
|
||||||
* we can make use of that for the index computation.
|
|
||||||
*/
|
|
||||||
#define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
|
|
||||||
sethi %hi(swapper_4m_tsb), REG1; \
|
|
||||||
or REG1, %lo(swapper_4m_tsb), REG1; \
|
|
||||||
and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
|
|
||||||
sllx REG2, 4, REG2; \
|
|
||||||
add REG1, REG2, REG2; \
|
|
||||||
KTSB_LOAD_QUAD(REG2, REG3); \
|
|
||||||
cmp REG3, TAG; \
|
|
||||||
be,a,pt %xcc, OK_LABEL; \
|
|
||||||
mov REG4, REG1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_TSB_H) */
|
|
||||||
|
|
|
@ -1,658 +1 @@
|
||||||
#ifndef _SPARC64_TTABLE_H
|
#include <asm-sparc/ttable.h>
|
||||||
#define _SPARC64_TTABLE_H
|
|
||||||
|
|
||||||
#include <asm/utrap.h>
|
|
||||||
|
|
||||||
#ifdef __ASSEMBLY__
|
|
||||||
#include <asm/thread_info.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;
|
|
||||||
|
|
||||||
/* We need a "cleaned" instruction... */
|
|
||||||
#define CLEAN_WINDOW \
|
|
||||||
rdpr %cleanwin, %l0; add %l0, 1, %l0; \
|
|
||||||
wrpr %l0, 0x0, %cleanwin; \
|
|
||||||
clr %o0; clr %o1; clr %o2; clr %o3; \
|
|
||||||
clr %o4; clr %o5; clr %o6; clr %o7; \
|
|
||||||
clr %l0; clr %l1; clr %l2; clr %l3; \
|
|
||||||
clr %l4; clr %l5; clr %l6; clr %l7; \
|
|
||||||
retry; \
|
|
||||||
nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
|
|
||||||
|
|
||||||
#define TRAP(routine) \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, etrap; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
call routine; \
|
|
||||||
add %sp, PTREGS_OFF, %o0; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
nop; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define TRAP_7INSNS(routine) \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, etrap; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
call routine; \
|
|
||||||
add %sp, PTREGS_OFF, %o0; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define TRAP_SAVEFPU(routine) \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, do_fptrap; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
call routine; \
|
|
||||||
add %sp, PTREGS_OFF, %o0; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
nop; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define TRAP_NOSAVE(routine) \
|
|
||||||
ba,pt %xcc, routine; \
|
|
||||||
nop; \
|
|
||||||
nop; nop; nop; nop; nop; nop;
|
|
||||||
|
|
||||||
#define TRAP_NOSAVE_7INSNS(routine) \
|
|
||||||
ba,pt %xcc, routine; \
|
|
||||||
nop; \
|
|
||||||
nop; nop; nop; nop; nop;
|
|
||||||
|
|
||||||
#define TRAPTL1(routine) \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, etraptl1; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
call routine; \
|
|
||||||
add %sp, PTREGS_OFF, %o0; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
nop; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define TRAP_ARG(routine, arg) \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, etrap; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
add %sp, PTREGS_OFF, %o0; \
|
|
||||||
call routine; \
|
|
||||||
mov arg, %o1; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define TRAPTL1_ARG(routine, arg) \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, etraptl1; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
add %sp, PTREGS_OFF, %o0; \
|
|
||||||
call routine; \
|
|
||||||
mov arg, %o1; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define SYSCALL_TRAP(routine, systbl) \
|
|
||||||
rdpr %pil, %g2; \
|
|
||||||
mov TSTATE_SYSCALL, %g3; \
|
|
||||||
sethi %hi(109f), %g7; \
|
|
||||||
ba,pt %xcc, etrap_syscall; \
|
|
||||||
109: or %g7, %lo(109b), %g7; \
|
|
||||||
sethi %hi(systbl), %l7; \
|
|
||||||
ba,pt %xcc, routine; \
|
|
||||||
or %l7, %lo(systbl), %l7;
|
|
||||||
|
|
||||||
#define TRAP_UTRAP(handler,lvl) \
|
|
||||||
mov handler, %g3; \
|
|
||||||
ba,pt %xcc, utrap_trap; \
|
|
||||||
mov lvl, %g4; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
|
||||||
#define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)
|
|
||||||
#else
|
|
||||||
#define LINUX_32BIT_SYSCALL_TRAP BTRAP(0x110)
|
|
||||||
#endif
|
|
||||||
#define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)
|
|
||||||
#define GETCC_TRAP TRAP(getcc)
|
|
||||||
#define SETCC_TRAP TRAP(setcc)
|
|
||||||
#define BREAKPOINT_TRAP TRAP(breakpoint_trap)
|
|
||||||
|
|
||||||
#ifdef CONFIG_TRACE_IRQFLAGS
|
|
||||||
|
|
||||||
#define TRAP_IRQ(routine, level) \
|
|
||||||
rdpr %pil, %g2; \
|
|
||||||
wrpr %g0, 15, %pil; \
|
|
||||||
sethi %hi(1f-4), %g7; \
|
|
||||||
ba,pt %xcc, etrap_irq; \
|
|
||||||
or %g7, %lo(1f-4), %g7; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
.subsection 2; \
|
|
||||||
1: call trace_hardirqs_off; \
|
|
||||||
nop; \
|
|
||||||
mov level, %o0; \
|
|
||||||
call routine; \
|
|
||||||
add %sp, PTREGS_OFF, %o1; \
|
|
||||||
ba,a,pt %xcc, rtrap_irq; \
|
|
||||||
.previous;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define TRAP_IRQ(routine, level) \
|
|
||||||
rdpr %pil, %g2; \
|
|
||||||
wrpr %g0, 15, %pil; \
|
|
||||||
ba,pt %xcc, etrap_irq; \
|
|
||||||
rd %pc, %g7; \
|
|
||||||
mov level, %o0; \
|
|
||||||
call routine; \
|
|
||||||
add %sp, PTREGS_OFF, %o1; \
|
|
||||||
ba,a,pt %xcc, rtrap_irq;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
|
|
||||||
|
|
||||||
#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
|
|
||||||
|
|
||||||
#define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)
|
|
||||||
|
|
||||||
#define FLUSH_WINDOW_TRAP \
|
|
||||||
ba,pt %xcc, etrap; \
|
|
||||||
rd %pc, %g7; \
|
|
||||||
flushw; \
|
|
||||||
ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1; \
|
|
||||||
add %l1, 4, %l2; \
|
|
||||||
stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \
|
|
||||||
ba,pt %xcc, rtrap; \
|
|
||||||
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC];
|
|
||||||
|
|
||||||
#ifdef CONFIG_KPROBES
|
|
||||||
#define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)
|
|
||||||
#else
|
|
||||||
#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_KGDB
|
|
||||||
#define KGDB_TRAP(lvl) TRAP_IRQ(kgdb_trap, lvl)
|
|
||||||
#else
|
|
||||||
#define KGDB_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SUN4V_ITSB_MISS \
|
|
||||||
ldxa [%g0] ASI_SCRATCHPAD, %g2; \
|
|
||||||
ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \
|
|
||||||
ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5; \
|
|
||||||
srlx %g4, 22, %g6; \
|
|
||||||
ba,pt %xcc, sun4v_itsb_miss; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
#define SUN4V_DTSB_MISS \
|
|
||||||
ldxa [%g0] ASI_SCRATCHPAD, %g2; \
|
|
||||||
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \
|
|
||||||
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \
|
|
||||||
srlx %g4, 22, %g6; \
|
|
||||||
ba,pt %xcc, sun4v_dtsb_miss; \
|
|
||||||
nop; \
|
|
||||||
nop; \
|
|
||||||
nop;
|
|
||||||
|
|
||||||
/* Before touching these macros, you owe it to yourself to go and
|
|
||||||
* see how arch/sparc64/kernel/winfixup.S works... -DaveM
|
|
||||||
*
|
|
||||||
* For the user cases we used to use the %asi register, but
|
|
||||||
* it turns out that the "wr xxx, %asi" costs ~5 cycles, so
|
|
||||||
* now we use immediate ASI loads and stores instead. Kudos
|
|
||||||
* to Greg Onufer for pointing out this performance anomaly.
|
|
||||||
*
|
|
||||||
* Further note that we cannot use the g2, g4, g5, and g7 alternate
|
|
||||||
* globals in the spill routines, check out the save instruction in
|
|
||||||
* arch/sparc64/kernel/etrap.S to see what I mean about g2, and
|
|
||||||
* g4/g5 are the globals which are preserved by etrap processing
|
|
||||||
* for the caller of it. The g7 register is the return pc for
|
|
||||||
* etrap. Finally, g6 is the current thread register so we cannot
|
|
||||||
* us it in the spill handlers either. Most of these rules do not
|
|
||||||
* apply to fill processing, only g6 is not usable.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Normal kernel spill */
|
|
||||||
#define SPILL_0_NORMAL \
|
|
||||||
stx %l0, [%sp + STACK_BIAS + 0x00]; \
|
|
||||||
stx %l1, [%sp + STACK_BIAS + 0x08]; \
|
|
||||||
stx %l2, [%sp + STACK_BIAS + 0x10]; \
|
|
||||||
stx %l3, [%sp + STACK_BIAS + 0x18]; \
|
|
||||||
stx %l4, [%sp + STACK_BIAS + 0x20]; \
|
|
||||||
stx %l5, [%sp + STACK_BIAS + 0x28]; \
|
|
||||||
stx %l6, [%sp + STACK_BIAS + 0x30]; \
|
|
||||||
stx %l7, [%sp + STACK_BIAS + 0x38]; \
|
|
||||||
stx %i0, [%sp + STACK_BIAS + 0x40]; \
|
|
||||||
stx %i1, [%sp + STACK_BIAS + 0x48]; \
|
|
||||||
stx %i2, [%sp + STACK_BIAS + 0x50]; \
|
|
||||||
stx %i3, [%sp + STACK_BIAS + 0x58]; \
|
|
||||||
stx %i4, [%sp + STACK_BIAS + 0x60]; \
|
|
||||||
stx %i5, [%sp + STACK_BIAS + 0x68]; \
|
|
||||||
stx %i6, [%sp + STACK_BIAS + 0x70]; \
|
|
||||||
stx %i7, [%sp + STACK_BIAS + 0x78]; \
|
|
||||||
saved; retry; nop; nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop; nop; nop; nop; nop;
|
|
||||||
|
|
||||||
#define SPILL_0_NORMAL_ETRAP \
|
|
||||||
etrap_kernel_spill: \
|
|
||||||
stx %l0, [%sp + STACK_BIAS + 0x00]; \
|
|
||||||
stx %l1, [%sp + STACK_BIAS + 0x08]; \
|
|
||||||
stx %l2, [%sp + STACK_BIAS + 0x10]; \
|
|
||||||
stx %l3, [%sp + STACK_BIAS + 0x18]; \
|
|
||||||
stx %l4, [%sp + STACK_BIAS + 0x20]; \
|
|
||||||
stx %l5, [%sp + STACK_BIAS + 0x28]; \
|
|
||||||
stx %l6, [%sp + STACK_BIAS + 0x30]; \
|
|
||||||
stx %l7, [%sp + STACK_BIAS + 0x38]; \
|
|
||||||
stx %i0, [%sp + STACK_BIAS + 0x40]; \
|
|
||||||
stx %i1, [%sp + STACK_BIAS + 0x48]; \
|
|
||||||
stx %i2, [%sp + STACK_BIAS + 0x50]; \
|
|
||||||
stx %i3, [%sp + STACK_BIAS + 0x58]; \
|
|
||||||
stx %i4, [%sp + STACK_BIAS + 0x60]; \
|
|
||||||
stx %i5, [%sp + STACK_BIAS + 0x68]; \
|
|
||||||
stx %i6, [%sp + STACK_BIAS + 0x70]; \
|
|
||||||
stx %i7, [%sp + STACK_BIAS + 0x78]; \
|
|
||||||
saved; \
|
|
||||||
sub %g1, 2, %g1; \
|
|
||||||
ba,pt %xcc, etrap_save; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
nop; nop; nop; nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop;
|
|
||||||
|
|
||||||
/* Normal 64bit spill */
|
|
||||||
#define SPILL_1_GENERIC(ASI) \
|
|
||||||
add %sp, STACK_BIAS + 0x00, %g1; \
|
|
||||||
stxa %l0, [%g1 + %g0] ASI; \
|
|
||||||
mov 0x08, %g3; \
|
|
||||||
stxa %l1, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %l2, [%g1 + %g0] ASI; \
|
|
||||||
stxa %l3, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %l4, [%g1 + %g0] ASI; \
|
|
||||||
stxa %l5, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %l6, [%g1 + %g0] ASI; \
|
|
||||||
stxa %l7, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %i0, [%g1 + %g0] ASI; \
|
|
||||||
stxa %i1, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %i2, [%g1 + %g0] ASI; \
|
|
||||||
stxa %i3, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %i4, [%g1 + %g0] ASI; \
|
|
||||||
stxa %i5, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
stxa %i6, [%g1 + %g0] ASI; \
|
|
||||||
stxa %i7, [%g1 + %g3] ASI; \
|
|
||||||
saved; \
|
|
||||||
retry; nop; nop; \
|
|
||||||
b,a,pt %xcc, spill_fixup_dax; \
|
|
||||||
b,a,pt %xcc, spill_fixup_mna; \
|
|
||||||
b,a,pt %xcc, spill_fixup;
|
|
||||||
|
|
||||||
#define SPILL_1_GENERIC_ETRAP \
|
|
||||||
etrap_user_spill_64bit: \
|
|
||||||
stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \
|
|
||||||
stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \
|
|
||||||
stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \
|
|
||||||
stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \
|
|
||||||
stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \
|
|
||||||
stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \
|
|
||||||
stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \
|
|
||||||
stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \
|
|
||||||
stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \
|
|
||||||
stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \
|
|
||||||
stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \
|
|
||||||
stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \
|
|
||||||
stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \
|
|
||||||
stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \
|
|
||||||
stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \
|
|
||||||
stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \
|
|
||||||
saved; \
|
|
||||||
sub %g1, 2, %g1; \
|
|
||||||
ba,pt %xcc, etrap_save; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop; \
|
|
||||||
ba,a,pt %xcc, etrap_spill_fixup_64bit; \
|
|
||||||
ba,a,pt %xcc, etrap_spill_fixup_64bit; \
|
|
||||||
ba,a,pt %xcc, etrap_spill_fixup_64bit;
|
|
||||||
|
|
||||||
#define SPILL_1_GENERIC_ETRAP_FIXUP \
|
|
||||||
etrap_spill_fixup_64bit: \
|
|
||||||
ldub [%g6 + TI_WSAVED], %g1; \
|
|
||||||
sll %g1, 3, %g3; \
|
|
||||||
add %g6, %g3, %g3; \
|
|
||||||
stx %sp, [%g3 + TI_RWIN_SPTRS]; \
|
|
||||||
sll %g1, 7, %g3; \
|
|
||||||
add %g6, %g3, %g3; \
|
|
||||||
stx %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
|
|
||||||
stx %l1, [%g3 + TI_REG_WINDOW + 0x08]; \
|
|
||||||
stx %l2, [%g3 + TI_REG_WINDOW + 0x10]; \
|
|
||||||
stx %l3, [%g3 + TI_REG_WINDOW + 0x18]; \
|
|
||||||
stx %l4, [%g3 + TI_REG_WINDOW + 0x20]; \
|
|
||||||
stx %l5, [%g3 + TI_REG_WINDOW + 0x28]; \
|
|
||||||
stx %l6, [%g3 + TI_REG_WINDOW + 0x30]; \
|
|
||||||
stx %l7, [%g3 + TI_REG_WINDOW + 0x38]; \
|
|
||||||
stx %i0, [%g3 + TI_REG_WINDOW + 0x40]; \
|
|
||||||
stx %i1, [%g3 + TI_REG_WINDOW + 0x48]; \
|
|
||||||
stx %i2, [%g3 + TI_REG_WINDOW + 0x50]; \
|
|
||||||
stx %i3, [%g3 + TI_REG_WINDOW + 0x58]; \
|
|
||||||
stx %i4, [%g3 + TI_REG_WINDOW + 0x60]; \
|
|
||||||
stx %i5, [%g3 + TI_REG_WINDOW + 0x68]; \
|
|
||||||
stx %i6, [%g3 + TI_REG_WINDOW + 0x70]; \
|
|
||||||
stx %i7, [%g3 + TI_REG_WINDOW + 0x78]; \
|
|
||||||
add %g1, 1, %g1; \
|
|
||||||
stb %g1, [%g6 + TI_WSAVED]; \
|
|
||||||
saved; \
|
|
||||||
rdpr %cwp, %g1; \
|
|
||||||
sub %g1, 2, %g1; \
|
|
||||||
ba,pt %xcc, etrap_save; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
nop; nop; nop
|
|
||||||
|
|
||||||
/* Normal 32bit spill */
|
|
||||||
#define SPILL_2_GENERIC(ASI) \
|
|
||||||
srl %sp, 0, %sp; \
|
|
||||||
stwa %l0, [%sp + %g0] ASI; \
|
|
||||||
mov 0x04, %g3; \
|
|
||||||
stwa %l1, [%sp + %g3] ASI; \
|
|
||||||
add %sp, 0x08, %g1; \
|
|
||||||
stwa %l2, [%g1 + %g0] ASI; \
|
|
||||||
stwa %l3, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x08, %g1; \
|
|
||||||
stwa %l4, [%g1 + %g0] ASI; \
|
|
||||||
stwa %l5, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x08, %g1; \
|
|
||||||
stwa %l6, [%g1 + %g0] ASI; \
|
|
||||||
stwa %l7, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x08, %g1; \
|
|
||||||
stwa %i0, [%g1 + %g0] ASI; \
|
|
||||||
stwa %i1, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x08, %g1; \
|
|
||||||
stwa %i2, [%g1 + %g0] ASI; \
|
|
||||||
stwa %i3, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x08, %g1; \
|
|
||||||
stwa %i4, [%g1 + %g0] ASI; \
|
|
||||||
stwa %i5, [%g1 + %g3] ASI; \
|
|
||||||
add %g1, 0x08, %g1; \
|
|
||||||
stwa %i6, [%g1 + %g0] ASI; \
|
|
||||||
stwa %i7, [%g1 + %g3] ASI; \
|
|
||||||
saved; \
|
|
||||||
retry; nop; nop; \
|
|
||||||
b,a,pt %xcc, spill_fixup_dax; \
|
|
||||||
b,a,pt %xcc, spill_fixup_mna; \
|
|
||||||
b,a,pt %xcc, spill_fixup;
|
|
||||||
|
|
||||||
#define SPILL_2_GENERIC_ETRAP \
|
|
||||||
etrap_user_spill_32bit: \
|
|
||||||
srl %sp, 0, %sp; \
|
|
||||||
stwa %l0, [%sp + 0x00] %asi; \
|
|
||||||
stwa %l1, [%sp + 0x04] %asi; \
|
|
||||||
stwa %l2, [%sp + 0x08] %asi; \
|
|
||||||
stwa %l3, [%sp + 0x0c] %asi; \
|
|
||||||
stwa %l4, [%sp + 0x10] %asi; \
|
|
||||||
stwa %l5, [%sp + 0x14] %asi; \
|
|
||||||
stwa %l6, [%sp + 0x18] %asi; \
|
|
||||||
stwa %l7, [%sp + 0x1c] %asi; \
|
|
||||||
stwa %i0, [%sp + 0x20] %asi; \
|
|
||||||
stwa %i1, [%sp + 0x24] %asi; \
|
|
||||||
stwa %i2, [%sp + 0x28] %asi; \
|
|
||||||
stwa %i3, [%sp + 0x2c] %asi; \
|
|
||||||
stwa %i4, [%sp + 0x30] %asi; \
|
|
||||||
stwa %i5, [%sp + 0x34] %asi; \
|
|
||||||
stwa %i6, [%sp + 0x38] %asi; \
|
|
||||||
stwa %i7, [%sp + 0x3c] %asi; \
|
|
||||||
saved; \
|
|
||||||
sub %g1, 2, %g1; \
|
|
||||||
ba,pt %xcc, etrap_save; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop; \
|
|
||||||
ba,a,pt %xcc, etrap_spill_fixup_32bit; \
|
|
||||||
ba,a,pt %xcc, etrap_spill_fixup_32bit; \
|
|
||||||
ba,a,pt %xcc, etrap_spill_fixup_32bit;
|
|
||||||
|
|
||||||
#define SPILL_2_GENERIC_ETRAP_FIXUP \
|
|
||||||
etrap_spill_fixup_32bit: \
|
|
||||||
ldub [%g6 + TI_WSAVED], %g1; \
|
|
||||||
sll %g1, 3, %g3; \
|
|
||||||
add %g6, %g3, %g3; \
|
|
||||||
stx %sp, [%g3 + TI_RWIN_SPTRS]; \
|
|
||||||
sll %g1, 7, %g3; \
|
|
||||||
add %g6, %g3, %g3; \
|
|
||||||
stw %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
|
|
||||||
stw %l1, [%g3 + TI_REG_WINDOW + 0x04]; \
|
|
||||||
stw %l2, [%g3 + TI_REG_WINDOW + 0x08]; \
|
|
||||||
stw %l3, [%g3 + TI_REG_WINDOW + 0x0c]; \
|
|
||||||
stw %l4, [%g3 + TI_REG_WINDOW + 0x10]; \
|
|
||||||
stw %l5, [%g3 + TI_REG_WINDOW + 0x14]; \
|
|
||||||
stw %l6, [%g3 + TI_REG_WINDOW + 0x18]; \
|
|
||||||
stw %l7, [%g3 + TI_REG_WINDOW + 0x1c]; \
|
|
||||||
stw %i0, [%g3 + TI_REG_WINDOW + 0x20]; \
|
|
||||||
stw %i1, [%g3 + TI_REG_WINDOW + 0x24]; \
|
|
||||||
stw %i2, [%g3 + TI_REG_WINDOW + 0x28]; \
|
|
||||||
stw %i3, [%g3 + TI_REG_WINDOW + 0x2c]; \
|
|
||||||
stw %i4, [%g3 + TI_REG_WINDOW + 0x30]; \
|
|
||||||
stw %i5, [%g3 + TI_REG_WINDOW + 0x34]; \
|
|
||||||
stw %i6, [%g3 + TI_REG_WINDOW + 0x38]; \
|
|
||||||
stw %i7, [%g3 + TI_REG_WINDOW + 0x3c]; \
|
|
||||||
add %g1, 1, %g1; \
|
|
||||||
stb %g1, [%g6 + TI_WSAVED]; \
|
|
||||||
saved; \
|
|
||||||
rdpr %cwp, %g1; \
|
|
||||||
sub %g1, 2, %g1; \
|
|
||||||
ba,pt %xcc, etrap_save; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
nop; nop; nop
|
|
||||||
|
|
||||||
#define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
|
|
||||||
#define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
|
|
||||||
#define SPILL_3_NORMAL SPILL_0_NORMAL
|
|
||||||
#define SPILL_4_NORMAL SPILL_0_NORMAL
|
|
||||||
#define SPILL_5_NORMAL SPILL_0_NORMAL
|
|
||||||
#define SPILL_6_NORMAL SPILL_0_NORMAL
|
|
||||||
#define SPILL_7_NORMAL SPILL_0_NORMAL
|
|
||||||
|
|
||||||
#define SPILL_0_OTHER SPILL_0_NORMAL
|
|
||||||
#define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS)
|
|
||||||
#define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS)
|
|
||||||
#define SPILL_3_OTHER SPILL_3_NORMAL
|
|
||||||
#define SPILL_4_OTHER SPILL_4_NORMAL
|
|
||||||
#define SPILL_5_OTHER SPILL_5_NORMAL
|
|
||||||
#define SPILL_6_OTHER SPILL_6_NORMAL
|
|
||||||
#define SPILL_7_OTHER SPILL_7_NORMAL
|
|
||||||
|
|
||||||
/* Normal kernel fill */
|
|
||||||
#define FILL_0_NORMAL \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x00], %l0; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x08], %l1; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x10], %l2; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x18], %l3; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x20], %l4; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x28], %l5; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x30], %l6; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x38], %l7; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x40], %i0; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x48], %i1; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x50], %i2; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x58], %i3; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x60], %i4; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x68], %i5; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x70], %i6; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x78], %i7; \
|
|
||||||
restored; retry; nop; nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop; nop; nop; nop; nop;
|
|
||||||
|
|
||||||
#define FILL_0_NORMAL_RTRAP \
|
|
||||||
kern_rtt_fill: \
|
|
||||||
rdpr %cwp, %g1; \
|
|
||||||
sub %g1, 1, %g1; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x00], %l0; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x08], %l1; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x10], %l2; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x18], %l3; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x20], %l4; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x28], %l5; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x30], %l6; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x38], %l7; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x40], %i0; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x48], %i1; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x50], %i2; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x58], %i3; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x60], %i4; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x68], %i5; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x70], %i6; \
|
|
||||||
ldx [%sp + STACK_BIAS + 0x78], %i7; \
|
|
||||||
restored; \
|
|
||||||
add %g1, 1, %g1; \
|
|
||||||
ba,pt %xcc, kern_rtt_restore; \
|
|
||||||
wrpr %g1, %cwp; \
|
|
||||||
nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop;
|
|
||||||
|
|
||||||
|
|
||||||
/* Normal 64bit fill */
|
|
||||||
#define FILL_1_GENERIC(ASI) \
|
|
||||||
add %sp, STACK_BIAS + 0x00, %g1; \
|
|
||||||
ldxa [%g1 + %g0] ASI, %l0; \
|
|
||||||
mov 0x08, %g2; \
|
|
||||||
mov 0x10, %g3; \
|
|
||||||
ldxa [%g1 + %g2] ASI, %l1; \
|
|
||||||
mov 0x18, %g5; \
|
|
||||||
ldxa [%g1 + %g3] ASI, %l2; \
|
|
||||||
ldxa [%g1 + %g5] ASI, %l3; \
|
|
||||||
add %g1, 0x20, %g1; \
|
|
||||||
ldxa [%g1 + %g0] ASI, %l4; \
|
|
||||||
ldxa [%g1 + %g2] ASI, %l5; \
|
|
||||||
ldxa [%g1 + %g3] ASI, %l6; \
|
|
||||||
ldxa [%g1 + %g5] ASI, %l7; \
|
|
||||||
add %g1, 0x20, %g1; \
|
|
||||||
ldxa [%g1 + %g0] ASI, %i0; \
|
|
||||||
ldxa [%g1 + %g2] ASI, %i1; \
|
|
||||||
ldxa [%g1 + %g3] ASI, %i2; \
|
|
||||||
ldxa [%g1 + %g5] ASI, %i3; \
|
|
||||||
add %g1, 0x20, %g1; \
|
|
||||||
ldxa [%g1 + %g0] ASI, %i4; \
|
|
||||||
ldxa [%g1 + %g2] ASI, %i5; \
|
|
||||||
ldxa [%g1 + %g3] ASI, %i6; \
|
|
||||||
ldxa [%g1 + %g5] ASI, %i7; \
|
|
||||||
restored; \
|
|
||||||
retry; nop; nop; nop; nop; \
|
|
||||||
b,a,pt %xcc, fill_fixup_dax; \
|
|
||||||
b,a,pt %xcc, fill_fixup_mna; \
|
|
||||||
b,a,pt %xcc, fill_fixup;
|
|
||||||
|
|
||||||
#define FILL_1_GENERIC_RTRAP \
|
|
||||||
user_rtt_fill_64bit: \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \
|
|
||||||
ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \
|
|
||||||
ba,pt %xcc, user_rtt_pre_restore; \
|
|
||||||
restored; \
|
|
||||||
nop; nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop; nop; \
|
|
||||||
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
|
||||||
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
|
||||||
ba,a,pt %xcc, user_rtt_fill_fixup;
|
|
||||||
|
|
||||||
|
|
||||||
/* Normal 32bit fill */
|
|
||||||
#define FILL_2_GENERIC(ASI) \
|
|
||||||
srl %sp, 0, %sp; \
|
|
||||||
lduwa [%sp + %g0] ASI, %l0; \
|
|
||||||
mov 0x04, %g2; \
|
|
||||||
mov 0x08, %g3; \
|
|
||||||
lduwa [%sp + %g2] ASI, %l1; \
|
|
||||||
mov 0x0c, %g5; \
|
|
||||||
lduwa [%sp + %g3] ASI, %l2; \
|
|
||||||
lduwa [%sp + %g5] ASI, %l3; \
|
|
||||||
add %sp, 0x10, %g1; \
|
|
||||||
lduwa [%g1 + %g0] ASI, %l4; \
|
|
||||||
lduwa [%g1 + %g2] ASI, %l5; \
|
|
||||||
lduwa [%g1 + %g3] ASI, %l6; \
|
|
||||||
lduwa [%g1 + %g5] ASI, %l7; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
lduwa [%g1 + %g0] ASI, %i0; \
|
|
||||||
lduwa [%g1 + %g2] ASI, %i1; \
|
|
||||||
lduwa [%g1 + %g3] ASI, %i2; \
|
|
||||||
lduwa [%g1 + %g5] ASI, %i3; \
|
|
||||||
add %g1, 0x10, %g1; \
|
|
||||||
lduwa [%g1 + %g0] ASI, %i4; \
|
|
||||||
lduwa [%g1 + %g2] ASI, %i5; \
|
|
||||||
lduwa [%g1 + %g3] ASI, %i6; \
|
|
||||||
lduwa [%g1 + %g5] ASI, %i7; \
|
|
||||||
restored; \
|
|
||||||
retry; nop; nop; nop; nop; \
|
|
||||||
b,a,pt %xcc, fill_fixup_dax; \
|
|
||||||
b,a,pt %xcc, fill_fixup_mna; \
|
|
||||||
b,a,pt %xcc, fill_fixup;
|
|
||||||
|
|
||||||
#define FILL_2_GENERIC_RTRAP \
|
|
||||||
user_rtt_fill_32bit: \
|
|
||||||
srl %sp, 0, %sp; \
|
|
||||||
lduwa [%sp + 0x00] %asi, %l0; \
|
|
||||||
lduwa [%sp + 0x04] %asi, %l1; \
|
|
||||||
lduwa [%sp + 0x08] %asi, %l2; \
|
|
||||||
lduwa [%sp + 0x0c] %asi, %l3; \
|
|
||||||
lduwa [%sp + 0x10] %asi, %l4; \
|
|
||||||
lduwa [%sp + 0x14] %asi, %l5; \
|
|
||||||
lduwa [%sp + 0x18] %asi, %l6; \
|
|
||||||
lduwa [%sp + 0x1c] %asi, %l7; \
|
|
||||||
lduwa [%sp + 0x20] %asi, %i0; \
|
|
||||||
lduwa [%sp + 0x24] %asi, %i1; \
|
|
||||||
lduwa [%sp + 0x28] %asi, %i2; \
|
|
||||||
lduwa [%sp + 0x2c] %asi, %i3; \
|
|
||||||
lduwa [%sp + 0x30] %asi, %i4; \
|
|
||||||
lduwa [%sp + 0x34] %asi, %i5; \
|
|
||||||
lduwa [%sp + 0x38] %asi, %i6; \
|
|
||||||
lduwa [%sp + 0x3c] %asi, %i7; \
|
|
||||||
ba,pt %xcc, user_rtt_pre_restore; \
|
|
||||||
restored; \
|
|
||||||
nop; nop; nop; nop; nop; \
|
|
||||||
nop; nop; nop; nop; nop; \
|
|
||||||
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
|
||||||
ba,a,pt %xcc, user_rtt_fill_fixup; \
|
|
||||||
ba,a,pt %xcc, user_rtt_fill_fixup;
|
|
||||||
|
|
||||||
|
|
||||||
#define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
|
|
||||||
#define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
|
|
||||||
#define FILL_3_NORMAL FILL_0_NORMAL
|
|
||||||
#define FILL_4_NORMAL FILL_0_NORMAL
|
|
||||||
#define FILL_5_NORMAL FILL_0_NORMAL
|
|
||||||
#define FILL_6_NORMAL FILL_0_NORMAL
|
|
||||||
#define FILL_7_NORMAL FILL_0_NORMAL
|
|
||||||
|
|
||||||
#define FILL_0_OTHER FILL_0_NORMAL
|
|
||||||
#define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS)
|
|
||||||
#define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS)
|
|
||||||
#define FILL_3_OTHER FILL_3_NORMAL
|
|
||||||
#define FILL_4_OTHER FILL_4_NORMAL
|
|
||||||
#define FILL_5_OTHER FILL_5_NORMAL
|
|
||||||
#define FILL_6_OTHER FILL_6_NORMAL
|
|
||||||
#define FILL_7_OTHER FILL_7_NORMAL
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_TTABLE_H) */
|
|
||||||
|
|
|
@ -1,109 +1 @@
|
||||||
#ifndef _SPARC64_UPA_H
|
#include <asm-sparc/upa.h>
|
||||||
#define _SPARC64_UPA_H
|
|
||||||
|
|
||||||
#include <asm/asi.h>
|
|
||||||
|
|
||||||
/* UPA level registers and defines. */
|
|
||||||
|
|
||||||
/* UPA Config Register */
|
|
||||||
#define UPA_CONFIG_RESV 0xffffffffc0000000 /* Reserved. */
|
|
||||||
#define UPA_CONFIG_PCON 0x000000003fc00000 /* Depth of various sys queues. */
|
|
||||||
#define UPA_CONFIG_MID 0x00000000003e0000 /* Module ID. */
|
|
||||||
#define UPA_CONFIG_PCAP 0x000000000001ffff /* Port Capabilities. */
|
|
||||||
|
|
||||||
/* UPA Port ID Register */
|
|
||||||
#define UPA_PORTID_FNP 0xff00000000000000 /* Hardcoded to 0xfc on ultra. */
|
|
||||||
#define UPA_PORTID_RESV 0x00fffff800000000 /* Reserved. */
|
|
||||||
#define UPA_PORTID_ECCVALID 0x0000000400000000 /* Zero if mod can generate ECC */
|
|
||||||
#define UPA_PORTID_ONEREAD 0x0000000200000000 /* Set if mod generates P_RASB */
|
|
||||||
#define UPA_PORTID_PINTRDQ 0x0000000180000000 /* # outstanding P_INT_REQ's */
|
|
||||||
#define UPA_PORTID_PREQDQ 0x000000007e000000 /* slave-wr's to mod supported */
|
|
||||||
#define UPA_PORTID_PREQRD 0x0000000001e00000 /* # incoming P_REQ's supported */
|
|
||||||
#define UPA_PORTID_UPACAP 0x00000000001f0000 /* UPA capabilities of mod */
|
|
||||||
#define UPA_PORTID_ID 0x000000000000ffff /* Module Identification bits */
|
|
||||||
|
|
||||||
/* UPA I/O space accessors */
|
|
||||||
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
|
|
||||||
static inline unsigned char _upa_readb(unsigned long addr)
|
|
||||||
{
|
|
||||||
unsigned char ret;
|
|
||||||
|
|
||||||
__asm__ __volatile__("lduba\t[%1] %2, %0\t/* upa_readb */"
|
|
||||||
: "=r" (ret)
|
|
||||||
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned short _upa_readw(unsigned long addr)
|
|
||||||
{
|
|
||||||
unsigned short ret;
|
|
||||||
|
|
||||||
__asm__ __volatile__("lduha\t[%1] %2, %0\t/* upa_readw */"
|
|
||||||
: "=r" (ret)
|
|
||||||
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned int _upa_readl(unsigned long addr)
|
|
||||||
{
|
|
||||||
unsigned int ret;
|
|
||||||
|
|
||||||
__asm__ __volatile__("lduwa\t[%1] %2, %0\t/* upa_readl */"
|
|
||||||
: "=r" (ret)
|
|
||||||
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned long _upa_readq(unsigned long addr)
|
|
||||||
{
|
|
||||||
unsigned long ret;
|
|
||||||
|
|
||||||
__asm__ __volatile__("ldxa\t[%1] %2, %0\t/* upa_readq */"
|
|
||||||
: "=r" (ret)
|
|
||||||
: "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void _upa_writeb(unsigned char b, unsigned long addr)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stba\t%0, [%1] %2\t/* upa_writeb */"
|
|
||||||
: /* no outputs */
|
|
||||||
: "r" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void _upa_writew(unsigned short w, unsigned long addr)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stha\t%0, [%1] %2\t/* upa_writew */"
|
|
||||||
: /* no outputs */
|
|
||||||
: "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void _upa_writel(unsigned int l, unsigned long addr)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stwa\t%0, [%1] %2\t/* upa_writel */"
|
|
||||||
: /* no outputs */
|
|
||||||
: "r" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void _upa_writeq(unsigned long q, unsigned long addr)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__("stxa\t%0, [%1] %2\t/* upa_writeq */"
|
|
||||||
: /* no outputs */
|
|
||||||
: "r" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define upa_readb(__addr) (_upa_readb((unsigned long)(__addr)))
|
|
||||||
#define upa_readw(__addr) (_upa_readw((unsigned long)(__addr)))
|
|
||||||
#define upa_readl(__addr) (_upa_readl((unsigned long)(__addr)))
|
|
||||||
#define upa_readq(__addr) (_upa_readq((unsigned long)(__addr)))
|
|
||||||
#define upa_writeb(__b, __addr) (_upa_writeb((__b), (unsigned long)(__addr)))
|
|
||||||
#define upa_writew(__w, __addr) (_upa_writew((__w), (unsigned long)(__addr)))
|
|
||||||
#define upa_writel(__l, __addr) (_upa_writel((__l), (unsigned long)(__addr)))
|
|
||||||
#define upa_writeq(__q, __addr) (_upa_writeq((__q), (unsigned long)(__addr)))
|
|
||||||
#endif /* __KERNEL__ && !__ASSEMBLY__ */
|
|
||||||
|
|
||||||
#endif /* !(_SPARC64_UPA_H) */
|
|
||||||
|
|
|
@ -1,406 +1 @@
|
||||||
#ifndef _SPARC64_VIO_H
|
#include <asm-sparc/vio.h>
|
||||||
#define _SPARC64_VIO_H
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <linux/device.h>
|
|
||||||
#include <linux/mod_devicetable.h>
|
|
||||||
#include <linux/timer.h>
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
#include <linux/completion.h>
|
|
||||||
#include <linux/list.h>
|
|
||||||
#include <linux/log2.h>
|
|
||||||
|
|
||||||
#include <asm/ldc.h>
|
|
||||||
#include <asm/mdesc.h>
|
|
||||||
|
|
||||||
struct vio_msg_tag {
|
|
||||||
u8 type;
|
|
||||||
#define VIO_TYPE_CTRL 0x01
|
|
||||||
#define VIO_TYPE_DATA 0x02
|
|
||||||
#define VIO_TYPE_ERR 0x04
|
|
||||||
|
|
||||||
u8 stype;
|
|
||||||
#define VIO_SUBTYPE_INFO 0x01
|
|
||||||
#define VIO_SUBTYPE_ACK 0x02
|
|
||||||
#define VIO_SUBTYPE_NACK 0x04
|
|
||||||
|
|
||||||
u16 stype_env;
|
|
||||||
#define VIO_VER_INFO 0x0001
|
|
||||||
#define VIO_ATTR_INFO 0x0002
|
|
||||||
#define VIO_DRING_REG 0x0003
|
|
||||||
#define VIO_DRING_UNREG 0x0004
|
|
||||||
#define VIO_RDX 0x0005
|
|
||||||
#define VIO_PKT_DATA 0x0040
|
|
||||||
#define VIO_DESC_DATA 0x0041
|
|
||||||
#define VIO_DRING_DATA 0x0042
|
|
||||||
#define VNET_MCAST_INFO 0x0101
|
|
||||||
|
|
||||||
u32 sid;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_rdx {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u64 resv[6];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_ver_info {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u16 major;
|
|
||||||
u16 minor;
|
|
||||||
u8 dev_class;
|
|
||||||
#define VDEV_NETWORK 0x01
|
|
||||||
#define VDEV_NETWORK_SWITCH 0x02
|
|
||||||
#define VDEV_DISK 0x03
|
|
||||||
#define VDEV_DISK_SERVER 0x04
|
|
||||||
|
|
||||||
u8 resv1[3];
|
|
||||||
u64 resv2[5];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_dring_register {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u64 dring_ident;
|
|
||||||
u32 num_descr;
|
|
||||||
u32 descr_size;
|
|
||||||
u16 options;
|
|
||||||
#define VIO_TX_DRING 0x0001
|
|
||||||
#define VIO_RX_DRING 0x0002
|
|
||||||
u16 resv;
|
|
||||||
u32 num_cookies;
|
|
||||||
struct ldc_trans_cookie cookies[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_dring_unregister {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u64 dring_ident;
|
|
||||||
u64 resv[5];
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Data transfer modes */
|
|
||||||
#define VIO_PKT_MODE 0x01 /* Packet based transfer */
|
|
||||||
#define VIO_DESC_MODE 0x02 /* In-band descriptors */
|
|
||||||
#define VIO_DRING_MODE 0x03 /* Descriptor rings */
|
|
||||||
|
|
||||||
struct vio_dring_data {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u64 seq;
|
|
||||||
u64 dring_ident;
|
|
||||||
u32 start_idx;
|
|
||||||
u32 end_idx;
|
|
||||||
u8 state;
|
|
||||||
#define VIO_DRING_ACTIVE 0x01
|
|
||||||
#define VIO_DRING_STOPPED 0x02
|
|
||||||
|
|
||||||
u8 __pad1;
|
|
||||||
u16 __pad2;
|
|
||||||
u32 __pad3;
|
|
||||||
u64 __par4[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_dring_hdr {
|
|
||||||
u8 state;
|
|
||||||
#define VIO_DESC_FREE 0x01
|
|
||||||
#define VIO_DESC_READY 0x02
|
|
||||||
#define VIO_DESC_ACCEPTED 0x03
|
|
||||||
#define VIO_DESC_DONE 0x04
|
|
||||||
u8 ack;
|
|
||||||
#define VIO_ACK_ENABLE 0x01
|
|
||||||
#define VIO_ACK_DISABLE 0x00
|
|
||||||
|
|
||||||
u16 __pad1;
|
|
||||||
u32 __pad2;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* VIO disk specific structures and defines */
|
|
||||||
struct vio_disk_attr_info {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u8 xfer_mode;
|
|
||||||
u8 vdisk_type;
|
|
||||||
#define VD_DISK_TYPE_SLICE 0x01 /* Slice in block device */
|
|
||||||
#define VD_DISK_TYPE_DISK 0x02 /* Entire block device */
|
|
||||||
u16 resv1;
|
|
||||||
u32 vdisk_block_size;
|
|
||||||
u64 operations;
|
|
||||||
u64 vdisk_size;
|
|
||||||
u64 max_xfer_size;
|
|
||||||
u64 resv2[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_disk_desc {
|
|
||||||
struct vio_dring_hdr hdr;
|
|
||||||
u64 req_id;
|
|
||||||
u8 operation;
|
|
||||||
#define VD_OP_BREAD 0x01 /* Block read */
|
|
||||||
#define VD_OP_BWRITE 0x02 /* Block write */
|
|
||||||
#define VD_OP_FLUSH 0x03 /* Flush disk contents */
|
|
||||||
#define VD_OP_GET_WCE 0x04 /* Get write-cache status */
|
|
||||||
#define VD_OP_SET_WCE 0x05 /* Enable/disable write-cache */
|
|
||||||
#define VD_OP_GET_VTOC 0x06 /* Get VTOC */
|
|
||||||
#define VD_OP_SET_VTOC 0x07 /* Set VTOC */
|
|
||||||
#define VD_OP_GET_DISKGEOM 0x08 /* Get disk geometry */
|
|
||||||
#define VD_OP_SET_DISKGEOM 0x09 /* Set disk geometry */
|
|
||||||
#define VD_OP_SCSICMD 0x0a /* SCSI control command */
|
|
||||||
#define VD_OP_GET_DEVID 0x0b /* Get device ID */
|
|
||||||
#define VD_OP_GET_EFI 0x0c /* Get EFI */
|
|
||||||
#define VD_OP_SET_EFI 0x0d /* Set EFI */
|
|
||||||
u8 slice;
|
|
||||||
u16 resv1;
|
|
||||||
u32 status;
|
|
||||||
u64 offset;
|
|
||||||
u64 size;
|
|
||||||
u32 ncookies;
|
|
||||||
u32 resv2;
|
|
||||||
struct ldc_trans_cookie cookies[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define VIO_DISK_VNAME_LEN 8
|
|
||||||
#define VIO_DISK_ALABEL_LEN 128
|
|
||||||
#define VIO_DISK_NUM_PART 8
|
|
||||||
|
|
||||||
struct vio_disk_vtoc {
|
|
||||||
u8 volume_name[VIO_DISK_VNAME_LEN];
|
|
||||||
u16 sector_size;
|
|
||||||
u16 num_partitions;
|
|
||||||
u8 ascii_label[VIO_DISK_ALABEL_LEN];
|
|
||||||
struct {
|
|
||||||
u16 id;
|
|
||||||
u16 perm_flags;
|
|
||||||
u32 resv;
|
|
||||||
u64 start_block;
|
|
||||||
u64 num_blocks;
|
|
||||||
} partitions[VIO_DISK_NUM_PART];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_disk_geom {
|
|
||||||
u16 num_cyl; /* Num data cylinders */
|
|
||||||
u16 alt_cyl; /* Num alternate cylinders */
|
|
||||||
u16 beg_cyl; /* Cyl off of fixed head area */
|
|
||||||
u16 num_hd; /* Num heads */
|
|
||||||
u16 num_sec; /* Num sectors */
|
|
||||||
u16 ifact; /* Interleave factor */
|
|
||||||
u16 apc; /* Alts per cylinder (SCSI) */
|
|
||||||
u16 rpm; /* Revolutions per minute */
|
|
||||||
u16 phy_cyl; /* Num physical cylinders */
|
|
||||||
u16 wr_skip; /* Num sects to skip, writes */
|
|
||||||
u16 rd_skip; /* Num sects to skip, writes */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_disk_devid {
|
|
||||||
u16 resv;
|
|
||||||
u16 type;
|
|
||||||
u32 len;
|
|
||||||
char id[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_disk_efi {
|
|
||||||
u64 lba;
|
|
||||||
u64 len;
|
|
||||||
char data[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
/* VIO net specific structures and defines */
|
|
||||||
struct vio_net_attr_info {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u8 xfer_mode;
|
|
||||||
u8 addr_type;
|
|
||||||
#define VNET_ADDR_ETHERMAC 0x01
|
|
||||||
u16 ack_freq;
|
|
||||||
u32 resv1;
|
|
||||||
u64 addr;
|
|
||||||
u64 mtu;
|
|
||||||
u64 resv2[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define VNET_NUM_MCAST 7
|
|
||||||
|
|
||||||
struct vio_net_mcast_info {
|
|
||||||
struct vio_msg_tag tag;
|
|
||||||
u8 set;
|
|
||||||
u8 count;
|
|
||||||
u8 mcast_addr[VNET_NUM_MCAST * 6];
|
|
||||||
u32 resv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_net_desc {
|
|
||||||
struct vio_dring_hdr hdr;
|
|
||||||
u32 size;
|
|
||||||
u32 ncookies;
|
|
||||||
struct ldc_trans_cookie cookies[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define VIO_MAX_RING_COOKIES 24
|
|
||||||
|
|
||||||
struct vio_dring_state {
|
|
||||||
u64 ident;
|
|
||||||
void *base;
|
|
||||||
u64 snd_nxt;
|
|
||||||
u64 rcv_nxt;
|
|
||||||
u32 entry_size;
|
|
||||||
u32 num_entries;
|
|
||||||
u32 prod;
|
|
||||||
u32 cons;
|
|
||||||
u32 pending;
|
|
||||||
int ncookies;
|
|
||||||
struct ldc_trans_cookie cookies[VIO_MAX_RING_COOKIES];
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline void *vio_dring_cur(struct vio_dring_state *dr)
|
|
||||||
{
|
|
||||||
return dr->base + (dr->entry_size * dr->prod);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *vio_dring_entry(struct vio_dring_state *dr,
|
|
||||||
unsigned int index)
|
|
||||||
{
|
|
||||||
return dr->base + (dr->entry_size * index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline u32 vio_dring_avail(struct vio_dring_state *dr,
|
|
||||||
unsigned int ring_size)
|
|
||||||
{
|
|
||||||
BUILD_BUG_ON(!is_power_of_2(ring_size));
|
|
||||||
|
|
||||||
return (dr->pending -
|
|
||||||
((dr->prod - dr->cons) & (ring_size - 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define VIO_MAX_TYPE_LEN 32
|
|
||||||
#define VIO_MAX_COMPAT_LEN 64
|
|
||||||
|
|
||||||
struct vio_dev {
|
|
||||||
u64 mp;
|
|
||||||
struct device_node *dp;
|
|
||||||
|
|
||||||
char type[VIO_MAX_TYPE_LEN];
|
|
||||||
char compat[VIO_MAX_COMPAT_LEN];
|
|
||||||
int compat_len;
|
|
||||||
|
|
||||||
u64 dev_no;
|
|
||||||
|
|
||||||
unsigned long channel_id;
|
|
||||||
|
|
||||||
unsigned int tx_irq;
|
|
||||||
unsigned int rx_irq;
|
|
||||||
|
|
||||||
struct device dev;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_driver {
|
|
||||||
struct list_head node;
|
|
||||||
const struct vio_device_id *id_table;
|
|
||||||
int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
|
|
||||||
int (*remove)(struct vio_dev *dev);
|
|
||||||
void (*shutdown)(struct vio_dev *dev);
|
|
||||||
unsigned long driver_data;
|
|
||||||
struct device_driver driver;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_version {
|
|
||||||
u16 major;
|
|
||||||
u16 minor;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_driver_state;
|
|
||||||
struct vio_driver_ops {
|
|
||||||
int (*send_attr)(struct vio_driver_state *vio);
|
|
||||||
int (*handle_attr)(struct vio_driver_state *vio, void *pkt);
|
|
||||||
void (*handshake_complete)(struct vio_driver_state *vio);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_completion {
|
|
||||||
struct completion com;
|
|
||||||
int err;
|
|
||||||
int waiting_for;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vio_driver_state {
|
|
||||||
/* Protects VIO handshake and, optionally, driver private state. */
|
|
||||||
spinlock_t lock;
|
|
||||||
|
|
||||||
struct ldc_channel *lp;
|
|
||||||
|
|
||||||
u32 _peer_sid;
|
|
||||||
u32 _local_sid;
|
|
||||||
struct vio_dring_state drings[2];
|
|
||||||
#define VIO_DRIVER_TX_RING 0
|
|
||||||
#define VIO_DRIVER_RX_RING 1
|
|
||||||
|
|
||||||
u8 hs_state;
|
|
||||||
#define VIO_HS_INVALID 0x00
|
|
||||||
#define VIO_HS_GOTVERS 0x01
|
|
||||||
#define VIO_HS_GOT_ATTR 0x04
|
|
||||||
#define VIO_HS_SENT_DREG 0x08
|
|
||||||
#define VIO_HS_SENT_RDX 0x10
|
|
||||||
#define VIO_HS_GOT_RDX_ACK 0x20
|
|
||||||
#define VIO_HS_GOT_RDX 0x40
|
|
||||||
#define VIO_HS_SENT_RDX_ACK 0x80
|
|
||||||
#define VIO_HS_COMPLETE (VIO_HS_GOT_RDX_ACK | VIO_HS_SENT_RDX_ACK)
|
|
||||||
|
|
||||||
u8 dev_class;
|
|
||||||
|
|
||||||
u8 dr_state;
|
|
||||||
#define VIO_DR_STATE_TXREG 0x01
|
|
||||||
#define VIO_DR_STATE_RXREG 0x02
|
|
||||||
#define VIO_DR_STATE_TXREQ 0x10
|
|
||||||
#define VIO_DR_STATE_RXREQ 0x20
|
|
||||||
|
|
||||||
u8 debug;
|
|
||||||
#define VIO_DEBUG_HS 0x01
|
|
||||||
#define VIO_DEBUG_DATA 0x02
|
|
||||||
|
|
||||||
void *desc_buf;
|
|
||||||
unsigned int desc_buf_len;
|
|
||||||
|
|
||||||
struct vio_completion *cmp;
|
|
||||||
|
|
||||||
struct vio_dev *vdev;
|
|
||||||
|
|
||||||
struct timer_list timer;
|
|
||||||
|
|
||||||
struct vio_version ver;
|
|
||||||
|
|
||||||
struct vio_version *ver_table;
|
|
||||||
int ver_table_entries;
|
|
||||||
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
struct vio_driver_ops *ops;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define viodbg(TYPE, f, a...) \
|
|
||||||
do { if (vio->debug & VIO_DEBUG_##TYPE) \
|
|
||||||
printk(KERN_INFO "vio: ID[%lu] " f, \
|
|
||||||
vio->vdev->channel_id, ## a); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
extern int vio_register_driver(struct vio_driver *drv);
|
|
||||||
extern void vio_unregister_driver(struct vio_driver *drv);
|
|
||||||
|
|
||||||
static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
|
|
||||||
{
|
|
||||||
return container_of(drv, struct vio_driver, driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct vio_dev *to_vio_dev(struct device *dev)
|
|
||||||
{
|
|
||||||
return container_of(dev, struct vio_dev, dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len);
|
|
||||||
extern void vio_link_state_change(struct vio_driver_state *vio, int event);
|
|
||||||
extern void vio_conn_reset(struct vio_driver_state *vio);
|
|
||||||
extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt);
|
|
||||||
extern int vio_validate_sid(struct vio_driver_state *vio,
|
|
||||||
struct vio_msg_tag *tp);
|
|
||||||
extern u32 vio_send_sid(struct vio_driver_state *vio);
|
|
||||||
extern int vio_ldc_alloc(struct vio_driver_state *vio,
|
|
||||||
struct ldc_channel_config *base_cfg, void *event_arg);
|
|
||||||
extern void vio_ldc_free(struct vio_driver_state *vio);
|
|
||||||
extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
|
|
||||||
u8 dev_class, struct vio_version *ver_table,
|
|
||||||
int ver_table_size, struct vio_driver_ops *ops,
|
|
||||||
char *name);
|
|
||||||
|
|
||||||
extern void vio_port_up(struct vio_driver_state *vio);
|
|
||||||
|
|
||||||
#endif /* _SPARC64_VIO_H */
|
|
||||||
|
|
|
@ -1,62 +1 @@
|
||||||
#ifndef _SPARC64_VISASM_H
|
#include <asm-sparc/visasm.h>
|
||||||
#define _SPARC64_VISASM_H
|
|
||||||
|
|
||||||
/* visasm.h: FPU saving macros for VIS routines
|
|
||||||
*
|
|
||||||
* Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <asm/pstate.h>
|
|
||||||
#include <asm/ptrace.h>
|
|
||||||
|
|
||||||
/* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
|
|
||||||
|
|
||||||
#define VISEntry \
|
|
||||||
rd %fprs, %o5; \
|
|
||||||
andcc %o5, (FPRS_FEF|FPRS_DU), %g0; \
|
|
||||||
be,pt %icc, 297f; \
|
|
||||||
sethi %hi(297f), %g7; \
|
|
||||||
sethi %hi(VISenter), %g1; \
|
|
||||||
jmpl %g1 + %lo(VISenter), %g0; \
|
|
||||||
or %g7, %lo(297f), %g7; \
|
|
||||||
297: wr %g0, FPRS_FEF, %fprs; \
|
|
||||||
|
|
||||||
#define VISExit \
|
|
||||||
wr %g0, 0, %fprs;
|
|
||||||
|
|
||||||
/* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
|
|
||||||
* Must preserve %o5 between VISEntryHalf and VISExitHalf */
|
|
||||||
|
|
||||||
#define VISEntryHalf \
|
|
||||||
rd %fprs, %o5; \
|
|
||||||
andcc %o5, FPRS_FEF, %g0; \
|
|
||||||
be,pt %icc, 297f; \
|
|
||||||
sethi %hi(298f), %g7; \
|
|
||||||
sethi %hi(VISenterhalf), %g1; \
|
|
||||||
jmpl %g1 + %lo(VISenterhalf), %g0; \
|
|
||||||
or %g7, %lo(298f), %g7; \
|
|
||||||
clr %o5; \
|
|
||||||
297: wr %o5, FPRS_FEF, %fprs; \
|
|
||||||
298:
|
|
||||||
|
|
||||||
#define VISExitHalf \
|
|
||||||
wr %o5, 0, %fprs;
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
static inline void save_and_clear_fpu(void) {
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
" rd %%fprs, %%o5\n"
|
|
||||||
" andcc %%o5, %0, %%g0\n"
|
|
||||||
" be,pt %%icc, 299f\n"
|
|
||||||
" sethi %%hi(298f), %%g7\n"
|
|
||||||
" sethi %%hi(VISenter), %%g1\n"
|
|
||||||
" jmpl %%g1 + %%lo(VISenter), %%g0\n"
|
|
||||||
" or %%g7, %%lo(298f), %%g7\n"
|
|
||||||
" 298: wr %%g0, 0, %%fprs\n"
|
|
||||||
" 299:\n"
|
|
||||||
" " : : "i" (FPRS_FEF|FPRS_DU) :
|
|
||||||
"o5", "g1", "g2", "g3", "g7", "cc");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _SPARC64_ASI_H */
|
|
||||||
|
|
Loading…
Reference in New Issue