Lines Matching +full:p10 +full:- +full:occ +full:- +full:hwmon
1 // SPDX-License-Identifier: GPL-2.0+
7 #include <linux/fsi-occ.h>
21 struct occ occ; member
30 #define to_p9_sbe_occ(x) container_of((x), struct p9_sbe_occ, occ)
37 struct occ *occ = dev_get_drvdata(kobj_to_dev(kobj)); in ffdc_read() local
38 struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); in ffdc_read()
40 mutex_lock(&ctx->sbe_error_lock); in ffdc_read()
41 if (ctx->sbe_error) { in ffdc_read()
42 rc = memory_read_from_buffer(buf, count, &pos, ctx->ffdc, in ffdc_read()
43 ctx->ffdc_len); in ffdc_read()
44 if (pos >= ctx->ffdc_len) in ffdc_read()
45 ctx->sbe_error = false; in ffdc_read()
47 mutex_unlock(&ctx->sbe_error_lock); in ffdc_read()
58 mutex_lock(&ctx->sbe_error_lock); in p9_sbe_occ_save_ffdc()
59 if (!ctx->sbe_error) { in p9_sbe_occ_save_ffdc()
60 if (resp_len > ctx->ffdc_size) { in p9_sbe_occ_save_ffdc()
61 kvfree(ctx->ffdc); in p9_sbe_occ_save_ffdc()
62 ctx->ffdc = kvmalloc(resp_len, GFP_KERNEL); in p9_sbe_occ_save_ffdc()
63 if (!ctx->ffdc) { in p9_sbe_occ_save_ffdc()
64 ctx->ffdc_len = 0; in p9_sbe_occ_save_ffdc()
65 ctx->ffdc_size = 0; in p9_sbe_occ_save_ffdc()
69 ctx->ffdc_size = resp_len; in p9_sbe_occ_save_ffdc()
73 ctx->sbe_error = true; in p9_sbe_occ_save_ffdc()
74 ctx->ffdc_len = resp_len; in p9_sbe_occ_save_ffdc()
75 memcpy(ctx->ffdc, resp, resp_len); in p9_sbe_occ_save_ffdc()
79 mutex_unlock(&ctx->sbe_error_lock); in p9_sbe_occ_save_ffdc()
83 static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len, in p9_sbe_occ_send_cmd() argument
87 struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); in p9_sbe_occ_send_cmd()
91 rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); in p9_sbe_occ_send_cmd()
96 sysfs_notify(&occ->bus_dev->kobj, NULL, in p9_sbe_occ_send_cmd()
100 if (rc != -EBADE) in p9_sbe_occ_send_cmd()
105 switch (((struct occ_response *)resp)->return_status) { in p9_sbe_occ_send_cmd()
107 rc = -ETIMEDOUT; in p9_sbe_occ_send_cmd()
116 rc = -EINVAL; in p9_sbe_occ_send_cmd()
125 rc = -EREMOTEIO; in p9_sbe_occ_send_cmd()
128 rc = -EPROTO; in p9_sbe_occ_send_cmd()
137 struct occ *occ; in p9_sbe_occ_probe() local
138 struct p9_sbe_occ *ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), in p9_sbe_occ_probe()
141 return -ENOMEM; in p9_sbe_occ_probe()
143 mutex_init(&ctx->sbe_error_lock); in p9_sbe_occ_probe()
145 ctx->sbe = pdev->dev.parent; in p9_sbe_occ_probe()
146 occ = &ctx->occ; in p9_sbe_occ_probe()
147 occ->bus_dev = &pdev->dev; in p9_sbe_occ_probe()
148 platform_set_drvdata(pdev, occ); in p9_sbe_occ_probe()
150 occ->powr_sample_time_us = 500; in p9_sbe_occ_probe()
151 occ->poll_cmd_data = 0x20; /* P9 OCC poll data */ in p9_sbe_occ_probe()
152 occ->send_cmd = p9_sbe_occ_send_cmd; in p9_sbe_occ_probe()
154 rc = occ_setup(occ); in p9_sbe_occ_probe()
155 if (rc == -ESHUTDOWN) in p9_sbe_occ_probe()
156 rc = -ENODEV; /* Host is shutdown, don't spew errors */ in p9_sbe_occ_probe()
159 rc = device_create_bin_file(occ->bus_dev, &bin_attr_ffdc); in p9_sbe_occ_probe()
161 dev_warn(occ->bus_dev, in p9_sbe_occ_probe()
172 struct occ *occ = platform_get_drvdata(pdev); in p9_sbe_occ_remove() local
173 struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); in p9_sbe_occ_remove()
175 device_remove_bin_file(occ->bus_dev, &bin_attr_ffdc); in p9_sbe_occ_remove()
177 ctx->sbe = NULL; in p9_sbe_occ_remove()
178 occ_shutdown(occ); in p9_sbe_occ_remove()
180 kvfree(ctx->ffdc); in p9_sbe_occ_remove()
184 { .compatible = "ibm,p9-occ-hwmon" },
185 { .compatible = "ibm,p10-occ-hwmon" },
192 .name = "occ-hwmon",
202 MODULE_DESCRIPTION("BMC P9 OCC hwmon driver");