Commit Graph

744 Commits

Author SHA1 Message Date
imp
105dd71b16 Commit WIP SSC driver, more work is needed here, but it configures
things OK.
2006-10-20 07:08:59 +00:00
imp
dbcd7809d1 More register definitions. 2006-10-20 07:08:15 +00:00
imp
22d781c5e8 Progress commit for getting TWI working 2006-10-20 07:06:39 +00:00
imp
e08539a4c7 Add sysctl to export current state of rmii vs mii configuraiton.
Fix a typo in resource allocation.
2006-10-20 07:04:56 +00:00
imp
4084c0b8bc Add configuration of the SSC lines for second SSC. 2006-10-20 07:03:57 +00:00
imp
3434ef1d27 MMC/SD bridge driver (host adapter) for AT91RM9200's MCI interface.
This interface also appears in the AT91SAM9260 and '61 as well as the
AVR32 based micros from Atmel.  We don't yet support write protect or
hot-swap in this bridge driver.
2006-10-20 06:44:04 +00:00
davidxu
bb5a3880aa o Add keyword volatile for user mutex owner field.
o Fix type consistent problem by using type long for old
  umtx and wait channel.
o Rename casuptr to casuword.
2006-10-17 02:24:47 +00:00
jb
bf543444cf PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:
Security:
Move the relocation definitions to the common elf header so that DTrace
can use them on one architecture targeted to a different one.

Add the additional ELF types defines in Sun's "Linker and Libraries"
manual.
2006-10-04 21:37:10 +00:00
phk
50c81b8a9a First part of a little cleanup in the calendar/timezone/RTC handling.
Move relevant variables to <sys/clock.h> and fix #includes as necessary.

Use libkern's much more time- & spamce-efficient BCD routines.
2006-10-02 12:59:59 +00:00
kan
c9b2659ee8 Use __builtin_va_start instead of __builtin_stdarg_start. GCC4 obsoletes
the former and  __builtin_va_start was present in all GCC version 3.1 and
later.
2006-09-21 01:37:02 +00:00
imp
6af2f13b58 MFp4: first cut at getting I2C transfers working (generically). I'm
unsure if this driver correctly implements all the start/stop junk
right (but it did or didn't before I made this commit).
2006-09-07 21:53:28 +00:00
imp
423b53ad2f MFp4: berndt pointed me at an errata that shows that the stat register
offsets were originally documented incorrectly.  This fixes that.  It
shouldn't affect anything other than error stat reporting.
2006-09-07 21:50:01 +00:00
cognet
56796490ea Remove dead code, already defined in sys/cdef.h
Spotted out by:	bde
2006-08-30 11:45:07 +00:00
cognet
192d7d2aa6 Use ENTRY_NP for alternate entry points instead of ENTRY to avoid calling
mcount twice when profiling.

Spotted out by:	bde
2006-08-30 11:44:37 +00:00
cognet
8397e9dcdc Use ENTRY instead of ALTENTRY, it doesn't exist on arm. 2006-08-29 23:53:34 +00:00
cognet
ecf44c474e Ooops m->md.pvh_attrs can't be used to know if the page is writeable, because
it only remembers if the page is modified or referenced.

Bad review from:	cognet
2006-08-28 21:43:34 +00:00
cognet
fa893a6f9c Relocate the vector page for AT91, to work around bugs with the LOW_VECTOR
code.
2006-08-28 20:05:00 +00:00
davidxu
87b5aa08ee Implement casuword32, compare and set user integer, thank Marcel Moolenarr
who wrote the IA64 version of casuword32.
2006-08-28 02:28:15 +00:00
cognet
15bd8c41bf Fill in dump_avail[] before pmap_boostrap() is called so that
ARM_USE_SMALL_ALLOC work.
2006-08-27 13:23:51 +00:00
alc
72ff1a9186 Eliminate unused definitions. (They came from NetBSD.)
Discussed with: cognet, grehan, marcel
2006-08-25 23:51:11 +00:00
cognet
53e0a06a26 Explicitely set the "allocbuffer" field to NULL when creating a new dmamap. 2006-08-25 15:10:45 +00:00
cognet
3748f87bf1 Do not create dma maps with bus_dmamap_create, as we call
bus_dmamem_alloc later which will overwrite the value, leading to a small
memory leak.
2006-08-25 13:38:42 +00:00
cognet
d4600e67df Finally bring it support for the i80219 XScale processor.
Submitted by:	Max M. Boyarov <m.boyarov bsd by>
2006-08-24 23:51:28 +00:00
cognet
ccd457af25 Use ELFDATA2MSB if we're building big endian.
Noticed by:	Oleksandr Tymoshenko <gonzo freebsd org>
2006-08-24 23:00:03 +00:00
imp
95a426fdc6 add comment about why we include opt_global.h 2006-08-15 18:11:25 +00:00
cognet
d7e3bf9763 Ooops we need to include <machine/vmparam.h> to get the definition of
KERNBASE and VM_MAXUSER_ADDRESS.
Remove the useless include of opt_global.h, as noticed by netchild@ (the one
in arm/elf_trampoline.c is legit, because this file is compiled outside the
kernel, and doesn't use the standard CFLAGS).
2006-08-15 16:43:07 +00:00
imp
8d1199edcd Hook into the watchdog device, if present. Also, turn off the
watchdog timer stuff when we boot because the boot blocks are turning
it on...
2006-08-09 20:58:55 +00:00
cognet
2d628bb4d9 Rewrite ARM_USE_SMALL_ALLOC so that instead of the current behavior, it maps
whole the physical memory, cached, using 1MB section mappings. This reduces
the address space available for user processes a bit, but given the amount of
memory a typical arm machine has, it is not (yet) a big issue.
It then provides a uma_small_alloc() that works as it does for architectures
which have a direct mapping.
2006-08-08 20:59:38 +00:00
kevlo
ae60705942 Remove a bogus i = 0.
Approved by: cognet
2006-08-08 01:18:18 +00:00
alc
a152234cf9 Complete the transition from pmap_page_protect() to pmap_remove_write().
Originally, I had adopted sparc64's name, pmap_clear_write(), for the
function that is now pmap_remove_write().  However, this function is more
like pmap_remove_all() than like pmap_clear_modify() or
pmap_clear_reference(), hence, the name change.

The higher-level rationale behind this change is described in
src/sys/amd64/amd64/pmap.c revision 1.567.  The short version is that I'm
trying to clean up and fix our support for execute access.

Reviewed by: marcel@ (ia64)
2006-08-01 19:06:06 +00:00
jhb
3a707d012d Retire SYF_ARGMASK and remove both SYF_MPSAFE and SYF_ARGMASK. sy_narg is
now back to just being an argument count.
2006-07-28 20:22:58 +00:00
jhb
c62c38439f Now that all system calls are MPSAFE, retire the SYF_MPSAFE flag used to
mark system calls as being MPSAFE:
- Stop conditionally acquiring Giant around system call invocations.
- Remove all of the 'M' prefixes from the master system call files.
- Remove support for the 'M' prefix from the script that generates the
  syscall-related files from the master system call files.
- Don't explicitly set SYF_MPSAFE when registering nfssvc.
2006-07-28 19:05:28 +00:00
jhb
12302c47d0 Unify the checking for lock misbehavior in the various syscall()
implementations and adjust some of the checks while I'm here:
- Add a new check to make sure we don't return from a syscall in a critical
  section.
- Add a new explicit check before userret() to make sure we don't return
  with any locks held.  The advantage here is that we can include the
  syscall number and name in syscall() whereas that info is not available
  in userret().
- Drop the mtx_assert()'s of sched_lock and Giant.  They are replaced by
  the more general checks just added.

MFC after:	2 weeks
2006-07-27 22:32:30 +00:00
cognet
eb22761b8a Define BYTE_MSF if we're compiling a big endian kernel, so that DDB can
correctly disassemble instructions on big endian.
2006-07-27 11:41:37 +00:00
cognet
405961b2ae Use virtual_avail instead of freemempos as the starting point of the available
physical memory, as the vm uses the memory between freemempos and
virtual_avail.

MFC After:	3 days
2006-07-25 23:07:35 +00:00
kevlo
9600c80b61 Cleanup.
Approved by: cognet
2006-07-25 01:08:41 +00:00
alc
51bab356f5 Implement pmap_clear_write().
Discussed with: cognet@
2006-07-20 23:26:22 +00:00
cognet
83a16c4049 Fix ALT_BREAK_TO_DEBUGGER on the AT91 :
The core uart code expects the receive method to actually puts the
characters read into its buffers. For AT91, it's done in the ipend routine,
so also check if we have the alternate break sequence here.

MFC after:	3 days
2006-07-20 21:03:43 +00:00
cognet
c601d0f319 Make sure we use REDUCE32 on the result of do_cksum(), as in_cksum_skip()
expects this. If we do not, this could result in wrong checksums.

MFC after:	1 day
2006-07-18 00:07:05 +00:00
cognet
34956b2cd0 If we can't defrag a packet, re-queue it instead of dropping it. 2006-07-17 21:36:08 +00:00
cognet
68d3bbc684 #if => #ifdef 2006-07-17 21:20:00 +00:00
cognet
010b2aa1be at91_spi won't compile without spibus, so add it. 2006-07-17 21:17:20 +00:00
cognet
8b02dff467 Oops bring back code that shouldn't have been removed by the previous
commit.
2006-07-15 23:15:31 +00:00
cognet
f4ecac7c4e Make sure that if uma_small_alloc() gets called recursively, we just give up
and call kmem_malloc(), to avoid a deadlock.
2006-07-15 23:01:54 +00:00
cognet
1d520bd714 Add a comment explaining why the OHCI mapping has been commented out. 2006-07-15 00:09:53 +00:00
imp
29ab994ef0 MFp4: this now depends on new spi bus stuff 2006-07-14 22:41:54 +00:00
imp
a3607b2b33 MFp4: tweaks 2006-07-14 22:40:24 +00:00
imp
60a615aa4e MFp4: elevate quality of slow clock a little 2006-07-14 22:31:12 +00:00
imp
a96b0fc43f MFp4: paren police 2006-07-14 22:30:44 +00:00
imp
1248744935 MFp4:
Introduce framework to configure the multiplexed pins on boot.

	Since the USART supprots RS-485 multidrop mode, it allows the
	TX pins to float.  However, for RS-232 operations, we don't
	want these pins to float.  Instead, they should be pulled up
	to avoid mismatches.  Linux does something similar when it
	configures the TX lines.  This implies that we also allow the
	RX lines to float rather than be in the state they are left in
	by the boot loader.  Since they are input pins, I think that
	this is the right thing to do.

	Plus minor for our board.
2006-07-14 22:22:57 +00:00
imp
de4939a282 MFp4:
Fix typo in RTC_CALR_MK.
2006-07-14 22:06:01 +00:00
imp
05cb2db736 The TSC board uses a 16MHz base clock for the AT91RM9200, while the Kwikbyte
board uses a 10MHz base clock.  Cope with this difference.
2006-07-14 22:01:51 +00:00
imp
3b9505ced7 Implement the set_time function. Rather pointless with this RTC, as it
resets when the core resets, but there may be some use for it...
2006-07-14 21:37:19 +00:00
imp
d9d2d73de5 MF p4:
Adapt to forthcoming spi framework.  The ioctls for SPI commands and such
belong in the higher level driver.
2006-07-14 21:35:59 +00:00
imp
6dccb75673 Be sure to flush the cache after a partial read on timeout. Expand
comments about timeouts.  Fix a style nit.  Sometimes small messages
were getting corrupted.
2006-07-14 21:33:04 +00:00
imp
e5fffb8574 Move some of the common parameters into the std. files for this platform.
Also migrate from MD disk to NFS boot.
2006-07-14 15:20:31 +00:00
cognet
2b9f045c18 Remove prototype for the undefined function counterhandler().
Submitted by:	kevlo
2006-07-14 13:37:47 +00:00
cognet
15c9b6e9df Add remote GDB bits for arm. 2006-07-14 00:50:51 +00:00
jhb
a72b0bcd7f Simplify the pager support in DDB. Allowing different db commands to
install custom pager functions didn't actually happen in practice (they
all just used the simple pager and passed in a local quit pointer).  So,
just hardcode the simple pager as the only pager and make it set a global
db_pager_quit flag that db commands can check when the user hits 'q' (or a
suitable variant) at the pager prompt.  Also, now that it's easy to do so,
enable paging by default for all ddb commands.  Any command that wishes to
honor the quit flag can do so by checking db_pager_quit.  Note that the
pager can also be effectively disabled by setting $lines to 0.

Other fixes:
- 'show idt' on i386 and pc98 now actually checks the quit flag and
  terminates early.
- 'show intr' now actually checks the quit flag and terminates early.
2006-07-12 21:22:44 +00:00
cognet
45301dddff Comment out the mapping of the OHCI controller registers va == pa. This
address is in the userland address space. The proper thing is either to choose
a virtual address in the kernel address space beyond the KVA, or to use
pmap_mapdev().
2006-07-12 00:48:50 +00:00
cognet
510c505cb5 Add a new flag to pmap_enter_locked() to say if it's OK to wait. If it is, and
we're unable to allocate the memory for a PTE, we'll wait until we can. If not,
we'll just return.
Use M_NOWAIT|M_USE_RESERVE to allocate PTEs, it is less aggressive than
M_NOWAIT alone.

Suggested by:   alc
2006-07-11 11:22:06 +00:00
imp
d1b6a98346 Add support for configuring pins to be one of {GPIO, PERIPHERAL A or
PERIPHERAL B}, as well as direction of GPIO pin.  Add defines for all
the pins.
2006-07-02 03:50:44 +00:00
imp
7a60ad8bb4 MFp4:
Make serial ports more robust and reliable.  Make non-console ports
work.  This might have broken skyeye stuff.

o Introduce ping-pong receive buffers.
o Use DMA to copy characters directly into memory.
o Support baud rates other than 115200
o Use 1 stop bit when 1 stop bit is requested (otherwise 2 were used,
  which caused dropped characters when received in bursts).
o Use 1.5 stop bits for 5-bit bytes, and 2 stop bits otherwise when 2
  stop bits were requested.
o Actually update line parameters.
o Fix comments
o Move init into attach
o Tweaks to TX interrupt registers to get them reliable and non-storming.
o harvest data in ipend since the latency between it and the callback
  was too long.  This likely is how it should be, I don't know why I deferred
  things to the callback before.
o disable all interrupts in console init.  We don't want interrupts until
  we turn on an ISR.
o cosmetic tweaks
o Automatically detect of the TIMEOUT interrupt is supported.  If so, use
  it so we get better CPU utilization.  Otherwise do a character at a time
  RX.  Good news here is that it seems we have enough CPU and low enough
  fast interrupt latency to do this reliably.
o Don't read USART_CR.  It is a write-only register.
o start to implement bus_ioctl.  Do BAUD now...
2006-07-02 03:45:33 +00:00
cognet
5688b2b9fa Backout previous commit, Warner committed at91_pio.c... 2006-06-23 23:07:11 +00:00
cognet
39fcd24d6a There's no need to allocate that much phdr/shdr from the stack. 2006-06-23 22:45:35 +00:00
cognet
905a22c391 Add the arm9_setup() prototype. 2006-06-23 22:37:15 +00:00
cognet
109db2df6d Comment out at91_pio.c, it's not in CVS. 2006-06-23 22:30:55 +00:00
cognet
73fb243aea arm9_setup() is now needed even if we're not using a gzipped kernel, so move
it outside the #ifdef KZIP

Pointy Hat to:	cognet
2006-06-22 22:33:21 +00:00
imp
14612d61da Nitsville: the routine is called initarm, not init_arm, correct it in
a comment.
2006-06-21 23:47:25 +00:00
cognet
bf915fdf74 Don't forget to define uart_sa1110_vaddr.
Submitted by:	kevlo
2006-06-21 10:56:59 +00:00
imp
7ac9e2a5c2 Compute physmem so we can print it correctly on boot.
Slightly optimize while I'm here.
2006-06-20 23:40:04 +00:00
imp
da7a558f2e Probe the memory size of the board better. Look at the bus width,
number of banks, rows and columns the SDRAMC is programmed to access
to determine the RAM size for the board, rather than hard-wiring it to
be 32MB.  My company's board with 64MB now probes correctly, as does
the KB9202 with only 32MB.  This means that to detect the right memory
size, our boot loader must correctly initialize these values.  This is
a fairly safe assumption because the boot loader has to initialize
SDRAM already, and it isn't really possible to change this register
after we've accessed SDRAM.
2006-06-20 20:13:40 +00:00
cognet
a32f908e29 Make sure the stack is properly aligned.
Enable the MMU when relocating as well, and use write-through cache.
2006-06-18 22:46:30 +00:00
imp
6126658315 comment out twi for now: no iicbus in KB920X: it breaks booting 2006-06-17 23:34:59 +00:00
imp
efe72c3bf7 Carefully note the RMII bit in the config register at attach time.
The boot loader is supposed to leave this bit set to the right value
for the board.  If this bit was set at attach time, use it to init the
config register correctly.

Note: this means the boot loader has to properly initialize it.
2006-06-17 23:24:35 +00:00
imp
c2756c87a0 improve reporting of clocks 2006-06-17 23:22:10 +00:00
netchild
11681ee0b5 Remove COMPAT_43 from GENERIC (and other kernel configs). For amd64 there's
an explicit comment that it's needed for the linuxolator. This is not the
case anymore. For all other architectures there was only a "KEEP THIS".
I'm (and other people too) running a COMPAT_43-less kernel since it's not
necessary anymore for the linuxolator. Roman is running such a kernel for a
for longer time. No problems so far. And I doubt other (newer than ia32
or alpha) architectures really depend on it.

This may result in a small performance increase for some workloads.

If the removal of COMPAT_43 results in a not working program, please
recompile it and all dependencies and try again before reporting a
problem.

The only place where COMPAT_43 is needed (as in: does not compile without
it) is in the (outdated/not usable since too old) svr4 code.

Note: this does not remove the COMPAT_43TTY option.

Nagging by:	rdivacky
2006-06-15 19:58:53 +00:00
ups
b3a7439a45 Remove mpte optimization from pmap_enter_quick().
There is a race with the current locking scheme and removing
it should have no measurable performance impact.
This fixes page faults leading to panics in pmap_enter_quick_locked()
on amd64/i386.

Reviewed by: alc,jhb,peter,ps
2006-06-15 01:01:06 +00:00
cognet
5dcde5a0f3 MFp4:
- Try hard to calculate a safe sp, so that the stack doesn't get smashed
while uncompressing or relocating the kernel.
- Bring in code needed to calculate the cacheline size etc, needed for
arm9_idcache_wbinv_all.
2006-06-12 22:58:50 +00:00
cognet
e928591f2a MFp4: Increase the L1 pagetable needed for the kernel from 8 to 22, to be
able to boot fat kernels.
2006-06-12 22:57:24 +00:00
alc
c282bd28da Remove pmap_pagedaemon_waken and update pmap_get_pv_entry() to match the
current interface with the machine-independent layer.  Without this change,
the page daemon would only have been awakened the first time that the
number of pv entries went above the high water mark, not each time.
2006-06-11 04:53:06 +00:00
alc
2047f3b7e7 Eliminate spl calls. 2006-06-11 04:14:36 +00:00
alc
2af67f3b97 Add a lock assertion. Remove dead (locking) code. Change some white
space.

Reviewed by: cognet@
2006-06-10 05:20:18 +00:00
alc
d902525710 Add pmap locking to pmap_extract().
Tested by: cognet@
2006-06-09 03:54:20 +00:00
cognet
b2f0652261 Oops it seems I forgot to remove ARM32_NEW_VM_LAYOUT from here. 2006-06-07 22:41:14 +00:00
alc
65c52763ef Add pmap locking to pmap_fault_fixup().
Add an assertion to pmap_vac_me_harder().

Tested by: cognet@
2006-06-07 20:54:31 +00:00
alc
0dc86d8ad0 Properly synchronize access to the pmap in pmap_extract_and_hold().
Eliminate an unneeded variable from pmap_extract_and_hold().

Tested by: cognet@
2006-06-07 17:14:48 +00:00
cognet
ef695e4fb6 Now that we use pmap_mapdev_boostrap(), we can get ride of the got_mmu
hack.

Submitted by:	kevlo
2006-06-07 11:28:17 +00:00
imp
21150f79c2 Remove sa1_cache_clean_addr. It isn't needed.
Submitted by: kevlo
2006-06-07 05:36:10 +00:00
cognet
13929c476a Convert the last offender, the SA1110 port, to ARM32_NEW_VM_LAYOUT, and
completely nuke the !ARM32_NEW_VM_LAYOUT case.
2006-06-06 21:06:57 +00:00
cognet
5de6166e83 Remove a bogus, useless, "i++". 2006-06-06 20:47:59 +00:00
alc
0370c1b8e9 Add partial pmap locking.
Tested by: cognet@
2006-06-06 17:27:53 +00:00
alc
361dd71e9d Add partial pmap locking.
Eliminate the unused allpmaps list.

Tested by: cognet@
2006-06-06 04:32:20 +00:00
cognet
04175402f4 Make VERBOSE_INIT_ARM compile by fixing various printf formats, and add it
as an option.

Submitted by:   Max N. Boyarov <m.boyarov at bsd dot by>
2006-06-06 01:14:12 +00:00
cognet
9a1fae8510 vm_page_alloc_contig() can sleep, so don't even think about using it
in the M_NOWAIT case.
2006-06-05 23:42:47 +00:00
alc
ff4adb11fe Introduce the function pmap_enter_object(). It maps a sequence of resident
pages from the same object.  Use it in vm_map_pmap_enter() to reduce the
locking overhead of premapping objects.

Reviewed by: tegge@
2006-06-05 20:35:27 +00:00
cognet
df0505f188 Don't #error if no CPU is defined but we're not compiling the kernel. 2006-06-02 09:39:06 +00:00
cognet
55e41f7b78 Don't enable the FIQ in enable_interrupts() if F32_bit is not specified.
This has been committed by mistake.

Reported by:	ssouhlal
2006-06-01 16:17:44 +00:00
alc
987bc104a2 Introduce pmap_enter_locked() and use it to reimplement pmap_enter_quick().
Tested by: cognet@
2006-06-01 01:31:07 +00:00
cognet
dab340c4af Avoid a LOR by unlocking the vm_page_queue_mtx before calling uma_zalloc,
and freeing the allocated memory if another thread already did the same.
2006-05-31 15:52:11 +00:00
cognet
25b7dd01d0 If our buffer is not aligned on the cache line size, write back/invalidate
the first and last cache line in PREREAD, and just invalidate the cache
lines in POSTREAD, instead of write-back/invalidating in POSTREAD, which
could lead to stale data overriding what has been transfered by DMA.
2006-05-31 15:50:33 +00:00
cognet
22b23b4b2d Ooops arm10 is armv5, not armv4.
Submitted by:	kevlo
2006-05-31 13:06:08 +00:00
cognet
d766c10a1c Include machine/cpuconf.h in pmap.h in order to get ARM_NMMUS defined,
to appease -Wundef.
2006-05-31 11:57:37 +00:00
cognet
9507be8d56 Protect the mapping used for pmap_copy_page/pmap_zero_page with a
mutex.
2006-05-30 23:50:45 +00:00
cognet
eb54945e83 To avoid problems, invalidate the data cache and disable the MMU once
we're done uncompressing the kernel.
2006-05-30 21:13:47 +00:00
cognet
032e8ffcc2 In pmap_is_prefaultable(), assert that the pte isn't NULL if
pmap_get_pde_pte() returns TRUE.

Suggested by:   ssouhlal
2006-05-30 16:55:38 +00:00
cognet
13f50bf79a The Assabet has 32MB of RAM, not 16.
Submitted by:	kevlo
2006-05-30 15:47:55 +00:00
benno
b96008e410 In pmap_mapdev we correctly round the address off to the nearest page
boundary, but we must also add the offset back on to the va we return.
2006-05-30 14:21:09 +00:00
cognet
6449092f51 Uncomment the call to cpu_idcache_wbinv_all() after the MMU has been
enabled. It has been commented out for a reason I forgot but I suspect
does not apply anymore.
Technically speaking it's not required to do it, has the data and the
instruction cache have been disabled in _start(). However, it may change
in the future, so I don't want to rely on this behavior.

Submitted by:	kevlo
2006-05-30 11:51:58 +00:00
cognet
4fa540e2fb Nuke sa11x0_attach_args. It's a NetBSDIsm, and we have no use for it.
Submitted by:	kevlo
2006-05-29 19:32:32 +00:00
cognet
cebb2624f1 Remove any reference to enable_mmu(), it's been gone for a long time.
Submitted by:	kevlo
2006-05-26 01:41:47 +00:00
cognet
a1e9e6f052 Use pmap_devmap_bootstrap(), instead of mapping the SACOM1 registers
with pmap_map_entry.
More use of macros instead of hardcoding the addr.

Submitted by:	kevlo
2006-05-23 12:14:14 +00:00
cognet
671ec01c10 Use macros instead of hardcoding the address for SACOM1. Also don't
pretend we're working with SACOM3, as we're really mapping SACOM1.

Submitted by:   kevlo
2006-05-22 23:25:34 +00:00
cognet
e748a32ffa We have an implementation of generic_bs_rr_1, so use it, as some drivers use
it.

Submitted by:	kevlo
2006-05-19 11:27:02 +00:00
cognet
6dfe821fda Comment out SYSCTL_OMIT_DESCR until it's committed. 2006-05-19 00:11:21 +00:00
cognet
703043e7e1 Implement sa11x0_bs_unmap.
Submitted by:	kevlo
2006-05-18 22:03:47 +00:00
cognet
26f5546b64 Make this compile (UART_IPEND_* => SER_INT_*). 2006-05-18 22:02:33 +00:00
cognet
c4eaf759a9 Add definitions for atomic_subtract_rel_32, atomic_add_rel_32 and
atomic_load_acq_32, needed for hwpmc.
2006-05-15 13:08:12 +00:00
benno
438bd823c9 Display real/avail memory as per other platforms.
Approved by:	cognet
2006-05-15 10:40:37 +00:00
cognet
b979607c78 Switch to a 64bit time_t, while it's not a big problem to do so.
Suggested by:	imp
2006-05-15 00:17:27 +00:00
cognet
2e58b61962 Resurrect Skyeye support :
Add a new option, SKYEYE_WORKAROUNDS, which as the name suggests adds
workarounds for things skyeye doesn't simulate. Specifically :
- Use USART0 instead of DBGU as the console, make it not use DMA, and           manually provoke an interrupt when we're done in the transmit function.
- Skyeye maintains an internal counter for clock, but apparently there's
no way to access it, so hack the timecounter code to return a value which
is increased at every clock interrupts. This is gross, but I didn't find a
better way to implement timecounters without hacking Skyeye to get the
counter value.
- Force the write-back of PTEs once we're done writing them, even if they
are supposed to be write-through. I don't know why I have to do that.
2006-05-13 23:41:16 +00:00
imp
cf90ee9498 Tidy up a bit... 2006-05-13 02:47:39 +00:00
phk
5d8c57a08b Clean out sysctl machdep.* related defines.
The cmos clock related stuff should really be in MI code.
2006-05-11 17:29:25 +00:00
cognet
a100106c75 Get this to compile :
- The prototype of uart_bus_probe() hasn't been changed in cvs yet, so use the
old one.
- Add at91_pdcreg.h, needed by uart_dev_at91usart.c.
2006-05-11 14:30:28 +00:00
cognet
627a93886f Move the call to cpu_setup() before the call to vm_ksubmap_init().
vm_ksubmap_init() calls pmap_copy_page(), which uses the mini data cache
to do the copy, but we're running uncaching before cpu_setup().
For some reason it hasn't been a problem so far, but it is for the
PXA255.

Spotted out by: benno
2006-05-10 13:39:10 +00:00
cognet
58dbe8e93e Setting the rid of the resource is a good idea, but we still need to return
the resource after.
2006-05-05 19:14:57 +00:00
cognet
beb0639917 MFother arches :
date: 2006/04/12 04:22:50;  author: alc;  state: Exp;  lines: +14 -41
Retire pmap_track_modified().  We no longer need it because we do not
create managed mappings within the clean submap.  To prevent regressions,
add assertions blocking the creation of managed mappings within the clean
submap.

Reviewed by: tegge
2006-04-22 22:51:32 +00:00
imp
09e17e600a When returning a resource that we've allocated with rman_reserve_resource,
go ahead and set the rid for that resource.
2006-04-20 04:12:02 +00:00
cognet
89b59ebb5e We need to adjust the bus handle if the resource is SYS_RES_MEMORY, NOT
SYS_RES_IOPORT.
2006-04-13 15:07:59 +00:00
cognet
b63a034818 Disable/enable fiqs as well as irqs. 2006-04-13 14:25:28 +00:00
cognet
271e02009f MFp4: Use CPU_CONTROL_ROUNDROBIN for arm9, it seems to give marginally
better performances.
2006-04-09 23:07:31 +00:00
cognet
f1ed1ae32f Not only disable/enable interrupts, do it for FIQs as well, when needed. 2006-04-09 20:16:47 +00:00
cognet
e23eec56ae MFp4: Don't write-back the PTEs if they are mapped write-through, this was
apparently only needed because skyeye has bugs in its cache emulation.
2006-04-09 20:03:03 +00:00
cognet
8b8bb58f45 MFp4: Catchup with recent UART changes. 2006-04-06 20:47:54 +00:00
cognet
067f218bcf Add a new option, XSCALE_DISABLE_CCNT, to not use the xscale ccnt as a
timecounter (because gxemul doesn't emule it yet).
2006-04-06 17:11:08 +00:00
imp
8694646e12 Add debug writes in error cases that, in theory, should never happen 2006-04-06 04:32:29 +00:00
imp
000b33975f Connect twi to the FreeBSD iicbus infrastructure. 2006-04-06 04:31:19 +00:00
imp
b8ec0fd91c Pull in numerous fixes from myself and cognet. With these fixes the
KB9202 eval board is finally stable with a nfs root.
2006-04-06 04:30:23 +00:00
imp
9a23a843f0 Remove unused bit definitions.
Minor style cleanup while I'm here.
2006-04-06 04:29:24 +00:00
imp
41d4c17769 Optimize the TX side of the part by using the PDC to move bytes out to
the wire.  This increases the speed considerably.  Start to put
infrastructure in place to do RX side, but that requires more study
before it can be done.
2006-04-06 04:27:19 +00:00
peter
0f363b7d24 Remove the unused sva and eva arguments from pmap_remove_pages(). 2006-04-03 21:16:10 +00:00
cognet
acc2935072 Implement pmap_object_init_pt() the way it is on sparc64/alpha, by doing
nothing except asserting the vm object is locked, and a device object,
instead of a useless printf.
2006-03-26 22:03:43 +00:00
imp
3bdb3321e5 Skeleton support for the SSC device, which implements I2S interfaces,
amoung others.
2006-03-24 07:42:33 +00:00
imp
177c00bf75 Skeleton PIO support. 2006-03-24 07:39:29 +00:00
imp
378a37c96c Add the sekelton of support for the Power Management Controller. 2006-03-24 07:37:56 +00:00
imp
0fcb126eba Add rtc to files.at91 2006-03-24 07:36:23 +00:00
imp
2d026c4a78 Add RTC support. This may be of dubious value since the RTC is reset
to 1998 every reboot.
2006-03-24 07:35:30 +00:00
cognet
311d69f620 MFp4: Don't force single-user now we can go multi-user.
Call cninit() only after the pagetable has been set, as locore.S won't
map the system device for us anymore.
2006-03-22 22:31:31 +00:00
cognet
68a24ad6b0 MFp4: More special casing of when vector_page == 0x00000000 :
catch attempts to write to vector_page earlier in pmap_fault_fixup(),
and deny it.
2006-03-22 22:11:10 +00:00
cognet
0e96d8153f MFp4: If we're mapping the vector page (this will happen if we didn't
relocate it), do not attempt to call pmap_vac_me_harder() on the page.
At this point m will be NULL, and we know we won't have any cache
issues with this page.
2006-03-22 21:23:27 +00:00
cognet
b9a98eab6a MFp4: teach the KB920x bits how to know where the ELF trampoline puts the
strtab and the symtab.
2006-03-22 21:16:51 +00:00
cognet
1e8aa65571 MFp4: Handle break interrupts (it seems to only work for USART, not DBGU). 2006-03-22 21:16:09 +00:00
imp
ebdf4c5109 MFp4:
Add bus attachment for the ohci device on this chip.  The bus and hub
are detected correctly, but the children devices aren't detected
correctly for reasons unknown.
2006-03-18 01:45:29 +00:00
imp
a98bdc0813 Add ohci controller mapping. 2006-03-18 01:43:54 +00:00
imp
e1042394e7 MFp4:
o update TODO list
o Better use of busdma
o mark RX dtors as COHERENT.  This helps performance a lot by not requiring
  so many EXPENSIVE cache flushes.  The cost of accessing it non-cached
  is much smaller.
o Copy data from Rx buffers to make IP header 4 byte aligned.
o CRC length included in reported length, so cope
o Don't free TX buffer twice
o Manage TX buffers better.
o Enable just the interrupts we want.
o Manage OACTIVE better

# Some of these done by cognet
# These changes let us get to # via NFS root.
2006-03-18 01:43:25 +00:00
imp
efec5051c9 MFP4:
Gratuitously sort alphabetically.
2006-03-18 01:39:23 +00:00
imp
89937ade66 MFP4:
GC and fix definitions.

# some of this may have been done by cognet
2006-03-18 01:38:25 +00:00
imp
ed8d5d3e0b MFp4:
o Add memory barrier to bus space
o Allow for up to 3 IRQs per device
o Move to table driven population of children devices.
o Add support for usb ohci memory mapped controller resource allocation.
o Clean up a bunch of extra writes to disable interrupts that are now
  done elsewhere.
o Force all system interrupt handlers be fast.  We get deadlock if they
  aren't.
2006-03-18 01:35:49 +00:00
imp
4470c64621 MFp4:
o Disable all interrupts that the ST can generate until we have an ISR
  to service them.
o Correct clock calculation to make DELAY the right length...

Submitted by: cognet (#2)
2006-03-18 01:30:31 +00:00
cognet
b82f657662 MFp4: Forget the asm inlined version of in_cksum_hdr(). It doesn't work if
the pointer is unaligned, and it just doesn't worth it.
2006-03-09 23:33:59 +00:00
cognet
98462ee055 Use BUS_DMA_COHERENT. 2006-03-02 14:06:38 +00:00
cognet
f8b9a9739d Use 8 * sizeof(int) instead of hardcoding 32, for the unlikely case this
code ever get used on a plateform where sizeof(int) != 4.

Suggested by:	jmg
2006-03-02 00:37:40 +00:00
cognet
dc462dee1c Try to honor BUS_DMA_COHERENT : if the flag is set, normally allocate memory
with malloc() or contigmalloc() as usual, but try to re-map the allocated
memory into a VA outside the KVA, non-cached, thus making the calls to
bus_dmamap_sync() for these buffers useless.
2006-03-01 23:04:25 +00:00
cognet
51d4ab1575 Use a better panic message than lol. 2006-03-01 20:43:51 +00:00
cognet
6ea36e7106 Make sure we decrement p_lock before leaving prefetch_abort_handler() 2006-03-01 20:42:47 +00:00
cognet
979dd3001b userret() now only takes 2 parameters. 2006-03-01 18:33:45 +00:00
cognet
ce247bd774 Get this to compile with the recent UART changes. 2006-02-27 23:19:13 +00:00
jhb
ff9c76bccd Close some races between procfs/ptrace and exit(2):
- Reorder the events in exit(2) slightly so that we trigger the S_EXIT
  stop event earlier.  After we have signalled that, we set P_WEXIT and
  then wait for any processes with a hold on the vmspace via PHOLD to
  release it.  PHOLD now KASSERT()'s that P_WEXIT is clear when it is
  invoked, and PRELE now does a wakeup if P_WEXIT is set and p_lock drops
  to zero.
- Change proc_rwmem() to require that the processing read from has its
  vmspace held via PHOLD by the caller and get rid of all the junk to
  screw around with the vmspace reference count as we no longer need it.
- In ptrace() and pseudofs(), treat a process with P_WEXIT set as if it
  doesn't exist.
- Only do one PHOLD in kern_ptrace() now, and do it earlier so it covers
  FIX_SSTEP() (since on alpha at least this can end up calling proc_rwmem()
  to clear an earlier single-step simualted via a breakpoint).  We only
  do one to avoid races.  Also, by making the EINVAL error for unknown
  requests be part of the default: case in the switch, the various
  switch cases can now just break out to return which removes a _lot_ of
  duplicated PRELE and proc unlocks, etc.  Also, it fixes at least one bug
  where a LWP ptrace command could return EINVAL with the proc lock still
  held.
- Changed the locking for ptrace_single_step(), ptrace_set_pc(), and
  ptrace_clear_single_step() to always be called with the proc lock
  held (it was a mixed bag previously).  Alpha and arm have to drop
  the lock while the mess around with breakpoints, but other archs
  avoid extra lock release/acquires in ptrace().  I did have to fix a
  couple of other consumers in kern_kse and a few other places to
  hold the proc lock and PHOLD.

Tested by:	ps (1 mostly, but some bits of 2-4 as well)
MFC after:	1 week
2006-02-22 18:57:50 +00:00
imp
da6aba0374 These files apply to all the atmel parts that freebsd is going to run on,
so name them more generically.  If we do support the MMU-less ARM7 parts,
then we'll need to, at that time, expand the files we have.
2006-02-17 22:33:13 +00:00
imp
a2ac42b55a This file was obsolete when committed. Catchup and delete it. 2006-02-17 22:23:36 +00:00
imp
e106ce1e06 Use the correct address for the ohci device. 2006-02-11 03:58:07 +00:00
phk
74f8e63a10 Simplify system time accounting for profiling.
Rename struct thread's td_sticks to td_pticks, we will need the
other name for more appropriately named use shortly.  Reduce it
from uint64_t to u_int.

Clear td_pticks whenever we enter the kernel instead of recording
its value as reference for userret().  Use the absolute value of
td->pticks in userret() and eliminate third argument.
2006-02-08 08:09:17 +00:00
cognet
f63c104013 Set the MAC address after we just read it at attach time, as it seems needed. 2006-02-07 21:31:13 +00:00
cognet
c7f3a565d2 Set m_pkthdr.len and m_pkthdr.rcvif. 2006-02-07 20:48:52 +00:00
imp
763746d810 This file isn't GENERIC, so change the header 2006-02-07 18:45:54 +00:00
imp
323aae33b2 Rather than pull in all the phy, just pull in the lxt phy that we need
for this board (although our lxtphy driver isn't claiming it, but that's
a different problem).

This saves 57k in this kernel.
2006-02-07 18:43:46 +00:00
cognet
35615ccad6 - Call mii_phy_probe() after we allocated an ifp. mii has this evil
hack where it assumes the first field of the driver softc is the struct
ifnet, and it copies its value in mii_phy_probe().
- In the interrupt handler, set the mbuf m_len field on packet receive.
2006-02-06 22:17:42 +00:00
cognet
0ac58cd215 Use memory clobbers, to be on the safe side.
Suggested by:	jhb
2006-02-06 18:29:05 +00:00
cognet
2d37c104ef Backout rev 1.12. It would have been a good thing, if gcc was smart enough
not to generate bad code.
2006-02-05 22:06:12 +00:00
imp
f2384c93e3 Import support for the Atmel AT91RM9200 CPU/Microcontroller. This SoC
is a ARM920T based CPU with a bunch of built-in peripherals.  The
inital import supports the SPI bus, the TWI bus (although iicbus
integration is not complete), the uarts, the system timer and the
onboard ethernet.  Support for the Kwikbyte KB9202
(http://www.kwikbyte.com) board is also included, although there's no
reason why the 9200 and the 9201 wouldn't also work.  Primitive
support for running under the skyeye emulator is also provided
(although skyeye's support for the AT91RM9200 is a little weak).

The code has been structured so that other members of Atmel's arm family can
be supported in the future.  The AT91SAM9260 is not presently supported
due to lack of hardware.  The arm7tdmi families are also not supported
becasue they lack an MMU.

Many thanks to cognet@ for his help and assistance in bringing up this
board.  He did much of the vm work and wrote parts of the uart and
system timer code as well as the bus space implementation.

The system boots to single user w/o problem, although the serial
console is a little slow and the ethernet driver is still in flux.

This work was sponsored by Timing Solutions, Corporation.  I am
grateful to their support of the FreeBSD project in this manner.
2006-02-04 23:32:13 +00:00
cognet
9e3a001532 Don't forget to set the address of the next descriptor to 0 when we're
zeroing a physical page, or we could end up re-zeroing portions of
memory we have zeroed before, which is clearly not wanted.
2006-02-04 18:01:15 +00:00
cognet
d81c576ce5 MFi386:
revision 1.288
date: 2006/02/04 14:11:33;  author: wsalamon;  state: Exp;  lines: +4 -1
Hook up the audit system to system call entry and exit. System calls will
now be audited.

Obtained from:  TrustedBSD Project
Approved by: rwatson (mentor)
2006-02-04 17:01:19 +00:00
imp
20530f2614 MFp4: Small cleanup of cpu messages at boot. 2006-02-03 06:39:57 +00:00
imp
f5f4fa6dba Merge from p4: minor formatting nits. 2006-02-03 06:27:51 +00:00
cognet
c5069da841 Try harder not to recurse. 2006-01-27 21:07:04 +00:00
cognet
245cc1d801 Donc recompute the io port address if it's already the good one. 2006-01-23 14:03:14 +00:00
cognet
f32398d06c Build a minimal pagetables, with only section mappings, mapped write through,
to speed up the decompression.
2006-01-20 00:46:44 +00:00
imp
c2b2965b6a By popular demand, move __HAVE_ACPI and __PCI_REROUTE_INTERRUPT into
param.h.  Per request, I've placed these just after the
_NO_NAMESPACE_POLLUTION ifndef.  I've not renamed anything yet, but
may since we don't need the __.

Submitted by: bde, jhb, scottl, many others.
2006-01-09 06:05:57 +00:00
jhb
42cfa2cc9e Fix various places that were testing td_critnest to see if interrupts
should remain disabled during a trap or not to check
td_md.md_spinlock_count instead.
2006-01-06 18:02:12 +00:00
imp
8d9b67a0e3 Define __HAVE_ACPI and/or __PCI_REROUTE_INTERRUPT, as appropriate for
each platform.  These will be used in the pci code in preference to
the complicated #ifdefs we have there now.
2006-01-01 20:59:28 +00:00
netchild
507a9b3e93 MI changes:
- provide an interface (macros) to the page coloring part of the VM system,
   this allows to try different coloring algorithms without the need to
   touch every file [1]
 - make the page queue tuning values readable: sysctl vm.stats.pagequeue
 - autotuning of the page coloring values based upon the cache size instead
   of options in the kernel config (disabling of the page coloring as a
   kernel option is still possible)

MD changes:
 - detection of the cache size: only IA32 and AMD64 (untested) contains
   cache size detection code, every other arch just comes with a dummy
   function (this results in the use of default values like it was the
   case without the autotuning of the page coloring)
 - print some more info on Intel CPU's (like we do on AMD and Transmeta
   CPU's)

Note to AMD owners (IA32 and AMD64): please run "sysctl vm.stats.pagequeue"
and report if the cache* values are zero (= bug in the cache detection code)
or not.

Based upon work by:	Chad David <davidc@acns.ab.ca> [1]
Reviewed by:		alc, arch (in 2004)
Discussed with:		alc, Chad David, arch (in 2004)
2005-12-31 14:39:20 +00:00
sobomax
34fa5a81a5 Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structure
with flags bitfield and set BI_CAN_EXEC_DYN flag for all brands that usually
allow executing elf dynamic binaries (aka shared libraries). When it is
requested to execute ET_DYN elf image check if this flag is on after we
know the elf brand allowing execution if so.

PR:		kern/87615
Submitted by:	Marcin Koziej <creep@desk.pl>
2005-12-26 21:23:57 +00:00
jhb
cb0d490ebe Tweak how the MD code calls the fooclock() methods some. Instead of
passing a pointer to an opaque clockframe structure and requiring the
MD code to supply CLKF_FOO() macros to extract needed values out of the
opaque structure, just pass the needed values directly.  In practice this
means passing the pair (usermode, pc) to hardclock() and profclock() and
passing the boolean (usermode) to hardclock_cpu() and hardclock_process().
Other details:
- Axe clockframe and CLKF_FOO() macros on all architectures.  Basically,
  all the archs were taking a trapframe and converting it into a clockframe
  one way or another.  Now they can just extract the PC and usermode values
  directly out of the trapframe and pass it to fooclock().
- Renamed hardclock_process() to hardclock_cpu() as the latter is more
  accurate.
- On Alpha, we now run profclock() at hz (profhz == hz) rather than at
  the slower stathz.
- On Alpha, for the TurboLaser machines that don't have an 8254
  timecounter, call hardclock() directly.  This removes an extra
  conditional check from every clock interrupt on Alpha on the BSP.
  There is probably room for even further pruning here by changing Alpha
  to use the simplified timecounter we use on x86 with the lapic timer
  since we don't get interrupts from the 8254 on Alpha anyway.
- On x86, clkintr() shouldn't ever be called now unless using_lapic_timer
  is false, so add a KASSERT() to that affect and remove a condition
  to slightly optimize the non-lapic case.
- Change prototypeof  arm_handler_execute() so that it's first arg is a
  trapframe pointer rather than a void pointer for clarity.
- Use KCOUNT macro in profclock() to lookup the kernel profiling bucket.

Tested on:	alpha, amd64, arm, i386, ia64, sparc64
Reviewed by:	bde (mostly)
2005-12-22 22:16:09 +00:00
cognet
25ca56da4e Ooops, I removed the wrong bits.
This unbreak boot from a VA which is different from the PA.
2005-12-21 15:02:31 +00:00
cognet
d92d18713f Remove #undef DDB I shouldn't have committed. 2005-12-21 15:01:49 +00:00
cognet
264e5634f3 - Disable the instruction cache very early, until it's time to enable it again.
- Revamp the code that jumps from physical to virtual address.
2005-12-20 01:29:17 +00:00
cognet
b0632238f9 Make the elf trampoline disable the MMU, and link it at physical address,
to avoid bad surprises.
2005-12-20 01:28:17 +00:00
cognet
854ebbd249 - Better use of the busdma API.
- Use spin locks instead of sleep locks.
2005-12-09 23:55:41 +00:00
cognet
3a93af2494 Fix a harmless bug in the way we allocate the early PTEs. 2005-12-09 23:54:50 +00:00
cognet
24415ea106 The IQ80321 clock is 200MHz, but the IQ80321 is 198MHz, so add a kernel option
to override the frequency
2005-12-09 23:52:51 +00:00