"Dunlap, Randy" <[EMAIL PROTECTED]> writes:

> A few weeks ago, on the "alpha and USB" thread with
> Richard Henderson, I saw this and asked Richard about

Hm, I seem to have missed that thread - which list is it on?

> They're both correct, given appropriate context.  The first
> is the PCI bus address that the device lives at.  The second
> is the ioremap'ed address that the CPU should use to talk to
> the device.

For future reference, and to expound on my calculation below
(hopefully someone will correct me if I'm wrong):

> > > 0xfffffd0009000000 = IDENT_ADDR + TS_BIAS + HOSE(0) + 0x9000000
(actually this is just TSUNAMI_MEM(), taken from
include/asm-alpha/core_tsunami.h)

All currently released alphas, when running with Unix PALcode, have
an 8k page size, a 43-bit virtual address (vasize), and a 41-bit
physical address(pasize).

Physical memory on Alpha is divided into four segments, which are
selected by the two most significant bits of a physical address,
i.e. bits 39 and 40.  Actually, this tends to get split into two
segments (00-01 and 10-11), the first being memory space and the
second being "non-memory-like" (i.e. I/O) space.

TS_BIAS is where the I/O space starts on the Tsunami chipset (DECchip
21272 - used in most EV6 machines).  From reading
include/asm-alpha/core_tsunami.h, it appears that it is actually
physical segment 10, or 0x10000000000 (2 << pasize - 2).

Virtual memory on Alpha with Unix PALcode is divided into three
segments, which are selected by the two most significant bits of the
virtual address (sign-extended to 64 bits).  Segments 00/01 (SEG0 -
user space) or 11 (SEG1 - kernel virtual memory, i.e. what vmalloc()
returns) use address translation via a 3 or 4-level page table (we use
3-level page tables at the moment), while segment 10 (KSEG) maps all
of physical memory read/write in kernel mode (VMS has four levels of
priviledge, Unix only has two).

So to get a KSEG virtual address (which is presumably what ioremap()
returns), you take the sum of the physical address and SEXT(2 <<
vasize-2), i.e. IDENT_ADDR, which is defined as 0xfffffc0000000000 for
43-bit virtual addressing.

Most recent Alphas have multiple PCI address spaces, called "hoses".
In the machine types I've glanced at so far, bits 33 and 34 of the
physical address select the hose.  On the DS10, the USB controller
lives in hose 0 (actually there is only one hose on the DS10).

So, to put this all together:

  Virtual segment 10 (KSEG) = ffff fc00 0000 0000 (2 << vasize-2) (IDENT_ADDR)
  Physical segment 10       =       100 0000 0000 (2 << pasize-2) (TS_BIAS)
  Hose 0                    =         0 0000 0000 (0 << 33) (HOSE(0))
  PCI address 0x9000000     =            900 0000

                            = ffff fd00 0900 0000

Hope that makes more sense :)

Anyhow, all I know about the hang so far is that if I remove USB
support from the kernel, it boots fine.  I'll grab the patch for the
IRQ stuff, #define DEBUG and send the output tonight...

-- 
David Huggins-Daines, Senior Linux Consultant, Linuxcare, Inc.
613.562.1239 desk, 613.223.0225 mobile
[EMAIL PROTECTED], http://www.linuxcare.com/
Linuxcare. Support for the revolution.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to