Lines Matching full:ipa
15 #include "ipa.h"
23 * DOC: IPA Immediate Commands
25 * The AP command TX endpoint is used to issue immediate commands to the IPA.
26 * An immediate command is generally used to request the IPA do something
74 /* For IPA v4.0+, the pipeline clear options are encoded in the opcode */
79 __le16 flags; /* Unused/reserved prior to IPA v4.0 */
83 __le32 clear_options; /* Unused/reserved for IPA v4.0+ */
87 /* The next field is present for IPA v4.0+ */
89 /* The next field is not present for IPA v4.0+ */
92 /* The next field and its values are not present for IPA v4.0+ */
98 u8 dest_endpoint; /* Full 8 bits used for IPA v5.0+ */
107 /* For IPA v4.0+, this opcode gets modified with pipeline clear options */
125 /* The next two fields are not present for IPA v4.0+ */
161 /* Prior to IPA v5.0, we supported no more than 32 endpoints,
163 * endpoint numbers. Starting with IPA v5.0, the widths of
172 bool ipa_cmd_table_init_valid(struct ipa *ipa, const struct ipa_mem *mem,
178 struct device *dev = ipa->dev;
181 size = route ? ipa->route_count : ipa->filter_count + 1;
194 ipa->mem_offset > offset_max - mem->offset) {
197 ipa->mem_offset, mem->offset, offset_max);
206 static bool ipa_cmd_header_init_local_valid(struct ipa *ipa)
208 struct device *dev = ipa->dev;
218 * that the entire range is within the overall IPA memory range.
226 mem = ipa_mem_find(ipa, IPA_MEM_MODEM_HEADER);
230 /* Make sure the offset fits in the IPA command */
231 if (offset > offset_max || ipa->mem_offset > offset_max - offset) {
234 ipa->mem_offset, offset, offset_max);
240 mem = ipa_mem_find(ipa, IPA_MEM_AP_HEADER);
244 /* Make sure the combined size fits in the IPA command */
256 static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa,
260 struct device *dev = ipa->dev;
265 * on the version of IPA. A 16 bit offset is always supported,
266 * but starting with IPA v4.0 some additional high-order bits are
270 if (ipa->version >= IPA_VERSION_4_0)
277 * the overall IPA memory range.
279 if (offset > offset_max || ipa->mem_offset > offset_max - offset) {
281 name, ipa->mem_offset, offset, offset_max);
289 static bool ipa_cmd_register_write_valid(struct ipa *ipa)
296 * offset will fit in a register write IPA immediate command.
298 if (ipa_table_hash_support(ipa)) {
299 if (ipa->version < IPA_VERSION_5_0)
300 reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH);
302 reg = ipa_reg(ipa, FILT_ROUT_CACHE_FLUSH);
306 if (!ipa_cmd_register_write_offset_valid(ipa, name, offset))
313 * using a register write IPA immediate command. Make sure the
317 reg = ipa_reg(ipa, ENDP_STATUS);
320 if (!ipa_cmd_register_write_offset_valid(ipa, name, offset))
349 ipa_cmd_payload_alloc(struct ipa *ipa, dma_addr_t *addr)
354 endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX];
355 trans_info = &ipa->gsi.channel[endpoint->channel_id].trans_info;
366 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
373 offset += ipa->mem_offset;
380 hash_offset += ipa->mem_offset;
387 cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
400 /* Initialize header space in IPA-local memory */
404 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
411 offset += ipa->mem_offset;
413 /* With this command we tell the IPA where in its local memory the
415 * also written via DMA into that space. The IPA hardware owns
418 cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
433 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
445 /* IPA v4.0+ represents the pipeline clear options in the opcode. It
449 if (ipa->version >= IPA_VERSION_4_0) {
474 cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
490 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
496 cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
499 if (ipa->version < IPA_VERSION_5_0) {
511 /* Use a DMA command to read or write a block of IPA-resident memory */
515 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
525 WARN_ON(offset > U16_MAX || ipa->mem_offset > U16_MAX - offset);
527 offset += ipa->mem_offset;
529 cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
532 /* payload->clear_after_read was reserved prior to IPA v4.0. It's
538 * direction: 0 = write to IPA, 1 read from IPA
555 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
561 cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
573 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
579 payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
588 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
592 reinit_completion(&ipa->completion);
597 /* Send a data packet through the IPA pipeline. The packet_init
599 * endpoint without any other IPA processing. The tag_status
605 endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
617 void ipa_cmd_pipeline_clear_wait(struct ipa *ipa)
619 wait_for_completion(&ipa->completion);
623 struct gsi_trans *ipa_cmd_trans_alloc(struct ipa *ipa, u32 tre_count)
630 endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX];
632 return gsi_channel_trans_alloc(&ipa->gsi, endpoint->channel_id,
637 int ipa_cmd_init(struct ipa *ipa)
641 if (!ipa_cmd_header_init_local_valid(ipa))
644 if (!ipa_cmd_register_write_valid(ipa))