3 * Manes Initializer implementation
5 * Copyright (C) 2008-2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "cds/creator.h"
28 #include "services/server.h"
29 #include "services/tty_logger.h"
30 #include "services/early_logger.h"
31 #include "services/timer.h"
32 #include "services/unmangler.h"
33 #include "services/stats.h"
34 #include "services/interrupt_manager.h"
35 #include "services/kernel_state.h"
36 #include "services/asynch_tasks.h"
38 #include "resources/isa.h"
39 #include "resources/pci.h"
40 #include "resources/keybscr.h"
41 #include "resources/fdc.h"
42 #include "resources/fat.h"
43 #include "resources/speaker.h"
44 #include "resources/foma.h"
45 #include "resources/slob.h"
46 #include "resources/uhci.h"
47 #include "resources/file.h"
48 #include "resources/unknown.h"
49 #include "resources/virtual_bus.h"
50 #include "resources/usb_mass_storage.h"
51 #include "resources/pio.h"
52 #include "resources/physmem.h"
53 #include "resources/ne2k.h"
54 #include "resources/usb.h"
55 #include "resources/rtl8139.h"
57 #include "modules/loader.h"
58 #include "modules/module.h"
59 #include "modules/elf.h"
61 #include "actors/roundrobin.h"
62 #include "actors/actor.h"
64 using namespace manes
;
65 using namespace manes::cds
;
67 extern p
<resources::memm
> allocator
;
69 p
<manei
> manei::instance
= p
<manei
>::invalid
;
71 p
<manei
> manei::get() {
72 if (!instance
.valid())
77 void manei::launch_manes() {
79 types
= new factory(new type(component_name::from_path("/type,factory"), component_name::invalid
, delegate
<p
<component
> >()));
80 main
->initialize(types
);
84 void manei::register_creators() {
86 services::server::register_type();
89 modules::loader::register_type();
92 actors::roundrobin::register_type();
97 resources::slob::register_type();
100 resources::foma::register_type();
103 resources::physmem::register_type();
106 resources::isa::register_type();
109 resources::pci::register_type();
112 resources::virtual_bus::register_type();
115 void manei::register_builtin_types() {
116 /* ---- SERVICES ---- */
119 services::early_logger::register_type();
122 services::tty_logger::register_type();
125 services::timer::register_type();
128 services::unmangler::register_type();
131 services::stats::register_type();
133 /* interrupt_manager */
134 services::interrupt_manager::register_type();
137 services::kernel_state::register_type();
140 services::asynch_tasks::register_type();
142 /* ---- DEVICES ---- */
145 resources::keybscr::register_type();
148 resources::fdc::register_type();
151 resources::speaker::register_type();
154 resources::pio::register_type();
157 resources::ne2k::register_type();
160 resources::usb::register_type();
163 resources::uhci::register_type();
166 resources::unknown::register_type();
169 resources::rtl8139::register_type();
171 /* usb mass storage */
172 resources::usb_mass_storage::register_type();
174 /* ---- FILE SYSTEMS ---- */
175 resources::fat::register_type();
177 resources::file::register_type();
179 /* ---- ACTORS ---- */
180 actors::actor::register_type();
182 /* ---- MODULES ---- */
183 modules::module::register_type();
185 modules::elf::register_type();
188 void manei::animate_creators() {
190 main
->new_component(component_name::from_path("/type,server")).cast
<creator
>()->initialize();
192 kstate
= main
->new_component(component_name::from_path("/type,kernel_state")).cast
<services::kernel_state
>();
194 main
->new_component(component_name::from_path("/type,physmem"));//.cast<resources::memm>()->initialize();
197 allocator
= main
->new_component(component_name::from_path("/type,foma")).cast
<resources::memm
>();
200 main
->new_component(component_name::from_path("/type,loader")).cast
<creator
>()->initialize();
202 /* animate isa - main bus */
203 main
->new_component(component_name::from_path("/type,isa")).cast
<creator
>()->initialize();
206 main
->new_component(component_name::from_path("/type,pci")).cast
<creator
>()->initialize();
208 /* animate virtual_bus */
209 main
->new_component(component_name::from_path("/type,virtual_bus")).cast
<creator
>()->initialize();
211 /* animate fat - main fs (temp) */
212 main
->new_component(component_name::from_path("/type,fat")).cast
<creator
>()->initialize();
214 /* animate director */
215 main
->new_component(component_name::from_path("/type,director")).cast
<creator
>()->initialize();
218 p
<root
> manei::get_root() {
222 p
<services::kernel_state
> manei::state() {