Minskey, I am finding these messages in log:
Apr 14 13:58:05 Sol-232 pci_autoconfig: [ID 596873 kern.info] NOTICE: reprogram mem-range on ppb[0/e/0]: 0x80000000 ~ 0x800fffff Apr 14 13:58:05 Sol-232 pci_autoconfig: [ID 596873 kern.info] NOTICE: reprogram mem-range on ppb[80/1/0]: 0xd9000000 ~ 0xd94fffff Apr 14 13:58:05 Sol-232 pci_autoconfig: [ID 596873 kern.info] NOTICE: reprogram mem-range on ppb[80/2/0]: 0xd9500000 ~ 0xd99fffff Apr 14 13:58:05 Sol-232 pci_autoconfig: [ID 374940 kern.info] NOTICE: add mem-range on subtractive ppb[0/9/0]: 0x80100000 ~ 0x801fffff Apr 14 13:58:05 Sol-232 pci_autoconfig: [ID 516285 kern.warning] WARNING: failed to program mem space [4/0/0] b...@0x10 length 0x800000 Thanks, Gireesh -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of minskey guo Sent: Sunday, April 12, 2009 10:04 AM To: [email protected] Subject: Re: [driver-discuss] OpenSOlaris build 110 - problem with ddi_regs_map_setup() on x86 Sorry, I didn't notice that your code used to work well. Can you find some messages such as "reprogram xxxx" in syslog ? Or your device is put into D3 state ? minskey guo 写道: > > This couldn't be an error of ddi_regs_map_setup() or ddi_get64(), if that > happens, most hardware device drivers cannot work. > > You can check if the BAR is allocated PCI address range by "prtconf -vp", > and check the value of assigned-addresses of your device, and whether > your device support 64bit addressing or not. For the values of assigned- > addresses, each BAR is presented as 5 dwords. > > Not sure that you just want to get the content of BAR0. The code is > expected > to get the memory-mapped device registers or memory . If you did want to > get the content of mmaped registers, you should enable I/O or memory > access > in PCI command register (PCI offset 0x04), before you read/write device > registers. > > thanks, > -minskey > > > -minskey > > Eitan Eliahu 写道: >> The following is a code snippet which describes the problem. The >> value returned by ddi_get64 is wrong. I used PCItool to read the >> same address from bar0 and it returns the correct value. >> As I mentioned before the same code works on s10 update 6. It also works >> fine on build 110 on Sparc. It seems that device address is not set >> correctly. I haven't figured out at which address it points to but >> certainly not the correct address. >> >> ddi_device_acc_attr_t dev_attr = { >> DDI_DEVICE_ATTR_V0, >> DDI_NEVERSWAP_ACC, >> DDI_STRICTORDER_ACC, >> DDI_FLAGERR_ACC >> }; >> >> >> /* map BAR0 */ >> ret = ddi_regs_map_setup(dev_info, 1, (caddr_t *)&attr.bar0, >> (offset_t)0, (offset_t)0, &dev_attr, &attr.regh0); >> if (ret != DDI_SUCCESS) { >> ... >> } >> >> >> // >> // val64 has a wrong value >> // >> val64 = ddi_get64(attr.regh0, (uint64_t *)(attr.bar0)) >> >> >> >> -----Original Message----- >> From: Dan Mick [mailto:[email protected]] Sent: Friday, April 10, 2009 >> 8:45 PM >> To: Eitan Eliahu >> Cc: [email protected] >> Subject: Re: [driver-discuss] OpenSOlaris build 110 - problem with >> ddi_regs_map_setup() on x86 >> >> Not enough information here. Can you supply a misbehaving code snippet? >> How do you know it's the wrong data? >> >> Eitan Eliahu wrote: >> >>> >>> >>> Hello all, >>> >>> >>> >>> I'm facing a problem with this build when running on an x86 machine. >>> >> It >>> seems that ddi_regs_map_setup()does not return the correct device >>> address. When offset provided to ddi_get() a wrong data is read from >>> >> the >>> device. >>> >>> >>> >>> The following attribute is provided: >>> >>> ddi_device_acc_attr_t dev_attr = { >>> >>> DDI_DEVICE_ATTR_V0, >>> >>> DDI_NEVERSWAP_ACC, >>> >>> DDI_STRICTORDER_ACC, >>> >>> DDI_FLAGERR_ACC >>> >>> }; >>> >>> >>> >>> When range # 0 is provided to ddi_regs_map_setup the correct data >>> is read from the configuration space. The issue is for memory mapped >>> I/O, >>> >> >> >>> on x86 (Sparc works) and OpenSolaris build 110. >>> >>> >>> >>> I would appreciate any advice. >>> >>> >>> >>> Eitan >>> >>> >>> >>> >>> >>> >> ------------------------------------------------------------------------ >> >>> _______________________________________________ >>> driver-discuss mailing list >>> [email protected] >>> http://mail.opensolaris.org/mailman/listinfo/driver-discuss >>> >> >> _______________________________________________ >> driver-discuss mailing list >> [email protected] >> http://mail.opensolaris.org/mailman/listinfo/driver-discuss >> >> > > _______________________________________________ driver-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/driver-discuss _______________________________________________ driver-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/driver-discuss
