Merge usb into yeeloongfw
This commit is contained in:
		
						commit
						89d90892d0
					
				
					 22 changed files with 763 additions and 182 deletions
				
			
		|  | @ -46,5 +46,6 @@ int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...); | |||
| #endif | ||||
| 
 | ||||
| char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); | ||||
| extern char * canonicalize_file_name (const char *path); | ||||
| 
 | ||||
| #endif /* GRUB_EMU_MISC_H */ | ||||
|  |  | |||
|  | @ -25,14 +25,26 @@ | |||
| #define GRUB_SCSI_REMOVABLE_BIT	7 | ||||
| #define GRUB_SCSI_LUN_SHIFT	5 | ||||
| 
 | ||||
| struct grub_scsi_test_unit_ready | ||||
| { | ||||
|   grub_uint8_t opcode; | ||||
|   grub_uint8_t lun; /* 7-5 LUN, 4-0 reserved */ | ||||
|   grub_uint8_t reserved1; | ||||
|   grub_uint8_t reserved2; | ||||
|   grub_uint8_t reserved3; | ||||
|   grub_uint8_t control; | ||||
|   grub_uint8_t pad[6]; /* To be ATAPI compatible */ | ||||
| } __attribute__((packed)); | ||||
| 
 | ||||
| struct grub_scsi_inquiry | ||||
| { | ||||
|   grub_uint8_t opcode; | ||||
|   grub_uint8_t lun; | ||||
|   grub_uint16_t reserved; | ||||
|   grub_uint16_t alloc_length; | ||||
|   grub_uint8_t reserved2; | ||||
|   grub_uint8_t pad[5]; | ||||
|   grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 EVPD */ | ||||
|   grub_uint8_t page; /* page code if EVPD=1 */ | ||||
|   grub_uint8_t reserved; | ||||
|   grub_uint8_t alloc_length; | ||||
|   grub_uint8_t control; | ||||
|   grub_uint8_t pad[6]; /* To be ATAPI compatible */ | ||||
| } __attribute__((packed)); | ||||
| 
 | ||||
| struct grub_scsi_inquiry_data | ||||
|  | @ -47,12 +59,42 @@ struct grub_scsi_inquiry_data | |||
|   char prodrev[4]; | ||||
| } __attribute__((packed)); | ||||
| 
 | ||||
| struct grub_scsi_request_sense | ||||
| { | ||||
|   grub_uint8_t opcode; | ||||
|   grub_uint8_t lun; /* 7-5 LUN, 4-0 reserved */ | ||||
|   grub_uint8_t reserved1; | ||||
|   grub_uint8_t reserved2; | ||||
|   grub_uint8_t alloc_length; | ||||
|   grub_uint8_t control; | ||||
|   grub_uint8_t pad[6]; /* To be ATAPI compatible */ | ||||
| } __attribute__((packed)); | ||||
| 
 | ||||
| struct grub_scsi_request_sense_data | ||||
| { | ||||
|   grub_uint8_t error_code; /* 7 Valid, 6-0 Err. code */ | ||||
|   grub_uint8_t segment_number; | ||||
|   grub_uint8_t sense_key; /*7 FileMark, 6 EndOfMedia, 5 ILI, 4-0 sense key */ | ||||
|   grub_uint32_t information; | ||||
|   grub_uint8_t additional_sense_length; | ||||
|   grub_uint32_t cmd_specific_info; | ||||
|   grub_uint8_t additional_sense_code; | ||||
|   grub_uint8_t additional_sense_code_qualifier; | ||||
|   grub_uint8_t field_replaceable_unit_code; | ||||
|   grub_uint8_t sense_key_specific[3]; | ||||
|   /* there can be additional sense field */ | ||||
| } __attribute__((packed)); | ||||
| 
 | ||||
| struct grub_scsi_read_capacity | ||||
| { | ||||
|   grub_uint8_t opcode; | ||||
|   grub_uint8_t lun; | ||||
|   grub_uint8_t reserved[8]; | ||||
|   grub_uint8_t pad[2]; | ||||
|   grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 reserved */ | ||||
|   grub_uint32_t logical_block_addr; /* only if PMI=1 */ | ||||
|   grub_uint8_t reserved1; | ||||
|   grub_uint8_t reserved2; | ||||
|   grub_uint8_t PMI; | ||||
|   grub_uint8_t control; | ||||
|   grub_uint16_t pad; /* To be ATAPI compatible */ | ||||
| } __attribute__((packed)); | ||||
| 
 | ||||
| struct grub_scsi_read_capacity_data | ||||
|  | @ -106,11 +148,13 @@ struct grub_scsi_write12 | |||
| typedef enum | ||||
|   { | ||||
|     grub_scsi_cmd_inquiry = 0x12, | ||||
|     grub_scsi_cmd_test_unit_ready = 0x00, | ||||
|     grub_scsi_cmd_read_capacity = 0x25, | ||||
|     grub_scsi_cmd_read10 = 0x28, | ||||
|     grub_scsi_cmd_write10 = 0x2a, | ||||
|     grub_scsi_cmd_read12 = 0xa8, | ||||
|     grub_scsi_cmd_write12 = 0xaa | ||||
|     grub_scsi_cmd_write12 = 0xaa, | ||||
|     grub_scsi_cmd_request_sense = 0x03 | ||||
|   } grub_scsi_cmd_t; | ||||
| 
 | ||||
| typedef enum | ||||
|  |  | |||
|  | @ -156,7 +156,7 @@ struct grub_usb_device | |||
|   int initialized; | ||||
| 
 | ||||
|   /* Data toggle values (used for bulk transfers only).  */ | ||||
|   int toggle[16]; | ||||
|   int toggle[256]; | ||||
| 
 | ||||
|   /* Device-specific data.  */ | ||||
|   void *data; | ||||
|  | @ -184,7 +184,12 @@ typedef enum | |||
| 
 | ||||
| typedef enum | ||||
|   { | ||||
|     GRUB_USBMS_SUBCLASS_BULK = 0x06 | ||||
|     GRUB_USBMS_SUBCLASS_BULK = 0x06, | ||||
|   	/* Experimental support for non-pure SCSI devices */ | ||||
|     GRUB_USBMS_SUBCLASS_RBC = 0x01, | ||||
|     GRUB_USBMS_SUBCLASS_MMC2 = 0x02, | ||||
|     GRUB_USBMS_SUBCLASS_UFI = 0x04, | ||||
|     GRUB_USBMS_SUBCLASS_SFF8070 = 0x05 | ||||
|   } grub_usbms_subclass_t; | ||||
| 
 | ||||
| typedef enum | ||||
|  |  | |||
|  | @ -86,9 +86,9 @@ typedef struct grub_usb_transfer *grub_usb_transfer_t; | |||
| 
 | ||||
| #define GRUB_USB_REQ_HUB_GET_PORT_STATUS 0x00 | ||||
| 
 | ||||
| #define GRUB_USB_FEATURE_ENDP_HALT	0x01 | ||||
| #define GRUB_USB_FEATURE_DEV_REMOTE_WU	0x02 | ||||
| #define GRUB_USB_FEATURE_TEST_MODE	0x04 | ||||
| #define GRUB_USB_FEATURE_ENDP_HALT	0x00 | ||||
| #define GRUB_USB_FEATURE_DEV_REMOTE_WU	0x01 | ||||
| #define GRUB_USB_FEATURE_TEST_MODE	0x02 | ||||
| 
 | ||||
| #define GRUB_USB_HUB_STATUS_CONNECTED	(1 << 0) | ||||
| #define GRUB_USB_HUB_STATUS_LOWSPEED	(1 << 9) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue