@@ -116,7 +116,7 @@ static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state);
116
116
static void ath10k_pci_htt_htc_rx_cb (struct ath10k_ce_pipe * ce_state );
117
117
static void ath10k_pci_pktlog_rx_cb (struct ath10k_ce_pipe * ce_state );
118
118
119
- static struct ce_attr host_ce_config_wlan [] = {
119
+ static const struct ce_attr pci_host_ce_config_wlan [] = {
120
120
/* CE0: host->target HTC control and raw streams */
121
121
{
122
122
.flags = CE_ATTR_FLAGS ,
@@ -222,7 +222,7 @@ static struct ce_attr host_ce_config_wlan[] = {
222
222
};
223
223
224
224
/* Target firmware's Copy Engine configuration. */
225
- static struct ce_pipe_config target_ce_config_wlan [] = {
225
+ static const struct ce_pipe_config pci_target_ce_config_wlan [] = {
226
226
/* CE0: host->target HTC control and raw streams */
227
227
{
228
228
.pipenum = __cpu_to_le32 (0 ),
@@ -335,7 +335,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = {
335
335
* This table is derived from the CE_PCI TABLE, above.
336
336
* It is passed to the Target at startup for use by firmware.
337
337
*/
338
- static struct service_to_pipe target_service_to_ce_map_wlan [] = {
338
+ static const struct ce_service_to_pipe pci_target_service_to_ce_map_wlan [] = {
339
339
{
340
340
__cpu_to_le32 (ATH10K_HTC_SVC_ID_WMI_DATA_VO ),
341
341
__cpu_to_le32 (PIPEDIR_OUT ), /* out = UL = host -> target */
@@ -1787,6 +1787,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
1787
1787
void ath10k_pci_hif_send_complete_check (struct ath10k * ar , u8 pipe ,
1788
1788
int force )
1789
1789
{
1790
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
1791
+
1790
1792
ath10k_dbg (ar , ATH10K_DBG_PCI , "pci hif send complete check\n" );
1791
1793
1792
1794
if (!force ) {
@@ -1804,7 +1806,7 @@ void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
1804
1806
* If at least 50% of the total resources are still available,
1805
1807
* don't bother checking again yet.
1806
1808
*/
1807
- if (resources > (host_ce_config_wlan [pipe ].src_nentries >> 1 ))
1809
+ if (resources > (ar_pci -> attr [pipe ].src_nentries >> 1 ))
1808
1810
return ;
1809
1811
}
1810
1812
ath10k_ce_per_engine_service (ar , pipe );
@@ -1820,14 +1822,15 @@ static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
1820
1822
int ath10k_pci_hif_map_service_to_pipe (struct ath10k * ar , u16 service_id ,
1821
1823
u8 * ul_pipe , u8 * dl_pipe )
1822
1824
{
1823
- const struct service_to_pipe * entry ;
1825
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
1826
+ const struct ce_service_to_pipe * entry ;
1824
1827
bool ul_set = false, dl_set = false;
1825
1828
int i ;
1826
1829
1827
1830
ath10k_dbg (ar , ATH10K_DBG_PCI , "pci hif map service\n" );
1828
1831
1829
- for (i = 0 ; i < ARRAY_SIZE (target_service_to_ce_map_wlan ); i ++ ) {
1830
- entry = & target_service_to_ce_map_wlan [i ];
1832
+ for (i = 0 ; i < ARRAY_SIZE (pci_target_service_to_ce_map_wlan ); i ++ ) {
1833
+ entry = & ar_pci -> serv_to_pipe [i ];
1831
1834
1832
1835
if (__le32_to_cpu (entry -> service_id ) != service_id )
1833
1836
continue ;
@@ -2316,6 +2319,7 @@ static int ath10k_bus_get_num_banks(struct ath10k *ar)
2316
2319
2317
2320
int ath10k_pci_init_config (struct ath10k * ar )
2318
2321
{
2322
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
2319
2323
u32 interconnect_targ_addr ;
2320
2324
u32 pcie_state_targ_addr = 0 ;
2321
2325
u32 pipe_cfg_targ_addr = 0 ;
@@ -2361,7 +2365,7 @@ int ath10k_pci_init_config(struct ath10k *ar)
2361
2365
}
2362
2366
2363
2367
ret = ath10k_pci_diag_write_mem (ar , pipe_cfg_targ_addr ,
2364
- target_ce_config_wlan ,
2368
+ ar_pci -> pipe_config ,
2365
2369
sizeof (struct ce_pipe_config ) *
2366
2370
NUM_TARGET_CE_CONFIG_WLAN );
2367
2371
@@ -2386,8 +2390,8 @@ int ath10k_pci_init_config(struct ath10k *ar)
2386
2390
}
2387
2391
2388
2392
ret = ath10k_pci_diag_write_mem (ar , svc_to_pipe_map ,
2389
- target_service_to_ce_map_wlan ,
2390
- sizeof (target_service_to_ce_map_wlan ));
2393
+ ar_pci -> serv_to_pipe ,
2394
+ sizeof (pci_target_service_to_ce_map_wlan ));
2391
2395
if (ret != 0 ) {
2392
2396
ath10k_err (ar , "Failed to write svc/pipe map: %d\n" , ret );
2393
2397
return ret ;
@@ -2459,23 +2463,24 @@ static void ath10k_pci_override_ce_config(struct ath10k *ar)
2459
2463
{
2460
2464
struct ce_attr * attr ;
2461
2465
struct ce_pipe_config * config ;
2466
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
2462
2467
2463
2468
/* For QCA6174 we're overriding the Copy Engine 5 configuration,
2464
2469
* since it is currently used for other feature.
2465
2470
*/
2466
2471
2467
2472
/* Override Host's Copy Engine 5 configuration */
2468
- attr = & host_ce_config_wlan [5 ];
2473
+ attr = & ar_pci -> attr [5 ];
2469
2474
attr -> src_sz_max = 0 ;
2470
2475
attr -> dest_nentries = 0 ;
2471
2476
2472
2477
/* Override Target firmware's Copy Engine configuration */
2473
- config = & target_ce_config_wlan [5 ];
2478
+ config = & ar_pci -> pipe_config [5 ];
2474
2479
config -> pipedir = __cpu_to_le32 (PIPEDIR_OUT );
2475
2480
config -> nbytes_max = __cpu_to_le32 (2048 );
2476
2481
2477
2482
/* Map from service/endpoint to Copy Engine */
2478
- target_service_to_ce_map_wlan [15 ].pipenum = __cpu_to_le32 (1 );
2483
+ ar_pci -> serv_to_pipe [15 ].pipenum = __cpu_to_le32 (1 );
2479
2484
}
2480
2485
2481
2486
int ath10k_pci_alloc_pipes (struct ath10k * ar )
@@ -2491,7 +2496,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar)
2491
2496
pipe -> pipe_num = i ;
2492
2497
pipe -> hif_ce_state = ar ;
2493
2498
2494
- ret = ath10k_ce_alloc_pipe (ar , i , & host_ce_config_wlan [i ]);
2499
+ ret = ath10k_ce_alloc_pipe (ar , i , & ar_pci -> attr [i ]);
2495
2500
if (ret ) {
2496
2501
ath10k_err (ar , "failed to allocate copy engine pipe %d: %d\n" ,
2497
2502
i , ret );
@@ -2504,7 +2509,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar)
2504
2509
continue ;
2505
2510
}
2506
2511
2507
- pipe -> buf_sz = (size_t )(host_ce_config_wlan [i ].src_sz_max );
2512
+ pipe -> buf_sz = (size_t )(ar_pci -> attr [i ].src_sz_max );
2508
2513
}
2509
2514
2510
2515
return 0 ;
@@ -2520,10 +2525,11 @@ void ath10k_pci_free_pipes(struct ath10k *ar)
2520
2525
2521
2526
int ath10k_pci_init_pipes (struct ath10k * ar )
2522
2527
{
2528
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
2523
2529
int i , ret ;
2524
2530
2525
2531
for (i = 0 ; i < CE_COUNT ; i ++ ) {
2526
- ret = ath10k_ce_init_pipe (ar , i , & host_ce_config_wlan [i ]);
2532
+ ret = ath10k_ce_init_pipe (ar , i , & ar_pci -> attr [i ]);
2527
2533
if (ret ) {
2528
2534
ath10k_err (ar , "failed to initialize copy engine pipe %d: %d\n" ,
2529
2535
i , ret );
@@ -3595,6 +3601,30 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3595
3601
3596
3602
timer_setup (& ar_pci -> ps_timer , ath10k_pci_ps_timer , 0 );
3597
3603
3604
+ ar_pci -> attr = kmemdup (pci_host_ce_config_wlan ,
3605
+ sizeof (pci_host_ce_config_wlan ),
3606
+ GFP_KERNEL );
3607
+ if (!ar_pci -> attr ) {
3608
+ ret = - ENOMEM ;
3609
+ goto err_free ;
3610
+ }
3611
+
3612
+ ar_pci -> pipe_config = kmemdup (pci_target_ce_config_wlan ,
3613
+ sizeof (pci_target_ce_config_wlan ),
3614
+ GFP_KERNEL );
3615
+ if (!ar_pci -> pipe_config ) {
3616
+ ret = - ENOMEM ;
3617
+ goto err_free ;
3618
+ }
3619
+
3620
+ ar_pci -> serv_to_pipe = kmemdup (pci_target_service_to_ce_map_wlan ,
3621
+ sizeof (pci_target_service_to_ce_map_wlan ),
3622
+ GFP_KERNEL );
3623
+ if (!ar_pci -> serv_to_pipe ) {
3624
+ ret = - ENOMEM ;
3625
+ goto err_free ;
3626
+ }
3627
+
3598
3628
ret = ath10k_pci_setup_resource (ar );
3599
3629
if (ret ) {
3600
3630
ath10k_err (ar , "failed to setup resource: %d\n" , ret );
@@ -3690,6 +3720,11 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3690
3720
err_core_destroy :
3691
3721
ath10k_core_destroy (ar );
3692
3722
3723
+ err_free :
3724
+ kfree (ar_pci -> attr );
3725
+ kfree (ar_pci -> pipe_config );
3726
+ kfree (ar_pci -> serv_to_pipe );
3727
+
3693
3728
return ret ;
3694
3729
}
3695
3730
@@ -3715,6 +3750,9 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
3715
3750
ath10k_pci_sleep_sync (ar );
3716
3751
ath10k_pci_release (ar );
3717
3752
ath10k_core_destroy (ar );
3753
+ kfree (ar_pci -> attr );
3754
+ kfree (ar_pci -> pipe_config );
3755
+ kfree (ar_pci -> serv_to_pipe );
3718
3756
}
3719
3757
3720
3758
MODULE_DEVICE_TABLE (pci , ath10k_pci_id_table );
0 commit comments