1/* $FreeBSD: head/sys/dev/usb/controller/usb_controller.c 213435 2010-10-04 23:18:05Z hselasky $ */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
--- 46 unchanged lines hidden (view full) ---
56#include <dev/usb/usb_process.h>
57#include <dev/usb/usb_busdma.h>
58#include <dev/usb/usb_dynamic.h>
59#include <dev/usb/usb_device.h>
60#include <dev/usb/usb_hub.h>
61
62#include <dev/usb/usb_controller.h>
63#include <dev/usb/usb_bus.h>
64
65/* function prototypes */
66
67static device_probe_t usb_probe;
68static device_attach_t usb_attach;
69static device_detach_t usb_detach;
70
71static void usb_attach_sub(device_t, struct usb_bus *);
--- 470 unchanged lines hidden (view full) ---
542 mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent),
543 NULL, MTX_DEF | MTX_RECURSE);
544
545 usb_callout_init_mtx(&bus->power_wdog,
546 &bus->bus_mtx, 0);
547
548 TAILQ_INIT(&bus->intr_q.head);
549
550#if USB_HAVE_BUSDMA
551 usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags,
552 dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX);
553#endif
554 if ((bus->devices_max > USB_MAX_DEVICES) ||
555 (bus->devices_max < USB_MIN_DEVICES) ||
556 (bus->devices == NULL)) {
557 DPRINTFN(0, "Devices field has not been "
--- 31 unchanged lines hidden (view full) ---
589{
590#if USB_HAVE_BUSDMA
591 if (cb) {
592 cb(bus, &usb_bus_mem_free_all_cb);
593 }
594 usb_dma_tag_unsetup(bus->dma_parent_tag);
595#endif
596
597 mtx_destroy(&bus->bus_mtx);
598}
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
--- 46 unchanged lines hidden (view full) ---
56#include <dev/usb/usb_process.h>
57#include <dev/usb/usb_busdma.h>
58#include <dev/usb/usb_dynamic.h>
59#include <dev/usb/usb_device.h>
60#include <dev/usb/usb_hub.h>
61
62#include <dev/usb/usb_controller.h>
63#include <dev/usb/usb_bus.h>
64
65/* function prototypes */
66
67static device_probe_t usb_probe;
68static device_attach_t usb_attach;
69static device_detach_t usb_detach;
70
71static void usb_attach_sub(device_t, struct usb_bus *);
--- 470 unchanged lines hidden (view full) ---
542 mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent),
543 NULL, MTX_DEF | MTX_RECURSE);
544
545 usb_callout_init_mtx(&bus->power_wdog,
546 &bus->bus_mtx, 0);
547
548 TAILQ_INIT(&bus->intr_q.head);
549
550#if USB_HAVE_BUSDMA
551 usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags,
552 dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX);
553#endif
554 if ((bus->devices_max > USB_MAX_DEVICES) ||
555 (bus->devices_max < USB_MIN_DEVICES) ||
556 (bus->devices == NULL)) {
557 DPRINTFN(0, "Devices field has not been "
--- 31 unchanged lines hidden (view full) ---
589{
590#if USB_HAVE_BUSDMA
591 if (cb) {
592 cb(bus, &usb_bus_mem_free_all_cb);
593 }
594 usb_dma_tag_unsetup(bus->dma_parent_tag);
595#endif
596
597 mtx_destroy(&bus->bus_mtx);
598}