Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FrameworkWindowsUtils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dustin L. Howett
FrameworkWindowsUtils
Commits
9ad7eae5
Commit
9ad7eae5
authored
3 years ago
by
Dustin L. Howett
Browse files
Options
Downloads
Patches
Plain Diff
ec: add some ioctls (cmd, readmem)
parent
6a31048f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CrosEC/Public.h
+5
-0
5 additions, 0 deletions
CrosEC/Public.h
CrosEC/Queue.c
+46
-0
46 additions, 0 deletions
CrosEC/Queue.c
with
51 additions
and
0 deletions
CrosEC/Public.h
+
5
−
0
View file @
9ad7eae5
...
...
@@ -22,3 +22,8 @@ Environment:
DEFINE_GUID
(
GUID_DEVINTERFACE_CrosEC
,
0xd66bb4f8
,
0x0a7a
,
0x4f89
,
0x90
,
0x33
,
0x79
,
0x8a
,
0xff
,
0xa4
,
0xf5
,
0x38
);
// {d66bb4f8-0a7a-4f89-9033-798affa4f538}
#define FILE_DEVICE_CROS_EMBEDDED_CONTROLLER 0x80EC
#define IOCTL_CROSEC_XCMD CTL_CODE(FILE_DEVICE_CROS_EMBEDDED_CONTROLLER, 0x801, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
#define IOCTL_CROSEC_RDMEM CTL_CODE(FILE_DEVICE_CROS_EMBEDDED_CONTROLLER, 0x802, METHOD_BUFFERED, FILE_READ_DATA)
This diff is collapsed.
Click to expand it.
CrosEC/Queue.c
+
46
−
0
View file @
9ad7eae5
...
...
@@ -17,6 +17,8 @@ Environment:
#include
"driver.h"
#include
"queue.tmh"
#include
"EC.h"
#ifdef ALLOC_PRAGMA
#pragma alloc_text (PAGE, CrosECQueueInitialize)
#endif
...
...
@@ -118,6 +120,50 @@ Return Value:
"%!FUNC! Queue 0x%p, Request 0x%p OutputBufferLength %d InputBufferLength %d IoControlCode %d"
,
Queue
,
Request
,
(
int
)
OutputBufferLength
,
(
int
)
InputBufferLength
,
IoControlCode
);
WDFDEVICE
device
=
WdfIoQueueGetDevice
(
Queue
);
PDEVICE_CONTEXT
deviceContext
=
DeviceGetContext
(
device
);
switch
(
IoControlCode
)
{
case
IOCTL_CROSEC_XCMD
:
{
struct
cros_ec_command_v2
*
cmd
;
size_t
cmdLen
;
WdfRequestRetrieveInputBuffer
(
Request
,
sizeof
(
cmd
),
(
PVOID
*
)
&
cmd
,
&
cmdLen
);
RtlZeroMemory
(
deviceContext
->
inflightCommand
,
0x200
/*TODO*/
);
memcpy
(
deviceContext
->
inflightCommand
,
cmd
,
InputBufferLength
);
int
res
=
ECSendCommandLPCv3
(
device
,
cmd
->
command
,
cmd
->
version
,
cmd
->
data
,
cmd
->
outsize
,
deviceContext
->
inflightCommand
->
data
,
cmd
->
insize
);
if
(
res
>
0
)
{
deviceContext
->
inflightCommand
->
insize
=
res
;
res
=
0
;
// propagate it to the client
}
deviceContext
->
inflightCommand
->
result
=
res
;
int
requiredReplySize
=
sizeof
(
struct
cros_ec_command_v2
)
+
deviceContext
->
inflightCommand
->
insize
;
WDFMEMORY
OutputMem
;
WdfRequestRetrieveOutputMemory
(
Request
,
&
OutputMem
);
WdfMemoryCopyFromBuffer
(
OutputMem
,
0
,
deviceContext
->
inflightCommand
,
min
(
requiredReplySize
,
OutputBufferLength
));
WdfRequestSetInformation
(
Request
,
requiredReplySize
);
break
;
}
case
IOCTL_CROSEC_RDMEM
:
{
struct
cros_ec_readmem_v2
*
rq
;
WdfRequestRetrieveInputBuffer
(
Request
,
sizeof
(
*
rq
),
(
PVOID
*
)
&
rq
,
NULL
);
ECReadMemoryLPC
(
device
,
rq
->
offset
,
rq
->
buffer
,
rq
->
bytes
);
struct
cros_ec_readmem_v2
*
rs
;
WdfRequestRetrieveOutputBuffer
(
Request
,
sizeof
(
*
rs
),
(
PVOID
*
)
&
rs
,
NULL
);
memcpy
(
rs
,
rq
,
sizeof
(
rs
));
WdfRequestSetInformation
(
Request
,
sizeof
(
*
rs
));
break
;
}
default:
WdfRequestComplete
(
Request
,
STATUS_INVALID_PARAMETER
);
return
;
}
WdfRequestComplete
(
Request
,
STATUS_SUCCESS
);
return
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment