summaryrefslogtreecommitdiffstats
path: root/sys/isa
Commit message (Collapse)AuthorAgeFilesLines
* Rename statclock_disable variable to atrtcclock_disable that it actually is,mav2009-05-032-0/+28
| | | | | | | | | | | | | and hide it inside of atrtc driver. Add new tunable hint.atrtc.0.clock controlling it. Setting it to 0 disables using RTC clock as stat-/ profclock sources. Teach i386 and amd64 SMP platforms to emulate stat-/profclocks using i8254 hardclock, when LAPIC and RTC clocks are disabled. This allows to reduce global interrupt rate of idle system down to about 100 interrupts per core, permitting C3 and deeper C-states provide maximum CPU power efficiency.
* Add resume methods to i8254 and atrtc devices.mav2009-05-011-2/+8
|
* Allow syscons to work on amd64 and i386 without any hints:jhb2009-03-051-3/+7
| | | | | | | | - Enable keyboard autodetection by default for ISA syscons attachments. - If there are no syscons hints at all, assume there is a single sc0 device anyway. The console probe will still fail unless a VGA adapter is found. MFC after: 2 weeks
* Allow device hints to wire the unit numbers of devices.jhb2008-11-184-103/+149
| | | | | | | | | | | | | | | | | | | | - An "at" hint now reserves a device name. - A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When determining the unit number of a device, this method is invoked to let the bus driver specify the unit of a device given a specific devclass. This is the only way a device can be given a name reserved via an "at" hint. - Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers. Both of these busses implement this by comparing the resources for a given hint device with the resources enumerated by ACPI/PnPBIOS and wire a unit if the hint resources are a subset of the "real" resources. - Use bus_hinted_children() for adding hinted devices on isa(4) busses now instead of doing it by hand. - Remove the unit kludging from sio(4) as it is no longer necessary. Prodding from: peter, imp OK'd by: marcel MFC after: 1 month
* MFp4:imp2008-11-024-5/+32
| | | | | | Make the ISA bus keep track of more PNP details. Plus a minor style fix while I'm here. More could be done here, but except for some SBCs that don't have ACPI, there's limited value to anybody in doing so.
* MFp4 (my newcard tree):imp2008-08-242-55/+0
| | | | | ISACFGATTR_MULTI is unused. Retire it, and a function that has no side effects used to compute it.
* atrtc.c is a repocopy of the RTC device driver from i386/isa/clock.cphk2008-04-142-599/+40
| | | | | In addition to the device driver functionality, it exposes a number of functions which various other bits of code use to fondle the RTC chip.
* Move i386 to generic RTC handling code.phk2008-04-121-103/+168
| | | | | | | | | | | | | | | | | | | | | | | | Make clock_if.m and subr_rtc.c standard on i386 Add hints for "atrtc" driver, for non-PnP, non-ACPI systems. NB: Make sure to install GENERIC.hints into /boot/device.hints in these! Nuke MD inittodr(), resettodr() functions. Don't attach to PHP0B00 in the "attimer" dummy driver any more, and remove comments that no longer apply for that reason. Add new "atrtc" device driver, which handles IBM PC AT Real Time Clock compatible devices using subr_rtc and clock_if. This driver is not entirely clean: other code still fondles the hardware to get a statclock interrupt on non-ACPI timer systems. Wrap some overly long lines. After it has settled in -current, this will be ported to amd64. Technically this is MFC'able, but I fail to see a good reason.
* Back in the good old days, PC's had random pieces of rock forphk2008-03-261-122/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | frequency generation and what frequency the generated was anyones guess. In general the 32.768kHz RTC clock x-tal was the best, because that was a regular wrist-watch Xtal, whereas the X-tal generating the ISA bus frequency was much lower quality, often costing as much as several cents a piece, so it made good sense to check the ISA bus frequency against the RTC clock. The other relevant property of those machines, is that they typically had no more than 16MB RAM. These days, CPU chips croak if their clocks are not tightly within specs and all necessary frequencies are derived from the master crystal by means if PLL's. Considering that it takes on average 1.5 second to calibrate the frequency of the i8254 counter, that more likely than not, we will not actually use the result of the calibration, and as the final clincher, we seldom use the i8254 for anything besides BEL in syscons anyway, it has become time to drop the calibration code. If you need to tell the system what frequency your i8254 runs, you can do so from the loader using hw.i8254.freq or using the sysctl kern.timecounter.tc.i8254.frequency.
* Further cleanup of sound generation in syscons:phk2008-03-261-9/+1
| | | | | | | | The timer_spkr_*() functions take care of the enabling/disabling of the speaker. Test on the existence of timer_spkr_*() functions, rather than architectures.
* The "free-lance" timer in the i8254 is only used for the speakerphk2008-03-262-37/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | these days, so de-generalize the acquire_timer/release_timer api to just deal with speakers. The new (optional) MD functions are: timer_spkr_acquire() timer_spkr_release() and timer_spkr_setfreq() the last of which configures the timer to generate a tone of a given frequency, in Hz instead of 1/1193182th of seconds. Drop entirely timer2 on pc98, it is not used anywhere at all. Move sysbeep() to kern/tty_cons.c and use the timer_spkr*() if they exist, and do nothing otherwise. Remove prototypes and empty acquire-/release-timer() and sysbeep() functions from the non-beeping archs. This eliminate the need for the speaker driver to know about i8254frequency at all. In theory this makes the speaker driver MI, contingent on the timer_spkr_*() functions existing but the driver does not know this yet and still attaches to the ISA bus. Syscons is more tricky, in one function, sc_tone(), it knows the hz and things are just fine. In the other function, sc_bell() it seems to get the period from the KDMKTONE ioctl in terms if 1/1193182th second, so we hardcode the 1193182 and leave it at that. It's probably not important. Change a few other sysbeep() uses which obviously knew that the argument was in terms of i8254 frequency, and leave alone those that look like people thought sysbeep() took frequency in hertz. This eliminates the knowledge of i8254_freq from all but the actual clock.c code and the prof_machdep.c on amd64 and i386, where I think it would be smart to ask for help from the timecounters anyway [TBD].
* Rename timer0_max_count to i8254_max_count.phk2008-03-262-50/+51
| | | | | Rename timer0_real_max_count to i8254_real_max_count and make it static. Rename timer_freq to i8254_freq and make it a loader tunable.
* The RTC related pscnt and psdiv variables have no business being public.phk2008-03-261-2/+2
|
* Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY().jhb2008-01-171-0/+1
| | | | MFC after: 1 week
* Replace explicit calls to video methods with their respective variantswkoszek2007-12-291-6/+4
| | | | | | | | | | | | | | | implemented with macros. This patch improves code readability. Reasoning behind vidd_* is a sort of "video discipline". List of macros is supposed to be complete--all methods of video_switch ought to have their respective macros from now on. Functionally, this code should be no-op. My intention is to leave current behaviour of touched code as is. No objections: rwatson Silence on: freebsd-current@ Approved by: cognet
* Split /dev/nvram driver out of isa/clock.c for i386 and amd64. I have notpeter2007-10-261-96/+1
| | | | | | | | refactored it to be a generic device. Instead of being part of the standard kernel, there is now a 'nvram' device for i386/amd64. It is in DEFAULTS like io and mem, and can be turned off with 'nodevice nvram'. This matches the previous behavior when it was first committed.
* It seems that some i386 mothermoards either do not implement thedwmalone2007-07-271-1/+2
| | | | | | | | | | | | | | | | | | day of week field correctly, or they remember bad values that are written into the day of week field. For this reason, ignore the day of week field when reading the clock on i386 rather than bailing if it is set incorrectly. Problems were seen on a number of platforms, including VMWare, qemu, EPIA ME6000, Epox-3PTA and ABIT-SL30T. This is a slightly different fix to that proposed by Ted in his PR, but the same basic idea. PR: 111117 Submitted by: Ted Faber <faber@lunabase.org> Approved by: re (rwatson) MFC after: 3 weeks
* If clock_ct_to_ts fails to convert time time from the real time clock,dwmalone2007-07-231-3/+6
| | | | | | | | | print a one line error message. Add some comments on not being able to trust the day of week field (I'll act on these comments in a follow up commit). Approved by: re MFC after: 3 weeks
* Prototype (but functional) Linux-ish /dev/nvram interface to the extrapeter2007-06-151-0/+99
| | | | | | | | | | | | 114 bytes of cmos ram in the PC clock chip. The big difference between this and the Linux version is that we do not recalculate the checksums for bytes 16..31. We use this at work when cloning identical machines - we can copy the bios settings as well. Reading /dev/nvram gives 114 bytes of data but you can seek/read/write whichever bytes you like. Yes, this is a "foot, gun, fire!" type of device.
* Despite several examples in the kernel, the third argument ofdwmalone2007-06-041-1/+1
| | | | | | | | | | | | | sysctl_handle_int is not sizeof the int type you want to export. The type must always be an int or an unsigned int. Remove the instances where a sizeof(variable) is passed to stop people accidently cut and pasting these examples. In a few places this was sysctl_handle_int was being used on 64 bit types, which would truncate the value to be exported. In these cases use sysctl_handle_quad to export them and change the format to Q so that sysctl(1) can still print them.
* When trying to allocate a PnP BIOS memory resource, the code loops tryingjhb2007-04-171-1/+1
| | | | | | | to move up the start address until the allocation succeeds. If the alignment of the resource was 0, then the code would keep trying the same request in an infinite loop and hang. Force the request to always move start up by at least 1 byte each time through the loop.
* Partial fix for a bug in rev.1.231. If suspend/resume clobbers thebde2007-03-051-0/+1
| | | | | | | | | | | | | | | | | RTC state, then it may clobber the RTC index register, so the index register must be restored before using it to restore control registers in rtc_restore(). The following problems remain: - rtc_restore() is only called if pmtimer is configured. Buggy suspend/resumes are more likely to clobber the index register than a control register, so pmtimer is more needed than it used to be. - pmtimer doesn't exist for amd64. - Restoring of the RTC state may race with rtcintr(). If an RTC interrupt is handled before the state is restored, then rtcin(RTC_INTR) in rtcintr() may read from the wrong register, so rtcintr() may spin forever. This may be mitigated by the most common state clobbering being to turn off RTC interrupts.
* style(9).nyan2007-03-041-2/+2
|
* Use pause() rather than tsleep() on explicit global dummy variables.jhb2007-02-271-2/+1
|
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-232-7/+10
| | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
* Cleaned up declaration and initialization of clock_lock. It is onlybde2007-01-231-13/+10
| | | | | | | | | | | | | | | | | | | | used by clock code, so don't export it to the world for machdep.c to initialize. There is a minor problem initializing it before it is used, since although clock initialization is split up so that parts of it can be done early, the first part was never done early enough to actually work. Split it up a bit more and do the first part as late as possible to document the necessary order. The functions that implement the split are still bogusly exported. Cleaned up initialization of the i8254 clock hardware using the new split. Actually initialize it early enough, and don't work around it not being initialized in DELAY() when DELAY() is called early for initialization of some console drivers. This unfortunately moves a little more code before the early debugger breakpoint so that it is harder to debug. The ordering of console and related initialization is delicate because we want to do as little as possible before the breakpoint, but must initialize a console.
* Be consistent with the spelling of "dependent" in user-visible places.ceri2006-12-301-1/+1
| | | | | PR: kern/27429 Submitted by: T. William Wells
* Optimized RTC accesses by avoiding null writes to the index registerbde2006-12-031-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | and by only delaying when an RTC register is written to. The delay after writing to the data register is now not just a workaround. This reduces the number of ISA accesses in the usual case from 4 to 1. The usual case is 2 rtcin()'s for each RTC interrupt. The index register is almost always RTC_INTR for this. The 3 extra ISA accesses were 1 for writing the index and 2 for delays. Some delays are needed in theory, but in practice they now just slow down slow accesses some more since almost eveyone including us does them wrong so modern systems enforce sufficient delays in hardware. I used to have the delays ifdefed out, but with the index register optimization the delays are rarely executed so the old magic ones can be kept or even implemented non- magically without significant cost. Optimizing RTC interrupt handling is more interesting than it used to be because RTC interrupts are currently needed to fix the more efficient apic timer interrupts on some systems. apic_timer_hz is normally 2000 so the RTC interrupt rate needs to be 2048 to keep the apic timer firing on such systems. Without these changes, each RTC interrupt normally took 10 ISA accesses (2 PIC accesses and 2 sets of 4 RTC accesses). Each ISA access takes 1-1.5uS so 10 of then at 2048 Hz takes 2-3% of a CPU. Now 4 of them take 0.8-1.2% of a CPU.
* Use calendaric calculation support from subr_clock.c instead of home-rolled.phk2006-10-021-88/+33
| | | | Eventually, this RTC should probably use subr_rtc.c as well
* Second part of a little cleanup in the calendar/timezone/RTC handling.phk2006-10-021-3/+0
| | | | | | | | | | | Split subr_clock.c in two parts (by repo-copy): subr_clock.c contains generic RTC and calendaric stuff. etc. subr_rtc.c contains the newbus'ified RTC interface. Centralize the machdep.{adjkerntz,disable_rtc_set,wall_cmos_clock} sysctls and associated variables into subr_clock.c. They are not machine dependent and we have generic code that relies on being present so they are not even optional.
* First part of a little cleanup in the calendar/timezone/RTC handling.phk2006-10-021-0/+1
| | | | | | Move relevant variables to <sys/clock.h> and fix #includes as necessary. Use libkern's much more time- & spamce-efficient BCD routines.
* Eliminate one set of XBOX #ifdefs. The Xbox code just needs to set aimp2006-08-091-9/+0
| | | | | different TIMER_FREQ value than default. Accomplish this via the config file rather than via an #ifdef.
* (apply '(lambda (reformat-region 'style-9-parens)) (read-file isahint.c))imp2006-07-081-2/+2
| | | | remove redundant parens, per style(9) to reduce that limp, lispy feeling.
* Remove old GENERIC kludge. We no longer need to skip devices namedimp2006-07-081-8/+2
| | | | | | | | | | atkbd. Version 1.162 of GENERIC fixed this problem in April of 1999. Subsequent to that, the hints data was removed from GENERIC and move to hints files. All the hints file ever created have atkbd at the right location. This should have been removed just after RELENG_4 was branched (and likely around 4.5 in RELENG_4). MFC After: 3 days
* Make the ISAPNP code optional and only enable it on i386 and pc98 (usedmarius2006-06-121-0/+6
| | | | | | | | | for CBUS-PNP cards there) by default, as there are no amd64 and sparc64 machines with ISA slots and which therefore could make use of this code known to exist. For sparc64 this additionally allows to get rid of the compat shims for in{b,w,l}()/out{b,w,l}() etc and the associated hacks. OK'ed by: imp, peter
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-122-6/+0
|
* Committed the xbox syscons(8)-able console driver.rink2006-03-031-0/+19
| | | | | Reviewed by: arch@ (no comments) Approved by: imp (mentor)
* Tweak how the MD code calls the fooclock() methods some. Instead ofjhb2005-12-221-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | passing a pointer to an opaque clockframe structure and requiring the MD code to supply CLKF_FOO() macros to extract needed values out of the opaque structure, just pass the needed values directly. In practice this means passing the pair (usermode, pc) to hardclock() and profclock() and passing the boolean (usermode) to hardclock_cpu() and hardclock_process(). Other details: - Axe clockframe and CLKF_FOO() macros on all architectures. Basically, all the archs were taking a trapframe and converting it into a clockframe one way or another. Now they can just extract the PC and usermode values directly out of the trapframe and pass it to fooclock(). - Renamed hardclock_process() to hardclock_cpu() as the latter is more accurate. - On Alpha, we now run profclock() at hz (profhz == hz) rather than at the slower stathz. - On Alpha, for the TurboLaser machines that don't have an 8254 timecounter, call hardclock() directly. This removes an extra conditional check from every clock interrupt on Alpha on the BSP. There is probably room for even further pruning here by changing Alpha to use the simplified timecounter we use on x86 with the lapic timer since we don't get interrupts from the 8254 on Alpha anyway. - On x86, clkintr() shouldn't ever be called now unless using_lapic_timer is false, so add a KASSERT() to that affect and remove a condition to slightly optimize the non-lapic case. - Change prototypeof arm_handler_execute() so that it's first arg is a trapframe pointer rather than a void pointer for clarity. - Use KCOUNT macro in profclock() to lookup the kernel profiling bucket. Tested on: alpha, amd64, arm, i386, ia64, sparc64 Reviewed by: bde (mostly)
* MFamd64 rev 1.223: Use the TSC to implement DELAY() if not marked brokenpeter2005-12-131-0/+15
| | | | and it has been calibrated.
* Fix -Wundef.ru2005-12-041-1/+1
|
* Add support for XBOX to the FreeBSD port. The xbox architecture isimp2005-11-091-0/+10
| | | | | | | | | | | | | | | | | | | | nearly identical to wintel/ia32, with a couple of tweaks. Since it is so similar to ia32, it is optionally added to a i386 kernel. This port is preliminary, but seems to work well. Further improvements will improve the interaction with syscons(4), port Linux nforce driver and future versions of the xbox. This supports the 64MB and 128MB boxes. You'll need the most recent CVS version of Cromwell (the Linux BIOS for the XBOX) to boot. Rink will be maintaining this port, and is interested in feedback. He's setup a website http://xbox-bsd.nl to report the latest developments. Any silly mistakes are my fault. Submitted by: Rink P.W. Springer rink at stack dot nl and Ed Schouten ed at fxq dot nl
* Fix an endianness issue in pnp_eisaformat(). This corrects printing PnP IDsmarius2005-09-281-1/+4
| | | | | | | | | | | | | | on big-endian archs like sparc64, e.g.: uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 43 pnpid @HEd041 on isa0 is now correctly printed as: uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 43 pnpid PNP0501 on isa0 There are probably other endianness issues lurking in the PnP code which however aren't exhibited on sparc64 as the PnP devices there are sort of PnP BIOS devices rather than ISA PnP devices. Tested on: i386, sparc64 MFC after: 1 week
* Add pnp and location info for the ISA bus. The pnp info is theimp2005-08-011-0/+25
| | | | | | | | primary vendor id for this device. The location is empty because ISA doesn't give one a way to generally locate a card. PNP BIOS entries do provide a way to locate cards, as do isa pnp cards. These locations will be added as soon as the code to remember them is written.
* Fixup some more fallout from the lapic/i8254 changes:jhb2005-07-131-24/+20
| | | | | | | | | | | | - Make sure timer0_max_count is set to a correct value in the lapic case. - Revert i8254_restore() to explicitly reprogram timer 0 rather than calling set_timer_freq() to do it. set_timer_freq() only reprograms the counter if the max count changes which it never does on resume. This unbreaks suspend/resume for several people. Tested by: marks, others Reviewed by: bde MFC after: 3 days
* Remove a || 1 that crept into the i8254 commit and was subsequentlyjhb2005-07-051-1/+1
| | | | | | | | | copied and pasted. I had actually tested without this change in my trees as had the other testers. Reported by: bde, Rostislav Krasny rosti dot bsd at gmail dot com Approved by: re (scottl) Pointy hat to: jhb
* Use a simpler implementation for the i8254 timecounter when using the lapicjhb2005-07-011-12/+35
| | | | | | | | | | timer since irq0 isn't being driven at hz in that case and we don't need to try to handle edge cases with rollover, etc. that require irq0 to be firing for the timecounter to actually work. Submitted by: phk Tested by: schweikh Approved by: re (scottl)
* - Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) sourcemarius2005-06-103-4203/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | files after they were repo-copied to sys/dev/atkbdc. The sources of atkbdc(4) and its children were moved to the new location in preparation for adding an EBus front-end to atkbdc(4) for use on sparc64; i.e. in order to not further scatter them over the whole tree which would have been the result of adding atkbdc_ebus.c in e.g. sys/sparc64/ebus. Another reason for the repo-copies was that some of the sources were misfiled, e.g. sys/isa/atkbd_isa.c wasn't ISA-specific at all but for hanging atkbd(4) off of atkbdc(4) and was renamed to atkbd_atkbdc.c accordingly. Most of sys/isa/psm.c, i.e. expect for its PSMC PNP part, also isn't ISA-specific. - Separate the parts of atkbdc_isa.c which aren't actually ISA-specific but are shareable between different atkbdc(4) bus front-ends into atkbdc_subr.c (repo-copied from atkbdc_isa.c). While here use bus_generic_rl_alloc_resource() and bus_generic_rl_release_resource() respectively in atkbdc_isa.c instead of rolling own versions. - Add sparc64 MD bits to atkbdc(4) and atkbd(4) and an EBus front-end for atkbdc(4). PS/2 controllers and input devices are used on a couple of Sun OEM boards and occur on either the EBus or the ISA bus. Depending on the board it's either the only on-board mean to connect a keyboard and mouse or an alternative to either RS232 or USB devices. - Wrap the PSMC PNP part of psm.c in #ifdef DEV_ISA so it can be compiled without isa(4) (e.g. for EBus-only machines). This ISA-specific part isn't separated into its own source file, yet, as it requires more work than was feasible for 6.0 in order to do it in a clean way. Actually philip@ is working on a rewrite of psm(4) so a more comprehensive clean-up and separation of hardware dependent and independent parts is expected to happen after 6.0. Tested on: i386, sparc64 (AX1105, AXe and AXi boards) Reviewed by: philip
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-291-2/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* - Move bus dependent defines to {isa,cbus}_dmareg.h.nyan2005-05-142-5/+56
| | | | | | - Use isa/isareg.h rather than <arch>/isa/isa.h. Tested on: i386, pc98
* - Move timerreg.h to <arch>/include and split i8253 specific defines intonyan2005-05-143-23/+15
| | | | | | | | | i8253reg.h, and add some defines to control a speaker. - Move PPI related defines from i386/isa/spkr.c into ppireg.h and use them. - Move IO_{PPI,TIMER} defines into ppireg.h and timerreg.h respectively. - Use isa/isareg.h rather than <arch>/isa/isa.h. Tested on: i386, pc98
OpenPOWER on IntegriCloud