tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Kernel code documentation and pci data structures (was: Problem with Intel WiFi card)



Hi, Rocky.

On 2017/05/18 18:21, Rocky Hotas wrote:
Hi Masanobu and hi all!
After the discussion on this thread,

http://mail-index.netbsd.org/netbsd-users/2017/02/01/msg019280.html

I'm trying to apply this patch

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/pci/ppb.c.diff?r1=1.35&r2=1.36

to NetBSD. The current version of OpenBSD kernel ppb.c file (which
works in my laptop, where I tried to temporarily install OpenBSD)
has some more lines and is based on the rev. 1.40.
I write to you because you made much of the last commits on the
NetBSD ppb.c sourcefile;

 It's one of the thing that I want to have it in our ppb.c.
I'd like to add PCI(e) hot-plug stuff because of nvme(4)
hot-plug. Reasons why I've not doing the work yet are that
I'm now working another job(fixing bugs in ixg(4) and wm(4))
and I'm not familiar with resource allocation near here :-(

I  write also to the list, to let the
community know these updates.
OpenBSD code is based upon the following members of the
`struct pci_attach_args':

struct extent	*pa_ioex;
struct extent	*pa_memex;

They must be added to the NetBSD code, and then correctly handled.
The extent(9) manpages both in NetBSD and in OpenBSDare both too
much concise. These pages

https://www.netbsd.org/docs/internals/en/
https://www.netbsd.org/docs/kernel/

don't mention nor pci neither extents.
So, a couple of questions:

1) What are the extent(9) used for? They were born in NetBSD (as it
is even stated in the OpenBSD manpage). After a quick discussion on
#netbsd-code with coypu, they seem to be related to address spaces.
If there is some guide like this one

http://www.unixag-kl.fh-kl.de/~jkunz/projekte/NetBSD-driver_writing-1.0.1e.pdf.gz

but for extents(9) and memory, please let me know.

2) About these lines (that are both in NetBSD and in OpenBSD):

static int
ppbmatch(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa = aux;


driver(9) explicitly states that "The match function would
type-cast the aux argument to its appropriate attachment structure and
use its contents to determine whether it supports the device". But who
initially fills the `aux' data? Whoever he is, he should then take
care about some new members, like `pa_ioex' and `pa_memex'.

Thank you for having read,

Rocky

 To configure ppb's address decoding, some of the code in
sys/dev/pci/pciconf.c can be used. Basically, to use pciconf.c,
"options PCI_NETBSD_CONFIGURE" is required and it's used for
machines that IPL or boot loader of embedded machine doesn't
initialize PCI bus stuff. Perhaps PCI_NETBSD_CONFIGURE is not
intended to use on x86, so some function might be moved outside
of #ifdef PCI_NETBSD_CONFIGURE. I think it's worth for you to
read sys/dev/pci/pciconf.c

 BTW,

	http://mail-index.netbsd.org/netbsd-users/2017/02/01/msg019280.html

pci2 at ppb1 bus 2
pci2: i/o space, memory space enabled, rd/line, wr/inv ok
iwn0 at pci2 dev 0 function 0: vendor 0x8086 product 0x4232 (rev. 0x00)
: can't map mem space
ppb2 at pci0 dev 28 function 1: vendor 0x8086 product 0x2942 (rev. 0x03)
ppb2: PCI Express capability version 1 <Root Port of PCI-E Root Complex> x1 @ 2.5GT/s


Did you check the PCI config area of ppb"1" on your machine?
iwn0 is under ppb1.

Could you show me the output of "pcictl pciN dump" of your ppb1?

And, If you are OK, could you me the full output of pcictl
using with the following script?

	http://www.netbsd.org/~msaitoh/pcidump

(Note that the output is huge, so please don't send the output to
the ML. Could you put it somewhere and give us the link?)

 Regards.

--
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index