Skip to content

Commit

Permalink
[POWERPC] Convert from DBG() to pr_debug() in platforms/pseries/
Browse files Browse the repository at this point in the history
In pseries/lpar.c, fix some printf specifier mismatches, and add
a newline to one printk.

In pseries/rtasd.c add "rtasd" to some messages to make it clear
where they're coming from.

In pseries/scanlog.c remove the hand-rolled runtime debugging support
in there. This file has been largely unchanged for eons, if we need to
debug it in future we can recompile.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Apr 24, 2008
1 parent cb1e2ab commit f7ebf35
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 88 deletions.
9 changes: 2 additions & 7 deletions arch/powerpc/platforms/pseries/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
#include <asm/prom.h>
#include <asm/udbg.h>

#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#else
#define DBG(fmt...)
#endif

typedef struct {
unsigned long val;
Expand Down Expand Up @@ -72,7 +67,7 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
const char *s;
int i;

DBG(" -> fw_feature_init()\n");
pr_debug(" -> fw_feature_init()\n");

for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
Expand All @@ -88,5 +83,5 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
}
}

DBG(" <- fw_feature_init()\n");
pr_debug(" <- fw_feature_init()\n");
}
39 changes: 19 additions & 20 deletions arch/powerpc/platforms/pseries/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

#include "plpar_wrappers.h"

#define DBG(fmt...)

static void tce_build_pSeries(struct iommu_table *tbl, long index,
long npages, unsigned long uaddr,
Expand Down Expand Up @@ -322,7 +321,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)

dn = pci_bus_to_OF_node(bus);

DBG("pci_dma_bus_setup_pSeries: setting up bus %s\n", dn->full_name);
pr_debug("pci_dma_bus_setup_pSeries: setting up bus %s\n", dn->full_name);

if (bus->self) {
/* This is not a root bus, any setup will be done for the
Expand All @@ -347,7 +346,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
children++;

DBG("Children: %d\n", children);
pr_debug("Children: %d\n", children);

/* Calculate amount of DMA window per slot. Each window must be
* a power of two (due to pci_alloc_consistent requirements).
Expand All @@ -361,8 +360,8 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)

while (pci->phb->dma_window_size * children > 0x80000000ul)
pci->phb->dma_window_size >>= 1;
DBG("No ISA/IDE, window size is 0x%lx\n",
pci->phb->dma_window_size);
pr_debug("No ISA/IDE, window size is 0x%lx\n",
pci->phb->dma_window_size);
pci->phb->dma_window_base_cur = 0;

return;
Expand All @@ -387,8 +386,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
while (pci->phb->dma_window_size * children > 0x70000000ul)
pci->phb->dma_window_size >>= 1;

DBG("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);

pr_debug("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);
}


Expand All @@ -401,7 +399,8 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)

dn = pci_bus_to_OF_node(bus);

DBG("pci_dma_bus_setup_pSeriesLP: setting up bus %s\n", dn->full_name);
pr_debug("pci_dma_bus_setup_pSeriesLP: setting up bus %s\n",
dn->full_name);

/* Find nearest ibm,dma-window, walking up the device tree */
for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
Expand All @@ -411,22 +410,22 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
}

if (dma_window == NULL) {
DBG(" no ibm,dma-window property !\n");
pr_debug(" no ibm,dma-window property !\n");
return;
}

ppci = PCI_DN(pdn);

DBG(" parent is %s, iommu_table: 0x%p\n",
pdn->full_name, ppci->iommu_table);
pr_debug(" parent is %s, iommu_table: 0x%p\n",
pdn->full_name, ppci->iommu_table);

if (!ppci->iommu_table) {
tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
ppci->phb->node);
iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window,
bus->number);
ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
DBG(" created table: %p\n", ppci->iommu_table);
pr_debug(" created table: %p\n", ppci->iommu_table);
}

if (pdn != dn)
Expand All @@ -439,7 +438,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
struct device_node *dn;
struct iommu_table *tbl;

DBG("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));

dn = dev->dev.archdata.of_node;

Expand All @@ -450,7 +449,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
if (!dev->bus->self) {
struct pci_controller *phb = PCI_DN(dn)->phb;

DBG(" --> first child, no bridge. Allocating iommu table.\n");
pr_debug(" --> first child, no bridge. Allocating iommu table.\n");
tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
phb->node);
iommu_table_setparms(phb, dn, tbl);
Expand Down Expand Up @@ -480,7 +479,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
const void *dma_window = NULL;
struct pci_dn *pci;

DBG("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev));
pr_debug("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev));

/* dev setup for LPAR is a little tricky, since the device tree might
* contain the dma-window properties per-device and not neccesarily
Expand All @@ -489,7 +488,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
* already allocated.
*/
dn = pci_device_to_OF_node(dev);
DBG(" node is %s\n", dn->full_name);
pr_debug(" node is %s\n", dn->full_name);

for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
pdn = pdn->parent) {
Expand All @@ -504,13 +503,13 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
pci_name(dev), dn? dn->full_name : "<null>");
return;
}
DBG(" parent is %s\n", pdn->full_name);
pr_debug(" parent is %s\n", pdn->full_name);

/* Check for parent == NULL so we don't try to setup the empty EADS
* slots on POWER4 machines.
*/
if (dma_window == NULL || pdn->parent == NULL) {
DBG(" no dma window for device, linking to parent\n");
pr_debug(" no dma window for device, linking to parent\n");
dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table;
return;
}
Expand All @@ -522,9 +521,9 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window,
pci->phb->bus->number);
pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
DBG(" created table: %p\n", pci->iommu_table);
pr_debug(" created table: %p\n", pci->iommu_table);
} else {
DBG(" found DMA window, table: %p\n", pci->iommu_table);
pr_debug(" found DMA window, table: %p\n", pci->iommu_table);
}

dev->dev.archdata.dma_data = pci->iommu_table;
Expand Down
34 changes: 15 additions & 19 deletions arch/powerpc/platforms/pseries/lpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#undef DEBUG_LOW
/* Enables debugging of low-level hash table routines - careful! */
#undef DEBUG

#include <linux/kernel.h>
#include <linux/dma-mapping.h>
Expand All @@ -42,11 +43,6 @@
#include "plpar_wrappers.h"
#include "pseries.h"

#ifdef DEBUG_LOW
#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0)
#else
#define DBG_LOW(fmt...) do { } while(0)
#endif

/* in hvCall.S */
EXPORT_SYMBOL(plpar_hcall);
Expand Down Expand Up @@ -290,15 +286,15 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
unsigned long hpte_v, hpte_r;

if (!(vflags & HPTE_V_BOLTED))
DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, "
"rflags=%lx, vflags=%lx, psize=%d)\n",
hpte_group, va, pa, rflags, vflags, psize);
pr_debug("hpte_insert(group=%lx, va=%016lx, pa=%016lx, "
"rflags=%lx, vflags=%lx, psize=%d)\n",
hpte_group, va, pa, rflags, vflags, psize);

hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID;
hpte_r = hpte_encode_r(pa, psize) | rflags;

if (!(vflags & HPTE_V_BOLTED))
DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
pr_debug(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);

/* Now fill in the actual HPTE */
/* Set CEC cookie to 0 */
Expand All @@ -315,7 +311,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot);
if (unlikely(lpar_rc == H_PTEG_FULL)) {
if (!(vflags & HPTE_V_BOLTED))
DBG_LOW(" full\n");
pr_debug(" full\n");
return -1;
}

Expand All @@ -326,11 +322,11 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
*/
if (unlikely(lpar_rc != H_SUCCESS)) {
if (!(vflags & HPTE_V_BOLTED))
DBG_LOW(" lpar err %d\n", lpar_rc);
pr_debug(" lpar err %lu\n", lpar_rc);
return -2;
}
if (!(vflags & HPTE_V_BOLTED))
DBG_LOW(" -> slot: %d\n", slot & 7);
pr_debug(" -> slot: %lu\n", slot & 7);

/* Because of iSeries, we have to pass down the secondary
* bucket bit here as well
Expand Down Expand Up @@ -422,17 +418,17 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot,

want_v = hpte_encode_avpn(va, psize, ssize);

DBG_LOW(" update: avpnv=%016lx, hash=%016lx, f=%x, psize: %d ... ",
want_v, slot, flags, psize);
pr_debug(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...",
want_v, slot, flags, psize);

lpar_rc = plpar_pte_protect(flags, slot, want_v);

if (lpar_rc == H_NOT_FOUND) {
DBG_LOW("not found !\n");
pr_debug("not found !\n");
return -1;
}

DBG_LOW("ok\n");
pr_debug("ok\n");

BUG_ON(lpar_rc != H_SUCCESS);

Expand Down Expand Up @@ -507,8 +503,8 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
unsigned long lpar_rc;
unsigned long dummy1, dummy2;

DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d",
slot, va, psize, local);
pr_debug(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n",
slot, va, psize, local);

want_v = hpte_encode_avpn(va, psize, ssize);
lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2);
Expand Down
14 changes: 5 additions & 9 deletions arch/powerpc/platforms/pseries/rtasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
#include <asm/atomic.h>
#include <asm/machdep.h>

#if 0
#define DEBUG(A...) printk(KERN_ERR A)
#else
#define DEBUG(A...)
#endif

static DEFINE_SPINLOCK(rtasd_log_lock);

Expand Down Expand Up @@ -198,7 +193,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
unsigned long s;
int len = 0;

DEBUG("logging event\n");
pr_debug("rtasd: logging event\n");
if (buf == NULL)
return;

Expand Down Expand Up @@ -409,7 +404,8 @@ static int rtasd(void *unused)
daemonize("rtasd");

printk(KERN_DEBUG "RTAS daemon started\n");
DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
pr_debug("rtasd: will sleep for %d milliseconds\n",
(30000 / rtas_event_scan_rate));

/* See if we have any error stored in NVRAM */
memset(logdata, 0, rtas_error_log_max);
Expand All @@ -428,9 +424,9 @@ static int rtasd(void *unused)
do_event_scan_all_cpus(1000);

if (surveillance_timeout != -1) {
DEBUG("enabling surveillance\n");
pr_debug("rtasd: enabling surveillance\n");
enable_surveillance(surveillance_timeout);
DEBUG("surveillance enabled\n");
pr_debug("rtasd: surveillance enabled\n");
}

/* Delay should be at least one second since some
Expand Down
23 changes: 8 additions & 15 deletions arch/powerpc/platforms/pseries/scanlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
#define SCANLOG_HWERROR -1
#define SCANLOG_CONTINUE 1

#define DEBUG(A...) do { if (scanlog_debug) printk(KERN_ERR "scanlog: " A); } while (0)

static int scanlog_debug;
static unsigned int ibm_scan_log_dump; /* RTAS token */
static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */

Expand Down Expand Up @@ -86,14 +84,14 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
memcpy(data, rtas_data_buf, RTAS_DATA_BUF_SIZE);
spin_unlock(&rtas_data_buf_lock);

DEBUG("status=%d, data[0]=%x, data[1]=%x, data[2]=%x\n",
status, data[0], data[1], data[2]);
pr_debug("scanlog: status=%d, data[0]=%x, data[1]=%x, " \
"data[2]=%x\n", status, data[0], data[1], data[2]);
switch (status) {
case SCANLOG_COMPLETE:
DEBUG("hit eof\n");
pr_debug("scanlog: hit eof\n");
return 0;
case SCANLOG_HWERROR:
DEBUG("hardware error reading scan log data\n");
pr_debug("scanlog: hardware error reading data\n");
return -EIO;
case SCANLOG_CONTINUE:
/* We may or may not have data yet */
Expand All @@ -110,7 +108,8 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
/* Assume extended busy */
wait_time = rtas_busy_delay_time(status);
if (!wait_time) {
printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status);
printk(KERN_ERR "scanlog: unknown error " \
"from rtas: %d\n", status);
return -EIO;
}
}
Expand All @@ -134,15 +133,9 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,

if (buf) {
if (strncmp(stkbuf, "reset", 5) == 0) {
DEBUG("reset scanlog\n");
pr_debug("scanlog: reset scanlog\n");
status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, 0, 0);
DEBUG("rtas returns %d\n", status);
} else if (strncmp(stkbuf, "debugon", 7) == 0) {
printk(KERN_ERR "scanlog: debug on\n");
scanlog_debug = 1;
} else if (strncmp(stkbuf, "debugoff", 8) == 0) {
printk(KERN_ERR "scanlog: debug off\n");
scanlog_debug = 0;
pr_debug("scanlog: rtas returns %d\n", status);
}
}
return count;
Expand Down
Loading

0 comments on commit f7ebf35

Please sign in to comment.