Hi all,

I'm very new to driver programming, so please bear with me. :)
 

I've read through the Solaris 'Writing Device Drivers' book (can't
find BSD equivalent that is as detailed.) And I think I have a pretty
good grasp of the solaris side of things. But I'm trying to port a
driver from BSD (I have both FreeBSD and OpenBSD versions) to Solaris,
and there are some things I'm having trouble mapping from one to the
other.

My first question is mainly a solaris question:

When trying to do pci_config_get16(instp->pci_acc_handle,
PCI_CONF_VENID) is pci_config_setup( devinfop,
&(instp->pci_acc_handle)) absolutely required? or can a
ddi_acc_handle_t from

ddi_regs_map_setup(devinfop, 1, (caddr_t *)&softs->pci_mem_base_vaddr, 0,
        softs->min_size, &softs->reg_attr, &softs->pci_acc_handle)

usable for this? can the latter be used with pci_config_get*()? or
only with ddi_get*()? If the latter, can 'PCI_CONF_VENID' still be
passed to ddi_get16()?

Is there an advantage of one over the other?

Second question:

Any advice on mapping BSD bus_dma*() functions to Solaris operations?

In particular, how can I determine the correct values for the Solaris
ddi_dma_attr structure? I don't have any documentation for the device.

I do see calls like this in the FreeBSD code, but nothing similiar in
OpenBSD:

bus_dma_tag_create( /* parent    */    NULL,
                    /* alignemnt */    1,
                    /* boundary  */    0,
                    /* lowaddr   */    BUS_SPACE_MAXADDR_32BIT,
//0xFFFFFFFF
                    /* highaddr  */    BUS_SPACE_MAXADDR,     
//0xFFFFFFFF
                    /* filter    */    NULL,
                    /* filterarg */    NULL,
                    /* maxsize   */    BUS_SPACE_MAXSIZE_32BIT,
                    /* numsegs   */    MAX_SG_ELEMENTS,
                    /* maxsegsize*/    BUS_SPACE_MAXSIZE_32BIT,
                    /* flags     */    0,
                    /* lockfunc  */    NULL,
                    /* lockarg   */    NULL,
                    &sc->command_dmatag)

This seems to give some of the values (Solaris's _align, _addr_lo,
_addr_hi, _sgllen and _maxxfer) but I'm not sure the values can be
used verbatim - How can lowaddr be the same as the highaddr?

I have defines for MAX_XFER (64k) that seem to disagree with the
maxsize above, and the 2 BSD drivers have different values (16 vs. 32)
for the MAX_SG_ELEMENTS above.

Also I don't see likely values for solaris's _burstsizes, _minxfer,
_seg (boundary above?), _granular, or _flags and is _count_max the
same as numsegs above? - I doubt it.

Is it possible to pick safe values for these fields without the device
docs?
Are there Solaris equivalents of the generic BSD BUS_SPACE_* defines?

Thanks in advance for any advice/help you can offer!

  -Kyle


_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to