Home | History | Annotate | only in /src/sys/arch/x86/isa
History log of /src/sys/arch/x86/isa
RevisionDateAuthorComments
 1.42 24-Feb-2025  imil Check for RTC presence to avoid hang with QEMU microvm and rtc=off
parameter.

Test bits 0-6 of MC146818's Register D, which must be 0 according to
the specification. This prevents a later hang in rtcget() when no RTC
is present.
 1.41 25-Jan-2023  riastradh branches: 1.41.6;
x86/intr: Work around sleazy clockintr with a secret frame argument.

PR kern/57197
 1.40 24-Jan-2023  riastradh x86/isa/clock.c: Nix trailing whitespace.

No functional change intended.
 1.39 29-May-2020  rin branches: 1.39.20;
For struct timecounter, use C99 initializers.
Compile tested. No functional changes intended.
 1.38 02-May-2020  bouyer Introduce Xen PVH support in GENERIC.
This is compiled in with
options XENPVHVM
x86 changes:
- add Xen section and xen pvh entry points to locore.S. Set vm_guest
to VM_GUEST_XENPVH in this entry point.
Most of the boot procedure (especially page table setup and switch to
paged mode) is shared with native.
- change some x86_delay() to delay_func(), which points to x86_delay() for
native/HVM, and xen_delay() for PVH

Xen changes:
- remove Xen bits from init_x86_64_ksyms() and init386_ksyms()
and move to xen_init_ksyms(), used for both PV and PVH
- set ISA no-legacy-devices property for PVH
- factor out code from Xen's cpu_bootconf() to xen_bootconf()
in xen_machdep.c
- set up a specific pvh_consinit() which starts with printk()
(which uses a simple hypercall that is available early) and switch to
xencons when we can use pmap_kenter_pa().
 1.37 25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.36 16-Oct-2019  christos branches: 1.36.6;
Add and use __FPTRCAST, requested by uwe@
 1.35 16-Oct-2019  christos add void * casts for the clock interrupt handlers.
 1.34 15-Feb-2019  nonaka Added Microsoft Hyper-V support. It ported from OpenBSD and FreeBSD.

graphical console is not work on Gen.2 VM yet. To use the serial console,
enter "consdev com,0x3f8,115200" on efiboot.
 1.33 16-Jun-2009  bouyer branches: 1.33.56; 1.33.64;
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.
 1.32 07-Apr-2009  dyoung Detach sysbeep0 at shutdown.
 1.31 16-Dec-2008  christos branches: 1.31.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.30 11-May-2008  ad branches: 1.30.6; 1.30.8; 1.30.14;
Fix the qemu (?) problem.
 1.29 10-May-2008  ad Improve x86 tsc handling:

- Ditch the cross-CPU calibration stuff. It didn't work properly, and it's
near impossible to synchronize the CPUs in a running system, because bus
traffic will interfere with any calibration attempt, messing up the
timings.

- Only enable the TSC on CPUs where we are sure it does not drift. If we are
On a known good CPU, give the TSC high timecounter quality, making it the
default.

- When booting CPUs, detect TSC skew and account for it. Most Intel MP
systems have synchronized counters, but that need not be true if the
system has a complicated bus structure. As far as I know, AMD systems
do not have synchronized TSCs and so we need to handle skew.

- While an AP is waiting to be set running, try and make the TSC drift by
entering a reduced power state. If we detect drift, ensure that the TSC
does not get a high timecounter quality. This should not happen and is
only for safety.

- Make cpu_counter() stuff LKM safe.
 1.28 06-Apr-2008  cherry branches: 1.28.2; 1.28.4; 1.28.6;
Correct comment about struct timecounter field
 1.27 05-Mar-2008  cube Cosmetics: use device_t and cfdata_t.
 1.26 04-Mar-2008  cube sysbeep has no softc, use CFATTACH_DECL_NEW.
 1.25 19-Jan-2008  kardel branches: 1.25.2; 1.25.6;
unbreak i8254_get_timecount() in environments where the
clock interrupt is derived from other sources (e.g. lapic)
and the i8254 timer is running the full cycle without
being used as clock interrupt source.
 1.24 17-Jan-2008  lukem Remove unnecessary references to config_time.h.
 1.23 16-Jan-2008  chuck fix clock accounting problem in i8254_get_timecount that caused
the auich auich_calibrate() function to get the wrong ac97 freq
(may cause audio to play at wrong speed on some systems). this
error was inadvertently introduced in rev 1.98 of the old
src/sys/arch/i386/isa/clock.c (2006/09/03) and manifests itself
on systems that do not use an alternate timecounter (e.g. ACPI-Fast).

the basic problem is that the code that handled when the i8254
counter wrapped was firing in cases when it shouldn't have,
causing the counter to run fast. a more detailed discussion
can be found here:
http://mail-index.netbsd.org/tech-kern/2008/01/15/0001.html
http://mail-index.netbsd.org/tech-kern/2008/01/16/0000.html
 1.22 04-Jan-2008  dyoung Remove superfluous #if (NPCPPI > 0).
 1.21 04-Jan-2008  dyoung Move #endif to the place where it belongs. Thanks, Chavdar Ivanov,
for noticing this.
 1.20 04-Jan-2008  ad Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.19 04-Jan-2008  christos add missing includes
 1.18 03-Jan-2008  he Declare sysbeepdetach(), and protect a small additional section
with #if (NPCPPI > 0).
 1.17 03-Jan-2008  dyoung Support detachment of pchb(4) and sysbeep(4).
 1.16 28-Dec-2007  joerg Remove delaytab and just compute the reminder directly. This requires
two muls and a shift, which needs at most 2ms on a 25MHz i386 and should
end up as fast as delay(1) was before due to using a reminder of 2.
Discussed with ad@.
 1.15 09-Dec-2007  jmcneill branches: 1.15.2;
Merge jmcneill-pm branch.
 1.14 04-Dec-2007  ad branches: 1.14.2;
- Fix the locking around the i8254. Values for the TSC clock and lapic
delay function were wildly inaccurate due to multiple CPUs competing
in DELAY() during calibration, confusing the clock chip.
- Use i8254_delay() explictly in a few more places.
 1.13 14-Nov-2007  ad branches: 1.13.2;
- Remove I486_CPU, I586_CPU, I686_CPU options. They buy us nothing and
clutter the code significantly.
- Remove pccons.
 1.12 26-Oct-2007  joerg branches: 1.12.2;
Match delay/DELAY on x86 with delay(9). It takes an unsigned int as
argument. Use this and replace the inline assembly (mul + div using the
64bit intermediate result) with normal 32bit multiplication and
division. The compiler can turn the division into a multiplication and
shift, making it even cheaper then the original assembly. For extreme
long delays, just use 64bit arithmetic.
 1.11 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.10 26-Sep-2007  ad branches: 1.10.2;
x86 changes for pcc and LKMs.

- Replace most inline assembly with proper functions. As a side effect
this reduces the size of amd64 GENERIC by about 120kB, and i386 by a
smaller amount. Nearly all of the inlines did something slow, or something
that does not need to be fast.
- Make curcpu() and curlwp functions proper, unless __GNUC__ && _KERNEL.
In that case make them inlines. Makes curlwp LKM and preemption safe.
- Make bus_space and bus_dma more LKM friendly.
- Share a few more files between the ports.
- Other minor changes.
 1.9 09-Jul-2007  ad branches: 1.9.8; 1.9.10; 1.9.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.8 08-Dec-2006  yamt branches: 1.8.2; 1.8.8; 1.8.10; 1.8.16;
- pass intrframe by-pointer, not by-value.
- make i386 and xen use per-cpu interrupt stack.

xen part is reviewed by Manuel Bouyer.
 1.7 16-Nov-2006  christos branches: 1.7.2; 1.7.4;
__unused removal on arguments; approved by core.
 1.6 13-Oct-2006  hannken More __unused (NPCPPI == 0 case).
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 07-Sep-2006  gdamore branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8;
Use common todr_settime_ymdhms/gettime_ymdhms.
While here, fix an incorrect test for timeset (that's in kern_todr already),
and an incorrect to time_second (instead of using the date passed in).
 1.3 04-Sep-2006  gdamore Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.2 04-Sep-2006  perry Undo static declaration on gettick -- lapic.c uses it.
Pointed out by Geoff Wing (mason at primenet.com.au)
 1.1 04-Sep-2006  perry switch to a common clock.c
 1.4.8.2 10-Dec-2006  yamt sync with head.
 1.4.8.1 22-Oct-2006  yamt sync with head
 1.4.6.2 14-Sep-2006  yamt sync with head.
 1.4.6.1 07-Sep-2006  yamt file clock.c was added on branch yamt-pdpolicy on 2006-09-14 12:31:22 +0000
 1.4.4.2 09-Sep-2006  rpaulo sync with head
 1.4.4.1 07-Sep-2006  rpaulo file clock.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:44:49 +0000
 1.4.2.2 12-Jan-2007  ad Sync with head.
 1.4.2.1 18-Nov-2006  ad Sync with head.
 1.7.4.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.7.2.2 17-May-2008  bouyer Pull up following revision(s) (requested by kardel in ticket #1058):
sys/arch/x86/isa/clock.c: revision 1.25 via patch
unbreak i8254_get_timecount() in environments where the
clock interrupt is derived from other sources (e.g. lapic)
and the i8254 timer is running the full cycle without
being used as clock interrupt source.
 1.7.2.1 21-Jan-2008  bouyer Pull up following revision(s) (requested by chuck in ticket #1049):
src/sys/arch/x86/isa/clock.c 1.23 via patch
fixes clock accounting problem in i8254_get_timecount that caused
the auich auich_calibrate() function to get the wrong ac97 freq
(may cause audio to play at wrong speed on some systems).
 1.8.16.1 03-Oct-2007  garbled Sync with HEAD
 1.8.10.1 11-Jul-2007  mjf Sync with head.
 1.8.8.3 03-Dec-2007  ad Sync with HEAD.
 1.8.8.2 09-Oct-2007  ad Sync with head.
 1.8.8.1 10-Apr-2007  ad Replace some more locks.
 1.8.2.8 17-Mar-2008  yamt sync with head.
 1.8.2.7 21-Jan-2008  yamt sync with head
 1.8.2.6 07-Dec-2007  yamt sync with head
 1.8.2.5 15-Nov-2007  yamt sync with head.
 1.8.2.4 27-Oct-2007  yamt sync with head.
 1.8.2.3 03-Sep-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 08-Dec-2006  yamt file clock.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:22 +0000
 1.9.12.1 06-Oct-2007  yamt sync with head.
 1.9.10.3 23-Mar-2008  matt sync with HEAD
 1.9.10.2 09-Jan-2008  matt sync with HEAD
 1.9.10.1 06-Nov-2007  matt sync with HEAD
 1.9.8.6 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.8.5 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.9.8.4 28-Nov-2007  jmcneill Register with power management framework.
 1.9.8.3 21-Nov-2007  joerg Sync with HEAD.
 1.9.8.2 28-Oct-2007  joerg Sync with HEAD.
 1.9.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.10.2.2 18-Nov-2007  bouyer Sync with HEAD
 1.10.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.12.2.4 18-Feb-2008  mjf Sync with HEAD.
 1.12.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.12.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.12.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.13.2.2 26-Dec-2007  ad Sync with head.
 1.13.2.1 08-Dec-2007  ad Sync with head.
 1.14.2.1 11-Dec-2007  yamt sync with head.
 1.15.2.4 20-Jan-2008  bouyer Sync with HEAD
 1.15.2.3 19-Jan-2008  bouyer Sync with HEAD
 1.15.2.2 08-Jan-2008  bouyer Sync with HEAD
 1.15.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.25.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.25.2.1 24-Mar-2008  keiichi sync with head.
 1.28.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28.4.3 20-Jun-2009  yamt sync with head
 1.28.4.2 04-May-2009  yamt sync with head.
 1.28.4.1 16-May-2008  yamt sync with head.
 1.28.2.1 18-May-2008  yamt sync with head.
 1.30.14.1 21-Apr-2010  matt sync to netbsd-5
 1.30.8.1 19-Jun-2009  snj Pull up following revision(s) (requested by bouyer in ticket #816):
sys/arch/amd64/conf/files.amd64: revision 1.68
sys/arch/i386/conf/files.i386: revision 1.350
sys/arch/x86/include/rtc.h: revision 1.1
sys/arch/x86/isa/clock.c: revision 1.33
sys/arch/x86/isa/rtc.c: revision 1.1
sys/arch/xen/conf/files.xen: revision 1.100
sys/arch/xen/xen/clock.c: revision 1.50 via patch
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.
 1.30.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.30.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.2.3 01-Nov-2009  jym Sync with HEAD.
 1.31.2.2 23-Jul-2009  jym Sync with HEAD.
 1.31.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.33.64.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.33.64.1 10-Jun-2019  christos Sync with HEAD
 1.33.56.1 09-Mar-2019  martin Pull up following revision(s) via patch (requested by nonaka in ticket #1210):

sys/dev/hyperv/vmbusvar.h: revision 1.1
sys/dev/hyperv/hvs.c: revision 1.1
sys/dev/hyperv/if_hvn.c: revision 1.1
sys/dev/hyperv/vmbusic.c: revision 1.1
sys/arch/x86/x86/lapic.c: revision 1.69
sys/arch/x86/isa/clock.c: revision 1.34
sys/arch/x86/include/intrdefs.h: revision 1.22
sys/arch/i386/conf/GENERIC: revision 1.1201
sys/arch/x86/x86/hyperv.c: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.105
sys/arch/x86/x86/x86_machdep.c: revision 1.124
sys/arch/i386/conf/GENERIC: revision 1.1203
sys/arch/amd64/amd64/genassym.cf: revision 1.74
sys/arch/i386/conf/GENERIC: revision 1.1204
sys/arch/amd64/conf/GENERIC: revision 1.520
sys/arch/x86/x86/hypervreg.h: revision 1.1
sys/arch/amd64/amd64/vector.S: revision 1.69
sys/dev/hyperv/hvshutdown.c: revision 1.1
sys/dev/hyperv/hvshutdown.c: revision 1.2
sys/dev/usb/if_urndisreg.h: file removal
sys/arch/x86/x86/cpu.c: revision 1.167
sys/arch/x86/conf/files.x86: revision 1.107
sys/dev/usb/if_urndis.c: revision 1.20
sys/dev/hyperv/vmbusicreg.h: revision 1.1
sys/dev/hyperv/hvheartbeat.c: revision 1.1
sys/dev/hyperv/vmbusicreg.h: revision 1.2
sys/dev/hyperv/hvheartbeat.c: revision 1.2
sys/dev/hyperv/files.hyperv: revision 1.1
sys/dev/ic/rndisreg.h: revision 1.1
sys/arch/i386/i386/genassym.cf: revision 1.111
sys/dev/ic/rndisreg.h: revision 1.2
sys/dev/hyperv/hyperv_common.c: revision 1.1
sys/dev/hyperv/hvtimesync.c: revision 1.1
sys/dev/hyperv/hypervreg.h: revision 1.1
sys/dev/hyperv/hvtimesync.c: revision 1.2
sys/dev/hyperv/vmbusicvar.h: revision 1.1
sys/dev/hyperv/if_hvnreg.h: revision 1.1
sys/arch/x86/x86/lapic.c: revision 1.70
sys/arch/amd64/amd64/vector.S: revision 1.70
sys/dev/ic/ndisreg.h: revision 1.1
sys/arch/amd64/conf/GENERIC: revision 1.516
sys/dev/hyperv/hypervvar.h: revision 1.1
sys/arch/amd64/conf/GENERIC: revision 1.518
sys/arch/amd64/conf/GENERIC: revision 1.519
sys/arch/i386/conf/files.i386: revision 1.400
sys/dev/acpi/vmbus_acpi.c: revision 1.1
sys/dev/hyperv/vmbus.c: revision 1.1
sys/dev/hyperv/vmbus.c: revision 1.2
sys/arch/x86/x86/intr.c: revision 1.144
sys/arch/i386/i386/vector.S: revision 1.83
sys/arch/amd64/conf/files.amd64: revision 1.112

separate RNDIS definitions from urndis(4) for use with Hyper-V NetVSC.

-

Added Microsoft Hyper-V support. It ported from OpenBSD and FreeBSD.
graphical console is not work on Gen.2 VM yet. To use the serial console,
enter "consdev com,0x3f8,115200" on efiboot.

-

Add __diagused.

-

PR/53984: Partial revert of modify lapic_calibrate_timer() in lapic.c r1.69.

-

Update Hyper-V related drivers description.

-

Remove unused definition.

-

Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.
NFCI intended.

-

commented out hvkvp entry.

-

fix typo. pointed out by pgoyette@n.o.

-

Use IDTVEC instead of NENTRY for handle_hyperv_hypercall.

-

Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.
 1.36.6.1 18-Apr-2020  bouyer Centralize initialisations of delay_func and initclock_func
in x86_machdep.c and export from <x86/machdep.h>
Introduce a x86_dummy_initclock() and a x86_cpu_initclock_func pointer,
to be used later for Xen HVM native clock support.
rename rtclock_tval to x86_rtclock_tval and export from <x86/machdep.h>,
for the benefit of lapic.c
 1.39.20.1 01-Apr-2023  martin Pull up following revision(s) (requested by riastradh in ticket #136):

sys/arch/x86/x86/intr.c: revision 1.164
sys/arch/x86/isa/clock.c: revision 1.41
sys/arch/x86/include/intr_private.h: revision 1.1

x86/intr: Work around sleazy clockintr with a secret frame argument.
PR kern/57197
 1.41.6.1 02-Aug-2025  perseant Sync with HEAD
 1.53 03-Oct-2025  thorpej Use device_{get,set}prop_bool() for "no-legacy-devices".
 1.52 15-Apr-2022  jmcneill Disable FADT LEGACY_DEVICES flag test.

This test had the unintended side-effect of blocking the lm(4) driver
from attaching on more than one system. Go back to (slow) probing of
ISA devices for now to restore existing functionality.
 1.51 17-Dec-2021  skrll Correct copypaste comment grammar.
 1.50 17-Dec-2021  skrll Trailing whitespace
 1.49 16-Oct-2021  jmcneill Skip legacy device detection for VMware guests with ACPI enabled.
 1.48 15-Oct-2021  jmcneill Add missing acpi include
 1.47 15-Oct-2021  jmcneill If ACPI indicates that there are no user visible devices on the LPC or ISA
bus, set the "no-legacy-devices" property on isa to bypass indirect
configuration of ISA devices.
 1.46 02-May-2020  bouyer Introduce Xen PVH support in GENERIC.
This is compiled in with
options XENPVHVM
x86 changes:
- add Xen section and xen pvh entry points to locore.S. Set vm_guest
to VM_GUEST_XENPVH in this entry point.
Most of the boot procedure (especially page table setup and switch to
paged mode) is shared with native.
- change some x86_delay() to delay_func(), which points to x86_delay() for
native/HVM, and xen_delay() for PVH

Xen changes:
- remove Xen bits from init_x86_64_ksyms() and init386_ksyms()
and move to xen_init_ksyms(), used for both PV and PVH
- set ISA no-legacy-devices property for PVH
- factor out code from Xen's cpu_bootconf() to xen_bootconf()
in xen_machdep.c
- set up a specific pvh_consinit() which starts with printk()
(which uses a simple hypercall that is available early) and switch to
xencons when we can use pmap_kenter_pa().
 1.45 25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.44 11-Feb-2019  cherry branches: 1.44.10;
We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.
 1.43 25-Dec-2018  cherry Excise XEN specific code out of x86/x86/intr.c into xen/x86/xen_intr.c

While at it, separate the source function tracking so that the interrupt
paths are truly independant.

Use weak symbol exporting to provision for future PVHVM co-existence
of both files, but with independant paths. Introduce assembler code
such that in a unified scenario, native interrupts get first priority
in spllower(), followed by XEN event callbacks. IPL management and
semantics are unchanged - native handlers and xen callbacks are
expected to maintain their ipl related semantics.

In summary, after this commit, native and XEN now have completely
unrelated interrupt handling mechanisms, including
intr_establish_xname() and assembler stubs and intr handler
management.

Happy Christmas!
 1.42 10-Dec-2018  maxv Remove unused mbuf.h includes.
 1.41 03-Dec-2018  cherry Allow isa_machdep.c to compile in the case of no ioapic support.
 1.40 10-Sep-2018  cherry Remove the last usage of xen_pirq_alloc() and pirq_establish()
outside of the x86 interrupt and xen events framework.

This allows us to finally unify the interrupt path for both Xen
and x86 as changes 'internal' to the subsystem.

This change has been kindly tested on real hardware by gson@

The change is not cosmetic and may thus affect users on various
hardware configurations - especially involving legacy hardware.

I look forward to bug reports.
 1.39 24-Jun-2018  jdolecek branches: 1.39.2;
add support for kern.intr.list aka intrctl(8) 'list' for xen

event_set_handler() and pirq_establish() now have extra intrname
parameter; shared intr_create_intrid() is used to provide the value

xen drivers were changed to pass the specific driver instance
name as the xname, e.g. 'vcpu0 clock' instead just 'clock', or
'xencons0' instead of 'xencons'

associated evcnt is now changed to use intrname - this matches native x86
 1.38 13-Dec-2017  bouyer branches: 1.38.2;
Fixes for physical interrupts on Xen:
- do not cast int * to intr_handle_t *, they're not the same size
- legacy_irq is not always -1 for ioapic interrupts, test pic_type instead
- change irq2port[] to hold (port + 1) so that 0 is an invalid value
- add KASSERTs to make sure vect, port or irq values extracted from arrays are
valid (or that they are invalid before write)
- for the !ioapic case, we still need to do PHYSDEVOP_ASSIGN_VECTOR and
bind_pirq_to_evtch().

now XEN3_DOM0 boots again
 1.37 04-Nov-2017  cherry Retire xen/x86/intr.c and use the new xen specific glue in x86/x86/intr.c

The purpose of this change is to expose the x86/include/intr.h API
to drivers. Specifically the following functions:

void *intr_establish_xname(...);
void *intr_establish(...);
void intr_disestablish(...);

while maintaining the old API from xen/include/evtchn.h, specifically
the following functions:

int event_set_handler(...);
int event_remove_handler(...);

This is so that if things break, we can keep using the old API until
everything stabilises. This is a stepping stone towards getting the
actual XEN event callback path rework code in place - which can be
done opaquely behind the intr.h API - NetBSD/XEN specific drivers that
have been ported to the intr.h API should then work without
significant further modifications.
 1.36 21-Jul-2017  cherry Fix uninitialised use of variable mpih

Pointed out by joerg@
 1.35 16-Jul-2017  cherry branches: 1.35.2;
Remove the xen specific interrupt type for the x86 intr_handle_t
For this to work, we use the evtchn.c:get_pirq_to_evtchn() glue
function to make things easier.
 1.34 15-Oct-2016  jdolecek provide intr xname
 1.33 27-Apr-2015  knakahara branches: 1.33.2;
add intr_handle_t and let pci_intr_handle_t use it.
 1.32 28-Feb-2012  mbalmer branches: 1.32.2; 1.32.16;
cosmetic, spelling, and grammar adjustments
 1.31 18-Oct-2011  dyoung branches: 1.31.2; 1.31.6;
Factor device_isa_register() and device_pci_register() out of
device_register() and stick the new routines into isa_machdep.c and
pci_machdep.c, respectively.
 1.30 01-Sep-2011  christos Add bus_dma overrides. From dyoung
 1.29 27-Aug-2011  christos use c99 struct initializers
 1.28 19-Aug-2009  dyoung isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t.
 1.27 18-Aug-2009  dyoung 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().
 1.26 19-Apr-2009  ad 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.
 1.25 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.24 18-Dec-2008  cegger branches: 1.24.2;
remove unused malloc.h
 1.23 03-Jul-2008  drochner branches: 1.23.4;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64
 1.22 27-Jun-2008  cegger struct device * -> device_t
 1.21 27-Jun-2008  cegger ansify
 1.20 30-May-2008  ad branches: 1.20.2;
Add a 'known_mpsafe' argument to intr_establish().
 1.19 28-Apr-2008  martin branches: 1.19.2;
Remove clause 3 and 4 from TNF licenses
 1.18 17-Oct-2007  garbled branches: 1.18.16; 1.18.18; 1.18.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.17 09-Jul-2007  ad branches: 1.17.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.16 21-Feb-2007  mrg branches: 1.16.4; 1.16.6; 1.16.12;
add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
bus_addr_t min_addr,
bus_addr_t max_addr,
bus_dma_tag_t *newtag,
int flags)
void _bus_dmatag_destroy(bus_dma_tag_t tag)

that allow a (normally broken/limited) device to restrict the bus address
range it can talk to. this is used by bce(4) to limit DMA addresses to
1GB range, the maximum the chip can address.

all this is from Yorick Hardy <yhardy@uj.ac.za> with input from several
people on tech-kern.

XXX: bus_dma(9) needs an update still.
 1.15 16-Nov-2006  christos branches: 1.15.4;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 11-Dec-2005  christos branches: 1.13.20; 1.13.22;
merge ktrace-lwp.
 1.12 16-Apr-2005  yamt branches: 1.12.2;
tweak x86 bus_dma code so that it can be used by xen port.

- distinguish paddr_t and bus_addr_t.
for xen, use bus_addr_t in the sense of machine address.
- move _X86_BUS_DMA_PRIVATE part of bus.h into bus_private.h.
- remove special handling of xen_shm. we can always grab
machine address from pte.
 1.11 20-Jun-2004  thorpej branches: 1.11.4; 1.11.10;
Remove the "ID" component of the x86 bus_dma flags, since these are no
longer "ISA DMA" specific flags.
 1.10 30-Oct-2003  fvdl * keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant
 1.9 16-Oct-2003  fvdl Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 07-May-2003  fvdl branches: 1.7.2;
Generalize bounce buffers, and use them for 32 bit PCI if needed.
Make ALLOCNOW the default iff bouncing might be needed (this has
no effect on i386 because ISA DMA devices already had to use
ALLOCNOW, and PCI isn't bounced (yet), since we don't do > 4G
at this point for i386.
 1.6 05-May-2003  fvdl Move definition of ISA_DMA_BOUNCE_THRESHOLD to dev/isa/isareg.h.
 1.5 03-May-2003  wiz DMA, not dma nor Dma.
 1.4 04-Mar-2003  fvdl s/i386_isa_chipset/x86_isa_chipset/
 1.3 02-Mar-2003  fvdl Clean up some unneeded "mca.h" and "eisa.h" includes, make one that is
needed dependent on !__x86_64__. To be revisited later.
 1.2 02-Mar-2003  fvdl x86_64 has no mca.h and eisa.h (should perhaps just generate empty ones)
 1.1 27-Feb-2003  fvdl Moved here from i386/isa
 1.7.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 21-Apr-2005  tron Pull up revision 1.12 (requested by yamt in ticket #175):
tweak x86 bus_dma code so that it can be used by xen port.
- distinguish paddr_t and bus_addr_t.
for xen, use bus_addr_t in the sense of machine address.
- move _X86_BUS_DMA_PRIVATE part of bus.h into bus_private.h.
- remove special handling of xen_shm. we can always grab
machine address from pte.
 1.11.4.1 29-Apr-2005  kent sync with -current
 1.12.2.3 03-Sep-2007  yamt sync with head.
 1.12.2.2 26-Feb-2007  yamt sync with head.
 1.12.2.1 30-Dec-2006  yamt sync with head.
 1.13.22.2 10-Dec-2006  yamt sync with head.
 1.13.22.1 22-Oct-2006  yamt sync with head
 1.13.20.1 18-Nov-2006  ad Sync with head.
 1.15.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.16.12.1 03-Oct-2007  garbled Sync with HEAD
 1.16.6.1 11-Jul-2007  mjf Sync with head.
 1.16.4.1 29-Apr-2007  ad Replace another simplelock.
 1.17.10.1 06-Nov-2007  matt sync with HEAD
 1.18.20.3 19-Aug-2009  yamt sync with head.
 1.18.20.2 04-May-2009  yamt sync with head.
 1.18.20.1 16-May-2008  yamt sync with head.
 1.18.18.2 04-Jun-2008  yamt sync with head
 1.18.18.1 18-May-2008  yamt sync with head.
 1.18.16.4 17-Jan-2009  mjf Sync with HEAD.
 1.18.16.3 28-Sep-2008  mjf Sync with HEAD.
 1.18.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.18.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.20.2.2 03-Jul-2008  simonb Sync with head.
 1.20.2.1 27-Jun-2008  simonb Sync with head.
 1.23.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.23.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.24.2.3 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.24.2.2 01-Nov-2009  jym Sync with HEAD.
 1.24.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.31.6.3 06-Mar-2012  mrg sync to -current
 1.31.6.2 06-Mar-2012  mrg sync to -current
 1.31.6.1 04-Mar-2012  mrg sync to latest -current.
 1.31.2.1 17-Apr-2012  yamt sync with head
 1.32.16.3 28-Aug-2017  skrll Sync with HEAD
 1.32.16.2 05-Dec-2016  skrll Sync with HEAD
 1.32.16.1 06-Jun-2015  skrll Sync with HEAD
 1.32.2.1 03-Dec-2017  jdolecek update from HEAD
 1.33.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.35.2.2 16-Jul-2017  cherry 2739767
 1.35.2.1 16-Jul-2017  cherry file isa_machdep.c was added on branch perseant-stdc-iso10646 on 2017-07-16 06:14:24 +0000
 1.38.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.38.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.38.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.39.2.1 10-Jun-2019  christos Sync with HEAD
 1.44.10.1 12-Apr-2020  bouyer Get rid of xen-specific ci_x* interrupt handling:
- use the general SIR mechanism, reserving 3 more slots for IPL_VM, IPL_SCHED
and IPL_HIGH
- remove specific handling from C sources, or change to ipending
- convert IPL number to SIR number in various places
- Remove XUNMASK/XPENDING in assembly or change to IUNMASK/IPENDING
- remove Xen-specific ci_xsources, ci_xmask, ci_xunmask, ci_xpending from
struct cpu_info
- for now remove a KASSERT that there are no pending interrupts in
idle_block(). We can get there with some software interrupts pending
in autoconf XXX needs to be looked at.
 1.4 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.3 07-Jan-2025  jakllsch Only use FADT Century byte if it targets a valid 146818 NVRAM location.

Should fix PR 57821.
 1.2 30-Dec-2022  jakllsch branches: 1.2.6;
Honor ACPI FADT Century byte; should fix many "unknown CMOS layout" messages.
 1.1 16-Jun-2009  bouyer branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12; 1.1.102;
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.
 1.1.102.2 09-May-2025  martin Pull up following revision(s) (requested by sborrill in ticket #1105):

sys/arch/x86/isa/rtc.c: revision 1.3

Only use FADT Century byte if it targets a valid 146818 NVRAM location.

Should fix PR 57821.
 1.1.102.1 13-Jan-2023  martin Pull up following revision(s) (requested by jakllsch in ticket #46):

sys/arch/x86/isa/rtc.c: revision 1.2

Honor ACPI FADT Century byte; should fix many "unknown CMOS layout" messages.
 1.1.12.2 21-Apr-2010  matt sync to netbsd-5
 1.1.12.1 16-Jun-2009  matt file rtc.c was added on branch matt-nb5-mips64 on 2010-04-21 00:33:46 +0000
 1.1.6.2 01-Nov-2009  jym Sync with HEAD.
 1.1.6.1 16-Jun-2009  jym file rtc.c was added on branch jym-xensuspend on 2009-11-01 13:58:16 +0000
 1.1.4.2 20-Jun-2009  yamt sync with head
 1.1.4.1 16-Jun-2009  yamt file rtc.c was added on branch yamt-nfs-mp on 2009-06-20 07:20:12 +0000
 1.1.2.2 19-Jun-2009  snj Pull up following revision(s) (requested by bouyer in ticket #816):
sys/arch/amd64/conf/files.amd64: revision 1.68
sys/arch/i386/conf/files.i386: revision 1.350
sys/arch/x86/include/rtc.h: revision 1.1
sys/arch/x86/isa/clock.c: revision 1.33
sys/arch/x86/isa/rtc.c: revision 1.1
sys/arch/xen/conf/files.xen: revision 1.100
sys/arch/xen/xen/clock.c: revision 1.50 via patch
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.
 1.1.2.1 16-Jun-2009  snj file rtc.c was added on branch netbsd-5 on 2009-06-19 21:22:11 +0000
 1.2.6.1 02-Aug-2025  perseant Sync with HEAD

RSS XML Feed