*参照元 [#k0468d07]
#backlinks

*説明 [#kd36d210]
-パス: [[linux-2.6.33/char/agp/generic.c]]
-パス: [[linux-2.6.33/drivers/char/agp/generic.c]]

-FIXME: これは何?
--説明


**引数 [#ffab187b]
-struct agp_bridge_data *bridge
--
--[[linux-2.6.33/agp_bridge_data]]
-size_t page_count
--
-u32 type
--


**返り値 [#nc6370ae]
-struct agp_memory *
--
--[[linux-2.6.33/agp_memory]]


**参考 [#l67c5b8c]


*実装 [#h22dd96a]
 /**
  *	agp_allocate_memory  -  allocate a group of pages of a certain type.
  *
  *	@page_count:	size_t argument of the number of pages
  *	@type:	u32 argument of the type of memory to be allocated.
  *
  *	Every agp bridge device will allow you to allocate AGP_NORMAL_MEMORY which
  *	maps to physical ram.  Any other type is device dependent.
  *
  *	It returns NULL whenever memory is unavailable.
  */
 struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
 					size_t page_count, u32 type)
 {
 	int scratch_pages;
 	struct agp_memory *new;
 	size_t i;
 
 	if (!bridge)
 		return NULL;
 
 	if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp)
 		return NULL;
 
-
--[[linux-2.6.33/atomic_read()]]

 	if (type >= AGP_USER_TYPES) {
 		new = agp_generic_alloc_user(page_count, type);
 		if (new)
 			new->bridge = bridge;
 		return new;
 	}
 
-
--[[linux-2.6.33/AGP_USER_TYPES]]
-
--[[linux-2.6.33/agp_generic_alloc_user()]]

 	if (type != 0) {
 		new = bridge->driver->alloc_by_type(page_count, type);
 		if (new)
 			new->bridge = bridge;
 		return new;
 	}
 
-bridge->driver は agp_bridge_driver 型のメンバ
--[[linux-2.6.33/agp_bridge_driver]]

 	scratch_pages = (page_count + ENTRIES_PER_PAGE - 1) / ENTRIES_PER_PAGE;
 
 	new = agp_create_memory(scratch_pages);
 
 	if (new == NULL)
 		return NULL;
 
-
--[[linux-2.6.33/ENTRIES_PER_PAGE]]
-
--[[linux-2.6.33/agp_create_memory()]]

 	if (bridge->driver->agp_alloc_pages) {
 		if (bridge->driver->agp_alloc_pages(bridge, new, page_count)) {
 			agp_free_memory(new);
 			return NULL;
 		}
 		new->bridge = bridge;
 		return new;
 	}
 
-
--[[linux-2.6.33/agp_free_memory()]]

 	for (i = 0; i < page_count; i++) {
 		struct page *page = bridge->driver->agp_alloc_page(bridge);
 
 		if (page == NULL) {
 			agp_free_memory(new);
 			return NULL;
 		}
 		new->pages[i] = page;
 		new->page_count++;
 	}
 	new->bridge = bridge;
 
 	return new;
 }
 EXPORT_SYMBOL(agp_allocate_memory);
-モジュールのライセンスに関係なくシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]


*コメント [#j37f849e]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS