Home | History | Annotate | Download | only in ofw
History log of /src/sys/arch/shark/ofw/ofw.c
RevisionDateAuthorComments
 1.69  10-Dec-2023  andvar fix format specifiers for OLDPRINTFS build option.
 1.68  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.67  04-Mar-2017  jakllsch branches: 1.67.12; 1.67.14;
Fix up OFW_DEBUG printfs, particularly regarding newlines and error cases.
 1.66  22-Dec-2016  cherry branches: 1.66.2;
switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.65  07-Jul-2016  msaitoh branches: 1.65.2;
KNF. Remove extra spaces. No functional change.
 1.64  17-Oct-2015  jmcneill remove tlb_flush define and change callers to use cpu_tlb_flushID directly, ok matt@
 1.63  22-Feb-2014  matt branches: 1.63.6;
Deal with non-4K page sizes.
 1.62  06-Nov-2013  christos remove unused variables
 1.61  18-Aug-2013  matt Use <arm/locore.h>
 1.60  22-Sep-2012  matt branches: 1.60.2;
Don't use an asm in pmap_activate to update the TTBR, use cpu_setttb instead
but add a second argument to it to indicate whether the TLB/caches need to be
flushed. Default cortex to pmap_needs_fixup = 1. But check the MMFR3 field
to see if the fixed can be skipped.
Use a cf_flag bit 0 to indicate whether the A9 L2 cache should disable (bit 0 = 1)
or enabeld (bit = 0).

With these changes, the A9 MMU can use traverse caches to do MMU tablewalks
Also, make sure all memory has the shareable bit for the A9.
 1.59  29-Jul-2012  matt branches: 1.59.2;
Fix more -fno-common fallout.
Move more variables to common locations.
 1.58  01-Mar-2012  matt kernelstack is declared in arm32_machdep.c
 1.57  23-Nov-2011  jmcneill branches: 1.57.2; 1.57.6;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.56  19-Jul-2011  dyoung branches: 1.56.2; 1.56.4;
Change <machine/bus.h> to <sys/bus.h> throughout.

Split bus.h -> bus_{defs,funcs}.h.
 1.55  23-Mar-2011  macallan add support for chipsfb at ofbus
 1.54  12-Nov-2010  uebayasi branches: 1.54.2;
Pull in uvm/uvm.h for VM_PAGE_TO_PHYS().
 1.53  28-Dec-2009  uebayasi branches: 1.53.4;
More setttb() -> cpu_setttb() for readability & consistency. Missing instances
pointed out by tsutsui@ & nonaka@, thanks.
 1.52  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.51  26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.50  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)
 1.49  18-Mar-2009  cegger bzero -> memset
 1.48  18-Mar-2009  cegger bcmp -> memcmp
 1.47  18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.46  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.45  14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.44  11-Nov-2008  dyoung branches: 1.44.4;
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.
 1.43  27-Apr-2008  matt branches: 1.43.6; 1.43.8;
Merge kernel changes in matt-armv6 to HEAD.
 1.42  28-Oct-2007  jmmv branches: 1.42.16; 1.42.18; 1.42.20;
Drop pccons. Obsoleted by wscons, now fully supported in NetBSD/shark.
OK'ed by thorpej@ and tsutsui@ a while ago.
 1.41  17-Oct-2007  garbled 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.
 1.40  13-Aug-2007  tsutsui branches: 1.40.2; 1.40.6;
Remove all references to spl_mask. Now it isn't used by any sources.
Discussed on port-arm.
 1.39  30-Jul-2007  jmmv branches: 1.39.2; 1.39.4; 1.39.6;
Fix build of kernels that use vga or igsfb together with pccons by avoiding
a warning mentioning an unused static function.
 1.38  08-Mar-2007  matt branches: 1.38.2; 1.38.10; 1.38.12; 1.38.14;
Clean the bitrotting ofw code. Don't export export the underlying irq
dispatch mechanism to the rest of the kernel; they don't need to know.
Nuke IRQSTATS entirely.

XXX ofwgencfg_clock needs to taught about timecounters
 1.37  23-Feb-2007  mrg make this build without wscons or vga enabled.
 1.36  25-Jan-2007  macallan branches: 1.36.2;
have OF re-initialize the console before calling OF_exit() so we actually
end up in something usable
 1.35  08-Dec-2005  yamt branches: 1.35.20;
use VM_PAGE_TO_PHYS macro.
 1.34  05-Jan-2005  tsutsui branches: 1.34.10;
Purge vm_offset_t.
 1.33  05-Nov-2003  scw s/bcopy/memmove/
The kernel's bcopy (actually a wrapper around memcpy) is not guaranteed to
handle overlapping regions, even though the old ARM version did.

This fixes a problem where the kernel reported more available memory
than actually existed.
 1.32  15-Jul-2003  lukem __KERNEL_RCSID()
 1.31  16-Jun-2003  thorpej branches: 1.31.2;
Rename IPL_IMP -> IPL_VM.
 1.30  22-May-2003  thorpej Move KERNEL_VM_SIZE into the C files where its used.
 1.29  21-May-2003  thorpej Move KERNEL_VM_BASE inside where it is used (it won't be there for long).
 1.28  03-May-2003  wiz DMA, not dma nor Dma.
 1.27  03-May-2003  thorpej Reduce differences between ARM32_NEW_VM_LAYOUT and not; always pass
the start and end of the kernel managed virtual address space to
pmap_bootstrap() in the new pmap.
 1.26  03-May-2003  thorpej Remove old pmap support for platforms which have fully switched over.
 1.25  02-May-2003  thorpej Eliminate PTE_BASE and the PT-PT completely in the ARM32_PMAP_NEW case.
Also in the ARM32_PMAP_NEW case, reclaim the USPACE-bytes of wasted space
at the top of the user address that hasn't been needed for a very very
long time.
 1.24  18-Apr-2003  scw Enable ARM32_PMAP_NEW on NetBSD/shark.
 1.23  02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.22  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.21  05-Oct-2002  chs add missing protos.
 1.20  24-Aug-2002  thorpej Enable caching on kernel and user page tables. This saves having
to do uncached memory access during VM operations (which can be
quite expensive on some CPUs).

We currently write-back PTEs as soon as they're modified; there is
some room for optimization (to write them back in larger chunks).
For PTEs in the APTE space (i.e. PTEs for pmaps that describe another
process's address space), PTEs must also be evicted from the cache
complete (PTEs in PTE space will be evicted durint a context switch).
 1.19  22-Aug-2002  thorpej * Add PTE_SYNC() and PTE_SYNC_RANGE() macros. These don't actually do
anything yet.
* Use PTE_SYNC() and PTE_SYNC_RANGE() in some obvious places, i.e.
where vtopte() is used.
 1.18  21-Aug-2002  thorpej Do cached memory access to L1 tables, making sure to write-back the
cache after any L1 table modifications.
 1.17  31-Jul-2002  thorpej Overhaul how DMA ranges work in the ARM bus_dma implementation.

A new "arm32_dma_range" structure now describes a DMA window, with
a system address base, bus address base, and length. In addition to
providing info about which memory regions are legal for DMA, the new
structure provides address translation support, as well.

As before, if a tag does not list any ranges, then all addresses are
considered valid, and no DMA address translation is performed.

This allows us to remove a large chunk of code which was duplicated and
tweaked slightly (to do the address translation) from the stock ARM
bus_dma in the XScale IOP and ARM Integrator ports.

Test compiled on all ARM platforms, test booted on Intel IQ80321 and Shark.
 1.16  31-Jul-2002  thorpej Move the calls to uvm_page_physload() out of pmap_bootstrap() and
into platform-specific initialization code, giving platform-specific
code control over which free list a given chunk of memory gets put
onto.

Changes are essentially mechanical. Test compiled for all ARM
platforms, test booted on Intel IQ80321 and Shark.

Discussed some time ago on port-arm.
 1.15  30-Jul-2002  thorpej Move the uvm_setpagesize() call to platform-dependent code in preparation
for other changes to pmap_bootstrap().
 1.14  02-Jun-2002  drochner branches: 1.14.2;
move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.13  05-Apr-2002  thorpej branches: 1.13.2; 1.13.4;
* Rewrite the 32-bit ARM pte.h based on the ARM architecture manual.
Significant cleanup, here, including better PTE bit names.
* Add XScale PTE extensions (ECC enable, write-allocate cache mode).
* Mechanical changes everywhere else to update for new pte.h. While
doing this, two bugs (as a result of typos) were fixed in

arm/arm32/bus_dma.c
evbarm/integrator/int_bus_dma.c
 1.12  03-Apr-2002  thorpej Clean up handling of the vector page on 32-bit ARM systems:
* Don't refer to VA 0, instead refer to a new variable: vector_page
* Delete the old zero_page_*() functions, replacing them with a new
one: vector_page_setprot().
* When manipulating vector page mappings in user pmaps, only do so if
the vector page is below KERNEL_BASE (if it's above KERNEL_BASE, the
vector page is mapped by the kernel pmap).
* Add a new function, arm32_vector_init(), which takes the virtual
address of the vector page (which MUST be valid when the function
is called) and a bitmask of vectors the kernel is going to take
over, and performs all vector page initialization, including setting
the V bit in the CPU Control register ("relocate vectors to high
address"), if necessary.
 1.11  31-Mar-2002  thorpej Add a second page table for the kernel image. INSTALL kernels cross
a 4MB boundary.

XXX The 32-bit ARM VM layout needs a complete overhaul. After 1.6.
 1.10  25-Mar-2002  thorpej * Fix use of pmap_curmaxkvaddr.
* Use the PTP hint in the pmap.
 1.9  23-Mar-2002  thorpej * Rename PROCESS_PAGE_TBLS_BASE -> PTE_BASE
* Rename ALT_PAGE_TBLS_BASE -> APTE_BASE
* Garbage-collect PAGE_TABLE_SPACE_START
 1.8  03-Mar-2002  chris branches: 1.8.2;
Implement pmap_growkernel for arm32 based ports.
Note that this has been compiled on some systems, cats, IQ80310, IPAQ, netwinder and shark (note that shark's build is currently broken due to other reasons), but only actually run on cats.
Shark doesn't make use of the functionality as I believe there has to be a correlation between OFW and the kernel tables so that calls into OFW work.
 1.7  22-Feb-2002  thorpej branches: 1.7.2;
Change pmap_map_entry() to work like pmap_map_chunk(): take a pointer
to the L1 table and a virtual address, and no pointer to the L2 table.
The L2 table will be looked up by pmap_map_entry(), which will panic
if the there is no L2 table for the requested VA.

NOTE: IT IS EXTREMELY IMPORTANT THAT THE CORRECT VIRTUAL ADDRESS
BE PROVIDED TO pmap_map_entry()! Notably, the code that mapped
the kernel L2 tables into the kernel PT mapping L2 table were not
passing actual virtual addresses, but rather offsets into the range
mapped by the L2 table. I have fixed up all of these call sites,
and tested the resulting kernel on both an IQ80310 and a Shark.
Other portmasters should examine their pmap_map_entry() calls if
their new kernels fail.
 1.6  21-Feb-2002  thorpej Keep track of which kernel PTs are available during bootstrap,
and let pmap_map_chunk() lookup the correct one to use for the
current VA. Eliminate the "l2table" argument to pmap_map_chunk().

Add a second L2 table for mapping kernel text/data/bss on the
IQ80310 (fixes booting kernels with ramdisks).
 1.5  21-Feb-2002  thorpej Delete some unneeded comments.
 1.4  20-Feb-2002  thorpej map_pagetable() -> pmap_link_l2pt(), and move it to pmap.c
 1.3  20-Feb-2002  thorpej Collapse map_entry{,ro,nc}() into a single pmap_map_entry() that
takes a prot and a "cacheable" indicator.
 1.2  20-Feb-2002  thorpej Rename map_section() to pmap_map_section(), move it to pmap.c, and give it
an extra argument (prot - specifies protection of the mapping).
 1.1  10-Feb-2002  thorpej Kill arch/arm32. The last platform supported there, Shark, is now
in arch/shark.

(NOTE: arch/dnard, a premature move to split out the Shark support
code, is going to be deleted. It has bit-rotted.)
 1.7.2.9  18-Oct-2002  nathanw Catch up to -current.
 1.7.2.8  27-Aug-2002  thorpej Sync with -current.
 1.7.2.7  01-Aug-2002  nathanw Catch up to -current.
 1.7.2.6  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.7.2.5  20-Jun-2002  nathanw Catch up to -current.
 1.7.2.4  17-Apr-2002  nathanw Catch up to -current.
 1.7.2.3  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.2.2  28-Feb-2002  nathanw Catch up to -current.
 1.7.2.1  22-Feb-2002  nathanw file ofw.c was added on branch nathanw_sa on 2002-02-28 04:11:54 +0000
 1.8.2.1  17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 1.13.4.2  14-Feb-2003  he Revert pull-up of revision 1.18 (requested by rearnsha in ticket #1170):
Revert cached memory access to L1 tables, this causes instability
on the release branch.
 1.13.4.1  21-Nov-2002  he Pull up revision 1.18 (requested by thorpej in ticket #712):
Do cached memory access to L1 tables, making sure to
write-back the cache after any L1 table modifications.
 1.13.2.2  31-Aug-2002  gehenna catch up with -current.
 1.13.2.1  15-Jul-2002  gehenna catch up with -current.
 1.14.2.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14.2.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.1  02-Jun-2002  jdolecek file ofw.c was added on branch kqueue on 2002-06-23 17:41:26 +0000
 1.31.2.5  11-Dec-2005  christos Sync with head.
 1.31.2.4  17-Jan-2005  skrll Sync with HEAD.
 1.31.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.31.2.1  03-Aug-2004  skrll Sync with HEAD
 1.34.10.4  15-Nov-2007  yamt sync with head.
 1.34.10.3  03-Sep-2007  yamt sync with head.
 1.34.10.2  26-Feb-2007  yamt sync with head.
 1.34.10.1  21-Jun-2006  yamt sync with head.
 1.35.20.1  01-Feb-2007  ad Sync with head.
 1.36.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.36.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.38.14.1  15-Aug-2007  skrll Sync with HEAD.
 1.38.12.1  07-Aug-2007  matt Sync with HEAD.
 1.38.10.1  03-Oct-2007  garbled Sync with HEAD
 1.38.2.2  03-Dec-2007  ad Sync with HEAD.
 1.38.2.1  20-Aug-2007  ad Sync with HEAD.
 1.39.6.2  01-Jan-2008  chris Sync with HEAD.
 1.39.6.1  18-Aug-2007  chris Sync with HEAD
 1.39.4.2  28-Oct-2007  joerg Sync with HEAD.
 1.39.4.1  16-Aug-2007  jmcneill Sync with HEAD.
 1.39.2.1  26-Dec-2007  rjs Sync with HEAD.
 1.40.6.1  13-Nov-2007  bouyer Sync with HEAD
 1.40.2.2  28-Jan-2008  matt Given the that there are only 4 IPLs (ignoring soft IPLs), a number of
cleanups can be done:
Remove _SPL_* aliases.
Don't store irqmasks in ci_cpl, just make it an ipl level.
Add fast softint switching support.
 1.40.2.1  06-Nov-2007  matt sync with HEAD
 1.42.20.4  11-Mar-2010  yamt sync with head
 1.42.20.3  19-Aug-2009  yamt sync with head.
 1.42.20.2  04-May-2009  yamt sync with head.
 1.42.20.1  16-May-2008  yamt sync with head.
 1.42.18.1  18-May-2008  yamt sync with head.
 1.42.16.2  17-Jan-2009  mjf Sync with HEAD.
 1.42.16.1  02-Jun-2008  mjf Sync with HEAD.
 1.43.8.2  28-Apr-2009  skrll Sync with HEAD.
 1.43.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.43.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.44.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.53.4.2  21-Apr-2011  rmind sync with head
 1.53.4.1  05-Mar-2011  rmind sync with head
 1.54.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.56.4.1  22-Nov-2011  mrg IPL_AUDIO is no more
 1.56.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.56.2.2  30-Oct-2012  yamt sync with head
 1.56.2.1  17-Apr-2012  yamt sync with head
 1.57.6.1  06-Dec-2012  matt Merge changes from -current.
 1.57.2.3  06-Mar-2012  mrg sync to -current
 1.57.2.2  06-Mar-2012  mrg sync to -current
 1.57.2.1  04-Mar-2012  mrg sync to latest -current.
 1.59.2.3  03-Dec-2017  jdolecek update from HEAD
 1.59.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.60.2.2  18-May-2014  rmind sync with head
 1.60.2.1  28-Aug-2013  rmind sync with head
 1.63.6.4  28-Aug-2017  skrll Sync with HEAD
 1.63.6.3  05-Feb-2017  skrll Sync with HEAD
 1.63.6.2  09-Jul-2016  skrll Sync with HEAD
 1.63.6.1  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.65.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.65.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.66.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.67.14.1  10-Jun-2019  christos Sync with HEAD
 1.67.12.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

RSS XML Feed