diff options
Diffstat (limited to 'drivers/edgetpu/edgetpu-kci.h')
-rw-r--r-- | drivers/edgetpu/edgetpu-kci.h | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/drivers/edgetpu/edgetpu-kci.h b/drivers/edgetpu/edgetpu-kci.h index cc8bff3..2a2ff16 100644 --- a/drivers/edgetpu/edgetpu-kci.h +++ b/drivers/edgetpu/edgetpu-kci.h @@ -60,7 +60,11 @@ struct edgetpu_dma_descriptor { }; struct edgetpu_command_element { - u64 seq; /* set by edgetpu_kci_push_cmd() */ + /* + * Set by edgetpu_kci_push_cmd() in case of KCI cmd and copied from + * the RKCI cmd in case of RKCI response. + */ + u64 seq; u16 code; u16 reserved[3]; /* explicit padding, does not affect alignment */ struct edgetpu_dma_descriptor dma; @@ -72,7 +76,8 @@ struct edgetpu_kci_response_element { /* * Reserved for host use - firmware can't touch this. * If a value is written here it will be discarded and overwritten - * during response processing. + * during response processing. However, when repurposed as an RKCI + * command, the FW can set this field. */ u16 status; /* @@ -107,9 +112,16 @@ enum edgetpu_kci_code { KCI_CODE_OPEN_DEVICE = 9, KCI_CODE_CLOSE_DEVICE = 10, KCI_CODE_FIRMWARE_INFO = 11, - KCI_CODE_GET_USAGE = 12, + /* TODO(b/271372136): remove v1 when v1 firmware no longer in use. */ + KCI_CODE_GET_USAGE_V1 = 12, KCI_CODE_NOTIFY_THROTTLING = 13, KCI_CODE_BLOCK_BUS_SPEED_CONTROL = 14, + /* 15..18 not implemented in this branch */ + KCI_CODE_FIRMWARE_TRACING_LEVEL = 19, + /* 20 not implemented in this branch */ + KCI_CODE_GET_USAGE_V2 = 21, + + KCI_CODE_RKCI_ACK = 256, }; /* @@ -207,8 +219,8 @@ struct edgetpu_kci_device_group_detail { }; struct edgetpu_kci_open_device_detail { - /* The bit map of mailboxes to be opened. */ - u16 mailbox_map; + /* The client privilege level. */ + u16 client_priv; /* * Virtual context ID @mailbox_id is associated to. * For device groups with @mailbox_detachable attribute the mailbox attached to the group @@ -284,14 +296,6 @@ int edgetpu_kci_send_cmd(struct edgetpu_kci *kci, struct edgetpu_command_element *cmd); /* - * Sends the "Unmap Buffer Sync" command and waits for remote response. - * - * Returns the code of response, or a negative errno on error. - */ -int edgetpu_kci_unmap_buffer(struct edgetpu_kci *kci, tpu_addr_t tpu_addr, - u32 size, enum dma_data_direction dir); - -/* * Sends a FIRMWARE_INFO command and expects a response with a * edgetpu_fw_info struct filled out, including what firmware type is running, * along with build CL and time. @@ -377,7 +381,8 @@ int edgetpu_kci_get_debug_dump(struct edgetpu_kci *kci, tpu_addr_t tpu_addr, * You usually shouldn't call this directly - consider using * edgetpu_mailbox_activate() or edgetpu_mailbox_activate_bulk() instead. */ -int edgetpu_kci_open_device(struct edgetpu_kci *kci, u32 mailbox_map, s16 vcid, bool first_open); +int edgetpu_kci_open_device(struct edgetpu_kci *kci, u32 mailbox_map, u32 client_priv, s16 vcid, + bool first_open); /* * Inform the firmware that the VII mailboxes included in @mailbox_map are closed. @@ -405,4 +410,18 @@ int edgetpu_kci_notify_throttling(struct edgetpu_dev *etdev, u32 level); */ int edgetpu_kci_block_bus_speed_control(struct edgetpu_dev *etdev, bool block); +/* Set the firmware tracing level. */ +int edgetpu_kci_firmware_tracing_level(struct edgetpu_dev *etdev, unsigned long level, + unsigned long *active_level); + +/* + * Send an ack to the FW after handling a reverse KCI request. + * + * The FW may wait for a response from the kernel for an RKCI request so a + * response could be sent as an ack. + */ +int edgetpu_kci_resp_rkci_ack(struct edgetpu_dev *etdev, + struct edgetpu_kci_response_element *rkci_cmd); + + #endif /* __EDGETPU_KCI_H__ */ |