Vengineerの戯言

人生は短いけど、長いです。人生を楽しみましょう!

Apple M1 (Mac mini) の PCIe 関連の更新

@Vengineerの戯言 : Twitter
SystemVerilogの世界へようこそすべては、SystemC v0.9公開から始まった 

はじめに

Apple M1 の PCIe に関しては、このブログで過去3回、アップしています。

vengineer.hatenablog.com

vengineer.hatenablog.com

vengineer.hatenablog.com

NetBSD への移植

Apple M1機(Mac mini) への NetBSD の移植が進んでいるようです。下記のツイートに NetBSDのブート時の PCIe 関連のログがアップされました。

記録のため(このツイートが無くなっても困らないように)、画像を引用します。

f:id:Vengineer:20210313094230p:plain

ブートログの内容

上記の画像からブートログの書き出してみました。

applepcie0 at simplebus1: Apple PCIe host controller
applepcie0: MMIO (64bit prefetchable): 0x6_a000_0000+0x2000_0000@0x6_a000_0000
applepcie0: MMIO (32bit non-prefetchable): 0xc000000+0x40000000@0x6_c000_0000
pci0: at applepcie0 bus 0
pci0: memory spacce enabled, rd/line, rd/mult, wr/inv ok
ppb0: at pci0 dev0 function 0: vendor 106b product 180cc (rev. 0x01)
ppb0: PCI Express capability version 2<Root Port of PCI-E Root Complex> x1 @ 16.0GT/s
ppb0: link is x1 @ 2.5GT/s
pci1 at ppb0 bus 1
pci1: memory space enabled, rd/line, wr/inv ok
vendor 14e4 product 4425 (miscellaneous network, revision 0x3) at pci1 dev 0 function not con….
vendor 14e4 product 5f69 (miscellaneous network, revision 0x3) at pci1 dev 1 function not con….
ppb1 at pci0 dev 1 function 0:vendorr 106b product 100c (rev. 0x01)
ppb1: PCI Express capability version 2 <Root Port of PCI-E Root Complex> x1 @ 16.0GT/s
ppb1: link is x1 @ 2.5GT/s
pci2 at ppb1 bus 2
pci2: memory space enabled, rd/line, wr/inv ok
xhci0; at pci2 dev 0 function 0: vendor 1b73 product 1100 (rev. 0x10)
xhci0: 64-bit DMA
xhci0: autoconfiguration error: ccan’t allocate handler
ppb2: at pci0 dev 2 function 0: vendoer 106bb product 100c (rev. 0x01)
ppb2: PCI Express capability version 2 <Root Port of PCI-E Root Complex> x1 @ 16.0GT/s
ppb2: link is x1 @ 2.5GT/s
pci3 at ppb2 bus 3
pci3: memory spae enabled, rd/line, wr/inv ok
vendor 14e4 product 1682 (ethernet network) at pci3 dev0 funtion 0 not configured
/socc/pcie_dart0@6_8100_0000 at simplebus1 not configured
/socc/pcie_dart1@6_8200_0000 at simplebus1 not configured
/socc/pcie_dart2@6_8300_0000 at simplebus1 not configured

ブートログの整理

PCI Controllerのアドレスの部分は、Linuxdtbpcie: pcie@690000000 の部分に相当し、

           reg = <0x6 0x90000000 0x0 0x1000000                                                                 /* config */
                   0x6 0x80000000 0x0 0x100000  0x6 0x8c000000 0x0 0x100000                                     /* core and AXI bridge */
                   0x6 0x81000000 0x0 0x20000   0x6 0x82000000 0x0 0x20000   0x6 0x83000000 0x0 0x20000>;       /* ports */

の内、
core and AXI bridges の部分が MMIO の2つに対応している (アドレスは違う)
ports は、pcie_dart0/1/2 に対応(アドレスも同じ)

Device Tree をまとめてみると、下記のようになっています。

simplebus1
  applepcie0 : Apple PCIe host controller
     pci0 : applepci0 bus 
       ppb0: at pci0 dev0 function 0: vendor 106b product 100c (rev. 0x01)
       ppb0: Root Port of PCIE-Root Complex (Gen4 x1)
         pci1 at ppb0 bus 1 (Gen1, Wifi + BLE)
       ppb1: at pci0 dev1 function 0:vendor 106b product 100c (rev. 0x01)
       ppb1: Root Port of PCIE-Root Complex (Gen4 x1)
         pci2 at ppb0 bus 2 (Gen1, xhc0 => USB 3.0 Host)
       ppb2: Root Port of PCIE-Root Complex (Gen4 x1)
       ppb2: at pci0 dev 2 function 0: vendor 106b product 100c (rev. 0x01)
         pci3 at ppb2 bus 3 (Gen1, GbE)

この結果、各ポートには、次のようなデバイスが繋がっているのがわかります。

  • PCIe-0 : Wifi + BLE
  • PCIe-1 : USB 3.0 Host
  • PCIe-2 : GbE

結果として、次のような構成になっています。

f:id:Vengineer:20210313094837p:plain

終わりに

これで Apple M1 機の PCIe Controller がどんな感じになっていて、何が繋がっているが分かりました。