summaryrefslogtreecommitdiffstats
path: root/lib/atomic64_test.c
AgeCommit message (Expand)Author
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner
2017-07-14lib/atomic64_test.c: add a test that atomic64_inc_not_zero() returns an intMichael Ellerman
2017-02-24lib: add module support to atomic64 testsGeert Uytterhoeven
2016-10-07atomic64: no need for CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVEVineet Gupta
2016-06-16locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}...Peter Zijlstra
2016-01-30x86/cpufeature: Carve out X86_FEATURE_*Borislav Petkov
2016-01-11Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds
2015-12-06x86/headers: Don't include asm/processor.h in asm/atomic.hAndi Kleen
2015-11-23atomics: Add test for atomic operations with _relaxed variantsBoqun Feng
2015-07-27atomic: Add simple atomic_t testsPeter Zijlstra
2014-06-04lib/atomic64_test.c: convert printk(KERN_INFO to pr_infoFabian Frederick
2012-07-30atomic64_test: simplify the #ifdef for atomic64_dec_if_positive() testCatalin Marinas
2012-02-29bug.h: add include of it to various implicit C usersPaul Gortmaker
2011-07-26atomic: use <linux/atomic.h>Arun Sharma
2010-07-27ARM: 6213/1: atomic64_test: add ARM as supported architectureWill Deacon
2010-06-04lib: add s390 to atomic64_dec_if_positive archsHeiko Carstens
2010-05-24lib/atomic64_test: fix missing include of linux/kernel.hPeter Huewe
2010-03-01x86, atomic64: In selftest, distinguish x86-64 from 586+H. Peter Anvin
2010-03-01lib: Fix atomic64_inc_not_zero testLuca Barbieri
2010-03-01lib: Fix atomic64_add_unless testLuca Barbieri
2010-03-01x86: Implement atomic[64]_dec_if_positive()Luca Barbieri
2010-03-01lib: Only test atomic64_dec_if_positive on archs having itLuca Barbieri
2010-02-25lib: Add self-test for atomic64_tLuca Barbieri
herit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#define DSP_RESET	(devc->base + 0x6)
#define DSP_READ	(devc->base + 0xA)
#define DSP_WRITE	(devc->base + 0xC)
#define DSP_COMMAND	(devc->base + 0xC)
#define DSP_STATUS	(devc->base + 0xC)
#define DSP_DATA_AVAIL	(devc->base + 0xE)
#define DSP_DATA_AVL16	(devc->base + 0xF)
#define MIXER_ADDR	(devc->base + 0x4)
#define MIXER_DATA	(devc->base + 0x5)
#define OPL3_LEFT	(devc->base + 0x0)
#define OPL3_RIGHT	(devc->base + 0x2)
#define OPL3_BOTH	(devc->base + 0x8)
/* DSP Commands */

#define DSP_CMD_SPKON		0xD1
#define DSP_CMD_SPKOFF		0xD3
#define DSP_CMD_DMAON		0xD0
#define DSP_CMD_DMAOFF		0xD4

#define IMODE_NONE		0
#define IMODE_OUTPUT		PCM_ENABLE_OUTPUT
#define IMODE_INPUT		PCM_ENABLE_INPUT
#define IMODE_INIT		3
#define IMODE_MIDI		4

#define NORMAL_MIDI	0
#define UART_MIDI	1


/*
 * Device models
 */
#define MDL_NONE	0
#define MDL_SB1		1	/* SB1.0 or 1.5 */
#define MDL_SB2		2	/* SB2.0 */
#define MDL_SB201	3	/* SB2.01 */
#define MDL_SBPRO	4	/* SB Pro */
#define MDL_SB16	5	/* SB16/32/AWE */
#define MDL_SBPNP 	6	/* SB16/32/AWE PnP */
#define MDL_JAZZ	10	/* Media Vision Jazz16 */
#define MDL_SMW		11	/* Logitech SoundMan Wave (Jazz16) */
#define MDL_ESS		12	/* ESS ES688 and ES1688 */
#define MDL_AZTECH	13	/* Aztech Sound Galaxy family */
#define MDL_ES1868MIDI	14	/* MIDI port of ESS1868 */
#define MDL_AEDSP	15	/* Audio Excel DSP 16 */
#define MDL_ESSPCI	16	/* ESS PCI card */
#define MDL_YMPCI	17	/* Yamaha PCI sb in emulation */

#define SUBMDL_ALS007	42	/* ALS-007 differs from SB16 only in mixer */
				/* register assignment */
#define SUBMDL_ALS100	43	/* ALS-100 allows sampling rates of up */
				/* to 48kHz */
				
/*
 * Config flags
 */
#define SB_NO_MIDI	0x00000001
#define SB_NO_MIXER	0x00000002
#define SB_NO_AUDIO	0x00000004
#define SB_NO_RECORDING	0x00000008 /* No audio recording */
#define SB_MIDI_ONLY	(SB_NO_AUDIO|SB_NO_MIXER)
#define SB_PCI_IRQ	0x00000010 /* PCI shared IRQ */

struct mixer_def {
	unsigned int regno: 8;
	unsigned int bitoffs:4;
	unsigned int nbits:4;
};

typedef struct mixer_def mixer_tab[32][2];
typedef struct mixer_def mixer_ent;

struct sb_module_options
{
	int  esstype;	/* ESS chip type */
	int  acer;	/* Do acer notebook init? */
	int  sm_games;	/* Logitech soundman games? */
};

typedef struct sb_devc {
	   int dev;

	/* Hardware parameters */
	   int *osp;
	   int minor, major;
	   int type;
	   int model, submodel;
	   int caps;
#	define SBCAP_STEREO	0x00000001
#	define SBCAP_16BITS	0x00000002

	/* Hardware resources */
	   int base;
	   int irq;
	   int dma8, dma16;
	   
	   int pcibase;		/* For ESS Maestro etc */

	/* State variables */
 	   int opened;
	/* new audio fields for full duplex support */
	   int fullduplex;
	   int duplex;
	   int speed, bits, channels;
	   volatile int irq_ok;
	   volatile int intr_active, irq_mode;
	/* duplicate audio fields for full duplex support */
	   volatile int intr_active_16, irq_mode_16;

	/* Mixer fields */
	   int *levels;
	   mixer_tab *iomap;
	   size_t iomap_sz; /* number or records in the iomap table */
	   int mixer_caps, recmask, outmask, supported_devices;
	   int supported_rec_devices, supported_out_devices;
	   int my_mixerdev;
	   int sbmixnum;

	/* Audio fields */
	   unsigned long trg_buf;
	   int      trigger_bits;
	   int      trg_bytes;
	   int      trg_intrflag;
	   int      trg_restart;
	/* duplicate audio fields for full duplex support */
	   unsigned long trg_buf_16;
	   int      trigger_bits_16;
	   int      trg_bytes_16;
	   int      trg_intrflag_16;
	   int      trg_restart_16;

	   unsigned char tconst;
	
	/* MIDI fields */
	   int my_mididev;
	   int input_opened;
	   int midi_broken;
	   void (*midi_input_intr) (int dev, unsigned char data);
	   void *midi_irq_cookie;		/* IRQ cookie for the midi */

	   spinlock_t lock;

	   struct sb_module_options sbmo;	/* Module options */

	} sb_devc;
	
/*
 *	PCI card types
 */

#define	SB_PCI_ESSMAESTRO	1	/* ESS Maestro Legacy */
#define	SB_PCI_YAMAHA		2	/* Yamaha Legacy */

/* 
 *	Functions
 */
 
int sb_dsp_command (sb_devc *devc, unsigned char val);
int sb_dsp_get_byte(sb_devc * devc);
int sb_dsp_reset (sb_devc *devc);
void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value);
unsigned int sb_getmixer (sb_devc *devc, unsigned int port);
int sb_dsp_detect (struct address_info *hw_config, int pci, int pciio, struct sb_module_options *sbmo);
int sb_dsp_init (struct address_info *hw_config, struct module *owner);
void sb_dsp_unload(struct address_info *hw_config, int sbmpu);
int sb_mixer_init(sb_devc *devc, struct module *owner);
void sb_mixer_unload(sb_devc *devc);
void sb_mixer_set_stereo (sb_devc *devc, int mode);
void smw_mixer_init(sb_devc *devc);
void sb_dsp_midi_init (sb_devc *devc, struct module *owner);
void sb_audio_init (sb_devc *devc, char *name, struct module *owner);
void sb_midi_interrupt (sb_devc *devc);
void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val);
int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right);

int sb_audio_open(int dev, int mode);
void sb_audio_close(int dev);

/*	From sb_common.c */
void sb_dsp_disable_midi(int port);
int probe_sbmpu (struct address_info *hw_config, struct module *owner);
void unload_sbmpu (struct address_info *hw_config);

void unload_sb16(struct address_info *hw_info);
void unload_sb16midi(struct address_info *hw_info);