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 ModePID/Data Monitor Inspection [Instrument Cluster]
1. Connect the M-MDS (IDS) to the DLC-2.
2. After the vehicle is identified, select the following items from the initialization
screen of the IDS.
a. Select “DataLogger”.
b. Select “Modules”.
c. Select “IC”.
3. Select the applicable PID from the PID table.
4. Verify the PID data ac ...
Engine Coolant Temperature (ECT) Sensor Removal/Installation [Mzr 2.0, Mzr 2.5]
WARNING:
When the engine is hot, it can badly burn. Turn off the engine and wait until
it is cool before removing the ECT sensor.
ECT Sensor No.1
1. Remove the battery cover..
2. Disconnect the negative battery cable..
3. Drain the engine coolant..
4. Remove the battery and b ...
Camshaft Position (CMP) Sensor Removal/Installation [Mzr 2.0, Mzr 2.5]
CAUTION:
When replacing the CMP sensor, make sure there is no foreign material on
it such as metal shavings. If it is installed with foreign material, the sensor
output signal will malfunction resulting from fluctuation in magnetic flux and
cause a deterioration in engine control.
...