Commit Graph

29 Commits

Author SHA1 Message Date
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Warner Losh
97eb0c3c6a Add fdt binding for nand for Atmel parts. This does little more than
match the device. Pinctrl will need to be added before this will work,
in addition to migrating the current board_foo.c method of configuring
these pins to something else. Non-FDT systems won't be affected, yet.
2014-02-28 02:38:04 +00:00
Christian Brueffer
d01195e3a9 Correct the order of arguments to mtx_init().
PR:		186701
Submitted by:	Takanori Sawada <tak.swd at gmail.com>
MFC after:	2 weeks
2014-02-14 11:18:15 +00:00
Warner Losh
90a9a51875 Generalize AT91 NAND support a bit. Be more flexible about ALE and CLE
address line assignment. Provide convenince function to set these things.
2014-01-19 17:53:51 +00:00
Warner Losh
b3a6fedaec More NAND IDs of some really old Samsung parts, also list the part
number that we're matching...
2014-01-04 22:30:18 +00:00
Warner Losh
8b96ccd4b5 Fill in some more info about the (somewhat old) Samsung parts I have
here...
2014-01-03 00:26:56 +00:00
Warner Losh
de74da330d The HOT-E HL201 has 128MB Samsung SLC NAND, ID it properly. 2014-01-03 00:17:52 +00:00
Warner Losh
e6ffadc39f Make the comment match the code. Not sure why we calculate it this
weird way, but didn't change that...
2014-01-02 02:20:10 +00:00
Warner Losh
380ff59ab1 Add support for Samsung K9F2G08U0A (256MiB SLC) NAND found on some old
Atmel boards I have.

# All Samsung, Toshiba and SanDisk parts will need to be in this table
# since they don't conform to the ONFI specification (they are all Toggle
# parts). There's some standards for the additional bytes so there's some hope
# to decode them automatically on a per-vendor basis, but even that has
# problems (and is what motivated the ONFI parameter page).
2013-12-31 07:36:39 +00:00
Ian Lepore
f32d80bf1f Add a nand flash controller driver for Atmel at91 family. Tested only
on at91rm9200 so far.

The files.at91 has listed a nand driver for ages, but it never existed.
2013-12-02 03:52:40 +00:00
Ian Lepore
ff00fd81aa Look up a nand chip by id in the static table before trying to obtain
ONFI parameters.  This allows a static table entry to provide valid data
for chips known to provide invalid ONFI data.
2013-11-29 14:23:22 +00:00
Grzegorz Bernacki
364871328e Unbreak compilation with GCC. 2013-11-21 09:19:14 +00:00
Grzegorz Bernacki
8e16e025ac Split raw reading/programming into smaller chunks to avoid allocating too
big chunk of kernel memory. Validate size of data. Add error handling to
avoid calling copyout() when data has not been read correctly.

Reviewed by:    zbb
Reported by:    x90c <geinblues@gmail.com>
MFC after:      2 days
2013-11-20 11:10:23 +00:00
Ian Lepore
774b082ca9 Rework the routine that returns a pointer to the table of software ECC
byte positions within the OOB area to support chips with unusual OOB
sizes such as 218 or 224 bytes.

The table for 128 byte OOB works for these but it assumes 3 bytes of ECC
per 256 byte block, and in the case of an ONFI chip the params page may
ask for something different.  In other words, this is better but not
yet perfect.
2013-11-15 23:48:51 +00:00
Ian Lepore
8fad47e60f Move the luns field to the end of the struct, for serendipitous packing.
(I was supposed to do this before committing it initially.)
2013-11-15 23:45:13 +00:00
Ian Lepore
c3c04faa3a ONFI parameters are little-endian, hence we must take care to convert them
to native endianness.  We must also pay attention to unaligned accesses.

Copy the interesting parameters to a new struct so the rest of the code can
forget about these problems.

Submitted by:	Kristof Provost <kristof@sigsegv.be> (cleanup) and me (orig).
2013-11-15 23:41:32 +00:00
Ian Lepore
1b45c6cd53 Search for and validate the ONFI params as specified in the standard.
The ONFI spec states that at least two bytes of the signature ("ONFI")
must be present, and the CRC must be correct to have a valid parameter
page.  If the page is not valid there are at least two backup pages where
the data can also be found.

Submitted by:	Kristof Provost <kristof@sigsegv.be> (cleanup) and me (orig).
2013-11-15 23:37:33 +00:00
Ian Lepore
7aa6428bc6 Update the onfi_params struct to ONFI revision 3.2 (06 12 2013).
Submitted by:	Kristof Provost <kristof@sigsegv.be> (cleanup) and me (orig).
2013-11-15 23:35:10 +00:00
Ian Lepore
1337b92635 The vendor specified field is 88 bytes, not 8 bytes.
Submitted by:	Kristof Provost <kristof@sigsegv.be>
2013-11-15 23:31:39 +00:00
Ruslan Bukin
8a57d93d59 o Add ONFI signature check.
o Add Micron chip found in Freescale Vybrid Family
  Phytec COSMIC board.

Approved by:	cognet (mentor)
2013-11-09 18:46:11 +00:00
Alexander Motin
ce4bc82d19 Use direct custom implementations instead of g_handleattr() for CFI and NAND
d_getattr().  Since these drivers use disk(9) KPI and not directly GEOM, use
of that function means KPI layering violation, causing extra g_io_deliver()
call for the request.
2013-06-12 12:51:43 +00:00
Grzegorz Bernacki
0242992132 Fix ONFI chip detection.
Submitted by:	Alexander Fedorov <alexander.fedorov@rtlservice.com>
2013-05-27 06:24:31 +00:00
Ian Lepore
af66b223de Add the chip used in recent GlobalScale Technologies *Plug computers
Approved by:	cognet (mentor)
2013-01-27 00:16:36 +00:00
Konstantin Belousov
5050aa86cf Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the
filesystem module, remove the VFS_LOCK_GIANT() and related
macros. Stop handling buffers belonging to non-mpsafe filesystems.

The VFS_VERSION is bumped to indicate the interface change which does
not result in the interface signatures changes.

Conducted and reviewed by:	attilio
Tested by:	pho
2012-10-22 17:50:54 +00:00
Marcel Moolenaar
7c45c9e4b5 Add a driver for the Freescale FCM module in the localbus controller.
This driver does not yet handle multiple chip selects properly.

Note that the NAND infrastructure does not perform full page
reads or writes, which means that this driver cannot make use
of the hardware ECC that is otherwise present.
2012-07-03 01:00:29 +00:00
Takanori Watanabe
ab25c078af Add nand core module and module dependency information.
Reviewed by:gber
2012-06-26 18:08:03 +00:00
Grzegorz Bernacki
7f725bcd5c Import work done under project/nand (@235533) into head.
The NAND Flash environment consists of several distinct components:
  - NAND framework (drivers harness for NAND controllers and NAND chips)
  - NAND simulator (NANDsim)
  - NAND file system (NAND FS)
  - Companion tools and utilities
  - Documentation (manual pages)

This work is still experimental. Please use with caution.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-17 10:11:18 +00:00