How do I determine if my controller is in IDE or AHCI mode in Linux?

11,017

lspci is all I need it seems. IDE mode means it is in IDE mode and AHCI mode means it is in AHCI/SATA mode.

I have documented this here

This modified MBR I referred to seems to just to something like this:

setpci -s 0:1f.2 90.b=40

which will work for a number of Apple MacBooks that use ICH7 and ICH8 controllers, but it is important to use a correct PCI 'slot' value that is easily obtained from lspci.

eg, while in IDE mode, note down slot which is 0:1f.2 in my case. In AHCI mode, this slot seems to change.

lspci
...
00:1f.2 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [IDE mode] (rev 03)
...
Share:
11,017

Related videos on Youtube

Arslan Ali
Author by

Arslan Ali

Updated on September 18, 2022

Comments

  • Arslan Ali
    Arslan Ali over 1 year

    I have an old MacBook Pro 4,1 (early 2008) - but I suspect an answer would apply to many MacBook Pros.

    It has an Intel IDE/SATA controller (ICH8M/ICH8M-E).

    I have installed a patched MBR that is supposed to put my controller into AHCI mode. It does this by setting some controller port value that I don't understand.

    This seems to work as I get this from lspci:

    00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
    00:1f.2 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 03)
    

    Now most, perhaps all, sites that provide a solution (enabling AHCI) suggest that after a sleep/wake cycle that a controller will revert to IDE mode due to how Apple supports Windows.

    They recommend disabling sleep.

    From author of patchedcode.bin I think

    Enabling AHCI for Windows on MacBooks

    NB: I do not have Boot Camp installed and I do not have Windows installed.

    Is there a way to prove that my controller is in IDE or AHCI mode?

    Background Data

    Using patchedcode.bin MBR I get this in syslog:

    Jun 12 22:33:22 max kernel: [    1.860955] ahci 0000:00:1f.2: version 3.0
    Jun 12 22:33:22 max kernel: [    1.861052] ahci 0000:00:1f.2: irq 45 for MSI/MSI-X
    Jun 12 22:33:22 max kernel: [    1.861117] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 3 ports 1.5 Gbps 0x1 impl SATA mode
    Jun 12 22:33:22 max kernel: [    1.861120] ahci 0000:00:1f.2: flags: 64bit ncq sntf pm led clo pio slum part ccc ems 
    Jun 12 22:33:22 max kernel: [    1.861130] ahci 0000:00:1f.2: setting latency timer to 64
    Jun 12 22:33:22 max kernel: [    1.880880] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
    Jun 12 22:33:22 max kernel: [    1.880983] scsi2 : ahci
    Jun 12 22:33:22 max kernel: [    1.884552] scsi3 : ahci
    Jun 12 22:33:22 max kernel: [    1.886932] scsi4 : ahci
    Jun 12 22:33:22 max kernel: [    1.886998] ata3: SATA max UDMA/133 abar m2048@0xdb504000 port 0xdb504100 irq 45
    Jun 12 22:33:22 max kernel: [    1.887000] ata4: DUMMY
    Jun 12 22:33:22 max kernel: [    1.887002] ata5: DUMMY
    Jun 12 22:33:22 max kernel: [    2.204103] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
    Jun 12 22:33:22 max kernel: [    2.204656] ata3.00: ATA-8: FUJITSU MHY2200BH, 0081000D, max UDMA/100
    Jun 12 22:33:22 max kernel: [    2.204662] ata3.00: 390721968 sectors, multi 16: LBA48 NCQ (depth 31/32), AA
    Jun 12 22:33:22 max kernel: [    2.205324] ata3.00: configured for UDMA/100
    Jun 12 22:33:22 max kernel: [    2.205554] scsi 2:0:0:0: Direct-Access     ATA      FUJITSU MHY2200B 0081 PQ: 0 ANSI: 5
    

    Using my original MBR I get this from syslog:

    Jun 13 18:07:13 max kernel: [    0.622861] ata_piix 0000:00:1f.1: version 2.13
    Jun 13 18:07:13 max kernel: [    0.622869] ata_piix 0000:00:1f.1: power state changed by ACPI to D0
    Jun 13 18:07:13 max kernel: [    0.622924] ata_piix 0000:00:1f.1: setting latency timer to 64
    Jun 13 18:07:13 max kernel: [    0.623339] scsi0 : ata_piix
    Jun 13 18:07:13 max kernel: [    0.623730] scsi1 : ata_piix
    Jun 13 18:07:13 max kernel: [    0.623765] ata1: PATA max UDMA/100 cmd 0x8108 ctl 0x811c bmdma 0x80e0 irq 21
    Jun 13 18:07:13 max kernel: [    0.623767] ata2: PATA max UDMA/100 cmd 0x8100 ctl 0x8118 bmdma 0x80e8 irq 21
    Jun 13 18:07:13 max kernel: [    0.623810] ata_piix 0000:00:1f.2: MAP [
    Jun 13 18:07:13 max kernel: [    0.623811]  P0 -- -- -- ]
    Jun 13 18:07:13 max kernel: [    0.623866] ata_piix 0000:00:1f.2: setting latency timer to 64
    Jun 13 18:07:13 max kernel: [    0.624241] scsi2 : ata_piix
    Jun 13 18:07:13 max kernel: [    0.624558] scsi3 : ata_piix
    Jun 13 18:07:13 max kernel: [    0.624862] ata3: SATA max UDMA/133 cmd 0x80f8 ctl 0x8114 bmdma 0x8020 irq 18
    Jun 13 18:07:13 max kernel: [    0.624865] ata4: SATA max UDMA/133 cmd 0x80f0 ctl 0x8110 bmdma 0x8028 irq 18
    Jun 13 18:07:13 max kernel: [    1.208879] ata3.00: ATA-8: FUJITSU MHY2200BH, 0081000D, max UDMA/100
    Jun 13 18:07:13 max kernel: [    1.208882] ata3.00: 390721968 sectors, multi 16: LBA48 NCQ (depth 0/32)
    Jun 13 18:07:13 max kernel: [    1.208961] ata1.01: ATAPI: MATSHITA DVD+/-RW UJ-867S, 1.00, max UDMA/33
    Jun 13 18:07:13 max kernel: [    1.216186] ata3.00: configured for UDMA/100
    Jun 13 18:07:13 max kernel: [    1.224396] ata1.01: configured for UDMA/33
    
  • Robert Siemer
    Robert Siemer about 10 years
    Do disks not get screwed when you wakeup in IDE mode with AHCI driver? They stop working? Do they get back to normal when you switch to AHCI mode after wakeup?
  • Arslan Ali
    Arslan Ali about 10 years
    I don't think so. This is a mode for an Intel controller and it should not change or alter anything on your disk.
  • Robert Siemer
    Robert Siemer about 10 years
    of course it doesn't change anything on the disk itself, but the disk drivers can't talk to the controller the same way as before the switch... the next read/write doesn't fail?
  • Arslan Ali
    Arslan Ali about 10 years
    Sorry Robert, I did not take time to understand your question. Short answer is 'I don't know'. Longer answer is that I am not doing this - I am putting controller into AHCI mode before booting OS and in my case it sticks so I don't experience my controller dropping back to IDE mode.