From owner-freebsd-wireless@freebsd.org Sun Oct 1 05:21:51 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A04B5E26428 for ; Sun, 1 Oct 2017 05:21:51 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: from mail-qk0-x22d.google.com (mail-qk0-x22d.google.com [IPv6:2607:f8b0:400d:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CDAD73C90 for ; Sun, 1 Oct 2017 05:21:51 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: by mail-qk0-x22d.google.com with SMTP id c67so2136665qkg.2 for ; Sat, 30 Sep 2017 22:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=6D3326gWv4sTpt4PCQ0oOEC7JUVnESKp/J4w2+DEVIE=; b=XvcDRxhsNFyYrOqnbVXC5s68xiB/RWkTQNLa1/VTNiBuhPirrvy5+PtMIgHwhFM9/w lslkwe3DxpHsl0DJtFbLxSUi2IPIjegioCEYkKHISzI0Bu5ET+KAhwOeFQCzEi2HBMbi cbcvCAiiz6f+pgGo3/BYX1NLvXqzf7hG+W3Rtfan6lw8rTtP9/H72FR8FgvVi9PKKkpg D6TNibTU3TEbHi1lUSsOZb5baMoPUzF38QwigTUEyaMv2S2+HzNVJaXRdsMnFHe3V5lF 3up1A6Q0X+4jmHAcM5GqZg98pOO+mkw+7BRM1KmUedQC8GcbWjST0zDvpqKHDWOaFS0O enJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=6D3326gWv4sTpt4PCQ0oOEC7JUVnESKp/J4w2+DEVIE=; b=tlUZzm4eXyW3G9cV1u6D4hvns6sRxjK9lUc9T5m/Wd0ZU3Z46zgmprVBEN8fJrRjOO hV3K1iaEFJU73mbXSiJGagzaS1AM0uL0CxD4RqFOq5shg3Dw31teu20E9t0/vog5/QEh D8rb5M5LBB40bqfErGzqv7isGdlpdKm65gLgaeB6+Hp1nmqNLmDsbpQ1uP2CjVkkqLTA k7y17h1THiqIZVSJGEJchGLkdlR5GJk3gUEGtpDOEOeKoHEk2p6G4qXRLsgu+RGmELY1 biBFnX76XkzS66ekXNbnTbxydyx9hCrLO4BWRa84oS3tiH/elVuH0Po02y3MWK0lfx3j YvsQ== X-Gm-Message-State: AMCzsaUF7SiZNU6OIVUgRZ/HRnr+TiEjG8uaDZL78QQ8quDhRON9p1XM WN1oQ4l1mCrDdwAdYwFNZicflMmK X-Google-Smtp-Source: AOwi7QDu1s4XCxAIJT8QmqAgynNm+wWS5GkU5Z2HZEm4rUrrPcuXCCjuKwhGZ7zPL5sez1ubXiCXSw== X-Received: by 10.55.102.13 with SMTP id a13mr9866435qkc.320.1506835310047; Sat, 30 Sep 2017 22:21:50 -0700 (PDT) Received: from pc.farhan.codes ([2001:470:8:209:ee25:a59b:55f4:7cc]) by smtp.gmail.com with ESMTPSA id q49sm5284738qta.80.2017.09.30.22.21.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Sep 2017 22:21:49 -0700 (PDT) From: Farhan Khan To: freebsd-wireless@freebsd.org Subject: Register Address Size Mismatch Message-ID: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> Date: Sun, 1 Oct 2017 01:21:48 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 05:21:51 -0000 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 From owner-freebsd-wireless@freebsd.org Sun Oct 1 10:33:35 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39810E0F8D4 for ; Sun, 1 Oct 2017 10:33:35 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C14B8813DE for ; Sun, 1 Oct 2017 10:33:34 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: by mail-wm0-x22e.google.com with SMTP id e195so1985977wma.5 for ; Sun, 01 Oct 2017 03:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:subject:references:date:cc:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2/2gFJ1lyO3gI5NMyPXM+FoqrHXZL3vW7UAy16dRT/w=; b=CeN6waqLj6EuiFMAz4I24BU6G50OTsnOQ6DsWcJhg3M1wxKqF65TeoWk4fYunjE3FC J4S3f4EA/kDImOmt9RmUYyckv/72yIrfm671wxV4ZA+etpmGbqQCha1AoR0LW3yfkQj4 sMzo9cZ0Ir/5AHKPeUYaZjptDyy/940PdjUJbq/TnmC9K4JqRyyaugZNF/5/zTw9THOS PoiCDH6eBhNP9QogysrzetNRDYGkT5hSGjc5QrjVHtJ73S/X1O6N03gqrLwYq/7bEFtW pIUKURmmsnRnrQAEmrb+GlE4NrDuNSnRt+pf3tJqX3wf1jx4RUPOUwOYsaWqGV7eJvMz 8oMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:references:date:cc:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2/2gFJ1lyO3gI5NMyPXM+FoqrHXZL3vW7UAy16dRT/w=; b=ahc0dRFy7cw6rdCbO3z5DX3ej6vWRShHqIk5qXDFCV+15fNZB1gQ4I10h1cEz0orKy ZqRiUVoOYco96FpbSK+PbEKFlNbZduUUDd8tTBa4N3KQi2wk8MIhi+4fmG4isLo1UpG3 z+6nXTiizOJYgi4r7M2r04w6vjSLALLwC4zGYTtWhcN335rR0i5F1L71ODa1/HJV/nue /jZH0ay0nXKRn/jqrweAhFrSOGP1Z1vQj3SbGYK7wUbIxT6HIOSNpQPetgciSOuFf3Sw sJgYFoiPGXr/cECR/4AK75a6gguV6rbOI23Wyxp3WlkgSlLDfFV+n45llArgcUvrC68B vndQ== X-Gm-Message-State: AHPjjUie0gakIiHp0HMf61GZBJ/6vLR4lJUL4PMItMoSiSiPT4FUbugP iHsF8TkcQgqw7O2Oycsn5T0= X-Google-Smtp-Source: AOwi7QDQDfnXEoznyHr4ZMjmpHF0EvjS0U5bvvDynv5TwgYg6k6lld8vkxKIgq+fILh7yFHQZywQIA== X-Received: by 10.28.247.19 with SMTP id v19mr869293wmh.1.1506854012890; Sun, 01 Oct 2017 03:33:32 -0700 (PDT) Received: from thinkpad-x220 (46-133-43-27.dialup.umc.net.ua. [46.133.43.27]) by smtp.gmail.com with ESMTPSA id x75sm10630372wme.3.2017.10.01.03.33.25 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 01 Oct 2017 03:33:32 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Farhan Khan" Subject: Re: Register Address Size Mismatch References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> Date: Sun, 01 Oct 2017 13:30:47 +0300 Cc: freebsd-wireless@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> User-Agent: Opera Mail/12.15 (FreeBSD) X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 10:33:35 -0000 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" From owner-freebsd-wireless@freebsd.org Sun Oct 1 18:51:07 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6A27E2BEE6 for ; Sun, 1 Oct 2017 18:51:07 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: from mail-qt0-x22a.google.com (mail-qt0-x22a.google.com [IPv6:2607:f8b0:400d:c0d::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E3916AC2E for ; Sun, 1 Oct 2017 18:51:07 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: by mail-qt0-x22a.google.com with SMTP id s18so5011327qta.3 for ; Sun, 01 Oct 2017 11:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6fcXxcKNZSnnn9XYhJpsVgdDfvWnJvtp1QR5QsQ79BY=; b=MKH5MjQNt5a3/O3ulhAVjCCj7spCgKf3iunGUP9wvFBcTpt7CaihnsTcIjDzS0wq2/ E+N/tBp6kjTMUbimvWeio2zC808LwKCLWx9PsvxbKz8SxtinY1iKq34Ago4hkTNZ8L2L kFNN69Wr3dUe4cnzXWxgRueKX089V1kcBk9IhnmCwJ9AT+lkIvRqxxdrNm7G07ZmB3mh /xgUmVKiuhfekOQQV+vHbKBtNfeqKt4hFSHAdxpo71OCQ0G35mJi1NHaPhNq6xPlJNxH Ep/YOG99TzGDRbqX+d5PSBeFnqmyJhjaPb3igWsrJfzZKS7XL8OJ2SLeU+jWuDybWdo4 2X6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6fcXxcKNZSnnn9XYhJpsVgdDfvWnJvtp1QR5QsQ79BY=; b=QasKgJV3nvNi31z6N/nOTKc57qgnlAt0VRapxIIlz4GGpXryuzS30MWcMGz47GsyFu 5oSKu3lNZdP9Vd1X0LnDBA/7YKenjwDCc4EUja9nmB4Hfc+unHVDLD8UKyX7yVd1AB3t wSfAF4ngSGWgiSD1BEbsyn7qQ5jSEQm7FXBXKVvmqI09poHwKGAhg56zAMCfVy+sHrGM 8j9wa8a+znJqUl6oODIm3aGxqy0zXD8ZV0sz+/gvpogv10mbFkBdiB7gq6hnuqRE/LhT 6zLVcmv6y9253vEGmKXnveB6BtXOm2BlIXrLo9TrgmwCmxbWke0HwPudDXJwgmWdbEDM v4Kg== X-Gm-Message-State: AMCzsaVJ4y1SmWjEA/1in7Cdu5xhYf1sVLuQxqFzMsxgKXDyDnG5Hpke RZZC3H0OyzsHh9T7tsFngaUGuJ49 X-Google-Smtp-Source: AOwi7QDjIxSQdjj3CAcE4RTMJGGfkohxa3MFvkqc7eC0cltfJueGPuFFPwlzCuAEkJkP+vZak3k5nw== X-Received: by 10.237.34.181 with SMTP id p50mr15880261qtc.192.1506883866348; Sun, 01 Oct 2017 11:51:06 -0700 (PDT) Received: from pc.farhan.codes ([2001:470:8:209:ee25:a59b:55f4:7cc]) by smtp.gmail.com with ESMTPSA id e68sm2012265qtb.23.2017.10.01.11.51.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Oct 2017 11:51:04 -0700 (PDT) Subject: Re: Register Address Size Mismatch To: Andriy Voskoboinyk Cc: freebsd-wireless@freebsd.org References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> From: Farhan Khan Message-ID: <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> Date: Sun, 1 Oct 2017 14:51:04 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 18:51:07 -0000 The issue is in the assignment, not the write/read part. rtwn_rf_prog wants a * uint8_t list, whereas the register size from Linux is a uint32_t (but can cleanly fit into a uint16_t and might just be the default register size on Linux). How do I reconcile those two? I hope I was clearer there. The first column are the Linux registers in question: http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c#316 Thank you for your continued assistance. On 10/01/2017 06:30 AM, Andriy Voskoboinyk wrote: > 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" From owner-freebsd-wireless@freebsd.org Sun Oct 1 19:15:14 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFE65E2C4C4 for ; Sun, 1 Oct 2017 19:15:14 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C7726B5B8 for ; Sun, 1 Oct 2017 19:15:14 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: by mail-wm0-x235.google.com with SMTP id m72so7041756wmc.1 for ; Sun, 01 Oct 2017 12:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=SJPkJwZs50+j2wxB2uytz/5PjlZJnRPQh7CD4cucR/M=; b=q7QE+sLxA/1DGI6zGLeHwaY/SOwx10k3Cw+Fv4cMhbeCJ3x5Cgimb26KC6V9Z8OGkF CKAAPJcA9cAuNkeEdRfPfddjQ8jIlSsXNtRdyQ3ov/3xOD6P4/p3BOP52rUifKDZHjZf Fvzl5ERL0b1PlSTPb6MRf7UAuR2zX5uwObpUKo3a0uFys5rRCyRXf4j0YyPiBNDnWFTY ED5Cep3xd/t/C5rdMBsuznamYAW3GTxfdtrBxuLSWDUDAKE6IZkCopgJR8sqkzY7x+CM AHSWBGedKibYArxbxpxLKpck7izsebOsXqPSftSyoUi/C1F4Zz51b3EpbxEAOa0bS7BK YbYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=SJPkJwZs50+j2wxB2uytz/5PjlZJnRPQh7CD4cucR/M=; b=YYUYmD7cUD/NoIxXe59Mt08D3Y0LqgNExv0hBQICoRh8wmfgLU6NCwkTCDHqwB+f1I rhVMA4SYz3FwDEWJyl66OihfJdlBrCRT5OxI2DhYMCXDApygf8HCTY7mm5AXZHjHZryY bIGkYAr5KFz+KKXUwMem5WYB7ypbxFba/U9NiNIBQJV1wIx/kNC2o/UtYopiC98TL0yi 6Acm3BzYBvmKFIySccp8GXjOvZtEZ/fJ4RT/3tIgl0iA42WkJiULB8ZZGHmEYUx+zkjX omUDQHQnQmNW1QoT4lPz0FOur2cb9JZyrBGr26EfMjHKj5rfMG5SDEptB7JWLBaBXgiX bBlw== X-Gm-Message-State: AMCzsaW9CitaRJgcZrB5gnBpP3xucE9PjFT63eSEvDIS4oUM47fIsQ06 tQGHil0mTq7HJE8RhdBKoaE= X-Google-Smtp-Source: AOwi7QB9bimax0Mnke/BvpNObMSFEMRYOjt+bTIVCA111XLfj7JoNxXV83uPInDblbfd2O0dQ/PomA== X-Received: by 10.28.11.195 with SMTP id 186mr8006610wml.41.1506885312556; Sun, 01 Oct 2017 12:15:12 -0700 (PDT) Received: from thinkpad-x220 (46-133-43-27.dialup.umc.net.ua. [46.133.43.27]) by smtp.gmail.com with ESMTPSA id p200sm7936218wmg.48.2017.10.01.12.15.10 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 01 Oct 2017 12:15:11 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Farhan Khan" Cc: freebsd-wireless@freebsd.org Subject: Re: Register Address Size Mismatch References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> Date: Sun, 01 Oct 2017 22:12:42 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> User-Agent: Opera Mail/12.15 (FreeBSD) X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 19:15:14 -0000 Do you mean 0xFFE address? In vendor driver such 'addresses' are used for delay between writes (50 ms for RTL8812A). > The issue is in the assignment, not the write/read part. rtwn_rf_prog > wants a * uint8_t list, whereas the register size from Linux is a > uint32_t (but can cleanly fit into a uint16_t and might just be the > default register size on Linux). How do I reconcile those two? I hope I > was clearer there. > > The first column are the Linux registers in question: > http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c#316 > > Thank you for your continued assistance. > > On 10/01/2017 06:30 AM, Andriy Voskoboinyk wrote: >> 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" From owner-freebsd-wireless@freebsd.org Mon Oct 2 05:10:39 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFF22E365A7 for ; Mon, 2 Oct 2017 05:10:39 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 766F47F01A for ; Mon, 2 Oct 2017 05:10:39 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: by mail-qt0-x22b.google.com with SMTP id i13so5950463qtc.11 for ; Sun, 01 Oct 2017 22:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=rghP1uKpUpexRBqLVk+HBSfg584cO11J7ZXljmKsZOM=; b=j4joxmS+BM4e3wbARFzb1TEKG+bSY2hP7jAMa8kJMsewnHEPWEYCbt7JDo80YOEFWO OcQ2gh9ZuEXyGaDFw7MZpG9RHPA2PDTW4kdSGLqDCvfkUmTA75qquXA+xztJJYf/o/rH eTf9kggFROd80Mq4T6pjlyAt998yaddIqKRMnLGY1o5iKZjpt2Ge1tui2gXJbBgqCEj2 mfokj1765qrH/w+blogDChKlhjvjaMlJOzMqFdQLJ8WdFHaMY6ZNgMXMF7hZaz7mDF67 fLdwykvv82U7J25vjni4A8tNKkoaElfTlzZQffMiG6cifP6130oVUviM3uhpqKWsIKz5 LolQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rghP1uKpUpexRBqLVk+HBSfg584cO11J7ZXljmKsZOM=; b=M02oddGIQFjJnfVHiCnmlMmZ0ngKQXKLGc8qbbnot2Ad0+NV2DJDxzIQSPKgbfyRKq AHvYtBliFUuw3Y1FtwTVraQfrP5sUlSi7P7wHNNlsech+uQ+RRL2eDyz+ewyVM9W0Khp ENve7JpIo6KvJxQdZ0L+U5kxC2hXRNuxb/BPIQwCx7QZ00qPNDPDCm7/g6Ca7H3Zbr2U gLTGQKJr3wmguTrfnsXvfhGx8GIGww+E2ZX/+us4mYt3ikG9zQrfClTVn1JbdDIPXiuH jltBr1xYGdiydD52+9ihQwUnB5C4d8Joa36jF3GpFDIxcLCDWLEfZGGxAAoyOiQh0KjX hJAw== X-Gm-Message-State: AMCzsaUiwfqpPHvAt4lEdOICF4X01GiAReGDShurH7knlsGVj+wFMYOS 0IRWg7kOx3orbbKptgFdFu7+CChp X-Google-Smtp-Source: AOwi7QCjClmvqhzLZzha/ogU9YUUKMNdjarSA1c5oMRAiiLV5DAleViCC/bsgoPwyVBd+m6AACchtg== X-Received: by 10.237.60.101 with SMTP id u34mr16550473qte.153.1506921037989; Sun, 01 Oct 2017 22:10:37 -0700 (PDT) Received: from pc.farhan.codes ([2001:470:8:209:ee25:a59b:55f4:7cc]) by smtp.gmail.com with ESMTPSA id j205sm2072217qke.7.2017.10.01.22.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Oct 2017 22:10:36 -0700 (PDT) Subject: Re: Register Address Size Mismatch To: Andriy Voskoboinyk Cc: freebsd-wireless@freebsd.org References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> From: Farhan Khan Message-ID: <9b0976c3-ad31-0558-a3f4-0177b91fb7e6@gmail.com> Date: Mon, 2 Oct 2017 01:10:35 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2017 05:10:39 -0000 Thank you! That is in the Linux driver here: http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c#_rtl8188e_config_rf_reg As a matter of completion, is this information publicly available such as in a chipset document or something you came across from reading the driver code? I am currently essentially doing replay without fully understanding how the device works. On 10/01/2017 03:12 PM, Andriy Voskoboinyk wrote: > Do you mean 0xFFE address? In vendor driver such 'addresses' are used > for delay between writes (50 ms for RTL8812A). > >> The issue is in the assignment, not the write/read part. rtwn_rf_prog >> wants a * uint8_t list, whereas the register size from Linux is a >> uint32_t (but can cleanly fit into a uint16_t and might just be the >> default register size on Linux). How do I reconcile those two? I hope I >> was clearer there. >> >> The first column are the Linux registers in question: >> http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c#316 >> >> >> Thank you for your continued assistance. >> >> On 10/01/2017 06:30 AM, Andriy Voskoboinyk wrote: >>> 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" From owner-freebsd-wireless@freebsd.org Mon Oct 2 22:01:42 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E1B4E28950 for ; Mon, 2 Oct 2017 22:01:42 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A23B17D1E2 for ; Mon, 2 Oct 2017 22:01:41 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: by mail-wr0-x22f.google.com with SMTP id t76so4832923wrc.3 for ; Mon, 02 Oct 2017 15:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2DqmJ7Hm0vuifllII8kb8eedoIlGfrzO+ZeZB7O9SYY=; b=qnUXoXGn6KYCvquyW1kxd/mAGfTc/U4Bveq1aIXJAQPqnc5XkYuXzbZM4m8AnM4mXs L4EnHcG/WBDcjaX5dYhUK5wZQoWn0aJbn0iLMzkh5yNal6LL8Jdvk+HKDnhRffb5qv62 EmY3ZERVnLj2dzvnKGeLVkhGE7CcjK5KKw3Vt6fmPuqRkwSF7sPl8vPxhCApV+snTC0m h3Q2wB7fK4GGmudljVBdX8w5m1jfHzBVe8Qne6ojyv3PPCPESZ8FtD2j+IBxFJv94pS5 gwi21LRPlKM2/DIe38hYrmLqAZmwW3dIXs4X7CnCmSnNfkzXdQ0WN2hFY64Wsg9dBc2L gr8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2DqmJ7Hm0vuifllII8kb8eedoIlGfrzO+ZeZB7O9SYY=; b=dOXLnECPZ7jtnuiQIWKCnwoRdFb0bp24IYvJlrnpD7lKDdDne7FwAEYlSFegiAOSbv JEm9/VUm/mZ4NibgPkjslQJoxBVLDh+8/7Lmvm89PlElmSyuScux5VRpunng/FIiOcWc 8eRURwm9BPmtoPuW6dzKqc58e9H7bw56SArycGuoS9TFy5O3GvyhZZNELKqfWOdMHH0Z Fo2QBBT0oDL4Vxlt9b6oyymYOmKvqJWJYoYPQjel0enc4V71M6iRLqU1Ri0UCI03vqKP lk0iLvKqUjNJVa5Ax6boM7c5zbza9+rjiIdIuXQgYj7PmchXhPS4zpdv0G+k/j7IbNRx tHYA== X-Gm-Message-State: AHPjjUi4DP55z3G3YmhcLm9dyKfkembgVk/0vJvsMdhpRW6HzRuhfla4 YmGAXLk08vr60IKmuD/ma8g= X-Google-Smtp-Source: AOwi7QC+lB6emEQTS55tRSpzJKX3a8mMKh/XKQ8UBDHLVg0NMXAghnTSVzPwe+JfeKAXPAlUS1eejA== X-Received: by 10.223.198.82 with SMTP id u18mr16767961wrg.5.1506981699933; Mon, 02 Oct 2017 15:01:39 -0700 (PDT) Received: from localhost (46-133-157-150.dialup.umc.net.ua. [46.133.157.150]) by smtp.gmail.com with ESMTPSA id p78sm21343866wma.11.2017.10.02.15.01.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Oct 2017 15:01:39 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Farhan Khan" Cc: freebsd-wireless@freebsd.org Subject: Re: Register Address Size Mismatch References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> <9b0976c3-ad31-0558-a3f4-0177b91fb7e6@gmail.com> Date: Tue, 03 Oct 2017 00:59:06 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <9b0976c3-ad31-0558-a3f4-0177b91fb7e6@gmail.com> User-Agent: Opera Mail/12.15 (FreeBSD) X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2017 22:01:42 -0000 I have not seen any (except generic chipset description) documents in public (only references to them in the driver); most of information was retrieved by reading vendor driver code / experimenting with devices. > Thank you! That is in the Linux driver here: > http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c#_rtl8188e_config_rf_reg > > As a matter of completion, is this information publicly available such > as in a chipset document or something you came across from reading the > driver code? I am currently essentially doing replay without fully > understanding how the device works. > > On 10/01/2017 03:12 PM, Andriy Voskoboinyk wrote: >> Do you mean 0xFFE address? In vendor driver such 'addresses' are used >> for delay between writes (50 ms for RTL8812A). >> >>> The issue is in the assignment, not the write/read part. rtwn_rf_prog >>> wants a * uint8_t list, whereas the register size from Linux is a >>> uint32_t (but can cleanly fit into a uint16_t and might just be the >>> default register size on Linux). How do I reconcile those two? I hope I >>> was clearer there. >>> >>> The first column are the Linux registers in question: >>> http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c#316 >>> >>> >>> Thank you for your continued assistance. >>> >>> On 10/01/2017 06:30 AM, Andriy Voskoboinyk wrote: >>>> 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"