X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fohci-dbg.c;h=62f53a2138082a9f82bfdb31b1667ee7c277c523;hb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;hp=3918eb3f2bbfc7bfb0f34012fa3cb60913ad6755;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index 3918eb3f2..62f53a213 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c @@ -131,16 +131,16 @@ static char *hcfs2string (int state) static void ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) { - struct ohci_regs *regs = controller->regs; + struct ohci_regs __iomem *regs = controller->regs; u32 temp; - temp = readl (®s->revision) & 0xff; + temp = ohci_readl (controller, ®s->revision) & 0xff; ohci_dbg_sw (controller, next, size, "OHCI %d.%d, %s legacy support registers\n", 0x03 & (temp >> 4), (temp & 0x0f), - (temp & 0x10) ? "with" : "NO"); + (temp & 0x0100) ? "with" : "NO"); - temp = readl (®s->control); + temp = ohci_readl (controller, ®s->control); ohci_dbg_sw (controller, next, size, "control 0x%03x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", temp, @@ -155,7 +155,7 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) temp & OHCI_CTRL_CBSR ); - temp = readl (®s->cmdstatus); + temp = ohci_readl (controller, ®s->cmdstatus); ohci_dbg_sw (controller, next, size, "cmdstatus 0x%05x SOC=%d%s%s%s%s\n", temp, (temp & OHCI_SOC) >> 16, @@ -166,26 +166,37 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) ); ohci_dump_intr_mask (controller, "intrstatus", - readl (®s->intrstatus), next, size); + ohci_readl (controller, ®s->intrstatus), + next, size); ohci_dump_intr_mask (controller, "intrenable", - readl (®s->intrenable), next, size); + ohci_readl (controller, ®s->intrenable), + next, size); // intrdisable always same as intrenable maybe_print_eds (controller, "ed_periodcurrent", - readl (®s->ed_periodcurrent), next, size); + ohci_readl (controller, ®s->ed_periodcurrent), + next, size); maybe_print_eds (controller, "ed_controlhead", - readl (®s->ed_controlhead), next, size); + ohci_readl (controller, ®s->ed_controlhead), + next, size); maybe_print_eds (controller, "ed_controlcurrent", - readl (®s->ed_controlcurrent), next, size); + ohci_readl (controller, ®s->ed_controlcurrent), + next, size); maybe_print_eds (controller, "ed_bulkhead", - readl (®s->ed_bulkhead), next, size); + ohci_readl (controller, ®s->ed_bulkhead), + next, size); maybe_print_eds (controller, "ed_bulkcurrent", - readl (®s->ed_bulkcurrent), next, size); + ohci_readl (controller, ®s->ed_bulkcurrent), + next, size); maybe_print_eds (controller, "donehead", - readl (®s->donehead), next, size); + ohci_readl (controller, ®s->donehead), next, size); + + /* broken fminterval means traffic won't flow! */ + ohci_dbg (controller, "fminterval %08x\n", + ohci_readl (controller, ®s->fminterval)); } #define dbg_port_sw(hc,num,value,next,size) \ @@ -266,11 +277,11 @@ static void ohci_dump (struct ohci_hcd *controller, int verbose) ohci_dbg (controller, "OHCI controller state\n"); // dumps some of the state we know about - ohci_dump_status (controller, NULL, 0); + ohci_dump_status (controller, NULL, NULL); if (controller->hcca) ohci_dbg (controller, - "hcca frame #%04x\n", OHCI_FRAME_NO(controller->hcca)); - ohci_dump_roothub (controller, 1, NULL, 0); + "hcca frame #%04x\n", ohci_frame_no(controller)); + ohci_dump_roothub (controller, 1, NULL, NULL); } static const char data0 [] = "DATA0"; @@ -279,13 +290,13 @@ static const char data1 [] = "DATA1"; static void ohci_dump_td (const struct ohci_hcd *ohci, const char *label, const struct td *td) { - u32 tmp = le32_to_cpup (&td->hwINFO); + u32 tmp = hc32_to_cpup (ohci, &td->hwINFO); ohci_dbg (ohci, "%s td %p%s; urb %p index %d; hw next td %08x\n", label, td, (tmp & TD_DONE) ? " (DONE)" : "", td->urb, td->index, - le32_to_cpup (&td->hwNextTD)); + hc32_to_cpup (ohci, &td->hwNextTD)); if ((tmp & TD_ISO) == 0) { const char *toggle, *pid; u32 cbp, be; @@ -306,8 +317,8 @@ static void ohci_dump_td (const struct ohci_hcd *ohci, const char *label, TD_CC_GET(tmp), /* EC, */ toggle, (tmp & TD_DI) >> 21, pid, (tmp & TD_R) ? "R" : ""); - cbp = le32_to_cpup (&td->hwCBP); - be = le32_to_cpup (&td->hwBE); + cbp = hc32_to_cpup (ohci, &td->hwCBP); + be = hc32_to_cpup (ohci, &td->hwBE); ohci_dbg (ohci, " cbp %08x be %08x (len %d)\n", cbp, be, cbp ? (be + 1 - cbp) : 0); } else { @@ -318,10 +329,10 @@ static void ohci_dump_td (const struct ohci_hcd *ohci, const char *label, (tmp & TD_DI) >> 21, tmp & 0x0000ffff); ohci_dbg (ohci, " bp0 %08x be %08x\n", - le32_to_cpup (&td->hwCBP) & ~0x0fff, - le32_to_cpup (&td->hwBE)); + hc32_to_cpup (ohci, &td->hwCBP) & ~0x0fff, + hc32_to_cpup (ohci, &td->hwBE)); for (i = 0; i < MAXPSW; i++) { - u16 psw = le16_to_cpup (&td->hwPSW [i]); + u16 psw = ohci_hwPSW (ohci, td, i); int cc = (psw >> 12) & 0x0f; ohci_dbg (ohci, " psw [%d] = %2x, CC=%x %s=%d\n", i, psw, cc, @@ -336,33 +347,34 @@ static void __attribute__((unused)) ohci_dump_ed (const struct ohci_hcd *ohci, const char *label, const struct ed *ed, int verbose) { - u32 tmp = ed->hwINFO; + u32 tmp = hc32_to_cpu (ohci, ed->hwINFO); char *type = ""; ohci_dbg (ohci, "%s, ed %p state 0x%x type %s; next ed %08x\n", label, ed, ed->state, edstring (ed->type), - le32_to_cpup (&ed->hwNextED)); + hc32_to_cpup (ohci, &ed->hwNextED)); switch (tmp & (ED_IN|ED_OUT)) { case ED_OUT: type = "-OUT"; break; case ED_IN: type = "-IN"; break; /* else from TDs ... control */ } ohci_dbg (ohci, - " info %08x MAX=%d%s%s%s%s EP=%d%s DEV=%d\n", le32_to_cpu (tmp), - 0x03ff & (le32_to_cpu (tmp) >> 16), + " info %08x MAX=%d%s%s%s%s EP=%d%s DEV=%d\n", tmp, + 0x03ff & (tmp >> 16), (tmp & ED_DEQUEUE) ? " DQ" : "", (tmp & ED_ISO) ? " ISO" : "", (tmp & ED_SKIP) ? " SKIP" : "", (tmp & ED_LOWSPEED) ? " LOW" : "", - 0x000f & (le32_to_cpu (tmp) >> 7), + 0x000f & (tmp >> 7), type, - 0x007f & le32_to_cpu (tmp)); + 0x007f & tmp); + tmp = hc32_to_cpup (ohci, &ed->hwHeadP); ohci_dbg (ohci, " tds: head %08x %s%s tail %08x%s\n", - tmp = le32_to_cpup (&ed->hwHeadP), - (ed->hwHeadP & ED_C) ? data1 : data0, - (ed->hwHeadP & ED_H) ? " HALT" : "", - le32_to_cpup (&ed->hwTailP), + tmp, + (tmp & ED_C) ? data1 : data0, + (tmp & ED_H) ? " HALT" : "", + hc32_to_cpup (ohci, &ed->hwTailP), verbose ? "" : " (not listing)"); if (verbose) { struct list_head *tmp; @@ -394,13 +406,6 @@ static inline void remove_debug_files (struct ohci_hcd *bus) { } #else -static inline struct ohci_hcd *dev_to_ohci (struct device *dev) -{ - struct usb_hcd *hcd = dev_get_drvdata (dev); - - return hcd_to_ohci (hcd); -} - static ssize_t show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) { @@ -415,23 +420,23 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) /* dump a snapshot of the bulk or control schedule */ while (ed) { - u32 info = ed->hwINFO; - u32 scratch = cpu_to_le32p (&ed->hwINFO); - struct list_head *entry; - struct td *td; + u32 info = hc32_to_cpu (ohci, ed->hwINFO); + u32 headp = hc32_to_cpu (ohci, ed->hwHeadP); + struct list_head *entry; + struct td *td; temp = scnprintf (buf, size, "ed/%p %cs dev%d ep%d%s max %d %08x%s%s %s", ed, (info & ED_LOWSPEED) ? 'l' : 'f', - scratch & 0x7f, - (scratch >> 7) & 0xf, + info & 0x7f, + (info >> 7) & 0xf, (info & ED_IN) ? "in" : "out", - 0x03ff & (scratch >> 16), - scratch, + 0x03ff & (info >> 16), + info, (info & ED_SKIP) ? " s" : "", - (ed->hwHeadP & ED_H) ? " H" : "", - (ed->hwHeadP & ED_C) ? data1 : data0); + (headp & ED_H) ? " H" : "", + (headp & ED_C) ? data1 : data0); size -= temp; buf += temp; @@ -439,21 +444,21 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) u32 cbp, be; td = list_entry (entry, struct td, td_list); - scratch = cpu_to_le32p (&td->hwINFO); - cbp = le32_to_cpup (&td->hwCBP); - be = le32_to_cpup (&td->hwBE); + info = hc32_to_cpup (ohci, &td->hwINFO); + cbp = hc32_to_cpup (ohci, &td->hwCBP); + be = hc32_to_cpup (ohci, &td->hwBE); temp = scnprintf (buf, size, "\n\ttd %p %s %d cc=%x urb %p (%08x)", td, ({ char *pid; - switch (scratch & TD_DP) { + switch (info & TD_DP) { case TD_DP_SETUP: pid = "setup"; break; case TD_DP_IN: pid = "in"; break; case TD_DP_OUT: pid = "out"; break; default: pid = "(?)"; break; } pid;}), cbp ? (be + 1 - cbp) : 0, - TD_CC_GET (scratch), td->urb, scratch); + TD_CC_GET (info), td->urb, info); size -= temp; buf += temp; } @@ -541,8 +546,7 @@ show_periodic (struct class_device *class_dev, char *buf) /* show more info the first time around */ if (temp == seen_count) { - u32 info = ed->hwINFO; - u32 scratch = cpu_to_le32p (&ed->hwINFO); + u32 info = hc32_to_cpu (ohci, ed->hwINFO); struct list_head *entry; unsigned qlen = 0; @@ -554,15 +558,17 @@ show_periodic (struct class_device *class_dev, char *buf) " (%cs dev%d ep%d%s-%s qlen %u" " max %d %08x%s%s)", (info & ED_LOWSPEED) ? 'l' : 'f', - scratch & 0x7f, - (scratch >> 7) & 0xf, + info & 0x7f, + (info >> 7) & 0xf, (info & ED_IN) ? "in" : "out", (info & ED_ISO) ? "iso" : "int", qlen, - 0x03ff & (scratch >> 16), - scratch, + 0x03ff & (info >> 16), + info, (info & ED_SKIP) ? " K" : "", - (ed->hwHeadP & ED_H) ? " H" : ""); + (ed->hwHeadP & + cpu_to_hc32(ohci, ED_H)) ? + " H" : ""); size -= temp; next += temp; @@ -574,7 +580,7 @@ show_periodic (struct class_device *class_dev, char *buf) } else { /* we've seen it and what's after */ temp = 0; - ed = 0; + ed = NULL; } } while (ed); @@ -599,7 +605,7 @@ show_registers (struct class_device *class_dev, char *buf) struct usb_bus *bus; struct usb_hcd *hcd; struct ohci_hcd *ohci; - struct ohci_regs *regs; + struct ohci_regs __iomem *regs; unsigned long flags; unsigned temp, size; char *next; @@ -618,9 +624,11 @@ show_registers (struct class_device *class_dev, char *buf) ohci_dbg_sw (ohci, &next, &size, "bus %s, device %s\n" + "%s\n" "%s version " DRIVER_VERSION "\n", hcd->self.controller->bus->name, hcd->self.controller->bus_id, + hcd->product_desc, hcd_name); if (bus->controller->power.power_state) { @@ -634,31 +642,31 @@ show_registers (struct class_device *class_dev, char *buf) /* hcca */ if (ohci->hcca) ohci_dbg_sw (ohci, &next, &size, - "hcca frame 0x%04x\n", OHCI_FRAME_NO(ohci->hcca)); + "hcca frame 0x%04x\n", ohci_frame_no(ohci)); /* other registers mostly affect frame timings */ - rdata = readl (®s->fminterval); + rdata = ohci_readl (ohci, ®s->fminterval); temp = scnprintf (next, size, "fmintvl 0x%08x %sFSMPS=0x%04x FI=0x%04x\n", - rdata, (rdata >> 31) ? " FIT" : "", + rdata, (rdata >> 31) ? "FIT " : "", (rdata >> 16) & 0xefff, rdata & 0xffff); size -= temp; next += temp; - rdata = readl (®s->fmremaining); + rdata = ohci_readl (ohci, ®s->fmremaining); temp = scnprintf (next, size, "fmremaining 0x%08x %sFR=0x%04x\n", - rdata, (rdata >> 31) ? " FRT" : "", + rdata, (rdata >> 31) ? "FRT " : "", rdata & 0x3fff); size -= temp; next += temp; - rdata = readl (®s->periodicstart); + rdata = ohci_readl (ohci, ®s->periodicstart); temp = scnprintf (next, size, "periodicstart 0x%04x\n", rdata & 0x3fff); size -= temp; next += temp; - rdata = readl (®s->lsthresh); + rdata = ohci_readl (ohci, ®s->lsthresh); temp = scnprintf (next, size, "lsthresh 0x%04x\n", rdata & 0x3fff); size -= temp; @@ -674,19 +682,23 @@ done: static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); -static inline void create_debug_files (struct ohci_hcd *bus) +static inline void create_debug_files (struct ohci_hcd *ohci) { - class_device_create_file(&bus->hcd.self.class_dev, &class_device_attr_async); - class_device_create_file(&bus->hcd.self.class_dev, &class_device_attr_periodic); - class_device_create_file(&bus->hcd.self.class_dev, &class_device_attr_registers); - ohci_dbg (bus, "created debug files\n"); + struct class_device *cldev = &ohci_to_hcd(ohci)->self.class_dev; + + class_device_create_file(cldev, &class_device_attr_async); + class_device_create_file(cldev, &class_device_attr_periodic); + class_device_create_file(cldev, &class_device_attr_registers); + ohci_dbg (ohci, "created debug files\n"); } -static inline void remove_debug_files (struct ohci_hcd *bus) +static inline void remove_debug_files (struct ohci_hcd *ohci) { - class_device_remove_file(&bus->hcd.self.class_dev, &class_device_attr_async); - class_device_remove_file(&bus->hcd.self.class_dev, &class_device_attr_periodic); - class_device_remove_file(&bus->hcd.self.class_dev, &class_device_attr_registers); + struct class_device *cldev = &ohci_to_hcd(ohci)->self.class_dev; + + class_device_remove_file(cldev, &class_device_attr_async); + class_device_remove_file(cldev, &class_device_attr_periodic); + class_device_remove_file(cldev, &class_device_attr_registers); } #endif