History log of /netbsd-current/sys/arch/sgimips/sgimips/machdep.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.156 23-May-2024 skrll

Trailing whitespace.


# 1.155 23-May-2024 skrll

sgimips: call mips_vector_init earlier to fix boot.

PR port-sgimips/58269


# 1.154 05-Mar-2024 thorpej

Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


# 1.153 20-Dec-2023 thorpej

Remove unnecessary <sys/malloc.h>.


Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.152 12-Aug-2021 andvar

fix typos in "environment" word.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.151 24-Jul-2021 andvar

Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.150 11-Jun-2020 ad

branches: 1.150.6;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.154 05-Mar-2024 thorpej

Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


# 1.153 20-Dec-2023 thorpej

Remove unnecessary <sys/malloc.h>.


Revision tags: netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.152 12-Aug-2021 andvar

fix typos in "environment" word.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.151 24-Jul-2021 andvar

Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.150 11-Jun-2020 ad

branches: 1.150.6;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.153 20-Dec-2023 thorpej

Remove unnecessary <sys/malloc.h>.


Revision tags: thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.152 12-Aug-2021 andvar

fix typos in "environment" word.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.151 24-Jul-2021 andvar

Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.150 11-Jun-2020 ad

branches: 1.150.6;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.152 12-Aug-2021 andvar

fix typos in "environment" word.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.151 24-Jul-2021 andvar

Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.150 11-Jun-2020 ad

branches: 1.150.6;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.151 24-Jul-2021 andvar

Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.150 11-Jun-2020 ad

uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.150 11-Jun-2020 ad

uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.149 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.148 21-Dec-2019 ad

uvmexp.free -> uvm_free()


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2; 1.145.4;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
# 1.147 08-Sep-2018 tsutsui

Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.


Revision tags: pgoyette-compat-0906
# 1.146 02-Sep-2018 tsutsui

Fix build failure without options DDB and with pseudo-device ksyms.

There is a typo for ksyms (NKSYMS vs NKSYM).
Also use consistent "#if NKSYMS" rather than "#if NKSYMS > 0" etc.
and add comments after corresponding #endif for readability.

Fixes PR port-sgimips/53521 from Naruaki Etomi.
Should be pulled up to (at least) netbsd-8.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.145 06-Nov-2017 christos

branches: 1.145.2;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

branches: 1.144.6;
kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.145 06-Nov-2017 christos

Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.


Revision tags: matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.144 10-Feb-2017 christos

kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

branches: 1.143.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.144 10-Feb-2017 christos

kill variable stack allocation


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.143 22-Dec-2016 cherry

switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.


# 1.143 22-Dec-2016 cherry

switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.142 03-Nov-2016 kamil

Prefer modern simple past tense and past participle of catch

The "catched" form is obsolete and nonstandard, prefer "caught".


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.141 26-Jun-2015 matt

branches: 1.141.2;
Cleanup includes


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.140 24-Mar-2014 christos

branches: 1.140.6;
- use cpu_{g,s}etmodel
- fix unused


Revision tags: riastradh-drm2-base3
# 1.139 16-Dec-2013 mrg

- remove unused variables
- use (void) when we don't care about the return value


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.138 27-Oct-2012 chs

branches: 1.138.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


# 1.137 28-Jul-2012 matt

branches: 1.137.2;
Fix -fno-common fallout.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.136 28-Jul-2011 uebayasi

branches: 1.136.2;
Fix DEBUG build.


# 1.135 01-Jul-2011 dyoung

#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-base
# 1.134 20-Feb-2011 matt

Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.133 08-Feb-2010 joerg

branches: 1.133.2; 1.133.4; 1.133.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base
# 1.132 16-Dec-2009 matt

branches: 1.132.2;
Fix various build with the 32bit mips ports after the mips64 merge.


# 1.131 14-Dec-2009 matt

Merge from matt-nb5-mips64
Merge mips-specific arch files.


Revision tags: matt-premerge-20091211
# 1.130 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.129 26-Nov-2009 matt

Kill proc0paddr. Use lwp0.l_addr instead.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.128 11-Aug-2009 matt

Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.127 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.126 13-Feb-2009 apb

Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.


# 1.125 12-Feb-2009 rumble

Enable Personal IRIS 4D/20 and 4D/25 support:
- Adapt int(4) to handle the INT1 chip
- Move generic rtc clocks out of hpc/ and into dev/
- Handle the very strangely wired eeprom and other bits in arcemu
- Sprinkle MACH_SGI_IP6 as necessary
- Enable IP6/IP10 devices in GENERIC32_IP12. Yes, the naming is poor but
there's no winning with kernel/hw compatibility on sgimips...

Tested on my 4D/25. Doesn't (appear to) break macallan@'s IP22.


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base mjf-devfs2-base
# 1.124 30-Nov-2008 martin

branches: 1.124.4;
As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.


# 1.123 12-Nov-2008 ad

Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


# 1.122 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.121 03-Aug-2008 tsutsui

branches: 1.121.2; 1.121.8;
Two fixes to make -current kernel be loadable by 4.0 bootloader:
- if bootinfo is not passed from bootloader, check argv[1] first
which might be the loaded kernel path specified for bootloader
- when using argv[0] as the kernel path (loaded directly by the PROM)
assume boot partition is 0 (partition a) since the kernel might be
in an SGI volume header partition and it can't be a root partition

Ok'ed by rumble@, and tested on IP22 and IP32.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.120 02-Jul-2008 ad

branches: 1.120.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base
# 1.119 28-Mar-2008 tsutsui

branches: 1.119.4; 1.119.6; 1.119.8;
Adjust boot device detection code to make netboot work properly:
- make a bootloader pass bootpath which includes device path on ARC BIOS
via BTINFO_BOOTPATH
- make a kernel use BTINFO_BOOTPATH in bootinfo to see boot device first,
then check argv[0] passed from ARC BIOS if there is no valid bootinfo
- check OSLoadPartition variables in the ARCBIOS environment and whole
argv[] arguments for IP12
- initialize mach_type before it's referred
- bump boot version

Tested on IP32 with various kernel/bootloader combinations.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.118 26-Jan-2008 tsutsui

branches: 1.118.6;
Replace bootinfo stuff on sgimips (which has been disabled in bootloader)
with ones used on arc (which has been working for a year) and
enable it in bootloader. Tested on IP32.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.117 03-Dec-2007 ad

Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.116 17-Oct-2007 garbled

branches: 1.116.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.115 26-Sep-2007 macallan

use crime_reboot() and mcclock_poweroff() when appropriate.
With this my O2 resets and powers down again even when using crmfb,
apparently it freaks out the ARCS firmware - with crmfb the machine would
just sit there blinking instead of rebooting.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.114 17-May-2007 yamt

branches: 1.114.8; 1.114.10; 1.114.12;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8
# 1.113 11-May-2007 rumble

IP12's PROM passes us a '-a' flag in argv when booting directly from the
disk volume header. On NetBSD this means RB_ASKNAME, however in SGI terms
it appears to mean 'autoboot'.

Add an appropriate kludge to keep us from doing the wrong thing.

XXX - This whole argv/env/prom parameter mess needs to be cleaned up.


# 1.112 10-May-2007 rumble

A few changes to allow booting to multi-user with IP12 kernels squished
into oversized volume headers:

Query ARCBIOS for OSLoadFilename and OSLoadOptions first, rather than only
using the environment variables passed since we want to go through arcemu.

Add an ugly hack to arcemu that munges the nvram 'bootfile' variable. We
need this because bootfile will point to the volume header, which then
translates into a bogus root device of 'sd0i', or similar.


# 1.111 10-May-2007 rumble

Clean up extracting environment variables passed by the prom. No functional
change.


Revision tags: thorpej-atomic-base
# 1.110 06-Mar-2007 tsutsui

branches: 1.110.2; 1.110.4; 1.110.10;
Use (char *) to appease -Wpointer-arith.


# 1.109 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.108 22-Feb-2007 thorpej

TRUE -> true, FALSE -> false


# 1.107 21-Feb-2007 rumble

Since IP12 doesn't use ARCS, we could read the console setting from the
nvram, but it may not be valid. For example, if the console is set to
graphics, but no keyboard is attached, we should not attempt to use a
graphical console.

To fix this, we extend arcemu to parse the prom's environment array, which
is the third argument to the kernel. If the console mode is graphics, but
no keyboard is found, the 'gfx' environment variable will contain 'dead'.

Note that since IP12 has no bootloader, we assume that the third parameter
is the environment table, not bootinfo.


Revision tags: post-newlock2-merge
# 1.106 09-Feb-2007 ad

branches: 1.106.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase newlock2-base
# 1.105 30-Dec-2006 rumble

Fix typo in comment.


# 1.104 29-Dec-2006 rumble

Move the mips1_clock_intr handling into int.c where it belongs.


# 1.103 29-Dec-2006 rumble

IP12 (and perhaps other systems) appear to be buggy and incapable of
reliably supporting badaddr(). False negatives appear to occur
approximately 1.8 percent of the time, although neither false positives
nor consecutive false negatives occur. We take advantage of the latter
property and always use a wrapper that makes multiple checks.

My IP12 no longer sees occasional ghost devices and related panics during
boot.


# 1.102 28-Dec-2006 rumble

Handle fpu interrupts (MIPS interrupt 0) on IP12.


# 1.101 27-Dec-2006 rumble

Specify the member names of struct platform for clarity.


# 1.100 22-Dec-2006 rumble

Guiness -> Guinness.


# 1.99 21-Dec-2006 yamt

merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base netbsd-4-base
# 1.98 16-Sep-2006 gdamore

branches: 1.98.2;
sgimips converted to timecounters. Systems that can do them get mips_cp0
based logic. We also use the common mips3_clock functions for those systems,
removing some port-specific code.

Tested by martin@.


Revision tags: yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.97 01-Sep-2006 sekiya

branches: 1.97.2;
Fix delay() so that gcc4 does not optimize it into a noop. Lifted from the
newsmips implementation by tsutsui@


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 elad-kernelauth-base simonb-timecounters-base
# 1.96 09-Apr-2006 tsutsui

Remove declarations for cpu_model[] since it's in <sys/systm.h>.


Revision tags: yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.95 11-Dec-2005 christos

branches: 1.95.4; 1.95.6; 1.95.8; 1.95.10; 1.95.12;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.94 18-Oct-2005 sekiya

Restore missing call to r5k_enable_sdcache(). Its' removal was a thinko
on my part -- the COP0 SC presence test fails on r5k IP22, but
r5k_enable_sdcache() will DTRT regardless.

Pointed out by tsutsui@


# 1.93 03-Jun-2005 martin

branches: 1.93.2;
Avoid a global name "netmask" - it causes lots of shadow warnings all over
the place. Collect all interrupt masks into a single array instead.
Constify a bit and fix a bogus argument to config_rootfound().


Revision tags: kent-audio2-base
# 1.92 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


Revision tags: yamt-km-base4
# 1.91 26-Mar-2005 tsutsui

mips_sdcache_forceinv has been removed.

XXX Should we check MIPS3_CONFIG_SE in mips3_cp0_config_read() and
XXX call r5k_enable_sdcache() accordingly here?


Revision tags: netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.90 01-Mar-2005 sekiya

branches: 1.90.2;
Set mips_sdcache_forceinv to 1 for r5k processors.

We now support secondary cache operation on r5ksc out-of-the-box.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.89 17-Dec-2004 sekiya

branches: 1.89.2; 1.89.4;
Nuke MIPS64; we'll use MIPS3 to indicate the presence of MIPS3 instructions
and _LP64 to indicate that 64-bit is desired.

Pointed out by simonb@


# 1.88 13-Dec-2004 sekiya

MIPS3_CONFIG_SC is an unreliable indicator for SC presence; r5k_enable_sdcache()
will gracefully exit if there is no secondary cache. Rework #ifdef'd out
r5k cache code to take this into account, and remove pointless r10k case.


Revision tags: kent-audio1-base
# 1.87 02-Oct-2004 sekiya

Use the mips3 bus functions on IP30. Recognize the IP30 as a supported* SGI
platform.

* For extremely small values of "supported". arch/mips/* needs a lot of work
yet for MIPS64.


# 1.86 01-Oct-2004 sekiya

s,#ifdef MIPS3,#if defined(MIPS3) || defined(MIPS64),g


# 1.85 11-Apr-2004 pooka

KNF some and make printf output a bit nicer.


# 1.84 11-Apr-2004 pooka

Add IP12 stuff. Most bits included are from Steve Rumble.

After this change it is possible to run IP12.


# 1.83 09-Apr-2004 pooka

If argv[1] doesn't exist, don't try to use it.


# 1.82 05-Apr-2004 tsutsui

Tidy up total/avail memory message as well as other ports.
As per discussion on port-sgimips.


Revision tags: netbsd-2-0-base
# 1.81 25-Mar-2004 pooka

branches: 1.81.2;
Sprinkle some #ifdef MIPS3 to be able to compile the port without
including MIPS3 code.

for upcoming IP12


# 1.80 06-Mar-2004 sekiya

Print an informative message when unimpl_intr() is invoked, rather than panic().


# 1.79 19-Jan-2004 sekiya

Completely remove IP2X and IP32, which renders opt_machtype.h obsolete.


# 1.78 19-Jan-2004 sekiya

g/c obsolete function.


# 1.77 19-Jan-2004 sekiya

Attach int0 at mainbus (precedent being the ip32 CRIME device, which handled
interrupts and timer calibration yet is also attached at mainbus).

Introduce the INDY_R4600_CACHE config option, which more accurately describes
the code enabled by this option.

This renders #ifdef IPxx completely obsolete, thus we theoretically can unify
the GENERIC files if a workable load address relocation scheme can be found.


# 1.76 18-Jan-2004 sekiya

Remove another #ifdef IP32


# 1.75 18-Jan-2004 sekiya

Large rototill of the lowlevel code:

* move all device-specific bitbanging to the device drivers in question --
i.e., the ip32 init code doesn't access the CRIME registers directly but
instead trusts the CRIME driver to DTRT. machdep.c is cleaner thereby.
* introduce int.c, which handles the interrupt-controller goo formerly
in ip2x.c.
* unify the CPU interrupt handler, with CRIME, INT2, and the various timer
handlers hooked in via pointers in the platform struct.
* eliminate ip2x.c and ip32.c. After the interrupt handler cleanup, the
actual platform-dependent code was so minimal (rev identification, mask level
initialization) that it made sense to move it into machdep.c
* "#ifdef DEBUG printf("foo"); #endif" becomes aprint_debug.

Tested on my ip22 and ip32. Discussed with pooka@, rafal@.


# 1.74 13-Jan-2004 sekiya

Call sgimips_bus_dma_init() in mach_init to set up the proper MIPS1/MIPS3
bus_dma_sync() routine.


# 1.73 13-Jan-2004 sekiya

Add a call to ip1x_init().


# 1.72 12-Jan-2004 sekiya

Wrap more mips3_ operations in MIPS3 defines.


# 1.71 03-Jan-2004 sekiya

Streamline bootinfo logic.


# 1.70 03-Jan-2004 lonewolf

Rework the memory detection routine to handle cases where kernel doesn't
fit inside one memory chunk.
Leave 1 page before kernel untouched as that's where our initial kernel
stack before we switch to proc0 stack is (fixes boot problems on my Indy
with small kernels).


# 1.69 02-Jan-2004 sekiya

Add trailing newline. Noticed by Steve Rumble.


# 1.68 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.67 29-Dec-2003 sekiya

Fix typo ("ARCBIOS_MEM_ExecptionBlock"). From Steve Rumble.


# 1.66 15-Dec-2003 sekiya

Part two in the Great Renaming. ip22.c becomes ip2x.c, and all generic ip2x
routines become ip2x_*.


# 1.65 15-Dec-2003 sekiya

Change all IP22 preprocessor conditionals to IP2X preprocessor conditionals.

Part one of two -- part two will be renaming ip22_*() to ip2x_*().


# 1.64 14-Dec-2003 sekiya

IP20 should handle the watchdog timer in the same manner as for IP22.


# 1.63 14-Dec-2003 sekiya

For the purposes of machdep.c, consider IP20 to be a variant of IP22. ip20.c
and #ifdef IP20 will go away (short-term), ip22_* will be renamed to ip2x_*
(slighly longer-term).


# 1.62 14-Dec-2003 sekiya

The ARCBIOS->FlushAllCaches() vector is NULL on at least one SGI platform
(ip20) and has no actual operational effect, thus it should not be invoked here.


# 1.61 10-Dec-2003 lonewolf

Remove the extra call to consinit().


# 1.60 17-Nov-2003 keihan

www.netbsd.org -> www.NetBSD.org


# 1.59 05-Oct-2003 tsutsui

Apply a bunch of patches written by Christopher SEKIYA
(with several cosmetic changes by me) which fixes O2 (IP32) support.

Now my R5000 O2 works fine in multiuser with on-board AIC7880 SCSIs
and several PCI network cards (but only on serial console yet).
L2 cache on R5000/Rm5200 is still disabled for now, but it will be
fixed later, hopefully.

See recent discussion on port-sgimips for details.


# 1.58 04-Oct-2003 tsutsui

TAB/space cleanup.


# 1.57 28-Sep-2003 tsutsui

Cast through (void *) to appease gcc3.


# 1.56 15-Sep-2003 simonb

Use common mips generic software interrupt routines.

Changes from Izumi Tsutsui, tested by Havard Eidnes.


# 1.55 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.54 26-Apr-2003 ragge

branches: 1.54.2;
Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)


# 1.53 02-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.52 31-Mar-2003 rafal

Oops, make sure to re-enable the IP32 watchdog correctly, else we end up
getting random reboots after returning from DDB.


# 1.51 19-Jan-2003 rafal

Parse out flags passed to the kernel on boot; from Scott Taylor, tweaked to
use the MI boot_flags.h interface by me.


# 1.50 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.49 10-Jan-2003 rafal

Get rid of some extraneous declarations/comments.


# 1.48 10-Jan-2003 rafal

Add the MIPS3_CONFIG_SE (name taken from Rm52xx manual) bit, which is the
external cache enable bit -- this allows software to enable or disable the
(external) L2 cache on the R5k and Rm527x and the (external) L3 cache on
the Rm7k. If the (external) cache is disabled, treat it as if there were
no cache for the purposes of the cache setup code.

Also, update sgimips code to use the new name.


# 1.47 06-Jan-2003 rafal

There's no cache_r5k.h yet, so don't try to include it.


# 1.46 06-Jan-2003 rafal

Postpone DDB/KGDB init until we know the machine type, so the debugger can
be attached to the right place, twiddle the right watchdog registers, etc.


# 1.45 03-Jan-2003 rafal

Checkpoint of O2 work by Chris Sekiya and myself. This is the sgimips bit;
still needs some arch/mips support code before it will fully work.


# 1.44 03-Jan-2003 rafal

Move console setup after we've determined machine type so the console init
code can guess where to find a console depending on machine type.


Revision tags: fvdl_fs64_base
# 1.43 23-Dec-2002 pooka

Use crimereg.h definitions for the crime dog. Also, move watchdog
disable down the very last possible place in cpu_reboot.

from Chris Sekiya


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.42 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.41 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.40 25-Sep-2002 thorpej

Don't include <sys/map.h>.


Revision tags: gehenna-devsw-base
# 1.39 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.38 04-Aug-2002 gmcgarry

Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.37 03-May-2002 rafal

branches: 1.37.2;
Update copyright dates.


# 1.36 03-May-2002 rafal

Fix up clock interrupt accounting for the sgimips port -- make sure
to schedule clock interrupts at a fixed interval, rather scheduling
the next one based on the time of the arrival/servicing of the previous
clock interrupt. Also, pick up a trick from the sbmips port to convert
a division in ip22_clkread to a multiplication, since those are much
cheaper -- the details of that are described in Simon's commit (see
Message-Id: <20020306073437.1D2A8B004@cvs.netbsd.org>). Thanks to
Jason Thorpe and Dominic Sweetman's "See MIPS Run" (where I found
mention of this very subject while looking for something totally un-
related! 8-) for the clue about the source of the timekeeping problems.

For the IP32, where we have no clock-calibration code yet, use the CPU
frequency provided by ARCS instead; it beats a hard-coded value!

As an added bonus, most of the CPU-clock related stuff is now collected
together in cpu_info_store, rather than as a collection of unorganized
global variables.


# 1.35 29-Apr-2002 rafal

Fix nasty crashes on IP22 machines with console running at 38.4kbps (which
generally translates to "high interrupt load") -- the old code re-enabled
interrupts in the machine-specific hardware interrupt handler causing the
handler to be re-entered, possible multiple times. Could lead to kernel
stack overflows, and all sorts of mysterious crashes/hangs as a result.

While here, fix up the IP32 interrupt handler code to also not re-enable
interrupts.

Thanks for ideas/comments go to Chuq and Stephen Ma.


Revision tags: eeh-devprop-base
# 1.34 13-Mar-2002 simonb

Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.


Revision tags: newlock-base ifpoll-base
# 1.33 22-Nov-2001 soren

Respect OSLoadPartition even if it doesn't come before SystemPartition in argv.
Add a few comments about the above.


# 1.32 21-Nov-2001 thorpej

- Check for provided bootinfo from the bootloader. If we find it,
save off DDB symbol table information.
- Make loading of memory work reliably with the bootloader; for each
candidate memory type from ARCS (which now includes LoadedProgram),
check to see if the kernel is within that chunk, and load the pages
around it if it is.


# 1.31 19-Nov-2001 soren

Also check SystemPartition when finding boot device. Especially
when netbooting, it is practical to load the kernel directly.


# 1.30 14-Nov-2001 mhitch

branches: 1.30.2;
When loadfile() leaves the ELF header at the end of the kernel, it enables
erroneous code that tries to compute the end of the symbol table. Disable
that for now so that kernels don't hang when booted from the disk.


Revision tags: thorpej-mips-cache-base
# 1.29 11-Nov-2001 rafal

Make microtime(9) do interpolation to get better-than-hz resolution, if
the platform supplies a clkread function that does something other than
return 0 (which is the default unless overridden by the platorm code).
Supply such a function for the IP22; even if it isn't perfect, it goes
a long way to making ntp usable.

While I'm at it, move the ticks-per-hz variable out of the struct platform
since it's really private to the per-platform interrupt/clock code.

XXX: No clkread function supplied for IP32, since it has other problems --
like a hardcoded ticks-per-hz, but the same code as on the IP22 could be
used.


# 1.28 18-Oct-2001 mhitch

branches: 1.28.2;
Use boot arguments to try to determine the boot device. The OSLoadPartition
string, if present, will override the second argument (which may be the
path/kernel being loaded). This will provide a way to netboot the kernel
and allow the root device be set to a disk partition.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.27 24-Sep-2001 mhitch

Run vfs_shutdown() if NOSYNC is *not* set, rather than set.


# 1.26 22-Sep-2001 rafal

If OSLoadOptions is set to auto, boot straight to multi-user. Requested
one too many times and it seems to do no harm, so enable it.


# 1.25 18-Sep-2001 rafal

Obey the RB_POWERDOWN flag passed to cpu_reboot; make it work on the Indy
by enabling the FPU before jumping back to ARCS (gross, but necessary!).


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.24 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.23 09-Jul-2001 thorpej

branches: 1.23.2; 1.23.4;
Count and display the number of CPUs present on the system.


# 1.22 09-Jul-2001 thorpej

Fill in cpu_model[]


# 1.21 08-Jul-2001 thorpej

- Use the identifier strings that are fetched by the MI ARC BIOS
code.
- Garbage-collect some non-useful stuff from the mainbus_attach_args.


# 1.20 08-Jul-2001 thorpej

bcopy -> memcpy, bzero -> memset


# 1.19 08-Jul-2001 thorpej

Use sys/dev/arcbios.


# 1.18 07-Jul-2001 wdk

- Finish off KGDB kernel debugger support for sgimips


# 1.17 13-Jun-2001 rafal

Implement a db_trap_callback which turns off the watchdog on entry to DDB
and turns it back on on exit. Hook the callback in early in the boot, so
it's there as soon as DDB is available.


# 1.16 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.15 11-May-2001 thorpej

Adjustments for dynamic system configuration. From Rafal K. Boni.


Revision tags: thorpej_scsipi_beforemerge
# 1.14 24-Apr-2001 thorpej

Do the first allocsys() pass (the pass that computes sizes) before
calling pmap_bootstrap(); pmap_bootstrap() needs some of the size
information computed by allocsys().


# 1.13 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


# 1.12 23-Apr-2001 thorpej

Call pmap_bootstrap() before calling uvm_pageboot_alloc(), so that
the kernel virtual address space bounds will be set up.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 22-Apr-2001 thorpej

Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.


# 1.10 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.9 22-Jan-2001 jdolecek

branches: 1.9.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.


# 1.8 15-Jan-2001 thorpej

Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().


# 1.7 27-Nov-2000 soren

Consistently use pmap_steal_memory() to allocate USPACE.


# 1.6 05-Oct-2000 cgd

branches: 1.6.2;
clean up and consistency for CP0 Count, Compare, Wired, and Config
access function names and prototypes.


# 1.5 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.4 14-Jul-2000 jeffs

Use cpu_intr() definition from mips/cpu.h instead of local one.


# 1.3 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.2 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-base
# 1.1 14-Jun-2000 soren

branches: 1.1.2; 1.1.4;
Initial commit. Needs work.