1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup rtems_bsd_rtems |
---|
5 | * |
---|
6 | * @brief TODO. |
---|
7 | */ |
---|
8 | |
---|
9 | /*- |
---|
10 | * Copyright (c) 2012-2013 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Dornierstr. 4 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * Redistribution and use in source and binary forms, with or without |
---|
19 | * modification, are permitted provided that the following conditions |
---|
20 | * are met: |
---|
21 | * 1. Redistributions of source code must retain the above copyright |
---|
22 | * notice, this list of conditions, and the following disclaimer, |
---|
23 | * without modification, immediately at the beginning of the file. |
---|
24 | * 2. The name of the author may not be used to endorse or promote products |
---|
25 | * derived from this software without specific prior written permission. |
---|
26 | * |
---|
27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR |
---|
31 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
37 | * SUCH DAMAGE. |
---|
38 | */ |
---|
39 | |
---|
40 | #include <machine/rtems-bsd-kernel-space.h> |
---|
41 | |
---|
42 | #include <sys/param.h> |
---|
43 | #include <sys/bus.h> |
---|
44 | |
---|
45 | #include <rtems/bsd.h> |
---|
46 | |
---|
47 | int |
---|
48 | rtems_bsd_bus_root_attach(void) |
---|
49 | { |
---|
50 | int err; |
---|
51 | device_t dev; |
---|
52 | |
---|
53 | dev = device_find_child(root_bus, "nexus", 0); |
---|
54 | if (dev != NULL) { |
---|
55 | err = device_probe_and_attach(dev); |
---|
56 | } else { |
---|
57 | err = ENOENT; |
---|
58 | } |
---|
59 | |
---|
60 | return (err); |
---|
61 | } |
---|
62 | |
---|
63 | int |
---|
64 | rtems_bsd_bus_root_suspend(void) |
---|
65 | { |
---|
66 | |
---|
67 | return (DEVICE_SUSPEND(root_bus)); |
---|
68 | } |
---|
69 | |
---|
70 | int |
---|
71 | rtems_bsd_bus_root_resume(void) |
---|
72 | { |
---|
73 | |
---|
74 | return (DEVICE_RESUME(root_bus)); |
---|
75 | } |
---|
76 | |
---|
77 | int |
---|
78 | rtems_bsd_bus_root_detach(void) |
---|
79 | { |
---|
80 | int err; |
---|
81 | device_t dev; |
---|
82 | |
---|
83 | dev = device_find_child(root_bus, "nexus", 0); |
---|
84 | if (dev != NULL) { |
---|
85 | err = device_detach(dev); |
---|
86 | } else { |
---|
87 | err = ENOENT; |
---|
88 | } |
---|
89 | |
---|
90 | return (err); |
---|
91 | } |
---|