コード例 #1
0
ファイル: fsam7400.c プロジェクト: ArthySundaram/firstrepo
static inline int fsam_map_memory(void)
{
   const unsigned long max_offset = BIOS_CODE_MAPSIZE - BIOS_SIGN_SIZE - PTR_POSITION;
   unsigned long offset;
   unsigned int addr;
   mem_code = ioremap(BIOS_CODE_ADDR, BIOS_CODE_MAPSIZE);
   if (!mem_code)
      goto fail;
   DEBUG_OUT3("physical memory %x-%x mapped to virtual address %p\n",
              BIOS_CODE_ADDR, BIOS_CODE_ADDR+BIOS_CODE_MAPSIZE, mem_code);
   for ( offset = 0; offset < max_offset; offset += ALLIGNED_STEP )
      if (check_signature((void*)TOUL(mem_code) + offset, bios_sign, BIOS_SIGN_SIZE))
         break;
   if (offset >= max_offset)
     goto fail;
   DEBUG_OUT1("bios signature found at offset %lx\n", offset);
   addr = readl((void*)TOUL(mem_code) + offset + PTR_POSITION);
   if (addr < BIOS_CODE_ADDR) {
      DEBUG_OUT0("bios routine out of memory range, "
                 "doing some new memory mapping...\n");
      iounmap(mem_code);
      mem_code = NULL;
      addr &= BIOS_CODE_ALT_MASK;
      mem_code = ioremap(addr, BIOS_CODE_ALT_MAPSIZE);
      if (!mem_code)
         goto fail;
      DEBUG_OUT3("physical memory %x-%x mapped to virtual address %p\n",
                 addr, addr+BIOS_CODE_ALT_MAPSIZE, mem_code);
      addr &= 0x3FFF;
   } else
     addr &= 0xFFFF;

   bios_code = addr + TOUL(mem_code);
   DEBUG_OUT1("supposed address of bios routine is %lx\n", bios_code);
   return 1;
 fail:
   fsam_unmap_memory();
   return 0;
}
コード例 #2
0
//
// cleaner object for a ValueFactory
// 
ValueFactoryCleaner::ValueFactoryCleaner (class CORBA::ValueFactoryBase* factory, char* repid)
: factory_ (factory), is_registered_(false), repid_(repid)
{
	int dummy = 0;
    CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0);

	// check whether there is already a factory
	if (orb->lookup_value_factory( repid ))
	{
		DEBUG_OUT3("..... factory for ", repid, " already registered");
	}
	else
	{
		DEBUG_OUT2( "..... register factory for ", repid );
		orb->register_value_factory( repid, factory_ );
		is_registered_ = true;
	}
}
コード例 #3
0
void
AssemblyImpl::build
()
throw( Components::CreateFailure )
{
	DEBUG_OUT2( "AssemblyImpl: build assembly for ", package_ );

	//
	// get data from descriptor file
    //
	CADReader reader;
	try 
	{
		reader.readCAD( package_, &data_, pathname_ );
	}
	catch( CADReadException ) 
	{
        throw Components::CreateFailure();
	}

	//
	// install implementations
	//
	install();

	//
	// instantiate components
	//
	instantiate();

	//
	// make connections
	//
	connect();

	//
	// start components
	//
	configurationComplete();
    
	DEBUG_OUT3( "AssemblyImpl: assembly for ", package_, " is running" );
}
コード例 #4
0
void
ComponentImplementation::install()
throw(Components::CreateFailure)
{
    //
	// if already installed increment counter only
	//
	if (installation_count_)
	{
		installation_count_++;
		DEBUG_OUT3( "..... already installed (", installation_count_, ")" );
		return;
	}

	//
	// if without package increment counter only
	//
	if (package_.empty())
	{
		installation_count_++;
		return;
	}

	//
	// create directories for the component implementation
	//
	makeDir(data_.installation_dir);
    makeDir(build_dir_);

	//
	// package may be component or composition
	//
	Package archive = Package( package_ );
    std::string xmlfile_name = archive.getFileNameWithSuffix( ".cad" );
    if ( xmlfile_name != std::string( "" ) )
	{
		//
		// get info from the assembly package
		//
		CADReader reader;
		try 
		{
			reader.readCAD( package_, &(data_.assembly), build_path_ );
		}
		catch( CADReadException ) 
		{
			std::cerr << "!!!!! Error during reading .cad" << std::endl;
			removeFileOrDirectory(data_.installation_dir);
			removeFileOrDirectory(build_dir_);
			throw Components::CreateFailure();
		}
		data_.assembly.cad = getFileName( xmlfile_name );
	}
	else
	{
		xmlfile_name = archive.getFileNameWithSuffix( ".csd" );

		//
		// get info from the software package
		//
		CSDReader reader;
		try 
		{
			reader.readCSD( package_, &data_, build_path_ );
		}
		catch( CSDReadException ) 
		{
			std::cerr << "!!!!! Error during reading .csd" << std::endl;
			removeFileOrDirectory(data_.installation_dir);
			removeFileOrDirectory(build_dir_);
			throw Components::CreateFailure();
		}
		data_.csd = getFileName( xmlfile_name );
	}

    //
	// install any code
	//
    try	
	{
		installCode();
	}
	catch( Components::CreateFailure )
	{
		removeFileOrDirectory(data_.installation_dir);
		removeFileOrDirectory(build_dir_);
        throw Components::CreateFailure();
	}

	// increment installation counter ( to 1 )
	installation_count_++;
}
コード例 #5
0
char*
RepDCIManagerSessionImpl::install(MDE::Deployment::Assembly_var ass){

	char * assUUID = ass->uuid();

	MDE::Deployment::Configuration_var cfg = ass->config();
	if ( CORBA::is_nil ( cfg ) ) {
		NORMAL_ERR("RepDCIManagerSessionImpl::install_with_archive(): assembly reference nil!");
		throw CORBA::SystemException();
	}

	//install on nodes
	DEBUG_OUT( "RepDCIManagerSessionImpl::install_with_archive(): install on nodes...");
    MDE::Deployment::InstallationSet* inst_set =cfg->install_dest();
	for ( unsigned long inst_set_idx = 0; inst_set_idx < inst_set->length(); inst_set_idx++ ) {
		MDE::Deployment::DeploymentUnit_var depl = (*inst_set)[inst_set_idx]->impl();
		string deplUUID = depl->uuid();
		string location("RepRef=");
		location += orb_->object_to_string(depl);
		DEBUG_OUT( "-----------------------------------------------------------------------------------");
		DEBUG_OUT3( deplUUID, " ", location);

		// for all destinations:
		CorbaIdlTypes::StringSet* dests = (*inst_set)[inst_set_idx]->destinations();
		for ( unsigned long dests_idx = 0; dests_idx < dests->length(); dests_idx++ ) {
			string destination((*dests)[dests_idx]);
			DEBUG_OUT2( "   install on node=", destination);
			//get NodeManager
			DCI::NodeManager_var node_manager_;
			try {
				node_manager_ = this->get_node_manager(destination.c_str());
			}
			catch(...) {
				throw (Components::Deployment::InstallationFailure());
			}
			// get ExtComponentInstallation
			::DCI::ExtComponentInstallation_var ext_comp_install;
//			::DCI::NodeInformation_var node_information;
			CORBA::Object_var obj_nm_;
			obj_nm_ = node_manager_->provide_facet("component_installation");	
			ext_comp_install = ::DCI::ExtComponentInstallation::_narrow ( obj_nm_ );
			if (CORBA::is_nil(ext_comp_install))
			{
				NORMAL_ERR("RepDCIManagerSessionImpl::install_with_archive(): ext_comp_install reference nil!");
				throw (Components::Deployment::InstallationFailure());
			};

			//check non-rep-aware-nodemanager
			DCI::RepNodeManager_var rnm = DCI::RepNodeManager::_narrow(node_manager_);
			if (CORBA::is_nil(rnm)) { 
				//non-rep-nodemanager
				DEBUG_OUT("RepDCIManagerSessionImpl::install_with_archive(): NON-REP-AWARE-NODEMANAGER");
				try {
					DEBUG_OUT2("RepDCIManagerSessionImpl::install_with_archive(): try to install without upload uuid=", deplUUID);
					ext_comp_install->install(deplUUID.c_str(), "");
				}
				catch(...) {
					//get component archieve
					string pathname = mda_etc_var_+"\\repo-files\\"+deplUUID+".ZIP";
					DEBUG_OUT2("RepDCIManagerSessionImpl::install_with_archive(): get component package ", pathname);
					DCI::AssemblyArchive archive;
					::RepUtils::get_file(pathname.c_str(), &archive);
					DEBUG_OUT2("RepDCIManagerSessionImpl::install_with_archive(): upload software package with uuid=", deplUUID);
					char * nmlocation = ext_comp_install->upload(deplUUID.c_str(), archive);
					DEBUG_OUT2("RepDCIManagerSessionImpl::install_with_archive(): install with location=", nmlocation);
					ext_comp_install->install(deplUUID.c_str(), nmlocation);
				}
			}
			else
			try 
				{
					//install
					DEBUG_OUT3("RepDCIManagerSessionImpl::install_with_archive(): try to install uuid/location=", deplUUID, location);
					ext_comp_install->install(deplUUID.c_str(), location.c_str());
				}
				catch (::Components::Deployment::InstallationFailure&)
				{
					NORMAL_ERR2("RepDCIManagerSessionImpl::install_with_archive(): InstallationFailure on node ", destination);
					throw (Components::Deployment::InstallationFailure());
				}
				catch (::Components::Deployment::InvalidLocation&)
				{
					NORMAL_ERR2("RepDCIManagerSessionImpl::install_with_archive(): InvalidLocation on node ", destination);
					throw (Components::Deployment::InvalidLocation());
				}
				catch (...)
				{
					NORMAL_ERR2("RepDCIManagerSessionImpl::install_with_archive(): ERROR on node ", destination);
					throw;
				}
		}
	}

	//Assembly is installed ("valid")
	ass->set_valid(true);

	return strdup(assUUID);
}
コード例 #6
0
void 
AssemblyImpl::tear_down ()
throw( Components::RemoveFailure )
{
	DEBUG_OUT2( "AssemblyImpl: tear down the application for ", package_ );

	//
	// use reverse start order to remove components
	//
	std::vector < std::string > ::reverse_iterator iter;
	std::map < std::string, Components::CCMObject_var > ::iterator instanceIter;
	Components::CCMObject_var comp;
	for(iter = data_.start_order_.rbegin();
		iter != data_.start_order_.rend();
		iter++ )
	{
		instanceIter = instanceMap_.find( *iter );
		if( instanceIter != instanceMap_.end() )
		{
			try
			{
				DEBUG_OUT2("..... remove ", instanceIter->first );
				comp = Components::CCMObject::_duplicate( instanceIter->second );
				comp->remove();
			}
			catch (CORBA::Exception&)
			{
				NORMAL_ERR2( "AssemblyImpl: EXCEPTION during removal of ", instanceIter->first );
			}

			instanceMap_.erase( instanceIter );
		}
	}

	//
	// call remove for all remaining components
	//
	for( instanceIter = instanceMap_.begin();
		 instanceIter != instanceMap_.end();
		 instanceIter++ )
	{
		try
		{
			DEBUG_OUT2( "..... remove ", instanceIter->first );
			instanceIter->second->remove();
		}
		catch (CORBA::Exception&)
		{
			NORMAL_ERR2( "AssemblyImpl: EXCEPTION during removal of ", instanceIter->first );
		}
	}

	instanceMap_.clear();

	//
	// remove homes/containers/servers
	//
	std::vector < HostData > ::iterator host_iter;
	std::vector < ProcessData > ::iterator process_iter;
	std::vector < HomeInstanceData > ::iterator home_iter;

	// for each host
	for(host_iter = data_.hosts_.begin();
		host_iter != data_.hosts_.end();
		host_iter++)
	{
		// for each processcollocation
		for(process_iter = (*host_iter).processes.begin(); 
			process_iter != (*host_iter).processes.end();
			process_iter++)
		{
			// for each homeplacement
			for(home_iter = (*process_iter).homes.begin();
				home_iter != (*process_iter).homes.end();
				home_iter++)
			{
				// remove home
				try
				{
					DEBUG_OUT2( "..... remove home ", (*home_iter).id );
					(*home_iter).container->remove_home(getHomeInstance((*home_iter).id));
				}
				catch (Components::RemoveFailure)
				{
					NORMAL_ERR2( "AssemblyImpl: remove home failure for ", (*home_iter).id );
				}
				catch (CORBA::Exception& e)
				{
					NORMAL_ERR2( "AssemblyImpl: EXCEPTION during removal of home ", (*home_iter).id );
#ifdef MICO_ORB
					e._print (std::cerr);
					std::cerr << std::endl;
#endif
				}

				// remove container
				try
				{
					DEBUG_OUT( "..... remove container" );
					(*home_iter).container->remove();
				}
				catch (Components::RemoveFailure)
				{
					NORMAL_ERR( "AssemblyImpl: remove container failure" );
				}
				catch (CORBA::Exception& e)
				{
					NORMAL_ERR( "AssemblyImpl: EXCEPTION during removal of container" );
#ifdef MICO_ORB
					e._print (std::cerr);
					std::cerr << std::endl;
#endif
				}
			}

			// remove component server
			try
			{
				DEBUG_OUT( "..... remove component server" );
				(*process_iter).server->remove();
			}
			catch (Components::RemoveFailure)
			{
				NORMAL_ERR( "AssemblyImpl: remove component server failure");
			}
			catch (CORBA::Exception& e)
			{
				NORMAL_ERR( "AssemblyImpl: EXCEPTION during removal of container" );
#ifdef MICO_ORB
				e._print (std::cerr);
				std::cerr << std::endl;
#endif
			}
		}
	}

	homeMap_.clear();

	//
	// uninstall
	//
	uninstall();

	DEBUG_OUT3( "application for ", package_, " is teared down and uninstalled" );
}