Commit Graph

317 Commits

Author SHA1 Message Date
Lukas Ertl
1bcf24ee9d Fix syntax errors and wrong function prototypes in several MD header
files when using non-GNUC compilers.

PR:             kern/58515
Submitted by:   Stefan Farfeleder <stefan@fafoe.narf.at>
Approved by:    grog (mentor), obrien
2004-03-05 09:19:59 +00:00
Peter Grehan
4daf20b2f1 Increase kernel VA from 256Mb to 512Mb by shifting the segment used
for user copyinout down to 12, and keeping segments 13/14 for
kernel VA.

It would be nice to have more available, but segments lower than
this are reserved for either memory or 1:1 mapped device i/o,
and seg 15 is OpenFirmware ROM. Also, the effort to keep OpenFirmware
available for callbacks limits the use of VA-mapped segments.
Fortunately UMA_MD_SMALL_ALLOC takes away a lot of VM pressure.

Obtained from:  NetBSD
2004-03-02 06:49:21 +00:00
Peter Grehan
919cb3362f Kernel changes for libthr (and probably libpthread).
include/ucontext.h
 - remove trapframe and switch over to 'generic' description of machine
   state. Include version field to help with future modifications.
   Include floating point and altivec state, and hopefully align
   correctly

powerpc/copyinout.c
 - fill out casuptr() sync primitive, required by kern_umtx.c

powerpc/machdep.c
 - shifted proc0/thread0/pcpu setup to before cninit, since
   syscons -> make_dev -> devlock requires a valid curthread
 - implemented get_mcontext/set_mcontext
 - recast sendsig/sigreturn to use get/set_mcontext and new
   ucontext struct. floating point now saved
 - TODO: save/restore altivec state

powerpc/vm_machdep.c
 - implemented cpu_thread_setup/cpu_set_upcall/cpu_set_upcall_kse
 - eliminated trailing whitespace

Submitted by:  Suleiman Souhlal <refugee@segfaulted.com>, ucontext by grehan
2004-03-02 06:13:09 +00:00
Peter Grehan
a3063d483e Add sys file required for IEEE fp functions.
Submitted by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-02-12 09:12:11 +00:00
Peter Grehan
49f397d0c3 Interrupt statistics, vmstat -i now works.
Submitted by:  Suleiman Souhlal <refugee@segfaulted.com>
Slightly modified by: grehan
Derived from:  i386
2004-02-11 13:18:31 +00:00
Peter Grehan
7c2779715c Cleaned up param.h:
- culled long-dead #define's
 - segment register defs moved to sr.h
 - NPMAPS moved to pmap.h
 - KERNBASE moved to vmparam.h
 - removed include of <machine/cpu.h> and fixed src files that
   relied on this.

Modifying segment register code no longer causes gcc rebuilds :-)
2004-02-11 07:27:34 +00:00
Peter Grehan
e6d3e1c2c6 Definitions for MPC7457 CPU type and HID0 bits 2004-02-09 00:12:50 +00:00
Peter Grehan
10df017f33 Move temporary register save area from exception-vector memory to
per-CPU memory. This allows for interrupt handling on multiple CPUs.

Obtained from: NetBSD
2004-02-04 12:56:15 +00:00
Peter Grehan
db55e39aa1 Implement UMA_MD_SMALL_ALLOC, since the BAT registers allow direct
addressing of memory. Makes a substantial improvement for apps that
stress the limited amount of KVM on PPC (e.g. untarring the ports tree).

uma_machdep.c stolen from amd64/ia64.
2004-01-29 00:32:22 +00:00
Peter Grehan
462ded3729 A syscons implementation using the 8-bit framebuffer set up by
OpenFirmware. Not at all optimized, but provides a PC-style
user-experience.

Tested on revA imac, B&W G3, 2k iBook, and G4 eMac.
2004-01-21 05:16:23 +00:00
Peter Grehan
feb43b1c96 Update 128-bit long double constants to match what is expected
by libc
2004-01-21 04:56:39 +00:00
Peter Grehan
739af9bcb5 Make the OpenPic driver bus-independent, with attachments for
the MacIO chip and PSIM's IOBus. Bus-specific drivers should
use the identify method to attach themselves to nexus so
interrupt can be allocated before the h/w is probed. The
'early attach' routine in openpic is used for this stage
of boot. When h/w is probed, the openpic can be attached
properly. It will enable interrupts allocated prior to
this.
2004-01-13 11:24:36 +00:00
Peter Grehan
8dbee7197d Remove hard-coded knowledge of specific OFW devices. Use bus_generic_probe
and add_child entry point to allow devices to use the identify
method to add themselves if need be (e.g. openpic, syscons).
Export interrupt-controller-add routine for extern int cntlr drivers.
Eliminate recursive OFW device-tree walk and only iterate the
top-level ala sparc64. Allow child devices to set the device
type with write_ivars.

Step 1 of many in removing the hard-dependency on OpenFirmware.
2004-01-13 11:20:52 +00:00
Peter Wemm
c15e347e22 GC the unused <machine/kse.h> file. 2003-12-24 00:51:30 +00:00
Peter Grehan
1d9c166f51 - removed obsolete ppc_exit/ppc_boot functions
- OpenFirmware returns overlapping memory regions. Use a simple
  brute force algorithm to merge these into non-overlapping
  regions. This fixes bugs in reporting of available memory
  and also prevents pages from being added twice in the VM system.
2003-12-10 08:55:53 +00:00
Andrew Gallatin
eaa53cc8fc Use the "shut-down" and "reset-all" Forth procedures to halt and
reboot, as calling OF_exit() just hangs a mac.

FreeBSD on my G4 800Mhz mac behaves identically to OSX for halt
and reboot now.

Reviewed by: grehan  (who also supplied the concept and sample code)
2003-12-09 14:45:39 +00:00
Andrew Gallatin
67e945bab9 Make breakpoint() actually break into ddb.
Reviewed by: grehan
2003-12-09 13:37:31 +00:00
Peter Wemm
0bfbe7b935 Widen the enable/disable helper function's argument in line with the
ithread_create() changes etc.  This should be mostly a NOP.
2003-11-17 06:10:15 +00:00
Alan Cox
e45db9b837 - Modify alpha's sf_buf implementation to use the direct virtual-to-
physical mapping.
 - Move the sf_buf API to its own header file; make struct sf_buf's
   definition machine dependent.  In this commit, we remove an
   unnecessary field from struct sf_buf on the alpha, amd64, and ia64.
   Ultimately, we may eliminate struct sf_buf on those architecures
   except as an opaque pointer that references a vm page.
2003-11-16 06:11:26 +00:00
Bruce M Simpson
2bc7dd5661 Move pmap_resident_count() from the MD pmap.h to the MI pmap.h.
Add a definition of pmap_wired_count().
Add a definition of vmspace_wired_count().

Reviewed by:	truckman
Discussed with:	peter
2003-10-06 01:47:12 +00:00
Peter Grehan
02b63ceaff DELAY must be a routine, not a macro definition. 2003-09-26 09:02:24 +00:00
Peter Wemm
c460ac3a00 Add sysentvec->sv_fixlimits() hook so that we can catch cases on 64 bit
systems where the data/stack/etc limits are too big for a 32 bit process.

Move the 5 or so identical instances of ELF_RTLD_ADDR() into imgact_elf.c.

Supply an ia32_fixlimits function.  Export the clip/default values to
sysctl under the compat.ia32 heirarchy.

Have mmap(0, ...) respect the current p->p_limits[RLIMIT_DATA].rlim_max
value rather than the sysctl tweakable variable.  This allows mmap to
place mappings at sensible locations when limits have been reduced.

Have the imgact_elf.c ld-elf.so.1 placement algorithm use the same
method as mmap(0, ...) now does.

Note that we cannot remove all references to the sysctl tweakable
maxdsiz etc variables because /etc/login.conf specifies a datasize
of 'unlimited'.  And that causes exec etc to fail since it can no
longer find space to mmap things.
2003-09-25 01:10:26 +00:00
Peter Grehan
7a77eb896e _MACHINE/_MACHINE_ARCH shouldn't be quoted. Found by trying to
compile the isp driver.
2003-09-24 01:45:07 +00:00
Alexander Kabaev
1d49585050 Standardize idempotentcy ifdefs. Consistently use _MACHINE_VARARGS_H_
symbol.
2003-09-01 03:01:45 +00:00
Marcel Moolenaar
26502503e5 Further cleanup <machine/cpu.h> and <machine/md_var.h>: move the MI
prototypes of cpu_halt(), cpu_reset() and swi_vm() from md_var.h to
cpu.h. This affects db_command.c and kern_shutdown.c.

ia64: move all MD prototypes from cpu.h to md_var.h. This affects
madt.c, interrupt.c and mp_machdep.c. Remove is_physical_memory().
It's not used (vm_machdep.c).

alpha: the MD prototypes have been left in cpu.h with a comment
that they should be there. Moving them is left for later. It was
expected that the impact would be significant enough to be done in
a seperate commit.

powerpc: MD prototypes left in cpu.h. Comment added.

Suggested by: bde
Tested with: make universe (pc98 incomplete)
2003-08-16 16:57:57 +00:00
Warner Losh
06b4bf3e55 Expand inline the relevant parts of src/COPYRIGHT for Matt Dillon's
copyrighted files.

Approved by: Matt Dillon
2003-08-12 23:24:05 +00:00
John Baldwin
3bdbd658f1 - Since td_critnest is now initialized in MI code, it doesn't have to be
set in cpu_critical_fork_exit() anymore.
- As far as I can tell, cpu_thread_link() has never been used, not even
  when it was originally added, so remove it.
2003-08-04 20:32:45 +00:00
David E. O'Brien
eeb086be33 Deal with GCC annoyingly defining _BIG_ENDIAN. 2003-08-03 07:53:50 +00:00
Peter Wemm
ad7a226f9d Deal with 'options KSTACK_PAGES' being a global option. 2003-07-31 01:31:32 +00:00
Maxime Henrion
d5afecd068 - Introduce a new busdma flag BUS_DMA_ZERO to request for zero'ed
memory in bus_dmamem_alloc().  This is possible now that
  contigmalloc() supports the M_ZERO flag.
- Remove the locking of Giant around calls to contigmalloc() since
  contigmalloc() now grabs Giant itself.
2003-07-27 13:52:10 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Peter Grehan
f209c40211 Remove unused bootpath[] variable. It conflicted with a declaration
in the sunlabel utility, causing build problems.
2003-06-25 08:11:29 +00:00
Alan Cox
49a2507bd1 Migrate the thread stack management functions from the machine-dependent
to the machine-independent parts of the VM.  At the same time, this
introduces vm object locking for the non-i386 platforms.

Two details:

1. KSTACK_GUARD has been removed in favor of KSTACK_GUARD_PAGES.  The
different machine-dependent implementations used various combinations
of KSTACK_GUARD and KSTACK_GUARD_PAGES.  To disable guard page, set
KSTACK_GUARD_PAGES to 0.

2. Remove the (unnecessary) clearing of PG_ZERO in vm_thread_new.  In
5.x, (but not 4.x,) PG_ZERO can only be set if VM_ALLOC_ZERO is passed
to vm_page_alloc() or vm_page_grab().
2003-06-14 23:23:55 +00:00
Scott Long
7e71df9339 Bring back bus_dmasync_op_t. It is now a typedef to an int, though the
BUS_DMASYNC_ definitions remain as before.  The does not change the ABI,
and reverts the API to be a bit more compatible and flexible.  This has
survived a full 'make universe'.

Approved by:	re (bmah)
2003-05-27 04:59:59 +00:00
Alexander Kabaev
980ded9a7d sys/sys/limits.h:
- Fix visibilty test for LONG_BIT and WORD_BIT.  `#if defined(__FOO_VISIBLE)'
   is alays wrong because __FOO_VISIBLE is always defined (to 0 for
   invisibility).

sys/<arch>/include/limits.h
sys/<arch>/include/_limits.h:

 - Style fixes.

Submitted by:	bde
Reviewed by:	bsdmike
Approved by:	re (scottl)
2003-05-19 20:29:07 +00:00
Alexander Kabaev
0eda4c08a5 Style fixes.
Remove DBL_DIG, DBL_MIN, DBL_MAX and their FLT_ counterparts, they
were marked for deprecation ever since SUSv1 at least.
Only define ULLONG_MIN/MAX and LLONG_MAX if long long type is
supported.
Restore a lost comment in MI _limits.h file and remove it from
sys/limits.h where it does not belong.
2003-05-04 22:13:04 +00:00
Peter Wemm
7f47668191 Slight reorg and added AMD64 support. A couple of the MODINFOMD_* values
that were added to sparc64 and later powerpc, really should have been in
the MI area.  But changing that now with insufficient preperation will
just cause too much pain.

Move MD_FETCH() to the MI sys/linker.h file to avoid another two copies
of it.
2003-05-01 03:31:18 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Alexander Kabaev
6fd839f9c7 Add a new sys/limits.h file which in turn depends on machine/_limits.h
to get actual constant values. This is in preparation for machine/limits.h
retirement.

Discussed on:	standards@
Submitted by:	Craig Rodrigues <rodrigc@attbi.com>  (*)
Modified by:	kan
2003-04-23 21:41:59 +00:00
Peter Grehan
1e1e003218 - Convert NetBSD-derived macros to inline functions for better
type-checking and future debug code.
- Remove sparse addressing hack, since the only consumer, the macio ATA
  driver, doesn't require it anymore.
2003-04-18 02:38:10 +00:00
Maxime Henrion
7a648f56cf I deserve a big pointy hat for having missed all those references
to bus_dmasync_op_t in my last commit.
2003-04-10 23:50:06 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Jake Burkholder
5501d40bb9 Made the prototypes for pmap_kenter and pmap_kremove MD. These functions
are machine dependent because they are not required to update the tlb when
mappings are added or removed, and doing so is machine dependent.
In addition, an implementation may require that pages mapped with pmap_kenter
have a backing vm_page_t, which is not necessarily true of all physical
pages, and so may choose to pass the vm_page_t to pmap_kenter instead of the
physical address in order to make this requirement clear.
2003-03-16 04:16:03 +00:00
Maxime Henrion
f6c912dd0c Correctly set BUS_SPACE_MAXSIZE in all the busdma backends.
It was bogusly set to 64 * 1024 or 128 * 1024 because it was
bogusly reused in the BUS_DMAMAP_NSEGS definition.
2003-02-26 02:16:06 +00:00
Peter Grehan
9ea031d50b Doh. Forgot to remove _KERNEL version. 2003-02-23 13:47:44 +00:00
Peter Grehan
d273b006c5 Expose powerpc_mb() to user-space. Currently needed for atomic.h users,
this may go away in the future.
2003-02-22 22:58:13 +00:00
Mike Barcroft
8cf5ed5125 Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
  contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
  contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
  storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
  double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
  HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
  <math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
  <machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
  on the size of its argument.  __fpclassifyl() is never called on
  alpha because (sizeof(long double) == sizeof(double)), which is good
  since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR:		23103
Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
		(significant portions)
Reviewed by:	bde, fenner (earlier versions)
2003-02-08 20:37:55 +00:00
Benno Rice
d8e3618615 Export the ns_per_tick variable through md_var.h rather than by declaring
it extern in cpu.c.
2003-02-05 12:33:49 +00:00
Benno Rice
fb954d9d2f Add cpu.c. This contains one exported function, cpu_setup(), which handles
setup of and printing information about cpus.

Obtained from:	NetBSD (parts)
2003-02-05 12:09:53 +00:00
Benno Rice
19ca68d921 - Update spr.h
- Add hid.h

Obtained from:	NetBSD

NOTE: This undoes some changes I'd made to prefix the processor name defines
with PVR_.  This was due to my original decision to use MPC750 as a cpu name.
With this changed, the PVR_ change is no longer required.
2003-02-05 12:04:29 +00:00