mirror of https://github.com/deadw00d/AROS.git
# slight tidy of the main base to prevent confusion. # disable the specific missing devices from acpi.
This commit is contained in:
parent
cac0d0b33d
commit
900950b844
|
@ -22,10 +22,11 @@ static ACPI_STATUS ACPIFoundCallback(ACPI_HANDLE handle, ULONG nesting_level,
|
|||
void *context, void **return_value)
|
||||
{
|
||||
IPTR *found = (IPTR *)return_value;
|
||||
IPTR mask = (IPTR)context;
|
||||
|
||||
D(bug("[i8042:ACPI] %s()\n", __func__));
|
||||
|
||||
*found = *found + 1;
|
||||
*found = *found | mask;
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
@ -47,14 +48,23 @@ static int init_i8042acpi(LIBBASETYPEPTR lh)
|
|||
ACPI_STATUS status;
|
||||
IPTR devicesfound = 0;
|
||||
|
||||
status = AcpiGetDevices("PNP0303", ACPIFoundCallback, NULL, (void **)&devicesfound);
|
||||
status = AcpiGetDevices("PNP0303", ACPIFoundCallback, (APTR)(1 << 0), (void **)&devicesfound);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
D(bug("[i8042:ACPI] %s: No PNP0303 PS/2 Keyboard found\n", __func__);)
|
||||
}
|
||||
status = AcpiGetDevices("PNP0F03", ACPIFoundCallback, NULL, (void **)&devicesfound);
|
||||
if (devicesfound & (1 << 0))
|
||||
{
|
||||
lh->csd.cs_Flags |= PS2F_DISABLEKEYB;
|
||||
}
|
||||
|
||||
status = AcpiGetDevices("PNP0F03", ACPIFoundCallback, (APTR)(1 << 1), (void **)&devicesfound);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
D(bug("[i8042:ACPI] %s: No PNP0F03 PS/2 Mouse found\n", __func__);)
|
||||
}
|
||||
if (devicesfound & (1 << 1))
|
||||
{
|
||||
lh->csd.cs_Flags |= PS2F_DISABLEMOUSE;
|
||||
}
|
||||
|
||||
if (devicesfound)
|
||||
{
|
||||
|
@ -66,7 +76,7 @@ static int init_i8042acpi(LIBBASETYPEPTR lh)
|
|||
|
||||
return TRUE;
|
||||
|
||||
ReturnInt("HIDD::Init", ULONG, TRUE);
|
||||
ReturnInt("i8042::ACPIInit", int, TRUE);
|
||||
}
|
||||
|
||||
ADD2INITLIB(init_i8042acpi, 0)
|
||||
ADD2INITLIB(init_i8042acpi, 20)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
include $(SRCDIR)/config/aros.cfg
|
||||
|
||||
FILES := i8042_acpi
|
||||
FILES := \
|
||||
i8042_acpi
|
||||
|
||||
USER_CPPFLAGS := -DAROS_USE_OOP \
|
||||
-D__OOP_NOLIBBASE__ \
|
||||
|
@ -9,6 +10,7 @@ USER_CPPFLAGS := -DAROS_USE_OOP \
|
|||
-D__OOP_NOMETHODBASES__ \
|
||||
-D__UTILITY_NOLIBBASE__ \
|
||||
-D__INLINE_ACPICA_STACKCALL__
|
||||
#USER_CPPFLAGS += -DDEBUG=1
|
||||
|
||||
USER_LDFLAGS := -static
|
||||
USER_INCLUDES := -I$(SRCDIR)/$(CURDIR) -I$(SRCDIR)/rom/hidds/i8042
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
##begin config
|
||||
basename i8042Kbd
|
||||
libbasetype struct kbdbase
|
||||
version 1.8
|
||||
libbasetype struct i8042base
|
||||
version 1.9
|
||||
residentpri 10
|
||||
superclass CLID_Hidd
|
||||
classptr_field ksd.kbdclass
|
||||
classptr_field csd.kbdclass
|
||||
classdatatype struct kbd_data
|
||||
oopbase_field ksd.cs_OOPBase
|
||||
seglist_field ksd.cs_SegList
|
||||
oopbase_field csd.cs_OOPBase
|
||||
seglist_field csd.cs_SegList
|
||||
##end config
|
||||
|
||||
##begin cdefprivate
|
||||
|
@ -27,7 +27,7 @@ Dispose
|
|||
basename i8042Mouse
|
||||
type hidd
|
||||
superclass CLID_Hidd
|
||||
classptr_field ksd.mouseclass
|
||||
classptr_field csd.mouseclass
|
||||
classdatatype struct mouse_data
|
||||
##end config
|
||||
|
||||
|
|
|
@ -16,39 +16,43 @@
|
|||
#undef HiddAttrBase
|
||||
#undef HWBase
|
||||
#undef OOPBase
|
||||
#define HiddAttrBase (LIBBASE->ksd.hiddAttrBase)
|
||||
#define HWBase (LIBBASE->ksd.hwMethodBase)
|
||||
#define OOPBase (LIBBASE->ksd.cs_OOPBase)
|
||||
#define HiddAttrBase (LIBBASE->csd.hiddAttrBase)
|
||||
#define HWBase (LIBBASE->csd.hwMethodBase)
|
||||
#define OOPBase (LIBBASE->csd.cs_OOPBase)
|
||||
|
||||
static int i8042_Init(struct kbdbase *LIBBASE)
|
||||
static int i8042_Init(struct i8042base * LIBBASE)
|
||||
{
|
||||
OOP_Object *kbd;
|
||||
OOP_Object *ms;
|
||||
ULONG initcnt = LIBBASE->library.lib_OpenCnt;
|
||||
|
||||
D(bug("[i8042] %s()\n", __func__));
|
||||
|
||||
kbd = OOP_NewObject(NULL, CLID_HW_Kbd, NULL);
|
||||
D(bug("[i8042] %s: %s @ %p\n", __func__, CLID_HW_Kbd, kbd));
|
||||
if (!kbd)
|
||||
if (!(LIBBASE->csd.cs_Flags & PS2F_DISABLEKEYB) && kbd)
|
||||
{
|
||||
/* This can be triggered by old base kickstart */
|
||||
D(bug("[i8042] %s: unable to create Keyboard class instance\n", __func__));
|
||||
return FALSE;
|
||||
D(bug("[i8042] %s: registering Keyboard hardware driver ..\n", __func__));
|
||||
if (HW_AddDriver(kbd, LIBBASE->csd.kbdclass, NULL))
|
||||
{
|
||||
D(bug("[i8042] %s: Keyboard driver installed\n", __func__));
|
||||
LIBBASE->library.lib_OpenCnt++;
|
||||
}
|
||||
}
|
||||
D(bug("[i8042] %s: registering Keyboard hardware driver ..\n", __func__));
|
||||
if (!HW_AddDriver(kbd, LIBBASE->ksd.kbdclass, NULL))
|
||||
else
|
||||
{
|
||||
D(bug("[i8042] %s: no Keyboard controller detected\n", __func__));
|
||||
return FALSE;
|
||||
D(
|
||||
bug("[i8042] %s: unable to create Keyboard class instance\n", __func__);
|
||||
)
|
||||
}
|
||||
LIBBASE->library.lib_OpenCnt = 1;
|
||||
|
||||
/* Mouse can be missing, it's not a failure */
|
||||
ms = OOP_NewObject(NULL, CLID_HW_Mouse, NULL);
|
||||
D(bug("[i8042] %s: %s @ %p\n", __func__, CLID_HW_Mouse, ms));
|
||||
if (ms)
|
||||
if (!(LIBBASE->csd.cs_Flags & PS2F_DISABLEMOUSE) && ms)
|
||||
{
|
||||
D(bug("[i8042] %s: registering Mouse hardware driver ..\n", __func__));
|
||||
if (HW_AddDriver(ms, LIBBASE->ksd.mouseclass, NULL))
|
||||
if (HW_AddDriver(ms, LIBBASE->csd.mouseclass, NULL))
|
||||
{
|
||||
D(bug("[i8042] %s: Mouse driver installed\n", __func__));
|
||||
LIBBASE->library.lib_OpenCnt++;
|
||||
|
@ -58,12 +62,11 @@ static int i8042_Init(struct kbdbase *LIBBASE)
|
|||
{
|
||||
D(
|
||||
bug("[i8042] %s: unable to create Mouse class instance\n", __func__);
|
||||
bug("[i8042] %s: # starting with Keyboard only\n", __func__);
|
||||
)
|
||||
}
|
||||
D(bug("[i8042] %s: finished\n", __func__));
|
||||
|
||||
return TRUE;
|
||||
return (initcnt < LIBBASE->library.lib_OpenCnt) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
ADD2INITLIB(i8042_Init, 10);
|
||||
|
|
|
@ -18,32 +18,32 @@
|
|||
#include "i8042_intern.h"
|
||||
|
||||
#undef OOPBase
|
||||
#define OOPBase (LIBBASE->ksd.cs_OOPBase)
|
||||
#define OOPBase (LIBBASE->csd.cs_OOPBase)
|
||||
|
||||
static int i8042Kbd_InitAttrs(struct kbdbase *LIBBASE)
|
||||
static int i8042Kbd_InitAttrs(struct i8042base * LIBBASE)
|
||||
{
|
||||
struct OOP_ABDescr attrbases[] =
|
||||
{
|
||||
{IID_Hidd , &LIBBASE->ksd.hiddAttrBase},
|
||||
{IID_Hidd_Kbd , &LIBBASE->ksd.hiddKbdAB },
|
||||
{IID_Hidd_Mouse, &LIBBASE->ksd.hiddMouseAB },
|
||||
{IID_Hidd , &LIBBASE->csd.hiddAttrBase},
|
||||
{IID_Hidd_Kbd , &LIBBASE->csd.hiddKbdAB },
|
||||
{IID_Hidd_Mouse, &LIBBASE->csd.hiddMouseAB },
|
||||
{NULL , NULL }
|
||||
};
|
||||
|
||||
D(bug("[i8042] %s()\n", __func__));
|
||||
|
||||
LIBBASE->ksd.cs_KernelBase = OpenResource("kernel.resource");
|
||||
if (!LIBBASE->ksd.cs_KernelBase)
|
||||
LIBBASE->csd.cs_KernelBase = OpenResource("kernel.resource");
|
||||
if (!LIBBASE->csd.cs_KernelBase)
|
||||
return FALSE;
|
||||
|
||||
LIBBASE->ksd.cs_UtilityBase = TaggedOpenLibrary(TAGGEDOPEN_UTILITY);
|
||||
if (!LIBBASE->ksd.cs_UtilityBase)
|
||||
LIBBASE->csd.cs_UtilityBase = TaggedOpenLibrary(TAGGEDOPEN_UTILITY);
|
||||
if (!LIBBASE->csd.cs_UtilityBase)
|
||||
return FALSE;
|
||||
|
||||
if (!OOP_ObtainAttrBases(attrbases))
|
||||
return FALSE;
|
||||
|
||||
LIBBASE->ksd.hwMethodBase = OOP_GetMethodID(IID_HW, 0);
|
||||
LIBBASE->csd.hwMethodBase = OOP_GetMethodID(IID_HW, 0);
|
||||
|
||||
D(bug("[i8042] %s: Initialization done\n", __func__));
|
||||
|
||||
|
@ -52,13 +52,13 @@ static int i8042Kbd_InitAttrs(struct kbdbase *LIBBASE)
|
|||
|
||||
/****************************************************************************************/
|
||||
|
||||
static int i8042Kbd_ExpungeAttrs(struct kbdbase *LIBBASE)
|
||||
static int i8042Kbd_ExpungeAttrs(struct i8042base * LIBBASE)
|
||||
{
|
||||
struct OOP_ABDescr attrbases[] =
|
||||
{
|
||||
{IID_Hidd , &LIBBASE->ksd.hiddAttrBase},
|
||||
{IID_Hidd_Kbd , &LIBBASE->ksd.hiddKbdAB },
|
||||
{IID_Hidd_Mouse, &LIBBASE->ksd.hiddMouseAB },
|
||||
{IID_Hidd , &LIBBASE->csd.hiddAttrBase},
|
||||
{IID_Hidd_Kbd , &LIBBASE->csd.hiddKbdAB },
|
||||
{IID_Hidd_Mouse, &LIBBASE->csd.hiddMouseAB },
|
||||
{NULL , NULL }
|
||||
};
|
||||
|
||||
|
@ -66,8 +66,8 @@ static int i8042Kbd_ExpungeAttrs(struct kbdbase *LIBBASE)
|
|||
|
||||
OOP_ReleaseAttrBases(attrbases);
|
||||
|
||||
if (!LIBBASE->ksd.cs_UtilityBase)
|
||||
CloseLibrary(LIBBASE->ksd.cs_UtilityBase);
|
||||
if (!LIBBASE->csd.cs_UtilityBase)
|
||||
CloseLibrary(LIBBASE->csd.cs_UtilityBase);
|
||||
|
||||
ReturnInt("i8042Kbd_ExpungeAttrs", int, TRUE);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
/***** Common static data *******************/
|
||||
|
||||
struct kbd_staticdata
|
||||
struct i8042_staticdata
|
||||
{
|
||||
OOP_Class *kbdclass;
|
||||
OOP_Object *kbdhidd;
|
||||
|
@ -28,17 +28,23 @@ struct kbd_staticdata
|
|||
struct Library *cs_OOPBase;
|
||||
struct Library *cs_UtilityBase;
|
||||
struct Interrupt cs_ResetInt;
|
||||
ULONG cs_Flags;
|
||||
};
|
||||
|
||||
struct kbdbase
|
||||
#define PS2B_DISABLEKEYB 0
|
||||
#define PS2F_DISABLEKEYB (1 << PS2B_DISABLEKEYB)
|
||||
#define PS2B_DISABLEMOUSE 1
|
||||
#define PS2F_DISABLEMOUSE (1 << PS2B_DISABLEMOUSE)
|
||||
|
||||
struct i8042base
|
||||
{
|
||||
struct Library library;
|
||||
struct kbd_staticdata ksd;
|
||||
struct i8042_staticdata csd;
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
#define XSD(cl) (&((struct kbdbase *)cl->UserData)->ksd)
|
||||
#define XSD(cl) (&((struct i8042base *)cl->UserData)->csd)
|
||||
|
||||
#undef HiddAttrBase
|
||||
#undef HiddKbdAB
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
/****************************************************************************************/
|
||||
|
||||
int ps2mouse_reset(struct kbdbase *csd, struct IORequest* tmr, struct mouse_data *);
|
||||
int ps2mouse_reset(struct i8042base *csd, struct IORequest* tmr, struct mouse_data *);
|
||||
|
||||
/****************************************************************************************
|
||||
* PS/2 Mouse Interrupt handler
|
||||
|
@ -226,7 +226,7 @@ void PS2Mouse_InitTask(OOP_Class *cl, OOP_Object *o)
|
|||
|
||||
D(bug("[i8042:PS2Mouse] attempting reset to detect mouse ...\n");)
|
||||
Disable();
|
||||
result = ps2mouse_reset((struct kbdbase *)cl->UserData, tmr, data);
|
||||
result = ps2mouse_reset((struct i8042base *)cl->UserData, tmr, data);
|
||||
Enable();
|
||||
|
||||
/* If no valid PS/2 mouse detected, release the IRQ */
|
||||
|
@ -364,7 +364,7 @@ static int ps2mouse_detectintellimouse(struct IORequest* tmr)
|
|||
|
||||
/****************************************************************************************/
|
||||
|
||||
static AROS_INTH1(PS2KBMResetHandler, struct kbdbase *, i8042Base)
|
||||
static AROS_INTH1(PS2KBMResetHandler, struct i8042base *, i8042Base)
|
||||
{
|
||||
AROS_INTFUNC_INIT
|
||||
|
||||
|
@ -377,7 +377,7 @@ static AROS_INTH1(PS2KBMResetHandler, struct kbdbase *, i8042Base)
|
|||
AROS_INTFUNC_EXIT
|
||||
}
|
||||
|
||||
int ps2mouse_reset(struct kbdbase *i8042Base, struct IORequest* tmr, struct mouse_data *data)
|
||||
int ps2mouse_reset(struct i8042base *i8042Base, struct IORequest* tmr, struct mouse_data *data)
|
||||
{
|
||||
int result, timeout = 100;
|
||||
|
||||
|
@ -466,11 +466,11 @@ int ps2mouse_reset(struct kbdbase *i8042Base, struct IORequest* tmr, struct mous
|
|||
D(bug("[i8042:PS2Mouse] Found and initialized PS/2 mouse!\n"));
|
||||
|
||||
// Install warm-reset handler
|
||||
i8042Base->ksd.cs_ResetInt.is_Node.ln_Name = i8042Base->library.lib_Node.ln_Name;
|
||||
i8042Base->ksd.cs_ResetInt.is_Node.ln_Pri = -10;
|
||||
i8042Base->ksd.cs_ResetInt.is_Code = (VOID_FUNC)PS2KBMResetHandler;
|
||||
i8042Base->ksd.cs_ResetInt.is_Data = i8042Base;
|
||||
AddResetCallback(&i8042Base->ksd.cs_ResetInt);
|
||||
i8042Base->csd.cs_ResetInt.is_Node.ln_Name = i8042Base->library.lib_Node.ln_Name;
|
||||
i8042Base->csd.cs_ResetInt.is_Node.ln_Pri = -10;
|
||||
i8042Base->csd.cs_ResetInt.is_Code = (VOID_FUNC)PS2KBMResetHandler;
|
||||
i8042Base->csd.cs_ResetInt.is_Data = i8042Base;
|
||||
AddResetCallback(&i8042Base->csd.cs_ResetInt);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
|
||||
include $(SRCDIR)/config/aros.cfg
|
||||
|
||||
FILES := i8042_init i8042_classinit i8042_kbdclass i8042_mouseclass i8042_common i8042_mouseps2
|
||||
USER_CPPFLAGS := \
|
||||
-D__OOP_NOLIBBASE__ \
|
||||
-D__OOP_NOATTRBASES__ \
|
||||
-D__OOP_NOMETHODBASES__
|
||||
|
||||
FILES := \
|
||||
i8042_init \
|
||||
i8042_classinit \
|
||||
i8042_kbdclass \
|
||||
i8042_mouseclass \
|
||||
i8042_common \
|
||||
i8042_mouseps2
|
||||
|
||||
%build_module mmake=kernel-hidd-i8042 \
|
||||
modname=i8042 modtype=hidd \
|
||||
files="$(FILES)" uselibs="hiddstubs" usesdks="private"
|
||||
|
|
Loading…
Reference in New Issue