Date: Thu, 12 Apr 2012 22:38:11 -0700 From: Adrian Chadd <adrian.chadd@gmail.com> To: freebsd-mips@freebsd.org Subject: [ar71xx] PCI changes from ar71xx in openwrt Message-ID: <CAJ-VmokCQW_6pPAX9JgKmgWtiqU%2B2O_Nay%2BAbTQU_vNWT0zppw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
--e89a8f234c27d128f404bd88e0b8 Content-Type: text/plain; charset=ISO-8859-1 Hi, I've noticed that the ar71xx PCI code in openwrt trunk is .. different. Specifically, the "local" config stuff isn't handled in bus/slot/func '0/0/0' - it's a different function. This patch brings it in sync: * break the local config writes into a new function, matching what Linux does; * use that when doing the "PCI work around" during PCI bus attach; * change that to a 4 byte write, rather than a 2 byte write, which again matches what Linux does; * change the pci read/write config to not treat 0/0/0 special and use "local" read/write. Any issues? Adrian --e89a8f234c27d128f404bd88e0b8 Content-Type: application/octet-stream; name="ar71xx_pci_lconf_change.diff" Content-Disposition: attachment; filename="ar71xx_pci_lconf_change.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h0yt3kh30 SW5kZXg6IGFyNzF4eF9wY2kuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBhcjcxeHhfcGNpLmMJKHJldmlzaW9u IDIzNDE1NykKKysrIGFyNzF4eF9wY2kuYwkod29ya2luZyBjb3B5KQpAQCAtMjA3LDE3ICsyMDcs MTEgQEAKIAlkcHJpbnRmKCIlczogdGFnICgleCwgJXgsICV4KSByZWcgJWQoJWQpXG4iLCBfX2Z1 bmNfXywgYnVzLCBzbG90LCAKIAkgICAgZnVuYywgcmVnLCBieXRlcyk7CiAKLQlpZiAoKGJ1cyA9 PSAwKSAmJiAoc2xvdCA9PSAwKSAmJiAoZnVuYyA9PSAwKSkgewotCQljbWQgPSBQQ0lfTENPTkZf Q01EX1JFQUQgfCAocmVnICYgfjMpOwotCQlBVEhfV1JJVEVfUkVHKE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