User talk:MrNuke/Block Device API: Difference between revisions

From coreboot
Jump to navigation Jump to search
(Created page with "== Ideas for generic handling of devices == IMPORTANT! Feel free to edit this page to share your thoughts and ideas. This is the official MMC open brainstorming page. === Pr...")
 
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
  void (*power)(int); /* power mgt: power(1) ? on, power (0) ? off */
  void (*power)(int); /* power mgt: power(1) ? on, power (0) ? off */
  };
  };
==== Comments ====
This API is too big and too powerful for the needs of coreboot. It will need to be trimmed to present a coreboot-centric (simpler) interface.


==== Questions ====
==== Questions ====
Line 33: Line 37:
#* think "Device specfic storage drivers -> [*] Allwinner A10 MMC driver" in '''libpayload''' config
#* think "Device specfic storage drivers -> [*] Allwinner A10 MMC driver" in '''libpayload''' config
# More questions coming soon (TM)
# More questions coming soon (TM)
==== Resources ====
* Existing, but not merged, MMC code for cubieboard: [https://github.com/mrnuke/coreboot/commits/cubie_mmc mrnuke's github branch]

Latest revision as of 20:11, 6 March 2014

Ideas for generic handling of devices

IMPORTANT! Feel free to edit this page to share your thoughts and ideas. This is the official MMC open brainstorming page.

Proposal 1: Unified API

Chan is an IO channel.

This struct is used in Inferno and has been for a long time; so it works. It's also in the opcodes somewhat like what we did for EMMC on ARM.

struct Dev
{
	char*	name;
	void	(*reset)(void);
	void	(*init)(void);
	void	(*shutdown)(void);
	Chan*	(*attach)(char*); /* tell the device you want to use it */
	Walkqid*	(*walk)(Chan*, Chan*, char**, int); /* walk to a name in the device's managed name space; return a handle */
	int	(*stat)(Chan*, uchar*, int); // status info
	Chan*	(*open)(Chan*, int); /* get access to a resource in the device name space */
	void	(*close)(Chan*); /* tell it you are done with whatever it is. */
	long	(*read)(Chan*, void*, long, vlong);
	long	(*write)(Chan*, void*, long, vlong);
	void	(*power)(int);	/* power mgt: power(1) ? on, power (0) ? off */
};

Comments

This API is too big and too powerful for the needs of coreboot. It will need to be trimmed to present a coreboot-centric (simpler) interface.

Questions

  1. Do we want to expose or hide the block nature of some devces (i.e. force reading multiples of blocksize, or allow reading any number of bytes, with no alignment requirement) ?
  2. How do we connect the dots, such that most of the details can be handled transparently ?
  3. How simple or complex do we want the API to be such that it can work in any stage (including bootblock, assuming some SRAM and a stack are available) ?
  4. Can we integrate this into libpayload such that the same sources can be used for both coreboot and libpayload ?
    • think "Device specfic storage drivers -> [*] Allwinner A10 MMC driver" in libpayload config
  5. More questions coming soon (TM)

Resources