hi,
i am having trouble reading information off my pci_dev_info structure
after i use the pci_attach_device command. the PciRom address which i
am printing after the device attach command is called returns all
zeros as the Pci Rom address. the relevant code fragment is attached
below.
what am i missing?
thanks a lot
ninad
attachDevice =
pci_attach_device(NULL,PCI_SHARE|PCI_SEARCH_VENDEV|PCI_INIT_IRQ|PCI_INIT_ROM,
0, &DevInfo);
if ( attachDevice == NULL)
{
fprintf(stdout, “\n Unable to allocate resources
\n”);
}
else
{
DevRomAddr = PCI_MEM_ADDR(DevInfo.PciRom);
fprintf(stdout,"\n PCI ROM address: %016" PRIx64
“\n”, DevRomAddr);
// Print Device information according to:
// http://brama.king.net.pl/download/qnx/articles/hwtalk.htm
for (i = 0; i< 6; i++)
{
if (DevInfo.BaseAddressSize > 0)
{
fprintf(stdout,“Aperture %d: "
“Base 0x%llx Length %d bytes Type %s\n”, i,
PCI_IS_MEM(DevInfo.CpuBaseAddress) ?
PCI_MEM_ADDR(DevInfo.CpuBaseAddress)
:
PCI_IO_ADDR(DevInfo.CpuBaseAddress),
DevInfo.BaseAddressSize,
PCI_IS_MEM(DevInfo.CpuBaseAddress) ?
“MEM” : “IO”);
}
}
fprintf(stdout,”\n IRQ 0x%x \n", DevInfo.Irq);
}
You must use %llx to print out the ROM address, as it is 64-bits.
“ninadpradhan” <ninad.pradhan@gmail-dot-com.no-spam.invalid> wrote in
message news:e5g8rl$i67$1@inn.qnx.com…
hi,
i am having trouble reading information off my pci_dev_info structure
after i use the pci_attach_device command. the PciRom address which i
am printing after the device attach command is called returns all
zeros as the Pci Rom address. the relevant code fragment is attached
below.
what am i missing?
thanks a lot
ninad
attachDevice =
pci_attach_device(NULL,PCI_SHARE|PCI_SEARCH_VENDEV|PCI_INIT_IRQ|PCI_INIT_ROM,
0, &DevInfo);
if ( attachDevice == NULL)
{
fprintf(stdout, “\n Unable to allocate resources
\n”);
}
else
{
DevRomAddr = PCI_MEM_ADDR(DevInfo.PciRom);
fprintf(stdout,"\n PCI ROM address: %016" PRIx64
“\n”, DevRomAddr);
// Print Device information according to:
// > http://brama.king.net.pl/download/qnx/articles/hwtalk.htm
for (i = 0; i< 6; i++)
{
if (DevInfo.BaseAddressSize > > 0)
{
fprintf(stdout,“Aperture %d: "
“Base 0x%llx Length %d bytes Type %s\n”, i,
PCI_IS_MEM(DevInfo.CpuBaseAddress> ) ?
PCI_MEM_ADDR(DevInfo.CpuBaseAddress> )
:
PCI_IO_ADDR(DevInfo.CpuBaseAddress> ),
DevInfo.BaseAddressSize> ,
PCI_IS_MEM(DevInfo.CpuBaseAddress> ) ?
“MEM” : “IO”);
}
}
fprintf(stdout,”\n IRQ 0x%x \n", DevInfo.Irq);
}
thanks for the reply.
You must use %llx to print out the ROM address, as it is 64-bits
the method i have used also works for uint64_t variables. i have tried
it with a dummy variable. i tried %llx too, but it is just returning
the ROM address as 0.
i think i am making a mistake in one of the pci related commands, but
i am not sure what it is. do you have any suggestions on that?
regards
ninad
Run your program, but don’t let it exit. Then on another screen do a
‘pci -v’ and let me know what the ROM address is. If it is also zero, then
slay the PCI server, restart it with ‘-vvv’ and post the sloginfo output as
well as the ‘pci -v’ output after running your program.
“ninadpradhan” <ninad.pradhan@gmail-dot-com.no-spam.invalid> wrote in
message news:e5i13n$phh$1@inn.qnx.com…
thanks for the reply.
You must use %llx to print out the ROM address, as it is 64-bits
the method i have used also works for uint64_t variables. i have tried
it with a dummy variable. i tried %llx too, but it is just returning
the ROM address as 0.
i think i am making a mistake in one of the pci related commands, but
i am not sure what it is. do you have any suggestions on that?
regards
ninad
hi,
Run your program, but don’t let it exit. Then on another screen do a
br>‘pci -v’ and let me know what the ROM address is.
pci -v gives me a PCI Mem address of ec140000h, which is the only
address displayed in the device information.
The PciRom address on the device info is still 0h.
regards
ninad
Well it might just be that this device doesn’t have any ROM. You can verify
this by doing the following:
- slay pci-bios
- sloginfo -c
- pci-bios -vvv
- sloginfo | less
Look through the sloginfo for the vendor and device IDs of your device and
you should see something like ‘MEM ec140000 xxxxxx’, where xxxxx is the size
of the memory aperture. If there was ROM space found, then you should also
see a line ‘ROM xxxx - yyyyy’, where ‘x’ is the address and ‘y’ is the size.
If it does show a ROM size, then please post the output of sloginfo as well
as the ‘pci -vv’ output.
“ninadpradhan” <ninad.pradhan@gmail-dot-com.no-spam.invalid> wrote in
message news:e62uji$5e0$1@inn.qnx.com…
hi,
Run your program, but don’t let it exit. Then on another screen do a
br>‘pci -v’ and let me know what the ROM address is.
pci -v gives me a PCI Mem address of ec140000h, which is the only
address displayed in the device information.
The PciRom address on the device info is still 0h.
regards
ninad