/* * tascam.h - a part of driver for TASCAM FireWire series * * Copyright (c) 2015 Takashi Sakamoto * * Licensed under the terms of the GNU General Public License, version 2. */ #ifndef SOUND_TASCAM_H_INCLUDED #define SOUND_TASCAM_H_INCLUDED #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../lib.h" #include "../amdtp-stream.h" #include "../iso-resources.h" struct snd_tscm_spec { const char *const name; bool has_adat; bool has_spdif; unsigned int pcm_capture_analog_channels; unsigned int pcm_playback_analog_channels; unsigned int midi_capture_ports; unsigned int midi_playback_ports; }; #define TSCM_MIDI_IN_PORT_MAX 4 #define TSCM_MIDI_OUT_PORT_MAX 4 struct snd_tscm { struct snd_card *card; struct fw_unit *unit; struct mutex mutex; spinlock_t lock; bool registered; struct delayed_work dwork; const struct snd_tscm_spec *spec; struct fw_iso_resources tx_resources; struct fw_iso_resources rx_resources; struct amdtp_stream tx_stream; struct amdtp_stream rx_stream; unsigned int substreams_counter; int dev_lock_count; bool dev_lock_changed; wait_queue_head_t hwdep_wait; /* For MIDI message incoming transactions. */ struct fw_address_handler async_handler; struct snd_rawmidi_substream *tx_midi_substreams[TSCM_MIDI_IN_PORT_MAX]; /* For MIDI message outgoing transactions. */ struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX]; u8 running_status[TSCM_MIDI_OUT_PORT_MAX]; bool on_sysex[TSCM_MIDI_OUT_PORT_MAX]; }; #define TSCM_ADDR_BASE 0xffff00000000ull #define TSCM_OFFSET_FIRMWARE_REGISTER 0x0000 #define TSCM_OFFSET_FIRMWARE_FPGA 0x0004 #define TSCM_OFFSET_FIRMWARE_ARM 0x0008 #define TSCM_OFFSET_FIRMWARE_HW 0x000c #define TSCM_OFFSET_ISOC_TX_CH 0x0200 #define TSCM_OFFSET_UNKNOWN 0x0204 #define TSCM_OFFSET_START_STREAMING 0x0208 #define TSCM_OFFSET_ISOC_RX_CH 0x020c #define TSCM_OFFSET_ISOC_RX_ON 0x0210 /* Little conviction. */ #define TSCM_OFFSET_TX_PCM_CHANNELS 0x0214 #define TSCM_OFFSET_RX_PCM_CHANNELS 0x0218 #define TSCM_OFFSET_MULTIPLEX_MODE 0x021c #define TSCM_OFFSET_ISOC_TX_ON 0x0220 /* Unknown 0x0224 */ #define TSCM_OFFSET_CLOCK_STATUS 0x0228 #define TSCM_OFFSET_SET_OPTION 0x022c #define TSCM_OFFSET_MIDI_TX_ON 0x0300 #define TSCM_OFFSET_MIDI_TX_ADDR_HI 0x0304 #define TSCM_OFFSET_MIDI_TX_ADDR_LO 0x0308 #define TSCM_OFFSET_LED_POWER 0x0404 #define TSCM_OFFSET_MIDI_RX_QUAD 0x4000 enum snd_tscm_clock { SND_TSCM_CLOCK_INTERNAL = 0, SND_TSCM_CLOCK_WORD = 1, SND_TSCM_CLOCK_SPDIF = 2, SND_TSCM_CLOCK_ADAT = 3, }; int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit, enum amdtp_stream_direction dir, unsigned int pcm_channels); int amdtp_tscm_set_parameters(struct amdtp_stream *s, unsigned int rate); int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s, struct snd_pcm_runtime *runtime); void amdtp_tscm_set_pcm_format(struct amdtp_stream *s, snd_pcm_format_t format); int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate); int snd_tscm_stream_get_clock(struct snd_tscm *tscm, enum snd_tscm_clock *clock); int snd_tscm_stream_init_duplex(struct snd_tscm *tscm); void snd_tscm_stream_update_duplex(struct snd_tscm *tscm); void snd_tscm_stream_destroy_duplex(struct snd_tscm *tscm); int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate); void snd_tscm_stream_stop_duplex(struct snd_tscm *tscm); void snd_tscm_stream_lock_changed(struct snd_tscm *tscm); int snd_tscm_stream_lock_try(struct snd_tscm *tscm); void snd_tscm_stream_lock_release(struct snd_tscm *tscm); int snd_tscm_transaction_register(struct snd_tscm *tscm); int snd_tscm_transaction_reregister(struct snd_tscm *tscm); void snd_tscm_transaction_unregister(struct snd_tscm *tscm); void snd_tscm_proc_init(struct snd_tscm *tscm); int snd_tscm_create_pcm_devices(struct snd_tscm *tscm); int snd_tscm_create_midi_devices(struct snd_tscm *tscm); int snd_tscm_create_hwdep_device(struct snd_tscm *tscm); #endif ion value='25'>25space:mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-02-01 17:45:02 +0000
committerIngo Molnar <mingo@kernel.org>2017-02-01 21:17:49 +0100
commitc8f325a59cfc718d13a50fbc746ed9b415c25e92 (patch)
treed53fbdac9d0781e39a13b2ac6b2bd258cf3b4140 /sound/soc/codecs/es8328-spi.c
parentbf29bddf0417a4783da3b24e8c9e017ac649326f (diff)
efi/fdt: Avoid FDT manipulation after ExitBootServices()
Some AArch64 UEFI implementations disable the MMU in ExitBootServices(), after which unaligned accesses to RAM are no longer supported. Commit: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") fixed an issue in the memory map handling of the stub FDT code, but inadvertently created an issue with such firmware, by moving some of the FDT manipulation to after the invocation of ExitBootServices(). Given that the stub's libfdt implementation uses the ordinary, accelerated string functions, which rely on hardware handling of unaligned accesses, manipulating the FDT with the MMU off may result in alignment faults. So fix the situation by moving the update_fdt_memmap() call into the callback function invoked by efi_exit_boot_services() right before it calls the ExitBootServices() UEFI service (which is arguably a better place for it anyway) Note that disabling the MMU in ExitBootServices() is not compliant with the UEFI spec, and carries great risk due to the fact that switching from cached to uncached memory accesses halfway through compiler generated code (i.e., involving a stack) can never be done in a way that is architecturally safe. Fixes: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Riku Voipio <riku.voipio@linaro.org> Cc: <stable@vger.kernel.org> Cc: mark.rutland@arm.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: leif.lindholm@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/soc/codecs/es8328-spi.c')