| @@ -1,64 +1,75 @@ | | | @@ -1,64 +1,75 @@ |
1 | /* $NetBSD: bonitoreg.h,v 1.6 2005/12/24 20:07:19 perry Exp $ */ | | 1 | /* $NetBSD: bonitoreg.h,v 1.7 2011/08/27 12:59:17 bouyer Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Bonito Register Map | | 4 | * Bonito Register Map |
5 | * Copyright (c) 1999 Algorithmics Ltd | | 5 | * Copyright (c) 1999 Algorithmics Ltd |
6 | * | | 6 | * |
7 | * Algorithmics gives permission for anyone to use and modify this file | | 7 | * Algorithmics gives permission for anyone to use and modify this file |
8 | * without any obligation or license condition except that you retain | | 8 | * without any obligation or license condition except that you retain |
9 | * this copyright message in any source redistribution in whole or part. | | 9 | * this copyright message in any source redistribution in whole or part. |
10 | * | | 10 | * |
11 | * Updated copies of this and other files can be found at | | 11 | * Updated copies of this and other files can be found at |
12 | * ftp://ftp.algor.co.uk/pub/bonito/ | | 12 | * ftp://ftp.algor.co.uk/pub/bonito/ |
13 | * | | 13 | * |
14 | * Users of the Bonito controller are warmly recommended to contribute | | 14 | * Users of the Bonito controller are warmly recommended to contribute |
15 | * any useful changes back to Algorithmics (mail to | | 15 | * any useful changes back to Algorithmics (mail to |
16 | * bonito@algor.co.uk). | | 16 | * bonito@algor.co.uk). |
17 | */ | | 17 | */ |
18 | | | 18 | |
19 | /* Revision 1.48 autogenerated on 08/17/99 15:20:01 */ | | 19 | /* Revision 1.48 autogenerated on 08/17/99 15:20:01 */ |
20 | | | 20 | |
21 | #ifndef _BONITO_H_ | | 21 | #ifndef _BONITO_H_ |
22 | | | 22 | |
23 | #define BONITO(x) (BONITO_REG_BASE + (x)) | | 23 | #define BONITO(x) (BONITO_REG_BASE + (x)) |
24 | | | 24 | |
| | | 25 | |
| | | 26 | #ifdef _LP64 |
| | | 27 | #define REGVAL(x) *((volatile u_int32_t *)MIPS_PHYS_TO_XKPHYS_UNCACHED(x)) |
| | | 28 | #define REGVAL8(x) *((volatile u_int8_t *)MIPS_PHYS_TO_XKPHYS_UNCACHED(x)) |
| | | 29 | #else |
25 | #define REGVAL(x) *((volatile u_int32_t *) MIPS_PHYS_TO_KSEG1(x)) | | 30 | #define REGVAL(x) *((volatile u_int32_t *) MIPS_PHYS_TO_KSEG1(x)) |
| | | 31 | #define REGVAL8(x) *((volatile u_int8_t *)MIPS_PHYS_TO_KSEG1(x)) |
| | | 32 | #endif |
26 | | | 33 | |
27 | #define BONITO_BOOT_BASE 0x1fc00000 | | 34 | #define BONITO_BOOT_BASE 0x1fc00000 |
28 | #define BONITO_BOOT_SIZE 0x00100000 | | 35 | #define BONITO_BOOT_SIZE 0x00100000 |
29 | #define BONITO_BOOT_TOP (BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1) | | 36 | #define BONITO_BOOT_TOP (BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1) |
30 | #define BONITO_FLASH_BASE 0x1c000000 | | 37 | #define BONITO_FLASH_BASE 0x1c000000 |
31 | #define BONITO_FLASH_SIZE 0x03000000 | | 38 | #define BONITO_FLASH_SIZE 0x03000000 |
32 | #define BONITO_FLASH_TOP (BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1) | | 39 | #define BONITO_FLASH_TOP (BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1) |
33 | #define BONITO_SOCKET_BASE 0x1f800000 | | 40 | #define BONITO_SOCKET_BASE 0x1f800000 |
34 | #define BONITO_SOCKET_SIZE 0x00400000 | | 41 | #define BONITO_SOCKET_SIZE 0x00400000 |
35 | #define BONITO_SOCKET_TOP (BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1) | | 42 | #define BONITO_SOCKET_TOP (BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1) |
36 | #define BONITO_REG_BASE 0x1fe00000 | | 43 | #define BONITO_REG_BASE 0x1fe00000 |
37 | #define BONITO_REG_SIZE 0x00040000 | | 44 | #define BONITO_REG_SIZE 0x00040000 |
38 | #define BONITO_REG_TOP (BONITO_REG_BASE+BONITO_REG_SIZE-1) | | 45 | #define BONITO_REG_TOP (BONITO_REG_BASE+BONITO_REG_SIZE-1) |
39 | #define BONITO_DEV_BASE 0x1ff00000 | | 46 | #define BONITO_DEV_BASE 0x1ff00000 |
40 | #define BONITO_DEV_SIZE 0x00100000 | | 47 | #define BONITO_DEV_SIZE 0x00100000 |
41 | #define BONITO_DEV_TOP (BONITO_DEV_BASE+BONITO_DEV_SIZE-1) | | 48 | #define BONITO_DEV_TOP (BONITO_DEV_BASE+BONITO_DEV_SIZE-1) |
42 | #define BONITO_PCILO_BASE 0x10000000 | | 49 | #define BONITO_PCILO_BASE 0x10000000 |
43 | #define BONITO_PCILO_SIZE 0x0c000000 | | 50 | #define BONITO_PCILO_SIZE 0x0c000000 |
44 | #define BONITO_PCILO_TOP (BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1) | | 51 | #define BONITO_PCILO_TOP (BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1) |
45 | #define BONITO_PCILO0_BASE 0x10000000 | | 52 | #define BONITO_PCILO0_BASE 0x10000000 |
46 | #define BONITO_PCILO1_BASE 0x14000000 | | 53 | #define BONITO_PCILO1_BASE 0x14000000 |
47 | #define BONITO_PCILO2_BASE 0x18000000 | | 54 | #define BONITO_PCILO2_BASE 0x18000000 |
48 | #define BONITO_PCIHI_BASE 0x20000000 | | 55 | #define BONITO_PCIHI_BASE 0x20000000 |
49 | #define BONITO_PCIHI_SIZE 0x20000000 | | 56 | #define BONITO_PCIHI_SIZE 0x20000000 |
50 | #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1) | | 57 | #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1) |
| | | 58 | #define LS2F_PCIHI_BASE 0x40000000UL |
| | | 59 | #define LS2F_PCIHI_SIZE 0x40000000UL |
| | | 60 | #define LS2F_PCIHI_TOP (LS2F_PCIHI_BASE+LS2F_PCIHI_SIZE-1) |
51 | #define BONITO_PCIIO_BASE 0x1fd00000 | | 61 | #define BONITO_PCIIO_BASE 0x1fd00000 |
| | | 62 | #define BONITO_PCIIO_LEGACY 0x00004000UL |
52 | #define BONITO_PCIIO_SIZE 0x00100000 | | 63 | #define BONITO_PCIIO_SIZE 0x00100000 |
53 | #define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1) | | 64 | #define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1) |
54 | #define BONITO_PCICFG_BASE 0x1fe80000 | | 65 | #define BONITO_PCICFG_BASE 0x1fe80000 |
55 | #define BONITO_PCICFG_SIZE 0x00080000 | | 66 | #define BONITO_PCICFG_SIZE 0x00080000 |
56 | #define BONITO_PCICFG_TOP (BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1) | | 67 | #define BONITO_PCICFG_TOP (BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1) |
57 | | | 68 | |
58 | | | 69 | |
59 | /* Bonito Register Bases */ | | 70 | /* Bonito Register Bases */ |
60 | | | 71 | |
61 | #define BONITO_PCICONFIGBASE 0x00 | | 72 | #define BONITO_PCICONFIGBASE 0x00 |
62 | #define BONITO_REGBASE 0x100 | | 73 | #define BONITO_REGBASE 0x100 |
63 | | | 74 | |
64 | | | 75 | |
| @@ -399,14 +410,115 @@ | | | @@ -399,14 +410,115 @@ |
399 | (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN,CFG)) \ | | 410 | (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN,CFG)) \ |
400 | ) | | 411 | ) |
401 | /* PCIMAP Cfg */ | | 412 | /* PCIMAP Cfg */ |
402 | | | 413 | |
403 | #define BONITO_PCIMAPCFG_TYPE1 0x00010000 | | 414 | #define BONITO_PCIMAPCFG_TYPE1 0x00010000 |
404 | | | 415 | |
405 | /* PCICmd */ | | 416 | /* PCICmd */ |
406 | | | 417 | |
407 | #define BONITO_PCICMD_MEMEN 0x00000002 | | 418 | #define BONITO_PCICMD_MEMEN 0x00000002 |
408 | #define BONITO_PCICMD_MSTREN 0x00000004 | | 419 | #define BONITO_PCICMD_MSTREN 0x00000004 |
409 | | | 420 | |
410 | | | 421 | |
411 | #define BONITO_TIMERCFG BONITO(BONITO_REGBASE + 0x60) | | 422 | #define BONITO_TIMERCFG BONITO(BONITO_REGBASE + 0x60) |
| | | 423 | |
| | | 424 | /* |
| | | 425 | * Bonito interrupt assignments |
| | | 426 | */ |
| | | 427 | |
| | | 428 | /* |
| | | 429 | * Loongson 2F assignments |
| | | 430 | */ |
| | | 431 | |
| | | 432 | #define LOONGSON_INTR_GPIO0 0 |
| | | 433 | #define LOONGSON_INTR_GPIO1 1 |
| | | 434 | #define LOONGSON_INTR_GPIO2 2 |
| | | 435 | #define LOONGSON_INTR_GPIO3 3 |
| | | 436 | |
| | | 437 | /* pci interrupts */ |
| | | 438 | #define LOONGSON_INTR_PCIA 4 |
| | | 439 | #define LOONGSON_INTR_PCIB 5 |
| | | 440 | #define LOONGSON_INTR_PCIC 6 |
| | | 441 | #define LOONGSON_INTR_PCID 7 |
| | | 442 | |
| | | 443 | #define LOONGSON_INTR_PCI_PARERR 8 |
| | | 444 | #define LOONGSON_INTR_PCI_SYSERR 9 |
| | | 445 | #define LOONGSON_INTR_DRAM_PARERR 10 |
| | | 446 | |
| | | 447 | /* non-PCI interrupts */ |
| | | 448 | #define LOONGSON_INTR_INT0 11 |
| | | 449 | #define LOONGSON_INTR_INT1 12 |
| | | 450 | #define LOONGSON_INTR_INT2 13 |
| | | 451 | #define LOONGSON_INTR_INT3 14 |
| | | 452 | |
| | | 453 | #define LOONGSON_INTRMASK_GPIO0 0x00000001 /* can't interrupt */ |
| | | 454 | #define LOONGSON_INTRMASK_GPIO1 0x00000002 |
| | | 455 | #define LOONGSON_INTRMASK_GPIO2 0x00000004 |
| | | 456 | #define LOONGSON_INTRMASK_GPIO3 0x00000008 |
| | | 457 | |
| | | 458 | #define LOONGSON_INTRMASK_GPIO 0x0000000f |
| | | 459 | |
| | | 460 | /* pci interrupts */ |
| | | 461 | #define LOONGSON_INTRMASK_PCIA 0x00000010 |
| | | 462 | #define LOONGSON_INTRMASK_PCIB 0x00000020 |
| | | 463 | #define LOONGSON_INTRMASK_PCIC 0x00000040 |
| | | 464 | #define LOONGSON_INTRMASK_PCID 0x00000080 |
| | | 465 | |
| | | 466 | #define LOONGSON_INTRMASK_PCI_PARERR 0x00000100 |
| | | 467 | #define LOONGSON_INTRMASK_PCI_SYSERR 0x00000200 |
| | | 468 | #define LOONGSON_INTRMASK_DRAM_PARERR 0x00000400 |
| | | 469 | |
| | | 470 | /* non-PCI interrupts */ |
| | | 471 | #define LOONGSON_INTRMASK_INT0 0x00000800 |
| | | 472 | #define LOONGSON_INTRMASK_INT1 0x00001000 |
| | | 473 | #define LOONGSON_INTRMASK_INT2 0x00002000 |
| | | 474 | #define LOONGSON_INTRMASK_INT3 0x00004000 |
| | | 475 | |
| | | 476 | #define LOONGSON_INTRMASK_LVL0 0x00007800 /* not maskable in bonito */ |
| | | 477 | #define LOONGSON_INTRMASK_LVL4 0x000007ff |
| | | 478 | |
| | | 479 | /* |
| | | 480 | * Loongson 2E (Bonito64) assignments |
| | | 481 | */ |
| | | 482 | |
| | | 483 | #define BONITO_INTRMASK_MBOX 0x0000000f |
| | | 484 | #define BONITO_INTR_MBOX 0 |
| | | 485 | #define BONITO_INTRMASK_DMARDY 0x00000010 |
| | | 486 | #define BONITO_INTRMASK_DMAEMPTY 0x00000020 |
| | | 487 | #define BONITO_INTRMASK_COPYRDY 0x00000040 |
| | | 488 | #define BONITO_INTRMASK_COPYEMPTY 0x00000080 |
| | | 489 | #define BONITO_INTRMASK_COPYERR 0x00000100 |
| | | 490 | #define BONITO_INTRMASK_PCIIRQ 0x00000200 |
| | | 491 | #define BONITO_INTRMASK_MASTERERR 0x00000400 |
| | | 492 | #define BONITO_INTRMASK_SYSTEMERR 0x00000800 |
| | | 493 | #define BONITO_INTRMASK_DRAMPERR 0x00001000 |
| | | 494 | #define BONITO_INTRMASK_RETRYERR 0x00002000 |
| | | 495 | #define BONITO_INTRMASK_GPIO 0x01ff0000 |
| | | 496 | #define BONITO_INTR_GPIO 16 |
| | | 497 | #define BONITO_INTRMASK_GPIN 0x7e000000 |
| | | 498 | #define BONITO_INTR_GPIN 25 |
| | | 499 | |
| | | 500 | /* |
| | | 501 | * Bonito interrupt handling recipes: |
| | | 502 | * - we have up to 32 interrupts at the Bonito level. |
| | | 503 | * - systems with ISA devices also have 16 (well, 15) ISA interrupts with the |
| | | 504 | * usual 8259 pair. Bonito and ISA interrupts happen on two different levels. |
| | | 505 | * |
| | | 506 | * These arbitrary values may be changed as long as interrupt mask variables |
| | | 507 | * use large enough integer types and always use the following macros to |
| | | 508 | * handle interrupt masks. |
| | | 509 | */ |
| | | 510 | |
| | | 511 | #define INTPRI_BONITO (INTPRI_CLOCK + 1) |
| | | 512 | #define INTPRI_ISA (INTPRI_BONITO + 1) |
| | | 513 | |
| | | 514 | #define BONITO_NDIRECT 32 |
| | | 515 | #define BONITO_NISA 16 |
| | | 516 | #define BONITO_NINTS (BONITO_NDIRECT + BONITO_NISA) |
| | | 517 | #define BONITO_ISA_IRQ(i) ((i) + BONITO_NDIRECT) |
| | | 518 | #define BONITO_DIRECT_IRQ(i) (i) |
| | | 519 | #define BONITO_IRQ_IS_ISA(i) ((i) >= BONITO_NDIRECT) |
| | | 520 | #define BONITO_IRQ_TO_ISA(i) ((i) - BONITO_NDIRECT) |
| | | 521 | |
| | | 522 | #define BONITO_DIRECT_MASK(imask) ((imask) & ((1L << BONITO_NDIRECT) - 1)) |
| | | 523 | #define BONITO_ISA_MASK(imask) ((imask) >> BONITO_NDIRECT) |
412 | #endif /* _BONITO_H_ */ | | 524 | #endif /* _BONITO_H_ */ |