Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2015 09:28:41 +0000
From:      "jpa-semihalf.com (Jakub Palider)" <phabric-noreply@FreeBSD.org>
To:        freebsd-arm@freebsd.org
Subject:   [Differential] [Request, 1, 557 lines] D2579: PCI support for Alpine platform from Annapurna Labs
Message-ID:  <differential-rev-PHID-DREV-y2vdtziki6lwmyrnc5ux-req@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

--b1_5b195ef0c6e36ed87c42d297273477fd
Content-Type: text/plain; charset = "utf-8"
Content-Transfer-Encoding: 8bit

jpa-semihalf.com created this revision.
jpa-semihalf.com added reviewers: andrew, ian, imp.
jpa-semihalf.com added a subscriber: freebsd-arm.

REVISION SUMMARY
  This is a continuation of https://reviews.freebsd.org/D2340 and follows Andrew's suggestion to extract code related to PCI support into a separate review. This is an intermediate step between the first commit and adding MSIx support (including transition towards Linux dts).

REVISION DETAIL
  https://reviews.freebsd.org/D2579

AFFECTED FILES
  sys/arm/annapurna/alpine/alpine_pci.c
  sys/arm/annapurna/alpine/alpine_pci.h
  sys/arm/annapurna/alpine/files.alpine
  sys/arm/conf/ALPINE

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: jpa-semihalf.com, andrew, ian, imp
Cc: freebsd-arm

--b1_5b195ef0c6e36ed87c42d297273477fd
Content-Type: text/x-patch; charset=utf-8; name="D2579.5470.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="D2579.5470.patch"

ZGlmZiAtLWdpdCBhL3N5cy9hcm0vY29uZi9BTFBJTkUgYi9zeXMvYXJtL2NvbmYvQUxQSU5FCi0t
LSBhL3N5cy9hcm0vY29uZi9BTFBJTkUKKysrIGIvc3lzL2FybS9jb25mL0FMUElORQpAQCAtNjMs
OCArNjMsMTMgQEAKICMgU2VyaWFsIHBvcnRzCiBkZXZpY2UJCXVhcnQKIAorI1BDSS9QQ0lFCitk
ZXZpY2UJCXBjaQorCiAjIEV0aGVybmV0CiBkZXZ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Zp
Y2VfcHJpbnRmKHBjaWIsICJjb3VsZCBub3Qgcm91dGUgcGluICVkIGZvciBkZXZpY2UgJWQuJWRc
biIsCisJICAgIHBpbiwgcGNpX2dldF9zbG90KGRldiksIHBjaV9nZXRfZnVuY3Rpb24oZGV2KSk7
CisJcmV0dXJuIChQQ0lfSU5WQUxJRF9JUlEpOworfQorCgo=


--b1_5b195ef0c6e36ed87c42d297273477fd--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?differential-rev-PHID-DREV-y2vdtziki6lwmyrnc5ux-req>