1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ 2 /* 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * Copyright(c) 2018 Intel Corporation. All rights reserved. 7 * 8 * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> 9 */ 10 11 #ifndef __SOUND_SOC_SOF_PRIV_H 12 #define __SOUND_SOC_SOF_PRIV_H 13 14 #include <linux/device.h> 15 16 #include <sound/hdaudio.h> 17 #include <sound/soc.h> 18 19 #include <sound/sof.h> 20 #include <sound/sof/stream.h> /* needs to be included before control.h */ 21 #include <sound/sof/control.h> 22 #include <sound/sof/dai.h> 23 #include <sound/sof/info.h> 24 #include <sound/sof/pm.h> 25 #include <sound/sof/topology.h> 26 #include <sound/sof/trace.h> 27 28 #include <uapi/sound/sof/fw.h> 29 30 /* debug flags */ 31 #define SOF_DBG_REGS BIT(1) 32 #define SOF_DBG_MBOX BIT(2) 33 #define SOF_DBG_TEXT BIT(3) 34 #define SOF_DBG_PCI BIT(4) 35 36 /* max BARs mmaped devices can use */ 37 #define SND_SOF_BARS 8 38 39 /* time in ms for runtime suspend delay */ 40 #define SND_SOF_SUSPEND_DELAY_MS 2000 41 42 /* DMA buffer size for trace */ 43 #define DMA_BUF_SIZE_FOR_TRACE (PAGE_SIZE * 16) 44 45 /* max number of FE PCMs before BEs */ 46 #define SOF_BE_PCM_BASE 16 47 48 #define SOF_IPC_DSP_REPLY 0 49 #define SOF_IPC_HOST_REPLY 1 50 51 /* convenience constructor for DAI driver streams */ 52 #define SOF_DAI_STREAM(sname, scmin, scmax, srates, sfmt) \ 53 {.stream_name = sname, .channels_min = scmin, .channels_max = scmax, \ 54 .rates = srates, .formats = sfmt} 55 56 #define SOF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \ 57 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_FLOAT) 58 59 struct snd_sof_dev; 60 struct snd_sof_ipc_msg; 61 struct snd_sof_ipc; 62 struct snd_sof_debugfs_map; 63 struct snd_soc_tplg_ops; 64 struct snd_soc_component; 65 struct snd_sof_pdata; 66 67 /* 68 * SOF DSP HW abstraction operations. 69 * Used to abstract DSP HW architecture and any IO busses between host CPU 70 * and DSP device(s). 71 */ 72 struct snd_sof_dsp_ops { 73 74 /* probe and remove */ 75 int (*probe)(struct snd_sof_dev *sof_dev); /* mandatory */ 76 int (*remove)(struct snd_sof_dev *sof_dev); /* optional */ 77 78 /* DSP core boot / reset */ 79 int (*run)(struct snd_sof_dev *sof_dev); /* mandatory */ 80 int (*stall)(struct snd_sof_dev *sof_dev); /* optional */ 81 int (*reset)(struct snd_sof_dev *sof_dev); /* optional */ 82 int (*core_power_up)(struct snd_sof_dev *sof_dev, 83 unsigned int core_mask); /* optional */ 84 int (*core_power_down)(struct snd_sof_dev *sof_dev, 85 unsigned int core_mask); /* optional */ 86 87 /* 88 * Register IO: only used by respective drivers themselves, 89 * TODO: consider removing these operations and calling respective 90 * implementations directly 91 */ 92 void (*write)(struct snd_sof_dev *sof_dev, void __iomem *addr, 93 u32 value); /* optional */ 94 u32 (*read)(struct snd_sof_dev *sof_dev, 95 void __iomem *addr); /* optional */ 96 void (*write64)(struct snd_sof_dev *sof_dev, void __iomem *addr, 97 u64 value); /* optional */ 98 u64 (*read64)(struct snd_sof_dev *sof_dev, 99 void __iomem *addr); /* optional */ 100 101 /* memcpy IO */ 102 void (*block_read)(struct snd_sof_dev *sof_dev, u32 bar, 103 u32 offset, void *dest, 104 size_t size); /* mandatory */ 105 void (*block_write)(struct snd_sof_dev *sof_dev, u32 bar, 106 u32 offset, void *src, 107 size_t size); /* mandatory */ 108 109 /* doorbell */ 110 irqreturn_t (*irq_handler)(int irq, void *context); /* optional */ 111 irqreturn_t (*irq_thread)(int irq, void *context); /* optional */ 112 113 /* ipc */ 114 int (*send_msg)(struct snd_sof_dev *sof_dev, 115 struct snd_sof_ipc_msg *msg); /* mandatory */ 116 117 /* FW loading */ 118 int (*load_firmware)(struct snd_sof_dev *sof_dev); /* mandatory */ 119 int (*load_module)(struct snd_sof_dev *sof_dev, 120 struct snd_sof_mod_hdr *hdr); /* optional */ 121 /* 122 * FW ready checks for ABI compatibility and creates 123 * memory windows at first boot 124 */ 125 int (*fw_ready)(struct snd_sof_dev *sdev, u32 msg_id); /* optional */ 126 127 /* connect pcm substream to a host stream */ 128 int (*pcm_open)(struct snd_sof_dev *sdev, 129 struct snd_pcm_substream *substream); /* optional */ 130 /* disconnect pcm substream to a host stream */ 131 int (*pcm_close)(struct snd_sof_dev *sdev, 132 struct snd_pcm_substream *substream); /* optional */ 133 134 /* host stream hw params */ 135 int (*pcm_hw_params)(struct snd_sof_dev *sdev, 136 struct snd_pcm_substream *substream, 137 struct snd_pcm_hw_params *params, 138 struct sof_ipc_stream_params *ipc_params); /* optional */ 139 140 /* host stream trigger */ 141 int (*pcm_trigger)(struct snd_sof_dev *sdev, 142 struct snd_pcm_substream *substream, 143 int cmd); /* optional */ 144 145 /* host stream pointer */ 146 snd_pcm_uframes_t (*pcm_pointer)(struct snd_sof_dev *sdev, 147 struct snd_pcm_substream *substream); /* optional */ 148 149 /* host read DSP stream data */ 150 void (*ipc_msg_data)(struct snd_sof_dev *sdev, 151 struct snd_pcm_substream *substream, 152 void *p, size_t sz); /* mandatory */ 153 154 /* host configure DSP HW parameters */ 155 int (*ipc_pcm_params)(struct snd_sof_dev *sdev, 156 struct snd_pcm_substream *substream, 157 const struct sof_ipc_pcm_params_reply *reply); /* mandatory */ 158 159 /* pre/post firmware run */ 160 int (*pre_fw_run)(struct snd_sof_dev *sof_dev); /* optional */ 161 int (*post_fw_run)(struct snd_sof_dev *sof_dev); /* optional */ 162 163 /* DSP PM */ 164 int (*suspend)(struct snd_sof_dev *sof_dev, int state); /* optional */ 165 int (*resume)(struct snd_sof_dev *sof_dev); /* optional */ 166 int (*runtime_suspend)(struct snd_sof_dev *sof_dev, 167 int state); /* optional */ 168 int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */ 169 void (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */ 170 171 /* DSP clocking */ 172 int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq); /* optional */ 173 174 /* debug */ 175 const struct snd_sof_debugfs_map *debug_map; /* optional */ 176 int debug_map_count; /* optional */ 177 void (*dbg_dump)(struct snd_sof_dev *sof_dev, 178 u32 flags); /* optional */ 179 void (*ipc_dump)(struct snd_sof_dev *sof_dev); /* optional */ 180 181 /* host DMA trace initialization */ 182 int (*trace_init)(struct snd_sof_dev *sdev, 183 u32 *stream_tag); /* optional */ 184 int (*trace_release)(struct snd_sof_dev *sdev); /* optional */ 185 int (*trace_trigger)(struct snd_sof_dev *sdev, 186 int cmd); /* optional */ 187 188 /* DAI ops */ 189 struct snd_soc_dai_driver *drv; 190 int num_drv; 191 }; 192 193 /* DSP architecture specific callbacks for oops and stack dumps */ 194 struct sof_arch_ops { 195 void (*dsp_oops)(struct snd_sof_dev *sdev, void *oops); 196 void (*dsp_stack)(struct snd_sof_dev *sdev, void *oops, 197 u32 *stack, u32 stack_words); 198 }; 199 200 #define sof_arch_ops(sdev) ((sdev)->pdata->desc->arch_ops) 201 202 /* DSP device HW descriptor mapping between bus ID and ops */ 203 struct sof_ops_table { 204 const struct sof_dev_desc *desc; 205 const struct snd_sof_dsp_ops *ops; 206 }; 207 208 enum sof_dfsentry_type { 209 SOF_DFSENTRY_TYPE_IOMEM = 0, 210 SOF_DFSENTRY_TYPE_BUF, 211 }; 212 213 enum sof_debugfs_access_type { 214 SOF_DEBUGFS_ACCESS_ALWAYS = 0, 215 SOF_DEBUGFS_ACCESS_D0_ONLY, 216 }; 217 218 /* FS entry for debug files that can expose DSP memories, registers */ 219 struct snd_sof_dfsentry { 220 struct dentry *dfsentry; 221 size_t size; 222 enum sof_dfsentry_type type; 223 /* 224 * access_type specifies if the 225 * memory -> DSP resource (memory, register etc) is always accessible 226 * or if it is accessible only when the DSP is in D0. 227 */ 228 enum sof_debugfs_access_type access_type; 229 #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE) 230 char *cache_buf; /* buffer to cache the contents of debugfs memory */ 231 #endif 232 struct snd_sof_dev *sdev; 233 struct list_head list; /* list in sdev dfsentry list */ 234 union { 235 void __iomem *io_mem; 236 void *buf; 237 }; 238 }; 239 240 /* Debug mapping for any DSP memory or registers that can used for debug */ 241 struct snd_sof_debugfs_map { 242 const char *name; 243 u32 bar; 244 u32 offset; 245 u32 size; 246 /* 247 * access_type specifies if the memory is always accessible 248 * or if it is accessible only when the DSP is in D0. 249 */ 250 enum sof_debugfs_access_type access_type; 251 }; 252 253 /* mailbox descriptor, used for host <-> DSP IPC */ 254 struct snd_sof_mailbox { 255 u32 offset; 256 size_t size; 257 }; 258 259 /* IPC message descriptor for host <-> DSP IO */ 260 struct snd_sof_ipc_msg { 261 /* message data */ 262 u32 header; 263 void *msg_data; 264 void *reply_data; 265 size_t msg_size; 266 size_t reply_size; 267 int reply_error; 268 269 wait_queue_head_t waitq; 270 bool ipc_complete; 271 }; 272 273 /* PCM stream, mapped to FW component */ 274 struct snd_sof_pcm_stream { 275 u32 comp_id; 276 struct snd_dma_buffer page_table; 277 struct sof_ipc_stream_posn posn; 278 struct snd_pcm_substream *substream; 279 struct work_struct period_elapsed_work; 280 }; 281 282 /* ALSA SOF PCM device */ 283 struct snd_sof_pcm { 284 struct snd_sof_dev *sdev; 285 struct snd_soc_tplg_pcm pcm; 286 struct snd_sof_pcm_stream stream[2]; 287 struct list_head list; /* list in sdev pcm list */ 288 struct snd_pcm_hw_params params[2]; 289 int hw_params_upon_resume[2]; /* set up hw_params upon resume */ 290 }; 291 292 /* ALSA SOF Kcontrol device */ 293 struct snd_sof_control { 294 struct snd_sof_dev *sdev; 295 int comp_id; 296 int num_channels; 297 u32 readback_offset; /* offset to mmaped data if used */ 298 struct sof_ipc_ctrl_data *control_data; 299 u32 size; /* cdata size */ 300 enum sof_ipc_ctrl_cmd cmd; 301 u32 *volume_table; /* volume table computed from tlv data*/ 302 303 struct list_head list; /* list in sdev control list */ 304 }; 305 306 /* ASoC SOF DAPM widget */ 307 struct snd_sof_widget { 308 struct snd_sof_dev *sdev; 309 int comp_id; 310 int pipeline_id; 311 int complete; 312 int id; 313 314 struct snd_soc_dapm_widget *widget; 315 struct list_head list; /* list in sdev widget list */ 316 317 void *private; /* core does not touch this */ 318 }; 319 320 /* ASoC SOF DAPM route */ 321 struct snd_sof_route { 322 struct snd_sof_dev *sdev; 323 324 struct snd_soc_dapm_route *route; 325 struct list_head list; /* list in sdev route list */ 326 327 void *private; 328 }; 329 330 /* ASoC DAI device */ 331 struct snd_sof_dai { 332 struct snd_sof_dev *sdev; 333 const char *name; 334 335 struct sof_ipc_comp_dai comp_dai; 336 struct sof_ipc_dai_config *dai_config; 337 struct list_head list; /* list in sdev dai list */ 338 }; 339 340 /* 341 * SOF Device Level. 342 */ 343 struct snd_sof_dev { 344 struct device *dev; 345 spinlock_t ipc_lock; /* lock for IPC users */ 346 spinlock_t hw_lock; /* lock for HW IO access */ 347 348 /* 349 * ASoC components. plat_drv fields are set dynamically so 350 * can't use const 351 */ 352 struct snd_soc_component_driver plat_drv; 353 354 /* DSP firmware boot */ 355 wait_queue_head_t boot_wait; 356 u32 boot_complete; 357 u32 first_boot; 358 359 /* work queue in case the probe is implemented in two steps */ 360 struct work_struct probe_work; 361 362 /* DSP HW differentiation */ 363 struct snd_sof_pdata *pdata; 364 365 /* IPC */ 366 struct snd_sof_ipc *ipc; 367 struct snd_sof_mailbox dsp_box; /* DSP initiated IPC */ 368 struct snd_sof_mailbox host_box; /* Host initiated IPC */ 369 struct snd_sof_mailbox stream_box; /* Stream position update */ 370 struct snd_sof_ipc_msg *msg; 371 int ipc_irq; 372 u32 next_comp_id; /* monotonic - reset during S3 */ 373 374 /* memory bases for mmaped DSPs - set by dsp_init() */ 375 void __iomem *bar[SND_SOF_BARS]; /* DSP base address */ 376 int mmio_bar; 377 int mailbox_bar; 378 size_t dsp_oops_offset; 379 380 /* debug */ 381 struct dentry *debugfs_root; 382 struct list_head dfsentry_list; 383 384 /* firmware loader */ 385 struct snd_dma_buffer dmab; 386 struct snd_dma_buffer dmab_bdl; 387 struct sof_ipc_fw_ready fw_ready; 388 struct sof_ipc_fw_version fw_version; 389 390 /* topology */ 391 struct snd_soc_tplg_ops *tplg_ops; 392 struct list_head pcm_list; 393 struct list_head kcontrol_list; 394 struct list_head widget_list; 395 struct list_head dai_list; 396 struct list_head route_list; 397 struct snd_soc_component *component; 398 u32 enabled_cores_mask; /* keep track of enabled cores */ 399 400 /* FW configuration */ 401 struct sof_ipc_dma_buffer_data *info_buffer; 402 struct sof_ipc_window *info_window; 403 404 /* IPC timeouts in ms */ 405 int ipc_timeout; 406 int boot_timeout; 407 408 /* Wait queue for code loading */ 409 wait_queue_head_t waitq; 410 int code_loading; 411 412 /* DMA for Trace */ 413 struct snd_dma_buffer dmatb; 414 struct snd_dma_buffer dmatp; 415 int dma_trace_pages; 416 wait_queue_head_t trace_sleep; 417 u32 host_offset; 418 u32 dtrace_is_enabled; 419 u32 dtrace_error; 420 u32 msi_enabled; 421 422 void *private; /* core does not touch this */ 423 }; 424 425 /* 426 * Device Level. 427 */ 428 429 int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data); 430 int snd_sof_device_remove(struct device *dev); 431 432 int snd_sof_runtime_suspend(struct device *dev); 433 int snd_sof_runtime_resume(struct device *dev); 434 int snd_sof_resume(struct device *dev); 435 int snd_sof_suspend(struct device *dev); 436 437 void snd_sof_new_platform_drv(struct snd_sof_dev *sdev); 438 439 int snd_sof_create_page_table(struct snd_sof_dev *sdev, 440 struct snd_dma_buffer *dmab, 441 unsigned char *page_table, size_t size); 442 443 /* 444 * Firmware loading. 445 */ 446 int snd_sof_load_firmware(struct snd_sof_dev *sdev); 447 int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev); 448 int snd_sof_load_firmware_memcpy(struct snd_sof_dev *sdev); 449 int snd_sof_run_firmware(struct snd_sof_dev *sdev); 450 int snd_sof_parse_module_memcpy(struct snd_sof_dev *sdev, 451 struct snd_sof_mod_hdr *module); 452 void snd_sof_fw_unload(struct snd_sof_dev *sdev); 453 int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset); 454 455 /* 456 * IPC low level APIs. 457 */ 458 struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev); 459 void snd_sof_ipc_free(struct snd_sof_dev *sdev); 460 int snd_sof_ipc_reply(struct snd_sof_dev *sdev, u32 msg_id); 461 void snd_sof_ipc_msgs_rx(struct snd_sof_dev *sdev); 462 int snd_sof_ipc_stream_pcm_params(struct snd_sof_dev *sdev, 463 struct sof_ipc_pcm_params *params); 464 int snd_sof_dsp_mailbox_init(struct snd_sof_dev *sdev, u32 dspbox, 465 size_t dspbox_size, u32 hostbox, 466 size_t hostbox_size); 467 int snd_sof_ipc_valid(struct snd_sof_dev *sdev); 468 int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header, 469 void *msg_data, size_t msg_bytes, void *reply_data, 470 size_t reply_bytes); 471 struct snd_sof_widget *snd_sof_find_swidget(struct snd_sof_dev *sdev, 472 const char *name); 473 struct snd_sof_widget *snd_sof_find_swidget_sname(struct snd_sof_dev *sdev, 474 const char *pcm_name, 475 int dir); 476 struct snd_sof_dai *snd_sof_find_dai(struct snd_sof_dev *sdev, 477 const char *name); 478 479 static inline 480 struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_sof_dev *sdev, 481 struct snd_soc_pcm_runtime *rtd) 482 { 483 struct snd_sof_pcm *spcm = NULL; 484 485 list_for_each_entry(spcm, &sdev->pcm_list, list) { 486 if (le32_to_cpu(spcm->pcm.dai_id) == rtd->dai_link->id) 487 return spcm; 488 } 489 490 return NULL; 491 } 492 493 struct snd_sof_pcm *snd_sof_find_spcm_name(struct snd_sof_dev *sdev, 494 const char *name); 495 struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev, 496 unsigned int comp_id, 497 int *direction); 498 struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev, 499 unsigned int pcm_id); 500 void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream); 501 502 /* 503 * Stream IPC 504 */ 505 int snd_sof_ipc_stream_posn(struct snd_sof_dev *sdev, 506 struct snd_sof_pcm *spcm, int direction, 507 struct sof_ipc_stream_posn *posn); 508 509 /* 510 * Mixer IPC 511 */ 512 int snd_sof_ipc_set_get_comp_data(struct snd_sof_ipc *ipc, 513 struct snd_sof_control *scontrol, u32 ipc_cmd, 514 enum sof_ipc_ctrl_type ctrl_type, 515 enum sof_ipc_ctrl_cmd ctrl_cmd, 516 bool send); 517 518 /* 519 * Topology. 520 * There is no snd_sof_free_topology since topology components will 521 * be freed by snd_soc_unregister_component, 522 */ 523 int snd_sof_init_topology(struct snd_sof_dev *sdev, 524 struct snd_soc_tplg_ops *ops); 525 int snd_sof_load_topology(struct snd_sof_dev *sdev, const char *file); 526 int snd_sof_complete_pipeline(struct snd_sof_dev *sdev, 527 struct snd_sof_widget *swidget); 528 529 int sof_load_pipeline_ipc(struct snd_sof_dev *sdev, 530 struct sof_ipc_pipe_new *pipeline, 531 struct sof_ipc_comp_reply *r); 532 533 /* 534 * Trace/debug 535 */ 536 int snd_sof_init_trace(struct snd_sof_dev *sdev); 537 void snd_sof_release_trace(struct snd_sof_dev *sdev); 538 void snd_sof_free_trace(struct snd_sof_dev *sdev); 539 int snd_sof_dbg_init(struct snd_sof_dev *sdev); 540 void snd_sof_free_debug(struct snd_sof_dev *sdev); 541 int snd_sof_debugfs_io_item(struct snd_sof_dev *sdev, 542 void __iomem *base, size_t size, 543 const char *name, 544 enum sof_debugfs_access_type access_type); 545 int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev, 546 void *base, size_t size, 547 const char *name); 548 int snd_sof_trace_update_pos(struct snd_sof_dev *sdev, 549 struct sof_ipc_dma_trace_posn *posn); 550 void snd_sof_trace_notify_for_error(struct snd_sof_dev *sdev); 551 void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code, 552 u32 tracep_code, void *oops, 553 struct sof_ipc_panic_info *panic_info, 554 void *stack, size_t stack_words); 555 int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev); 556 557 /* 558 * Platform specific ops. 559 */ 560 extern struct snd_compr_ops sof_compressed_ops; 561 562 /* 563 * Kcontrols. 564 */ 565 566 int snd_sof_volume_get(struct snd_kcontrol *kcontrol, 567 struct snd_ctl_elem_value *ucontrol); 568 int snd_sof_volume_put(struct snd_kcontrol *kcontrol, 569 struct snd_ctl_elem_value *ucontrol); 570 int snd_sof_switch_get(struct snd_kcontrol *kcontrol, 571 struct snd_ctl_elem_value *ucontrol); 572 int snd_sof_switch_put(struct snd_kcontrol *kcontrol, 573 struct snd_ctl_elem_value *ucontrol); 574 int snd_sof_enum_get(struct snd_kcontrol *kcontrol, 575 struct snd_ctl_elem_value *ucontrol); 576 int snd_sof_enum_put(struct snd_kcontrol *kcontrol, 577 struct snd_ctl_elem_value *ucontrol); 578 int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, 579 struct snd_ctl_elem_value *ucontrol); 580 int snd_sof_bytes_put(struct snd_kcontrol *kcontrol, 581 struct snd_ctl_elem_value *ucontrol); 582 int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol, 583 const unsigned int __user *binary_data, 584 unsigned int size); 585 int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, 586 unsigned int __user *binary_data, 587 unsigned int size); 588 589 /* 590 * DSP Architectures. 591 */ 592 static inline void sof_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack, 593 u32 stack_words) 594 { 595 if (sof_arch_ops(sdev)->dsp_stack) 596 sof_arch_ops(sdev)->dsp_stack(sdev, oops, stack, stack_words); 597 } 598 599 static inline void sof_oops(struct snd_sof_dev *sdev, void *oops) 600 { 601 if (sof_arch_ops(sdev)->dsp_oops) 602 sof_arch_ops(sdev)->dsp_oops(sdev, oops); 603 } 604 605 extern const struct sof_arch_ops sof_xtensa_arch_ops; 606 607 /* 608 * Utilities 609 */ 610 void sof_io_write(struct snd_sof_dev *sdev, void __iomem *addr, u32 value); 611 void sof_io_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value); 612 u32 sof_io_read(struct snd_sof_dev *sdev, void __iomem *addr); 613 u64 sof_io_read64(struct snd_sof_dev *sdev, void __iomem *addr); 614 void sof_mailbox_write(struct snd_sof_dev *sdev, u32 offset, 615 void *message, size_t bytes); 616 void sof_mailbox_read(struct snd_sof_dev *sdev, u32 offset, 617 void *message, size_t bytes); 618 void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src, 619 size_t size); 620 void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest, 621 size_t size); 622 623 void intel_ipc_msg_data(struct snd_sof_dev *sdev, 624 struct snd_pcm_substream *substream, 625 void *p, size_t sz); 626 int intel_ipc_pcm_params(struct snd_sof_dev *sdev, 627 struct snd_pcm_substream *substream, 628 const struct sof_ipc_pcm_params_reply *reply); 629 630 int intel_pcm_open(struct snd_sof_dev *sdev, 631 struct snd_pcm_substream *substream); 632 int intel_pcm_close(struct snd_sof_dev *sdev, 633 struct snd_pcm_substream *substream); 634 635 #endif 636