summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/adm5120/adm5120_machdep.c3
-rw-r--r--sys/mips/alchemy/alchemy_machdep.c3
-rw-r--r--sys/mips/atheros/ar71xx_machdep.c3
-rw-r--r--sys/mips/cavium/octeon_machdep.c8
-rw-r--r--sys/mips/idt/idt_machdep.c3
-rw-r--r--sys/mips/include/md_var.h6
-rw-r--r--sys/mips/include/pmap.h3
-rw-r--r--sys/mips/include/vmparam.h8
-rw-r--r--sys/mips/malta/malta_machdep.c3
-rw-r--r--sys/mips/mips/minidump_machdep.c4
-rw-r--r--sys/mips/mips/mp_machdep.c2
-rw-r--r--sys/mips/mips/pmap.c47
-rw-r--r--sys/mips/mips/uma_machdep.c87
-rw-r--r--sys/mips/mips/vm_machdep.c3
-rw-r--r--sys/mips/rmi/dev/nlge/if_nlge.c1
-rw-r--r--sys/mips/rmi/xlr_machdep.c7
-rw-r--r--sys/mips/rmi/xlr_pci.c7
-rw-r--r--sys/mips/sentry5/s5_machdep.c5
-rw-r--r--sys/mips/sibyte/sb_machdep.c5
19 files changed, 162 insertions, 46 deletions
diff --git a/sys/mips/adm5120/adm5120_machdep.c b/sys/mips/adm5120/adm5120_machdep.c
index 90a6b90..bc7b7b0 100644
--- a/sys/mips/adm5120/adm5120_machdep.c
+++ b/sys/mips/adm5120/adm5120_machdep.c
@@ -97,6 +97,9 @@ mips_init(void)
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1];
+
physmem = realmem;
init_param1();
diff --git a/sys/mips/alchemy/alchemy_machdep.c b/sys/mips/alchemy/alchemy_machdep.c
index a94d995..047fa42 100644
--- a/sys/mips/alchemy/alchemy_machdep.c
+++ b/sys/mips/alchemy/alchemy_machdep.c
@@ -97,6 +97,9 @@ mips_init(void)
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1];
+
physmem = realmem;
init_param1();
diff --git a/sys/mips/atheros/ar71xx_machdep.c b/sys/mips/atheros/ar71xx_machdep.c
index ec355cc..c8abc74 100644
--- a/sys/mips/atheros/ar71xx_machdep.c
+++ b/sys/mips/atheros/ar71xx_machdep.c
@@ -184,6 +184,9 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1] - phys_avail[0];
+
physmem = realmem;
/*
diff --git a/sys/mips/cavium/octeon_machdep.c b/sys/mips/cavium/octeon_machdep.c
index 886595c..edb92af 100644
--- a/sys/mips/cavium/octeon_machdep.c
+++ b/sys/mips/cavium/octeon_machdep.c
@@ -265,7 +265,7 @@ octeon_memory_init(void)
{
vm_paddr_t phys_end;
int64_t addr;
- unsigned i;
+ unsigned i, j;
phys_end = round_page(MIPS_KSEG0_TO_PHYS((vm_offset_t)&end));
@@ -274,6 +274,9 @@ octeon_memory_init(void)
phys_avail[0] = phys_end;
phys_avail[1] = 96 << 20;
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1];
+
realmem = physmem = btoc(phys_avail[1] - phys_avail[0]);
return;
}
@@ -314,6 +317,9 @@ octeon_memory_init(void)
i += 2;
}
+ for (j = 0; j < i; j++)
+ dump_avail[j] = phys_avail[j];
+
realmem = physmem;
}
diff --git a/sys/mips/idt/idt_machdep.c b/sys/mips/idt/idt_machdep.c
index 0dfee66..6c76c26 100644
--- a/sys/mips/idt/idt_machdep.c
+++ b/sys/mips/idt/idt_machdep.c
@@ -167,6 +167,9 @@ platform_start(__register_t a0, __register_t a1,
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1];
+
physmem = realmem;
/*
diff --git a/sys/mips/include/md_var.h b/sys/mips/include/md_var.h
index 3cebbdc..3e46ad3 100644
--- a/sys/mips/include/md_var.h
+++ b/sys/mips/include/md_var.h
@@ -77,6 +77,8 @@ void platform_identify(void);
extern int busdma_swi_pending;
void busdma_swi(void);
-struct dumperinfo;
-void minidumpsys(struct dumperinfo *);
+struct dumperinfo;
+void dump_add_page(vm_paddr_t);
+void dump_drop_page(vm_paddr_t);
+void minidumpsys(struct dumperinfo *);
#endif /* !_MACHINE_MD_VAR_H_ */
diff --git a/sys/mips/include/pmap.h b/sys/mips/include/pmap.h
index c082abb..cdbf9bc 100644
--- a/sys/mips/include/pmap.h
+++ b/sys/mips/include/pmap.h
@@ -163,6 +163,9 @@ void pmap_kenter_temporary_free(vm_paddr_t pa);
int pmap_compute_pages_to_dump(void);
void pmap_flush_pvcache(vm_page_t m);
int pmap_emulate_modified(pmap_t pmap, vm_offset_t va);
+void pmap_grow_direct_page_cache(void);
+vm_page_t pmap_alloc_direct_page(unsigned int index, int req);
+
#endif /* _KERNEL */
#endif /* !LOCORE */
diff --git a/sys/mips/include/vmparam.h b/sys/mips/include/vmparam.h
index 3050a91..212a0c3 100644
--- a/sys/mips/include/vmparam.h
+++ b/sys/mips/include/vmparam.h
@@ -46,11 +46,6 @@
/*
* Machine dependent constants mips processors.
*/
-/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack.
- */
-#define USRTEXT (1*PAGE_SIZE)
/*
* Virtual memory related constants, all in bytes
@@ -94,7 +89,6 @@
#define VM_MAX_ADDRESS ((vm_offset_t)(intptr_t)(int32_t)0xffffffff)
#define VM_MINUSER_ADDRESS ((vm_offset_t)0x00000000)
-#define VM_MAX_MMAP_ADDR VM_MAXUSER_ADDRESS
#ifdef __mips_n64
#define VM_MAXUSER_ADDRESS (VM_MINUSER_ADDRESS + (NPDEPG * NBSEG))
@@ -155,6 +149,8 @@
#define VM_INITIAL_PAGEIN 16
#endif
+#define UMA_MD_SMALL_ALLOC
+
/*
* max number of non-contig chunks of physical RAM you can have
*/
diff --git a/sys/mips/malta/malta_machdep.c b/sys/mips/malta/malta_machdep.c
index 6cbdcd8..0ff34cb 100644
--- a/sys/mips/malta/malta_machdep.c
+++ b/sys/mips/malta/malta_machdep.c
@@ -181,6 +181,9 @@ mips_init(void)
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1];
+
physmem = realmem;
init_param1();
diff --git a/sys/mips/mips/minidump_machdep.c b/sys/mips/mips/minidump_machdep.c
index 1ac384a..cded3ae 100644
--- a/sys/mips/mips/minidump_machdep.c
+++ b/sys/mips/mips/minidump_machdep.c
@@ -83,7 +83,7 @@ is_dumpable(vm_paddr_t pa)
return (0);
}
-static void
+void
dump_add_page(vm_paddr_t pa)
{
int idx, bit;
@@ -94,7 +94,7 @@ dump_add_page(vm_paddr_t pa)
atomic_set_int(&vm_page_dump[idx], 1ul << bit);
}
-static void
+void
dump_drop_page(vm_paddr_t pa)
{
int idx, bit;
diff --git a/sys/mips/mips/mp_machdep.c b/sys/mips/mips/mp_machdep.c
index 2b993cb..41de5fb 100644
--- a/sys/mips/mips/mp_machdep.c
+++ b/sys/mips/mips/mp_machdep.c
@@ -164,7 +164,7 @@ mips_ipi_handler(void *arg)
break;
case IPI_HARDCLOCK:
CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__);
- hardclockintr();;
+ hardclockintr();
break;
default:
panic("Unknown IPI 0x%0x on cpu %d", ipi, curcpu);
diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c
index 4e2b34e..7b0d09b 100644
--- a/sys/mips/mips/pmap.c
+++ b/sys/mips/mips/pmap.c
@@ -185,8 +185,6 @@ static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags);
static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags);
static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t);
static int init_pte_prot(vm_offset_t va, vm_page_t m, vm_prot_t prot);
-static vm_page_t pmap_alloc_pte_page(unsigned int index, int req);
-static void pmap_grow_pte_page_cache(void);
#ifdef SMP
static void pmap_invalidate_page_action(void *arg);
@@ -196,14 +194,15 @@ static void pmap_update_page_action(void *arg);
#ifndef __mips_n64
/*
- * This structure is for high memory (memory above 512Meg in 32 bit)
- * This memory area does not have direct mapping, so we a mechanism to do
- * temporary per-CPU mapping to access these addresses.
+ * This structure is for high memory (memory above 512Meg in 32 bit) support.
+ * The highmem area does not have a KSEG0 mapping, and we need a mechanism to
+ * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc.
*
- * At bootup we reserve 2 virtual pages per CPU for mapping highmem pages, to
- * access a highmem physical address on a CPU, we will disable interrupts and
- * add the mapping from the reserved virtual address for the CPU to the physical
- * address in the kernel pagetable.
+ * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To
+ * access a highmem physical address on a CPU, we map the physical address to
+ * the reserved virtual address for the CPU in the kernel pagetable. This is
+ * done with interrupts disabled(although a spinlock and sched_pin would be
+ * sufficient).
*/
struct local_sysmaps {
vm_offset_t base;
@@ -520,11 +519,11 @@ again:
}
/*
- * In 32 bit, we may have memory which cannot be mapped directly
- * this memory will need temporary mapping before it can be
+ * In 32 bit, we may have memory which cannot be mapped directly.
+ * This memory will need temporary mapping before it can be
* accessed.
*/
- if (!MIPS_DIRECT_MAPPABLE(phys_avail[i - 1]))
+ if (!MIPS_DIRECT_MAPPABLE(phys_avail[i - 1] - 1))
need_local_mappings = 1;
/*
@@ -893,7 +892,7 @@ pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
{
vm_offset_t va, sva;
- if (MIPS_DIRECT_MAPPABLE(end))
+ if (MIPS_DIRECT_MAPPABLE(end - 1))
return (MIPS_PHYS_TO_DIRECT(start));
va = sva = *virt;
@@ -1061,8 +1060,8 @@ pmap_pinit0(pmap_t pmap)
bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
}
-static void
-pmap_grow_pte_page_cache()
+void
+pmap_grow_direct_page_cache()
{
#ifdef __mips_n64
@@ -1072,8 +1071,8 @@ pmap_grow_pte_page_cache()
#endif
}
-static vm_page_t
-pmap_alloc_pte_page(unsigned int index, int req)
+vm_page_t
+pmap_alloc_direct_page(unsigned int index, int req)
{
vm_page_t m;
@@ -1106,8 +1105,8 @@ pmap_pinit(pmap_t pmap)
/*
* allocate the page directory page
*/
- while ((ptdpg = pmap_alloc_pte_page(NUSERPGTBLS, VM_ALLOC_NORMAL)) == NULL)
- pmap_grow_pte_page_cache();
+ while ((ptdpg = pmap_alloc_direct_page(NUSERPGTBLS, VM_ALLOC_NORMAL)) == NULL)
+ pmap_grow_direct_page_cache();
ptdva = MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(ptdpg));
pmap->pm_segtab = (pd_entry_t *)ptdva;
@@ -1140,11 +1139,11 @@ _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags)
/*
* Find or fabricate a new pagetable page
*/
- if ((m = pmap_alloc_pte_page(ptepindex, VM_ALLOC_NORMAL)) == NULL) {
+ if ((m = pmap_alloc_direct_page(ptepindex, VM_ALLOC_NORMAL)) == NULL) {
if (flags & M_WAITOK) {
PMAP_UNLOCK(pmap);
vm_page_unlock_queues();
- pmap_grow_pte_page_cache();
+ pmap_grow_direct_page_cache();
vm_page_lock_queues();
PMAP_LOCK(pmap);
}
@@ -1312,7 +1311,7 @@ pmap_growkernel(vm_offset_t addr)
#ifdef __mips_n64
if (*pdpe == 0) {
/* new intermediate page table entry */
- nkpg = pmap_alloc_pte_page(nkpt, VM_ALLOC_INTERRUPT);
+ nkpg = pmap_alloc_direct_page(nkpt, VM_ALLOC_INTERRUPT);
if (nkpg == NULL)
panic("pmap_growkernel: no memory to grow kernel");
*pdpe = (pd_entry_t)MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(nkpg));
@@ -1332,7 +1331,7 @@ pmap_growkernel(vm_offset_t addr)
/*
* This index is bogus, but out of the way
*/
- nkpg = pmap_alloc_pte_page(nkpt, VM_ALLOC_INTERRUPT);
+ nkpg = pmap_alloc_direct_page(nkpt, VM_ALLOC_INTERRUPT);
if (!nkpg)
panic("pmap_growkernel: no memory to grow kernel");
nkpt++;
@@ -3099,7 +3098,7 @@ pads(pmap_t pm)
va >= VM_MAXUSER_ADDRESS)
continue;
ptep = pmap_pte(pm, va);
- if (pmap_pte_v(ptep))
+ if (pte_test(ptep, PTE_V))
printf("%x:%x ", va, *(int *)ptep);
}
diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c
new file mode 100644
index 0000000..690fc23
--- /dev/null
+++ b/sys/mips/mips/uma_machdep.c
@@ -0,0 +1,87 @@
+/*-
+ * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/systm.h>
+#include <vm/vm.h>
+#include <vm/vm_page.h>
+#include <vm/vm_pageout.h>
+#include <vm/uma.h>
+#include <vm/uma_int.h>
+#include <machine/md_var.h>
+#include <machine/vmparam.h>
+
+void *
+uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
+{
+ static vm_pindex_t color;
+ vm_paddr_t pa;
+ vm_page_t m;
+ int pflags;
+ void *va;
+
+ *flags = UMA_SLAB_PRIV;
+
+ if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
+ pflags = VM_ALLOC_INTERRUPT;
+ else
+ pflags = VM_ALLOC_SYSTEM;
+
+ for (;;) {
+ m = pmap_alloc_direct_page(color++, pflags);
+ if (m == NULL) {
+ if (wait & M_NOWAIT)
+ return (NULL);
+ else
+ pmap_grow_direct_page_cache();
+ } else
+ break;
+ }
+
+ pa = VM_PAGE_TO_PHYS(m);
+ va = (void *)MIPS_PHYS_TO_DIRECT(pa);
+ if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
+ bzero(va, PAGE_SIZE);
+ return (va);
+}
+
+void
+uma_small_free(void *mem, int size, u_int8_t flags)
+{
+ vm_page_t m;
+ vm_paddr_t pa;
+
+ pa = MIPS_DIRECT_TO_PHYS((vm_offset_t)mem);
+ m = PHYS_TO_VM_PAGE(pa);
+ m->wire_count--;
+ vm_page_free(m);
+ atomic_subtract_int(&cnt.v_wire_count, 1);
+}
diff --git a/sys/mips/mips/vm_machdep.c b/sys/mips/mips/vm_machdep.c
index 73fab5a..b4059e6 100644
--- a/sys/mips/mips/vm_machdep.c
+++ b/sys/mips/mips/vm_machdep.c
@@ -538,6 +538,9 @@ sf_buf_free(struct sf_buf *sf)
void
swi_vm(void *dummy)
{
+
+ if (busdma_swi_pending)
+ busdma_swi();
}
int
diff --git a/sys/mips/rmi/dev/nlge/if_nlge.c b/sys/mips/rmi/dev/nlge/if_nlge.c
index 9ff88ea..5c3dd2f 100644
--- a/sys/mips/rmi/dev/nlge/if_nlge.c
+++ b/sys/mips/rmi/dev/nlge/if_nlge.c
@@ -213,7 +213,6 @@ static int send_fmn_msg_tx(struct nlge_softc *, struct msgrng_msg *,
//#define DEBUG
#ifdef DEBUG
static int mac_debug = 1;
-static int reg_dump = 0;
#undef PDEBUG
#define PDEBUG(fmt, args...) \
do {\
diff --git a/sys/mips/rmi/xlr_machdep.c b/sys/mips/rmi/xlr_machdep.c
index 8f96633..5a5bb79 100644
--- a/sys/mips/rmi/xlr_machdep.c
+++ b/sys/mips/rmi/xlr_machdep.c
@@ -363,6 +363,9 @@ xlr_mem_init(void)
(void *)phys_avail[0],
(void *)phys_avail[1]);
+ dump_avail[0] = phys_avail[0];
+ dump_avail[1] = phys_avail[1];
+
} else {
/*
* Can't use this code yet, because most of the fixed allocations happen from
@@ -390,6 +393,10 @@ xlr_mem_init(void)
(void *)phys_avail[j],
(void *)phys_avail[j+1]);
}
+
+ dump_avail[j] = phys_avail[j];
+ dump_avail[j+1] = phys_avail[j+1];
+
physsz += boot_map->physmem_map[i].size;
}
}
diff --git a/sys/mips/rmi/xlr_pci.c b/sys/mips/rmi/xlr_pci.c
index 3204691..8cdaede 100644
--- a/sys/mips/rmi/xlr_pci.c
+++ b/sys/mips/rmi/xlr_pci.c
@@ -105,13 +105,6 @@ __FBSDID("$FreeBSD$");
(MSI_MIPS_DATA_TRGRLVL | MSI_MIPS_DATA_DELFIXED | \
MSI_MIPS_DATA_ASSERT | (irq))
-#define DEBUG
-#ifdef DEBUG
-#define dbg_devprintf device_printf
-#else
-#define dbg_devprintf(dev, fmt, ...)
-#endif
-
struct xlr_pcib_softc {
bus_dma_tag_t sc_pci_dmat; /* PCI DMA tag pointer */
};
diff --git a/sys/mips/sentry5/s5_machdep.c b/sys/mips/sentry5/s5_machdep.c
index 00e6231..4491b93 100644
--- a/sys/mips/sentry5/s5_machdep.c
+++ b/sys/mips/sentry5/s5_machdep.c
@@ -91,7 +91,7 @@ platform_cpu_init()
static void
mips_init(void)
{
- int i;
+ int i, j;
printf("entry: mips_init()\n");
@@ -128,6 +128,9 @@ mips_init(void)
realmem = btoc(physmem);
#endif
+ for (j = 0; j < i; j++)
+ dump_avail[j] = phys_avail[j];
+
physmem = realmem;
init_param1();
diff --git a/sys/mips/sibyte/sb_machdep.c b/sys/mips/sibyte/sb_machdep.c
index ba4b62e9..ac30451 100644
--- a/sys/mips/sibyte/sb_machdep.c
+++ b/sys/mips/sibyte/sb_machdep.c
@@ -138,7 +138,7 @@ sb_intr_init(int cpuid)
static void
mips_init(void)
{
- int i, cfe_mem_idx, tmp;
+ int i, j, cfe_mem_idx, tmp;
uint64_t maxmem;
#ifdef CFE_ENV
@@ -225,6 +225,9 @@ mips_init(void)
realmem = btoc(physmem);
#endif
+ for (j = 0; j < i; j++)
+ dump_avail[j] = phys_avail[j];
+
physmem = realmem;
init_param1();
OpenPOWER on IntegriCloud