Subject: Some questions about PCI implementations
To: tech-kern@NetBSD.ORG <tech-kern@NetBSD.ORG>
From: Dante Profeta <firstname.lastname@example.org>
Date: 06/10/1998 21:55:18
This is my first attempt to try porting a driver from Linux
(manufacturer source) / FreeBSD (Justin T. Gibbs work) to NetBSD.
The driver is for and AdvanSys SCSI-U board I bought.
I have no experience in such a job so any suggestions, flames, are
I think the first step is to dial with the PCI bus, so at this time I'm
studing the software PCI implementation starting from the source code (I
didn't find any docs on the NetBSD site).
I saw there are two main functions in sys/dev/pci/ahc_pci.c etc.. named
xxx_probe and xxx_attach.
The first one is clear to me: it looks for the adapter.
The second one I guess is used to link the sw layer with the hw layer.
But a more clear definition would be appreciated.
It would be helpfull if you could point me to some reference document,
This card seems to does not allow memory mapped access, so I think I
cannot use the pci_mapreg_map() function (a good synopsys for all the
pci i/o layer functions would be helpfull too).
The FreeBSD Justin's code perform these actions:
id = pci_conf_read(config_id, PCI_ID_REG);
command = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
if ((command & (PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MASTER_ENABLE))
command |= PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MASTER_ENABLE;
pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, command);
I think the first line (id=...) is usless because I can find this id
into the aux (pci_attach_args) structure.
I think the second and third lines are usefull to enable the IO ports of
the boards... but... while under freebsd the config_id var is a
parameter to the attach function, under netbsd where can I get the
Please don't esitate to give me any kind of suggestions - flames you
can... maybe I'm not the right one to do this porting... but I will try,
if I may.
Thank you very much