/* * Thunderbolt Cactus Ridge driver - switch/port utility functions * * Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com> */#include<linux/delay.h>#include<linux/idr.h>#include<linux/nvmem-provider.h>#include<linux/sizes.h>#include<linux/slab.h>#include<linux/vmalloc.h>#include"tb.h"/* Switch authorization from userspace is serialized by this lock */staticDEFINE_MUTEX(switch_lock);/* Switch NVM support */#define NVM_DEVID 0x05#define NVM_VERSION 0x08#define NVM_CSS 0x10#define NVM_FLASH_SIZE 0x45#define NVM_MIN_SIZE SZ_32K#define NVM_MAX_SIZE SZ_512KstaticDEFINE_IDA(nvm_ida);structnvm_auth_status{structlist_headlist;uuid_tuuid;u32status;};/* * Hold NVM authentication failure status per switch This information * needs to stay around even when the switch gets power cycled so we * keep it separately. */staticLIST_HEAD(nvm_auth_status_cache);staticDEF