From 3dc420657621753f468e7a078c825ac06107f42f Mon Sep 17 00:00:00 2001 From: stsp Date: Fri, 30 Jul 2021 13:56:44 +0000 Subject: [PATCH] Remove an unused 320k bytes DMA memory allocation from iwx(4). This allocation was left over from code inherited from iwm(4) where it is used for transferring firmware code to the device. Devices supported by iwx(4) use an entirely different mechanism for loading firmware and don't need this allocation at all. Based on a patch by zxystd from the OpenIntelWireless project. --- sys/dev/pci/if_iwx.c | 20 ++------------------ sys/dev/pci/if_iwxvar.h | 9 +-------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 286c08c8731..6bc6333dadb 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.86 2021/07/29 12:13:58 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.87 2021/07/30 13:56:44 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -9319,7 +9319,6 @@ iwx_attach(struct device *parent, struct device *self, void *aux) case PCI_PRODUCT_INTEL_WL_22500_1: sc->sc_fwname = "iwx-cc-a0-63"; 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; @@ -9337,7 +9336,6 @@ iwx_attach(struct device *parent, struct device *self, void *aux) sc->sc_fwname = "iwx-QuZ-a0-hr-b0-63"; 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; @@ -9348,7 +9346,6 @@ iwx_attach(struct device *parent, struct device *self, void *aux) case PCI_PRODUCT_INTEL_WL_22500_4: sc->sc_fwname = "iwx-Qu-c0-hr-b0-63"; 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; @@ -9408,18 +9405,6 @@ iwx_attach(struct device *parent, struct device *self, void *aux) 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<= 0) fail3: 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); +fail1: iwx_dma_contig_free(&sc->ctxt_info_dma); return; } diff --git a/sys/dev/pci/if_iwxvar.h b/sys/dev/pci/if_iwxvar.h index beff2648cf6..e8c9640db69 100644 --- a/sys/dev/pci/if_iwxvar.h +++ b/sys/dev/pci/if_iwxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwxvar.h,v 1.20 2021/07/29 12:01:04 stsp Exp $ */ +/* $OpenBSD: if_iwxvar.h,v 1.21 2021/07/30 13:56:44 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh @@ -124,10 +124,6 @@ struct iwx_tx_radiotap_header { (1 << IEEE80211_RADIOTAP_CHANNEL)) #define IWX_UCODE_SECT_MAX 48 -#define IWX_FWDMASEGSZ (192*1024) -#define IWX_FWDMASEGSZ_8000 (320*1024) -/* sanity check value */ -#define IWX_FWMAXSIZE (2*1024*1024) /* * fw_status is used to determine if we've already parsed the firmware file @@ -521,8 +517,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; @@ -558,7 +552,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; -- 2.20.1