Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\sed-opal.c Create Date:2022-07-28 18:12:27
Last Modify:2020-03-17 23:36:33 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:read_table_data

Proto:static int read_table_data(struct opal_dev *dev, void *data)

Type:int

Parameter:

TypeParameterName
struct opal_dev *dev
void *data
2006  read_tbl = data
2008  off = 0 , max_read_size = IO_BUFFER_LENGTH = 2048* sizeof(header) = 56* No. of Token Bytes in the Response = 11* MAX size of data that can be carried in response buffer* at a time is : 2048 - (56 + 11) = 1981 = 0x7BD.
2010  offset = offset , read_size = size - 1
2011  __user * dst
2013  err = see TCG SAS 5.3.2.3 for a description of the available columns* the result is provided in dev->resp->tok[4]
2014  If err Then
2015  pr_debug("Couldn't get the table size\n")
2016  Return err
2019  table_len = response_get_u64( & parsed, 4)
2022  If read_size > table_len || offset > table_len - read_size Then
2023  pr_debug("Read size exceeds the Table size limits (%llu vs. %llu)\n", offset + read_size, table_len)
2025  Return -EINVAL
2028  When off < read_size cycle
2029  err = cmd_start(dev, table_uid, TCG Storage SSC Methods.* Derived from: TCG_Storage_Architecture_Core_Spec_v2.01_r1.00* Section: 6.3 Assigned UIDs[OPAL_GET])
2031  add_token_u8( & err, dev, OPAL_STARTLIST)
2032  add_token_u8( & err, dev, OPAL_STARTNAME)
2033  add_token_u8( & err, dev, OPAL_STARTROW)
2034  add_token_u64( & err, dev, offset + off)
2035  add_token_u8( & err, dev, OPAL_ENDNAME)
2037  add_token_u8( & err, dev, OPAL_STARTNAME)
2038  add_token_u8( & err, dev, OPAL_ENDROW)
2040  len = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(max_read_size, (size_t)(read_size - off))
2042  add_token_u64( & err, dev, offset + off + len)
2043  add_token_u8( & err, dev, OPAL_ENDNAME)
2044  add_token_u8( & err, dev, OPAL_ENDLIST)
2046  If err Then
2047  pr_debug("Error building read table data command.\n")
2048  Break
2051  err = finalize_and_send(dev, read_table_data_cont)
2052  If err Then Break
2056  If prev_d_len > len + 1 Then
2057  err = -EOVERFLOW
2058  Break
2061  dst = data
2062  If copy_to_user(dst + off, prev_data, prev_d_len) Then
2063  pr_debug("Error copying data to userspace\n")
2064  err = -EFAULT
2065  Break
2067  prev_data = NULL
2069  off += len
2072  Return err