From 51b12685a452e4b8e0794e27e711386c4e01f1cb Mon Sep 17 00:00:00 2001 From: ichiro Date: Sun, 8 Dec 2002 13:21:44 +0000 Subject: [PATCH] change flags of pmap_enter() in ixp12x0_io.c, ixpsip_io.c bug fix: ixp12x0_pci.c --- sys/arch/arm/ixp12x0/ixp12x0_io.c | 11 ++++---- sys/arch/arm/ixp12x0/ixp12x0_pci.c | 42 ++++++++++++++++++------------ sys/arch/arm/ixp12x0/ixpsip_io.c | 5 ++-- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/sys/arch/arm/ixp12x0/ixp12x0_io.c b/sys/arch/arm/ixp12x0/ixp12x0_io.c index e5aee90515bf..c04ca95d6201 100644 --- a/sys/arch/arm/ixp12x0/ixp12x0_io.c +++ b/sys/arch/arm/ixp12x0/ixp12x0_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp12x0_io.c,v 1.2 2002/09/27 15:35:48 provos Exp $ */ +/* $NetBSD: ixp12x0_io.c,v 1.3 2002/12/08 13:21:44 ichiro Exp $ */ /* * Copyright (c) 2002 @@ -189,14 +189,14 @@ ixp12x0_mem_bs_map(t, bpa, size, cacheable, bshp) paddr_t pa, endpa; vaddr_t va; - if ((bpa + size) >= IXP12X0_PCI_MEM_SIZE) + if ((bpa + size) >= IXP12X0_PCI_MEM_VBASE + IXP12X0_PCI_MEM_SIZE) return (EINVAL); /* * PCI MEM space is mapped same address as real memory */ - pa = trunc_page(bpa + IXP12X0_PCI_MEM_VBASE); - endpa = round_page((bpa + IXP12X0_PCI_MEM_VBASE) + size); + pa = trunc_page(bpa); + endpa = round_page(bpa + size); /* XXX use extent manager to check duplicate mapping */ @@ -209,7 +209,8 @@ ixp12x0_mem_bs_map(t, bpa, size, cacheable, bshp) for(; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, pa, - VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } pmap_update(pmap_kernel()); diff --git a/sys/arch/arm/ixp12x0/ixp12x0_pci.c b/sys/arch/arm/ixp12x0/ixp12x0_pci.c index 8e4ab302e170..545101704000 100644 --- a/sys/arch/arm/ixp12x0/ixp12x0_pci.c +++ b/sys/arch/arm/ixp12x0/ixp12x0_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp12x0_pci.c,v 1.2 2002/10/09 00:11:15 thorpej Exp $ */ +/* $NetBSD: ixp12x0_pci.c,v 1.3 2002/12/08 13:21:44 ichiro Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. * All rights reserved. @@ -65,7 +65,17 @@ void ixp12x0_pci_decompose_tag(void *, pcitag_t, int *, int *, int *); pcireg_t ixp12x0_pci_conf_read(void *, pcitag_t, int); void ixp12x0_pci_conf_write(void *, pcitag_t, int, pcireg_t); -#define MAX_PCI_DEVICES 21 +#define MAX_PCI_DEVICES 4 + +/* + * IXM1200 PCI configuration Cycles + * Device Address + * ------------------------------------- + * 0 IXP1200 0x0800 - 0x08FF + * 1 i21555 0x1000 - 0x10FF + * 2 i82559 0x2000 - 0x20FF + * 3 PMC expansion 0x4000 - 0x40FF + */ void ixp12x0_pci_init(pc, cookie) @@ -114,6 +124,10 @@ ixp12x0_pci_make_tag(v, bus, device, function) #ifdef PCI_DEBUG printf("ixp12x0_pci_make_tag(v=%p, bus=%d, device=%d, function=%d)\n", v, bus, device, function); +#endif +#ifdef PCI_DEBUG2 + printf("ixp12x0_pci_make_tag return = 0x%x\n", + ((bus << 16) | (device << 11) | (function << 8))); #endif return ((bus << 16) | (device << 11) | (function << 8)); } @@ -149,19 +163,18 @@ ixp12x0_pci_conf_read(v, tag, offset) ixp12x0_pci_decompose_tag(v, tag, &bus, &device, &function); - if (bus != 0) - address = IXP12X0_PCI_TYPE1_VBASE | ((bus & 0xff) << 16) | - ((device & 0x1F) << 8) | (offset & 0xff); - else /* bus == 0 */ - address = IXP12X0_PCI_TYPE0_VBASE | 0xc00000 | - ((device &0x1f) << 3 | (function & 0x7)) << 8 | - (offset & 0xff); + /* bus == 0 */ + address = IXP12X0_PCI_TYPE0_VBASE | + ((0x1) << (device)) << 11 | (offset & 0xff); /* XXX */ val = *((unsigned int *)address); #ifdef PCI_DEBUG printf("ixp12x0_pci_conf_read(addr=%08x)(v=%p tag=0x%08lx offset=0x%02x)=0x%08x\n", address, v, tag, offset, val); +#endif +#ifdef PCI_DEBUG2 + printf("ixp12x0_pci_conf_read(addr=%08x)(bus=0x%08x device=0x%08x function=0x%08x offset=0x%02x)\n", address, bus, device, function, offset); #endif return(val); } @@ -178,13 +191,10 @@ ixp12x0_pci_conf_write(v, tag, offset, val) ixp12x0_pci_decompose_tag(v, tag, &bus, &device, &function); - if (bus != 0) - address = IXP12X0_PCI_TYPE1_VBASE | ((bus & 0xff) << 16) | - ((device & 0x1F) << 8) | (offset & 0xff); - else /* bus == 0 */ - address = IXP12X0_PCI_TYPE0_VBASE | 0xc00000 | - ((device &0x1f) << 3 | (function & 0x7)) << 8 | - (offset & 0xff); + /* bus == 0 */ + address = IXP12X0_PCI_TYPE0_VBASE | + ((0x1) << (device)) << 11 | (offset & 0xff); /* XXX */ + #ifdef PCI_DEBUG printf("ixp12x0_pci_conf_write(addr=%08x)(v=%p tag=0x%08lx offset=0x%02x)=0x%08x\n", diff --git a/sys/arch/arm/ixp12x0/ixpsip_io.c b/sys/arch/arm/ixp12x0/ixpsip_io.c index c88440b155f6..b9a5d8624b8d 100644 --- a/sys/arch/arm/ixp12x0/ixpsip_io.c +++ b/sys/arch/arm/ixp12x0/ixpsip_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixpsip_io.c,v 1.2 2002/09/27 15:35:48 provos Exp $ */ +/* $NetBSD: ixpsip_io.c,v 1.3 2002/12/08 13:21:44 ichiro Exp $ */ /* * Copyright (c) 2002 @@ -159,7 +159,8 @@ ixpsip_bs_map(t, bpa, size, cacheable, bshp) *bshp = va + (bpa & PAGE_MASK); for(; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, pa, - VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } pmap_update(pmap_kernel());