From: Hannes Reinecke <hare@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Tejun Heo <tj@kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
linux-ide@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 12/40] sata_mv: replace DPRINTK with 'pci_dump' module parameter
Date: Tue, 3 Mar 2020 10:37:45 +0100 [thread overview]
Message-ID: <20200303093813.18523-13-hare@suse.de> (raw)
In-Reply-To: <20200303093813.18523-1-hare@suse.de>
Implement module parameter 'pci_dump' and move the DPRINTK calls
over to dev_printk().
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
drivers/ata/sata_mv.c | 88 ++++++++++++++++++++++++++++-----------------------
1 file changed, 49 insertions(+), 39 deletions(-)
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index d7228f8e9297..1eb93976af8d 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -83,6 +83,10 @@ module_param(irq_coalescing_usecs, int, S_IRUGO);
MODULE_PARM_DESC(irq_coalescing_usecs,
"IRQ coalescing time threshold in usecs");
+static int pci_dump;
+module_param(pci_dump, int, S_IRUGO);
+MODULE_PARM_DESC(pci_dump, "Enable dumping of PCI registers on error");
+
enum {
/* BAR's are enumerated in terms of pci_resource_start() terms */
MV_PRIMARY_BAR = 0, /* offset 0x10: memory space */
@@ -1245,42 +1249,43 @@ static int mv_stop_edma(struct ata_port *ap)
return err;
}
-#ifdef ATA_DEBUG
-static void mv_dump_mem(void __iomem *start, unsigned bytes)
+static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)
{
- int b, w;
+ int b, w, o;
+ unsigned char linebuf[38];
+
for (b = 0; b < bytes; ) {
- DPRINTK("%p: ", start + b);
- for (w = 0; b < bytes && w < 4; w++) {
- printk("%08x ", readl(start + b));
+ for (w = 0, o = 0; b < bytes && w < 4; w++) {
+ o += snprintf(linebuf + o, 38 - o,
+ "%08x ", readl(start + b));
b += sizeof(u32);
}
- printk("\n");
+ dev_printk(KERN_DEBUG, dev, "%s: %p: %s\n",
+ __func__, start + b, linebuf);
}
}
-#endif
-#if defined(ATA_DEBUG) || defined(CONFIG_PCI)
+
static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes)
{
-#ifdef ATA_DEBUG
- int b, w;
+ int b, w, o;
u32 dw;
+ unsigned char linebuf[38];
+
for (b = 0; b < bytes; ) {
- DPRINTK("%02x: ", b);
- for (w = 0; b < bytes && w < 4; w++) {
+ for (w = 0, o = 0; b < bytes && w < 4; w++) {
(void) pci_read_config_dword(pdev, b, &dw);
- printk("%08x ", dw);
+ o += snprintf(linebuf + o, 38 - o,
+ "%08x ", dw);
b += sizeof(u32);
}
- printk("\n");
+ dev_printk(KERN_DEBUG, &pdev->dev, "%s: %02x: %s\n",
+ __func__, b, linebuf);
}
-#endif
}
-#endif
+
static void mv_dump_all_regs(void __iomem *mmio_base, int port,
struct pci_dev *pdev)
{
-#ifdef ATA_DEBUG
void __iomem *hc_base = mv_hc_base(mmio_base,
port >> MV_PORT_HC_SHIFT);
void __iomem *port_base;
@@ -1295,31 +1300,34 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
start_port = port;
num_ports = num_hcs = 1;
}
- DPRINTK("All registers for port(s) %u-%u:\n", start_port,
- num_ports > 1 ? num_ports - 1 : start_port);
+ dev_printk(KERN_DEBUG, &pdev->dev,
+ "%s: All registers for port(s) %u-%u:\n", __func__,
+ start_port, num_ports > 1 ? num_ports - 1 : start_port);
- if (NULL != pdev) {
- DPRINTK("PCI config space regs:\n");
- mv_dump_pci_cfg(pdev, 0x68);
- }
- DPRINTK("PCI regs:\n");
- mv_dump_mem(mmio_base+0xc00, 0x3c);
- mv_dump_mem(mmio_base+0xd00, 0x34);
- mv_dump_mem(mmio_base+0xf00, 0x4);
- mv_dump_mem(mmio_base+0x1d00, 0x6c);
+ dev_printk(KERN_DEBUG, &pdev->dev,
+ "%s: PCI config space regs:\n", __func__);
+ mv_dump_pci_cfg(pdev, 0x68);
+
+ dev_printk(KERN_DEBUG, &pdev->dev, "%s: PCI regs:\n", __func__);
+ mv_dump_mem(&pdev->dev, mmio_base+0xc00, 0x3c);
+ mv_dump_mem(&pdev->dev, mmio_base+0xd00, 0x34);
+ mv_dump_mem(&pdev->dev, mmio_base+0xf00, 0x4);
+ mv_dump_mem(&pdev->dev, mmio_base+0x1d00, 0x6c);
for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
hc_base = mv_hc_base(mmio_base, hc);
- DPRINTK("HC regs (HC %i):\n", hc);
- mv_dump_mem(hc_base, 0x1c);
+ dev_printk(KERN_DEBUG, &pdev->dev, "%s: HC regs (HC %i):\n",
+ __func__, hc);
+ mv_dump_mem(&pdev->dev, hc_base, 0x1c);
}
for (p = start_port; p < start_port + num_ports; p++) {
port_base = mv_port_base(mmio_base, p);
- DPRINTK("EDMA regs (port %i):\n", p);
- mv_dump_mem(port_base, 0x54);
- DPRINTK("SATA regs (port %i):\n", p);
- mv_dump_mem(port_base+0x300, 0x60);
+ dev_printk(KERN_DEBUG, &pdev->dev, "%s: EDMA regs (port %i):\n",
+ __func__, p);
+ mv_dump_mem(&pdev->dev, port_base, 0x54);
+ dev_printk(KERN_DEBUG, &pdev->dev, "%s: SATA regs (port %i):\n",
+ __func__, p);
+ mv_dump_mem(&pdev->dev, port_base+0x300, 0x60);
}
-#endif
}
static unsigned int mv_scr_offset(unsigned int sc_reg_in)
@@ -2958,9 +2966,11 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
dev_err(host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", err_cause);
- DPRINTK("All regs @ PCI error\n");
- mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
-
+ if (pci_dump) {
+ dev_printk(KERN_DEBUG, host->dev, "%s: All regs @ PCI error\n",
+ __func__);
+ mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
+ }
writelfl(0, mmio + hpriv->irq_cause_offset);
for (i = 0; i < host->n_ports; i++) {
--
2.16.4
next prev parent reply other threads:[~2020-03-03 9:39 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 9:37 [PATCHv3 00/40] ata: kill ATA_DEBUG Hannes Reinecke
2020-03-03 9:37 ` [PATCH 01/40] libata: drop BPRINTK() Hannes Reinecke
2020-03-03 9:37 ` [PATCH 02/40] libata.h: whitespace and indentation fixes Hannes Reinecke
2020-03-03 9:37 ` [PATCH 03/40] libata-transport: Whitespace cleanup Hannes Reinecke
2020-03-03 9:37 ` [PATCH 04/40] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
2020-03-24 13:26 ` Geert Uytterhoeven
2020-03-25 14:56 ` Bartlomiej Zolnierkiewicz
2020-03-25 15:34 ` Geert Uytterhoeven
2020-03-25 15:45 ` Bartlomiej Zolnierkiewicz
2020-03-25 16:54 ` Hannes Reinecke
2020-03-03 9:37 ` [PATCH 05/40] libata: move __func__ into ata_{port,link,dev}_dbg() helper Hannes Reinecke
2020-03-03 9:37 ` [PATCH 06/40] libata: remove pointless debugging messages Hannes Reinecke
2020-03-03 9:37 ` [PATCH 07/40] ata_piix: remove " Hannes Reinecke
2020-03-03 9:37 ` [PATCH 08/40] libata-core: remove pointless " Hannes Reinecke
2020-03-03 9:37 ` [PATCH 09/40] libata: Add ata_port_classify() helper Hannes Reinecke
2020-03-03 9:37 ` [PATCH 10/40] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
2020-03-03 9:37 ` [PATCH 11/40] libata: sanitize ATA_HORKAGE_DUMP_ID Hannes Reinecke
2020-03-03 9:37 ` Hannes Reinecke [this message]
2020-03-03 9:37 ` [PATCH 13/40] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
2020-03-03 9:37 ` [PATCH 14/40] sata_sx4: move DPRINTK to VPRINTK Hannes Reinecke
2020-03-03 9:37 ` [PATCH 15/40] libata: add reset tracepoints Hannes Reinecke
2020-03-03 9:37 ` [PATCH 16/40] libata: drop DPRINTK() calls in reset Hannes Reinecke
2020-03-03 9:37 ` [PATCH 17/40] libata: tracepoints for bus-master DMA Hannes Reinecke
2020-03-03 9:37 ` [PATCH 18/40] libata: drop debugging statements " Hannes Reinecke
2020-03-03 9:37 ` [PATCH 19/40] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls Hannes Reinecke
2020-03-03 9:37 ` [PATCH 20/40] pata_arasan_cf: use generic tracepoints Hannes Reinecke
2020-03-03 9:37 ` [PATCH 21/40] sata_dwc_460ex: " Hannes Reinecke
2020-03-03 9:37 ` [PATCH 22/40] sata_nv: " Hannes Reinecke
2020-03-03 9:37 ` [PATCH 23/40] libata-sff: tracepoints for HSM state machine Hannes Reinecke
2020-03-03 9:37 ` [PATCH 24/40] libata-sff: add tracepoints for ata_sff_flush_pio_task() Hannes Reinecke
2020-03-03 9:37 ` [PATCH 25/40] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
2020-03-03 9:37 ` [PATCH 26/40] libata: add tracepoints for ATA error handling Hannes Reinecke
2020-03-03 9:38 ` [PATCH 27/40] libata: drop DPRINTK() calls during " Hannes Reinecke
2020-03-03 9:38 ` [PATCH 28/40] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
2020-03-03 9:38 ` [PATCH 29/40] pata_octeon_cf: move DPRINTK to VPRINTK Hannes Reinecke
2020-03-03 9:38 ` [PATCH 30/40] pdc_adma: " Hannes Reinecke
2020-03-03 9:38 ` [PATCH 31/40] sata_rcar: " Hannes Reinecke
2020-03-03 9:38 ` [PATCH 32/40] sata_qstor: " Hannes Reinecke
2020-03-03 9:38 ` [PATCH 33/40] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Hannes Reinecke
2020-03-03 9:38 ` [PATCH 34/40] sata_nv: move DPRINTK to ata debugging Hannes Reinecke
2020-03-03 9:38 ` [PATCH 35/40] sata_fsl: " Hannes Reinecke
2020-03-13 14:43 ` Guenter Roeck
2020-03-03 9:38 ` [PATCH 36/40] libata-core: " Hannes Reinecke
2020-03-03 9:38 ` [PATCH 37/40] libata: remove DPRINTK() macro Hannes Reinecke
2020-03-03 9:38 ` [PATCH 38/40] libata: kill ATA_MSG_INFO Hannes Reinecke
2020-03-03 9:38 ` [PATCH 39/40] libata: kill ATA_MSG_CTL Hannes Reinecke
2020-03-03 9:38 ` [PATCH 40/40] libata: remove references to ATA_DEBUG Hannes Reinecke
2020-03-12 14:04 ` [PATCHv3 00/40] ata: kill ATA_DEBUG Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200303093813.18523-13-hare@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=b.zolnierkie@samsung.com \
--cc=linux-ide@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).