-in root hub emulation, return a sane value as language code
-constify "methods" tables and (partly) descriptor templates
This commit is contained in:
parent
f8b074ef41
commit
8fd98300b1
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ehci.c,v 1.122 2007/02/10 07:52:29 mlelstv Exp $ */
|
||||
/* $NetBSD: ehci.c,v 1.123 2007/02/26 13:26:45 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004,2005 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.122 2007/02/10 07:52:29 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.123 2007/02/26 13:26:45 drochner Exp $");
|
||||
|
||||
#include "ohci.h"
|
||||
#include "uhci.h"
|
||||
@ -242,7 +242,7 @@ Static void ehci_dump_exfer(struct ehci_xfer *);
|
||||
} while (0)
|
||||
#define ehci_active_intr_list(ex) ((ex)->inext.le_prev != NULL)
|
||||
|
||||
Static struct usbd_bus_methods ehci_bus_methods = {
|
||||
Static const struct usbd_bus_methods ehci_bus_methods = {
|
||||
ehci_open,
|
||||
ehci_softintr,
|
||||
ehci_poll,
|
||||
@ -252,7 +252,7 @@ Static struct usbd_bus_methods ehci_bus_methods = {
|
||||
ehci_freex,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ehci_root_ctrl_methods = {
|
||||
Static const struct usbd_pipe_methods ehci_root_ctrl_methods = {
|
||||
ehci_root_ctrl_transfer,
|
||||
ehci_root_ctrl_start,
|
||||
ehci_root_ctrl_abort,
|
||||
@ -261,7 +261,7 @@ Static struct usbd_pipe_methods ehci_root_ctrl_methods = {
|
||||
ehci_root_ctrl_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ehci_root_intr_methods = {
|
||||
Static const struct usbd_pipe_methods ehci_root_intr_methods = {
|
||||
ehci_root_intr_transfer,
|
||||
ehci_root_intr_start,
|
||||
ehci_root_intr_abort,
|
||||
@ -270,7 +270,7 @@ Static struct usbd_pipe_methods ehci_root_intr_methods = {
|
||||
ehci_root_intr_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ehci_device_ctrl_methods = {
|
||||
Static const struct usbd_pipe_methods ehci_device_ctrl_methods = {
|
||||
ehci_device_ctrl_transfer,
|
||||
ehci_device_ctrl_start,
|
||||
ehci_device_ctrl_abort,
|
||||
@ -279,7 +279,7 @@ Static struct usbd_pipe_methods ehci_device_ctrl_methods = {
|
||||
ehci_device_ctrl_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ehci_device_intr_methods = {
|
||||
Static const struct usbd_pipe_methods ehci_device_intr_methods = {
|
||||
ehci_device_intr_transfer,
|
||||
ehci_device_intr_start,
|
||||
ehci_device_intr_abort,
|
||||
@ -288,7 +288,7 @@ Static struct usbd_pipe_methods ehci_device_intr_methods = {
|
||||
ehci_device_intr_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ehci_device_bulk_methods = {
|
||||
Static const struct usbd_pipe_methods ehci_device_bulk_methods = {
|
||||
ehci_device_bulk_transfer,
|
||||
ehci_device_bulk_start,
|
||||
ehci_device_bulk_abort,
|
||||
@ -297,7 +297,7 @@ Static struct usbd_pipe_methods ehci_device_bulk_methods = {
|
||||
ehci_device_bulk_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ehci_device_isoc_methods = {
|
||||
Static const struct usbd_pipe_methods ehci_device_isoc_methods = {
|
||||
ehci_device_isoc_transfer,
|
||||
ehci_device_isoc_start,
|
||||
ehci_device_isoc_abort,
|
||||
@ -306,7 +306,7 @@ Static struct usbd_pipe_methods ehci_device_isoc_methods = {
|
||||
ehci_device_isoc_done,
|
||||
};
|
||||
|
||||
static uint8_t revbits[EHCI_MAX_POLLRATE] = {
|
||||
static const uint8_t revbits[EHCI_MAX_POLLRATE] = {
|
||||
0x00,0x40,0x20,0x60,0x10,0x50,0x30,0x70,0x08,0x48,0x28,0x68,0x18,0x58,0x38,0x78,
|
||||
0x04,0x44,0x24,0x64,0x14,0x54,0x34,0x74,0x0c,0x4c,0x2c,0x6c,0x1c,0x5c,0x3c,0x7c,
|
||||
0x02,0x42,0x22,0x62,0x12,0x52,0x32,0x72,0x0a,0x4a,0x2a,0x6a,0x1a,0x5a,0x3a,0x7a,
|
||||
@ -1561,7 +1561,7 @@ Static usb_device_descriptor_t ehci_devd = {
|
||||
1 /* # of configurations */
|
||||
};
|
||||
|
||||
Static usb_device_qualifier_t ehci_odevd = {
|
||||
Static const usb_device_qualifier_t ehci_odevd = {
|
||||
USB_DEVICE_DESCRIPTOR_SIZE,
|
||||
UDESC_DEVICE_QUALIFIER, /* type */
|
||||
{0x00, 0x02}, /* USB version */
|
||||
@ -1573,7 +1573,7 @@ Static usb_device_qualifier_t ehci_odevd = {
|
||||
0
|
||||
};
|
||||
|
||||
Static usb_config_descriptor_t ehci_confd = {
|
||||
Static const usb_config_descriptor_t ehci_confd = {
|
||||
USB_CONFIG_DESCRIPTOR_SIZE,
|
||||
UDESC_CONFIG,
|
||||
{USB_CONFIG_DESCRIPTOR_SIZE +
|
||||
@ -1586,7 +1586,7 @@ Static usb_config_descriptor_t ehci_confd = {
|
||||
0 /* max power */
|
||||
};
|
||||
|
||||
Static usb_interface_descriptor_t ehci_ifcd = {
|
||||
Static const usb_interface_descriptor_t ehci_ifcd = {
|
||||
USB_INTERFACE_DESCRIPTOR_SIZE,
|
||||
UDESC_INTERFACE,
|
||||
0,
|
||||
@ -1598,7 +1598,7 @@ Static usb_interface_descriptor_t ehci_ifcd = {
|
||||
0
|
||||
};
|
||||
|
||||
Static usb_endpoint_descriptor_t ehci_endpd = {
|
||||
Static const usb_endpoint_descriptor_t ehci_endpd = {
|
||||
USB_ENDPOINT_DESCRIPTOR_SIZE,
|
||||
UDESC_ENDPOINT,
|
||||
UE_DIR_IN | EHCI_INTR_ENDPT,
|
||||
@ -1607,7 +1607,7 @@ Static usb_endpoint_descriptor_t ehci_endpd = {
|
||||
12
|
||||
};
|
||||
|
||||
Static usb_hub_descriptor_t ehci_hubd = {
|
||||
Static const usb_hub_descriptor_t ehci_hubd = {
|
||||
USB_HUB_DESCRIPTOR_SIZE,
|
||||
UDESC_HUB,
|
||||
0,
|
||||
@ -1757,7 +1757,12 @@ ehci_root_ctrl_start(usbd_xfer_handle xfer)
|
||||
totlen = 1;
|
||||
switch (value & 0xff) {
|
||||
case 0: /* Language table */
|
||||
totlen = ehci_str(buf, len, "\001");
|
||||
if (len > 0)
|
||||
*(u_int8_t *)buf = 4;
|
||||
if (len >= 4) {
|
||||
USETW(((usb_string_descriptor_t *)buf)->bString[0], 0x0409);
|
||||
totlen = 4;
|
||||
}
|
||||
break;
|
||||
case 1: /* Vendor */
|
||||
totlen = ehci_str(buf, len, sc->sc_vendor);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ohci.c,v 1.181 2007/02/10 07:52:29 mlelstv Exp $ */
|
||||
/* $NetBSD: ohci.c,v 1.182 2007/02/26 13:26:46 drochner Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.181 2007/02/10 07:52:29 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.182 2007/02/26 13:26:46 drochner Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -298,7 +298,7 @@ struct ohci_pipe {
|
||||
|
||||
#define OHCI_INTR_ENDPT 1
|
||||
|
||||
Static struct usbd_bus_methods ohci_bus_methods = {
|
||||
Static const struct usbd_bus_methods ohci_bus_methods = {
|
||||
ohci_open,
|
||||
ohci_softintr,
|
||||
ohci_poll,
|
||||
@ -308,7 +308,7 @@ Static struct usbd_bus_methods ohci_bus_methods = {
|
||||
ohci_freex,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ohci_root_ctrl_methods = {
|
||||
Static const struct usbd_pipe_methods ohci_root_ctrl_methods = {
|
||||
ohci_root_ctrl_transfer,
|
||||
ohci_root_ctrl_start,
|
||||
ohci_root_ctrl_abort,
|
||||
@ -317,7 +317,7 @@ Static struct usbd_pipe_methods ohci_root_ctrl_methods = {
|
||||
ohci_root_ctrl_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ohci_root_intr_methods = {
|
||||
Static const struct usbd_pipe_methods ohci_root_intr_methods = {
|
||||
ohci_root_intr_transfer,
|
||||
ohci_root_intr_start,
|
||||
ohci_root_intr_abort,
|
||||
@ -326,7 +326,7 @@ Static struct usbd_pipe_methods ohci_root_intr_methods = {
|
||||
ohci_root_intr_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ohci_device_ctrl_methods = {
|
||||
Static const struct usbd_pipe_methods ohci_device_ctrl_methods = {
|
||||
ohci_device_ctrl_transfer,
|
||||
ohci_device_ctrl_start,
|
||||
ohci_device_ctrl_abort,
|
||||
@ -335,7 +335,7 @@ Static struct usbd_pipe_methods ohci_device_ctrl_methods = {
|
||||
ohci_device_ctrl_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ohci_device_intr_methods = {
|
||||
Static const struct usbd_pipe_methods ohci_device_intr_methods = {
|
||||
ohci_device_intr_transfer,
|
||||
ohci_device_intr_start,
|
||||
ohci_device_intr_abort,
|
||||
@ -344,7 +344,7 @@ Static struct usbd_pipe_methods ohci_device_intr_methods = {
|
||||
ohci_device_intr_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ohci_device_bulk_methods = {
|
||||
Static const struct usbd_pipe_methods ohci_device_bulk_methods = {
|
||||
ohci_device_bulk_transfer,
|
||||
ohci_device_bulk_start,
|
||||
ohci_device_bulk_abort,
|
||||
@ -353,7 +353,7 @@ Static struct usbd_pipe_methods ohci_device_bulk_methods = {
|
||||
ohci_device_bulk_done,
|
||||
};
|
||||
|
||||
Static struct usbd_pipe_methods ohci_device_isoc_methods = {
|
||||
Static const struct usbd_pipe_methods ohci_device_isoc_methods = {
|
||||
ohci_device_isoc_transfer,
|
||||
ohci_device_isoc_start,
|
||||
ohci_device_isoc_abort,
|
||||
@ -2313,7 +2313,7 @@ Static usb_device_descriptor_t ohci_devd = {
|
||||
1 /* # of configurations */
|
||||
};
|
||||
|
||||
Static usb_config_descriptor_t ohci_confd = {
|
||||
Static const usb_config_descriptor_t ohci_confd = {
|
||||
USB_CONFIG_DESCRIPTOR_SIZE,
|
||||
UDESC_CONFIG,
|
||||
{USB_CONFIG_DESCRIPTOR_SIZE +
|
||||
@ -2326,7 +2326,7 @@ Static usb_config_descriptor_t ohci_confd = {
|
||||
0 /* max power */
|
||||
};
|
||||
|
||||
Static usb_interface_descriptor_t ohci_ifcd = {
|
||||
Static const usb_interface_descriptor_t ohci_ifcd = {
|
||||
USB_INTERFACE_DESCRIPTOR_SIZE,
|
||||
UDESC_INTERFACE,
|
||||
0,
|
||||
@ -2338,7 +2338,7 @@ Static usb_interface_descriptor_t ohci_ifcd = {
|
||||
0
|
||||
};
|
||||
|
||||
Static usb_endpoint_descriptor_t ohci_endpd = {
|
||||
Static const usb_endpoint_descriptor_t ohci_endpd = {
|
||||
.bLength = USB_ENDPOINT_DESCRIPTOR_SIZE,
|
||||
.bDescriptorType = UDESC_ENDPOINT,
|
||||
.bEndpointAddress = UE_DIR_IN | OHCI_INTR_ENDPT,
|
||||
@ -2347,7 +2347,7 @@ Static usb_endpoint_descriptor_t ohci_endpd = {
|
||||
.bInterval = 255,
|
||||
};
|
||||
|
||||
Static usb_hub_descriptor_t ohci_hubd = {
|
||||
Static const usb_hub_descriptor_t ohci_hubd = {
|
||||
.bDescLength = USB_HUB_DESCRIPTOR_SIZE,
|
||||
.bDescriptorType = UDESC_HUB,
|
||||
};
|
||||
@ -2472,7 +2472,12 @@ ohci_root_ctrl_start(usbd_xfer_handle xfer)
|
||||
totlen = 1;
|
||||
switch (value & 0xff) {
|
||||
case 0: /* Language table */
|
||||
totlen = ohci_str(buf, len, "\001");
|
||||
if (len > 0)
|
||||
*(u_int8_t *)buf = 4;
|
||||
if (len >= 4) {
|
||||
USETW(((usb_string_descriptor_t *)buf)->bString[0], 0x0409);
|
||||
totlen = 4;
|
||||
}
|
||||
break;
|
||||
case 1: /* Vendor */
|
||||
totlen = ohci_str(buf, len, sc->sc_vendor);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhci.c,v 1.207 2007/02/10 07:52:29 mlelstv Exp $ */
|
||||
/* $NetBSD: uhci.c,v 1.208 2007/02/26 13:26:46 drochner Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -49,7 +49,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.207 2007/02/10 07:52:29 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.208 2007/02/26 13:26:46 drochner Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -319,7 +319,7 @@ UREAD4(uhci_softc_t *sc, bus_size_t r)
|
||||
|
||||
#define UHCI_INTR_ENDPT 1
|
||||
|
||||
struct usbd_bus_methods uhci_bus_methods = {
|
||||
const struct usbd_bus_methods uhci_bus_methods = {
|
||||
uhci_open,
|
||||
uhci_softintr,
|
||||
uhci_poll,
|
||||
@ -329,7 +329,7 @@ struct usbd_bus_methods uhci_bus_methods = {
|
||||
uhci_freex,
|
||||
};
|
||||
|
||||
struct usbd_pipe_methods uhci_root_ctrl_methods = {
|
||||
const struct usbd_pipe_methods uhci_root_ctrl_methods = {
|
||||
uhci_root_ctrl_transfer,
|
||||
uhci_root_ctrl_start,
|
||||
uhci_root_ctrl_abort,
|
||||
@ -338,7 +338,7 @@ struct usbd_pipe_methods uhci_root_ctrl_methods = {
|
||||
uhci_root_ctrl_done,
|
||||
};
|
||||
|
||||
struct usbd_pipe_methods uhci_root_intr_methods = {
|
||||
const struct usbd_pipe_methods uhci_root_intr_methods = {
|
||||
uhci_root_intr_transfer,
|
||||
uhci_root_intr_start,
|
||||
uhci_root_intr_abort,
|
||||
@ -347,7 +347,7 @@ struct usbd_pipe_methods uhci_root_intr_methods = {
|
||||
uhci_root_intr_done,
|
||||
};
|
||||
|
||||
struct usbd_pipe_methods uhci_device_ctrl_methods = {
|
||||
const struct usbd_pipe_methods uhci_device_ctrl_methods = {
|
||||
uhci_device_ctrl_transfer,
|
||||
uhci_device_ctrl_start,
|
||||
uhci_device_ctrl_abort,
|
||||
@ -356,7 +356,7 @@ struct usbd_pipe_methods uhci_device_ctrl_methods = {
|
||||
uhci_device_ctrl_done,
|
||||
};
|
||||
|
||||
struct usbd_pipe_methods uhci_device_intr_methods = {
|
||||
const struct usbd_pipe_methods uhci_device_intr_methods = {
|
||||
uhci_device_intr_transfer,
|
||||
uhci_device_intr_start,
|
||||
uhci_device_intr_abort,
|
||||
@ -365,7 +365,7 @@ struct usbd_pipe_methods uhci_device_intr_methods = {
|
||||
uhci_device_intr_done,
|
||||
};
|
||||
|
||||
struct usbd_pipe_methods uhci_device_bulk_methods = {
|
||||
const struct usbd_pipe_methods uhci_device_bulk_methods = {
|
||||
uhci_device_bulk_transfer,
|
||||
uhci_device_bulk_start,
|
||||
uhci_device_bulk_abort,
|
||||
@ -374,7 +374,7 @@ struct usbd_pipe_methods uhci_device_bulk_methods = {
|
||||
uhci_device_bulk_done,
|
||||
};
|
||||
|
||||
struct usbd_pipe_methods uhci_device_isoc_methods = {
|
||||
const struct usbd_pipe_methods uhci_device_isoc_methods = {
|
||||
uhci_device_isoc_transfer,
|
||||
uhci_device_isoc_start,
|
||||
uhci_device_isoc_abort,
|
||||
@ -3009,7 +3009,7 @@ usb_device_descriptor_t uhci_devd = {
|
||||
1 /* # of configurations */
|
||||
};
|
||||
|
||||
usb_config_descriptor_t uhci_confd = {
|
||||
const usb_config_descriptor_t uhci_confd = {
|
||||
USB_CONFIG_DESCRIPTOR_SIZE,
|
||||
UDESC_CONFIG,
|
||||
{USB_CONFIG_DESCRIPTOR_SIZE +
|
||||
@ -3022,7 +3022,7 @@ usb_config_descriptor_t uhci_confd = {
|
||||
0 /* max power */
|
||||
};
|
||||
|
||||
usb_interface_descriptor_t uhci_ifcd = {
|
||||
const usb_interface_descriptor_t uhci_ifcd = {
|
||||
USB_INTERFACE_DESCRIPTOR_SIZE,
|
||||
UDESC_INTERFACE,
|
||||
0,
|
||||
@ -3034,7 +3034,7 @@ usb_interface_descriptor_t uhci_ifcd = {
|
||||
0
|
||||
};
|
||||
|
||||
usb_endpoint_descriptor_t uhci_endpd = {
|
||||
const usb_endpoint_descriptor_t uhci_endpd = {
|
||||
USB_ENDPOINT_DESCRIPTOR_SIZE,
|
||||
UDESC_ENDPOINT,
|
||||
UE_DIR_IN | UHCI_INTR_ENDPT,
|
||||
@ -3043,7 +3043,7 @@ usb_endpoint_descriptor_t uhci_endpd = {
|
||||
255
|
||||
};
|
||||
|
||||
usb_hub_descriptor_t uhci_hubd_piix = {
|
||||
const usb_hub_descriptor_t uhci_hubd_piix = {
|
||||
USB_HUB_DESCRIPTOR_SIZE,
|
||||
UDESC_HUB,
|
||||
2,
|
||||
@ -3269,7 +3269,12 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer)
|
||||
totlen = 1;
|
||||
switch (value & 0xff) {
|
||||
case 0: /* Language table */
|
||||
totlen = uhci_str(buf, len, "\001");
|
||||
if (len > 0)
|
||||
*(u_int8_t *)buf = 4;
|
||||
if (len >= 4) {
|
||||
USETW(((usb_string_descriptor_t *)buf)->bString[0], 0x0409);
|
||||
totlen = 4;
|
||||
}
|
||||
break;
|
||||
case 1: /* Vendor */
|
||||
totlen = uhci_str(buf, len, sc->sc_vendor);
|
||||
|
Loading…
Reference in New Issue
Block a user