PCI-related question [SOLVED]

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

PCI-related question [SOLVED]

Post by bigbob »

Hi,

There seem to be a SATA and an IDE controller on a laptop (lspci on Linux):
00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA controller [AHCI mode]
00:14.1 IDE Interface: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 IDE Controller (rev 40)

So the SATA is bus=0, device=0x11 and function=0, the IDE is bus=0, device=0x14 and function=1.
I already configured the SATA controller to be IDE and in compatibility mode according to the "SB700/710/750 Register Reference Guide" (datasheet) but it doesn't want to work (I have no AHCI driver).
I set bit0 of the 32bit-register 0x40 to 1 and its bit24 to 0 (val=inb(0x40), outb(0x40, val | 0x01) and val=inb(0x43), outb(0x43, val & 0xFE)) then
I changed the deviceID to 0x4390 (IDE, outw(0x02, 0x4390)) and also changed the subclassId to 0x01 (outb(0x0A, 0x01)),
finally I set the legacy mode by clearing bit0 and bit2 in register 0x09 (val=inb(0x09), outb(0x09, val & 0xFA))

My pcils command correctly shows the changed values (devId, subclass) and I also the values of the other changed regsiters are correct and I already implemented the same thing in case of an Intel (ICH7 datasheet) SATA controller and it works.

The winchester doesn't get detected. Probably because not the SATA but the IDE controller is used (but it's in compatibility mode). According to the datasheet in compatibility mode the BAR addresses are not used,
so how could I determine if the Primary Bus (0x1F0) is connected to the SATA or the IDE controller?
EDIT: I mean how will I know if the SATA controller is mapped to 0x1F0 or 0x170, or the IDE?

I hope it's not too silly a question.
Last edited by bigbob on Sat Oct 12, 2013 5:02 am, edited 1 time in total.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: PCI-related question

Post by Gigasoft »

Only one controller should have a channel set to compatibility mode at a time. It is an error to configure multiple controllers with the same I/O address. You should set the IDE controller to native mode or disable it by writing a "0" to bit 0 of the command register.
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: PCI-related question

Post by bigbob »

Gigasoft wrote:Only one controller should have a channel set to compatibility mode at a time. It is an error to configure multiple controllers with the same I/O address. You should set the IDE controller to native mode or disable it by writing a "0" to bit 0 of the command register.
Thank you! 8)

EDIT: Setting the IDE controller to native mode solved it.
Post Reply