Commit Graph

731 Commits

Author SHA1 Message Date
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
80bd99be33 Bring to working PIO state.
- use correct rid when allocating PCI mem resource
 - ATA taskfile registers are indeed spaced 0x10 apart just like
 the Macio ATA cell. Adjust offsets in ATA channel struct.

Tested by:  Suleiman Souhlal <ssouhlal@vt.edu>
2004-02-29 06:01:16 +00:00
Peter Grehan
321fd46031 Work-in-progress for the 'Kauai' ATA device in Mac notebooks. The
device seems to be the macio ATA cell with a PCI front-end, and
has no relation to PIIX-style ATA/PCI devices.
2004-02-12 09:17:16 +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
9c24bed2d9 Clean up header files, which fixes compile warning. 2004-02-11 10:49:30 +00:00
Peter Grehan
69a9f22118 - constify devinfo strings to eliminate compile warning
- remove trailing whitespace
2004-02-11 10:15:15 +00:00
Peter Grehan
3102ccf30c - fix compile warnings
- removed obsolete NetBSD-derived ADB conditionals
2004-02-11 08:07:19 +00:00
Peter Grehan
1820f9fe29 - fixed trailing whitespace and indentation
- removed unused variable to fix compile warning
2004-02-11 07:58:43 +00:00
Peter Grehan
735e89e8a5 Fix compile warning 2004-02-11 07:48:19 +00:00
Peter Grehan
475a183dd1 - remove trailing whitespace
- fix compile warnings. badaddr() will go to a header file soon.
2004-02-11 07:44:56 +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
d1850887de Invalide pcb's fpu cpu # by setting it to INT_MAX, not NULL. 2004-02-11 07:19:15 +00:00
Peter Grehan
7d23b5b7db Add sysctl hw.uma_mdpages to track how many pages have been allocated
by UMA_MD_SMALL_ALLOC
2004-02-11 04:42:48 +00:00
Peter Grehan
439696f355 Correctly create interrupt key for PCI, which is the OpenFirmware
pci-hi/med/lo + node 'interrupts' property. This worked by
accident until recent notebooks required correct operation.

Tested by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-02-10 23:57:35 +00:00
Peter Grehan
a4d2c25de5 Disable branch-target instruction cache on MPC7457 as outlined
in Motorola processor errata.

Submitted by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-02-09 07:04:01 +00:00
Peter Grehan
ef7efb4ab0 Recognize MPC7547 (aka G4+) 2004-02-09 02:25:24 +00:00
Peter Grehan
e6d3e1c2c6 Definitions for MPC7457 CPU type and HID0 bits 2004-02-09 00:12:50 +00:00
Peter Grehan
174e81ed65 - add a description of what .gdbinit should contain.
- add an option for the output device in the hope that this can
  be made non-blocking at some stage.
- define an alias for the disk device, required by dev/ofw/ofw_disk.c
- shift iobus to 0x9000000 so as not to clash with the OpenFirmware
  entry point of 0x8000400 when address decoding.
- down-tone comments about the disk dev config :-)
2004-02-04 13:23:05 +00:00
Peter Grehan
0ee6dbd789 Remove pmap_pvo_allocf zone alloc function. It was a way of
using the direct-mapping of physmem to force PTE data structures
to be physically addressable so the interrupt-time real-mode
DSI trap handler could perform PTE spills. However, the memory
may have been > 256Mb, which would have caused a BAT spill and
double-interrupt.

The new trap code no longer handles PTE spills, so the requirement
that these pages be direct-mapped no longer applies. The irony is
UMA_MD_SMALL_ALLOC will return direct mappings for these structs :-)
2004-02-04 13:16:21 +00:00
Peter Grehan
112a8d7bdb Major overhaul of common trap code
- remove unused 601 and tlb exception code
 - remove interrupt-time PTE spill code. The pmap code
   will now take care of pinning kernel PTEs, and there
   are no longer issues about physical mapping of PTE
   data structures
 - All segment registers are switched on kernel entry/exit,
   allowing the kernel to have more virtual space and for
   user virtual space to extend to 4G.
 - The temporary register save area has been shifted from
   unused exception vector space to the per-cpu data area.
   This allows interrupts to be delivered to multiple CPUs
 - ISI traps no longer spill to BAT tables. It is assumed
   that all of kernel instruction memory is pinned.
 - shift from 'ldmw/stmw' instructions to individual register
   loads/stores when saving context. All PPC manuals indicate
   this should be much faster.
 - use '%r' for register names throughout.

TODO: need to test if DSI traps were the result of kernel stack
guard-page hits.

Reworked from:  NetBSD
2004-02-04 13:10:25 +00:00
Peter Grehan
a6d9116665 - remove unused trap definitions
- ISI traps are now handled by the generic trap routine
- direct diagnostic traps to DDB if defined
- remove unused asngen pcpu init
2004-02-04 13:00:56 +00:00
Peter Grehan
aa6bcb7d23 - Lots more symbols required by the new trap_subr code 2004-02-04 12:58:49 +00:00
Peter Grehan
867069044e - Add definition for GET_CPUINFO, required by new trap_subr code
- garbage-collect unused defs
2004-02-04 12:57:41 +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
9960916dbb Allow child devices to set the OpenFirmware device node ivar 2004-02-04 12:50:47 +00:00
Peter Grehan
78bdfb1f1c - removed debug printf that was a false positive on non-OpenPIC systems
- white space nits
2004-02-04 04:53:09 +00:00
Peter Grehan
2894a94905 Use device alias "mpic" to locate the macio OpenPIC. This works
on the new 12/15/17" PowerBooks that don't have the "interrupt-controller"
property underneath "/chosen", which was the previous way of
searching.
2004-02-03 08:00:37 +00:00
Peter Grehan
0efd0097cb When UMA_MD_SMALL_ALLOC is defined, pmap_kextract will be called
for direct-mapped addresses. Assume that any address less than KVA
is one of these and return it. Also assert that an address is KVA
does have a valid mapping - callers of pmap_kextract don't check
the return value, since they assume that they have a valid virtual
address.
2004-01-29 00:45:41 +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
Jeff Roberson
048ac395be - Recruit some new ULE users by making it the default scheduler in GENERIC.
ULE will be in a probationary period to determine whether it will be left
   as the default in 5.3 which would likely mean the rest of the 5.x series.
2004-01-24 21:38:52 +00:00
Jacques Vidrine
5864cda7c6 Add PFIL_HOOKS to the GENERIC kernel configuration, primarily so
that one can load the IPFilter module (which requires PFIL_HOOKS).

Requested by:	Many, for over a year
2004-01-24 14:59:51 +00:00
Peter Grehan
e878e0085f Add syscons options and enable USB, since there is no conflict between
the OpenFirmware console and the syscons console when using a USB
keyboard.
2004-01-21 05:22:53 +00:00
Peter Grehan
e976ea5a89 - Catch up with panic __LINE__/__FILE__ changes by moving panic calls
out of asm.
- remove some long-dead code from machdep.c
2004-01-21 05:18:08 +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
ec9db41566 Catch up with ATA UMA changes 2004-01-15 23:52:32 +00:00
Peter Grehan
73cb337c32 Use a device identify entry point to attach to nexus, since the
nexus code no longer searches for interrupt controllers.
2004-01-13 11:25:40 +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 Grehan
c576427c52 Catch up with ATA changes by including <sys/sema.h> 2004-01-13 10:54:35 +00:00
David Xu
a30ec4b99c Make sigaltstack as per-threaded, because per-process sigaltstack state
is useless for threaded programs, multiple threads can not share same
stack.
The alternative signal stack is private for thread, no lock is needed,
the orignal P_ALTSTACK is now moved into td_pflags and renamed to
TDP_ALTSTACK.
For single thread or Linux clone() based threaded program, there is no
semantic changed, because those programs only have one kernel thread
in every process.

Reviewed by: deischen, dfr
2004-01-03 02:02:26 +00:00
Mike Silbersack
ddeb5b242e Track three new sendfile-related statistics:
- The number of times sendfile had to do disk I/O
- The number of times sfbuf allocation failed
- The number of times sfbuf allocation had to wait
2003-12-28 08:57:09 +00:00
Mike Silbersack
5caf2b00f0 Move the declaration of sfbufspeak and sfbufsused to mbuf.h,
and use imax instead of max, as sfbufspeak and sfbufsused
are signed.

Submitted by:   bde
2003-12-28 01:43:22 +00:00
Mike Silbersack
5eda9873e9 Track current and peak sfbuf usage, export the values via sysctl. 2003-12-27 07:52:47 +00:00
Peter Wemm
c15e347e22 GC the unused <machine/kse.h> file. 2003-12-24 00:51:30 +00:00
Peter Wemm
9b68618df0 Add an additional field to the elf brandinfo structure to support
quicker exec-time replacement of the elf interpreter on an emulation
environment where an entire /compat/* tree isn't really warranted.
2003-12-23 02:42:39 +00:00
Peter Grehan
7b33c6ef7a Disable the per-vm_page PTE cache. This was not being invalidated
correctly, resulting in the dreaded "vm_pageout_flush: partially
invalid page" panic. The caching issue will be revisited in the
future, but opt for safety over performance in the meantime.

Tested by: gallatin
2003-12-16 03:55:57 +00:00
Peter Grehan
71bf803ad6 imac revA-D and beige G3 OpenFirmware uses the "ide" string for
ATA drives.
2003-12-10 08:58:48 +00:00