Subject: Re: PCI memory space mapping on RD94/JC94
To: None <ur@a-r.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-arc
Date: 08/13/2001 03:14:38
In article <200106251511.f5PFBeT01955@mirage.ceres.dti.ne.jp>
I wrote:
> > > Yes, I know. BTW, I tried PCI_NETBSD_CONFIGURE on arc,
> >
> > Is this solved sip and siop problem?
>
> No, it dit not help at that time, but I doubt my fix was really correct.
> I'll try and check it again later.
I've tried PCI_NETBSD_CONFIGURE again with the attached patch.
But it does not work because TGA is not mapped properly.
After pci_configure_bus() is called, TGA console does not work.
With serial console, the kernel gets a panic on the attachment:
---
tga0 at pci0 dev 3 function 0: PCI configuration registers:
Common header:
0x00: 0x00041011 0x02800087 0x03800003 0x0000ff00
Vendor Name: Digital Equipment (0x1011)
Device Name: DECchip 21030 ("TGA") (0x0004)
[..snip..]
Type 0 ("normal" device) header:
0x10: 0x00000008 0x00000000 0x00000000 0x00000000
0x20: 0x00000000 0x00000000 0x00000000 0x00000000
0x30: 0x08000001 0x00000000 0x00000000 0x00000100
Base address register at 0x10
type: 32-bit prefetchable memory
base: 0x00000000, size: 0x08000000
[..snip..]
Expansion ROM Base Address: 0x08000001
[..snip..]
Digital Equipment DECchip 21030 ("TGA") (miscellaneous display, revision 0x03) at ? dev 3 function 0 (intrswiz 0, intrpin 0x1, i/o on, mem on, no quirks)arc_map_wired(0x100000000, 0x8000000): 2 is not enough
panic: arc_bus_space_compose_handle: cannot allocate KVA 0x100000000..0x108000000
Stopped in pid 0 (swapper) at 0x8037f320: jr ra
bdslot: nop
db>
---
I'm not sure my patch is really correct, though...
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp
---
Index: include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arc/include/pci_machdep.h,v
retrieving revision 1.2
diff -u -r1.2 pci_machdep.h
--- include/pci_machdep.h 2001/01/13 10:46:18 1.2
+++ include/pci_machdep.h 2001/08/12 17:59:36
@@ -53,6 +53,8 @@
struct device *, struct pcibus_attach_args *));
int (*pc_bus_maxdevs) __P((pci_chipset_tag_t, int));
pcitag_t (*pc_make_tag) __P((pci_chipset_tag_t, int, int, int));
+ void (*pc_decompose_tag) __P((pci_chipset_tag_t, pcitag_t,
+ int *, int *, int *));
pcireg_t (*pc_conf_read) __P((pci_chipset_tag_t, pcitag_t,
int));
void (*pc_conf_write) __P((pci_chipset_tag_t, pcitag_t, int,
@@ -65,6 +67,8 @@
pci_intr_handle_t, int, int (*)(void *), void *));
void (*pc_intr_disestablish) __P((pci_chipset_tag_t,
void *));
+ void (*pc_conf_interrupt) __P((pci_chipset_tag_t,
+ int, int, int, int, int *));
};
/*
@@ -76,6 +80,8 @@
(*(c)->pc_bus_maxdevs)((c), (b))
#define pci_make_tag(c, b, d, f) \
(*(c)->pc_make_tag)((c), (b), (d), (f))
+#define pci_decompose_tag(c, t, bp, dp, fp) \
+ (*(c)->pc_decompose_tag)((c), (t), (bp), (dp), (fp))
#define pci_conf_read(c, t, r) \
(*(c)->pc_conf_read)((c), (t), (r))
#define pci_conf_write(c, t, r, v) \
@@ -88,3 +94,5 @@
(*(c)->pc_intr_establish)((c), (ih), (l), (h), (a))
#define pci_intr_disestablish(c, iv) \
(*(c)->pc_intr_disestablish)((c), (iv))
+#define pci_conf_interrupt(c, b, d, f, s, i) \
+ (*(c)->pc_conf_interrupt)((c), (b), (d), (f), (s), (i))
Index: pci/necpb.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arc/pci/necpb.c,v
retrieving revision 1.8
diff -u -r1.8 necpb.c
--- pci/necpb.c 2001/06/13 15:18:27 1.8
+++ pci/necpb.c 2001/08/12 17:59:38
@@ -67,6 +67,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "opt_pci.h"
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
@@ -89,6 +91,9 @@
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
+#if defined(PCI_NETBSD_CONFIGURE)
+#include <dev/pci/pciconf.h>
+#endif
#include <arc/jazz/rd94.h>
#include <arc/pci/necpbvar.h>
@@ -113,6 +118,8 @@
void * necpb_intr_establish __P((pci_chipset_tag_t, pci_intr_handle_t,
int, int (*func)(void *), void *));
void necpb_intr_disestablish __P((pci_chipset_tag_t, void *));
+void necpb_conf_interrupt __P((pci_chipset_tag_t,
+ int, int, int, int, int *));
int necpb_intr(unsigned, struct clockframe *);
@@ -155,8 +162,12 @@
necpb_init(ncp)
struct necpb_context *ncp;
{
+#if defined(PCI_NETBSD_CONFIGURE)
+ struct extent *ioext, *memext;
+#else
pcitag_t tag;
pcireg_t csr;
+#endif
if (ncp->nc_initialized)
return;
@@ -176,13 +187,24 @@
ncp->nc_pc.pc_attach_hook = necpb_attach_hook;
ncp->nc_pc.pc_bus_maxdevs = necpb_bus_maxdevs;
ncp->nc_pc.pc_make_tag = necpb_make_tag;
+ ncp->nc_pc.pc_decompose_tag = necpb_decompose_tag;
ncp->nc_pc.pc_conf_read = necpb_conf_read;
ncp->nc_pc.pc_conf_write = necpb_conf_write;
ncp->nc_pc.pc_intr_map = necpb_intr_map;
ncp->nc_pc.pc_intr_string = necpb_intr_string;
ncp->nc_pc.pc_intr_establish = necpb_intr_establish;
ncp->nc_pc.pc_intr_disestablish = necpb_intr_disestablish;
+ ncp->nc_pc.pc_conf_interrupt = necpb_conf_interrupt;
+#if defined(PCI_NETBSD_CONFIGURE)
+ ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF,
+ NULL, 0, EX_NOWAIT);
+ memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF,
+ NULL, 0, EX_NOWAIT);
+ pci_configure_bus(&ncp->nc_pc, ioext, memext, NULL);
+ extent_destroy(ioext);
+ extent_destroy(memext);
+#else
/* XXX: enable all mem/io/busmaster */
tag = necpb_make_tag(&ncp->nc_pc, 0, 3, 0);
csr = necpb_conf_read(&ncp->nc_pc, tag, PCI_COMMAND_STATUS_REG);
@@ -201,6 +223,7 @@
csr |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
PCI_COMMAND_MASTER_ENABLE;
necpb_conf_write(&ncp->nc_pc, tag, PCI_COMMAND_STATUS_REG, csr);
+#endif
ncp->nc_initialized = 1;
}
@@ -455,6 +478,15 @@
q->ih_next = n->ih_next;
free(n, M_DEVBUF);
+}
+
+void
+necpb_conf_interrupt(pc, bus, dev, func, swiz, iline)
+ pci_chipset_tag_t pc;
+ int bus, dev, func, swiz, *iline;
+{
+
+ return;
}
/*