Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Oct 2017 13:30:47 +0300
From:      "Andriy Voskoboinyk" <s3erios@gmail.com>
To:        "Farhan Khan" <khanzf@gmail.com>
Cc:        freebsd-wireless@freebsd.org
Subject:   Re: Register Address Size Mismatch
Message-ID:  <op.y7fd5mltiew4ia@thinkpad-x220>
In-Reply-To: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com>
References:  <293228d3-c777-d928-8476-ee23ba487c72@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

RF registers are using indirect addressing; you should use
rtwn_rf_write() / rtwn_rf_read() instead.


> I am working on porting over a Linux Realtek driver to FreeBSD. I ran
> into a register-size issue.
>
> FreeBSD's PCI-write function is defined as follows:
> rtwn_pci_write_4(struct rtwn_softc *sc, uint16_t addr)
>
> Notice that the second parameter is of type uint16_t.
>
> During initialization, the rtwn driver uses the rtwn_rf_prog structure
> to write a pre-defined list of data to a pre-defined list of registers.
> The structure to hold both lists is defined here:
> http://src.illumos.org/source/xref/freebsd-head/sys/dev/rtwn/if_rtwnreg.h#150.
> Notice how the second parameter 'reg' is a uint8_t.
>
> The rtwn_pci_write_4's addr is uint16_t, the rtwn_rf_prog's addr is a
> uint8_t. How would I reconcile this type mismatch? Additionally, the
> Linux version of this block of code has all register values as a
> uint32_t. It is not a matter of a cast, because some values definitely
> use more than 1 byte (ie 0xFFE).
>
> Suggestions on how to reconcile and resolve this issue?
>
> Thanks!
> Farhan Khan
> _______________________________________________
> freebsd-wireless@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
> To unsubscribe, send any mail to  
> "freebsd-wireless-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.y7fd5mltiew4ia>