mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / payloads / libpayload / include / usb / usbmsc.h
blob0331f92873d23e290f4365cecc88d386d6075eb6
1 /*
3 * Copyright (C) 2008-2010 coresystems GmbH
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.
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.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
29 #ifndef __USBMSC_H
30 #define __USBMSC_H
31 typedef struct {
32 unsigned int blocksize;
33 unsigned int numblocks;
34 endpoint_t *bulk_in;
35 endpoint_t *bulk_out;
36 u8 quirks : 7;
37 u8 usbdisk_created : 1;
38 s8 ready;
39 u8 lun;
40 u8 num_luns;
41 void *data; /* For use by consumers of libpayload. */
42 } usbmsc_inst_t;
44 /* Possible values for quirks field. */
45 enum {
46 /* Don't check for LUNs (force assumption that there's only one LUN). */
47 USB_MSC_QUIRK_NO_LUNS = 1 << 0,
48 /* Never do a BULK_ONLY reset, just continue. This means that the device
49 cannot recover from phase errors and won't detach automatically for
50 unrecoverable errors. Do not use unless you have to. */
51 USB_MSC_QUIRK_NO_RESET = 1 << 1,
54 /* Possible values for ready field. */
55 enum {
56 USB_MSC_DETACHED = -1, /* Disk detached or out to lunch. */
57 USB_MSC_NOT_READY = 0, /* Disk not ready yet -- empty card reader */
58 USB_MSC_READY = 1, /* Disk ready to communicate. */
61 #define MSC_INST(dev) ((usbmsc_inst_t*)(dev)->data)
63 typedef enum { cbw_direction_data_in = 0x80, cbw_direction_data_out = 0
64 } cbw_direction;
66 int readwrite_blocks_512 (usbdev_t *dev, int start, int n, cbw_direction dir, u8 *buf);
67 int readwrite_blocks (usbdev_t *dev, int start, int n, cbw_direction dir, u8 *buf);
69 /* Force a device to enumerate as MSC, without checking class/protocol types.
70 It must still have a bulk endpoint pair and respond to MSC commands. */
71 void usb_msc_force_init (usbdev_t *dev, u32 quirks);
73 #endif