On Sat, 23 Sep 2000 fh...@at... wrote:
> Anyone care to comment on any of this?
>
> The first address is the physical address of the 53c770 SCSI. This should
> be correct. I got the address from Ralph Schmidt.
>
> paddr: f40000
>
> When the ioremap_nocache is run using the physical address
> the virtual address comes out to be this:
>
> vaddr: 80f40000
>
> The np->reg variable is set to the virtual address and uses
> that address to access the chip registers.
OK.
> How is the kernel using this virtual address to translate
> to the physical address required to access the chip registers?
The kernel uses the MMU to map the virtual addresses. So if you access virtual
0x80f40000, the CPU will really access physical 0xf40000.
(BTW, since 0xf40000 is in Zorro II space (< 16 MB), you don't really have to
use ioremap(), but could live with ZTWO_VADDR() and ZTWO_PADDR() to convert
from physical to virtual and vice versa).
> should I be using virt_to_phys() to access all SCSI chip
> registers?
No.
But you have to use virt_to_phys() (or ZTWO_VADDR(), for Zorro II addresses)
to translate addresses for the DMA engine of the SCSI chip.
In the kernel, the CPU needs the virtual address of the buffer in RAM, while
the DMA engine needs the bus address of the buffer in RAM. I assume bus
address == physical address, which is probably the case.
In reality we have:
- virtual address: view from the CPU in kernel mode, before translation by
the MMU)
- physical address: view from the CPU after translation by the MMU
- bus address: view from the DMA engine in the SCSI chip
Another example: the Ariadne Ethernet card, which sends/receives Ethernet
packets using buffers in the RAM on the card.
In my box, the Ariadne is at 0xe90000 (physical). Since this is in Zorro II
space, the virtual address of the card is 0x80e90000. The RAM on the card
starts at offset 0x8000. So if I have a packet buffer at offset 0x400 inside
the RAM, the following is valid:
- The CPU in kernel mode accesses the packet at virtual address 0x80e98400
- The physical address of the packet is 0xe98400
- The Ethernet chip sees all addresses relative to the start of the RAM on
the card, so it has to be told the packet is at bus address 0x400
> There is no such thing as an I/O port (at least in the PC
> sense) on the Amiga?
No.
> Someone told me on a linux news group to use check_mem_region()
> /request_mem_region() instead of check_region()/request_region() in the
> driver, although it appears that the latter functions are again aimed
> toward the PC style hardware that has I/O ports. What does those
> functions do on APUS, if anything? Also, the "mem" versions of those
> functions are not in the 2.2.10 kernel I have been using. Are they new in
> the 2.3/2.4 kernels?
request_mem_region() is used to mark regions in memory space busy. After that
they show up in /proc/iomem. This is indeed something introduced in 2.3.x.
For now you shouldn't care about that. request_mem_region() is not vital to
get the driver working.
Good luck!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@li...
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
|