Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/macppc/dev/kauai.c
RevisionDateAuthorComments
 1.42  20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.41  05-Mar-2021  rin Convert to intr_establish_xname().
 1.40  03-Sep-2018  riastradh branches: 1.40.12;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.39  01-Mar-2018  macallan branches: 1.39.2; 1.39.4;
match K2 UATA, found in some G5
 1.38  20-Oct-2017  jdolecek move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)

on topic of PR kern/52606
 1.37  07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.36  15-Jul-2016  macallan branches: 1.36.4;
adjust to dbdma changes
 1.35  29-Mar-2014  christos branches: 1.35.6; 1.35.10;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.34  28-Apr-2013  macallan branches: 1.34.4;
make this work on G5
from Phileas Fogg, interrupt fixup from me
 1.33  31-Jul-2012  bouyer branches: 1.33.2;
Apply back changes that were reverted on Jul 24 and Jul 26 (general ata/wdc
cleanup and SATA PMP support), now that I'm back to fix the fallouts.
 1.32  26-Jul-2012  jakllsch Revert, with intention of restoring in a less invasive way, the SATA Port
Multiplier code.

ok christos@
 1.31  24-Jul-2012  jakllsch Revert dsl@'s changes of Sun, 15 Jul 2012 10:55:35 +0000 and
Sun, 15 Jul 2012 10:56:50 +0000, excepting the kernel version bump.
First step in reverting regressions to ata(4) subsystem during the addition of
port multiplier support.
 1.30  15-Jul-2012  dsl Some namespace protection (and add greppablity).
Prefix the DRIVE_ and DRIVET_ constants from atavar.h with ATA_.
Don't use an enum for drive_type - you don't know how big it will be.
Move driver_type to avoid implicit structure padding (esp on arm).
This change is purely lexical and mechanical.

Update to 6.99.9 - this wasn't done when the SATA PMP changes
were made - I'm sure they warranted a bump.
 1.29  02-Jul-2012  bouyer Add sata Port MultiPlier (PMP) support to the ata bus layer,
as described in
http://mail-index.netbsd.org/tech-kern/2012/06/23/msg013442.html
PMP support in integrated to the atabus layer.
struct ata_channel's ch_drive[] is not dynamically allocated, and ch_ndrive
(renamed to ch_ndrives) closely reflects the size of the ch_drive[] array.
Add helper functions atabus_alloc_drives() and atabus_free_drives()
to manage ch_drive[]/ch_ndrives.
Add wdc_maxdrives to struct wdc_softc so that bus front-end can specify
how much drive they really support (master/slave or single).
ata_reset_drive() callback gains a uint32_t *sigp argument which,
when not NULL, will contain the signature of the device being reset.
While there, some cosmetic changes:
- added a drive_type enum to ata_drive_datas, and stop encoding the
probed drive type in drive_flags (we were out of drive flags anyway).
- rename DRIVE_ATAPIST to DRIVE_ATAPIDSCW to better reflect what this
really is
- remove ata_channel->ata_drives, it's redundant with the pointer in
ata_drive_datas
- factor out the interpretation of SATA signatures in sata_interpet_sig()

propagate these changes to the ATA HBA drivers, and add support for PMP
to ahcisata(4) and siisata(4).

Thanks to:
- Protocase (http://www.protocase.com/) which provided a system
with lots of controllers, SATA PMP and drive slots
- Conservation Genomics Laboratory, Department of Biology, New Mexico State
University for hosting the above system
- Brook Milligan, who set up remote access and has been very responsive
when SATA cable move was needed
 1.28  01-Jul-2011  dyoung branches: 1.28.2;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.27  18-Nov-2009  dyoung wdcactivate() is gone, don't use it.
 1.26  28-Jul-2008  macallan Fix remaining register offset shifting left over from proper bus_space-ification
done a while ago. From Marco Trillo.
This should fix PR 39176.
 1.25  02-Jul-2008  macallan branches: 1.25.2;
actually initialize sc_dmacmd and get rid of getnodebypci() - use
pcidev_to_ofdev() instead
noticed by Marco Trillo, tested on my iBook G4
 1.24  25-May-2008  chs branches: 1.24.2;
recognize the variant found in the last model of powermac G5.
 1.23  18-Mar-2008  cube branches: 1.23.2; 1.23.4; 1.23.6;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.22  25-Feb-2008  matt Convert to prototypes, de'__P, use device_private, switch to aprint_*,
make things static, and some minor constification.
 1.21  17-Oct-2007  garbled branches: 1.21.12; 1.21.16;
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.20  25-Jun-2007  aymeric branches: 1.20.8; 1.20.10; 1.20.12; 1.20.14;
Recognize the Intrepid2 ATA controller. Needed at least for the last PB G4
 1.19  16-Jan-2006  bouyer branches: 1.19.28; 1.19.30; 1.19.36;
properly use ata_channel->ch_ndrive:
- initialize it properly in the bus front-ends (all 2, exept in wdc_pcmcia.c
for the "Sandisk CompactFlash Card" where it's set to 1)
- remplace hardcoded '2' by ata_channel->ch_ndrive in MI IDE drivers.

From Christos Zoulas in kern/32501.
 1.18  11-Dec-2005  christos branches: 1.18.2;
merge ktrace-lwp.
 1.17  25-Nov-2004  manu branches: 1.17.12;
For and from bouyer@: call wdc_init_shadow_reg(chp) only after chp has
been initialized. Cause the hard disk to be detected again on the iBook G4,
and probably other machines.

Weee, I can run -current again!
 1.16  20-Aug-2004  thorpej Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
 1.15  14-Aug-2004  thorpej - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
ata_channel. Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
maximum number of drives that can be present on the channel. For now,
this is always 2. Add an ATA_MAXDRIVES constant that places an upper
limit on this value, also currently 2.
 1.14  13-Aug-2004  thorpej Don't bother with bits that tell of the presence of optional callbacks;
just check the function pointers for NULL.
 1.13  25-May-2004  thorpej Add the notion of "shadow registers" to the wdc driver. These shadow
registers are registers that overlap with others on many controllers, but
which may actually be distinct on some controllers. Right now, the two
shadows are:

- wd_status (usually overlaps wd_command)
- wd_features (usually overlaps wd_error)

Add a new helper function, wdc_init_shadow_regs(), used to initialize
the shadow register handles on controllers where they do actually overlap.

Partially from Jordan Rhody @ Wasabi Systems, Inc.
 1.12  04-Jan-2004  dbj attempt to make these compile again after recent wdc changes.
 1.11  03-Jan-2004  thorpej More wdc_channel structure member namespace cleanup:
- channel -> ch_channel
- wdc -> ch_wdc
 1.10  03-Jan-2004  thorpej Rename "struct channel_softc" to "struct wdc_channel".
 1.9  01-Jan-2004  thorpej Rename:
- wdc_xfer to ata_xfer
- channel_queue to ata_queue
and move them to <dev/ata/atavar.h> so they can be used by non-wdc ATA
controllers. Clean up the member names of these structures while at it.
 1.8  31-Dec-2003  thorpej Simplify allocation of the channel queue.
 1.7  03-Dec-2003  bouyer Adapt for new wdc regiosters array. Should fix port-macppc/23604.
 1.6  08-Oct-2003  bouyer Adapt for wdcattach() prototype change, and deal with atabus in
device_register().
 1.5  25-Sep-2003  mycroft Hide the use of config_interrupts() in one place.
 1.4  19-Sep-2003  mycroft 1) Use config_interrupts() to attach IDE and ATAPI drives. This eliminates
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
(it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
*_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
drives more quickly.
 1.3  17-Aug-2003  chs recognize the product ID used on the latest G4s.
 1.2  15-Jul-2003  lukem __KERNEL_RCSID()
 1.1  11-Jun-2003  hamajima branches: 1.1.2; 1.1.4;
Support the PowerBook G4 12-inch (and maybe 17-inch).
Kauai ATA, new obio chip, and Japanese keymap for WSDISPLAY_COMPAT_RAWKBD

I tested only 12-inch Japanese model.
 1.1.4.5  29-Nov-2004  skrll Sync with HEAD.
 1.1.4.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3  18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2  25-Aug-2004  skrll Sync with HEAD.
 1.1.4.1  03-Aug-2004  skrll Sync with HEAD
 1.1.2.3  19-Jun-2003  grant Apply patch (requested by hamajima in ticket #1323):

patch for before devsw.
 1.1.2.2  19-Jun-2003  grant Create new file from rev 1.1 (requested by hamajima in ticket #1323):

Support the PowerBook G4 12-inch (and maybe 17-inch).
Kauai ATA, new obio chip, and Japanese keymap for WSDISPLAY_COMPAT_RAWKBD
 1.1.2.1  11-Jun-2003  grant file kauai.c was added on branch netbsd-1-6 on 2003-06-19 11:18:28 +0000
 1.17.12.5  24-Mar-2008  yamt sync with head.
 1.17.12.4  27-Feb-2008  yamt sync with head.
 1.17.12.3  27-Oct-2007  yamt sync with head.
 1.17.12.2  03-Sep-2007  yamt sync with head.
 1.17.12.1  21-Jun-2006  yamt sync with head.
 1.18.2.1  01-Feb-2006  yamt sync with head.
 1.19.36.5  08-Aug-2007  macallan don't make our own bus_space_tag_t anymore
 1.19.36.4  02-Aug-2007  macallan fix some more typos - now this one works on my iBook again
 1.19.36.3  02-Aug-2007  macallan sync with HEAD
 1.19.36.2  26-Jun-2007  garbled Sync with HEAD.
 1.19.36.1  07-Jun-2007  garbled Convert macppc to powerpc bus_space. Lots of work here from Matt Thomas,
as well as the common ofwoea code from myself. Compile tested only,
still probably needs some fine tuning.

Also in this commit:
Convert macppc to new shared ofwoea routines.
Lots of KNF.
 1.19.30.1  11-Jul-2007  mjf Sync with head.
 1.19.28.2  23-Oct-2007  ad Sync with head.
 1.19.28.1  15-Jul-2007  ad Sync with head.
 1.20.14.1  25-Oct-2007  bouyer Sync with HEAD.
 1.20.12.1  18-Oct-2007  yamt sync with head.
 1.20.10.2  23-Mar-2008  matt sync with HEAD
 1.20.10.1  06-Nov-2007  matt sync with HEAD
 1.20.8.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.21.16.4  28-Sep-2008  mjf Sync with HEAD.
 1.21.16.3  02-Jul-2008  mjf Sync with HEAD.
 1.21.16.2  02-Jun-2008  mjf Sync with HEAD.
 1.21.16.1  03-Apr-2008  mjf Sync with HEAD.
 1.21.12.1  24-Mar-2008  keiichi sync with head.
 1.23.6.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.23.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.4.2  11-Mar-2010  yamt sync with head
 1.23.4.1  04-May-2009  yamt sync with head.
 1.23.2.1  04-Jun-2008  yamt sync with head
 1.24.2.2  31-Jul-2008  simonb Sync with head.
 1.24.2.1  03-Jul-2008  simonb Sync with head.
 1.25.2.1  19-Oct-2008  haad Sync with HEAD.
 1.28.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.2.1  30-Oct-2012  yamt sync with head
 1.33.2.3  03-Dec-2017  jdolecek update from HEAD
 1.33.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.2.1  23-Jun-2013  tls resync from head
 1.34.4.1  18-May-2014  rmind sync with head
 1.35.10.1  26-Jul-2016  pgoyette Sync with HEAD
 1.35.6.1  05-Oct-2016  skrll Sync with HEAD
 1.36.4.2  27-Sep-2017  jdolecek change wdc_init_shadow_regs() to accept only struct wdc_regs, it doesn't
touch anything else

factor out the probe-only struct ata_channel initialization to wdcprobe(), to
reduce duplication of logic in individual drivers, and to actually work now
that more init is needed beyond the memset()
 1.36.4.1  24-Apr-2017  jdolecek use ata_queue_alloc() to dynamically allocate ata_queue for ata channel
 1.39.4.1  10-Jun-2019  christos Sync with HEAD
 1.39.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.40.12.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed