> > > > Currently kernel thread seems broken, so mallocing storage in
> > > > acpi_queue_event() never be freed.  I think number of events at a
> > > > point of tme is limited and we can have static storage for the events.
> > > > The implementaion of sys/i386/apm/apm.c:apm_record_event() (it's for apmd)
> > > > would be a good example.
> > > 
> > > I have a megapatch for acpi.c that I am nearly ready to commit which 
> > > converts it to use bus resources for all I/O allocations.  I'll fix this 
> > > in there, if you like.
> > 
> > I'm interested in your patch.  Can I see it?
> Sure.  I'm not 100% sure it's going to work right, so please feel free 
> to tell me I've broken something...

I've just tried the patch, GREAT!  it seems working for me perfectly w/o
any functional changes, much better than before.  I'll do testing more.

I have some comments;
# most of them is not related with your patch :-) but I'd like to
# consult with you.

Can we separate the code which uses FreeBSD specific APIs and structs
into a other file or arrange them at one place?
Because I'm going to merge NetBSD porting effort, I want to avoid having
too many #ifdef __FreeBSD__.  The patch is available at

Because of above reason, 
 * Debugging, console output
 * XXX this should really be using device_printf
extern int acpi_debug;
#define ACPI_DEVPRINTF(args...)         printf("acpi0: " args)

I don't use device_printf() here.
# Also we don't have more than 2 instances of acpi :-)

static void
acpi_trans_sleeping_state(acpi_softc_t *sc, u_int8_t state)
        /* XXX should be MI */
        /* XXX should always be called with interrupts enabled! */
        ef = read_eflags();

for this, I referred the comments in ACPI spec 7.5.2.
// Required environment:  Executing on the system boot
// processor.  All other processors stopped.  Interrupts <--
// disabled.  All Power Resources (and devices) are in
// corresponding device state to support NewState.

I don't know much about IA64, I'm not sure {read|write}_eflags()
inline functions will be available on IA64.  Should we replace them
with save_intr() and restore_intr() ?  because seems more general.

Also we need to consider SMP.  There is no hack for it so far.
# I think APM BIOS Call need to be executed on the system boot
# processor too.

acpi_soft_off(void *data, int howto)
        /* XXX Disable GPE intrrupt,or power on again in some machine */
        acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &vala);
        acpi_io_gpe1_enable(sc, ACPI_REGISTER_OUTPUT, &vala);

This still give no effect on my PORTEGE.  I think this should be done
in earlier phase.  Maybe we'd better to have acpi_disable_events() and
call this at shutdown_pre_sync (or some such) for shutdown -p, also
call this in acpi_set_sleeping_state() for power button/acpiconf -s 5.

acpi_intr(void *data)
#if 0
                /* Clear interrupt status */
                val = enable;   /* XXX */
                acpi_io_gpe0_status(sc, ACPI_REGISTER_OUTPUT, &val);

                /* Re-enable interrupt */
                acpi_io_gpe0_enable(sc, ACPI_REGISTER_OUTPUT, &enable);

                acpi_debug = 0;         /* Shut up again */

GPE1 too, right? :-)

acpi_attach(device_t dev)
                sc->iores[i].rsc = bus_alloc_resource(dev, SYS_RES_IOPORT, 
                                                      0, ~0, 1, RF_ACTIVE);
I didn't understand clearly for long time, but this give us more
flexibility w/o problems if we call bus_set_resource() and set count
correctly, right?

        acpi_enable_disable(sc, 1);
        acpi_intr((void *)sc);

Should we remove them and have acpi_enalbe="YES" in /etc/rc.conf just line APM ?

And last thing, how about header file name and location?
some poeple suggested that
/sys/dev/acpi/acpi.h should be renamed to acpivar.h.  And
/sys/sys/acpi.h should be moved to /sys/dev/acpi.h (installed in
/usr/include/dev/acpi/acpi.h).  We didn't care and are not interested
in this matter at all so far, but it seems quite reasonable for me and
doesn't hurt anything.

And *real* last thing :-)

msmith> the code in machdep.c.  Everything will move to acpi_machdep.c  I'll also 
msmith> be deleting <machine/acpi.h>, as it's not necessary (and never was).

I think better to wait deleting until IA64 porting.  I'm not sure if
this file really unnecessary or not.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to