Chialun
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: IPMI tags: IPMI, BMC --- [toc] # **Regarding IPMI and BMC** ## **名詞解釋** - IPMB:Intelligent Platform Management Bus,以i2c為基礎的一個Bus,用來管理BMC和其週邊的裝置 - ICMB:Intelligent Chassis Management Bus,提供一個標準介面來管理機箱的設備,例如PSU、FAN、LET - SEL:system event log,存放在非揮發性的儲存裝置中,IPMI也可透過IPMB將event message加到SEL - FRU:Field Replaced Unit,存放serial number、產品編號、型號和庫存編號 - IPMI messages:使用訊息為基礎的方式讓不同的subsystem例如IPMB、LAN、ICMB可以連接到BMC, 可將它分為request和response 兩個protocol,request就是我們常用的IPMI command,由Network Function 、command和data欄位組成,而response則額外加上了completion code欄位 - SDR:sensor data record,紀錄sensor的值 - SOL:serial over LAN,一種通過網路連接到遠端伺服器的控制台技術,通過SOL,Admin可以透過網路訪問服務器就像直接連接到server一樣 - KVM:keyboard video mouse,一種遠端管理技術,讓我們可以透過網路連接到遠端server的圖形控制台 - RPC:Remote Procedure Call - SNMP:Simple Network Management Protocol - DMI:Desktop Management Interface由Desktop Management Task Force (DMTF) 所草擬 DMI-MI(Management Interface) DMI-CI(Component Interface) DMI SERVICE PROVIDER 透過 Component Interface(CI) 取得作業系統和相關軟硬體的資訊並且將這些資訊存在MIF DB (Management Information Format 資料庫)這些MIF DB中的資料都具備標準格式所以不同的管理軟體都可以透過Management Interface來取得MIF DB中的資料 - System Event Log (SEL) and Event Messages:BMC提供系統事件紀錄,並存放在非揮發性的儲存裝置確保系統發生錯誤時SEL仍是可用的。 而Event Message是用來將event加入SEL的,且Event Message可以透過IPMB的方式傳送到BMC,我們將產生event message並透過IPMB送到其他控制器的控制器稱為IPMB event generator,接收event的則稱為IPMB event receiver,BMC就是一個典型的event receiver。 管理控制器需要知道sensor type和event type才可以將資訊放入event message,這通常會寫再控制器firmware裡面,但IPMI也可以透過command將sensor和event type於控制器初始階段時寫入,或讀取這些資訊 - AMBA(Advanced Microcontroller Bus Architecture)是由ARM(Advanced RISC Machines)公司提出的一種開放的、可延伸的處理器系統互連架構。AMBA提供了一系列標準的匯流排規範, 旨在連接處理器核心、記憶體、週邊設備和其他IP核心,以構建高效、靈活且易於整合的SoC(System on Chip)設計。 ``` AMBA的主要匯流排規範包括: AHB(Advanced High-performance Bus):高性能匯流排,用於連接處理器核心、高速外設和記憶體等主要元件,提供高頻寬和低延遲的通信。 APB(Advanced Peripheral Bus):低功耗匯流排,用於連接處理器和低頻週邊設備,提供簡單且低功耗的通信。 AXI(Advanced eXtensible Interface):高度可擴展的匯流排,用於連接處理器、高速週邊設備和其他IP核心,支援高性能和高頻寬的通信。 ACE(AXI Coherency Extension):擴展了AXI匯流排,提供一致性(coherency)支援,用於連接多個處理器和高速記憶體控制器。 AMBA架構被廣泛應用於ARM架構的SoC設計中,是許多現代處理器和嵌入式系統的主要互連架構,它的主要目標是促進SoC設計的標準化和可重用性。透過AMBA的標準規範,不同供應商的處理器核心、IP核心和週邊設備可以更容易地相互連接和整合,從而加快系統開發時間,提高設計的彈性和效率。 ``` - APB(Advanced Peripheral Bus)縮寫為APB bus,是一種在ARM架構的系統中用於連接外設的簡單、低速串行匯流排。APB bus是ARM處理器與外部週邊設備之間的通信通道。 在ARM處理器的SoC(System on Chip)中,通常會有多個外設,例如UART(通用非同步收發傳輸器)、SPI(串列外設接口)、I2C(I²C)等。這些外設需要與處理器進行通信,以進行數據的傳輸和控制。 APB bus的特點是簡單、低速和節能。它通常用於連接低頻的週邊設備,並且其設計主要考慮了功耗和面積的優化。APB bus的速度相對較低,適用於不需要高頻寬的外設,因此不適用於高速的數據傳輸。 在ARM架構中,還有其他高速串行匯流排,例如AHB(Advanced High-performance Bus)和AXI(Advanced eXtensible Interface),它們更適合高速數據傳輸和高性能需求的設備。這些匯流排在SoC中按需使用,以滿足不同外設的連接要求。 - MBus(Microcontroller Bus)是一種用於低功耗微控制器和嵌入式系統中的串行匯流排。MBus的設計目標是在低功耗和高效能的條件下,連接微控制器和其它週邊設備,提供高度節能和適合嵌入式應用的通信解決方案。 MBus主要用於微控制器的通信,包括了傳感器、記憶體、時鐘、控制器等外設裝置。由於在嵌入式系統中,功耗和效能通常是首要考慮的因素,MBus在設計時將這些需求納入考量,因此通常會有以下特點: 低功耗:MBus設計為低功耗通信,避免了高功率消耗,因此非常適合嵌入式系統,尤其是運行於電池供電的應用。 簡單和輕量:MBus的協定相對簡單,不需要複雜的控制和驅動電路,這有助於減少外設的成本和面積。 高效率:MBus的通信協定設計為高效率,能夠在短時間內完成數據的傳輸,這對於低延遲和快速回應的應用很重要。 靈活性:MBus支援多種不同的通信模式,包括點對點(Point-to-Point)、多主控制器(Multi-Master)、多從設備(Multi-Slave)等,這使得它適用於各種不同的應用場景。 MBus通常用於輕量、低功耗、嵌入式的應用,例如智慧穿戴裝置、嵌入式感測系統、物聯網(IoT)設備等。它提供了一個有效且可靠的通信解決方案,使得這些應用能夠在有限的資源下實現高效的數據傳輸和控制。 - AXI(Advanced eXtensible Interface)是ARM架構中高性能、高頻寬的串行匯流排,被廣泛用於連接處理器、記憶體、高速週邊設備和其他IP核心的系統互連。AXI bus提供了一個高效的通信通道,支援高度並行處理,使得多個主控制器可以同時訪問共享資源,大大提高了系統的整體性能。 AXI bus的主要特點如下: 1. 高性能:AXI bus設計用於支援高頻率和高性能的處理器和週邊設備,它提供了快速的數據傳輸和低延遲的通信,有助於實現高效的數據處理和高性能計算。 2. 高頻寬:AXI bus具有寬闊的資料通道,能夠同時傳輸多個數據位元,提供了更高的數據傳輸速率和頻寬,適合連接高速的記憶體和高速週邊設備。 3. 多主控制:AXI bus支援多個主控制器,這意味著多個裝置可以同時訪問共享的資源,提高了系統的並行處理能力。 支援Out-of-Order Transaction:AXI bus支援無序事務處理,這使得主控制器可以以無序方式發送和處理數據事務,從而提高了系統的吞吐量。 4. 支援節能功能:AXI bus支援節能功能,例如能夠在空閒時自動進入節能模式,降低功耗。 AXI bus通常用於高性能的處理器、高速記憶體控制器、高速DMA(Direct Memory Access)控制器和其他需要高頻寬和高效率通信的IP核心之間的連接。在ARM架構中,AXI bus是目前最常用的高性能匯流排,特別適用於複雜的SoC(System on Chip)設計,可以有效地處理高速數據傳輸和高度並行的要求。 - multi function pin(GPIO):查2400 data sheet(page 448為address),multi function pin(page 108) >[!Note] IPMI SPEC 重要chapter 1、2、5、9、31、36 ``` 42.2 Sensor Type Codes and data 定義SEL的sensor Type page 529 Table 42 Event/Reading Type Code Ranges 定義SEL的event type ipmi_msghandler:傳入和傳出訊息處理程序 (incoming and outgoing message handler) ipmi_devintf:IPMI driver的字符設備介面 (character device interface to IPMI driver) 對於2.4.x和早期2.6.x kernel,您需要根據硬體支持的系統介面類型選擇module。例如: ipmi_kcs_drv:Keyboard Controller Style (鍵盤控制器樣式) driver 最新的2.6.x kernel已將這些整併到一個module中: ipmi_si:通用的IPMI系統介面driver ``` - BMC Message Bridging用於橋接兩個media的通訊,只用於傳遞不同channel的訊息,不用於傳遞同channel的訊息 SMS : System Management Software SMS_ATN page 64,81~86,89, 91~95, 108 ## **KCS** source code在kcs_hw package 系統默認分配給KCS的port 是CA2h,使用IO空間,對應ast2500的KCS通道3 channel : CA0 channe2 : CA8 channe3 : CA2 KCS的暫存器是在BMC裡implement的,一共四個register,每個register占1byte, 系統側通過IO訪問這四個register來達到操作KCS的目的。 當系統端向BMC發送KCS請求時,IBF會被設置1,觸發BMC的KCS中斷,BMC在KCS中斷後讀取status register,判斷現在的狀態然後設定S1和S0,KCS的接收和發送都是透過中斷完成的,系統向BMC寫資料稱KCS write,BMC向系統寫data稱KCS read 第九章:(以System management software視角, 可視為BIOS) 四種resigister: Status(Read only) Command(Write only) Data-In(Write only) Data-Out(Read only) 當BIOS想要從BMC讀取資料時,會在Command and Data-In寫入Command想讀取的資料。同時Status的ibf bit設為1(推測是KCS driver作用)。若BIOS想繼續對Command和Data-In寫資料。須等ibf bit被clear(=0)此動作根據spec需有等待時間。建議五秒以上。BMC會將要給BIOS的資料寫到Data-Out register。之後會將status的obf bit設1。當BIOS確認obf bit為1後,再去讀取。同樣BIOS確認obf bit也建議等到五秒以上。 command相關,請參考page 612 - SetUserName ``` ipmitool user set name [user ID] [user name] ex: ipmitool user set name 3 Allen The corresponding IPMI command formats in “intel _ipmitool” are: SetUserName ipmitool 0x20 0x18 0x45 5 0x64 0x61 0x64 0x00-zero padded to 16 =>ipmitool raw 0x45 5 0x64 0x61 0x64 0x00 BMCaddr/NetfunLun/cmd/ID/name ``` - Get message command ``` ipmitool 0x20 0x18 0x33 => ipmitool raw 0x33 For example [IPMItool in Linux] Hint: hover over Place your mouse over the highlighted area in below for Response Data description $ ipmitool raw 0x06 0x35 80Byte 1 Completion Code 80h = data not available (queue / buffer empty) ``` Test Procedure: 1. Enable Event Message reception into Event Message Buffer by "Set BMC Global Enables Command" $ ipmitool raw 0x06 0x2e 0x04 2. Produce a SEL log $ ipmitool event 1 3. Read Event Message Buffer $ ipmitool raw 0x06 0x35 32 4f 02 a6 b3 ff 4e 20 00 04 04 b0 01 50 00 010 4. Disable Event Message reception into Event Message Buffer $ ipmitool raw 0x06 0x2e 0x04 5. Read Event Message Buffer, where response 80h = data not available (queue / buffer empty) $ ipmitool raw 0x06 0x35 80 ``` ipmitool -Uadmin -Padmin -H127.0.0.1 raw 0x06 0x35 -vvv -vvv 啟動偵錯 或-vvvvv (v愈多愈詳細) ``` 一種稍微複雜的通信模式就是使用IPMB、大家所謂的橋接命令(Bridged Command)。 例: ``` ipmitool -m 0x94 -t 0x9a raw 6 4 55 00 或者 ipmitool -m 0x94 -t 0x9a mc selftest Selftest: passed ``` 這仍然從netfn 6(應用程序)向目標target發送相同的命令4(selftest)。 但是,為此,命令(由驅動程序)封裝,並使用command 0x34(發送message)從netfn 6(應用程序)發送到KCS。然後,驅動程序輪詢(poll) KCS,直到收到message,然後驅動程序使用命令0x33(獲得message)。驅動程序還追踪message並確保響應與請求匹配。然後它解封message並將響應返回給應用程序。 >[!Note] KCS Source code user space : libipmikcs > KCSIfc.c kernel space : Kcs_hw > ast_kcs.c > kcs module > KCSmain.c ## **SDR Code** SDR.c 的GetSDRRepositoryInfo() > SDR_ReserveSDRRepository() > ReserveSDRRepository() > PreCheckSDRUpdateModeCmd() > GetSDRRec() > SDR_GetNextSDRId() > GetSDRRec() > GetSDR() > PreCheckSDRUpdateModeCmd() > SDR_GetSDRRec() SDR 透過g_BMCInfo 取得各sensor data e.g.: UnableRead = pBMCInfo->SensorSharedMem.SensorInfo[CL_Sensor_Info[index].Sensor_Number].EventFlags & BIT5; CL_Sensor_Info[index].Reading = pBMCInfo->SensorSharedMem.SensorInfo[CL_Sensor_Info[index].Sensor_Number].SensorReading; SDR欄位定義參考ipmi SPEC(page 554或552)43.2 SDR Type 02h Compact Sensor Record 的Table43 Compact Sensor Record - SDR Type base unit為單位可參考Table 43-15或43.17章節, Sensor Unit Type Codes(溫度為1,電壓為4,風扇轉速為18) sensor number只是編號,不重複即可(通常none connection sensor 需和PDKSensor.c所定義相同,) 新增sensor SDR檔案副檔名為pmc,路徑libipmipar_ast2400 AVIN = ADC ADC需查ast2400V13 公式和ipmi公式(page 509 , 36.35章節Sensor Reading Conversion Formula) Y=(MX+(B*10^K1))*10^k2 Sensor Number為自定義,各sensor不能重複定義 ipmi second gen interface spec > page:613 有最基本的RAW caommand B Exp = K1 = 指數 (需用2的補數表示) R Exp = K2 = 小數 (需用2的補數表示) I2c = slave address 必填(電路圖位址通常需*2) Temp 填UNR、 UC、 UNC、 LEN、 LC、 LNC、| K1 K2 B通常為0不需調整 M為1 ,Analog Data Format設定為2sComplement(2的補數) (M、B、K1、K2在其他地方須根據情況做調整例如小數點,B和K1通常都為0,小數點用K2控制需用2的補數表示如-2則為E) sensor取得的值可能大於1 byte,所以會除以一個常數值(向右shift N位),用略微的數值失真換取可處理的值,之後再透過 B M K1 K2補償回來 (例如FAN轉數1789轉存放在兩byte的data裡,可以將它除100約shift兩位變成1byte的值,我們才可以再pread_buf處理,因為pread_buf只能放1byte) SEEPROM 填slave address PMBUS需填slave address和write/read slaveaddr(如果電路圖沒提供,slave address可用i2c-test -b 2 --scan掃看看) AVIN的電壓須改Constant multipiler(M)=1 ,B=0,K1=0,K2=0xd (表示到小數點第3位) AVIN的UNR、UC....需參考分壓公式計算 最後generate configuration output, generate SDR records, generate sensor monitoring code Settable Readable Threshold: 設定哪些threshold可讀或可寫(page:551) assertion mask:設定當來到門檻是否發event(章節SDR type 01h full sensor record) deassertion mask:設定當來到門檻是否發解除event FAN 的UNR、 UC、 UNC、 LEN、 LC、 LNC 透過取最大公因數設為M來調整通常為105或120(值太大可再用最大公因數在跟最小的數值再做一次輾轉相除法),商為各threshold值,Rate Unit為PerMinute ,tolerence和accuracy都為0x0 analog data format的溫度是二的補數 ddf的code 必須是4個空白加1個TAB鍵做開頭,包含空白行也是 Gen config>gen sdr> gen sensor monitor code >gen simulate.... *.dat ,FRU.bin, IPMI.conf會放在系統的conf/BMC1/ ## **IPMI Command** - 取得網路資訊(檢查MAC、是否有拿到IP、IP來源是否為DHCP、確認有gateway IP) ``` ipmitool lan print 1 ``` - 開啟dhcp,其中的channel為1 -H為host端ip ( ipmitool channel 第1個網路port為1 第2個網路port為8 ) ``` ipmitool -Uadmin -Padmin -H127.0.0.1 lan set 1 ipsrc dhcp ``` - 取得Sensor狀態 ``` ipmitool -Uadmin -Padmin -H127.0.0.1 sensor ``` - system event log ``` ipmitool -Uadmin -Padmin -H192.168.5.100 sel ipmitool -Uadmin -Padmin -H127.0.0.1 sel elist ``` - system event log,檢查Sensor 發門檻的event是否生效 ``` ipmitool -Uadmin -Padmin -H192.168.5.100 sel list ``` - 根據id 去Get sensor event log詳細資訊 ``` ipmitool -Uadmin -Padmin -H127.0.0.1 sel get 0x46 System_Temp1 | 0Eh | ok | 7.1 | 31 degrees C System_Temp2 | 0Fh | ok | 7.1 | 35 degrees C P12V_SEN | 01h | ok | 7.1 | 11.86 Volts P5V_SEN | 02h | ok | 7.1 | 4.99 Volts ``` - i2c test tool ``` 檢查bus number 0的slave list的位址是否正確 i2c-test -b 0 --scan i2c slave address要除2所以b0為59 ,0x79 為PMbus Command,透過這command可取得pmbus的值 i2c-test -b 2 -s 0x59 -rc 2 -d 0x79 i2c-test --scan Done! Found 4 valid slave address(es) Slave list: 0xa0 0xa2 0xb0 0xb2 掃第3個block,假設CPU Temp接再第三個block i2c-test --scan -b 3 Done! Found 3 valid slave address(es) Slave list: 0x00 0x54 0xa0 PMBUS 的STATUS_WORD 須看SPEC par II的page 91 i2c-test -b 0 -s 0x58 -rc 2 -d 0x79 #79就是的STATUS_WORD i2c_dev = /dev/i2c0 Bytes read: 2 02 00 Bytes written: 1 79 斷電時return為 4b 28 #4b是low byte ,28是high byte i2cdetect -r -y 5 #列出 Bus 5上的所有Device 標示為 UU 的代表該設備有被 偵測到並正在被 kernel driver 使用著 i2cdump -y 4 0x56 #取得 i2c-4 上的 0x56 資訊 ``` >[!Note] PMbus可以在pmbus的ddf看他下了甚麼PMBUS command 0x79; /* STATUS_WORD */ 0x7e; /* STATUS_CML */ 0x7f; /* STATUS_OTHER */ 0x7b; /* STATUS_IOUT */ 0x7c; /* STATUS_INPUT */ 0x7d; /* STATUS_TEMPERATURE */ 0x81; /* STATUS_FANS_1_2 */ 0x82; /* STATUS_FANS_3_4 */ 0x03; /* CLEAR_FAULTS */ 讀回來的值順序為LOW Byte , High Byte(負值<1開頭>透過取2補數轉轉十進位並加負號,正值不須取2補數) - sensor data record ``` ipmitool -Uadmin -Padmin -H192.168.5.100 sdr type ``` - command help ``` ipmitool -Uadmin -Padmin -H127.0.0.1 sdr help ``` - 取得watchdog資訊 ``` ipmitool -I lanplus -Uadmin -P admin -H 192.168.0.100 mc watchdog get ``` - 取得chassis資訊 ``` ipmitool -I lanplus -Uadmin -P admin -H 192.168.0.100 chassis ipmitool -I lanplus -Uadmin -P admin -H 192.168.0.100 chassis status ``` - hardware monitor start scan ``` ipmitool -Uadmin -Padmin -H127.0.0.1 raw 0x2e 0x06 1 ``` - hardware monitor stop scan ``` ipmitool -Uadmin -Padmin -H127.0.0.1 raw 0x2e 0x06 0 ``` - show detail ``` ipmitool -Uadmin -Padmin -H127.0.0.1 sdr get "CPU0 VCCIO" ipmitool -Uadmin -Padmin -H127.0.0.1 sensor ``` - SOL功能驗證 ``` 需要先進WEB改密碼(maybe) ipmitool -I lanplus -Uadmin -P Ladmin -H 192.168.0.100 sol info ipmitool -I lanplus -Uadmin -P Ladmin -H 192.168.0.100 sol set non-volatile-bit-rate 115.2 ipmitool -I lanplus -Uadmin -P Ladmin -H 192.168.0.100 sol activate ``` - GPIO tool ``` Base Address of GPIO = 0x1E78:0000 查ipmipdk_dev/XXXGPIOMap.h 的pin define(GPIO_D6 為30) gpiotool 30 --get-dir #input/output gpiotool 30 --get-data #high/low ``` - PECI peciapp 0x30 -g 讀CPU溫度 Human readable temperature w.r.t Tcc : -71 Celsius 讀到的溫度 - TJMAX = 現實溫度 (TJmax要看CPU spec通常可能是-100或110) Tjmax讀取方式 ``` if(!bTjmax_init) { phal->read_len = 5; phal->write_len = 5; phal->pwrite_buf[0]= 0xA1; phal->pwrite_buf[1]= 0; phal->pwrite_buf[2]= 16; phal->pwrite_buf[3]= 0; phal->pwrite_buf[4]= 0; peci_cmd_writeread(phal); if(phal->pread_buf[0] == 0x40) { Tjmax = phal->pread_buf[3]; bTjmax_init = TRUE; } } ``` - 透過command改multi function pin (Register : 0x1e6e:2000) ``` 先對SCU00 寫入0x1688a8a8來解鎖multi funcion pin修改功能 devmem 0x1e6e2000 32 0x1688a8a8 GPIO register 1e78:0000 讀GPIO的GPIOAB devmem 0x1e7801e0 透過register將GPIOAB2 AB3 data設成low devmem 0x1e7801e0 32 0x0208a0f9 PWM register 1e78:6000 (風扇) Duty Control 0 Register devmem 0x1e786008 Duty Control 1 Register devmem 0x1e78600C Duty Control 2 Register devmem 0x1e786048 Duty Control 3 Register devmem 0x1e78604C //set clock division and period of type M/N //0xFF11 --> 24000000 / (2 * 2 * 256) = 23437.5 Hz iowrite32(0xFF11FF11, (void * __iomem)AST_PWM_FAN_BASE+0x04); ``` - disable GPIOE0 pass through //需要disable Power/reset/UID button時會用到 ``` #unlock SCU devmem 0x1e6e2000 32 0x1688a8a8 devmem 0x1e6e208C 32 0x00000000 #原始值為0x00802000 #Lock SCU protection key devmem 0x1e6e2000 32 0x00000000 ``` - create default user ``` ipmitool user list 1 ipmitool user set name 2 admin ipmitool user set password 2 admin ipmitool user enable 2 ipmitool user priv 2 4 1 ipmitool channel setaccess 1 2 callin=on ipmi=on link=on privilege=4 ``` - set MAC ``` 開機壓ESC進入Uboot setenv ethaddr +(MAC 位址) #可設定MAC print 檢查設定 saveenv 儲存設定 reset 重啟 ifconfig eth0 172.31.31.31 設定IP 設定動態取得 ip # ipmitool lan set 1 ipsrc dhcp 設定靜態ip # ipmitool lan set 1 ipsrc static # ipmitool lan set 1 ipaddr 192.168.0.xxx # ipmitool lan set 1 netmask 255.255.255.0 # ipmitool lan set 1 defgw ipaddr 192.168.0.1 # ipmitool lan set 1 access on # ipmitool lan print 1 ``` - PMBUS pmbus psu status check ``` ~ # i2c-test -b 0 -s 0x58 -rc 1 -d 0x19 i2c_dev = /dev/i2c0 Bytes read: 1 90 0x19 is pmbus CAPABILITY retrun bit 7 is 1 means "Packet Error Checking is supported" ``` ``` ~ # i2c-test -b 0 -s 0x58 -rc 3 -d 0x79 i2c_dev = /dev/i2c0 Bytes read: 3 00 00 d4 Bytes written: 1 79 0x79 is pmbus STATUS_WORD retrun 順序是low byte優先 ``` - System power up 產生SEL ``` ipmitool raw 0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00 0x04 0x1d 0x00 0x6f 0x00 0x00 0x00 ``` - System hard reset 產生SEL ``` ipmitool raw 0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00 0x04 0x1d 0x00 0x6f 0x01 0x00 0x00 ``` - System warm reset 產生SEL ``` ipmitool raw 0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00 0x04 0x1d 0x00 0x6f 0x02 0x00 0x00 ``` - 未整理 ``` ipmitool -I lanplus -Uadmin -P admin -H 192.168.0.100 raw 0x36 1 0 ``` ## **雜記** - 製作開機隨身碟透過Rufus firmware reset透過x86 console 重燒 cd SOCFLA~1 socflash -s FNCB55~2.IMA 抓不到隨身碟就power off power on 進bios更改boot開機選項將USB裝置設到第一個 - NCSI(network controller sideband interface)為共享網孔,通常由一個管理控制器(Management Controller, MC)和多個網路控制器(Network Controller, NC)組成, (x86和bmc共用,通常ast2500會使用I210 chip(in ecb4025 product)) 另一種為非共用RGMII(通常使用Realtek RTL8211C/D/DN/E/F chip) - intel cpu 溫度透過PECI protocol取得 - ADC input 分壓公式 參考ast2400 data sheet 的26.4.2 Voltage Sense Method 章節 (或ast2500 Voltage Sense Method 章節) - M k1 k2 B計算 36.3 Sensor Reading Conversion Formula - 門檻狀態 ok:溫度正常 nc: non-critical,溫度偏高(或者偏低),但是並不太嚴重 cr:critical,温度太高或者溫度太低,很嚴重 nr: non-recoverable,溫度太高或者溫度太低,造成不可恢復的損傷。 na:溫度狀態不明,較少見 - ast2500 datasheet 的Firmware Programming Guide章節(p129)定義multi function pin 通常會用到Base Address =0x1E6E:2000 Bootlooder_oem_ast2x00evb的Lanner_XXX_board_init定義所有的pin(multi function pin) PDKSensor.c定DIMM 和CPU temp SCI SCU(System Control Unit) (Page 351) GPIO 設定data為high/low dir為input/output libcomponent_manager build error >wipe & rebuild (libhosthelper > libcompamibios > libfcgi > libadvisercfg > libjson >libldapconf >libdapauth > libuserauth > libvideorecordcfg > spx_restservice) lighttpd error (libsession) 製作package時dev-install路徑也需要修改,需要改folder name ast2500 => code base 為LTS3 ast2600 => code base 為RR13 - NCSI(set in uboot) ``` set ethact ast_eth1 為i210 set ethact ast_eth0 為x766 ``` - 多層 libipmimsghndlr 所有的ipmi command會經過 ipmi message handler判斷處理決定要執行甚麼command import > spx > import encrypted image key pair 裡import key - ipmimain為ipmimain daemon - Web webui_html > 前端html ,javascript ,css spx_restservice > 後端C code AMI web admin/admin - dediprog currently working on選application memory chip 1(須根據jump作變更) (讀取bios轉存為bin)dediprog 選edit >read (read data from chip)> chip buffer to file - libipmipdk定義了sensor code - Add OEM command NetFn | CMD libipmipdkcmds > cmdselect.c 新增{ CMD_SET_BMC_FAN_SPEED, ENABLED, NONE }, ipmipdk_dev裡PDKCmds.h定義 function > extern int SetBMCFanSpeed(_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes, int BMCInst); libipmimsghndlr > corecmdselect.c 可enable/disable OEM command 和定NetFN number libipmimsghndlr > *.c 定CMD number header定義=>common/packages/ipmi_dev-src/data/IPMI_AewinPrivateCmd.h - ipmi_dev定義所有command number - GPIO編號算法 A=0, B=1, C=2, D=3以此類推,英文字母A代表0,每組8個所以B6如下(2-1)是因為B是英文字母第二個,但是起始是0所以2-1 GPIOB6(2-1)*8+6=14 超過Z後 2500=> AA AB 2600=> 18A0 B0 ... - gpio dir和data設定,可於ast2500 data sheet用0x1E78:0000去搜尋 - buzzer可以是設成timer或gpio - multi function設成特殊pin後不需要再調方向,它們會有預設的方向 #define AST_LPC_BASE 0x1E789000 /* Not in AST3100 */ #define AST_SCU_BASE 0x1E6E2000 - Build command git spx buildsrc <config> <package dir> <workspace dir> sudo git spx buildsrc ./configs/projectname.PRJ ./packages/ ./workspace/ 重build 需要將spx-packages-links和 workspace砍掉再build - FAN FAN有13bit和16bit的讀取方式(16bit讀取會比較準確,且不會有問題) 13 bit必須先讀出high byte的值向左shift left 5 bit 再和low byte的data 相加變成2 byte的 fan count data,再根據公式即可算出RPM 16 bit則high byte讀出後shift left 8 bit和low byte相加就是轉數 - PERST PERST是PCI Express (PCIe)介面中的一種訊號,其全稱為"PERST#",其中 "#"表示為訊號的電氣特性符號。PERST信號是由PCIe設備傳送給主機的一種reset訊號,其作用是通知主機系統該設備正在進行初始化或者已經發生錯誤,需要進行重新初始化。 當PCIe設備插入系統插槽時,其會在訊號線上拉高PERST訊號。如果設備正常啟動,該訊號會在啟動過程中保持高電位,直到初始化完成後才會拉低該信號。如果初始化過程中出現錯誤,設備會再次拉高該信號,以通知主機進行重新初始化。 Anyway,PERST信號的作用是協調PCIe設備和主機系統之間的通訊,保證系統和設備之間的互動正常運作。它也有助於診斷系統中可能出現的問題,例如設備初始化失敗或者硬件錯誤等。 - ipmimain 為ipmi的進入點 - i2c byte mode 和pool mode 的設定是定義i2c driver處理傳送和接收資料的方法. byte mode : BMC收送資料以byte為單位. pool mode : BMC收送資料使用32 bytes buffer. 一般來說建議使用pool mode,傳送和接收過程中產生的中斷比少,傳輸效率比較高還可以減少佔用cpu的資源。但若有使用SSIF(用於arm base system取代kcs interface)則只能使用byte mode,因為有資料需要額外處理。 - NCSI NCSI 只要將multi function pin 設成RMII1RCLK1,先查線路圖是2500的MAC幾,再根據GPIO腳位將對應腳位設成RMII1RCLK1 - power restore policy 在 *.pmc > Chassis Cfg TAB > 的 power restore policy AlwaysPowerUp 是斷電後重開會自動開機 StaysPoweredOff 是斷電後重開需要按power button RestorePowerState 是會記住斷電時的狀態 a. 如果電源中斷前,系統是開機,睡眠,或休眠其中的一種狀態,那麼電源中斷後再次連接電源後,系統恢復至對應狀態 b. 如果電源中斷前,系統是關機狀態,那麼電源中斷後再次連接電源後,系統狀態還是關機狀態 - eSPI的clock可能會影響ipmi command速度 - ddf的DEBUG_PRINTING 在 ddf的configuration可以enable(Enable Debug printing(values)),就是在設定k和門檻值那裏 - libipmimsghndlr/SensorEvent/SensorDevice/SensorMonitor.c ipmi daemon 用來定時讀sensor值的task (SensorMonitorTask 用來定期讀sensor值 ,SensorMonitorTimer會根據sensor_monitor_interval(再ddf裡面設定)定期去讀值) libipmimsghndlr/SensorEvent/SensorDevice/SensorMonitor.c SensorMonitorTask() 會去讀所有有效的sensor值 libipmimsghndlr/SensorEvent/SensorDevice/SensorMonitor.c GetSensorDeviceReading()會call IPMI_HAL_GET_SENSOR_READING() 讀sensor值 libipmihalapi > hal_api.c 會呼叫ddf gen出來的API table 做初始化 ipmi_dev > ipmi header定義 ddf > epilog.c 可用來print sensor的資訊 - ADD_MODULES_ONLY gpio > 加在dev-install可避免gpio kernel module 被unload - ACPI電源管理的工作狀態 S0(G0) 正常工作狀態: pc正式工作,CPU、DIM,PCH 、硬碟都開始工作。 G1 (睡眠)狀態:裡面包括S1-S4四個狀態,睡眠的模式不同對應的功耗也是不同的。具體如下: S1: 最耗電的睡眠模式。CPU所有暫存器刷新,且CPU停止執行指令。但是CPU、DIM電源沒有掉。 S2: CPU電關閉,通常不用。 S3:將任務掛到RAM中,當喚醒後(S3->S0)狀態,用戶剛剛的工作可以恢復到睡眠前的相同狀態。但是在這個狀態下如果突然AC掉電,這樣用戶之前處理的資料將會丟失。 S4:將任務掛到HD上,當喚醒後(S4->S0)狀態,用戶剛剛的工作可以恢復到睡眠前的相同狀態。但是在這個狀態下如果突然AC掉電,這樣用戶之前處理的資料將會丟失,再次重啟後依然能夠恢復進入睡眠模式前的工作狀態。 S5: soft off ,軟關機——包括POWER BUTTON或USER觸發(用戶介面)。 G3 狀態是:AC掉電,主版上只有RTC電源。 - realtek RTL8211E Page.54 Page 30 是有關 Extension Page Step 1. phy_write(phydev, 0x1f, 0x0007); 1F is Page Select Register, 0007 is extension page. (Ref Page 52) Step 2. phy_write(phydev, 0x1e, 0x002c); 2c is extension Page44(0x2c) Step 3. Write the target Register Data. Step 4. phy_write(phydev, 0x1f, 0x0000); Switch to Page 0

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully