Lines Matching +full:fw +full:- +full:cfg +full:- +full:mmio

7  * sysfs (read-only, under "/sys/firmware/qemu_fw_cfg/...").
15 * [qemu_fw_cfg.]mmio=<size>@<base>[:<ctrl_off>:<data_off>[:<dma_off>]]
18 * <size> := size of ioport or mmio range
19 * <base> := physical base address of ioport or mmio range
27 * qemu_fw_cfg.mmio=16@0x9020000:8:0:16 (the default on arm)
46 /* fw_cfg revision attribute, in /sys/firmware/qemu_fw_cfg top-level dir. */
80 u32 ctrl = be32_to_cpu(READ_ONCE(d->control)); in fw_cfg_wait_for_control()
82 /* do not reorder the read to d->control */ in fw_cfg_wait_for_control()
99 ret = -ENOMEM; in fw_cfg_dma_transfer()
113 /* force memory to sync before notifying device via MMIO */ in fw_cfg_dma_transfer()
119 if (be32_to_cpu(READ_ONCE(d->control)) & FW_CFG_DMA_CTL_ERROR) { in fw_cfg_dma_transfer()
120 ret = -EIO; in fw_cfg_dma_transfer()
130 /* read chunk of given fw_cfg blob (caller responsible for sanity-check) */
134 u32 glk = -1U; in fw_cfg_read_blob()
145 return -EINVAL; in fw_cfg_read_blob()
150 while (pos-- > 0) in fw_cfg_read_blob()
160 /* write chunk of given fw_cfg blob (caller responsible for sanity-check) */
164 u32 glk = -1U; in fw_cfg_write_blob()
175 return -EINVAL; in fw_cfg_write_blob()
212 /* arch-specific ctrl & data register offsets are not available in ACPI, DT */
246 return -EINVAL; in fw_cfg_do_platform_probe()
248 fw_cfg_p_base = range->start; in fw_cfg_do_platform_probe()
254 return -EBUSY; in fw_cfg_do_platform_probe()
258 return -EFAULT; in fw_cfg_do_platform_probe()
263 return -EBUSY; in fw_cfg_do_platform_probe()
267 return -EFAULT; in fw_cfg_do_platform_probe()
276 fw_cfg_reg_ctrl = fw_cfg_dev_base + ctrl->start; in fw_cfg_do_platform_probe()
277 fw_cfg_reg_data = fw_cfg_dev_base + data->start; in fw_cfg_do_platform_probe()
279 /* use architecture-specific offsets */ in fw_cfg_do_platform_probe()
285 fw_cfg_reg_dma = fw_cfg_dev_base + dma->start; in fw_cfg_do_platform_probe()
296 return -ENODEV; in fw_cfg_do_platform_probe()
330 return -ENOMEM; in fw_cfg_write_vmcoreinfo()
338 * don't know what else to format - host may ignore ours in fw_cfg_write_vmcoreinfo()
340 ret = fw_cfg_write_blob(be16_to_cpu(f->select), data, in fw_cfg_write_vmcoreinfo()
375 list_add_tail(&entry->list, &fw_cfg_entry_cache); in fw_cfg_sysfs_cache_enlist()
382 list_del(&entry->list); in fw_cfg_sysfs_cache_delist()
392 kobject_del(&entry->kobj); in fw_cfg_sysfs_cache_cleanup()
393 kobject_put(&entry->kobj); in fw_cfg_sysfs_cache_cleanup()
397 /* per-entry attributes and show methods */
407 return sprintf(buf, "%u\n", e->size); in fw_cfg_sysfs_show_size()
412 return sprintf(buf, "%u\n", e->select); in fw_cfg_sysfs_show_key()
417 return sprintf(buf, "%s\n", e->name); in fw_cfg_sysfs_show_name()
439 return attr->show(entry, buf); in fw_cfg_sysfs_attr_show()
461 /* raw-read method and attribute */
468 if (pos > entry->size) in fw_cfg_sysfs_read_raw()
469 return -EINVAL; in fw_cfg_sysfs_read_raw()
471 if (count > entry->size - pos) in fw_cfg_sysfs_read_raw()
472 count = entry->size - pos; in fw_cfg_sysfs_read_raw()
474 return fw_cfg_read_blob(entry->select, buf, pos, count); in fw_cfg_sysfs_read_raw()
486 * NOTE: We do this on a best-effort basis, since 'name' is not guaranteed
487 * to be a well-behaved path name. Whenever a symlink vs. kset directory
501 return -EINVAL; in fw_cfg_build_symlink()
506 return -ENOMEM; in fw_cfg_build_symlink()
513 ret = sysfs_create_link(&dir->kobj, target, tok); in fw_cfg_build_symlink()
523 /* ko MUST be a kset - we're about to use it as one ! */ in fw_cfg_build_symlink()
524 if (ko->ktype != dir->kobj.ktype) { in fw_cfg_build_symlink()
525 ret = -EINVAL; in fw_cfg_build_symlink()
535 ret = -ENOMEM; in fw_cfg_build_symlink()
538 subdir->kobj.kset = dir; in fw_cfg_build_symlink()
539 subdir->kobj.ktype = dir->kobj.ktype; in fw_cfg_build_symlink()
540 ret = kobject_set_name(&subdir->kobj, "%s", tok); in fw_cfg_build_symlink()
566 list_for_each_entry_safe(k, next, &kset->list, entry) in fw_cfg_kset_unregister_recursive()
568 if (k->ktype == kset->kobj.ktype) in fw_cfg_kset_unregister_recursive()
575 /* kobjects & kset representing top-level, by_key, and by_name folders */
588 strcmp(f->name, FW_CFG_VMCOREINFO_FILENAME) == 0 && in fw_cfg_register_file()
598 return -ENOMEM; in fw_cfg_register_file()
601 entry->size = be32_to_cpu(f->size); in fw_cfg_register_file()
602 entry->select = be16_to_cpu(f->select); in fw_cfg_register_file()
603 strscpy(entry->name, f->name, FW_CFG_MAX_FILE_PATH); in fw_cfg_register_file()
606 err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype, in fw_cfg_register_file()
607 fw_cfg_sel_ko, "%d", entry->select); in fw_cfg_register_file()
612 err = sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw); in fw_cfg_register_file()
617 fw_cfg_build_symlink(fw_cfg_fname_kset, &entry->kobj, entry->name); in fw_cfg_register_file()
624 kobject_del(&entry->kobj); in fw_cfg_register_file()
626 kobject_put(&entry->kobj); in fw_cfg_register_file()
649 return -ENOMEM; in fw_cfg_register_dir_entries()
667 /* unregister top-level or by_key folder */
680 * a subdirectory named after e.g. pdev->id, then hang per-device in fw_cfg_sysfs_probe()
682 * one fw_cfg device exist system-wide, so if one was already found in fw_cfg_sysfs_probe()
686 return -EBUSY; in fw_cfg_sysfs_probe()
689 err = -ENOMEM; in fw_cfg_sysfs_probe()
702 /* get revision number, add matching top-level attribute */ in fw_cfg_sysfs_probe()
745 { .compatible = "qemu,fw-cfg-mmio", },
805 /* only one fw_cfg device can exist system-wide, so if one in fw_cfg_cmdline_set()
812 return -EINVAL; in fw_cfg_cmdline_set()
832 return -EINVAL; in fw_cfg_cmdline_set()
835 res[0].end = base + size - 1; in fw_cfg_cmdline_set()
836 res[0].flags = !strcmp(kp->name, "mmio") ? IORESOURCE_MEM : in fw_cfg_cmdline_set()
866 * line, or if the parameter name (ioport/mmio) doesn't match in fw_cfg_cmdline_get()
870 (!strcmp(kp->name, "mmio") ^ in fw_cfg_cmdline_get()
871 (fw_cfg_cmdline_dev->resource[0].flags == IORESOURCE_MEM))) in fw_cfg_cmdline_get()
874 switch (fw_cfg_cmdline_dev->num_resources) { in fw_cfg_cmdline_get()
877 resource_size(&fw_cfg_cmdline_dev->resource[0]), in fw_cfg_cmdline_get()
878 fw_cfg_cmdline_dev->resource[0].start); in fw_cfg_cmdline_get()
881 resource_size(&fw_cfg_cmdline_dev->resource[0]), in fw_cfg_cmdline_get()
882 fw_cfg_cmdline_dev->resource[0].start, in fw_cfg_cmdline_get()
883 fw_cfg_cmdline_dev->resource[1].start, in fw_cfg_cmdline_get()
884 fw_cfg_cmdline_dev->resource[2].start); in fw_cfg_cmdline_get()
887 resource_size(&fw_cfg_cmdline_dev->resource[0]), in fw_cfg_cmdline_get()
888 fw_cfg_cmdline_dev->resource[0].start, in fw_cfg_cmdline_get()
889 fw_cfg_cmdline_dev->resource[1].start, in fw_cfg_cmdline_get()
890 fw_cfg_cmdline_dev->resource[2].start, in fw_cfg_cmdline_get()
891 fw_cfg_cmdline_dev->resource[3].start); in fw_cfg_cmdline_get()
896 fw_cfg_cmdline_dev->num_resources); in fw_cfg_cmdline_get()
906 device_param_cb(mmio, &fw_cfg_cmdline_param_ops, NULL, S_IRUSR);
917 return -ENOMEM; in fw_cfg_sysfs_init()