All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-ide@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH 17/24] sata_mv: replace DPRINTK with 'pci_dump' module parameter
Date: Thu, 30 Jan 2020 12:36:34 +0100	[thread overview]
Message-ID: <d9fdb2e6-e361-e070-92e5-e2ab01c8f3aa@samsung.com> (raw)
In-Reply-To: <20181213104716.31930-29-hare@suse.de>


On 12/13/18 11:47 AM, Hannes Reinecke wrote:
> Implement module parameter 'pci_dump' and move the DPRINTK calls
> over to dev_printk().

Please preserve __func__ printing in the conversion.

> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/ata/sata_mv.c | 71 +++++++++++++++++++++++++++------------------------
>  1 file changed, 38 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 73ba8e134ca9..2ede635e4023 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -96,6 +96,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 */
> @@ -1258,47 +1262,49 @@ 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, "%p: %s\n", start + b, linebuf);
>  	}
>  }
> -#endif
> -#if defined(ATA_DEBUG) || defined(CONFIG_PCI)
> +#if 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, "%02x: %s\n", 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;
>  	int start_port, num_ports, p, start_hc, num_hcs, hc;
>  
> +	if (!pci_dump)
> +		return;
> +	dev_printk(KERN_DEBUG, &pdev->dev, "All regs @ PCI error\n");
>  	if (0 > port) {
>  		start_hc = start_port = 0;
>  		num_ports = 8;		/* shld be benign for 4 port devs */
> @@ -1308,31 +1314,31 @@ 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,
> +		   "All registers for port(s) %u-%u:\n", start_port,
> +		   num_ports > 1 ? num_ports - 1 : start_port);
>  
>  	if (NULL != pdev) {
> -		DPRINTK("PCI config space regs:\n");
> +		dev_printk(KERN_DEBUG, &pdev->dev, "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, "PCI regs:\n");
> +	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, "HC regs (HC %i):\n", 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, "EDMA regs (port %i):\n", p);
> +		mv_dump_mem(&pdev->dev, port_base, 0x54);
> +		dev_printk(KERN_DEBUG, &pdev->dev, "SATA regs (port %i):\n", p);
> +		mv_dump_mem(&pdev->dev, port_base+0x300, 0x60);
>  	}
> -#endif
>  }
>  
>  static unsigned int mv_scr_offset(unsigned int sc_reg_in)
> @@ -2969,7 +2975,6 @@ 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));
>  
>  	writelfl(0, mmio + hpriv->irq_cause_offset);
> 

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

  parent reply	other threads:[~2020-01-30 11:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181213104740epcas3p419fa4d0d7bbd5a5004ba3f3c632ba7bd@epcas3p4.samsung.com>
     [not found] ` <20181213104716.31930-1-hare@suse.de>
2020-01-30 10:24   ` [PATCH 00/24] ata: move DPRINTK to dynamic debugging Bartlomiej Zolnierkiewicz
2020-01-30 10:55     ` Hannes Reinecke
     [not found]   ` <CGME20181213104740epcas3p430cad94d8c4c4f58f1d6595ea1eff438@epcas3p4.samsung.com>
     [not found]     ` <20181213104716.31930-2-hare@suse.de>
2020-01-30 10:42       ` [PATCH 01/24] libata: move ata_{port,link,dev}_dbg " Bartlomiej Zolnierkiewicz
2020-01-31 11:44         ` Hannes Reinecke
     [not found]   ` <CGME20181213104751epcas1p46f3208764bdb8b6a0c03ff234cbe61bf@epcas1p4.samsung.com>
     [not found]     ` <20181213104716.31930-13-hare@suse.de>
2020-01-30 10:46       ` [PATCH 02/24] sata_nv: move DPRINTK to ata debugging Bartlomiej Zolnierkiewicz
2020-01-31 12:57         ` Hannes Reinecke
     [not found]   ` <CGME20181213104742epcas5p487aa32d0bacabb467af45fcab65c7096@epcas5p4.samsung.com>
     [not found]     ` <20181213104716.31930-15-hare@suse.de>
2020-01-30 10:46       ` [PATCH 03/24] sata_sx4: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104753epcas4p2a438bc1a7eb6196a44644b0f93463d9d@epcas4p2.samsung.com>
     [not found]     ` <20181213104716.31930-16-hare@suse.de>
2020-01-30 10:47       ` [PATCH 04/24] sata_sil24: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104740epcas3p12db09f60dff38bdae330d6a541fd4656@epcas3p1.samsung.com>
     [not found]     ` <20181213104716.31930-17-hare@suse.de>
2020-01-30 10:48       ` [PATCH 05/24] sata_rcar: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104832epcas5p268d10f69ecfa32949f56cae0fed83f90@epcas5p2.samsung.com>
     [not found]     ` <20181213104716.31930-18-hare@suse.de>
2020-01-30 10:48       ` [PATCH 06/24] sata_qstor: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104738epcas2p471da9b8d359cec2dbb81dd9cdee37a15@epcas2p4.samsung.com>
     [not found]     ` <20181213104716.31930-19-hare@suse.de>
2020-01-30 10:49       ` [PATCH 07/24] pdc_adma: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104745epcas2p20c8dc2116482a250d09928fac8cea709@epcas2p2.samsung.com>
     [not found]     ` <20181213104716.31930-20-hare@suse.de>
2020-01-30 10:50       ` [PATCH 08/24] ahci: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104817epcas1p1bd74393040fb4b5da0b4aa2f401d1934@epcas1p1.samsung.com>
     [not found]     ` <20181213104716.31930-21-hare@suse.de>
2020-01-30 10:50       ` [PATCH 09/24] ahci_qorig: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104816epcas1p2b354b2f30c32d5e7a9d8cc42d2004c0f@epcas1p2.samsung.com>
     [not found]     ` <20181213104716.31930-22-hare@suse.de>
2020-01-30 10:52       ` [PATCH 10/24] pata_octeon_cf: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104752epcas1p47af8f76a903a917f9a1b6b9a6a1313d8@epcas1p4.samsung.com>
     [not found]     ` <20181213104716.31930-23-hare@suse.de>
2020-01-30 10:52       ` [PATCH 11/24] pata_sil680: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104821epcas1p232acb49869e54a322a48109bb43eeacc@epcas1p2.samsung.com>
     [not found]     ` <20181213104716.31930-24-hare@suse.de>
2020-01-30 10:53       ` [PATCH 12/24] ata_piix: Remove DPRINTK usage Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104745epcas2p448f3dcac7e01735ab3cded7c52d94ae9@epcas2p4.samsung.com>
     [not found]     ` <20181213104716.31930-25-hare@suse.de>
2020-01-30 10:55       ` [PATCH 13/24] libahci: move DPRINTK to ata debugging Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104817epcas1p25cb6abb26bf269e4ec5619c3920d3c83@epcas1p2.samsung.com>
     [not found]     ` <20181213104716.31930-26-hare@suse.de>
2020-01-30 11:07       ` [PATCH 14/24] libata: " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104753epcas4p3d7c28762331751d9dc184213ece87774@epcas4p3.samsung.com>
     [not found]     ` <20181213104716.31930-27-hare@suse.de>
2020-01-30 11:22       ` [PATCH 15/24] pata_pdc2027x: Replace PDPRINTK() with dynamic debugging Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104740epcas3p498f1b4f489320a9c04f74c072643e988@epcas3p4.samsung.com>
     [not found]     ` <20181213104716.31930-28-hare@suse.de>
2020-01-30 11:25       ` [PATCH 16/24] sata_fsl: move DPRINTK to ata debugging Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104810epcas2p3bdc448513b7a8a9fb65966bed4e4c9d8@epcas2p3.samsung.com>
     [not found]     ` <20181213104716.31930-29-hare@suse.de>
2020-01-30 11:36       ` Bartlomiej Zolnierkiewicz [this message]
     [not found]   ` <CGME20181213104753epcas1p1732188e6d1b66d18bc4e3f53cc0a12ce@epcas1p1.samsung.com>
     [not found]     ` <20181213104716.31930-30-hare@suse.de>
2020-01-30 11:44       ` [PATCH 18/24] libata: add 'link' argument to ata_dev_classify() Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104817epcas1p173179f4212a03ab93af37eeab41c89d7@epcas1p1.samsung.com>
     [not found]     ` <20181213104716.31930-31-hare@suse.de>
2020-01-30 11:52       ` [PATCH 19/24] libata: Use ata_port_printk() in ata_dump_id() Bartlomiej Zolnierkiewicz
2020-01-30 11:53         ` Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104753epcas1p338a6423f03225a101ef438786f3932b0@epcas1p3.samsung.com>
     [not found]     ` <20181213104716.31930-32-hare@suse.de>
2020-01-30 11:55       ` [PATCH 20/24] pata_pdc202xx_old: move DPRINTK to ata debugging Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104745epcas2p285b2e3d67650cbeee8298e30124ab9a4@epcas2p2.samsung.com>
     [not found]     ` <20181213104716.31930-33-hare@suse.de>
2020-01-30 11:56       ` [PATCH 21/24] libata: remove DPRINTK() macro Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104752epcas4p2e4bfedf01151d022ebc8057d5725e27f@epcas4p2.samsung.com>
     [not found]     ` <20181213104716.31930-34-hare@suse.de>
2020-01-30 12:00       ` [PATCH 22/24] ata: Remove remaining references to ATA_DEBUG Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104810epcas2p164ab666a276177a13a806be75ea7e7cd@epcas2p1.samsung.com>
     [not found]     ` <20181213104716.31930-35-hare@suse.de>
2020-01-30 12:02       ` [PATCH 23/24] libata: drop BPRINTK() Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20181213104739epcas5p1e0991efea2a383501aefa5613639afaa@epcas5p1.samsung.com>
     [not found]     ` <20181213104716.31930-36-hare@suse.de>
2020-01-30 12:03       ` [PATCH 24/24] libata.h: Whitespace cleanup Bartlomiej Zolnierkiewicz

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=d9fdb2e6-e361-e070-92e5-e2ab01c8f3aa@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=linux-ide@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.