Commit Graph

27 Commits

Author SHA1 Message Date
Davide Italiano
2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Ian Lepore
add35ed5b8 Follow r261352 by updating all drivers which are children of simplebus
to check the status property in their probe routines.

Simplebus used to only instantiate its children whose status="okay"
but that was improper behavior, fixed in r261352.  Now that it doesn't
check anymore and probes all its children; the children all have to
do the check because really only the children know how to properly
interpret their status property strings.

Right now all existing drivers only understand "okay" versus something-
that's-not-okay, so they all use the new ofw_bus_status_okay() helper.
2014-02-02 19:17:28 +00:00
Nathan Whitehorn
11dc3f01ec Set BUS_PROBE_NOWILDCARD on this attachment as a stopgap. Unconditionally
poking at registers in unknown devices is not the best probe mechanism.
This should be reverted and a better solution found later.
2013-10-22 14:10:00 +00:00
Brooks Davis
1a440eb2c0 MFP4: 1136252
Add an option ATSE_CFI_HACK to allow memory mapped CFI devices to have
their address range allocated sharable so that atse(4) can find it's
Ethernet address in the expected location.

We intend to remove this hack once the BERI platform has a loader.
2013-10-18 20:52:42 +00:00
Brooks Davis
f43581345b MFP4 217312, 222008, 222052, 222053, 222673, 231484, 231491, 231565, 570643
Rework the timeout code to use actual time rather than a DELAY() loop and
to use both typical and maximum to allow logging of timeout failures.
Also correct the erase timeout, it is specified in milliseconds not
microseconds like the other timeouts.  Do not invoke DELAY() between
status queries as this adds significant latency which in turn reduced
write performance substantially.

Sanity check timeout values from the hardware.

Implement support for buffered writes (only enabled on Intel/Sharp parts
for now).  This yields an order of magnitude speedup on the 64MB Intel
StrataFlash parts we use.

When making a copy of the block to modify, also keep a clean copy around
until we are ready to commit the block and use it to avoid unnecessary
erases.  In the non-buffer write case, also use it to avoid
unnecessary writes when the block has not been erased.  This yields a
significant speedup when doing things like zeroing a block.

Sponsored by:	DARPA, AFRL
Reviewed by:	imp (previous version)
2013-09-04 17:19:21 +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
Brooks Davis
5faf6ff4cc MFP4 @217311
Intel and Sharp flash power on with their blocks in a "locked" state.
Unlocked them before attempting to perform an erase or write action and
relock when the action is complete.
2013-05-30 01:22:50 +00:00
Brooks Davis
444e780150 MFP4 @222836
Add support for partitioning CFI disks from FDT using geom_flashmap.

Sponsored by:	DARPA, AFRL
2013-05-30 01:19:02 +00:00
Brooks Davis
c88b210b20 MFP4 change 222060:
On Intel devices, put the Factory PPR in kenv.  On some FPGA boards it may
be the only software accessable unique ID.

Sponsored by:	DARPA, AFRL
2013-04-30 18:48:11 +00:00
Brooks Davis
b3caab66ad MFP4 changes 222065 and 222068:
Add a simplebus attachment for cfi(4)'s FDT support and move
cfi_bus_fdt.c to sys/conf/files so non-ppc architectures are supported.

Sponsored by:	DARPA, AFRL
2013-04-30 18:33:29 +00:00
Brooks Davis
3b6e39d445 MFP4 change 217313 and part of 222068:
Add a simple nexus attachment for cfi(4).
2013-04-03 22:37:40 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +00:00
Jayachandran C.
9c1f1330d6 CFI fixes for big endian archs.
The flash commands and responses are little-endian and have to be
byte swapped on big-endian systems.  However the raw read of data
need not be swapped.

Make the cfi_read and cfi_write do the swapping, and provide a
cfi_read_raw which does not byte swap for reading data from
flash.
2012-03-27 15:13:12 +00:00
Attilio Rao
dc6dc1f573 Merge r221614,221696,221737,221840 from largeSMP project branch:
Rewrite atomic operations for powerpc in order to achieve the following:
- Produce a type-clean implementation (in terms of functions arguments
  and returned values) for the primitives.
- Fix errors with _long() atomics where they ended up with the wrong
  arguments to be accepted.
- Follow the sys/type.h specifics that define the numbered types starting
  from standard C types.
- Let _ptr() version to not auto-magically cast arguments, but leave
  the burden on callers, as _ptr() atomic is intended to be used
  relatively rarely.

Fix cfi in order to support the latest point.

In collabouration with:	bde
Tested by:		andreast, nwhitehorn, jceel
MFC after:		2 weeks
2011-05-22 20:55:54 +00:00
Rafal Jaworowski
d1d3233ebd Convert Freescale PowerPC platforms to FDT convention.
The following systems are affected:

  - MPC8555CDS
  - MPC8572DS

This overhaul covers the following major changes:

  - All integrated peripherals drivers for Freescale MPC85XX SoC, which are
    currently in the FreeBSD source tree are reworked and adjusted so they
    derive config data out of the device tree blob (instead of hard coded /
    tabelarized values).

  - This includes: LBC, PCI / PCI-Express, I2C, DS1553, OpenPIC, TSEC, SEC,
    QUICC, UART, CFI.

  - Thanks to the common FDT infrastrucutre (fdtbus, simplebus) we retire
    ocpbus(4) driver, which was based on hard-coded config data.

Note that world for these platforms has to be built WITH_FDT.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-07-11 21:08:29 +00:00
Warner Losh
f3a36f8193 Move from using devclass_find_free_unit(cfi_diskclass, 0) to -1, since
they have the same basic behavior.
2009-06-10 17:41:24 +00:00
Sam Leffler
7bed4560f3 choose the size of the last region for d_stripsize instead of the first;
this fixes geom_redboot on boards that have multiple parts/regions as it
uses the value to locate the FIS directory which is in the last erase
region of flash
2009-03-10 22:29:42 +00:00
Sam Leffler
f2c6781bfd Add cfid, a disk interface to CFI flash devices; this enables construction
of flash-based filesystems.

Note this is not interlocked against the raw CFI device.
2009-03-09 23:16:02 +00:00
Sam Leffler
30b00c24b0 fix whitespace 2009-02-17 23:43:17 +00:00
Sam Leffler
26b3568c2f fix typo
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-02-08 20:29:37 +00:00
Sam Leffler
9313bae41d fix building w/o CFI_ARMEDANDDANGEROUS 2009-02-07 05:32:19 +00:00
Sam Leffler
bd8c9fc04d expand CFI_ARMEDANDDANGEROUS to include writing the user segment
of the PR; this register is actually write-once so deserves the
safety-belt as much as the PLR
2009-02-07 05:03:25 +00:00
Sam Leffler
63425a7f25 Add support for frobbing Intel StrataFlash Protection Registers:
o add CFI_SUPPORT_STRATAFLASH compile option to enable support
o add new ioctls to get/set the factory and user/oem segments of the PR
  and to get/set Protection Lock Register that fuses the user segment
o add #defines for bits in the status register
o update cfi_wait_ready to take an offset so it can be used to wait for
  PR write completion and replace constants w/ symbolic names

Note: writing the user segment isn't correct; committing now to get review.

Sponsored by:	Carlson Wireless
Reviewed by:	imp, Chris Anderson
2009-02-05 18:12:07 +00:00
Sam Leffler
8313510315 add Roel's copyright as he did the initial version 2009-02-03 19:21:15 +00:00
Sam Leffler
e73090b5d3 honor any interface width (e.g. setup by the bus shim) and don't probe;
this is needed for the moment to workaround bus shim issues
2009-02-03 19:09:16 +00:00
Sam Leffler
3a114d1f92 reorg ioctl code to simplify adding new requests 2009-02-03 19:07:41 +00:00
Marcel Moolenaar
e00251b7ed Add a driver for flash memory that implements to the Common Flash
Memory Interface (CFI). The flash memory can be read and written
to through /dev/cfi# and an ioctl() exists so processes can read
the query information.
The driver supports the AMD and Intel command set, though only
the AMD command has been tested.

Obtained from:	Juniper Networks, Inc.
2008-10-25 06:18:12 +00:00