If the selector lever will not move from P using the proper shift procedure, continue to hold down the brake pedal.

Take the vehicle to an Authorized Mazda Dealer to have the system checked.
Shift-Lock System
Manual Shift ModeHydraulic Variable Valve Timing Actuator Inspection [Skyactiv G 2.0]
WARNING:
A hot engine can cause severe burns. Turn off the engine and wait until it
is cool before servicing.
CAUTION:
Do not disassemble the hydraulic variable valve timing actuator because it
is a precision unit.
1. Remove the battery cover..
2. Disconnect the n ...
Ignition Switch Inspection [Without Advanced Keyless Entry And Push Button Start
System]
1. Disconnect the negative battery cable..
2. Remove the column cover..
3. Remove the ignition switch..
4. Verify that the continuity between the ignition switch terminals is as indicated
in the table.
If not as indicated in the table, replace the ignition switch.
...
Body Control Module (Bcm) Inspection
1. Remove the following parts:
a. Front scuff plate (LH).
b. Front side trim (LH).
c. Upper panel.
d. Shift knob (MTX).
e. Selector lever knob (ATX).
f. Shift panel.
g. Side wall.
h. Console.
2. Set the hood release lever out of the way..
3. Remove the lower panel. (driver-side). ...