From e49069636d442f50509da84f7f78144270e4fe3e Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Mon, 29 Jan 2024 13:05:05 +0100 Subject: [PATCH] refactor: pci_channel_io_perm_failure info to the log. --- mrmShared/linux/dkms-rpm/50-mrf.rules.in | 2 +- mrmShared/linux/dkms-rpm/mrf.spec.in | 5 +++-- mrmShared/linux/uio_mrf.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/mrmShared/linux/dkms-rpm/50-mrf.rules.in b/mrmShared/linux/dkms-rpm/50-mrf.rules.in index a0903e23c..6b7de2f2b 100644 --- a/mrmShared/linux/dkms-rpm/50-mrf.rules.in +++ b/mrmShared/linux/dkms-rpm/50-mrf.rules.in @@ -1,2 +1,2 @@ # UDEV rule giving access to MRF device -KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@MRF_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/echo UDEV rule giving access to MRF device %S%p" +KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@MRF_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/logger UDEV rule giving access to MRF device %S%p" diff --git a/mrmShared/linux/dkms-rpm/mrf.spec.in b/mrmShared/linux/dkms-rpm/mrf.spec.in index 4bdee0269..833e898d7 100644 --- a/mrmShared/linux/dkms-rpm/mrf.spec.in +++ b/mrmShared/linux/dkms-rpm/mrf.spec.in @@ -61,8 +61,8 @@ modprobe %{kmod_name} %preun modprobe -r %{kmod_name} dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade --all ||: -groupdel @@MRF_GROUP@@ 2>&1 || : %udev_rules_update +groupdel @@MRF_GROUP@@ 2>&1 || : %postun rmdir /usr/src/%{kmod_name}-%{version} @@ -70,7 +70,8 @@ rmdir /usr/src/%{kmod_name}-%{version} %changelog * Wed Jan 24 2024 Jerzy Jamroz - 3-1 -- Build adjustments. +- Build adjustments exposing the control variables. +- Pkg name changed to mrfioc2-dkms. - Correction of the driver version handling. - Group rw access for the pci resource0. - AER handling functions. diff --git a/mrmShared/linux/uio_mrf.c b/mrmShared/linux/uio_mrf.c index 9114552a0..dff76526f 100644 --- a/mrmShared/linux/uio_mrf.c +++ b/mrmShared/linux/uio_mrf.c @@ -398,7 +398,7 @@ int mrf_irqcontrol(struct uio_info *info, s32 onoff) default: // there are no distict registers for this bridge. // 'plx' holds the base address of FPGA registers - + // Check endianism end = mrf_detect_endian(priv, plx); @@ -644,7 +644,7 @@ mrf_probe(struct pci_dev *dev, /* clear everything for GPIO 0-3 (aka first 12 bits). * Preserve current settings for GPIO 4-7. * This will setup these as inputs (which float high) - * + * * Each GPIO bit has 3 register bits (function, direction, and value) */ val &= 0xfffff000; @@ -832,23 +832,24 @@ mrf_error_detected(struct pci_dev *dev, pci_channel_state_t state) { struct uio_info *info = pci_get_drvdata(dev); struct mrf_priv *priv = container_of(info, struct mrf_priv, uio); - + if (state == pci_channel_io_normal) { /* FIXME: Anything else to do here? */ return PCI_ERS_RESULT_CAN_RECOVER; } else if (state == pci_channel_io_frozen) { dev_warn(&dev->dev, "Unregistering UIO device\n"); uio_unregister_device(info); - + if (priv->msienabled) { pci_disable_msi(dev); } - + pci_disable_device(dev); - + /* FIXME: Anything else to do here? */ return PCI_ERS_RESULT_NEED_RESET; } else if (state == pci_channel_io_perm_failure) { + printk(KERN_ERR "PCI card is dead.\n"); return PCI_ERS_RESULT_DISCONNECT; } @@ -878,13 +879,13 @@ mrf_slot_reset(struct pci_dev *dev) dev_dbg(&dev->dev, "Error enabling MSI %d\n", err); } } - + ret = uio_register_device(&dev->dev, info); if (ret) { dev_err(&dev->dev, "Failed to register UIO device %d\n", ret); } dev_warn(&dev->dev, "Registered UIO device\n"); - + pci_restore_state(dev); pci_save_state(dev);