Tons of enchancements to MD PCI code: - The G-REX 4000 and G-REX 1200 are now really supported and working (still only 1st slot but the rest are a matter of time). - Add bridge identification to p5pb, simplifies the driver and make it more user-friendly. - Retire P5PB_GENFB and P5PB_OLD_FIRMWARE options, these are now handled automatically, depending on used hardware and firmware. - Add PCI bus reconfiguration support to p5pb (PCI_NETBSD_CONFIGURE), allows using G-REX without boot to AmigaOS. - Bring p5pb registers desription up to date with my knowledge. - Add a lot of debugging code to p5pb (enabled by P5PB_DEBUG kernel option). - Fix PCI_NETBSD_CONFIGURE in mppb (now it really works). - Fix quirk handling in zbus. - Update GENERIC.in and regen the kernel configs. - Misc cleanup.diff -r1.150 -r1.151 src/sys/arch/amiga/conf/DRACO
(rkujawa)
--- src/sys/arch/amiga/conf/DRACO 2012/01/11 17:04:29 1.150
+++ src/sys/arch/amiga/conf/DRACO 2012/01/19 00:14:08 1.151
@@ -1,45 +1,45 @@ | @@ -1,45 +1,45 @@ | |||
1 | # $NetBSD: DRACO,v 1.150 2012/01/11 17:04:29 rkujawa Exp $ | 1 | # $NetBSD: DRACO,v 1.151 2012/01/19 00:14:08 rkujawa Exp $ | |
2 | # | 2 | # | |
3 | # This file was automatically created. | 3 | # This file was automatically created. | |
4 | # Changes will be lost when make is run in this directory. | 4 | # Changes will be lost when make is run in this directory. | |
5 | # | 5 | # | |
6 | # Created from: # NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $ | 6 | # Created from: # NetBSD: GENERIC.in,v 1.92 2012/01/11 17:04:29 rkujawa Exp $ | |
7 | # | 7 | # | |
8 | ## | 8 | ## | |
9 | # GENERIC machine description file | 9 | # GENERIC machine description file | |
10 | # | 10 | # | |
11 | # This machine description file is used to generate the default NetBSD | 11 | # This machine description file is used to generate the default NetBSD | |
12 | # kernel. The generic kernel does not include all options, subsystems | 12 | # kernel. The generic kernel does not include all options, subsystems | |
13 | # and device drivers, but should be useful for most applications. | 13 | # and device drivers, but should be useful for most applications. | |
14 | # | 14 | # | |
15 | # The machine description file can be customised for your specific | 15 | # The machine description file can be customised for your specific | |
16 | # machine to reduce the kernel size and improve its performance. | 16 | # machine to reduce the kernel size and improve its performance. | |
17 | # | 17 | # | |
18 | # For further information on compiling NetBSD kernels, see the config(8) | 18 | # For further information on compiling NetBSD kernels, see the config(8) | |
19 | # man page. | 19 | # man page. | |
20 | # | 20 | # | |
21 | # For further information on hardware support for this architecture, see | 21 | # For further information on hardware support for this architecture, see | |
22 | # the intro(4) man page. For further information about kernel options | 22 | # the intro(4) man page. For further information about kernel options | |
23 | # for this architecture, see the options(4) man page. For an explanation | 23 | # for this architecture, see the options(4) man page. For an explanation | |
24 | # of each device driver in this file see the section 4 man page for the | 24 | # of each device driver in this file see the section 4 man page for the | |
25 | # device. | 25 | # device. | |
26 | 26 | |||
27 | 27 | |||
28 | include "arch/amiga/conf/std.amiga" | 28 | include "arch/amiga/conf/std.amiga" | |
29 | 29 | |||
30 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | 30 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | |
31 | 31 | |||
32 | #ident "GENERIC-$Revision: 1.150 $" | 32 | #ident "GENERIC-$Revision: 1.151 $" | |
33 | 33 | |||
34 | 34 | |||
35 | maxusers 8 | 35 | maxusers 8 | |
36 | options RTC_OFFSET=0 | 36 | options RTC_OFFSET=0 | |
37 | 37 | |||
38 | # | 38 | # | |
39 | # mainboards to support (in addition to Amiga) | 39 | # mainboards to support (in addition to Amiga) | |
40 | # | 40 | # | |
41 | options DRACO | 41 | options DRACO | |
42 | # | 42 | # | |
43 | # processors this kernel should support | 43 | # processors this kernel should support | |
44 | # | 44 | # | |
45 | options M68060 # support for 060 | 45 | options M68060 # support for 060 |
--- src/sys/arch/amiga/conf/GENERIC 2012/01/11 17:04:29 1.280
+++ src/sys/arch/amiga/conf/GENERIC 2012/01/19 00:14:08 1.281
@@ -1,45 +1,45 @@ | @@ -1,45 +1,45 @@ | |||
1 | # $NetBSD: GENERIC,v 1.280 2012/01/11 17:04:29 rkujawa Exp $ | 1 | # $NetBSD: GENERIC,v 1.281 2012/01/19 00:14:08 rkujawa Exp $ | |
2 | # | 2 | # | |
3 | # This file was automatically created. | 3 | # This file was automatically created. | |
4 | # Changes will be lost when make is run in this directory. | 4 | # Changes will be lost when make is run in this directory. | |
5 | # | 5 | # | |
6 | # Created from: # NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $ | 6 | # Created from: # NetBSD: GENERIC.in,v 1.92 2012/01/11 17:04:29 rkujawa Exp $ | |
7 | # | 7 | # | |
8 | ## | 8 | ## | |
9 | # GENERIC machine description file | 9 | # GENERIC machine description file | |
10 | # | 10 | # | |
11 | # This machine description file is used to generate the default NetBSD | 11 | # This machine description file is used to generate the default NetBSD | |
12 | # kernel. The generic kernel does not include all options, subsystems | 12 | # kernel. The generic kernel does not include all options, subsystems | |
13 | # and device drivers, but should be useful for most applications. | 13 | # and device drivers, but should be useful for most applications. | |
14 | # | 14 | # | |
15 | # The machine description file can be customised for your specific | 15 | # The machine description file can be customised for your specific | |
16 | # machine to reduce the kernel size and improve its performance. | 16 | # machine to reduce the kernel size and improve its performance. | |
17 | # | 17 | # | |
18 | # For further information on compiling NetBSD kernels, see the config(8) | 18 | # For further information on compiling NetBSD kernels, see the config(8) | |
19 | # man page. | 19 | # man page. | |
20 | # | 20 | # | |
21 | # For further information on hardware support for this architecture, see | 21 | # For further information on hardware support for this architecture, see | |
22 | # the intro(4) man page. For further information about kernel options | 22 | # the intro(4) man page. For further information about kernel options | |
23 | # for this architecture, see the options(4) man page. For an explanation | 23 | # for this architecture, see the options(4) man page. For an explanation | |
24 | # of each device driver in this file see the section 4 man page for the | 24 | # of each device driver in this file see the section 4 man page for the | |
25 | # device. | 25 | # device. | |
26 | 26 | |||
27 | 27 | |||
28 | include "arch/amiga/conf/std.amiga" | 28 | include "arch/amiga/conf/std.amiga" | |
29 | 29 | |||
30 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | 30 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | |
31 | 31 | |||
32 | #ident "GENERIC-$Revision: 1.280 $" | 32 | #ident "GENERIC-$Revision: 1.281 $" | |
33 | 33 | |||
34 | 34 | |||
35 | maxusers 8 | 35 | maxusers 8 | |
36 | options RTC_OFFSET=0 | 36 | options RTC_OFFSET=0 | |
37 | 37 | |||
38 | # | 38 | # | |
39 | # mainboards to support (in addition to Amiga) | 39 | # mainboards to support (in addition to Amiga) | |
40 | # | 40 | # | |
41 | options DRACO | 41 | options DRACO | |
42 | options BB060STUPIDROM # You need this, if you have a non-DraCo | 42 | options BB060STUPIDROM # You need this, if you have a non-DraCo | |
43 | # MC68060 with an OS ROM up to (at least) | 43 | # MC68060 with an OS ROM up to (at least) | |
44 | # V40 (OS3.1) and want to boot with the | 44 | # V40 (OS3.1) and want to boot with the | |
45 | # bootblock. | 45 | # bootblock. | |
@@ -460,32 +460,30 @@ scsibus* at drsc0 | @@ -460,32 +460,30 @@ scsibus* at drsc0 | |||
460 | 460 | |||
461 | # each hard drive from low target to high | 461 | # each hard drive from low target to high | |
462 | # will configure to the next available sd unit number | 462 | # will configure to the next available sd unit number | |
463 | sd* at scsibus? target ? lun ? # scsi disks | 463 | sd* at scsibus? target ? lun ? # scsi disks | |
464 | st* at scsibus? target ? lun ? # scsi tapes | 464 | st* at scsibus? target ? lun ? # scsi tapes | |
465 | cd* at scsibus? target ? lun ? # scsi cds | 465 | cd* at scsibus? target ? lun ? # scsi cds | |
466 | ch* at scsibus? target ? lun ? # scsi autochangers | 466 | ch* at scsibus? target ? lun ? # scsi autochangers | |
467 | ss* at scsibus? target ? lun ? # scsi scanner | 467 | ss* at scsibus? target ? lun ? # scsi scanner | |
468 | uk* at scsibus? target ? lun ? # scsi unknown | 468 | uk* at scsibus? target ? lun ? # scsi unknown | |
469 | 469 | |||
470 | # PCI bus support | 470 | # PCI bus support | |
471 | options PCIVERBOSE # verbose PCI device autoconfig messages | 471 | options PCIVERBOSE # verbose PCI device autoconfig messages | |
472 | #options PCI_CONFIG_DUMP | 472 | #options PCI_CONFIG_DUMP | |
473 | options PCI_NETBSD_CONFIGURE # used only by mppb(4) | 473 | options PCI_NETBSD_CONFIGURE # supported by mppb(4) and p5pb(4) | |
474 | 474 | |||
475 | p5pb0 at p5bus0 # Phase5 PCI bridge (CVPPC/BVPPC/G-REX) | 475 | p5pb0 at p5bus0 # Phase5 PCI bridge (CVPPC/BVPPC/G-REX) | |
476 | p5membar* at zbus0 # Phase5 PCI bridge autoconfiguring BARs | 476 | p5membar* at zbus0 # Phase5 PCI bridge autoconfiguring BARs | |
477 | #options P5PB_OLD_FIRMWARE # enable support for p5pb with old fw | |||
478 | #options P5PB_GENFB # enable genfb support for CVPPC/BVPPC | |||
479 | #options P5PB_DEBUG # enable excessive debug for p5pb | 477 | #options P5PB_DEBUG # enable excessive debug for p5pb | |
480 | pci* at p5pb0 | 478 | pci* at p5pb0 | |
481 | 479 | |||
482 | mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge | 480 | mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge | |
483 | pci* at mppb? | 481 | pci* at mppb? | |
484 | 482 | |||
485 | #cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge | 483 | #cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge | |
486 | 484 | |||
487 | #genfb* at pci? # generic fb, CVPPC/BVPPC only | 485 | #genfb* at pci? # generic fb, CVPPC/BVPPC only | |
488 | ne* at pci? # NE2000 Ethernet | 486 | ne* at pci? # NE2000 Ethernet | |
489 | 487 | |||
490 | # Bluetooth Controller and Device support | 488 | # Bluetooth Controller and Device support | |
491 | # tested only with btuart on an A1200 | 489 | # tested only with btuart on an A1200 |
--- src/sys/arch/amiga/conf/GENERIC.in 2012/01/11 17:04:29 1.92
+++ src/sys/arch/amiga/conf/GENERIC.in 2012/01/19 00:14:08 1.93
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: GENERIC.in,v 1.92 2012/01/11 17:04:29 rkujawa Exp $ | 1 | # $NetBSD: GENERIC.in,v 1.93 2012/01/19 00:14:08 rkujawa Exp $ | |
2 | # | 2 | # | |
3 | ## | 3 | ## | |
4 | # GENERIC machine description file | 4 | # GENERIC machine description file | |
5 | # | 5 | # | |
6 | # This machine description file is used to generate the default NetBSD | 6 | # This machine description file is used to generate the default NetBSD | |
7 | # kernel. The generic kernel does not include all options, subsystems | 7 | # kernel. The generic kernel does not include all options, subsystems | |
8 | # and device drivers, but should be useful for most applications. | 8 | # and device drivers, but should be useful for most applications. | |
9 | # | 9 | # | |
10 | # The machine description file can be customised for your specific | 10 | # The machine description file can be customised for your specific | |
11 | # machine to reduce the kernel size and improve its performance. | 11 | # machine to reduce the kernel size and improve its performance. | |
12 | # | 12 | # | |
13 | # For further information on compiling NetBSD kernels, see the config(8) | 13 | # For further information on compiling NetBSD kernels, see the config(8) | |
14 | # man page. | 14 | # man page. | |
@@ -42,27 +42,27 @@ m4_define(M4_Target`_CONFIGURATION', `') | @@ -42,27 +42,27 @@ m4_define(M4_Target`_CONFIGURATION', `') | |||
42 | m4_ifelse(M4_Target, `AMIGA', `', `m4_define(`DRACO_CONFIGURATION', `')') | 42 | m4_ifelse(M4_Target, `AMIGA', `', `m4_define(`DRACO_CONFIGURATION', `')') | |
43 | 43 | |||
44 | # If not building DRACO, set AMIGA_CONFIGURATION | 44 | # If not building DRACO, set AMIGA_CONFIGURATION | |
45 | # | 45 | # | |
46 | m4_ifelse(M4_Target, `DRACO', `', `m4_define(`AMIGA_CONFIGURATION', `')') | 46 | m4_ifelse(M4_Target, `DRACO', `', `m4_define(`AMIGA_CONFIGURATION', `')') | |
47 | 47 | |||
48 | 48 | |||
49 | m4_divert(0)m4_dnl | 49 | m4_divert(0)m4_dnl | |
50 | 50 | |||
51 | include "arch/amiga/conf/std.amiga" | 51 | include "arch/amiga/conf/std.amiga" | |
52 | 52 | |||
53 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | 53 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | |
54 | 54 | |||
55 | #ident "GENERIC-$Revision: 1.92 $" | 55 | #ident "GENERIC-$Revision: 1.93 $" | |
56 | 56 | |||
57 | m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl | 57 | m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl | |
58 | makeoptions COPTS="-Os" | 58 | makeoptions COPTS="-Os" | |
59 | ')m4_dnl | 59 | ')m4_dnl | |
60 | 60 | |||
61 | maxusers 8 | 61 | maxusers 8 | |
62 | options RTC_OFFSET=0 | 62 | options RTC_OFFSET=0 | |
63 | 63 | |||
64 | # | 64 | # | |
65 | # mainboards to support (in addition to Amiga) | 65 | # mainboards to support (in addition to Amiga) | |
66 | # | 66 | # | |
67 | m4_ifdef(`DRACO_CONFIGURATION', `m4_dnl | 67 | m4_ifdef(`DRACO_CONFIGURATION', `m4_dnl | |
68 | options DRACO | 68 | options DRACO | |
@@ -547,32 +547,30 @@ scsibus* at drsc0 | @@ -547,32 +547,30 @@ scsibus* at drsc0 | |||
547 | sd* at scsibus? target ? lun ? # scsi disks | 547 | sd* at scsibus? target ? lun ? # scsi disks | |
548 | st* at scsibus? target ? lun ? # scsi tapes | 548 | st* at scsibus? target ? lun ? # scsi tapes | |
549 | cd* at scsibus? target ? lun ? # scsi cds | 549 | cd* at scsibus? target ? lun ? # scsi cds | |
550 | ch* at scsibus? target ? lun ? # scsi autochangers | 550 | ch* at scsibus? target ? lun ? # scsi autochangers | |
551 | m4_ifdef(`INSTALL_CONFIGURATION', `', `m4_dnl | 551 | m4_ifdef(`INSTALL_CONFIGURATION', `', `m4_dnl | |
552 | ss* at scsibus? target ? lun ? # scsi scanner | 552 | ss* at scsibus? target ? lun ? # scsi scanner | |
553 | uk* at scsibus? target ? lun ? # scsi unknown | 553 | uk* at scsibus? target ? lun ? # scsi unknown | |
554 | ')m4_dnl | 554 | ')m4_dnl | |
555 | m4_ifdef(`AMIGA_CONFIGURATION', `m4_dnl | 555 | m4_ifdef(`AMIGA_CONFIGURATION', `m4_dnl | |
556 | 556 | |||
557 | # PCI bus support | 557 | # PCI bus support | |
558 | options PCIVERBOSE # verbose PCI device autoconfig messages | 558 | options PCIVERBOSE # verbose PCI device autoconfig messages | |
559 | #options PCI_CONFIG_DUMP | 559 | #options PCI_CONFIG_DUMP | |
560 | options PCI_NETBSD_CONFIGURE # used only by mppb(4) | 560 | options PCI_NETBSD_CONFIGURE # supported by mppb(4) and p5pb(4) | |
561 | 561 | |||
562 | p5pb0 at p5bus0 # Phase5 PCI bridge (CVPPC/BVPPC/G-REX) | 562 | p5pb0 at p5bus0 # Phase5 PCI bridge (CVPPC/BVPPC/G-REX) | |
563 | p5membar* at zbus0 # Phase5 PCI bridge autoconfiguring BARs | 563 | p5membar* at zbus0 # Phase5 PCI bridge autoconfiguring BARs | |
564 | #options P5PB_OLD_FIRMWARE # enable support for p5pb with old fw | |||
565 | #options P5PB_GENFB # enable genfb support for CVPPC/BVPPC | |||
566 | #options P5PB_DEBUG # enable excessive debug for p5pb | 564 | #options P5PB_DEBUG # enable excessive debug for p5pb | |
567 | pci* at p5pb0 | 565 | pci* at p5pb0 | |
568 | 566 | |||
569 | mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge | 567 | mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge | |
570 | pci* at mppb? | 568 | pci* at mppb? | |
571 | 569 | |||
572 | #cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge | 570 | #cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge | |
573 | 571 | |||
574 | #genfb* at pci? # generic fb, CVPPC/BVPPC only | 572 | #genfb* at pci? # generic fb, CVPPC/BVPPC only | |
575 | ne* at pci? # NE2000 Ethernet | 573 | ne* at pci? # NE2000 Ethernet | |
576 | 574 | |||
577 | # Bluetooth Controller and Device support | 575 | # Bluetooth Controller and Device support | |
578 | # tested only with btuart on an A1200 | 576 | # tested only with btuart on an A1200 |
--- src/sys/arch/amiga/conf/INSTALL 2012/01/11 17:04:29 1.102
+++ src/sys/arch/amiga/conf/INSTALL 2012/01/19 00:14:08 1.103
@@ -1,45 +1,45 @@ | @@ -1,45 +1,45 @@ | |||
1 | # $NetBSD: INSTALL,v 1.102 2012/01/11 17:04:29 rkujawa Exp $ | 1 | # $NetBSD: INSTALL,v 1.103 2012/01/19 00:14:08 rkujawa Exp $ | |
2 | # | 2 | # | |
3 | # This file was automatically created. | 3 | # This file was automatically created. | |
4 | # Changes will be lost when make is run in this directory. | 4 | # Changes will be lost when make is run in this directory. | |
5 | # | 5 | # | |
6 | # Created from: # NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $ | 6 | # Created from: # NetBSD: GENERIC.in,v 1.92 2012/01/11 17:04:29 rkujawa Exp $ | |
7 | # | 7 | # | |
8 | ## | 8 | ## | |
9 | # GENERIC machine description file | 9 | # GENERIC machine description file | |
10 | # | 10 | # | |
11 | # This machine description file is used to generate the default NetBSD | 11 | # This machine description file is used to generate the default NetBSD | |
12 | # kernel. The generic kernel does not include all options, subsystems | 12 | # kernel. The generic kernel does not include all options, subsystems | |
13 | # and device drivers, but should be useful for most applications. | 13 | # and device drivers, but should be useful for most applications. | |
14 | # | 14 | # | |
15 | # The machine description file can be customised for your specific | 15 | # The machine description file can be customised for your specific | |
16 | # machine to reduce the kernel size and improve its performance. | 16 | # machine to reduce the kernel size and improve its performance. | |
17 | # | 17 | # | |
18 | # For further information on compiling NetBSD kernels, see the config(8) | 18 | # For further information on compiling NetBSD kernels, see the config(8) | |
19 | # man page. | 19 | # man page. | |
20 | # | 20 | # | |
21 | # For further information on hardware support for this architecture, see | 21 | # For further information on hardware support for this architecture, see | |
22 | # the intro(4) man page. For further information about kernel options | 22 | # the intro(4) man page. For further information about kernel options | |
23 | # for this architecture, see the options(4) man page. For an explanation | 23 | # for this architecture, see the options(4) man page. For an explanation | |
24 | # of each device driver in this file see the section 4 man page for the | 24 | # of each device driver in this file see the section 4 man page for the | |
25 | # device. | 25 | # device. | |
26 | 26 | |||
27 | 27 | |||
28 | include "arch/amiga/conf/std.amiga" | 28 | include "arch/amiga/conf/std.amiga" | |
29 | 29 | |||
30 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | 30 | options INCLUDE_CONFIG_FILE # embed config file in kernel binary | |
31 | 31 | |||
32 | #ident "GENERIC-$Revision: 1.102 $" | 32 | #ident "GENERIC-$Revision: 1.103 $" | |
33 | 33 | |||
34 | makeoptions COPTS="-Os" | 34 | makeoptions COPTS="-Os" | |
35 | 35 | |||
36 | maxusers 8 | 36 | maxusers 8 | |
37 | options RTC_OFFSET=0 | 37 | options RTC_OFFSET=0 | |
38 | 38 | |||
39 | # | 39 | # | |
40 | # mainboards to support (in addition to Amiga) | 40 | # mainboards to support (in addition to Amiga) | |
41 | # | 41 | # | |
42 | options DRACO | 42 | options DRACO | |
43 | options BB060STUPIDROM # You need this, if you have a non-DraCo | 43 | options BB060STUPIDROM # You need this, if you have a non-DraCo | |
44 | # MC68060 with an OS ROM up to (at least) | 44 | # MC68060 with an OS ROM up to (at least) | |
45 | # V40 (OS3.1) and want to boot with the | 45 | # V40 (OS3.1) and want to boot with the | |
@@ -404,32 +404,30 @@ drsc0 at mainbus0 # DraCo scsi | @@ -404,32 +404,30 @@ drsc0 at mainbus0 # DraCo scsi | |||
404 | scsibus* at drsc0 | 404 | scsibus* at drsc0 | |
405 | 405 | |||
406 | 406 | |||
407 | # each hard drive from low target to high | 407 | # each hard drive from low target to high | |
408 | # will configure to the next available sd unit number | 408 | # will configure to the next available sd unit number | |
409 | sd* at scsibus? target ? lun ? # scsi disks | 409 | sd* at scsibus? target ? lun ? # scsi disks | |
410 | st* at scsibus? target ? lun ? # scsi tapes | 410 | st* at scsibus? target ? lun ? # scsi tapes | |
411 | cd* at scsibus? target ? lun ? # scsi cds | 411 | cd* at scsibus? target ? lun ? # scsi cds | |
412 | ch* at scsibus? target ? lun ? # scsi autochangers | 412 | ch* at scsibus? target ? lun ? # scsi autochangers | |
413 | 413 | |||
414 | # PCI bus support | 414 | # PCI bus support | |
415 | options PCIVERBOSE # verbose PCI device autoconfig messages | 415 | options PCIVERBOSE # verbose PCI device autoconfig messages | |
416 | #options PCI_CONFIG_DUMP | 416 | #options PCI_CONFIG_DUMP | |
417 | options PCI_NETBSD_CONFIGURE # used only by mppb(4) | 417 | options PCI_NETBSD_CONFIGURE # supported by mppb(4) and p5pb(4) | |
418 | 418 | |||
419 | p5pb0 at p5bus0 # Phase5 PCI bridge (CVPPC/BVPPC/G-REX) | 419 | p5pb0 at p5bus0 # Phase5 PCI bridge (CVPPC/BVPPC/G-REX) | |
420 | p5membar* at zbus0 # Phase5 PCI bridge autoconfiguring BARs | 420 | p5membar* at zbus0 # Phase5 PCI bridge autoconfiguring BARs | |
421 | #options P5PB_OLD_FIRMWARE # enable support for p5pb with old fw | |||
422 | #options P5PB_GENFB # enable genfb support for CVPPC/BVPPC | |||
423 | #options P5PB_DEBUG # enable excessive debug for p5pb | 421 | #options P5PB_DEBUG # enable excessive debug for p5pb | |
424 | pci* at p5pb0 | 422 | pci* at p5pb0 | |
425 | 423 | |||
426 | mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge | 424 | mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge | |
427 | pci* at mppb? | 425 | pci* at mppb? | |
428 | 426 | |||
429 | #cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge | 427 | #cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge | |
430 | 428 | |||
431 | #genfb* at pci? # generic fb, CVPPC/BVPPC only | 429 | #genfb* at pci? # generic fb, CVPPC/BVPPC only | |
432 | ne* at pci? # NE2000 Ethernet | 430 | ne* at pci? # NE2000 Ethernet | |
433 | 431 | |||
434 | # Bluetooth Controller and Device support | 432 | # Bluetooth Controller and Device support | |
435 | # tested only with btuart on an A1200 | 433 | # tested only with btuart on an A1200 |
--- src/sys/arch/amiga/conf/files.amiga 2012/01/11 17:04:29 1.152
+++ src/sys/arch/amiga/conf/files.amiga 2012/01/19 00:14:08 1.153
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.amiga,v 1.152 2012/01/11 17:04:29 rkujawa Exp $ | 1 | # $NetBSD: files.amiga,v 1.153 2012/01/19 00:14:08 rkujawa Exp $ | |
2 | 2 | |||
3 | # maxpartitions must be first item in files.${ARCH}.newconf | 3 | # maxpartitions must be first item in files.${ARCH}.newconf | |
4 | maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! | 4 | maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! | |
5 | 5 | |||
6 | defflag opt_m060sp.h M060SP | 6 | defflag opt_m060sp.h M060SP | |
7 | defflag PANICBUTTON # panic on kbd NMI if not DDB | 7 | defflag PANICBUTTON # panic on kbd NMI if not DDB | |
8 | 8 | |||
9 | maxusers 2 8 64 | 9 | maxusers 2 8 64 | |
10 | 10 | |||
11 | defflag opt_amigaccgrf.h GRF_NTSC | 11 | defflag opt_amigaccgrf.h GRF_NTSC | |
12 | defflag opt_amigaccgrf.h GRF_PAL :GRF_NTSC # temporary workaround | 12 | defflag opt_amigaccgrf.h GRF_PAL :GRF_NTSC # temporary workaround | |
13 | defflag opt_amigaccgrf.h GRF_ECS GRF_AGA | 13 | defflag opt_amigaccgrf.h GRF_ECS GRF_AGA | |
14 | defflag opt_amigaccgrf.h GRF_A2024:GRF_ECS | 14 | defflag opt_amigaccgrf.h GRF_A2024:GRF_ECS | |
@@ -23,28 +23,26 @@ defflag opt_amigacons.h SERCONSOLE | @@ -23,28 +23,26 @@ defflag opt_amigacons.h SERCONSOLE | |||
23 | 23 | |||
24 | defflag opt_kfont.h KFONT_CONS_ISO8859_1 | 24 | defflag opt_kfont.h KFONT_CONS_ISO8859_1 | |
25 | defflag opt_kfont.h KFONT_CONS_ISO8859_2 | 25 | defflag opt_kfont.h KFONT_CONS_ISO8859_2 | |
26 | 26 | |||
27 | defparam opt_retina.h RH_MEMCLK | 27 | defparam opt_retina.h RH_MEMCLK | |
28 | defflag opt_retina.h RH_64BIT_SPRITE RH_HARDWARECURSOR | 28 | defflag opt_retina.h RH_64BIT_SPRITE RH_HARDWARECURSOR | |
29 | defflag opt_retina.h RETINA_SPEED_HACK | 29 | defflag opt_retina.h RETINA_SPEED_HACK | |
30 | 30 | |||
31 | defflag BB060STUPIDROM | 31 | defflag BB060STUPIDROM | |
32 | defflag P5PPC68KBOARD | 32 | defflag P5PPC68KBOARD | |
33 | defflag LEV6_DEFER | 33 | defflag LEV6_DEFER | |
34 | defflag DEVRELOAD | 34 | defflag DEVRELOAD | |
35 | 35 | |||
36 | defflag opt_p5pb.h P5PB_GENFB | |||
37 | defflag opt_p5pb.h P5PB_OLD_FIRMWARE | |||
38 | defflag opt_p5pb.h P5PB_DEBUG | 36 | defflag opt_p5pb.h P5PB_DEBUG | |
39 | 37 | |||
40 | defparam IOBZCLOCK | 38 | defparam IOBZCLOCK | |
41 | 39 | |||
42 | device mainbus {} | 40 | device mainbus {} | |
43 | attach mainbus at root | 41 | attach mainbus at root | |
44 | 42 | |||
45 | device cpu | 43 | device cpu | |
46 | attach cpu at mainbus | 44 | attach cpu at mainbus | |
47 | 45 | |||
48 | # for bus_space | 46 | # for bus_space | |
49 | define amibus_bl | 47 | define amibus_bl | |
50 | file arch/amiga/amiga/amiga_bus_simple_4.c | 48 | file arch/amiga/amiga/amiga_bus_simple_4.c |
--- src/sys/arch/amiga/dev/p5bus.c 2012/01/10 20:29:50 1.1
+++ src/sys/arch/amiga/dev/p5bus.c 2012/01/19 00:14:08 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: p5bus.c,v 1.1 2012/01/10 20:29:50 rkujawa Exp $ */ | 1 | /* $NetBSD: p5bus.c,v 1.2 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -54,30 +54,26 @@ static char* p5bus_cardsn(void); | @@ -54,30 +54,26 @@ static char* p5bus_cardsn(void); | |||
54 | static int p5bus_print(void *aux, const char *str); | 54 | static int p5bus_print(void *aux, const char *str); | |
55 | static void p5bus_callback(device_t self); | 55 | static void p5bus_callback(device_t self); | |
56 | 56 | |||
57 | struct p5bus_softc { | 57 | struct p5bus_softc { | |
58 | device_t sc_dev; | 58 | device_t sc_dev; | |
59 | uint8_t sc_cardtype; | 59 | uint8_t sc_cardtype; | |
60 | uint8_t sc_has_scsi; | 60 | uint8_t sc_has_scsi; | |
61 | #define P5BUS_SCSI_NONE 0 | 61 | #define P5BUS_SCSI_NONE 0 | |
62 | #define P5BUS_SCSI_710 1 /* NCR 53C710 */ | 62 | #define P5BUS_SCSI_710 1 /* NCR 53C710 */ | |
63 | #define P5BUS_SCSI_770 2 /* NCR 53C770 */ | 63 | #define P5BUS_SCSI_770 2 /* NCR 53C770 */ | |
64 | uint8_t sc_has_ppc; | 64 | uint8_t sc_has_ppc; | |
65 | #define P5BUS_PPC_NONE 0 /* CS Mk-III only */ | 65 | #define P5BUS_PPC_NONE 0 /* CS Mk-III only */ | |
66 | #define P5BUS_PPC_OK 1 /* has working PPC CPU */ | 66 | #define P5BUS_PPC_OK 1 /* has working PPC CPU */ | |
67 | uint8_t sc_has_pci; | |||
68 | #define P5BUS_PCI_NONE 0 | |||
69 | #define P5BUS_PCI_CVPPC 1 /* CyberVisionPPC / BlizzardVisionPPC */ | |||
70 | #define P5BUS_PCI_GREX 2 /* G-REX (not yet) */ | |||
71 | }; | 67 | }; | |
72 | 68 | |||
73 | CFATTACH_DECL_NEW(p5bus, sizeof(struct p5bus_softc), | 69 | CFATTACH_DECL_NEW(p5bus, sizeof(struct p5bus_softc), | |
74 | p5bus_match, p5bus_attach, NULL, NULL); | 70 | p5bus_match, p5bus_attach, NULL, NULL); | |
75 | 71 | |||
76 | static int | 72 | static int | |
77 | p5bus_match(struct device *pdp, struct cfdata *cfp, void *auxp) | 73 | p5bus_match(struct device *pdp, struct cfdata *cfp, void *auxp) | |
78 | { | 74 | { | |
79 | struct zbus_args *zap; | 75 | struct zbus_args *zap; | |
80 | 76 | |||
81 | zap = auxp; | 77 | zap = auxp; | |
82 | 78 | |||
83 | if (zap->manid != ZORRO_MANID_P5) | 79 | if (zap->manid != ZORRO_MANID_P5) | |
@@ -116,43 +112,41 @@ p5bus_attach(device_t parent, device_t s | @@ -116,43 +112,41 @@ p5bus_attach(device_t parent, device_t s | |||
116 | "CyberStorm Mk-III (sn %s)\n", sn); | 112 | "CyberStorm Mk-III (sn %s)\n", sn); | |
117 | sc->sc_has_ppc = P5BUS_PPC_NONE; | 113 | sc->sc_has_ppc = P5BUS_PPC_NONE; | |
118 | } else { | 114 | } else { | |
119 | aprint_normal_dev(sc->sc_dev, | 115 | aprint_normal_dev(sc->sc_dev, | |
120 | "CyberStorm PPC 604e (sn %s)\n", sn); | 116 | "CyberStorm PPC 604e (sn %s)\n", sn); | |
121 | sc->sc_has_ppc = P5BUS_PPC_OK; | 117 | sc->sc_has_ppc = P5BUS_PPC_OK; | |
122 | } | 118 | } | |
123 | 119 | |||
124 | sc->sc_cardtype = P5_CARDTYPE_CS; | 120 | sc->sc_cardtype = P5_CARDTYPE_CS; | |
125 | sc->sc_has_scsi = P5BUS_SCSI_770; | 121 | sc->sc_has_scsi = P5BUS_SCSI_770; | |
126 | 122 | |||
127 | } else if (zap->prodid == ZORRO_PRODID_BPPC) { | 123 | } else if (zap->prodid == ZORRO_PRODID_BPPC) { | |
128 | 124 | |||
129 | if (sn[0] == 'I') { /* only "+" model has SCSI */ | 125 | if (sn[0] != 'I') { /* only "+" model has SCSI */ | |
130 | aprint_normal_dev(sc->sc_dev, | 126 | aprint_normal_dev(sc->sc_dev, | |
131 | "BlizzardPPC 603e (sn %s)\n", sn); | 127 | "BlizzardPPC 603e (sn %s)\n", sn); | |
132 | sc->sc_has_scsi = P5BUS_SCSI_NONE; | 128 | sc->sc_has_scsi = P5BUS_SCSI_NONE; | |
133 | } else { | 129 | } else { | |
134 | aprint_normal_dev(sc->sc_dev, | 130 | aprint_normal_dev(sc->sc_dev, | |
135 | "BlizzardPPC 603e+ (sn %s)\n", sn); | 131 | "BlizzardPPC 603e+ (sn %s)\n", sn); | |
136 | sc->sc_has_scsi = P5BUS_SCSI_710; | 132 | sc->sc_has_scsi = P5BUS_SCSI_710; | |
137 | } | 133 | } | |
138 | 134 | |||
139 | sc->sc_cardtype = P5_CARDTYPE_BPPC; | 135 | sc->sc_cardtype = P5_CARDTYPE_BPPC; | |
140 | sc->sc_has_ppc = P5BUS_PPC_OK; | 136 | sc->sc_has_ppc = P5BUS_PPC_OK; | |
141 | 137 | |||
142 | } | 138 | } | |
143 | 139 | |||
144 | sc->sc_has_pci = P5BUS_PCI_CVPPC; /* XXX: insert probe here? */ | |||
145 | ||||
146 | p5baa.p5baa_cardtype = sc->sc_cardtype; | 140 | p5baa.p5baa_cardtype = sc->sc_cardtype; | |
147 | 141 | |||
148 | /* Attach the SCSI host adapters. */ | 142 | /* Attach the SCSI host adapters. */ | |
149 | switch (sc->sc_has_scsi) { | 143 | switch (sc->sc_has_scsi) { | |
150 | case P5BUS_SCSI_710: | 144 | case P5BUS_SCSI_710: | |
151 | strcpy(p5baa.p5baa_name, "bppcsc"); | 145 | strcpy(p5baa.p5baa_name, "bppcsc"); | |
152 | config_found_ia(sc->sc_dev, "p5bus", &p5baa, p5bus_print); | 146 | config_found_ia(sc->sc_dev, "p5bus", &p5baa, p5bus_print); | |
153 | break; | 147 | break; | |
154 | case P5BUS_SCSI_770: | 148 | case P5BUS_SCSI_770: | |
155 | strcpy(p5baa.p5baa_name, "cbiiisc"); | 149 | strcpy(p5baa.p5baa_name, "cbiiisc"); | |
156 | config_found_ia(sc->sc_dev, "p5bus", &p5baa, p5bus_print); | 150 | config_found_ia(sc->sc_dev, "p5bus", &p5baa, p5bus_print); | |
157 | break; | 151 | break; | |
158 | default: | 152 | default: | |
@@ -167,30 +161,29 @@ p5bus_attach(device_t parent, device_t s | @@ -167,30 +161,29 @@ p5bus_attach(device_t parent, device_t s | |||
167 | 161 | |||
168 | } | 162 | } | |
169 | 163 | |||
170 | /* Continue the attachment. */ | 164 | /* Continue the attachment. */ | |
171 | static void | 165 | static void | |
172 | p5bus_callback(device_t self) { | 166 | p5bus_callback(device_t self) { | |
173 | 167 | |||
174 | struct p5bus_attach_args p5baa; | 168 | struct p5bus_attach_args p5baa; | |
175 | struct p5bus_softc *sc; | 169 | struct p5bus_softc *sc; | |
176 | 170 | |||
177 | sc = device_private(self); | 171 | sc = device_private(self); | |
178 | p5baa.p5baa_cardtype = sc->sc_cardtype; | 172 | p5baa.p5baa_cardtype = sc->sc_cardtype; | |
179 | 173 | |||
180 | if (sc->sc_has_pci) { | 174 | /* p5pb is always found, probe is inside of p5pb driver */ | |
181 | strcpy(p5baa.p5baa_name, "p5pb"); | 175 | strcpy(p5baa.p5baa_name, "p5pb"); | |
182 | config_found_ia(sc->sc_dev, "p5bus", &p5baa, p5bus_print); | 176 | config_found_ia(sc->sc_dev, "p5bus", &p5baa, p5bus_print); | |
183 | } | |||
184 | } | 177 | } | |
185 | 178 | |||
186 | /* Get serial number of the card. */ | 179 | /* Get serial number of the card. */ | |
187 | static char * | 180 | static char * | |
188 | p5bus_cardsn() | 181 | p5bus_cardsn() | |
189 | { | 182 | { | |
190 | char *snr, *sn; | 183 | char *snr, *sn; | |
191 | 184 | |||
192 | sn = kmem_zalloc(P5_SN_LEN + 1, KM_SLEEP); | 185 | sn = kmem_zalloc(P5_SN_LEN + 1, KM_SLEEP); | |
193 | snr = (char *)__UNVOLATILE(ztwomap(P5_ROM_OFF)); | 186 | snr = (char *)__UNVOLATILE(ztwomap(P5_ROM_OFF)); | |
194 | 187 | |||
195 | memcpy(sn, snr, P5_SN_LEN); | 188 | memcpy(sn, snr, P5_SN_LEN); | |
196 | return sn; | 189 | return sn; |
--- src/sys/arch/amiga/dev/zbus.c 2011/09/21 12:40:25 1.67
+++ src/sys/arch/amiga/dev/zbus.c 2012/01/19 00:14:08 1.68
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: zbus.c,v 1.67 2011/09/21 12:40:25 rkujawa Exp $ */ | 1 | /* $NetBSD: zbus.c,v 1.68 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994 Christian E. Hopps | 4 | * Copyright (c) 1994 Christian E. Hopps | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.67 2011/09/21 12:40:25 rkujawa Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.68 2012/01/19 00:14:08 rkujawa Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/bus.h> | 39 | #include <sys/bus.h> | |
40 | 40 | |||
41 | #include <machine/cpu.h> | 41 | #include <machine/cpu.h> | |
42 | #include <machine/pte.h> | 42 | #include <machine/pte.h> | |
43 | #include <amiga/amiga/cfdev.h> | 43 | #include <amiga/amiga/cfdev.h> | |
44 | #include <amiga/amiga/device.h> | 44 | #include <amiga/amiga/device.h> | |
45 | #include <amiga/dev/zbusvar.h> | 45 | #include <amiga/dev/zbusvar.h> | |
46 | 46 | |||
47 | struct aconfdata { | 47 | struct aconfdata { | |
@@ -234,34 +234,35 @@ static struct quirksdata quirkstab[] = { | @@ -234,34 +234,35 @@ static struct quirksdata quirkstab[] = { | |||
234 | {8512, 101, ZORRO_QUIRK_NO_ZBUSMAP} | 234 | {8512, 101, ZORRO_QUIRK_NO_ZBUSMAP} | |
235 | }; | 235 | }; | |
236 | static int nquirksent = sizeof(quirkstab) / sizeof(struct quirksdata); | 236 | static int nquirksent = sizeof(quirkstab) / sizeof(struct quirksdata); | |
237 | 237 | |||
238 | void zbusattach(device_t, device_t, void *); | 238 | void zbusattach(device_t, device_t, void *); | |
239 | int zbusprint(void *, const char *); | 239 | int zbusprint(void *, const char *); | |
240 | int zbusmatch(device_t, cfdata_t, void *); | 240 | int zbusmatch(device_t, cfdata_t, void *); | |
241 | static const char *aconflookup(int, int); | 241 | static const char *aconflookup(int, int); | |
242 | 242 | |||
243 | /* | 243 | /* | |
244 | * given a manufacturer id and product id, find quirks | 244 | * given a manufacturer id and product id, find quirks | |
245 | * for this board. | 245 | * for this board. | |
246 | */ | 246 | */ | |
247 | ||||
247 | static uint8_t | 248 | static uint8_t | |
248 | quirkslookup(int mid, int pid) | 249 | quirkslookup(int mid, int pid) | |
249 | { | 250 | { | |
250 | const struct quirksdata *qdp, *eqdp; | 251 | const struct quirksdata *qdp, *eqdp; | |
251 | 252 | |||
252 | eqdp = &quirkstab[nquirksent]; | 253 | eqdp = &quirkstab[nquirksent]; | |
253 | for (qdp = quirkstab; qdp < eqdp; qdp++) | 254 | for (qdp = quirkstab; qdp < eqdp; qdp++) | |
254 | if (qdp->manid == mid && qdp->prodid == pid) | 255 | if (qdp->manid == mid && qdp->prodid == pid) | |
255 | return(qdp->quirks); | 256 | return(qdp->quirks); | |
256 | return(0); | 257 | return(0); | |
257 | } | 258 | } | |
258 | 259 | |||
259 | /* | 260 | /* | |
260 | * given a manufacturer id and product id, find the name | 261 | * given a manufacturer id and product id, find the name | |
261 | * that describes this board. | 262 | * that describes this board. | |
262 | */ | 263 | */ | |
263 | static const char * | 264 | static const char * | |
264 | aconflookup(int mid, int pid) | 265 | aconflookup(int mid, int pid) | |
265 | { | 266 | { | |
266 | const struct aconfdata *adp, *eadp; | 267 | const struct aconfdata *adp, *eadp; | |
267 | 268 | |||
@@ -325,44 +326,45 @@ zbusattach(device_t pdp, device_t dp, vo | @@ -325,44 +326,45 @@ zbusattach(device_t pdp, device_t dp, vo | |||
325 | if (amiga_realconfig == 0 && pcp >= epcp) | 326 | if (amiga_realconfig == 0 && pcp >= epcp) | |
326 | continue; | 327 | continue; | |
327 | 328 | |||
328 | /* | 329 | /* | |
329 | * check if it's a Zorro II or III board and not linked into | 330 | * check if it's a Zorro II or III board and not linked into | |
330 | * MemList (i.e. not a memory board) | 331 | * MemList (i.e. not a memory board) | |
331 | */ | 332 | */ | |
332 | if ((cdp->rom.type & 0xe0) != 0xc0 && | 333 | if ((cdp->rom.type & 0xe0) != 0xc0 && | |
333 | (cdp->rom.type & 0xe0) != 0x80) | 334 | (cdp->rom.type & 0xe0) != 0x80) | |
334 | continue; /* er_Type != Zorro I/O */ | 335 | continue; /* er_Type != Zorro I/O */ | |
335 | 336 | |||
336 | za.pa = cdp->addr; | 337 | za.pa = cdp->addr; | |
337 | za.size = cdp->size; | 338 | za.size = cdp->size; | |
339 | za.manid = cdp->rom.manid; | |||
340 | za.prodid = cdp->rom.prodid; | |||
341 | za.serno = cdp->rom.serno; | |||
342 | za.slot = (((u_long)za.pa >> 16) & 0xF) - 0x9; | |||
343 | ||||
338 | if (amiga_realconfig && pcp < epcp && pcp->vaddr) | 344 | if (amiga_realconfig && pcp < epcp && pcp->vaddr) | |
339 | za.va = pcp->vaddr; | 345 | za.va = pcp->vaddr; | |
340 | else { | 346 | else { | |
341 | if(quirkslookup(za.manid, za.prodid) != | 347 | if(quirkslookup(za.manid, za.prodid) != | |
342 | ZORRO_QUIRK_NO_ZBUSMAP) | 348 | ZORRO_QUIRK_NO_ZBUSMAP) | |
343 | za.va = (void *) (isztwopa(za.pa) ? | 349 | za.va = (void *) (isztwopa(za.pa) ? | |
344 | __UNVOLATILE(ztwomap(za.pa)) : | 350 | __UNVOLATILE(ztwomap(za.pa)) : | |
345 | zbusmap(za.pa, za.size)); | 351 | zbusmap(za.pa, za.size)); | |
346 | /* | 352 | /* | |
347 | * save value if early console init | 353 | * save value if early console init | |
348 | */ | 354 | */ | |
349 | if (amiga_realconfig == 0) | 355 | if (amiga_realconfig == 0) | |
350 | pcp->vaddr = za.va; | 356 | pcp->vaddr = za.va; | |
351 | } | 357 | } | |
352 | za.manid = cdp->rom.manid; | |||
353 | za.prodid = cdp->rom.prodid; | |||
354 | za.serno = cdp->rom.serno; | |||
355 | za.slot = (((u_long)za.pa >> 16) & 0xF) - 0x9; | |||
356 | amiga_config_found(early_cfdata, dp, &za, zbusprint); | 358 | amiga_config_found(early_cfdata, dp, &za, zbusprint); | |
357 | } | 359 | } | |
358 | } | 360 | } | |
359 | 361 | |||
360 | /* | 362 | /* | |
361 | * print configuration info. | 363 | * print configuration info. | |
362 | */ | 364 | */ | |
363 | int | 365 | int | |
364 | zbusprint(void *auxp, const char *pnp) | 366 | zbusprint(void *auxp, const char *pnp) | |
365 | { | 367 | { | |
366 | struct zbus_args *zap; | 368 | struct zbus_args *zap; | |
367 | int rv; | 369 | int rv; | |
368 | 370 |
--- src/sys/arch/amiga/include/pci_machdep.h 2011/09/19 19:15:29 1.3
+++ src/sys/arch/amiga/include/pci_machdep.h 2012/01/19 00:14:08 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pci_machdep.h,v 1.3 2011/09/19 19:15:29 rkujawa Exp $ */ | 1 | /* $NetBSD: pci_machdep.h,v 1.4 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -28,26 +28,28 @@ | @@ -28,26 +28,28 @@ | |||
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #ifndef _AMIGA_PCI_MACHDEP_H_ | 32 | #ifndef _AMIGA_PCI_MACHDEP_H_ | |
33 | #define _AMIGA_PCI_MACHDEP_H_ | 33 | #define _AMIGA_PCI_MACHDEP_H_ | |
34 | 34 | |||
35 | #include <sys/bus.h> | 35 | #include <sys/bus.h> | |
36 | 36 | |||
37 | #include <machine/intr.h> | 37 | #include <machine/intr.h> | |
38 | 38 | |||
39 | #include <m68k/bus_dma.h> | 39 | #include <m68k/bus_dma.h> | |
40 | 40 | |||
41 | /* #define __HAVE_PCI_CONF_HOOK */ | |||
42 | ||||
41 | /* | 43 | /* | |
42 | * Forward declarations. | 44 | * Forward declarations. | |
43 | */ | 45 | */ | |
44 | struct pci_attach_args; | 46 | struct pci_attach_args; | |
45 | 47 | |||
46 | /* | 48 | /* | |
47 | * Types provided to machine-independent PCI code | 49 | * Types provided to machine-independent PCI code | |
48 | */ | 50 | */ | |
49 | typedef struct amiga_pci_chipset *pci_chipset_tag_t; | 51 | typedef struct amiga_pci_chipset *pci_chipset_tag_t; | |
50 | typedef u_long pcitag_t; | 52 | typedef u_long pcitag_t; | |
51 | typedef u_long pci_intr_handle_t; | 53 | typedef u_long pci_intr_handle_t; | |
52 | 54 | |||
53 | /* | 55 | /* |
--- src/sys/arch/amiga/pci/mppb.c 2012/01/13 13:41:25 1.4
+++ src/sys/arch/amiga/pci/mppb.c 2012/01/19 00:14:08 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mppb.c,v 1.4 2012/01/13 13:41:25 rkujawa Exp $ */ | 1 | /* $NetBSD: mppb.c,v 1.5 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -45,26 +45,28 @@ | @@ -45,26 +45,28 @@ | |||
45 | 45 | |||
46 | #include <machine/bus.h> | 46 | #include <machine/bus.h> | |
47 | #include <machine/cpu.h> | 47 | #include <machine/cpu.h> | |
48 | 48 | |||
49 | #include <m68k/bus_dma.h> | 49 | #include <m68k/bus_dma.h> | |
50 | #include <amiga/dev/zbusvar.h> | 50 | #include <amiga/dev/zbusvar.h> | |
51 | #include <amiga/pci/mppbreg.h> | 51 | #include <amiga/pci/mppbreg.h> | |
52 | 52 | |||
53 | #include <dev/pci/pcivar.h> | 53 | #include <dev/pci/pcivar.h> | |
54 | #include <dev/pci/pcireg.h> | 54 | #include <dev/pci/pcireg.h> | |
55 | #include <dev/pci/pcidevs.h> | 55 | #include <dev/pci/pcidevs.h> | |
56 | #include <dev/pci/pciconf.h> | 56 | #include <dev/pci/pciconf.h> | |
57 | 57 | |||
58 | #include "opt_pci.h" | |||
59 | ||||
58 | /* Zorro IDs */ | 60 | /* Zorro IDs */ | |
59 | #define ZORRO_MANID_MATAY 44359 | 61 | #define ZORRO_MANID_MATAY 44359 | |
60 | #define ZORRO_PRODID_PROMETHEUS 1 | 62 | #define ZORRO_PRODID_PROMETHEUS 1 | |
61 | 63 | |||
62 | struct mppb_softc { | 64 | struct mppb_softc { | |
63 | device_t sc_dev; | 65 | device_t sc_dev; | |
64 | volatile char *ba; | 66 | volatile char *ba; | |
65 | struct bus_space_tag pci_conf_area; | 67 | struct bus_space_tag pci_conf_area; | |
66 | struct bus_space_tag pci_io_area; | 68 | struct bus_space_tag pci_io_area; | |
67 | struct bus_space_tag pci_mem_area; | 69 | struct bus_space_tag pci_mem_area; | |
68 | struct amiga_pci_chipset apc; | 70 | struct amiga_pci_chipset apc; | |
69 | }; | 71 | }; | |
70 | 72 | |||
@@ -90,31 +92,26 @@ CFATTACH_DECL_NEW(mppb, sizeof(struct mp | @@ -90,31 +92,26 @@ CFATTACH_DECL_NEW(mppb, sizeof(struct mp | |||
90 | static int | 92 | static int | |
91 | mppb_match(device_t parent, cfdata_t cf, void *aux) | 93 | mppb_match(device_t parent, cfdata_t cf, void *aux) | |
92 | { | 94 | { | |
93 | struct zbus_args *zap; | 95 | struct zbus_args *zap; | |
94 | 96 | |||
95 | zap = aux; | 97 | zap = aux; | |
96 | 98 | |||
97 | if (zap->manid != ZORRO_MANID_MATAY) | 99 | if (zap->manid != ZORRO_MANID_MATAY) | |
98 | return 0; | 100 | return 0; | |
99 | 101 | |||
100 | if (zap->prodid != ZORRO_PRODID_PROMETHEUS) | 102 | if (zap->prodid != ZORRO_PRODID_PROMETHEUS) | |
101 | return 0; | 103 | return 0; | |
102 | 104 | |||
103 | #ifdef MPPB_DEBUG | |||
104 | aprint_normal("mppb matched by Zorro ID %d, %d\n", zap->manid, | |||
105 | zap->prodid); | |||
106 | #endif | |||
107 | ||||
108 | return 1; | 105 | return 1; | |
109 | } | 106 | } | |
110 | 107 | |||
111 | 108 | |||
112 | static void | 109 | static void | |
113 | mppb_attach(device_t parent, device_t self, void *aux) | 110 | mppb_attach(device_t parent, device_t self, void *aux) | |
114 | { | 111 | { | |
115 | struct mppb_softc *sc; | 112 | struct mppb_softc *sc; | |
116 | struct pcibus_attach_args pba; | 113 | struct pcibus_attach_args pba; | |
117 | struct zbus_args *zap; | 114 | struct zbus_args *zap; | |
118 | pci_chipset_tag_t pc; | 115 | pci_chipset_tag_t pc; | |
119 | #ifdef PCI_NETBSD_CONFIGURE | 116 | #ifdef PCI_NETBSD_CONFIGURE | |
120 | struct extent *ioext, *memext; | 117 | struct extent *ioext, *memext; | |
@@ -129,30 +126,30 @@ mppb_attach(device_t parent, device_t se | @@ -129,30 +126,30 @@ mppb_attach(device_t parent, device_t se | |||
129 | aprint_normal(": Matay Prometheus PCI bridge\n"); | 126 | aprint_normal(": Matay Prometheus PCI bridge\n"); | |
130 | 127 | |||
131 | /* Setup bus space mappings. */ | 128 | /* Setup bus space mappings. */ | |
132 | sc->pci_conf_area.base = (bus_addr_t) sc->ba + MPPB_CONF_BASE; | 129 | sc->pci_conf_area.base = (bus_addr_t) sc->ba + MPPB_CONF_BASE; | |
133 | sc->pci_conf_area.absm = &amiga_bus_stride_1swap; | 130 | sc->pci_conf_area.absm = &amiga_bus_stride_1swap; | |
134 | 131 | |||
135 | sc->pci_mem_area.base = (bus_addr_t) sc->ba + MPPB_MEM_BASE; | 132 | sc->pci_mem_area.base = (bus_addr_t) sc->ba + MPPB_MEM_BASE; | |
136 | sc->pci_mem_area.absm = &amiga_bus_stride_1; | 133 | sc->pci_mem_area.absm = &amiga_bus_stride_1; | |
137 | 134 | |||
138 | sc->pci_io_area.base = (bus_addr_t) sc->ba + MPPB_IO_BASE; | 135 | sc->pci_io_area.base = (bus_addr_t) sc->ba + MPPB_IO_BASE; | |
139 | sc->pci_io_area.absm = &amiga_bus_stride_1; | 136 | sc->pci_io_area.absm = &amiga_bus_stride_1; | |
140 | 137 | |||
141 | #ifdef MPPB_DEBUG | 138 | #ifdef MPPB_DEBUG | |
142 | aprint_normal("mppb mapped conf %x->%x, mem %x->%x\n, io %x->%x", | 139 | aprint_normal("mppb mapped conf %x->%x, mem %x->%x\n, io %x->%x\n", | |
143 | (zap->pa) + MPPB_CONF_BASE, sc->pci_conf_area.base, | 140 | kvtop((void*) sc->pci_conf_area.base), sc->pci_conf_area.base, | |
144 | (zap->pa) + MPPB_MEM_BASE, sc->pci_mem_area.base, | 141 | kvtop((void*) sc->pci_mem_area.base), sc->pci_mem_area.base, | |
145 | (zap->pa) + MPPB_IO_BASE, sc->pci_io_area.base); | 142 | kvtop((void*) sc->pci_io_area.base), sc->pci_io_area.base); | |
146 | #endif | 143 | #endif | |
147 | 144 | |||
148 | sc->apc.pci_conf_datat = &(sc->pci_conf_area); | 145 | sc->apc.pci_conf_datat = &(sc->pci_conf_area); | |
149 | 146 | |||
150 | if (bus_space_map(sc->apc.pci_conf_datat, 0, MPPB_CONF_SIZE, 0, | 147 | if (bus_space_map(sc->apc.pci_conf_datat, 0, MPPB_CONF_SIZE, 0, | |
151 | &sc->apc.pci_conf_datah)) | 148 | &sc->apc.pci_conf_datah)) | |
152 | aprint_error_dev(self, | 149 | aprint_error_dev(self, | |
153 | "couldn't map PCI configuration data space\n"); | 150 | "couldn't map PCI configuration data space\n"); | |
154 | 151 | |||
155 | /* Initialize the PCI chipset tag. */ | 152 | /* Initialize the PCI chipset tag. */ | |
156 | sc->apc.pc_conf_v = (void*) pc; | 153 | sc->apc.pc_conf_v = (void*) pc; | |
157 | sc->apc.pc_bus_maxdevs = mppb_pci_bus_maxdevs; | 154 | sc->apc.pc_bus_maxdevs = mppb_pci_bus_maxdevs; | |
158 | sc->apc.pc_make_tag = amiga_pci_make_tag; | 155 | sc->apc.pc_make_tag = amiga_pci_make_tag; | |
@@ -164,27 +161,30 @@ mppb_attach(device_t parent, device_t se | @@ -164,27 +161,30 @@ mppb_attach(device_t parent, device_t se | |||
164 | sc->apc.pc_intr_map = mppb_pci_intr_map; | 161 | sc->apc.pc_intr_map = mppb_pci_intr_map; | |
165 | sc->apc.pc_intr_string = amiga_pci_intr_string; | 162 | sc->apc.pc_intr_string = amiga_pci_intr_string; | |
166 | sc->apc.pc_intr_establish = amiga_pci_intr_establish; | 163 | sc->apc.pc_intr_establish = amiga_pci_intr_establish; | |
167 | sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish; | 164 | sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish; | |
168 | 165 | |||
169 | sc->apc.pc_conf_hook = amiga_pci_conf_hook; | 166 | sc->apc.pc_conf_hook = amiga_pci_conf_hook; | |
170 | sc->apc.pc_conf_interrupt = amiga_pci_conf_interrupt; | 167 | sc->apc.pc_conf_interrupt = amiga_pci_conf_interrupt; | |
171 | 168 | |||
172 | #ifdef PCI_NETBSD_CONFIGURE | 169 | #ifdef PCI_NETBSD_CONFIGURE | |
173 | ioext = extent_create("mppbio", MPPB_IO_BASE, | 170 | ioext = extent_create("mppbio", MPPB_IO_BASE, | |
174 | MPPB_IO_BASE + MPPB_IO_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); | 171 | MPPB_IO_BASE + MPPB_IO_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); | |
175 | memext = extent_create("mppbmem", MPPB_MEM_BASE, | 172 | memext = extent_create("mppbmem", MPPB_MEM_BASE, | |
176 | MPPB_MEM_BASE + MPPB_MEM_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); | 173 | MPPB_MEM_BASE + MPPB_MEM_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); | |
177 | 174 | |||
175 | #ifdef MPPB_DEBUG | |||
176 | aprint_normal("mppb: reconfiguring the bus!\n"); | |||
177 | #endif /* MPPB_DEBUG */ | |||
178 | pci_configure_bus(pc, ioext, memext, NULL, 0, CACHELINE_SIZE); | 178 | pci_configure_bus(pc, ioext, memext, NULL, 0, CACHELINE_SIZE); | |
179 | 179 | |||
180 | extent_destroy(ioext); | 180 | extent_destroy(ioext); | |
181 | extent_destroy(memext); | 181 | extent_destroy(memext); | |
182 | #endif /* PCI_NETBSD_CONFIGURE */ | 182 | #endif /* PCI_NETBSD_CONFIGURE */ | |
183 | 183 | |||
184 | pba.pba_iot = &(sc->pci_io_area); | 184 | pba.pba_iot = &(sc->pci_io_area); | |
185 | pba.pba_memt = &(sc->pci_mem_area); | 185 | pba.pba_memt = &(sc->pci_mem_area); | |
186 | pba.pba_dmat = NULL; | 186 | pba.pba_dmat = NULL; | |
187 | pba.pba_dmat64 = NULL; | 187 | pba.pba_dmat64 = NULL; | |
188 | pba.pba_pc = pc; | 188 | pba.pba_pc = pc; | |
189 | pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; | 189 | pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; | |
190 | pba.pba_bus = 0; | 190 | pba.pba_bus = 0; | |
@@ -193,48 +193,48 @@ mppb_attach(device_t parent, device_t se | @@ -193,48 +193,48 @@ mppb_attach(device_t parent, device_t se | |||
193 | config_found_ia(self, "pcibus", &pba, pcibusprint); | 193 | config_found_ia(self, "pcibus", &pba, pcibusprint); | |
194 | } | 194 | } | |
195 | 195 | |||
196 | pcireg_t | 196 | pcireg_t | |
197 | mppb_pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) | 197 | mppb_pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) | |
198 | { | 198 | { | |
199 | uint32_t data; | 199 | uint32_t data; | |
200 | uint32_t bus, dev, func; | 200 | uint32_t bus, dev, func; | |
201 | 201 | |||
202 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | 202 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | |
203 | 203 | |||
204 | data = bus_space_read_4(pc->pci_conf_datat, pc->pci_conf_datah, | 204 | data = bus_space_read_4(pc->pci_conf_datat, pc->pci_conf_datah, | |
205 | (MPPB_CONF_STRIDE*dev) + reg); | 205 | (MPPB_CONF_STRIDE*dev) + reg); | |
206 | #ifdef MPPB_DEBUG | 206 | #ifdef MPPB_DEBUG_CONF | |
207 | aprint_normal("mppb conf read va: %lx, bus: %d, dev: %d, " | 207 | aprint_normal("mppb conf read va: %lx, bus: %d, dev: %d, " | |
208 | "func: %d, reg: %d -r-> data %x\n", | 208 | "func: %d, reg: %d -r-> data %x\n", | |
209 | pc->pci_conf_datah, bus, dev, func, reg, data); | 209 | pc->pci_conf_datah, bus, dev, func, reg, data); | |
210 | #endif | 210 | #endif /* MPPB_DEBUG_CONF */ | |
211 | return data; | 211 | return data; | |
212 | } | 212 | } | |
213 | 213 | |||
214 | void | 214 | void | |
215 | mppb_pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val) | 215 | mppb_pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val) | |
216 | { | 216 | { | |
217 | uint32_t bus, dev, func; | 217 | uint32_t bus, dev, func; | |
218 | 218 | |||
219 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | 219 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | |
220 | 220 | |||
221 | bus_space_write_4(pc->pci_conf_datat, pc->pci_conf_datah, | 221 | bus_space_write_4(pc->pci_conf_datat, pc->pci_conf_datah, | |
222 | (MPPB_CONF_STRIDE*dev) + reg, val); | 222 | (MPPB_CONF_STRIDE*dev) + reg, val); | |
223 | #ifdef MPPB_DEBUG | 223 | #ifdef MPPB_DEBUG_CONF | |
224 | aprint_normal("mppb conf write va: %lx, bus: %d, dev: %d, " | 224 | aprint_normal("mppb conf write va: %lx, bus: %d, dev: %d, " | |
225 | "func: %d, reg: %d -w-> data %x\n", | 225 | "func: %d, reg: %d -w-> data %x\n", | |
226 | pc->pci_conf_datah, bus, dev, func, reg, val); | 226 | pc->pci_conf_datah, bus, dev, func, reg, val); | |
227 | #endif | 227 | #endif /* MPPB_DEBUG_CONF */ | |
228 | 228 | |||
229 | } | 229 | } | |
230 | 230 | |||
231 | int | 231 | int | |
232 | mppb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno) | 232 | mppb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno) | |
233 | { | 233 | { | |
234 | return 4; /* Prometheus has 4 slots */ | 234 | return 4; /* Prometheus has 4 slots */ | |
235 | } | 235 | } | |
236 | 236 | |||
237 | void | 237 | void | |
238 | mppb_pci_attach_hook(struct device *parent, struct device *self, | 238 | mppb_pci_attach_hook(struct device *parent, struct device *self, | |
239 | struct pcibus_attach_args *pba) | 239 | struct pcibus_attach_args *pba) | |
240 | { | 240 | { |
--- src/sys/arch/amiga/pci/p5membar.c 2012/01/10 20:29:50 1.1
+++ src/sys/arch/amiga/pci/p5membar.c 2012/01/19 00:14:08 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: p5membar.c,v 1.1 2012/01/10 20:29:50 rkujawa Exp $ */ | 1 | /* $NetBSD: p5membar.c,v 1.2 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -91,27 +91,27 @@ p5membar_attach(device_t parent, device_ | @@ -91,27 +91,27 @@ p5membar_attach(device_t parent, device_ | |||
91 | 91 | |||
92 | sc->sc_dev = self; | 92 | sc->sc_dev = self; | |
93 | sc->sc_base = zap->pa; | 93 | sc->sc_base = zap->pa; | |
94 | sc->sc_size = zap->size; | 94 | sc->sc_size = zap->size; | |
95 | 95 | |||
96 | if ((bus_addr_t) zap->pa == P5BUS_PCI_CONF_BASE) { | 96 | if ((bus_addr_t) zap->pa == P5BUS_PCI_CONF_BASE) { | |
97 | aprint_normal(": PCI config area, %d kB\n", | 97 | aprint_normal(": PCI config area, %d kB\n", | |
98 | zap->size / 1024); | 98 | zap->size / 1024); | |
99 | sc->sc_type = P5MEMBAR_TYPE_INTERNAL; | 99 | sc->sc_type = P5MEMBAR_TYPE_INTERNAL; | |
100 | } else if ((bus_addr_t) zap->pa == P5BUS_PCI_IO_BASE) { | 100 | } else if ((bus_addr_t) zap->pa == P5BUS_PCI_IO_BASE) { | |
101 | aprint_normal(": PCI I/O area, %d kB\n", | 101 | aprint_normal(": PCI I/O area, %d kB\n", | |
102 | zap->size / 1024); | 102 | zap->size / 1024); | |
103 | sc->sc_type = P5MEMBAR_TYPE_INTERNAL; | 103 | sc->sc_type = P5MEMBAR_TYPE_INTERNAL; | |
104 | } else if ((bus_addr_t) zap->pa == P5BUS_PCI_BRIDGE_BASE) { | 104 | } else if ((bus_addr_t) zap->pa == P5BUS_BRIDGE_BASE) { | |
105 | aprint_normal(": PCI bridge, %d kB\n", | 105 | aprint_normal(": PCI bridge, %d kB\n", | |
106 | zap->size / 1024); | 106 | zap->size / 1024); | |
107 | sc->sc_type = P5MEMBAR_TYPE_INTERNAL; | 107 | sc->sc_type = P5MEMBAR_TYPE_INTERNAL; | |
108 | } else { | 108 | } else { | |
109 | aprint_normal(": PCI memory BAR, %d kB\n", | 109 | aprint_normal(": PCI memory BAR, %d kB\n", | |
110 | zap->size / 1024); | 110 | zap->size / 1024); | |
111 | sc->sc_type = P5MEMBAR_TYPE_MEMORY; | 111 | sc->sc_type = P5MEMBAR_TYPE_MEMORY; | |
112 | } | 112 | } | |
113 | 113 | |||
114 | /* | 114 | /* | |
115 | * Do nothing here, p5pb should find the p5membar devices | 115 | * Do nothing here, p5pb should find the p5membar devices | |
116 | * and do the right(tm) thing. | 116 | * and do the right(tm) thing. | |
117 | */ | 117 | */ |
--- src/sys/arch/amiga/pci/p5pb.c 2012/01/10 20:29:50 1.5
+++ src/sys/arch/amiga/pci/p5pb.c 2012/01/19 00:14:08 1.6
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | /* $NetBSD: p5pb.c,v 1.5 2012/01/10 20:29:50 rkujawa Exp $ */ | 1 | /* $NetBSD: p5pb.c,v 1.6 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
@@ -26,164 +26,249 @@ | @@ -26,164 +26,249 @@ | |||
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/types.h> | 32 | #include <sys/types.h> | |
33 | #include <sys/param.h> | 33 | #include <sys/param.h> | |
34 | #include <sys/time.h> | 34 | #include <sys/time.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/errno.h> | 36 | #include <sys/errno.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | #include <sys/malloc.h> | 38 | #include <sys/malloc.h> | |
39 | #include <sys/extent.h> | |||
40 | #include <sys/kmem.h> | 39 | #include <sys/kmem.h> | |
40 | #include <sys/extent.h> | |||
41 | 41 | |||
42 | #include <uvm/uvm_extern.h> | 42 | #include <uvm/uvm_extern.h> | |
43 | 43 | |||
44 | #include <machine/bus.h> | 44 | #include <machine/bus.h> | |
45 | #include <machine/cpu.h> | 45 | #include <machine/cpu.h> | |
46 | 46 | |||
47 | #include <m68k/bus_dma.h> | 47 | #include <m68k/bus_dma.h> | |
48 | #include <amiga/dev/zbusvar.h> | 48 | #include <amiga/dev/zbusvar.h> | |
49 | #include <amiga/dev/p5busvar.h> | 49 | #include <amiga/dev/p5busvar.h> | |
50 | #include <amiga/pci/p5pbreg.h> | 50 | #include <amiga/pci/p5pbreg.h> | |
51 | #include <amiga/pci/p5pbvar.h> | 51 | #include <amiga/pci/p5pbvar.h> | |
52 | #include <amiga/pci/p5membarvar.h> | 52 | #include <amiga/pci/p5membarvar.h> | |
53 | 53 | |||
54 | #include <dev/pci/pcivar.h> | 54 | #include <dev/pci/pcivar.h> | |
55 | #include <dev/pci/pcireg.h> | 55 | #include <dev/pci/pcireg.h> | |
56 | #include <dev/pci/pcidevs.h> | 56 | #include <dev/pci/pcidevs.h> | |
57 | #ifdef PCI_NETBSD_CONFIGURE | |||
57 | #include <dev/pci/pciconf.h> | 58 | #include <dev/pci/pciconf.h> | |
59 | #endif /* PCI_NETBSD_CONFIGURE */ | |||
60 | ||||
61 | #include "opt_p5pb.h" | |||
62 | #include "opt_pci.h" | |||
58 | 63 | |||
59 | /* Initial CVPPC/BVPPC resolution as configured by the firmware */ | 64 | /* Initial CVPPC/BVPPC resolution as configured by the firmware */ | |
60 | #define P5GFX_WIDTH 640 | 65 | #define P5GFX_WIDTH 640 | |
61 | #define P5GFX_HEIGHT 480 | 66 | #define P5GFX_HEIGHT 480 | |
62 | #define P5GFX_DEPTH 8 | 67 | #define P5GFX_DEPTH 8 | |
63 | #define P5GFX_LINEBYTES 640 | 68 | #define P5GFX_LINEBYTES 640 | |
64 | 69 | |||
65 | static int p5pb_match(struct device *, struct cfdata *, void *); | 70 | static int p5pb_match(struct device *, struct cfdata *, void *); | |
66 | static void p5pb_attach(struct device *, struct device *, void *); | 71 | static void p5pb_attach(struct device *, struct device *, void *); | |
67 | void p5pb_set_props(struct p5pb_softc *sc); | 72 | void p5pb_set_props(struct p5pb_softc *sc); | |
68 | pcireg_t p5pb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int); | 73 | pcireg_t p5pb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int); | |
69 | void p5pb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); | 74 | void p5pb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); | |
70 | int p5pb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno); | 75 | int p5pb_pci_bus_maxdevs_cvppc(pci_chipset_tag_t pc, int busno); | |
76 | int p5pb_pci_bus_maxdevs_grex1200(pci_chipset_tag_t pc, int busno); | |||
77 | int p5pb_pci_bus_maxdevs_grex4000(pci_chipset_tag_t pc, int busno); | |||
71 | int p5pb_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev, | 78 | int p5pb_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev, | |
72 | int func, pcireg_t id); | 79 | int func, pcireg_t id); | |
73 | void p5pb_pci_attach_hook (struct device *parent, | 80 | void p5pb_pci_attach_hook (struct device *parent, | |
74 | struct device *self, struct pcibus_attach_args *pba); | 81 | struct device *self, struct pcibus_attach_args *pba); | |
75 | pcitag_t p5pb_pci_make_tag(pci_chipset_tag_t pc, int bus, int device, | 82 | pcitag_t p5pb_pci_make_tag(pci_chipset_tag_t pc, int bus, int device, | |
76 | int function); | 83 | int function); | |
77 | void p5pb_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, | 84 | void p5pb_pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, | |
78 | int *bp, int *dp, int *fp); | 85 | int *bp, int *dp, int *fp); | |
79 | int p5pb_pci_intr_map(const struct pci_attach_args *pa, | 86 | int p5pb_pci_intr_map(const struct pci_attach_args *pa, | |
80 | pci_intr_handle_t *ihp); | 87 | pci_intr_handle_t *ihp); | |
81 | bool p5pb_bus_map_cvppc(struct p5pb_softc *sc); | 88 | bool p5pb_bus_map_memio(struct p5pb_softc *sc); | |
82 | bool p5pb_bus_map_grex(struct p5pb_softc *sc); | 89 | bool p5pb_bus_map_conf(struct p5pb_softc *sc); | |
83 | bool p5pb_bus_map_common(struct p5pb_softc *sc); | |||
84 | uint8_t p5pb_find_resources(struct p5pb_softc *sc); | 90 | uint8_t p5pb_find_resources(struct p5pb_softc *sc); | |
91 | static bool p5pb_identify_bridge(struct p5pb_softc *sc); | |||
92 | void p5pb_membar_grex(struct p5pb_softc *sc); | |||
93 | static bool p5pb_cvppc_probe(struct p5pb_softc *sc); | |||
94 | #ifdef PCI_NETBSD_CONFIGURE | |||
95 | bool p5pb_bus_reconfigure(struct p5pb_softc *sc); | |||
96 | #endif /* PCI_NETBSD_CONFIGURE */ | |||
97 | #ifdef P5PB_DEBUG | |||
98 | void p5pb_usable_ranges(struct p5pb_softc *sc); | |||
99 | void p5pb_badaddr_range(struct p5pb_softc *sc, bus_space_tag_t bust, | |||
100 | bus_addr_t base, size_t len); | |||
101 | void p5pb_conf_search(struct p5pb_softc *sc, uint16_t val); | |||
102 | #endif /* P5PB_DEBUG */ | |||
85 | 103 | |||
86 | CFATTACH_DECL_NEW(p5pb, sizeof(struct p5pb_softc), | 104 | CFATTACH_DECL_NEW(p5pb, sizeof(struct p5pb_softc), | |
87 | p5pb_match, p5pb_attach, NULL, NULL); | 105 | p5pb_match, p5pb_attach, NULL, NULL); | |
88 | 106 | |||
89 | static int | 107 | static int | |
90 | p5pb_match(device_t parent, cfdata_t cf, void *aux) | 108 | p5pb_match(device_t parent, cfdata_t cf, void *aux) | |
91 | { | 109 | { | |
92 | struct p5bus_attach_args *p5baa; | 110 | struct p5bus_attach_args *p5baa; | |
93 | 111 | |||
94 | p5baa = (struct p5bus_attach_args *) aux; | 112 | p5baa = (struct p5bus_attach_args *) aux; | |
95 | 113 | |||
96 | if (strcmp(p5baa->p5baa_name, "p5pb") == 0) | 114 | if (strcmp(p5baa->p5baa_name, "p5pb") == 0) | |
97 | return 1; | 115 | return 1; | |
98 | 116 | |||
99 | return 0; | 117 | return 0; | |
100 | } | 118 | } | |
101 | 119 | |||
102 | 120 | |||
103 | static void | 121 | static void | |
104 | p5pb_attach(device_t parent, device_t self, void *aux) | 122 | p5pb_attach(device_t parent, device_t self, void *aux) | |
105 | { | 123 | { | |
106 | struct p5pb_softc *sc; | 124 | struct p5pb_softc *sc; | |
107 | struct pcibus_attach_args pba; | 125 | struct pcibus_attach_args pba; | |
108 | 126 | |||
109 | sc = device_private(self); | 127 | sc = device_private(self); | |
110 | pci_chipset_tag_t pc = &sc->apc; | |||
111 | sc->sc_dev = self; | 128 | sc->sc_dev = self; | |
129 | sc->p5baa = (struct p5bus_attach_args *) aux; | |||
112 | 130 | |||
113 | if (p5pb_find_resources(sc) > 0) { | 131 | pci_chipset_tag_t pc = &sc->apc; | |
114 | sc->p5pb_bus_map = &p5pb_bus_map_grex; | 132 | ||
115 | } else { | 133 | if (!p5pb_bus_map_conf(sc)) { | |
116 | #ifdef P5PB_OLD_FIRMWARE | 134 | aprint_error_dev(self, | |
117 | sc->p5pb_bus_map = &p5pb_bus_map_cvppc; | 135 | "couldn't map PCI configuration space\n"); | |
118 | #else | |||
119 | aprint_normal(": no PCI bridges detected\n"); | |||
120 | return; | 136 | return; | |
121 | #endif /* P5PB_OLD_FIRMWARE */ | |||
122 | } | 137 | } | |
123 | 138 | |||
124 | aprint_normal(": Phase5 CVPPC/BVPPC/G-REX PCI bridge\n"); | 139 | if (!p5pb_identify_bridge(sc)) { | |
125 | ||||
126 | if(!p5pb_bus_map_common(sc)) { | |||
127 | aprint_error_dev(self, | |||
128 | "couldn't map PCI configuration and I/O spaces\n"); | |||
129 | return; | 140 | return; | |
130 | } | 141 | } | |
131 | 142 | |||
132 | if(!(sc->p5pb_bus_map(sc))) { | 143 | if (sc->bridge_type == P5PB_BRIDGE_CVPPC) { | |
144 | sc->pci_mem_lowest = P5BUS_PCI_MEM_BASE; | |||
145 | sc->pci_mem_highest = P5BUS_PCI_MEM_BASE + P5BUS_PCI_MEM_SIZE; | |||
146 | } else { | |||
147 | p5pb_membar_grex(sc); | |||
148 | } | |||
149 | ||||
150 | if (!p5pb_bus_map_memio(sc)) { | |||
133 | aprint_error_dev(self, | 151 | aprint_error_dev(self, | |
134 | "couldn't map PCI memory space\n"); | 152 | "couldn't map PCI I/O and memory space\n"); | |
135 | return; | 153 | return; | |
136 | } | 154 | } | |
137 | 155 | |||
138 | #ifdef P5PB_DEBUG | 156 | #ifdef P5PB_DEBUG | |
139 | aprint_normal("p5pb: mapped %x -> %x, %x -> %x\n, %x -> %x\n", | 157 | aprint_normal("p5pb: map conf %x -> %x, io %x -> %x, mem %x -> %x\n", | |
140 | P5BUS_PCI_CONF_BASE, sc->pci_conf_area.base, | 158 | kvtop((void*) sc->pci_conf_area.base), sc->pci_conf_area.base, | |
141 | P5BUS_PCI_IO_BASE, sc->pci_io_area.base, | 159 | kvtop((void*) sc->pci_io_area.base), sc->pci_io_area.base, | |
142 | P5BUS_PCI_MEM_BASE, sc->pci_mem_area.base ); | 160 | kvtop((void*) sc->pci_mem_area.base), sc->pci_mem_area.base ); | |
143 | #endif | 161 | #endif | |
144 | 162 | |||
145 | /* Initialize the PCI chipset tag. */ | 163 | /* Initialize the PCI chipset tag. */ | |
164 | ||||
165 | if (sc->bridge_type == P5PB_BRIDGE_GREX1200) | |||
166 | sc->apc.pc_bus_maxdevs = p5pb_pci_bus_maxdevs_grex1200; | |||
167 | else if (sc->bridge_type == P5PB_BRIDGE_GREX4000) | |||
168 | sc->apc.pc_bus_maxdevs = p5pb_pci_bus_maxdevs_grex4000; | |||
169 | else | |||
170 | sc->apc.pc_bus_maxdevs = p5pb_pci_bus_maxdevs_cvppc; | |||
171 | ||||
146 | sc->apc.pc_conf_v = (void*) pc; | 172 | sc->apc.pc_conf_v = (void*) pc; | |
147 | sc->apc.pc_bus_maxdevs = p5pb_pci_bus_maxdevs; | |||
148 | sc->apc.pc_make_tag = amiga_pci_make_tag; | 173 | sc->apc.pc_make_tag = amiga_pci_make_tag; | |
149 | sc->apc.pc_decompose_tag = amiga_pci_decompose_tag; | 174 | sc->apc.pc_decompose_tag = amiga_pci_decompose_tag; | |
150 | sc->apc.pc_conf_read = p5pb_pci_conf_read; | 175 | sc->apc.pc_conf_read = p5pb_pci_conf_read; | |
151 | sc->apc.pc_conf_write = p5pb_pci_conf_write; | 176 | sc->apc.pc_conf_write = p5pb_pci_conf_write; | |
177 | sc->apc.pc_conf_hook = p5pb_pci_conf_hook; | |||
178 | sc->apc.pc_conf_interrupt = amiga_pci_conf_interrupt; | |||
152 | sc->apc.pc_attach_hook = p5pb_pci_attach_hook; | 179 | sc->apc.pc_attach_hook = p5pb_pci_attach_hook; | |
153 | 180 | |||
154 | sc->apc.pc_intr_map = p5pb_pci_intr_map; | 181 | sc->apc.pc_intr_map = p5pb_pci_intr_map; | |
155 | sc->apc.pc_intr_string = amiga_pci_intr_string; | 182 | sc->apc.pc_intr_string = amiga_pci_intr_string; | |
156 | sc->apc.pc_intr_establish = amiga_pci_intr_establish; | 183 | sc->apc.pc_intr_establish = amiga_pci_intr_establish; | |
157 | sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish; | 184 | sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish; | |
185 | ||||
186 | #ifdef PCI_NETBSD_CONFIGURE | |||
187 | p5pb_bus_reconfigure(sc); | |||
188 | #endif /* PCI_NETBSD_CONFIGURE */ | |||
189 | ||||
190 | /* Initialize the bus attachment structure. */ | |||
158 | 191 | |||
159 | pba.pba_iot = &(sc->pci_io_area); | 192 | pba.pba_iot = &(sc->pci_io_area); | |
160 | pba.pba_memt = &(sc->pci_mem_area); | 193 | pba.pba_memt = &(sc->pci_mem_area); | |
161 | pba.pba_dmat = NULL; | 194 | pba.pba_dmat = NULL; | |
162 | pba.pba_dmat64 = NULL; | 195 | pba.pba_dmat64 = NULL; | |
163 | pba.pba_pc = pc; | 196 | pba.pba_pc = pc; | |
164 | pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; | 197 | pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; | |
165 | pba.pba_bus = 0; | 198 | pba.pba_bus = 0; | |
166 | pba.pba_bridgetag = NULL; | 199 | pba.pba_bridgetag = NULL; | |
167 | 200 | |||
168 | #ifdef P5PB_GENFB | 201 | /* If we are a CVPPC/BVPPC, set the properties needed for genfb. */ | |
169 | p5pb_set_props(sc); | 202 | if (sc->bridge_type == P5PB_BRIDGE_CVPPC) { | |
170 | #endif /* P5PB_GENFB */ | 203 | p5pb_set_props(sc); | |
204 | } | |||
171 | 205 | |||
172 | config_found_ia(self, "pcibus", &pba, pcibusprint); | 206 | config_found_ia(self, "pcibus", &pba, pcibusprint); | |
173 | } | 207 | } | |
174 | 208 | |||
209 | /* | |||
210 | * Try to detect what kind of bridge are we dealing with. | |||
211 | */ | |||
212 | static bool | |||
213 | p5pb_identify_bridge(struct p5pb_softc *sc) | |||
214 | { | |||
215 | int pcires_count; /* Number of AutoConfig(TM) PCI resources */ | |||
216 | ||||
217 | pcires_count = p5pb_find_resources(sc); | |||
218 | ||||
219 | switch (pcires_count) { | |||
220 | case 0: | |||
221 | /* | |||
222 | * Zero AutoConfig(TM) PCI resources, means that there's nothing | |||
223 | * OR there's a CVPPC/BVPPC with a pre-44.69 firmware. | |||
224 | */ | |||
225 | if (p5pb_cvppc_probe(sc)) { | |||
226 | sc->bridge_type = P5PB_BRIDGE_CVPPC; | |||
227 | aprint_normal(": Phase5 CVPPC/BVPPC PCI bridge\n"); | |||
228 | } else { | |||
229 | aprint_normal(": no PCI bridges detected\n"); | |||
230 | return false; | |||
231 | } | |||
232 | break; | |||
233 | case 6: | |||
234 | /* | |||
235 | * We have a slight possibility, that there's a CVPPC/BVPPC with | |||
236 | * the new firmware. So check for it first. | |||
237 | */ | |||
238 | if (p5pb_cvppc_probe(sc)) { | |||
239 | /* New firmware, treat as one-slot GREX. */ | |||
240 | sc->bridge_type = P5PB_BRIDGE_CVPPC; | |||
241 | aprint_normal( | |||
242 | ": Phase5 CVPPC/BVPPC PCI bridge (44.69/44.71)\n"); | |||
243 | break; | |||
244 | } | |||
245 | default: | |||
246 | /* We have a G-REX surely. */ | |||
247 | ||||
248 | if (sc->p5baa->p5baa_cardtype == P5_CARDTYPE_CS) { | |||
249 | sc->bridge_type = P5PB_BRIDGE_GREX4000; | |||
250 | aprint_normal(": DCE G-REX 4000 PCI bridge\n"); | |||
251 | } else { | |||
252 | sc->bridge_type = P5PB_BRIDGE_GREX1200; | |||
253 | aprint_normal(": DCE G-REX 1200 PCI bridge\n"); | |||
254 | } | |||
255 | break; | |||
256 | } | |||
257 | return true; | |||
258 | } | |||
259 | ||||
175 | /* | 260 | /* | |
176 | * Find autoconfigured resuorces (for boards running G-REX firmware). Return the | 261 | * Find AutoConfig(TM) resuorces (for boards running G-REX firmware). Return the | |
177 | * total number of found resources. | 262 | * total number of found resources. | |
178 | */ | 263 | */ | |
179 | uint8_t | 264 | uint8_t | |
180 | p5pb_find_resources(struct p5pb_softc *sc) | 265 | p5pb_find_resources(struct p5pb_softc *sc) | |
181 | { | 266 | { | |
182 | uint8_t i, rv; | 267 | uint8_t i, rv; | |
183 | struct p5pb_autoconf_entry *auto_entry; | 268 | struct p5pb_autoconf_entry *auto_entry; | |
184 | struct p5membar_softc *membar_sc; | 269 | struct p5membar_softc *membar_sc; | |
185 | device_t p5membar_dev; | 270 | device_t p5membar_dev; | |
186 | 271 | |||
187 | rv = 0; | 272 | rv = 0; | |
188 | 273 | |||
189 | TAILQ_INIT(&sc->auto_bars); | 274 | TAILQ_INIT(&sc->auto_bars); | |
@@ -205,175 +290,322 @@ p5pb_find_resources(struct p5pb_softc *s | @@ -205,175 +290,322 @@ p5pb_find_resources(struct p5pb_softc *s | |||
205 | KM_SLEEP); | 290 | KM_SLEEP); | |
206 | 291 | |||
207 | auto_entry->base = membar_sc->sc_base; | 292 | auto_entry->base = membar_sc->sc_base; | |
208 | auto_entry->size = membar_sc->sc_size; | 293 | auto_entry->size = membar_sc->sc_size; | |
209 | 294 | |||
210 | TAILQ_INSERT_TAIL(&sc->auto_bars, auto_entry, entries); | 295 | TAILQ_INSERT_TAIL(&sc->auto_bars, auto_entry, entries); | |
211 | } | 296 | } | |
212 | } | 297 | } | |
213 | return rv; | 298 | return rv; | |
214 | } | 299 | } | |
215 | 300 | |||
216 | /* | 301 | /* | |
217 | * Set properties needed to support fb driver. These are read later during | 302 | * Set properties needed to support fb driver. These are read later during | |
218 | * autoconfg in device_register(). | 303 | * autoconfg in device_register(). Needed for CVPPC/BVPPC. | |
219 | */ | 304 | */ | |
220 | void | 305 | void | |
221 | p5pb_set_props(struct p5pb_softc *sc) | 306 | p5pb_set_props(struct p5pb_softc *sc) | |
222 | { | 307 | { | |
223 | prop_dictionary_t dict; | 308 | prop_dictionary_t dict; | |
224 | device_t dev; | 309 | device_t dev; | |
225 | 310 | |||
226 | dev = sc->sc_dev; | 311 | dev = sc->sc_dev; | |
227 | dict = device_properties(dev); | 312 | dict = device_properties(dev); | |
228 | 313 | |||
229 | prop_dictionary_set_uint32(dict, "width", P5GFX_WIDTH); | 314 | prop_dictionary_set_uint32(dict, "width", P5GFX_WIDTH); | |
230 | prop_dictionary_set_uint32(dict, "height", P5GFX_HEIGHT); | 315 | prop_dictionary_set_uint32(dict, "height", P5GFX_HEIGHT); | |
231 | prop_dictionary_set_uint8(dict, "depth", P5GFX_DEPTH); | 316 | prop_dictionary_set_uint8(dict, "depth", P5GFX_DEPTH); | |
232 | prop_dictionary_set_uint16(dict, "linebytes", P5GFX_LINEBYTES); | 317 | prop_dictionary_set_uint16(dict, "linebytes", P5GFX_LINEBYTES); | |
233 | prop_dictionary_set_uint64(dict, "address", P5BUS_PCI_MEM_BASE); | 318 | prop_dictionary_set_uint64(dict, "address", | |
319 | kvtop((void*) sc->pci_mem_area.base)); | |||
234 | #if (NGENFB > 0) | 320 | #if (NGENFB > 0) | |
235 | /* | 321 | /* genfb needs virtual address too */ | |
236 | * Framebuffer starts at P5BUS_PCI_MEM_BASE, but genfb needs virtual | |||
237 | * address. | |||
238 | */ | |||
239 | prop_dictionary_set_uint64(dict, "virtual_address", | 322 | prop_dictionary_set_uint64(dict, "virtual_address", | |
240 | sc->pci_mem_area.base); | 323 | sc->pci_mem_area.base); | |
241 | #endif | 324 | #endif | |
242 | } | 325 | } | |
243 | 326 | |||
244 | pcireg_t | 327 | pcireg_t | |
245 | p5pb_pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) | 328 | p5pb_pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) | |
246 | { | 329 | { | |
247 | uint32_t data; | 330 | uint32_t data; | |
248 | uint32_t bus, dev, func; | 331 | uint32_t bus, dev, func; | |
249 | 332 | |||
250 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | 333 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | |
251 | 334 | |||
252 | data = bus_space_read_4(pc->pci_conf_datat, pc->pci_conf_datah, | 335 | data = bus_space_read_4(pc->pci_conf_datat, pc->pci_conf_datah, | |
253 | (func<<5) + reg); | 336 | + reg + (dev * OFF_PCI_DEVICE)); | |
254 | #ifdef P5PB_DEBUG | 337 | #ifdef P5PB_DEBUG_CONF | |
255 | aprint_normal("p5pb conf read va: %lx, bus: %d, dev: %d, " | 338 | aprint_normal("p5pb conf read va: %lx, bus: %d, dev: %d, " | |
256 | "func: %d, reg: %d -r-> data %x\n", | 339 | "func: %d, reg: %d -r-> data %x\n", | |
257 | pc->pci_conf_datah, bus, dev, func, reg, data); | 340 | pc->pci_conf_datah, bus, dev, func, reg, data); | |
258 | #endif | 341 | #endif | |
259 | return data; | 342 | return data; | |
260 | } | 343 | } | |
261 | 344 | |||
262 | void | 345 | void | |
263 | p5pb_pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val) | 346 | p5pb_pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val) | |
264 | { | 347 | { | |
265 | uint32_t bus, dev, func; | 348 | uint32_t bus, dev, func; | |
266 | 349 | |||
267 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | 350 | pci_decompose_tag(pc, tag, &bus, &dev, &func); | |
268 | 351 | |||
269 | bus_space_write_4(pc->pci_conf_datat, pc->pci_conf_datah, | 352 | bus_space_write_4(pc->pci_conf_datat, pc->pci_conf_datah, | |
270 | (func << 5) + reg, val); | 353 | + reg + (dev * OFF_PCI_DEVICE), val); | |
271 | #ifdef P5PB_DEBUG | 354 | #ifdef P5PB_DEBUG_CONF | |
272 | aprint_normal("p5pb conf write va: %lx, bus: %d, dev: %d, " | 355 | aprint_normal("p5pb conf write va: %lx, bus: %d, dev: %d, " | |
273 | "func: %d, reg: %d -w-> data %x\n", | 356 | "func: %d, reg: %d -w-> data %x\n", | |
274 | pc->pci_conf_datah, bus, dev, func, reg, val); | 357 | pc->pci_conf_datah, bus, dev, func, reg, val); | |
275 | #endif | 358 | #endif | |
276 | 359 | |||
277 | } | 360 | } | |
278 | 361 | |||
279 | int | 362 | int | |
280 | p5pb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno) | 363 | p5pb_pci_bus_maxdevs_cvppc(pci_chipset_tag_t pc, int busno) | |
281 | { | 364 | { | |
282 | /* G-REX has max 5 slots. CVPPC/BVPPC has only 1. */ | 365 | /* CVPPC/BVPPC has only 1 "slot". */ | |
283 | return 1; | 366 | return 1; | |
284 | } | 367 | } | |
285 | 368 | |||
369 | int | |||
370 | p5pb_pci_bus_maxdevs_grex4000(pci_chipset_tag_t pc, int busno) | |||
371 | { | |||
372 | /* G-REX 4000 has 4 slots. */ | |||
373 | return 1; /* XXX: 4 not yet! */ | |||
374 | } | |||
375 | ||||
376 | int | |||
377 | p5pb_pci_bus_maxdevs_grex1200(pci_chipset_tag_t pc, int busno) | |||
378 | { | |||
379 | /* G-REX 1200 has 5 slots. */ | |||
380 | return 1; /* XXX: 5 not yet! */ | |||
381 | } | |||
382 | ||||
286 | void | 383 | void | |
287 | p5pb_pci_attach_hook(struct device *parent, struct device *self, | 384 | p5pb_pci_attach_hook(struct device *parent, struct device *self, | |
288 | struct pcibus_attach_args *pba) | 385 | struct pcibus_attach_args *pba) | |
289 | { | 386 | { | |
290 | } | 387 | } | |
291 | 388 | |||
292 | int | 389 | int | |
293 | p5pb_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) | 390 | p5pb_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) | |
294 | { | 391 | { | |
295 | /* TODO: add sanity checking */ | 392 | /* TODO: add sanity checking */ | |
296 | 393 | |||
297 | *ihp = 2; | 394 | *ihp = 2; | |
298 | return 0; | 395 | return 0; | |
299 | } | 396 | } | |
300 | 397 | |||
301 | /* PCI memory mapping done G-REX-style. */ | 398 | /* Probe for CVPPC/BVPPC. */ | |
399 | static bool | |||
400 | p5pb_cvppc_probe(struct p5pb_softc *sc) | |||
401 | { | |||
402 | bus_space_handle_t probe_h; | |||
403 | uint16_t prodid, manid; | |||
404 | void* data; | |||
405 | bool rv; | |||
406 | ||||
407 | manid = 0; prodid = 0; | |||
408 | rv = false; | |||
409 | ||||
410 | if (bus_space_map(sc->apc.pci_conf_datat, 0, 4, 0, &probe_h)) | |||
411 | return rv; | |||
412 | ||||
413 | data = bus_space_vaddr(sc->apc.pci_conf_datat, probe_h); | |||
414 | ||||
415 | if (badaddr((void *)__UNVOLATILE((uint32_t) data))) { | |||
416 | #ifdef P5PB_DEBUG_PROBE | |||
417 | aprint_normal("p5pb: CVPPC configuration space not usable!\n"); | |||
418 | #endif /* P5PB_DEBUG_PROBE */ | |||
419 | } else { | |||
420 | prodid = bus_space_read_2(sc->apc.pci_conf_datat, probe_h, 0); | |||
421 | manid = bus_space_read_2(sc->apc.pci_conf_datat, probe_h, 2); | |||
422 | ||||
423 | if ((prodid == P5PB_PM2_PRODUCT_ID) && | |||
424 | (manid == P5PB_PM2_VENDOR_ID)) | |||
425 | rv = true; | |||
426 | } | |||
427 | ||||
428 | #ifdef P5PB_DEBUG_PROBE | |||
429 | aprint_normal("p5pb: CVPPC probe for PCI ID: %x, %x returns %d\n", | |||
430 | manid, prodid, (int) rv); | |||
431 | #endif /* P5PB_DEBUG_PROBE */ | |||
432 | ||||
433 | bus_space_unmap(sc->apc.pci_conf_datat, probe_h, 4); | |||
434 | return rv; | |||
435 | } | |||
436 | ||||
437 | #ifdef PCI_NETBSD_CONFIGURE | |||
438 | /* Reconfigure the bus. */ | |||
302 | bool | 439 | bool | |
303 | p5pb_bus_map_grex(struct p5pb_softc *sc) | 440 | p5pb_bus_reconfigure(struct p5pb_softc *sc) | |
304 | { | 441 | { | |
305 | struct p5pb_autoconf_entry *membar_entry; | 442 | struct extent *ioext, *memext; | |
306 | bus_addr_t bar_address; | 443 | pci_chipset_tag_t pc; | |
307 | bus_addr_t pci_mem_highest; | |||
308 | 444 | |||
309 | pci_mem_highest = P5BUS_PCI_MEM_BASE; | 445 | pc = &sc->apc; | |
310 | 446 | |||
311 | #ifdef P5PB_DEBUG | 447 | ioext = extent_create("p5pbio", 0, P5BUS_PCI_IO_SIZE, M_DEVBUF, NULL, 0, | |
312 | aprint_normal("p5pb: p5pb_bus_map_grex called\n"); | 448 | EX_NOWAIT); | |
449 | ||||
450 | memext = extent_create("p5pbmem", sc->pci_mem_lowest, | |||
451 | sc->pci_mem_highest, M_DEVBUF, NULL, 0, EX_NOWAIT); | |||
452 | ||||
453 | if ( (!ioext) || (!memext) ) | |||
454 | return false; | |||
455 | ||||
456 | #ifdef P5PB_DEBUG | |||
457 | aprint_normal("p5pb: reconfiguring the bus!\n"); | |||
313 | #endif /* P5PB_DEBUG */ | 458 | #endif /* P5PB_DEBUG */ | |
459 | pci_configure_bus(pc, ioext, memext, NULL, 0, CACHELINE_SIZE); | |||
314 | 460 | |||
315 | /* Determine the highest address used by any PCI card. */ | 461 | extent_destroy(ioext); | |
316 | TAILQ_FOREACH(membar_entry, &sc->auto_bars, entries) { | 462 | extent_destroy(memext); | |
317 | 463 | |||
318 | bar_address = (bus_addr_t) membar_entry->base; | 464 | return true; /* TODO: better error handling */ | |
319 | if ((bar_address + membar_entry->size) > pci_mem_highest) | 465 | } | |
320 | pci_mem_highest = bar_address + membar_entry->size; | 466 | #endif /* PCI_NETBSD_CONFIGURE */ | |
321 | 467 | |||
322 | #ifdef P5PB_DEBUG | 468 | /* Determine the PCI memory space (done G-REX-style). */ | |
323 | aprint_normal("p5pb: memory BAR at %p, highest address %x\n", | 469 | void | |
324 | membar_entry->base, pci_mem_highest); | 470 | p5pb_membar_grex(struct p5pb_softc *sc) | |
325 | #endif /* P5PB_DEBUG */ | 471 | { | |
472 | struct p5pb_autoconf_entry *membar_entry; | |||
473 | uint32_t bar_address; | |||
474 | ||||
475 | sc->pci_mem_lowest = 0xFFFFFFFF; | |||
476 | sc->pci_mem_highest = 0; | |||
477 | ||||
478 | /* Iterate over membar entries to find lowest and highest address. */ | |||
479 | TAILQ_FOREACH(membar_entry, &sc->auto_bars, entries) { | |||
480 | ||||
481 | bar_address = (uint32_t) membar_entry->base; | |||
482 | if ((bar_address + membar_entry->size) > sc->pci_mem_highest) | |||
483 | sc->pci_mem_highest = bar_address + membar_entry->size; | |||
484 | if (bar_address < sc->pci_mem_lowest) | |||
485 | sc->pci_mem_lowest = bar_address; | |||
486 | ||||
487 | #ifdef P5PB_DEBUG_BAR | |||
488 | aprint_normal("p5pb: %d kB mem BAR at %p, hi = %x, lo = %x\n", | |||
489 | membar_entry->size / 1024, membar_entry->base, | |||
490 | sc->pci_mem_highest, sc->pci_mem_lowest); | |||
491 | #endif /* P5PB_DEBUG_BAR */ | |||
326 | } | 492 | } | |
327 | 493 | |||
328 | sc->pci_mem_area.base = (bus_addr_t) zbusmap( | 494 | aprint_normal("p5pb: %d kB PCI memory space (%8p to %8p)\n", | |
329 | (void *) P5BUS_PCI_MEM_BASE, pci_mem_highest - P5BUS_PCI_MEM_BASE); | 495 | (sc->pci_mem_highest - sc->pci_mem_lowest) / 1024, | |
330 | sc->pci_mem_area.absm = &amiga_bus_stride_1swap_abs; | 496 | (void*) sc->pci_mem_lowest, (void*) sc->pci_mem_highest); | |
331 | 497 | |||
332 | return true; | |||
333 | } | 498 | } | |
334 | 499 | |||
335 | /* Map things common for all supported bridges. */ | |||
336 | bool | 500 | bool | |
337 | p5pb_bus_map_common(struct p5pb_softc *sc) | 501 | p5pb_bus_map_conf(struct p5pb_softc *sc) | |
338 | { | 502 | { | |
339 | #ifdef P5PB_DEBUG | |||
340 | aprint_normal("p5pb: p5pb_bus_map_common called\n"); | |||
341 | #endif /* P5PB_DEBUG */ | |||
342 | ||||
343 | sc->pci_conf_area.base = (bus_addr_t) zbusmap( | 503 | sc->pci_conf_area.base = (bus_addr_t) zbusmap( | |
344 | (void *) P5BUS_PCI_CONF_BASE, P5BUS_PCI_CONF_SIZE); | 504 | (void *) P5BUS_PCI_CONF_BASE, P5BUS_PCI_CONF_SIZE); | |
345 | sc->pci_conf_area.absm = &amiga_bus_stride_1; | 505 | sc->pci_conf_area.absm = &amiga_bus_stride_1; | |
346 | 506 | |||
347 | sc->pci_io_area.base = (bus_addr_t) zbusmap( | |||
348 | (void *) P5BUS_PCI_IO_BASE, P5BUS_PCI_IO_SIZE); | |||
349 | sc->pci_io_area.absm = &amiga_bus_stride_1swap_abs; | |||
350 | ||||
351 | sc->apc.pci_conf_datat = &(sc->pci_conf_area); | 507 | sc->apc.pci_conf_datat = &(sc->pci_conf_area); | |
352 | sc->apc.pci_conf_addresst = &(sc->pci_conf_area); | |||
353 | 508 | |||
354 | if (bus_space_map(sc->apc.pci_conf_datat, OFF_PCI_CONF_DATA, | 509 | if (bus_space_map(sc->apc.pci_conf_datat, OFF_PCI_CONF_DATA, | |
355 | 256, 0, &sc->apc.pci_conf_datah)) | 510 | 256, 0, &sc->apc.pci_conf_datah)) | |
356 | return false; | 511 | return false; | |
357 | 512 | |||
358 | /* XXX */ | |||
359 | /* if (bus_space_map(sc->apc.pci_conf_addresst, OFF_PCI_CONF_ADDR, | |||
360 | 256, 0, &sc->apc.pci_conf_addressh)) | |||
361 | return false; */ | |||
362 | ||||
363 | return true; | 513 | return true; | |
364 | } | 514 | } | |
365 | 515 | |||
366 | /* Hard-coded memory mapping for CVPPC/BVPPC (without G-REX firmware). */ | 516 | /* Map I/O and memory space. */ | |
367 | bool | 517 | bool | |
368 | p5pb_bus_map_cvppc(struct p5pb_softc *sc) | 518 | p5pb_bus_map_memio(struct p5pb_softc *sc) | |
369 | { | 519 | { | |
370 | #ifdef P5PB_DEBUG | 520 | sc->pci_io_area.base = (bus_addr_t) zbusmap( | |
371 | aprint_normal("p5pb: p5pb_bus_map_cvppc called\n"); | 521 | (void *) P5BUS_PCI_IO_BASE, P5BUS_PCI_IO_SIZE); | |
372 | #endif /* P5PB_DEBUG */ | 522 | sc->pci_io_area.absm = &amiga_bus_stride_1swap; | |
523 | ||||
373 | sc->pci_mem_area.base = (bus_addr_t) zbusmap( | 524 | sc->pci_mem_area.base = (bus_addr_t) zbusmap( | |
374 | (void *) P5BUS_PCI_MEM_BASE, P5BUS_PCI_MEM_SIZE); | 525 | (void *) sc->pci_mem_lowest, | |
526 | sc->pci_mem_highest - sc->pci_mem_lowest); | |||
375 | sc->pci_mem_area.absm = &amiga_bus_stride_1swap_abs; | 527 | sc->pci_mem_area.absm = &amiga_bus_stride_1swap_abs; | |
376 | 528 | |||
377 | return true; | 529 | return true; | |
378 | } | 530 | } | |
379 | 531 | |||
532 | int | |||
533 | p5pb_pci_conf_hook(pci_chipset_tag_t pct, int bus, int dev, | |||
534 | int func, pcireg_t id) | |||
535 | { | |||
536 | /* XXX: What should we do on CVPPC/BVPPC? It breaks genfb. */ | |||
537 | ||||
538 | return PCI_CONF_DEFAULT; | |||
539 | } | |||
540 | ||||
541 | #ifdef P5PB_DEBUG | |||
542 | /* Check which config and I/O ranges are usable. */ | |||
543 | void | |||
544 | p5pb_usable_ranges(struct p5pb_softc *sc) | |||
545 | { | |||
546 | p5pb_badaddr_range(sc, &(sc->pci_conf_area), 0, P5BUS_PCI_CONF_SIZE); | |||
547 | p5pb_badaddr_range(sc, &(sc->pci_io_area), 0, P5BUS_PCI_IO_SIZE); | |||
548 | } | |||
549 | ||||
550 | void | |||
551 | p5pb_badaddr_range(struct p5pb_softc *sc, bus_space_tag_t bust, bus_addr_t base, | |||
552 | size_t len) | |||
553 | { | |||
554 | int i, state, prev_state; | |||
555 | bus_space_handle_t bush; | |||
556 | volatile void *data; | |||
557 | ||||
558 | state = -1; | |||
559 | prev_state = -1; | |||
560 | ||||
561 | bus_space_map(bust, base, len, 0, &bush); | |||
562 | ||||
563 | aprint_normal("p5pb: badaddr range check from %x (%x) to %x (%x)\n", | |||
564 | (bus_addr_t) bush, /* start VA */ | |||
565 | (bus_addr_t) kvtop((void*) bush), /* start PA */ | |||
566 | (bus_addr_t) bush + len, /* end VA */ | |||
567 | (bus_addr_t) kvtop((void*) (bush + len)));/* end PA */ | |||
568 | ||||
569 | data = bus_space_vaddr(bust, bush); | |||
570 | ||||
571 | for(i = 0; i < len; i++) { | |||
572 | state = badaddr((void *)__UNVOLATILE(((uint32_t) data + i))); | |||
573 | if(state != prev_state) { | |||
574 | aprint_normal("p5pb: badaddr %p (%x) : %d\n", | |||
575 | (void*) ((uint32_t) data + i), | |||
576 | (bus_addr_t) kvtop((void*) ((uint32_t) data + i)), | |||
577 | state); | |||
578 | prev_state = state; | |||
579 | } | |||
580 | ||||
581 | } | |||
582 | ||||
583 | bus_space_unmap(bust, bush, len); | |||
584 | } | |||
585 | ||||
586 | /* Search for 16-bit value in the configuration space. */ | |||
587 | void | |||
588 | p5pb_conf_search(struct p5pb_softc *sc, uint16_t val) | |||
589 | { | |||
590 | int i, state; | |||
591 | uint16_t readv; | |||
592 | void *va; | |||
593 | ||||
594 | va = bus_space_vaddr(sc->apc.pci_conf_datat, sc->apc.pci_conf_datah); | |||
595 | ||||
596 | for (i = 0; i < P5BUS_PCI_CONF_SIZE; i++) { | |||
597 | state = badaddr((void *)__UNVOLATILE(((uint32_t) va + i))); | |||
598 | if(state == 0) { | |||
599 | readv = bus_space_read_2(sc->apc.pci_conf_datat, | |||
600 | sc->apc.pci_conf_datah, i); | |||
601 | if(readv == val) | |||
602 | aprint_normal("p5pb: found val %x @ %x (%x)\n", | |||
603 | readv, (uint32_t) sc->apc.pci_conf_datah | |||
604 | + i, (bus_addr_t) kvtop((void*) | |||
605 | ((uint32_t) sc->apc.pci_conf_datah + i))); | |||
606 | } | |||
607 | } | |||
608 | } | |||
609 | ||||
610 | #endif /* P5PB_DEBUG */ | |||
611 |
--- src/sys/arch/amiga/pci/p5pbreg.h 2012/01/11 17:04:29 1.5
+++ src/sys/arch/amiga/pci/p5pbreg.h 2012/01/19 00:14:08 1.6
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | /* $NetBSD: p5pbreg.h,v 1.5 2012/01/11 17:04:29 rkujawa Exp $ */ | 1 | /* $NetBSD: p5pbreg.h,v 1.6 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
@@ -24,62 +24,64 @@ | @@ -24,62 +24,64 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Reverse engineered Phase5 PCI bridge memory map (firmware 44.71): | 33 | * Reverse engineered Phase5 PCI bridge memory map (firmware 44.71): | |
34 | * | 34 | * | |
35 | * 0xFFFA0000 - PCI register space, 64KB | 35 | * 0xFFFA0000 - PCI register space, 64KB | |
36 | * 0xFFFC0000 - PCI configuration mechanism #1 data, 128KB | 36 | * 0xFFFC0000 - PCI configuration mechanism #1 data, 128KB | |
37 | * 0xFFFE0000 - (unknown, maybe PCI configuration mechanism #1 address, 4KB) | 37 | * 0xFFFE0000 - (unknown, probably PCI bridge configuration registers, 4KB) | |
38 | * | 38 | * | |
39 | * 0xE0000000 - Permedia RAM on CVPPC/BVPPC (1st aperture), 8MB | 39 | * 0xE0000000 - Permedia RAM on CVPPC/BVPPC (1st aperture), 8MB | |
40 | * 0xE0800000 - Permedia RAM on CVPPC/BVPPC (2nd aperture), 8MB | 40 | * 0xE0800000 - Permedia RAM on CVPPC/BVPPC (2nd aperture), 8MB | |
41 | * 0xE1000000 - Permedia registers, 128KB | 41 | * 0xE1000000 - Permedia registers on CVPPC/BVPPC, 128KB | |
42 | * | |||
43 | * 0x80000000 - PCI cards memory space on G-REX, variable size | |||
42 | * | 44 | * | |
43 | * Note: this map may not look the same for every firmware revision. | 45 | * Note: this map may not look the same for every firmware revision. | |
44 | * | 46 | * | |
45 | * The bridge is probably capable of DMA and interrupts, but this would | 47 | * The bridge is certainly capable of DMA, but this needs further reverse | |
46 | * need further reverse engineering, and is not really needed to drive | 48 | * engineering. | |
47 | * the Permedia 2 chip on CVPPC/BVPPC cards. | |||
48 | */ | 49 | */ | |
49 | #ifndef _AMIGA_P5PBREG_H_ | 50 | #ifndef _AMIGA_P5PBREG_H_ | |
50 | 51 | |||
51 | #define P5BUS_PCI_CONF_BASE 0xFFFC0000 | 52 | #define P5BUS_PCI_CONF_BASE 0xFFFC0000 | |
52 | #define P5BUS_PCI_CONF_SIZE 0x00020000 /* up to 128kB */ | 53 | #define P5BUS_PCI_CONF_SIZE 0x00020000 /* up to 128kB */ | |
53 | 54 | |||
54 | /* XXX: This is OK for CVPPC/BVPPC only! */ | 55 | #define OFF_PCI_CONF_DATA 0x00001000 /* also 0 on CVPPC */ | |
55 | #define P5BUS_PCI_MEM_BASE 0xE0000000 | 56 | #define OFF_PCI_DEVICE 0x00002000 | |
56 | #define P5BUS_PCI_MEM_SIZE 0x01010000 /* actually 0x01020000 */ | 57 | #define OFF_PCI_FUNCTION 0x00000100 | |
57 | 58 | |||
58 | #define P5BUS_PCI_IO_BASE 0xFFFA0000 | 59 | #define P5BUS_PCI_IO_BASE 0xFFFA0000 | |
59 | #define P5BUS_PCI_IO_SIZE 0x0000FFFF /* 64kB */ | 60 | #define P5BUS_PCI_IO_SIZE 0x00010000 /* 64kB */ | |
60 | ||||
61 | #define P5BUS_PCI_BRIDGE_BASE 0xFFFE0000 | |||
62 | #define P5BUS_PCI_BRIDGE_SIZE 0x0000FFFF /* 64kB, 4kB on some fw revs */ | |||
63 | 61 | |||
64 | #define OFF_PCI_CONF_DATA 0x00000000 | 62 | /* Bridge configuration */ | |
63 | #define P5BUS_BRIDGE_BASE 0xFFFE0000 | |||
64 | #define P5BUS_BRIDGE_SIZE 0x00001000 /* 64kB, 4kB on some fw revs */ | |||
65 | ||||
66 | #define OFF_BRIDGE_ENDIAN 0x0000 /* PCI_BRIDGE_BASE + offset */ | |||
67 | #define P5BUS_BRIDGE_ENDIAN_BIG 0x02 /* to switch into BE mode */ | |||
68 | #define OFF_BRIDGE_INTR 0x0010 /* ? XXX interrupt enable? */ | |||
69 | #define P5BUS_BRIDGE_INTR_INT2 0x01 /* ? XXX INT2? */ | |||
65 | 70 | |||
66 | #define P5BUS_CONF_ENDIAN 0x0000 /* PCI_BRIDGE_BASE + offset */ | 71 | /* CVPPC/BVPPC defaults. */ | |
67 | #define P5BUS_CONF_ENDIAN_BIG 0x02 /* to switch into BE mode */ | 72 | #define P5BUS_PCI_MEM_BASE 0xE0000000 | |
68 | #define P5BUS_CONF_INTR 0x0010 /* ? XXX interrupt enable? */ | 73 | /* #define P5BUS_PCI_MEM_BASE 0x80000000 */ /* default on G-REX */ | |
69 | #define P5BUS_CONF_INTR_INT2 0x01 /* ? XXX INT2? */ | 74 | #define P5BUS_PCI_MEM_SIZE 0x01020000 | |
70 | 75 | |||
71 | /* typical configuration of Permedia 2 on CVPPC/BVPPC */ | 76 | /* typical configuration of Permedia 2 on CVPPC/BVPPC */ | |
72 | #define OFF_P2_APERTURE_1 0x0 | 77 | #define OFF_P2_APERTURE_1 0x0 | |
73 | #define OFF_P2_APERTURE_2 0x00800000 | 78 | #define OFF_P2_APERTURE_2 0x00800000 | |
74 | #define OFF_P2_REGS 0x01000000 | 79 | #define OFF_P2_REGS 0x01000000 | |
75 | /* #define OFF_P2_REGS 0x0F000000 */ /* ? alt. Permedia regs */ | 80 | /* #define OFF_P2_REGS 0x0F000000 */ /* ? alt. Permedia regs */ | |
76 | 81 | |||
77 | /* PCI configuration register on CV64/3D, base is an offset from card base */ | 82 | /* Permedia 2 vendor and product IDs, for CVPPC/BVPPC probe. */ | |
78 | #define CV643D_PCI_CONF_BASE 0xC0E0000 | 83 | #define P5PB_PM2_VENDOR_ID 0x104C | |
79 | #define CV643D_PCI_CONF_SIZE 0xFFF | 84 | #define P5PB_PM2_PRODUCT_ID 0x3D07 | |
80 | #define CV643D_PCI_MEM_BASE 0x4000000 | |||
81 | #define CV643D_PCI_MEM_SIZ 0x4000FFF | |||
82 | #define CV643D_PCI_IO_BASE 0xC000000 | |||
83 | #define CV643D_PCI_IO_SIZE 0xFFFF | |||
84 | 85 | |||
85 | #endif /* _AMIGA_P5PBREG_H_ */ | 86 | #endif /* _AMIGA_P5PBREG_H_ */ | |
87 |
--- src/sys/arch/amiga/pci/p5pbvar.h 2012/01/10 20:29:50 1.2
+++ src/sys/arch/amiga/pci/p5pbvar.h 2012/01/19 00:14:08 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: p5pbvar.h,v 1.2 2012/01/10 20:29:50 rkujawa Exp $ */ | 1 | /* $NetBSD: p5pbvar.h,v 1.3 2012/01/19 00:14:08 rkujawa Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Radoslaw Kujawa. | 8 | * by Radoslaw Kujawa. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -35,27 +35,33 @@ | @@ -35,27 +35,33 @@ | |||
35 | #include <dev/pci/pcivar.h> | 35 | #include <dev/pci/pcivar.h> | |
36 | #include <dev/pci/pciconf.h> | 36 | #include <dev/pci/pciconf.h> | |
37 | #include <machine/pci_machdep.h> | 37 | #include <machine/pci_machdep.h> | |
38 | 38 | |||
39 | struct p5pb_autoconf_entry { | 39 | struct p5pb_autoconf_entry { | |
40 | volatile char *base; | 40 | volatile char *base; | |
41 | uint32_t size; | 41 | uint32_t size; | |
42 | TAILQ_ENTRY(p5pb_autoconf_entry) entries; | 42 | TAILQ_ENTRY(p5pb_autoconf_entry) entries; | |
43 | }; | 43 | }; | |
44 | 44 | |||
45 | struct p5pb_softc { | 45 | struct p5pb_softc { | |
46 | device_t sc_dev; | 46 | device_t sc_dev; | |
47 | 47 | |||
48 | volatile char *ba; | 48 | struct p5bus_attach_args *p5baa; | |
49 | ||||
49 | struct bus_space_tag pci_conf_area; | 50 | struct bus_space_tag pci_conf_area; | |
50 | struct bus_space_tag pci_mem_area; | 51 | struct bus_space_tag pci_mem_area; | |
51 | struct bus_space_tag pci_io_area; | 52 | struct bus_space_tag pci_io_area; | |
52 | struct amiga_pci_chipset apc; | 53 | struct amiga_pci_chipset apc; | |
53 | 54 | |||
54 | /* list of preconfigured BARs */ | 55 | uint8_t bridge_type; | |
55 | TAILQ_HEAD(, p5pb_autoconf_entry) auto_bars; | 56 | #define P5PB_BRIDGE_CVPPC 1 | |
57 | #define P5PB_BRIDGE_GREX1200 2 | |||
58 | #define P5PB_BRIDGE_GREX4000 3 | |||
56 | 59 | |||
57 | bool(*p5pb_bus_map)(struct p5pb_softc *); | 60 | uint32_t pci_mem_lowest; | |
61 | uint32_t pci_mem_highest; | |||
58 | 62 | |||
63 | /* list of preconfigured BARs */ | |||
64 | TAILQ_HEAD(, p5pb_autoconf_entry) auto_bars; | |||
59 | }; | 65 | }; | |
60 | 66 | |||
61 | #endif /* _AMIGA_P5PBVAR_H_ */ | 67 | #endif /* _AMIGA_P5PBVAR_H_ */ |