Commit Graph

490 Commits

Author SHA1 Message Date
martin
cb5d206224 __unused policy 2006-10-15 19:22:17 +00:00
rjs
69dfdd82db Allow kernel to build with KGDB enabled. 2006-10-07 18:14:42 +00:00
jnemeth
6238d5fa66 Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken.  It failed to work on an ebus machine.  The ebus
support compiles fine, but I don't have hardware for testing.  This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
2006-10-06 08:44:59 +00:00
tnozaki
44eb8f042e fix gcc -Werror -Wmissing-braces problem
mbstate_t(this is opaque object)'s initializer should be ``{ 0 }'',
so changed 1st field of union from character array to integer.
2006-10-04 13:51:59 +00:00
mrg
fa535729f9 remove some sparc v8 only definitions. 2006-10-02 23:22:52 +00:00
martin
931c60dde9 Rework boot device matching to get rid of lots of special case code
and tables to map fimware names to driver names. Based on a suggestion
from Eduardo (quite some time ago).
Each device (on busses we can handle and care about) gets a device property
storing the devices OpenFirmware package handle. To match the boot device,
the phandle of the chosen bootpath is compared against this property,
plus some additional string matching for disk/cd devices (where OF only
provides a node for the device class, not each instance).
2006-09-26 09:45:57 +00:00
mrg
bbe604f605 normalise case in some macro values to be all the same (lower case) 2006-09-19 00:55:35 +00:00
martin
0b9bd89cf1 Lazy FPU handling for the MULTIPROCESSOR case 2006-09-18 08:18:47 +00:00
martin
092e3c8b7a Do not bother to save fpu state when we are about to get rid of it. 2006-09-15 07:42:38 +00:00
mrg
2102e18c4b SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
  from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
  all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
  but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
  all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
  environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
  db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
  does the same) and also implement "mach cpu N" to switch to
  another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
  them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
  multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
  if DDB is configured, enable it to save the passed-in trapframe
  to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
  pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
  the address and argument of the to be called function.  (the
  argument right now is the address of ipi_tlb_args variable, and
  part of the reason why only one CPU can send IPI's at a time.)
  don't wait forever for an IPI to complete.  some of this is
  from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
  mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
  saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
  smp_tlb_flush_ctx() and smp_tlb_flush_all().  the other end may
  not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
  vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
  the debugger using the normal breakpoint trap.  these cpus usually
  lose the race in db_interface.c:db_suspend_others() and end up
  calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
  points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
  %tpc is at the sparc64_ipi_pause_trap_point and if so, call
  "done" not "retry"
- rework cpu_switch slightly:  save the passed-in lwp instead of
  using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well.  from petrov.
- in cpu_exit(), fix a load register confusion.  from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
2006-09-13 11:35:53 +00:00
mrg
fc3c59182c make this idempotent. 2006-09-08 23:08:05 +00:00
yamt
e527ebac6f - remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
	ctod
	dtoc
	ctob
	btoc
	dbtob
	btodb
2006-08-28 13:43:35 +00:00
drochner
84f50d1b92 don't install <machine/db_machdep.h>, this is kernel only 2006-07-26 19:54:56 +00:00
kardel
09b51ec920 convert to timecounters (from branch simonb-timecounters) 2006-06-07 22:37:14 +00:00
yamt
4aed9e155a pull splraiseipl() for sparc64 from newlock branch.
reviewed by Martin Husemann.
2006-05-04 12:18:54 +00:00
cherry
93447d7ac4 closes: PR kern/32359
modifies machine/db_machdep.h: BKPT_SET(inst) to BKPT_SET(inst, addr) for all archs ie; passess the
breakpoint address as well.

Patch from cherry@mahiti.org
2006-04-01 15:45:00 +00:00
cube
f40bc6f570 s/uint32_t/unsigned int/ because we don't always have the former defined.
Reported by Juergen Hannken-Illjes.

XXX I prefer uint32_t, but there might be some namespace issues so for now
    it will do.
2006-03-16 16:05:53 +00:00
cube
bc7a3a86a6 Add the sparc64 MD bits to get usable coredumps for COMPAT_NETBSD32
binaries.
2006-03-14 22:05:05 +00:00
cube
8db07ab1c5 Under COMPAT_NETBSD32 emulation, pointers are not the same size as the
native ones...  netbsd32_pointer_t can't be used here though, so uint32_t
is used instead, which is of course the same thing.
2006-03-14 22:03:39 +00:00
cube
7e4eb63d0d We really have EM_SPARC binaries in 32-bits mode, not EM_SPARC32PLUS.
And yes, we do have EM_SPARCV9 binaries in 64-bits mode.
2006-03-14 21:37:48 +00:00
cdi
d0f8217f78 Use ANSI-style function definitions and declarations. 2006-02-20 19:00:27 +00:00
perry
fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
cdi
1a509d615a ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions. 2006-02-13 21:47:11 +00:00
cdi
d50f0c6274 ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
2006-02-11 17:57:31 +00:00
cdi
4c2e4320bd Alter sparc64 bootstrap, catch up to ofwboot v1.9:
- Accept bootinfo structure passed down from ofwboot v1.9
 - Drop kernel re-mapping code
 - Use permanent 4MB mappings provided by the loader instead
 - Change kernel entry address to point directly at the code instead of pointing
   at the trap table's first slot. This allows the bootloader to detect
   those kernels which are aware of the new boot scheme
 - Due to the changes in kernel mapping code, alter secondary CPU bootstrap
   code to use trampoline just like FreeBSD does (some FreeBSD code is used
   here as well)
2006-01-27 18:37:49 +00:00
perry
50a256a3a0 __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
2005-12-24 23:23:59 +00:00
perry
5f1c88d70d Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:06:46 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
martin
eb8540417a Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
   currently
 - implement cpu_proc_fork() to init p_md.md_flags on fork
2005-10-27 20:43:30 +00:00
chs
c0f26b2223 remove unnecessary includes. 2005-09-27 15:06:43 +00:00
christos
8fac7adf53 change trapframe to trapframe64 in the md_syscall prototype to fix 32
bit kernel builds.
2005-07-12 21:13:14 +00:00
martin
e14ba58310 When returning 64bit values (from netbsd32_lseek) fix up the return
value vector (of 32bit values, most likely) via a MD macro.
2005-07-12 15:06:17 +00:00
christos
3e061b04ef new file 2005-07-11 13:05:33 +00:00
christos
f1f78efdd1 Now that sparc has syscall intern, no need to define it here too. 2005-07-10 17:02:51 +00:00
martin
d6c7a12fb5 Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
2005-07-10 15:44:23 +00:00
christos
415655638b Forgot to add this. 2005-07-10 01:58:57 +00:00
christos
1e568eda97 Re-factor syscall, and make it use syscall_{plain,fancy}. 2005-07-10 00:50:16 +00:00
thorpej
6a02aeb003 Small clean-ups before an overhaul. 2005-06-19 23:36:47 +00:00
briggs
7f01fdeb84 Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
     match i386 et al.
2005-06-16 04:17:49 +00:00
dyoung
a37289db57 Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/.  That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such.  I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
2005-06-12 19:46:15 +00:00
christos
a38d2d274a sprinkle const. 2005-05-31 00:49:42 +00:00
matt
f854ad4125 For GCC3 and later, use the __builtin_va* constructs. 2005-04-20 05:15:15 +00:00
fvdl
c487efe4a7 Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
  that will return the default VM map address. The default function
  is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
  macro. This gives emulations control over the default map address,
  and allows things to be mapped at the right address (in 32bit range)
  for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
  or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
  instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
2005-03-26 05:12:34 +00:00
matt
a6db24a485 Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create).  dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
2005-03-09 19:04:43 +00:00
heas
c1d895ba16 Add a few comments wrt PTEs 2005-02-25 17:29:04 +00:00
martin
7cbebc44aa Cleanup: the PG_SZ macro was buggy (pointed out by Tim Newsham).
It was only used by (the also buggy/not ready for prime time) PMAP_PAGE_SIZE,
which in turn only was used in one place.

Get rid of all this and hardcode the result at the single place of use.
2005-02-22 16:21:07 +00:00
martin
c7b31c04d6 Remove orphaned extern declaration. 2005-01-27 08:50:27 +00:00
atatat
a076957818 Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
2005-01-17 04:37:20 +00:00
christos
ca0484bf3e add a linted comment. 2005-01-02 00:14:46 +00:00
abs
5958dd944e Fix comments slighly 2004-12-12 20:42:53 +00:00