Lines Matching +full:integer +full:- +full:n
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2012-2014 Intel Corporation
10 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
55 return sysfs_emit(buf, "%s\n", chip->ppi_version); in tpm_show_ppi_version()
61 ssize_t size = -EINVAL; in tpm_show_ppi_request()
67 if (strcmp(chip->ppi_version, "1.2") < 0) in tpm_show_ppi_request()
70 obj = tpm_eval_dsm(chip->acpi_dev_handle, TPM_PPI_FN_GETREQ, in tpm_show_ppi_request()
73 return -ENXIO; in tpm_show_ppi_request()
81 if (obj->package.count == 3 && in tpm_show_ppi_request()
82 obj->package.elements[0].type == ACPI_TYPE_INTEGER && in tpm_show_ppi_request()
83 obj->package.elements[1].type == ACPI_TYPE_INTEGER && in tpm_show_ppi_request()
84 obj->package.elements[2].type == ACPI_TYPE_INTEGER) { in tpm_show_ppi_request()
85 if (obj->package.elements[0].integer.value) in tpm_show_ppi_request()
86 size = -EFAULT; in tpm_show_ppi_request()
88 req = obj->package.elements[1].integer.value; in tpm_show_ppi_request()
90 size = sysfs_emit(buf, "%llu %llu\n", req, in tpm_show_ppi_request()
91 obj->package.elements[2].integer.value); in tpm_show_ppi_request()
93 size = sysfs_emit(buf, "%llu\n", req); in tpm_show_ppi_request()
95 } else if (obj->package.count == 2 && in tpm_show_ppi_request()
96 obj->package.elements[0].type == ACPI_TYPE_INTEGER && in tpm_show_ppi_request()
97 obj->package.elements[1].type == ACPI_TYPE_INTEGER) { in tpm_show_ppi_request()
98 if (obj->package.elements[0].integer.value) in tpm_show_ppi_request()
99 size = -EFAULT; in tpm_show_ppi_request()
101 size = sysfs_emit(buf, "%llu\n", in tpm_show_ppi_request()
102 obj->package.elements[1].integer.value); in tpm_show_ppi_request()
123 * the function to submit TPM operation request to pre-os environment in tpm_store_ppi_request()
127 if (acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid, in tpm_store_ppi_request()
133 * accept buffer/string/integer type, but some BIOS accept buffer/ in tpm_store_ppi_request()
137 if (strcmp(chip->ppi_version, "1.3") == 0) { in tpm_store_ppi_request()
138 if (sscanf(buf, "%llu %llu", &tmp[0].integer.value, in tpm_store_ppi_request()
139 &tmp[1].integer.value) != 2) in tpm_store_ppi_request()
144 } else if (strcmp(chip->ppi_version, "1.2") < 0) { in tpm_store_ppi_request()
146 return -EINVAL; in tpm_store_ppi_request()
154 if (sscanf(buf, "%llu", &tmp[0].integer.value) != 1) in tpm_store_ppi_request()
155 return -EINVAL; in tpm_store_ppi_request()
158 obj = tpm_eval_dsm(chip->acpi_dev_handle, func, ACPI_TYPE_INTEGER, in tpm_store_ppi_request()
161 return -ENXIO; in tpm_store_ppi_request()
163 ret = obj->integer.value; in tpm_store_ppi_request()
170 return (ret == 1) ? -EPERM : -EFAULT; in tpm_store_ppi_request()
191 "OS Vendor-specific", in tpm_show_ppi_transition_action()
197 * (e.g. Capella with PPI 1.0) need integer/string/buffer type, so for in tpm_show_ppi_transition_action()
200 if (strcmp(chip->ppi_version, "1.2") < 0) in tpm_show_ppi_transition_action()
202 obj = tpm_eval_dsm(chip->acpi_dev_handle, TPM_PPI_FN_GETACT, in tpm_show_ppi_transition_action()
205 return -ENXIO; in tpm_show_ppi_transition_action()
207 ret = obj->integer.value; in tpm_show_ppi_transition_action()
211 if (ret < ARRAY_SIZE(info) - 1) in tpm_show_ppi_transition_action()
212 status = sysfs_emit(buf, "%d: %s\n", ret, info[ret]); in tpm_show_ppi_transition_action()
214 status = sysfs_emit(buf, "%d: %s\n", ret, in tpm_show_ppi_transition_action()
215 info[ARRAY_SIZE(info) - 1]); in tpm_show_ppi_transition_action()
223 acpi_status status = -EINVAL; in tpm_show_ppi_response()
228 obj = tpm_eval_dsm(chip->acpi_dev_handle, TPM_PPI_FN_GETRSP, in tpm_show_ppi_response()
231 return -ENXIO; in tpm_show_ppi_response()
238 * the second integer is not 0, the response makes sense. in tpm_show_ppi_response()
240 ret_obj = obj->package.elements; in tpm_show_ppi_response()
241 if (obj->package.count < 3 || in tpm_show_ppi_response()
247 if (ret_obj[0].integer.value) { in tpm_show_ppi_response()
248 status = -EFAULT; in tpm_show_ppi_response()
252 req = ret_obj[1].integer.value; in tpm_show_ppi_response()
253 res = ret_obj[2].integer.value; in tpm_show_ppi_response()
256 status = sysfs_emit(buf, "%llu %s\n", req, in tpm_show_ppi_response()
259 status = sysfs_emit(buf, "%llu %s\n", req, in tpm_show_ppi_response()
262 status = sysfs_emit(buf, "%llu %s\n", req, in tpm_show_ppi_response()
265 status = sysfs_emit(buf, "%llu %llu: %s\n", in tpm_show_ppi_response()
268 status = sysfs_emit(buf, "%llu %llu: %s\n", in tpm_show_ppi_response()
271 status = sysfs_emit(buf, "%llu: %s\n", in tpm_show_ppi_response()
299 return -EPERM; in show_ppi_operations()
301 tmp.integer.type = ACPI_TYPE_INTEGER; in show_ppi_operations()
303 tmp.integer.value = i; in show_ppi_operations()
308 return -ENOMEM; in show_ppi_operations()
310 ret = obj->integer.value; in show_ppi_operations()
315 len += sysfs_emit_at(buf, len, "%d %d: %s\n", in show_ppi_operations()
328 return show_ppi_operations(chip->acpi_dev_handle, buf, 0, in tpm_show_ppi_tcg_operations()
338 return show_ppi_operations(chip->acpi_dev_handle, buf, PPI_VS_REQ_START, in tpm_show_ppi_vs_operations()
368 if (!chip->acpi_dev_handle) in tpm_add_ppi()
371 if (!acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid, in tpm_add_ppi()
376 obj = acpi_evaluate_dsm_typed(chip->acpi_dev_handle, &tpm_ppi_guid, in tpm_add_ppi()
381 strscpy(chip->ppi_version, obj->string.pointer, in tpm_add_ppi()
382 sizeof(chip->ppi_version)); in tpm_add_ppi()
386 chip->groups[chip->groups_cnt++] = &ppi_attr_grp; in tpm_add_ppi()