On Fri, Apr 02, 2021 at 06:26:11PM +0800, zxystd wrote:
> It is not a functionality change. The firmware dma is not actually used and 
> it is due to ported from iwm, this patch remove this allocation.

Thanks! I have committed a slightly tweaked version, renaming the final
goto label only. I'm sorry that it took me so long to get around to this.

> By the way, firmware monitor code is not ported done and not work, right?

I don't think the firmware monitor is needed if you don't intend to
debug or reverse-engineer the firmware.

> Index: sys/dev/pci/if_iwx.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_iwx.c,v
> retrieving revision 1.50
> diff -u -p -u -r1.50 if_iwx.c
> --- sys/dev/pci/if_iwx.c 17 Mar 2021 15:59:27 -0000 1.50
> +++ sys/dev/pci/if_iwx.c 2 Apr 2021 05:31:06 -0000
> @@ -7928,7 +7928,6 @@ iwx_attach(struct device *parent, struct
>   case PCI_PRODUCT_INTEL_WL_22500_1:
>   sc->sc_fwname = "iwx-cc-a0-48";
>   sc->sc_device_family = IWX_DEVICE_FAMILY_22000;
> - sc->sc_fwdmasegsz = IWX_FWDMASEGSZ_8000;
>   sc->sc_integrated = 1;
>   sc->sc_ltr_delay = IWX_SOC_FLAGS_LTR_APPLY_DELAY_NONE;
>   sc->sc_low_latency_xtal = 0;
> @@ -7945,7 +7944,6 @@ iwx_attach(struct device *parent, struct
>  
>   sc->sc_fwname = "iwx-QuZ-a0-hr-b0-48";
>   sc->sc_device_family = IWX_DEVICE_FAMILY_22000;
> - sc->sc_fwdmasegsz = IWX_FWDMASEGSZ_8000;
>   sc->sc_integrated = 1;
>   sc->sc_ltr_delay = IWX_SOC_FLAGS_LTR_APPLY_DELAY_200;
>   sc->sc_low_latency_xtal = 0;
> @@ -7956,7 +7954,6 @@ iwx_attach(struct device *parent, struct
>   case PCI_PRODUCT_INTEL_WL_22500_4:
>       sc->sc_fwname = "iwx-Qu-c0-hr-b0-48";
>       sc->sc_device_family = IWX_DEVICE_FAMILY_22000;
> -     sc->sc_fwdmasegsz = IWX_FWDMASEGSZ_8000;
>       sc->sc_integrated = 1;
>       sc->sc_ltr_delay = IWX_SOC_FLAGS_LTR_APPLY_DELAY_200;
>       sc->sc_low_latency_xtal = 0;
> @@ -8016,24 +8013,12 @@ iwx_attach(struct device *parent, struct
>   return;
>   }
>  
> - /* 
> - * Allocate DMA memory for firmware transfers.
> - * Must be aligned on a 16-byte boundary.
> - */
> - err = iwx_dma_contig_alloc(sc->sc_dmat, &sc->fw_dma,
> -     sc->sc_fwdmasegsz, 16);
> - if (err) {
> - printf("%s: could not allocate memory for firmware transfers\n",
> -     DEVNAME(sc));
> - goto fail0;
> - }
> -
>   /* Allocate interrupt cause table (ICT).*/
>   err = iwx_dma_contig_alloc(sc->sc_dmat, &sc->ict_dma,
>       IWX_ICT_SIZE, 1<<IWX_ICT_PADDR_SHIFT);
>   if (err) {
>   printf("%s: could not allocate ICT table\n", DEVNAME(sc));
> - goto fail1;
> + goto fail0;
>   }
>  
>   /* TX scheduler rings must be aligned on a 1KB boundary. */
> @@ -8042,7 +8027,7 @@ iwx_attach(struct device *parent, struct
>   if (err) {
>   printf("%s: could not allocate TX scheduler rings\n",
>       DEVNAME(sc));
> - goto fail3;
> + goto fail1;
>   }
>  
>   for (txq_i = 0; txq_i < nitems(sc->txq); txq_i++) {
> @@ -8050,19 +8035,19 @@ iwx_attach(struct device *parent, struct
>   if (err) {
>   printf("%s: could not allocate TX ring %d\n",
>       DEVNAME(sc), txq_i);
> - goto fail4;
> + goto fail2;
>   }
>   }
>  
>   err = iwx_alloc_rx_ring(sc, &sc->rxq);
>   if (err) {
>   printf("%s: could not allocate RX ring\n", DEVNAME(sc));
> - goto fail4;
> + goto fail2;
>   }
>  
>   sc->sc_nswq = taskq_create("iwxns", 1, IPL_NET, 0);
>   if (sc->sc_nswq == NULL)
> - goto fail4;
> + goto fail2;
>  
>   ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
>   ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */
> @@ -8141,14 +8126,13 @@ iwx_attach(struct device *parent, struct
>  
>   return;
>  
> -fail4: while (--txq_i >= 0)
> +fail2: while (--txq_i >= 0)
>   iwx_free_tx_ring(sc, &sc->txq[txq_i]);
>   iwx_free_rx_ring(sc, &sc->rxq);
>   iwx_dma_contig_free(&sc->sched_dma);
> -fail3: if (sc->ict_dma.vaddr != NULL)
> +fail1: if (sc->ict_dma.vaddr != NULL)
>   iwx_dma_contig_free(&sc->ict_dma);
>   
> -fail1: iwx_dma_contig_free(&sc->fw_dma);
>  fail0: iwx_dma_contig_free(&sc->ctxt_info_dma);
>   return;
>  }
> Index: sys/dev/pci/if_iwxvar.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_iwxvar.h,v
> retrieving revision 1.13
> diff -u -p -u -r1.13 if_iwxvar.h
> --- sys/dev/pci/if_iwxvar.h 11 Oct 2020 07:05:28 -0000 1.13
> +++ sys/dev/pci/if_iwxvar.h 2 Apr 2021 05:31:06 -0000
> @@ -124,8 +124,6 @@ struct iwx_tx_radiotap_header {
>   (1 << IEEE80211_RADIOTAP_CHANNEL))
>  
>  #define IWX_UCODE_SECT_MAX 42
> -#define IWX_FWDMASEGSZ (192*1024)
> -#define IWX_FWDMASEGSZ_8000 (320*1024)
>  /* sanity check value */
>  #define IWX_FWMAXSIZE (2*1024*1024)
>  
> @@ -401,8 +399,6 @@ struct iwx_softc {
>  #define IWX_DEVICE_FAMILY_22000 1
>  #define IWX_DEVICE_FAMILY_22560 2
>  
> - struct iwx_dma_info fw_dma;
> -
>   struct iwx_dma_info ctxt_info_dma;
>   struct iwx_self_init_dram init_dram;
>  
> @@ -438,7 +434,6 @@ struct iwx_softc {
>   int sc_cap_off; /* PCIe caps */
>  
>   const char *sc_fwname;
> - bus_size_t sc_fwdmasegsz;
>   struct iwx_fw_info sc_fw;
>   struct iwx_dma_info fw_mon;
>   int sc_fw_phy_config;

Reply via email to