3 * Copyright (c) 2011 Hans Petter Selasky. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #ifndef _BSD_KERNEL_H_
28 #define _BSD_KERNEL_H_
31 #undef __FreeBSD_version
32 #define __FreeBSD_version 1100000
34 #include <sys/cdefs.h>
35 #include <sys/queue.h>
36 #include <sys/errno.h>
38 #define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z'))
39 #define isdigit(x) ((x) >= '0' && (x) <= '9')
40 #define panic(...) do { printf("USB PANIC: " __VA_ARGS__); while (1) ; } while (0)
44 #define USB_PROC_MAX 3
45 #define USB_BUS_GIANT_PROC(bus) (usb_process + 2)
46 #define USB_BUS_NON_GIANT_BULK_PROC(bus) (usb_process + 2)
47 #define USB_BUS_NON_GIANT_ISOC_PROC(bus) (usb_process + 2)
48 #define USB_BUS_EXPLORE_PROC(bus) (usb_process + 0)
49 #define USB_BUS_CONTROL_XFER_PROC(bus) (usb_process + 1)
50 #define SYSCTL_DECL(...)
54 #define SYSCTL_HANDLER_ARGS void *oidp, void *arg1, \
55 uint32_t arg2, struct sysctl_req *req
56 #define SYSCTL_NODE(name,...) struct { } name __used
57 #define SYSCTL_INT(...)
58 #define SYSCTL_UINT(...)
59 #define SYSCTL_PROC(...)
60 #define TUNABLE_INT(...)
61 #define MALLOC_DECLARE(...)
62 #define MALLOC_DEFINE(...)
63 #define EVENTHANDLER_DECLARE(...)
64 #define EVENTHANDLER_INVOKE(...)
66 #define SCHEDULER_STOPPED(x) (0)
67 #define PI_SWI(...) (0)
68 #define UNIQ_NAME(x) x
69 #define UNIQ_NAME_STR(x) #x
70 #define DEVCLASS_MAXUNIT 32
73 #define DEVMETHOD(what,func) { #what, (void *)&func }
74 #define DEVMETHOD_END {0,0}
75 #define EARLY_DRIVER_MODULE(a, b, c, d, e, f, g) DRIVER_MODULE(a, b, c, d, e, f)
76 #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \
77 static struct module_data bsd_##name##_##busname##_driver_mod = { \
78 evh, arg, #busname, #name, #busname "/" #name, \
79 &driver, &devclass, { 0, 0 } }; \
80 SYSINIT(bsd_##name##_##busname##_driver_mod, SI_SUB_DRIVERS, \
81 SI_ORDER_MIDDLE, module_register, \
82 &bsd_##name##_##busname##_driver_mod)
83 #define SYSINIT(uniq, subs, order, _func, _data) \
84 const struct sysinit UNIQ_NAME(sysinit_##uniq) = { \
86 .data = __DECONST(void *, _data) \
88 SYSINIT_ENTRY(uniq##_entry, "sysinit", (subs), \
89 (order), "const struct sysinit", \
90 UNIQ_NAME_STR(sysinit_##uniq), "SYSINIT")
92 #define SYSUNINIT(uniq, subs, order, _func, _data) \
93 const struct sysinit UNIQ_NAME(sysuninit_##uniq) = { \
95 .data = __DECONST(void *, _data) \
97 SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs), \
98 (order), "const struct sysuninit", \
99 UNIQ_NAME_STR(sysuninit_##uniq), "SYSUNINIT")
100 #define MODULE_DEPEND(...)
101 #define MODULE_VERSION(...)
102 #define NULL ((void *)0)
103 #define BUS_SPACE_BARRIER_READ 0x01
104 #define BUS_SPACE_BARRIER_WRITE 0x02
107 #define PAGE_SIZE 4096
109 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
111 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
114 #define MTX_RECURSE 0
116 #define SX_NOWITNESS 0
117 #define WITNESS_WARN(...)
119 #define BUS_PROBE_GENERIC 0
120 #define BUS_PROBE_DEFAULT (-20)
121 #define CALLOUT_RETURNUNLOCKED 0x1
123 #define ffs(x) __builtin_ffs(x)
125 #define va_list __builtin_va_list
127 #define va_size(type) __builtin_va_size(type)
129 #define va_start(ap, last) __builtin_va_start(ap, last)
131 #define va_end(ap) __builtin_va_end(ap)
133 #define va_arg(ap, type) __builtin_va_arg((ap), type)
134 #define DEVICE_ATTACH(dev, ...) \
135 (((device_attach_t *)(device_get_method(dev, "device_attach")))(dev,## __VA_ARGS__))
136 #define DEVICE_DETACH(dev, ...) \
137 (((device_detach_t *)(device_get_method(dev, "device_detach")))(dev,## __VA_ARGS__))
138 #define DEVICE_PROBE(dev, ...) \
139 (((device_probe_t *)(device_get_method(dev, "device_probe")))(dev,## __VA_ARGS__))
140 #define DEVICE_RESUME(dev, ...) \
141 (((device_resume_t *)(device_get_method(dev, "device_resume")))(dev,## __VA_ARGS__))
142 #define DEVICE_SHUTDOWN(dev, ...) \
143 (((device_shutdown_t *)(device_get_method(dev, "device_shutdown")))(dev,## __VA_ARGS__))
144 #define DEVICE_SUSPEND(dev, ...) \
145 (((device_suspend_t *)(device_get_method(dev, "device_suspend")))(dev,## __VA_ARGS__))
146 #define USB_HANDLE_REQUEST(dev, ...) \
147 (((usb_handle_request_t *)(device_get_method(dev, "usb_handle_request")))(dev,## __VA_ARGS__))
148 #define USB_TAKE_CONTROLLER(dev, ...) \
149 (((usb_take_controller_t *)(device_get_method(dev, "usb_take_controller")))(dev,## __VA_ARGS__))
150 #define GPIO_PIN_SET(dev, ...) \
151 (((gpio_pin_set_t *)(device_get_method(dev, "gpio_pin_set")))(dev,## __VA_ARGS__))
152 #define GPIO_PIN_SETFLAGS(dev, ...) \
153 (((gpio_pin_setflags_t *)(device_get_method(dev, "gpio_pin_setflags")))(dev,## __VA_ARGS__))
156 SI_SUB_DUMMY = 0x0000000,
157 SI_SUB_LOCK = 0x1B00000,
158 SI_SUB_KLD = 0x2000000,
159 SI_SUB_DRIVERS = 0x3100000,
160 SI_SUB_PSEUDO = 0x7000000,
161 SI_SUB_KICK_SCHEDULER = 0xa000000,
162 SI_SUB_RUN_SCHEDULER = 0xfffffff
166 SI_ORDER_FIRST = 0x0000000,
167 SI_ORDER_SECOND = 0x0000001,
168 SI_ORDER_THIRD = 0x0000002,
169 SI_ORDER_FOURTH = 0x0000003,
170 SI_ORDER_MIDDLE = 0x1000000,
171 SI_ORDER_ANY = 0xfffffff /* last */
179 #ifndef HAVE_STANDARD_DEFS
180 #define _UINT8_T_DECLARED
181 typedef unsigned char uint8_t;
182 #define _INT8_T_DECLARED
183 typedef signed char int8_t;
184 #define _UINT16_T_DECLARED
185 typedef unsigned short uint16_t;
186 #define _INT16_T_DECLARED
187 typedef signed short int16_t;
188 #define _UINT32_T_DECLARED
189 typedef unsigned int uint32_t;
190 #define _INT32_T_DECLARED
191 typedef signed int int32_t;
192 #define _UINT64_T_DECLARED
193 typedef unsigned long long uint64_t;
194 #define _INT16_T_DECLARED
195 typedef signed long long int64_t;
197 typedef uint16_t uid_t;
198 typedef uint16_t gid_t;
199 typedef uint16_t mode_t;
201 typedef uint8_t *caddr_t;
202 #define _UINTPTR_T_DECLARED
203 typedef unsigned long uintptr_t;
205 #define _SIZE_T_DECLARED
206 typedef unsigned long size_t;
207 typedef unsigned long u_long;
210 typedef unsigned long bus_addr_t;
211 typedef unsigned long bus_size_t;
213 typedef struct bus_dma_segment {
214 bus_addr_t ds_addr; /* DMA address */
215 bus_size_t ds_len; /* length of transfer */
223 typedef void *bus_dmamap_t;
224 typedef struct bus_dma_tag *bus_dma_tag_t;
228 BUS_DMA_UNLOCK = 0x02,
231 typedef void *bus_space_tag_t;
232 typedef uint8_t *bus_space_handle_t;
233 typedef int bus_dma_filter_t(void *, bus_addr_t);
234 typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);
236 typedef uint32_t bool;
243 void (*func) (void *arg);
254 #define mtx_assert(...) do { } while (0)
255 void mtx_init(struct mtx *, const char *, const char *, int);
256 void mtx_lock(struct mtx *);
257 void mtx_unlock(struct mtx *);
258 #define mtx_lock_spin(x) mtx_lock(x)
259 #define mtx_unlock_spin(x) mtx_unlock(x)
260 int mtx_owned(struct mtx *);
261 void mtx_destroy(struct mtx *);
263 extern struct mtx Giant;
271 #define sx_assert(...) do { } while (0)
272 #define sx_init(...) sx_init_flags(__VA_ARGS__, 0)
273 void sx_init_flags(struct sx *, const char *, int);
274 void sx_destroy(struct sx *);
275 void sx_xlock(struct sx *);
276 void sx_xunlock(struct sx *);
277 int sx_xlocked(struct sx *);
285 void cv_init(struct cv *, const char *desc);
286 void cv_destroy(struct cv *);
287 void cv_wait(struct cv *, struct mtx *);
288 int cv_timedwait(struct cv *, struct mtx *, int);
289 void cv_signal(struct cv *);
290 void cv_broadcast(struct cv *);
294 typedef void callout_fn_t (void *);
296 extern volatile int ticks;
299 LIST_ENTRY(callout) entry;
307 void callout_init_mtx(struct callout *, struct mtx *, int);
308 void callout_reset(struct callout *, int, callout_fn_t *, void *);
309 void callout_stop(struct callout *);
310 void callout_drain(struct callout *);
311 int callout_pending(struct callout *);
312 void callout_process(int timeout);
322 typedef struct driver driver_t;
323 typedef struct devclass *devclass_t;
324 typedef struct device *device_t;
325 typedef void (driver_intr_t)(void *arg);
326 typedef int (driver_filter_t)(void *arg);
327 #define FILTER_STRAY 0x01
328 #define FILTER_HANDLED 0x02
329 #define FILTER_SCHEDULE_THREAD 0x04
331 typedef int device_attach_t (device_t dev);
332 typedef int device_detach_t (device_t dev);
333 typedef int device_resume_t (device_t dev);
334 typedef int device_shutdown_t (device_t dev);
335 typedef int device_probe_t (device_t dev);
336 typedef int device_suspend_t (device_t dev);
337 typedef int gpio_pin_set_t (device_t dev, uint32_t, unsigned int);
338 typedef int gpio_pin_setflags_t (device_t dev, uint32_t, uint32_t);
340 typedef int bus_child_location_str_t (device_t parent, device_t child, char *buf, size_t buflen);
341 typedef int bus_child_pnpinfo_str_t (device_t parent, device_t child, char *buf, size_t buflen);
342 typedef void bus_driver_added_t (device_t dev, driver_t *driver);
344 struct device_method {
349 typedef struct device_method device_method_t;
352 TAILQ_HEAD(device_list, device) dev_children;
353 TAILQ_ENTRY(device) dev_link;
355 struct device *dev_parent;
356 const struct module_data *dev_module;
359 driver_filter_t *dev_irq_filter;
360 driver_intr_t *dev_irq_fn;
365 char dev_nameunit[64];
368 uint8_t dev_res_alloc:1;
370 uint8_t dev_softc_set:1;
371 uint8_t dev_softc_alloc:1;
372 uint8_t dev_attached:1;
373 uint8_t dev_fixed_class:1;
374 uint8_t dev_unit_manual:1;
378 device_t dev_list[DEVCLASS_MAXUNIT];
383 const struct device_method *methods;
388 int (*callback) (struct module *, int, void *arg);
390 const char *bus_name;
391 const char *mod_name;
392 const char *long_name;
393 const struct driver *driver;
394 struct devclass **devclass_pp;
395 TAILQ_ENTRY(module_data) entry;
398 device_t device_get_parent(device_t dev);
399 void *device_get_method(device_t dev, const char *what);
400 const char *device_get_name(device_t dev);
401 const char *device_get_nameunit(device_t dev);
403 #define device_printf(dev, fmt,...) \
404 printf("%s: " fmt, device_get_nameunit(dev),## __VA_ARGS__)
405 device_t device_add_child(device_t dev, const char *name, int unit);
406 void device_quiet(device_t dev);
407 void device_set_interrupt(device_t dev, driver_filter_t *, driver_intr_t *, void *);
408 void device_run_interrupts(device_t parent);
409 void device_set_ivars(device_t dev, void *ivars);
410 void *device_get_ivars(device_t dev);
411 const char *device_get_desc(device_t dev);
412 int device_probe_and_attach(device_t dev);
413 int device_detach(device_t dev);
414 void *device_get_softc(device_t dev);
415 void device_set_softc(device_t dev, void *softc);
416 int device_delete_child(device_t dev, device_t child);
417 int device_delete_children(device_t dev);
418 int device_is_attached(device_t dev);
419 void device_set_desc(device_t dev, const char *desc);
420 void device_set_desc_copy(device_t dev, const char *desc);
421 int device_get_unit(device_t dev);
422 void *devclass_get_softc(devclass_t dc, int unit);
423 int devclass_get_maxunit(devclass_t dc);
424 device_t devclass_get_device(devclass_t dc, int unit);
425 devclass_t devclass_find(const char *classname);
427 #define bus_get_dma_tag(...) (NULL)
428 int bus_generic_detach(device_t dev);
429 int bus_generic_resume(device_t dev);
430 int bus_generic_shutdown(device_t dev);
431 int bus_generic_suspend(device_t dev);
432 int bus_generic_print_child(device_t dev, device_t child);
433 void bus_generic_driver_added(device_t dev, driver_t *driver);
434 int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
435 bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp);
439 void bus_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint8_t data);
440 void bus_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint16_t data);
441 void bus_space_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint32_t data);
443 uint8_t bus_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset);
444 uint16_t bus_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset);
445 uint32_t bus_space_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset);
447 void bus_space_read_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint8_t *datap, bus_size_t count);
448 void bus_space_read_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint16_t *datap, bus_size_t count);
449 void bus_space_read_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint32_t *datap, bus_size_t count);
451 void bus_space_write_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint8_t *datap, bus_size_t count);
452 void bus_space_write_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint16_t *datap, bus_size_t count);
453 void bus_space_write_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset, uint32_t *datap, bus_size_t count);
455 void bus_space_read_region_1(bus_space_tag_t space, bus_space_handle_t handle, bus_size_t offset, uint8_t *datap, bus_size_t count);
456 void bus_space_write_region_1(bus_space_tag_t space, bus_space_handle_t handle, bus_size_t offset, uint8_t *datap, bus_size_t count);
457 void bus_space_read_region_4(bus_space_tag_t space, bus_space_handle_t handle, bus_size_t offset, uint32_t *datap, bus_size_t count);
458 void bus_space_write_region_4(bus_space_tag_t space, bus_space_handle_t handle, bus_size_t offset, uint32_t *datap, bus_size_t count);
460 void bus_space_barrier(bus_space_tag_t space, bus_space_handle_t handle, bus_size_t offset, bus_size_t length, int flags);
462 void module_register(void *);
466 void *memset(void *, int, size_t len);
467 void *memcpy(void *, const void *, size_t len);
468 int printf(const char *,...) __printflike(1, 2);
469 int snprintf(char *restrict str, size_t size, const char *restrict format,...) __printflike(3, 4);
470 size_t strlen(const char *s);
475 #define malloc(s,x,f) usb_malloc(s)
476 void *usb_malloc(size_t);
479 #define free(p,x) usb_free(p)
480 void usb_free(void *);
482 #define strdup(p,x) usb_strdup(p)
483 char *usb_strdup(const char *str);
487 #ifndef HAVE_ENDIAN_DEFS
489 /* Assume little endian */
491 #define htole64(x) ((uint64_t)(x))
492 #define le64toh(x) ((uint64_t)(x))
494 #define htole32(x) ((uint32_t)(x))
495 #define le32toh(x) ((uint32_t)(x))
497 #define htole16(x) ((uint16_t)(x))
498 #define le16toh(x) ((uint16_t)(x))
500 #define be32toh(x) ((uint32_t)(x))
501 #define htobe32(x) ((uint32_t)(x))
504 #include <sys/endian.h>
509 typedef int usb_handle_request_t (device_t dev, const void *req, void **pptr, uint16_t *plen, uint16_t offset, uint8_t *pstate);
510 typedef int usb_take_controller_t (device_t dev);
514 void usb_uninit(void);
516 /* set some defaults */
518 #ifndef USB_POOL_SIZE
519 #define USB_POOL_SIZE (1024*1024) /* 1 MByte */
522 int pause(const char *, int);
523 void DELAY(unsigned int);
530 /* SYSTEM STARTUP API */
532 extern const void *sysinit_data[];
533 extern const void *sysuninit_data[];
545 INTR_EXCL = 256, /* exclusive interrupt */
546 INTR_MPSAFE = 512, /* this interrupt is SMP safe */
547 INTR_ENTROPY = 1024, /* this interrupt provides entropy */
548 INTR_MD1 = 4096, /* flag reserved for MD use */
549 INTR_MD2 = 8192, /* flag reserved for MD use */
550 INTR_MD3 = 16384, /* flag reserved for MD use */
551 INTR_MD4 = 32768 /* flag reserved for MD use */
555 u_long r_start; /* index of the first entry in this resource */
556 u_long r_end; /* index of the last entry (inclusive) */
560 struct resource_i *__r_i;
561 bus_space_tag_t r_bustag; /* bus_space tag */
562 bus_space_handle_t r_bushandle; /* bus_space handle */
565 struct resource_spec {
571 #define SYS_RES_IRQ 1 /* interrupt lines */
572 #define SYS_RES_DRQ 2 /* isa dma lines */
573 #define SYS_RES_MEMORY 3 /* i/o memory */
574 #define SYS_RES_IOPORT 4 /* i/o ports */
576 #define RF_ALLOCATED 0x0001 /* resource has been reserved */
577 #define RF_ACTIVE 0x0002 /* resource allocation has been activated */
578 #define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */
579 #define RF_SPARE1 0x0008
580 #define RF_SPARE2 0x0010
581 #define RF_FIRSTSHARE 0x0020 /* first in sharing list */
582 #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */
583 #define RF_OPTIONAL 0x0080 /* for bus_alloc_resources() */
585 int bus_alloc_resources(device_t, struct resource_spec *, struct resource **);
586 int bus_release_resource(device_t, int, int, struct resource *);
587 void bus_release_resources(device_t, const struct resource_spec *,
589 struct resource *bus_alloc_resource_any(device_t, int, int *, unsigned int);
590 int bus_generic_attach(device_t);
591 bus_space_tag_t rman_get_bustag(struct resource *);
592 bus_space_handle_t rman_get_bushandle(struct resource *);
593 u_long rman_get_size(struct resource *);
594 int bus_setup_intr(device_t, struct resource *, int, driver_filter_t,
595 driver_intr_t, void *, void **);
596 int bus_teardown_intr(device_t, struct resource *, void *);
597 int ofw_bus_status_okay(device_t);
598 int ofw_bus_is_compatible(device_t, char *);
600 extern int (*bus_alloc_resource_any_cb)(struct resource *res, device_t dev,
601 int type, int *rid, unsigned int flags);
602 extern int (*ofw_bus_status_ok_cb)(device_t dev);
603 extern int (*ofw_bus_is_compatible_cb)(device_t dev, char *name);
606 #define strlcpy(d,s,n) snprintf((d),(n),"%s",(s))
609 /* Should be defined in user application since it is machine-dependent */
610 extern int delay(unsigned int);
613 #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
614 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
615 #define BUS_SPACE_MAXADDR 0xFFFFFFFF
616 #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
617 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
618 #define BUS_SPACE_MAXSIZE 0xFFFFFFFF
620 #define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */
621 #define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */
622 #define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */
623 #define BUS_DMA_COHERENT 0x04 /* hint: map memory in a coherent way */
624 #define BUS_DMA_ZERO 0x08 /* allocate zero'ed memory */
625 #define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */
626 #define BUS_DMA_BUS2 0x20
627 #define BUS_DMA_BUS3 0x40
628 #define BUS_DMA_BUS4 0x80
630 typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
633 bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
634 bus_size_t boundary, bus_addr_t lowaddr,
635 bus_addr_t highaddr, bus_dma_filter_t *filter,
636 void *filterarg, bus_size_t maxsize, int nsegments,
637 bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
638 void *lockfuncarg, bus_dma_tag_t *dmat);
640 int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
642 void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
643 int bus_dma_tag_destroy(bus_dma_tag_t dmat);
645 #endif /* _BSD_KERNEL_H_ */