summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include/cpufunc.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename disable_intr() to ia64_disable_intr() and rename enable_intr()marcel2010-03-261-4/+5
| | | | | | | | to ia64_enable_intr(). This reduces confusion with intr_disable() and intr_restore(). Have configure_final() call ia64_finalize_intr() instead of enable_intr() in preparation of adding support for binding interrupts to all CPUs.
* Revamp bus_space access functions:marcel2009-12-301-120/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | o Optimize for memory mapped I/O by making all I/O port acceses function calls and marking the test for the IA64_BUS_SPACE_IO tag with __predict_false(). Implement the I/O port access functions in a new file, called bus_machdep.c. o Change the bus_space_handle_t for memory mapped I/O to the virtual address rather than the physical address. This eliminates the PA->VA translation for every I/O access. The handle for I/O port access is still the port number. o Move inb(), outb(), inw(), outw(), inl(), outl(), and their string variants from cpufunc.h and define them in bus.h. On ia64 these are not CPU functions at all. In bus.h they are merely aliases for the new I/O port access functions defined in bus_machdep.h. o Handle the ACPI resource bug in nexus_set_resource(). There we can do it once so that we don't have to worry about it whenever we need to write to an I/O port that is really a memory mapped address. The upshot of this change is that the KBI is better defined and that I/O port access always involves a function call, allowing us to change the actual implementation without breaking the KBI. For memory mapped I/O the virtual address is abstracted, so that we can change the VA->PA mapping in the kernel without causing an KBI breakage. The exception at this time is for bus_space_map() and bus_space_unmap(). MFC after: 1 week.
* Use unordered memory loads and stores for the in* and out*marcel2009-12-261-18/+12
| | | | family of functions.
* Make sure bus space accesses use unorder memory loads and stores.marcel2009-12-031-2/+2
| | | | | | | | | | | | Memory accesses are posted in program order by virtue of the uncacheable memory attribute. Since GCC, by default, adds acquire and release semantics to volatile memory loads and stores, we need to use inline assembly to guarantee it. With inline assembly, we don't need volatile pointers anymore. Itanium does not support semaphore instructions to uncacheable memory.
* Work around a firmware bug in the HP rx2660, where in ACPI an I/O portmarcel2007-06-101-3/+2
| | | | | | | | | | | | is really a memory mapped I/O address. The bug is in the GAS that describes the address and in particular the SpaceId field. The field should not say the address is an I/O port when it clearly is not. With an additional check for the IA64_BUS_SPACE_IO case in the bus access functions, and the fact that I/O ports pretty much not used in general on ia64, make the calculation of the I/O port address a function. This avoids inlining the work-around into every driver, and also helps reduce overall code bloat.
* netchild's mega-patch to isolate compiler dependencies into a centraljoerg2005-03-021-3/+7
| | | | | | | | | | | | | | | | place. This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42. By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course. Submitted by: netchild Reviewed by: various developers on arch@, some time ago
* Fix -O builds with gcc 3.4 by defining ffs as __builtin_ffs instead ofmarcel2004-07-301-6/+1
| | | | creating an inline function that just calls __builtin_ffs.
* In breakpoint(), use a different immediate to make sure we canmarcel2004-03-211-2/+3
| | | | | | | | distinguish between debugger inserted breakpoints and fixed breakpoints. While here, make sure the break instruction never ends up in the last slot of a bundle by forcing it to be an M-unit instruction. This makes it easier for use to skip over it.
* Whitespace nit.des2004-01-131-1/+1
|
* Use gcc's superior ffs() builtin.peter2003-12-101-0/+9
|
* Be more careful how we restore interrupts. Don't rewrite most of themarcel2003-05-241-3/+4
| | | | | | | | | | | | | | | | | | | | PSR only to achieve setting PSR.i back to it's previous value. It makes it impossible to change any of the 30+ other unrelated bits when done between intr_disable() and intr_restore(). That's bad. Instead have intr_disable() return 1 when interrupts were previously enabled and 0 otherwise and only enable interrupts in intr_restore() when given a non-0 value. This change specifically disallows using intr_restore() to disable interrupts. The reason is simple: interrupts only need to be restored after they are being disabled, which means that intr_restore() is called with interrupts disabled and we only need to enable them if they were previously enabled. This change does not fix any bugs, other than that it bugged me... Approved by: re@ (blanket)
* Revamp the newbus functions:marcel2003-04-291-155/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o do not use the in* and out* functions. These functions are used by legacy drivers and thus must have ia32 compatible behaviour. Hence, they need to have fences. Using these functions for newbus would then pessimize performance. o remove the conditional compilation of PIO and/or MEMIO support. It's a PITA without having any significant benefit. We always support them both. Since there are no I/O ports on ia64 (they are simulated by the chipset by translating memory mapped I/O to predefined uncacheable memory regions) the only difference between PIO and MEMIO is in the address calculation. There should be enough ILP that can be exploited here that making these computations compile-time conditional is not worth it. We now also don't use the read* and write* functions. o Add the missing *_8 variants. They were missing, although not missed. It's for completeness. o Do not add the fences that were present in the low-level support functions here. We're using uncacheable memory, which means that accesses are in program order. Change the barrier implementation to not only do a memory fence, but also an acceptance fence. This should more reliably synchronize drivers with the hardware. The memory fence enforces ordering, but does not imply visibility (ie the access does not necessarily have happened). This is what the acceptance deals with. cpufunc.h cleanup: o Remove the low-level memory mapped I/O support functions. They are not used. Keep the low-level I/O port access functions for legacy drivers and add fences to ensure ia32 compatibility. o Remove the syscons specific functions now that we have moved the proper definitions where they belong. o Replace the ia64_port_address() and ia64_memory_address() functions with macros. There's a bigger change inline functions get inlined when there aren't function callsi and the calculations are simply enough to do it with macros. Replace the one reference to ia64_memory address in mp_machdep.c to use the macro.
* Make all memory I/O addresses (explicitly) 64-bit. Memory mappedmarcel2003-01-051-11/+11
| | | | | | devices aren't necessarily mapped within 4GB. I/O port addresses are offsets into the memory mapped I/O port space, which is not larger than 16MB. No need to convert those to 64 bit types.
* Remove mf.a (the acceptance form of the memory fence instruction)marcel2002-10-281-12/+0
| | | | | | | | | | | from all low-level bus space support functions. There's no need to actually force the read/write to be accepted by the platform before we can do anything else. We still have the mf instruction there, which forces ordering. This too is not required given the semantices of the bus space I/O functions, but it's not at all clear to me if there are any poorly written device drivers that depend on the strict ordering by the processor. The motto here is to take small steps...
* o Remove namespace pollution from param.h:marcel2002-05-191-0/+1
| | | | | | | | | | | - Don't include ia64_cpu.h and cpu.h - Guard definitions by _NO_NAMESPACE_POLLUTION - Move definition of KERNBASE to vmparam.h o Move definitions of IA64_RR_{BASE|MASK} to vmparam.h o Move definitions of IA64_PHYS_TO_RR{6|7} to vmparam.h o While here, remove some left-over Alpha references.
* Stage-2 commit of the critical*() code. This re-inlines cpu_critical_enter()dillon2002-04-011-5/+0
| | | | | | | | | | | | | | | | | | | | | and cpu_critical_exit() and moves associated critical prototypes into their own header file, <arch>/<arch>/critical.h, which is only included by the three MI source files that need it. Backout and re-apply improperly comitted syntactical cleanups made to files that were still under active development. Backout improperly comitted program structure changes that moved localized declarations to the top of two procedures. Partially re-apply one of the program structure changes to move 'mask' into an intermediate block rather then in three separate sub-blocks to make the code more readable. Re-integrate bug fixes that Jake made to the sparc64 code. Note: In general, developers should not gratuitously move declarations out of sub-blocks. They are where they are for reasons of structure, grouping, readability, compiler-localizability, and to avoid developer-introduced bugs similar to several found in recent years in the VFS and VM code. Reviewed by: jake
* Compromise for critical*()/cpu_critical*() recommit. Cleanup the interruptdillon2002-03-271-12/+5
| | | | | | | | | | | | | | | | | | | disablement assumptions in kern_fork.c by adding another API call, cpu_critical_fork_exit(). Cleanup the td_savecrit field by moving it from MI to MD. Temporarily move cpu_critical*() from <arch>/include/cpufunc.h to <arch>/<arch>/critical.c (stage-2 will clean this up). Implement interrupt deferral for i386 that allows interrupts to remain enabled inside critical sections. This also fixes an IPI interlock bug, and requires uses of icu_lock to be enclosed in a true interrupt disablement. This is the stage-1 commit. Stage-2 will occur after stage-1 has stabilized, and will move cpu_critical*() into its own header file(s) + other things. This commit may break non-i386 architectures in trivial ways. This should be temporary. Reviewed by: core Approved by: core
* Change critical_t to register_t for intr_disable/restore.dfr2002-03-211-2/+2
|
* Change intr_enable to intr_restore for consistency with sparc64.dfr2002-03-201-2/+2
|
* Recreate intr_disable/intr_enable and implement cpu_critical_enter/exitdfr2002-03-201-2/+14
| | | | in terms of that (for now).
* Fix CRITICAL_FORK so that it compiles.dfr2001-12-231-1/+1
|
* Modify the critical section API as follows:jhb2001-12-181-2/+4
| | | | | | | | | | | | | | | | | | | - The MD functions critical_enter/exit are renamed to start with a cpu_ prefix. - MI wrapper functions critical_enter/exit maintain a per-thread nesting count and a per-thread critical section saved state set when entering a critical section while at nesting level 0 and restored when exiting to nesting level 0. This moves the saved state out of spin mutexes so that interlocking spin mutexes works properly. - Most low-level MD code that used critical_enter/exit now use cpu_critical_enter/exit. MI code such as device drivers and spin mutexes use the MI wrappers. Note that since the MI wrappers store the state in the current thread, they do not have any return values or arguments. - mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is assigned to curthread->td_savecrit during fork_exit(). Tested on: i386, alpha
* o Change ia64_memory_address to explicitly take a u_int64_tmarcel2001-10-061-2/+50
| | | | | | o Add memcpy_fromio, memcpy_io, memcpy_toio, memset_io, memsetw and memsetw_io. I'm not sure this is the right place for it, though.
* Add implementations of readx() and writex().dfr2001-09-221-6/+33
|
* Implement inx() and outx() functions for accessing I/O ports.dfr2001-09-151-6/+38
|
* - Add the new critical_t type used to save state inside of criticaljhb2001-03-281-8/+7
| | | | | | | | | sections. - Add implementations of the critical_enter() and critical_exit() functions and remove restore_intr() and save_intr(). - Remove the somewhat bogus disable_intr() and enable_intr() functions on the alpha as the alpha actually uses a priority level and not simple bit flag on the CPU.
* This is the first snapshot of the FreeBSD/ia64 kernel. This kernel willdfr2000-09-291-0/+197
not work on any real hardware (or fully work on any simulator). Much more needs to happen before this is actually functional but its nice to see the FreeBSD copyright message appear in the ia64 simulator.
OpenPOWER on IntegriCloud