[U-Boot-Users] pci_hose_write_config_{byte,word}_via_dword?
Masami Komiya
mkomiya at sonare.it
Mon Apr 12 11:10:04 CEST 2004
Dear Wolfgang,
The attached patch fixes the pci_hose_write_config_{byte,word}_via_dword problem.
The original code is difficult to understand, so I have changed
the code not only fixing.
Best regards.
Masami Komiya
Masami Komiya wrote:
> I have confirmed the problem reported in this list.
>
> When pci_hose_write_config_{byte,word}_via_dword is used
> the upper byte is destroied.
>
> If you can access pci device, please execute pci command
> as the followings.
>
> # pci w.l 00.0c.00 10 12345600
> # pci display 00.0c.00 10
> 00000010: 12345601 10000000 00000000 00000000
>
> # pci w.b 00.0c.00 13 ff
> # pci display 00.0c.00 10
> 00000010: ff345601 10000000 00000000 00000000 <== GOOD
>
> -----------------------------------------------------------
>
> # pci w.l 00.0c.00 10 12345600
> # pci display 00.0c.00 10
> 00000010: 12345601 10000000 00000000 00000000
>
> # pci w.b 00.0c.00 12 ff
> # pci display 00.0c.00 10
> 00000010: 00ff5601 10000000 00000000 00000000 <== NG
>
> -----------------------------------------------------------
>
> # pci w.l 00.0c.00 10 12345600
> # pci display 00.0c.00 10
> 00000010: 12345601 10000000 00000000 00000000
>
> # pci w.b 00.0c.00 11 ff
> # pci display 00.0c.00 10
> 00000010: 0034ff01 10000000 00000000 00000000 <== NG
>
> -----------------------------------------------------------
>
> # pci w.l 00.0c.00 10 12345600
> # pci display 00.0c.00 10
> 00000010: 12345601 10000000 00000000 00000000
>
> # pci w.w 00.0c.00 10 ffff
> # pci display 00.0c.00 10
> 00000010: 0000ff01 10000000 00000000 00000000 <== NG
>
> How is your result ?
>
> Best regards.
>
> Masami Komiya
>
>
> Masao Uebayashi wrote:
>
>> Hello.
>>
>> Is there anyone successfully using
>> pci_hose_write_config_{byte,word}_via_dword defined as a macro in
>> drivers/pci.c? Or, are you sure what the code there is doing? When I
>> tried to use it, writing a byte failed and I used the following code.
>>
>> I think the current code is just wrong, but I can't explain how it's
>> wrong since I can't understand the intention of the code. :-)
>>
>> Masao
>>
>> #define __mask(_o, _v) \
>> (_v << ((offset & _o) * 8))
>>
>> #define __data(_o, _v) \
>> ((((unsigned long)(val)) & _v) << ((offset & _o) * 8))
>>
>> #define PCI_WRITE_VIA_DWORD_OP(__size, __type, __offsetmask,
>> __valmask) \
>> int pci_hose_write_config_##__size##_via_dword( \
>> struct pci_controller *hose, \
>> pci_dev_t dev, \
>> int offset, \
>> __type val) \
>> { \
>> u32 val32; \
>> \
>> if (pci_hose_read_config_dword(hose, dev, offset & ~0x3, &val32) <
>> 0) \
>> return -1; \
>> /* Clear a byte/word in a word. */ \
>> val32 &= ~__mask(__offsetmask, __valmask); \
>> /* Fill a cleared byte/word in a word with a byte/word value. */ \
>> val32 |= __data(__offsetmask, __valmask); \
>> /* Write the value as a word! */ \
>> if (pci_hose_write_config_dword(hose, dev, offset & ~0x3, val32) <
>> 0) \
>> return -1; \
>> \
>> return 0; \
>> }
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by: IBM Linux Tutorials
>> Free Linux tutorial presented by Daniel Robbins, President and CEO of
>> GenToo technologies. Learn everything from fundamentals to system
>> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>> _______________________________________________
>> U-Boot-Users mailing list
>> U-Boot-Users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>>
>>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pci.patch
Url: http://lists.denx.de/pipermail/u-boot/attachments/20040412/90d1a5a0/attachment.txt
More information about the U-Boot
mailing list