Thanks to Aaron Young of SGI, there are experimental patches for USB
keyboard support against kdb for 2.6. The USB keyboard on SGI systems
only uses the OHCI driver, so these patches do not cover the UHCI
controller. Patches for a UHCI keyboard will be gratefully accepted.
Apply the common patch below plus either the ia64 or i386 patch. They
apply over the existing kdb-v4.4-2.6.13-rc2-{common,ia64,i386}-1
patches.
-- Attached file included as plaintext by Ecartis --
-- File: kdb-v4.4-2.6.13-rc2-common-usb-1
-- Desc: kdb-v4.4-2.6.13-rc2-common-usb-1
Index: linux/drivers/usb/host/ohci-hcd.c
--- linux.orig/drivers/usb/host/ohci-hcd.c 2005-07-09 10:37:04.420169654
+1000
+++ linux/drivers/usb/host/ohci-hcd.c 2005-07-09 10:37:17.300059061 +1000
@@ -17,6 +17,7 @@
*
* History:
*
+ * 2005/06/23 CONFIG_KDB_USB support. ([EMAIL PROTECTED])
* 2004/03/24 LH7A404 support (Durgesh Pattamatta & Marc Singer)
* 2004/02/04 use generic dma_* functions instead of pci_* ([EMAIL PROTECTED])
* 2003/02/24 show registers in sysfs (Kevin Brosius)
@@ -871,6 +872,53 @@ static int ohci_restart (struct ohci_hcd
/*-------------------------------------------------------------------------*/
+#ifdef CONFIG_KDB_USB
+
+static void
+ohci_kdb_poll (void * __ohci, struct urb *urb)
+{
+ struct ohci_hcd *ohci;
+ struct ohci_regs * regs;
+
+ /*
+ * NOTE - we use the ohci_hcd from the urb rather than the
+ * __ohci parameter (which is NULL anyway). This ensures
+ * that we will process the proper controller for the urb.
+ */
+
+ if (!urb) /* can happen if no keyboard attached */
+ return;
+
+ ohci = (struct ohci_hcd *) hcd_to_ohci(urb->dev->bus->hcpriv);
+ regs = ohci->regs;
+
+ /* if the urb is not currently in progress resubmit it */
+ if (urb->status != -EINPROGRESS) {
+
+ if (usb_submit_urb (urb, SLAB_ATOMIC))
+ return;
+
+ /* make sure the HC registers are set correctly */
+ writel (OHCI_INTR_WDH, ®s->intrenable);
+ writel (OHCI_INTR_WDH, ®s->intrstatus);
+ writel (OHCI_INTR_MIE, ®s->intrenable);
+
+ // flush those pci writes
+ (void) readl (&ohci->regs->control);
+ }
+
+ if (ohci->hcca->done_head) {
+ dl_done_list_kdb (ohci, urb);
+ writel (OHCI_INTR_WDH, ®s->intrstatus);
+ // flush the pci write
+ (void) readl (&ohci->regs->control);
+ }
+}
+
+#endif /* CONFIG_KDB_USB */
+
+/*-------------------------------------------------------------------------*/
+
#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC
MODULE_AUTHOR (DRIVER_AUTHOR);
Index: linux/drivers/usb/host/ohci-pci.c
--- linux.orig/drivers/usb/host/ohci-pci.c 2005-07-09 10:37:04.420169654
+1000
+++ linux/drivers/usb/host/ohci-pci.c 2005-07-09 10:37:17.300059061 +1000
@@ -25,6 +25,10 @@
#error "This file is PCI bus glue. CONFIG_PCI must be defined."
#endif
+#ifdef CONFIG_KDB_USB
+#include <linux/kdb.h>
+#endif
+
/*-------------------------------------------------------------------------*/
static int
@@ -105,6 +109,11 @@ ohci_pci_start (struct usb_hcd *hcd)
ohci_stop (hcd);
return ret;
}
+
+#ifdef CONFIG_KDB_USB
+ kdb_usb_infos.poll_func = ohci_kdb_poll;
+ kdb_usb_infos.uhci = NULL; /* not used */
+#endif
return 0;
}
Index: linux/drivers/usb/host/ohci-q.c
--- linux.orig/drivers/usb/host/ohci-q.c 2005-07-09 10:37:04.420169654
+1000
+++ linux/drivers/usb/host/ohci-q.c 2005-07-09 10:37:17.301035624 +1000
@@ -1114,3 +1114,65 @@ dl_done_list (struct ohci_hcd *ohci, str
td = td_next;
}
}
+
+
+/*-------------------------------------------------------------------------*/
+
+#ifdef CONFIG_KDB_USB
+static void
+dl_done_list_kdb (struct ohci_hcd *ohci, struct urb *kdburb)
+{
+ struct td *td = dl_reverse_done_list (ohci);
+
+ while (td) {
+ struct td *td_next = td->next_dl_td;
+ struct urb *urb = td->urb;
+ urb_priv_t *urb_priv = urb->hcpriv;
+ struct ed *ed = td->ed;
+
+ if (urb != kdburb) {
+ td = td_next;
+ continue;
+ }
+
+ /* update URB's length and status from TD */
+ td_done (ohci, urb, td);
+ urb_priv->td_cnt++;
+
+ /* If all this urb's TDs are done, just resubmit it */
+ if (urb_priv->td_cnt == urb_priv->length) {
+ urb->actual_length = 0;
+ urb->status = -EINPROGRESS;
+ td_submit_urb (ohci, urb);
+ }
+
+ /* clean schedule: unlink EDs that are no longer busy */
+ if (list_empty (&ed->td_list)) {
+ if (ed->state == ED_OPER)
+ start_ed_unlink (ohci, ed);
+
+ /* ... reenabling halted EDs only after fault cleanup */
+ } else if ((ed->hwINFO & cpu_to_hc32 (ohci, ED_SKIP |
ED_DEQUEUE))
+ == cpu_to_hc32 (ohci, ED_SKIP)) {
+ td = list_entry (ed->td_list.next, struct td, td_list);
+ if (!(td->hwINFO & cpu_to_hc32 (ohci, TD_DONE))) {
+ ed->hwINFO &= ~cpu_to_hc32 (ohci, ED_SKIP);
+ /* ... hc may need waking-up */
+ switch (ed->type) {
+ case PIPE_CONTROL:
+ ohci_writel (ohci, OHCI_CLF,
+ &ohci->regs->cmdstatus);
+ break;
+ case PIPE_BULK:
+ ohci_writel (ohci, OHCI_BLF,
+ &ohci->regs->cmdstatus);
+ break;
+ }
+ }
+ }
+
+ td = td_next;
+ }
+}
+
+#endif /* CONFIG_KDB_USB */
Index: linux/drivers/usb/input/hid-core.c
--- linux.orig/drivers/usb/input/hid-core.c 2005-07-09 10:37:04.420169654
+1000
+++ linux/drivers/usb/input/hid-core.c 2005-07-09 10:37:17.302988750 +1000
@@ -43,6 +43,10 @@
#define DRIVER_DESC "USB HID core driver"
#define DRIVER_LICENSE "GPL"
+#ifdef CONFIG_KDB_USB
+#include <linux/kdb.h>
+#endif
+
static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",
"Gamepad", "Keyboard", "Keypad", "Multi-Axis
Controller"};
/*
@@ -1816,6 +1820,16 @@ static int hid_probe(struct usb_interfac
printk(": USB HID v%x.%02x %s [%s] on %s\n",
hid->version >> 8, hid->version & 0xff, c, hid->name, path);
+#ifdef CONFIG_KDB_USB
+ /* Initialization of the KDB structure */
+ if (!strcmp(c, "Keyboard")) {
+ kdb_usb_infos.urb = hid->urbin;
+ kdb_usb_infos.buffer = hid->inbuf;
+ kdb_usb_infos.reset_timer = NULL;
+ kdb_usb_infos.driver = HID_ACTIVE;
+ }
+#endif
+
return 0;
}
Index: linux/drivers/usb/input/usbkbd.c
--- linux.orig/drivers/usb/input/usbkbd.c 2005-07-09 10:37:04.421146217
+1000
+++ linux/drivers/usb/input/usbkbd.c 2005-07-09 10:37:17.303965313 +1000
@@ -81,6 +81,10 @@ struct usb_kbd {
dma_addr_t leds_dma;
};
+#ifdef CONFIG_KDB_USB
+#include <linux/kdb.h>
+#endif
+
static void usb_kbd_irq(struct urb *urb, struct pt_regs *regs)
{
struct usb_kbd *kbd = urb->context;
@@ -274,6 +278,14 @@ static int usb_kbd_probe(struct usb_inte
usb_fill_int_urb(kbd->irq, dev, pipe,
kbd->new, (maxp > 8 ? 8 : maxp),
usb_kbd_irq, kbd, endpoint->bInterval);
+
+#ifdef CONFIG_KDB_USB
+ /* Init the KDB structure */
+ kdb_usb_infos.urb = kbd->irq;
+ kdb_usb_infos.buffer = kbd->new;
+ kdb_usb_infos.reset_timer = NULL;
+ kdb_usb_infos.driver = USB_KBD_ACTIVE;
+#endif
kbd->irq->transfer_dma = kbd->new_dma;
kbd->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-- Attached file included as plaintext by Ecartis --
-- File: kdb-v4.4-2.6.13-rc2-ia64-usb-1
-- Desc: kdb-v4.4-2.6.13-rc2-ia64-usb-1
Index: linux/arch/ia64/Kconfig.debug
--- linux.orig/arch/ia64/Kconfig.debug 2005-07-09 10:37:04.418216528 +1000
+++ linux/arch/ia64/Kconfig.debug 2005-07-09 10:37:17.297129372 +1000
@@ -137,16 +137,13 @@ config KDB_CONTINUE_CATASTROPHIC
If you are not sure, say 0. Read Documentation/kdb/dump.txt before
setting to 2.
-# KDB_USB does not work, the usb code needs to be
-# converted from 2.4.19 to 2.5.40 APIs. Omit it until somebody
-# fixes CONFIG_KDB_USB.
-#config KDB_USB
-# bool "Support for USB Keyboard in KDB"
-# depends on KDB && USB
-# help
-# If you want to use kdb from a USB keyboard then say Y here. If you
-# say N then kdb can only be used from a PC (AT) keyboard or a serial
-# console.
+config KDB_USB
+ bool "Support for USB Keyboard in KDB (OHCI only)"
+ depends on KDB && USB_OHCI_HCD
+ help
+ If you want to use kdb from a OHCI USB keyboard then say Y here. If
you
+ say N then kdb can only be used from a PC (AT) keyboard or a serial
+ console.
config SYSVIPC_COMPAT
bool
Index: linux/arch/ia64/kdb/kdba_io.c
--- linux.orig/arch/ia64/kdb/kdba_io.c 2005-07-09 10:37:04.418216528 +1000
+++ linux/arch/ia64/kdb/kdba_io.c 2005-07-09 10:37:17.298105935 +1000
@@ -40,7 +40,9 @@
#endif
#ifdef CONFIG_KDB_USB
-struct kdb_usb_exchange kdb_usb_infos = { NULL, NULL, NULL, NULL, NULL, 0};
+struct kdb_usb_exchange kdb_usb_infos;
+
+EXPORT_SYMBOL(kdb_usb_infos);
static unsigned char kdb_usb_keycode[256] = {
0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
@@ -133,7 +135,7 @@ static int get_usb_char(void)
}
return -1;
}
-#endif
+#endif /* CONFIG_KDB_USB */
/*
* This module contains code to read characters from the keyboard or a serial
-- Attached file included as plaintext by Ecartis --
-- File: kdb-v4.4-2.6.13-rc2-i386-usb-1
-- Desc: kdb-v4.4-2.6.13-rc2-i386-usb-1
Index: linux/arch/i386/Kconfig.debug
--- linux.orig/arch/i386/Kconfig.debug 2005-07-09 10:37:16.848886955 +1000
+++ linux/arch/i386/Kconfig.debug 2005-07-09 10:37:55.406523884 +1000
@@ -139,15 +139,12 @@ config KDB_CONTINUE_CATASTROPHIC
If you are not sure, say 0. Read Documentation/kdb/dump.txt before
setting to 2.
-# KDB_USB does not work, the usb code needs to be
-# converted from 2.4.19 to 2.5.40 APIs. Omit it until somebody
-# fixes CONFIG_KDB_USB.
-#config KDB_USB
-# bool "Support for USB Keyboard in KDB"
-# depends on KDB && USB
-# help
-# If you want to use kdb from a USB keyboard then say Y here. If you
-# say N then kdb can only be used from a PC (AT) keyboard or a serial
-# console.
+config KDB_USB
+ bool "Support for USB Keyboard in KDB (OHCI only)"
+ depends on KDB && USB_OHCI_HCD
+ help
+ If you want to use kdb from a OHCI USB keyboard then say Y here. If
you
+ say N then kdb can only be used from a PC (AT) keyboard or a serial
+ console.
endmenu
Index: linux/arch/i386/kdb/kdba_io.c
--- linux.orig/arch/i386/kdb/kdba_io.c 2005-07-09 10:37:16.903574483 +1000
+++ linux/arch/i386/kdb/kdba_io.c 2005-07-09 10:39:54.119475290 +1000
@@ -30,7 +30,9 @@
#endif
#ifdef CONFIG_KDB_USB
-struct kdb_usb_exchange kdb_usb_infos = { NULL, NULL, NULL, NULL, NULL, 0};
+struct kdb_usb_exchange kdb_usb_infos;
+
+EXPORT_SYMBOL(kdb_usb_infos);
static unsigned char kdb_usb_keycode[256] = {
0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
@@ -123,7 +125,7 @@ static int get_usb_char(void)
}
return -1;
}
-#endif
+#endif /* CONFIG_KDB_USB */
/*
* This module contains code to read characters from the keyboard or a serial
---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.