From owner-freebsd-mips@FreeBSD.ORG Fri Apr 13 05:38:12 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F73B106564A for ; Fri, 13 Apr 2012 05:38:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by mx1.freebsd.org (Postfix) with ESMTP id 510F88FC17 for ; Fri, 13 Apr 2012 05:38:12 +0000 (UTC) Received: by dadz14 with SMTP id z14so11297674dad.17 for ; Thu, 12 Apr 2012 22:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=IZsnloqZJr5N6GlGYGXMRgBS4s38c8wyODR95WZvmZU=; b=k0Qp2+8FHBvCUeaM9RZ9QrNkx4bwPylEd3P20h8YfvMHZGNwppUjtGx8awB0U1nixZ D3nJR/LgjbSw1l47QS26a8NmuhBDJrawuqEL2E47BtXxjPHjt8Mj+iYC8nKk9Btd1Y1t /vN94J9j4gHtuMUextI+chomut2LcNa846myuyqXmvkfEgRmL0ZEg79lS6mRBiYNXYDo 59DPTO/N4IKdA5nzMSj9IcAy13h0RiYSorM5gX9Xz9CQUIwGYNkfiFKbjvMVdek5C6v8 bODu5tpeSIb5Nq8yNldOU6TZlDdyvbwO9cmRsqKhbFe5qyc6tUhLvsACAtmtnBVAY6Y4 Q3jQ== MIME-Version: 1.0 Received: by 10.68.219.34 with SMTP id pl2mr1867871pbc.56.1334295491848; Thu, 12 Apr 2012 22:38:11 -0700 (PDT) Received: by 10.142.101.9 with HTTP; Thu, 12 Apr 2012 22:38:11 -0700 (PDT) Date: Thu, 12 Apr 2012 22:38:11 -0700 Message-ID: From: Adrian Chadd To: freebsd-mips@freebsd.org Content-Type: multipart/mixed; boundary=e89a8f234c27d128f404bd88e0b8 Subject: [ar71xx] PCI changes from ar71xx in openwrt X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2012 05:38:12 -0000 --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 Q01EX1JFQUQgfCAocmVnICYgfjMpOwotCQlBVEhfV1JJVEVfUkVHKEFSNzFYWF9QQ0lfTENPTkZf Q01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