Commit Graph

971 Commits

Author SHA1 Message Date
David van Moolenbroek
9062787e35 Retire EBADIOCTL in favor of ENOTTY
Change-Id: I6bd0e301d21ab7f2336e350e7e6e15d238c2c93d
2013-09-28 00:10:55 +02:00
David van Moolenbroek
9cb14b4a32 libnetsock: use libchardriver
Change-Id: Ia5b780cad0b0c636db9bd866c7223da0d38ef6ea
2013-09-28 00:10:55 +02:00
David van Moolenbroek
9030f602d9 LWIP: move chardev message parsing into libnetsock
Change-Id: Ie23fd003c9fa35811548f388c8e9b55e8d9de8d7
2013-09-28 00:10:54 +02:00
David van Moolenbroek
7e6fb473b5 libaudiodriver: use libchardriver
Change-Id: I299d58d110ad14b69076276ba46c4325875c34ca
2013-09-28 00:10:54 +02:00
David van Moolenbroek
c9152e5207 libchardriver: full API rewrite
The new API now covers the entire character driver protocol, while
hiding all the message details. It should therefore be used by all
new character drivers. All existing drivers that already made use of
libchardriver have been changed to use the new API.

As one of the most important API changes, support for scatter and
gather transfers has been removed, as several key drivers already
did not support this, and it could be supported at the safecopy
level instead (for a future readv/writev).

Additional changes include:

- respond to block device open requests to avoid hanging VFS threads;
- add support for sef_cancel.

Change-Id: I1bab6c1cb66916c71b87aeb1db54a9bdf171fe6b
2013-09-28 00:10:53 +02:00
David van Moolenbroek
07e307364c libutil: let opendisk(3) try /dev
If a device node is given without path, and opening the node fails
initially, prepend "/dev/" to the node name and try opening again.
This is more in line with NetBSD behavior.
2013-09-28 00:10:53 +02:00
David van Moolenbroek
fd5b12ab74 Block drivers: make IOCTL request unsigned long
The block driver protocol and libblockdriver's bdr_ioctl hook are
changed, as well as the users of this hook. Other parts of the system
are expected to change accordingly eventually, since the ioctl(2)
prototype has been aligned with NetBSD's.

Change-Id: Ide46245b22cfa89ed267a38088fb0ab7696eba92
2013-09-28 00:10:53 +02:00
David van Moolenbroek
9999124fe3 Block protocol: add user endpoint to IOCTL request
I/O control requests now come with the endpoint of the user process
that initiated the ioctl(2) call. It is stored in a new BDEV_USER
field, which is an alias for BDEV_FLAGS. The contents of this field
are to be used only in highly specific situations. It should be
preserved (not replaced!) by services that forward IOCTL requests,
and may be set to NONE for service-initiated IOCTL requests.

Change-Id: I68a01b9ce43eca00e61b985a9cf87f55ba683de4
2013-09-28 00:10:53 +02:00
David van Moolenbroek
701a6c359a libblockdriver: expose BLOCKDRIVER_MAX_DEVICES
This constant determines the range of valid device_id_t values that
a block driver can return from the bdr_device hook: a value between
0 and (BLOCKDRIVER_MAX_DEVICES - 1) inclusive.

Change-Id: I80fac469e88ac13d4b869007e6f2c2f7569da433
2013-09-28 00:10:52 +02:00
David van Moolenbroek
06d589c2fa libblockdriver: various updates
- internal structure rearrangement;
- respond to char device open requests to avoid hanging VFS threads;
- make drivers use designated initializers;
- use devminor_t for all minor device numbers;
- change bdr_other hook to take ipc_status and return nothing;
- fix default geometry computation;
- add support for sef_cancel.

Change-Id: Ia063a136a3ddb2b78de36180feda870605753d70
2013-09-28 00:10:52 +02:00
David van Moolenbroek
05d02d297e Block drivers: reply ENOTTY to unknown IOCTLs
Change-Id: Ie2e82d2491d546f4dd73b009100646e249a147b5
2013-09-28 00:10:52 +02:00
David van Moolenbroek
1cea00a2fe I2C: change BUSC_I2C_xxx to use own protocol
Previously it would use bits of the character driver protocol, which
will change heavily.  In the new situation, the BUSC_I2C_xxx requests
use a protocol more in line with the PCI protocol, with the reply code
in m_type.

Change-Id: I51597b3f191078c8178ce17372de123031f7a4c4
2013-09-28 00:10:51 +02:00
David van Moolenbroek
191e31124e libmthread: do not dump stack for free threads
Change-Id: Ic438a252f5bddaf1513f554c71173e6fffb0c674
2013-09-28 00:10:50 +02:00
David van Moolenbroek
9e2b5c667b Retire the synchronous character driver protocol
- change all sync char drivers into async drivers;
- retire support for the sync protocol in libchardev;
- remove async dev style, as this is now the default;
- remove dev_status from VFS;
- clean up now-unused protocol messages.

Change-Id: I6aacff712292f6b29f2ccd51bc1e7d7003723e87
2013-09-28 00:10:48 +02:00
Lionel Sambuc
77db0c5766 Removing CSU patches
* Removed startup code patches in lib/csu regarding kernel to userland
   ABI.

 * Aligned stack layout on NetBSD stack layout.

 * Generate valid stack pointers instead of offsets by taking into account
   _minix_kerninfo->kinfo->user_sp.

 * Refactored stack generation, by moving part of execve in two
   functions {minix_stack_params(), minix_stack_fill()} and using them
   in execve(), rs and vm.

 * Changed load offset of rtld (ld.so) to:
      execi.args.stack_high - execi.args.stack_size - 0xa00000
   which is 10MB below the main executable stack.

Change-Id: I839daf3de43321cded44105634102d419cb36cec
2013-09-28 00:10:47 +02:00
David van Moolenbroek
390c4df3cd Remove support for obsolete 3.2.1 ABI
Change-Id: I76b4960bda41f55d9c42f8c99c5beae3424ca851
2013-09-28 00:10:47 +02:00
David van Moolenbroek
f8ebd3dee4 Fix various file system warnings
Change-Id: Ied10498c3ae14f9f2fd06914f23239df330fa296
2013-09-28 00:10:46 +02:00
David van Moolenbroek
cb32cbb218 VFS/FS: replace protocol version with flag field
The main motivation for this change is that only Loris supports
multithreading, and Loris supports dynamic thread allocation, so the
number of supported threads can be implemented as a bit flag (i.e.,
either 1 or "at least as many as VFS has"). The ABI break obviates the
need to support file system versioning at this time, and several
other aspects are better implemented as flags as well. Other changes:

- replace peek/bpeek test upon mount with FS flag as well;
- mark libsffs as 64-bit file size capable;
- remove old (3.2.1) getdents support.

Change-Id: I313eace9c50ed816656c31cd47d969033d952a03
2013-09-28 00:10:46 +02:00
David van Moolenbroek
acca21faed Import NetBSD df(1)
Change-Id: I7a99e335da666a15b43b9daeb59dbfee516f0118
2013-09-28 00:10:40 +02:00
David van Moolenbroek
080c91c8a5 Enable getmntinfo(3)
Change-Id: Ida9b0660471bb9fde3cdca6c9b9fd9e94341e02f
2013-09-28 00:10:26 +02:00
David van Moolenbroek
ab703fdfdf Implement support for [f]statvfs1(2)
The [f]statvfs(3) calls now use [f]statvfs1(2).

Change-Id: I949c177fc14abf976e45165c342f897f4ec988ee
2013-09-28 00:09:54 +02:00
David van Moolenbroek
cdcbf659a1 Implement support for getvfsstat(2)
Change-Id: I99b697919d411c57105de561105beefc7d1d309a
2013-09-28 00:09:43 +02:00
David van Moolenbroek
098ec7e415 Redo mount(2)/umount(2) ABI
- pass in file system type through mount(2), and return this type in
  statvfs structures as generated by [f]statvfs(2);
- align mount flags field with NetBSD's, splitting out service flags
  which are not to be passed to VFS;
- remove limitation of mount ABI to 16-byte labels, so that labels
  can be made larger in the future;
- introduce new m11 message union type for mount(2) as side effect.

Change-Id: I88b7710e297e00a5e4582ada5243d3d5c2801fd9
2013-09-28 00:09:33 +02:00
David van Moolenbroek
c4bd0e949e Align "struct statvfs" with NetBSD
This is a requirement for implementing calls such as getmntinfo(3).
VFS is now responsible for filling in some of the structure's fields.

Change-Id: I0c1fa78019587efefd2949b3be38cd9a7ddc2ced
2013-09-28 00:09:22 +02:00
David van Moolenbroek
92f858105b VFS/FS: remove fstatfs(2) and REQ_FSTATFS
The fstatfs(3) call now uses fstatvfs(2).

Change-Id: I3fa5d31f078457b4d80418c23060bb2c148cb460
2013-09-28 00:06:01 +02:00
Lionel Sambuc
6112cea1e2 almost aligned ioctl prototype
Change-Id: I7f3eaa99d2a9767f71e8387cea5c7f56dcb28f99
2013-09-28 00:03:44 +02:00
Lionel Sambuc
29d530957e 32 to 64 bits fsblkcnt_t and fsfilcnt_t.
Change-Id: I432229143c85cd178262b802a76ac606801ac59a
2013-09-28 00:03:43 +02:00
Lionel Sambuc
730d1ea6d6 moving prototypes to lib.h
Change-Id: If53d3f5ee761b10e0f3d4346a0c5b39ba7901c65
2013-09-28 00:03:43 +02:00
Lionel Sambuc
43490dfc1d struct uucred
Change-Id: Ia97cb6c38bb566be30d568a252ae7b76142a21dd
2013-09-28 00:03:43 +02:00
Lionel Sambuc
54065af023 Alignement on netbsd types, part 1
The following types are modified (old -> new):
 * _BSD_USECONDS_T_ int       -> unsigned int
 * __socklen_t      __int32_t -> __uint32_t
 * blksize_t        uint32_t  -> int32_t
 * rlim_t           uint32_t  -> uint64_t
On ARM:
 * _BSD_CLOCK_T_    int       -> unsigned int
On Intel:
 * _BSD_CLOCK_T_    int       -> unsigned long

bin/cat is also updated in order to fix warnings.

_BSD_TIMER_T_ has still to be aligned.

Change-Id: I2b4fda024125a19901120546c4e22e443ba5e9d7
2013-09-28 00:03:42 +02:00
Lionel Sambuc
2ec49130c1 fix sysroot clang
Change-Id: I63adf8460e7fdbe3d9d5ad6c828ae5758cb1643c
2013-09-28 00:03:42 +02:00
Thomas Veerman
72b91ca301 stat.h: remove some big_ types
Change-Id: I84017db3d54edfb823cc52e02d0b07fccb003988
2013-09-28 00:02:52 +02:00
Thomas Veerman
62b10087fc Define protocol version of {mode,ino,uid,gid}_t
Change-Id: Ia2027749f2ce55a561d19eb895a5618505e9a2ac
2013-09-28 00:02:32 +02:00
Thomas Veerman
334c19a7f8 VFS-FS protocol: add versioning
Change-Id: Ice6fbfd4b535b7435653fa08b27a3378d1cfdbf8
2013-09-28 00:02:15 +02:00
Kees Jongenburger
6595e79da8 block-dev:add additional sanity check.
Change-Id: Ib5b7cd93a50726b95c2e1b4c7eeedfefc824dd9c
2013-09-26 09:06:57 +02:00
Thomas Cort
75bd3009d3 libi2cdriver: add functions for IC register access
Many i2c device drivers used similar code to access registers on
the ICs they drive. This commit implements that functionality in
libi2cdriver and updates the drivers to use the library instead of
their own register access functions. The net result is 375+ fewer
lines of code and less work for people developing new drivers.

The two exceptions were cat24c256 and parts of tda19988. They access
the bus in uncommon ways. It doesn't make sense at this time to
move their read/write functions into libi2cdriver.

Change-Id: Id8280b71af33b710a49944d7f20a7262be9f5988
2013-09-18 08:10:26 -04:00
Ben Gras
b538531449 vm: make WARNS=5 proof
Change-Id: I737ded223daf04f1c0c85a2e8e6b36c8fdcd07db
2013-09-06 11:51:20 +02:00
Thomas Cort
0a9eab0bb6 gpio: port to am335x
* port libgpio to am335x.
 * increase NR_IRQ to 16 to avoid too many IRQs requested error.
 * move gpio binary to /sbin (that's where mount looks for drivers).
 * fix bug that re-enabled banks that were disabled due to bad revision.
 * fix padconf masks for dm37xx in gpio driver (should be 16-bit).
 * fix a few typos in README.txt and comments.

Change-Id: I32374415a97135174c5224f76374a870909fa90c
2013-09-03 08:14:18 -04:00
Thomas Cort
4593804bf0 kernel: add padconf kernel call
On the AM335X, writes to the padconf registers must be done in privileged
mode. To allow userspace drivers to dynamically change the padconf at
runtime, a kernel call has been added.

Change-Id: I4b25d2879399b1785a360912faa0e90b5c258533
2013-08-28 12:53:05 -04:00
Ben Gras
c8f3b10909 fix a few more minix specific warnings
. also disable stack protection feature for gcc,
	  causes build errors for pkgsrc gcc on minix

Change-Id: I1c6e2bcb4d948098d642543d7b2711284ee55c72
2013-08-27 16:16:03 +00:00
Arne Welzel
842c4eda7f libaudiodriver: handle interrupt only once
Apparently, qemu's sb16 doesn't reset the interrupt register
of the mixer and the driver ends up in an endless loop when
playing a "multi-fragment" sample.

Change-Id: I47633b99a0d79ba201aec785da69fb3950e026bf
2013-08-20 19:42:37 +02:00
Arne Welzel
5b211ac848 libaudiodriver: allocate mem lower 16 MB and 64K aligned
Righ now, the DMA controller will access some random memory below 16 MB,
as the physical address returned by alloc_contig() is simply truncated
when given to the DMA controller.

Yes, it's bad...
2013-08-20 19:42:21 +02:00
LiQiong Lee
f0d27a9570 libminixfs: allow non-page-multiple blocksizes
. this is OK (although it wastes some memory) as
	  long as the VM interface isn't used, which has its
	  own checks in libsys

Change-Id: I28decd367b2cd5c01482bdc71615c65ab61c9a71
2013-08-20 16:19:28 +02:00
Ben Gras
6e5a113837 a bit more -Werror compatability
for clang, fix warnings in drivers/, lib/, servers/, sys/, common/.
by turning off fatal warnings (takes effect if the default is on),
fixing warnings or reducing the warning level.

Change-Id: Ia1b4bc877c879ba783158081b59aa6ebb021a50f
2013-08-20 11:37:40 +02:00
David van Moolenbroek
4cd78c64a4 libnetdriver: only block datalink messages
Previously, all incoming messages would be blocked before a DL_CONF
message arrives from the TCP/IP stack. This however makes it impossible
for a driver to process interrupts before the DL_CONF initialization.
This patch blocks only datalink messages before the initial DL_CONF,
and lets through all other messages to the driver.

Change-Id: I89988958c0bff9bb38e0379b66f6142491a67b61
2013-08-18 12:09:51 +02:00
Antoine Leca
3a0aa55040 libc: make MINIX assembly code position-independent
While here, simplify ucontext.S

	. makes libc link without the messy DT_TEXTREL warning.

Change-Id: I4656d9068eab5ed2fa1e391242883d5dd9d93644
2013-08-09 11:09:51 +02:00
David van Moolenbroek
78d707cd26 VM: support for shared call mask ACLs
The VM server now manages its call masks such that all user processes
share the same call mask. As a result, an update for the call mask of
any user process will apply to all user processes. This is similar to
the privilege infrastructure employed by the kernel, and may serve as
a template for similar fine-grained restrictions in other servers.

Concretely, this patch fixes the problem of "service edit init" not
applying the given VM call mask to user processes started from RC
scripts during system startup.

In addition, this patch makes RS set a proper VM call mask for each
recovery script it spawns.

Change-Id: I520a30d85a0d3f3502d2b158293a2258825358cf
2013-08-08 23:22:58 +02:00
Antoine Leca
521de2a716 Env_memory_parse: move into VM
Only possible user of that function.
While here, fix bug about NR_MEMS vs MAXMEMMAP
NR_MEMS=16 is currently less than MAXMEMMAP=40; avoid overriding
2013-08-07 16:30:27 +00:00
Antoine Leca
84afb336d6 libexec: bug in debugging code
Change-Id: I8988a6a2d680e1afd0966bc8c90f1c34aee938ed
2013-08-06 11:46:40 +02:00
Antoine Leca
da82f9b2e8 <a.out.h>, MINIX style: remove as obsolete
Change-Id: Icc8b7210d60a93ac9cc4610d676dcba270756410
2013-08-06 11:43:35 +02:00