Re: Kernel Driver Question

2015-08-21 Thread Miod Vallat
 is 'bus_dma'
 http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man9/bus_dma.9
 the equivalent of  'ioremap/ioread32'
 http://www.makelinux.net/ldd3/chp-9-sect-4--
 ?

I don't think so.

It looks like you are attempting to port a PCI driver, and attempting to
access the device's register.

PCI device regions in memory and I/O space are made available to the
kernel with pci_mapreg_map(), which gives you a bus_space_handle_t
suitable for use with thi bus_space(9) API. This would be a sugar-coated
equivalent of ioremap().

From then on, bus_space_read_(N/8) will match ioreadN() calls.



Re: Kernel Driver Question

2015-08-21 Thread Mike Larkin
On Fri, Aug 21, 2015 at 01:29:20PM -0400, sven falempin wrote:
 Dear Readers,
 
 is 'bus_dma'
 http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man9/bus_dma.9
 the equivalent of  'ioremap/ioread32'
 http://www.makelinux.net/ldd3/chp-9-sect-4--
 ?
 
 trying to port a driver : watchdog/sp5100_tco.c, wondering the openbsd
 equivalent of readl :
 if (sp5100_tco_pci-revision = 0x40) {
 /* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */
 outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG);
 [..bus space map equivalent..]
 } else {
 [...]
 /* Check MMIO address conflict */
 if (request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
   dev_name)) {
 [...]
 tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE);
 [...]
 /* Check that the watchdog action is set to reset the system */
 [..ioread32 old school form..]
 val = readl(SP5100_WDT_CONTROL(tcobase));
 
 
 Best regards,
 

no context here, but you're probably looking for something like
bus_space_read_4

-ml



Kernel Driver Question

2015-08-21 Thread sven falempin
Dear Readers,

is 'bus_dma'
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man9/bus_dma.9
the equivalent of  'ioremap/ioread32'
http://www.makelinux.net/ldd3/chp-9-sect-4--
?

trying to port a driver : watchdog/sp5100_tco.c, wondering the openbsd
equivalent of readl :
if (sp5100_tco_pci-revision = 0x40) {
/* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */
outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG);
[..bus space map equivalent..]
} else {
[...]
/* Check MMIO address conflict */
if (request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
  dev_name)) {
[...]
tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE);
[...]
/* Check that the watchdog action is set to reset the system */
[..ioread32 old school form..]
val = readl(SP5100_WDT_CONTROL(tcobase));


Best regards,



Re: Kernel Driver Question

2015-08-21 Thread sven falempin
On Fri, Aug 21, 2015 at 3:30 PM, Miod Vallat m...@online.fr wrote:
 is 'bus_dma'
 http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man9/bus_dma.9
 the equivalent of  'ioremap/ioread32'
 http://www.makelinux.net/ldd3/chp-9-sect-4--
 ?

 I don't think so.

 It looks like you are attempting to port a PCI driver, and attempting to
 access the device's register.

 PCI device regions in memory and I/O space are made available to the
 kernel with pci_mapreg_map(), which gives you a bus_space_handle_t
 suitable for use with thi bus_space(9) API. This would be a sugar-coated
 equivalent of ioremap().

 From then on, bus_space_read_(N/8) will match ioreadN() calls.


Thank you :-)  I figure it was not dma by grep the call of those everywhere,
still need to understand the mapping.

(
working on the AMD Bobcat WDT actually, i have the base adress trough
bus space map :
in acpi 0xFED0  and the then doc say go to 00b0 but i do not
understand where this address makes sense,
and how to write in it
)

-- 
-
() ascii ribbon campaign - against html e-mail
/\