Lines Matching +full:integer +full:- +full:n
1 // SPDX-License-Identifier: GPL-2.0
76 return container_of(file->private_data, struct pfrt_log_device, miscdev); in to_pfrt_log_dev()
82 acpi_handle handle = ACPI_HANDLE(pfrt_log_dev->parent_dev); in get_pfrt_log_data_info()
84 int ret = -EBUSY; in get_pfrt_log_data_info()
93 in_buf.integer.value = pfrt_log_dev->info.log_type; in get_pfrt_log_data_info()
96 pfrt_log_dev->info.log_revid, PFRT_FUNC_GET_DATA, in get_pfrt_log_data_info()
99 return -EINVAL; in get_pfrt_log_data_info()
101 if (out_obj->package.count < LOG_NR_IDX || in get_pfrt_log_data_info()
102 out_obj->package.elements[LOG_STATUS_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
103 out_obj->package.elements[LOG_EXT_STATUS_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
104 out_obj->package.elements[LOG_MAX_SZ_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
105 out_obj->package.elements[LOG_CHUNK1_LO_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
106 out_obj->package.elements[LOG_CHUNK1_HI_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
107 out_obj->package.elements[LOG_CHUNK1_SZ_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
108 out_obj->package.elements[LOG_CHUNK2_LO_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
109 out_obj->package.elements[LOG_CHUNK2_HI_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
110 out_obj->package.elements[LOG_CHUNK2_SZ_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
111 out_obj->package.elements[LOG_ROLLOVER_CNT_IDX].type != ACPI_TYPE_INTEGER || in get_pfrt_log_data_info()
112 out_obj->package.elements[LOG_RESET_CNT_IDX].type != ACPI_TYPE_INTEGER) in get_pfrt_log_data_info()
115 data_info->status = out_obj->package.elements[LOG_STATUS_IDX].integer.value; in get_pfrt_log_data_info()
116 data_info->ext_status = in get_pfrt_log_data_info()
117 out_obj->package.elements[LOG_EXT_STATUS_IDX].integer.value; in get_pfrt_log_data_info()
118 if (data_info->status != DSM_SUCCEED) { in get_pfrt_log_data_info()
119 dev_dbg(pfrt_log_dev->parent_dev, "Error Status:%d\n", data_info->status); in get_pfrt_log_data_info()
120 dev_dbg(pfrt_log_dev->parent_dev, "Error Extend Status:%d\n", in get_pfrt_log_data_info()
121 data_info->ext_status); in get_pfrt_log_data_info()
125 data_info->max_data_size = in get_pfrt_log_data_info()
126 out_obj->package.elements[LOG_MAX_SZ_IDX].integer.value; in get_pfrt_log_data_info()
127 data_info->chunk1_addr_lo = in get_pfrt_log_data_info()
128 out_obj->package.elements[LOG_CHUNK1_LO_IDX].integer.value; in get_pfrt_log_data_info()
129 data_info->chunk1_addr_hi = in get_pfrt_log_data_info()
130 out_obj->package.elements[LOG_CHUNK1_HI_IDX].integer.value; in get_pfrt_log_data_info()
131 data_info->chunk1_size = in get_pfrt_log_data_info()
132 out_obj->package.elements[LOG_CHUNK1_SZ_IDX].integer.value; in get_pfrt_log_data_info()
133 data_info->chunk2_addr_lo = in get_pfrt_log_data_info()
134 out_obj->package.elements[LOG_CHUNK2_LO_IDX].integer.value; in get_pfrt_log_data_info()
135 data_info->chunk2_addr_hi = in get_pfrt_log_data_info()
136 out_obj->package.elements[LOG_CHUNK2_HI_IDX].integer.value; in get_pfrt_log_data_info()
137 data_info->chunk2_size = in get_pfrt_log_data_info()
138 out_obj->package.elements[LOG_CHUNK2_SZ_IDX].integer.value; in get_pfrt_log_data_info()
139 data_info->rollover_cnt = in get_pfrt_log_data_info()
140 out_obj->package.elements[LOG_ROLLOVER_CNT_IDX].integer.value; in get_pfrt_log_data_info()
141 data_info->reset_cnt = in get_pfrt_log_data_info()
142 out_obj->package.elements[LOG_RESET_CNT_IDX].integer.value; in get_pfrt_log_data_info()
154 acpi_handle handle = ACPI_HANDLE(pfrt_log_dev->parent_dev); in set_pfrt_log_level()
165 in_buf.integer.value = level; in set_pfrt_log_level()
168 pfrt_log_dev->info.log_revid, PFRT_FUNC_SET_LEV, in set_pfrt_log_level()
171 return -EINVAL; in set_pfrt_log_level()
173 obj = &out_obj->package.elements[0]; in set_pfrt_log_level()
174 status = obj->integer.value; in set_pfrt_log_level()
176 obj = &out_obj->package.elements[1]; in set_pfrt_log_level()
177 ext_status = obj->integer.value; in set_pfrt_log_level()
178 dev_dbg(pfrt_log_dev->parent_dev, "Error Status:%d\n", status); in set_pfrt_log_level()
179 dev_dbg(pfrt_log_dev->parent_dev, "Error Extend Status:%d\n", ext_status); in set_pfrt_log_level()
180 ret = -EBUSY; in set_pfrt_log_level()
190 acpi_handle handle = ACPI_HANDLE(pfrt_log_dev->parent_dev); in get_pfrt_log_level()
193 int ret = -EBUSY; in get_pfrt_log_level()
196 pfrt_log_dev->info.log_revid, PFRT_FUNC_GET_LEV, in get_pfrt_log_level()
199 return -EINVAL; in get_pfrt_log_level()
201 obj = &out_obj->package.elements[0]; in get_pfrt_log_level()
202 if (obj->type != ACPI_TYPE_INTEGER) in get_pfrt_log_level()
205 status = obj->integer.value; in get_pfrt_log_level()
207 obj = &out_obj->package.elements[1]; in get_pfrt_log_level()
208 ext_status = obj->integer.value; in get_pfrt_log_level()
209 dev_dbg(pfrt_log_dev->parent_dev, "Error Status:%d\n", status); in get_pfrt_log_level()
210 dev_dbg(pfrt_log_dev->parent_dev, "Error Extend Status:%d\n", ext_status); in get_pfrt_log_level()
214 obj = &out_obj->package.elements[2]; in get_pfrt_log_level()
215 if (obj->type != ACPI_TYPE_INTEGER) in get_pfrt_log_level()
218 ret = obj->integer.value; in get_pfrt_log_level()
255 return -EFAULT; in pfrt_log_ioctl()
258 pfrt_log_dev->info.log_revid = info.log_revid; in pfrt_log_ioctl()
265 pfrt_log_dev->info.log_level = info.log_level; in pfrt_log_ioctl()
269 pfrt_log_dev->info.log_type = info.log_type; in pfrt_log_ioctl()
278 info.log_type = pfrt_log_dev->info.log_type; in pfrt_log_ioctl()
279 info.log_revid = pfrt_log_dev->info.log_revid; in pfrt_log_ioctl()
281 return -EFAULT; in pfrt_log_ioctl()
291 return -EFAULT; in pfrt_log_ioctl()
296 return -ENOTTY; in pfrt_log_ioctl()
309 if (vma->vm_flags & VM_WRITE) in pfrt_log_mmap()
310 return -EROFS; in pfrt_log_mmap()
324 return -ENODEV; in pfrt_log_mmap()
329 return -ENODEV; in pfrt_log_mmap()
331 vsize = vma->vm_end - vma->vm_start; in pfrt_log_mmap()
333 return -EINVAL; in pfrt_log_mmap()
335 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); in pfrt_log_mmap()
336 if (io_remap_pfn_range(vma, vma->vm_start, PFN_DOWN(base_addr), in pfrt_log_mmap()
337 vsize, vma->vm_page_prot)) in pfrt_log_mmap()
338 return -EAGAIN; in pfrt_log_mmap()
354 misc_deregister(&pfrt_log_dev->miscdev); in acpi_pfrt_log_remove()
363 ida_free(&pfrt_log_ida, pfrt_log_dev->index); in pfrt_log_put_idx()
368 acpi_handle handle = ACPI_HANDLE(&pdev->dev); in acpi_pfrt_log_probe()
373 dev_dbg(&pdev->dev, "Missing _DSM\n"); in acpi_pfrt_log_probe()
374 return -ENODEV; in acpi_pfrt_log_probe()
377 pfrt_log_dev = devm_kzalloc(&pdev->dev, sizeof(*pfrt_log_dev), GFP_KERNEL); in acpi_pfrt_log_probe()
379 return -ENOMEM; in acpi_pfrt_log_probe()
385 pfrt_log_dev->index = ret; in acpi_pfrt_log_probe()
386 ret = devm_add_action_or_reset(&pdev->dev, pfrt_log_put_idx, pfrt_log_dev); in acpi_pfrt_log_probe()
390 pfrt_log_dev->info.log_revid = PFRT_DEFAULT_REV_ID; in acpi_pfrt_log_probe()
391 pfrt_log_dev->parent_dev = &pdev->dev; in acpi_pfrt_log_probe()
393 pfrt_log_dev->miscdev.minor = MISC_DYNAMIC_MINOR; in acpi_pfrt_log_probe()
394 pfrt_log_dev->miscdev.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, in acpi_pfrt_log_probe()
396 pfrt_log_dev->index); in acpi_pfrt_log_probe()
397 if (!pfrt_log_dev->miscdev.name) in acpi_pfrt_log_probe()
398 return -ENOMEM; in acpi_pfrt_log_probe()
400 pfrt_log_dev->miscdev.nodename = devm_kasprintf(&pdev->dev, GFP_KERNEL, in acpi_pfrt_log_probe()
402 pfrt_log_dev->index); in acpi_pfrt_log_probe()
403 if (!pfrt_log_dev->miscdev.nodename) in acpi_pfrt_log_probe()
404 return -ENOMEM; in acpi_pfrt_log_probe()
406 pfrt_log_dev->miscdev.fops = &acpi_pfrt_log_fops; in acpi_pfrt_log_probe()
407 pfrt_log_dev->miscdev.parent = &pdev->dev; in acpi_pfrt_log_probe()
409 ret = misc_register(&pfrt_log_dev->miscdev); in acpi_pfrt_log_probe()