From: Jim C. <jim...@gm...> - 2012-05-08 17:14:18
|
hi Oliver, heres another batch, with a mix of stuff: - unused proto removal - random style cleanups - add some statics, move callees before callers (in create*desc*queue) - ifndef guards against multiple inclusion - refactoring of rx/tx.host/buf data in struct acx_device - work towards USB-only config - streamlining of acx_allocate, free These include the patches that didnt make it into your last merge session, rebased. 0001-mem.c-if0-unused-acxmem_create_rx_host_desc_queue.patch 0002-merge-acx-mem-pci-_create_desc_queues.patch 0003-merge-clean-out-commented-fn-protos.patch 0004-merge.c-update-comments.patch 0005-rewrap-comments-reindent-to-help-sdiffing.patch 0006-cleanup-remove-d-forward-decl-fn-protos.patch 0007-cleanup-drop-if0d-functions-and-their-comments.patch 0008-mem.c-fix-stray-acxmem_advance_txdesc-ref.patch 0009-merge.h-put-static-inline-in-fn-proto-line.patch 0010-merge.c-drop-if0d-funcs.patch 0011-merge-fix-no-mem-build-probs.patch 0012-mem.c-newline-before-fn-body-open-brace.patch 0013-merge.c-comment-wrap-whitespace.patch 1st acx_device refactor. These could be squashed together, esp 14-18, See commit msgs for why I didnt. 0014-desc-pair-start-factoring-tx-desc-fields-into-struct.patch 0015-desc-pair-add-txhostdesc_start-into-struct-tx_desc_p.patch 0016-desc_pair-add-3-tx-size-fields-into-struct-tx_desc_p.patch 0017-desc-pair-add-dma_addr_t-fields-to-struct-tx_desc_pa.patch 0018-desc-pair-add-txdesc_start-field-to-struct-tx-desc-r.patch 0019-desc-pair-factor-rx-desc-fields-out-of-acx_device-in.patch 0020-fixup-drop-if0-from-desc-pair-patches.patch 0021-merge.-ch-step-towards-USB-only-compile.patch 0022-common.c-add-ifdefs-to-disable-field-refs-for-USB-on.patch 0023-mem.h-add-ifdef-guard-and-MEM-stub-functions.patch 0024-mem-inlines.h-add-ifndef-guard.patch 0025-merge.h-add-ifndef-guard-stubs.patch 0026-mem-inlines.h-add-notes-re-inclusion.patch 2nd acx_device refactor. This uses an anonymous union, which I think is a GCC extension, and which might be problematic for very old compilers, probably too old to worry about. 28,29 arguably should be adjusted, 29's changes are by script given in 28, I didnt feel like explaining in english whats pretty clear in code. I probably could fix it to do 100% of changes, not leave manual tweaks at end, but I think/hope its once and done, so not worth automating completely. 0027-merge.ch-cleanup-create-desc-routines-make-helpers-s.patch 0028-desc-info-refactor-txdesc_t-and-rxdesc_t-to-extract-.patch 0029-field-refs-for-previous-struct-changes.patch 0030-merge.c-trim-acx_allocate-to-leverage-desc_info-refa.patch |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:19
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mem.c b/mem.c index deb426a..ca8fe5e 100644 --- a/mem.c +++ b/mem.c @@ -535,6 +535,7 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, * plus 32 bytes safety offset at the end */ //static +#if 0 // acxmem_create_rx_host_desc_queue() int acxmem_create_rx_host_desc_queue(acx_device_t *adev) { rxhostdesc_t *hostdesc; @@ -588,6 +589,7 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) FN_EXIT1(NOT_OK); return NOT_OK; } +#endif // acxmem_create_rx_host_desc_queue() /* * In the generic slave memory access mode, most of the stuff in -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:20
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 117 ++--------------------------------------------------------------- pci.c | 99 ------------------------------------------------------- 2 files changed, 3 insertions(+), 213 deletions(-) diff --git a/mem.c b/mem.c index 952330b..d4d909b 100644 --- a/mem.c +++ b/mem.c @@ -107,128 +107,17 @@ * ================================================== */ -// Logging -// static void acxmem_log_rxbuffer(const acx_device_t *adev); -// static void acxmem_log_txbuffer(acx_device_t *adev); #if DUMP_MEM_DEFINED > 0 //= static void acxmem_dump_mem(acx_device_t *adev, u32 start, int length); #endif -// Data Access -//= static -void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); -//= static -//- void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count); -//=static -//- void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count); -//=static -//- void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); - -// int acxmem_create_hostdesc_queues(acx_device_t *adev); -// static -//- int acxmem_create_rx_host_desc_queue(acx_device_t *adev); -// static -//= int acxmem_create_tx_host_desc_queue(acx_device_t *adev); -//- void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, u32 rx_queue_start); -//=STATick void acxmem_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); -//= STATick void acxmem_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start); -//= void acxmem_free_desc_queues(acx_device_t *adev); -//= STATick void acxmem_delete_dma_regions(acx_device_t *adev); -//= STATick void *acxmem_allocate(acx_device_t *adev, size_t size, dma_addr_t *phy, const char *msg); - -// Firmware, EEPROM, Phy -//= int acxmem_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -#ifdef UNUSED -//- int acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, const u8 *charbuf); -#endif -//- STATick inline void acxmem_read_eeprom_area(acx_device_t *adev); -//- int acxmem_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -//=int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); -//STATick -//- int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -//static -//- int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -//- STATick int acxmem_upload_fw(acx_device_t *adev); - -#if defined(NONESSENTIAL_FEATURES) -//- STATick void acx_show_card_eeprom_id(acx_device_t *adev); -#endif +void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, + u32 source, int count); -// CMDs (Control Path) -//- int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char* cmdstr); -//- STATick inline void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//= u32 acxmem_read_cmd_type_status(acx_device_t *adev); -//- STATick inline void acxmem_init_mboxes(acx_device_t *adev); - -// Init, Configure (Control Path) -//=int acxmem_reset_dev(acx_device_t *adev); -//- STATick int acxmem_verify_init(acx_device_t *adev); -//- STATick int acxmem_complete_hw_reset(acx_device_t *adev); -//- STATick void acxmem_reset_mac(acx_device_t *adev); -//= STATick void acxmem_up(struct ieee80211_hw *hw); -//static void acxmem_i_set_multicast_list(struct net_device *ndev); - -// Other (Control Path) - -// Proc, Debug -//- int acxmem_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//= char *acxmem_proc_eeprom_output(int *len, acx_device_t *adev); - -// Rx Path -//- STATick void acxmem_process_rxdesc(acx_device_t *adev); - -// Tx Path -//- tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len); -//- void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque); - -//- void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque); -//- static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int //- len); -//- STATick u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); -//- STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr); static void acxmem_init_acx_txbuf(acx_device_t *adev); -//= static void acxmem_init_acx_txbuf2(acx_device_t *adev); -//- STATick inline txdesc_t *acxmem_get_txdesc(acx_device_t *adev, int index); -// static inline -//= txdesc_t *acxmem_advance_txdesc(acx_device_t *adev, txdesc_t* txdesc, int inc); txhostdesc_t *acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc); - -//= void acxmem_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct ieee80211_tx_info *info, struct sk_buff *skb); -//- unsigned int acxmem_tx_clean_txdesc(acx_device_t *adev); -//= void acxmem_clean_txdesc_emergency(acx_device_t *adev); - -//- void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -//- int acx100mem_set_tx_level(acx_device_t *adev, u8 level_dbm); -//static void acxmem_i_tx_timeout(struct net_device *ndev); - -// Irq Handling, Timer -//= STATick void acxmem_irq_enable(acx_device_t *adev); -//= STATick void acxmem_irq_disable(acx_device_t *adev); -//=void acxmem_irq_work(struct work_struct *work); -// STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//= STATick void acxmem_handle_info_irq(acx_device_t *adev); -//= void acxmem_set_interrupt_mask(acx_device_t *adev); - -// Helpers -//- void acxmem_power_led(acx_device_t *adev, int enable); -//- INLINE_IO int acxmem_adev_present(acx_device_t *adev); -STATick char acxmem_printable(char c); -//static void update_link_quality_led(acx_device_t *adev); - -// Ioctls -//int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -//int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); - -// Driver, Module -//- STATick int __devinit acxmem_probe(struct platform_device *pdev); -//- STATick int __devexit acxmem_remove(struct platform_device *pdev); -#ifdef CONFIG_PM -//- STATick int acxmem_e_suspend(struct platform_device *pdev, pm_message_t state); -//- STATick int acxmem_e_resume(struct platform_device *pdev); -#endif -//- int __init acxmem_init_module(void); -//- void __exit acxmem_cleanup_module(void); +char acxmem_printable(char c); /* * BOM Defines, static vars, etc. diff --git a/pci.c b/pci.c index 1116e8e..67d5ea6 100644 --- a/pci.c +++ b/pci.c @@ -70,110 +70,11 @@ * ================================================== */ -// Logging -// static void acxpci_log_rxbuffer(const acx_device_t * adev); -// static void acxpci_log_txbuffer(acx_device_t * adev); - -// Data Access - -// int acxpci_create_hostdesc_queues(acx_device_t * adev); -//static -//- int acxpci_create_rx_host_desc_queue(acx_device_t * adev); -//static -//- int acxpci_create_tx_host_desc_queue(acx_device_t * adev); - -//- void acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, u32 rx_queue_start); -//= static void acxpci_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start); -//= static void acxpci_create_tx_desc_queue(acx_device_t * adev, u32 tx_queue_start); - -//= void acxpci_free_desc_queues(acx_device_t * adev); -//= static void acxpci_delete_dma_regions(acx_device_t * adev); -//=static inline -//- void acxpci_free_coherent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); -//= static void *acxpci_allocate(acx_device_t * adev, size_t size, dma_addr_t * phy, const char *msg); - -// Firmware, EEPROM, Phy -//=int acxpci_read_eeprom_byte(acx_device_t * adev, u32 addr, u8 * charbuf); -// int acxpci_s_write_eeprom(acx_device_t * adev, u32 addr, u32 len, const u8 * charbuf); -//= static inline void acxpci_read_eeprom_area(acx_device_t * adev); -//int acxpci_read_phy_reg(acx_device_t * adev, u32 reg, u8 * charbuf); -//=int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value); -// static -//- int acxpci_write_fw(acx_device_t * adev, const firmware_image_t *fw_image, u32 offset); -// static -//- int acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, u32 offset); -//= static int acxpci_upload_fw(acx_device_t * adev); -// static void acx_show_card_eeprom_id(acx_device_t * adev); - -// CMDs (Control Path) -//- int acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char *cmdstr); -//=static inline void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status); -//= static -//- u32 acxpci_read_cmd_type_status(acx_device_t *adev); -//= static inline void acxpci_init_mboxes(acx_device_t * adev); - -// Init, Configuration (Control Path) -//- int acxpci_reset_dev(acx_device_t * adev); -//= static int acxpci_verify_init(acx_device_t * adev); -//= static void acxpci_reset_mac(acx_device_t * adev); -//= static void acxpci_up(struct ieee80211_hw *hw); - -// Other (Control Path) - -// Proc, Debug -//- int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//=char *acxpci_proc_eeprom_output(int *len, acx_device_t * adev); - -// Rx Path -//= static void acxpci_process_rxdesc(acx_device_t * adev); - -// Tx Path -//- tx_t *acxpci_alloc_tx(acx_device_t * adev); -//= void *acxpci_get_txbuf(acx_device_t * adev, tx_t * tx_opaque); -//- void acxpci_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct ieee80211_tx_info *info, struct sk_buff *skb); -//= unsigned int acxpci_tx_clean_txdesc(acx_device_t * adev); -//=void acxpci_clean_txdesc_emergency(acx_device_t * adev); -//= static inline txdesc_t *acxpci_get_txdesc(acx_device_t * adev, int index); -// static inline -//= txdesc_t *acxpci_advance_txdesc(acx_device_t * adev, txdesc_t * txdesc, int inc); -//= static txhostdesc_t *acxpci_get_txhostdesc(acx_device_t * adev, txdesc_t * txdesc); - -// Irq Handling, Timer -//= static void acxpci_irq_enable(acx_device_t * adev); -//= static void acxpci_irq_disable(acx_device_t * adev); -//=void acxpci_irq_work(struct work_struct *work); -// static irqreturn_t acxpci_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//= static void acxpci_handle_info_irq(acx_device_t * adev); -//= void acxpci_set_interrupt_mask(acx_device_t * adev); - -// Helpers -//- void acxpci_power_led(acx_device_t * adev, int enable); -//- INLINE_IO int acxpci_adev_present(acx_device_t *adev); - -// Ioctls -//- int acx111pci_ioctl_info(struct net_device *ndev, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -//- int acx100pci_ioctl_set_phy_amp_bias(struct net_device *ndev, struct //- iw_request_info *info, struct iw_param *vwrq, char *extra); - -// Driver, Module -#ifdef CONFIG_PCI -//= static int __devinit acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id); -//= static void __devexit acxpci_remove(struct pci_dev *pdev); -#ifdef CONFIG_PM -//= static int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state); -//= static int acxpci_e_resume(struct pci_dev *pdev); -#endif // CONFIG_PM -#endif // CONFIG_PCI - #ifdef CONFIG_VLYNQ static int vlynq_probe(struct vlynq_device *vdev, struct vlynq_device_id *id); static void vlynq_remove(struct vlynq_device *vdev); #endif // CONFIG_VLYNQ -//- int __init acxpci_init_module(void); -//- void __exit acxpci_cleanup_module(void); - - /* * BOM Defines, static vars, etc. * ================================================== -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:22
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.h | 103 ++++++---------------------------------------------------------- pci.h | 75 ++++++----------------------------------------- 2 files changed, 19 insertions(+), 159 deletions(-) diff --git a/mem.h b/mem.h index 5c6c0ec..17c8bad 100644 --- a/mem.h +++ b/mem.h @@ -1,12 +1,9 @@ -/* purpose of this file is to aid in unification of appropriate - * functions from mem.c and pci.c into merge.c. It borrows fn-sigs - * from pci.c, and changes them from static to public to suppress - * warnings like: - - warning: 'acxpci_op_stop' declared 'static' but never defined [-Wunused-function] - Later, we'll drop it. -*/ +/* this file provides prototypes for functions defined in mem.c that + * are used by common.c etc, and is thus the internal API. It also + * forward declares some of the functions used in mem.c, reducing the + * set of forward declarations in mem.c + */ #define STATick /* ick: suppress static, let linker find fns in mem.o pci.o */ @@ -14,13 +11,11 @@ #define DUMP_MEM_DEFINED 1 // to insure export of dump* fns too // Logging -//- STATick void acxmem_log_rxbuffer(const acx_device_t *adev); -//- STATick void acxmem_log_txbuffer(acx_device_t *adev); + #if DUMP_MEM_DEFINED > 0 void acxmem_dump_mem(acx_device_t *adev, u32 start, int length); #endif -//- STATick void acxmem_copy_from_slavemem(acx_device_t *adev, u8 //- *destination, u32 source, int count); void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count); void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, @@ -28,121 +23,43 @@ void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); -//- int acxmem_create_hostdesc_queues(acx_device_t *adev); -//- STATick int acxmem_create_rx_host_desc_queue(acx_device_t *adev); -//- STATick int acxmem_create_tx_host_desc_queue(acx_device_t *adev); -//! void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, -//! u32 rx_queue_start); -//- STATick void acxmem_create_rx_desc_queue(acx_device_t *adev, u32 //- rx_queue_start); -//- STATick void acxmem_create_tx_desc_queue(acx_device_t *adev, u32 //- tx_queue_start); -//- void acxmem_free_desc_queues(acx_device_t *adev); -//- STATick void acxmem_delete_dma_regions(acx_device_t *adev); -//- STATick void *acxmem_allocate(acx_device_t *adev, size_t size, dma_addr_t *phy, const char *msg); - // Firmware, EEPROM, Phy + int acxmem_upload_radio(acx_device_t *adev); -//- int acxmem_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -//- #ifdef UNUSED -//- int acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, const u8 //- *charbuf); -//- #endif -//- STATick inline void acxmem_read_eeprom_area(acx_device_t *adev); -//- int acxmem_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -//- int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); + int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -//a int acxmem_upload_fw(acx_device_t *adev); -//- -#if defined(NONESSENTIAL_FEATURES) -//- STATick void acx_show_card_eeprom_id(acx_device_t *adev); -#endif // CMDs (Control Path) -//- int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, -//- void *buffer, unsigned buflen, -//- unsigned cmd_timeout, const char *cmdstr); - -// STATick inline void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//= copied to merge.c -//= STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev); - -// Init, Configure (Control Path) -//= int acxmem_reset_dev(acx_device_t *adev); -//= STATick int acxmem_verify_init(acx_device_t *adev); -// STATick int acxmem_complete_hw_reset(acx_device_t *adev); void acxmem_reset_mac(acx_device_t *adev); -// STATick void acxmem_up(struct ieee80211_hw *hw); -//STATick void acxmem_i_set_multicast_list(struct net_device *ndev); // Other (Control Path) // Proc, Debug int acxmem_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//- char *acxmem_proc_eeprom_output(int *len, acx_device_t *adev); // Rx Path -//= STATick void acxmem_process_rxdesc(acx_device_t *adev); - // Tx Path tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len); void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque); -//- void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque); -//= STATick int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len); u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); -//= STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr); -//= STATick void acxmem_init_acx_txbuf(acx_device_t *adev); -void acxmem_init_acx_txbuf2(acx_device_t *adev); -//= STATick inline txdesc_t *acxmem_get_txdesc(acx_device_t *adev, int index); -//- STATick inline txdesc_t *acxmem_advance_txdesc(acx_device_t *adev, txdesc_t *txdesc, int inc); -//= STATick txhostdesc_t *acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc); -//- void acxmem_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct //- ieee80211_tx_info *info, struct sk_buff *skb); -//- unsigned int acxmem_tx_clean_txdesc(acx_device_t *adev); -//- void acxmem_clean_txdesc_emergency(acx_device_t *adev); +void acxmem_init_acx_txbuf2(acx_device_t *adev); void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -//- int acx100mem_set_tx_level(acx_device_t *adev, u8 level_dbm); -//STATick void acxmem_i_tx_timeout(struct net_device *ndev); // Irq Handling, Timer -//= STATick void acxmem_irq_enable(acx_device_t *adev); -//= STATick void acxmem_irq_disable(acx_device_t *adev); -//- void acxmem_irq_work(struct work_struct *work); -// STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//- STATick void acxmem_handle_info_irq(acx_device_t *adev); -//- void acxmem_set_interrupt_mask(acx_device_t *adev); - // Helpers -//- void acxmem_power_led(acx_device_t *adev, int enable); -// INLINE_IO int acxmem_adev_present(acx_device_t *adev); -//= STATick char acxmem_printable(char c); -//STATick void update_link_quality_led(acx_device_t *adev); - // Ioctls -//int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -//int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); - // Driver, Module -//= STATick int __devinit acxmem_probe(struct platform_device *pdev); -//= STATick int __devexit acxmem_remove(struct platform_device *pdev); -#ifdef CONFIG_PM -//= STATick int acxmem_e_suspend(struct platform_device *pdev, pm_message_t state); -//= STATick int acxmem_e_resume(struct platform_device *pdev); -#endif + int __init acxmem_init_module(void); void __exit acxmem_cleanup_module(void); -// for merge of tx_data -//- u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); - -// for merge of acx_reset_dev -//- void acxmem_reset_mac(acx_device_t *adev); -//- u32 acxmem_read_cmd_type_status(acx_device_t *adev); void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acxmem_init_mboxes(acx_device_t *adev); -//- inline void acxmem_init_mboxes(acx_device_t *adev); diff --git a/pci.h b/pci.h index ca0c0d9..eca8a7f 100644 --- a/pci.h +++ b/pci.h @@ -1,115 +1,58 @@ -/* purpose of this file is to aid in unification of appropriate - * functions from mem.c and pci.c into merge.c. It borrows fn-sigs - * from pci.c, and changes them from static to public to suppress - * warnings like: - - warning: 'acxpci_op_stop' declared 'static' but never defined [-Wunused-function] - Later, we'll drop it. -*/ +/* This file provides prototypes for functions defined in pci.c which + * are used by common.c etc. It also forward declares functions + * inside pci.c, thus reducing set of forward declarations needed there. + */ #define STATick /* ick - suppress static, and thus a raft of warnings let linker find the fns in mem.o, pci.o */ // Logging -//= STATick void acxpci_log_rxbuffer(const acx_device_t *adev); -//= STATick void acxpci_log_txbuffer(acx_device_t *adev); - -//=int acxpci_create_hostdesc_queues(acx_device_t *adev); -//= STATick int acxpci_create_rx_host_desc_queue(acx_device_t *adev); -//=STATick int acxpci_create_tx_host_desc_queue(acx_device_t *adev); - -//! void acxpci_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, -//! u32 rx_queue_start); -//=STATick void acxpci_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); -//= STATick void acxpci_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start); -//= void acxpci_free_desc_queues(acx_device_t *adev); -//- STATick void acxpci_delete_dma_regions(acx_device_t *adev); void acxpci_free_coherent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); -//= STATick void *acxpci_allocate(acx_device_t *adev, size_t size, dma_addr_t *phy, const char *msg); // Firmware, EEPROM, Phy int acxpci_upload_radio(acx_device_t *adev); -//- int acxpci_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -// int acxpci_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, const u8 *charbuf); -//- STATick inline void acxpci_read_eeprom_area(acx_device_t *adev); -//- int acxpci_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -//- int acxpci_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); + int acxpci_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxpci_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxpci_upload_fw(acx_device_t *adev); -// STATick void acx_show_card_eeprom_id(acx_device_t *adev); // CMDs (Control Path) int acxpci_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char *cmdstr); -// coplied to merge.c -// STATick inline void acxpci_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//- STATick u32 acxpci_read_cmd_type_status(acx_device_t *adev); + void acxpci_init_mboxes(acx_device_t *adev); // Init, Configuration (Control Path) int acxpci_reset_dev(acx_device_t *adev); -//= STATick int acxpci_verify_init(acx_device_t *adev); void acxpci_reset_mac(acx_device_t *adev); -//- STATick void acxpci_up(struct ieee80211_hw *hw); // Other (Control Path) // Proc, Debug int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//- char *acxpci_proc_eeprom_output(int *len, acx_device_t *adev); // Rx Path -//- STATick void acxpci_process_rxdesc(acx_device_t *adev); - // Tx Path tx_t *acxpci_alloc_tx(acx_device_t *adev); -//- void *acxpci_get_txbuf(acx_device_t *adev, tx_t *tx_opaque); -//- void acxpci_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct //- ieee80211_tx_info *info, struct sk_buff *skb); -//- unsigned int acxpci_tx_clean_txdesc(acx_device_t *adev); -//- void acxpci_clean_txdesc_emergency(acx_device_t *adev); -//- //= STATick inline txdesc_t *acxpci_get_txdesc(acx_device_t *adev, int //- index); -//= STATick inline txdesc_t *acxpci_advance_txdesc(acx_device_t *adev, txdesc_t *txdesc, int inc); -//- STATick txhostdesc_t *acxpci_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc); // Irq Handling, Timer -//- STATick void acxpci_irq_enable(acx_device_t *adev); -//- STATick void acxpci_irq_disable(acx_device_t *adev); -//- void acxpci_irq_work(struct work_struct *work); -//- // STATick irqreturn_t acxpci_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//- STATick void acxpci_handle_info_irq(acx_device_t *adev); -//- void acxpci_set_interrupt_mask(acx_device_t *adev); -//- + // Helpers void acxpci_power_led(acx_device_t *adev, int enable); -// INLINE_IO int acxpci_adev_present(acx_device_t *adev); // Ioctls -//- int acx111pci_ioctl_info(struct net_device *ndev, struct iw_request_info //- *info, struct iw_param *vwrq, char *extra); -//- int acx100pci_ioctl_set_phy_amp_bias(struct net_device *ndev, struct iw_request_info *info, struct iw_param *vwrq, char *extra); - // Driver, Module -//- STATick int __devinit acxpci_probe(struct pci_dev *pdev, const struct //- pci_device_id *id); -//- STATick void __devexit acxpci_remove(struct pci_dev *pdev); -//- #ifdef CONFIG_PM -//- STATick int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state); -//- STATick int acxpci_e_resume(struct pci_dev *pdev); -//- #endif -//- + int __init acxpci_init_module(void); void __exit acxpci_cleanup_module(void); -//- -//- // for merge of acx_reset_dev + void acxpci_reset_mac(acx_device_t *adev); u32 acxpci_read_cmd_type_status(acx_device_t *adev); void acxpci_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//- void acxpci_init_mboxes(acx_device_t *adev); -//- -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:20
|
Merge 2 fns together in merge.c, #if0 old fn-defns in mem.c, pci.c, fix 4 calls (and fold 2 of them together) in common.c, //! fn-protos in mem.h, pci.h Signed-off-by: Jim Cromie <jim...@gm...> --- common.c | 9 +++------ mem.c | 4 ++-- mem.h | 4 ++-- merge.c | 24 ++++++++++++++++++++++++ merge.h | 3 +++ pci.c | 3 ++- pci.h | 4 ++-- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/common.c b/common.c index 382fd1a..b247b52 100644 --- a/common.c +++ b/common.c @@ -1109,7 +1109,7 @@ static int acx100_create_dma_regions(acx_device_t * adev) /* sets the beginning of the rx descriptor queue, after the tx descrs */ if (OK != acx_create_hostdesc_queues(adev)) goto fail; - acxpci_create_desc_queues(adev, tx_queue_start, rx_queue_start); + acx_create_desc_queues(adev, tx_queue_start, rx_queue_start); } #ifdef CONFIG_ACX_MAC80211_MEM else if (IS_MEM(adev)) { @@ -1119,7 +1119,7 @@ static int acx100_create_dma_regions(acx_device_t * adev) if (OK != acx_create_hostdesc_queues(adev)) goto fail; - acxmem_create_desc_queues(adev, tx_queue_start, rx_queue_start); + acx_create_desc_queues(adev, tx_queue_start, rx_queue_start); } #endif @@ -1242,10 +1242,7 @@ static int acx111_create_dma_regions(acx_device_t * adev) le32_to_cpu(queueconf.rx_memory_block_address), tx_queue_start, rx_queue_start); - if (IS_PCI(adev)) - acxpci_create_desc_queues(adev, tx_queue_start, rx_queue_start); - else if (IS_MEM(adev)) - acxmem_create_desc_queues(adev, tx_queue_start, rx_queue_start); + acx_create_desc_queues(adev, tx_queue_start, rx_queue_start); FN_EXIT1(OK); return OK; diff --git a/mem.c b/mem.c index ca8fe5e..8b95481 100644 --- a/mem.c +++ b/mem.c @@ -600,6 +600,7 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) * on the way out. */ +#if 0 // acxmem_create_desc_queues() void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, u32 rx_queue_start) { @@ -617,9 +618,8 @@ void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, p++; } acxmem_unlock(); - } - +#endif // acxmem_create_desc_queues() #if 0 STATick void acxmem_delete_dma_regions(acx_device_t *adev) { diff --git a/mem.h b/mem.h index 9c608c0..5c6c0ec 100644 --- a/mem.h +++ b/mem.h @@ -31,8 +31,8 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, //- int acxmem_create_hostdesc_queues(acx_device_t *adev); //- STATick int acxmem_create_rx_host_desc_queue(acx_device_t *adev); //- STATick int acxmem_create_tx_host_desc_queue(acx_device_t *adev); -void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start); +//! void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, +//! u32 rx_queue_start); //- STATick void acxmem_create_rx_desc_queue(acx_device_t *adev, u32 //- rx_queue_start); //- STATick void acxmem_create_tx_desc_queue(acx_device_t *adev, u32 //- tx_queue_start); //- void acxmem_free_desc_queues(acx_device_t *adev); diff --git a/merge.c b/merge.c index bc13700..5b43121 100644 --- a/merge.c +++ b/merge.c @@ -438,6 +438,30 @@ fail: return NOT_OK; } +void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start) +{ + u32 *p; + int i; + + acxmem_lock_flags; + acxmem_lock(); + + acx_create_tx_desc_queue(adev, tx_queue_start); + acx_create_rx_desc_queue(adev, rx_queue_start); + + if (IS_PCI(adev)) + goto out; + + p = (u32 *) adev->acx_queue_indicator; + for (i = 0; i < 4; i++) { + write_slavemem32(adev, (u32) p, 0); + p++; + } +out: + acxmem_unlock(); +} + int acx_create_hostdesc_queues(acx_device_t *adev) { int result; diff --git a/merge.h b/merge.h index f6784ea..5c1e50e 100644 --- a/merge.h +++ b/merge.h @@ -73,6 +73,9 @@ int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_upload_fw(acx_device_t *adev); +void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start); + #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index dcc84fe..1f4ffee 100644 --- a/pci.c +++ b/pci.c @@ -240,7 +240,7 @@ static void vlynq_remove(struct vlynq_device *vdev); * plus 32 bytes safety offset at the end */ - +#if 0 // acxpci_create_desc_queues() void acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, u32 rx_queue_start) @@ -248,6 +248,7 @@ acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, acx_create_tx_desc_queue(adev, tx_queue_start); acx_create_rx_desc_queue(adev, rx_queue_start); } +#endif // acxpci_create_desc_queues() //static #if 0 // diff --git a/pci.h b/pci.h index 6b04c5f..ca0c0d9 100644 --- a/pci.h +++ b/pci.h @@ -19,8 +19,8 @@ //= STATick int acxpci_create_rx_host_desc_queue(acx_device_t *adev); //=STATick int acxpci_create_tx_host_desc_queue(acx_device_t *adev); -void acxpci_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start); +//! void acxpci_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, +//! u32 rx_queue_start); //=STATick void acxpci_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); //= STATick void acxpci_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:22
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 733 ----------------------------------------------------------------- pci.c | 575 --------------------------------------------------- 2 files changed, 0 insertions(+), 1308 deletions(-) diff --git a/mem.c b/mem.c index d4d909b..ec915f7 100644 --- a/mem.c +++ b/mem.c @@ -420,68 +420,6 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, } } -/* - * acxmem_s_create_rx_host_desc_queue - * - * the whole size of a data buffer (header plus data body) plus 32 - * bytes safety offset at the end - */ -//static -#if 0 // acxmem_create_rx_host_desc_queue() -int acxmem_create_rx_host_desc_queue(acx_device_t *adev) -{ - rxhostdesc_t *hostdesc; - rxbuffer_t *rxbuf; - int i; - - FN_ENTER; - - /* allocate the RX host descriptor queue pool */ - adev->rxhostdesc_area_size = RX_CNT * sizeof(*hostdesc); - - adev->rxhostdesc_start = acx_allocate(adev, - adev->rxhostdesc_area_size, - &adev->rxhostdesc_startphy, "rxhostdesc_start"); - if (!adev->rxhostdesc_start) - goto fail; - - /* check for proper alignment of RX host descriptor pool */ - if ((long) adev->rxhostdesc_start & 3) { - pr_acx("driver bug: dma alloc returns unaligned address\n"); - goto fail; - } - - /* allocate Rx buffer pool which will be used by the acx to - * store the whole content of the received frames in it */ - adev->rxbuf_area_size = RX_CNT * RX_BUFFER_SIZE; - - adev->rxbuf_start - = acx_allocate(adev, adev->rxbuf_area_size, - &adev->rxbuf_startphy, "rxbuf_start"); - if (!adev->rxbuf_start) - goto fail; - - rxbuf = adev->rxbuf_start; - hostdesc = adev->rxhostdesc_start; - - /* don't make any popular C programming pointer arithmetic - * mistakes here, otherwise I'll kill you... (and don't dare - * asking me why I'm warning you about that...) */ - for (i = 0; i < RX_CNT; i++) { - hostdesc->data = rxbuf; - hostdesc->hd.length = cpu_to_le16(RX_BUFFER_SIZE); - rxbuf++; - hostdesc++; - } - hostdesc--; - FN_EXIT1(OK); - return OK; - fail: pr_acx("create_rx_host_desc_queue FAILED\n"); - /* dealloc will be done by free function on error case */ - FN_EXIT1(NOT_OK); - return NOT_OK; -} -#endif // acxmem_create_rx_host_desc_queue() /* * In the generic slave memory access mode, most of the stuff in the @@ -492,50 +430,7 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) * way out. */ -#if 0 // acxmem_create_desc_queues() -void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start) -{ - u32 *p; - int i; - - acxmem_lock_flags; - acxmem_lock(); - - acx_create_tx_desc_queue(adev, tx_queue_start); - acx_create_rx_desc_queue(adev, rx_queue_start); - p = (u32 *) adev->acx_queue_indicator; - for (i = 0; i < 4; i++) { - write_slavemem32(adev, (u32) p, 0); - p++; - } - acxmem_unlock(); -} -#endif // acxmem_create_desc_queues() -#if 0 -STATick void acxmem_delete_dma_regions(acx_device_t *adev) { - - //unsigned long flags; - - FN_ENTER; - /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's - * no longer possible here? */ - /* - * slave memory interface really doesn't like this. - */ - /* - write_reg16(adev, IO_ACX_ENABLE, 0); - */ - - acx_mwait(100); - - acx_free_desc_queues(adev); - - FN_EXIT0; -} -#endif // acxmem_delete_dma_regions() /* * BOM Firmware, EEPROM, Phy @@ -651,328 +546,7 @@ STATick inline void acxmem_read_eeprom_area(acx_device_t *adev) { #endif } -#if 0 // copied to merge.c -int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { - int count; - acxmem_lock_flags; - - FN_ENTER; - acxmem_lock(); - /* mprusko said that 32bit accesses result in distorted - * sensitivity on his card. Unconfirmed, looks like it's not - * true (most likely since we now properly flush writes). */ - write_reg32(adev, IO_ACX_PHY_DATA, value); - write_reg32(adev, IO_ACX_PHY_ADDR, reg); - write_flush(adev); - write_reg32(adev, IO_ACX_PHY_CTL, 1); - write_flush(adev); - - count = 0xffff; - while (read_reg32(adev, IO_ACX_PHY_CTL)) { - /* scheduling away instead of CPU burning loop doesn't - * seem to work here at all: awful delay, sometimes - * also failure. Doesn't matter anyway (only small - * delay). */ - if (unlikely(!--count)) { - pr_acx("%s: timeout waiting for phy read\n", - wiphy_name(adev->ieee->wiphy)); - goto fail; - } - cpu_relax(); - } - - log(L_DEBUG, "radio PHY write 0x%02X at 0x%04X\n", value, reg); - fail: - - acxmem_unlock(); - FN_EXIT1(OK); - return OK; -} -#endif - -/* - * acxmem_s_write_fw - * - * Write the firmware image into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * 1 firmware image corrupted - * 0 success - */ - -#if 0 // acxmem_write_fw() - copied to merge, but needs work -- test now -// static - probly could restore, but.. -int acxmem_write_fw(acx_device_t *adev, - const firmware_image_t *fw_image, u32 offset) { - int len, size, checkMismatch = -1; - u32 sum, v32, tmp, id; - - /* we skip the first four bytes which contain the control sum */ - const u8 *p = (u8*) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - -#ifdef NOPE -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ - write_flush(adev); -#endif -#endif - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32*)p); - sum += p[0] + p[1] + p[2] + p[3]; - p += 4; - len += 4; - -#ifdef NOPE -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); - write_flush(adev); -#endif - write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32); - write_flush(adev); -#endif - write_slavemem32(adev, offset + len - 4, v32); - - id = read_id_register(adev); - - /* - * check the data written - */ - tmp = read_slavemem32(adev, offset + len - 4); - if (checkMismatch && (tmp != v32)) { - pr_info("first data mismatch at 0x%08x good 0x%08x" - " bad 0x%08x id 0x%08x\n", - offset + len - 4, v32, tmp, id); - checkMismatch = 0; - } - } - log(L_DEBUG, "firmware written, size:%d sum1:%x sum2:%x\n", - size, sum, le32_to_cpu(fw_image->chksum)); - - /* compare our checksum with the stored image checksum */ - FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); - return (sum != le32_to_cpu(fw_image->chksum)); -} -#endif // - -/* - * acxmem_s_validate_fw - * - * Compare the firmware image given with - * the firmware image written into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * NOT_OK firmware image corrupted or not correctly written - * OK success - */ -// static -#if 0 // acxmem_validate_fw() -int acxmem_validate_fw(acx_device_t *adev, - const firmware_image_t *fw_image, u32 offset) -{ - u32 sum, v32, w32; - int len, size; - int result = OK; - /* we skip the first four bytes which contain the control sum */ - const u8 *p = (u8*) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - - write_reg32(adev, IO_ACX_SLV_END_CTL, 0); - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ -#endif - - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32*)p); - p += 4; - len += 4; - -#ifdef NOPE -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); -#endif - udelay(10); - w32 = read_reg32(adev, IO_ACX_SLV_MEM_DATA); -#endif - - w32 = read_slavemem32(adev, offset + len - 4); - - if (unlikely(w32 != v32)) { - pr_acx("FATAL: firmware upload: " - "data parts at offset %d don't match (0x%08X vs. 0x%08X)! " - "I/O timing issues or defective memory, with DWL-xx0+? " - "ACX_IO_WIDTH=16 may help. Please report\n", - len, v32, w32); - result = NOT_OK; - break; - } - - sum += (u8) w32 - + (u8) (w32 >> 8) - + (u8) (w32 >> 16) - + (u8) (w32 >> 24); - } - - /* sum control verification */ - if (result != NOT_OK) { - if (sum != le32_to_cpu(fw_image->chksum)) { - pr_acx("FATAL: firmware upload: " - "checksums don't match!\n"); - result = NOT_OK; - } - } - - FN_EXIT1(result); - return result; -} -#endif // acxmem_validate_fw() - -#if 0 // acxmem_upload_fw() -STATick int acxmem_upload_fw(acx_device_t *adev) { - firmware_image_t *fw_image = NULL; - int res = NOT_OK; - int try; - u32 file_size; - char *filename = "WLANGEN.BIN"; - - acxmem_lock_flags; - -#ifdef PATCH_AROUND_BAD_SPOTS - u32 offset; - int i; - /* - * arm-linux-objdump -d patch.bin, or - * od -Ax -t x4 patch.bin after finding the bounds - * of the .text section with arm-linux-objdump -s patch.bin - */ - u32 patch[] = { 0xe584c030, 0xe59fc008, 0xe92d1000, 0xe59fc004, 0xe8bd8000, - 0x0000080c, 0x0000aa68, 0x605a2200, 0x2c0a689c, 0x2414d80a, - 0x2f00689f, 0x1c27d007, 0x06241e7c, 0x2f000e24, 0xe000d1f6, - 0x602e6018, 0x23036468, 0x480203db, 0x60ca6003, 0xbdf0750a, - 0xffff0808 }; -#endif - - FN_ENTER; - - /* No combined image; tell common we need the radio firmware, too */ - adev->need_radio_fw = 1; - - fw_image = acx_read_fw(adev->bus_dev, filename, &file_size); - if (!fw_image) { - FN_EXIT1(NOT_OK); - return NOT_OK; - } - - for (try = 1; try <= 5; try++) { - - acxmem_lock(); - res = acx_write_fw(adev, fw_image, 0); - log(L_DEBUG|L_INIT, "acx_write_fw (main): %d\n", res); - if (OK == res) { - res = acx_validate_fw(adev, fw_image, 0); - log(L_DEBUG|L_INIT, "acx_validate_fw " - "(main): %d\n", res); - } - acxmem_unlock(); - - if (OK == res) { - SET_BIT(adev->dev_state_mask, ACX_STATE_FW_LOADED); - break; - } - pr_acx("firmware upload attempt #%d FAILED, " - "retrying...\n", try); - acx_mwait(1000); /* better wait for a while... */ - } - -#ifdef PATCH_AROUND_BAD_SPOTS - acxmem_lock(); - /* - * Only want to do this if the firmware is exactly what we - * expect for an iPaq 4700; otherwise, bad things would ensue. - */ - if ((HX4700_FIRMWARE_CHECKSUM == fw_image->chksum) - || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) { - /* - * Put the patch after the main firmware image. - * 0x950c contains the ACX's idea of the end of the - * firmware. Use that location to load ours (which - * depends on that location being 0xab58) then update - * that location to point to after ours. - */ - - offset = read_slavemem32(adev, 0x950c); - - log (L_DEBUG, "patching in at 0x%04x\n", offset); - - for (i = 0; i < sizeof(patch) / sizeof(patch[0]); i++) { - write_slavemem32(adev, offset, patch[i]); - offset += sizeof(u32); - } - - /* - * Patch the instruction at 0x0804 to branch to our - * ARM patch at 0xab58 - */ - write_slavemem32(adev, 0x0804, 0xea000000 + (0xab58 - 0x0804 - 8) / 4); - - /* - * Patch the instructions at 0x1f40 to branch to our - * Thumb patch at 0xab74 - * - * 4a00 ldr r2, [pc, #0] - * 4710 bx r2 - * .data 0xab74+1 - */ - write_slavemem32(adev, 0x1f40, 0x47104a00); - write_slavemem32(adev, 0x1f44, 0x0000ab74 + 1); - - /* - * Bump the end of the firmware up to beyond our patch. - */ - write_slavemem32(adev, 0x950c, offset); - - } - acxmem_unlock(); -#endif - - vfree(fw_image); - - FN_EXIT1(res); - return res; -} -#endif // acxmem_upload_fw() /* * BOM CMDs (Control Path) @@ -1211,223 +785,12 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, } #endif -#if 0 // acxmem_write_cmd_type_status() -void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) -{ - FN_ENTER; - write_slavemem32(adev, (u32) adev->cmd_area, type | (status << 16)); - write_flush(adev); - FN_EXIT0; -} -#endif // acxmem_write_cmd_type_status() - -#if 0 // acxmem_read_cmd_type_status() -STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev) { - u32 cmd_type, cmd_status; - - FN_ENTER; - - cmd_type = read_slavemem32(adev, (u32) adev->cmd_area); - - cmd_status = (cmd_type >> 16); - cmd_type = (u16) cmd_type; - - log(L_DEBUG, "%s: " - "cmd_type:%04X cmd_status:%04X [%s]\n", - __func__, - cmd_type, cmd_status, - acx_cmd_status_str(cmd_status)); - - FN_EXIT1(cmd_status); - return cmd_status; -} -#endif // acxmem_read_cmd_type_status() - -//STATick inline -#if 0 // acxmem_init_mboxes() -void acxmem_init_mboxes(acx_device_t *adev) -{ - u32 cmd_offs, info_offs; - - FN_ENTER; - - cmd_offs = read_reg32(adev, IO_ACX_CMD_MAILBOX_OFFS); - info_offs = read_reg32(adev, IO_ACX_INFO_MAILBOX_OFFS); - adev->cmd_area = (u8*) cmd_offs; - adev->info_area = (u8*) info_offs; - - // OW iobase2 not used in mem.c, in pci.c it is - /* - log(L_DEBUG, "iobase2=%p\n" - */ - log(L_DEBUG, "cmd_mbox_offset=%X cmd_area=%p\n" - "acx: info_mbox_offset=%X info_area=%p\n", - cmd_offs, adev->cmd_area, - info_offs, adev->info_area); - - FN_EXIT0; -} -#endif // acxmem_init_mboxes() /* * BOM Init, Configure (Control Path) * ================================================== */ -/* - * acxmem_s_reset_dev - * - * Arguments: - * netdevice that contains the adev variable - * Returns: - * NOT_OK on fail - * OK on success - * Side effects: - * device is hard reset - * Call context: - * acxmem_e_probe - * Comment: - * This resets the device using low level hardware calls - * as well as uploads and verifies the firmware to the card - */ -#if 0 // copied to merge, but needs work -int acxmem_reset_dev(acx_device_t *adev) -{ - const char* msg = ""; - int result = NOT_OK; - u16 hardware_info; - u16 ecpu_ctrl; - int count; - u32 tmp; - acxmem_lock_flags; - - FN_ENTER; - acxmem_lock(); - - /* - write_reg32 (adev, IO_ACX_SLV_MEM_CP, 0); - */ - /* reset the device to make sure the eCPU is stopped to upload - * the firmware correctly */ - - /* Windows driver does some funny things here */ - /* - * clear bit 0x200 in register 0x2A0 - */ - clear_regbits(adev, 0x2A0, 0x200); - - /* - * Set bit 0x200 in ACX_GPIO_OUT - */ - set_regbits(adev, IO_ACX_GPIO_OUT, 0x200); - - /* - * read register 0x900 until its value is 0x8400104C, sleeping - * in between reads if it's not immediate - */ - tmp = read_reg32(adev, REG_ACX_VENDOR_ID); - count = 500; - while (count-- && (tmp != ACX_VENDOR_ID)) { - mdelay (10); - tmp = read_reg32(adev, REG_ACX_VENDOR_ID); - } - - /* end what Windows driver does */ - - acxmem_reset_mac(adev); - - ecpu_ctrl = read_reg32(adev, IO_ACX_ECPU_CTRL) & 1; - if (!ecpu_ctrl) { - msg = "acx: eCPU is already running. "; - goto end_fail; - } - -#if 0 - if (read_reg16(adev, IO_ACX_SOR_CFG) & 2) { - /* eCPU most likely means "embedded CPU" */ - msg = "acx: eCPU did not start after boot from flash. "; - goto end_unlock; - } - - /* check sense on reset flags */ - if (read_reg16(adev, IO_ACX_SOR_CFG) & 0x10) { - pr_acx("%s: eCPU did not start after boot (SOR), " - "is this fatal?\n", adev->ndev->name); - } -#endif - - /* scan, if any, is stopped now, setting corresponding IRQ bit */ - adev->irq_status |= HOST_INT_SCAN_COMPLETE; - - /* need to know radio type before fw load */ - /* Need to wait for arrival of this information in a loop, - * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also sets the - * radio type ID */ - - count = 0xffff; - do { - hardware_info = read_reg16(adev, IO_ACX_EEPROM_INFORMATION); - if (!--count) { - msg = "acx: eCPU didn't indicate radio type"; - goto end_fail; - } - cpu_relax(); - } while (!(hardware_info & 0xff00)); /* radio type still zero? */ - - pr_acx("ACX radio type 0x%02x\n", (hardware_info >> 8) & 0xff); - /* printk("DEBUG: count %d\n", count); */ - adev->form_factor = hardware_info & 0xff; - adev->radio_type = hardware_info >> 8; - - acxmem_unlock(); - /* load the firmware */ - if (OK != acxmem_upload_fw(adev)) - goto end_fail; - acxmem_lock(); - - /* acx_s_mwait(10); this one really shouldn't be required */ - - /* now start eCPU by clearing bit */ - clear_regbits(adev, IO_ACX_ECPU_CTRL, 0x1); - log(L_DEBUG, "booted eCPU up and waiting for completion...\n"); - - /* Windows driver clears bit 0x200 in register 0x2A0 here */ - clear_regbits(adev, 0x2A0, 0x200); - - /* Windows driver sets bit 0x200 in ACX_GPIO_OUT here */ - set_regbits(adev, IO_ACX_GPIO_OUT, 0x200); - - acxmem_unlock(); - /* wait for eCPU bootup */ - if (OK != acxmem_verify_init(adev)) { - msg = "acx: timeout waiting for eCPU. "; - goto end_fail; - } - acxmem_lock(); - - log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); - acx_init_mboxes(adev); - acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); - - /* test that EEPROM is readable */ - acxmem_read_eeprom_area(adev); - - result = OK; - goto end; - - /* Finish error message. Indicate which function failed */ - end_fail: - - pr_acx("%sreset_dev() FAILED\n", msg); - - end: - - acxmem_unlock(); - FN_EXIT1(result); - return result; -} -#endif // acxmem_reset_dev() STATick int acxmem_verify_init(acx_device_t *adev) { int result = NOT_OK; @@ -2285,102 +1648,6 @@ STATick void acxmem_i_tx_timeout(struct net_device *ndev) { } #endif -/* Interrupt handler bottom-half */ -// OW TODO Copy of pci: possible merging. -#if 0 // copied to merge -void acxmem_irq_work(struct work_struct *work) -{ - acx_device_t *adev = container_of(work, struct acx_device, irq_work); - int irqreason; - int irqmasked; - acxmem_lock_flags; - - FN_ENTER; - - acx_sem_lock(adev); - acxmem_lock(); - - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq - * reasons. However masked irq reasons we still read with - * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES - */ - irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); - irqmasked = irqreason & ~adev->irq_mask; - log(L_IRQ, "acxpci: irqstatus=%04X, irqmasked==%04X\n", irqreason, irqmasked); - - /* HOST_INT_CMD_COMPLETE handling */ - if (irqmasked & HOST_INT_CMD_COMPLETE) { - log(L_IRQ, "got Command_Complete IRQ\n"); - /* save the state for the running issue_cmd() */ - SET_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); - } - - /* Tx reporting */ - if (irqmasked & HOST_INT_TX_COMPLETE) { - log(L_IRQ, "got Tx_Complete IRQ\n"); - acxmem_tx_clean_txdesc(adev); - - // Restart queue if stopped and enough tx-descr free - if ((adev->tx_free >= TX_START_QUEUE) && acx_queue_stopped(adev->ieee)) { - log(L_BUF, "tx: wake queue (avail. Tx desc %u)\n", - adev->tx_free); - acx_wake_queue(adev->ieee, NULL); - ieee80211_queue_work(adev->ieee, &adev->tx_work); - } - - } - - /* Rx processing */ - if (irqmasked & HOST_INT_RX_DATA) { - log(L_IRQ, "got Rx_Complete IRQ\n"); - acxmem_process_rxdesc(adev); - } - - /* HOST_INT_INFO */ - if (irqmasked & HOST_INT_INFO) { - acx_handle_info_irq(adev); - } - - /* HOST_INT_SCAN_COMPLETE */ - if (irqmasked & HOST_INT_SCAN_COMPLETE) { - log(L_IRQ, "got Scan_Complete IRQ\n"); - /* need to do that in process context */ - /* remember that fw is not scanning anymore */ - SET_BIT(adev->irq_status, - HOST_INT_SCAN_COMPLETE); - } - - /* These we just log, but either they happen rarely - * or we keep them masked out */ - if (acx_debug & L_IRQ) - { - acx_log_irq(irqreason); - } - - /* Routine to perform blink with range FIXME: - * update_link_quality_led is a stub - add proper code and - * enable this again: if (unlikely(adev->led_power == 2)) - * update_link_quality_led(adev); - */ - - // Renable irq-signal again for irqs we are interested in - write_reg16(adev, IO_ACX_IRQ_MASK, adev->irq_mask); - write_flush(adev); - - acxmem_unlock(); - - // after_interrupt_jobs: need to be done outside acx_lock (Sleeping required. None atomic) - if (adev->after_interrupt_jobs){ - acx_after_interrupt_task(adev); - } - - acx_sem_unlock(adev); - - FN_EXIT0; - return; - -} -#endif /* * acxmem_handle_info_irq diff --git a/pci.c b/pci.c index 67d5ea6..8d8ae03 100644 --- a/pci.c +++ b/pci.c @@ -141,37 +141,6 @@ static void vlynq_remove(struct vlynq_device *vdev); * plus 32 bytes safety offset at the end */ -#if 0 // acxpci_create_desc_queues() -void -acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, - u32 rx_queue_start) -{ - acx_create_tx_desc_queue(adev, tx_queue_start); - acx_create_rx_desc_queue(adev, rx_queue_start); -} -#endif // acxpci_create_desc_queues() - -//static -#if 0 // -void acxpci_delete_dma_regions(acx_device_t * adev) -{ - FN_ENTER; - /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's - * no longer possible here? */ - write_reg16(adev, IO_ACX_ENABLE, 0); - - acx_mwait(100); - - /* NO locking for all parts of acxpci_free_desc_queues - * because: while calling dma_free_coherent() interrupts need - * to be 'free' but if you spinlock the whole function - * (acxpci_free_desc_queues) you'll get an error */ - acx_free_desc_queues(adev); - - FN_EXIT0; -} -#endif // acxpci_delete_dma_regions() // static inline void acxpci_free_coherent(struct pci_dev *hwdev, size_t size, @@ -295,179 +264,6 @@ inline void acxpci_read_eeprom_area(acx_device_t * adev) #endif // ACX_DEBUG > 1 acxpci_read_eeprom_area() body } -#if 0 // acxpci_write_phy_reg() -int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value) -{ - FN_ENTER; - - /* mprusko said that 32bit accesses result in distorted - * sensitivity on his card. Unconfirmed, looks like it's not - * true (most likely since we now properly flush writes). */ - write_reg32(adev, IO_ACX_PHY_DATA, value); - write_reg32(adev, IO_ACX_PHY_ADDR, reg); - write_flush(adev); - write_reg32(adev, IO_ACX_PHY_CTL, 1); - write_flush(adev); - log(L_DEBUG, "radio PHY write 0x%02X at 0x%04X\n", value, reg); - - FN_EXIT0; - return OK; -} -#endif // acxpci_write_phy_reg() - - -/* - * acxpci_s_write_fw - * - * Write the firmware image into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * 1 firmware image corrupted - * 0 success - * - * Standard csum implementation + write to IO - */ -// static -#if 0 // acxpci_write_fw() -int acxpci_write_fw(acx_device_t * adev, const firmware_image_t *fw_image, - u32 offset) -{ - int len, size; - u32 sum, v32; - /* we skip the first four bytes which contain the control sum */ - - const u8 *p = (u8 *) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - - write_reg32(adev, IO_ACX_SLV_END_CTL, 0); - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ - write_flush(adev); -#endif // FW_NO_AUTO_INCREMENT - - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32 *) p); - sum += p[0] + p[1] + p[2] + p[3]; - p += 4; - len += 4; - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); - write_flush(adev); -#endif - write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32); - } - - log(L_DEBUG, "firmware written, size:%d sum1:%x sum2:%x\n", - size, sum, le32_to_cpu(fw_image->chksum)); - - /* compare our checksum with the stored image checksum */ - FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); - return (sum != le32_to_cpu(fw_image->chksum)); -} -#endif // acxpci_write_fw() - -/* - * acxpci_s_validate_fw - * - * Compare the firmware image given with - * the firmware image written into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * NOT_OK firmware image corrupted or not correctly written - * OK success - * - * Origin: Standard csum + Read IO - */ -// static -#if 0 // acxpci_validate_fw() -int -acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, - u32 offset) -{ - u32 sum, v32, w32; - int len, size; - int result = OK; - /* we skip the first four bytes which contain the control sum */ - const u8 *p = (u8 *) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - - write_reg32(adev, IO_ACX_SLV_END_CTL, 0); - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ -#endif - - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32 *) p); - p += 4; - len += 4; - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); -#endif - w32 = read_reg32(adev, IO_ACX_SLV_MEM_DATA); - - if (unlikely(w32 != v32)) { - pr_acx("FATAL: firmware upload: " - "data parts at offset %d don't match (0x%08X vs. 0x%08X)! " - "I/O timing issues or defective memory, with DWL-xx0+? " - "ACX_IO_WIDTH=16 may help. Please report\n", - len, v32, w32); - result = NOT_OK; - break; - } - - sum += (u8) w32 - + (u8) (w32 >> 8) - + (u8) (w32 >> 16) - + (u8) (w32 >> 24); - } - - /* sum control verification */ - if (result != NOT_OK) { - if (sum != le32_to_cpu(fw_image->chksum)) { - pr_acx("FATAL: firmware upload: " - "checksums don't match!\n"); - result = NOT_OK; - } - } - - FN_EXIT1(result); - return result; -} -#endif // acxpci_validate_fw() /* * acxpci_s_upload_fw @@ -764,202 +560,12 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, return NOT_OK; } -// static inline -#if 0 // acxpci_write_cmd_type_status() -void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status) -{ - FN_ENTER; - acx_writel(type | (status << 16), adev->cmd_area); - write_flush(adev); - FN_EXIT0; -} -#endif // acxpci_write_cmd_type_status() - -#if 0 // acxpci_read_cmd_type_status() -//static -u32 acxpci_read_cmd_type_status(acx_device_t *adev) -{ - u32 cmd_type, cmd_status; - - FN_ENTER; - - cmd_type = acx_readl(adev->cmd_area); - cmd_status = (cmd_type >> 16); - cmd_type = (u16) cmd_type; - - logf1(L_DEBUG, "cmd_type=%04X cmd_status=%04X [%s]\n", - cmd_type, cmd_status, acx_cmd_status_str(cmd_status)); - - FN_EXIT1(cmd_status); - return cmd_status; -} -#endif // acxpci_read_cmd_type_status() - -// static -#if 0 // acxpci_init_mboxes() -inline void acxpci_init_mboxes(acx_device_t * adev) -{ - u32 cmd_offs, info_offs; - - FN_ENTER; - - cmd_offs = read_reg32(adev, IO_ACX_CMD_MAILBOX_OFFS); - info_offs = read_reg32(adev, IO_ACX_INFO_MAILBOX_OFFS); - adev->cmd_area = (u8 *) adev->iobase2 + cmd_offs; - adev->info_area = (u8 *) adev->iobase2 + info_offs; - log(L_DEBUG, "iobase2=%p\n" - "acx: cmd_mbox_offset=%X cmd_area=%p\n" - "acx: info_mbox_offset=%X info_area=%p\n", - adev->iobase2, - cmd_offs, adev->cmd_area, info_offs, adev->info_area); - FN_EXIT0; -} -#endif // acxpci_init_mboxes() /* * BOM Init, Configuration (Control Path) * ================================================== */ -/* - * acxpci_s_reset_dev - * - * Arguments: - * netdevice that contains the adev variable - * Returns: - * NOT_OK on fail - * OK on success - * Side effects: - * device is hard reset - * Call context: - * acxpci_e_probe - * Comment: - * This resets the device using low level hardware calls - * as well as uploads and verifies the firmware to the card - */ -#if 0 // acxpci_reset_dev() -int acxpci_reset_dev(acx_device_t *adev) -{ - const char *msg = ""; - int result = NOT_OK; - u16 hardware_info; - u16 ecpu_ctrl; - int count; - - FN_ENTER; - - /* reset the device to make sure the eCPU is stopped to upload - * the firmware correctly */ - -#ifdef CONFIG_PCI - acxpci_reset_mac(adev); -#endif - - ecpu_ctrl = read_reg16(adev, IO_ACX_ECPU_CTRL) & 1; - if (!ecpu_ctrl) { - msg = "acx: eCPU is already running. "; - goto end_unlock; - } -#if 0 - if (read_reg16(adev, IO_ACX_SOR_CFG) & 2) { - /* eCPU most likely means "embedded CPU" */ - msg = "acx: eCPU did not start after boot from flash. "; - goto end_unlock; - } - - /* check sense on reset flags */ - if (read_reg16(adev, IO_ACX_SOR_CFG) & 0x10) { - pr_acx("%s: eCPU did not start after boot (SOR), " - "is this fatal?\n", wiphy_name(adev->ieee->wiphy)); - } -#endif - /* scan, if any, is stopped now, setting corresponding IRQ bit */ - SET_BIT(adev->irq_status, HOST_INT_SCAN_COMPLETE); - - /* need to know radio type before fw load */ - /* Need to wait for arrival of this information in a loop, - * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also sets the - * radio type ID */ - - count = 0xffff; - do { - hardware_info = read_reg16(adev, IO_ACX_EEPROM_INFORMATION); - if (!--count) { - msg = "acx: eCPU didn't indicate radio type"; - goto end_fail; - } - cpu_relax(); - } while (!(hardware_info & 0xff00)); /* radio type still zero? */ - - /* pr_acx("DEBUG: count %d\n", count); */ - adev->form_factor = hardware_info & 0xff; - adev->radio_type = hardware_info >> 8; - - /* load the firmware */ - if (OK != acxpci_upload_fw(adev)) - goto end_fail; - - /* acx_s_mwait(10); this one really shouldn't be required */ - - /* now start eCPU by clearing bit */ - write_reg16(adev, IO_ACX_ECPU_CTRL, ecpu_ctrl & ~0x1); - log(L_DEBUG, "booted eCPU up and waiting for completion...\n"); - - /* wait for eCPU bootup */ - if (OK != acx_verify_init(adev)) { - msg = "acx: timeout waiting for eCPU. "; - goto end_fail; - } - log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); - - acx_init_mboxes(adev); - acx_write_cmd_type_status(adev, 0, 0); - - /* test that EEPROM is readable */ - acxpci_read_eeprom_area(adev); - - result = OK; - goto end; - -/* Finish error message. Indicate which function failed */ - end_unlock: - - end_fail: - pr_acx("%sreset_dev() FAILED\n", msg); - end: - FN_EXIT1(result); - return result; -} -#endif // acxpci_reset_dev() - -#if 0 // !unused -static int acxpci_verify_init(acx_device_t * adev) -{ - int result = NOT_OK; - unsigned long timeout; - - FN_ENTER; - - timeout = jiffies + 2 * HZ; - for (;;) { - u16 irqstat = read_reg16(adev, IO_ACX_IRQ_STATUS_NON_DES); - if (irqstat & HOST_INT_FCS_THRESHOLD) { - result = OK; - write_reg16(adev, IO_ACX_IRQ_ACK, - HOST_INT_FCS_THRESHOLD); - break; - } - if (time_after(jiffies, timeout)) - break; - /* Init may take up to ~0.5 sec total */ - acx_mwait(50); - } - - FN_EXIT1(result); - return result; -} -#endif // unused acxpci_verify_init() /* * acxpci_l_reset_mac @@ -1168,32 +774,6 @@ tx_t* acxpci_alloc_tx(acx_device_t * adev) } -/* clean *all* Tx descriptors, and regardless of their previous state. - * Used for brute-force reset handling. */ -#if 0 // acxpci_clean_txdesc_emergency() -void acxpci_clean_txdesc_emergency(acx_device_t * adev) -{ - txdesc_t *txdesc; - int i; - - FN_ENTER; - - for (i = 0; i < TX_CNT; i++) { - txdesc = acx_get_txdesc(adev, i); - - /* free it */ - txdesc->ack_failures = 0; - txdesc->rts_failures = 0; - txdesc->rts_ok = 0; - txdesc->error = 0; - txdesc->Ctl_8 = DESC_CTL_HOSTOWN; - } - - adev->tx_free = TX_CNT; - - FN_EXIT0; -} -#endif // acxpci_clean_txdesc_emergency() /* * BOM Irq Handling, Timer @@ -1201,161 +781,6 @@ void acxpci_clean_txdesc_emergency(acx_device_t * adev) */ -/* Interrupt handler bottom-half */ -#define IRQ_ITERATE 0 -#if 0 // acxpci_irq_work() -void acxpci_irq_work(struct work_struct *work) -{ - acx_device_t *adev = container_of(work, struct acx_device, irq_work); - int irqreason; - int irqmasked; -#if IRQ_ITERATE - unsigned int irqcnt=10; -#endif - - FN_ENTER; - - acx_sem_lock(adev); - - /* OW, 20100611: Iterating and latency: - * - * IRQ iteration can improve latency, by avoiding waiting for the schedling - * of the tx worklet. - */ -#if IRQ_ITERATE - while(irqcnt--) { -#endif - - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq - * reasons. However masked irq reasons we still read with - * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES - */ - irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); - irqmasked = irqreason & ~adev->irq_mask; - log(L_IRQ, "irqstatus=%04X, irqmasked==%04X\n", irqreason, irqmasked); - -#if IRQ_ITERATE - if (!irqmasked) break; -#endif - - /* HOST_INT_CMD_COMPLETE handling */ - if (irqmasked & HOST_INT_CMD_COMPLETE) { - log(L_IRQ, "got Command_Complete IRQ\n"); - - /* save the state for the running issue_cmd() */ - SET_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); - } - - /* First report tx status. Just a guess, but it might - * be better in AP mode with hostapd, because tx - * status reporting of previous tx and new rx - * receiving are now in sequence. */ - if (irqmasked & HOST_INT_TX_COMPLETE) { - log(L_IRQ, "got Tx_Complete IRQ\n"); - - /* The condition on TX_START_CLEAN was - * removed, because if was creating a race, - * sequencing problem in AP mode during WPA - * association with different STAs. - * - * The result were many WPA assoc retries of - * the STA, until assoc finally succeeded. It - * happens sporadically, but still often. I - * oberserved this with a ath5k and acx STA. - * - * It manifested as followed: - * 1) STA authenticates and associates - * 2) And then hostapd reported reception of a - * Data/PS-poll frame of an unassociated STA - * 3) hostapd sends disassoc frame - * 4) And then it was looping in retrying this seq, - * until it succeed 'by accident' - * - * Removing the TX_START_CLEAN check and - * always report directly on the tx status - * resolved this problem. Now WPA assoc - * succeeds directly and robust. - */ - acx_tx_clean_txdesc(adev); - - // Restart queue if stopped and enough tx-descr free - if ((adev->tx_free >= TX_START_QUEUE) - && acx_queue_stopped(adev->ieee)) { - - log(L_BUF, - "tx: wake queue (avail. Tx desc %u)\n", - adev->tx_free); - acx_wake_queue(adev->ieee, NULL); - // Schedule the tx. Doesn't harm. Required in case of irq-iteration. - ieee80211_queue_work(adev->ieee, - &adev->tx_work); - } - - } - - /* Now do Rx processing */ - if (irqmasked & HOST_INT_RX_COMPLETE) { - log(L_IRQ, "got Rx_Complete IRQ\n"); - acx_process_rxdesc(adev); - } - - -#if IRQ_ITERATE - /* Tx new frames, after rx processing. If queue is - * running. We indirectly use this as indicator, that - * tx_free >= TX_START_QUEUE */ - if (!acx_queue_stopped(adev->ieee)) - acx_tx_queue_go(adev); -#endif - - /* HOST_INT_INFO */ - if (irqmasked & HOST_INT_INFO) { - acx_handle_info_irq(adev); - } - - /* HOST_INT_SCAN_COMPLETE */ - if (irqmasked & HOST_INT_SCAN_COMPLETE) { - log(L_IRQ, "got Scan_Complete IRQ\n"); - /* need to do that in process context */ - /* remember that fw is not scanning anymore */ - SET_BIT(adev->irq_status, - HOST_INT_SCAN_COMPLETE); - } - - /* These we just log, but either they happen rarely - * or we keep them masked out */ - if (acx_debug & L_IRQ) - { - acx_log_irq(irqreason); - } - -#if IRQ_ITERATE - } -#endif - - /* Routine to perform blink with range FIXME: - * update_link_quality_led is a stub - add proper code and - * enable this again: if (unlikely(adev->led_power == 2)) - * update_link_quality_led(adev); - */ - - // Renable irq-signal again for irqs we are interested in - write_reg16(adev, IO_ACX_IRQ_MASK, adev->irq_mask); - write_flush(adev); - - /* after_interrupt_jobs: need to be done outside acx_lock - * (Sleeping required. None atomic) */ - if (adev->after_interrupt_jobs){ - acx_after_interrupt_task(adev); - } - - acx_sem_unlock(adev); - - FN_EXIT0; - return; -} -#endif // acxpci_irq_work() - /* * acxpci_handle_info_irq */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:22
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/merge.c b/merge.c index 5b43121..e1e6c37 100644 --- a/merge.c +++ b/merge.c @@ -238,8 +238,13 @@ void *acx_allocate(acx_device_t * adev, size_t size, } #define RX_BUFFER_SIZE (sizeof(rxbuffer_t) + 32) -static -int acx_create_rx_host_desc_queue(acx_device_t * adev) +/* + * acx_create_rx_host_desc_queue() + * + * the whole size of a data buffer (header plus data body) plus 32 + * bytes safety offset at the end + */ +static int acx_create_rx_host_desc_queue(acx_device_t * adev) { rxhostdesc_t *hostdesc; rxbuffer_t *rxbuf; @@ -1104,7 +1109,7 @@ fail: #endif // acxmem_write_phy_reg() /* - * acxmem_s_write_fw + * acx_write_fw * * Write the firmware image into the card. * @@ -1951,7 +1956,7 @@ void acx_up(struct ieee80211_hw *hw) } /* - * acxmem_s_reset_dev + * acx_reset_dev * * Arguments: * netdevice that contains the adev variable -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:24
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.h | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/merge.h b/merge.h index 5c1e50e..8cb48e2 100644 --- a/merge.h +++ b/merge.h @@ -68,9 +68,9 @@ u32 acx_read_cmd_type_status(acx_device_t *adev); void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acx_init_mboxes(acx_device_t *adev); int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, - u32 offset); + u32 offset); int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, - u32 offset); + u32 offset); int acxmem_upload_fw(acx_device_t *adev); void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, @@ -79,26 +79,23 @@ void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, #if !defined(CONFIG_ACX_MAC80211_MEM) -static inline -u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) +static inline u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, + int count) { return 0; } -static inline -void acxmem_chaincopy_to_slavemem(acx_device_t *adev, +static inline void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count) { } -static inline -void acxmem_chaincopy_from_slavemem(acx_device_t *adev, +static inline void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count) { } -static inline -void acxmem_init_acx_txbuf2(acx_device_t *adev) +static inline void acxmem_init_acx_txbuf2(acx_device_t *adev) { } -static inline -void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) +static inline void acxmem_dump_mem(acx_device_t *adev, u32 start, + int length) { } #endif -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:22
|
This was in #if0d code, so it didnt get picked up by the compiler. Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mem.c b/mem.c index ec915f7..0eed320 100644 --- a/mem.c +++ b/mem.c @@ -2186,7 +2186,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, txdesc->Ctl2_8, txdesc->error, txdesc->u.r1.rate); - txdesc = acxmem_advance_txdesc(adev, txdesc, 1); + txdesc = acx_advance_txdesc(adev, txdesc, 1); } /* dump host tx descriptor ring buffer */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:25
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 83 +++++--------------------------------------------------------- 1 files changed, 7 insertions(+), 76 deletions(-) diff --git a/merge.c b/merge.c index e1e6c37..0896399 100644 --- a/merge.c +++ b/merge.c @@ -1840,48 +1840,12 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, #define REG_ACX_VENDOR_ID 0x900 #define ACX_VENDOR_ID 0x8400104c -#if 0 // unused yet, review before #if1 -static int acxmem_verify_init(acx_device_t *adev) { - int result = NOT_OK; - unsigned long timeout; - u32 irqstat; - - acxmem_lock_flags; - - FN_ENTER; - - timeout = jiffies + 2 * HZ; - for (;;) { - acxmem_lock(); - irqstat = read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES); - if ((irqstat != 0xFFFFFFFF) - && (irqstat & HOST_INT_FCS_THRESHOLD)) { - result = OK; - write_reg32(adev, IO_ACX_IRQ_ACK, - HOST_INT_FCS_THRESHOLD); - acxmem_unlock(); - break; - } - acxmem_unlock(); - - if (time_after(jiffies, timeout)) - break; - /* Init may take up to ~0.5 sec total */ - acx_mwait(50); - } - - FN_EXIT1(result); - return result; -} -#endif // acxmem_verify_init() /* * BOM Init, Configure (Control Path) * ================================================== */ - - /* * acxmem_l_reset_mac * @@ -2209,7 +2173,7 @@ static void acxmem_init_acx_txbuf(acx_device_t *adev) { * reset, so the ACX memory is in the state we want. */ } -#endif +#endif // acxmem_init_acx_txbuf() /* * Most of the acx specific pieces of hardware reset. @@ -2271,7 +2235,7 @@ static int acxmem_complete_hw_reset(acx_device_t *adev) return 0; } -#endif +#endif // acxmem_complete_hw_reset() #if 0 /*********************************************************************** @@ -2701,7 +2665,7 @@ static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len) { return (blocks_needed); } -#if 0 +#if 0 // acxmem_get_txdesc() static inline txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index) { @@ -2719,6 +2683,7 @@ txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index) * sufficiently many. */ // OW TODO Align with pci.c +#if 1 // acxmem_alloc_tx() tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { struct txdesc *txdesc; unsigned head; @@ -2833,6 +2798,7 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { return (tx_t*) txdesc; } +#endif // acxmem_alloc_tx() /* * acxmem_l_dealloc_tx @@ -2844,6 +2810,7 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { * state and move the queue head pointer back. * */ +#if 1 // acxmem_dealloc_tx() void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { /* * txdesc is the address of the descriptor on the ACX. @@ -2878,6 +2845,7 @@ void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { acxmem_unlock(); } +#endif // acxmem_dealloc_tx() #endif // CONFIG_ACX_MAC80211_MEM /* @@ -2991,43 +2959,6 @@ static void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } -/* Re-initialize tx-buffer list - */ -#if 0 // none in pci, doesnt belong here -void acxmem_init_acx_txbuf2(acx_device_t *adev) { - - int i; - u32 adr, next_adr; - - adr = adev->acx_txbuf_start; - for (i = 0; i < adev->acx_txbuf_numblocks; i++) { - next_adr = adr + adev->memblocksize; - - // Last block is marked with 0x02000000 - if (i == adev->acx_txbuf_numblocks - 1) { - write_slavemem32(adev, adr, 0x02000000); - } - // Else write pointer to next block - else { - write_slavemem32(adev, adr, (next_adr >> 5)); - } - adr = next_adr; - } - - adev->acx_txbuf_free = adev->acx_txbuf_start; - adev->acx_txbuf_blocks_free = adev->acx_txbuf_numblocks; - -} -#endif - -#if 0 // replaced by merge.h:acx_advance_txdesc() -// static inline -txdesc_t* -acxmem_advance_txdesc(acx_device_t *adev, txdesc_t* txdesc, int inc) { - return (txdesc_t*) (((u8*) txdesc) + inc * adev->txdesc_size); -} -#endif // acxmem_advance_txdesc() - static txhostdesc_t *acx_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc) { int index = (u8 *) txdesc - (u8 *) adev->txdesc_start; -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:26
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 548 ++++++++++++++++++++++++++++++++++------------------------------- pci.c | 252 ++++++++++++++++-------------- 2 files changed, 423 insertions(+), 377 deletions(-) diff --git a/mem.c b/mem.c index 8b95481..952330b 100644 --- a/mem.c +++ b/mem.c @@ -298,8 +298,8 @@ void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, ACXMEM_WARN_NOT_SPIN_LOCKED; /* - * Right now I'm making the assumption that the destination is aligned, but - * I'd better check. + * Right now I'm making the assumption that the destination is + * aligned, but I'd better check. */ if ((u32) destination & 3) { pr_acx("copy_from_slavemem: warning! destination not word-aligned!\n"); @@ -315,8 +315,9 @@ void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, } /* - * If the word reads above didn't satisfy the count, read one more word - * and transfer a byte at a time until the request is satisfied. + * If the word reads above didn't satisfy the count, read one + * more word and transfer a byte at a time until the request + * is satisfied. */ if (count) { write_reg32(adev, IO_ACX_SLV_MEM_ADDR, source); @@ -366,8 +367,8 @@ void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, } /* - * If there are leftovers read the next word from the acx and merge in - * what they want to write. + * If there are leftovers read the next word from the acx and + * merge in what they want to write. */ if (count) { write_reg32(adev, IO_ACX_SLV_MEM_ADDR, destination); @@ -377,7 +378,8 @@ void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, *ptmp++ = *source++; } /* - * reset address in case we're currently in auto-increment mode + * reset address in case we're currently in + * auto-increment mode */ write_reg32(adev, IO_ACX_SLV_MEM_ADDR, destination); udelay (10); @@ -511,8 +513,9 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, acx_writel (val, adev->iobase + ACX_SLV_MEM_ADDR); /* - * Read the data from the slave data register, rounding up to the end - * of the word containing the last byte (hence the > 0) + * Read the data from the slave data register, rounding up to + * the end of the word containing the last byte (hence the > + * 0) */ while (count > 0) { *data++ = acx_readl (adev->iobase + ACX_SLV_MEM_DATA); @@ -520,8 +523,8 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, } /* - * If the destination wasn't aligned, we would have saved it in - * the aligned buffer, so copy it where it should go. + * If the destination wasn't aligned, we would have saved it + * in the aligned buffer, so copy it where it should go. */ if ((u32) destination & 3) { memcpy(destination, aligned_destination, saved_count); @@ -531,8 +534,8 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, /* * acxmem_s_create_rx_host_desc_queue * - * the whole size of a data buffer (header plus data body) - * plus 32 bytes safety offset at the end + * the whole size of a data buffer (header plus data body) plus 32 + * bytes safety offset at the end */ //static #if 0 // acxmem_create_rx_host_desc_queue() @@ -559,8 +562,8 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) goto fail; } - /* allocate Rx buffer pool which will be used by the acx - * to store the whole content of the received frames in it */ + /* allocate Rx buffer pool which will be used by the acx to + * store the whole content of the received frames in it */ adev->rxbuf_area_size = RX_CNT * RX_BUFFER_SIZE; adev->rxbuf_start @@ -572,9 +575,9 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) rxbuf = adev->rxbuf_start; hostdesc = adev->rxhostdesc_start; - /* don't make any popular C programming pointer arithmetic mistakes - * here, otherwise I'll kill you... - * (and don't dare asking me why I'm warning you about that...) */ + /* don't make any popular C programming pointer arithmetic + * mistakes here, otherwise I'll kill you... (and don't dare + * asking me why I'm warning you about that...) */ for (i = 0; i < RX_CNT; i++) { hostdesc->data = rxbuf; hostdesc->hd.length = cpu_to_le16(RX_BUFFER_SIZE); @@ -592,12 +595,12 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) #endif // acxmem_create_rx_host_desc_queue() /* - * In the generic slave memory access mode, most of the stuff in - * the txhostdesc_t is unused. It's only here because the rest of - * the ACX driver expects it to be since the PCI version uses indirect - * host memory organization with DMA. Since we're not using DMA the - * only use we have for the host descriptors is to store the packets - * on the way out. + * In the generic slave memory access mode, most of the stuff in the + * txhostdesc_t is unused. It's only here because the rest of the ACX + * driver expects it to be since the PCI version uses indirect host + * memory organization with DMA. Since we're not using DMA the only + * use we have for the host descriptors is to store the packets on the + * way out. */ #if 0 // acxmem_create_desc_queues() @@ -628,8 +631,8 @@ STATick void acxmem_delete_dma_regions(acx_device_t *adev) { FN_ENTER; /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's no - * longer possible here? */ + * here instead? Or are we that much down the road that it's + * no longer possible here? */ /* * slave memory interface really doesn't like this. */ @@ -683,12 +686,11 @@ acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, goto end; } - /* first we need to enable the OE (EEPROM Output Enable) GPIO line - * to be able to write to the EEPROM. - * NOTE: an EEPROM writing success has been reported, - * but you probably have to modify GPIO_OUT, too, - * and you probably need to activate a different GPIO - * line instead! */ + /* first we need to enable the OE (EEPROM Output Enable) GPIO + * line to be able to write to the EEPROM. NOTE: an EEPROM + * writing success has been reported, but you probably have to + * modify GPIO_OUT, too, and you probably need to activate a + * different GPIO line instead! */ gpio_orig = read_reg16(adev, IO_ACX_GPIO_OE); write_reg16(adev, IO_ACX_GPIO_OE, gpio_orig & ~1); write_flush(adev); @@ -768,9 +770,9 @@ int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { FN_ENTER; acxmem_lock(); - /* mprusko said that 32bit accesses result in distorted sensitivity - * on his card. Unconfirmed, looks like it's not true (most likely since we - * now properly flush writes). */ + /* mprusko said that 32bit accesses result in distorted + * sensitivity on his card. Unconfirmed, looks like it's not + * true (most likely since we now properly flush writes). */ write_reg32(adev, IO_ACX_PHY_DATA, value); write_reg32(adev, IO_ACX_PHY_ADDR, reg); write_flush(adev); @@ -779,13 +781,13 @@ int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { count = 0xffff; while (read_reg32(adev, IO_ACX_PHY_CTL)) { - /* scheduling away instead of CPU burning loop - * doesn't seem to work here at all: - * awful delay, sometimes also failure. - * Doesn't matter anyway (only small delay). */ + /* scheduling away instead of CPU burning loop doesn't + * seem to work here at all: awful delay, sometimes + * also failure. Doesn't matter anyway (only small + * delay). */ if (unlikely(!--count)) { - pr_acx("%s: timeout waiting for phy read\n", wiphy_name( - adev->ieee->wiphy)); + pr_acx("%s: timeout waiting for phy read\n", + wiphy_name(adev->ieee->wiphy)); goto fail; } cpu_relax(); @@ -1028,16 +1030,17 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { #ifdef PATCH_AROUND_BAD_SPOTS acxmem_lock(); /* - * Only want to do this if the firmware is exactly what we expect for an - * iPaq 4700; otherwise, bad things would ensue. + * Only want to do this if the firmware is exactly what we + * expect for an iPaq 4700; otherwise, bad things would ensue. */ if ((HX4700_FIRMWARE_CHECKSUM == fw_image->chksum) || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) { /* - * Put the patch after the main firmware image. 0x950c contains - * the ACX's idea of the end of the firmware. Use that location to - * load ours (which depends on that location being 0xab58) then - * update that location to point to after ours. + * Put the patch after the main firmware image. + * 0x950c contains the ACX's idea of the end of the + * firmware. Use that location to load ours (which + * depends on that location being 0xab58) then update + * that location to point to after ours. */ offset = read_slavemem32(adev, 0x950c); @@ -1050,12 +1053,14 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { } /* - * Patch the instruction at 0x0804 to branch to our ARM patch at 0xab58 + * Patch the instruction at 0x0804 to branch to our + * ARM patch at 0xab58 */ write_slavemem32(adev, 0x0804, 0xea000000 + (0xab58 - 0x0804 - 8) / 4); /* - * Patch the instructions at 0x1f40 to branch to our Thumb patch at 0xab74 + * Patch the instructions at 0x1f40 to branch to our + * Thumb patch at 0xab74 * * 4a00 ldr r2, [pc, #0] * 4710 bx r2 @@ -1092,14 +1097,15 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { * * OW, 20100630: * - * The mem device is quite sensible to data access operations, therefore - * we may not sleep during the command handling. + * The mem device is quite sensible to data access operations, + * therefore we may not sleep during the command handling. * - * This has manifested as problem during sw-scan while if up. The acx got - * stuck - most probably due to concurrent data access collision. + * This has manifested as problem during sw-scan while if up. The acx + * got stuck - most probably due to concurrent data access collision. * - * By not sleeping anymore and doing the entire operation completely under - * spinlock (thus with irqs disabled), the sw scan problem was solved. + * By not sleeping anymore and doing the entire operation completely + * under spinlock (thus with irqs disabled), the sw scan problem was + * solved. * * We can now run repeating sw scans, under load, without that the acx * device gets stuck. @@ -1192,9 +1198,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, /* wait for firmware to process command */ - /* Ensure nonzero and not too large timeout. - ** Also converts e.g. 100->99, 200->199 - ** which is nice but not essential */ + /* Ensure nonzero and not too large timeout. Also converts + * e.g. 100->99, 200->199 which is nice but not essential */ cmd_timeout = (cmd_timeout - 1) | 1; if (unlikely(cmd_timeout> 1199)) cmd_timeout = 1199; @@ -1259,8 +1264,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, if (cmd_status != 1) { /* it is not a 'Success' */ /* zero out result buffer - * WARNING: this will trash stack in case of illegally large input - * length! */ + * WARNING: this will trash stack in case of illegally + * large input length! */ if (buflen > 388) { /* @@ -1302,8 +1307,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, return OK; bad: - /* Give enough info so that callers can avoid - ** printing their own diagnostic messages */ + /* Give enough info so that callers can avoid printing their + * own diagnostic messages */ logf1(L_ANY, "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n", devname, cmdstr, buflen, cmd_timeout, @@ -1413,8 +1418,8 @@ int acxmem_reset_dev(acx_device_t *adev) /* write_reg32 (adev, IO_ACX_SLV_MEM_CP, 0); */ - /* reset the device to make sure the eCPU is stopped - * to upload the firmware correctly */ + /* reset the device to make sure the eCPU is stopped to upload + * the firmware correctly */ /* Windows driver does some funny things here */ /* @@ -1468,8 +1473,8 @@ int acxmem_reset_dev(acx_device_t *adev) /* need to know radio type before fw load */ /* Need to wait for arrival of this information in a loop, * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also - * sets the radio type ID */ + * (started burst read in reset_mac()) which also sets the + * radio type ID */ count = 0xffff; do { @@ -1573,16 +1578,17 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) { acx111_ie_configoption_t co; acxmem_lock_flags; - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + * large parts of the I/O registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ if (OK != acx_reset_dev(adev)) return -1; acxmem_lock(); if (IS_ACX100(adev)) { - /* ACX100: configopt struct in cmd mailbox - directly after reset */ + /* ACX100: configopt struct in cmd mailbox - directly + * after reset */ acxmem_copy_from_slavemem(adev, (u8*) &co, (u32) adev->cmd_area, sizeof(co)); } acxmem_unlock(); @@ -1591,7 +1597,8 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) { return -3; if (IS_ACX111(adev)) { - /* ACX111: configopt struct needs to be queried after full init */ + /* ACX111: configopt struct needs to be queried after + * full init */ acx_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS); } @@ -1602,15 +1609,17 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) { acxmem_lock(); /* - * Windows driver writes 0x01000000 to register 0x288, RADIO_CTL, if the form factor - * is 3. It also write protects the EEPROM by writing 1<<9 to GPIO_OUT + * Windows driver writes 0x01000000 to register 0x288, + * RADIO_CTL, if the form factor is 3. It also write protects + * the EEPROM by writing 1<<9 to GPIO_OUT */ if (adev->form_factor == 3) { set_regbits(adev, 0x288, 0x01000000); set_regbits(adev, 0x298, 1 << 9); } - /* TODO: merge them into one function, they are called just once and are the same for pci & usb */ + /* TODO: merge them into one function, they are called just + * once and are the same for pci & usb */ if (OK != acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version)) return -2; @@ -1753,34 +1762,34 @@ int acxmem_proc_diag_output(struct seq_file *file, acxmem_copy_from_slavemem(adev, (u8 *) &rxd, (u32) rxdesc, sizeof(rxd)); seq_printf(file, - "%04x: %04x %04x %04x %04x %04x %04x %04x Ctl_8=%04x %04x %04x %04x %04x %04x %04x %04x\n", - (u32) rxdesc, - rxd.pNextDesc.v, - rxd.HostMemPtr.v, - rxd.ACXMemPtr.v, - rxd.rx_time, - rxd.total_length, - rxd.WEP_length, - rxd.WEP_ofs, - rxd.Ctl_8, - rxd.rate, - rxd.error, - rxd.SNR, - rxd.RxLevel, - rxd.queue_ctrl, - rxd.unknown, - rxd.unknown2); + "%04x: %04x %04x %04x %04x %04x %04x %04x Ctl_8=%04x %04x %04x %04x %04x %04x %04x %04x\n", + (u32) rxdesc, + rxd.pNextDesc.v, + rxd.HostMemPtr.v, + rxd.ACXMemPtr.v, + rxd.rx_time, + rxd.total_length, + rxd.WEP_length, + rxd.WEP_ofs, + rxd.Ctl_8, + rxd.rate, + rxd.error, + rxd.SNR, + rxd.RxLevel, + rxd.queue_ctrl, + rxd.unknown, + rxd.unknown2); rxdesc++; } seq_printf(file, "** Tx buf (free %d, Ieee80211 queue: %s) **\n", - adev->acx_txbuf_free, acx_queue_stopped(adev->ieee) ? "STOPPED" - : "Running"); + adev->acx_txbuf_free, acx_queue_stopped(adev->ieee) + ? "STOPPED" : "Running"); seq_printf(file, - "** Tx buf %d blocks total, %d available, free list head %04x\n", - adev->acx_txbuf_numblocks, adev->acx_txbuf_blocks_free, - adev->acx_txbuf_free); + "** Tx buf %d blocks total, %d available, free list head %04x\n", + adev->acx_txbuf_numblocks, adev->acx_txbuf_blocks_free, + adev->acx_txbuf_free); txdesc = adev->txdesc_start; if (txdesc) { @@ -1796,18 +1805,18 @@ int acxmem_proc_diag_output(struct seq_file *file, seq_printf(file, "%02u available (%02X)%-7s%-7s", i, Ctl_8, thd, ttl); else seq_printf(file, "%02u busy (%02X)%-7s%-7s", i, Ctl_8, thd, ttl); - + seq_printf(file, - "%04x: %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %02x %02x %02x %02x " - "%02x %02x %02x %02x %04x: ", (u32) txdesc, - txd.pNextDesc.v, txd.HostMemPtr.v, txd.AcxMemPtr.v, - txd.tx_time, txd.total_length, txd.Reserved, - txd.dummy[0], txd.dummy[1], txd.dummy[2], - txd.dummy[3], txd.Ctl_8, txd.Ctl2_8, txd.error, - txd.ack_failures, txd.rts_failures, - txd.rts_ok, txd.u.r1.rate, - txd.u.r1.queue_ctrl, txd.queue_info); - + "%04x: %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %02x %02x %02x %02x " + "%02x %02x %02x %02x %04x: ", (u32) txdesc, + txd.pNextDesc.v, txd.HostMemPtr.v, txd.AcxMemPtr.v, + txd.tx_time, txd.total_length, txd.Reserved, + txd.dummy[0], txd.dummy[1], txd.dummy[2], + txd.dummy[3], txd.Ctl_8, txd.Ctl2_8, txd.error, + txd.ack_failures, txd.rts_failures, + txd.rts_ok, txd.u.r1.rate, + txd.u.r1.queue_ctrl, txd.queue_info); + tmp = read_slavemem32(adev, (u32) & (txdesc->AcxMemPtr)); seq_printf(file, " %04x: ", tmp); @@ -1920,7 +1929,8 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { /* First, have a loop to determine the first descriptor that's * full, just in case there's a mismatch between our current - * rx_tail and the full descriptor we're supposed to handle. */ + * rx_tail and the full descriptor we're supposed to + * handle. */ tail = adev->rx_tail; count = RX_CNT; while (1) { @@ -1930,11 +1940,12 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { tail = (tail + 1) % RX_CNT; /* - * Unlike the PCI interface, where the ACX can write directly to - * the host descriptors, on the slave memory interface we have to - * pull these. All we really need to do is check the Ctl_8 field - * in the rx descriptor on the ACX, which should be 0x11000000 if - * we should process it. + * Unlike the PCI interface, where the ACX can write + * directly to the host descriptors, on the slave + * memory interface we have to pull these. All we + * really need to do is check the Ctl_8 field in the + * rx descriptor on the ACX, which should be + * 0x11000000 if we should process it. */ Ctl_8 = hostdesc->hd.Ctl_16 = read_slavemem8(adev, (u32) &(rxdesc->Ctl_8)); if ((Ctl_8 & DESC_CTL_HOSTOWN) && (Ctl_8 & DESC_CTL_ACXDONE)) @@ -1948,9 +1959,9 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { while (1) { log(L_BUFR, "%s: rx: tail=%u Ctl_8=%02X\n", __func__, tail, Ctl_8); /* - * If the ACX has CTL_RECLAIM set on this descriptor there - * is no buffer associated; it just wants us to tell it to - * reclaim the memory. + * If the ACX has CTL_RECLAIM set on this descriptor + * there is no buffer associated; it just wants us to + * tell it to reclaim the memory. */ if (!(Ctl_8 & DESC_CTL_RECLAIM)) { @@ -1961,15 +1972,19 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { (u32) &(rxdesc->total_length)); /* - * hostdesc->data is an rxbuffer_t, which includes header information, - * but the length in the data packet doesn't. The header information - * takes up an additional 12 bytes, so add that to the length we copy. + * hostdesc->data is an rxbuffer_t, which + * includes header information, but the length + * in the data packet doesn't. The header + * information takes up an additional 12 + * bytes, so add that to the length we copy. */ addr = read_slavemem32(adev, (u32) &(rxdesc->ACXMemPtr)); if (addr) { /* - * How can &(rxdesc->ACXMemPtr) above ever be zero? Looks like we - * get that now and then - try to trap it for debug. + * How can &(rxdesc->ACXMemPtr) above + * ever be zero? Looks like we get + * that now and then - try to trap it + * for debug. */ if (addr & 0xffff0000) { log(L_ANY, "%s: rxdesc 0x%08x\n", __func__, (u32) rxdesc); @@ -1996,8 +2011,8 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { write_slavemem8(adev, (u32) &rxdesc->Ctl_8, Ctl_8); /* - * Now tell the ACX we've finished with the receive buffer so - * it can finish the reclaim. + * Now tell the ACX we've finished with the receive + * buffer so it can finish the reclaim. */ write_reg16(adev, IO_ACX_INT_TRIG, INT_TRIG_RXPRC); @@ -2047,8 +2062,8 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) int blocks_needed; /* - * Take 4 off the memory block size to account for the reserved word at the start of - * the block. + * Take 4 off the memory block size to account for the + * reserved word at the start of the block. */ blocks_needed = acxmem_get_txbuf_space_needed(adev, count); @@ -2059,8 +2074,9 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) last_block = block = adev->acx_txbuf_free; /* - * Follow block pointers through the requested number of blocks both to - * find the new head of the free list and to set the flags for the blocks + * Follow block pointers through the requested number + * of blocks both to find the new head of the free + * list and to set the flags for the blocks * appropriately. */ while (blocks_needed--) { @@ -2084,13 +2100,14 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) } /* - * Flag the last block both by clearing out the next pointer - * and marking the control field. + * Flag the last block both by clearing out the next + * pointer and marking the control field. */ write_slavemem32(adev, last_block, 0x02000000); /* - * If we're out of buffers make sure the free list pointer is NULL + * If we're out of buffers make sure the free list + * pointer is NULL */ if (!adev->acx_txbuf_blocks_free) { adev->acx_txbuf_free = 0; @@ -2103,11 +2120,12 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) } /* - * Return buffer space back to the pool by following the next pointers until we find - * the block marked as the end. Point the last block to the head of the free list, - * then update the head of the free list to point to the newly freed memory. - * This routine gets called in interrupt context, so it shouldn't block to protect - * the integrity of the linked list. The ISR already holds the lock. + * Return buffer space back to the pool by following the next pointers + * until we find the block marked as the end. Point the last block to + * the head of the free list, then update the head of the free list to + * point to the newly freed memory. This routine gets called in + * interrupt context, so it shouldn't block to protect the integrity + * of the linked list. The ISR already holds the lock. */ STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { u32 cur, last, next; @@ -2132,10 +2150,12 @@ STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } while (!(next & 0x02000000)); /* - * last now points to the last block of that allocation. Update the pointer - * in that block to point to the free list and reset the free list to the - * first block of the free call. If there were no free blocks, make sure - * the new end of the list marks itself as truly the end. + * last now points to the last block of that + * allocation. Update the pointer in that block to + * point to the free list and reset the free list to + * the first block of the free call. If there were no + * free blocks, make sure the new end of the list + * marks itself as truly the end. */ if (adev->acx_txbuf_free) { write_slavemem32(adev, last, adev->acx_txbuf_free >> 5); @@ -2148,25 +2168,28 @@ STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } /* - * Initialize the pieces managing the transmit buffer pool on the ACX. The transmit - * buffer is a circular queue with one 32 bit word reserved at the beginning of each - * block. The upper 13 bits are a control field, of which only 0x02000000 has any - * meaning. The lower 19 bits are the address of the next block divided by 32. + * Initialize the pieces managing the transmit buffer pool on the ACX. + * The transmit buffer is a circular queue with one 32 bit word + * reserved at the beginning of each block. The upper 13 bits are a + * control field, of which only 0x02000000 has any meaning. The lower + * 19 bits are the address of the next block divided by 32. */ static void acxmem_init_acx_txbuf(acx_device_t *adev) { /* - * acx100_s_init_memory_pools set up txbuf_start and txbuf_numblocks for us. - * All we need to do is reset the rest of the bookeeping. + * acx100_s_init_memory_pools set up txbuf_start and + * txbuf_numblocks for us. All we need to do is reset the + * rest of the bookeeping. */ adev->acx_txbuf_free = adev->acx_txbuf_start; adev->acx_txbuf_blocks_free = adev->acx_txbuf_numblocks; /* - * Initialization leaves the last transmit pool block without a pointer back to - * the head of the list, but marked as the end of the list. That's how we want - * to see it, too, so leave it alone. This is only ever called after a firmware + * Initialization leaves the last transmit pool block without + * a pointer back to the head of the list, but marked as the + * end of the list. That's how we want to see it, too, so + * leave it alone. This is only ever called after a firmware * reset, so the ACX memory is in the state we want. */ @@ -2240,7 +2263,8 @@ void acxmem_clean_txdesc_emergency(acx_device_t *adev) #if 0 u32 acxmem; /* - * Clean up the memory allocated on the ACX for this transmit descriptor. + * Clean up the memory allocated on the ACX for this + * transmit descriptor. */ acxmem = read_slavemem32(adev, (u32) &(txdesc->AcxMemPtr)); @@ -2266,9 +2290,9 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { int count; /* - * Can't handle an interrupt while we're fiddling with the ACX's lock, - * according to TI. The ACX is supposed to hold fw_lock for at most - * 500ns. + * Can't handle an interrupt while we're fiddling with the + * ACX's lock, according to TI. The ACX is supposed to hold + * fw_lock for at most 500ns. */ local_irq_save(flags); @@ -2283,8 +2307,8 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { if (count < 50) { /* - * Take out the host lock - anything non-zero will work, so don't worry about - * be/le + * Take out the host lock - anything non-zero will + * work, so don't worry about be/le */ write_slavemem16 (adev, (u32) &(adev->acx_queue_indicator->host_lock), 1); @@ -2342,9 +2366,9 @@ STATick void acxmem_i_tx_timeout(struct net_device *ndev) { tx_num_cleaned = acxmem_tx_clean_txdesc(adev); /* nothing cleaned, yet (almost) no free buffers available? - * --> clean all tx descs, no matter which status!! - * Note that I strongly suspect that doing emergency cleaning - * may confuse the firmware. This is a last ditch effort to get + * --> clean all tx descs, no matter which status!! Note that + * I strongly suspect that doing emergency cleaning may + * confuse the firmware. This is a last ditch effort to get * ANYTHING to work again... * * TODO: it's best to simply reset & reinit hw from scratch... @@ -2387,9 +2411,9 @@ void acxmem_irq_work(struct work_struct *work) acx_sem_lock(adev); acxmem_lock(); - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq reasons. - * However masked irq reasons we still read with IO_ACX_IRQ_REASON or - * IO_ACX_IRQ_STATUS_NON_DES + /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq + * reasons. However masked irq reasons we still read with + * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES */ irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); irqmasked = irqreason & ~adev->irq_mask; @@ -2444,10 +2468,10 @@ void acxmem_irq_work(struct work_struct *work) acx_log_irq(irqreason); } - /* Routine to perform blink with range - * FIXME: update_link_quality_led is a stub - add proper code and enable this again: - if (unlikely(adev->led_power == 2)) - update_link_quality_led(adev); + /* Routine to perform blink with range FIXME: + * update_link_quality_led is a stub - add proper code and + * enable this again: if (unlikely(adev->led_power == 2)) + * update_link_quality_led(adev); */ // Renable irq-signal again for irqs we are interested in @@ -2543,8 +2567,8 @@ STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id) adev->irq_last_jiffies = jiffies; } - /* safety condition; we'll normally abort loop below - * in case no IRQ type occurred */ + /* safety condition; we'll normally abort loop below in case + * no IRQ type occurred */ while (likely(--irqcount)) { #endif /* ACK all IRQs ASAP */ @@ -2565,12 +2589,14 @@ STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id) if (irqtype & HOST_INT_TX_COMPLETE) { log(L_IRQ, "got Tx_Complete IRQ\n"); - /* don't clean up on each Tx complete, wait a bit - * unless we're going towards full, in which case - * we do it immediately, too (otherwise we might lockup - * with a full Tx buffer if we go into - * acxmem_l_clean_txdesc() at a time when we won't wakeup - * the net queue in there for some reason...) */ + /* don't clean up on each Tx complete, wait a + * bit unless we're going towards full, in + * which case we do it immediately, too + * (otherwise we might lockup with a full Tx + * buffer if we go into + * acxmem_l_clean_txdesc() at a time when we + * won't wakeup the net queue in there for + * some reason...) */ if (adev->tx_free <= TX_START_CLEAN) { #if TX_CLEANUP_IN_SOFTIRQ acx_schedule_task(adev, ACX_AFTER_IRQ_TX_CLEANUP); @@ -2958,21 +2984,21 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, if (rxhostdesc) for (i = 0; i < RX_CNT; i++) { pr_acx("\ndump host rxdesc %d:\n" - "mem pos %p\n" - "buffer mem pos 0x%X\n" - "buffer mem offset 0x%X\n" - "CTL 0x%X\n" - "Length 0x%X\n" - "next 0x%X\n" - "Status 0x%X\n", - i, - rxhostdesc, - acx2cpu(rxhostdesc->data_phy), - rxhostdesc->data_offset, - le16_to_cpu(rxhostdesc->hd.Ctl_16), - le16_to_cpu(rxhostdesc->hd.length), - acx2cpu(rxhostdesc->desc_phy_next), - rxhostdesc->Status); + "mem pos %p\n" + "buffer mem pos 0x%X\n" + "buffer mem offset 0x%X\n" + "CTL 0x%X\n" + "Length 0x%X\n" + "next 0x%X\n" + "Status 0x%X\n", + i, + rxhostdesc, + acx2cpu(rxhostdesc->data_phy), + rxhostdesc->data_offset, + le16_to_cpu(rxhostdesc->hd.Ctl_16), + le16_to_cpu(rxhostdesc->hd.length), + acx2cpu(rxhostdesc->desc_phy_next), + rxhostdesc->Status); rxhostdesc++; } @@ -2983,27 +3009,27 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, if (txdesc) for (i = 0; i < TX_CNT; i++) { pr_acx("\ndump internal txdesc %d:\n" - "size 0x%X\n" - "mem pos %p\n" - "next 0x%X\n" - "acx mem pointer (dynamic) 0x%X\n" - "host mem pointer (dynamic) 0x%X\n" - "length (dynamic) 0x%X\n" - "CTL (dynamic) 0x%X\n" - "CTL2 (dynamic) 0x%X\n" - "Status (dynamic) 0x%X\n" - "Rate (dynamic) 0x%X\n", - i, - (int) sizeof(struct txdesc), - txdesc, - acx2cpu(txdesc->pNextDesc), - acx2cpu(txdesc->AcxMemPtr), - acx2cpu(txdesc->HostMemPtr), - le16_to_cpu(txdesc->total_length), - txdesc->Ctl_8, - txdesc->Ctl2_8, - txdesc->error, - txdesc->u.r1.rate); + "size 0x%X\n" + "mem pos %p\n" + "next 0x%X\n" + "acx mem pointer (dynamic) 0x%X\n" + "host mem pointer (dynamic) 0x%X\n" + "length (dynamic) 0x%X\n" + "CTL (dynamic) 0x%X\n" + "CTL2 (dynamic) 0x%X\n" + "Status (dynamic) 0x%X\n" + "Rate (dynamic) 0x%X\n", + i, + (int) sizeof(struct txdesc), + txdesc, + acx2cpu(txdesc->pNextDesc), + acx2cpu(txdesc->AcxMemPtr), + acx2cpu(txdesc->HostMemPtr), + le16_to_cpu(txdesc->total_length), + txdesc->Ctl_8, + txdesc->Ctl2_8, + txdesc->error, + txdesc->u.r1.rate); txdesc = acxmem_advance_txdesc(adev, txdesc, 1); } @@ -3015,21 +3041,21 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, if (txhostdesc) for (i = 0; i < TX_CNT * 2; i++) { pr_acx("\ndump host txdesc %d:\n" - "mem pos %p\n" - "buffer mem pos 0x%X\n" - "buffer mem offset 0x%X\n" - "CTL 0x%X\n" - "Length 0x%X\n" - "next 0x%X\n" - "Status 0x%X\n", - i, - txhostdesc, - acx2cpu(txhostdesc->data_phy), - txhostdesc->data_offset, - le16_to_cpu(txhostdesc->hd.Ctl_16), - le16_to_cpu(txhostdesc->hd.length), - acx2cpu(txhostdesc->desc_phy_next), - le32_to_cpu(txhostdesc->Status)); + "mem pos %p\n" + "buffer mem pos 0x%X\n" + "buffer mem offset 0x%X\n" + "CTL 0x%X\n" + "Length 0x%X\n" + "next 0x%X\n" + "Status 0x%X\n", + i, + txhostdesc, + acx2cpu(txhostdesc->data_phy), + txhostdesc->data_offset, + le16_to_cpu(txhostdesc->hd.Ctl_16), + le16_to_cpu(txhostdesc->hd.length), + acx2cpu(txhostdesc->desc_phy_next), + le32_to_cpu(txhostdesc->Status)); txhostdesc++; } @@ -3144,21 +3170,24 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { ieee->queues = 1; // OW TODO Check if RTS/CTS threshold can be included here - /* TODO: although in the original driver the maximum value was 100, - * the OpenBSD driver assigns maximum values depending on the type of - * radio transceiver (i.e. Radia, Maxim, etc.). This value is always a - * positive integer which most probably indicates the gain of the AGC - * in the rx path of the chip, in dB steps (0.625 dB, for example?). - * The mapping of this rssi value to dBm is still unknown, but it can - * nevertheless be used as a measure of relative signal strength. The - * other two values, i.e. max_signal and max_noise, do not seem to be - * supported on my acx111 card (they are always 0), although iwconfig - * reports them (in dBm) when using ndiswrapper with the Windows XP - * driver. The GPL-licensed part of the AVM FRITZ!WLAN USB Stick - * driver sources (for the TNETW1450, though) seems to also indicate - * that only the RSSI is supported. In conclusion, the max_signal and - * max_noise values will not be initialised by now, as they do not - * seem to be supported or how to acquire them is still unknown. */ + /* TODO: although in the original driver the maximum value was + * 100, the OpenBSD driver assigns maximum values depending on + * the type of radio transceiver (i.e. Radia, Maxim, + * etc.). This value is always a positive integer which most + * probably indicates the gain of the AGC in the rx path of + * the chip, in dB steps (0.625 dB, for example?). The + * mapping of this rssi value to dBm is still unknown, but it + * can nevertheless be used as a measure of relative signal + * strength. The other two values, i.e. max_signal and + * max_noise, do not seem to be supported on my acx111 card + * (they are always 0), although iwconfig reports them (in + * dBm) when using ndiswrapper with the Windows XP driver. The + * GPL-licensed part of the AVM FRITZ!WLAN USB Stick driver + * sources (for the TNETW1450, though) seems to also indicate + * that only the RSSI is supported. In conclusion, the + * max_signal and max_noise values will not be initialised by + * now, as they do not seem to be supported or how to acquire + * them is still unknown. */ // We base signal quality on winlevel approach of previous driver // TODO OW 20100615 This should into a common init code @@ -3172,8 +3201,9 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { spin_lock_init(&adev->spinlock); /* initial state: unlocked */ /* We do not start with downed sem: we want PARANOID_LOCKING to work */ mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->pdevmem = pdev; @@ -3187,7 +3217,7 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { platform_set_drvdata(pdev, ieee); /* chiptype is u8 but id->driver_data is ulong - ** Works for now (possible values are 1 and 2) */ + * Works for now (possible values are 1 and 2) */ chip_type = CHIPTYPE_ACX100; /* acx100 and acx111 have different PCI memory regions */ if (chip_type == CHIPTYPE_ACX100) { @@ -3223,13 +3253,13 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { adev->irq = i; log(L_ANY, "found an %s-based wireless network card, " - "irq:%d, " - "membase:0x%08lx, mem_size:%ld, " - "iobase:0x%p", - chip_name, - adev->irq, - adev->membase, addr_size, - adev->iobase); + "irq:%d, " + "membase:0x%08lx, mem_size:%ld, " + "iobase:0x%p", + chip_name, + adev->irq, + adev->membase, addr_size, + adev->iobase); log(L_ANY, "the initial debug setting is 0x%04X\n", acx_debug); if (adev->irq == 0) { @@ -3286,13 +3316,15 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { /* Register the card, AFTER everything else has been set up, * since otherwise an ioctl could step on our feet due to - * firmware operations happening in parallel or uninitialized data */ + * firmware operations happening in parallel or uninitialized + * data */ if (acx_proc_register_entries(ieee) != OK) goto fail_proc_register_entries; /* Now we have our device, so make sure the kernel doesn't try - * to send packets even though we're not associated to a network yet */ + * to send packets even though we're not associated to a + * network yet */ // OW FIXME Check if acx_stop_queue, acx_carrier_off should be included // OW Rest can be cleaned up @@ -3401,9 +3433,9 @@ STATick int __devexit acxmem_remove(struct platform_device *pdev) { } #ifdef REDUNDANT - /* put the eCPU to sleep to save power - * Halting is not possible currently, - * since not supported by all firmware versions */ + /* put the eCPU to sleep to save power Halting is not + * possible currently, since not supported by all + * firmware versions */ acx_issue_cmd(adev, ACX100_CMD_SLEEP, NULL, 0); #endif @@ -3450,9 +3482,8 @@ STATick int __devexit acxmem_remove(struct platform_device *pdev) { /* remove dev registration */ platform_set_drvdata(pdev, NULL); - /* Free netdev (quite late, - * since otherwise we might get caught off-guard - * by a netdev timeout handler execution + /* Free netdev (quite late, since otherwise we might get + * caught off-guard by a netdev timeout handler execution * expecting to see a working dev...) */ ieee80211_free_hw(adev->ieee); @@ -3543,8 +3574,9 @@ STATick int acxmem_e_resume(struct platform_device *pdev) { acx_up(hw); pr_acx("rsm: acx up done\n"); - /* now even reload all card parameters as they were before suspend, - * and possibly be back in the network again already :-) + /* now even reload all card parameters as they were before + * suspend, and possibly be back in the network again already + * :-) */ /* - most settings updated in acxmem_s_up() */ if (ACX_STATE_IFACE_UP & adev->dev_state_mask) { diff --git a/pci.c b/pci.c index 1f4ffee..1116e8e 100644 --- a/pci.c +++ b/pci.c @@ -256,16 +256,16 @@ void acxpci_delete_dma_regions(acx_device_t * adev) { FN_ENTER; /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's no - * longer possible here? */ + * here instead? Or are we that much down the road that it's + * no longer possible here? */ write_reg16(adev, IO_ACX_ENABLE, 0); acx_mwait(100); - /* NO locking for all parts of acxpci_free_desc_queues because: - * while calling dma_free_coherent() interrupts need to be 'free' - * but if you spinlock the whole function (acxpci_free_desc_queues) - * you'll get an error */ + /* NO locking for all parts of acxpci_free_desc_queues + * because: while calling dma_free_coherent() interrupts need + * to be 'free' but if you spinlock the whole function + * (acxpci_free_desc_queues) you'll get an error */ acx_free_desc_queues(adev); FN_EXIT0; @@ -313,12 +313,11 @@ acxpci_s_write_eeprom(acx_device_t * adev, u32 addr, u32 len, FN_ENTER; - /* first we need to enable the OE (EEPROM Output Enable) GPIO line - * to be able to write to the EEPROM. - * NOTE: an EEPROM writing success has been reported, - * but you probably have to modify GPIO_OUT, too, - * and you probably need to activate a different GPIO - * line instead! */ + /* first we need to enable the OE (EEPROM Output Enable) GPIO + * line to be able to write to the EEPROM. NOTE: an EEPROM + * writing success has been reported, but you probably have to + * modify GPIO_OUT, too, and you probably need to activate a + * different GPIO line instead! */ gpio_orig = read_reg16(adev, IO_ACX_GPIO_OE); write_reg16(adev, IO_ACX_GPIO_OE, gpio_orig & ~1); write_flush(adev); @@ -400,9 +399,9 @@ int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value) { FN_ENTER; - /* mprusko said that 32bit accesses result in distorted sensitivity - * on his card. Unconfirmed, looks like it's not true (most likely since we - * now properly flush writes). */ + /* mprusko said that 32bit accesses result in distorted + * sensitivity on his card. Unconfirmed, looks like it's not + * true (most likely since we now properly flush writes). */ write_reg32(adev, IO_ACX_PHY_DATA, value); write_reg32(adev, IO_ACX_PHY_ADDR, reg); write_flush(adev); @@ -587,9 +586,10 @@ int acxpci_upload_fw(acx_device_t *adev) FN_ENTER; - /* print exact chipset and radio ID to make sure people - * really get a clue on which files exactly they need to provide. - * Firmware loading is a frequent end-user PITA with these chipsets. + /* print exact chipset and radio ID to make sure people really + * get a clue on which files exactly they need to provide. + * Firmware loading is a frequent end-user PITA with these + * chipsets. */ pr_acx("need firmware for acx1%02d chipset with radio ID %02X\n" "Please provide via firmware hotplug:\n" @@ -602,9 +602,11 @@ int acxpci_upload_fw(acx_device_t *adev) IS_ACX111(adev)*11, adev->radio_type ); - /* print exact chipset and radio ID to make sure people really get a clue on which files exactly they are supposed to provide, - * since firmware loading is the biggest enduser PITA with these chipsets. - * Not printing radio ID in 0xHEX in order to not confuse them into wrong file naming */ + /* print exact chipset and radio ID to make sure people really + * get a clue on which files exactly they are supposed to + * provide, since firmware loading is the biggest enduser PITA + * with these chipsets. Not printing radio ID in 0xHEX in + * order to not confuse them into wrong file naming */ pr_acx("need to load firmware for acx1%02d chipset with radio ID %02x, please provide via firmware hotplug:\n" "acx: either one file only (<c>ombined firmware image file, radio-specific) or two files (radio-less base image file *plus* separate <r>adio-specific extension file)\n", IS_ACX111(adev)*11, adev->radio_type); @@ -734,8 +736,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, /* now write the parameters of the command if needed */ if (buffer && buflen) { - /* if it's an INTERROGATE command, just pass the length - * of parameters to read, as data */ + /* if it's an INTERROGATE command, just pass the + * length of parameters to read, as data */ #if CMD_DISCOVERY if (cmd == ACX1xx_CMD_INTERROGATE) memset_io(adev->cmd_area + 4, 0xAA, buflen); @@ -756,9 +758,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, /* wait for firmware to process command */ - /* Ensure nonzero and not too large timeout. - ** Also converts e.g. 100->99, 200->199 - ** which is nice but not essential */ + /* Ensure nonzero and not too large timeout. Also converts + * e.g. 100->99, 200->199 which is nice but not essential */ cmd_timeout = (cmd_timeout - 1) | 1; if (unlikely(cmd_timeout > 1199)) cmd_timeout = 1199; @@ -825,8 +826,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, if (1 != cmd_status) { /* it is not a 'Success' */ /* zero out result buffer - * WARNING: this will trash stack in case of illegally large input - * length! */ + * WARNING: this will trash stack in case of illegally + * large input length! */ if (buffer && buflen) memset(buffer, 0, buflen); goto bad; @@ -848,8 +849,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, return OK; bad: - /* Give enough info so that callers can avoid - ** printing their own diagnostic messages */ + /* Give enough info so that callers can avoid printing their + * own diagnostic messages */ logf1(L_ANY, "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n", devname, cmdstr, buflen, cmd_timeout, @@ -946,8 +947,8 @@ int acxpci_reset_dev(acx_device_t *adev) FN_ENTER; - /* reset the device to make sure the eCPU is stopped - * to upload the firmware correctly */ + /* reset the device to make sure the eCPU is stopped to upload + * the firmware correctly */ #ifdef CONFIG_PCI acxpci_reset_mac(adev); @@ -977,8 +978,8 @@ int acxpci_reset_dev(acx_device_t *adev) /* need to know radio type before fw load */ /* Need to wait for arrival of this information in a loop, * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also - * sets the radio type ID */ + * (started burst read in reset_mac()) which also sets the + * radio type ID */ count = 0xffff; do { @@ -1178,24 +1179,24 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) txdesc = acx_advance_txdesc(adev, txdesc, 1); } seq_printf(file, - "\n" - "** PCI data **\n" - "txbuf_start %p, txbuf_area_size %u, txbuf_startphy %08llx\n" - "txdesc_size %u, txdesc_start %p\n" - "txhostdesc_start %p, txhostdesc_area_size %u, txhostdesc_startphy %08llx\n" - "rxdesc_start %p\n" - "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" - "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", - adev->txbuf_start, adev->txbuf_area_size, - (unsigned long long)adev->txbuf_startphy, - adev->txdesc_size, adev->txdesc_start, - adev->txhostdesc_start, adev->txhostdesc_area_size, - (unsigned long long)adev->txhostdesc_startphy, - adev->rxdesc_start, - adev->rxhostdesc_start, adev->rxhostdesc_area_size, - (unsigned long long)adev->rxhostdesc_startphy, - adev->rxbuf_start, adev->rxbuf_area_size, - (unsigned long long)adev->rxbuf_startphy); + "\n" + "** PCI data **\n" + "txbuf_start %p, txbuf_area_size %u, txbuf_startphy %08llx\n" + "txdesc_size %u, txdesc_start %p\n" + "txhostdesc_start %p, txhostdesc_area_size %u, txhostdesc_startphy %08llx\n" + "rxdesc_start %p\n" + "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" + "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", + adev->txbuf_start, adev->txbuf_area_size, + (unsigned long long)adev->txbuf_startphy, + adev->txdesc_size, adev->txdesc_start, + adev->txhostdesc_start, adev->txhostdesc_area_size, + (unsigned long long)adev->txhostdesc_startphy, + adev->rxdesc_start, + adev->rxhostdesc_start, adev->rxhostdesc_area_size, + (unsigned long long)adev->rxhostdesc_startphy, + adev->rxbuf_start, adev->rxbuf_area_size, + (unsigned long long)adev->rxbuf_startphy); FN_EXIT0; return 0; @@ -1216,8 +1217,8 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) * acxpci_l_alloc_tx * Actually returns a txdesc_t* ptr * - * FIXME: in case of fragments, should allocate multiple descrs - * after figuring out how many we need and whether we still have + * FIXME: in case of fragments, should allocate multiple descrs after + * figuring out how many we need and whether we still have * sufficiently many. */ tx_t* acxpci_alloc_tx(acx_device_t * adev) @@ -1238,13 +1239,13 @@ tx_t* acxpci_alloc_tx(acx_device_t * adev) txdesc = acx_get_txdesc(adev, head); ctl8 = txdesc->Ctl_8; - /* 2005-10-11: there were several bug reports on this happening - ** but now cause seems to be understood & fixed */ + /* 2005-10-11: there were several bug reports on this + * happening but now cause seems to be understood & fixed */ // TODO OW Check if this is correct if (unlikely(DESC_CTL_HOSTOWN != (ctl8 & DESC_CTL_ACXDONE_HOSTOWN))) { - /* whoops, descr at current index is not free, so probably - * ring buffer already full */ + /* whoops, descr at current index is not free, so + * probably ring buffer already full */ pr_acx("BUG: tx_head:%d Ctl8:0x%02X - failed to find " "free txdesc\n", head, ctl8); txdesc = NULL; @@ -1324,9 +1325,9 @@ void acxpci_irq_work(struct work_struct *work) while(irqcnt--) { #endif - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq reasons. - * However masked irq reasons we still read with IO_ACX_IRQ_REASON or - * IO_ACX_IRQ_STATUS_NON_DES + /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq + * reasons. However masked irq reasons we still read with + * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES */ irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); irqmasked = irqreason & ~adev->irq_mask; @@ -1512,8 +1513,8 @@ void acxpci_power_led(acx_device_t * adev, int enable) { u16 gpio_pled = IS_ACX111(adev) ? 0x0040 : 0x0800; - /* A hack. Not moving message rate limiting to adev->xxx - * (it's only a debug message after all) */ + /* A hack. Not moving message rate limiting to adev->xxx (it's + * only a debug message after all) */ static int rate_limit = 0; if (rate_limit++ < 3) @@ -1529,8 +1530,8 @@ void acxpci_power_led(acx_device_t * adev, int enable) INLINE_IO int acxpci_adev_present(acx_device_t *adev) { - /* fast version (accesses the first register, IO_ACX_SOFT_RESET, - * which should be safe): */ + /* fast version (accesses the first register, + * IO_ACX_SOFT_RESET, which should be safe): */ return acx_readl(adev->iobase) != 0xffffffff; } @@ -1575,8 +1576,8 @@ acx111pci_ioctl_info(struct net_device *ndev, /* get Acx111 Memory Configuration */ memset(&memconf, 0, sizeof(memconf)); - /* BTW, fails with 12 (Write only) error code. - ** Retained for easy testing of issue_cmd error handling :) */ + /* BTW, fails with 12 (Write only) error code. Retained for + * easy testing of issue_cmd error handling :) */ acx_interrogate(adev, &memconf, ACX1xx_IE_QUEUE_CONFIG); /* get Acx111 Queue Configuration */ @@ -2009,21 +2010,24 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ieee->queues = 1; // OW TODO Check if RTS/CTS threshold can be included here - /* TODO: although in the original driver the maximum value was 100, - * the OpenBSD driver assigns maximum values depending on the type of - * radio transceiver (i.e. Radia, Maxim, etc.). This value is always a - * positive integer which most probably indicates the gain of the AGC - * in the rx path of the chip, in dB steps (0.625 dB, for example?). - * The mapping of this rssi value to dBm is still unknown, but it can - * nevertheless be used as a measure of relative signal strength. The - * other two values, i.e. max_signal and max_noise, do not seem to be - * supported on my acx111 card (they are always 0), although iwconfig - * reports them (in dBm) when using ndiswrapper with the Windows XP - * driver. The GPL-licensed part of the AVM FRITZ!WLAN USB Stick - * driver sources (for the TNETW1450, though) seems to also indicate - * that only the RSSI is supported. In conclusion, the max_signal and - * max_noise values will not be initialised by now, as they do not - * seem to be supported or how to acquire them is still unknown. */ + /* TODO: although in the original driver the maximum value was + * 100, the OpenBSD driver assigns maximum values depending on + * the type of radio transceiver (i.e. Radia, Maxim, + * etc.). This value is always a positive integer which most + * probably indicates the gain of the AGC in the rx path of + * the chip, in dB steps (0.625 dB, for example?). The + * mapping of this rssi value to dBm is still unknown, but it + * can nevertheless be used as a measure of relative signal + * strength. The other two values, i.e. max_signal and + * max_noise, do not seem to be supported on my acx111 card + * (they are always 0), although iwconfig reports them (in + * dBm) when using ndiswrapper with the Windows XP driver. The + * GPL-licensed part of the AVM FRITZ!WLAN USB Stick driver + * sources (for the TNETW1450, though) seems to also indicate + * that only the RSSI is supported. In conclusion, the + * max_signal and max_noise values will not be initialised by + * now, as they do not seem to be supported or how to acquire + * them is still unknown. */ // We base signal quality on winlevel approach of previous driver // TODO OW 20100615 This should into a common init code @@ -2038,8 +2042,9 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* We do not start with downed sem: we want PARANOID_LOCKING to work */ pr_acx("mutex_init(&adev->mutex); // adev = 0x%px\n", adev); mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->pdev = pdev; @@ -2061,11 +2066,12 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* enable busmastering (required for CardBus) */ pci_set_master(pdev); - /* Specify DMA mask 30-bit. Problem was triggered from >=2.6.33 on x86_64 */ + /* Specify DMA mask 30-bit. Problem was triggered from + * >=2.6.33 on x86_64 */ adev->bus_dev->coherent_dma_mask = DMA_BIT_MASK(30); - /* chiptype is u8 but id->driver_data is ulong - ** Works for now (possible values are 1 and 2) */ + /* chiptype is u8 but id->driver_data is ulong Works for now + * (possible values are 1 and 2) */ chip_type = (u8) id->driver_data; /* acx100 and acx111 have different PCI memory regions */ if (chip_type == CHIPTYPE_ACX100) { @@ -2111,8 +2117,8 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* * We got them? Map them! * - * We pass 0 as the third argument to pci_iomap(): it will map the full - * region in this case, which is what we want. + * We pass 0 as the third argument to pci_iomap(): it will map + * the full region in this case, which is what we want. */ mem1 = pci_iomap(pdev, mem_region1, 0); @@ -2178,15 +2184,16 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) INIT_WORK(&adev->tx_work, acx_tx_work); skb_queue_head_init(&adev->tx_queue); - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + * large parts of the I/O registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ if (OK != acx_reset_dev(adev)) goto fail_reset_dev; if (IS_ACX100(adev)) { - /* ACX100: configopt struct in cmd mailbox - directly after reset */ + /* ACX100: configopt struct in cmd mailbox - directly + * after reset */ memcpy_fromio(&co, adev->cmd_area, sizeof(co)); } @@ -2194,11 +2201,13 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto fail_init_mac; if (IS_ACX111(adev)) { - /* ACX111: configopt struct needs to be queried after full init */ + /* ACX111: configopt struct needs to be queried after + * full init */ acx_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS); } - /* TODO: merge them into one function, they are called just once and are the same for pci & usb */ + /* TODO: merge them into one function, they are called just + * once and are the same for pci & usb */ if (OK != acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version)) goto fail_read_eeprom_byte; @@ -2209,7 +2218,8 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Register the card, AFTER everything else has been set up, * since otherwise an ioctl could step on our feet due to - * firmware operations happening in parallel or uninitialized data */ + * firmware operations happening in parallel or uninitialized + * data */ if (acx_proc_register_entries(ieee) != OK) goto fail_proc_register_entries; @@ -2352,9 +2362,9 @@ void __devexit acxpci_remove(struct pci_dev *pdev) } #ifdef REDUNDANT - /* put the eCPU to sleep to save power - * Halting is not possible currently, - * since not supported by all firmware versions */ + /* put the eCPU to sleep to save power Halting is not + * possible currently, since not supported by all + * firmware versions */ acx_issue_cmd(adev, ACX100_CMD_SLEEP, NULL, 0); #endif /* disable power LED to save power :-) */ @@ -2362,8 +2372,8 @@ void __devexit acxpci_remove(struct pci_dev *pdev) acxpci_power_led(adev, 0); /* stop our eCPU */ if (IS_ACX111(adev)) { - /* FIXME: does this actually keep halting the eCPU? - * I don't think so... + /* FIXME: does this actually keep halting the + * eCPU? I don't think so... */ acxpci_reset_mac(adev); } else { @@ -2408,9 +2418,8 @@ void __devexit acxpci_remove(struct pci_dev *pdev) /* remove dev registration */ pci_set_drvdata(pdev, NULL); - /* Free netdev (quite late, - * since otherwise we might get caught off-guard - * by a netdev timeout handler execution + /* Free netdev (quite late, since otherwise we might get + * caught off-guard by a netdev timeout handler execution * expecting to see a working dev...) */ ieee80211_free_hw(adev->ieee); @@ -2492,8 +2501,9 @@ int acxpci_e_resume(struct pci_dev *pdev) acx_up(hw); pr_acx("rsm: acx up done\n"); - /* now even reload all card parameters as they were before suspend, - * and possibly be back in the network again already :-) */ + /* now even reload all card parameters as they were before + * suspend, and possibly be back in the network again already + * :-) */ if (ACX_STATE_IFACE_UP & adev->dev_state_mask) { adev->set_mask = GETSET_ALL; //acx_update_card_settings(adev); @@ -2681,8 +2691,9 @@ static __devinit int vlynq_probe(struct vlynq_device *vdev, spin_lock_init(&adev->spinlock); /* initial state: unlocked */ /* We do not start with downed sem: we want PARANOID_LOCKING to work */ mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->vdev = vdev; @@ -2782,9 +2793,9 @@ static __devinit int vlynq_probe(struct vlynq_device *vdev, INIT_WORK(&adev->tx_work, acx_tx_work); skb_queue_head_init(&adev->tx_queue); - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + ... [truncated message content] |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:26
|
Add #if/#else/#endif on CONFIG_ACX_MAC80211_MEM, with static inline stub functions to provide the right fn-protos. Added an #if guard to 1 func in merge.c, and stub in merge.h; the func should probably be moved back to mem.c Signed-off-by: Jim Cromie <jim...@gm...> --- mem.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++++------------- merge.c | 6 ++++- merge.h | 24 ++++++------------ 3 files changed, 78 insertions(+), 35 deletions(-) diff --git a/mem.h b/mem.h index 17c8bad..1db3d6b 100644 --- a/mem.h +++ b/mem.h @@ -8,12 +8,16 @@ #define STATick /* ick: suppress static, let linker find fns in mem.o pci.o */ +#if defined(CONFIG_ACX_MAC80211_MEM) + #define DUMP_MEM_DEFINED 1 // to insure export of dump* fns too // Logging #if DUMP_MEM_DEFINED > 0 void acxmem_dump_mem(acx_device_t *adev, u32 start, int length); +#else +inline void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) { } #endif void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, @@ -23,26 +27,18 @@ void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); -// Firmware, EEPROM, Phy - -int acxmem_upload_radio(acx_device_t *adev); +// in merge.c ! +// int acxmem_upload_radio(acx_device_t *adev); int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -// CMDs (Control Path) - void acxmem_reset_mac(acx_device_t *adev); -// Other (Control Path) - -// Proc, Debug int acxmem_proc_diag_output(struct seq_file *file, acx_device_t *adev); -// Rx Path -// Tx Path tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len); void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque); @@ -50,16 +46,67 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); void acxmem_init_acx_txbuf2(acx_device_t *adev); -void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); - -// Irq Handling, Timer -// Helpers -// Ioctls -// Driver, Module - int __init acxmem_init_module(void); void __exit acxmem_cleanup_module(void); void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acxmem_init_mboxes(acx_device_t *adev); - + + +#else // CONFIG_ACX_MAC80211_MEM + + +static inline void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) { } + +static inline void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, + u8 *source, int count) +{ } + +static inline void acxmem_chaincopy_to_slavemem(acx_device_t *adev, + u32 destination, u8 *source, int count) +{ } + +static inline void acxmem_chaincopy_from_slavemem(acx_device_t *adev, + u8 *destination, u32 source, int count) +{ } + +//inline int acxmem_upload_radio(acx_device_t *adev) +//{ return 0; } + +static inline int acxmem_write_fw(acx_device_t *adev, + const firmware_image_t *fw_image, u32 offset) +{ return 0; } + +static inline int acxmem_validate_fw(acx_device_t *adev, + const firmware_image_t *fw_image, u32 offset) +{ return 0; } + +static inline void acxmem_reset_mac(acx_device_t *adev) { } + +static inline int acxmem_proc_diag_output(struct seq_file *file, + acx_device_t *adev) +{ return 0; } + +static inline tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) +{ return (tx_t*) NULL; } + +static inline void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) +{ } + +static inline u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, + int count) +{ return 0; } + +static inline void acxmem_init_acx_txbuf2(acx_device_t *adev) { } + +static inline int __init acxmem_init_module(void) { return 0; } +static inline void __exit acxmem_cleanup_module(void) { } + +static inline void acxmem_write_cmd_type_status(acx_device_t *adev, + u16 type, u16 status) +{ } + +static inline void acxmem_init_mboxes(acx_device_t *adev) { } + + +#endif // CONFIG_ACX_MAC80211_MEM diff --git a/merge.c b/merge.c index 0896399..288f83b 100644 --- a/merge.c +++ b/merge.c @@ -3490,7 +3490,10 @@ void acx_clean_txdesc_emergency(acx_device_t *adev) FN_EXIT0; } -void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { +#if defined(CONFIG_ACX_MAC80211_MEM) +// probly should move this back to merge.c +void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) +{ #ifdef USING_MORE_THAN_ONE_TRANSMIT_QUEUE u32 indicator; unsigned long flags; @@ -3550,6 +3553,7 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { local_irq_restore (flags); #endif } +#endif // CONFIG_ACX_MAC80211_MEM) acxmem_update_queue_indicator() // OW TODO See if this is usable with mac80211 #if 0 diff --git a/merge.h b/merge.h index 8cb48e2..009df61 100644 --- a/merge.h +++ b/merge.h @@ -76,26 +76,18 @@ int acxmem_upload_fw(acx_device_t *adev); void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, u32 rx_queue_start); +/* wrappers on acx_upload_radio(adev, filename */ +int acxmem_upload_radio(acx_device_t *adev); +int acxpci_upload_radio(acx_device_t *adev); -#if !defined(CONFIG_ACX_MAC80211_MEM) +#if defined(CONFIG_ACX_MAC80211_MEM) -static inline u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, - int count) -{ return 0; } +void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -static inline void acxmem_chaincopy_to_slavemem(acx_device_t *adev, - u32 destination, u8 *source, int count) -{ } - -static inline void acxmem_chaincopy_from_slavemem(acx_device_t *adev, - u8 *destination, u32 source, int count) -{ } - -static inline void acxmem_init_acx_txbuf2(acx_device_t *adev) -{ } +#else -static inline void acxmem_dump_mem(acx_device_t *adev, u32 start, - int length) +static inline void acxmem_update_queue_indicator(acx_device_t *adev, + int txqueue) { } #endif -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:31
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 99 +++++++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 60 insertions(+), 39 deletions(-) diff --git a/mem.c b/mem.c index 0eed320..5a88f4d 100644 --- a/mem.c +++ b/mem.c @@ -145,7 +145,8 @@ char acxmem_printable(char c); #if DUMP_MEM_DEFINED > 0 //= static -void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) { +void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) +{ int i; u8 buf[16]; @@ -466,9 +467,8 @@ acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, FN_ENTER; data_verify = kmalloc(len, GFP_KERNEL); - if (!data_verify) { + if (!data_verify) goto end; - } /* first we need to enable the OE (EEPROM Output Enable) GPIO * line to be able to write to the EEPROM. NOTE: an EEPROM @@ -531,7 +531,8 @@ acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, } #endif /* UNUSED */ -STATick inline void acxmem_read_eeprom_area(acx_device_t *adev) { +STATick inline void acxmem_read_eeprom_area(acx_device_t *adev) +{ #if ACX_DEBUG > 1 int offs; u8 tmp; @@ -792,7 +793,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, */ -STATick int acxmem_verify_init(acx_device_t *adev) { +STATick int acxmem_verify_init(acx_device_t *adev) +{ int result = NOT_OK; unsigned long timeout; u32 irqstat; @@ -826,7 +828,8 @@ STATick int acxmem_verify_init(acx_device_t *adev) { /* * Most of the acx specific pieces of hardware reset. */ -STATick int acxmem_complete_hw_reset(acx_device_t *adev) { +STATick int acxmem_complete_hw_reset(acx_device_t *adev) +{ acx111_ie_configoption_t co; acxmem_lock_flags; @@ -934,7 +937,8 @@ STATick void acxmem_reset_mac(acx_device_t *adev) ** FIXME: most likely needs refinement */ #if 0 // or mem.c:2019:2: error: implicit declaration of function 'ndev2adev' -STATick void acxmem_i_set_multicast_list(struct net_device *ndev) { +STATick void acxmem_i_set_multicast_list(struct net_device *ndev) +{ acx_device_t *adev = ndev2adev(ndev); unsigned long flags; @@ -1167,7 +1171,8 @@ int acxmem_proc_diag_output(struct seq_file *file, * * Called directly and only from the IRQ handler */ -STATick void acxmem_process_rxdesc(acx_device_t *adev) { +STATick void acxmem_process_rxdesc(acx_device_t *adev) +{ register rxhostdesc_t *hostdesc; register rxdesc_t *rxdesc; unsigned count, tail; @@ -1290,7 +1295,8 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { * ================================================== */ -void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque) { +void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque) +{ return acxmem_get_txhostdesc(adev, (txdesc_t*) tx_opaque)->data; } @@ -1379,7 +1385,8 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) * interrupt context, so it shouldn't block to protect the integrity * of the linked list. The ISR already holds the lock. */ -STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { +STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) +{ u32 cur, last, next; if ((blockptr >= adev->acx_txbuf_start) && @@ -1477,7 +1484,8 @@ void acxmem_init_acx_txbuf2(acx_device_t *adev) #endif STATick txhostdesc_t* -acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { +acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) +{ int index = (u8*) txdesc - (u8*) adev->txdesc_start; if (unlikely(ACX_DEBUG && (index % adev->txdesc_size))) { pr_info("bad txdesc ptr %p\n", txdesc); @@ -1535,7 +1543,8 @@ void acxmem_clean_txdesc_emergency(acx_device_t *adev) FN_EXIT0; } -void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { +void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) +{ #ifdef USING_MORE_THAN_ONE_TRANSMIT_QUEUE u32 indicator; unsigned long flags; @@ -1605,7 +1614,8 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { */ #if 0 // or mem.c:3242:3: warning: passing argument 1 of 'acx_wake_queue' // from incompatible pointer type [enabled by default] -STATick void acxmem_i_tx_timeout(struct net_device *ndev) { +STATick void acxmem_i_tx_timeout(struct net_device *ndev) +{ acx_device_t *adev = ndev2adev(ndev); unsigned long flags; unsigned int tx_num_cleaned; @@ -1884,7 +1894,8 @@ static const struct ieee80211_ops acxmem_hw_ops = { * ================================================== */ -void acxmem_power_led(acx_device_t *adev, int enable) { +void acxmem_power_led(acx_device_t *adev, int enable) +{ u16 gpio_pled = IS_ACX111(adev) ? 0x0040 : 0x0800; /* A hack. Not moving message rate limiting to adev->xxx @@ -1902,13 +1913,15 @@ void acxmem_power_led(acx_device_t *adev, int enable) { | gpio_pled); } -INLINE_IO int acxmem_adev_present(acx_device_t *adev) { +INLINE_IO int acxmem_adev_present(acx_device_t *adev) +{ /* fast version (accesses the first register, IO_ACX_SOFT_RESET, * which should be safe): */ return acx_readl(adev->iobase) != 0xffffffff; } -STATick char acxmem_printable(char c) { +STATick char acxmem_printable(char c) +{ return ((c >= 20) && (c < 127)) ? c : '.'; } @@ -2225,11 +2238,11 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, return OK; } -/*********************************************************************** - */ +/*********************************************************************/ int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) { + struct iw_param *vwrq, char *extra) +{ // OW acx_device_t *adev = ieee2adev(hw); unsigned long flags; @@ -2258,12 +2271,13 @@ int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, acx_lock(adev, flags); gpio_old = read_reg16(adev, IO_ACX_GPIO_OUT); write_reg16(adev, IO_ACX_GPIO_OUT, - (gpio_old & 0xf8ff) | ((u16) *extra << 8)); + (gpio_old & 0xf8ff) | ((u16) *extra << 8)); acx_unlock(adev, flags); log(L_DEBUG, "gpio_old: 0x%04X\n", gpio_old); pr_acx("%s: PHY power amplifier bias: old:%d, new:%d\n", - wiphy_name(adev->ieee->wiphy), (gpio_old & 0x0700) >> 8, (unsigned char) *extra); + wiphy_name(adev->ieee->wiphy), + (gpio_old & 0x0700) >> 8, (unsigned char) *extra); acx_sem_unlock(adev); @@ -2291,8 +2305,8 @@ int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, * pdev - ptr to pci device structure containing info about pci configuration * id - ptr to the device id entry that matched this device */ -STATick int __devinit acxmem_probe(struct platform_device *pdev) { - +STATick int __devinit acxmem_probe(struct platform_device *pdev) +{ acx_device_t *adev = NULL; const char *chip_name; int result = -EIO; @@ -2311,7 +2325,8 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { ieee = ieee80211_alloc_hw(sizeof(struct acx_device), &acxmem_hw_ops); if (!ieee) { - pr_acx("could not allocate ieee80211 structure %s\n", pdev->name); + pr_acx("could not allocate ieee80211 structure %s\n", + pdev->name); goto fail_ieee80211_alloc_hw; } SET_IEEE80211_DEV(ieee, &pdev->dev); @@ -2429,7 +2444,8 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { IRQF_SHARED, KBUILD_MODNAME, adev)) { - pr_acx("%s: request_irq FAILED\n", wiphy_name(adev->ieee->wiphy)); + pr_acx("%s: request_irq FAILED\n", + wiphy_name(adev->ieee->wiphy)); result = -EAGAIN; goto fail_request_irq; } @@ -2490,8 +2506,8 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { #endif pr_acx("net device %s, driver compiled " - "against wireless extensions %d and Linux %s\n", - wiphy_name(adev->ieee->wiphy), WIRELESS_EXT, UTS_RELEASE); + "against wireless extensions %d and Linux %s\n", + wiphy_name(adev->ieee->wiphy), WIRELESS_EXT, UTS_RELEASE); MAC_COPY(adev->ieee->wiphy->perm_addr, adev->dev_addr); @@ -2499,7 +2515,7 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { /* need to be able to restore PCI state after a suspend */ #ifdef CONFIG_PM - // pci_save_state(pdev); + // pci_save_state(pdev); #endif err = acx_setup_modes(adev); @@ -2559,9 +2575,10 @@ fail_ieee80211_alloc_hw: * * pdev - ptr to PCI device structure containing info about pci configuration */ -STATick int __devexit acxmem_remove(struct platform_device *pdev) { - - struct ieee80211_hw *hw = (struct ieee80211_hw *) platform_get_drvdata(pdev); +STATick int __devexit acxmem_remove(struct platform_device *pdev) +{ + struct ieee80211_hw *hw = (struct ieee80211_hw *) + platform_get_drvdata(pdev); acx_device_t *adev = ieee2adev(hw); acxmem_lock_flags; @@ -2656,9 +2673,10 @@ STATick int __devexit acxmem_remove(struct platform_device *pdev) { */ #ifdef CONFIG_PM STATick int -acxmem_e_suspend(struct platform_device *pdev, pm_message_t state) { - - struct ieee80211_hw *hw = (struct ieee80211_hw *) platform_get_drvdata(pdev); +acxmem_e_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct ieee80211_hw *hw = (struct ieee80211_hw *) + platform_get_drvdata(pdev); acx_device_t *adev; FN_ENTER; @@ -2693,9 +2711,10 @@ acxmem_e_suspend(struct platform_device *pdev, pm_message_t state) { return OK; } -STATick int acxmem_e_resume(struct platform_device *pdev) { - - struct ieee80211_hw *hw = (struct ieee80211_hw *) platform_get_drvdata(pdev); +STATick int acxmem_e_resume(struct platform_device *pdev) +{ + struct ieee80211_hw *hw = (struct ieee80211_hw *) + platform_get_drvdata(pdev); acx_device_t *adev; FN_ENTER; @@ -2771,7 +2790,8 @@ STATick struct platform_driver acxmem_driver = { * * Module initialization routine, called once at module load time */ -int __init acxmem_init_module(void) { +int __init acxmem_init_module(void) +{ int res; FN_ENTER; @@ -2807,7 +2827,8 @@ int __init acxmem_init_module(void) { * Called at module unload time. This is our last chance to * clean up after ourselves. */ -void __exit acxmem_cleanup_module(void) { +void __exit acxmem_cleanup_module(void) +{ FN_ENTER; pr_acxmem("cleanup_module\n"); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:32
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 639 +++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 332 insertions(+), 307 deletions(-) diff --git a/merge.c b/merge.c index 288f83b..511c2d1 100644 --- a/merge.c +++ b/merge.c @@ -68,24 +68,24 @@ irqreturn_t acx_interrupt(int irq, void *dev_id) spin_lock_irqsave(&adev->spinlock, flags); - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq reasons. - * However masked irq reasons we still read with IO_ACX_IRQ_REASON or - * IO_ACX_IRQ_STATUS_NON_DES + /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq + * reasons. However masked irq reasons we still read with + * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES */ irqreason = read_reg16(adev, IO_ACX_IRQ_STATUS_NON_DES); irqmasked = irqreason & ~adev->irq_mask; log(L_IRQ, "irqstatus=%04X, irqmasked=%04X,\n", irqreason, irqmasked); if (unlikely(irqreason == 0xffff)) { - /* 0xffff value hints at missing hardware, - * so don't do anything. - * Not very clean, but other drivers do the same... */ + /* 0xffff value hints at missing hardware, so don't do + * anything. Not very clean, but other drivers do the + * same... */ log(L_IRQ, "irqstatus=FFFF: Device removed?: IRQ_NONE\n"); goto none; } - /* Our irq-signals are the ones, that were triggered by the IO_ACX_IRQ_MASK - * unmasked irqs. + /* Our irq-signals are the ones, that were triggered by the + * IO_ACX_IRQ_MASK unmasked irqs. */ if (!irqmasked) { /* We are on a shared IRQ line and it wasn't our IRQ */ @@ -93,7 +93,8 @@ irqreturn_t acx_interrupt(int irq, void *dev_id) goto none; } - // Mask all irqs, until we handle them. We will unmask them later in the tasklet. + /* Mask all irqs, until we handle them. We will unmask them + * later in the tasklet. */ write_reg16(adev, IO_ACX_IRQ_MASK, HOST_INT_MASK_ALL); write_flush(adev); acx_schedule_task(adev, 0); @@ -283,9 +284,9 @@ static int acx_create_rx_host_desc_queue(acx_device_t * adev) hostdesc = adev->rxhostdesc_start; hostdesc_phy = adev->rxhostdesc_startphy; - /* don't make any popular C programming pointer arithmetic mistakes - * here, otherwise I'll kill you... - * (and don't dare asking me why I'm warning you about that...) */ + /* don't make any popular C programming pointer arithmetic + * mistakes here, otherwise I'll kill you... (and don't dare + * asking me why I'm warning you about that...) */ for (i = 0; i < RX_CNT; i++) { hostdesc->data = rxbuf; hostdesc->hd.data_phy = cpu2acx(rxbuf_phy); @@ -349,22 +350,19 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) txbuf_phy = adev->txbuf_startphy; #if 0 -/* Each tx buffer is accessed by hardware via -** txdesc -> txhostdesc(s) -> txbuffer(s). -** We use only one txhostdesc per txdesc, but it looks like -** acx111 is buggy: it accesses second txhostdesc -** (via hostdesc.desc_phy_next field) even if -** txdesc->hd.length == hostdesc->hd.length and thus -** entire packet was placed into first txhostdesc. -** Due to this bug acx111 hangs unless second txhostdesc -** has le16_to_cpu(hostdesc.length) = 3 (or larger) -** Storing NULL into hostdesc.desc_phy_next -** doesn't seem to help. -** -** Update: although it worked on Xterasys XN-2522g -** with len=3 trick, WG311v2 is even more bogus, doesn't work. -** Keeping this code (#ifdef'ed out) for documentational purposes. -*/ +/* Each tx buffer is accessed by hardware via txdesc -> txhostdesc(s) + * -> txbuffer(s). We use only one txhostdesc per txdesc, but it + * looks like acx111 is buggy: it accesses second txhostdesc (via + * hostdesc.desc_phy_next field) even if txdesc->hd.length == + * hostdesc->hd.length and thus entire packet was placed into first + * txhostdesc. Due to this bug acx111 hangs unless second txhostdesc + * has le16_to_cpu(hostdesc.length) = 3 (or larger) Storing NULL into + * hostdesc.desc_phy_next doesn't seem to help. + * + * Update: although it worked on Xterasys XN-2522g with len=3 trick, + * WG311v2 is even more bogus, doesn't work. Keeping this code + * (#ifdef'ed out) for documentational purposes. + */ for (i = 0; i < TX_CNT * 2; i++) { hostdesc_phy += sizeof(*hostdesc); if (!(i & 1)) { @@ -529,8 +527,8 @@ void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) + (TX_CNT * sizeof(txdesc_t))); /* NB: sizeof(txdesc_t) above is valid because we know - * we are in if (acx100) block. Beware of cut-n-pasting - * elsewhere! acx111's txdesc is larger! */ + * we are in if (acx100) block. Beware of cut-n-pasting + * elsewhere! acx111's txdesc is larger! */ if (IS_PCI(adev)) memset(adev->rxdesc_start, 0, @@ -713,9 +711,9 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) /* * acx_free_desc_queues * - * Releases the queues that have been allocated, the - * others have been initialised to NULL so this - * function can be used if only part of the queues were allocated. + * Releases the queues that have been allocated, the others have been + * initialised to NULL so this function can be used if only part of + * the queues were allocated. */ void acx_free_desc_queues(acx_device_t *adev) { @@ -858,10 +856,10 @@ int acx_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf) count = 0xffff; while (read_reg16(adev, IO_ACX_EEPROM_CTL)) { - /* scheduling away instead of CPU burning loop - * doesn't seem to work here at all: - * awful delay, sometimes also failure. - * Doesn't matter anyway (only small delay). */ + /* scheduling away instead of CPU burning loop doesn't + * seem to work here at all: awful delay, sometimes + * also failure. Doesn't matter anyway (only small + * delay). */ if (unlikely(!--count)) { pr_acx("%s: timeout waiting for EEPROM read\n", wiphy_name(adev->ieee->wiphy)); @@ -930,12 +928,11 @@ int acx_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, FN_ENTER; - /* first we need to enable the OE (EEPROM Output Enable) GPIO line - * to be able to write to the EEPROM. - * NOTE: an EEPROM writing success has been reported, - * but you probably have to modify GPIO_OUT, too, - * and you probably need to activate a different GPIO - * line instead! */ + /* first we need to enable the OE (EEPROM Output Enable) GPIO + * line to be able to write to the EEPROM. NOTE: an EEPROM + * writing success has been reported, but you probably have to + * modify GPIO_OUT, too, and you probably need to activate a + * different GPIO line instead! */ gpio_orig = read_reg16(adev, IO_ACX_GPIO_OE); write_reg16(adev, IO_ACX_GPIO_OE, gpio_orig & ~1); write_flush(adev); @@ -1017,8 +1014,8 @@ static inline void acx_read_eeprom_area(acx_device_t *adev) /* * _acx_read_phy_reg - from mem.c, has locking which looks harmless for pci.c * - * common.c has acx_read_phy_reg too, called (pci|mem|usb), now (usb|x) - * Messing with rx/tx disabling and enabling here + * common.c has acx_read_phy_reg too, called (pci|mem|usb), now + * (usb|x). Messing with rx/tx disabling and enabling here * (write_reg32(adev, IO_ACX_ENABLE, 0b000000xx)) kills traffic */ int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf) @@ -1037,10 +1034,10 @@ int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf) count = 0xffff; // todo moe while to fn, reuse while (read_reg32(adev, IO_ACX_PHY_CTL)) { - /* scheduling away instead of CPU burning loop - * doesn't seem to work here at all: - * awful delay, sometimes also failure. - * Doesn't matter anyway (only small delay). */ + /* scheduling away instead of CPU burning loop doesn't + * seem to work here at all: awful delay, sometimes + * also failure. Doesn't matter anyway (only small + * delay). */ if (unlikely(!--count)) { pr_acx("%s: timeout waiting for phy read\n", wiphy_name(adev->ieee->wiphy)); @@ -1088,10 +1085,10 @@ int _acx_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) // this not present for pci count = 0xffff; while (read_reg32(adev, IO_ACX_PHY_CTL)) { - /* scheduling away instead of CPU burning loop - * doesn't seem to work here at all: - * awful delay, sometimes also failure. - * Doesn't matter anyway (only small delay). */ + /* scheduling away instead of CPU burning loop doesn't + * seem to work here at all: awful delay, sometimes + * also failure. Doesn't matter anyway (only small + * delay). */ if (unlikely(!--count)) { pr_acx("%s: timeout waiting for phy read\n", wiphy_name(adev->ieee->wiphy)); @@ -1383,10 +1380,11 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename) if ((HX4700_FIRMWARE_CHECKSUM == fw_image->chksum) || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) { /* - * Put the patch after the main firmware image. 0x950c contains - * the ACX's idea of the end of the firmware. Use that location to - * load ours (which depends on that location being 0xab58) then - * update that location to point to after ours. + * Put the patch after the main firmware image. + * 0x950c contains the ACX's idea of the end of the + * firmware. Use that location to load ours (which + * depends on that location being 0xab58) then update + * that location to point to after ours. */ offset = read_slavemem32(adev, 0x950c); @@ -1399,12 +1397,14 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename) } /* - * Patch the instruction at 0x0804 to branch to our ARM patch at 0xab58 + * Patch the instruction at 0x0804 to branch to our + * ARM patch at 0xab58 */ write_slavemem32(adev, 0x0804, 0xea000000 + (0xab58 - 0x0804 - 8) / 4); /* - * Patch the instructions at 0x1f40 to branch to our Thumb patch at 0xab74 + * Patch the instructions at 0x1f40 to branch to our + * Thumb patch at 0xab74 * * 4a00 ldr r2, [pc, #0] * 4710 bx r2 @@ -1594,14 +1594,15 @@ void acx_init_mboxes(acx_device_t *adev) * * OW, 20100630: * - * The mem device is quite sensible to data access operations, therefore - * we may not sleep during the command handling. + * The mem device is quite sensible to data access operations, + * therefore we may not sleep during the command handling. * - * This has manifested as problem during sw-scan while if up. The acx got - * stuck - most probably due to concurrent data access collision. + * This has manifested as problem during sw-scan while if up. The acx + * got stuck - most probably due to concurrent data access collision. * - * By not sleeping anymore and doing the entire operation completely under - * spinlock (thus with irqs disabled), the sw scan problem was solved. + * By not sleeping anymore and doing the entire operation completely + * under spinlock (thus with irqs disabled), the sw scan problem was + * solved. * * We can now run repeating sw scans, under load, without that the acx * device gets stuck. @@ -1676,8 +1677,8 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, /* now write the parameters of the command if needed */ if (buffer && buflen) { - /* if it's an INTERROGATE command, just pass the length - * of parameters to read, as data */ + /* if it's an INTERROGATE command, just pass the + * length of parameters to read, as data */ #if CMD_DISCOVERY if (cmd == ACX1xx_CMD_INTERROGATE) memset_io(adev->cmd_area + 4, 0xAA, buflen); @@ -1689,7 +1690,8 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, (cmd == ACX1xx_CMD_INTERROGATE) ? 4 : buflen); } else { - /* adev->cmd_area points to PCI device's memory, not to RAM! */ + /* adev->cmd_area points to PCI device's + * memory, not to RAM! */ memcpy_toio(adev->cmd_area + 4, buffer, (cmd == ACX1xx_CMD_INTERROGATE) ? 4 : buflen); } @@ -1706,9 +1708,9 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, /* wait for firmware to process command */ - /* Ensure nonzero and not too large timeout. - ** Also converts e.g. 100->99, 200->199 - ** which is nice but not essential */ + /* Ensure nonzero and not too large timeout. Also converts + * e.g. 100->99, 200->199 which is nice but not essential + */ cmd_timeout = (cmd_timeout - 1) | 1; if (unlikely(cmd_timeout> 1199)) cmd_timeout = 1199; @@ -1778,9 +1780,8 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, if (cmd_status != 1) { /* it is not a 'Success' */ - /* zero out result buffer - * WARNING: this will trash stack in case of illegally - * large input length! */ + /* zero out result buffer WARNING: this will trash + * stack in case of illegally large input length! */ if (buflen > 388) { /* 388 is maximum command length */ @@ -1822,8 +1823,8 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, return OK; bad: - /* Give enough info so that callers can avoid - ** printing their own diagnostic messages */ + /* Give enough info so that callers can avoid printing their + * own diagnostic messages */ logf1(L_ANY, "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n", devname, cmdstr, buflen, cmd_timeout, (buffer ? le16_to_cpu(((acx_ie_generic_t *) buffer)->type) @@ -1904,8 +1905,8 @@ void acx_up(struct ieee80211_hw *hw) acxmem_unlock(); /* acx fw < 1.9.3.e has a hardware timer, and older drivers - ** used to use it. But we don't do that anymore, our OS - ** has reliable software timers */ + * used to use it. But we don't do that anymore, our OS has + * reliable software timers */ init_timer(&adev->mgmt_timer); adev->mgmt_timer.function = acx_timer; adev->mgmt_timer.data = (unsigned long) adev; @@ -2018,8 +2019,8 @@ int acx_reset_dev(acx_device_t *adev) /* need to know radio type before fw load */ /* Need to wait for arrival of this information in a loop, * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also - * sets the radio type ID */ + * (started burst read in reset_mac()) which also sets the + * radio type ID */ count = 0xffff; do { @@ -2184,16 +2185,17 @@ static int acxmem_complete_hw_reset(acx_device_t *adev) acx111_ie_configoption_t co; acxmem_lock_flags; - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + * large parts of the I/O registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ if (OK != acx_reset_dev(adev)) return -1; acxmem_lock(); if (IS_ACX100(adev)) { - /* ACX100: configopt struct in cmd mailbox - directly after reset */ + /* ACX100: configopt struct in cmd mailbox - directly + * after reset */ acxmem_copy_from_slavemem(adev, (u8*) &co, (u32) adev->cmd_area, sizeof(co)); } @@ -2203,7 +2205,8 @@ static int acxmem_complete_hw_reset(acx_device_t *adev) return -3; if (IS_ACX111(adev)) { - /* ACX111: configopt struct needs to be queried after full init */ + /* ACX111: configopt struct needs to be queried after + * full init */ acx_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS); } @@ -2251,8 +2254,8 @@ static void acxmem_i_set_multicast_list(struct net_device *ndev) acx_lock(adev, flags); - /* firmwares don't have allmulti capability, - * so just use promiscuous mode instead in this case. */ + /* firmwares don't have allmulti capability, so just use + * promiscuous mode instead in this case. */ if (ndev->flags & (IFF_PROMISC|IFF_ALLMULTI)) { SET_BIT(adev->rx_config_1, RX_CFG1_RCV_PROMISCUOUS); CLEAR_BIT(adev->rx_config_1, RX_CFG1_FILTER_ALL_MULTI); @@ -2501,7 +2504,8 @@ void acx_process_rxdesc(acx_device_t *adev) /* First, have a loop to determine the first descriptor that's * full, just in case there's a mismatch between our current - * rx_tail and the full descriptor we're supposed to handle. */ + * rx_tail and the full descriptor we're supposed to + * handle. */ tail = adev->rx_tail; count = RX_CNT; while (1) { @@ -2698,11 +2702,12 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { if (unlikely(!adev->tx_free)) { log(L_ANY, "%s: BUG: no free txdesc left\n", __func__); /* - * Probably the ACX ignored a transmit attempt and now there's a packet - * sitting in the queue we think should be transmitting but the ACX doesn't - * know about. - * On the first pass, send the ACX a TxProc interrupt to try moving - * things along, and if that doesn't work (ie, we get called again) completely + * Probably the ACX ignored a transmit attempt and now + * there's a packet sitting in the queue we think + * should be transmitting but the ACX doesn't know + * about. On the first pass, send the ACX a TxProc + * interrupt to try moving things along, and if that + * doesn't work (ie, we get called again) completely * flush the transmit queue. */ if (txattempts < 10) { @@ -2720,27 +2725,29 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { } /* - * Make a quick check to see if there is transmit buffer space on - * the ACX. This can't guarantee there is enough space for the packet - * since we don't yet know how big it is, but it will prevent at least some - * annoyances. + * Make a quick check to see if there is transmit buffer space + * on the ACX. This can't guarantee there is enough space for + * the packet since we don't yet know how big it is, but it + * will prevent at least some annoyances. */ /* OW 20090815 - * Make a detailed check of required tx_buf blocks, to avoid 'out of tx_buf' situation. + * Make a detailed check of required tx_buf blocks, to avoid + * 'out of tx_buf' situation. * - * The empty tx_buf and reuse trick in acxmem_l_tx_data doen't wotk well. - * I think it confused mac80211, that was supposing the packet was send, - * but actually it was dropped. According to mac80211 dropping should not happen, + * The empty tx_buf and reuse trick in acxmem_l_tx_data doen't + * wotk well. I think it confused mac80211, that was + * supposing the packet was send, but actually it was + * dropped. According to mac80211 dropping should not happen, * altough a bit of dropping seemed to be ok. * * What we do now is simpler and clean I think: * - first check the number of required blocks * - and if there are not enough: Stop the queue and report NOT_OK. * - * Reporting NOT_OK here shouldn't be done neither according to mac80211, - * but it seems to work better here. - */ + * Reporting NOT_OK here shouldn't be done neither according + * to mac80211, but it seems to work better here. + */ blocks_needed=acxmem_get_txbuf_space_needed(adev, len); if (!(blocks_needed <= adev->acx_txbuf_blocks_free)) { @@ -2762,11 +2769,11 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { ctl8 = read_slavemem8(adev, (u32) &(txdesc->Ctl_8)); /* - * If we don't own the buffer (HOSTOWN) it is certainly not free; however, - * we may have previously thought we had enough memory to send - * a packet, allocated the buffer then gave up when we found not enough - * transmit buffer space on the ACX. In that case, HOSTOWN and - * ACXDONE will both be set. + * If we don't own the buffer (HOSTOWN) it is certainly not + * free; however, we may have previously thought we had enough + * memory to send a packet, allocated the buffer then gave up + * when we found not enough transmit buffer space on the + * ACX. In that case, HOSTOWN and ACXDONE will both be set. */ // TODO OW Check if this is correct @@ -2803,11 +2810,11 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { /* * acxmem_l_dealloc_tx * - * Clears out a previously allocatedvoid acxmem_l_dealloc_tx(tx_t *tx_opaque); - * transmit descriptor. - * The ACX can get confused if we skip transmit descriptors in the queue, - * so when we don't need a descriptor return it to its original - * state and move the queue head pointer back. + * Clears out a previously allocatedvoid acxmem_l_dealloc_tx(tx_t + * *tx_opaque); transmit descriptor. The ACX can get confused if we + * skip transmit descriptors in the queue, so when we don't need a + * descriptor return it to its original state and move the queue head + * pointer back. * */ #if 1 // acxmem_dealloc_tx() @@ -2834,8 +2841,8 @@ void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { - sizeof(tmptxdesc.pNextDesc)); /* - * This is only called immediately after we've allocated, so we should - * be able to set the head back to this descriptor. + * This is only called immediately after we've allocated, so + * we should be able to set the head back to this descriptor. */ index = ((u8*) txdesc - (u8*) adev->txdesc_start) / adev->txdesc_size; pr_info("acx_dealloc: moving head from %d to %d\n", @@ -2857,8 +2864,8 @@ static u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) { int blocks_needed; /* - * Take 4 off the memory block size to account for the reserved word at the start of - * the block. + * Take 4 off the memory block size to account for the + * reserved word at the start of the block. */ blocks_needed=acxmem_get_txbuf_space_needed(adev, count); @@ -2869,8 +2876,9 @@ static u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) { last_block = block = adev->acx_txbuf_free; /* - * Follow block pointers through the requested number of blocks both to - * find the new head of the free list and to set the flags for the blocks + * Follow block pointers through the requested number + * of blocks both to find the new head of the free + * list and to set the flags for the blocks * appropriately. */ while (blocks_needed--) { @@ -2894,13 +2902,14 @@ static u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) { } /* - * Flag the last block both by clearing out the next pointer - * and marking the control field. + * Flag the last block both by clearing out the next + * pointer and marking the control field. */ write_slavemem32(adev, last_block, 0x02000000); /* - * If we're out of buffers make sure the free list pointer is NULL + * If we're out of buffers make sure the free list + * pointer is NULL */ if (!adev->acx_txbuf_blocks_free) { adev->acx_txbuf_free = 0; @@ -2914,11 +2923,12 @@ static u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) { #endif /* - * Return buffer space back to the pool by following the next pointers until we find - * the block marked as the end. Point the last block to the head of the free list, - * then update the head of the free list to point to the newly freed memory. - * This routine gets called in interrupt context, so it shouldn't block to protect - * the integrity of the linked list. The ISR already holds the lock. + * Return buffer space back to the pool by following the next pointers + * until we find the block marked as the end. Point the last block to + * the head of the free list, then update the head of the free list to + * point to the newly freed memory. This routine gets called in + * interrupt context, so it shouldn't block to protect the integrity + * of the linked list. The ISR already holds the lock. */ static void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { u32 cur, last, next; @@ -2943,10 +2953,12 @@ static void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } while (!(next & 0x02000000)); /* - * last now points to the last block of that allocation. Update the pointer - * in that block to point to the free list and reset the free list to the - * first block of the free call. If there were no free blocks, make sure - * the new end of the list marks itself as truly the end. + * last now points to the last block of that + * allocation. Update the pointer in that block to + * point to the free list and reset the free list to + * the first block of the free call. If there were no + * free blocks, make sure the new end of the list + * marks itself as truly the end. */ if (adev->acx_txbuf_free) { write_slavemem32(adev, last, adev->acx_txbuf_free >> 5); @@ -3005,8 +3017,9 @@ acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { /* * acxmem_l_tx_data * - * Can be called from IRQ (rx -> (AP bridging or mgmt response) -> tx). - * Can be called from acx_i_start_xmit (data frames from net core). + * Can be called from IRQ (rx -> (AP bridging or mgmt response) -> + * tx). Can be called from acx_i_start_xmit (data frames from net + * core). * * FIXME: in case of fragments, should loop over the number of * pre-allocated tx descrs, properly setting up transfer data and @@ -3043,9 +3056,9 @@ void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, // wlhdr_len = ieee80211_hdrlen(le16_to_cpu(wireless_header->frame_control)); wlhdr_len = WLAN_HDR_A3_LEN; - /* modify flag status in separate variable to be able to write it back - * in one big swoop later (also in order to have less device memory - * accesses) */ + /* modify flag status in separate variable to be able to write + * it back in one big swoop later (also in order to have less + * device memory accesses) */ Ctl_8 = (IS_MEM(adev)) ? read_slavemem8(adev, (u32) &(txdesc->Ctl_8)) : txdesc->Ctl_8; @@ -3082,16 +3095,16 @@ void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, // Build rateset for acx111 rateset=acx111_tx_build_rateset(adev, txdesc, info); - /* note that if !txdesc->do_auto, txrate->cur - ** has only one nonzero bit */ + /* note that if !txdesc->do_auto, txrate->cur has only + * one nonzero bit */ txdesc->u.r2.rate111 = cpu_to_le16(rateset); /* WARNING: I was never able to make it work with - * prism54 AP. It was falling down to 1Mbit where - * shortpre is not applicable, and not working at all - * at "5,11 basic rates only" setting. I even didn't - * see tx packets in radio packet capture. Disabled - * for now --vda */ + * prism54 AP. It was falling down to 1Mbit where + * shortpre is not applicable, and not working at all + * at "5,11 basic rates only" setting. I even didn't + * see tx packets in radio packet capture. Disabled + * for now --vda */ /*| ((clt->shortpre && clt->cur!=RATE111_1) ? RATE111_SHORTPRE : 0) */ @@ -3191,8 +3204,9 @@ is_pci_branch: /* don't need to clean ack/rts statistics here, already * done on descr cleanup */ - /* clears HOSTOWN and ACXDONE bits, thus telling that the descriptors - * are now owned by the acx100; do this as LAST operation */ + /* clears HOSTOWN and ACXDONE bits, thus telling that the + * descriptors are now owned by the acx100; do this as LAST + * operation */ CLEAR_BIT(Ctl_8, DESC_CTL_ACXDONE_HOSTOWN); /* flush writes before we release hostdesc to the adapter here */ @@ -3226,9 +3240,10 @@ is_pci_branch: hostdesc1->skb = skb; - /* log the packet content AFTER sending it, - * in order to not delay sending any further than absolutely needed - * Do separate logs for acx100/111 to have human-readable rates */ + /* log the packet content AFTER sending it, in order to not + * delay sending any further than absolutely needed Do + * separate logs for acx100/111 to have human-readable + * rates */ end_of_chain: @@ -3269,12 +3284,12 @@ end_of_chain: /* * acxmem_l_clean_txdesc * - * This function resets the txdescs' status when the ACX100 - * signals the TX done IRQ (txdescs have been processed), starting with - * the pool index of the descriptor which we would use next, - * in order to make sure that we can be as fast as possible - * in filling new txdescs. - * Everytime we get called we know where the next packet to be cleaned is. + * This function resets the txdescs' status when the ACX100 signals + * the TX done IRQ (txdescs have been processed), starting with the + * pool index of the descriptor which we would use next, in order to + * make sure that we can be as fast as possible in filling new + * txdescs. Everytime we get called we know where the next packet to + * be cleaned is. */ // OW TODO Very similar with pci: possible merging. unsigned int acx_tx_clean_txdesc(acx_device_t *adev) @@ -3307,11 +3322,12 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) log(L_BUFT, "tx: cleaning up bufs from %u\n", adev->tx_tail); - /* We know first descr which is not free yet. We advance it as far - ** as we see correct bits set in following descs (if next desc - ** is NOT free, we shouldn't advance at all). We know that in - ** front of tx_tail may be "holes" with isolated free descs. - ** We will catch up when all intermediate descs will be freed also */ + /* We know first descr which is not free yet. We advance it as + * far as we see correct bits set in following descs (if next + * desc is NOT free, we shouldn't advance at all). We know + * that in front of tx_tail may be "holes" with isolated free + * descs. We will catch up when all intermediate descs will + * be freed also */ finger = adev->tx_tail; num_cleaned = 0; @@ -3319,9 +3335,10 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) txdesc = acx_get_txdesc(adev, finger); /* If we allocated txdesc on tx path but then decided - ** to NOT use it, then it will be left as a free "bubble" - ** in the "allocated for tx" part of the ring. - ** We may meet it on the next ring pass here. */ + * to NOT use it, then it will be left as a free + * "bubble" in the "allocated for tx" part of the + * ring. We may meet it on the next ring pass + * here. */ /* stop if not marked as "tx finished" and "host owned" */ Ctl_8 = (IS_MEM(adev)) @@ -3368,8 +3385,9 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) finger, ack_failures, rts_failures, rts_ok, r100, r111, adev->tx_free); - /* need to check for certain error conditions before we - * clean the descriptor: we still need valid descr data here */ + /* need to check for certain error conditions before + * we clean the descriptor: we still need valid descr + * data here */ hostdesc = acx_get_txhostdesc(adev, txdesc); txstatus = IEEE80211_SKB_CB(hostdesc->skb); @@ -3500,9 +3518,9 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) int count; /* - * Can't handle an interrupt while we're fiddling with the ACX's lock, - * according to TI. The ACX is supposed to hold fw_lock for at most - * 500ns. + * Can't handle an interrupt while we're fiddling with the + * ACX's lock, according to TI. The ACX is supposed to hold + * fw_lock for at most 500ns. */ local_irq_save(flags); @@ -3640,9 +3658,9 @@ void acx_irq_work(struct work_struct *work) do { // IRQ_ITERATE, but at least once - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq reasons. - * However masked irq reasons we still read with IO_ACX_IRQ_REASON or - * IO_ACX_IRQ_STATUS_NON_DES + /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq + * reasons. However masked irq reasons we still read with + * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES */ irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); irqmasked = irqreason & ~adev->irq_mask; @@ -3886,9 +3904,9 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id) unmasked = read_reg16(adev, IO_ACX_IRQ_REASON); if (unlikely(0xffff == unmasked)) { - /* 0xffff value hints at missing hardware, - * so don't do anything. - * Not very clean, but other drivers do the same... */ + /* 0xffff value hints at missing hardware, so don't do + * anything. Not very clean, but other drivers do the + * same... */ log(L_IRQ, "IRQ type:FFFF - device removed? IRQ_NONE\n"); goto none; } @@ -3935,12 +3953,14 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id) if (irqtype & HOST_INT_TX_COMPLETE) { log(L_IRQ, "got Tx_Complete IRQ\n"); - /* don't clean up on each Tx complete, wait a bit - * unless we're going towards full, in which case - * we do it immediately, too (otherwise we might lockup - * with a full Tx buffer if we go into - * acxmem_l_clean_txdesc() at a time when we won't wakeup - * the net queue in there for some reason...) */ + /* don't clean up on each Tx complete, wait a + * bit unless we're going towards full, in + * which case we do it immediately, too + * (otherwise we might lockup with a full Tx + * buffer if we go into + * acxmem_l_clean_txdesc() at a time when we + * won't wakeup the net queue in there for + * some reason...) */ if (adev->tx_free <= TX_START_CLEAN) { #if TX_CLEANUP_IN_SOFTIRQ acx_schedule_task(adev, ACX_AFTER_IRQ_TX_CLEANUP); @@ -4062,12 +4082,11 @@ int acx_op_start(struct ieee80211_hw *hw) /* ifup device */ acx_up(hw); - /* We don't currently have to do anything else. - * The setup of the MAC should be subsequently completed via - * the mlme commands. - * Higher layers know we're ready from dev->start==1 and - * dev->tbusy==0. Our rx path knows to pass up received/ - * frames because of dev->flags&IFF_UP is true. + /* We don't currently have to do anything else. The setup of + * the MAC should be subsequently completed via the mlme + * commands. Higher layers know we're ready from + * dev->start==1 and dev->tbusy==0. Our rx path knows to pass + * up received/ frames because of dev->flags&IFF_UP is true. */ ieee80211_wake_queues(adev->ieee); @@ -4261,16 +4280,16 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, "Rx Queue 1 Host Memory Start: %X\n" "Tx Queue 1 Count Descriptors: %X\n" "Tx Queue 1 Attributes: %X\n", - memconf.len, (int) sizeof(memconf), - memconf.no_of_stations, - memconf.memory_block_size, - memconf.tx_rx_memory_block_allocation, - memconf.count_rx_queues, memconf.count_tx_queues, - memconf.options, - memconf.fragmentation, - memconf.rx_queue1_count_descs, - acx2cpu(memconf.rx_queue1_host_rx_start), - memconf.tx_queue1_count_descs, memconf.tx_queue1_attributes); + memconf.len, (int) sizeof(memconf), + memconf.no_of_stations, + memconf.memory_block_size, + memconf.tx_rx_memory_block_allocation, + memconf.count_rx_queues, memconf.count_tx_queues, + memconf.options, + memconf.fragmentation, + memconf.rx_queue1_count_descs, + acx2cpu(memconf.rx_queue1_host_rx_start), + memconf.tx_queue1_count_descs, memconf.tx_queue1_attributes); /* dump Acx111 Queue Configuration */ pr_acx("dump queue head:\n" @@ -4280,11 +4299,11 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, "rx1_queue address (from card): %X\n" "tx1_queue address (from card): %X\n" "tx1_queue attributes (from card): %X\n", - queueconf.len, (int) sizeof(queueconf), - queueconf.tx_memory_block_address, - queueconf.rx_memory_block_address, - queueconf.rx1_queue_address, - queueconf.tx1_queue_address, queueconf.tx1_attributes); + queueconf.len, (int) sizeof(queueconf), + queueconf.tx_memory_block_address, + queueconf.rx_memory_block_address, + queueconf.rx1_queue_address, + queueconf.tx1_queue_address, queueconf.tx1_attributes); /* dump Acx111 Mem Map */ pr_acx("dump mem map:\n" @@ -4303,43 +4322,43 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, "Packet memory pool end: %X\n" "iobase: %p\n" "iobase2: %p\n", - *((u16 *) &memmap[0x02]), (int) sizeof(memmap), - *((u32 *) &memmap[0x04]), - *((u32 *) &memmap[0x08]), - *((u32 *) &memmap[0x0C]), - *((u32 *) &memmap[0x10]), - *((u32 *) &memmap[0x14]), - *((u32 *) &memmap[0x18]), - *((u32 *) &memmap[0x1C]), - *((u32 *) &memmap[0x20]), - *((u32 *) &memmap[0x24]), - *((u32 *) &memmap[0x28]), - *((u32 *) &memmap[0x2C]), - *((u32 *) &memmap[0x30]), adev->iobase, - adev->iobase2); + *((u16 *) &memmap[0x02]), (int) sizeof(memmap), + *((u32 *) &memmap[0x04]), + *((u32 *) &memmap[0x08]), + *((u32 *) &memmap[0x0C]), + *((u32 *) &memmap[0x10]), + *((u32 *) &memmap[0x14]), + *((u32 *) &memmap[0x18]), + *((u32 *) &memmap[0x1C]), + *((u32 *) &memmap[0x20]), + *((u32 *) &memmap[0x24]), + *((u32 *) &memmap[0x28]), + *((u32 *) &memmap[0x2C]), + *((u32 *) &memmap[0x30]), adev->iobase, + adev->iobase2); /* dump Acx111 Rx Config */ pr_acx("dump rx config:\n" "data read: %d, struct size: %d\n" "rx config: %X\n" "rx filter config: %X\n", - *((u16 *) &rxconfig[0x02]), (int) sizeof(rxconfig), - *((u16 *) &rxconfig[0x04]), *((u16 *) &rxconfig[0x06])); + *((u16 *) &rxconfig[0x02]), (int) sizeof(rxconfig), + *((u16 *) &rxconfig[0x04]), *((u16 *) &rxconfig[0x06])); /* dump Acx111 fcs error */ pr_acx("dump fcserror:\n" "data read: %d, struct size: %d\n" "fcserrors: %X\n", - *((u16 *) &fcserror[0x02]), (int) sizeof(fcserror), - *((u32 *) &fcserror[0x04])); + *((u16 *) &fcserror[0x02]), (int) sizeof(fcserror), + *((u32 *) &fcserror[0x04])); /* dump Acx111 rate fallback */ pr_acx("dump rate fallback:\n" "data read: %d, struct size: %d\n" "ratefallback: %X\n", - *((u16 *) &ratefallback[0x02]), - (int) sizeof(ratefallback), - *((u8 *) &ratefallback[0x04])); + *((u16 *) &ratefallback[0x02]), + (int) sizeof(ratefallback), + *((u8 *) &ratefallback[0x04])); /* protect against IRQ */ acx_lock(adev, flags); @@ -4362,7 +4381,8 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, rxdesc, acx2cpu(rxdesc->pNextDesc), acx2cpu(rxdesc->ACXMemPtr), - rxdesc->Ctl_8, rxdesc->rate, rxdesc->error, rxdesc->SNR); + rxdesc->Ctl_8, rxdesc->rate, + rxdesc->error, rxdesc->SNR); rxdesc++; } @@ -4374,21 +4394,21 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, if (rxhostdesc) for (i = 0; i < RX_CNT; i++) { pr_acx("\ndump host rxdesc %d:\n" - "mem pos %p\n" - "buffer mem pos 0x%X\n" - "buffer mem offset 0x%X\n" - "CTL 0x%X\n" - "Length 0x%X\n" - "next 0x%X\n" - "Status 0x%X\n", - i, - rxhostdesc, - acx2cpu(rxhostdesc->hd.data_phy), - rxhostdesc->data_offset, - le16_to_cpu(rxhostdesc->hd.Ctl_16), - le16_to_cpu(rxhostdesc->hd.length), - acx2cpu(rxhostdesc->hd.desc_phy_next), - rxhostdesc->Status); + "mem pos %p\n" + "buffer mem pos 0x%X\n" + "buffer mem offset 0x%X\n" + "CTL 0x%X\n" + "Length 0x%X\n" + "next 0x%X\n" + "Status 0x%X\n", + i, + rxhostdesc, + acx2cpu(rxhostdesc->hd.data_phy), + rxhostdesc->data_offset, + le16_to_cpu(rxhostdesc->hd.Ctl_16), + le16_to_cpu(rxhostdesc->hd.length), + acx2cpu(rxhostdesc->hd.desc_phy_next), + rxhostdesc->Status); rxhostdesc++; } @@ -4399,27 +4419,27 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, if (txdesc) for (i = 0; i < TX_CNT; i++) { pr_acx("\ndump internal txdesc %d:\n" - "size 0x%X\n" - "mem pos %p\n" - "next 0x%X\n" - "acx mem pointer (dynamic) 0x%X\n" - "host mem pointer (dynamic) 0x%X\n" - "length (dynamic) 0x%X\n" - "CTL (dynamic) 0x%X\n" - "CTL2 (dynamic) 0x%X\n" - "Status (dynamic) 0x%X\n" - "Rate (dynamic) 0x%X\n", - i, - (int) sizeof(struct txdesc), - txdesc, - acx2cpu(txdesc->pNextDesc), - acx2cpu(txdesc->AcxMemPtr), - acx2cpu(txdesc->HostMemPtr), - le16_to_cpu(txdesc->total_length), - txdesc->Ctl_8, - txdesc->Ctl2_8, - txdesc->error, - txdesc->u.r1.rate); + "size 0x%X\n" + "mem pos %p\n" + "next 0x%X\n" + "acx mem pointer (dynamic) 0x%X\n" + "host mem pointer (dynamic) 0x%X\n" + "length (dynamic) 0x%X\n" + "CTL (dynamic) 0x%X\n" + "CTL2 (dynamic) 0x%X\n" + "Status (dynamic) 0x%X\n" + "Rate (dynamic) 0x%X\n", + i, + (int) sizeof(struct txdesc), + txdesc, + acx2cpu(txdesc->pNextDesc), + acx2cpu(txdesc->AcxMemPtr), + acx2cpu(txdesc->HostMemPtr), + le16_to_cpu(txdesc->total_length), + txdesc->Ctl_8, + txdesc->Ctl2_8, + txdesc->error, + txdesc->u.r1.rate); txdesc = acx_advance_txdesc(adev, txdesc, 1); } @@ -4431,21 +4451,21 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, if (txhostdesc) for (i = 0; i < TX_CNT * 2; i++) { pr_acx("\ndump host txdesc %d:\n" - "mem pos %p\n" - "buffer mem pos 0x%X\n" - "buffer mem offset 0x%X\n" - "CTL 0x%X\n" - "Length 0x%X\n" - "next 0x%X\n" - "Status 0x%X\n", - i, - txhostdesc, - acx2cpu(txhostdesc->hd.data_phy), - txhostdesc->data_offset, - le16_to_cpu(txhostdesc->hd.Ctl_16), - le16_to_cpu(txhostdesc->hd.length), - acx2cpu(txhostdesc->hd.desc_phy_next), - le32_to_cpu(txhostdesc->Status)); + "mem pos %p\n" + "buffer mem pos 0x%X\n" + "buffer mem offset 0x%X\n" + "CTL 0x%X\n" + "Length 0x%X\n" + "next 0x%X\n" + "Status 0x%X\n", + i, + txhostdesc, + acx2cpu(txhostdesc->hd.data_phy), + txhostdesc->data_offset, + le16_to_cpu(txhostdesc->hd.Ctl_16), + le16_to_cpu(txhostdesc->hd.length), + acx2cpu(txhostdesc->hd.desc_phy_next), + le32_to_cpu(txhostdesc->Status)); txhostdesc++; } @@ -4586,21 +4606,24 @@ static int __devinit acxmem_probe(struct platform_device *pdev) { ieee->queues = 1; // OW TODO Check if RTS/CTS threshold can be included here - /* TODO: although in the original driver the maximum value was 100, - * the OpenBSD driver assigns maximum values depending on the type of - * radio transceiver (i.e. Radia, Maxim, etc.). This value is always a - * positive integer which most probably indicates the gain of the AGC - * in the rx path of the chip, in dB steps (0.625 dB, for example?). - * The mapping of this rssi value to dBm is still unknown, but it can - * nevertheless be used as a measure of relative signal strength. The - * other two values, i.e. max_signal and max_noise, do not seem to be - * supported on my acx111 card (they are always 0), although iwconfig - * reports them (in dBm) when using ndiswrapper with the Windows XP - * driver. The GPL-licensed part of the AVM FRITZ!WLAN USB Stick - * driver sources (for the TNETW1450, though) seems to also indicate - * that only the RSSI is supported. In conclusion, the max_signal and - * max_noise values will not be initialised by now, as they do not - * seem to be supported or how to acquire them is still unknown. */ + /* TODO: although in the original driver the maximum value was + * 100, the OpenBSD driver assigns maximum values depending on + * the type of radio transceiver (i.e. Radia, Maxim, + * etc.). This value is always a positive integer which most + * probably indicates the gain of the AGC in the rx path of + * the chip, in dB steps (0.625 dB, for example?). The + * mapping of this rssi value to dBm is still unknown, but it + * can nevertheless be used as a measure of relative signal + * strength. The other two values, i.e. max_signal and + * max_noise, do not seem to be supported on my acx111 card + * (they are always 0), although iwconfig reports them (in + * dBm) when using ndiswrapper with the Windows XP driver. The + * GPL-licensed part of the AVM FRITZ!WLAN USB Stick driver + * sources (for the TNETW1450, though) seems to also indicate + * that only the RSSI is supported. In conclusion, the + * max_signal and max_noise values will not be initialised by + * now, as they do not seem to be supported or how to acquire + * them is still unknown. */ // We base signal quality on winlevel approach of previous driver // TODO OW 20100615 This should into a common init code @@ -4614,8 +4637,9 @@ static int __devinit acxmem_probe(struct platform_device *pdev) { spin_lock_init(&adev->spinlock); /* initial state: unlocked */ /* We do not start with downed sem: we want PARANOID_LOCKING to work */ mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->pdev = pdev; @@ -4629,7 +4653,7 @@ static int __devinit acxmem_probe(struct platform_device *pdev) { platform_set_drvdata(pdev, ieee); /* chiptype is u8 but id->driver_data is ulong - ** Works for now (possible values are 1 and 2) */ + * Works for now (possible values are 1 and 2) */ chip_type = CHIPTYPE_ACX100; /* acx100 and acx111 have different PCI memory regions */ if (chip_type == CHIPTYPE_ACX100) { @@ -4665,13 +4689,13 @@ static int __devinit acxmem_probe(struct platform_device *pdev) { adev->irq = i; log(L_ANY, "found an %s-based wireless network card, " - "irq:%d, " - "membase:0x%p, mem_size:%ld, " - "iobase:0x%p", - chip_name, - adev->irq, - adev->membase, addr_size, - adev->iobase); + "irq:%d, " + "membase:0x%p, mem_size:%ld, " + "iobase:0x%p", + chip_name, + adev->irq, + adev->membase, addr_size, + adev->iobase); log(L_ANY, "the initial debug setting is 0x%04X\n", acx_debug); if (adev->irq == 0) { @@ -4726,13 +4750,15 @@ static int __devinit acxmem_probe(struct platform_device *pdev) { /* Register the card, AFTER everything else has been set up, * since otherwise an ioctl could step on our feet due to - * firmware operations happening in parallel or uninitialized data */ + * firmware operations happening in parallel or uninitialized + * data */ if (acx_proc_register_entries(ieee) != OK) goto fail_proc_register_entries; /* Now we have our device, so make sure the kernel doesn't try - * to send packets even though we're not associated to a network yet */ + * to send packets even though we're not associated to a + * network yet */ // OW FIXME Check if acx_stop_queue, acx_carrier_off should be included // OW Rest can be cleaned up @@ -4845,9 +4871,9 @@ static int __devexit acxmem_remove(struct platform_device *pdev) } #ifdef REDUNDANT - /* put the eCPU to sleep to save power - * Halting is not possible currently, - * since not supported by all firmware versions */ + /* put the eCPU to sleep to save power. Halting is + * not possible currently, since not supported by all + * firmware versions */ acx_issue_cmd(adev, ACX100_CMD_SLEEP, NULL, 0); #endif @@ -4894,9 +4920,8 @@ static int __devexit acxmem_remove(struct platform_device *pdev) /* remove dev registration */ platform_set_drvdata(pdev, NULL); - /* Free netdev (quite late, - * since otherwise we might get caught off-guard - * by a netdev timeout handler execution + /* Free netdev (quite late, since otherwise we might get + * caught off-guard by a netdev timeout handler execution * expecting to see a working dev...) */ ieee80211_free_hw(adev->ieee); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:38
|
Add new struct tx_desc_pair, move a few tx* fields into it, add "struct tx_desc_pair tx;" into struct acx_device, and update the field refs (using a script, full version in subsequent patch) This patch is a baby-step, cuz 1st try (a full-up version) got past compiler and OOPsed on modprobe. It was easier to git reset HEAD and start over. Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 10 ++++++++++ mem.c | 4 ++-- merge.c | 22 +++++++++++----------- pci.c | 4 ++-- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index 8bfd52f..4cc017d 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -216,6 +216,12 @@ struct eeprom_cfg { co_manuf_t manufacturer; }; +/* tx fields refactored */ +struct tx_desc_pair { + unsigned int tail; + u8 *buf_start; +}; + /* FIXME: this should be named something like struct acx_priv (typedef'd to * acx_priv_t) */ @@ -449,8 +455,12 @@ struct acx_device { #if (defined(CONFIG_ACX_MAC80211_PCI) || defined(CONFIG_ACX_MAC80211_MEM)) /* pointers to tx buffers, tx host descriptors (in host memory) ** and tx descs in device memory */ +#if 0 unsigned int tx_tail; u8 *txbuf_start; +#else + struct tx_desc_pair tx; +#endif txhostdesc_t *txhostdesc_start; txdesc_t *txdesc_start; /* points to PCI-mapped memory */ dma_addr_t txbuf_startphy; diff --git a/mem.c b/mem.c index 5a88f4d..7f82803 100644 --- a/mem.c +++ b/mem.c @@ -1051,7 +1051,7 @@ int acxmem_proc_diag_output(struct seq_file *file, if (txdesc) { for (i = 0; i < TX_CNT; i++) { thd = (i == adev->tx_head) ? " [head]" : ""; - ttl = (i == adev->tx_tail) ? " [tail]" : ""; + ttl = (i == adev->tx.tail) ? " [tail]" : ""; acxmem_copy_from_slavemem(adev, (u8 *) &txd, (u32) txdesc, sizeof(txd)); Ctl_8 = read_slavemem8(adev, (u32) &(txdesc->Ctl_8)); @@ -1146,7 +1146,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), - adev->txbuf_start, adev->txbuf_area_size, adev->txdesc_size, + adev->tx.buf_start, adev->txbuf_area_size, adev->txdesc_size, adev->txdesc_start, adev->txhostdesc_start, adev->txhostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, diff --git a/merge.c b/merge.c index 511c2d1..53e4460 100644 --- a/merge.c +++ b/merge.c @@ -324,10 +324,10 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) /* OW 20100513 adev->txbuf_area_size = TX_CNT * *WLAN_A4FR_MAXLEN_WEP_FCS (30 + 2312 + 4); */ adev->txbuf_area_size = TX_CNT * WLAN_A4FR_MAXLEN_WEP_FCS; - adev->txbuf_start + adev->tx.buf_start = acx_allocate(adev, adev->txbuf_area_size, &adev->txbuf_startphy, "txbuf_start"); - if (!adev->txbuf_start) + if (!adev->tx.buf_start) goto fail; /* allocate the TX host descriptor queue pool */ @@ -346,7 +346,7 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) hostdesc = adev->txhostdesc_start; hostdesc_phy = adev->txhostdesc_startphy; - txbuf = adev->txbuf_start; + txbuf = adev->tx.buf_start; txbuf_phy = adev->txbuf_startphy; #if 0 @@ -608,7 +608,7 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) adev->tx_free = TX_CNT; /* done by memset: adev->tx_head = 0; */ - /* done by memset: adev->tx_tail = 0; */ + /* done by memset: adev->tx.tail = 0; */ txdesc = adev->txdesc_start; if (IS_PCI(adev)) { mem_offs = tx_queue_start; @@ -734,7 +734,7 @@ void acx_free_desc_queues(acx_device_t *adev) adev->txhostdesc_start, adev->txhostdesc_startphy); ACX_FREE_QUEUE(adev, adev->txbuf_area_size, - adev->txbuf_start, adev->txbuf_startphy); + adev->tx.buf_start, adev->txbuf_startphy); adev->txdesc_start = NULL; @@ -2362,7 +2362,7 @@ int acxmem_proc_diag_output(struct seq_file *file, if (txdesc) { for (i = 0; i < TX_CNT; i++) { thd = (i == adev->tx_head) ? " [head]" : ""; - ttl = (i == adev->tx_tail) ? " [tail]" : ""; + ttl = (i == adev->tx.tail) ? " [tail]" : ""; acxmem_copy_from_slavemem(adev, (u8 *) &txd, (u32) txdesc, sizeof(txd)); @@ -2464,7 +2464,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), - adev->txbuf_start, adev->txbuf_area_size, adev->txdesc_size, + adev->tx.buf_start, adev->txbuf_area_size, adev->txdesc_size, adev->txdesc_start, adev->txhostdesc_start, adev->txhostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, @@ -3320,7 +3320,7 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) if (unlikely(acx_debug & L_DEBUG)) acx_log_txbuffer(adev); - log(L_BUFT, "tx: cleaning up bufs from %u\n", adev->tx_tail); + log(L_BUFT, "tx: cleaning up bufs from %u\n", adev->tx.tail); /* We know first descr which is not free yet. We advance it as * far as we see correct bits set in following descs (if next @@ -3329,7 +3329,7 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) * descs. We will catch up when all intermediate descs will * be freed also */ - finger = adev->tx_tail; + finger = adev->tx.tail; num_cleaned = 0; while (likely(finger != adev->tx_head)) { txdesc = acx_get_txdesc(adev, finger); @@ -3352,7 +3352,7 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) if (unlikely(!num_cleaned)) pr_warn("clean_txdesc: tail isn't free. " "finger=%d, tail=%d, head=%d\n", - finger, adev->tx_tail, adev->tx_head); + finger, adev->tx.tail, adev->tx_head); break; } @@ -3454,7 +3454,7 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev) finger = (finger + 1) % TX_CNT; } /* remember last position */ - adev->tx_tail = finger; + adev->tx.tail = finger; FN_EXIT1(num_cleaned); return num_cleaned; diff --git a/pci.c b/pci.c index 8d8ae03..1d52a22 100644 --- a/pci.c +++ b/pci.c @@ -670,7 +670,7 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) if (txdesc) for (i = 0; i < TX_CNT; i++) { thd = (i == adev->tx_head) ? " [head]" : ""; - ttl = (i == adev->tx_tail) ? " [tail]" : ""; + ttl = (i == adev->tx.tail) ? " [tail]" : ""; if (txdesc->Ctl_8 & DESC_CTL_ACXDONE) seq_printf(file, "%02u Ready to free (%02X)%s%s", i, txdesc->Ctl_8, @@ -694,7 +694,7 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) "rxdesc_start %p\n" "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", - adev->txbuf_start, adev->txbuf_area_size, + adev->tx.buf_start, adev->txbuf_area_size, (unsigned long long)adev->txbuf_startphy, adev->txdesc_size, adev->txdesc_start, adev->txhostdesc_start, adev->txhostdesc_area_size, -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:40
|
This repeats tx*desc refactoring, this time for rx*desc. It moves all rx*desc fields into new rx_desc_pair struct, and changes all field-refs to match: The script to change field-refs, for this and previous patches, is: for f in $* ; do perl -pi -e 's/->(tx|rx)_tail/->$1.tail/g' $f perl -pi -e 's/->(tx|rx)(buf_start)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)(hostdesc_start)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)(buf_area_size)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)(hostdesc_area_size)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)(desc_size)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)((host)?desc_startphy)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)(buf_startphy)\b/->$1.$2/g' $f perl -pi -e 's/->(tx|rx)(desc_start)\b/->$1.$2/g' $f done This patch should probably be squashed with the previous baby-step patches, since the script modifies all field refs together. I did it in steps cuz my 1st try (all tx at once, apparently improperly) slipped past the compiler, and OOPsd on modprobe. Im sending them this way in case something breaks on one of your hardware setups, so you can "bisect" the trouble. Tested-by: jimc - ifups on pci, scripted test looks good. Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 22 +++++++++++- common.c | 10 +++--- mem.c | 26 +++++++------- merge.c | 96 +++++++++++++++++++++++++++--------------------------- pci.c | 18 +++++----- 5 files changed, 95 insertions(+), 77 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index b291aca..6463104 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -221,6 +221,8 @@ struct tx_desc_pair { unsigned int tail; u8 *buf_start; txhostdesc_t *hostdesc_start; + txdesc_t *desc_start; /* points to PCI-mapped memory */ + /* sizes of above host memory areas */ unsigned int buf_area_size; unsigned int hostdesc_area_size; @@ -228,8 +230,21 @@ struct tx_desc_pair { dma_addr_t buf_startphy; dma_addr_t hostdesc_startphy; - txdesc_t *desc_start; /* points to PCI-mapped memory */ +}; +// identical to above, except for field types (and theyre close too) +struct rx_desc_pair { + unsigned int tail; + rxbuffer_t *buf_start; + rxhostdesc_t *hostdesc_start; + rxdesc_t *desc_start; + + /* sizes of above host memory areas */ + unsigned int buf_area_size; + unsigned int hostdesc_area_size; + unsigned int desc_size; /* size of txdesc */ + dma_addr_t buf_startphy; + dma_addr_t hostdesc_startphy; }; /* FIXME: this should be named something like struct acx_priv (typedef'd to @@ -479,7 +494,7 @@ struct acx_device { #else struct tx_desc_pair tx; #endif - +#if 0 /* same for rx */ unsigned int rx_tail; rxbuffer_t *rxbuf_start; @@ -490,6 +505,9 @@ struct acx_device { dma_addr_t rxhostdesc_startphy; unsigned int rxbuf_area_size; unsigned int rxhostdesc_area_size; +#else + struct rx_desc_pair rx; +#endif u8 need_radio_fw; u8 irqs_active; /* whether irq sending is activated */ diff --git a/common.c b/common.c index 6a6eccd..42594f5 100644 --- a/common.c +++ b/common.c @@ -973,10 +973,10 @@ acx100_init_memory_pools(acx_device_t * adev, const acx_ie_memmap_t * mmt) MemoryConfigOption.DMA_config = cpu_to_le32(0x30000); /* Declare start of the Rx host pool */ MemoryConfigOption.pRxHostDesc = - cpu2acx(adev->rxhostdesc_startphy); + cpu2acx(adev->rx.hostdesc_startphy); log(L_DEBUG, "pRxHostDesc 0x%08X, rxhostdesc_startphy 0x%lX\n", acx2cpu(MemoryConfigOption.pRxHostDesc), - (long)adev->rxhostdesc_startphy); + (long)adev->rx.hostdesc_startphy); } else if(IS_MEM(adev)) { /* @@ -987,7 +987,7 @@ acx100_init_memory_pools(acx_device_t * adev, const acx_ie_memmap_t * mmt) MemoryConfigOption.pRxHostDesc = cpu2acx(0); log(L_DEBUG, "pRxHostDesc 0x%08X, rxhostdesc_startphy 0x%lX\n", acx2cpu(MemoryConfigOption.pRxHostDesc), - (long)adev->rxhostdesc_startphy); + (long)adev->rx.hostdesc_startphy); } else { MemoryConfigOption.DMA_config = cpu_to_le32(0x20000); @@ -1205,11 +1205,11 @@ static int acx111_create_dma_regions(acx_device_t * adev) /* done by memset: memconf.rx_queue1_prio = 0; low prio */ if (IS_PCI(adev)) { memconf.rx_queue1_host_rx_start = - cpu2acx(adev->rxhostdesc_startphy); + cpu2acx(adev->rx.hostdesc_startphy); } else if (IS_MEM(adev)) { - memconf.rx_queue1_host_rx_start = cpu2acx(adev->rxhostdesc_startphy); + memconf.rx_queue1_host_rx_start = cpu2acx(adev->rx.hostdesc_startphy); } /* Tx descriptor queue config */ diff --git a/mem.c b/mem.c index 7f2b944..3e827bb 100644 --- a/mem.c +++ b/mem.c @@ -1004,10 +1004,10 @@ int acxmem_proc_diag_output(struct seq_file *file, #endif seq_printf(file, "** Rx buf **\n"); - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; if (rxdesc) for (i = 0; i < RX_CNT; i++) { - rtl = (i == adev->rx_tail) ? " [tail]" : ""; + rtl = (i == adev->rx.tail) ? " [tail]" : ""; Ctl_8 = read_slavemem8(adev, (u32) &(rxdesc->Ctl_8)); if (Ctl_8 & DESC_CTL_HOSTOWN) seq_printf(file, "%02u (%02x) FULL %-10s", i, Ctl_8, rtl); @@ -1151,9 +1151,9 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->tx.hostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, - adev->rxdesc_start, - adev->rxhostdesc_start, adev->rxhostdesc_area_size, - adev->rxbuf_start, adev->rxbuf_area_size); + adev->rx.desc_start, + adev->rx.hostdesc_start, adev->rx.hostdesc_area_size, + adev->rx.buf_start, adev->rx.buf_area_size); acxmem_unlock(); FN_EXIT0; @@ -1188,11 +1188,11 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) * full, just in case there's a mismatch between our current * rx_tail and the full descriptor we're supposed to * handle. */ - tail = adev->rx_tail; + tail = adev->rx.tail; count = RX_CNT; while (1) { - hostdesc = &adev->rxhostdesc_start[tail]; - rxdesc = &adev->rxdesc_start[tail]; + hostdesc = &adev->rx.hostdesc_start[tail]; + rxdesc = &adev->rx.desc_start[tail]; /* advance tail regardless of outcome of the below test */ tail = (tail + 1) % RX_CNT; @@ -1274,8 +1274,8 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) write_reg16(adev, IO_ACX_INT_TRIG, INT_TRIG_RXPRC); /* ok, descriptor is handled, now check the next descriptor */ - hostdesc = &adev->rxhostdesc_start[tail]; - rxdesc = &adev->rxdesc_start[tail]; + hostdesc = &adev->rx.hostdesc_start[tail]; + rxdesc = &adev->rx.desc_start[tail]; Ctl_8 = hostdesc->hd.Ctl_16 = read_slavemem8(adev, (u32) &(rxdesc->Ctl_8)); @@ -1286,7 +1286,7 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) tail = (tail + 1) % RX_CNT; } end: - adev->rx_tail = tail; + adev->rx.tail = tail; FN_EXIT0; } @@ -2124,7 +2124,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, acx_lock(adev, flags); /* dump acx111 internal rx descriptor ring buffer */ - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; /* loop over complete receive pool */ if (rxdesc) @@ -2147,7 +2147,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, /* dump host rx descriptor ring buffer */ - rxhostdesc = adev->rxhostdesc_start; + rxhostdesc = adev->rx.hostdesc_start; /* loop over complete receive pool */ if (rxhostdesc) diff --git a/merge.c b/merge.c index f0b9665..893f38a 100644 --- a/merge.c +++ b/merge.c @@ -256,33 +256,33 @@ static int acx_create_rx_host_desc_queue(acx_device_t * adev) FN_ENTER; /* allocate the RX host descriptor queue pool */ - adev->rxhostdesc_area_size = RX_CNT * sizeof(*hostdesc); - adev->rxhostdesc_start + adev->rx.hostdesc_area_size = RX_CNT * sizeof(*hostdesc); + adev->rx.hostdesc_start = acx_allocate(adev, - adev->rxhostdesc_area_size, - &adev->rxhostdesc_startphy, + adev->rx.hostdesc_area_size, + &adev->rx.hostdesc_startphy, "rxhostdesc_start"); - if (!adev->rxhostdesc_start) + if (!adev->rx.hostdesc_start) goto fail; /* check for proper alignment of RX host descriptor pool */ - if ((long)adev->rxhostdesc_start & 3) { + if ((long)adev->rx.hostdesc_start & 3) { pr_acx("driver bug: dma alloc returns unaligned address\n"); goto fail; } /* allocate Rx buffer pool which will be used by the acx * to store the whole content of the received frames in it */ - adev->rxbuf_area_size = RX_CNT * RX_BUFFER_SIZE; - adev->rxbuf_start - = acx_allocate(adev, adev->rxbuf_area_size, - &adev->rxbuf_startphy, "rxbuf_start"); - if (!adev->rxbuf_start) + adev->rx.buf_area_size = RX_CNT * RX_BUFFER_SIZE; + adev->rx.buf_start + = acx_allocate(adev, adev->rx.buf_area_size, + &adev->rx.buf_startphy, "rxbuf_start"); + if (!adev->rx.buf_start) goto fail; - rxbuf = adev->rxbuf_start; - rxbuf_phy = adev->rxbuf_startphy; - hostdesc = adev->rxhostdesc_start; - hostdesc_phy = adev->rxhostdesc_startphy; + rxbuf = adev->rx.buf_start; + rxbuf_phy = adev->rx.buf_startphy; + hostdesc = adev->rx.hostdesc_start; + hostdesc_phy = adev->rx.hostdesc_startphy; /* don't make any popular C programming pointer arithmetic * mistakes here, otherwise I'll kill you... (and don't dare @@ -299,7 +299,7 @@ static int acx_create_rx_host_desc_queue(acx_device_t * adev) hostdesc++; } hostdesc--; - hostdesc->hd.desc_phy_next = cpu2acx(adev->rxhostdesc_startphy); + hostdesc->hd.desc_phy_next = cpu2acx(adev->rx.hostdesc_startphy); FN_EXIT1(OK); return OK; fail: @@ -490,7 +490,7 @@ void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) FN_ENTER; - /* done by memset: adev->rx_tail = 0; */ + /* done by memset: adev->rx.tail = 0; */ /* ACX111 doesn't need any further config: preconfigures itself. * Simply print ring buffer for debugging */ @@ -498,31 +498,31 @@ void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) /* rxdesc_start already set here */ if (IS_PCI(adev)) - adev->rxdesc_start = (rxdesc_t *) + adev->rx.desc_start = (rxdesc_t *) ((u8 *) adev->iobase2 + rx_queue_start); else - adev->rxdesc_start = (rxdesc_t *) + adev->rx.desc_start = (rxdesc_t *) ((u8 *) rx_queue_start); - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; for (i = 0; i < RX_CNT; i++) { log(L_DEBUG, "rx descriptor %d @ 0x%p\n", i, rxdesc); if (IS_PCI(adev)) - adev->rxdesc_start = (rxdesc_t *) + adev->rx.desc_start = (rxdesc_t *) ((u8 *) adev->iobase2 + acx2cpu(rxdesc->pNextDesc)); else - adev->rxdesc_start = (rxdesc_t *) + adev->rx.desc_start = (rxdesc_t *) ((u8 *) acx2cpu(rxdesc->pNextDesc)); - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; } } else { /* we didn't pre-calculate rxdesc_start in case of ACX100 */ /* rxdesc_start should be right AFTER Tx pool */ - adev->rxdesc_start = (rxdesc_t *) + adev->rx.desc_start = (rxdesc_t *) ((u8 *) adev->tx.desc_start + (TX_CNT * sizeof(txdesc_t))); @@ -531,18 +531,18 @@ void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) * elsewhere! acx111's txdesc is larger! */ if (IS_PCI(adev)) - memset(adev->rxdesc_start, 0, + memset(adev->rx.desc_start, 0, RX_CNT * sizeof(*rxdesc)); else { // IS_MEM - mem_offs = (u32) adev->rxdesc_start; - while (mem_offs < (u32) adev->rxdesc_start + mem_offs = (u32) adev->rx.desc_start; + while (mem_offs < (u32) adev->rx.desc_start + (RX_CNT * sizeof(*rxdesc))) { write_slavemem32(adev, mem_offs, 0); mem_offs += 4; } } /* loop over whole receive pool */ - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; mem_offs = rx_queue_start; for (i = 0; i < RX_CNT; i++) { log(L_DEBUG, "rx descriptor @ 0x%p\n", rxdesc); @@ -738,13 +738,13 @@ void acx_free_desc_queues(acx_device_t *adev) adev->tx.desc_start = NULL; - ACX_FREE_QUEUE(adev, adev->rxhostdesc_area_size, - adev->rxhostdesc_start, adev->rxhostdesc_startphy); + ACX_FREE_QUEUE(adev, adev->rx.hostdesc_area_size, + adev->rx.hostdesc_start, adev->rx.hostdesc_startphy); - ACX_FREE_QUEUE(adev, adev->rxbuf_area_size, - adev->rxbuf_start, adev->rxbuf_startphy); + ACX_FREE_QUEUE(adev, adev->rx.buf_area_size, + adev->rx.buf_start, adev->rx.buf_startphy); - adev->rxdesc_start = NULL; + adev->rx.desc_start = NULL; FN_EXIT0; } @@ -787,7 +787,7 @@ void acx_log_rxbuffer(const acx_device_t *adev) pr_debug("entry\n"); - rxhostdesc = adev->rxhostdesc_start; + rxhostdesc = adev->rx.hostdesc_start; if (unlikely(!rxhostdesc)) return; @@ -2314,10 +2314,10 @@ int acxmem_proc_diag_output(struct seq_file *file, #endif seq_printf(file, "** Rx buf **\n"); - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; if (rxdesc) for (i = 0; i < RX_CNT; i++) { - rtl = (i == adev->rx_tail) ? " [tail]" : ""; + rtl = (i == adev->rx.tail) ? " [tail]" : ""; Ctl_8 = read_slavemem8(adev, (u32) &(rxdesc->Ctl_8)); if (Ctl_8 & DESC_CTL_HOSTOWN) seq_printf(file, "%02u (%02x) FULL %-10s", i, Ctl_8, rtl); @@ -2469,9 +2469,9 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->tx.hostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, - adev->rxdesc_start, - adev->rxhostdesc_start, adev->rxhostdesc_area_size, - adev->rxbuf_start, adev->rxbuf_area_size); + adev->rx.desc_start, + adev->rx.hostdesc_start, adev->rx.hostdesc_area_size, + adev->rx.buf_start, adev->rx.buf_area_size); acxmem_unlock(); FN_EXIT0; @@ -2506,12 +2506,12 @@ void acx_process_rxdesc(acx_device_t *adev) * full, just in case there's a mismatch between our current * rx_tail and the full descriptor we're supposed to * handle. */ - tail = adev->rx_tail; + tail = adev->rx.tail; count = RX_CNT; while (1) { - hostdesc = &adev->rxhostdesc_start[tail]; + hostdesc = &adev->rx.hostdesc_start[tail]; if (IS_MEM(adev)) - rxdesc = &adev->rxdesc_start[tail]; + rxdesc = &adev->rx.desc_start[tail]; /* advance tail regardless of outcome of the below test */ tail = (tail + 1) % RX_CNT; @@ -2561,7 +2561,7 @@ void acx_process_rxdesc(acx_device_t *adev) /* ok, descriptor is handled, now check the * next descriptor */ - hostdesc = &adev->rxhostdesc_start[tail]; + hostdesc = &adev->rx.hostdesc_start[tail]; /* if next descriptor is empty, then bail out */ if (!(hostdesc->hd.Ctl_16 & cpu_to_le16(DESC_CTL_HOSTOWN)) @@ -2636,8 +2636,8 @@ void acx_process_rxdesc(acx_device_t *adev) write_reg16(adev, IO_ACX_INT_TRIG, INT_TRIG_RXPRC); /* ok, descriptor is handled, now check the next descriptor */ - hostdesc = &adev->rxhostdesc_start[tail]; - rxdesc = &adev->rxdesc_start[tail]; + hostdesc = &adev->rx.hostdesc_start[tail]; + rxdesc = &adev->rx.desc_start[tail]; Ctl_8 = hostdesc->hd.Ctl_16 = read_slavemem8(adev, (u32) &(rxdesc->Ctl_8)); @@ -2649,7 +2649,7 @@ void acx_process_rxdesc(acx_device_t *adev) tail = (tail + 1) % RX_CNT; } end: - adev->rx_tail = tail; + adev->rx.tail = tail; FN_EXIT0; } @@ -4364,7 +4364,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, acx_lock(adev, flags); /* dump acx111 internal rx descriptor ring buffer */ - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; /* loop over complete receive pool */ if (rxdesc) @@ -4388,7 +4388,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, /* dump host rx descriptor ring buffer */ - rxhostdesc = adev->rxhostdesc_start; + rxhostdesc = adev->rx.hostdesc_start; /* loop over complete receive pool */ if (rxhostdesc) diff --git a/pci.c b/pci.c index b19b4f3..46ced41 100644 --- a/pci.c +++ b/pci.c @@ -649,10 +649,10 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) FN_ENTER; seq_printf(file, "** Rx buf **\n"); - rxhostdesc = adev->rxhostdesc_start; + rxhostdesc = adev->rx.hostdesc_start; if (rxhostdesc) for (i = 0; i < RX_CNT; i++) { - rtl = (i == adev->rx_tail) ? " [tail]" : ""; + rtl = (i == adev->rx.tail) ? " [tail]" : ""; if ((rxhostdesc->hd.Ctl_16 & cpu_to_le16(DESC_CTL_HOSTOWN)) && (rxhostdesc-> Status & cpu_to_le32(DESC_STATUS_FULL))) @@ -699,11 +699,11 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) adev->tx.desc_size, adev->tx.desc_start, adev->tx.hostdesc_start, adev->tx.hostdesc_area_size, (unsigned long long)adev->tx.hostdesc_startphy, - adev->rxdesc_start, - adev->rxhostdesc_start, adev->rxhostdesc_area_size, - (unsigned long long)adev->rxhostdesc_startphy, - adev->rxbuf_start, adev->rxbuf_area_size, - (unsigned long long)adev->rxbuf_startphy); + adev->rx.desc_start, + adev->rx.hostdesc_start, adev->rx.hostdesc_area_size, + (unsigned long long)adev->rx.hostdesc_startphy, + adev->rx.buf_start, adev->rx.buf_area_size, + (unsigned long long)adev->rx.buf_startphy); FN_EXIT0; return 0; @@ -1025,7 +1025,7 @@ acx111pci_ioctl_info(struct net_device *ndev, acx_lock(adev, flags); /* dump acx111 internal rx descriptor ring buffer */ - rxdesc = adev->rxdesc_start; + rxdesc = adev->rx.desc_start; /* loop over complete receive pool */ if (rxdesc) @@ -1049,7 +1049,7 @@ acx111pci_ioctl_info(struct net_device *ndev, /* dump host rx descriptor ring buffer */ - rxhostdesc = adev->rxhostdesc_start; + rxhostdesc = adev->rx.hostdesc_start; /* loop over complete receive pool */ if (rxhostdesc) -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:40
|
Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 32 ++++---------------------------- 1 files changed, 4 insertions(+), 28 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index 6463104..d1342f3 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -478,36 +478,12 @@ struct acx_device { /*** PCI stuff ***/ #if (defined(CONFIG_ACX_MAC80211_PCI) || defined(CONFIG_ACX_MAC80211_MEM)) - /* pointers to tx buffers, tx host descriptors (in host memory) - ** and tx descs in device memory */ -#if 0 - unsigned int tx_tail; - u8 *txbuf_start; - txhostdesc_t *txhostdesc_start; - /* sizes of above host memory areas */ - unsigned int txbuf_area_size; - unsigned int txhostdesc_area_size; - unsigned int txdesc_size; /* size of txdesc */ - dma_addr_t txbuf_startphy; - dma_addr_t txhostdesc_startphy; - txdesc_t *txdesc_start; /* points to PCI-mapped memory */ -#else + + /* pointers to tx buffers, tx host descriptors (in host + * memory) and tx descs in device memory, same for rx + */ struct tx_desc_pair tx; -#endif -#if 0 - /* same for rx */ - unsigned int rx_tail; - rxbuffer_t *rxbuf_start; - rxhostdesc_t *rxhostdesc_start; - rxdesc_t *rxdesc_start; - /* physical addresses of above host memory areas */ - dma_addr_t rxbuf_startphy; - dma_addr_t rxhostdesc_startphy; - unsigned int rxbuf_area_size; - unsigned int rxhostdesc_area_size; -#else struct rx_desc_pair rx; -#endif u8 need_radio_fw; u8 irqs_active; /* whether irq sending is activated */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:41
|
last step, completes tx*desc refactoring move more tx related fields into tx_desc_pair struct. One left, see if its the problem (or it was some other slop that got past compiler to get OOPs) Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 7 +++++-- merge.c | 16 ++++++++-------- pci.c | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index 747ebba..a4a80f3 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -225,6 +225,9 @@ struct tx_desc_pair { unsigned int buf_area_size; unsigned int hostdesc_area_size; unsigned int desc_size; /* size of txdesc */ + + dma_addr_t buf_startphy; + dma_addr_t hostdesc_startphy; }; /* FIXME: this should be named something like struct acx_priv (typedef'd to @@ -468,12 +471,12 @@ struct acx_device { unsigned int txbuf_area_size; unsigned int txhostdesc_area_size; unsigned int txdesc_size; /* size of txdesc */ + dma_addr_t txbuf_startphy; + dma_addr_t txhostdesc_startphy; #else struct tx_desc_pair tx; #endif txdesc_t *txdesc_start; /* points to PCI-mapped memory */ - dma_addr_t txbuf_startphy; - dma_addr_t txhostdesc_startphy; /* same for rx */ unsigned int rx_tail; diff --git a/merge.c b/merge.c index 3db74f9..22e96c0 100644 --- a/merge.c +++ b/merge.c @@ -326,7 +326,7 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) adev->tx.buf_area_size = TX_CNT * WLAN_A4FR_MAXLEN_WEP_FCS; adev->tx.buf_start = acx_allocate(adev, adev->tx.buf_area_size, - &adev->txbuf_startphy, "txbuf_start"); + &adev->tx.buf_startphy, "txbuf_start"); if (!adev->tx.buf_start) goto fail; @@ -334,7 +334,7 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) adev->tx.hostdesc_area_size = TX_CNT * 2 * sizeof(*hostdesc); adev->tx.hostdesc_start = acx_allocate(adev, adev->tx.hostdesc_area_size, - &adev->txhostdesc_startphy, + &adev->tx.hostdesc_startphy, "txhostdesc_start"); if (!adev->tx.hostdesc_start) goto fail; @@ -345,9 +345,9 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) } hostdesc = adev->tx.hostdesc_start; - hostdesc_phy = adev->txhostdesc_startphy; + hostdesc_phy = adev->tx.hostdesc_startphy; txbuf = adev->tx.buf_start; - txbuf_phy = adev->txbuf_startphy; + txbuf_phy = adev->tx.buf_startphy; #if 0 /* Each tx buffer is accessed by hardware via txdesc -> txhostdesc(s) @@ -430,7 +430,7 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) hostdesc++; } hostdesc--; - hostdesc->hd.desc_phy_next = cpu2acx(adev->txhostdesc_startphy); + hostdesc->hd.desc_phy_next = cpu2acx(adev->tx.hostdesc_startphy); FN_EXIT1(OK); return OK; @@ -612,7 +612,7 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) txdesc = adev->txdesc_start; if (IS_PCI(adev)) { mem_offs = tx_queue_start; - hostmemptr = adev->txhostdesc_startphy; + hostmemptr = adev->tx.hostdesc_startphy; hostdesc = adev->tx.hostdesc_start; } if (IS_ACX111(adev)) { @@ -731,10 +731,10 @@ void acx_free_desc_queues(acx_device_t *adev) FN_ENTER; ACX_FREE_QUEUE(adev, adev->tx.hostdesc_area_size, - adev->tx.hostdesc_start, adev->txhostdesc_startphy); + adev->tx.hostdesc_start, adev->tx.hostdesc_startphy); ACX_FREE_QUEUE(adev, adev->tx.buf_area_size, - adev->tx.buf_start, adev->txbuf_startphy); + adev->tx.buf_start, adev->tx.buf_startphy); adev->txdesc_start = NULL; diff --git a/pci.c b/pci.c index 79bef39..f3a221e 100644 --- a/pci.c +++ b/pci.c @@ -695,10 +695,10 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", adev->tx.buf_start, adev->tx.buf_area_size, - (unsigned long long)adev->txbuf_startphy, + (unsigned long long)adev->tx.buf_startphy, adev->tx.desc_size, adev->txdesc_start, adev->tx.hostdesc_start, adev->tx.hostdesc_area_size, - (unsigned long long)adev->txhostdesc_startphy, + (unsigned long long)adev->tx.hostdesc_startphy, adev->rxdesc_start, adev->rxhostdesc_start, adev->rxhostdesc_area_size, (unsigned long long)adev->rxhostdesc_startphy, -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:40
|
another baby-step Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 13 ++++++++----- common.c | 2 +- mem.c | 8 ++++---- merge.c | 44 ++++++++++++++++++++++---------------------- merge.h | 4 ++-- pci.c | 6 +++--- 6 files changed, 40 insertions(+), 37 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index 7ae26ba..747ebba 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -221,6 +221,10 @@ struct tx_desc_pair { unsigned int tail; u8 *buf_start; txhostdesc_t *hostdesc_start; + /* sizes of above host memory areas */ + unsigned int buf_area_size; + unsigned int hostdesc_area_size; + unsigned int desc_size; /* size of txdesc */ }; /* FIXME: this should be named something like struct acx_priv (typedef'd to @@ -460,17 +464,16 @@ struct acx_device { unsigned int tx_tail; u8 *txbuf_start; txhostdesc_t *txhostdesc_start; + /* sizes of above host memory areas */ + unsigned int txbuf_area_size; + unsigned int txhostdesc_area_size; + unsigned int txdesc_size; /* size of txdesc */ #else struct tx_desc_pair tx; #endif txdesc_t *txdesc_start; /* points to PCI-mapped memory */ dma_addr_t txbuf_startphy; dma_addr_t txhostdesc_startphy; - /* sizes of above host memory areas */ - unsigned int txbuf_area_size; - unsigned int txhostdesc_area_size; - - unsigned int txdesc_size; /* size of txdesc; ACX111 = ACX100 + 4 */ /* same for rx */ unsigned int rx_tail; diff --git a/common.c b/common.c index b247b52..710ba9b 100644 --- a/common.c +++ b/common.c @@ -5404,7 +5404,7 @@ u16 acx111_tx_build_rateset(acx_device_t *adev, txdesc_t *txdesc, if (debug) { i = ((u8*) txdesc - (u8*) adev->txdesc_start) - / adev->txdesc_size; + / adev->tx.desc_size; sprintf(tmpstr, "txdesc=%i: rates in info" "[bitrate,hw_value,count]: ", i); } diff --git a/mem.c b/mem.c index 1f80286..5fbe4d1 100644 --- a/mem.c +++ b/mem.c @@ -1146,9 +1146,9 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), - adev->tx.buf_start, adev->txbuf_area_size, adev->txdesc_size, + adev->tx.buf_start, adev->tx.buf_area_size, adev->tx.desc_size, adev->txdesc_start, adev->tx.hostdesc_start, - adev->txhostdesc_area_size, adev->acx_txbuf_start, + adev->tx.hostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, adev->rxdesc_start, @@ -1487,11 +1487,11 @@ STATick txhostdesc_t* acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { int index = (u8*) txdesc - (u8*) adev->txdesc_start; - if (unlikely(ACX_DEBUG && (index % adev->txdesc_size))) { + if (unlikely(ACX_DEBUG && (index % adev->tx.desc_size))) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; } - index /= adev->txdesc_size; + index /= adev->tx.desc_size; if (unlikely(ACX_DEBUG && (index >= TX_CNT))) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; diff --git a/merge.c b/merge.c index 9839679..3db74f9 100644 --- a/merge.c +++ b/merge.c @@ -321,19 +321,19 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) FN_ENTER; /* allocate TX buffer */ - /* OW 20100513 adev->txbuf_area_size = TX_CNT + /* OW 20100513 adev->tx.buf_area_size = TX_CNT * *WLAN_A4FR_MAXLEN_WEP_FCS (30 + 2312 + 4); */ - adev->txbuf_area_size = TX_CNT * WLAN_A4FR_MAXLEN_WEP_FCS; + adev->tx.buf_area_size = TX_CNT * WLAN_A4FR_MAXLEN_WEP_FCS; adev->tx.buf_start - = acx_allocate(adev, adev->txbuf_area_size, + = acx_allocate(adev, adev->tx.buf_area_size, &adev->txbuf_startphy, "txbuf_start"); if (!adev->tx.buf_start) goto fail; /* allocate the TX host descriptor queue pool */ - adev->txhostdesc_area_size = TX_CNT * 2 * sizeof(*hostdesc); + adev->tx.hostdesc_area_size = TX_CNT * 2 * sizeof(*hostdesc); adev->tx.hostdesc_start - = acx_allocate(adev, adev->txhostdesc_area_size, + = acx_allocate(adev, adev->tx.hostdesc_area_size, &adev->txhostdesc_startphy, "txhostdesc_start"); if (!adev->tx.hostdesc_start) @@ -591,10 +591,10 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) FN_ENTER; if (IS_ACX100(adev)) - adev->txdesc_size = sizeof(*txdesc); + adev->tx.desc_size = sizeof(*txdesc); else /* the acx111 txdesc is 4 bytes larger */ - adev->txdesc_size = sizeof(*txdesc) + 4; + adev->tx.desc_size = sizeof(*txdesc) + 4; /* This refers to an ACX address, not one of ours */ adev->txdesc_start = (IS_PCI(adev)) @@ -651,7 +651,7 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) /* loop over whole send pool */ for (i = 0; i < TX_CNT; i++) { log(L_DEBUG, "configure card tx descriptor: 0x%p, " - "size: 0x%X\n", txdesc, adev->txdesc_size); + "size: 0x%X\n", txdesc, adev->tx.desc_size); if (IS_PCI(adev)) { /* pointer to hostdesc memory */ @@ -665,12 +665,12 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) /* done by memset(0): txdesc->Ctl2_8 = 0; */ /* point to next txdesc */ txdesc->pNextDesc = - cpu2acx(mem_offs + adev->txdesc_size); + cpu2acx(mem_offs + adev->tx.desc_size); /* reserve two (hdr desc and payload desc) */ hostdesc += 2; hostmemptr += 2 * sizeof(*hostdesc); /* go to the next one */ - mem_offs += adev->txdesc_size; + mem_offs += adev->tx.desc_size; /* ++ is safe here (we are acx100) */ txdesc++; @@ -686,7 +686,7 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) /* point to next txdesc */ write_slavemem32(adev, (u32) &(txdesc->pNextDesc), (u32) cpu_to_le32 ((u8 *) txdesc - + adev->txdesc_size)); + + adev->tx.desc_size)); /* go to the next one */ /* ++ is safe here (we are acx100) */ @@ -730,10 +730,10 @@ void acx_free_desc_queues(acx_device_t *adev) FN_ENTER; - ACX_FREE_QUEUE(adev, adev->txhostdesc_area_size, + ACX_FREE_QUEUE(adev, adev->tx.hostdesc_area_size, adev->tx.hostdesc_start, adev->txhostdesc_startphy); - ACX_FREE_QUEUE(adev, adev->txbuf_area_size, + ACX_FREE_QUEUE(adev, adev->tx.buf_area_size, adev->tx.buf_start, adev->txbuf_startphy); adev->txdesc_start = NULL; @@ -2464,9 +2464,9 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), - adev->tx.buf_start, adev->txbuf_area_size, adev->txdesc_size, + adev->tx.buf_start, adev->tx.buf_area_size, adev->tx.desc_size, adev->txdesc_start, adev->tx.hostdesc_start, - adev->txhostdesc_area_size, adev->acx_txbuf_start, + adev->tx.hostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, adev->rxdesc_start, @@ -2674,7 +2674,7 @@ static inline txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index) { return (txdesc_t*) (((u8*) adev->txdesc_start) - + index * adev->txdesc_size); + + index * adev->tx.desc_size); } #endif @@ -2844,7 +2844,7 @@ void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { * This is only called immediately after we've allocated, so * we should be able to set the head back to this descriptor. */ - index = ((u8*) txdesc - (u8*) adev->txdesc_start) / adev->txdesc_size; + index = ((u8*) txdesc - (u8*) adev->txdesc_start) / adev->tx.desc_size; pr_info("acx_dealloc: moving head from %d to %d\n", adev->tx_head, index); adev->tx_head = index; @@ -2977,11 +2977,11 @@ static txhostdesc_t *acx_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc) FN_ENTER; - if (unlikely(ACX_DEBUG && (index % adev->txdesc_size))) { + if (unlikely(ACX_DEBUG && (index % adev->tx.desc_size))) { pr_acx("bad txdesc ptr %p\n", txdesc); return NULL; } - index /= adev->txdesc_size; + index /= adev->tx.desc_size; if (unlikely(ACX_DEBUG && (index >= TX_CNT))) { pr_acx("bad txdesc ptr %p\n", txdesc); return NULL; @@ -3001,11 +3001,11 @@ void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque) static txhostdesc_t* acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { int index = (u8*) txdesc - (u8*) adev->txdesc_start; - if (unlikely(ACX_DEBUG && (index % adev->txdesc_size))) { + if (unlikely(ACX_DEBUG && (index % adev->tx.desc_size))) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; } - index /= adev->txdesc_size; + index /= adev->tx.desc_size; if (unlikely(ACX_DEBUG && (index >= TX_CNT))) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; @@ -3189,7 +3189,7 @@ void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, write_slavemem8(adev, (u32) &(txdesc->Ctl_8), DESC_CTL_HOSTOWN | DESC_CTL_FIRSTFRAG); adev->tx_head = ((u8*) txdesc - (u8*) adev->txdesc_start) - / adev->txdesc_size; + / adev->tx.desc_size; adev->tx_free++; goto end_of_chain; } diff --git a/merge.h b/merge.h index 009df61..8a6c816 100644 --- a/merge.h +++ b/merge.h @@ -41,14 +41,14 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev); static inline txdesc_t* acx_get_txdesc(acx_device_t *adev, int index) { return (txdesc_t*) (((u8*) adev->txdesc_start) - + index * adev->txdesc_size); + + index * adev->tx.desc_size); } static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev, txdesc_t* txdesc, int inc) { return (txdesc_t*) (((u8*) txdesc) - + inc * adev->txdesc_size); + + inc * adev->tx.desc_size); } void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, diff --git a/pci.c b/pci.c index b91f138..79bef39 100644 --- a/pci.c +++ b/pci.c @@ -694,10 +694,10 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) "rxdesc_start %p\n" "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", - adev->tx.buf_start, adev->txbuf_area_size, + adev->tx.buf_start, adev->tx.buf_area_size, (unsigned long long)adev->txbuf_startphy, - adev->txdesc_size, adev->txdesc_start, - adev->tx.hostdesc_start, adev->txhostdesc_area_size, + adev->tx.desc_size, adev->txdesc_start, + adev->tx.hostdesc_start, adev->tx.hostdesc_area_size, (unsigned long long)adev->txhostdesc_startphy, adev->rxdesc_start, adev->rxhostdesc_start, adev->rxhostdesc_area_size, -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:43
|
Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 4 +++- common.c | 2 +- mem.c | 8 ++++---- merge.c | 38 +++++++++++++++++++------------------- merge.h | 2 +- pci.c | 6 +++--- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index a4a80f3..b291aca 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -228,6 +228,8 @@ struct tx_desc_pair { dma_addr_t buf_startphy; dma_addr_t hostdesc_startphy; + txdesc_t *desc_start; /* points to PCI-mapped memory */ + }; /* FIXME: this should be named something like struct acx_priv (typedef'd to @@ -473,10 +475,10 @@ struct acx_device { unsigned int txdesc_size; /* size of txdesc */ dma_addr_t txbuf_startphy; dma_addr_t txhostdesc_startphy; + txdesc_t *txdesc_start; /* points to PCI-mapped memory */ #else struct tx_desc_pair tx; #endif - txdesc_t *txdesc_start; /* points to PCI-mapped memory */ /* same for rx */ unsigned int rx_tail; diff --git a/common.c b/common.c index 710ba9b..6a6eccd 100644 --- a/common.c +++ b/common.c @@ -5403,7 +5403,7 @@ u16 acx111_tx_build_rateset(acx_device_t *adev, txdesc_t *txdesc, int debug = acx_debug & L_BUFT; if (debug) { - i = ((u8*) txdesc - (u8*) adev->txdesc_start) + i = ((u8*) txdesc - (u8*) adev->tx.desc_start) / adev->tx.desc_size; sprintf(tmpstr, "txdesc=%i: rates in info" "[bitrate,hw_value,count]: ", i); diff --git a/mem.c b/mem.c index 5fbe4d1..7f2b944 100644 --- a/mem.c +++ b/mem.c @@ -1047,7 +1047,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->acx_txbuf_numblocks, adev->acx_txbuf_blocks_free, adev->acx_txbuf_free); - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; if (txdesc) { for (i = 0; i < TX_CNT; i++) { thd = (i == adev->tx_head) ? " [head]" : ""; @@ -1147,7 +1147,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), adev->tx.buf_start, adev->tx.buf_area_size, adev->tx.desc_size, - adev->txdesc_start, adev->tx.hostdesc_start, + adev->tx.desc_start, adev->tx.hostdesc_start, adev->tx.hostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, @@ -1486,7 +1486,7 @@ void acxmem_init_acx_txbuf2(acx_device_t *adev) STATick txhostdesc_t* acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { - int index = (u8*) txdesc - (u8*) adev->txdesc_start; + int index = (u8*) txdesc - (u8*) adev->tx.desc_start; if (unlikely(ACX_DEBUG && (index % adev->tx.desc_size))) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; @@ -2172,7 +2172,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, } /* dump acx111 internal tx descriptor ring buffer */ - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; /* loop over complete transmit pool */ if (txdesc) diff --git a/merge.c b/merge.c index 22e96c0..f0b9665 100644 --- a/merge.c +++ b/merge.c @@ -523,7 +523,7 @@ void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) /* we didn't pre-calculate rxdesc_start in case of ACX100 */ /* rxdesc_start should be right AFTER Tx pool */ adev->rxdesc_start = (rxdesc_t *) - ((u8 *) adev->txdesc_start + ((u8 *) adev->tx.desc_start + (TX_CNT * sizeof(txdesc_t))); /* NB: sizeof(txdesc_t) above is valid because we know @@ -597,19 +597,19 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) adev->tx.desc_size = sizeof(*txdesc) + 4; /* This refers to an ACX address, not one of ours */ - adev->txdesc_start = (IS_PCI(adev)) + adev->tx.desc_start = (IS_PCI(adev)) ? (txdesc_t *) (adev->iobase2 + tx_queue_start) : (txdesc_t *) tx_queue_start; log(L_DEBUG, "adev->iobase2=%p\n" "tx_queue_start=%08X\n" - "adev->txdesc_start=%p\n", - adev->iobase2, tx_queue_start, adev->txdesc_start); + "adev->tx.desc_start=%p\n", + adev->iobase2, tx_queue_start, adev->tx.desc_start); adev->tx_free = TX_CNT; /* done by memset: adev->tx_head = 0; */ /* done by memset: adev->tx.tail = 0; */ - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; if (IS_PCI(adev)) { mem_offs = tx_queue_start; hostmemptr = adev->tx.hostdesc_startphy; @@ -635,13 +635,13 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) /* clear whole send pool. sizeof is safe here (we are * acx100) */ if (IS_PCI(adev)) - memset(adev->txdesc_start, 0, + memset(adev->tx.desc_start, 0, TX_CNT * sizeof(*txdesc)); else { - /* adev->txdesc_start refers to device memory, + /* adev->tx.desc_start refers to device memory, so we can't write directly to it. */ - clr = (u32) adev->txdesc_start; - while (clr < (u32) adev->txdesc_start + clr = (u32) adev->tx.desc_start; + while (clr < (u32) adev->tx.desc_start + (TX_CNT * sizeof(*txdesc))) { write_slavemem32(adev, clr, 0); clr += 4; @@ -736,7 +736,7 @@ void acx_free_desc_queues(acx_device_t *adev) ACX_FREE_QUEUE(adev, adev->tx.buf_area_size, adev->tx.buf_start, adev->tx.buf_startphy); - adev->txdesc_start = NULL; + adev->tx.desc_start = NULL; ACX_FREE_QUEUE(adev, adev->rxhostdesc_area_size, adev->rxhostdesc_start, adev->rxhostdesc_startphy); @@ -810,7 +810,7 @@ void acx_log_txbuffer(acx_device_t *adev) pr_debug("entry\n"); - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; if (unlikely(!txdesc)) return; @@ -2358,7 +2358,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->acx_txbuf_numblocks, adev->acx_txbuf_blocks_free, adev->acx_txbuf_free); - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; if (txdesc) { for (i = 0; i < TX_CNT; i++) { thd = (i == adev->tx_head) ? " [head]" : ""; @@ -2465,7 +2465,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), adev->tx.buf_start, adev->tx.buf_area_size, adev->tx.desc_size, - adev->txdesc_start, adev->tx.hostdesc_start, + adev->tx.desc_start, adev->tx.hostdesc_start, adev->tx.hostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, @@ -2673,7 +2673,7 @@ static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len) { static inline txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index) { - return (txdesc_t*) (((u8*) adev->txdesc_start) + return (txdesc_t*) (((u8*) adev->tx.desc_start) + index * adev->tx.desc_size); } #endif @@ -2844,7 +2844,7 @@ void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { * This is only called immediately after we've allocated, so * we should be able to set the head back to this descriptor. */ - index = ((u8*) txdesc - (u8*) adev->txdesc_start) / adev->tx.desc_size; + index = ((u8*) txdesc - (u8*) adev->tx.desc_start) / adev->tx.desc_size; pr_info("acx_dealloc: moving head from %d to %d\n", adev->tx_head, index); adev->tx_head = index; @@ -2973,7 +2973,7 @@ static void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { static txhostdesc_t *acx_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc) { - int index = (u8 *) txdesc - (u8 *) adev->txdesc_start; + int index = (u8 *) txdesc - (u8 *) adev->tx.desc_start; FN_ENTER; @@ -3000,7 +3000,7 @@ void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque) #if 0 // merged static txhostdesc_t* acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { - int index = (u8*) txdesc - (u8*) adev->txdesc_start; + int index = (u8*) txdesc - (u8*) adev->tx.desc_start; if (unlikely(ACX_DEBUG && (index % adev->tx.desc_size))) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; @@ -3188,7 +3188,7 @@ void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, write_slavemem16(adev, (u32) &(txdesc->total_length), 0); write_slavemem8(adev, (u32) &(txdesc->Ctl_8), DESC_CTL_HOSTOWN | DESC_CTL_FIRSTFRAG); - adev->tx_head = ((u8*) txdesc - (u8*) adev->txdesc_start) + adev->tx_head = ((u8*) txdesc - (u8*) adev->tx.desc_start) / adev->tx.desc_size; adev->tx_free++; goto end_of_chain; @@ -4413,7 +4413,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, } /* dump acx111 internal tx descriptor ring buffer */ - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; /* loop over complete transmit pool */ if (txdesc) diff --git a/merge.h b/merge.h index 8a6c816..a7f933c 100644 --- a/merge.h +++ b/merge.h @@ -40,7 +40,7 @@ unsigned int acx_tx_clean_txdesc(acx_device_t *adev); static inline txdesc_t* acx_get_txdesc(acx_device_t *adev, int index) { - return (txdesc_t*) (((u8*) adev->txdesc_start) + return (txdesc_t*) (((u8*) adev->tx.desc_start) + index * adev->tx.desc_size); } diff --git a/pci.c b/pci.c index f3a221e..b19b4f3 100644 --- a/pci.c +++ b/pci.c @@ -666,7 +666,7 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) adev->tx_free, acx_queue_stopped(adev->ieee) ? "STOPPED" : "running"); - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; if (txdesc) for (i = 0; i < TX_CNT; i++) { thd = (i == adev->tx_head) ? " [head]" : ""; @@ -696,7 +696,7 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", adev->tx.buf_start, adev->tx.buf_area_size, (unsigned long long)adev->tx.buf_startphy, - adev->tx.desc_size, adev->txdesc_start, + adev->tx.desc_size, adev->tx.desc_start, adev->tx.hostdesc_start, adev->tx.hostdesc_area_size, (unsigned long long)adev->tx.hostdesc_startphy, adev->rxdesc_start, @@ -1074,7 +1074,7 @@ acx111pci_ioctl_info(struct net_device *ndev, } /* dump acx111 internal tx descriptor ring buffer */ - txdesc = adev->txdesc_start; + txdesc = adev->tx.desc_start; /* loop over complete transmit pool */ if (txdesc) -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:43
|
2nd baby-step Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 3 ++- mem.c | 6 +++--- merge.c | 20 ++++++++++---------- pci.c | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index 4cc017d..7ae26ba 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -220,6 +220,7 @@ struct eeprom_cfg { struct tx_desc_pair { unsigned int tail; u8 *buf_start; + txhostdesc_t *hostdesc_start; }; /* FIXME: this should be named something like struct acx_priv (typedef'd to @@ -458,10 +459,10 @@ struct acx_device { #if 0 unsigned int tx_tail; u8 *txbuf_start; + txhostdesc_t *txhostdesc_start; #else struct tx_desc_pair tx; #endif - txhostdesc_t *txhostdesc_start; txdesc_t *txdesc_start; /* points to PCI-mapped memory */ dma_addr_t txbuf_startphy; dma_addr_t txhostdesc_startphy; diff --git a/mem.c b/mem.c index 7f82803..1f80286 100644 --- a/mem.c +++ b/mem.c @@ -1147,7 +1147,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), adev->tx.buf_start, adev->txbuf_area_size, adev->txdesc_size, - adev->txdesc_start, adev->txhostdesc_start, + adev->txdesc_start, adev->tx.hostdesc_start, adev->txhostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, @@ -1496,7 +1496,7 @@ acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) pr_info("bad txdesc ptr %p\n", txdesc); return NULL; } - return &adev->txhostdesc_start[index * 2]; + return &adev->tx.hostdesc_start[index * 2]; } @@ -2204,7 +2204,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, /* dump host tx descriptor ring buffer */ - txhostdesc = adev->txhostdesc_start; + txhostdesc = adev->tx.hostdesc_start; /* loop over complete host send pool */ if (txhostdesc) diff --git a/merge.c b/merge.c index 53e4460..9839679 100644 --- a/merge.c +++ b/merge.c @@ -332,19 +332,19 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) /* allocate the TX host descriptor queue pool */ adev->txhostdesc_area_size = TX_CNT * 2 * sizeof(*hostdesc); - adev->txhostdesc_start + adev->tx.hostdesc_start = acx_allocate(adev, adev->txhostdesc_area_size, &adev->txhostdesc_startphy, "txhostdesc_start"); - if (!adev->txhostdesc_start) + if (!adev->tx.hostdesc_start) goto fail; /* check for proper alignment of TX host descriptor pool */ - if ((long)adev->txhostdesc_start & 3) { + if ((long)adev->tx.hostdesc_start & 3) { pr_acx("driver bug: dma alloc returns unaligned address\n"); goto fail; } - hostdesc = adev->txhostdesc_start; + hostdesc = adev->tx.hostdesc_start; hostdesc_phy = adev->txhostdesc_startphy; txbuf = adev->tx.buf_start; txbuf_phy = adev->txbuf_startphy; @@ -613,7 +613,7 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) if (IS_PCI(adev)) { mem_offs = tx_queue_start; hostmemptr = adev->txhostdesc_startphy; - hostdesc = adev->txhostdesc_start; + hostdesc = adev->tx.hostdesc_start; } if (IS_ACX111(adev)) { /* ACX111 has a preinitialized Tx buffer! */ @@ -731,7 +731,7 @@ void acx_free_desc_queues(acx_device_t *adev) FN_ENTER; ACX_FREE_QUEUE(adev, adev->txhostdesc_area_size, - adev->txhostdesc_start, adev->txhostdesc_startphy); + adev->tx.hostdesc_start, adev->txhostdesc_startphy); ACX_FREE_QUEUE(adev, adev->txbuf_area_size, adev->tx.buf_start, adev->txbuf_startphy); @@ -2465,7 +2465,7 @@ int acxmem_proc_diag_output(struct seq_file *file, adev->irq_mask, adev->irq_status, read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES), adev->tx.buf_start, adev->txbuf_area_size, adev->txdesc_size, - adev->txdesc_start, adev->txhostdesc_start, + adev->txdesc_start, adev->tx.hostdesc_start, adev->txhostdesc_area_size, adev->acx_txbuf_start, adev->acx_txbuf_numblocks * adev->memblocksize, @@ -2989,7 +2989,7 @@ static txhostdesc_t *acx_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc) FN_EXIT0; - return &adev->txhostdesc_start[index * 2]; + return &adev->tx.hostdesc_start[index * 2]; } void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque) @@ -3010,7 +3010,7 @@ acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) { pr_info("bad txdesc ptr %p\n", txdesc); return NULL; } - return &adev->txhostdesc_start[index * 2]; + return &adev->tx.hostdesc_start[index * 2]; } #endif // acxmem_get_txhostdesc() @@ -4445,7 +4445,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, /* dump host tx descriptor ring buffer */ - txhostdesc = adev->txhostdesc_start; + txhostdesc = adev->tx.hostdesc_start; /* loop over complete host send pool */ if (txhostdesc) diff --git a/pci.c b/pci.c index 1d52a22..b91f138 100644 --- a/pci.c +++ b/pci.c @@ -697,7 +697,7 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) adev->tx.buf_start, adev->txbuf_area_size, (unsigned long long)adev->txbuf_startphy, adev->txdesc_size, adev->txdesc_start, - adev->txhostdesc_start, adev->txhostdesc_area_size, + adev->tx.hostdesc_start, adev->txhostdesc_area_size, (unsigned long long)adev->txhostdesc_startphy, adev->rxdesc_start, adev->rxhostdesc_start, adev->rxhostdesc_area_size, @@ -1105,7 +1105,7 @@ acx111pci_ioctl_info(struct net_device *ndev, /* dump host tx descriptor ring buffer */ - txhostdesc = adev->txhostdesc_start; + txhostdesc = adev->tx.hostdesc_start; /* loop over complete host send pool */ if (txhostdesc) -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:45
|
The aim here is to guard adev->tx, adev->rx refs, which are not present in acx_device_t when only USB is configured. This is insufficient, and there may be a better way (like ifdef'g the entire function, or perhaps file), so do it separately so its easy to revert later. Signed-off-by: Jim Cromie <jim...@gm...> --- common.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common.c b/common.c index 42594f5..933151d 100644 --- a/common.c +++ b/common.c @@ -970,6 +970,7 @@ acx100_init_memory_pools(acx_device_t * adev, const acx_ie_memmap_t * mmt) 0x00010000 using host indirect descriptors (else host must access ACX memory?) */ if (IS_PCI(adev)) { + #if defined(CONFIG_ACX_MAC80211_PCI) MemoryConfigOption.DMA_config = cpu_to_le32(0x30000); /* Declare start of the Rx host pool */ MemoryConfigOption.pRxHostDesc = @@ -977,17 +978,20 @@ acx100_init_memory_pools(acx_device_t * adev, const acx_ie_memmap_t * mmt) log(L_DEBUG, "pRxHostDesc 0x%08X, rxhostdesc_startphy 0x%lX\n", acx2cpu(MemoryConfigOption.pRxHostDesc), (long)adev->rx.hostdesc_startphy); + #endif } else if(IS_MEM(adev)) { /* * ACX ignores DMA_config for generic slave mode. */ + #if defined(CONFIG_ACX_MAC80211_MEM) MemoryConfigOption.DMA_config = 0; /* Declare start of the Rx host pool */ MemoryConfigOption.pRxHostDesc = cpu2acx(0); log(L_DEBUG, "pRxHostDesc 0x%08X, rxhostdesc_startphy 0x%lX\n", acx2cpu(MemoryConfigOption.pRxHostDesc), (long)adev->rx.hostdesc_startphy); + #endif } else { MemoryConfigOption.DMA_config = cpu_to_le32(0x20000); @@ -1204,12 +1208,16 @@ static int acx111_create_dma_regions(acx_device_t * adev) memconf.rx_queue1_type = 7; /* must be set to 7 */ /* done by memset: memconf.rx_queue1_prio = 0; low prio */ if (IS_PCI(adev)) { + #if defined(CONFIG_ACX_MAC80211_PCI) memconf.rx_queue1_host_rx_start = cpu2acx(adev->rx.hostdesc_startphy); + #endif } - else if (IS_MEM(adev)) - { - memconf.rx_queue1_host_rx_start = cpu2acx(adev->rx.hostdesc_startphy); + else if (IS_MEM(adev)) { + #if defined(CONFIG_ACX_MAC80211_MEM) + memconf.rx_queue1_host_rx_start = + cpu2acx(adev->rx.hostdesc_startphy); + #endif } /* Tx descriptor queue config */ @@ -5403,10 +5411,13 @@ u16 acx111_tx_build_rateset(acx_device_t *adev, txdesc_t *txdesc, int debug = acx_debug & L_BUFT; if (debug) { + #if defined(CONFIG_ACX_MAC80211_PCI) || \ + defined(CONFIG_ACX_MAC80211_MEM) i = ((u8*) txdesc - (u8*) adev->tx.desc_start) / adev->tx.desc_size; sprintf(tmpstr, "txdesc=%i: rates in info" "[bitrate,hw_value,count]: ", i); + #endif } for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:45
|
To get a good USB-only compile, must hide refs to adev->rx, adev->tx, as those members dont exist w/o PCI or MEM, this takes 1st step. Add ACX_FREE_QUEUES(adev, dir), which wraps 2 ACX_FREE_QUEUE() calls, and does the adev->tx.* or adev->rx.* expansions itself. This lets us hide the direct field refs, and provide a stub version for !PCI && !MEM configs (stub-macro is in merge.h, real-macro in merge.c) Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 23 +++++++++++------------ merge.h | 4 ++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/merge.c b/merge.c index 893f38a..a17c224 100644 --- a/merge.c +++ b/merge.c @@ -718,6 +718,7 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) void acx_free_desc_queues(acx_device_t *adev) { + #define ACX_FREE_QUEUE(adev, size, ptr, phyaddr) \ if (ptr) { \ if (IS_PCI(adev)) \ @@ -728,22 +729,20 @@ void acx_free_desc_queues(acx_device_t *adev) size = 0; \ } - FN_ENTER; - - ACX_FREE_QUEUE(adev, adev->tx.hostdesc_area_size, - adev->tx.hostdesc_start, adev->tx.hostdesc_startphy); +#ifndef ACX_FREE_QUEUES +#define ACX_FREE_QUEUES(adev, _dir_) \ + ACX_FREE_QUEUE(adev, adev->_dir_.hostdesc_area_size, \ + adev->_dir_.hostdesc_start, adev->_dir_.hostdesc_startphy); \ + ACX_FREE_QUEUE(adev, adev->_dir_.buf_area_size, \ + adev->_dir_.buf_start, adev->_dir_.buf_startphy); +#endif - ACX_FREE_QUEUE(adev, adev->tx.buf_area_size, - adev->tx.buf_start, adev->tx.buf_startphy); + FN_ENTER; + ACX_FREE_QUEUES(adev, tx); adev->tx.desc_start = NULL; - ACX_FREE_QUEUE(adev, adev->rx.hostdesc_area_size, - adev->rx.hostdesc_start, adev->rx.hostdesc_startphy); - - ACX_FREE_QUEUE(adev, adev->rx.buf_area_size, - adev->rx.buf_start, adev->rx.buf_startphy); - + ACX_FREE_QUEUES(adev, rx); adev->rx.desc_start = NULL; FN_EXIT0; diff --git a/merge.h b/merge.h index a7f933c..19c6855 100644 --- a/merge.h +++ b/merge.h @@ -91,3 +91,7 @@ static inline void acxmem_update_queue_indicator(acx_device_t *adev, { } #endif + +#if !defined(CONFIG_ACX_MAC80211_PCI) && !defined(CONFIG_ACX_MAC80211_MEM) +#define ACX_FREE_QUEUES(adev, _dir_) // empty stub here, real one in merge.c +#endif -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:47
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem-inlines.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/mem-inlines.h b/mem-inlines.h index 54fe4bc..fbebdb7 100644 --- a/mem-inlines.h +++ b/mem-inlines.h @@ -1,3 +1,6 @@ +#ifndef _MEM_INLINES_H_ +#define _MEM_INLINES_H_ + /* * Locking in mem * ================================================== @@ -378,3 +381,4 @@ INLINE_IO u16 read_slavemem16(acx_device_t *adev, u32 slave_address) return val; } +#endif /* _MEM_INLINES_H_ */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-08 17:14:48
|
- add guard - add some stub funcs to improve compilability of multiple configs Signed-off-by: Jim Cromie <jim...@gm...> --- merge.h | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 insertions(+), 19 deletions(-) diff --git a/merge.h b/merge.h index 19c6855..e995c94 100644 --- a/merge.h +++ b/merge.h @@ -1,3 +1,6 @@ +#ifndef _MERGE_H_ +#define _MERGE_H_ + #include <linux/interrupt.h> irqreturn_t acx_interrupt(int irq, void *dev_id); @@ -38,19 +41,6 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 rx_queue_start); unsigned int acx_tx_clean_txdesc(acx_device_t *adev); -static inline txdesc_t* acx_get_txdesc(acx_device_t *adev, int index) -{ - return (txdesc_t*) (((u8*) adev->tx.desc_start) - + index * adev->tx.desc_size); -} - -static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev, - txdesc_t* txdesc, int inc) -{ - return (txdesc_t*) (((u8*) txdesc) - + inc * adev->tx.desc_size); -} - void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct ieee80211_tx_info *info, struct sk_buff *skb); @@ -80,18 +70,36 @@ void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, int acxmem_upload_radio(acx_device_t *adev); int acxpci_upload_radio(acx_device_t *adev); -#if defined(CONFIG_ACX_MAC80211_MEM) +#if defined(CONFIG_ACX_MAC80211_PCI) || defined(CONFIG_ACX_MAC80211_MEM) void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -#else +static inline txdesc_t* acx_get_txdesc(acx_device_t *adev, int index) +{ + return (txdesc_t*) (((u8*) adev->tx.desc_start) + + index * adev->tx.desc_size); +} + +static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev, + txdesc_t* txdesc, int inc) +{ + return (txdesc_t*) (((u8*) txdesc) + + inc * adev->tx.desc_size); +} + +#else /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */ static inline void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { } -#endif +static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev, + txdesc_t* txdesc, int inc) +{ return (txdesc_t*) NULL; } + +/* empty stub here, real one in merge.c */ +#define ACX_FREE_QUEUES(adev, _dir_) + +#endif /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */ -#if !defined(CONFIG_ACX_MAC80211_PCI) && !defined(CONFIG_ACX_MAC80211_MEM) -#define ACX_FREE_QUEUES(adev, _dir_) // empty stub here, real one in merge.c -#endif +#endif /* _MERGE_H_ */ -- 1.7.8.1 |