在 2013-03-19二的 10:15 +0000,Peter Maydell写道: > On 19 March 2013 09:31, li guang <lig.f...@cn.fujitsu.com> wrote: > > 在 2013-03-19二的 09:05 +0000,Peter Maydell写道: > >> I suspect this should involve more modelling of actual > >> control signals between the power controller and > >> the devices, not methods on the base class. > >> > > > > do we have to realize something like signals which are actually > > only some copper wires? > > I think we just emulate the real work, that is when some signals > > asserted, we just call corresponding method to do something > > by these embedded method, I want to let devices take care > > of power event(on/off/suspend/wakeup) themselves. > > The point is that how exactly power controllers connect > to devices, and which devices respond to reset/suspend/etc > is a property of the individual machine being modelled. > An x86 PC will be different from an ARM devboard which is > different again from the Exynos4 ARM SoC. So to allow this > flexibility, you have to let the machine model do the configuration, > which you do by having the model wire up the power controller > to the devices in the same way it's done on hardware.
agree, originally, I made all devices can realize the power state callbacks, e.g. if one can do suspend, then it will realize DeviceState::suspend, so if system go to suspend, this method will be called. do you want some explicit way to configure for machine's devices if they can support power state changes? > > >> > I'm eager to get more comments and discussion. > >> > This idea simply based on system board design convention, > >> > I'm not saying a power chip has signals directly connected > >> > to all devices, I mean system board and its devices should > >> > have protocol to deal with power state changes. > >> > >> Hardware does it with signals, so should we. > > > > can these signals be viewed as the calling of corresponding methods? > > In some ways, they are -- but the wiring up of the source of > the call to the implementation is done at runtime as devices > are connected together. So, can I go ahead to do this work? Thanks! Li Guang