diff --git a/sys/dev/usb/ehci_pci.c b/sys/dev/usb/ehci_pci.c index 439a3f5c9878..9918efcef4f8 100644 --- a/sys/dev/usb/ehci_pci.c +++ b/sys/dev/usb/ehci_pci.c @@ -79,24 +79,66 @@ __FBSDID("$FreeBSD$"); #define PCI_EHCI_VENDORID_ACERLABS 0x10b9 #define PCI_EHCI_VENDORID_AMD 0x1022 #define PCI_EHCI_VENDORID_APPLE 0x106b +#define PCI_EHCI_VENDORID_ATI 0x1002 #define PCI_EHCI_VENDORID_CMDTECH 0x1095 #define PCI_EHCI_VENDORID_INTEL 0x8086 #define PCI_EHCI_VENDORID_NEC 0x1033 #define PCI_EHCI_VENDORID_OPTI 0x1045 +#define PCI_EHCI_VENDORID_PHILIPS 0x1131 #define PCI_EHCI_VENDORID_SIS 0x1039 #define PCI_EHCI_VENDORID_NVIDIA 0x12D2 #define PCI_EHCI_VENDORID_NVIDIA2 0x10DE #define PCI_EHCI_VENDORID_VIA 0x1106 +/* AcerLabs/ALi */ +#define PCI_EHCI_DEVICEID_M5239 0x523910b9 +static const char *ehci_device_m5239 = "ALi M5239 USB 2.0 controller"; + +/* AMD */ +#define PCI_EHCI_DEVICEID_8111 0x10227463 +static const char *ehci_device_8111 = "AMD 8111 USB 2.0 controller"; + +/* ATI */ +#define PCI_EHCI_DEVICEID_SB200 0x43451002 +static const char *ehci_device_sb200 = "ATI SB200 USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_SB400 0x43731002 +static const char *ehci_device_sb400 = "ATI SB400 USB 2.0 controller"; + +/* Intel */ +#define PCI_EHCI_DEVICEID_6300 0x25ad8086 +static const char *ehci_device_6300 = "Intel 6300ESB USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_ICH4 0x24cd8086 +static const char *ehci_device_ich4 = "Intel 82801DB/L/M (ICH4) USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_ICH5 0x24dd8086 +static const char *ehci_device_ich5 = "Intel 82801EB/R (ICH5) USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_ICH6 0x265c8086 +static const char *ehci_device_ich6 = "Intel 82801FB (ICH6) USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_ICH7 0x27cc8086 +static const char *ehci_device_ich7 = "Intel 82801GB/R (ICH7) USB 2.0 controller"; + +/* NEC */ #define PCI_EHCI_DEVICEID_NEC 0x00e01033 static const char *ehci_device_nec = "NEC uPD 720100 USB 2.0 controller"; +/* NVIDIA */ +#define PCI_EHCI_DEVICEID_NF2 0x006810de +static const char *ehci_device_nf2 = "NVIDIA nForce2 USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_NF2_400 0x008810de +static const char *ehci_device_nf2_400 = "NVIDIA nForce2 Ultra 400 USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_NF3 0x00d810de +static const char *ehci_device_nf3 = "NVIDIA nForce3 USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_NF3_250 0x00e810de +static const char *ehci_device_nf3_250 = "NVIDIA nForce3 250 USB 2.0 controller"; +#define PCI_EHCI_DEVICEID_NF4 0x005b10de +static const char *ehci_device_nf4 = "NVIDIA nForce4 USB 2.0 controller"; + +/* Philips */ +#define PCI_EHCI_DEVICEID_ISP156X 0x15621131 +static const char *ehci_device_isp156x = "Philips ISP156x USB 2.0 controller"; + #define PCI_EHCI_DEVICEID_VIA 0x31041106 static const char *ehci_device_via = "VIA VT6202 USB 2.0 controller"; -#define PCI_EHCI_DEVICEID_ICH4 0x24cd8086 -static const char *ehci_device_ich4 = "Intel 82801DB/DBL/DBM (ICH4) USB 2.0 controller"; - static const char *ehci_device_generic = "EHCI (generic) USB 2.0 controller"; #define PCI_EHCI_BASE_REG 0x10 @@ -164,12 +206,40 @@ ehci_pci_match(device_t self) u_int32_t device_id = pci_get_devid(self); switch (device_id) { - case PCI_EHCI_DEVICEID_NEC: - return (ehci_device_nec); - case PCI_EHCI_DEVICEID_VIA: - return (ehci_device_via); + case PCI_EHCI_DEVICEID_M5239: + return (ehci_device_m5239); + case PCI_EHCI_DEVICEID_8111: + return (ehci_device_8111); + case PCI_EHCI_DEVICEID_SB200: + return (ehci_device_sb200); + case PCI_EHCI_DEVICEID_SB400: + return (ehci_device_sb400); + case PCI_EHCI_DEVICEID_6300: + return (ehci_device_6300); case PCI_EHCI_DEVICEID_ICH4: return (ehci_device_ich4); + case PCI_EHCI_DEVICEID_ICH5: + return (ehci_device_ich5); + case PCI_EHCI_DEVICEID_ICH6: + return (ehci_device_ich6); + case PCI_EHCI_DEVICEID_ICH7: + return (ehci_device_ich7); + case PCI_EHCI_DEVICEID_NEC: + return (ehci_device_nec); + case PCI_EHCI_DEVICEID_NF2: + return (ehci_device_nf2); + case PCI_EHCI_DEVICEID_NF2_400: + return (ehci_device_nf2_400); + case PCI_EHCI_DEVICEID_NF3: + return (ehci_device_nf3); + case PCI_EHCI_DEVICEID_NF3_250: + return (ehci_device_nf3_250); + case PCI_EHCI_DEVICEID_NF4: + return (ehci_device_nf4); + case PCI_EHCI_DEVICEID_ISP156X: + return (ehci_device_isp156x); + case PCI_EHCI_DEVICEID_VIA: + return (ehci_device_via); default: if (pci_get_class(self) == PCIC_SERIALBUS && pci_get_subclass(self) == PCIS_SERIALBUS_USB diff --git a/sys/dev/usb/ehcireg.h b/sys/dev/usb/ehcireg.h index 304b4ae2d92a..e9182736edde 100644 --- a/sys/dev/usb/ehcireg.h +++ b/sys/dev/usb/ehcireg.h @@ -1,4 +1,4 @@ -/* $NetBSD: ehcireg.h,v 1.17 2004/06/23 06:45:56 mycroft Exp $ */ +/* $NetBSD: ehcireg.h,v 1.18 2004/10/22 10:38:17 augustss Exp $ */ /* $FreeBSD$ */ /*- diff --git a/sys/dev/usb/ehcivar.h b/sys/dev/usb/ehcivar.h index fe791ec36d43..e6f2a0a57a84 100644 --- a/sys/dev/usb/ehcivar.h +++ b/sys/dev/usb/ehcivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ehcivar.h,v 1.12 2001/12/31 12:16:57 augustss Exp $ */ +/* $NetBSD: ehcivar.h,v 1.19 2005/04/29 15:04:29 augustss Exp $ */ /* $FreeBSD$ */ /*- @@ -85,6 +85,7 @@ struct ehci_soft_islot { #define EHCI_FRAMELIST_MAXCOUNT 1024 #define EHCI_IPOLLRATES 8 /* Poll rates (1ms, 2, 4, 8 ... 128) */ #define EHCI_INTRQHS ((1 << EHCI_IPOLLRATES) - 1) +#define EHCI_MAX_POLLRATE (1 << (EHCI_IPOLLRATES - 1)) #define EHCI_IQHIDX(lev, pos) \ ((((pos) & ((1 << (lev)) - 1)) | (1 << (lev))) - 1) #define EHCI_ILEV_IVAL(lev) (1 << (lev)) @@ -108,7 +109,7 @@ typedef struct ehci_softc { #endif u_int sc_offs; /* offset to operational regs */ - char sc_vendor[16]; /* vendor string for root hub */ + char sc_vendor[32]; /* vendor string for root hub */ int sc_id_vendor; /* vendor ID for root hub */ u_int32_t sc_cmd; /* shadow of cmd reg during suspend */ @@ -124,6 +125,7 @@ typedef struct ehci_softc { usb_dma_t sc_fldma; ehci_link_t *sc_flist; u_int sc_flsize; + u_int sc_rand; /* XXX need proper intr scheduling */ struct ehci_soft_islot sc_islots[EHCI_INTRQHS]; @@ -154,6 +156,9 @@ typedef struct ehci_softc { device_ptr_t sc_child; /* /dev/usb# device */ #endif char sc_dying; +#if defined(__NetBSD__) + struct usb_dma_reserve sc_dma_reserve; +#endif } ehci_softc_t; #define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a)) diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index dc2c64888f0c..4d9a6a5496d7 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,5 +1,5 @@ /* $OpenBSD: usb_port.h,v 1.18 2000/09/06 22:42:10 rahnds Exp $ */ -/* $NetBSD: usb_port.h,v 1.54 2002/03/28 21:49:19 ichiro Exp $ */ +/* $NetBSD: usb_port.h,v 1.68 2005/07/30 06:14:50 skrll Exp $ */ /* $FreeBSD$ */ /* Also already merged from NetBSD: @@ -58,6 +58,15 @@ #include "opt_usbverbose.h" +#if defined(_KERNEL) +#include + +MALLOC_DECLARE(M_USB); +MALLOC_DECLARE(M_USBDEV); +MALLOC_DECLARE(M_USBHC); + +#endif + #define USB_USE_SOFTINTR #ifdef USB_DEBUG @@ -93,7 +102,7 @@ typedef struct callout usb_callout_t; #define usb_kthread_create1 kthread_create1 #define usb_kthread_create kthread_create -typedef int usb_malloc_type; +typedef struct malloc_type *usb_malloc_type; #define Ether_ifattach ether_ifattach #define IF_INPUT(ifp, m) (*(ifp)->if_input)((ifp), (m)) @@ -155,7 +164,8 @@ int __CONCAT(dname,_detach)(struct device *self, int flags) sc = __CONCAT(dname,_cd).cd_devs[unit] #define USB_DO_ATTACH(dev, bdev, parent, args, print, sub) \ - (config_found_sm(parent, args, print, sub)) + (config_found_sm_loc(parent, (args)->port == 0 ? "usb" : "uhub", \ + NULL, args, print, sub)) #elif defined(__OpenBSD__) /* @@ -202,6 +212,8 @@ typedef struct proc *usb_proc_ptr; #define usb_kthread_create1 kthread_create #define usb_kthread_create kthread_create_deferred +#define usb_lockmgr(lk, mode, ptr) lockmgr(lk, mode, ptr, curproc) + #define config_pending_incr() #define config_pending_decr() @@ -220,7 +232,6 @@ typedef int usb_malloc_type; #define usbpoll usbselect #define uhidpoll uhidselect #define ugenpoll ugenselect -#define uriopoll urioselect #define uscannerpoll uscannerselect #define powerhook_establish(fn, sc) (fn) @@ -407,6 +418,8 @@ typedef struct callout usb_callout_t; #define usb_callout(h, t, f, d) callout_reset(&(h), (t), (f), (d)) #define usb_uncallout(h, f, d) callout_stop(&(h)) +#define usb_lockmgr lockmgr + #define BUS_DMA_COHERENT 0 #define ETHER_ALIGN 2 #define BPF_MTAP(ifp, m) if ((ifp)->if_bpf) bpf_mtap((ifp), (m));