| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: umass.c,v 1.149.2.4 2014/12/06 08:27:23 skrll Exp $ */ | | 1 | /* $NetBSD: umass.c,v 1.149.2.5 2015/03/01 08:31:27 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2003 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 Charles M. Hannum. | | 8 | * by Charles M. Hannum. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -114,27 +114,27 @@ | | | @@ -114,27 +114,27 @@ |
114 | | | 114 | |
115 | /* | | 115 | /* |
116 | * The SCSI related part of this driver has been derived from the | | 116 | * The SCSI related part of this driver has been derived from the |
117 | * dev/ppbus/vpo.c driver, by Nicolas Souchu (nsouch@freebsd.org). | | 117 | * dev/ppbus/vpo.c driver, by Nicolas Souchu (nsouch@freebsd.org). |
118 | * | | 118 | * |
119 | * The CAM layer uses so called actions which are messages sent to the host | | 119 | * The CAM layer uses so called actions which are messages sent to the host |
120 | * adapter for completion. The actions come in through umass_cam_action. The | | 120 | * adapter for completion. The actions come in through umass_cam_action. The |
121 | * appropriate block of routines is called depending on the transport protocol | | 121 | * appropriate block of routines is called depending on the transport protocol |
122 | * in use. When the transfer has finished, these routines call | | 122 | * in use. When the transfer has finished, these routines call |
123 | * umass_cam_cb again to complete the CAM command. | | 123 | * umass_cam_cb again to complete the CAM command. |
124 | */ | | 124 | */ |
125 | | | 125 | |
126 | #include <sys/cdefs.h> | | 126 | #include <sys/cdefs.h> |
127 | __KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.4 2014/12/06 08:27:23 skrll Exp $"); | | 127 | __KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.5 2015/03/01 08:31:27 skrll Exp $"); |
128 | | | 128 | |
129 | #ifdef _KERNEL_OPT | | 129 | #ifdef _KERNEL_OPT |
130 | #include "opt_usb.h" | | 130 | #include "opt_usb.h" |
131 | #endif | | 131 | #endif |
132 | | | 132 | |
133 | #include "atapibus.h" | | 133 | #include "atapibus.h" |
134 | #include "scsibus.h" | | 134 | #include "scsibus.h" |
135 | #include "wd.h" | | 135 | #include "wd.h" |
136 | | | 136 | |
137 | #include <sys/param.h> | | 137 | #include <sys/param.h> |
138 | #include <sys/systm.h> | | 138 | #include <sys/systm.h> |
139 | #include <sys/kernel.h> | | 139 | #include <sys/kernel.h> |
140 | #include <sys/conf.h> | | 140 | #include <sys/conf.h> |
| @@ -576,29 +576,31 @@ umass_attach(device_t parent, device_t s | | | @@ -576,29 +576,31 @@ umass_attach(device_t parent, device_t s |
576 | | | 576 | |
577 | /* initialisation of generic part */ | | 577 | /* initialisation of generic part */ |
578 | sc->transfer_state = TSTATE_IDLE; | | 578 | sc->transfer_state = TSTATE_IDLE; |
579 | | | 579 | |
580 | /* request a sufficient number of xfer handles */ | | 580 | /* request a sufficient number of xfer handles */ |
581 | for (i = 0; i < XFER_NR; i++) { | | 581 | for (i = 0; i < XFER_NR; i++) { |
582 | sc->transfer_xfer[i] = usbd_alloc_xfer(uaa->device); | | 582 | sc->transfer_xfer[i] = usbd_alloc_xfer(uaa->device); |
583 | if (sc->transfer_xfer[i] == NULL) { | | 583 | if (sc->transfer_xfer[i] == NULL) { |
584 | aprint_error_dev(self, "Out of memory\n"); | | 584 | aprint_error_dev(self, "Out of memory\n"); |
585 | umass_disco(sc); | | 585 | umass_disco(sc); |
586 | return; | | 586 | return; |
587 | } | | 587 | } |
588 | } | | 588 | } |
589 | /* Allocate buffer for data transfer (it's huge), command and | | 589 | /* |
590 | status data here as auto allocation cannot happen in interrupt | | 590 | * Allocate buffer for data transfer (it's huge), command and |
591 | context */ | | 591 | * status data here as auto allocation cannot happen in interrupt |
| | | 592 | * context |
| | | 593 | */ |
592 | switch (sc->sc_wire) { | | 594 | switch (sc->sc_wire) { |
593 | case UMASS_WPROTO_BBB: | | 595 | case UMASS_WPROTO_BBB: |
594 | sc->data_buffer = usbd_alloc_buffer( | | 596 | sc->data_buffer = usbd_alloc_buffer( |
595 | sc->transfer_xfer[XFER_BBB_DATA], | | 597 | sc->transfer_xfer[XFER_BBB_DATA], |
596 | UMASS_MAX_TRANSFER_SIZE); | | 598 | UMASS_MAX_TRANSFER_SIZE); |
597 | sc->cmd_buffer = usbd_alloc_buffer( | | 599 | sc->cmd_buffer = usbd_alloc_buffer( |
598 | sc->transfer_xfer[XFER_BBB_CBW], | | 600 | sc->transfer_xfer[XFER_BBB_CBW], |
599 | UMASS_BBB_CBW_SIZE); | | 601 | UMASS_BBB_CBW_SIZE); |
600 | sc->s1_buffer = usbd_alloc_buffer( | | 602 | sc->s1_buffer = usbd_alloc_buffer( |
601 | sc->transfer_xfer[XFER_BBB_CSW1], | | 603 | sc->transfer_xfer[XFER_BBB_CSW1], |
602 | UMASS_BBB_CSW_SIZE); | | 604 | UMASS_BBB_CSW_SIZE); |
603 | sc->s2_buffer = usbd_alloc_buffer( | | 605 | sc->s2_buffer = usbd_alloc_buffer( |
604 | sc->transfer_xfer[XFER_BBB_CSW2], | | 606 | sc->transfer_xfer[XFER_BBB_CSW2], |