Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jan 2001 16:18:35 +0100
From:      Nicolas Souchu <nsouch@alcove.fr>
To:        freebsd-hackers@freebsd.org
Subject:   odd result of pci_read_config
Message-ID:  <20010120161834.B20753@ontario.alcove-int>

next in thread | raw e-mail | index | archive | help
Hi folks,

I have a problem with R4.2. The device driver I'm currently
writing can't retrieve correctly the value from a PCI configuration
register. What is strange is that when using the pciconf tool I get
the result I expect, not with pci_read_config().

pciconf -r pci0:7:3: 0x48   returns 0x00006001

but 

value = pci_read_config(dev, 0x48, 4); returns 0x6 !!!

The later is called from the attach routine of the driver which
is detected like this:

viapm0: <VIA VT82C586B Power Management Unit> at device 7.3 on pci0

My pci config is:

chip0@pci0:0:0: class=0x060000 card=0x00000000 chip=0x05971106 rev=0x04 hdr=0x00
pcib1@pci0:1:0: class=0x060400 card=0x00000000 chip=0x85981106 rev=0x00 hdr=0x01
isab0@pci0:7:0: class=0x060100 card=0x00000000 chip=0x05861106 rev=0x47 hdr=0x00
atapci0@pci0:7:1:       class=0x01018a card=0x00000000 chip=0x05711106 rev=0x06 hdr=0x00
viapm0@pci0:7:3:        class=0x060400 card=0x00000000 chip=0x30401106 rev=0x10 hdr=0x01
pcm0@pci0:8:0:  class=0x040100 card=0x13191319 chip=0x08011319 rev=0xb1 hdr=0x00
none0@pci0:8:1: class=0x090410 card=0x13191319 chip=0x08021319 rev=0xb1 hdr=0x00
ahc0@pci0:9:0:  class=0x010000 card=0x00000000 chip=0x81789004 rev=0x00 hdr=0x00
fxp0@pci0:10:0: class=0x020000 card=0x10c3103c chip=0x12298086 rev=0x05 hdr=0x00
none1@pci1:0:0: class=0x030000 card=0x00281002 chip=0x52461002 rev=0x00 hdr=0x00

So what may be the problem?

Also, some PCI drivers allocate IOPORT resources by giving the PCI
configuration register as the rid of the bus_alloc_resource call... how
can it work? What are the magics in pci framework for this?

Thanks,

Nicholas

-- 
Nicolas.Souchu@alcove.fr
Alcôve - Open Source Software Engineer - http://www.alcove.fr


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010120161834.B20753>