// SPDX-License-Identifier: GPL-2.0 /* * Thunderbolt driver - capabilities lookup * * Copyright (c) 2014 Andreas Noever <[email protected]> * Copyright (C) 2018, Intel Corporation */ #include <linux/slab.h> #include <linux/errno.h> #include "tb.h" #define CAP_OFFSET_MAX … #define VSE_CAP_OFFSET_MAX … #define TMU_ACCESS_EN … static int tb_port_enable_tmu(struct tb_port *port, bool enable) { … } static void tb_port_dummy_read(struct tb_port *port) { … } /** * tb_port_next_cap() - Return next capability in the linked list * @port: Port to find the capability for * @offset: Previous capability offset (%0 for start) * * Returns dword offset of the next capability in port config space * capability list and returns it. Passing %0 returns the first entry in * the capability list. If no next capability is found returns %0. In case * of failure returns negative errno. */ int tb_port_next_cap(struct tb_port *port, unsigned int offset) { … } static int __tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap) { … } /** * tb_port_find_cap() - Find port capability * @port: Port to find the capability for * @cap: Capability to look * * Returns offset to start of capability or %-ENOENT if no such * capability was found. Negative errno is returned if there was an * error. */ int tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap) { … } /** * tb_switch_next_cap() - Return next capability in the linked list * @sw: Switch to find the capability for * @offset: Previous capability offset (%0 for start) * * Finds dword offset of the next capability in router config space * capability list and returns it. Passing %0 returns the first entry in * the capability list. If no next capability is found returns %0. In case * of failure returns negative errno. */ int tb_switch_next_cap(struct tb_switch *sw, unsigned int offset) { … } /** * tb_switch_find_cap() - Find switch capability * @sw: Switch to find the capability for * @cap: Capability to look * * Returns offset to start of capability or %-ENOENT if no such * capability was found. Negative errno is returned if there was an * error. */ int tb_switch_find_cap(struct tb_switch *sw, enum tb_switch_cap cap) { … } /** * tb_switch_find_vse_cap() - Find switch vendor specific capability * @sw: Switch to find the capability for * @vsec: Vendor specific capability to look * * Functions enumerates vendor specific capabilities (VSEC) of a switch * and returns offset when capability matching @vsec is found. If no * such capability is found returns %-ENOENT. In case of error returns * negative errno. */ int tb_switch_find_vse_cap(struct tb_switch *sw, enum tb_switch_vse_cap vsec) { … }