<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>PCI memory space access problems</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hello!</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">In my customized PCI initialization (within a set of tests), I do the following:</FONT>
<BR><FONT SIZE=2 FACE="Arial">(…)</FONT>
<BR> <FONT SIZE=2 FACE="Arial">immap->im_siu_conf.sc_ppc_alrh = 0x61207893;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">immap->im_siu_conf.sc_ppc_acr = 0x6;</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">immap->im_memctl.memc_pcimsk0 = 0xfffc0000;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">immap->im_memctl.memc_pcibr0 = 0x80000001;</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">immap->im_pci.pci_pitar0 = 0x00000000; /* PCI base */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">immap->im_pci.pci_pibar0 = 0x00000000; /* Local base */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* 64KB address space, no snooping, no prefetch */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">immap->im_pci.pci_picmr0 = cpu_to_le32(0xFFFF0000);</FONT>
<BR>
<BR> <FONT SIZE=2 FACE="Arial">bdf = PCI_BDF(0, 0x17, 0);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_read_config_dword(bdf, PCI_COMMAND, &temp32);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_dword(bdf, PCI_COMMAND, temp32 | 0x06);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set inbound transactions region base address */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_dword(bdf, 0x10, 0x80000000);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set latency and cache size */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_byte(bdf, PCI_CACHE_LINE_SIZE, 0x08);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_byte(bdf, PCI_LATENCY_TIMER, 0xF8);</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">bdf = PCI_BDF(0, 0x16, 0);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_read_config_dword(bdf, PCI_COMMAND, &temp32);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_dword(bdf, PCI_COMMAND, temp32 | 0x06);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set inbound transactions region base address */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_dword(bdf, 0x10, (0x80000000 + 0x00010000));</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set latency and cache size */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_byte(bdf, PCI_CACHE_LINE_SIZE, 0x08);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_byte(bdf, PCI_LATENCY_TIMER, 0xF8);</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">bdf = PCI_BDF(0, 0x18, 0);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_read_config_dword(bdf, PCI_COMMAND, &temp32);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_dword(bdf, PCI_COMMAND, temp32 | 0x06);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set inbound transactions region base address */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_dword(bdf, 0x10, (0x80000000 + 0x00020000));</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set latency and cache size */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_byte(bdf, PCI_CACHE_LINE_SIZE, 0x08);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_write_config_byte(bdf, PCI_LATENCY_TIMER, 0xF8);</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">/* Set CPU bridge as slave */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_hose_read_config_dword (hose, host_devno, PCI_COMMAND, &temp32);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_hose_write_config_dword (hose, host_devno, PCI_COMMAND, temp32 | 0x02);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set outbound transactions region base address */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_hose_write_config_dword (hose, host_devno, 0x10, CFG_IMMR);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">/* Set latency and cache size */</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_hose_write_config_byte (hose, host_devno, PCI_CACHE_LINE_SIZE, 0x08);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">pci_hose_write_config_byte (hose, host_devno, PCI_LATENCY_TIMER, 0xF8);</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">immap->im_siu_conf.sc_ppc_alrh = 0x30126789;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">immap->im_siu_conf.sc_ppc_acr = 0x03;</FONT>
<BR><FONT SIZE=2 FACE="Arial">(...)</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">And I am using readl and writel to read and write to/from the PCI memory address space. But, for some reason, I can't access properly (reads and writes) the devices that I configured earlier. What am I doing wrong? Or the PCI configurations are not correct? (In linux I can access those devices!...) </FONT></P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Thank you!</FONT>
<BR><FONT SIZE=2 FACE="Arial">Filipe.</FONT>
</P>
</BODY>
</HTML>