Search This Blog

Friday, July 10, 2015

[圖文] LINE原創貼圖

最近畫了一組LINE原創貼圖,經過審查通過,在LINE正式上架了。
原創貼圖連結 http://line.me/S/sticker/1160144
希望大家可以多多支持Icey Creamy!
Icey Creamy


以下是貼圖內容


Tuesday, March 27, 2012

BIOS該怎麼換SCI的IRQ9變成IRQ11呢?


預設值SCI是透過IRQ9,
如何去改IRQ9到IRQ11呢?

要修改三個部分
1. BIOS部分是透過EFI CODE這部分可以去參考Intel的南橋spec[SCI_IRQ_SEL].
2. ASL CODE 這部分可以去參考ACPI spec[FADT SCT_INT] 從9設成11
3. ASL CODE 這部分可以去參考ACPI spec的[MADT EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE]也是從9設成11


這樣就可以改用IRQ11去發SCI了。

Tuesday, March 6, 2012

How to create EDK2 enviornment?

以下是我個人電腦的設定,依據不同環境需要自行調整。

使用TortoiseSVN軟體download 位址https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2的source code
預設會下載到C:\EDK2的資料夾裡。

開啟Visual Studio 2008 Command Prompt
到指定的目錄夾,C:\EDK2
鍵入edksetup.bat


然後再到Conf的資料夾
鍵入edit target.txt
C:\EDK2\Conf\edit target.txt

ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc
TARGET = DEBUG
TARGET_ARCH = IA32
TOOL_CHAIN_CONF = Conf/toos_def.txt
TOOL_CHAIN_TAG = MYTOOLS
#MAX_CONCURRENT_THREAD_NUMBER = 1
MAX_CONCURRENT_THREAD_NUMBER = 8  # My CPU is Quad Core
BUILD_RULE_CONF = Conf/build_rule.txt

Build完後,可以到
鍵入secmain.exe
即可進入EDK2的模擬環境

Wednesday, November 30, 2011

PS2 Keyboard Malfunction Sometimes

最近遇到一個在POST過程中,隨意按鍵,有機率性的PS2 internal keyboard不能動的問題,所以為了解決這個問題,在BIOS logo出來時,去發一個keyboard reset給KBC controller。

以下的程式碼就是發keyboard reset給KBC controller

VOID
KeyBoardReset(
  VOID
  )
{
  UINT8 Data;

  //
  // Clear Output Buffer data
  //
  Data = IoInput8(0x64);
  while (Data & 0x01) {
    Data = IoInput8(0x60);
    Data = IoInput8(0x64);
  }
 
  //
  // Disalbe Aux Device
  //
  IoOutput8 (0x64, 0xA7);
  while (Data & 0x02) {
    Data = IoInput8(0x64);
  }

  //
  // Disalbe Keyboard
  //
  IoOutput8 (0x64, 0xAD);
  while (Data & 0x02) {
    Data = IoInput8(0x64);
  }

  //
  // Reset keyboard.
  //
  IoOutput8 (0x60, 0xFF);
  Data = IoInput8(0x64);
  while (!(Data & 0x01)) {
    Data = IoInput8(0x64);
  }
  Data = IoInput8(0x60);
  Data = IoInput8(0x64);
  while (!(Data & 0x01)) {
    Data = IoInput8(0x64);
  }
  Data = IoInput8(0x60);
}

Monday, November 28, 2011

Kindle Touch 連不上Wi-Fi?

在剛開始使用Kindle Touch時,有遇到無法透過家中的無線分享器連上Wi-Fi,怎麼會這樣子呢?上網找各種solution,使用了以下的方式,讓Kindle Touch可以順利連上Wi-Fi。

需求:一台安裝有Windows 7的電腦加上有一張無線網卡(若是筆電就是內建配備;
           桌上型電腦的話,可能要再買一張USB無線網卡)
軟體:額外安裝Connectify(用谷歌可以搜尋的到)

它的運作模式就是將你的電腦透過無線網卡,變成一個Hot Spot,讓你的Wi-Fi裝置可以透過它連上網路。簡單的方式就是,請記得密碼設定成10碼,編碼模式設成WEP。不然Kindle Touch可能會無法連上Wi-Fi。

Kindle Touch 開箱文


期待已久的Kindle Touch WiFi 廣告版總算是入手了!  接下來就讓我來開箱吧。





































簡單又環保的設計採破壞式開箱方式,我想這樣才會願意把盒子拿去回收吧(笑)























主角登場了!!!  伴隨著淡淡的紙盒香味飄出~在Kindle Touch的螢幕上有讓人有看來像是擺上一張紙的感覺,但那其實就是電子紙的魔力啊!!!在Kindle Touch螢幕下方有四條線(好在不是設計成三條線冏rz),那就是Home鍵,在機身下方由左至右有micro USB孔、耳機孔、和開關鍵。





























側身設計很薄



























躺在Kindle Touch正下方的就是傳輸以及充電的micro USB線





















準備插上USB線來大展身手囉。







可以看到插上USB線後,橘燈亮起,它就自動開機了...





















接下來就會看到一連串的Kindle Touch的自我介紹。若迫不及待,可以按下方四條横線的Home鍵開始設定Kindle Touch吧。



























最重要的就是設定Kindle Touch的Wi-Fi,讓它連上網路。




























連上Wi-Fi後,就會看到有Wi-Fi字樣出現在右上角













設成完成後就註冊Amazon的帳號準備買書吧。



























背面的設計也是很有質感的。

























Kindle Touch優點:
1. 以觸控的電子書來說,紅外線觸控方式在Kindle Touch表現的很不錯
2. 即時英文長押螢幕單字來查詢,非常適合學習英文
3. 大小和重量適中,很適合帶出門喝咖啡邊看書,多愜意啊
4. 翻頁的反應速度似乎有比前一代進步
5. 由於是電子紙,電池續航力最長可以到兩個月
6. 最大優點是電子紙螢幕看再久,眼睛也不會痠

Kindle Touch缺點:
1. 資料夾管理系統不是很方便
2. 如果將機身横擺,也沒辦法將文件橫向顯示
3. 手指要乾淨,才不會把螢幕弄髒(笑)

Monday, November 21, 2011

Set PS2 KB LED Status (Num Lock/Cap Lock/Scroll Lock) in Code

1. Send keyboard command 0xED to KBC command port 0x64
2. Wait for the response 0xFA value from KBC data port 0x60
3. Send keyboard LED status command to KBC command port 0x64
     EDh nn       write LEDs. nn=
                                                 b2      Caps Lock
                                                 b1      Num Lock
                                                 b0      Scroll Lock
     Ex. 0x05 means Caps Lock and Scroll Lock is enabled, Num Lock is disabled
4. Wait for the response 0xFA value from KBC data port 0x60

Tuesday, November 1, 2011

Trigger SMI to Do CpuIo Cause System Hangs Up Under Windows

We would like to use CpuIo protocol and must locate it first.

Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &CpuIo);
There is a question here, system is entered windows that has exited boot service.
Therefore, we locate this protocol will cause system hangs up.
To avoid this, we should create a global variable to save the CpuIo pointer when system during POST phase.

EFI_CPU_IO_PROTOCOL   *mCpuIo = NULL;

EFI_DRIVER_ENTRY_POINT (SctCpuIoPointSave)
EFI_STATUS
SctCpuIoPointSave (
  IN EFI_HANDLE ImageHandle,
  IN EFI_SYSTEM_TABLE *SystemTable
  )
{
  EFI_STATUS Status;
  EFI_HANDLE Handle;
  DxeInitializeDriverLib (ImageHandle, SystemTable);

  //
  // Locate CpuIo protocol.
  //
  Status = gBS->LocateProtocol ( &gEfiCpuIoProtocolGuid, NULL, &mCpuIo ) ;
       
  return Status;
} // EnteyPoint.


Just need to call your function in SMI code to use CpuIo.
For example,

VOID
ShowPort80 (VOID)
{
  EFI_STATUS    Status ;
  UINT8                Data ;
  Data = 0x99;
  Status = mCpuIo->Io.Write (
                        mCpuIo,
                        EfiCpuIoWidthUint8,
                        0x80,
                        1,
                        &Data);

  ASSERT_EFI_ERROR (Status);
}

Wednesday, October 26, 2011

How do I hide the "Devices and Printers" of hardware component in Windows 7

For example: want to remove the camera device in devices and printers
Just need to add red part in device ASL code.

Device(PRT3) {  
     Name(_ADR, 0x00000003)
               Name(_UPC, package() {
                                       0x00,
                                              0xFF,
                              0x00000000,
                                           0x00000000
                })
                //
                // Using method _RMV remove component
                //
                Method(_RMV,0)
                {
                     Return(0x00)  // 0 : Unremovable 1: Removable
                }
          }

Thursday, August 25, 2011

Deep S3

Why do we need deep S3?
A: Deep S3 can save more power consumption for notebook battery life.

How does the deep S3 work?
A: Deep S3 will automatically activate when notebook only attach the battery without AC plug-in and during S3. System goes to sleep to S3 will check the AC adapt is present or not. If AC is plug-in, the system will enter normal S3. If system without AC plug-in, the system will enter deep S3.

More information can refer to "Intel Deep S3 Implementation Guide".

Sunday, August 21, 2011

AMD UMI and PCIe Bridge Register Access Method


If we want to access the UMI and the FCH/GPP link interface could through the following register spaces: ABCFG, AXCFG, AXINDC, AXINDP, RCINDC, and RCINDP

Change the register spaces must through the AB_INDX/AB_DATA register pair. You can get the AB_INDX through PM_REG that IO index port 0xCD6 and IO data port 0xCD7 offset 0xE0 register.
For example, if the PM_REG offset 0xE0 is 0xCD8 that means the AB_INDX is 0xCD8 and AB_DATA is equal to AB_INDX + 4.

========================================

AXINDC Registers:
AX_INDXC 0x30
AX_DATAC 0x34

Example 1: For Write Temp to AXINDC 20h
Out CD8h, 00000030h
Out CDCh, 00000020h
Out CD8h, 00000034h
Out CDCh, Temp

=========================================

AXINDP Registers:
AX_INDXP 0x38
AX_DATAP 0x3C

Example 2: For Write Temp to AXINDP 20h
Out CD8h, 40000030h
Out CDCh, 00000020h
Out CD8h, 40000034h
Out CDCh, Temp

=========================================

AXCFG Registers:

Example 3: For Write Temp to AXCFG 03h
Out CD8h, 80000003h
Out CDCh, Temp

=========================================

ABCFG Registers:

Example 4: For Write 0xFFFFFFFF to ABCFG 04h
Out CD8h, C0000004h
Out  CDCh, FFFFFFFFh

=========================================

RCINDC Registers:

Example 5: For Write Temp to RCINDC 14h
Out CD8h, 20000014h
Out CDCh, Temp

=========================================

RCINDP Registers:

Example 6: For Write Temp to RCINDP A0h(PortB)
Out CD8h, 610000A0h
Out  CDCh, Temp

Wednesday, August 10, 2011

How to know the notebook panel resolution during POST

The horizontal can get from EDID table bytes 0x38(lower 8 bits) and 0x3A(Upper 4:4 bits).
For example:
Bytes   Value
0x38      0xA0
0x3A     0x50

Horizotal = (Offset (0x3A) & 0xF0 << 4) + Offset (0x38)
               = (0x50 << 4) + 0xA0
               = 0x5A0 (Hex)
               = 1440 (Dec)

The vertical can get from EDID table bytes 0x3B(lower 8 bits) and 0x3D(Upper 4:4 bits).
For example:
Bytes   Value
0x3B      0x84
0x3D     0x30

Vertical = (Offset (0x3D) & 0xF0 << 4) + Offset (0x3B)
             = (0x30 << 4) + 0x84
             = 0x384 (Hex)
             = 900 (Dec)

Therefore, we can know the panel resoultion is 1440 * 900 for this example.

Wednesday, June 29, 2011

Library Compiler Error - don't know how to make

遇到 don't know how to make LibraryX.lib 的情況,可以用以下的方式排除
1. 確定LibraryX.lib 在 AAA.dsc裡面有去定義這個AAA.inf
2. 若在build這個AAA.inf的library的時候就遇到compiler error,請先解決這個compiler error (可能是LibraryX建的方式有問題,可以參照其他現成的library做法)
3. 若你在BBB的檔案要引用這個LibraryX的時候,請先確定在build出來的temp目錄層底下,有長出LibraryX.lib的檔案。
4. 若有,請在BBB.inf裡確定以下兩點
[includes.common]
  $(EFI_SOURCE)\(Library_ROOT)  //要指定路徑在library那一層
[libraries.common]
  LibraryX
5.記住呼叫的Libray名字不要打錯,不然就會造成complier "don't know how to make" 的error

Monday, June 27, 2011

SATA及USB介面傳輸速度比較表

SATA版本
頻寬
速度       傳輸一部6G高清電影
SATA 3.0
6Gb/s
600MB            10 (理想值)
SATA 2.0
3Gb/s
300MB            20 (理想值)
SATA 1.0
1.5Gb/s
150MB            40 (理想值)



USB版本
頻寬
速度       傳輸一部6G高清電影
USB 3.0
5 Gb/s
500MB            12 (理想值)
USB 2.0
480Mb/s
48MB              125 (理想值)
USB 1.1
120Mb/s
1.2MB             5000 (理想值)
 USB 1.0           1.5Mb/s        150KB              40000 (理想值)

Wednesday, June 22, 2011

How to make an EFI library?

1. 在inf檔裡修改
[defines]
  BASE_NAME       =  HelloLib
  COMPONENT_TYPE  =  LIBRARY

[sources.common]
  Hello\Hello.c
  Hello\Hello.h


2. 把你需要的library function加到hello.c及hello.h裡

3.在EFI driver去引用HelloLib的時候要去修改以下的檔案
   AbcDriver.inf
   AbcDriver.c


4.AbcDriver.c要加入
   #include "Hello.h"

   用extern的方式加入library的function名字
   並在你的function去呼叫你要用的library function即可

5.AbcDriver.inf要加入
[includes.common]
  $(EFI_SOURCE)\Library\Hello  <== 指到放Hello.h的那一層目錄

[libraries.common] 
   HelloLib

Monday, May 30, 2011

INT 15h E820 Query Memory Map Use Debug32.exe

;Input:
;       eax   - function code 0E820H
;       ebx   - continuation code, zero for first call
;       es:di - buffer pointer , point to an buffer for BIOS to fill in.
;       ecx   - buffer size , minimum is 20 bytes
;       edx   - signature 'SMAP'

C:\debug32
-r32
-a
  mov eax, 0000e820
  mov ebx, 0
  mov ecx, 14
  mov edx, 534d4150
  mov di, 200
  int 15
  int 3
  p
-go


;Output:
;       CF    - non-carry indicates no error
;       eax   - signature return 'SMAP'
;       es:di - buffer pointer, same as input
;       ecx   - real buffer size return
;       ebx   - continuation code , zero return if last run occured

Thursday, May 26, 2011

ACPI can't recogize OS type with Ubuntu operating system

ACPI can't recogize OS type with Ubuntu operating system

Remove "Linux" from supported _OSI strings.
The Linux OS no longer wants to respond true for this string.
The only safe strings are windows-related as they represent the tested path through the BIOS-provided ASL.
===========================================================================

現在Ubuntu不支援用_OSI strings的方式來回報OS類型

Monday, May 23, 2011

A20 Gate

1.   8086的系統,當初只設計20根位址線。透過Segment + Offset的方式來定址,Ex. F000 : 0010h = F0000+ 0010h = F0010h  那衍生了一個問題就是當CS : IP的值為FFFF : FFFFh = FFFF0 + FFFFh = 10FFEFh = 1M + 64K – 16 Bytes  但系統只能存取到1M以下,這該如何是好? 所以大於1M,系統會直接回繞。

2.   80286的系統,位址線變成了24根,但又要向下相容,就衍生了A20的模式,當A20disable,就等同於8086的架構,A20 Enable,系統就可以存取到2 ^ 24次方 = 16M byte,也就是Segment變成最大值為FFFFFh 而不是FFFFh

3.   開啟A20 Gate的方法,最簡單就是對IO Port 92h 的bit 1給設起來;反之關閉A20 Gate的方法,就是清掉IO Port 92h 的bit 1。

enable_A20:
        cli

        call    a20wait
        mov     al,0xAD  ; Disable Keyboard
        out     0x64,al

        call    a20wait
        mov     al,0xD0
        out     0x64,al

        call    a20wait2
        in      al,0x60
        push    eax

        call    a20wait
        mov     al,0xD1
        out     0x64,al

        call    a20wait
        pop     eax
        or      al,2
        out     0x60,al

        call    a20wait
        mov     al,0xAE   ; Enable Keyboard
        out     0x64,al

        call    a20wait
        sti
        ret

a20wait:
        in      al,0x64
        test    al,2
        jnz     a20wait
        ret


a20wait2:
        in      al,0x64
        test    al,1
        jz      a20wait2
        ret

Wednesday, May 18, 2011

8259 Control Word


RTC Lost Power

After remove RTC coin battery, system plug-in RTC coin battery the CMOS  register 0xE access by (index port 0x70/ data port 0x71) bit 7 will be set. After check this bit, we also need to clear this bit by code.















============================================================================

在移除RTC水銀電池後,然後再次插上,這時後CMOS register offset 0xE的位址,在(使用index port 0x70/ data port 0x71)方式存取,這時候的0xE的bit 7會被設起來,在code裡面,一檢查完,就需要清掉這個位元。