Changes in 4.9.137 bcache: fix miss key refill->end in writeback hwmon: (pmbus) Fix page count auto-detection. jffs2: free jffs2_sb_info through jffs2_kill_sb() pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges ipmi: Fix timer race with module unload parisc: Fix address in HPMC IVA parisc: Fix map_pages() to not overwrite existing pte entries ALSA: hda - Add quirk for ASUS G751 laptop ALSA: hda - Fix headphone pin config for ASUS G751 ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905) ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided x86/speculation: Support Enhanced IBRS on future CPUs bpf: do not blindly change rlimit in reuseport net selftest Revert "perf tools: Fix PMU term format max value calculation" xfrm: policy: use hlist rcu variants on insert sparc: Fix single-pcr perf event counter management. sparc64: Make proc_id signed. sched/fair: Fix the min_vruntime update logic in dequeue_entity() perf cpu_map: Align cpu map synthesized events properly. x86/fpu: Remove second definition of fpu in __fpu__restore_sig() net: qla3xxx: Remove overflowing shift statement selftests: ftrace: Add synthetic event syntax testcase i2c: rcar: cleanup DMA for all kinds of failure locking/lockdep: Fix debug_locks off performance problem ataflop: fix error handling during setup swim: fix cleanup on setup error tun: Consistently configure generic netdev params via rtnetlink s390/sthyi: Fix machine name validity indication hwmon: (pwm-fan) Set fan speed to 0 on suspend perf tools: Free temporary 'sys' string in read_event_files() perf tools: Cleanup trace-event-info 'tdata' leak perf strbuf: Match va_{add,copy} with va_end mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01 iwlwifi: pcie: avoid empty free RB queue x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC cpufreq: dt: Try freeing static OPPs only if we have added them Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth x86: boot: Fix EFI stub alignment pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux brcmfmac: fix for proper support of 160MHz bandwidth kprobes: Return error if we fail to reuse kprobe instead of BUG_ON() ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers pinctrl: qcom: spmi-mpp: Fix drive strength setting pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant ixgbevf: VF2VF TCP RSS ath10k: schedule hardware restart if WMI command times out cgroup, netclassid: add a preemption point to write_classid scsi: esp_scsi: Track residual for PIO transfers scsi: megaraid_sas: fix a missing-check bug RDMA/core: Do not expose unsupported counters IB/ipoib: Clear IPCB before icmp_send tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated VMCI: Resource wildcard match fixed usb: gadget: udc: atmel: handle at91sam9rl PMC ext4: fix argument checking in EXT4_IOC_MOVE_EXT MD: fix invalid stored role for a disk PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice coresight: etb10: Fix handling of perf mode crypto: caam - fix implicit casts in endianness helpers usb: chipidea: Prevent unbalanced IRQ disable driver/dma/ioat: Call del_timer_sync() without holding prep_lock uio: ensure class is registered before devices scsi: lpfc: Correct soft lockup when running mds diagnostics signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init dmaengine: dma-jz4780: Return error if not probed from DT ALSA: hda: Check the non-cached stream buffers more explicitly ARM: dts: exynos: Remove "cooling-{min|max}-level" for CPU nodes arm: dts: exynos: Add missing cooling device properties for CPUs ARM: dts: exynos: Convert exynos5250.dtsi to opp-v2 bindings ARM: dts: exynos: Mark 1 GHz CPU OPP as suspend OPP on Exynos5250 xen-swiotlb: use actually allocated size on check physical continuous tpm: Restore functionality to xen vtpm driver. xen/blkfront: avoid NULL blkfront_info dereference on device removal xen: fix race in xen_qlock_wait() xen: make xen_qlock_wait() nestable libertas: don't set URB_ZERO_PACKET on IN USB transfer usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten iwlwifi: mvm: check return value of rs_rate_from_ucode_rate() net/ipv4: defensive cipso option parsing libnvdimm: Hold reference on parent while scheduling async init ASoC: intel: skylake: Add missing break in skl_tplg_get_token() jbd2: fix use after free in jbd2_log_do_checkpoint() gfs2_meta: ->mount() can get NULL dev_name ext4: initialize retries variable in ext4_da_write_inline_data_begin() ext4: propagate error from dquot_initialize() in EXT4_IOC_FSSETXATTR HID: hiddev: fix potential Spectre v1 EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting EDAC, skx_edac: Fix logical channel intermediate decoding PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk signal/GenWQE: Fix sending of SIGKILL crypto: lrw - Fix out-of bounds access on counter overflow crypto: tcrypt - fix ghash-generic speed test ima: fix showing large 'violations' or 'runtime_measurements_count' hugetlbfs: dirty pages as they are added to pagecache kbuild: fix kernel/bounds.c 'W=1' warning iio: ad5064: Fix regulator handling iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs() iio: adc: at91: fix acking DRDY irq on simple conversions iio: adc: at91: fix wrong channel number in triggered buffer mode w1: omap-hdq: fix missing bus unregister at removal smb3: allow stats which track session and share reconnects to be reset smb3: do not attempt cifs operation in smb3 query info error path smb3: on kerberos mount if server doesn't specify auth type use krb5 printk: Fix panic caused by passing log_buf_len to command line genirq: Fix race on spurious interrupt detection NFSv4.1: Fix the r/wsize checking nfsd: Fix an Oops in free_session() lockd: fix access beyond unterminated strings in prints dm ioctl: harden copy_params()'s copy_from_user() from malicious users powerpc/msi: Fix compile error on mpc83xx MIPS: OCTEON: fix out of bounds array access on CN68XX TC: Set DMA masks for devices media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD kgdboc: Passing ekgdboc to command line causes panic xen: fix xen_qlock_wait() media: em28xx: use a default format if TRY_FMT fails media: tvp5150: avoid going past array on v4l2_querymenu() media: em28xx: fix input name for Terratec AV 350 media: em28xx: make v4l2-compliance happier by starting sequence on zero arm64: lse: remove -fcall-used-x0 flag rpmsg: smd: fix memory leak on channel create Cramfs: fix abad comparison when wrap-arounds occur arm64: dts: stratix10: Correct System Manager register size soc/tegra: pmc: Fix child-node lookup btrfs: Handle owner mismatch gracefully when walking up tree btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock btrfs: fix error handling in free_log_tree btrfs: iterate all devices during trim, instead of fs_devices::alloc_list btrfs: don't attempt to trim devices that don't support it btrfs: wait on caching when putting the bg cache btrfs: reset max_extent_size on clear in a bitmap btrfs: make sure we create all new block groups Btrfs: fix wrong dentries after fsync of file that got its parent replaced btrfs: qgroup: Dirty all qgroups before rescan Btrfs: fix null pointer dereference on compressed write path error btrfs: set max_extent_size properly MD: fix invalid stored role for a disk - try2 Linux 4.9.137 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
209 lines
5.5 KiB
C
209 lines
5.5 KiB
C
/*
|
|
* TURBOchannel bus services.
|
|
*
|
|
* Copyright (c) Harald Koerfgen, 1998
|
|
* Copyright (c) 2001, 2003, 2005, 2006, 2018 Maciej W. Rozycki
|
|
* Copyright (c) 2005 James Simmons
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU
|
|
* General Public License. See the file "COPYING" in the main
|
|
* directory of this archive for more details.
|
|
*/
|
|
#include <linux/compiler.h>
|
|
#include <linux/dma-mapping.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/init.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/list.h>
|
|
#include <linux/module.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/string.h>
|
|
#include <linux/tc.h>
|
|
#include <linux/types.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
static struct tc_bus tc_bus = {
|
|
.name = "TURBOchannel",
|
|
};
|
|
|
|
/*
|
|
* Probing for TURBOchannel modules.
|
|
*/
|
|
static void __init tc_bus_add_devices(struct tc_bus *tbus)
|
|
{
|
|
resource_size_t slotsize = tbus->info.slot_size << 20;
|
|
resource_size_t extslotsize = tbus->ext_slot_size;
|
|
resource_size_t slotaddr;
|
|
resource_size_t extslotaddr;
|
|
resource_size_t devsize;
|
|
void __iomem *module;
|
|
struct tc_dev *tdev;
|
|
int i, slot, err;
|
|
u8 pattern[4];
|
|
long offset;
|
|
|
|
for (slot = 0; slot < tbus->num_tcslots; slot++) {
|
|
slotaddr = tbus->slot_base + slot * slotsize;
|
|
extslotaddr = tbus->ext_slot_base + slot * extslotsize;
|
|
module = ioremap_nocache(slotaddr, slotsize);
|
|
BUG_ON(!module);
|
|
|
|
offset = TC_OLDCARD;
|
|
|
|
err = 0;
|
|
err |= tc_preadb(pattern + 0, module + offset + TC_PATTERN0);
|
|
err |= tc_preadb(pattern + 1, module + offset + TC_PATTERN1);
|
|
err |= tc_preadb(pattern + 2, module + offset + TC_PATTERN2);
|
|
err |= tc_preadb(pattern + 3, module + offset + TC_PATTERN3);
|
|
if (err)
|
|
goto out_err;
|
|
|
|
if (pattern[0] != 0x55 || pattern[1] != 0x00 ||
|
|
pattern[2] != 0xaa || pattern[3] != 0xff) {
|
|
offset = TC_NEWCARD;
|
|
|
|
err = 0;
|
|
err |= tc_preadb(pattern + 0,
|
|
module + offset + TC_PATTERN0);
|
|
err |= tc_preadb(pattern + 1,
|
|
module + offset + TC_PATTERN1);
|
|
err |= tc_preadb(pattern + 2,
|
|
module + offset + TC_PATTERN2);
|
|
err |= tc_preadb(pattern + 3,
|
|
module + offset + TC_PATTERN3);
|
|
if (err)
|
|
goto out_err;
|
|
}
|
|
|
|
if (pattern[0] != 0x55 || pattern[1] != 0x00 ||
|
|
pattern[2] != 0xaa || pattern[3] != 0xff)
|
|
goto out_err;
|
|
|
|
/* Found a board, allocate it an entry in the list */
|
|
tdev = kzalloc(sizeof(*tdev), GFP_KERNEL);
|
|
if (!tdev) {
|
|
pr_err("tc%x: unable to allocate tc_dev\n", slot);
|
|
goto out_err;
|
|
}
|
|
dev_set_name(&tdev->dev, "tc%x", slot);
|
|
tdev->bus = tbus;
|
|
tdev->dev.parent = &tbus->dev;
|
|
tdev->dev.bus = &tc_bus_type;
|
|
tdev->slot = slot;
|
|
|
|
/* TURBOchannel has 34-bit DMA addressing (16GiB space). */
|
|
tdev->dma_mask = DMA_BIT_MASK(34);
|
|
tdev->dev.dma_mask = &tdev->dma_mask;
|
|
tdev->dev.coherent_dma_mask = DMA_BIT_MASK(34);
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
tdev->firmware[i] =
|
|
readb(module + offset + TC_FIRM_VER + 4 * i);
|
|
tdev->vendor[i] =
|
|
readb(module + offset + TC_VENDOR + 4 * i);
|
|
tdev->name[i] =
|
|
readb(module + offset + TC_MODULE + 4 * i);
|
|
}
|
|
tdev->firmware[8] = 0;
|
|
tdev->vendor[8] = 0;
|
|
tdev->name[8] = 0;
|
|
|
|
pr_info("%s: %s %s %s\n", dev_name(&tdev->dev), tdev->vendor,
|
|
tdev->name, tdev->firmware);
|
|
|
|
devsize = readb(module + offset + TC_SLOT_SIZE);
|
|
devsize <<= 22;
|
|
if (devsize <= slotsize) {
|
|
tdev->resource.start = slotaddr;
|
|
tdev->resource.end = slotaddr + devsize - 1;
|
|
} else if (devsize <= extslotsize) {
|
|
tdev->resource.start = extslotaddr;
|
|
tdev->resource.end = extslotaddr + devsize - 1;
|
|
} else {
|
|
pr_err("%s: Cannot provide slot space "
|
|
"(%ldMiB required, up to %ldMiB supported)\n",
|
|
dev_name(&tdev->dev), (long)(devsize >> 20),
|
|
(long)(max(slotsize, extslotsize) >> 20));
|
|
kfree(tdev);
|
|
goto out_err;
|
|
}
|
|
tdev->resource.name = tdev->name;
|
|
tdev->resource.flags = IORESOURCE_MEM;
|
|
|
|
tc_device_get_irq(tdev);
|
|
|
|
if (device_register(&tdev->dev)) {
|
|
put_device(&tdev->dev);
|
|
goto out_err;
|
|
}
|
|
list_add_tail(&tdev->node, &tbus->devices);
|
|
|
|
out_err:
|
|
iounmap(module);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* The main entry.
|
|
*/
|
|
static int __init tc_init(void)
|
|
{
|
|
/* Initialize the TURBOchannel bus */
|
|
if (tc_bus_get_info(&tc_bus))
|
|
goto out_err;
|
|
|
|
INIT_LIST_HEAD(&tc_bus.devices);
|
|
dev_set_name(&tc_bus.dev, "tc");
|
|
if (device_register(&tc_bus.dev))
|
|
goto out_err_device;
|
|
|
|
if (tc_bus.info.slot_size) {
|
|
unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000;
|
|
|
|
pr_info("tc: TURBOchannel rev. %d at %d.%d MHz "
|
|
"(with%s parity)\n", tc_bus.info.revision,
|
|
tc_clock / 10, tc_clock % 10,
|
|
tc_bus.info.parity ? "" : "out");
|
|
|
|
tc_bus.resource[0].start = tc_bus.slot_base;
|
|
tc_bus.resource[0].end = tc_bus.slot_base +
|
|
(tc_bus.info.slot_size << 20) *
|
|
tc_bus.num_tcslots - 1;
|
|
tc_bus.resource[0].name = tc_bus.name;
|
|
tc_bus.resource[0].flags = IORESOURCE_MEM;
|
|
if (request_resource(&iomem_resource,
|
|
&tc_bus.resource[0]) < 0) {
|
|
pr_err("tc: Cannot reserve resource\n");
|
|
goto out_err_device;
|
|
}
|
|
if (tc_bus.ext_slot_size) {
|
|
tc_bus.resource[1].start = tc_bus.ext_slot_base;
|
|
tc_bus.resource[1].end = tc_bus.ext_slot_base +
|
|
tc_bus.ext_slot_size *
|
|
tc_bus.num_tcslots - 1;
|
|
tc_bus.resource[1].name = tc_bus.name;
|
|
tc_bus.resource[1].flags = IORESOURCE_MEM;
|
|
if (request_resource(&iomem_resource,
|
|
&tc_bus.resource[1]) < 0) {
|
|
pr_err("tc: Cannot reserve resource\n");
|
|
goto out_err_resource;
|
|
}
|
|
}
|
|
|
|
tc_bus_add_devices(&tc_bus);
|
|
}
|
|
|
|
return 0;
|
|
|
|
out_err_resource:
|
|
release_resource(&tc_bus.resource[0]);
|
|
out_err_device:
|
|
put_device(&tc_bus.dev);
|
|
out_err:
|
|
return 0;
|
|
}
|
|
|
|
subsys_initcall(tc_init);
|