Lines Matching refs:nvm

111 	const u8 *buf = sw->nvm->buf;  in nvm_validate_and_write()
118 image_size = sw->nvm->buf_data_size; in nvm_validate_and_write()
265 if (!sw->nvm->buf) { in tb_switch_nvm_write()
266 sw->nvm->buf = vmalloc(NVM_MAX_SIZE); in tb_switch_nvm_write()
267 if (!sw->nvm->buf) { in tb_switch_nvm_write()
273 sw->nvm->buf_data_size = offset + bytes; in tb_switch_nvm_write()
274 memcpy(sw->nvm->buf + offset, val, bytes); in tb_switch_nvm_write()
313 struct tb_switch_nvm *nvm; in tb_switch_nvm_add() local
320 nvm = kzalloc(sizeof(*nvm), GFP_KERNEL); in tb_switch_nvm_add()
321 if (!nvm) in tb_switch_nvm_add()
324 nvm->id = ida_simple_get(&nvm_ida, 0, 0, GFP_KERNEL); in tb_switch_nvm_add()
348 nvm->major = val >> 16; in tb_switch_nvm_add()
349 nvm->minor = val >> 8; in tb_switch_nvm_add()
351 nvm_dev = register_nvmem(sw, nvm->id, nvm_size, true); in tb_switch_nvm_add()
356 nvm->active = nvm_dev; in tb_switch_nvm_add()
359 nvm_dev = register_nvmem(sw, nvm->id, NVM_MAX_SIZE, false); in tb_switch_nvm_add()
364 nvm->non_active = nvm_dev; in tb_switch_nvm_add()
367 sw->nvm = nvm; in tb_switch_nvm_add()
373 if (nvm->active) in tb_switch_nvm_add()
374 nvmem_unregister(nvm->active); in tb_switch_nvm_add()
376 ida_simple_remove(&nvm_ida, nvm->id); in tb_switch_nvm_add()
377 kfree(nvm); in tb_switch_nvm_add()
384 struct tb_switch_nvm *nvm; in tb_switch_nvm_remove() local
387 nvm = sw->nvm; in tb_switch_nvm_remove()
388 sw->nvm = NULL; in tb_switch_nvm_remove()
391 if (!nvm) in tb_switch_nvm_remove()
395 if (!nvm->authenticating) in tb_switch_nvm_remove()
398 nvmem_unregister(nvm->non_active); in tb_switch_nvm_remove()
399 if (nvm->active) in tb_switch_nvm_remove()
400 nvmem_unregister(nvm->active); in tb_switch_nvm_remove()
401 ida_simple_remove(&nvm_ida, nvm->id); in tb_switch_nvm_remove()
402 vfree(nvm->buf); in tb_switch_nvm_remove()
403 kfree(nvm); in tb_switch_nvm_remove()
888 if (!sw->nvm) { in nvm_authenticate_store()
901 if (!sw->nvm->buf) { in nvm_authenticate_store()
914 sw->nvm->authenticating = true; in nvm_authenticate_store()
944 else if (!sw->nvm) in nvm_version_show()
947 ret = sprintf(buf, "%x.%x\n", sw->nvm->major, sw->nvm->minor); in nvm_version_show()