Commit Graph

1399 Commits

Author SHA1 Message Date
jruoho
7feffa2641 Call cpufreq_suspend(9) and cpufreq_resume(9) during suspend/resume. 2011-09-28 15:38:21 +00:00
dyoung
ffb96a7f74 Cosmetic: join some if-statements, remove superfluous parentheses. No
change in the generated assembly.
2011-09-28 01:45:49 +00:00
dyoung
d60981839b After bouncing in bus_dmamap_load{,_mbuf,_uio}, call bus_dmamap_load(9)
instead of _bus_dmamap_load() so that a bus_dmamap_load(9) override has
a shot at loading the map.

XXX Perhaps bounce buffers should be rewritten in terms of bus_dma(9)
XXX overrides.
2011-09-28 01:38:19 +00:00
dyoung
6fdab11de7 In bus_dma_tag_create(9), copy important properties (e.g., bounce
parameters) from the parent tag.

In bus_dma_tag_create(), increase the reference count on a parent
bus_dma_tag_t (if applicable), and decrease the reference count in
bus_dma_tag_destroy().

Don't let bus_dmatag_destroy(9) destroy an overridden bus_dma_tag_t.
2011-09-28 01:35:58 +00:00
dyoung
9115bf9945 Add an untested implementation of bus_dmamap_load_raw(9). 2011-09-28 01:33:26 +00:00
dyoung
109ec163ae Instead of declaring _bus_dmamap_load_busaddr() static inline, make
it static and let the compiler decide about inlining.  This reduces
the code size on both amd64 and i386, and the smaller code is probably
faster code.
2011-09-27 23:44:18 +00:00
dyoung
65d90030bd In _bus_dmamap_load_busaddr(), change sgsize from an int to a bus_size_t. 2011-09-27 23:33:35 +00:00
dyoung
db42fb0801 Make the 'size' argument of _bus_dmamap_load_busaddr() a bus_size_t for
consistency's sake.
2011-09-27 23:25:55 +00:00
jym
325494fe33 Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
2011-09-27 01:02:33 +00:00
jym
ea5fe09303 Fix a small typo in comment: pmaps_lock is the lock that keeps all
pmaps in sync for kernel mappings (including when they are obtained from
pool caches).
2011-09-25 18:39:30 +00:00
jruoho
382c7404ce Try to obtain reliable MHz values for AMD familiesi 10h and 11h. 2011-09-24 19:41:40 +00:00
jruoho
20f20f38b9 Be more intelligent; read the MSR_CMPHALT with rdmsr_safe() and set the
C1E-flag based on this. Pointed out by jmcneill@.
2011-09-24 11:17:25 +00:00
jruoho
e514692ad1 As the detection of C1E is not entirely clear-cut, use rdmsr_safe()
when reading the AMD "interrupt pending and CMP-halt register".
2011-09-24 10:59:02 +00:00
jruoho
dfacc168e3 Use rdmsr_safe() when reading IA32_TEMPERATURE_TARGET. 2011-09-24 10:52:56 +00:00
jym
5e90fb2393 Be conservative when reading MSR_FSB_FREQ by using rdmsr_safe(). We cannot
tell in advance when new CPU model/family combo will come and trying to
read that MSR early during boot may cause unhandled faults.
2011-09-24 10:49:13 +00:00
jym
25f08e65cb Import rdmsr_safe(msr, *value) for x86 world. It allows reading MSRs
in a safe way by handling the fault that might trigger for certain
register <> CPU/arch combos.

Requested by Jukka. Patch adapted from one found in DragonflyBSD.
2011-09-24 10:32:52 +00:00
jym
eba16022d3 Merge jym-xensuspend branch in -current. ok bouyer@.
Goal: save/restore support in NetBSD domUs, for i386, i386 PAE and amd64.

Executive summary:
- split all Xen drivers (xenbus(4), grant tables, xbd(4), xennet(4))
in two parts: suspend and resume, and hook them to pmf(9).
- modify pmap so that Xen hypervisor does not cry out loud in case
it finds "unexpected" recursive memory mappings
- provide a sysctl(7), machdep.xen.suspend, to command suspend from
userland via powerd(8). Note: a suspend can only be handled correctly
when dom0 requested it, so provide a mechanism that will prevent
kernel to blindly validate user's commands

The code is still in experimental state, use at your own risk: restore
can corrupt backend communications rings; this can completely thrash
dom0 as it will loop at a high interrupt level trying to honor
all domU requests.

XXX PAE suspend does not work in amd64 currently, due to (yet again!)
page validation issues with hypervisor. Will fix.

XXX secondary CPUs are not suspended, I will write the handlers
in sync with cherry's Xen MP work.

Tested under i386 and amd64, bear in mind ring corruption though.

No build break expected, GENERICs and XEN* kernels should be fine.
./build.sh distribution still running. In any case: sorry if it does
break for you, contact me directly for reports.
2011-09-20 00:12:23 +00:00
gsutre
59ff3357e7 PR/38356: Minoura Makoto: Use the device's unit (instead of autoconf's)
to match the bootinfo root device.

Fixes multiboot(8) root= option as well as GRUB knetbsd --root option.
2011-09-19 10:03:32 +00:00
christos
ae210ffce4 fix typo, revert to previous version 2011-09-15 12:32:30 +00:00
christos
fe07a757f1 revert previous; bug was in the position of the inclusion of the file. 2011-09-14 14:58:43 +00:00
christos
8f0814daf5 Don't depend on the .d file here; since this is the only rule, acpi_wakeup.d
will never be build!
2011-09-14 13:13:21 +00:00
dyoung
351c7b7b28 Clean up a bit: delete #if 1 and its corresponding #endif. 2011-09-13 18:09:52 +00:00
dyoung
2a35d669c2 For consistency, call a bus_dma_tag_t bdt instead of bst. No functional
change intended.
2011-09-13 17:59:46 +00:00
dyoung
2c7ac85415 Bracket a debugging printf() with #ifdef DEBUG. 2011-09-13 17:58:42 +00:00
christos
eef9d69994 Remove code that was used to avoid register spills. setcontext(2) can change
the registers, so re-fetching will produce the wrong result for trace_exit().
2011-09-04 21:14:49 +00:00
christos
bac4b71fcb If the process is traced, resulting from a PTRACE_FORK inherited setting,
stop it right now.

XXX[1]: Cannot make this MI, because I cannot wrap child_return because there
is MD code that checks fun == child_return. I think it is better to have an
mi child_return() and add a cpu_child_return()?
XXX[2]: Why do we need to stop so early? Perhaps stopping just after exec
is better?
2011-09-02 20:01:20 +00:00
christos
05ec717ee7 Add bus_dma overrides. From dyoung 2011-09-01 15:10:31 +00:00
dyoung
4f4f4d2e20 Add override members to x86_bus_dma_tag. 2011-08-31 20:21:06 +00:00
dyoung
50eec10ffa Add pci_ranges.c to the set of files compiled when 'pci' is configured. 2011-08-29 22:46:56 +00:00
dyoung
cfc495a0e8 Move the code for grovelling in PCI configuration space for assigned
memory & I/O regions into its own module, pci_ranges.c, so that we can
leave it out on systems that won't need it.
2011-08-29 22:46:04 +00:00
dyoung
564aab2b39 Use a loop instead of tail-recursion for the pci_intr(9) overrides.
This is the same change that I just made to the pci(9) overrides.  While
I am here, fix a bug: use PCI_OVERRIDE_INTR_DISESTABLISH instead of
PCI_OVERRIDE_INTR_ESTABLISH for the pci_intr_disestablish(9) override.
2011-08-29 22:41:52 +00:00
dyoung
bdb3e7cbc5 Normalize whitespace. 2011-08-28 06:08:15 +00:00
dyoung
6332563764 Add some code for grovelling in the PCI configuration space for all
of the memory & I/O space reserved by the PCI BIOS for PCI devices
(including bridges) and recording that information for later use.

The code takes between 13k and 50k (depends on the architecture and,
bizarrely, the kernel configuration) so I am going to move it from
pci_machdep.c into its own module on Monday.
2011-08-28 06:04:17 +00:00
dyoung
35fd1a8bbe Replace some anonymous constants with PCI_ constants.
Print debugging information using aprint_debug(9) not aprint_verbose(9)
and be consistent about that.  Get rid of the pciaddrverbose switch for
debugging printfs.

Make 'static' several functions that are private to this module.

Don't test truth of arbitrary integers but compare with 0.  Change
'return (x)' to 'return x'.
2011-08-28 05:32:41 +00:00
dyoung
aa14fb96d7 Make the override implementation more concise. Saves about three lines
of code per routine, makes it more explicit what's going on, and avoids
recursion, though the compiler probably optimized the tail recursion in
the old code.
2011-08-28 04:59:37 +00:00
dyoung
bd41bd0d2c Use __strict_weak_alias(). 2011-08-28 00:51:21 +00:00
christos
93e326680f use c99 struct initializers 2011-08-27 09:32:11 +00:00
dyoung
f05aa184df Initialize bst_exists in bus_space_tag_create(9). Use it to avoid
walking the chain of ancestor tags to see if a bus_space(9) routine was
overridden.
2011-08-25 15:08:49 +00:00
dyoung
73b6a5effa Add to x86 bus_space_tag_t a member, bst_exists, that tells whether a
routine is overridden by this tag or by any ancestral tag.
2011-08-25 15:06:10 +00:00
jakllsch
08fb9c512d Add rescan support for 'amdtempbus' to x86 pchb(4).
Maybe finally fixes PR#45268.
2011-08-20 20:01:08 +00:00
jakllsch
a99113c4a1 pchb_get_bus_number() is actually public 2011-08-20 19:56:31 +00:00
jakllsch
08c7a716a6 staticification 2011-08-20 19:49:55 +00:00
jakllsch
90aab468c3 We no longer need to #include "rnd.h". 2011-08-20 19:43:47 +00:00
jakllsch
5cf40ee467 We need to initialize the PCI chipset and device tags in the softc for
the suspend and resume handlers.
2011-08-20 19:06:57 +00:00
jakllsch
844442797e Attach amdtemp(4) at pchb(4) instead of in place of pchb(4).
Should fix PR#45268.
2011-08-18 20:55:20 +00:00
dyoung
8062831546 In pci_msi_establish(), replace several anonymous constants with IOAPIC_
symbols.  No change in the generated assembly.
2011-08-17 14:56:55 +00:00
dyoung
6b47091b3b Add definitions from [1] for the I/O APIC's MSI Message Address & Data
registers.

[1] Intel Corporation, Intel 64 and IA-32 Architectures Software
    Developer's Manual, Volume 3A: System Programming Guide, Part 1,
    http://www.intel.com/Assets/PDF/manual/253668.pdf, Chapter 10,
    January, 2011.
2011-08-17 14:55:11 +00:00
dyoung
70183e515a Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).
Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish().  Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.
2011-08-17 00:59:47 +00:00
msaitoh
abdd14be5f Add some LPC entries for Intel 6 series and C20x. 2011-08-14 12:42:19 +00:00
rmind
8ff531f87f Convert few panic() uses to asserts, reduce the scope of variable use.
No functional changes.
2011-08-14 02:31:08 +00:00