Skip to content

Commit

Permalink
refactor: pci_channel_io_perm_failure info to the log.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerzyjamroz committed Jan 30, 2024
1 parent ddc9494 commit e490696
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mrmShared/linux/dkms-rpm/50-mrf.rules.in
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 3 additions & 2 deletions mrmShared/linux/dkms-rpm/mrf.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,17 @@ 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}

%changelog

* Wed Jan 24 2024 Jerzy Jamroz <[email protected]> - 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.
Expand Down
17 changes: 9 additions & 8 deletions mrmShared/linux/uio_mrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit e490696

Please sign in to comment.