Source
struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, const void *buffer,
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Thunderbolt driver - control channel and configuration commands
*
* Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com>
* Copyright (C) 2018, Intel Corporation
*/
/* control channel */
struct tb_ctl;
typedef bool (*event_cb)(void *data, enum tb_cfg_pkg_type type,
const void *buf, size_t size);
struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, event_cb cb, void *cb_data);
void tb_ctl_start(struct tb_ctl *ctl);
void tb_ctl_stop(struct tb_ctl *ctl);
void tb_ctl_free(struct tb_ctl *ctl);
/* configuration commands */
/* msec */
struct tb_cfg_result {
u64 response_route;
u32 response_port; /*
* If err = 1 then this is the port that send the
* error.
* If err = 0 and if this was a cfg_read/write then
* this is the the upstream port of the responding
* switch.
* Otherwise the field is set to zero.
*/
int err; /* negative errors, 0 for success, 1 for tb errors */
enum tb_cfg_error tb_error; /* valid if err == 1 */
};
struct ctl_pkg {
struct tb_ctl *ctl;
void *buffer;
struct ring_frame frame;
};
/**
* struct tb_cfg_request - Control channel request
* @kref: Reference count
* @ctl: Pointer to the control channel structure. Only set when the
* request is queued.
* @request_size: Size of the request packet (in bytes)
* @request_type: Type of the request packet
* @response: Response is stored here
* @response_size: Maximum size of one response packet
* @response_type: Expected type of the response packet
* @npackets: Number of packets expected to be returned with this request