Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: uapi: ufs: Make utp_upiu_req visible to user space

in preparation to send UPIU requests via bsg.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Avri Altman and committed by
Martin K. Petersen
a851b2bd c6049cd9

+78 -63
+1 -60
drivers/scsi/ufs/ufs.h
··· 38 38 39 39 #include <linux/mutex.h> 40 40 #include <linux/types.h> 41 + #include <uapi/scsi/scsi_bsg_ufs.h> 41 42 42 - #define MAX_CDB_SIZE 16 43 43 #define GENERAL_UPIU_REQUEST_SIZE 32 44 44 #define QUERY_DESC_MAX_SIZE 255 45 45 #define QUERY_DESC_MIN_SIZE 2 ··· 430 430 UFS_ACTIVE_PWR_MODE = 1, 431 431 UFS_SLEEP_PWR_MODE = 2, 432 432 UFS_POWERDOWN_PWR_MODE = 3, 433 - }; 434 - 435 - /** 436 - * struct utp_upiu_header - UPIU header structure 437 - * @dword_0: UPIU header DW-0 438 - * @dword_1: UPIU header DW-1 439 - * @dword_2: UPIU header DW-2 440 - */ 441 - struct utp_upiu_header { 442 - __be32 dword_0; 443 - __be32 dword_1; 444 - __be32 dword_2; 445 - }; 446 - 447 - /** 448 - * struct utp_upiu_cmd - Command UPIU structure 449 - * @data_transfer_len: Data Transfer Length DW-3 450 - * @cdb: Command Descriptor Block CDB DW-4 to DW-7 451 - */ 452 - struct utp_upiu_cmd { 453 - __be32 exp_data_transfer_len; 454 - u8 cdb[MAX_CDB_SIZE]; 455 - }; 456 - 457 - /** 458 - * struct utp_upiu_query - upiu request buffer structure for 459 - * query request. 460 - * @opcode: command to perform B-0 461 - * @idn: a value that indicates the particular type of data B-1 462 - * @index: Index to further identify data B-2 463 - * @selector: Index to further identify data B-3 464 - * @reserved_osf: spec reserved field B-4,5 465 - * @length: number of descriptor bytes to read/write B-6,7 466 - * @value: Attribute value to be written DW-5 467 - * @reserved: spec reserved DW-6,7 468 - */ 469 - struct utp_upiu_query { 470 - u8 opcode; 471 - u8 idn; 472 - u8 index; 473 - u8 selector; 474 - __be16 reserved_osf; 475 - __be16 length; 476 - __be32 value; 477 - __be32 reserved[2]; 478 - }; 479 - 480 - /** 481 - * struct utp_upiu_req - general upiu request structure 482 - * @header:UPIU header structure DW-0 to DW-2 483 - * @sc: fields structure for scsi command DW-3 to DW-7 484 - * @qr: fields structure for query request DW-3 to DW-7 485 - */ 486 - struct utp_upiu_req { 487 - struct utp_upiu_header header; 488 - union { 489 - struct utp_upiu_cmd sc; 490 - struct utp_upiu_query qr; 491 - }; 492 433 }; 493 434 494 435 /**
+3 -3
drivers/scsi/ufs/ufshcd.c
··· 2241 2241 ucd_req_ptr->sc.exp_data_transfer_len = 2242 2242 cpu_to_be32(lrbp->cmd->sdb.length); 2243 2243 2244 - cdb_len = min_t(unsigned short, lrbp->cmd->cmd_len, MAX_CDB_SIZE); 2245 - memset(ucd_req_ptr->sc.cdb, 0, MAX_CDB_SIZE); 2244 + cdb_len = min_t(unsigned short, lrbp->cmd->cmd_len, UFS_CDB_SIZE); 2245 + memset(ucd_req_ptr->sc.cdb, 0, UFS_CDB_SIZE); 2246 2246 memcpy(ucd_req_ptr->sc.cdb, lrbp->cmd->cmnd, cdb_len); 2247 2247 2248 2248 memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); ··· 8000 8000 host->max_lun = UFS_MAX_LUNS; 8001 8001 host->max_channel = UFSHCD_MAX_CHANNEL; 8002 8002 host->unique_id = host->host_no; 8003 - host->max_cmd_len = MAX_CDB_SIZE; 8003 + host->max_cmd_len = UFS_CDB_SIZE; 8004 8004 8005 8005 hba->max_pwr_info.is_valid = false; 8006 8006
+74
include/uapi/scsi/scsi_bsg_ufs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * UFS Transport SGIO v4 BSG Message Support 4 + * 5 + * Copyright (C) 2011-2013 Samsung India Software Operations 6 + */ 7 + #ifndef SCSI_BSG_UFS_H 8 + #define SCSI_BSG_UFS_H 9 + 10 + /* 11 + * This file intended to be included by both kernel and user space 12 + */ 13 + 14 + #define UFS_CDB_SIZE 16 15 + 16 + /** 17 + * struct utp_upiu_header - UPIU header structure 18 + * @dword_0: UPIU header DW-0 19 + * @dword_1: UPIU header DW-1 20 + * @dword_2: UPIU header DW-2 21 + */ 22 + struct utp_upiu_header { 23 + __be32 dword_0; 24 + __be32 dword_1; 25 + __be32 dword_2; 26 + }; 27 + 28 + /** 29 + * struct utp_upiu_query - upiu request buffer structure for 30 + * query request. 31 + * @opcode: command to perform B-0 32 + * @idn: a value that indicates the particular type of data B-1 33 + * @index: Index to further identify data B-2 34 + * @selector: Index to further identify data B-3 35 + * @reserved_osf: spec reserved field B-4,5 36 + * @length: number of descriptor bytes to read/write B-6,7 37 + * @value: Attribute value to be written DW-5 38 + * @reserved: spec reserved DW-6,7 39 + */ 40 + struct utp_upiu_query { 41 + __u8 opcode; 42 + __u8 idn; 43 + __u8 index; 44 + __u8 selector; 45 + __be16 reserved_osf; 46 + __be16 length; 47 + __be32 value; 48 + __be32 reserved[2]; 49 + }; 50 + 51 + /** 52 + * struct utp_upiu_cmd - Command UPIU structure 53 + * @data_transfer_len: Data Transfer Length DW-3 54 + * @cdb: Command Descriptor Block CDB DW-4 to DW-7 55 + */ 56 + struct utp_upiu_cmd { 57 + __be32 exp_data_transfer_len; 58 + u8 cdb[UFS_CDB_SIZE]; 59 + }; 60 + 61 + /** 62 + * struct utp_upiu_req - general upiu request structure 63 + * @header:UPIU header structure DW-0 to DW-2 64 + * @sc: fields structure for scsi command DW-3 to DW-7 65 + * @qr: fields structure for query request DW-3 to DW-7 66 + */ 67 + struct utp_upiu_req { 68 + struct utp_upiu_header header; 69 + union { 70 + struct utp_upiu_cmd sc; 71 + struct utp_upiu_query qr; 72 + }; 73 + }; 74 + #endif /* UFS_BSG_H */