Lines Matching refs:entry

69 	struct intel_pmt_entry *entry = container_of(attr,  in intel_pmt_read()  local
76 if (off >= entry->size) in intel_pmt_read()
79 if (count > entry->size - off) in intel_pmt_read()
80 count = entry->size - off; in intel_pmt_read()
82 if (entry->guid == GUID_SPR_PUNIT) in intel_pmt_read()
84 count = pmt_memcpy64_fromio(buf, entry->base + off, count); in intel_pmt_read()
86 memcpy_fromio(buf, entry->base + off, count); in intel_pmt_read()
95 struct intel_pmt_entry *entry = container_of(attr, in intel_pmt_mmap() local
100 unsigned long phys = entry->base_addr; in intel_pmt_mmap()
107 psize = (PFN_UP(entry->base_addr + entry->size) - pfn) * PAGE_SIZE; in intel_pmt_mmap()
124 struct intel_pmt_entry *entry = dev_get_drvdata(dev); in guid_show() local
126 return sprintf(buf, "0x%x\n", entry->guid); in guid_show()
133 struct intel_pmt_entry *entry = dev_get_drvdata(dev); in size_show() local
135 return sprintf(buf, "%zu\n", entry->size); in size_show()
142 struct intel_pmt_entry *entry = dev_get_drvdata(dev); in offset_show() local
144 return sprintf(buf, "%lu\n", offset_in_page(entry->base_addr)); in offset_show()
162 static int intel_pmt_populate_entry(struct intel_pmt_entry *entry, in intel_pmt_populate_entry() argument
192 entry->base_addr = disc_res->end + 1 + header->base_offset; in intel_pmt_populate_entry()
205 entry->base_addr = 0; in intel_pmt_populate_entry()
209 entry->base_addr = pci_resource_start(pci_dev, i) + in intel_pmt_populate_entry()
213 if (!entry->base_addr) in intel_pmt_populate_entry()
224 entry->base_addr = pci_resource_start(pci_dev, bir) + in intel_pmt_populate_entry()
233 entry->guid = header->guid; in intel_pmt_populate_entry()
234 entry->size = header->size; in intel_pmt_populate_entry()
239 static int intel_pmt_dev_register(struct intel_pmt_entry *entry, in intel_pmt_dev_register() argument
247 ret = xa_alloc(ns->xa, &entry->devid, entry, PMT_XA_LIMIT, GFP_KERNEL); in intel_pmt_dev_register()
251 dev = device_create(&intel_pmt_class, parent, MKDEV(0, 0), entry, in intel_pmt_dev_register()
252 "%s%d", ns->name, entry->devid); in intel_pmt_dev_register()
256 ns->name, entry->devid); in intel_pmt_dev_register()
261 entry->kobj = &dev->kobj; in intel_pmt_dev_register()
264 ret = sysfs_create_group(entry->kobj, ns->attr_grp); in intel_pmt_dev_register()
270 if (!entry->size) in intel_pmt_dev_register()
273 res.start = entry->base_addr; in intel_pmt_dev_register()
274 res.end = res.start + entry->size - 1; in intel_pmt_dev_register()
277 entry->base = devm_ioremap_resource(dev, &res); in intel_pmt_dev_register()
278 if (IS_ERR(entry->base)) { in intel_pmt_dev_register()
279 ret = PTR_ERR(entry->base); in intel_pmt_dev_register()
283 sysfs_bin_attr_init(&entry->pmt_bin_attr); in intel_pmt_dev_register()
284 entry->pmt_bin_attr.attr.name = ns->name; in intel_pmt_dev_register()
285 entry->pmt_bin_attr.attr.mode = 0440; in intel_pmt_dev_register()
286 entry->pmt_bin_attr.mmap = intel_pmt_mmap; in intel_pmt_dev_register()
287 entry->pmt_bin_attr.read = intel_pmt_read; in intel_pmt_dev_register()
288 entry->pmt_bin_attr.size = entry->size; in intel_pmt_dev_register()
290 ret = sysfs_create_bin_file(&dev->kobj, &entry->pmt_bin_attr); in intel_pmt_dev_register()
296 sysfs_remove_group(entry->kobj, ns->attr_grp); in intel_pmt_dev_register()
300 xa_erase(ns->xa, entry->devid); in intel_pmt_dev_register()
305 int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespace *ns, in intel_pmt_dev_create() argument
315 entry->disc_table = devm_ioremap_resource(dev, disc_res); in intel_pmt_dev_create()
316 if (IS_ERR(entry->disc_table)) in intel_pmt_dev_create()
317 return PTR_ERR(entry->disc_table); in intel_pmt_dev_create()
319 ret = ns->pmt_header_decode(entry, &header, dev); in intel_pmt_dev_create()
323 ret = intel_pmt_populate_entry(entry, &header, dev, disc_res); in intel_pmt_dev_create()
327 return intel_pmt_dev_register(entry, ns, dev); in intel_pmt_dev_create()
332 void intel_pmt_dev_destroy(struct intel_pmt_entry *entry, in intel_pmt_dev_destroy() argument
335 struct device *dev = kobj_to_dev(entry->kobj); in intel_pmt_dev_destroy()
337 if (entry->size) in intel_pmt_dev_destroy()
338 sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr); in intel_pmt_dev_destroy()
341 sysfs_remove_group(entry->kobj, ns->attr_grp); in intel_pmt_dev_destroy()
344 xa_erase(ns->xa, entry->devid); in intel_pmt_dev_destroy()