Lines Matching +full:off +full:- +full:chip

1 // SPDX-License-Identifier: GPL-2.0-or-later
30 * its form. Bits 4-11 are always 0. in opal_scom_unmangle()
34 * of the 64-bit address, and thus cannot use the indirect bit. in opal_scom_unmangle()
37 * bits 4-7 (IBM notation) instead of bit 0-3 in this API, we in opal_scom_unmangle()
40 * For in-kernel use, we don't need to do this mangling. In in opal_scom_unmangle()
41 * kernel won't have bits 4-7 set. in opal_scom_unmangle()
44 * debugfs will always set 0-3 = 0 and clear 4-7 in opal_scom_unmangle()
45 * kernel will always clear 0-3 = 0 and set 4-7 in opal_scom_unmangle()
55 static int opal_scom_read(uint32_t chip, uint64_t addr, u64 reg, u64 *value) in opal_scom_read() argument
61 rc = opal_xscom_read(chip, reg, (__be64 *)__pa(&v)); in opal_scom_read()
64 return -EIO; in opal_scom_read()
70 static int opal_scom_write(uint32_t chip, uint64_t addr, u64 reg, u64 value) in opal_scom_write() argument
75 rc = opal_xscom_write(chip, reg, value); in opal_scom_write()
77 return -EIO; in opal_scom_write()
82 u32 chip; member
90 struct scom_debug_entry *ent = filp->private_data; in scom_debug_read()
92 loff_t off = *ppos; in scom_debug_read() local
97 if (off < 0 || (off & 7) || (count & 7)) in scom_debug_read()
98 return -EINVAL; in scom_debug_read()
99 reg_base = off >> 3; in scom_debug_read()
103 rc = opal_scom_read(ent->chip, reg_base, reg, &val); in scom_debug_read()
121 struct scom_debug_entry *ent = filp->private_data; in scom_debug_write()
123 loff_t off = *ppos; in scom_debug_write() local
128 if (off < 0 || (off & 7) || (count & 7)) in scom_debug_write()
129 return -EINVAL; in scom_debug_write()
130 reg_base = off >> 3; in scom_debug_write()
136 rc = opal_scom_write(ent->chip, reg_base, reg, val); in scom_debug_write()
156 int chip) in scom_debug_init_one() argument
163 return -ENOMEM; in scom_debug_init_one()
165 ent->chip = chip; in scom_debug_init_one()
166 snprintf(ent->name, 16, "%08x", chip); in scom_debug_init_one()
167 ent->path.data = (void *)kasprintf(GFP_KERNEL, "%pOF", dn); in scom_debug_init_one()
168 if (!ent->path.data) { in scom_debug_init_one()
170 return -ENOMEM; in scom_debug_init_one()
173 ent->path.size = strlen((char *)ent->path.data); in scom_debug_init_one()
175 dir = debugfs_create_dir(ent->name, root); in scom_debug_init_one()
177 kfree(ent->path.data); in scom_debug_init_one()
179 return -1; in scom_debug_init_one()
182 debugfs_create_blob("devspec", 0400, dir, &ent->path); in scom_debug_init_one()
192 int chip, rc; in scom_debug_init() local
199 return -1; in scom_debug_init()
202 for_each_node_with_property(dn, "scom-controller") { in scom_debug_init()
203 chip = of_get_ibm_chip_id(dn); in scom_debug_init()
204 WARN_ON(chip == -1); in scom_debug_init()
205 rc |= scom_debug_init_one(root, dn, chip); in scom_debug_init()