usbdi(9): Add some missing header include guards.diff -r1.35 -r1.36 src/sys/dev/usb/usb_mem.h
(riastradh)
--- src/sys/dev/usb/usb_mem.h 2021/12/21 09:51:22 1.35
+++ src/sys/dev/usb/usb_mem.h 2022/02/14 09:23:32 1.36
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usb_mem.h,v 1.35 2021/12/21 09:51:22 skrll Exp $ */ | 1 | /* $NetBSD: usb_mem.h,v 1.36 2022/02/14 09:23:32 riastradh Exp $ */ | |
2 | /* $FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $ */ | 2 | /* $FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Lennart Augustsson (lennart@augustsson.net) at | 9 | * by Lennart Augustsson (lennart@augustsson.net) at | |
10 | * Carlstedt Research & Technology. | 10 | * Carlstedt Research & Technology. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -21,26 +21,29 @@ | @@ -21,26 +21,29 @@ | |||
21 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 21 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
31 | * POSSIBILITY OF SUCH DAMAGE. | 31 | * POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #ifndef _DEV_USB_USB_MEM_H_ | |||
35 | #define _DEV_USB_USB_MEM_H_ | |||
36 | ||||
34 | typedef struct usb_dma_block { | 37 | typedef struct usb_dma_block { | |
35 | bus_dma_tag_t tag; | 38 | bus_dma_tag_t tag; | |
36 | bus_dmamap_t map; | 39 | bus_dmamap_t map; | |
37 | void *kaddr; | 40 | void *kaddr; | |
38 | bus_dma_segment_t *segs; | 41 | bus_dma_segment_t *segs; | |
39 | int nsegs; | 42 | int nsegs; | |
40 | int nsegs_alloc; | 43 | int nsegs_alloc; | |
41 | size_t size; | 44 | size_t size; | |
42 | size_t align; | 45 | size_t align; | |
43 | int flags; | 46 | int flags; | |
44 | #define USB_DMA_FULLBLOCK __BIT(0) | 47 | #define USB_DMA_FULLBLOCK __BIT(0) | |
45 | #define USB_DMA_COHERENT __BIT(1) | 48 | #define USB_DMA_COHERENT __BIT(1) | |
46 | 49 | |||
@@ -50,13 +53,15 @@ typedef struct usb_dma_block { | @@ -50,13 +53,15 @@ typedef struct usb_dma_block { | |||
50 | #define USBMALLOC_MULTISEG __BIT(0) | 53 | #define USBMALLOC_MULTISEG __BIT(0) | |
51 | #define USBMALLOC_COHERENT __BIT(1) | 54 | #define USBMALLOC_COHERENT __BIT(1) | |
52 | #define USBMALLOC_ZERO __BIT(2) | 55 | #define USBMALLOC_ZERO __BIT(2) | |
53 | 56 | |||
54 | int usb_allocmem(bus_dma_tag_t, size_t, size_t, u_int, usb_dma_t *); | 57 | int usb_allocmem(bus_dma_tag_t, size_t, size_t, u_int, usb_dma_t *); | |
55 | void usb_freemem(usb_dma_t *); | 58 | void usb_freemem(usb_dma_t *); | |
56 | void usb_syncmem(usb_dma_t *, bus_addr_t, bus_size_t, int); | 59 | void usb_syncmem(usb_dma_t *, bus_addr_t, bus_size_t, int); | |
57 | 60 | |||
58 | bus_addr_t usb_dmaaddr(usb_dma_t *, unsigned int); | 61 | bus_addr_t usb_dmaaddr(usb_dma_t *, unsigned int); | |
59 | 62 | |||
60 | #define DMAADDR(dma, o) usb_dmaaddr((dma), (o)) | 63 | #define DMAADDR(dma, o) usb_dmaaddr((dma), (o)) | |
61 | #define KERNADDR(dma, o) \ | 64 | #define KERNADDR(dma, o) \ | |
62 | ((void *)((char *)(dma)->udma_block->kaddr + (dma)->udma_offs + (o))) | 65 | ((void *)((char *)(dma)->udma_block->kaddr + (dma)->udma_offs + (o))) | |
66 | ||||
67 | #endif /* _DEV_USB_USB_MEM_H_ */ |
--- src/sys/dev/usb/usbdivar.h 2021/09/07 10:44:18 1.130
+++ src/sys/dev/usb/usbdivar.h 2022/02/14 09:23:32 1.131
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usbdivar.h,v 1.130 2021/09/07 10:44:18 riastradh Exp $ */ | 1 | /* $NetBSD: usbdivar.h,v 1.131 2022/02/14 09:23:32 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). | 9 | * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -20,26 +20,29 @@ | @@ -20,26 +20,29 @@ | |||
20 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 20 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #ifndef _DEV_USB_USBDIVAR_H_ | |||
34 | #define _DEV_USB_USBDIVAR_H_ | |||
35 | ||||
33 | /* | 36 | /* | |
34 | * Discussion about locking in the USB code: | 37 | * Discussion about locking in the USB code: | |
35 | * | 38 | * | |
36 | * The host controller presents one lock at IPL_SOFTUSB (aka IPL_SOFTNET). | 39 | * The host controller presents one lock at IPL_SOFTUSB (aka IPL_SOFTNET). | |
37 | * | 40 | * | |
38 | * List of hardware interface methods, and whether the lock is held | 41 | * List of hardware interface methods, and whether the lock is held | |
39 | * when each is called by this module: | 42 | * when each is called by this module: | |
40 | * | 43 | * | |
41 | * BUS METHOD LOCK NOTES | 44 | * BUS METHOD LOCK NOTES | |
42 | * ----------------------- ------- ------------------------- | 45 | * ----------------------- ------- ------------------------- | |
43 | * ubm_open - might want to take lock? | 46 | * ubm_open - might want to take lock? | |
44 | * ubm_softint x | 47 | * ubm_softint x | |
45 | * ubm_dopoll - might want to take lock? | 48 | * ubm_dopoll - might want to take lock? | |
@@ -387,13 +390,15 @@ usbd_xfer_isread(struct usbd_xfer *xfer) | @@ -387,13 +390,15 @@ usbd_xfer_isread(struct usbd_xfer *xfer) | |||
387 | static __inline size_t | 390 | static __inline size_t | |
388 | usb_addr2dindex(int addr) | 391 | usb_addr2dindex(int addr) | |
389 | { | 392 | { | |
390 | 393 | |||
391 | return USB_ROOTHUB_INDEX + addr; | 394 | return USB_ROOTHUB_INDEX + addr; | |
392 | } | 395 | } | |
393 | 396 | |||
394 | /* | 397 | /* | |
395 | * These macros reflect the current locking scheme. They might change. | 398 | * These macros reflect the current locking scheme. They might change. | |
396 | */ | 399 | */ | |
397 | 400 | |||
398 | #define usbd_lock_pipe(p) mutex_enter((p)->up_dev->ud_bus->ub_lock) | 401 | #define usbd_lock_pipe(p) mutex_enter((p)->up_dev->ud_bus->ub_lock) | |
399 | #define usbd_unlock_pipe(p) mutex_exit((p)->up_dev->ud_bus->ub_lock) | 402 | #define usbd_unlock_pipe(p) mutex_exit((p)->up_dev->ud_bus->ub_lock) | |
403 | ||||
404 | #endif /* _DEV_USB_USBDIVAR_H_ */ |