struct opal_dev {
bool supported;
+ bool mbr_enabled;
void *data;
sec_send_recv *send_recv;
return true;
}
+static bool check_mbrenabled(const void *data)
+{
+ const struct d0_locking_features *lfeat = data;
+ u8 sup_feat = lfeat->supported_features;
+
+ return !!(sup_feat & MBR_ENABLED_MASK);
+}
+
static bool check_sum(const void *data)
{
const struct d0_single_user_mode *sum = data;
u32 hlen = be32_to_cpu(hdr->length);
print_buffer(dev->resp, hlen);
+ dev->mbr_enabled = false;
if (hlen > IO_BUFFER_LENGTH - sizeof(*hdr)) {
pr_debug("Discovery length overflows buffer (%zu+%u)/%u\n",
check_geometry(dev, body);
break;
case FC_LOCKING:
+ dev->mbr_enabled = check_mbrenabled(body->features);
+ break;
case FC_ENTERPRISE:
case FC_DATASTORE:
/* some ignored properties */
return next(dev);
}
+static int __opal_set_mbr_done(struct opal_dev *dev, struct opal_key *key)
+{
+ u8 mbr_done_tf = 1;
+ const struct opal_step mbrdone_step [] = {
+ { opal_discovery0, },
+ { start_admin1LSP_opal_session, key },
+ { set_mbr_done, &mbr_done_tf },
+ { end_opal_session, },
+ { NULL, }
+ };
+
+ dev->steps = mbrdone_step;
+ return next(dev);
+}
+
static int opal_lock_unlock(struct opal_dev *dev,
struct opal_lock_unlock *lk_unlk)
{
suspend->unlk.session.sum);
was_failure = true;
}
+ if (dev->mbr_enabled) {
+ ret = __opal_set_mbr_done(dev, &suspend->unlk.session.opal_key);
+ if (ret)
+ pr_debug("Failed to set MBR Done in S3 resume\n");
+ }
}
mutex_unlock(&dev->dev_lock);
return was_failure;