static ssize_t appid_show(struct device *dev, struct device_attribute *attr, char *buf) { char app_name[5]; struct genwqe_dev *cd = dev_get_drvdata(dev); genwqe_read_app_id(cd, app_name, sizeof(app_name)); return sprintf(buf, "%s\n", app_name); }
static int genwqe_read_ids(struct genwqe_dev *cd) { int err = 0; int slu_id; struct pci_dev *pci_dev = cd->pci_dev; cd->slu_unitcfg = __genwqe_readq(cd, IO_SLU_UNITCFG); if (cd->slu_unitcfg == IO_ILLEGAL_VALUE) { dev_err(&pci_dev->dev, "err: SLUID=%016llx\n", cd->slu_unitcfg); err = -EIO; goto out_err; } slu_id = genwqe_get_slu_id(cd); if (slu_id < GENWQE_SLU_ARCH_REQ || slu_id == 0xff) { dev_err(&pci_dev->dev, "err: incompatible SLU Architecture %u\n", slu_id); err = -ENOENT; goto out_err; } cd->app_unitcfg = __genwqe_readq(cd, IO_APP_UNITCFG); if (cd->app_unitcfg == IO_ILLEGAL_VALUE) { dev_err(&pci_dev->dev, "err: APPID=%016llx\n", cd->app_unitcfg); err = -EIO; goto out_err; } genwqe_read_app_id(cd, cd->app_name, sizeof(cd->app_name)); /* * Is access to all registers possible? If we are a VF the * answer is obvious. If we run fully virtualized, we need to * check if we can access all registers. If we do not have * full access we will cause an UR and some informational FIRs * in the PF, but that should not harm. */ if (pci_dev->is_virtfn) cd->is_privileged = 0; else cd->is_privileged = (__genwqe_readq(cd, IO_SLU_BITSTREAM) != IO_ILLEGAL_VALUE); out_err: return err; }