static ssize_t store_intc_userimask(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned long level; level = simple_strtoul(buf, NULL, 10); /* */ if (level >= intc_get_dfl_prio_level()) return -EINVAL; __raw_writel(0xa5 << 24 | level << 4, uimask); return count; }
static ssize_t store_intc_userimask(struct sysdev_class *cls, struct sysdev_class_attribute *attr, const char *buf, size_t count) { unsigned long level; level = simple_strtoul(buf, NULL, 10); /* * Minimal acceptable IRQ levels are in the 2 - 16 range, but * these are chomped so as to not interfere with normal IRQs. * * Level 1 is a special case on some CPUs in that it's not * directly settable, but given that USERIMASK cuts off below a * certain level, we don't care about this limitation here. * Level 0 on the other hand equates to user masking disabled. * * We use the default priority level as a cut off so that only * special case opt-in IRQs can be mangled. */ if (level >= intc_get_dfl_prio_level()) return -EINVAL; __raw_writel(0xa5 << 24 | level << 4, uimask); return count; }
int register_intc_userimask(unsigned long addr) { if (unlikely(uimask)) return -EBUSY; uimask = ioremap_nocache(addr, SZ_4K); if (unlikely(!uimask)) return -ENOMEM; pr_info("userimask support registered for levels 0 -> %d\n", intc_get_dfl_prio_level() - 1); return 0; }