Commit Graph

1366 Commits

Author SHA1 Message Date
jmcneill
eb0e82d870 Add support for blacklisting ACPI BIOS implementations by year. By default,
don't use ACPI on BIOS which advertise release years <= 2000. This
can be changed by setting option ACPI_BLACKLIST_YEAR=0 or by setting
acpi_force_load=1.
2010-09-06 15:54:26 +00:00
jruoho
cff1577a2c Add definitions for Intel Digital Thermal Sensor and Power Management, at
CPUID Fn0000_0006, %eax, %ecx. Use these instead of magic numbers.
2010-08-25 05:07:43 +00:00
jruoho
465d00f837 As all reported P-state failures so far have centered around the status-
check (today it was christos@' laptop), follow Linux and disable this rather
expensive sanity-check for the time being. A hypothesis about the cause of
the failures relates to the absence of cross-CPU coordination in the current
implementation.
2010-08-24 10:29:53 +00:00
jruoho
42a7d04b04 Add native support for AMD family 0Fh processors. This is the furthest we
will go backwards; K7 will not be supported already due doubts about
availability and reliability of ACPI during that era. Some unfortunate code
duplication is present (but not overly much). Thanks to cegger@ and jakllsch@
for patiently testing this.
2010-08-24 07:27:59 +00:00
jruoho
4f4a7a5d46 Other entry points beyond x86_cpu_idle_halt() may use HLT as the
idle-mechanism. Send an IPI also for these in cpu_need_resched().
2010-08-23 16:20:44 +00:00
jakllsch
785fb07d78 Move FWH chip detection area entirely within the mapping for
the smaller i82802AB. This is needed as not all BIOSes set a
larger-than-necessary decode range.
2010-08-23 02:57:19 +00:00
jruoho
89188f9d4a Still DELAY(9) a little even when we do not do the status-check. 2010-08-22 04:42:57 +00:00
jruoho
22b91511fc After discussion with jakllsch@ and jmcneill@, revert the previous and only
do the status-check when the comparison value reported by BIOS is not zero.
The uncertainty noted in the previous commit still applies. But if we ever
see a timeout again, it will likely be either a firmware bug or a special
case like the Intel Turbo Boost.
2010-08-21 18:25:45 +00:00
jmcneill
2055dab9df I guess people still attach com & lpt to isa, so don't skip legacy devices. 2010-08-21 17:27:20 +00:00
jmcneill
7ae909373c If ACPI is active and the FADT reports no legacy devices present, set
the 'no-legacy-devices' property to true on isa0.
2010-08-21 17:10:03 +00:00
jruoho
2f766899a8 When we do the sanity check that a P- or T-state transition was successful,
compare also against the control-field. There appears to be many BIOSes in
the field that report a zero value in the status-field. It is unclear whether
this should be taken as a hint that the status-check is not necessary also
during P-state transitions. If we still see timeouts (EAGAIN), this should
be reverted and the status-check should be bypassed if ps->ps_status is 0.
2010-08-21 15:37:35 +00:00
jruoho
57af947c67 Use an inverse logic when filling the (X)PSS structures -- if we know
the addresses, we trust ourselves more than a random BIOS in the field.
2010-08-21 09:16:28 +00:00
jruoho
7aac1c3ec2 Add a comment. 2010-08-21 07:18:34 +00:00
jruoho
497fed0a50 Check from CPUID 0x06 %eax (on Intel) whether we might actually have an
invariant APIC timer or an "ARAT" ("always running APIC timer"). This means
that the APIC timer may keep ticking at the same rate also in deep C-states
with some new or forthcoming Intel CPUs.
2010-08-21 06:45:50 +00:00
jruoho
503e356fbc Add a quirk for Turbo Boost.
It was observed that at least Sverre Froyen's ThinkPad T500 reports values
that do not match readings from the IA32_PERF_STATUS register. This only
applied to the P0-state. Thus, for now, skip the status check if Turbo
Boost has been detected and the requested state is P0.

This needs to be revisited once Turbo Boost actually works in NetBSD. It is
unclear whether this is a BIOS flaw or not; these values may well be what we
get from IA32_PERF_STATUS once the CPU actually uses the +133.33 MHz boost.
2010-08-21 05:10:43 +00:00
jruoho
4362bda118 Detect Intel's Turbo Boost and presence of IA32_APERF/IA32_MPERF. The former
is required for a quirk, and the latter is needed for hardware P-state
coordination (once acpicpu(4) will support fine-grained coordination).
2010-08-21 04:36:29 +00:00
jruoho
6cf2f2d125 Detect whether TSC is invariant, which may be the case on both new AMD and
Intel processors. The invariance means that TSC runs at a constant rate
during all ACPI state changes. If it is variant, skew may occur and TSC is
generally unsuitable for wall clock services. This is especially relevant
with C-states; with variant TSC, the whole counter may be stopped with states
larger than C1. All x86 CPUs before circa mid-2000s can be assumed to have a
variant time stamp counter.
2010-08-21 03:55:24 +00:00
jruoho
ec113abb1c Add IA32_MPERF (E7h) and IA32_APERF (E8h) as MSR_MPERF and MSR_APERF. 2010-08-21 02:59:18 +00:00
jruoho
26cf8b0518 Properly detect AMD hardware P-state support. Also detect "core boost" (only
present in some models of family 10h).
2010-08-21 02:47:37 +00:00
jruoho
78ed01b2e1 Add CPUID_APM_CPB at Fn8000_0007 %edx, for core performance boost. 2010-08-21 02:31:13 +00:00
jruoho
0499ea91d4 Use a constant from <x86/specialreg.h>. 2010-08-21 01:57:34 +00:00
jruoho
0e8d2e5a05 Check if SpeedStep is enabled. If it is disabled, try to enable it. 2010-08-20 07:00:17 +00:00
jruoho
a448b8a1b9 Revert all previous changes that were made naively believing that the
existing CPU power management implementations could peacefully coexist with
the acpicpu(4) driver. The following options can not be used with acpicpu(4):
ENHANCED_SPEEDSTEP, INTEL_ONDEMAND_CLOCKMOD, POWERNOW_K7, and POWERNOW_K8.
2010-08-20 06:34:32 +00:00
jruoho
8b94ac2ff3 Properly calculate the AMD CPU family. 2010-08-19 21:40:45 +00:00
jruoho
2ea8b86098 Add native P-state support for AMD family 10h and 11h processors. Both are
supported irrespective of XPSS. Family 10h tested by jakllsch@.
2010-08-19 18:30:24 +00:00
jmcneill
77b2a8365a VIA CPUs can have EST as well, so treat them the same as Intel 2010-08-19 11:08:33 +00:00
jruoho
e1be1909e4 Add sysctl-glue for interaction with the acpicpu(4). 2010-08-19 04:12:45 +00:00
jruoho
8116cea3d3 Use the idea from cegger@ and fill the (X)PSS structure during initialization. 2010-08-18 18:32:20 +00:00
jruoho
dd6aeafa08 Check the status of P- and T-state transformations on all CPUs. This is
still not ideal, as ACPI gives us information about "cross logical processor
dependencies". For instance, a single MSR call on one CPU may cause all other
CPUs in the same domain to follow the state shift. Thus, rather than using
xc_broadcast(9), we should xc_unicast(9) on per-domain or per-CPU-set basis.
2010-08-18 16:08:50 +00:00
jruoho
8302489936 Add MD support for the vendor-independent extended PSS. Some conforming AMD
systems are known to work. Alas, not all of them. We still need to deal with
the variety of different PowerNow! revisions.
2010-08-18 04:12:29 +00:00
jakllsch
3e117bf430 Match ichlpcib(4) on ICH0 (82801AB_LPC). 2010-08-17 01:45:51 +00:00
jym
df8a7061db Add machdep.pae sysctl(7) for i386. Thanks to Paul and Joerg for their
reviews.

In kernel, it matches the 'i386_use_pae' variable (0: kernel does not use
PAE, 1: kernel uses PAE). Will be used by i386 kvm(3) to know the functions
that should get called for VA => PA translations.
2010-08-16 19:39:06 +00:00
mrg
78b04d8f54 only attach on SMT ID 0 cpus.
on my i7, cpus 0/4, 1/5, 2/6 and 3/7 have identical information and the
processor manual says that there are only 4 actual sensors.


this still doesn't attach (yet) on that system, due to a core solo/duo
errata being wrongly applied, but i haven't figured out the right way
to do that.
2010-08-15 08:45:20 +00:00
jruoho
1f0e85dcbd Move the PIIX4-quirk to the MD file and disable T-states for PIIX4. 2010-08-14 05:13:20 +00:00
jruoho
3d52b10fd5 Remove some unnecessary locking. Mainly a leftover from previous revisions
where the dynamic maximum/minimum was used also when retrieving the current
state. The state-array itself changes only in C-states.
2010-08-13 18:44:24 +00:00
jruoho
6b9ff1079c Merge T-state a.k.a. throttling support for acpicpu(4).
Remarks:

  1.    Native instructions are supported only on Intel. Native support for
        other x86 vendors will be investigated. By assumption, AMD and others
        use the I/O based approach.

  2.    The existing code, INTEL_ONDEMAND_CLOCKMOD, must be disabled in
        order to use acpicpu(4). Otherwise fatal MSR races may occur.
        Unlike with P-states, no attempt is done to disable the existing
        implementation.

  3.    There is no rationale to export controls to user land.

  4.    Throttling is an artefact from the past. T-states will not be used for
        power management per se. For CPU frequency management, P-states are
        preferred in all circumstances. No noticeable additional power savings
        were observed in various experiments. When the system has been scaled
        to the highest (i.e. lowest power) P-state, it is preferable to move
        from C0 to deeper C-states than it is to actively throttle the CPU.

  5.    But T-states need to be implemented for passive cooling via acpitz(4).
        As specified by ACPI and Intel documents, these can be used as the
        last line of defence against critical thermal conditions. Support
        for this will be added later.
2010-08-13 16:21:50 +00:00
pgoyette
343c435ecf Keep condvar wmesg within 8-char limit. 2010-08-11 11:31:45 +00:00
jruoho
3d0f130a61 Revert the previous changes to EST. The used hack had an obvious flaw:
the acpicpu(4) driver should attach even if the existing frequency management
code fails to attach, mainly because ACPI is the only proper way to deal
with EST on new Intel system.

Use a more drastic hack to deal with this: when acpicpu(4) attachs, it tears
down any existing sysctl(8) controls and installs identical ones in place.
Upon detachment, the initialization function of the existing EST is called.
2010-08-09 15:46:17 +00:00
jruoho
af42249343 Remove a redundant function. 2010-08-09 13:41:38 +00:00
jruoho
c72ee2046d When retrieving the current frequency, scan all available P-states.
Only use the dynamic maximum when setting a frequency.
2010-08-09 04:27:07 +00:00
jruoho
cf677a3b1e Move the sysctl function pointers used by acpicpu(4) to x86/cpu.c.
Rename these so that the same pointers may be used in other parts.
2010-08-09 04:18:48 +00:00
jruoho
53e8f6c919 Merge P-state support for acpicpu(4).
Remarks:

  1.    All processors (x86 or not) for which the vendor has implemented
        ACPI I/O access routines are supported. Native instructions are
        currently supported only for Intel's "Enhanced Speedstep". Code for
        "PowerNow!" (AMD) will be merged later. Native support for VIA's
        "PowerSaver" will be investigated.

  2.    Backwards compatibility with existing userland code is maintained.
        Comparable to the case with cpu_idle(9), the ACPI CPU driver
        installs alternative functions for the existing sysctl(8) controls.
        The "native" behavior (if any) is restored upon detachment.

  3.    The dynamic nature of ACPI-provided P-states needs more investigation.
        The maximum frequency induced (but not forced) by the firmware may
        change dynamically. Currently, the sysctl(8) controls error out with
        a value larger than the dynamic maximum. The code itself does not
        however yet react to the notifications from the firmware by changing
        the frequencies in-place. Presumably the system administrator should
        be able to choose whether to use dynamic or static frequencies.
2010-08-08 16:58:41 +00:00
jym
1c41482e58 Some core i7 CPUs report model 0c. In this case, check for the extended
model value.

Required to avoid faulting on rdmsr(MSR_FSB_FREQ) early during boot.

Will ask for a pull-up. This affects GENERIC, and most likely, install iso
too.

XXX quick hack. Obtaining FSB through ACPI should be cleaner.
2010-08-08 00:48:46 +00:00
jym
fc57975766 Use aprint_debug_dev(). Caught thanks to coccinelle. 2010-08-07 22:31:57 +00:00
jruoho
6e6e026403 Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.
2010-08-07 09:41:19 +00:00
jruoho
ec701f3fe4 Run a xcall(9) to ensure that all CPUs are out from the ACPI idle-loop
before detachment.
2010-08-04 16:16:55 +00:00
jruoho
d8b9e18823 Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.
2010-08-04 10:02:11 +00:00
mlelstv
addf0d4b54 For sensors with inverted value (1/x function), exchange lower and upper
limits so that {warn,crit}min < curval < {warn,crit}max.
2010-08-01 15:42:19 +00:00
mlelstv
e5aae12639 sc_cmd_mtx protects a command sequence, no longer abuse it for delays.
Initialize mutexes and condition variables in attach and not in the
asynchronously started kernel thread.

Increase BMC spin timeout from 5ms to 15ms, this is necessary to detect
the BMC in a HP ML110G4 reliably.

Implement non-linear sensors as defined in IPMIv2.0 with some crude
32.32 fixed point arithmetic. This adds some small errors as logarithm
and power functions are only approximated.

Fix sensor index mapping so that sensor limits are computed correctly.
2010-08-01 08:16:14 +00:00
joerg
7f1183f226 Add support for fenv.h interface for i386 and amd64.
Submitted by Stathis Kamperis as part of GSoC 2010 and ported from
FreeBSD.
2010-07-31 21:47:52 +00:00
jruoho
18bb71aebc Remove the custom enter_s4_with_bios(). Use ACPICA's native
AcpiEnterSleepStateS4bios() instead. Minimum functional change.

ok jmcneill@
2010-07-29 11:40:08 +00:00
cegger
6e8417c157 add RDTSCP_AUX MSR 2010-07-29 08:16:49 +00:00
jruoho
c0c31ce929 Use acpi_eval_set_integer(), KNF. No functional change. 2010-07-28 18:10:31 +00:00
jakllsch
3bf76dbade Allow BUS_SPACE_DEBUG to compile on amd64. 2010-07-27 13:54:19 +00:00
jym
da702eb93d Add PAE to ALL kernel, so that most paddr_t format string errors get caught
during compilation.

While here, fix the compilation for ALL.
2010-07-26 22:33:23 +00:00
jruoho
f534f13d87 Revert the previous partially for the time being. 2010-07-24 21:53:53 +00:00
jruoho
6f76995c42 Move ACPI_FLUSH_CPU_CACHE() (a.k.a. WBINVD on x86) to MD headers where it
belongs to. Let IA-64 define its own function/instruction instead of
requiring a dummy wbinvd() to satisfy the definition in a MI header.
2010-07-24 09:35:36 +00:00
cegger
17310da7fe add AMD OSVW MSRs 2010-07-24 08:02:46 +00:00
jym
d94742232d Welcome PAE inside i386 current.
This patch is inspired by work previously done by Jeremy Morse, ported by me
to -current, merged with the work previously done for port-xen, together with
additionals fixes and improvements.

PAE option is disabled by default in GENERIC (but will be enabled in ALL in
the next few days).

In quick, PAE switches the CPU to a mode where physical addresses become
36 bits (64 GiB). Virtual address space remains at 32 bits (4 GiB). To cope
with the increased size of the physical address, they are manipulated as
64 bits variables by kernel and MMU.

When supported by the CPU, it also allows the use of the NX/XD bit that
provides no-execution right enforcement on a per physical page basis.

Notes:

- reworked locore.S

- introduce cpu_load_pmap(), used to switch pmap for the curcpu. Due to the
different handling of pmap mappings with PAE vs !PAE, Xen vs native, details
are hidden within this function. This helps calling it from assembly,
as some features, like BIOS calls, switch to pmap_kernel before mapping
trampoline code in low memory.

- some changes in bioscall and kvm86_call, to reflect the above.

- the L3 is "pinned" per-CPU, and is only manipulated by a
reduced set of functions within pmap. To track the L3, I added two
elements to struct cpu_info, namely ci_l3_pdirpa (PA of the L3), and
ci_l3_pdir (the L3 VA). Rest of the code considers that it runs "just
like" a normal i386, except that the L2 is 4 pages long (PTP_LEVELS is
still 2).

- similar to the ci_pae_l3_pdir{,pa} variables, amd64's xen_current_user_pgd
becomes an element of cpu_info (slowly paving the way for MP world).

- bootinfo_source struct declaration is modified, to cope with paddr_t size
change with PAE (it is not correct to assume that bs_addr is a paddr_t when
compiled with PAE - it should remain 32 bits). bs_addrs is now a
void * array (in bootloader's code under i386/stand/, the bs_addrs
is a physaddr_t, which is an unsigned long).

- fixes in multiboot code (same reason as bootinfo): paddr_t size
change. I used Elf32_* types, use RELOC() where necessary, and move the
memcpy() functions out of the if/else if (I do not expect sym and str tables
to overlap with ELF).

- 64 bits atomic functions for pmap

- all pmap_pdirpa access are now done through the pmap_pdirpa macro. It
hides the L3/L2 stuff from PAE, as well as the pm_pdirpa change in
struct pmap (it now becomes a PDP_SIZE array, with or without PAE).

- manipulation of recursive mappings ( PDIR_SLOT_{,A}PTEs ) is done via
loops on PDP_SIZE.

See also http://mail-index.netbsd.org/port-i386/2010/07/17/msg002062.html

No objection raised on port-i386@ and port-xen@R for about a week.

XXX kvm(3) will be fixed in another patch to properly handle both PAE and !PAE
kernel dumps (VA => PA macros are slightly different, and need proper 64 bits
PA support in kvm_i386).

XXX Mixing PAE and !PAE modules may lead to unwanted/unexpected results. This
cannot be solved easily, and needs lots of thinking before being declared
safe (paddr_t/bus_addr_t size handling, PD/PT macros abstractions).
2010-07-24 00:45:54 +00:00
cegger
84847a78fe use __arraycount 2010-07-23 22:31:35 +00:00
jruoho
4127064077 Make sure we use MWAIT with MONITOR.
Also clarify when we have interrupts disabled.
2010-07-23 13:54:21 +00:00
jakllsch
1bccaf8fad Finish cleaning up pchb from recent change.
Use fewer magic numbers in ichlpcib.
Slightly improve style conformance.
Update paths in cpp re-inclusion guards.
2010-07-23 02:23:58 +00:00
jakllsch
897b6b7d94 Almost entirely rework Intel Firmware Hub random number generator support.
This introduces fwhrng(4) which attaches via ichlpcib(4), replacing
the rnd(4) support in pchb(4).
2010-07-23 00:43:20 +00:00
jruoho
9fcb11c8f6 Add missing CVS identifiers. 2010-07-18 09:39:45 +00:00
jruoho
4d861e5bb4 Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).

Remarks:

  1.	Commented out in the GENERICs; more testing exposure is needed.

  2.	The C3-state is disabled for the time being because it turns off
	timers, among them the local APIC timer. This may not be universally
	true on all x86 processors; define ACPICPU_ENABLE_C3 to test.

  3.	The algorithm used to choose a power state may need tuning. When
	evaluating the appropriate state, the implementation uses the
	previous sleep time as an indicator. Additional hints would include
	for example the system load.

	Also bus master activity is evaluated when choosing a state. The
	usb(4) stack is notorious for such activity even when unused.
	Typically it must be disabled in order to reach the C3-state,
	but it may also prevent the use of C2.

  4.	While no extensive empirical measurements have been carried out, the
	power savings are somewhere between 1-2 W with C1 and C2, depending
	on the processor, firmware, and load. With C3 even up to 4 W can be
	saved.  The less something ticks, the more power is saved.

ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 09:29:11 +00:00
pgoyette
05644d3782 Register ipmi(4) with power management subsystem so we might have a chance
of suspending.  Suspending will still be denied if the watchdog is active.

As discussed on tech-kern@

XXX The pmf handlers for this and all other watchdogs should be factored
XXX out into a common handler for a generic wdog(4) pseudo-device, but
XXX that's left for the future.
2010-07-17 21:34:39 +00:00
jym
dd8a27c182 Check the virtual address 'va' for each PDIR_SLOT_PTE entry. PDP_SIZE
is 4 with PAE (Xen only currently), 1 otherwise: loop should be unrolled
when PDP_SIZE is 1.

pmap_alloc_level() is used by pmap_growkernel(), the PDE is a kernel
mapping: mark it so with PG_k. While here, use pmap_pa2pte() for physical
address 'pa'.

No functional change.
2010-07-15 21:14:31 +00:00
jym
7d13a50ab2 Make the comment about PDPpaddr more thorough. 2010-07-15 19:02:26 +00:00
rmind
7c940b718e Unify i386 and amd64 procfs MD code into x86. 2010-07-08 11:24:59 +00:00
rmind
9a7d390830 cpu_attach: use kmem_zalloc instead of memset. 2010-07-08 11:22:24 +00:00
cegger
57e387d4d7 use __arraycount 2010-07-08 09:42:08 +00:00
chs
33fa5ccbbf many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
 - support new-style (NPTL) linux pthreads on all platforms.
   clone() with CLONE_THREAD uses 1 process with many LWPs
   instead of separate processes.
 - move the contents of sys__lwp_setprivate() into a new
   lwp_setprivate() and use that everywhere.
 - update linux_release[] and linux32_release[] to "2.6.18".
 - adjust placement of emul fork/exec/exit hooks as needed
   and adjust other emul code to match.
 - convert all struct emul definitions to use named initializers.
 - change the pid allocator to allow multiple pids to refer to the same proc.
 - remove a few fields from struct proc that are no longer needed.
 - disable the non-functional "vdso" code in linux32/amd64,
   glibc works fine without it.
 - fix a race in the futex code where we could miss a wakeup after
   a requeue operation.
 - redo futex locking to be a little more efficient.
2010-07-07 01:30:32 +00:00
chs
8b4d79c278 implement cpu_lwp_setprivate() on several platforms. 2010-07-07 01:20:49 +00:00
chs
ffa744f452 add the guts of TLS support on amd64. based on joerg's patch,
reworked by me to support 32-bit processes as well.
we now keep %fs and %gs loaded with the user values
while in the kernel, which means we don't need to
reload them when returning to user mode.
2010-07-07 01:14:52 +00:00
njoly
3bb7b36948 Install x86/pte.h 2010-07-07 00:10:14 +00:00
cegger
a63798ea7c Turn PMAP_NOCACHE into MI flag.
Add MI flags PMAP_WRITE_COMBINE, PMAP_WRITE_BACK, PMAP_NOCACHE_OVR.
Update pmap(9) manpage.

hppa: Remove MD PMAP_NOCACHE flag as it exists as MI flag
mips: Rename MD PMAP_NOCACHE to PGC_NOCACHE.

x86: Implement new MI flags using Page-Attribute Tables.
x86: Implement BUS_SPACE_MAP_PREFETCHABLE.

Patch presented on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2010/06/30/msg008458.html

No comments on this last version.
2010-07-06 20:50:33 +00:00
rmind
d96d372bb4 Add missing pmap_update() in vga_post_init(), remove wrong pmap_kremove()
in error path, and fix pmap_update() in vga_post_set_vbe().
2010-06-28 00:39:47 +00:00
rmind
1840edb963 Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight.  Will be used for passive serialization.

OK ad@.
2010-06-22 18:29:01 +00:00
mrg
3cca660ebe attach just one of the cpu timer interrupts as EVCNT_TYPE_INTR, so that at
least something shows up in systat and beyond.  myself, and a few others,
have been confused at the lack of any timer interrupts appearing here.
2010-06-17 06:40:28 +00:00
mrg
bf0e9a40ae when complaining we don't support this many MTRR's, say how many there are. 2010-06-17 06:38:19 +00:00
riz
42943652d9 Add AGP support for a number of Intel onboard devices, including
82G41, 82B43, E7221, 82965GME, and "Iron Lake".  Device
types (i915, i965, G33, and G4X variants) from the Linux Intel AGP
driver, and (for 82G41) from Henry Bent in PR#42906.

There are a few more varieties that should be relatively low-hanging
fruit ("Pineview" and "Sandy Bridge"), but will require a little bit
of rejiggering of the "chiptype".

OK mrg@
2010-06-16 03:35:01 +00:00
joerg
06c85aad23 Restore PHYSMEM_MAX* options (hi cegger!) 2010-06-02 09:43:12 +00:00
rmind
efa9ba911f Rename ci_node_id to ci_package_id, as some claim that the former might
be confused with NUMA node.
2010-05-29 05:53:57 +00:00
christos
245822f743 simplify the debugging code and make it more informative. 2010-05-23 22:06:38 +00:00
christos
a39b0c6ef3 Add entry for:
Intel(R) Core(TM)2 Duo CPU     P9500  @ 2.53GHz
2010-05-23 19:00:28 +00:00
phx
76c67ee1e2 gcscpcib depends on functions from x86/pci/pcib.c 2010-05-14 18:11:25 +00:00
dyoung
19265b4bb9 Provide pmap_enter_ma(), pmap_extract_ma(), pmap_kenter_ma() in all x86
kernels, and use them in the bus_space(9) implementation instead of ugly
Xen #ifdef-age.  In a non-Xen kernel, the _ma() functions either call or
alias the equivalent _pa() functions.

Reviewed on port-xen@netbsd.org and port-i386@netbsd.org.  Passes
rmind@'s and bouyer@'s inspection.  Tested on i386 and on Xen DOMU /
DOM0.
2010-05-10 18:46:58 +00:00
rmind
da7cf0ef2f Drop x86 MD package/core/smt IDs and use MI. 2010-05-09 20:32:41 +00:00
jym
d66ce3b289 Enable the NX bit feature for Xen i386pae and amd64 kernels.
Tested with Xen 3.1 and Xen 3.3, dom0 and domU, by bouyer@ and jym@.

Ok bouyer@.
2010-05-04 23:27:13 +00:00
plunky
b8a6a61f01 The spl inline functions refer to external symbols that are only
defined in the kernel.

Wrap kernel-specific declarations in #ifdef _KERNEL to avoid unresolved
references when including from userland.
2010-05-02 18:03:31 +00:00
dyoung
327fd4b29c Add an exponential back-off to the loop that tries to lock the
PCI configuration-access registers, to avoid excessive cacheline
ping-ponging.  Thanks to rmind@ for the tip.
2010-04-30 21:05:27 +00:00
dyoung
7ce5c4de22 Provide an x86 implementation of pci_chipset_tag_create(9) and
pci_chipset_tag_destroy(9).
2010-04-28 21:27:14 +00:00
dyoung
92e85e37ae #include <sys/bus.h> instead of <machine/bus.h> here to get all of the
MI prototypes.
2010-04-28 20:27:36 +00:00
dyoung
30b2d68d20 On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag.  For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM.  In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem.  Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.
2010-04-28 19:17:03 +00:00
dyoung
84db22a2e0 Make pci_conf_read(9) and pci_conf_write(9) re-entrant so that the
kernel can use them in an NMI trap handler.  Only one CPU can be
in _read() or _write() at once.  However, on any single CPU, more
than one thread of execution (LWP, interrupt handler, trap handler)
may be in _read() or _write() at once, because each thread saves
and restores the PCI configuration-access state.
2010-04-27 23:33:14 +00:00
jruoho
d5124a1812 Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.
2010-04-27 05:34:14 +00:00
ad
b78c6a36cf Nothing uses x86_multicast_ipi() right now and it complicates many
CPU support, so remove it.
2010-04-25 16:10:51 +00:00
joerg
f5b7f56dbd Use struct segment_descriptor for pcb_fsd and pcb_gsd instead of int[2]. 2010-04-23 16:07:33 +00:00
jym
871c771cc1 Uses cpu_feature, so include <machine/cpuvar.h> 2010-04-22 21:47:32 +00:00
jym
bc0420413d This patch fixes the NX regression issue observed on amd64 kernels, where
per-page execution right was disabled (therefore leading to the inability
of the kernel to detect fraudulent use of memory mappings marked as not
being executable).

- replace cpu_feature and ci_feature_flags variables by cpu_feature and
ci_feat_val arrays. This makes it cleaner and brings kernel code closer
to the design of cpuctl(8). A warning will be raised for each CPU that
does not expose the same features as the Boot Processor (BP).

- the blacklist of CPU features is now a macro defined in the
specialreg.h header, instead of hardcoding it inside MD initialization
code; fix comments.

- replace checks against CPUID_TSC with the cpu_hascounter() function.

- clean up the code in init_x86_64(), as cpu_feature variables are set
inside cpu_probe().

- use cpu_init_msrs() for i386. It will be eventually used later for NX
feature under i386 PAE kernels.

- remove code that checks for CPUID_NOX in amd64 mptramp.S, this is already
performed by cpu_hatch() through cpu_init_msrs().

- remove cpu_signature and feature_flags members from struct mpbios_proc
(they were never used).

This patch was tested with i386 MONOLITHIC, XEN3PAE_DOM0 and XEN3_DOM0 under
a native i386 host, and amd64 GENERIC, XEN3_DOM0 via QEMU virtual machines.

XXX Should kernel rev be bumped?

XXX A similar patch should be pulled-up for NetBSD-5, hopefully tomorrow.
2010-04-18 23:47:50 +00:00
jym
f0fb5193e0 Fix a test semantic in cpu_probe(): check that the CPU currently probed
is the first one booting by comparing its struct cpu_info address with
cpu_info_primary, rather than supposing that cpu_feature variables are
set to 0.
2010-04-18 15:25:53 +00:00
jruoho
75373338c1 UINT32 -> uint32_t; UINT8 -> uint8_t. 2010-04-14 19:32:35 +00:00
jruoho
56bdff1846 Use CTLTYPE_BOOL. 2010-04-11 09:52:09 +00:00
pgoyette
0321f1cd9a Save initial, boot-time limit values, and restore them upon request
from sysmon_envsys(9).
2010-04-10 19:02:39 +00:00
jruoho
230c5ee4c7 ACPICA 20091112:
Implemented a post-order callback to AcpiWalkNamespace. The existing
        interface only has a pre-order callback. This change adds an
        additional parameter for a post-order callback which will be more
        useful for bus scans.  ACPICA BZ 779. Lin Ming. Updated the ACPICA
        Programmer Reference.

We will use the old "pre-order callback" for the time being.
2010-04-08 04:40:51 +00:00
jym
c4d1a64e49 Fix the comments about cpuid flags, according cpuid documentation by
Intel and AMD.
2010-04-03 23:17:05 +00:00
ad
7a8df643c4 KNF FTW 2010-03-31 19:07:32 +00:00
dyoung
62b209d568 A lot of good it does to printf() a bus_space_tag_t. Don't do it. 2010-03-22 23:21:29 +00:00
bouyer
5b2d9a3c1c bus_dmamem_alloc() may not get a boundary smaller than size, but
it's perfectly valid for bus_dmamap_create() to do so (a contigous
transfers will then split in multiple segment).
Fix _xen_bus_dmamem_alloc_range() and _bus_dmamem_alloc_range() to
allow a boundary limit smaller than size:
- compute appropriate boundary for uvm_pglistalloc(), wich doesn't
  accept boundary < size
- also take care of boundary when deciding to start a new segment.
While there, remove useless boundary argument to _xen_alloc_contig().
Fix the boundary-related issue of PR port-amd64/42980
2010-03-22 22:03:30 +00:00
dyoung
061b0589a4 Add a prototype for pci_mmio_range_infer() that will infer the
range of memory forwarded by the host chipset to PCI.
2010-03-20 00:02:59 +00:00
dyoung
090e16c442 Add a new member, pc_super, to x86's pci_chipset_tag: pc.pc_super points
to the tag that pc inherits its behavior from.  Add code to deal with
pc.pc_super.

Pull identical declarations out of xen/include/pci_machdep.h and
x86/include/pci_machdep.h into x86/include/pci_machdep_common.h.
2010-03-14 20:19:06 +00:00
pgoyette
d8b50b486b Remove setting of the edata->monitor since that member no longer exists. 2010-03-14 18:04:29 +00:00
jruoho
0f58ad7ae9 Use native functions instead of polluting the namespace with ACPICA-macros. 2010-02-28 13:56:49 +00:00
jym
42e5342a52 Fixes regarding paddr_t/pd_entry_t types in MD x86 code, exposed by PAE:
- NBPD_* macros are set to the types that better match their architecture
(UL for i386 and amd64, ULL for i386 PAE) - will revisit when paddr_t is
set to 64 bits for i386 non-PAE.

- type fixes in printf/printk messages (Use PRIxPADDR when printing paddr_t
values, instead of %lx - paddr_t/pd_entry_t being 64 bits with PAE)

- remove casts that are no more needed now that Xen2 support has been dropped

Some fixes are from jmorse@ patches for PAE.

Compile + tested for i386 GENERIC and XEN3 kernels. Only compile tested for
amd64.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html
2010-02-26 19:25:07 +00:00
dyoung
8687bf03ba In the x86 pci(9) implementation, test for and call a
pci_chipset_tag_t's override functions.
2010-02-25 20:51:10 +00:00
dyoung
6bbebe48f4 Change the pci_attach_args definition to allow machine-dependent
code to override the default pci(9) behavior by creating a non-NULL
pci_attach_args_t (on x86, pci_attach_args_t is always NULL) containing
one or more non-NULL function pointers.
2010-02-25 20:48:34 +00:00
dyoung
c1b390d493 A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
2010-02-24 22:37:54 +00:00
dyoung
7e2170d1cd KNF: change spaces to tabs. 2010-02-24 21:34:23 +00:00
dyoung
71e3c83259 Don't bother to #define PCI_PREFER_IOSPACE, nothing uses it. 2010-02-24 21:25:51 +00:00
dyoung
440f38e104 Change 'typedef void *pci_chipset_tag_t' to 'typedef struct
pci_chipset_tag *pci_chipset_tag_t' for an improvement in type safety.
(Back when I did the same for cardbus_chipset_tag_t, it helped to turn
up some bugs!)
2010-02-24 21:24:20 +00:00
dyoung
e43ae59b99 Rename to 'pc' all variables 'pci_chipset_tag'. 2010-02-24 21:22:01 +00:00
dyoung
a60f2abe1f PCI Configuration Mechanisms #1 and #2 are controlled by two to
three registers.  Let us think of the kernel operating the registers
in two steps:

1) Select: enable configuration cycles and select a range of
   configuration-space addresses.

2) Access: read or write a word in PCI configuration space.

To make the steps more explicit, extract some helper subroutines
from pci_conf_read(9) and pci_conf_write(9):

pci_conf_selector(tag, reg): from a pcitag_t and a register offset,
    create a word that enables configuration cycles and selects a
    configuration address range.

pci_conf_select(w): for `w' a word created by pci_conf_selector(),
    enable configuration cycles and select the address range indicated
    by `w'.

pci_conf_select(0): disable configuration cycles.

pci_conf_port(tag, reg): map a pcitag_t and a register offset to an I/O
    port where the configuration access should occur.

While I'm in here, change the panic(9) calls to panic("%s: ...",
__func__) instead of hard-coding a subroutine name.
2010-02-16 19:29:40 +00:00
jym
6d2adb482c - re-factor code in pmap_map_ptes() slightly, and make it PAE-ready for
native i386 by using PDP_SIZE

- introduce pmap_unmap_apdp(), used to clear the APDP entries in PD, and
replace the relevant code parts with this function.

Comes from Jeremy Morse's patch for i386 PAE support. Adjustments by me.
2010-02-16 00:48:17 +00:00
dyoung
07a5af08b1 Get rid of all PCI_CONF_MODE #ifdef'age except for the little bit
that initializes pci_mode, which I have moved to the top.

Make pci_mode private to pci_machdep.c.

Provide pci_mode_set() for pcibios.c to configure the PCI Configuration
Mechanism.  KASSERT() in pci_mode_set() that the mechanism is not
changing from anything but the "don't know" value, -1.
2010-02-16 00:03:47 +00:00
pgoyette
6ac583dc32 Adapt to changes in sysmon's limit structure. 2010-02-14 23:07:59 +00:00
jym
499833724f Starting with Xen 3 API, MMU_EXTENDED_COMMAND (tlb flush, cache flush, page
pinning/unpinning, set_ldt, invlpg) operations cannot be queued in the
xpq_queue[] any more, as they use their own specific hypercall, mmuext_op().

Their associated xpq_queue_*() functions already call xpq_flush_queue()
before issuing the mmuext_op() hypercall, which makes these xpq_flush_queue()
calls not necessary.

Rapidly discussed with bouyer@ in private mail. XEN3_DOM0/XEN3PAE_DOM0 tested
through a build.sh release, amd64 was only compile tested. No regression
expected.
2010-02-12 01:55:45 +00:00
jym
68ab1c6897 To properly account for the total number of pages allocated for PDP, use
PDP_SIZE, as PAE (i386) requires 4 pages instead of 1.
2010-02-10 00:39:30 +00:00
jym
7a73ba3497 Wrap a comment; add a space after a comma to another (align with next line) 2010-02-09 23:52:13 +00:00
jym
25df75469b Use roundup2() instead of hardcoding the operation. 2010-02-09 23:47:10 +00:00
jym
753d396585 Fix typos in comments. 2010-02-09 22:51:13 +00:00
mlelstv
9c35c3d3a7 Release buffer in case a receive failed. 2010-01-31 11:39:55 +00:00
hubertf
af120bb199 Replace more printfs with aprint_normal / aprint_verbose
Makes "boot -z" go mostly silent for me.
2010-01-31 00:43:37 +00:00
rmind
b6c2588582 x86_cpu_topology, not toplogy. 2010-01-18 16:40:17 +00:00
njoly
56cdb3bbf3 Use __arraycount instead of locally defined macro. 2010-01-13 15:31:47 +00:00
cegger
abd4f4b435 recognize SVM PauseFilter 2010-01-13 12:54:49 +00:00
jym
fefe0aff38 Simplify pmap_init_tmp_pgtbl() a bit.
The first level of the temporary page mappings are also done in the first
iteration of the loop below, so no need to do it before.

ok by joerg@ in private mail.
2010-01-10 12:10:23 +00:00
cegger
8ab319847f TOPLIMIT for i386 PAE is 64GB. 2010-01-09 22:54:00 +00:00
cegger
06f2c03231 add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.
2010-01-09 20:56:17 +00:00
cegger
07e7c0c3fa add LAPIC_MSR_ENABLE_x2 MSR. from murray@river-styx via port-amd64@
'...as documented in the Intel 64 and IA32 Architectures Software
   Developers Manual 3A, chapter 10.5.1.'
2010-01-09 20:50:11 +00:00
dyoung
3022acc4eb Expand PMF_FN_* macros. 2010-01-08 19:42:11 +00:00
dyoung
e94f23b742 Move all copies of ifattr_match() to sys/kern/subr_autoconf.c. 2010-01-08 00:09:44 +00:00
jruoho
50af5a5ff5 Put back the evaluation of the return value from mpacpi_get_bbn().
Break reported by njoly@. Thanks!
2010-01-05 17:23:18 +00:00
jruoho
5bb528f36b Use acpi_eval_set_integer() to simplify code. No functional change intended.
ok pgoyette@, jmcneill@
2010-01-05 13:57:18 +00:00
jruoho
6538aaf890 Fix several possible memory leaks in mpacpi_derive_bus().
ok pgoyette@, jmcneill@
2010-01-05 13:32:49 +00:00
mbalmer
2603a89351 One semicolon only (;; -> ;) 2010-01-05 13:20:29 +00:00
sborrill
e52d21a22a Interim workaround for modern Xeons that don't have the simplistic view of
bus speed and therefore do not support MSR_FSB_FREQ (e.g. X3400). In the
long-term, ACPI should be used for this (c.f. FreeBSD).
2009-12-03 14:47:15 +00:00
sborrill
b25ce49b1e CPU model and CPU extended model cannot simply be summed; the extended model
differentiates different CPUs within a given model type (i.e. model 0xe with
extended model 0x1 is NOT the same as a model 0xf).
Modern Xeons do not support MSR_IA32_EXT_CONFIG, so use model and extended
model correctly to avoid it
2009-12-03 14:44:12 +00:00
rmind
ce313d4fb1 Replace l_addr with uvm_lwp_getuarea() in various MD code, mostly cpu_lwp_fork(). 2009-11-29 04:15:42 +00:00
tron
8fe9393167 Fix build of kernels without PCI support like "GENERIC_TINY". 2009-11-25 19:46:19 +00:00
njoly
a323bb797a aprintify. 2009-11-25 15:06:26 +00:00
rmind
9303fb5a00 Remove IPL_LPT and IPL_IPI aliases, use the actual IPLs.
Fix some broken comments.
2009-11-25 14:28:49 +00:00
rmind
fc756ae2f7 Disable kstack red-zone for now, while we decide on a nice way to fix it. 2009-11-25 13:38:38 +00:00
bouyer
e0e426bb85 For amd64, introduce a third free list distinct from the default free list
for memory between 16M and 4G. On large memory machine, this avoids
the 32bit-accessible memory being eaten by various kernel early allocation,
causing 32bit bus_dma(9) memory allocation to fail at boot time.
Tested on a system with 48GB RAM; based on netbsd-5 patch proposed on
port-amd64 3 days ago.
2009-11-22 21:41:03 +00:00
rmind
3c2bd91e81 Use lwp_getpcb() on x86 MD code, clean from struct user usage. 2009-11-21 03:11:00 +00:00
cegger
e72026cf1f update comment: we use PMAP_NOCACHE for both pmap_enter and pmap_kenter_pa 2009-11-11 17:08:16 +00:00
yamt
be3e4126f3 x86_get_sdbase: copyout to a correct address. 2009-11-11 13:38:53 +00:00
cegger
962afef088 Implement pmap_kenter_pa(9) new flag argument in x86.
Make x86 bus_space(9) using it to eliminate an extra TLB flush.
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
Thanks to Martin Husemann for spotting copy&pasto errors in the original patch version.
2009-11-07 07:32:53 +00:00
cegger
9480c51b04 Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
2009-11-07 07:27:40 +00:00
dyoung
a43418e649 Use deviter(9) instead of accessing alldevs directly. 2009-11-06 23:10:22 +00:00
dsl
f73c380ff9 Don't call _bus_dmamem_free() when _bus_dmamem_alloc() fails.
Fixes PR/42208
2009-11-06 23:10:10 +00:00
toshii
c8d10319f7 Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.
2009-11-04 14:39:17 +00:00
dyoung
c64f34a1e5 Gracelessly bracket #include "opt_spldebug.h" with #ifdef i386.
Should fix the amd64 kernel-build failure that Andreas Wrede
reported.
2009-11-03 20:11:53 +00:00
dyoung
e48f8429d1 Add a kernel configuration flag, SPLDEBUG, that activates a per-CPU log
of transitions to IPL_HIGH from lower IPLs.  SPLDEBUG is only available
on i386 and Xen kernels, today.

'options SPLDEBUG' adds instrumentation to spllower() and splraise() as
well as routines to start/stop debugging and to record IPL transitions:
spldebug_start(), spldebug_stop(), spldebug_raise(), spldebug_lower().
2009-11-03 05:23:27 +00:00
snj
0676449036 Drop 3rd and 4th clauses, as the copyright holder (Michael Shalayeff) did
in OpenBSD revision 1.39.
2009-11-03 01:23:21 +00:00
snj
be288643d0 Drop 3rd and 4th clauses, as the copyright holder (Michael Shalayeff) did
in OpenBSD revision 1.2.
2009-11-03 01:19:35 +00:00
yamt
413e239f0d fix a typo in a comment. 2009-10-29 09:50:49 +00:00
rmind
8a919a04df cpu_proc_fork: use pcb1 and pcb2, and thus make routine more readable.
Remove or update outdated comments, add new ones.  Clean-up.
2009-10-27 03:48:59 +00:00
cegger
62cf489d8e kill extra whitespaces
reviewed by tsutsui@
2009-10-26 19:16:54 +00:00
rmind
10758cb0f9 Simplify pmap_remove() a little by avoiding pmap_do_remove() layer, since
possibility to skip wired mappings is not needed anymore.  Apart from that,
no functional differences are intended.
2009-10-22 19:50:55 +00:00
rmind
40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
bouyer
6d07b400dc Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
2009-10-19 18:41:07 +00:00
cegger
f94b517224 Family 10h Errata #319: Attach on Family10h cpu series which have it fixed. 2009-10-16 12:05:19 +00:00
elad
2cb56be586 Add a (weak aliased) machdep_init() as a place to do machdep initialization
that can't happen as early as the other init functions as called from
cpu_startup() -- for example, register kauth(9) listeners.

Put unprivileged policy in the x86 code; used by i386, amd64, and xen.
2009-10-06 21:07:05 +00:00
rmind
b619d660f4 Remove X86_IPI_WRITE_MSR (and msr_ipifuncs.c), replace all uses in drivers
with xc_broadcast().  AMD K8 PowerNow driver tested by <jakllsch>, thanks!

Closes PR/37665.
2009-10-05 23:59:30 +00:00
jmcneill
574c128daa Add support for VIA C7 temperature sensors (options VIA_C7TEMP) 2009-10-02 18:50:03 +00:00
jmcneill
f986f9682c Use the TSC and current multiplier to calculate bus clock on VIA C7 Esther.
Probably needed for all C7 and Nano processors, but to be safe only use
this alternate method on Esther for now.

Now est on my C7-M 1.6GHz properly reports frequencies from 1600 to 400,
instead of 2133 to 533.
2009-10-02 15:05:42 +00:00
jakllsch
ff243da79f Make this build without gpio(4). 2009-09-27 18:27:01 +00:00
jakllsch
bd5cb77445 gpio(4) support for Intel ICH southbridges.
Tested on Intel SS4200-E (ICH7), and Acorp 6A815EPD (ICH2) motherboards,
on amd64 and i386 ports respectively.

It should be noted that the majority of boards with ICH chips do not
expose the GPIO pins for off-board use.  For instance, aside from the
three exposed-on-a-header pins on the 6A815EPD, another pin is also
used to control write protect on the FWH.  The SS4200 exposes the GPIO
on a header that connects to the 10 LEDs on the front panel, as well
as a tact switch on the back panel.
2009-09-27 17:55:31 +00:00
macallan
b81d1cca71 set is_console even if we don't have any fb_info so other console drivers
than genfb have a chance of working.
Tested with radeonfb which works fine with an RV280
TODO: figure out how to deal with more than one PCI_CLASS_DISPLAY device in
      a halfway sane manner
2009-09-21 13:23:43 +00:00
mlelstv
23ab96a36b Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.
2009-09-16 10:47:54 +00:00
jmcneill
41b863f675 Fix a bug where mapping the very end of iomem accidentally returns an
address in the ISA hole (because addr+size calculations wrap to 0). Fixes
ohci on VirtualPC 7 for Mac, which places OHCI at base address 0xfffff000
size 0x1000.
2009-09-03 23:25:04 +00:00
joerg
292e598a25 Be a bit more noisy by telling the user VGA_POST is missing in the
kernel config when trying machdep.acpi_vbios_reset=2.
2009-09-02 15:42:31 +00:00
joerg
12cda29892 Don't allow machdep.acpi_vbios_reset=2 if option VGA_POST is missing. 2009-09-02 15:25:07 +00:00
jmcneill
0688029724 Don't reference genfb unless NGENFB > 0 2009-08-24 23:48:57 +00:00
jmcneill
31ca9984a5 PR# port-i386/41929: genfb and machdep.acpi_vbios_reset=2 interaction
When acpi_vbios_reset=2, invoke vga_post_call followed by vga_post_set_mode
in the genfb pmf resume handler.
2009-08-24 11:35:27 +00:00
jmcneill
8984ef0dcd Add vga_post_set_vbe for setting video mode. 2009-08-24 11:33:49 +00:00
jmcneill
f98f243e5f Paranoia; restore the genfb colour map on resume. 2009-08-24 11:04:29 +00:00
jmcneill
b585cf85b2 Pass the VBE mode number from the bootloader to the kernel, and then
make the ACPI wakecode aware of it. Restore the desired VBE mode on resume
when acpi_vbios_reset=1, so suspend/resume with genfb console will work.
2009-08-24 02:15:46 +00:00
ahoka
8e541eb4b2 Typo fix: Mhz -> MHz
No functional change intended.
2009-08-23 16:02:50 +00:00
jmcneill
05d8709153 Save a line of dmesg by printing the vendor/product info on the same line
as the locators.
2009-08-23 15:42:51 +00:00
jmcneill
39752cfc4d Save a line of dmesg by printing the vendor/product info on the same line
as the locators.
2009-08-23 15:37:51 +00:00
dyoung
a1ac1a18e2 isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t. 2009-08-19 15:04:27 +00:00
dyoung
5a395386a7 Let us detach ichlpcib(4) and its children.
XXX More testing is needed.  I've tested this on a Dell Dimension 3000,
XXX but that system does not attach every possible device that I try to
XXX detach with this code:

ichlpcib0 at pci0 dev 31 function 0
ichlpcib0: vendor 0x8086 product 0x24d0 (rev. 0x02)
timecounter: Timecounter "ichlpcib0" frequency 3579545 Hz quality 1000
ichlpcib0: 24-bit timer
ichlpcib0: TCO (watchdog) timer configured.
isa0 at ichlpcib0
2009-08-18 17:47:46 +00:00
dyoung
9b779d6eb6 Allow detachment and re-attachment of an ISA bus at an PCI-ISA bus
bridge, isa0 at pcib0.
2009-08-18 17:15:10 +00:00
dyoung
47b66b70d9 These are stragglers from my last commit ("Let us safely detach
the ISA bus and devices attaching to the ISA bus").  Define
isa_detach_hook() in MD ISA implementations.  Define isa_dmadestroy().
2009-08-18 17:02:00 +00:00
jmcneill
b0fb7abfad Switch to ACPICA 20090730, and update for API changes. 2009-08-18 16:41:02 +00:00
thorpej
84c3000008 pmap_page_remove(), pmap_test_attrs(), pmap_clear_attrs(): We're passed in
a vm_page, so there is little point in the DIAGNOSTIC test to see that we
have been passed a managed page.
2009-08-17 19:33:07 +00:00
matt
209a0b42e3 Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
2009-08-15 23:44:57 +00:00
cegger
46e5d74b06 recognize virtual cpu feature indicating guest state. 2009-08-13 11:27:34 +00:00
bouyer
913cd0a8e6 Fix watchdog code:
- the timer bound constants are in tick, so convert period to tick before
  checking it against the bounds
- for ICH5 or older, fix code that would have always written a 0 period
  to the register.
2009-08-11 17:15:32 +00:00
jym
bba2c41d59 Add Intel SpeedStep and AMD PowerNow! support in Xen dom0. MSR operations
are now compiled in by default.

Note that MSR support in Xen depends on its version. rdmsr() should always
succeed, but wrmsr() to certain registers can end in a NOOP. In that case,
the error will be logged (see xm dmesg).

Setting CPU frequency (SpeedStep) requires Xen 3.3 with the option
cpufreq="dom0-kernel" passed down to hypervisor during boot.

Compiled and tested for SpeedStep under i386 for XEN3_DOM0 and XEN3PAE_DOM0
by jym@. amd64 was tested by Joel Carnat.

See also http://mail-index.netbsd.org/port-xen/2009/08/02/msg005213.html .

Commit requested by bouyer@.
2009-08-05 20:15:36 +00:00
dsl
0c0bfe778a Only define x86_genfb_set_mapreg() and found_console when NPCI > 0
Fixes PR/41451
2009-08-03 20:15:14 +00:00
cegger
3518084fc6 remove Xen2 support.
ok bouyer@
2009-07-29 12:02:05 +00:00
jym
3974d05df6 Fix typos in comments and __PRINTKs. 2009-07-23 15:26:20 +00:00
dyoung
13f97f0e48 In ipmi_match(), initialize the condition variable sc_cmd_sleep.
Fixes a bug in previous, exposed by

# drvctl -d ipmi0
# drvctl -r -a ipmibus mainbus0
*lockdebug panic here*
2009-07-20 19:25:07 +00:00
dyoung
0c985f2dad Overhaul synchronization in ipmi(4): synchronize all access to
device registers with a mutex.  Convert tsleep/wakeup calls to
cv_wait/cv_signal.

Do not repeatedly malloc/free tiny buffers for sending/receiving
commands, but reserve a command buffer in the softc.

Tickle the watchdog in the sensors-refreshing thread.

I am fairly certain that after the device is attached, every register
access happens in the sensors-refreshing thread.  Moreover, no
software interrupt touches any register, now.  So I may get rid of
the mutex that protects register accesses, sc_cmd_mtx.
2009-07-20 19:11:30 +00:00
rmind
1be5c7a891 pmap_emap_sync: add an argument, and do not perform pmap_load() during
context switch (pmap_destroy() path seems to be unsafe), instead just
perform tlbflush().  Slightly inefficient, but good enough for now.
2009-07-19 15:17:29 +00:00
yamt
1a3805652d remove unnecessary casts. 2009-07-19 10:09:11 +00:00
pgoyette
9a7f03a6bb Store the limit values directly in the driver-private sensor data since
we don't have access to sysmon_envsys(8)'s copy at refresh time.  (The
refresh is driven completely within the driver, and sysmon is uninvolved.)

Resolves unexpected alarms (as reported by David Young) such as over-limit
alarms on fan sensors which have only lower limit values.
2009-07-11 05:03:11 +00:00
pgoyette
4bcd1e306c Don't extract upper/lower limit values if the values are not valid.
Correct comparison of cur_value against lower-limits.
2009-07-09 15:50:26 +00:00
drochner
49fc9bb35c add SIS 740 to the list of chipsets known to implement PCI configuration
mode 1 incorrectly, from Jason White
(see thread "ACPI issue with old Shuttle system" on port-i386)
2009-07-03 13:15:22 +00:00
pgoyette
144af482b2 Adapt to new features available in sysmon_envsys:
1) expose the built-in limits to user-land (via envstat(8)), and
2) allow user-specified limits to override the built-in limits.

No comments received from current-users@ over 2-week period.
2009-06-29 12:30:09 +00:00
rmind
5c68e5d0ee Ephemeral mapping (emap) implementation. Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.
2009-06-28 15:18:50 +00:00
cegger
861d7b5f02 make this build with DEBUG_MEMLOAD in all combinations of 32bit, 32bit PAE and 64bit 2009-06-20 13:10:14 +00:00
bouyer
3ac2dfe9bf Split mc146818-related functions from clock.c into rtc.c.
Call rtc_set_ymdhms() from xen/xen/clock.c:xen_rtc_set() for xen3 dom0
kernels as the Xen3 hypervisor doesn't write the new date/time to the CMOS
by itself.
Now a XEN3_DOM0 kernel properly updates the CMOS time.
2009-06-16 21:05:33 +00:00
cegger
18130206e3 - use <sys/bus.h> and <sys/cpu.h>
- add reference to family11h documentation
- add reference to AMD K8 Errata #141
2009-06-16 07:34:40 +00:00
tsutsui
9c2e10416b Apply fixes from jmcneill@ for PR port-i386/38729
(ACPI kernel booted under qemu cannot detect devices):
- make MP SCANPCI function for ACPI_SCANPCI and MPBIOS_SCANPCI
  return a number of attached PCI busses
- if no valid PCI busses are attached in the MP SCANPCI function,
  try to probe and attach pci0 at mainbus as well as kernels
  with no SCANPCI options

"Feel free to check it in" from jmcneill@.
Tested in pkgsrc qemu-0.9.1 (both i386 and x86_64) on NetBSD/i386.

Note original jmcneill's patch was posted on March:
http://mail-index.NetBSD.org/port-i386/2009/03/24/msg001281.html
and I also applied it to amd64:
http://mail-index.NetBSD.org/port-i386/2009/03/24/msg001283.html
but x86 MP attach functions have been reorganized by dyoung@ on April:
http://mail-index.NetBSD.org/source-changes/2009/04/17/msg219992.html
so I've modified the original patches to adapt the changes.
(mpacpi_scan_pci() and mpbios_scan_pci() have been merged into
 common mp_pci_scan() in new arch/x86/x86/mp.c)
For netbsd-5 and netbsd-5-0 branches, the original patches should be
applied cleanly, and they have been tested by abs@ on a selection of
i386 boxes and in qemu.
2009-06-13 13:35:11 +00:00
pgoyette
da6eeb0e4d Replace a flag that was accidentally removed. 2009-06-01 20:36:43 +00:00
pgoyette
5a84f3060e Since we no longer have individual events for each sensor value limit,
we don't need individual flag bits.  Clean up extra bit definitions.
Bump kernel version - welcome to 5.99.13
2009-06-01 20:08:44 +00:00
rmind
cfa533f904 Add CPU topology detection support for AMD processors.
Tested on the following AMD CPUs:
- Family 15, model 65
- Family 15, model 67
- Family 15, model 75
- Family 16, model 2
- Family 17, model 3

Reviewed (slightly older version of patch) by <yamt>.
2009-05-26 01:42:02 +00:00
bouyer
cc56ebe228 on Xen the GDT has to be updated though HYPERVISOR_update_descriptor().
Export i386/i386/gdt.c:update_descriptor() and use it in x86_set_sdbase(),
as a direct write to the GDT will cause a kernel trap.
Fix PR port-xen/41401.
2009-05-17 18:24:23 +00:00
ad
74b6a42ba2 Fix suspend/resume problem with some configurations. From drochner@. 2009-05-16 23:48:00 +00:00
pgoyette
2b244d4b8c Correctly identify flag bit for SSSE3 (one of the 'S' was missing). Also
rename AMD bit from SCALL/RET to SYSCALL/SYSRET to match Intel bit name.
2009-05-16 13:36:44 +00:00
pgoyette
85c2855a07 Fix toyp in previous. Pointed out by snj@ 2009-05-13 23:26:38 +00:00
pgoyette
1463b8efaf 1. Extend CPU probe of Intel processors to handle extended-models. This
allows us to properly identify new Intel 45nm processors, Core i7,
   Atom, and the 45nm Xeon MP.

2. Properly decode several new Intel cache descriptors, as listed in the
   most recent (March 2009) edition of Intel's Application Note 485.

3. Convert decode of the various features masks to use the newly added
   snprintb_m(3) routine.

Addresses my PR bin/41289
Addresses my PR bin/41290
2009-05-13 22:25:51 +00:00
mrg
a2836b8e54 avoid a warning seen with -O3. 2009-05-06 01:32:37 +00:00
cegger
463905bb9c struct cfdata * -> cfdata_t 2009-05-04 12:38:51 +00:00
cegger
287d5dd11d struct device * -> device_t 2009-05-01 09:38:24 +00:00
cegger
7298f44f6a - struct device * -> device_t
- remove useless parenthesis
2009-05-01 09:26:34 +00:00
cegger
827656cbc1 struct device * -> device_t 2009-05-01 09:20:02 +00:00
rmind
cc8d7ff411 Move x86 CPU topology detection code into the separate file (as it was originally).
OK by <yamt>.
2009-04-30 00:07:23 +00:00
njoly
7e5810aafc Attach 82801IEM LPC Interface Bridge too. 2009-04-29 14:55:36 +00:00
cegger
da38c1360b sprintf -> snprintf 2009-04-27 20:02:29 +00:00
ad
fbfeb4f2a9 A workaround for a bug with some Opteron revisions where locked operations
sometimes do not serve as memory barriers, allowing memory references to
bleed outside of critical sections.  It's possible that this is the
reason for pkgbuild's longstanding crashiness.
2009-04-24 17:49:51 +00:00
ad
c28dc6f757 A workaround for a bug with some Opteron revisions where locked operations
sometimes do not serve as memory barriers, allowing memory references to
bleed outside of critical sections.  It's possible that this is the
reason for pkgbuild's longstanding crashiness.

This is not complete (atomic ops need some work too).
2009-04-24 17:45:40 +00:00
ad
437e4a0d38 - Attach via the kthread so boot is not so slow on some systems with IPMI.
- NOWAIT -> WAITOK
2009-04-24 17:42:03 +00:00
cegger
7c3843a362 pool uses signed int for flags.
undo the int -> u_int change for pmap_pdp_alloc to unbreak the PAE build.
2009-04-23 12:18:41 +00:00
ad
a19f73310c Always write REDHI before REDLO, since REDLO contains the mask bit. 2009-04-22 22:31:26 +00:00
ad
c1cc516b61 Route all interrupts back to the BP again, for the time being.
Distributing them is causing strange problems on some systems.
2009-04-22 21:20:52 +00:00
cegger
88b0eacb84 change pmap flags argument from int to u_int.
forgot to commit this.
2009-04-22 10:17:48 +00:00
cegger
1d89a182fb change pmap flags argument from int to u_int.
discussed with christos@ on source-changes-d@
2009-04-21 21:29:58 +00:00
ad
4d8f47ae2f cpuctl:
- Add interrupt shielding (direct hardware interrupts away from the
  specified CPUs). Not documented just yet but will be soon.

- Redo /dev/cpu time_t compat so no kernel changes are needed.

x86:

- Make intr_establish, intr_disestablish safe to use when !cold.

- Distribute hardware interrupts among the CPUs, instead of directing
  everything to the boot CPU.

- Add MD code for interrupt sheilding. This works in most cases but there is
  a bug where delivery is not accepted by an LAPIC after redistribution. It
  also needs re-balancing to make things fair after interrupts are turned
  back on for a CPU.
2009-04-19 14:11:36 +00:00
cegger
da145a493a Introduce PMAP_NOCACHE as first PMAP MD bit in x86. Make use of it in pmap_enter().
This safes one extra TLB flush when mapping dma-safe memory.
Presented on tech-kern@, port-i386@ and port-amd64@
ok ad@
2009-04-18 08:51:45 +00:00
dyoung
c94ffba5d6 Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386.  This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.
2009-04-17 21:07:58 +00:00
rmind
3de18e79b4 - Add macros to handle (some) trapframe registers for common x86 code.
- Merge i386 and amd64 syscall.c into x86.  No functional changes intended.

Proposed on (port-i386 & port-amd64).  Unfortunately, I cannot merge these
lists into the single port-x86. :(
2009-04-16 15:34:23 +00:00
lukem
be3963b646 Constify a userland-only member. 2009-04-15 05:56:36 +00:00
dyoung
20d48b47c0 When ipmi0 detaches, free all of the ipmi_sensor's on the (global!)
ipmi_sensor_list.
2009-04-07 21:47:58 +00:00
dyoung
deeb71246e In ipmi_detach(), don't sysmon_envsys_destroy(), but just _unregister():
_unregister() calls _destroy().
2009-04-07 21:00:30 +00:00
dyoung
720a7dca79 Add opt_intrdebug.h for the INTRDEBUG option, and #include it here and
there.  Fixes GENERIC/i386 compilation with 'options INTRDEBUG'.
2009-04-07 18:24:23 +00:00
dyoung
f346073f7d Add a device-detachment hook for ipmi(4). 2009-04-07 17:53:45 +00:00